Updated ROM BIOS handling to use the external loader.
Several cleanups and fixes here and there. Updated (Windows) UI to properly handle resets and changes in Settings. Updated to no longer scan for roms at startup.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# Makefile for Windows systems using the MinGW32 environment.
|
||||
#
|
||||
# Version: @(#)Makefile.mingw 1.0.5 2018/02/25
|
||||
# Version: @(#)Makefile.mingw 1.0.6 2018/03/02
|
||||
#
|
||||
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
#
|
||||
@@ -234,7 +234,7 @@ else
|
||||
endif
|
||||
WINDRES := windres
|
||||
|
||||
SYSINC :=
|
||||
SYSINC := -Iwin/mingw/include
|
||||
SYSLIB :=
|
||||
endif
|
||||
|
||||
@@ -437,7 +437,8 @@ CXXFLAGS := $(WX_FLAGS) $(OPTS) $(DFLAGS) $(COPTIM) $(AOPTIM) \
|
||||
#########################################################################
|
||||
MAINOBJ := pc.o config.o random.o timer.o io.o dma.o nmi.o pic.o \
|
||||
pit.o ppi.o pci.o mca.o mcr.o mem.o memregs.o rom.o \
|
||||
device.o nvr.o nvr_at.o nvr_ps2.o $(VNCOBJ) $(RDPOBJ)
|
||||
rom_load.o device.o nvr.o nvr_at.o nvr_ps2.o \
|
||||
$(VNCOBJ) $(RDPOBJ)
|
||||
|
||||
INTELOBJ := intel.o \
|
||||
intel_flash.o \
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Application resource script for Windows.
|
||||
*
|
||||
* Version: @(#)VARCem.rc 1.0.3 2018/02/24
|
||||
* Version: @(#)VARCem.rc 1.0.4 2018/03/01
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -820,10 +820,10 @@ END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
2048 "VARCem"
|
||||
IDS_2049 "Error"
|
||||
IDS_2050 "Fatal Error"
|
||||
IDS_2051 "This will reset the emulator.\nAre you sure you want to save the settings?"
|
||||
IDS_2048 "Error"
|
||||
IDS_2049 "Fatal Error"
|
||||
IDS_2050 "Configuration Error"
|
||||
IDS_2051 "Are you sure you want to save these settings?\n\n(A restart may be needed...)"
|
||||
IDS_2052 "DirectDraw Screenshot Error"
|
||||
IDS_2053 "Invalid number of sectors (valid values are between 1 and 63)"
|
||||
IDS_2054 "Invalid number of heads (valid values are between 1 and 16)"
|
||||
@@ -834,13 +834,13 @@ BEGIN
|
||||
IDS_2059 "Turbo"
|
||||
IDS_2060 "On"
|
||||
IDS_2061 "Off"
|
||||
IDS_2062 "The emulator was unable to find any ROMs.\nAt least one ROM set is required to run."
|
||||
IDS_2063 "Configured ROM set not available.\nDefaulting to an available ROM set."
|
||||
IDS_2062 "Changes saved, please restart the emulator!"
|
||||
IDS_2063 "The configured machine:\n\n %ls\n\nis not available.\n\nWould you like to enter the Settings menu?"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_2064 "Configured video BIOS not available.\nDefaulting to an available video BIOS."
|
||||
IDS_2064 "Configured video card:\n\n %ls\n\nis not available.\n\nWould you like to enter the Settings menu?"
|
||||
IDS_2065 "Machine"
|
||||
IDS_2066 "Display"
|
||||
IDS_2067 "Input devices"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Windows resource defines.
|
||||
*
|
||||
* Version: @(#)resource.h 1.0.2 2018/02/21
|
||||
* Version: @(#)resource.h 1.0.3 2018/03/01
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Platform main support module for Windows.
|
||||
*
|
||||
* Version: @(#)win.c 1.0.1 2018/02/14
|
||||
* Version: @(#)win.c 1.0.2 2018/03/02
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -269,22 +269,58 @@ CreateConsole(int init)
|
||||
/* Not logging to file, attach to console. */
|
||||
if (! AttachConsole(ATTACH_PARENT_PROCESS)) {
|
||||
/* Parent has no console, create one. */
|
||||
AllocConsole();
|
||||
if (! AllocConsole()) {
|
||||
#ifdef DEBUG
|
||||
fp = fopen("error.txt", "w");
|
||||
fprintf(fp, "AllocConsole failed: %lu\n", GetLastError());
|
||||
fclose(fp);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
h = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
if ((h = GetStdHandle(STD_OUTPUT_HANDLE)) == NULL) {
|
||||
#ifdef DEBUG
|
||||
fp = fopen("error.txt", "w");
|
||||
fprintf(fp, "GetStdHandle(OUT) failed: %lu\n", GetLastError());
|
||||
fclose(fp);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
i = _open_osfhandle((intptr_t)h, _O_TEXT);
|
||||
fp = _fdopen(i, "w");
|
||||
setvbuf(fp, NULL, _IONBF, 1);
|
||||
*stdout = *fp;
|
||||
if (i != -1) {
|
||||
fp = _fdopen(i, "w");
|
||||
if (fp == NULL) {
|
||||
#ifdef DEBUG
|
||||
fp = fopen("error.txt", "w");
|
||||
fprintf(fp, "FdOpen(%i) failed: %lu\n", i, GetLastError());
|
||||
fclose(fp);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
setvbuf(fp, NULL, _IONBF, 1);
|
||||
*stdout = *fp;
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
fp = fopen("error.txt", "w");
|
||||
fprintf(fp, "GetOSfHandle(%p) failed: %lu\n", h, GetLastError());
|
||||
fclose(fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if NOTUSED
|
||||
h = GetStdHandle(STD_ERROR_HANDLE);
|
||||
i = _open_osfhandle((intptr_t)h, _O_TEXT);
|
||||
fp = _fdopen(i, "w");
|
||||
setvbuf(fp, NULL, _IONBF, 1);
|
||||
*stderr = *fp;
|
||||
if (h != NULL) {
|
||||
i = _open_osfhandle((intptr_t)h, _O_TEXT);
|
||||
if (i != -1) {
|
||||
fp = _fdopen(i, "w");
|
||||
if (fp != NULL) {
|
||||
setvbuf(fp, NULL, _IONBF, 1);
|
||||
*stderr = *fp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Set up stdin as well. */
|
||||
h = GetStdHandle(STD_INPUT_HANDLE);
|
||||
i = _open_osfhandle((intptr_t)h, _O_TEXT);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Platform support defintions for Win32.
|
||||
*
|
||||
* Version: @(#)win.h 1.0.2 2018/02/21
|
||||
* Version: @(#)win.h 1.0.3 2018/03/01
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -117,7 +117,7 @@ extern uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type);
|
||||
extern int getfile(HWND hwnd, char *f, char *fn);
|
||||
extern int getsfile(HWND hwnd, char *f, char *fn);
|
||||
|
||||
extern void win_settings_open(HWND hwnd);
|
||||
extern int win_settings_open(HWND hwnd, int ask);
|
||||
|
||||
extern void hard_disk_add_open(HWND hwnd, int is_existing);
|
||||
extern int hard_disk_was_added(void);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of server several dialogs.
|
||||
*
|
||||
* Version: @(#)win_dialog.c 1.0.1 2018/02/14
|
||||
* Version: @(#)win_dialog.c 1.0.2 2018/03/01
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -110,22 +110,27 @@ ui_msgbox(int flags, void *arg)
|
||||
switch(flags & 0x1f) {
|
||||
case MBX_INFO: /* just an informational message */
|
||||
fl = (MB_OK | MB_ICONINFORMATION);
|
||||
cap = plat_get_string(IDS_STRINGS); /* "VARCem" */
|
||||
cap = EMU_NAME_W;
|
||||
break;
|
||||
|
||||
case MBX_ERROR: /* error message */
|
||||
if (flags & MBX_FATAL) {
|
||||
fl = (MB_OK | MB_ICONERROR);
|
||||
cap = plat_get_string(IDS_2050); /* "Fatal Error"*/
|
||||
cap = plat_get_string(IDS_2049); /* "Fatal Error"*/
|
||||
} else {
|
||||
fl = (MB_OK | MB_ICONWARNING);
|
||||
cap = plat_get_string(IDS_2049); /* "Error" */
|
||||
cap = plat_get_string(IDS_2048); /* "Error" */
|
||||
}
|
||||
break;
|
||||
|
||||
case MBX_QUESTION: /* question */
|
||||
fl = (MB_YESNOCANCEL | MB_ICONQUESTION);
|
||||
cap = plat_get_string(IDS_STRINGS); /* "VARCem" */
|
||||
cap = EMU_NAME_W;
|
||||
break;
|
||||
|
||||
case MBX_CONFIG: /* configuration */
|
||||
fl = (MB_YESNO | MB_ICONERROR);
|
||||
cap = EMU_NAME_W;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -160,9 +165,17 @@ ui_msgbox(int flags, void *arg)
|
||||
fl);
|
||||
|
||||
/* Convert return values to generic ones. */
|
||||
if (fl == IDNO) fl = 1;
|
||||
else if (fl == IDCANCEL) fl = -1;
|
||||
else fl = 0;
|
||||
switch(fl) {
|
||||
case IDNO:
|
||||
fl = 1; break;
|
||||
|
||||
case IDYES:
|
||||
case IDOK:
|
||||
fl = 0; break;
|
||||
|
||||
case IDCANCEL:
|
||||
fl = -1; break;
|
||||
}
|
||||
|
||||
return(fl);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implement the user Interface module.
|
||||
*
|
||||
* Version: @(#)win_ui.c 1.0.2 2018/02/21
|
||||
* Version: @(#)win_ui.c 1.0.3 2018/03/02
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -328,7 +328,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
|
||||
case IDM_ACTION_CTRL_ALT_ESC:
|
||||
pc_send_cae();
|
||||
keyboard_send_cae();
|
||||
break;
|
||||
|
||||
case IDM_ACTION_RCTRL_IS_LALT:
|
||||
@@ -343,7 +343,10 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
|
||||
case IDM_CONFIG:
|
||||
win_settings_open(hwnd);
|
||||
plat_pause(1);
|
||||
if (win_settings_open(hwnd, 1) == 2)
|
||||
pc_reset_hard_init();
|
||||
plat_pause(0);
|
||||
break;
|
||||
|
||||
case IDM_ABOUT:
|
||||
@@ -724,7 +727,10 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
|
||||
case WM_SHOWSETTINGS:
|
||||
win_settings_open(hwnd);
|
||||
plat_pause(1);
|
||||
if (win_settings_open(hwnd, 1) == 2)
|
||||
pc_reset_hard_init();
|
||||
plat_pause(0);
|
||||
break;
|
||||
|
||||
case WM_PAUSE:
|
||||
@@ -763,9 +769,9 @@ ui_init(int nCmdShow)
|
||||
WCHAR title[200];
|
||||
WNDCLASSEX wincl; /* buffer for main window's class */
|
||||
MSG messages; /* received-messages buffer */
|
||||
HWND hwnd = 0; /* handle for our window */
|
||||
HWND hwnd = 0; /* handle for our window */
|
||||
HACCEL haccel; /* handle to accelerator table */
|
||||
int bRet;
|
||||
int ret;
|
||||
|
||||
#if 0
|
||||
/* We should have an application-wide at_exit catcher. */
|
||||
@@ -782,7 +788,7 @@ ui_init(int nCmdShow)
|
||||
return(6);
|
||||
}
|
||||
|
||||
win_settings_open(NULL);
|
||||
win_settings_open(NULL, 0);
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -887,14 +893,26 @@ ui_init(int nCmdShow)
|
||||
0, 0, 1, 1, hwnd, NULL, hinstance, NULL);
|
||||
MoveWindow(hwndRender, 0, 0, scrnsz_x, scrnsz_y, TRUE);
|
||||
|
||||
/* All done, fire up the actual emulated machine. */
|
||||
if (! pc_init_modules()) {
|
||||
/* Dang, no ROMs found at all! */
|
||||
MessageBox(hwnd,
|
||||
plat_get_string(IDS_2056),
|
||||
plat_get_string(IDS_2050),
|
||||
MB_OK | MB_ICONERROR);
|
||||
return(6);
|
||||
/* That looks good, now continue setting up the machine. */
|
||||
switch (pc_init_modules()) {
|
||||
case -1: /* General failure during init, give up. */
|
||||
return(6);
|
||||
|
||||
case 0: /* Configuration error, user wants to exit. */
|
||||
return(0);
|
||||
|
||||
case 1: /* All good. */
|
||||
break;
|
||||
|
||||
case 2: /* Configuration error, user wants to re-config. */
|
||||
if (win_settings_open(NULL, 0)) {
|
||||
/* Save the new configuration to file. */
|
||||
config_save();
|
||||
|
||||
/* Remind them to restart. */
|
||||
ui_msgbox(MBX_INFO, (wchar_t *)IDS_2062);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Initialize the configured Video API. */
|
||||
@@ -936,11 +954,11 @@ ui_init(int nCmdShow)
|
||||
|
||||
/* Run the message loop. It will run until GetMessage() returns 0 */
|
||||
while (! quited) {
|
||||
bRet = GetMessage(&messages, NULL, 0, 0);
|
||||
if ((bRet == 0) || quited) break;
|
||||
ret = GetMessage(&messages, NULL, 0, 0);
|
||||
if ((ret == 0) || quited) break;
|
||||
|
||||
if (bRet == -1) {
|
||||
fatal("bRet is -1\n");
|
||||
if (ret == -1) {
|
||||
fatal("ret is -1\n");
|
||||
}
|
||||
|
||||
if (messages.message == WM_QUIT) {
|
||||
|
||||
Reference in New Issue
Block a user