From c05d6693b6fd1b207f270457e5a637a87604b3f3 Mon Sep 17 00:00:00 2001 From: TomW Date: Sun, 29 Dec 2013 15:33:29 +0000 Subject: [PATCH] Fixed ROM autoselection. Video card menu now only lists cards for which ROMs are present again. --- src/model.c | 14 ++++++++++++++ src/model.h | 1 + src/win.c | 16 +++++++++------- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/model.c b/src/model.c index d621963..c96108c 100644 --- a/src/model.c +++ b/src/model.c @@ -86,6 +86,20 @@ int model_getromset() return models[model].id; } +int model_getmodel(int romset) +{ + int c = 0; + + while (models[c].id != -1) + { + if (models[c].id == romset) + return c; + c++; + } + + return 0; +} + char *model_getname() { return models[model].name; diff --git a/src/model.h b/src/model.h index 9931164..9f42c5c 100644 --- a/src/model.h +++ b/src/model.h @@ -16,5 +16,6 @@ extern MODEL models[]; extern int model; int model_getromset(); +int model_getmodel(int romset); char *model_getname(); void model_init(); diff --git a/src/win.c b/src/win.c index 35cf556..ac14ae4 100644 --- a/src/win.c +++ b/src/win.c @@ -14,7 +14,9 @@ #include "ibm.h" #include "video.h" #include "resources.h" +#include "cpu.h" #include "ide.h" +#include "model.h" #include "nvr.h" #include "sound.h" @@ -374,8 +376,10 @@ int WINAPI WinMain (HINSTANCE hThisInstance, { if (romspresent[c]) { - romset=c; - loadbios(); + romset = c; + model = model_getmodel(romset); + saveconfig(); + resetpchard(); break; } } @@ -397,7 +401,8 @@ int WINAPI WinMain (HINSTANCE hThisInstance, if (gfx_present[c]) { gfxcard = c; - mem_load_video_bios(); + saveconfig(); + resetpchard(); break; } } @@ -601,9 +606,6 @@ int mem_size_to_list[]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,15,15,15 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, 19}; -#include "cpu.h" -#include "model.h" - BOOL CALLBACK configdlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { char temp_str[256]; @@ -645,7 +647,7 @@ BOOL CALLBACK configdlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPara if (!s[0]) break; - if (video_card_available(c)) + if (video_card_available(c) && gfx_present[video_new_to_old(c)]) { SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s); if (video_new_to_old(c) == gfxcard)