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