Fixed ROM autoselection.

Video card menu now only lists cards for which ROMs are present again.
This commit is contained in:
TomW 2013-12-29 15:33:29 +00:00
commit c05d6693b6
3 changed files with 24 additions and 7 deletions

View file

@ -86,6 +86,20 @@ int model_getromset()
return models[model].id; 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() char *model_getname()
{ {
return models[model].name; return models[model].name;

View file

@ -16,5 +16,6 @@ extern MODEL models[];
extern int model; extern int model;
int model_getromset(); int model_getromset();
int model_getmodel(int romset);
char *model_getname(); char *model_getname();
void model_init(); void model_init();

View file

@ -14,7 +14,9 @@
#include "ibm.h" #include "ibm.h"
#include "video.h" #include "video.h"
#include "resources.h" #include "resources.h"
#include "cpu.h"
#include "ide.h" #include "ide.h"
#include "model.h"
#include "nvr.h" #include "nvr.h"
#include "sound.h" #include "sound.h"
@ -374,8 +376,10 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
{ {
if (romspresent[c]) if (romspresent[c])
{ {
romset=c; romset = c;
loadbios(); model = model_getmodel(romset);
saveconfig();
resetpchard();
break; break;
} }
} }
@ -397,7 +401,8 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
if (gfx_present[c]) if (gfx_present[c])
{ {
gfxcard = c; gfxcard = c;
mem_load_video_bios(); saveconfig();
resetpchard();
break; 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,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) BOOL CALLBACK configdlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
char temp_str[256]; char temp_str[256];
@ -645,7 +647,7 @@ BOOL CALLBACK configdlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPara
if (!s[0]) if (!s[0])
break; 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); SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s);
if (video_new_to_old(c) == gfxcard) if (video_new_to_old(c) == gfxcard)