From fb3d3d594b20846b3e3725418ead7b07c124c868 Mon Sep 17 00:00:00 2001 From: SarahW Date: Tue, 10 Jan 2017 16:38:52 +0000 Subject: [PATCH] Fixed building under Linux Linux GUI brought up to date --- src/allegro-gui-configure.c | 302 ++++++++++++++++++++++++------------ src/allegro-gui.c | 49 +++++- src/allegro-mouse.c | 5 +- src/allegro-video.c | 6 +- src/cdrom-ioctl-linux.c | 11 +- src/mouse.h | 2 + src/video.c | 4 +- 7 files changed, 269 insertions(+), 110 deletions(-) diff --git a/src/allegro-gui-configure.c b/src/allegro-gui-configure.c index 9b22450..f247019 100644 --- a/src/allegro-gui-configure.c +++ b/src/allegro-gui-configure.c @@ -6,12 +6,14 @@ #include "fdd.h" #include "gameport.h" #include "model.h" +#include "mouse.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]; +static int settings_mouse_to_list[20], settings_list_to_mouse[20]; typedef struct allegro_list_t { @@ -25,19 +27,10 @@ static allegro_list_t sound_list[GFX_MAX+1]; static allegro_list_t cpumanu_list[4]; static allegro_list_t cpu_list[32]; static allegro_list_t joystick_list[32]; +static allegro_list_t mouse_list[32]; static char mem_size_str[10], mem_size_units[3]; -static allegro_list_t cache_list[] = -{ - {"A little", 0}, - {"A bit", 1}, - {"Some", 2}, - {"A lot", 3}, - {"Infinite", 4}, - {"", -1} -}; - static allegro_list_t vidspeed_list[] = { {"8-bit", 0}, @@ -62,6 +55,21 @@ static allegro_list_t fdd_list[] = {"", -1} }; +static allegro_list_t waitstate_list[] = +{ + {"System default", 0}, + {"0 W/S", 1}, + {"1 W/S", 2}, + {"2 W/S", 3}, + {"3 W/S", 4}, + {"4 W/S", 5}, + {"5 W/S", 6}, + {"6 W/S", 7}, + {"7 W/S", 8}, + {"", -1} +}; + + static void reset_list(); static char *list_proc_model(int index, int *list_size) @@ -96,22 +104,6 @@ static char *list_proc_video(int index, int *list_size) return video_list[index].name; } -static char *list_proc_cache(int index, int *list_size) -{ - if (index < 0) - { - int c = 0; - - while (cache_list[c].name[0]) - c++; - - *list_size = c; - return NULL; - } - - return cache_list[index].name; -} - static char *list_proc_vidspeed(int index, int *list_size) { if (index < 0) @@ -208,6 +200,38 @@ static char *list_proc_joystick(int index, int *list_size) return joystick_list[index].name; } +static char *list_proc_mouse(int index, int *list_size) +{ + if (index < 0) + { + int c = 0; + + while (mouse_list[c].name[0]) + c++; + + *list_size = c; + return NULL; + } + + return mouse_list[index].name; +} + +static char *list_proc_ws(int index, int *list_size) +{ + if (index < 0) + { + int c = 0; + + while (waitstate_list[c].name[0]) + c++; + + *list_size = c; + return NULL; + } + + return waitstate_list[index].name; +} + static int voodoo_config_proc(int msg, DIALOG *d, int c) { int ret = d_button_proc(msg, d, c); @@ -221,7 +245,7 @@ static int voodoo_config_proc(int msg, DIALOG *d, int c) return ret; } - +static int model_config_proc(int msg, DIALOG *d, int c); 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); @@ -239,46 +263,91 @@ static DIALOG configure_dialog[] = {list_proc, 70*2, 52, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_cpumanu, 0, 0}, //5 {list_proc, 70*2, 72, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_cpu, 0, 0}, - {d_list_proc, 70*2, 112, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_cache, 0, 0}, - {d_list_proc, 70*2, 132, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_vidspeed, 0, 0}, - {list_proc, 70*2, 152, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_sound, 0, 0}, //9 + {d_list_proc, 70*2, 132, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_vidspeed, 0, 0}, //7 + {list_proc, 70*2, 152, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_sound, 0, 0}, //8 - {d_edit_proc, 70*2, 236, 32, 14, 0, 0xffffff, 0, 0, 3, 0, mem_size_str, 0, 0}, + {d_edit_proc, 70*2, 256, 32, 14, 0, 0xffffff, 0, 0, 3, 0, mem_size_str, 0, 0}, - {d_text_proc, 98*2, 236, 40, 10, 0, 0xffffff, 0, 0, 0, 0, mem_size_units, 0, 0}, + {d_text_proc, 98*2, 256, 40, 10, 0, 0xffffff, 0, 0, 0, 0, mem_size_units, 0, 0}, - {d_check_proc, 14*2, 252, 118*2, 10, 0, 0xffffff, 0, 0, 0, 0, "CMS / Game Blaster", 0, 0}, - {d_check_proc, 14*2, 268, 118*2, 10, 0, 0xffffff, 0, 0, 0, 0, "Gravis Ultrasound", 0, 0}, - {d_check_proc, 14*2, 284, 118*2, 10, 0, 0xffffff, 0, 0, 0, 0, "Innovation SSI-2001", 0, 0}, - {d_check_proc, 14*2, 300, 118*2, 10, 0, 0xffffff, 0, 0, 0, 0, "Composite CGA", 0, 0}, - {d_check_proc, 14*2, 316, 118*2, 10, 0, 0xffffff, 0, 0, 0, 0, "Voodoo Graphics", 0, 0}, + {d_check_proc, 14*2, 272, 118*2, 10, 0, 0xffffff, 0, 0, 0, 0, "CMS / Game Blaster", 0, 0}, + {d_check_proc, 14*2, 288, 118*2, 10, 0, 0xffffff, 0, 0, 0, 0, "Gravis Ultrasound", 0, 0}, + {d_check_proc, 14*2, 304, 118*2, 10, 0, 0xffffff, 0, 0, 0, 0, "Innovation SSI-2001", 0, 0}, + {d_check_proc, 14*2, 316, 118*2, 10, 0, 0xffffff, 0, 0, 0, 0, "Voodoo Graphics", 0, 0}, //14 {d_text_proc, 16*2, 16, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Machine :", 0, 0}, {d_text_proc, 16*2, 36, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Video :", 0, 0}, {d_text_proc, 16*2, 56, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "CPU type :", 0, 0}, {d_text_proc, 16*2, 76, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "CPU :", 0, 0}, - {d_text_proc, 16*2, 116, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Cache :", 0, 0}, {d_text_proc, 16*2, 136, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Video speed :", 0, 0}, {d_text_proc, 16*2, 156, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Soundcard :", 0, 0}, - {d_text_proc, 16*2, 236, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Memory :", 0, 0}, + {d_text_proc, 16*2, 256, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Memory :", 0, 0}, {d_check_proc, 14*2, 92, 118*2, 10, 0, 0xffffff, 0, 0, 0, 0, "Dynamic Recompiler", 0, 0}, {d_text_proc, 16*2, 176, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Drive A: :", 0, 0}, {d_text_proc, 16*2, 196, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Drive B: :", 0, 0}, - {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, 172, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_fdd, 0, 0}, //25 {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, 316, 100, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "Configure...", 0, 0}, + {video_config_proc, 452, 36, 100, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "Configure...", 0, 0}, //27 + {sound_config_proc, 452, 156, 100, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "Configure...", 0, 0}, + {voodoo_config_proc, 452, 316, 100, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "Configure...", 0, 0}, {d_text_proc, 16*2, 216, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Joystick :", 0, 0}, - {d_list_proc, 70*2, 212, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_joystick, 0, 0}, //34 + {d_list_proc, 70*2, 212, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_joystick, 0, 0}, //31 + + {d_text_proc, 16*2, 236, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Mouse :", 0, 0}, + {d_list_proc, 70*2, 232, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_mouse, 0, 0}, //33 + + {model_config_proc, 452, 12, 100, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "Configure...", 0, 0}, + + {d_text_proc, 16*2, 116, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Waitstates :", 0, 0}, + {d_list_proc, 70*2, 112, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_ws, 0, 0}, //36 {0,0,0,0,0,0,0,0,0,0,0,NULL,NULL,NULL} }; +static int mouse_valid(int type, int model) +{ + if ((type & MOUSE_TYPE_IF_MASK) == MOUSE_TYPE_PS2 && !(models[model].flags & MODEL_PS2)) + return 0; + if ((type & MOUSE_TYPE_IF_MASK) == MOUSE_TYPE_AMSTRAD && !(models[model].flags & MODEL_AMSTRAD)) + return 0; + if ((type & MOUSE_TYPE_IF_MASK) == MOUSE_TYPE_OLIM24 && !(models[model].flags & MODEL_OLIM24)) + return 0; + return 1; +} + +static void update_mouse_list() +{ + int sel_model = model_list[configure_dialog[3].d1].num; + int c = 0, d = 0; + int new_mouse = settings_list_to_mouse[configure_dialog[33].d1]; + + while (mouse_get_name(c)) + { + int type = mouse_get_type(c); + + settings_mouse_to_list[c] = d; + + if (mouse_valid(type, sel_model)) + { + strcpy(mouse_list[d].name, mouse_get_name(c)); + settings_list_to_mouse[d] = c; + d++; + } + + c++; + } + mouse_list[d].name[0] = 0; + + if (mouse_valid(mouse_get_type(new_mouse), sel_model)) + configure_dialog[33].d1 = settings_mouse_to_list[new_mouse]; + else + configure_dialog[33].d1 = 0; +} + static int list_proc(int msg, DIALOG *d, int c) { int old = d->d1; @@ -289,10 +358,10 @@ static int list_proc(int msg, DIALOG *d, int c) int new_model = model_list[configure_dialog[3].d1].num; 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_dynarec = configure_dialog[22].flags & D_SELECTED; int new_gfxcard = video_old_to_new(video_list[configure_dialog[4].d1].num); int new_mem_size; - int cpu_flags; + int cpu_flags, cpu_type; reset_list(); @@ -302,9 +371,9 @@ static int list_proc(int msg, DIALOG *d, int c) configure_dialog[4].flags &= ~D_DISABLED; cpu_flags = models[new_model].cpu[new_cpu_m].cpus[new_cpu].cpu_flags; - configure_dialog[25].flags = (((cpu_flags & CPU_SUPPORTS_DYNAREC) && new_dynarec) || (cpu_flags & CPU_REQUIRES_DYNAREC)) ? D_SELECTED : 0; + configure_dialog[22].flags = (((cpu_flags & CPU_SUPPORTS_DYNAREC) && new_dynarec) || (cpu_flags & CPU_REQUIRES_DYNAREC)) ? D_SELECTED : 0; if (!(cpu_flags & CPU_SUPPORTS_DYNAREC) || (cpu_flags & CPU_REQUIRES_DYNAREC)) - configure_dialog[25].flags |= D_DISABLED; + configure_dialog[22].flags |= D_DISABLED; sscanf(mem_size_str, "%i", &new_mem_size); new_mem_size &= ~(models[new_model].ram_granularity - 1); @@ -314,20 +383,33 @@ static int list_proc(int msg, DIALOG *d, int c) new_mem_size = models[new_model].max_ram; sprintf(mem_size_str, "%i", new_mem_size); - if (models[new_model].is_at) + if (models[new_model].flags & MODEL_AT) sprintf(mem_size_units, "MB"); else sprintf(mem_size_units, "kB"); if (!video_card_has_config(new_gfxcard)) - configure_dialog[30].flags |= D_DISABLED; + configure_dialog[27].flags |= D_DISABLED; else - configure_dialog[30].flags &= ~D_DISABLED; + configure_dialog[27].flags &= ~D_DISABLED; if (!sound_card_has_config(configure_dialog[9].d1)) - configure_dialog[31].flags |= D_DISABLED; + configure_dialog[28].flags |= D_DISABLED; else - configure_dialog[31].flags &= ~D_DISABLED; + configure_dialog[28].flags &= ~D_DISABLED; + + update_mouse_list(); + + if (!model_getdevice(new_model)) + configure_dialog[34].flags |= D_DISABLED; + else + configure_dialog[34].flags &= ~D_DISABLED; + + cpu_type = models[new_model].cpu[new_cpu_m].cpus[new_cpu].cpu_type; + if (cpu_type < CPU_286 || cpu_type > CPU_386DX) + configure_dialog[36].flags |= D_DISABLED; + else + configure_dialog[36].flags &= ~D_DISABLED; return D_REDRAW; } @@ -355,7 +437,7 @@ static int sound_config_proc(int msg, DIALOG *d, int c) if (ret == D_CLOSE) { - int new_sndcard = sound_list[configure_dialog[9].d1].num; + int new_sndcard = sound_list[configure_dialog[8].d1].num; deviceconfig_open(sound_card_getdevice(new_sndcard)); return D_O_K; @@ -363,6 +445,21 @@ static int sound_config_proc(int msg, DIALOG *d, int c) return ret; } +static int model_config_proc(int msg, DIALOG *d, int c) +{ + int ret = d_button_proc(msg, d, c); + + if (ret == D_CLOSE) + { + int model = model_list[configure_dialog[3].d1].num; + + deviceconfig_open(model_getdevice(model)); + return D_O_K; + } + + return ret; +} + static void reset_list() { @@ -449,9 +546,9 @@ pclog("video_card_available : %i\n", c); } if (!video_card_has_config(video_old_to_new(gfxcard))) - configure_dialog[30].flags |= D_DISABLED; + configure_dialog[27].flags |= D_DISABLED; else - configure_dialog[30].flags &= ~D_DISABLED; + configure_dialog[27].flags &= ~D_DISABLED; c = d = 0; while (1) @@ -466,7 +563,7 @@ pclog("video_card_available : %i\n", c); strcpy(sound_list[d].name, sound_card_getname(c)); sound_list[d].num = c; if (c == sound_card_current) - configure_dialog[9].d1 = d; + configure_dialog[8].d1 = d; d++; } @@ -478,20 +575,24 @@ pclog("video_card_available : %i\n", c); { strcpy(joystick_list[c].name, joystick_get_name(c)); if (c == joystick_type) - configure_dialog[34].d1 = c; + configure_dialog[31].d1 = c; c++; } - if (!sound_card_has_config(configure_dialog[9].d1)) - configure_dialog[31].flags |= D_DISABLED; + configure_dialog[33].d1 = 0; + update_mouse_list(); + configure_dialog[33].d1 = settings_mouse_to_list[mouse_type]; + + if (!sound_card_has_config(configure_dialog[8].d1)) + configure_dialog[28].flags |= D_DISABLED; else - configure_dialog[31].flags &= ~D_DISABLED; + configure_dialog[28].flags &= ~D_DISABLED; configure_dialog[5].d1 = cpu_manufacturer; configure_dialog[6].d1 = cpu; - configure_dialog[7].d1 = cache; - configure_dialog[8].d1 = video_speed; + configure_dialog[7].d1 = video_speed; + configure_dialog[36].d1 = cpu_waitstates; reset_list(); // strcpy(cpumanu_str, models[romstomodel[romset]].cpu[cpu_manufacturer].name); // strcpy(cpu_str, models[romstomodel[romset]].cpu[cpu_manufacturer].cpus[cpu].name); @@ -501,47 +602,47 @@ pclog("video_card_available : %i\n", c); // strcpy(soundcard_str, sound_card_getname(sound_card_current)); if (GAMEBLASTER) + configure_dialog[11].flags |= D_SELECTED; + else + configure_dialog[11].flags &= ~D_SELECTED; + + if (GUS) configure_dialog[12].flags |= D_SELECTED; else configure_dialog[12].flags &= ~D_SELECTED; - if (GUS) + if (SSI2001) configure_dialog[13].flags |= D_SELECTED; else configure_dialog[13].flags &= ~D_SELECTED; - if (SSI2001) + if (voodoo_enabled) configure_dialog[14].flags |= D_SELECTED; else configure_dialog[14].flags &= ~D_SELECTED; - if (cga_comp) - configure_dialog[15].flags |= D_SELECTED; - else - configure_dialog[15].flags &= ~D_SELECTED; - - if (voodoo_enabled) - configure_dialog[16].flags |= D_SELECTED; - else - configure_dialog[16].flags &= ~D_SELECTED; - - if (models[model].is_at) + if (models[model].flags & MODEL_AT) sprintf(mem_size_str, "%i", mem_size / 1024); else sprintf(mem_size_str, "%i", mem_size); - if (models[model].is_at) + if (models[model].flags & MODEL_AT) sprintf(mem_size_units, "MB"); else sprintf(mem_size_units, "kB"); - cpu_flags = models[model].cpu[cpu_manufacturer].cpus[cpu].cpu_flags; - configure_dialog[25].flags = (((cpu_flags & CPU_SUPPORTS_DYNAREC) && cpu_use_dynarec) || (cpu_flags & CPU_REQUIRES_DYNAREC)) ? D_SELECTED : 0; - if (!(cpu_flags & CPU_SUPPORTS_DYNAREC) || (cpu_flags & CPU_REQUIRES_DYNAREC)) - configure_dialog[25].flags |= D_DISABLED; + if (!model_getdevice(model)) + configure_dialog[34].flags |= D_DISABLED; + else + configure_dialog[34].flags &= ~D_DISABLED; - configure_dialog[28].d1 = fdd_get_type(0); - configure_dialog[29].d1 = fdd_get_type(1); + cpu_flags = models[model].cpu[cpu_manufacturer].cpus[cpu].cpu_flags; + configure_dialog[22].flags = (((cpu_flags & CPU_SUPPORTS_DYNAREC) && cpu_use_dynarec) || (cpu_flags & CPU_REQUIRES_DYNAREC)) ? D_SELECTED : 0; + if (!(cpu_flags & CPU_SUPPORTS_DYNAREC) || (cpu_flags & CPU_REQUIRES_DYNAREC)) + configure_dialog[22].flags |= D_DISABLED; + + configure_dialog[25].d1 = fdd_get_type(0); + configure_dialog[26].d1 = fdd_get_type(1); while (1) { @@ -555,18 +656,19 @@ pclog("video_card_available : %i\n", c); { int new_model = model_list[configure_dialog[3].d1].num; int new_gfxcard = video_list[configure_dialog[4].d1].num; - int new_sndcard = sound_list[configure_dialog[9].d1].num; + int new_sndcard = sound_list[configure_dialog[8].d1].num; int new_cpu_m = configure_dialog[5].d1; int new_cpu = configure_dialog[6].d1; int new_mem_size; int new_has_fpu = (models[new_model].cpu[new_cpu_m].cpus[new_cpu].cpu_type >= CPU_i486DX) ? 1 : 0; - int new_GAMEBLASTER = (configure_dialog[12].flags & D_SELECTED) ? 1 : 0; - int new_GUS = (configure_dialog[13].flags & D_SELECTED) ? 1 : 0; - int new_SSI2001 = (configure_dialog[14].flags & D_SELECTED) ? 1 : 0; - int new_voodoo = (configure_dialog[16].flags & D_SELECTED) ? 1 : 0; - int new_dynarec = (configure_dialog[25].flags & D_SELECTED) ? 1 : 0; - int new_fda = configure_dialog[28].d1; - int new_fdb = configure_dialog[29].d1; + int new_GAMEBLASTER = (configure_dialog[11].flags & D_SELECTED) ? 1 : 0; + int new_GUS = (configure_dialog[12].flags & D_SELECTED) ? 1 : 0; + int new_SSI2001 = (configure_dialog[13].flags & D_SELECTED) ? 1 : 0; + int new_voodoo = (configure_dialog[14].flags & D_SELECTED) ? 1 : 0; + int new_dynarec = (configure_dialog[22].flags & D_SELECTED) ? 1 : 0; + int new_fda = configure_dialog[25].d1; + int new_fdb = configure_dialog[26].d1; + int new_mouse = settings_list_to_mouse[configure_dialog[33].d1]; sscanf(mem_size_str, "%i", &new_mem_size); new_mem_size &= ~(models[new_model].ram_granularity - 1); @@ -574,13 +676,14 @@ pclog("video_card_available : %i\n", c); new_mem_size = models[new_model].min_ram; else if (new_mem_size > models[new_model].max_ram) new_mem_size = models[new_model].max_ram; - if (models[new_model].is_at) + if (models[new_model].flags & MODEL_AT) new_mem_size *= 1024; if (new_model != model || new_gfxcard != gfxcard || new_mem_size != mem_size || new_has_fpu != hasfpu || new_GAMEBLASTER != GAMEBLASTER || new_GUS != GUS || new_SSI2001 != SSI2001 || new_sndcard != sound_card_current || new_voodoo != voodoo_enabled || - new_dynarec != cpu_use_dynarec || new_fda != fdd_get_type(0) || new_fdb != fdd_get_type(1)) + new_dynarec != cpu_use_dynarec || new_fda != fdd_get_type(0) || new_fdb != fdd_get_type(1) || + new_mouse != mouse_type) { if (alert("This will reset PCem!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) != 1) continue; @@ -597,6 +700,7 @@ pclog("video_card_available : %i\n", c); sound_card_current = new_sndcard; voodoo_enabled = new_voodoo; cpu_use_dynarec = new_dynarec; + mouse_type = new_mouse; mem_resize(); loadbios(); @@ -606,18 +710,16 @@ pclog("video_card_available : %i\n", c); fdd_set_type(1, new_fdb); } - video_speed = configure_dialog[8].d1; - - cga_comp = (configure_dialog[15].flags & D_SELECTED) ? 1 : 0; + video_speed = configure_dialog[7].d1; cpu_manufacturer = new_cpu_m; cpu = new_cpu; cpu_set(); + + cpu_waitstates = configure_dialog[36].d1; + cpu_update_waitstates(); - cache = configure_dialog[7].d1; - mem_updatecache(); - - joystick_type = configure_dialog[34].d1; + joystick_type = configure_dialog[31].d1; gameport_update_joystick_type(); saveconfig(); diff --git a/src/allegro-gui.c b/src/allegro-gui.c index 11b13e8..8853d97 100644 --- a/src/allegro-gui.c +++ b/src/allegro-gui.c @@ -4,6 +4,7 @@ #include "allegro-gui.h" #include "disc.h" #include "ide.h" +#include "cdrom-iso.h" static int file_return(void) { @@ -107,10 +108,18 @@ static void cdrom_update() if (!cdrom_enabled) cdrom_menu[0].flags = D_SELECTED; - else + else switch (cdrom_drive) + { + case -1: cdrom_menu[1].flags = D_SELECTED; - - return D_O_K; + break; + case CDROM_ISO: + cdrom_menu[3].flags = D_SELECTED; + break; + default: + cdrom_menu[2].flags = D_SELECTED; + break; + } } static int cdrom_disabled() @@ -172,11 +181,45 @@ static int cdrom_dev() } } +static int cdrom_iso() +{ + char fn[260]; + int ret; + int xsize = SCREEN_W - 32, ysize = SCREEN_H - 64; + + strcpy(fn, iso_path); + ret = file_select_ex("Please choose an ISO image", fn, "ISO", 260, xsize, ysize); + if (ret) + { + if (!cdrom_enabled) + { + if (alert("This will reset PCem!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) != 1) + return D_O_K; + } + else + { + atapi->exit(); + } + + cdrom_drive = CDROM_ISO; + iso_open(fn); + if (!cdrom_enabled) + { + cdrom_enabled = 1; + resetpchard(); + } + cdrom_update(); + saveconfig(); + } + return D_O_K; +} + static MENU cdrom_menu[] = { {"&Disabled", cdrom_disabled, NULL, 0, NULL}, {"&Empty", cdrom_empty, NULL, 0, NULL}, {"/dev/cdrom", cdrom_dev, NULL, 0, NULL}, + {"&ISO image...", cdrom_iso, NULL, 0, NULL}, {NULL,NULL,NULL,0,NULL} }; diff --git a/src/allegro-mouse.c b/src/allegro-mouse.c index f36b3e9..9cceaa9 100644 --- a/src/allegro-mouse.c +++ b/src/allegro-mouse.c @@ -18,14 +18,15 @@ void mouse_poll_host() mouse_buttons = mouse_b; } -void mouse_get_mickeys(int *x, int *y) +void mouse_get_mickeys(int *x, int *y, int *z) { if (mousecapture) { get_mouse_mickeys(x, y); + *z = 0; // position_mouse(64, 64); } else - *x = *y = 0; + *x = *y = *z = 0; } diff --git a/src/allegro-video.c b/src/allegro-video.c index b4d355f..5ca4da3 100644 --- a/src/allegro-video.c +++ b/src/allegro-video.c @@ -73,10 +73,14 @@ static void allegro_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h) } } + video_blit_complete(); blit(buffer32_vscale, screen, x, (y+y1)*2, 0, y1, w, (y2-y1)*2); } else + { blit(buffer32, screen, x, y+y1, 0, y1, w, y2-y1); + video_blit_complete(); + } } static void allegro_blit_memtoscreen_8(int x, int y, int w, int h) @@ -110,7 +114,7 @@ static void allegro_blit_memtoscreen_8(int x, int y, int w, int h) } } } - + video_blit_complete(); if (readflash) { if (line_double) diff --git a/src/cdrom-ioctl-linux.c b/src/cdrom-ioctl-linux.c index 5ced89b..cd89b36 100644 --- a/src/cdrom-ioctl-linux.c +++ b/src/cdrom-ioctl-linux.c @@ -417,14 +417,16 @@ static void ioctl_load(void) cdrom_capacity = ioctl_get_last_block(0, 0, 4096, 0); } -static void ioctl_readsector(uint8_t *b, int sector) +static int ioctl_readsector(uint8_t *b, int sector) { int cdrom = open("/dev/cdrom", O_RDONLY|O_NONBLOCK); if (cdrom <= 0) - return; + return -1; lseek(cdrom, sector*2048, SEEK_SET); read(cdrom, b, 2048); close(cdrom); + + return 0; } union @@ -683,6 +685,11 @@ void ioctl_reset() close(fd); } +void ioctl_set_drive(char d) +{ + atapi=&ioctl_atapi; +} + int ioctl_open(char d) { atapi=&ioctl_atapi; diff --git a/src/mouse.h b/src/mouse.h index 53a09eb..43e9685 100644 --- a/src/mouse.h +++ b/src/mouse.h @@ -10,6 +10,8 @@ int mouse_get_type(int mouse); #define MOUSE_TYPE_AMSTRAD 2 #define MOUSE_TYPE_OLIM24 3 +#define MOUSE_TYPE_IF_MASK 3 + #define MOUSE_TYPE_3BUTTON (1 << 31) typedef struct diff --git a/src/video.c b/src/video.c index b072ed2..174d6b1 100644 --- a/src/video.c +++ b/src/video.c @@ -489,13 +489,13 @@ void video_blit_complete() void video_wait_for_blit() { while (blit_data.busy) - thread_wait_event(blit_data.blit_complete, -1); + thread_wait_event(blit_data.blit_complete, 1); thread_reset_event(blit_data.blit_complete); } void video_wait_for_buffer() { while (blit_data.buffer_in_use) - thread_wait_event(blit_data.buffer_not_in_use, -1); + thread_wait_event(blit_data.buffer_not_in_use, 1); thread_reset_event(blit_data.buffer_not_in_use); }