Initial commit for config rework. Work in progress!

This commit is contained in:
SarahW 2017-05-04 18:27:10 +01:00
commit 8538116c19
11 changed files with 125 additions and 69 deletions

1
configs/configs.txt Normal file
View file

@ -0,0 +1 @@
This directory is used to store config files.

View file

@ -559,6 +559,7 @@ void resetpc();
void resetpchard(); void resetpchard();
void speedchanged(); void speedchanged();
void saveconfig(); void saveconfig(char *fn);
void getpath();
#define UNUSED(x) (void)x #define UNUSED(x) (void)x

View file

@ -54,7 +54,7 @@ uint32_t biosmask;
int readlnum=0,writelnum=0; int readlnum=0,writelnum=0;
int cachesize=256; int cachesize=256;
uint8_t *ram,*rom; uint8_t *ram, *rom = NULL;
uint8_t romext[32768]; uint8_t romext[32768];
static void mem_load_atide115_bios() static void mem_load_atide115_bios()
@ -81,6 +81,8 @@ int loadbios()
biosmask = 0xffff; biosmask = 0xffff;
if (!rom)
rom = malloc(0x20000);
memset(romext,0x63,0x4000); memset(romext,0x63,0x4000);
memset(rom, 0xff, 0x20000); memset(rom, 0xff, 0x20000);
@ -1774,7 +1776,7 @@ void mem_init()
int c; int c;
ram = malloc((mem_size + 384) * 1024); ram = malloc((mem_size + 384) * 1024);
rom = malloc(0x20000); // rom = malloc(0x20000);
readlookup2 = malloc(1024 * 1024 * sizeof(uintptr_t)); readlookup2 = malloc(1024 * 1024 * sizeof(uintptr_t));
writelookup2 = malloc(1024 * 1024 * sizeof(uintptr_t)); writelookup2 = malloc(1024 * 1024 * sizeof(uintptr_t));
biosmask = 0xffff; biosmask = 0xffff;

View file

@ -69,7 +69,7 @@ int framecount,fps;
int output; int output;
int atfullspeed; int atfullspeed;
void saveconfig(); void saveconfig(char *fn);
int infocus; int infocus;
int mousecapture; int mousecapture;
FILE *pclogf; FILE *pclogf;
@ -202,17 +202,23 @@ void pc_reset()
// video_init(); // video_init();
} }
#undef printf #undef printf
void initpc(int argc, char *argv[]) void getpath()
{ {
char *p; char *p;
char *config_file = NULL;
int c;
// allegro_init();
get_executable_name(pcempath,511); get_executable_name(pcempath,511);
pclog("executable_name = %s\n", pcempath); pclog("executable_name = %s\n", pcempath);
p=get_filename(pcempath); p=get_filename(pcempath);
*p=0; *p=0;
pclog("path = %s\n", pcempath); pclog("path = %s\n", pcempath);
}
void initpc(int argc, char *argv[])
{
//char *p;
char *config_file = NULL;
int c;
// allegro_init();
for (c = 1; c < argc; c++) for (c = 1; c < argc; c++)
{ {
@ -241,12 +247,12 @@ void initpc(int argc, char *argv[])
joystick_init(); joystick_init();
midi_init(); midi_init();
append_filename(config_file_default, pcempath, "pcem.cfg", 511); // append_filename(config_file_default, pcempath, "pcem.cfg", 511);
loadconfig(config_file); loadconfig(config_file);
pclog("Config loaded\n"); pclog("Config loaded\n");
if (config_file) // if (config_file)
saveconfig(); // saveconfig();
cpuspeed2=(AT)?2:1; cpuspeed2=(AT)?2:1;
// cpuspeed2=cpuspeed; // cpuspeed2=cpuspeed;
@ -713,7 +719,7 @@ void loadconfig(char *fn)
enable_sync = config_get_int(NULL, "enable_sync", 1); enable_sync = config_get_int(NULL, "enable_sync", 1);
} }
void saveconfig() void saveconfig(char *fn)
{ {
int c, d; int c, d;
@ -810,5 +816,9 @@ void saveconfig()
config_set_int(NULL, "enable_sync", enable_sync); config_set_int(NULL, "enable_sync", enable_sync);
pclog("config_save(%s)\n", config_file_default);
if (fn)
config_save(fn);
else
config_save(config_file_default); config_save(config_file_default);
} }

View file

@ -54,8 +54,7 @@ BEGIN
MENUITEM "Disc activity indicator", IDM_VID_DISC MENUITEM "Disc activity indicator", IDM_VID_DISC
END END
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Load configuration...", IDM_CONFIG_LOAD MENUITEM "&Select configuration...", IDM_CONFIG_SELECT
MENUITEM "&Save configuration...", IDM_CONFIG_SAVE
END END
POPUP "&Misc" POPUP "&Misc"
BEGIN BEGIN
@ -317,3 +316,15 @@ BEGIN
COMBOBOX IDC_HDTYPE, 7,54,172,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_HDTYPE, 7,54,172,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
END END
ConfigureSelectionDlg DIALOGEX 0, 0, 200, 150
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Select Configuration"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK", IDOK, 200-54, 4, 50, 14, WS_TABSTOP
DEFPUSHBUTTON "Cancel", IDCANCEL, 200-54,22, 50, 14, WS_TABSTOP
DEFPUSHBUTTON "New...", IDC_NEW, 200-54,40, 50, 14, WS_TABSTOP
LISTBOX IDC_LIST, 4, 4,140,142, WS_TABSTOP
END

View file

@ -9,8 +9,7 @@
#define IDM_HDCONF 40014 #define IDM_HDCONF 40014
#define IDM_BPB_DISABLE 40015 #define IDM_BPB_DISABLE 40015
#define IDM_CONFIG 40020 #define IDM_CONFIG 40020
#define IDM_CONFIG_LOAD 40021 #define IDM_CONFIG_SELECT 40021
#define IDM_CONFIG_SAVE 40022
#define IDM_STATUS 40030 #define IDM_STATUS 40030
#define IDM_VID_RESIZE 40050 #define IDM_VID_RESIZE 40050
#define IDM_VID_REMEMBER 40051 #define IDM_VID_REMEMBER 40051
@ -134,3 +133,6 @@
#define WM_RESETD3D WM_USER #define WM_RESETD3D WM_USER
#define WM_LEAVEFULLSCREEN WM_USER + 1 #define WM_LEAVEFULLSCREEN WM_USER + 1
#define IDC_NEW 1200
#define IDC_LIST 1201

View file

@ -27,6 +27,8 @@ static int settings_sound_to_list[20], settings_list_to_sound[20];
static int settings_mouse_to_list[20], settings_list_to_mouse[20]; static int settings_mouse_to_list[20], settings_list_to_mouse[20];
static char *hdd_names[16]; static char *hdd_names[16];
static int has_been_inited = 0;
static int mouse_valid(int type, int model) static int mouse_valid(int type, int model)
{ {
if ((type & MOUSE_TYPE_IF_MASK) == MOUSE_TYPE_PS2 && !(models[model].flags & MODEL_PS2)) if ((type & MOUSE_TYPE_IF_MASK) == MOUSE_TYPE_PS2 && !(models[model].flags & MODEL_PS2))
@ -471,7 +473,7 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
temp_fda_type != fdd_get_type(0) || temp_fdb_type != fdd_get_type(1) || temp_fda_type != fdd_get_type(0) || temp_fdb_type != fdd_get_type(1) ||
temp_mouse_type != mouse_type || hdd_changed) temp_mouse_type != mouse_type || hdd_changed)
{ {
if (MessageBox(NULL,"This will reset PCem!\nOkay to continue?","PCem",MB_OKCANCEL)==IDOK) if (!has_been_inited || MessageBox(NULL,"This will reset PCem!\nOkay to continue?","PCem",MB_OKCANCEL)==IDOK)
{ {
savenvr(); savenvr();
model = temp_model; model = temp_model;
@ -496,11 +498,13 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
else else
strcpy(hdd_controller_name, "none"); strcpy(hdd_controller_name, "none");
if (has_been_inited)
{
mem_resize(); mem_resize();
loadbios(); loadbios();
resetpchard(); resetpchard();
} }
}
else else
{ {
EndDialog(hdlg, 0); EndDialog(hdlg, 0);
@ -520,7 +524,8 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
cpu_waitstates = SendMessage(h, CB_GETCURSEL, 0, 0); cpu_waitstates = SendMessage(h, CB_GETCURSEL, 0, 0);
cpu_update_waitstates(); cpu_update_waitstates();
saveconfig(); if (has_been_inited)
saveconfig(NULL);
speedchanged(); speedchanged();
@ -810,7 +815,9 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
return FALSE; return FALSE;
} }
void config_open(HWND hwnd) void config_open(HWND hwnd, int inited)
{ {
has_been_inited = inited;
DialogBox(hinstance, TEXT("ConfigureDlg"), hwnd, (DLGPROC)config_dlgproc); DialogBox(hinstance, TEXT("ConfigureDlg"), hwnd, (DLGPROC)config_dlgproc);
} }

View file

@ -178,7 +178,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
config++; config++;
} }
saveconfig(); saveconfig(NULL);
resetpchard(); resetpchard();

View file

@ -205,7 +205,7 @@ static BOOL CALLBACK hdnew_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARA
return TRUE; return TRUE;
case IDC_CFILE: case IDC_CFILE:
if (!getsfile(hdlg, "Hard disc image (*.IMG)\0*.IMG\0All files (*.*)\0*.*\0", "")) if (!getsfile(hdlg, "Hard disc image (*.IMG)\0*.IMG\0All files (*.*)\0*.*\0", "", NULL))
{ {
h = GetDlgItem(hdlg, IDC_EDITC); h = GetDlgItem(hdlg, IDC_EDITC);
SendMessage(h, WM_SETTEXT, 0, (LPARAM)openfilestring); SendMessage(h, WM_SETTEXT, 0, (LPARAM)openfilestring);
@ -515,7 +515,7 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
cdrom_channel = new_cdrom_channel; cdrom_channel = new_cdrom_channel;
saveconfig(); saveconfig(NULL);
resetpchard(); resetpchard();
} }

View file

@ -173,6 +173,7 @@ void mainthread(LPVOID param)
// Sleep(500); // Sleep(500);
drawits=0; drawits=0;
old_time = GetTickCount(); old_time = GetTickCount();
while (!quited) while (!quited)
{ {
if (updatestatus) if (updatestatus)
@ -555,6 +556,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
/* Make the window visible on the screen */ /* Make the window visible on the screen */
ShowWindow (hwnd, nFunsterStil); ShowWindow (hwnd, nFunsterStil);
ghMutex = CreateMutex(NULL, FALSE, NULL);
// win_set_window(hwnd); // win_set_window(hwnd);
memset(rawinputkey, 0, sizeof(rawinputkey)); memset(rawinputkey, 0, sizeof(rawinputkey));
@ -572,9 +574,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
ghwnd=hwnd; ghwnd=hwnd;
initpc(argc, argv); getpath();
vid_apis[0][vid_api].init(ghwnd);
if (vid_resize) SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW|WS_VISIBLE); if (vid_resize) SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW|WS_VISIBLE);
else SetWindowLong(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW&~WS_SIZEBOX&~WS_THICKFRAME&~WS_MAXIMIZEBOX)|WS_VISIBLE); else SetWindowLong(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW&~WS_SIZEBOX&~WS_THICKFRAME&~WS_MAXIMIZEBOX)|WS_VISIBLE);
@ -618,9 +618,18 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
} }
romset=d; romset=d;
c=loadbios();
if (!c) for (c = 0; c < GFX_MAX; c++)
gfx_present[c] = video_card_available(video_old_to_new(c));
loadconfig(NULL);
if (!config_selection_open(ghwnd, 0))
return 0;
initpc(argc, argv);
if (!loadbios())
{ {
if (romset!=-1) MessageBox(hwnd,"Configured romset not available.\nDefaulting to available romset.","PCem error",MB_OK); if (romset!=-1) MessageBox(hwnd,"Configured romset not available.\nDefaulting to available romset.","PCem error",MB_OK);
for (c=0;c<ROM_MAX;c++) for (c=0;c<ROM_MAX;c++)
@ -629,17 +638,13 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
{ {
romset = c; romset = c;
model = model_getmodel(romset); model = model_getmodel(romset);
saveconfig(); // saveconfig();
resetpchard(); // resetpchard();
break; break;
} }
} }
} }
for (c = 0; c < GFX_MAX; c++)
gfx_present[c] = video_card_available(video_old_to_new(c));
if (!video_card_available(video_old_to_new(gfxcard))) if (!video_card_available(video_old_to_new(gfxcard)))
{ {
if (romset!=-1) MessageBox(hwnd,"Configured video BIOS not available.\nDefaulting to available romset.","PCem error",MB_OK); if (romset!=-1) MessageBox(hwnd,"Configured video BIOS not available.\nDefaulting to available romset.","PCem error",MB_OK);
@ -648,8 +653,8 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
if (gfx_present[c]) if (gfx_present[c])
{ {
gfxcard = c; gfxcard = c;
saveconfig(); // saveconfig();
resetpchard(); // resetpchard();
break; break;
} }
} }
@ -662,11 +667,12 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
atexit(releasemouse); atexit(releasemouse);
vid_apis[0][vid_api].init(ghwnd);
// QueryPerformanceFrequency(&counter_base); // QueryPerformanceFrequency(&counter_base);
/// QueryPerformanceCounter(&counter_posold); /// QueryPerformanceCounter(&counter_posold);
// counter_posold.QuadPart*=100; // counter_posold.QuadPart*=100;
ghMutex = CreateMutex(NULL, FALSE, NULL);
mainthreadh=(HANDLE)_beginthread(mainthread,0,NULL); mainthreadh=(HANDLE)_beginthread(mainthread,0,NULL);
SetThreadPriority(mainthreadh, THREAD_PRIORITY_HIGHEST); SetThreadPriority(mainthreadh, THREAD_PRIORITY_HIGHEST);
@ -681,6 +687,8 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
// ShowCursor(TRUE); // ShowCursor(TRUE);
// return 0;
if (start_in_fullscreen) if (start_in_fullscreen)
{ {
startblit(); startblit();
@ -748,7 +756,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
// pclog("Closepc\n"); // pclog("Closepc\n");
savenvr(); savenvr();
if (save_window_pos && window_remember) if (save_window_pos && window_remember)
saveconfig(); saveconfig(NULL);
closepc(); closepc();
// pclog("dumpregs\n"); // pclog("dumpregs\n");
@ -810,7 +818,7 @@ int getfile(HWND hwnd, char *f, char *fn)
return 1; return 1;
} }
int getsfile(HWND hwnd, char *f, char *fn) int getsfile(HWND hwnd, char *f, char *fn, char *dir)
{ {
OPENFILENAME ofn; // common dialog box structure OPENFILENAME ofn; // common dialog box structure
BOOL r; BOOL r;
@ -832,7 +840,7 @@ int getsfile(HWND hwnd, char *f, char *fn)
ofn.nFilterIndex = 1; ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL; ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0; ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL; ofn.lpstrInitialDir = dir;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
// Display the Open dialog box. // Display the Open dialog box.
@ -933,7 +941,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{ {
disc_close(0); disc_close(0);
disc_load(0, openfilestring); disc_load(0, openfilestring);
saveconfig(); saveconfig(NULL);
} }
break; break;
case IDM_DISC_B: case IDM_DISC_B:
@ -941,27 +949,27 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{ {
disc_close(1); disc_close(1);
disc_load(1, openfilestring); disc_load(1, openfilestring);
saveconfig(); saveconfig(NULL);
} }
break; break;
case IDM_EJECT_A: case IDM_EJECT_A:
disc_close(0); disc_close(0);
saveconfig(); saveconfig(NULL);
break; break;
case IDM_EJECT_B: case IDM_EJECT_B:
disc_close(1); disc_close(1);
saveconfig(); saveconfig(NULL);
break; break;
case IDM_BPB_DISABLE: case IDM_BPB_DISABLE:
bpb_disable = !bpb_disable; bpb_disable = !bpb_disable;
CheckMenuItem(hmenu, IDM_BPB_DISABLE, bpb_disable ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hmenu, IDM_BPB_DISABLE, bpb_disable ? MF_CHECKED : MF_UNCHECKED);
saveconfig(); saveconfig(NULL);
break; break;
case IDM_HDCONF: case IDM_HDCONF:
hdconf_open(hwnd); hdconf_open(hwnd);
break; break;
case IDM_CONFIG: case IDM_CONFIG:
config_open(hwnd); config_open(hwnd, 1);
break; break;
case IDM_STATUS: case IDM_STATUS:
status_open(hwnd); status_open(hwnd);
@ -974,12 +982,12 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
else SetWindowLong(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW&~WS_SIZEBOX&~WS_THICKFRAME&~WS_MAXIMIZEBOX)|WS_VISIBLE); else SetWindowLong(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW&~WS_SIZEBOX&~WS_THICKFRAME&~WS_MAXIMIZEBOX)|WS_VISIBLE);
GetWindowRect(hwnd,&rect); GetWindowRect(hwnd,&rect);
SetWindowPos(hwnd, 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_FRAMECHANGED); SetWindowPos(hwnd, 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_FRAMECHANGED);
saveconfig(); saveconfig(NULL);
break; break;
case IDM_VID_ASPECT: case IDM_VID_ASPECT:
video_force_aspect_ration = !video_force_aspect_ration; video_force_aspect_ration = !video_force_aspect_ration;
CheckMenuItem(hmenu, IDM_VID_ASPECT, video_force_aspect_ration ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hmenu, IDM_VID_ASPECT, video_force_aspect_ration ? MF_CHECKED : MF_UNCHECKED);
saveconfig(); saveconfig(NULL);
break; break;
case IDM_VID_REMEMBER: case IDM_VID_REMEMBER:
window_remember = !window_remember; window_remember = !window_remember;
@ -992,7 +1000,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
window_w = rect.right - rect.left; window_w = rect.right - rect.left;
window_h = rect.bottom - rect.top; window_h = rect.bottom - rect.top;
} }
saveconfig(); saveconfig(NULL);
break; break;
case IDM_VID_DDRAW: case IDM_VID_D3D: case IDM_VID_DDRAW: case IDM_VID_D3D:
@ -1004,7 +1012,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
CheckMenuItem(hmenu, IDM_VID_DDRAW + vid_api, MF_CHECKED); CheckMenuItem(hmenu, IDM_VID_DDRAW + vid_api, MF_CHECKED);
vid_apis[0][vid_api].init(ghwnd); vid_apis[0][vid_api].init(ghwnd);
endblit(); endblit();
saveconfig(); saveconfig(NULL);
device_force_redraw(); device_force_redraw();
break; break;
@ -1033,16 +1041,28 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
CheckMenuItem(hmenu, IDM_VID_FS_FULL + video_fullscreen_scale, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_VID_FS_FULL + video_fullscreen_scale, MF_UNCHECKED);
video_fullscreen_scale = LOWORD(wParam) - IDM_VID_FS_FULL; video_fullscreen_scale = LOWORD(wParam) - IDM_VID_FS_FULL;
CheckMenuItem(hmenu, IDM_VID_FS_FULL + video_fullscreen_scale, MF_CHECKED); CheckMenuItem(hmenu, IDM_VID_FS_FULL + video_fullscreen_scale, MF_CHECKED);
saveconfig(); saveconfig(NULL);
break; break;
case IDM_VID_DISC: case IDM_VID_DISC:
vid_disc_indicator = !vid_disc_indicator; vid_disc_indicator = !vid_disc_indicator;
CheckMenuItem(hmenu, IDM_VID_DISC, vid_disc_indicator ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hmenu, IDM_VID_DISC, vid_disc_indicator ? MF_CHECKED : MF_UNCHECKED);
saveconfig(); saveconfig(NULL);
break; break;
case IDM_CONFIG_LOAD: case IDM_CONFIG_SELECT:
pause = 1;
if (config_selection_open(ghwnd, 1))
{
loadconfig(NULL);
mem_resize();
loadbios();
resetpchard();
}
pause = 0;
break;
/* case IDM_CONFIG_LOAD:
pause = 1; pause = 1;
if (!getfile(hwnd, "Configuration (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0", "")) if (!getfile(hwnd, "Configuration (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0", ""))
{ {
@ -1060,10 +1080,10 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case IDM_CONFIG_SAVE: case IDM_CONFIG_SAVE:
pause = 1; pause = 1;
if (!getsfile(hwnd, "Configuration (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0", "")) if (!getsfile(hwnd, "Configuration (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0", "", NULL))
config_save(openfilestring); config_save(openfilestring);
pause = 0; pause = 0;
break; break;*/
case IDM_CDROM_DISABLED: case IDM_CDROM_DISABLED:
if (cdrom_enabled) if (cdrom_enabled)
@ -1090,7 +1110,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
pause = 1; pause = 1;
Sleep(100); Sleep(100);
cdrom_enabled = 0; cdrom_enabled = 0;
saveconfig(); saveconfig(NULL);
resetpchard(); resetpchard();
pause = 0; pause = 0;
} }
@ -1121,13 +1141,13 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
old_cdrom_drive = cdrom_drive; old_cdrom_drive = cdrom_drive;
cdrom_drive=0; cdrom_drive=0;
CheckMenuItem(hmenu, IDM_CDROM_EMPTY, MF_CHECKED); CheckMenuItem(hmenu, IDM_CDROM_EMPTY, MF_CHECKED);
saveconfig(); saveconfig(NULL);
if (!cdrom_enabled) if (!cdrom_enabled)
{ {
pause = 1; pause = 1;
Sleep(100); Sleep(100);
cdrom_enabled = 1; cdrom_enabled = 1;
saveconfig(); saveconfig(NULL);
resetpchard(); resetpchard();
pause = 0; pause = 0;
} }
@ -1161,13 +1181,13 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
CheckMenuItem(hmenu, IDM_CDROM_ISO, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_CDROM_ISO, MF_UNCHECKED);
cdrom_drive = CDROM_ISO; cdrom_drive = CDROM_ISO;
CheckMenuItem(hmenu, IDM_CDROM_ISO, MF_CHECKED); CheckMenuItem(hmenu, IDM_CDROM_ISO, MF_CHECKED);
saveconfig(); saveconfig(NULL);
if (!cdrom_enabled) if (!cdrom_enabled)
{ {
pause = 1; pause = 1;
Sleep(100); Sleep(100);
cdrom_enabled = 1; cdrom_enabled = 1;
saveconfig(); saveconfig(NULL);
resetpchard(); resetpchard();
pause = 0; pause = 0;
} }
@ -1202,13 +1222,13 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
CheckMenuItem(hmenu, IDM_CDROM_ISO, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_CDROM_ISO, MF_UNCHECKED);
cdrom_drive = new_cdrom_drive; cdrom_drive = new_cdrom_drive;
CheckMenuItem(hmenu, IDM_CDROM_REAL + cdrom_drive, MF_CHECKED); CheckMenuItem(hmenu, IDM_CDROM_REAL + cdrom_drive, MF_CHECKED);
saveconfig(); saveconfig(NULL);
if (!cdrom_enabled) if (!cdrom_enabled)
{ {
pause = 1; pause = 1;
Sleep(100); Sleep(100);
cdrom_enabled = 1; cdrom_enabled = 1;
saveconfig(); saveconfig(NULL);
resetpchard(); resetpchard();
pause = 0; pause = 0;
} }

View file

@ -22,7 +22,9 @@ extern int status_is_open;
void hdconf_open(HWND hwnd); void hdconf_open(HWND hwnd);
void config_open(HWND hwnd); void config_open(HWND hwnd, int inited);
int config_selection_open(HWND hwnd, int inited);
struct device_t; struct device_t;
@ -32,6 +34,6 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type);
extern char openfilestring[260]; extern char openfilestring[260];
int getfile(HWND hwnd, char *f, char *fn); int getfile(HWND hwnd, char *f, char *fn);
int getsfile(HWND hwnd, char *f, char *fn); int getsfile(HWND hwnd, char *f, char *fn, char *dir);
extern int pause; extern int pause;