--- xmil/win9x/xmil.cpp 2004/08/12 17:57:36 1.16 +++ xmil/win9x/xmil.cpp 2004/08/19 09:50:23 1.23 @@ -10,7 +10,6 @@ #include "scrnmng.h" #include "soundmng.h" #include "sysmng.h" -#include "ddrawbmp.h" #include "winloc.h" #include "dclock.h" #include "winkbd.h" @@ -23,7 +22,6 @@ #include "pccore.h" #include "iocore.h" #include "timing.h" -#include "keystat.h" #if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE) #include "statsave.h" #endif @@ -39,7 +37,7 @@ static const OEMCHAR szClassName[] = OEM XMILOSCFG xmiloscfg = { CW_USEDEFAULT, CW_USEDEFAULT, - 1, 0, 0, 0, 1, + 1, 0, 0, 0, 0, 0, 0, 0, #if defined(SUPPORT_RESUME) 0, @@ -102,9 +100,9 @@ static void winuileave(void) { static void dispbmp(HINSTANCE hinst, HDC hdc, const OEMCHAR *res, int x, int y) { - HBITMAP hbmp; - BITMAP bmp; - HDC hmdc; + HBITMAP hbmp; + BITMAP bmp; + HDC hmdc; hbmp = LoadBitmap(hinst, res); GetObject(hbmp, sizeof(bmp), &bmp); @@ -118,14 +116,18 @@ static void dispbmp(HINSTANCE hinst, HDC // ---- -#if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE) +#if defined(SUPPORT_RESUME) static const OEMCHAR xmilresumeext[] = OEMTEXT(".sav"); +static const OEMCHAR str_resume[] = OEMTEXT("Resume"); #endif #if defined(SUPPORT_STATSAVE) static const OEMCHAR xmilflagext[] = OEMTEXT(".sv%u"); +static const OEMCHAR str_statload[] = OEMTEXT("Status Load"); #endif #if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE) +static const OEMCHAR str_loaderr[] = OEMTEXT("Couldn't restart"); +static const OEMCHAR str_conflict[] = OEMTEXT("Conflict!\n\n%s\nContinue?"); static void getstatfilename(OEMCHAR *path, const OEMCHAR *ext, UINT size) { @@ -157,24 +159,24 @@ static void flagdelete(const OEMCHAR *ex file_delete(path); } -static int flagload(const char *ext, const char *title, BOOL force) { +static int flagload(const OEMCHAR *ext, const OEMCHAR *title, BRESULT force) { int ret; int id; OEMCHAR path[MAX_PATH]; OEMCHAR buf[1024]; + OEMCHAR buf2[1024 + 32]; getstatfilename(path, ext, NELEMENTS(path)); winuienter(); id = IDYES; ret = statsave_check(path, buf, NELEMENTS(buf)); if (ret & (~STATFLAG_DISKCHG)) { - MessageBox(hWndMain, "Couldn't restart", title, MB_OK | MB_ICONSTOP); + MessageBox(hWndMain, str_loaderr, title, MB_OK | MB_ICONSTOP); id = IDNO; } else if ((!force) && (ret & STATFLAG_DISKCHG)) { - char buf2[1024 + 256]; - wsprintf(buf2, "Conflict!\n\n%s\nContinue?", buf); + OEMSPRINTF(buf2, str_conflict, buf); id = MessageBox(hWndMain, buf2, title, MB_YESNOCANCEL | MB_ICONQUESTION); } @@ -196,7 +198,9 @@ static int flagload(const char *ext, con static void xmilcmd(HWND hWnd, UINT cmd) { UINT update; +#if defined(SUPPORT_STATSAVE) OEMCHAR ext[16]; +#endif update = 0; switch(cmd) { @@ -245,8 +249,28 @@ static void xmilcmd(HWND hWnd, UINT cmd) diskdrv_setfdd(1, NULL, 0); break; - case IDM_TURBOZ: - menu_setiplrom(3); + case IDM_FDD2OPEN: + winuienter(); + dialog_changefdd(hWnd, 2); + winuileave(); + break; + + case IDM_FDD2EJECT: + diskdrv_setfdd(2, NULL, 0); + break; + + case IDM_FDD3OPEN: + winuienter(); + dialog_changefdd(hWnd, 3); + winuileave(); + break; + + case IDM_FDD3EJECT: + diskdrv_setfdd(3, NULL, 0); + break; + + case IDM_X1ROM: + menu_setiplrom(1); update = SYS_UPDATECFG; break; @@ -255,10 +279,12 @@ static void xmilcmd(HWND hWnd, UINT cmd) update = SYS_UPDATECFG; break; - case IDM_X1ROM: - menu_setiplrom(1); +#if defined(SUPPORT_TURBOZ) + case IDM_TURBOZ: + menu_setiplrom(3); update = SYS_UPDATECFG; break; +#endif case IDM_BOOT2D: menu_setbootmedia(0); @@ -288,14 +314,6 @@ static void xmilcmd(HWND hWnd, UINT cmd) scrnmng_changescreen(scrnmode | SCRNMODE_FULLSCREEN); break; - case IDM_WIDTH80: - crtc_forcesetwidth(80); - break; - - case IDM_WIDTH40: - crtc_forcesetwidth(40); - break; - case IDM_DISPSYNC: menu_setdispmode(xmilcfg.DISPSYNC ^ 1); update = SYS_UPDATECFG; @@ -303,6 +321,12 @@ static void xmilcmd(HWND hWnd, UINT cmd) case IDM_RASTER: menu_setraster(xmilcfg.RASTER ^ 1); + if (xmilcfg.RASTER) { + scrnmng_changescreen(scrnmode | SCRNMODE_SYSHIGHCOLOR); + } + else { + scrnmng_changescreen(scrnmode & (~SCRNMODE_SYSHIGHCOLOR)); + } update = SYS_UPDATECFG; break; @@ -369,9 +393,21 @@ static void xmilcmd(HWND hWnd, UINT cmd) update = SYS_UPDATECFG; break; + case IDM_WIDTH40: + crtc_forcesetwidth(40); + break; + + case IDM_WIDTH80: + crtc_forcesetwidth(80); + break; + + case IDM_Z80SAVE: + debugsub_status(); + break; + case IDM_BMPSAVE: winuienter(); - bmpsave(); + dialog_writebmp(hWnd); winuileave(); break; @@ -401,10 +437,6 @@ static void xmilcmd(HWND hWnd, UINT cmd) update = SYS_UPDATECFG; break; - case IDM_Z80SAVE: - debugsub_status(); - break; - case IDM_ABOUT: winuienter(); DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), @@ -422,7 +454,7 @@ static void xmilcmd(HWND hWnd, UINT cmd) else if ((cmd >= IDM_FLAGLOAD) && (cmd < (IDM_FLAGLOAD + SUPPORT_STATSAVE))) { OEMSPRINTF(ext, xmilflagext, cmd - IDM_FLAGLOAD); - flagload(ext, "Status Load", TRUE); + flagload(ext, str_statload, TRUE); } #endif break; @@ -832,6 +864,9 @@ int WINAPI WinMain(HINSTANCE hInstance, scrndraw_initialize(); scrnmode = 0; + if (xmilcfg.RASTER) { + scrnmode |= SCRNMODE_SYSHIGHCOLOR; + } if (scrnmng_create(scrnmode) != SUCCESS) { scrnmode ^= SCRNMODE_FULLSCREEN; if (scrnmng_create(scrnmode) != SUCCESS) {