From ffb1a46fc14fdf3b3ee556733216dd9bba2fcb2e Mon Sep 17 00:00:00 2001 From: SarahW Date: Sun, 15 May 2016 11:58:58 +0100 Subject: [PATCH] Brought Linux GUI up to date. --- src/Makefile.am | 2 +- src/allegro-gui-configure.c | 107 ++++++++---- src/allegro-gui-deviceconfig.c | 303 +++++++++++++++++++++++++++++++++ src/allegro-gui-hdconf.c | 207 ++++++++++++++++++---- src/allegro-gui.c | 2 +- src/allegro-gui.h | 2 + 6 files changed, 557 insertions(+), 66 deletions(-) create mode 100644 src/allegro-gui-deviceconfig.c diff --git a/src/Makefile.am b/src/Makefile.am index c7b02f7..e84966d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,7 +15,7 @@ pcem_CFLAGS = $(allegro_CFLAGS) pcem_LDADD = $(allegro_LIBS) -lopenal -lalut pcem_SOURCES = 386.c 386_dynarec.c 386_dynarec_ops.c 808x.c acer386sx.c ali1429.c allegro-gui.c \ -allegro-gui-configure.c allegro-gui-hdconf.c allegro-joystick.c allegro-keyboard.c allegro-main.c \ +allegro-gui-configure.c allegro-gui-deviceconfig.c allegro-gui-hdconf.c allegro-joystick.c allegro-keyboard.c allegro-main.c \ allegro-midi.c allegro-mouse.c allegro-video.c amstrad.c cdrom-ioctl-linux.c cdrom-iso.c cdrom-null.c \ codegen.c codegen_ops.c codegen_timing_486.c codegen_timing_686.c codegen_timing_pentium.c codegen_timing_winchip.c compaq.c config.c cpu.c \ dac.c device.c disc.c disc_fdi.c disc_img.c disc_sector.c dma.c fdc.c fdc37c665.c fdd.c fdi2raw.c gameport.c \ diff --git a/src/allegro-gui-configure.c b/src/allegro-gui-configure.c index 832ae36..a5c07e4 100644 --- a/src/allegro-gui-configure.c +++ b/src/allegro-gui-configure.c @@ -1,4 +1,5 @@ #include "ibm.h" +#include "device.h" #include "allegro-main.h" #include "allegro-gui.h" #include "cpu.h" @@ -6,39 +7,11 @@ #include "model.h" #include "sound.h" #include "video.h" +#include "vid_voodoo.h" static int romstolist[ROM_MAX], listtomodel[ROM_MAX], romstomodel[ROM_MAX], modeltolist[ROM_MAX]; static int settings_sound_to_list[20], settings_list_to_sound[20]; -#if 0 - DEFPUSHBUTTON "OK",IDOK,64,232,50,14, WS_TABSTOP - PUSHBUTTON "Cancel",IDCANCEL,128,232,50,14, WS_TABSTOP - COMBOBOX IDC_COMBO1,62,16,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBOVID,62,36,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure", IDC_CONFIGUREVID, 224, 36, 40, 14, WS_TABSTOP - COMBOBOX IDC_COMBOCPUM,62,56,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO3,62,76,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBOCHC,62,96,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBOSPD,62,116,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBOSND,62,136,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure", IDC_CONFIGURESND, 224, 136, 40, 14, WS_TABSTOP - EDITTEXT IDC_MEMTEXT, 62, 152, 36, 14, ES_AUTOHSCROLL | ES_NUMBER - CONTROL "", IDC_MEMSPIN, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_SETBUDDYINT, 98, 152, 12, 14 - LTEXT "MB", IDC_STATIC, 98, 152, 40, 10 - CONTROL "CMS / Game Blaster",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,172,118,10 - CONTROL "Gravis Ultrasound",IDC_CHECKGUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,188,118,10 - CONTROL "Innovation SSI-2001",IDC_CHECKSSI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,204,118,10 - CONTROL "Composite CGA",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,220,118,10 - LTEXT "Machine :",IDC_STATIC,15,16,40,10 - LTEXT "Video :",IDC_STATIC,15,36,34,10 - LTEXT "CPU type :",IDC_STATIC,15,56,34,10 - LTEXT "CPU :",IDC_STATIC,15,76,34,10 - LTEXT "Cache :",IDC_STATIC,15,96,40,10 - LTEXT "Video speed :",IDC_STATIC,15,116,40,10 - LTEXT "Soundcard :",IDC_STATIC,15,136,40,10 - LTEXT "Memory :",IDC_STATIC,15,156,40,10 -#endif - typedef struct allegro_list_t { char name[256]; @@ -217,14 +190,30 @@ static char *list_proc_fdd(int index, int *list_size) return fdd_list[index].name; } +static int voodoo_config_proc(int msg, DIALOG *d, int c) +{ + int ret = d_button_proc(msg, d, c); + + if (ret == D_CLOSE) + { + deviceconfig_open(&voodoo_device); + return D_O_K; + } + + return ret; +} + + +static int video_config_proc(int msg, DIALOG *d, int c); +static int sound_config_proc(int msg, DIALOG *d, int c); static int list_proc(int msg, DIALOG *d, int c); static DIALOG configure_dialog[] = { - {d_shadow_box_proc, 0, 0, 236*2,332,0,0xffffff,0,0, 0,0,0,0,0}, // 0 + {d_shadow_box_proc, 0, 0, 568,332,0,0xffffff,0,0, 0,0,0,0,0}, // 0 - {d_button_proc, 176, 308, 50, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "OK", 0, 0}, // 1 - {d_button_proc, 246, 308, 50, 16, 0, 0xffffff, 0, D_EXIT, 0, 0, "Cancel", 0, 0}, // 2 + {d_button_proc, 226, 308, 50, 16, 0, 0xffffff, 0, D_EXIT, 0, 0, "OK", 0, 0}, // 1 + {d_button_proc, 296, 308, 50, 16, 0, 0xffffff, 0, D_EXIT, 0, 0, "Cancel", 0, 0}, // 2 {list_proc, 70*2, 12, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_model, 0, 0}, @@ -262,6 +251,10 @@ static DIALOG configure_dialog[] = {d_list_proc, 70*2, 172, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_fdd, 0, 0}, {d_list_proc, 70*2, 192, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_fdd, 0, 0}, + {video_config_proc, 452, 32+4, 100, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "Configure...", 0, 0}, //30 + {sound_config_proc, 452, 152+4, 100, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "Configure...", 0, 0}, + {voodoo_config_proc, 452, 296, 100, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "Configure...", 0, 0}, + {0,0,0,0,0,0,0,0,0,0,0,NULL,NULL,NULL} }; @@ -276,6 +269,7 @@ static int list_proc(int msg, DIALOG *d, int c) int new_cpu_m = configure_dialog[5].d1; int new_cpu = configure_dialog[6].d1; int new_dynarec = configure_dialog[25].flags & D_SELECTED; + int new_gfxcard = video_old_to_new(video_list[configure_dialog[4].d1].num); int new_mem_size; int cpu_flags; @@ -304,12 +298,51 @@ static int list_proc(int msg, DIALOG *d, int c) else sprintf(mem_size_units, "kB"); + if (!video_card_has_config(new_gfxcard)) + configure_dialog[30].flags |= D_DISABLED; + else + configure_dialog[30].flags &= ~D_DISABLED; + + if (!sound_card_has_config(configure_dialog[9].d1)) + configure_dialog[31].flags |= D_DISABLED; + else + configure_dialog[31].flags &= ~D_DISABLED; + return D_REDRAW; } return ret; } +static int video_config_proc(int msg, DIALOG *d, int c) +{ + int ret = d_button_proc(msg, d, c); + + if (ret == D_CLOSE) + { + int new_gfxcard = video_old_to_new(video_list[configure_dialog[4].d1].num); + + deviceconfig_open(video_card_getdevice(new_gfxcard)); + return D_O_K; + } + + return ret; +} +static int sound_config_proc(int msg, DIALOG *d, int c) +{ + int ret = d_button_proc(msg, d, c); + + if (ret == D_CLOSE) + { + int new_sndcard = sound_list[configure_dialog[9].d1].num; + + deviceconfig_open(sound_card_getdevice(new_sndcard)); + return D_O_K; + } + + return ret; +} + static void reset_list() { int model = model_list[configure_dialog[3].d1].num; @@ -394,6 +427,11 @@ pclog("video_card_available : %i\n", c); c++; } + if (!video_card_has_config(video_old_to_new(gfxcard))) + configure_dialog[30].flags |= D_DISABLED; + else + configure_dialog[30].flags &= ~D_DISABLED; + c = d = 0; while (1) { @@ -414,6 +452,11 @@ pclog("video_card_available : %i\n", c); c++; } + if (!sound_card_has_config(configure_dialog[9].d1)) + configure_dialog[31].flags |= D_DISABLED; + else + configure_dialog[31].flags &= ~D_DISABLED; + configure_dialog[5].d1 = cpu_manufacturer; configure_dialog[6].d1 = cpu; configure_dialog[7].d1 = cache; diff --git a/src/allegro-gui-deviceconfig.c b/src/allegro-gui-deviceconfig.c new file mode 100644 index 0000000..a5029f8 --- /dev/null +++ b/src/allegro-gui-deviceconfig.c @@ -0,0 +1,303 @@ +#include "ibm.h" +#include "device.h" +#include "allegro-main.h" +#include "allegro-gui.h" +#include "config.h" + +static device_t *config_device; + +#define MAX_CONFIG_SIZE 64 +#define MAX_CONFIG_SELECTIONS 8 + +static device_config_selection_t *config_selections[MAX_CONFIG_SELECTIONS]; + +#define list_proc_device_func(i) \ + static char *list_proc_device_ ## i(int index, int *list_size) \ + { \ + device_config_selection_t *config = config_selections[i]; \ + \ + if (index < 0) \ + { \ + int c = 0; \ + \ + while (config[c].description[0]) \ + c++; \ + \ + *list_size = c; \ + return NULL; \ + } \ + \ + return config[index].description; \ + } + +list_proc_device_func(0) +list_proc_device_func(1) +list_proc_device_func(2) +list_proc_device_func(3) +list_proc_device_func(4) +list_proc_device_func(5) +list_proc_device_func(6) +list_proc_device_func(7) + +static DIALOG deviceconfig_dialog[MAX_CONFIG_SIZE] = +{ + {d_shadow_box_proc, 0, 0, 568,332,0,0xffffff,0,0, 0,0,0,0,0} // 0 +}; + +void deviceconfig_open(device_t *device) +{ + DIALOG *d; + device_config_t *config = device->config; + int y = 10; + int dialog_pos = 1; + int list_pos = 0; + int c; + int id_ok, id_cancel; + + memset((void *)((uintptr_t)deviceconfig_dialog) + sizeof(DIALOG), 0, sizeof(deviceconfig_dialog) - sizeof(DIALOG)); + deviceconfig_dialog[0].x = deviceconfig_dialog[0].y = 0; + + while (config->type != -1) + { + d = &deviceconfig_dialog[dialog_pos]; + + switch (config->type) + { + case CONFIG_BINARY: + d->x = 32; + d->y = y; + + d->w = 118*2; + d->h = 15; + + d->dp = config->description; + d->proc = d_check_proc; + + d->flags = config_get_int(device->name, config->name, config->default_int) ? D_SELECTED : 0; + d->bg = 0xffffff; + d->fg = 0; + + dialog_pos++; + + y += 20; + break; + + case CONFIG_SELECTION: + if (list_pos >= MAX_CONFIG_SELECTIONS) + break; + + d->x = 32; + d->y = y; + + d->w = 80; + d->h = 15; + + d->dp = config->description; + d->proc = d_text_proc; + + d->flags = 0; + d->bg = 0xffffff; + d->fg = 0; + + d++; + + d->x = 250; + d->y = y; + + d->w = 304; + d->h = 20; + + switch (list_pos) + { + case 0 : d->dp = list_proc_device_0; break; + case 1 : d->dp = list_proc_device_1; break; + case 2 : d->dp = list_proc_device_2; break; + case 3 : d->dp = list_proc_device_3; break; + case 4 : d->dp = list_proc_device_4; break; + case 5 : d->dp = list_proc_device_5; break; + case 6 : d->dp = list_proc_device_6; break; + case 7 : d->dp = list_proc_device_7; break; + } + d->proc = d_list_proc; + + d->flags = 0; + d->bg = 0xffffff; + d->fg = 0; + + config_selections[list_pos++] = config->selection; + + c = 0; + while (config->selection[c].description[0]) + { + if (config_get_int(device->name, config->name, config->default_int) == config->selection[c].value) + d->d1 = c; + c++; + } + + dialog_pos += 2; + + y += 20; + break; + + case CONFIG_MIDI: + break; + } + + config++; + + if (dialog_pos >= MAX_CONFIG_SIZE-3) + break; + } + + d = &deviceconfig_dialog[dialog_pos]; + + id_ok = dialog_pos; + id_cancel = dialog_pos + 1; + + d->x = 226; + d->y = y+8; + + d->w = 50; + d->h = 16; + + d->dp = "OK"; + d->proc = d_button_proc; + + d->flags = D_EXIT; + d->bg = 0xffffff; + d->fg = 0; + + d++; + + d->x = 296; + d->y = y+8; + + d->w = 50; + d->h = 16; + + d->dp = "Cancel"; + d->proc = d_button_proc; + + d->flags = D_EXIT; + d->bg = 0xffffff; + d->fg = 0; + + deviceconfig_dialog[0].h = y + 28; + + config_device = device; + + while (1) + { + position_dialog(deviceconfig_dialog, SCREEN_W/2 - deviceconfig_dialog[0].w/2, SCREEN_H/2 - deviceconfig_dialog[0].h/2); + + c = popup_dialog(deviceconfig_dialog, 1); + + position_dialog(deviceconfig_dialog, -(SCREEN_W/2 - deviceconfig_dialog[0].w/2), -(SCREEN_H/2 - deviceconfig_dialog[0].h/2)); + + if (c == id_ok) + { + int changed = 0; + + dialog_pos = 1; + config = device->config; + + while (config->type != -1) + { + int val; + + d = &deviceconfig_dialog[dialog_pos]; + + switch (config->type) + { + case CONFIG_BINARY: + val = (d->flags & D_SELECTED) ? 1 : 0; + + if (val != config_get_int(device->name, config->name, config->default_int)) + changed = 1; + + dialog_pos++; + break; + + case CONFIG_SELECTION: + if (list_pos >= MAX_CONFIG_SELECTIONS) + break; + + d++; + + val = config->selection[d->d1].value; + + if (val != config_get_int(device->name, config->name, config->default_int)) + changed = 1; + + dialog_pos += 2; + break; + + case CONFIG_MIDI: + break; + } + + config++; + + if (dialog_pos >= MAX_CONFIG_SIZE-3) + break; + } + + if (!changed) + return; + + if (alert("This will reset PCem!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) != 1) + continue; + + dialog_pos = 1; + config = device->config; + + while (config->type != -1) + { + int val; + + d = &deviceconfig_dialog[dialog_pos]; + + switch (config->type) + { + case CONFIG_BINARY: + val = (d->flags & D_SELECTED) ? 1 : 0; + + config_set_int(config_device->name, config->name, val); + + dialog_pos++; + break; + + case CONFIG_SELECTION: + if (list_pos >= MAX_CONFIG_SELECTIONS) + break; + + d++; + + val = config->selection[d->d1].value; + + config_set_int(config_device->name, config->name, val); + + dialog_pos += 2; + break; + + case CONFIG_MIDI: + break; + } + + config++; + + if (dialog_pos >= MAX_CONFIG_SIZE-3) + break; + } + + saveconfig(); + + resetpchard(); + + return; + } + + if (c == id_cancel) + break; + } +} diff --git a/src/allegro-gui-hdconf.c b/src/allegro-gui-hdconf.c index ba1bfb1..4021679 100644 --- a/src/allegro-gui-hdconf.c +++ b/src/allegro-gui-hdconf.c @@ -4,15 +4,16 @@ #include #include "ibm.h" +#include "device.h" #include "ide.h" #include "allegro-main.h" #include "allegro-gui.h" -static char hd_path[2][260]; -static char hd_sectors[2][10]; -static char hd_heads[2][10]; -static char hd_cylinders[2][10]; -static char hd_size[2][20]; +static char hd_path[4][260]; +static char hd_sectors[4][10]; +static char hd_heads[4][10]; +static char hd_cylinders[4][10]; +static char hd_size[4][20]; static char hd_path_new[260]; static char hd_sectors_new[10]; @@ -20,7 +21,9 @@ static char hd_heads_new[10]; static char hd_cylinders_new[10]; static char hd_size_new[20]; -static PcemHDC hdc_new[2]; +static int new_cdrom_channel; + +static PcemHDC hdc_new[4]; static DIALOG hdparams_dialog[]= { @@ -281,44 +284,162 @@ static int hdconf_eject(int msg, DIALOG *d, int c) return ret; } +static int hdconf_radio_hd(int msg, DIALOG *d, int c); +static int hdconf_radio_cd(int msg, DIALOG *d, int c); + static DIALOG hdconf_dialog[]= { - {d_shadow_box_proc, 0, 0, 210*2,172,0,0xffffff,0,0, 0,0,0,0,0}, // 0 + {d_shadow_box_proc, 0, 0, 210*2,354,0,0xffffff,0,0, 0,0,0,0,0}, // 0 - {d_button_proc, 150, 152, 50, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "OK", 0, 0}, // 1 - {d_button_proc, 220, 152, 50, 16, 0, 0xffffff, 0, D_EXIT, 0, 0, "Cancel", 0, 0}, // 2 + {d_button_proc, 150, 334, 50, 16, 0, 0xffffff, 0, D_EXIT, 0, 0, "OK", 0, 0}, // 1 + {d_button_proc, 220, 334, 50, 16, 0, 0xffffff, 0, D_EXIT, 0, 0, "Cancel", 0, 0}, // 2 {d_text_proc, 7*2, 6, 27, 10, 0, 0xffffff, 0, 0, 0, 0, "C:", 0, 0}, - {d_edit_proc, 7*2, 22, 136*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_path[0], 0, 0}, - {hdconf_open, 143*2, 22, 16*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "...", 0, 0}, - {hdconf_new, 159*2, 22, 24*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "New", 0, 0}, - {hdconf_eject, 183*2, 22, 24*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "Eject", 0, 0}, + {hdconf_radio_hd, 7*2, 22, 96, 12, 0, 0xffffff, 0, D_EXIT, 0, 0, "Hard drive", 0, 0}, // 4 + {hdconf_radio_cd, 100*2, 22, 64, 12, 0, 0xffffff, 0, D_EXIT, 0, 0, "CD-ROM", 0, 0}, // 5 + {d_edit_proc, 7*2, 38, 136*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_path[0], 0, 0}, + {hdconf_open, 143*2, 38, 16*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "...", 0, 0}, + {hdconf_new, 159*2, 38, 24*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "New", 0, 0}, + {hdconf_eject, 183*2, 38, 24*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "Eject", 0, 0}, - {d_text_proc, 7*2, 38, 27, 10, 0, 0xffffff, 0, 0, 0, 0, "Sectors:", 0, 0}, - {d_text_proc, 63*2, 38, 29, 8, 0, 0xffffff, 0, 0, 0, 0, "Heads:", 0, 0}, - {d_text_proc, 120*2, 38, 28, 12, 0, 0xffffff, 0, 0, 0, 0, "Cylinders:", 0, 0}, - {d_edit_proc, 44*2, 38, 16*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_sectors[0], 0, 0}, - {d_edit_proc, 92*2, 38, 16*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_heads[0], 0, 0}, - {d_edit_proc, 168*2, 38, 24*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_cylinders[0], 0, 0}, + {d_text_proc, 7*2, 54, 27, 10, 0, 0xffffff, 0, 0, 0, 0, "Sectors:", 0, 0}, + {d_text_proc, 63*2, 54, 29, 8, 0, 0xffffff, 0, 0, 0, 0, "Heads:", 0, 0}, + {d_text_proc, 120*2, 54, 28, 12, 0, 0xffffff, 0, 0, 0, 0, "Cylinders:", 0, 0}, + {d_edit_proc, 44*2, 54, 16*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_sectors[0], 0, 0}, + {d_edit_proc, 92*2, 54, 16*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_heads[0], 0, 0}, + {d_edit_proc, 168*2, 54, 24*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_cylinders[0], 0, 0}, {d_text_proc, 7*2, 54, 136, 12, 0, 0xffffff, 0, 0, 0, 0, hd_size[0], 0, 0}, {d_text_proc, 7*2, 76, 27, 10, 0, 0xffffff, 0, 0, 0, 0, "D:", 0, 0}, - {d_edit_proc, 7*2, 92, 136*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_path[1], 0, 0}, - {hdconf_open, 143*2, 92, 16*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 1, "...", 0, 0}, - {hdconf_new, 159*2, 92, 24*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 1, "New", 0, 0}, - {hdconf_eject, 183*2, 92, 24*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 1, "Eject", 0, 0}, + {hdconf_radio_hd, 7*2, 92, 96, 12, 0, 0xffffff, 0, D_EXIT, 1, 0, "Hard drive", 0, 0}, // 18 + {hdconf_radio_cd, 100*2, 92, 64, 12, 0, 0xffffff, 0, D_EXIT, 1, 0, "CD-ROM", 0, 0}, // 19 + {d_edit_proc, 7*2, 108, 136*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_path[1], 0, 0}, + {hdconf_open, 143*2, 108, 16*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 1, "...", 0, 0}, + {hdconf_new, 159*2, 108, 24*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 1, "New", 0, 0}, + {hdconf_eject, 183*2, 108, 24*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 1, "Eject", 0, 0}, - {d_edit_proc, 44*2, 108, 16*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_sectors[1], 0, 0}, - {d_edit_proc, 92*2, 108, 16*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_heads[1], 0, 0}, - {d_edit_proc, 168*2, 108, 24*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_cylinders[1], 0, 0}, - {d_text_proc, 7*2, 108, 27, 10, 0, 0xffffff, 0, 0, 0, 0, "Sectors:", 0, 0}, - {d_text_proc, 63*2, 108, 29, 8, 0, 0xffffff, 0, 0, 0, 0, "Heads:", 0, 0}, - {d_text_proc, 120*2, 108, 32, 12, 0, 0xffffff, 0, 0, 0, 0, "Cylinders:", 0, 0}, - {d_text_proc, 7*2, 124, 136, 12, 0, 0xffffff, 0, 0, 0, 0, hd_size[1], 0, 0}, + {d_edit_proc, 44*2, 124, 16*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_sectors[1], 0, 0}, + {d_edit_proc, 92*2, 124, 16*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_heads[1], 0, 0}, + {d_edit_proc, 168*2, 124, 24*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_cylinders[1], 0, 0}, + {d_text_proc, 7*2, 124, 27, 10, 0, 0xffffff, 0, 0, 0, 0, "Sectors:", 0, 0}, + {d_text_proc, 63*2, 124, 29, 8, 0, 0xffffff, 0, 0, 0, 0, "Heads:", 0, 0}, + {d_text_proc, 120*2, 124, 32, 12, 0, 0xffffff, 0, 0, 0, 0, "Cylinders:", 0, 0}, + {d_text_proc, 7*2, 140, 136, 12, 0, 0xffffff, 0, 0, 0, 0, hd_size[1], 0, 0}, + + {d_text_proc, 7*2, 162, 27, 10, 0, 0xffffff, 0, 0, 0, 0, "E:", 0, 0}, + {hdconf_radio_hd, 7*2, 178, 96, 12, 0, 0xffffff, 0, D_EXIT, 2, 0, "Hard drive", 0, 0}, // 32 + {hdconf_radio_cd, 100*2, 178, 64, 12, 0, 0xffffff, 0, D_EXIT, 2, 0, "CD-ROM", 0, 0}, // 33 + {d_edit_proc, 7*2, 194, 136*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_path[2], 0, 0}, + {hdconf_open, 143*2, 194, 16*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 2, "...", 0, 0}, + {hdconf_new, 159*2, 194, 24*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 2, "New", 0, 0}, + {hdconf_eject, 183*2, 194, 24*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 2, "Eject", 0, 0}, + + {d_edit_proc, 44*2, 210, 16*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_sectors[2], 0, 0}, + {d_edit_proc, 92*2, 210, 16*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_heads[2], 0, 0}, + {d_edit_proc, 168*2, 210, 24*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_cylinders[2], 0, 0}, + {d_text_proc, 7*2, 210, 27, 10, 0, 0xffffff, 0, 0, 0, 0, "Sectors:", 0, 0}, + {d_text_proc, 63*2, 210, 29, 8, 0, 0xffffff, 0, 0, 0, 0, "Heads:", 0, 0}, + {d_text_proc, 120*2, 210, 32, 12, 0, 0xffffff, 0, 0, 0, 0, "Cylinders:", 0, 0}, + {d_text_proc, 7*2, 226, 136, 12, 0, 0xffffff, 0, 0, 0, 0, hd_size[2], 0, 0}, + + {d_text_proc, 7*2, 248, 27, 10, 0, 0xffffff, 0, 0, 0, 0, "F:", 0, 0}, + {hdconf_radio_hd, 7*2, 264, 96, 12, 0, 0xffffff, 0, D_EXIT, 3, 0, "Hard drive", 0, 0}, // 46 + {hdconf_radio_cd, 100*2, 264, 64, 12, 0, 0xffffff, 0, D_EXIT, 3, 0, "CD-ROM", 0, 0}, // 47 + {d_edit_proc, 7*2, 280, 136*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_path[3], 0, 0}, + {hdconf_open, 143*2, 280, 16*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 3, "...", 0, 0}, + {hdconf_new, 159*2, 280, 24*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 3, "New", 0, 0}, + {hdconf_eject, 183*2, 280, 24*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 3, "Eject", 0, 0}, + + {d_edit_proc, 44*2, 296, 16*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_sectors[3], 0, 0}, + {d_edit_proc, 92*2, 296, 16*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_heads[3], 0, 0}, + {d_edit_proc, 168*2, 296, 24*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_cylinders[3], 0, 0}, + {d_text_proc, 7*2, 296, 27, 10, 0, 0xffffff, 0, 0, 0, 0, "Sectors:", 0, 0}, + {d_text_proc, 63*2, 296, 29, 8, 0, 0xffffff, 0, 0, 0, 0, "Heads:", 0, 0}, + {d_text_proc, 120*2, 296, 32, 12, 0, 0xffffff, 0, 0, 0, 0, "Cylinders:", 0, 0}, + {d_text_proc, 7*2, 312, 136, 12, 0, 0xffffff, 0, 0, 0, 0, hd_size[3], 0, 0}, {0,0,0,0,0,0,0,0,0,0,0,NULL,NULL,NULL} }; +static void update_hdd_cdrom() +{ + if (new_cdrom_channel == 0) + { + hdconf_dialog[4].flags &= ~D_SELECTED; + hdconf_dialog[5].flags |= D_SELECTED; + } + else + { + hdconf_dialog[4].flags |= D_SELECTED; + hdconf_dialog[5].flags &= ~D_SELECTED; + } + if (new_cdrom_channel == 1) + { + hdconf_dialog[18].flags &= ~D_SELECTED; + hdconf_dialog[19].flags |= D_SELECTED; + } + else + { + hdconf_dialog[18].flags |= D_SELECTED; + hdconf_dialog[19].flags &= ~D_SELECTED; + } + if (new_cdrom_channel == 2) + { + hdconf_dialog[32].flags &= ~D_SELECTED; + hdconf_dialog[33].flags |= D_SELECTED; + } + else + { + hdconf_dialog[32].flags |= D_SELECTED; + hdconf_dialog[33].flags &= ~D_SELECTED; + } + if (new_cdrom_channel == 3) + { + hdconf_dialog[46].flags &= ~D_SELECTED; + hdconf_dialog[47].flags |= D_SELECTED; + } + else + { + hdconf_dialog[46].flags |= D_SELECTED; + hdconf_dialog[47].flags &= ~D_SELECTED; + } +} + +static int hdconf_radio_hd(int msg, DIALOG *d, int c) +{ + int ret = d_radio_proc(msg, d, c); + + if (ret == D_CLOSE) + { + if (new_cdrom_channel == d->d1) + { + new_cdrom_channel = -1; + update_hdd_cdrom(); + } + + return D_REDRAW; + } + + return ret; +} +static int hdconf_radio_cd(int msg, DIALOG *d, int c) +{ + int ret = d_radio_proc(msg, d, c); + + if (ret == D_CLOSE) + { + if (new_cdrom_channel != d->d1) + { + new_cdrom_channel = d->d1; + update_hdd_cdrom(); + } + + return D_REDRAW; + } + + return ret; +} + int disc_hdconf() { int c; @@ -326,24 +447,40 @@ int disc_hdconf() hdc_new[0] = hdc[0]; hdc_new[1] = hdc[1]; + hdc_new[2] = hdc[2]; + hdc_new[3] = hdc[3]; strcpy(hd_path[0], ide_fn[0]); strcpy(hd_path[1], ide_fn[1]); + strcpy(hd_path[2], ide_fn[2]); + strcpy(hd_path[3], ide_fn[3]); sprintf(hd_sectors[0], "%i", hdc[0].spt); sprintf(hd_sectors[1], "%i", hdc[1].spt); + sprintf(hd_sectors[2], "%i", hdc[2].spt); + sprintf(hd_sectors[3], "%i", hdc[3].spt); sprintf(hd_heads[0], "%i", hdc[0].hpc); sprintf(hd_heads[1], "%i", hdc[1].hpc); + sprintf(hd_heads[2], "%i", hdc[2].hpc); + sprintf(hd_heads[3], "%i", hdc[3].hpc); sprintf(hd_cylinders[0], "%i", hdc[0].tracks); sprintf(hd_cylinders[1], "%i", hdc[1].tracks); + sprintf(hd_cylinders[2], "%i", hdc[2].tracks); + sprintf(hd_cylinders[3], "%i", hdc[3].tracks); sprintf(hd_size[0], "Size : %imb", (((((uint64_t)hdc[0].tracks*(uint64_t)hdc[0].hpc)*(uint64_t)hdc[0].spt)*512)/1024)/1024); sprintf(hd_size[1], "Size : %imb", (((((uint64_t)hdc[1].tracks*(uint64_t)hdc[1].hpc)*(uint64_t)hdc[1].spt)*512)/1024)/1024); + sprintf(hd_size[2], "Size : %imb", (((((uint64_t)hdc[2].tracks*(uint64_t)hdc[2].hpc)*(uint64_t)hdc[2].spt)*512)/1024)/1024); + sprintf(hd_size[3], "Size : %imb", (((((uint64_t)hdc[3].tracks*(uint64_t)hdc[3].hpc)*(uint64_t)hdc[3].spt)*512)/1024)/1024); + + new_cdrom_channel = cdrom_channel; + + update_hdd_cdrom(); while (1) { - position_dialog(hdconf_dialog, SCREEN_W/2 - 210, SCREEN_H/2 - 172/2); + position_dialog(hdconf_dialog, SCREEN_W/2 - hdconf_dialog[0].w/2, SCREEN_H/2 - hdconf_dialog[0].h/2); c = popup_dialog(hdconf_dialog, 1); - position_dialog(hdconf_dialog, -(SCREEN_W/2 - 210), -(SCREEN_H/2 - 172/2)); + position_dialog(hdconf_dialog, -(SCREEN_W/2 - hdconf_dialog[0].w/2), -(SCREEN_H/2 - hdconf_dialog[0].h/2)); if (c == 1) { @@ -351,9 +488,15 @@ int disc_hdconf() { hdc[0] = hdc_new[0]; hdc[1] = hdc_new[1]; + hdc[2] = hdc_new[2]; + hdc[3] = hdc_new[3]; strcpy(ide_fn[0], hd_path[0]); strcpy(ide_fn[1], hd_path[1]); + strcpy(ide_fn[2], hd_path[2]); + strcpy(ide_fn[3], hd_path[3]); + + cdrom_channel = new_cdrom_channel; saveconfig(); diff --git a/src/allegro-gui.c b/src/allegro-gui.c index 5868e58..11b13e8 100644 --- a/src/allegro-gui.c +++ b/src/allegro-gui.c @@ -1,7 +1,7 @@ #include "ibm.h" +#include "device.h" #include "allegro-main.h" #include "allegro-gui.h" -#include "device.h" #include "disc.h" #include "ide.h" diff --git a/src/allegro-gui.h b/src/allegro-gui.h index 49f840d..3f53b59 100644 --- a/src/allegro-gui.h +++ b/src/allegro-gui.h @@ -8,3 +8,5 @@ extern int gfx_present[GFX_MAX]; int disc_hdconf(); int settings_configure(); + +void deviceconfig_open(device_t *device);