|
|
| version 1.4, 2004/08/03 12:50:54 | 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 "scrndraw.h" | |
| #include "ddrawbmp.h" | |
| #include "winloc.h" | #include "winloc.h" |
| #include "dclock.h" | #include "dclock.h" |
| #include "winkbd.h" | #include "winkbd.h" |
| #include "menu.h" | #include "menu.h" |
| #include "ini.h" | #include "ini.h" |
| #include "juliet.h" | |
| #include "extclass.h" | #include "extclass.h" |
| #include "dialog.h" | #include "dialog.h" |
| #include "z80core.h" | #include "z80core.h" |
| #include "pccore.h" | #include "pccore.h" |
| #include "x1_io.h" | #include "iocore.h" |
| #include "x1_crtc.h" | |
| #include "timing.h" | #include "timing.h" |
| #include "draw.h" | #if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE) |
| #include "fdd_ini.h" | #include "statsave.h" |
| #include "juliet.h" | #endif |
| #include "diskdrv.h" | |
| #include "debugsub.h" | #include "debugsub.h" |
| #include "scrndraw.h" | |
| #include "makescrn.h" | |
| #include "diskdrv.h" | |
| #include "fdd_ini.h" | |
| #include "x1f.h" | #include "x1f.h" |
| Line 37 static const OEMCHAR szClassName[] = OEM | Line 37 static const OEMCHAR szClassName[] = OEM |
| XMILOSCFG xmiloscfg = { | XMILOSCFG xmiloscfg = { |
| CW_USEDEFAULT, CW_USEDEFAULT, | CW_USEDEFAULT, CW_USEDEFAULT, |
| 1, 0, 0, | 1, 0, 0, 0, 1, |
| 0, 0, 0, | 0, 0, 0, |
| #if defined(SUPPORT_RESUME) | |
| 0, | |
| #endif | |
| #if defined(SUPPORT_STATSAVE) | |
| 1, | |
| #endif | |
| 0, 0, 0xffffff, 0xffbf6a}; | 0, 0, 0xffffff, 0xffbf6a}; |
| OEMCHAR szProgName[] = OEMTEXT("X millennium ねこちゅ〜ん"); | OEMCHAR szProgName[] = OEMTEXT("X millennium ねこちゅ〜ん"); |
| Line 49 static const OEMCHAR szClassName[] = OEM | Line 55 static const OEMCHAR szClassName[] = OEM |
| OEMCHAR fddfolder[MAX_PATH]; | OEMCHAR fddfolder[MAX_PATH]; |
| OEMCHAR bmpfilefolder[MAX_PATH]; | OEMCHAR bmpfilefolder[MAX_PATH]; |
| static BYTE xmilforeground = 0; | static BRESULT xmilstopemulate = FALSE; |
| BYTE xmilopening = 1; | UINT8 xmilopening = 1; |
| static void wincentering(HWND hWnd) { | static void wincentering(HWND hWnd) { |
| Line 94 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 110 static void dispbmp(HINSTANCE hinst, HDC | Line 116 static void dispbmp(HINSTANCE hinst, HDC |
| // ---- | // ---- |
| LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { | #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 | |
| PAINTSTRUCT ps; | #if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE) |
| RECT rc; | static const OEMCHAR str_loaderr[] = OEMTEXT("Couldn't restart"); |
| HDC hdc; | static const OEMCHAR str_conflict[] = OEMTEXT("Conflict!\n\n%s\nContinue?"); |
| UINT updateflag; | |
| static void getstatfilename(OEMCHAR *path, const OEMCHAR *ext, UINT size) { | |
| file_cpyname(path, modulefile, size); | |
| file_cutext(path); | |
| file_catname(path, ext, size); | |
| } | |
| switch (msg) { | static int flagsave(const OEMCHAR *ext) { |
| case WM_CREATE: | |
| extclass_wmcreate(hWnd); | OEMCHAR path[MAX_PATH]; |
| #ifndef __GNUC__ | int ret; |
| WINNLSEnableIME(hWnd, FALSE); | |
| getstatfilename(path, ext, NELEMENTS(path)); | |
| soundmng_stop(); | |
| ret = statsave_save(path); | |
| if (ret) { | |
| file_delete(path); | |
| } | |
| soundmng_play(); | |
| return(ret); | |
| } | |
| static void flagdelete(const OEMCHAR *ext) { | |
| OEMCHAR path[MAX_PATH]; | |
| getstatfilename(path, ext, NELEMENTS(path)); | |
| file_delete(path); | |
| } | |
| 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, str_loaderr, title, MB_OK | MB_ICONSTOP); | |
| id = IDNO; | |
| } | |
| else if ((!force) && (ret & STATFLAG_DISKCHG)) { | |
| OEMSPRINTF(buf2, str_conflict, buf); | |
| id = MessageBox(hWndMain, buf2, title, | |
| MB_YESNOCANCEL | MB_ICONQUESTION); | |
| } | |
| if (id == IDYES) { | |
| statsave_load(path); | |
| // toolwin_setfdd(0, fdd_diskname(0)); | |
| // toolwin_setfdd(1, fdd_diskname(1)); | |
| } | |
| sysmng_workclockreset(); | |
| sysmng_updatecaption(1); | |
| winuileave(); | |
| return(id); | |
| } | |
| #endif | #endif |
| // ---- | |
| static void xmilcmd(HWND hWnd, UINT cmd) { | |
| UINT update; | |
| #if defined(SUPPORT_STATSAVE) | |
| OEMCHAR ext[16]; | |
| #endif | |
| update = 0; | |
| switch(cmd) { | |
| case IDM_IPLRESET: | |
| pccore_reset(); | |
| break; | break; |
| case WM_SYSCOMMAND: | case IDM_NMIRESET: |
| updateflag = 0; | Z80_NMI(); |
| switch(wParam) { | break; |
| case IDM_SCREENCENTER: | |
| if (!scrnmng_isfullscreen()) { | |
| wincentering(hWnd); | |
| } | |
| break; | |
| case IDM_SNAPENABLE: | case IDM_CONFIG: |
| sysmenu_setwinsnap(xmiloscfg.WINSNAP ^ 1); | winuienter(); |
| updateflag = SYS_UPDATEOSCFG; | DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG), |
| break; | hWnd, (DLGPROC)CfgDialogProc); |
| winuileave(); | |
| break; | |
| case IDM_BACKGROUND: | case IDM_NEWDISK: |
| sysmenu_setbackground(xmiloscfg.background ^ 1); | winuienter(); |
| updateflag = SYS_UPDATEOSCFG; | dialog_newdisk(hWnd); |
| break; | winuileave(); |
| break; | |
| case IDM_BGSOUND: | case IDM_EXIT: |
| sysmenu_setbgsound(xmiloscfg.background ^ 2); | SendMessage(hWnd, WM_CLOSE, 0, 0L); |
| updateflag = SYS_UPDATEOSCFG; | break; |
| break; | |
| default: | case IDM_FDD0OPEN: |
| return(DefWindowProc(hWnd, msg, wParam, lParam)); | winuienter(); |
| } | dialog_changefdd(hWnd, 0); |
| sysmng_update(updateflag); | winuileave(); |
| break; | break; |
| case WM_COMMAND: | case IDM_FDD0EJECT: |
| updateflag = 0; | diskdrv_setfdd(0, NULL, 0); |
| switch(LOWORD(wParam)) { | break; |
| case IDM_IPLRESET: | |
| #if 1 | |
| pccore_reset(); | |
| #else | |
| if ((!juliet_YM2151IsEnable()) && (changehz)) { | |
| changehz = 0; | |
| STREAM_TERM(); | |
| STREAM_CREATE(); | |
| } | |
| if (reset_x1(xmilcfg.ROM_TYPE, | |
| xmilcfg.SOUND_SW, xmilcfg.DIP_SW)) { | |
| PostQuitMessage(0); | |
| } | |
| #endif | |
| break; | |
| case IDM_NMIRESET: | case IDM_FDD1OPEN: |
| Z80_NMI(); | winuienter(); |
| break; | dialog_changefdd(hWnd, 1); |
| winuileave(); | |
| break; | |
| case IDM_CONFIG: | case IDM_FDD1EJECT: |
| winuienter(); | diskdrv_setfdd(1, NULL, 0); |
| DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG), | break; |
| hWnd, (DLGPROC)CfgDialogProc); | |
| winuileave(); | |
| break; | |
| case IDM_NEWDISK: | case IDM_FDD2OPEN: |
| winuienter(); | winuienter(); |
| dialog_newdisk(hWnd); | dialog_changefdd(hWnd, 2); |
| winuileave(); | winuileave(); |
| break; | break; |
| case IDM_EXIT: | case IDM_FDD2EJECT: |
| SendMessage(hWnd, WM_CLOSE, 0, 0L); | diskdrv_setfdd(2, NULL, 0); |
| break; | break; |
| case IDM_FDD0OPEN: | case IDM_FDD3OPEN: |
| winuienter(); | winuienter(); |
| dialog_changefdd(hWnd, 0); | dialog_changefdd(hWnd, 3); |
| winuileave(); | winuileave(); |
| break; | break; |
| case IDM_FDD0EJECT: | case IDM_FDD3EJECT: |
| diskdrv_setfdd(0, NULL, 0); | diskdrv_setfdd(3, NULL, 0); |
| break; | break; |
| case IDM_FDD1OPEN: | case IDM_X1ROM: |
| winuienter(); | menu_setiplrom(1); |
| dialog_changefdd(hWnd, 1); | update = SYS_UPDATECFG; |
| winuileave(); | break; |
| break; | |
| case IDM_FDD1EJECT: | case IDM_TURBO: |
| diskdrv_setfdd(1, NULL, 0); | menu_setiplrom(2); |
| break; | update = SYS_UPDATECFG; |
| break; | |
| case IDM_TURBOZ: | #if defined(SUPPORT_TURBOZ) |
| xmenu_setiplrom(3); | case IDM_TURBOZ: |
| updateflag = SYS_UPDATECFG; | menu_setiplrom(3); |
| break; | update = SYS_UPDATECFG; |
| break; | |
| #endif | |
| case IDM_TURBO: | case IDM_BOOT2D: |
| xmenu_setiplrom(2); | menu_setbootmedia(0); |
| updateflag = SYS_UPDATECFG; | update = SYS_UPDATECFG; |
| break; | break; |
| case IDM_X1ROM: | case IDM_BOOT2HD: |
| xmenu_setiplrom(1); | menu_setbootmedia(DIPSW_BOOTMEDIA); |
| updateflag = SYS_UPDATECFG; | update = SYS_UPDATECFG; |
| break; | break; |
| case IDM_BOOT2D: | case IDM_HIGHRES: |
| xmenu_setbootmedia(0); | menu_setresolute(0); |
| updateflag = SYS_UPDATECFG; | update = SYS_UPDATECFG; |
| break; | break; |
| case IDM_BOOT2HD: | case IDM_LOWRES: |
| xmenu_setbootmedia(DIPSW_BOOTMEDIA); | menu_setresolute(DIPSW_RESOLUTE); |
| updateflag = SYS_UPDATECFG; | update = SYS_UPDATECFG; |
| break; | break; |
| case IDM_HIGHRES: | case IDM_WINDOW: |
| xmenu_setresolute(0); | scrnmng_changescreen(scrnmode & (~SCRNMODE_FULLSCREEN)); |
| updateflag = SYS_UPDATECFG; | break; |
| break; | |
| case IDM_LOWRES: | case IDM_FULLSCREEN: |
| xmenu_setresolute(DIPSW_RESOLUTE); | scrnmng_changescreen(scrnmode | SCRNMODE_FULLSCREEN); |
| updateflag = SYS_UPDATECFG; | break; |
| break; | |
| case IDM_WINDOW: | case IDM_DISPSYNC: |
| scrnmng_changescreen(scrnmode & (~SCRNMODE_FULLSCREEN)); | menu_setdispmode(xmilcfg.DISPSYNC ^ 1); |
| break; | update = SYS_UPDATECFG; |
| break; | |
| case IDM_FULLSCREEN: | case IDM_RASTER: |
| scrnmng_changescreen(scrnmode | SCRNMODE_FULLSCREEN); | menu_setraster(xmilcfg.RASTER ^ 1); |
| break; | if (xmilcfg.RASTER) { |
| scrnmng_changescreen(scrnmode | SCRNMODE_SYSHIGHCOLOR); | |
| } | |
| else { | |
| scrnmng_changescreen(scrnmode & (~SCRNMODE_SYSHIGHCOLOR)); | |
| } | |
| update = SYS_UPDATECFG; | |
| break; | |
| case IDM_WIDTH80: | case IDM_NOWAIT: |
| crtc.TXT_XL = 80; | menu_setwaitflg(xmiloscfg.NOWAIT ^ 1); |
| crtc.GRP_XL = 640; | update = SYS_UPDATECFG; |
| vrambank_patch(); | break; |
| scrnallflash = 1; | |
| break; | |
| case IDM_WIDTH40: | case IDM_AUTOFPS: |
| crtc.TXT_XL = 40; | menu_setframe(0); |
| crtc.GRP_XL = 320; | update = SYS_UPDATECFG; |
| vrambank_patch(); | break; |
| scrnallflash = 1; | |
| break; | |
| case IDM_DISPSYNC: | case IDM_60FPS: |
| xmenu_setdispmode(xmilcfg.DISPSYNC ^ 1); | menu_setframe(1); |
| break; | update = SYS_UPDATECFG; |
| break; | |
| case IDM_NOWAIT: | case IDM_30FPS: |
| xmenu_setwaitflg(xmilcfg.NOWAIT ^ 1); | menu_setframe(2); |
| updateflag = SYS_UPDATECFG; | update = SYS_UPDATECFG; |
| break; | break; |
| case IDM_RASTER: | case IDM_20FPS: |
| xmenu_setframe(0); | menu_setframe(3); |
| updateflag = SYS_UPDATECFG; | update = SYS_UPDATECFG; |
| break; | break; |
| case IDM_60FPS: | case IDM_15FPS: |
| xmenu_setframe(1); | menu_setframe(4); |
| updateflag = SYS_UPDATECFG; | update = SYS_UPDATECFG; |
| break; | break; |
| case IDM_30FPS: | case IDM_KEY: |
| xmenu_setframe(2); | menu_setkey(0); |
| updateflag = SYS_UPDATECFG; | break; |
| break; | |
| case IDM_20FPS: | case IDM_JOY1: |
| xmenu_setframe(3); | menu_setkey(1); |
| updateflag = SYS_UPDATECFG; | break; |
| break; | |
| case IDM_15FPS: | case IDM_JOY2: |
| xmenu_setframe(4); | menu_setkey(2); |
| updateflag = SYS_UPDATECFG; | break; |
| break; | |
| case IDM_KEY: | case IDM_FMBOARD: |
| xmenu_setkey(0); | menu_setsound(xmilcfg.SOUND_SW ^ 1); |
| break; | update = SYS_UPDATECFG; |
| break; | |
| case IDM_JOY1: | case IDM_JOYSTICK: |
| xmenu_setkey(1); | menu_setjoystick(xmiloscfg.JOYSTICK ^ 1); |
| break; | update = SYS_UPDATECFG; |
| break; | |
| case IDM_JOY2: | case IDM_MOUSE: |
| xmenu_setkey(2); | // mousemng_toggle(MOUSEPROC_SYSTEM); |
| break; | menu_setmouse(xmilcfg.MOUSE_SW ^ 1); |
| update = SYS_UPDATECFG; | |
| break; | |
| case IDM_FMBOARD: | case IDM_SEEKSND: |
| xmenu_setsound(xmilcfg.SOUND_SW ^ 1); | menu_setmotorflg(xmilcfg.MOTOR ^ 1); |
| updateflag = SYS_UPDATECFG; | update = SYS_UPDATECFG; |
| break; | break; |
| case IDM_JOYSTICK: | case IDM_WIDTH40: |
| xmenu_setjoystick(xmiloscfg.JOYSTICK ^ 1); | crtc_forcesetwidth(40); |
| updateflag = SYS_UPDATECFG; | break; |
| break; | |
| case IDM_MOUSE: | case IDM_WIDTH80: |
| // mousemng_toggle(MOUSEPROC_SYSTEM); | crtc_forcesetwidth(80); |
| xmenu_setmouse(xmilcfg.MOUSE_SW ^ 1); | break; |
| updateflag = SYS_UPDATECFG; | |
| break; | |
| case IDM_8MHZ: | case IDM_Z80SAVE: |
| xmenu_setcpuspeed(xmilcfg.CPU8MHz ^ 1); | debugsub_status(); |
| updateflag = SYS_UPDATECFG; | break; |
| break; | |
| case IDM_SEEKSND: | case IDM_BMPSAVE: |
| xmenu_setmotorflg(xmilcfg.MOTOR ^ 1); | winuienter(); |
| updateflag = SYS_UPDATECFG; | dialog_writebmp(hWnd); |
| break; | winuileave(); |
| break; | |
| case IDM_BMPSAVE: | case IDM_OPMLOG: |
| winuienter(); | winuienter(); |
| bmpsave(); | dialog_x1f(hWnd); |
| winuileave(); | winuileave(); |
| break; | break; |
| case IDM_OPMLOG: | case IDM_DISPCLOCK: |
| winuienter(); | menu_setdispclk(xmiloscfg.DISPCLK ^ 1); |
| dialog_x1f(hWnd); | update = SYS_UPDATECFG; |
| winuileave(); | break; |
| break; | |
| case IDM_DISPCLOCK: | case IDM_DISPFRAME: |
| xmenu_setdispclk(xmiloscfg.DISPCLK ^ 1); | menu_setdispclk(xmiloscfg.DISPCLK ^ 2); |
| updateflag = SYS_UPDATECFG; | update = SYS_UPDATECFG; |
| break; | break; |
| case IDM_DISPFRAME: | case IDM_JOYX: |
| xmenu_setdispclk(xmiloscfg.DISPCLK ^ 2); | menu_setbtnmode(xmilcfg.BTN_MODE ^ 1); |
| updateflag = SYS_UPDATECFG; | update = SYS_UPDATECFG; |
| break; | break; |
| case IDM_SKIPLINE: | case IDM_RAPID: |
| xmenu_setskipline(xmilcfg.SKIP_LINE ^ 1); | menu_setbtnrapid(xmilcfg.BTN_RAPID ^ 1); |
| updateflag = SYS_UPDATECFG; | update = SYS_UPDATECFG; |
| break; | break; |
| case IDM_JOYX: | case IDM_ABOUT: |
| xmenu_setbtnmode(xmilcfg.BTN_MODE ^ 1); | winuienter(); |
| updateflag = SYS_UPDATECFG; | DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), |
| break; | hWnd, (DLGPROC)AboutDialogProc); |
| winuileave(); | |
| break; | |
| default: | |
| #if defined(SUPPORT_STATSAVE) | |
| if ((cmd >= IDM_FLAGSAVE) && | |
| (cmd < (IDM_FLAGSAVE + SUPPORT_STATSAVE))) { | |
| OEMSPRINTF(ext, xmilflagext, cmd - IDM_FLAGSAVE); | |
| flagsave(ext); | |
| } | |
| else if ((cmd >= IDM_FLAGLOAD) && | |
| (cmd < (IDM_FLAGLOAD + SUPPORT_STATSAVE))) { | |
| OEMSPRINTF(ext, xmilflagext, cmd - IDM_FLAGLOAD); | |
| flagload(ext, str_statload, TRUE); | |
| } | |
| #endif | |
| break; | |
| } | |
| sysmng_update(update); | |
| } | |
| LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { | |
| PAINTSTRUCT ps; | |
| RECT rc; | |
| HDC hdc; | |
| UINT updateflag; | |
| case IDM_RAPID: | switch (msg) { |
| xmenu_setbtnrapid(xmilcfg.BTN_RAPID ^ 1); | case WM_CREATE: |
| updateflag = SYS_UPDATECFG; | extclass_wmcreate(hWnd); |
| #ifndef __GNUC__ | |
| WINNLSEnableIME(hWnd, FALSE); | |
| #endif | |
| break; | |
| case WM_SYSCOMMAND: | |
| updateflag = 0; | |
| switch(wParam) { | |
| case IDM_SCREENCENTER: | |
| if (!scrnmng_isfullscreen()) { | |
| wincentering(hWnd); | |
| } | |
| break; | break; |
| case IDM_HALFBMP: | case IDM_SNAPENABLE: |
| winuienter(); | sysmenu_setwinsnap(xmiloscfg.WINSNAP ^ 1); |
| bmpsavehalf(); | updateflag = SYS_UPDATEOSCFG; |
| winuileave(); | |
| break; | break; |
| case IDM_Z80SAVE: | case IDM_BACKGROUND: |
| debugsub_status(); | sysmenu_setbackground(xmiloscfg.background ^ 1); |
| updateflag = SYS_UPDATEOSCFG; | |
| break; | break; |
| case IDM_ABOUT: | case IDM_BGSOUND: |
| winuienter(); | sysmenu_setbgsound(xmiloscfg.background ^ 2); |
| DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), | updateflag = SYS_UPDATEOSCFG; |
| hWnd, (DLGPROC)AboutDialogProc); | |
| winuileave(); | |
| break; | break; |
| default: | |
| return(DefWindowProc(hWnd, msg, wParam, lParam)); | |
| } | } |
| sysmng_update(updateflag); | sysmng_update(updateflag); |
| break; | break; |
| case WM_COMMAND: | |
| xmilcmd(hWnd, LOWORD(wParam)); | |
| break; | |
| case WM_ACTIVATE: | case WM_ACTIVATE: |
| if (LOWORD(wParam) != WA_INACTIVE) { | if (LOWORD(wParam) != WA_INACTIVE) { |
| xmilforeground = 0; | xmilstopemulate = FALSE; |
| scrnmng_update(); | scrnmng_update(); |
| mousemng_enable(MOUSEPROC_BG); | mousemng_enable(MOUSEPROC_BG); |
| soundmng_enable(SNDPROC_MASTER); | soundmng_enable(SNDPROC_MASTER); |
| } | } |
| else { | else { |
| xmilforeground = 1; | |
| mousemng_disable(MOUSEPROC_BG); | mousemng_disable(MOUSEPROC_BG); |
| xmilstopemulate = (xmiloscfg.background & 1)?TRUE:FALSE; | |
| if (xmiloscfg.background) { | if (xmiloscfg.background) { |
| soundmng_disable(SNDPROC_MASTER); | soundmng_disable(SNDPROC_MASTER); |
| } | } |
| Line 499 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 609 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| case WM_KEYDOWN: | case WM_KEYDOWN: |
| if (wParam == VK_F12) { | if (wParam == VK_F12) { |
| mousemng_toggle(MOUSEPROC_SYSTEM); | mousemng_toggle(MOUSEPROC_SYSTEM); |
| // xmenu_setmouse(np2oscfg.MOUSE_SW ^ 1); | // menu_setmouse(np2oscfg.MOUSE_SW ^ 1); |
| // sysmng_update(SYS_UPDATECFG); | // sysmng_update(SYS_UPDATECFG); |
| } | } |
| else { | else { |
| Line 579 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 689 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| case WM_MBUTTONDOWN: | case WM_MBUTTONDOWN: |
| mousemng_toggle(MOUSEPROC_SYSTEM); | mousemng_toggle(MOUSEPROC_SYSTEM); |
| // xmenu_setmouse(np2oscfg.MOUSE_SW ^ 1); | // menu_setmouse(np2oscfg.MOUSE_SW ^ 1); |
| // sysmng_update(SYS_UPDATECFG); | // sysmng_update(SYS_UPDATECFG); |
| break; | break; |
| Line 630 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 740 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| // ---- | // ---- |
| static UINT framecnt = 0; | |
| static UINT waitcnt = 0; | |
| static UINT framemax = 1; | |
| static void framereset(UINT cnt) { | |
| framecnt = 0; | |
| scrnmng_dispclock(); | |
| // kdispwin_draw((BYTE)cnt); | |
| // skbdwin_process(); | |
| // mdbgwin_process(); | |
| // toolwin_draw((BYTE)cnt); | |
| // viewer_allreload(FALSE); | |
| if (xmiloscfg.DISPCLK & 3) { | |
| if (sysmng_workclockrenewal()) { | |
| sysmng_updatecaption(3); | |
| } | |
| } | |
| } | |
| static void processwait(UINT cnt) { | |
| if (timing_getcount() >= cnt) { | |
| timing_setcount(0); | |
| framereset(cnt); | |
| } | |
| else { | |
| Sleep(1); | |
| } | |
| soundmng_sync(); | |
| } | |
| static void exec1frame(void) { | |
| joymng_sync(); | |
| mousemng_sync(); | |
| pccore_exec(framecnt == 0); | |
| dclock_callback(); | |
| framecnt++; | |
| } | |
| int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst, | int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst, |
| LPSTR lpszCmdLine, int nCmdShow) { | LPSTR lpszCmdLine, int nCmdShow) { |
| Line 637 int WINAPI WinMain(HINSTANCE hInstance, | Line 788 int WINAPI WinMain(HINSTANCE hInstance, |
| WNDCLASS wc; | WNDCLASS wc; |
| MSG msg; | MSG msg; |
| GetModuleFileName(NULL, modulefile, sizeof(modulefile)); | |
| dosio_init(); | |
| file_setcd(modulefile); | |
| initload(); | |
| hWnd = FindWindow(szClassName, NULL); | hWnd = FindWindow(szClassName, NULL); |
| if (hWnd != NULL) { | if (hWnd != NULL) { |
| ShowWindow(hWnd, SW_RESTORE); | ShowWindow(hWnd, SW_RESTORE); |
| SetForegroundWindow(hWnd); | SetForegroundWindow(hWnd); |
| dosio_term(); | |
| return(FALSE); | return(FALSE); |
| } | } |
| GetModuleFileName(NULL, modulefile, sizeof(modulefile)); | |
| file_setcd(modulefile); | |
| initload(); | |
| hInst = hInstance; | hInst = hInstance; |
| hPreI = hPreInst; | hPreI = hPreInst; |
| TRACEINIT(); | TRACEINIT(); |
| // keystat_initialize(); | |
| if (!hPreInst) { | if (!hPreInst) { |
| wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW; | wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW; |
| wc.lpfnWndProc = WndProc; | wc.lpfnWndProc = WndProc; |
| Line 675 int WINAPI WinMain(HINSTANCE hInstance, | Line 830 int WINAPI WinMain(HINSTANCE hInstance, |
| WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | | WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | |
| WS_MINIMIZEBOX, | WS_MINIMIZEBOX, |
| xmiloscfg.winx, xmiloscfg.winy, | xmiloscfg.winx, xmiloscfg.winy, |
| SCREEN_WIDTH, SCREEN_HEIGHT, | SURFACE_WIDTH, SURFACE_HEIGHT, |
| NULL, NULL, hInstance, NULL); | NULL, NULL, hInstance, NULL); |
| hWndMain = hWnd; | hWndMain = hWnd; |
| scrnmng_initialize(); | scrnmng_initialize(); |
| sysmng_updatecaption(3); | menu_setiplrom(xmilcfg.ROM_TYPE); |
| menu_setbootmedia(xmilcfg.DIP_SW); | |
| xmenu_setiplrom(xmilcfg.ROM_TYPE); | menu_setresolute(xmilcfg.DIP_SW); |
| xmenu_setsound(xmilcfg.SOUND_SW); | menu_setdispmode(xmilcfg.DISPSYNC); |
| xmenu_setskipline(xmilcfg.SKIP_LINE); | menu_setraster(xmilcfg.RASTER); |
| xmenu_setresolute(xmilcfg.DIP_SW); | menu_setwaitflg(xmiloscfg.NOWAIT); |
| xmenu_setbootmedia(xmilcfg.DIP_SW); | menu_setframe(xmiloscfg.DRAW_SKIP); |
| xmenu_setkey(0); | menu_setkey(0); |
| xmenu_setbtnrapid(xmilcfg.BTN_RAPID); | menu_setsound(xmilcfg.SOUND_SW); |
| xmenu_setbtnmode(xmilcfg.BTN_MODE); | menu_setjoystick(xmiloscfg.JOYSTICK); |
| xmenu_setcpuspeed(xmilcfg.CPU8MHz); | menu_setmouse(xmilcfg.MOUSE_SW); |
| xmenu_setwaitflg(xmilcfg.NOWAIT); | menu_setmotorflg(xmilcfg.MOTOR); |
| xmenu_setframe(xmilcfg.DRAW_SKIP); | menu_setdispclk(xmiloscfg.DISPCLK); |
| xmenu_setmotorflg(xmilcfg.MOTOR); | menu_setbtnmode(xmilcfg.BTN_MODE); |
| xmenu_setz80save(xmiloscfg.Z80SAVE); | menu_setbtnrapid(xmilcfg.BTN_RAPID); |
| xmenu_setjoystick(xmiloscfg.JOYSTICK); | |
| xmenu_setdispclk(xmiloscfg.DISPCLK); | |
| xmenu_setdispmode(xmilcfg.DISPSYNC); | |
| xmenu_setmouse(xmilcfg.MOUSE_SW); | |
| ShowWindow(hWnd, nCmdShow); | ShowWindow(hWnd, nCmdShow); |
| UpdateWindow(hWnd); | UpdateWindow(hWnd); |
| sysmenu_initialize(); | sysmenu_initialize(); |
| // xmenu_initialize(); | menu_initialize(); |
| DrawMenuBar(hWnd); | DrawMenuBar(hWnd); |
| sysmenu_setwinsnap(xmiloscfg.WINSNAP); | sysmenu_setwinsnap(xmiloscfg.WINSNAP); |
| Line 713 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) { |
| Line 721 int WINAPI WinMain(HINSTANCE hInstance, | Line 875 int WINAPI WinMain(HINSTANCE hInstance, |
| return(FALSE); | return(FALSE); |
| } | } |
| } | } |
| joymng_initialize(); | |
| juliet_load(); | juliet_load(); |
| juliet_prepare(); | juliet_prepare(); |
| // juliet2_reset(); | |
| juliet2_reset(); | |
| if (soundmng_initialize() == SUCCESS) { | if (soundmng_initialize() == SUCCESS) { |
| soundmng_pcmload(SOUND_PCMSEEK, OEMTEXT("fddseek.wav"), 0); | soundmng_pcmload(SOUND_PCMSEEK, OEMTEXT("fddseek.wav"), 0); |
| soundmng_pcmload(SOUND_PCMSEEK1, OEMTEXT("fddseek1.wav"), 0); | soundmng_pcmload(SOUND_PCMSEEK1, OEMTEXT("fddseek1.wav"), 0); |
| Line 734 int WINAPI WinMain(HINSTANCE hInstance, | Line 886 int WINAPI WinMain(HINSTANCE hInstance, |
| soundmng_pcmvolume(SOUND_PCMSEEK1, xmilcfg.MOTORVOL); | soundmng_pcmvolume(SOUND_PCMSEEK1, xmilcfg.MOTORVOL); |
| } | } |
| sysmng_initialize(); | |
| joymng_initialize(); | |
| pccore_initialize(); | pccore_initialize(); |
| pccore_reset(); | pccore_reset(); |
| Line 754 int WINAPI WinMain(HINSTANCE hInstance, | Line 909 int WINAPI WinMain(HINSTANCE hInstance, |
| xmilopening = 0; | xmilopening = 0; |
| while(1) { | while(1) { |
| if (!(xmiloscfg.background & xmilforeground)) { | if (!xmilstopemulate) { |
| if (PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE)) { | if (PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE)) { |
| if (!GetMessage(&msg, NULL, 0, 0)) { | if (!GetMessage(&msg, NULL, 0, 0)) { |
| break; | break; |
| } | } |
| if ((msg.message != WM_SYSKEYDOWN) && | if ((msg.hwnd != hWnd) || |
| (msg.message != WM_SYSKEYUP)) { | ((msg.message != WM_SYSKEYDOWN) && |
| (msg.message != WM_SYSKEYUP))) { | |
| TranslateMessage(&msg); | TranslateMessage(&msg); |
| } | } |
| DispatchMessage(&msg); | DispatchMessage(&msg); |
| } | } |
| else { | else { |
| if (xmiloscfg.DISPCLK) { | if (xmiloscfg.NOWAIT) { |
| if (sysmng_workclockrenewal()) { | exec1frame(); |
| sysmng_updatecaption(2); | if (xmiloscfg.DRAW_SKIP) { // nowait frame skip |
| if (framecnt >= xmiloscfg.DRAW_SKIP) { | |
| processwait(0); | |
| } | |
| } | |
| else { // nowait auto skip | |
| if (timing_getcount()) { | |
| processwait(0); | |
| } | |
| } | |
| } | |
| else if (xmiloscfg.DRAW_SKIP) { // frame skip | |
| if (framecnt < xmiloscfg.DRAW_SKIP) { | |
| exec1frame(); | |
| } | |
| else { | |
| processwait(xmiloscfg.DRAW_SKIP); | |
| } | } |
| } | } |
| if ((xmilcfg.NOWAIT) || (timing_getcount())) { | else { // auto skip |
| timing_setcount(0); | if (!waitcnt) { |
| joymng_sync(); | UINT cnt; |
| mousemng_sync(); | exec1frame(); |
| juliet2_sync(25); | cnt = timing_getcount(); |
| x1r_exec(); | if (framecnt > cnt) { |
| x1f_sync(); | waitcnt = framecnt; |
| if (framemax > 1) { | |
| framemax--; | |
| } | |
| } | |
| else if (framecnt >= framemax) { | |
| if (framemax < 12) { | |
| framemax++; | |
| } | |
| if (cnt >= 12) { | |
| timing_reset(); | |
| } | |
| else { | |
| timing_setcount(cnt - framecnt); | |
| } | |
| framereset(0); | |
| } | |
| } | |
| else { | |
| processwait(waitcnt); | |
| waitcnt = framecnt; | |
| } | |
| } | } |
| soundmng_sync(); | |
| juliet2_exec(); | |
| } | } |
| } | } |
| else { | else { // background sleep |
| if (!GetMessage(&msg, NULL, 0, 0)) { | if (!GetMessage(&msg, NULL, 0, 0)) { |
| break; | break; |
| } | } |