diff --git a/src/device.c b/src/device.c index 6bd27a8..b2737c8 100644 --- a/src/device.c +++ b/src/device.c @@ -1,6 +1,8 @@ #include "ibm.h" #include "config.h" +#include "cpu.h" #include "device.h" +#include "model.h" #include "sound.h" static void *device_priv[256]; @@ -16,7 +18,7 @@ void device_init() void device_add(device_t *d) { int c = 0; - void *priv; + void *priv = NULL; while (devices[c] != NULL && c < 256) c++; @@ -26,9 +28,12 @@ void device_add(device_t *d) current_device = d; - priv = d->init(); - if (priv == NULL) - fatal("device_add : device init failed\n"); + if (d->init != NULL) + { + priv = d->init(); + if (priv == NULL) + fatal("device_add : device init failed\n"); + } devices[c] = d; device_priv[c] = priv; @@ -42,7 +47,8 @@ void device_close_all() { if (devices[c] != NULL) { - devices[c]->close(device_priv[c]); + if (devices[c]->close != NULL) + devices[c]->close(device_priv[c]); devices[c] = device_priv[c] = NULL; } } @@ -135,3 +141,43 @@ char *device_get_config_string(char *s) } return NULL; } + +int model_get_config_int(char *s) +{ + device_t *device = model_getdevice(model); + device_config_t *config; + + if (!device) + return 0; + + config = device->config; + + while (config->type != -1) + { + if (!strcmp(s, config->name)) + return config_get_int(device->name, s, config->default_int); + + config++; + } + return 0; +} + +char *model_get_config_string(char *s) +{ + device_t *device = model_getdevice(model); + device_config_t *config; + + if (!device) + return 0; + + config = device->config; + + while (config->type != -1) + { + if (!strcmp(s, config->name)) + return config_get_string(device->name, s, config->default_string); + + config++; + } + return NULL; +} diff --git a/src/device.h b/src/device.h index 0c6050e..ef1c60f 100644 --- a/src/device.h +++ b/src/device.h @@ -48,3 +48,6 @@ enum { DEVICE_NOT_WORKING = 1 /*Device does not currently work correctly and will be disabled in a release build*/ }; + +int model_get_config_int(char *s); +char *model_get_config_string(char *s); diff --git a/src/gameport.c b/src/gameport.c index 527148d..5d16123 100644 --- a/src/gameport.c +++ b/src/gameport.c @@ -178,9 +178,12 @@ void gameport_update_joystick_type() { gameport_t *gameport = gameport_global; - gameport->joystick->close(gameport->joystick_dat); - gameport->joystick = joystick_list[joystick_type]; - gameport->joystick_dat = gameport->joystick->init(); + if (gameport) + { + gameport->joystick->close(gameport->joystick_dat); + gameport->joystick = joystick_list[joystick_type]; + gameport->joystick_dat = gameport->joystick->init(); + } } void *gameport_init() diff --git a/src/ibm.h b/src/ibm.h index ae213fe..b15cb86 100644 --- a/src/ibm.h +++ b/src/ibm.h @@ -432,7 +432,6 @@ int cpuspeed; /*Video*/ int readflash; extern int egareads,egawrites; -extern int cga_comp; extern int vid_resize; extern int vid_api; extern int winsizex,winsizey; diff --git a/src/model.c b/src/model.c index 6eab153..8cb710e 100644 --- a/src/model.c +++ b/src/model.c @@ -48,6 +48,8 @@ #include "tandy_rom.h" #include "um8669f.h" #include "um8881f.h" +#include "vid_pcjr.h" +#include "vid_tandy.h" #include "wd76c10.h" #include "xtide.h" @@ -81,48 +83,48 @@ int AMSTRAD, AT, PCI, TANDY; MODEL models[] = { - {"IBM PC", ROM_IBMPC, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init}, - {"IBM XT", ROM_IBMXT, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 128, 640, 64, xt_init}, - {"IBM PCjr", ROM_IBMPCJR, { "", cpus_pcjr, "", NULL, "", NULL}, 1, 0, 128, 640, 128, pcjr_init}, - {"Generic XT clone", ROM_GENXT, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 128, 640, 64, xt_init}, - {"AMI XT clone", ROM_AMIXT, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 128, 640, 64, xt_init}, - {"DTK XT clone", ROM_DTKXT, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 128, 640, 64, xt_init}, - {"VTech Laser Turbo XT",ROM_LTXT, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 128, 640, 64, xt_init}, - {"VTech Laser XT3", ROM_LXT3, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 128, 640, 64, xt_init}, - {"Phoenix XT clone", ROM_PXXT, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 128, 640, 64, xt_init}, - {"Juko XT clone", ROM_JUKOPC, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 128, 640, 64, xt_init}, - {"Tandy 1000", ROM_TANDY, { "", cpus_8088, "", NULL, "", NULL}, 1, 0, 128, 640, 128, tandy1k_init}, - {"Tandy 1000 HX", ROM_TANDY1000HX, { "", cpus_8088, "", NULL, "", NULL}, 1, 0, 256, 640, 128, tandy1k_init}, - {"Tandy 1000 SL/2", ROM_TANDY1000SL2,{ "", cpus_8086, "", NULL, "", NULL}, 1, 0, 512, 768, 128, tandy1ksl2_init}, - {"Amstrad PC1512", ROM_PC1512, { "", cpus_pc1512, "", NULL, "", NULL}, 1, 0, 512, 640, 128, ams_init}, - {"Sinclair PC200", ROM_PC200, { "", cpus_8086, "", NULL, "", NULL}, 1, 0, 512, 640, 128, ams_init}, - {"Euro PC", ROM_EUROPC, { "", cpus_8086, "", NULL, "", NULL}, 0, 0, 512, 640, 128, europc_init}, - {"Olivetti M24", ROM_OLIM24, { "", cpus_8086, "", NULL, "", NULL}, 1, 0, 128, 640, 128, olim24_init}, - {"Amstrad PC1640", ROM_PC1640, { "", cpus_8086, "", NULL, "", NULL}, 1, 0, 640, 640, 0, ams_init}, - {"Amstrad PC2086", ROM_PC2086, { "", cpus_8086, "", NULL, "", NULL}, 1, 0, 640, 640, 0, ams_init}, - {"Amstrad PC3086", ROM_PC3086, { "", cpus_8086, "", NULL, "", NULL}, 1, 0, 640, 640, 0, ams_init}, - {"IBM AT", ROM_IBMAT, { "", cpus_ibmat, "", NULL, "", NULL}, 0, 1, 1, 16, 1, at_init}, - {"Commodore PC 30 III", ROM_CMDPC30, { "", cpus_286, "", NULL, "", NULL}, 0, 1, 1, 16, 1, at_init}, - {"AMI 286 clone", ROM_AMI286, { "", cpus_286, "", NULL, "", NULL}, 0, 1, 1, 16, 1, at_neat_init}, - {"Award 286 clone", ROM_AWARD286, { "", cpus_286, "", NULL, "", NULL}, 0, 1, 1, 16, 1, at_scat_init}, - {"DELL System 200", ROM_DELL200, { "", cpus_286, "", NULL, "", NULL}, 0, 1, 1, 16, 1, at_init}, - {"IBM PS/1 model 2011", ROM_IBMPS1_2011, { "", cpus_ps1_m2011,"", NULL, "", NULL}, 1, 1, 1, 16, 1, ps1_m2011_init}, - {"IBM PS/1 model 2121", ROM_IBMPS1_2121, { "Intel", cpus_i386, "", NULL, "", NULL}, 1, 1, 1, 16, 1, ps1_m2121_init}, - {"Compaq Deskpro 386", ROM_DESKPRO_386, { "Intel", cpus_i386, "AMD", cpus_Am386, "Cyrix", cpus_486SDLC}, 0, 1, 1, 15, 1, deskpro386_init}, - {"Acer 386SX25/N", ROM_ACER386, { "Intel", cpus_acer, "", NULL, "", NULL}, 1, 1, 1, 16, 1, at_acer386sx_init}, - {"DTK 386SX clone", ROM_DTK386, { "Intel", cpus_i386, "AMD", cpus_Am386, "Cyrix", cpus_486SDLC}, 0, 1, 1, 16, 1, at_neat_init}, - {"Phoenix 386 clone", ROM_PX386, { "Intel", cpus_i386, "AMD", cpus_Am386, "Cyrix", cpus_486SDLC}, 0, 1, 1, 16, 1, at_init}, - {"Amstrad MegaPC", ROM_MEGAPC, { "Intel", cpus_i386, "AMD", cpus_Am386, "Cyrix", cpus_486SDLC}, 1, 1, 1, 16, 1, at_wd76c10_init}, - {"AMI 386SX clone", ROM_AMI386SX, { "Intel", cpus_i386, "AMD", cpus_Am386, "Cyrix", cpus_486SDLC}, 0, 1, 1, 256, 1, at_headland_init}, - {"MR 386DX clone", ROM_MR386DX_OPTI495, { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC}, 0, 1, 1, 256, 1, at_opti495_init}, - {"AMI 386DX clone", ROM_AMI386DX_OPTI495, { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC}, 0, 1, 1, 256, 1, at_opti495_init}, - {"AMI 486 clone", ROM_AMI486, { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486}, 0, 1, 1, 256, 1, at_ali1429_init}, - {"AMI WinBIOS 486", ROM_WIN486, { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486}, 0, 1, 1, 256, 1, at_ali1429_init}, + {"IBM PC", ROM_IBMPC, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"IBM XT", ROM_IBMXT, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 128, 640, 64, xt_init, NULL}, + {"IBM PCjr", ROM_IBMPCJR, { "", cpus_pcjr, "", NULL, "", NULL}, 1, 0, 128, 640, 128, pcjr_init, &pcjr_device}, + {"Generic XT clone", ROM_GENXT, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 128, 640, 64, xt_init, NULL}, + {"AMI XT clone", ROM_AMIXT, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 128, 640, 64, xt_init, NULL}, + {"DTK XT clone", ROM_DTKXT, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 128, 640, 64, xt_init, NULL}, + {"VTech Laser Turbo XT",ROM_LTXT, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 128, 640, 64, xt_init, NULL}, + {"VTech Laser XT3", ROM_LXT3, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 128, 640, 64, xt_init, NULL}, + {"Phoenix XT clone", ROM_PXXT, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 128, 640, 64, xt_init, NULL}, + {"Juko XT clone", ROM_JUKOPC, { "", cpus_8088, "", NULL, "", NULL}, 0, 0, 128, 640, 64, xt_init, NULL}, + {"Tandy 1000", ROM_TANDY, { "", cpus_8088, "", NULL, "", NULL}, 1, 0, 128, 640, 128, tandy1k_init, &tandy1000_device}, + {"Tandy 1000 HX", ROM_TANDY1000HX, { "", cpus_8088, "", NULL, "", NULL}, 1, 0, 256, 640, 128, tandy1k_init, &tandy1000hx_device}, + {"Tandy 1000 SL/2", ROM_TANDY1000SL2,{ "", cpus_8086, "", NULL, "", NULL}, 1, 0, 512, 768, 128, tandy1ksl2_init, NULL}, + {"Amstrad PC1512", ROM_PC1512, { "", cpus_pc1512, "", NULL, "", NULL}, 1, 0, 512, 640, 128, ams_init, NULL}, + {"Sinclair PC200", ROM_PC200, { "", cpus_8086, "", NULL, "", NULL}, 1, 0, 512, 640, 128, ams_init, NULL}, + {"Euro PC", ROM_EUROPC, { "", cpus_8086, "", NULL, "", NULL}, 0, 0, 512, 640, 128, europc_init, NULL}, + {"Olivetti M24", ROM_OLIM24, { "", cpus_8086, "", NULL, "", NULL}, 1, 0, 128, 640, 128, olim24_init, NULL}, + {"Amstrad PC1640", ROM_PC1640, { "", cpus_8086, "", NULL, "", NULL}, 1, 0, 640, 640, 0, ams_init, NULL}, + {"Amstrad PC2086", ROM_PC2086, { "", cpus_8086, "", NULL, "", NULL}, 1, 0, 640, 640, 0, ams_init, NULL}, + {"Amstrad PC3086", ROM_PC3086, { "", cpus_8086, "", NULL, "", NULL}, 1, 0, 640, 640, 0, ams_init, NULL}, + {"IBM AT", ROM_IBMAT, { "", cpus_ibmat, "", NULL, "", NULL}, 0, 1, 1, 16, 1, at_init, NULL}, + {"Commodore PC 30 III", ROM_CMDPC30, { "", cpus_286, "", NULL, "", NULL}, 0, 1, 1, 16, 1, at_init, NULL}, + {"AMI 286 clone", ROM_AMI286, { "", cpus_286, "", NULL, "", NULL}, 0, 1, 1, 16, 1, at_neat_init, NULL}, + {"Award 286 clone", ROM_AWARD286, { "", cpus_286, "", NULL, "", NULL}, 0, 1, 1, 16, 1, at_scat_init, NULL}, + {"DELL System 200", ROM_DELL200, { "", cpus_286, "", NULL, "", NULL}, 0, 1, 1, 16, 1, at_init, NULL}, + {"IBM PS/1 model 2011", ROM_IBMPS1_2011, { "", cpus_ps1_m2011,"", NULL, "", NULL}, 1, 1, 1, 16, 1, ps1_m2011_init, NULL}, + {"IBM PS/1 model 2121", ROM_IBMPS1_2121, { "Intel", cpus_i386, "", NULL, "", NULL}, 1, 1, 1, 16, 1, ps1_m2121_init, NULL}, + {"Compaq Deskpro 386", ROM_DESKPRO_386, { "Intel", cpus_i386, "AMD", cpus_Am386, "Cyrix", cpus_486SDLC}, 0, 1, 1, 15, 1, deskpro386_init, NULL}, + {"Acer 386SX25/N", ROM_ACER386, { "Intel", cpus_acer, "", NULL, "", NULL}, 1, 1, 1, 16, 1, at_acer386sx_init, NULL}, + {"DTK 386SX clone", ROM_DTK386, { "Intel", cpus_i386, "AMD", cpus_Am386, "Cyrix", cpus_486SDLC}, 0, 1, 1, 16, 1, at_neat_init, NULL}, + {"Phoenix 386 clone", ROM_PX386, { "Intel", cpus_i386, "AMD", cpus_Am386, "Cyrix", cpus_486SDLC}, 0, 1, 1, 16, 1, at_init, NULL}, + {"Amstrad MegaPC", ROM_MEGAPC, { "Intel", cpus_i386, "AMD", cpus_Am386, "Cyrix", cpus_486SDLC}, 1, 1, 1, 16, 1, at_wd76c10_init, NULL}, + {"AMI 386SX clone", ROM_AMI386SX, { "Intel", cpus_i386, "AMD", cpus_Am386, "Cyrix", cpus_486SDLC}, 0, 1, 1, 256, 1, at_headland_init, NULL}, + {"MR 386DX clone", ROM_MR386DX_OPTI495, { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC}, 0, 1, 1, 256, 1, at_opti495_init, NULL}, + {"AMI 386DX clone", ROM_AMI386DX_OPTI495, { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC}, 0, 1, 1, 256, 1, at_opti495_init, NULL}, + {"AMI 486 clone", ROM_AMI486, { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486}, 0, 1, 1, 256, 1, at_ali1429_init, NULL}, + {"AMI WinBIOS 486", ROM_WIN486, { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486}, 0, 1, 1, 256, 1, at_ali1429_init, NULL}, /* {"AMI WinBIOS 486 PCI", ROM_PCI486, { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486}, 0, 1, 1, 256, 1, at_um8881f_init},*/ - {"Award SiS 496/497", ROM_SIS496, { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486}, 0, 1, 1, 256, 1, at_sis496_init}, - {"Intel Premiere/PCI", ROM_REVENGE, { "Intel", cpus_Pentium5V, "", NULL, "", NULL}, 0, 1, 1, 128, 1, at_batman_init}, - {"Intel Advanced/EV", ROM_ENDEAVOR, { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "", NULL}, 0, 1, 1, 128, 1, at_endeavor_init}, - {"Award 430VX PCI", ROM_430VX, { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "", NULL}, 0, 1, 1, 256, 1, at_i430vx_init}, + {"Award SiS 496/497", ROM_SIS496, { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486}, 0, 1, 1, 256, 1, at_sis496_init, NULL}, + {"Intel Premiere/PCI", ROM_REVENGE, { "Intel", cpus_Pentium5V, "", NULL, "", NULL}, 0, 1, 1, 128, 1, at_batman_init, NULL}, + {"Intel Advanced/EV", ROM_ENDEAVOR, { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "", NULL}, 0, 1, 1, 128, 1, at_endeavor_init, NULL}, + {"Award 430VX PCI", ROM_430VX, { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "", NULL}, 0, 1, 1, 256, 1, at_i430vx_init, NULL}, {"", -1, {"", 0, "", 0, "", 0}, 0,0,0, 0} }; @@ -155,6 +157,11 @@ char *model_getname() return models[model].name; } +device_t *model_getdevice(int model) +{ + return models[model].device; +} + void common_init() { dma_init(); @@ -420,4 +427,6 @@ void model_init() io_init(); models[model].init(); + if (models[model].device) + device_add(models[model].device); } diff --git a/src/model.h b/src/model.h index e575b82..c5a3d26 100644 --- a/src/model.h +++ b/src/model.h @@ -12,6 +12,7 @@ typedef struct int min_ram, max_ram; int ram_granularity; void (*init)(); + struct device_t *device; } MODEL; extern MODEL models[]; @@ -23,3 +24,4 @@ int model_getromset(); int model_getmodel(int romset); char *model_getname(); void model_init(); +struct device_t *model_getdevice(int model); diff --git a/src/pc.c b/src/pc.c index 581cd0f..90cd0cc 100644 --- a/src/pc.c +++ b/src/pc.c @@ -559,7 +559,6 @@ void closepc() END_OF_MAIN();*/ -int cga_comp=0; void loadconfig(char *fn) { @@ -612,8 +611,6 @@ void loadconfig(char *fn) if (p) strcpy(iso_path, p); else strcpy(iso_path, ""); - cga_comp = config_get_int(NULL, "cga_composite", 0); - vid_resize = config_get_int(NULL, "vid_resize", 0); vid_api = config_get_int(NULL, "vid_api", 0); video_fullscreen_scale = config_get_int(NULL, "video_fullscreen_scale", 0); @@ -705,7 +702,6 @@ void saveconfig() config_set_int(NULL, "sndcard", sound_card_current); config_set_int(NULL, "cpu_speed", cpuspeed); config_set_int(NULL, "has_fpu", hasfpu); - config_set_int(NULL, "cga_composite", cga_comp); config_set_string(NULL, "disc_a", discfns[0]); config_set_string(NULL, "disc_b", discfns[1]); config_set_int(NULL, "mem_size", mem_size); diff --git a/src/pc.rc b/src/pc.rc index e5d5e1a..07a13e5 100644 --- a/src/pc.rc +++ b/src/pc.rc @@ -57,14 +57,15 @@ BEGIN END END -ConfigureDlg DIALOGEX 0, 0, 232+40, 388 +ConfigureDlg DIALOGEX 0, 0, 232+40, 372 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Configure PCem" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "OK",IDOK,64,364,50,14, WS_TABSTOP - PUSHBUTTON "Cancel",IDCANCEL,128,364,50,14, WS_TABSTOP + DEFPUSHBUTTON "OK",IDOK,64,348,50,14, WS_TABSTOP + PUSHBUTTON "Cancel",IDCANCEL,128,348,50,14, WS_TABSTOP COMBOBOX IDC_COMBO1,62,16,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Configure", IDC_CONFIGUREMOD, 224, 16, 40, 14, 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 @@ -80,10 +81,9 @@ BEGIN CONTROL "CMS / Game Blaster",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,272,118,10 CONTROL "Gravis Ultrasound",IDC_CHECKGUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,288,118,10 CONTROL "Innovation SSI-2001",IDC_CHECKSSI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,304,118,10 - CONTROL "Composite CGA",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,320,118,10 - CONTROL "Synchronise time to host clock",IDC_CHECKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,336,118,10 - CONTROL "Voodoo Graphics",IDC_CHECKVOODOO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,352,118,10 - PUSHBUTTON "Configure", IDC_CONFIGUREVOODOO, 224, 352, 40, 14, WS_TABSTOP + CONTROL "Synchronise time to host clock",IDC_CHECKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,320,118,10 + CONTROL "Voodoo Graphics",IDC_CHECKVOODOO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,336,118,10 + PUSHBUTTON "Configure", IDC_CONFIGUREVOODOO, 224, 336, 40, 14, WS_TABSTOP 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 diff --git a/src/resources.h b/src/resources.h index 3ac4583..e27e573 100644 --- a/src/resources.h +++ b/src/resources.h @@ -28,7 +28,6 @@ #define IDC_COMBO1 1000 #define IDC_COMBOVID 1001 #define IDC_COMBO3 1002 -#define IDC_COMBO4 1003 #define IDC_COMBO5 1004 #define IDC_COMBO386 1005 #define IDC_COMBO486 1006 @@ -118,6 +117,7 @@ #define IDC_CONFIGUREVID 1200 #define IDC_CONFIGURESND 1201 #define IDC_CONFIGUREVOODOO 1202 +#define IDC_CONFIGUREMOD 1203 #define IDC_JOY1 1210 #define IDC_JOY2 1211 #define IDC_JOY3 1212 diff --git a/src/vid_pcjr.c b/src/vid_pcjr.c index 8e6a63e..9cf9845 100644 --- a/src/vid_pcjr.c +++ b/src/vid_pcjr.c @@ -8,6 +8,9 @@ #include "video.h" #include "vid_pcjr.h" +#define PCJR_RGB 0 +#define PCJR_COMPOSITE 1 + static int i_filt[8],q_filt[8]; typedef struct pcjr_t @@ -35,6 +38,8 @@ typedef struct pcjr_t int dispontime, dispofftime, vidtime; int firstline, lastline; + + int composite; } pcjr_t; static uint8_t crtcmask[32] = @@ -427,7 +432,7 @@ void pcjr_poll(void *p) } if (pcjr->array[0] & 1) x = (pcjr->crtc[1] << 3) + 16; else x = (pcjr->crtc[1] << 4) + 16; - if (cga_comp) + if (pcjr->composite) { for (c = 0; c < x; c++) { @@ -577,7 +582,7 @@ void pcjr_poll(void *p) // printf("Blit %i %i\n",firstline,lastline); //printf("Xsize is %i\n",xsize); - if (cga_comp) + if (pcjr->composite) video_blit_memtoscreen(0, pcjr->firstline-4, 0, (pcjr->lastline - pcjr->firstline) + 8, xsize, (pcjr->lastline - pcjr->firstline) + 8); else video_blit_memtoscreen_8(0, pcjr->firstline-4, xsize, (pcjr->lastline - pcjr->firstline) + 8); @@ -606,9 +611,14 @@ static void *pcjr_video_init() { int c; int pcjr_tint = -2; + int display_type; pcjr_t *pcjr = malloc(sizeof(pcjr_t)); memset(pcjr, 0, sizeof(pcjr_t)); + display_type = model_get_config_int("display_type"); + pcjr->composite = (display_type != PCJR_RGB); + pclog("display_type = %i\n", display_type); + pcjr->memctrl = -1; for (c = 0; c < 8; c++) @@ -647,3 +657,45 @@ device_t pcjr_video_device = NULL, NULL }; + +static device_config_t pcjr_config[] = +{ + { + .name = "display_type", + .description = "Display type", + .type = CONFIG_SELECTION, + .selection = + { + { + .description = "RGB", + .value = PCJR_RGB + }, + { + .description = "Composite", + .value = PCJR_COMPOSITE + }, + { + .description = "" + } + }, + .default_int = PCJR_RGB + }, + { + .type = -1 + } +}; + +/*This isn't really a device as such - more of a convenient way to hook in the + config information*/ +device_t pcjr_device = +{ + "IBM PCjr", + 0, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + pcjr_config +}; diff --git a/src/vid_pcjr.h b/src/vid_pcjr.h index 21655c6..bc6bcbd 100644 --- a/src/vid_pcjr.h +++ b/src/vid_pcjr.h @@ -1 +1,2 @@ extern device_t pcjr_video_device; +extern device_t pcjr_device; diff --git a/src/vid_tandy.c b/src/vid_tandy.c index e154cc8..ffc5ec8 100644 --- a/src/vid_tandy.c +++ b/src/vid_tandy.c @@ -8,6 +8,9 @@ #include "video.h" #include "vid_tandy.h" +#define TANDY_RGB 0 +#define TANDY_COMPOSITE 1 + static int i_filt[8],q_filt[8]; typedef struct tandy_t @@ -37,6 +40,8 @@ typedef struct tandy_t int dispontime, dispofftime, vidtime; int firstline, lastline; + + int composite; } tandy_t; static uint8_t crtcmask[32] = @@ -467,7 +472,7 @@ void tandy_poll(void *p) } if (tandy->mode & 1) x = (tandy->crtc[1] << 3) + 16; else x = (tandy->crtc[1] << 4) + 16; - if (cga_comp) + if (tandy->composite) { for (c = 0; c < x; c++) { @@ -615,7 +620,7 @@ void tandy_poll(void *p) // printf("Blit %i %i\n",firstline,lastline); //printf("Xsize is %i\n",xsize); - if (cga_comp) + if (tandy->composite) video_blit_memtoscreen(0, tandy->firstline-4, 0, (tandy->lastline - tandy->firstline) + 8, xsize, (tandy->lastline - tandy->firstline) + 8); else video_blit_memtoscreen_8(0, tandy->firstline-4, xsize, (tandy->lastline - tandy->firstline) + 8); @@ -675,9 +680,14 @@ void *tandy_init() { int c; int tandy_tint = -2; + int display_type; tandy_t *tandy = malloc(sizeof(tandy_t)); memset(tandy, 0, sizeof(tandy_t)); + display_type = model_get_config_int("display_type"); + tandy->composite = (display_type != TANDY_RGB); + pclog("display_type = %i\n", display_type); + tandy->memctrl = -1; tandy->base = (mem_size - 128) * 1024; @@ -723,3 +733,57 @@ device_t tandy_device = NULL, NULL }; + +static device_config_t tandy_config[] = +{ + { + .name = "display_type", + .description = "Display type", + .type = CONFIG_SELECTION, + .selection = + { + { + .description = "RGB", + .value = TANDY_RGB + }, + { + .description = "Composite", + .value = TANDY_COMPOSITE + }, + { + .description = "" + } + }, + .default_int = TANDY_RGB + }, + { + .type = -1 + } +}; + +/*These aren't really devices as such - more of a convenient way to hook in the + config information*/ +device_t tandy1000_device = +{ + "Tandy 1000", + 0, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + tandy_config +}; +device_t tandy1000hx_device = +{ + "Tandy 1000HX", + 0, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + tandy_config +}; diff --git a/src/vid_tandy.h b/src/vid_tandy.h index f0a386f..8225726 100644 --- a/src/vid_tandy.h +++ b/src/vid_tandy.h @@ -1 +1,4 @@ extern device_t tandy_device; + +extern device_t tandy1000_device; +extern device_t tandy1000hx_device; diff --git a/src/win-config.c b/src/win-config.c index 62105e9..a4c9c26 100644 --- a/src/win-config.c +++ b/src/win-config.c @@ -138,9 +138,6 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR h=GetDlgItem(hdlg, IDC_CHECKSSI); SendMessage(h, BM_SETCHECK, SSI2001, 0); - h=GetDlgItem(hdlg, IDC_CHECK4); - SendMessage(h, BM_SETCHECK, cga_comp, 0); - h=GetDlgItem(hdlg, IDC_CHECKSYNC); SendMessage(h, BM_SETCHECK, enable_sync, 0); @@ -175,6 +172,12 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR accel.nInc = models[model].ram_granularity; SendMessage(h, UDM_SETACCEL, 1, (LPARAM)&accel); + h = GetDlgItem(hdlg, IDC_CONFIGUREMOD); + if (model_getdevice(model)) + EnableWindow(h, TRUE); + else + EnableWindow(h, FALSE); + h = GetDlgItem(hdlg, IDC_CONFIGUREVID); if (video_card_has_config(video_old_to_new(gfxcard))) EnableWindow(h, TRUE); @@ -348,9 +351,6 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR h = GetDlgItem(hdlg, IDC_COMBOSPD); video_speed = SendMessage(h, CB_GETCURSEL, 0, 0); - h = GetDlgItem(hdlg, IDC_CHECK4); - cga_comp=SendMessage(h, BM_GETCHECK, 0, 0); - cpu_manufacturer = temp_cpu_m; cpu = temp_cpu; cpu_set(); @@ -464,6 +464,12 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR EnableWindow(h, TRUE); else EnableWindow(h, FALSE); + + h = GetDlgItem(hdlg, IDC_CONFIGUREMOD); + if (model_getdevice(temp_model)) + EnableWindow(h, TRUE); + else + EnableWindow(h, FALSE); } break; case IDC_COMBOCPUM: @@ -537,6 +543,13 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR } break; + case IDC_CONFIGUREMOD: + h = GetDlgItem(hdlg, IDC_COMBO1); + temp_model = listtomodel[SendMessage(h, CB_GETCURSEL, 0, 0)]; + + deviceconfig_open(hdlg, (void *)model_getdevice(temp_model)); + break; + case IDC_CONFIGUREVID: h = GetDlgItem(hdlg, IDC_COMBOVID); SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM)temp_str);