|
|
| version 1.37, 2004/02/03 08:24:40 | version 1.75, 2007/12/28 20:36:39 |
|---|---|
| Line 8 | Line 8 |
| #include "parts.h" | #include "parts.h" |
| #include "np2.h" | #include "np2.h" |
| #include "np2arg.h" | #include "np2arg.h" |
| #include "cputype.h" | |
| #include "dosio.h" | #include "dosio.h" |
| #include "extromio.h" | #include "extromio.h" |
| #include "commng.h" | #include "commng.h" |
| Line 23 | Line 22 |
| #include "winloc.h" | #include "winloc.h" |
| #include "sstp.h" | #include "sstp.h" |
| #include "sstpmsg.h" | #include "sstpmsg.h" |
| #include "dclock.h" | |
| #include "toolwin.h" | #include "toolwin.h" |
| #include "juliet.h" | #include "juliet.h" |
| #include "np2class.h" | #include "np2class.h" |
| #include "dialog.h" | #include "dialog.h" |
| #include "memory.h" | #include "cpucore.h" |
| #include "pccore.h" | #include "pccore.h" |
| #include "iocore.h" | #include "iocore.h" |
| #include "pc9861k.h" | #include "pc9861k.h" |
| Line 41 | Line 39 |
| #include "diskdrv.h" | #include "diskdrv.h" |
| #include "fddfile.h" | #include "fddfile.h" |
| #include "timing.h" | #include "timing.h" |
| #include "keystat.h" | |
| #include "debugsub.h" | #include "debugsub.h" |
| #include "keydisp.h" | #include "subwind.h" |
| #include "kdispwin.h" | |
| #include "viewer.h" | #include "viewer.h" |
| #if !defined(_WIN64) | |
| #include "cputype.h" | |
| #endif | |
| #if defined(SUPPORT_DCLOCK) | |
| #include "dclock.h" | |
| #endif | |
| #ifdef BETA_RELEASE | #ifdef BETA_RELEASE |
| #define OPENING_WAIT 1500 | #define OPENING_WAIT 1500 |
| #endif | #endif |
| static char szClassName[] = "NP2-MainWindow"; | static TCHAR szClassName[] = _T("NP2-MainWindow"); |
| HWND hWndMain; | HWND g_hWndMain; |
| HINSTANCE hInst; | HINSTANCE g_hInstance; |
| HINSTANCE hPrev; | HINSTANCE g_hPrevInst; |
| #if !defined(_WIN64) | |
| int mmxflag; | int mmxflag; |
| BYTE np2break = 0; // ver0.30 | #endif |
| UINT8 np2break = 0; // ver0.30 | |
| BOOL winui_en; | BOOL winui_en; |
| NP2OSCFG np2oscfg = { | NP2OSCFG np2oscfg = { |
| "Neko Project II", "NP2", | OEMTEXT(PROJECTNAME) OEMTEXT(PROJECTSUBNAME), |
| CW_USEDEFAULT, CW_USEDEFAULT, 1, 1, 0, 1, 0, 0, | OEMTEXT("NP2"), |
| CW_USEDEFAULT, CW_USEDEFAULT, 1, 1, 0, 0, 0, 1, 0, 0, | |
| 0, 0, KEY_UNKNOWN, 0, | 0, 0, KEY_UNKNOWN, 0, |
| 0, 0, 0, {1, 2, 2, 1}, | 0, 0, 0, {1, 2, 2, 1}, |
| {5, 0, 0x3e, 19200, "", "", "", ""}, // ver0.34 | {5, 0, 0x3e, 19200, |
| {0, 0, 0x3e, 19200, "", "", "", ""}, // ver0.34 | OEMTEXT(""), OEMTEXT(""), OEMTEXT(""), OEMTEXT("")}, |
| {0, 0, 0x3e, 19200, "", "", "", ""}, // ver0.34 | {0, 0, 0x3e, 19200, |
| {0, 0, 0x3e, 19200, "", "", "", ""}, // ver0.34 | OEMTEXT(""), OEMTEXT(""), OEMTEXT(""), OEMTEXT("")}, |
| {0, 0, 0x3e, 19200, | |
| OEMTEXT(""), OEMTEXT(""), OEMTEXT(""), OEMTEXT("")}, | |
| {0, 0, 0x3e, 19200, | |
| OEMTEXT(""), OEMTEXT(""), OEMTEXT(""), OEMTEXT("")}, | |
| 0xffffff, 0xffbf6a, 0, 0, | 0xffffff, 0xffbf6a, 0, 0, |
| 0, 1, 0, 9801, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; | 0, 1, 0, 9801, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| char fddfolder[MAX_PATH]; | OEMCHAR fddfolder[MAX_PATH]; |
| char hddfolder[MAX_PATH]; | OEMCHAR hddfolder[MAX_PATH]; |
| char bmpfilefolder[MAX_PATH]; | OEMCHAR bmpfilefolder[MAX_PATH]; |
| char modulefile[MAX_PATH]; | OEMCHAR modulefile[MAX_PATH]; |
| static UINT framecnt = 0; | static UINT framecnt = 0; |
| static UINT waitcnt = 0; | static UINT waitcnt = 0; |
| static UINT framemax = 1; | static UINT framemax = 1; |
| static BYTE np2stopemulate = 0; | static UINT8 np2stopemulate = 0; |
| static int np2opening = 1; | static int np2opening = 1; |
| static int np2quitmsg = 0; | static int np2quitmsg = 0; |
| static HMENU hStat = NULL; | static UINT8 scrnmode; |
| static BYTE scrnmode; | |
| static WINLOCEX smwlex; | static WINLOCEX smwlex; |
| static HMODULE s_hModResource; | |
| static const OEMCHAR np2help[] = OEMTEXT("np2.chm"); | |
| static const OEMCHAR np2flagext[] = OEMTEXT("S%02d"); | |
| #if defined(_WIN64) | |
| static const OEMCHAR szNp2ResDll[] = OEMTEXT("np2x64_%u.dll"); | |
| #else // defined(_WIN64) | |
| static const OEMCHAR szNp2ResDll[] = OEMTEXT("np2_%u.dll"); | |
| #endi // defined(_WIN64) | |
| // ---- | |
| static int messagebox(HWND hWnd, LPCTSTR lpcszText, UINT uType) | |
| { | |
| int nRet; | |
| LPTSTR lpszText; | |
| #if defined(OSLANG_UTF8) | |
| TCHAR szCation[128]; | |
| oemtotchar(szCaption, NELEMENTS(szCaption), np2oscfg.titles, -1); | |
| #else // defined(OSLANG_UTF8) | |
| LPCTSTR szCaption = np2oscfg.titles; | |
| #endif // defined(OSLANG_UTF8) | |
| nRet = 0; | |
| if (HIWORD(lpcszText)) | |
| { | |
| nRet = MessageBox(hWnd, lpcszText, szCaption, uType); | |
| } | |
| else | |
| { | |
| lpszText = lockstringresource(lpcszText); | |
| nRet = MessageBox(hWnd, lpszText, szCaption, uType); | |
| unlockstringresource(lpszText); | |
| } | |
| return nRet; | |
| } | |
| // ---- | |
| static HINSTANCE loadextinst(HINSTANCE hInstance) | |
| { | |
| OEMCHAR szPath[MAX_PATH]; | |
| OEMCHAR szDllName[32]; | |
| HMODULE hMod; | |
| file_cpyname(szPath, modulefile, NELEMENTS(szPath)); | |
| file_cutname(szPath); | |
| OEMSPRINTF(szDllName, szNp2ResDll, GetOEMCP()); | |
| file_catname(szPath, szDllName, NELEMENTS(szPath)); | |
| hMod = LoadLibrary(szPath); | |
| s_hModResource = hMod; | |
| if (hMod != NULL) | |
| { | |
| hInstance = (HINSTANCE)hMod; | |
| } | |
| return(hInstance); | |
| } | |
| static const char np2help[] = "np2.chm"; | static void unloadextinst(void) |
| static const char np2flagext[] = "S%02d"; | { |
| HMODULE hMod; | |
| hMod = s_hModResource; | |
| s_hModResource = 0; | |
| if (hMod) | |
| { | |
| FreeLibrary(hMod); | |
| } | |
| } | |
| // ---- | |
| static void winuienter(void) { | static void winuienter(void) { |
| winui_en = TRUE; | winui_en = TRUE; |
| Line 106 static void winuileave(void) { | Line 186 static void winuileave(void) { |
| WINLOCEX np2_winlocexallwin(HWND base) { | WINLOCEX np2_winlocexallwin(HWND base) { |
| HWND list[3]; | |
| UINT i; | UINT i; |
| UINT cnt; | |
| HWND list[5]; | |
| list[0] = hWndMain; | cnt = 0; |
| list[1] = toolwin_gethwnd(); | list[cnt++] = g_hWndMain; |
| list[2] = kdispwin_gethwnd(); | list[cnt++] = toolwin_gethwnd(); |
| for (i=0; i<3; i++) { | list[cnt++] = kdispwin_gethwnd(); |
| list[cnt++] = skbdwin_gethwnd(); | |
| list[cnt++] = mdbgwin_gethwnd(); | |
| for (i=0; i<cnt; i++) { | |
| if (list[i] == base) { | if (list[i] == base) { |
| list[i] = NULL; | list[i] = NULL; |
| } | } |
| } | } |
| if (base != hWndMain) { // hWndMainのみ全体移動 | if (base != g_hWndMain) { // hWndMainのみ全体移動 |
| base = NULL; | base = NULL; |
| } | } |
| return(winlocex_create(base, list, 3)); | return(winlocex_create(base, list, cnt)); |
| } | } |
| static void changescreen(BYTE newmode) { | static void changescreen(UINT8 newmode) { |
| BYTE change; | UINT8 change; |
| BYTE renewal; | UINT8 renewal; |
| WINLOCEX wlex; | WINLOCEX wlex; |
| change = scrnmode ^ newmode; | change = scrnmode ^ newmode; |
| Line 142 static void changescreen(BYTE newmode) { | Line 226 static void changescreen(BYTE newmode) { |
| if (renewal & SCRNMODE_FULLSCREEN) { | if (renewal & SCRNMODE_FULLSCREEN) { |
| toolwin_destroy(); | toolwin_destroy(); |
| kdispwin_destroy(); | kdispwin_destroy(); |
| skbdwin_destroy(); | |
| mdbgwin_destroy(); | |
| } | } |
| else if (renewal & SCRNMODE_ROTATEMASK) { | else if (renewal & SCRNMODE_ROTATEMASK) { |
| wlex = np2_winlocexallwin(hWndMain); | wlex = np2_winlocexallwin(g_hWndMain); |
| winlocex_setholdwnd(wlex, hWndMain); | winlocex_setholdwnd(wlex, g_hWndMain); |
| } | } |
| soundmng_stop(); | soundmng_stop(); |
| mousemng_disable(MOUSEPROC_WINUI); | mousemng_disable(MOUSEPROC_WINUI); |
| Line 163 static void changescreen(BYTE newmode) { | Line 249 static void changescreen(BYTE newmode) { |
| if (renewal & SCRNMODE_FULLSCREEN) { | if (renewal & SCRNMODE_FULLSCREEN) { |
| if (!scrnmng_isfullscreen()) { | if (!scrnmng_isfullscreen()) { |
| if (np2oscfg.toolwin) { | if (np2oscfg.toolwin) { |
| toolwin_create(); | toolwin_create(g_hInstance); |
| } | } |
| if (np2oscfg.keydisp) { | if (np2oscfg.keydisp) { |
| kdispwin_create(); | kdispwin_create(g_hInstance); |
| } | } |
| } | } |
| } | } |
| Line 200 static void wincentering(HWND hWnd) { | Line 286 static void wincentering(HWND hWnd) { |
| np2oscfg.winy = 0; | np2oscfg.winy = 0; |
| } | } |
| sysmng_update(SYS_UPDATEOSCFG); | sysmng_update(SYS_UPDATEOSCFG); |
| MoveWindow(hWndMain, np2oscfg.winx, np2oscfg.winy, width, height, TRUE); | MoveWindow(g_hWndMain, np2oscfg.winx, np2oscfg.winy, width, height, TRUE); |
| } | } |
| void np2active_renewal(void) { // ver0.30 | void np2active_renewal(void) { // ver0.30 |
| if (np2break & (~NP2BREAK_MAIN)) { | if (np2break & (~NP2BREAK_MAIN)) { |
| np2stopemulate = 2; | np2stopemulate = 2; |
| Line 229 void np2active_renewal(void) { / | Line 315 void np2active_renewal(void) { / |
| } | } |
| } | } |
| static void getstatfilename(char *path, const char *ext, int size) { | |
| // ---- resume and statsave | |
| #if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE) | |
| static void getstatfilename(OEMCHAR *path, const OEMCHAR *ext, int size) { | |
| file_cpyname(path, modulefile, size); | file_cpyname(path, modulefile, size); |
| file_cutext(path); | file_cutext(path); |
| Line 237 static void getstatfilename(char *path, | Line 327 static void getstatfilename(char *path, |
| file_catname(path, ext, size); | file_catname(path, ext, size); |
| } | } |
| static int flagsave(const char *ext) { | static int flagsave(const OEMCHAR *ext) { |
| int ret; | int ret; |
| char path[MAX_PATH]; | OEMCHAR path[MAX_PATH]; |
| getstatfilename(path, ext, sizeof(path)); | getstatfilename(path, ext, NELEMENTS(path)); |
| soundmng_stop(); | soundmng_stop(); |
| ret = statsave_save(path); | ret = statsave_save(path); |
| if (ret) { | if (ret) { |
| Line 252 static int flagsave(const char *ext) { | Line 342 static int flagsave(const char *ext) { |
| return(ret); | return(ret); |
| } | } |
| static void flagdelete(const char *ext) { | static void flagdelete(const OEMCHAR *ext) { |
| char path[MAX_PATH]; | OEMCHAR path[MAX_PATH]; |
| getstatfilename(path, ext, sizeof(path)); | getstatfilename(path, ext, NELEMENTS(path)); |
| file_delete(path); | file_delete(path); |
| } | } |
| static int flagload(const char *ext, const char *title, BOOL force) { | static int flagload(HWND hWnd, const OEMCHAR *ext, LPCTSTR title, BOOL force) |
| { | |
| int ret; | int nRet; |
| int id; | int nID; |
| char path[MAX_PATH]; | OEMCHAR szPath[MAX_PATH]; |
| char buf[1024]; | OEMCHAR szStat[1024]; |
| TCHAR szFormat[256]; | |
| TCHAR szMessage[1024 + 256]; | |
| getstatfilename(path, ext, sizeof(path)); | getstatfilename(szPath, ext, NELEMENTS(szPath)); |
| winuienter(); | winuienter(); |
| id = IDYES; | nID = IDYES; |
| ret = statsave_check(path, buf, sizeof(buf)); | nRet = statsave_check(szPath, szStat, NELEMENTS(szStat)); |
| if (ret & (~NP2FLAG_DISKCHG)) { | if (nRet & (~STATFLAG_DISKCHG)) |
| MessageBox(hWndMain, "Couldn't restart", title, MB_OK | MB_ICONSTOP); | { |
| id = IDNO; | messagebox(hWnd, MAKEINTRESOURCE(IDS_ERROR_RESUME), |
| } | MB_OK | MB_ICONSTOP); |
| else if ((!force) && (ret & NP2FLAG_DISKCHG)) { | nID = IDNO; |
| char buf2[1024 + 256]; | } |
| wsprintf(buf2, "Conflict!\n\n%s\nContinue?", buf); | else if ((!force) && (nRet & STATFLAG_DISKCHG)) |
| id = MessageBox(hWndMain, buf2, title, | { |
| MB_YESNOCANCEL | MB_ICONQUESTION); | #if defined(OSLANG_UTF8) |
| } | TCHAR szStat2[128]; |
| if (id == IDYES) { | oemtotchar(szStat2, NELEMENTS(szStat2), szStat, -1); |
| statsave_load(path); | #else // defined(OSLANG_UTF8) |
| LPCTSTR szStat2 = szStat; | |
| #endif // defined(OSLANG_UTF8) | |
| loadstringresource(IDS_CONFIRM_RESUME, szFormat, NELEMENTS(szFormat)); | |
| wsprintf(szMessage, szFormat, szStat2); | |
| nID = messagebox(hWnd, szMessage, MB_YESNOCANCEL | MB_ICONQUESTION); | |
| } | |
| if (nID == IDYES) | |
| { | |
| statsave_load(szPath); | |
| toolwin_setfdd(0, fdd_diskname(0)); | toolwin_setfdd(0, fdd_diskname(0)); |
| toolwin_setfdd(1, fdd_diskname(1)); | toolwin_setfdd(1, fdd_diskname(1)); |
| } | } |
| sysmng_workclockreset(); | sysmng_workclockreset(); |
| sysmng_updatecaption(1); | sysmng_updatecaption(1); |
| winuileave(); | winuileave(); |
| return(id); | return nID; |
| } | } |
| #endif | |
| // ---- proc | // ---- proc |
| Line 301 static void np2popup(HWND hWnd, LPARAM l | Line 403 static void np2popup(HWND hWnd, LPARAM l |
| HMENU hMenu; | HMENU hMenu; |
| POINT pt; | POINT pt; |
| mainmenu = (HMENU)GetWindowLong(hWnd, NP2GWL_HMENU); | mainmenu = (HMENU)GetWindowLongPtr(hWnd, NP2GWLP_HMENU); |
| if (mainmenu == NULL) { | if (mainmenu == NULL) { |
| return; | return; |
| } | } |
| Line 314 static void np2popup(HWND hWnd, LPARAM l | Line 416 static void np2popup(HWND hWnd, LPARAM l |
| DestroyMenu(hMenu); | DestroyMenu(hMenu); |
| } | } |
| // extern "C" void iptrace_out(void); | static void OnCommand(HWND hWnd, WPARAM wParam) |
| { | |
| static void np2cmd(HWND hWnd, UINT16 cmd) { | HINSTANCE hInstance; |
| UINT update; | |
| UINT update; | UINT uID; |
| BOOL b; | BOOL b; |
| hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE);; | |
| update = 0; | update = 0; |
| switch(cmd) { | uID = LOWORD(wParam); |
| switch(uID) | |
| { | |
| case IDM_RESET: | case IDM_RESET: |
| b = FALSE; | b = FALSE; |
| if (!np2oscfg.comfirm) { | if (!np2oscfg.comfirm) |
| { | |
| b = TRUE; | b = TRUE; |
| } | } |
| else if (sstpconfirm_reset()) { | else if (sstpconfirm_reset()) |
| { | |
| winuienter(); | winuienter(); |
| if (MessageBox(hWnd, "Sure?", "Reset", | if (messagebox(hWnd, MAKEINTRESOURCE(IDS_CONFIRM_RESET), |
| MB_ICONQUESTION | MB_YESNO) == IDYES) { | MB_ICONQUESTION | MB_YESNO) == IDYES) |
| { | |
| b = TRUE; | b = TRUE; |
| } | } |
| winuileave(); | winuileave(); |
| } | } |
| if (b) { | if (b) |
| { | |
| sstpmsg_reset(); | sstpmsg_reset(); |
| juliet_YMF288Reset(); | juliet_YMF288Reset(); |
| pccore_cfgupdate(); | pccore_cfgupdate(); |
| Line 347 static void np2cmd(HWND hWnd, UINT16 cmd | Line 456 static void np2cmd(HWND hWnd, UINT16 cmd |
| case IDM_CONFIG: | case IDM_CONFIG: |
| winuienter(); | winuienter(); |
| sstpmsg_config(); | sstpmsg_config(); |
| DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG), | DialogBox(hInstance, MAKEINTRESOURCE(IDD_CONFIG), |
| hWnd, (DLGPROC)CfgDialogProc); | hWnd, (DLGPROC)CfgDialogProc); |
| if (!scrnmng_isfullscreen()) { | |
| UINT8 thick; | |
| thick = (GetWindowLong(hWnd, GWL_STYLE) & WS_THICKFRAME)?1:0; | |
| if (thick != np2oscfg.thickframe) { | |
| WINLOCEX wlex; | |
| wlex = np2_winlocexallwin(hWnd); | |
| winlocex_setholdwnd(wlex, hWnd); | |
| np2class_frametype(hWnd, np2oscfg.thickframe); | |
| winlocex_move(wlex); | |
| winlocex_destroy(wlex); | |
| } | |
| } | |
| winuileave(); | winuileave(); |
| break; | break; |
| Line 390 static void np2cmd(HWND hWnd, UINT16 cmd | Line 511 static void np2cmd(HWND hWnd, UINT16 cmd |
| toolwin_setfdd(1, NULL); | toolwin_setfdd(1, NULL); |
| break; | break; |
| case IDM_SASI1OPEN: | case IDM_FDD3OPEN: |
| winuienter(); | |
| dialog_changefdd(hWnd, 2); | |
| winuileave(); | |
| break; | |
| case IDM_FDD3EJECT: | |
| diskdrv_setfdd(2, NULL, 0); | |
| toolwin_setfdd(2, NULL); | |
| break; | |
| case IDM_FDD4OPEN: | |
| winuienter(); | |
| dialog_changefdd(hWnd, 3); | |
| winuileave(); | |
| break; | |
| case IDM_FDD4EJECT: | |
| diskdrv_setfdd(3, NULL, 0); | |
| toolwin_setfdd(3, NULL); | |
| break; | |
| case IDM_IDE0OPEN: | |
| winuienter(); | winuienter(); |
| dialog_changehdd(hWnd, 0x00); | dialog_changehdd(hWnd, 0x00); |
| winuileave(); | winuileave(); |
| break; | break; |
| case IDM_SASI1EJECT: | case IDM_IDE0EJECT: |
| diskdrv_sethdd(0x00, NULL); | diskdrv_sethdd(0x00, NULL); |
| break; | break; |
| case IDM_SASI2OPEN: | case IDM_IDE1OPEN: |
| winuienter(); | winuienter(); |
| dialog_changehdd(hWnd, 0x01); | dialog_changehdd(hWnd, 0x01); |
| winuileave(); | winuileave(); |
| break; | break; |
| case IDM_SASI2EJECT: | case IDM_IDE1EJECT: |
| diskdrv_sethdd(0x01, NULL); | diskdrv_sethdd(0x01, NULL); |
| break; | break; |
| #if defined(SUPPORT_IDEIO) | |
| case IDM_IDE2OPEN: | |
| winuienter(); | |
| dialog_changehdd(hWnd, 0x02); | |
| winuileave(); | |
| break; | |
| case IDM_IDE2EJECT: | |
| diskdrv_sethdd(0x02, NULL); | |
| break; | |
| #endif | |
| #if defined(SUPPORT_SCSI) | #if defined(SUPPORT_SCSI) |
| case IDM_SCSI0OPEN: | case IDM_SCSI0OPEN: |
| winuienter(); | winuienter(); |
| Line 450 static void np2cmd(HWND hWnd, UINT16 cmd | Line 606 static void np2cmd(HWND hWnd, UINT16 cmd |
| diskdrv_sethdd(0x23, NULL); | diskdrv_sethdd(0x23, NULL); |
| break; | break; |
| #endif | #endif |
| case IDM_WINDOW: | case IDM_WINDOW: |
| changescreen(scrnmode & (~SCRNMODE_FULLSCREEN)); | changescreen(scrnmode & (~SCRNMODE_FULLSCREEN)); |
| break; | break; |
| Line 566 static void np2cmd(HWND hWnd, UINT16 cmd | Line 723 static void np2cmd(HWND hWnd, UINT16 cmd |
| case IDM_F12MOUSE: | case IDM_F12MOUSE: |
| xmenu_setf12copy(0); | xmenu_setf12copy(0); |
| winkbd_resetf12(); | winkbd_resetf12(); |
| winkbd_setf12(0); | |
| update |= SYS_UPDATEOSCFG; | update |= SYS_UPDATEOSCFG; |
| break; | break; |
| case IDM_F12COPY: | case IDM_F12COPY: |
| xmenu_setf12copy(1); | xmenu_setf12copy(1); |
| winkbd_resetf12(); | winkbd_resetf12(); |
| winkbd_setf12(1); | |
| update |= SYS_UPDATEOSCFG; | update |= SYS_UPDATEOSCFG; |
| break; | break; |
| case IDM_F12STOP: | case IDM_F12STOP: |
| xmenu_setf12copy(2); | xmenu_setf12copy(2); |
| winkbd_resetf12(); | winkbd_resetf12(); |
| winkbd_setf12(2); | |
| update |= SYS_UPDATEOSCFG; | update |= SYS_UPDATEOSCFG; |
| break; | break; |
| case IDM_F12EQU: | case IDM_F12EQU: |
| xmenu_setf12copy(3); | xmenu_setf12copy(3); |
| winkbd_resetf12(); | winkbd_resetf12(); |
| winkbd_setf12(3); | |
| update |= SYS_UPDATEOSCFG; | update |= SYS_UPDATEOSCFG; |
| break; | break; |
| case IDM_F12COMMA: | case IDM_F12COMMA: |
| xmenu_setf12copy(4); | xmenu_setf12copy(4); |
| winkbd_resetf12(); | winkbd_resetf12(); |
| winkbd_setf12(4); | |
| update |= SYS_UPDATEOSCFG; | |
| break; | |
| case IDM_USERKEY1: | |
| xmenu_setf12copy(5); | |
| winkbd_resetf12(); | |
| winkbd_setf12(5); | |
| update |= SYS_UPDATEOSCFG; | |
| break; | |
| case IDM_USERKEY2: | |
| xmenu_setf12copy(6); | |
| winkbd_resetf12(); | |
| winkbd_setf12(6); | |
| update |= SYS_UPDATEOSCFG; | update |= SYS_UPDATEOSCFG; |
| break; | break; |
| Line 667 static void np2cmd(HWND hWnd, UINT16 cmd | Line 843 static void np2cmd(HWND hWnd, UINT16 cmd |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; |
| break; | break; |
| #if defined(SUPPORT_PX) | |
| case IDM_PX1: | |
| xmenu_setsound(0x30); | |
| update |= SYS_UPDATECFG; | |
| break; | |
| case IDM_PX2: | |
| xmenu_setsound(0x50); | |
| update |= SYS_UPDATECFG; | |
| break; | |
| #endif // defined(SUPPORT_PX) | |
| case IDM_JASTSOUND: | case IDM_JASTSOUND: |
| xmenu_setjastsound(np2oscfg.jastsnd ^ 1); | xmenu_setjastsound(np2oscfg.jastsnd ^ 1); |
| update |= SYS_UPDATEOSCFG; | update |= SYS_UPDATEOSCFG; |
| Line 697 static void np2cmd(HWND hWnd, UINT16 cmd | Line 885 static void np2cmd(HWND hWnd, UINT16 cmd |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; |
| break; | break; |
| case IDM_MEM116: | |
| xmenu_setextmem(11); | |
| update |= SYS_UPDATECFG; | |
| break; | |
| case IDM_MEM136: | |
| xmenu_setextmem(13); | |
| update |= SYS_UPDATECFG; | |
| break; | |
| case IDM_MOUSE: | case IDM_MOUSE: |
| mousemng_toggle(MOUSEPROC_SYSTEM); | mousemng_toggle(MOUSEPROC_SYSTEM); |
| xmenu_setmouse(np2oscfg.MOUSE_SW ^ 1); | xmenu_setmouse(np2oscfg.MOUSE_SW ^ 1); |
| Line 711 static void np2cmd(HWND hWnd, UINT16 cmd | Line 909 static void np2cmd(HWND hWnd, UINT16 cmd |
| case IDM_MPUPC98: | case IDM_MPUPC98: |
| winuienter(); | winuienter(); |
| DialogBox(hInst, MAKEINTRESOURCE(IDD_MPUPC98), | DialogBox(hInstance, MAKEINTRESOURCE(IDD_MPUPC98), |
| hWnd, (DLGPROC)MidiDialogProc); | hWnd, (DLGPROC)MidiDialogProc); |
| winuileave(); | winuileave(); |
| break; | break; |
| case IDM_MIDIPANIC: // ver0.29 | case IDM_MIDIPANIC: |
| rs232c_midipanic(); | rs232c_midipanic(); |
| mpu98ii_midipanic(); | mpu98ii_midipanic(); |
| pc9861k_midipanic(); | pc9861k_midipanic(); |
| Line 733 static void np2cmd(HWND hWnd, UINT16 cmd | Line 931 static void np2cmd(HWND hWnd, UINT16 cmd |
| dialog_writebmp(hWnd); | dialog_writebmp(hWnd); |
| winuileave(); | winuileave(); |
| break; | break; |
| #if defined(SUPPORT_S98) | |
| case IDM_S98LOGGING: | case IDM_S98LOGGING: |
| winuienter(); | winuienter(); |
| dialog_s98(hWnd); | dialog_s98(hWnd); |
| winuileave(); | winuileave(); |
| break; | break; |
| #endif | |
| #if defined(SUPPORT_WAVEREC) | |
| case IDM_WAVEREC: | |
| winuienter(); | |
| dialog_waverec(hWnd); | |
| winuileave(); | |
| break; | |
| #endif | |
| case IDM_DISPCLOCK: | case IDM_DISPCLOCK: |
| xmenu_setdispclk(np2oscfg.DISPCLK ^ 1); | xmenu_setdispclk(np2oscfg.DISPCLK ^ 1); |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; |
| Line 752 static void np2cmd(HWND hWnd, UINT16 cmd | Line 957 static void np2cmd(HWND hWnd, UINT16 cmd |
| case IDM_CALENDAR: | case IDM_CALENDAR: |
| winuienter(); | winuienter(); |
| DialogBox(hInst, MAKEINTRESOURCE(IDD_CALENDAR), | DialogBox(hInstance, MAKEINTRESOURCE(IDD_CALENDAR), |
| hWnd, (DLGPROC)ClndDialogProc); | hWnd, (DLGPROC)ClndDialogProc); |
| winuileave(); | winuileave(); |
| break; | break; |
| Line 787 static void np2cmd(HWND hWnd, UINT16 cmd | Line 992 static void np2cmd(HWND hWnd, UINT16 cmd |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; |
| break; | break; |
| case IDM_I286SAVE: | case IDM_CPUSAVE: |
| debugsub_status(); | debugsub_status(); |
| break; | break; |
| Line 800 static void np2cmd(HWND hWnd, UINT16 cmd | Line 1005 static void np2cmd(HWND hWnd, UINT16 cmd |
| sstpmsg_about(); | sstpmsg_about(); |
| if (sstp_result() != SSTP_SENDING) { | if (sstp_result() != SSTP_SENDING) { |
| winuienter(); | winuienter(); |
| DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), | DialogBox(hInstance, MAKEINTRESOURCE(IDD_ABOUT), |
| hWnd, (DLGPROC)AboutDialogProc); | hWnd, (DLGPROC)AboutDialogProc); |
| winuileave(); | winuileave(); |
| } | } |
| break; | break; |
| default: | default: |
| if ((cmd >= IDM_FLAGSAVE) && | #if defined(SUPPORT_STATSAVE) |
| (cmd < (IDM_FLAGSAVE + STATSAVEMAX))) { | if ((uID >= IDM_FLAGSAVE) && |
| char ext[4]; | (uID < (IDM_FLAGSAVE + SUPPORT_STATSAVE))) { |
| wsprintf(ext, np2flagext, cmd - IDM_FLAGSAVE); | OEMCHAR ext[4]; |
| OEMSPRINTF(ext, np2flagext, uID - IDM_FLAGSAVE); | |
| flagsave(ext); | flagsave(ext); |
| } | } |
| if ((cmd >= IDM_FLAGLOAD) && | else if ((uID >= IDM_FLAGLOAD) && |
| (cmd < (IDM_FLAGLOAD + STATSAVEMAX))) { | (uID < (IDM_FLAGLOAD + SUPPORT_STATSAVE))) { |
| char ext[4]; | OEMCHAR ext[4]; |
| wsprintf(ext, np2flagext, cmd - IDM_FLAGLOAD); | OEMSPRINTF(ext, np2flagext, uID - IDM_FLAGLOAD); |
| flagload(ext, "Status Load", TRUE); | flagload(hWnd, ext, _T("Status Load"), TRUE); |
| } | } |
| #endif | |
| break; | break; |
| } | } |
| sysmng_update(update); | sysmng_update(update); |
| Line 850 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1057 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| case IDM_TOOLWIN: | case IDM_TOOLWIN: |
| sysmenu_settoolwin(np2oscfg.toolwin ^ 1); | sysmenu_settoolwin(np2oscfg.toolwin ^ 1); |
| if (np2oscfg.toolwin) { | if (np2oscfg.toolwin) { |
| toolwin_create(); | toolwin_create(g_hInstance); |
| } | } |
| else { | else { |
| toolwin_destroy(); | toolwin_destroy(); |
| Line 858 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1065 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| update |= SYS_UPDATEOSCFG; | update |= SYS_UPDATEOSCFG; |
| break; | break; |
| #if defined(SUPPORT_KEYDISP) | |
| case IDM_KEYDISP: | case IDM_KEYDISP: |
| sysmenu_setkeydisp(np2oscfg.keydisp ^ 1); | sysmenu_setkeydisp(np2oscfg.keydisp ^ 1); |
| if (np2oscfg.keydisp) { | if (np2oscfg.keydisp) { |
| kdispwin_create(); | kdispwin_create(g_hInstance); |
| } | } |
| else { | else { |
| kdispwin_destroy(); | kdispwin_destroy(); |
| } | } |
| break; | break; |
| #endif | |
| #if defined(SUPPORT_SOFTKBD) | |
| case IDM_SOFTKBD: | |
| skbdwin_create(g_hInstance); | |
| break; | |
| #endif | |
| #if defined(CPUCORE_IA32) && defined(SUPPORT_MEMDBG32) | |
| case IDM_MEMDBG32: | |
| mdbgwin_create(g_hInstance); | |
| break; | |
| #endif | |
| case IDM_SCREENCENTER: | case IDM_SCREENCENTER: |
| if ((!scrnmng_isfullscreen()) && | if ((!scrnmng_isfullscreen()) && |
| (!(GetWindowLong(hWnd, GWL_STYLE) & | (!(GetWindowLong(hWnd, GWL_STYLE) & |
| Line 899 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1117 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| break; | break; |
| case IDM_DEBUGUTY: | case IDM_DEBUGUTY: |
| viewer_open(); | viewer_open(g_hInstance); |
| break; | break; |
| case IDM_SCRNMUL4: // ver0.26 | case IDM_SCRNMUL4: |
| case IDM_SCRNMUL6: | case IDM_SCRNMUL6: |
| case IDM_SCRNMUL8: | case IDM_SCRNMUL8: |
| case IDM_SCRNMUL10: | case IDM_SCRNMUL10: |
| case IDM_SCRNMUL12: | case IDM_SCRNMUL12: |
| case IDM_SCRNMUL16: | case IDM_SCRNMUL16: |
| if ((!scrnmng_isfullscreen()) && | if ((!scrnmng_isfullscreen()) && |
| !(GetWindowLong(hWndMain, GWL_STYLE) & WS_MINIMIZE)) { | !(GetWindowLong(g_hWndMain, GWL_STYLE) & WS_MINIMIZE)) |
| sysmenu_setscrnmul(wParam - IDM_SCRNMUL); | { |
| scrnmng_setmultiple(wParam - IDM_SCRNMUL); | sysmenu_setscrnmul((UINT8)(wParam - IDM_SCRNMUL)); |
| scrnmng_setmultiple((int)(wParam - IDM_SCRNMUL)); | |
| } | } |
| break; | break; |
| Line 930 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1149 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| if (subwin) { | if (subwin) { |
| ShowWindow(subwin, SW_SHOWNOACTIVATE); | ShowWindow(subwin, SW_SHOWNOACTIVATE); |
| } | } |
| subwin = skbdwin_gethwnd(); | |
| if (subwin) { | |
| ShowWindow(subwin, SW_SHOWNOACTIVATE); | |
| } | |
| subwin = mdbgwin_gethwnd(); | |
| if (subwin) { | |
| ShowWindow(subwin, SW_SHOWNOACTIVATE); | |
| } | |
| return(DefWindowProc(hWnd, msg, wParam, lParam)); | return(DefWindowProc(hWnd, msg, wParam, lParam)); |
| default: | default: |
| Line 939 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1166 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| break; | break; |
| case WM_COMMAND: | case WM_COMMAND: |
| np2cmd(hWnd, LOWORD(wParam)); | OnCommand(hWnd, wParam); |
| break; | break; |
| case WM_ACTIVATE: | case WM_ACTIVATE: |
| Line 959 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1186 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| case WM_PAINT: | case WM_PAINT: |
| hdc = BeginPaint(hWnd, &ps); | hdc = BeginPaint(hWnd, &ps); |
| if (np2opening) { | if (np2opening) { |
| HINSTANCE hinst; | HINSTANCE hInstance; |
| RECT rect; | RECT rect; |
| int width; | int width; |
| int height; | int height; |
| Line 967 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1194 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| BITMAP bmp; | BITMAP bmp; |
| HDC hmdc; | HDC hmdc; |
| HBRUSH hbrush; | HBRUSH hbrush; |
| hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); | hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE); |
| GetClientRect(hWnd, &rect); | GetClientRect(hWnd, &rect); |
| width = rect.right - rect.left; | width = rect.right - rect.left; |
| height = rect.bottom - rect.top; | height = rect.bottom - rect.top; |
| hbmp = LoadBitmap(hinst, "NP2BMP"); | hbmp = LoadBitmap(hInstance, _T("NP2BMP")); |
| GetObject(hbmp, sizeof(BITMAP), &bmp); | GetObject(hbmp, sizeof(BITMAP), &bmp); |
| hbrush = (HBRUSH)SelectObject(hdc, | hbrush = (HBRUSH)SelectObject(hdc, |
| GetStockObject(BLACK_BRUSH)); | GetStockObject(BLACK_BRUSH)); |
| Line 997 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1224 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| break; | break; |
| case WM_MOVE: | case WM_MOVE: |
| if (!scrnmng_isfullscreen()) { | if ((!scrnmng_isfullscreen()) && |
| if (!(GetWindowLong(hWnd, GWL_STYLE) & | (!(GetWindowLong(hWnd, GWL_STYLE) & |
| (WS_MAXIMIZE | WS_MINIMIZE))) { | (WS_MAXIMIZE | WS_MINIMIZE)))) { |
| GetWindowRect(hWnd, &rc); | GetWindowRect(hWnd, &rc); |
| np2oscfg.winx = rc.left; | np2oscfg.winx = rc.left; |
| np2oscfg.winy = rc.top; | np2oscfg.winy = rc.top; |
| sysmng_update(SYS_UPDATEOSCFG); | sysmng_update(SYS_UPDATEOSCFG); |
| } | |
| } | } |
| break; | break; |
| Line 1048 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1274 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| case WM_KEYDOWN: | case WM_KEYDOWN: |
| if (wParam == VK_F11) { | if (wParam == VK_F11) { |
| np2class_enablemenu(hWndMain, TRUE); | np2class_enablemenu(g_hWndMain, TRUE); |
| return(DefWindowProc(hWnd, WM_SYSKEYDOWN, VK_F10, lParam)); | return(DefWindowProc(hWnd, WM_SYSKEYDOWN, VK_F10, lParam)); |
| } | } |
| if ((wParam == VK_F12) && (!np2oscfg.F12COPY)) { | if ((wParam == VK_F12) && (!np2oscfg.F12COPY)) { |
| Line 1105 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1331 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| HTCAPTION, 0L)); | HTCAPTION, 0L)); |
| } | } |
| } | } |
| #if defined(SUPPORT_DCLOCK) | |
| else { | else { |
| POINT p; | POINT p; |
| if ((GetCursorPos(&p)) && (p.y >= 466)) { | if ((GetCursorPos(&p)) && |
| (scrnmng_isdispclockclick(&p))) { | |
| np2oscfg.clk_x++; | np2oscfg.clk_x++; |
| sysmng_update(SYS_UPDATEOSCFG); | sysmng_update(SYS_UPDATEOSCFG); |
| dclock_reset(); | dclock_reset(); |
| } | } |
| } | } |
| #endif | |
| return(DefWindowProc(hWnd, msg, wParam, lParam)); | return(DefWindowProc(hWnd, msg, wParam, lParam)); |
| } | } |
| break; | break; |
| Line 1123 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1352 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| } | } |
| break; | break; |
| case WM_MBUTTONDOWN: // ver0.26 | case WM_MBUTTONDOWN: |
| mousemng_toggle(MOUSEPROC_SYSTEM); | mousemng_toggle(MOUSEPROC_SYSTEM); |
| xmenu_setmouse(np2oscfg.MOUSE_SW ^ 1); | xmenu_setmouse(np2oscfg.MOUSE_SW ^ 1); |
| sysmng_update(SYS_UPDATECFG); | sysmng_update(SYS_UPDATECFG); |
| Line 1134 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1363 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| if (!scrnmng_isfullscreen()) { | if (!scrnmng_isfullscreen()) { |
| np2popup(hWnd, lParam); | np2popup(hWnd, lParam); |
| } | } |
| #if defined(SUPPORT_DCLOCK) | |
| else { | else { |
| POINT p; | POINT p; |
| if ((GetCursorPos(&p)) && (p.y >= 466) && | if ((GetCursorPos(&p)) && |
| (np2oscfg.clk_x)) { | (scrnmng_isdispclockclick(&p)) && |
| (np2oscfg.clk_x)) { | |
| np2oscfg.clk_fnt++; | np2oscfg.clk_fnt++; |
| sysmng_update(SYS_UPDATEOSCFG); | sysmng_update(SYS_UPDATEOSCFG); |
| dclock_reset(); | dclock_reset(); |
| } | } |
| } | } |
| #endif | |
| return(DefWindowProc(hWnd, msg, wParam, lParam)); | return(DefWindowProc(hWnd, msg, wParam, lParam)); |
| } | } |
| break; | break; |
| Line 1175 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1407 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| } | } |
| else if (sstpconfirm_exit()) { | else if (sstpconfirm_exit()) { |
| winuienter(); | winuienter(); |
| if (MessageBox(hWnd, "Sure?", "Exit", | if (messagebox(hWnd, MAKEINTRESOURCE(IDS_CONFIRM_EXIT), |
| MB_ICONQUESTION | MB_YESNO) == IDYES) { | MB_ICONQUESTION | MB_YESNO) == IDYES) |
| { | |
| b = TRUE; | b = TRUE; |
| } | } |
| winuileave(); | winuileave(); |
| Line 1188 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1421 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| break; | break; |
| case WM_DESTROY: | case WM_DESTROY: |
| DestroyMenu(hStat); | |
| np2class_wmdestroy(hWnd); | np2class_wmdestroy(hWnd); |
| PostQuitMessage(0); | PostQuitMessage(0); |
| break; | break; |
| Line 1256 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1488 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| static void framereset(UINT cnt) { | static void framereset(UINT cnt) { |
| framecnt = 0; | framecnt = 0; |
| #if defined(SUPPORT_DCLOCK) | |
| scrnmng_dispclock(); | scrnmng_dispclock(); |
| kdispwin_draw((BYTE)cnt); | #endif |
| toolwin_draw((BYTE)cnt); | kdispwin_draw((UINT8)cnt); |
| skbdwin_process(); | |
| mdbgwin_process(); | |
| toolwin_draw((UINT8)cnt); | |
| viewer_allreload(FALSE); | viewer_allreload(FALSE); |
| if (np2oscfg.DISPCLK & 3) { | if (np2oscfg.DISPCLK & 3) { |
| if (sysmng_workclockrenewal()) { | if (sysmng_workclockrenewal()) { |
| Line 1279 static void processwait(UINT cnt) { | Line 1515 static void processwait(UINT cnt) { |
| soundmng_sync(); | soundmng_sync(); |
| } | } |
| int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, | |
| int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst, | |
| LPSTR lpszCmdLine, int nCmdShow) { | LPSTR lpszCmdLine, int nCmdShow) { |
| WNDCLASS wc; | WNDCLASS wc; |
| MSG msg; | MSG msg; |
| HWND hWnd; | HWND hWnd; |
| UINT i; | UINT i; |
| DWORD style; | |
| #ifdef OPENING_WAIT | #ifdef OPENING_WAIT |
| UINT32 tick; | UINT32 tick; |
| #endif | #endif |
| BOOL xrollkey; | |
| _MEM_INIT(); | _MEM_INIT(); |
| GetModuleFileName(NULL, modulefile, sizeof(modulefile)); | GetModuleFileName(NULL, modulefile, NELEMENTS(modulefile)); |
| dosio_init(); | dosio_init(); |
| file_setcd(modulefile); | file_setcd(modulefile); |
| np2arg_analize(lpszCmdLine); | np2arg_analize(); |
| initload(); | initload(); |
| toolwin_readini(); | toolwin_readini(); |
| kdispwin_readini(); | kdispwin_readini(); |
| skbdwin_readini(); | |
| mdbgwin_readini(); | |
| rand_setseed((unsigned)time(NULL)); | rand_setseed((unsigned)time(NULL)); |
| CopyMemory(szClassName, np2oscfg.winid, 3); | szClassName[0] = (TCHAR)np2oscfg.winid[0]; |
| szClassName[1] = (TCHAR)np2oscfg.winid[1]; | |
| szClassName[2] = (TCHAR)np2oscfg.winid[2]; | |
| if ((hWnd = FindWindow(szClassName, NULL)) != NULL) { | if ((hWnd = FindWindow(szClassName, NULL)) != NULL) { |
| sstpmsg_running(); | sstpmsg_running(); |
| Line 1312 int WINAPI WinMain(HINSTANCE hInstance, | Line 1553 int WINAPI WinMain(HINSTANCE hInstance, |
| return(FALSE); | return(FALSE); |
| } | } |
| hInst = hInstance; | g_hInstance = loadextinst(hInstance); |
| hPrev = hPreInst; | g_hPrevInst = hPrevInst; |
| #if !defined(_WIN64) | |
| mmxflag = (havemmx())?0:MMXFLAG_NOTSUPPORT; | mmxflag = (havemmx())?0:MMXFLAG_NOTSUPPORT; |
| mmxflag += (np2oscfg.disablemmx)?MMXFLAG_DISABLE:0; | mmxflag += (np2oscfg.disablemmx)?MMXFLAG_DISABLE:0; |
| #endif | |
| TRACEINIT(); | TRACEINIT(); |
| if (np2oscfg.KEYBOARD >= KEY_TYPEMAX) { // ver0.28 | xrollkey = (np2oscfg.xrollkey == 0); |
| if (np2oscfg.KEYBOARD >= KEY_TYPEMAX) { | |
| int keytype = GetKeyboardType(1); | int keytype = GetKeyboardType(1); |
| if ((keytype & 0xff00) == 0x0d00) { | if ((keytype & 0xff00) == 0x0d00) { |
| np2oscfg.KEYBOARD = KEY_PC98; | np2oscfg.KEYBOARD = KEY_PC98; |
| xrollkey = !xrollkey; | |
| } | } |
| else if (!keytype) { | else if (!keytype) { |
| np2oscfg.KEYBOARD = KEY_KEY101; | np2oscfg.KEYBOARD = KEY_KEY101; |
| Line 1330 int WINAPI WinMain(HINSTANCE hInstance, | Line 1575 int WINAPI WinMain(HINSTANCE hInstance, |
| np2oscfg.KEYBOARD = KEY_KEY106; | np2oscfg.KEYBOARD = KEY_KEY106; |
| } | } |
| } | } |
| keystat_reset(); | winkbd_roll(xrollkey); |
| winkbd_setf12(np2oscfg.F12COPY); | |
| keystat_initialize(); | |
| np2class_initialize(hInstance); | np2class_initialize(g_hInstance); |
| if (!hPreInst) { | if (!hPrevInst) { |
| wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; | wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; |
| wc.lpfnWndProc = WndProc; | wc.lpfnWndProc = WndProc; |
| wc.cbClsExtra = 0; | wc.cbClsExtra = 0; |
| wc.cbWndExtra = NP2GWL_SIZE; | wc.cbWndExtra = NP2GWLP_SIZE; |
| wc.hInstance = hInstance; | wc.hInstance = g_hInstance; |
| wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)); | wc.hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON1)); |
| wc.hCursor = LoadCursor(NULL, IDC_ARROW); | wc.hCursor = LoadCursor(NULL, IDC_ARROW); |
| wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH); | wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH); |
| wc.lpszMenuName = MAKEINTRESOURCE(IDR_MAIN); | wc.lpszMenuName = MAKEINTRESOURCE(IDR_MAIN); |
| wc.lpszClassName = szClassName; | wc.lpszClassName = szClassName; |
| if (!RegisterClass(&wc)) { | if (!RegisterClass(&wc)) { |
| unloadextinst(); | |
| TRACETERM(); | |
| dosio_term(); | |
| return(FALSE); | return(FALSE); |
| } | } |
| toolwin_initapp(g_hInstance); | |
| kdispwin_initialize(g_hInstance); | |
| skbdwin_initialize(g_hInstance); | |
| mdbgwin_initialize(g_hInstance); | |
| viewer_init(g_hInstance); | |
| } | } |
| toolwin_initapp(hInstance); | |
| kdispwin_initialize(hPreInst); | mousemng_initialize(); |
| viewer_init(hPreInst); | |
| style = WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX; | |
| #if 1 | if (np2oscfg.thickframe) { |
| hWndMain = CreateWindowEx(0, | style |= WS_THICKFRAME; |
| szClassName, np2oscfg.titles, | } |
| WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | | hWnd = CreateWindowEx(0, szClassName, np2oscfg.titles, style, |
| WS_THICKFRAME | WS_MINIMIZEBOX, | |
| np2oscfg.winx, np2oscfg.winy, 640, 400, | |
| NULL, NULL, hInstance, NULL); | |
| #else // テスト | |
| hWndMain = CreateWindowEx(0, | |
| szClassName, np2oscfg.titles, | |
| WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | | |
| WS_MINIMIZEBOX, | |
| np2oscfg.winx, np2oscfg.winy, 640, 400, | np2oscfg.winx, np2oscfg.winy, 640, 400, |
| NULL, NULL, hInstance, NULL); | NULL, NULL, g_hInstance, NULL); |
| #endif | g_hWndMain = hWnd; |
| hWnd = hWndMain; | |
| scrnmng_initialize(); | scrnmng_initialize(); |
| xmenu_setroltate(0); | xmenu_setroltate(0); |
| Line 1392 int WINAPI WinMain(HINSTANCE hInstance, | Line 1639 int WINAPI WinMain(HINSTANCE hInstance, |
| xmenu_setbtnrapid(np2cfg.BTN_RAPID); | xmenu_setbtnrapid(np2cfg.BTN_RAPID); |
| xmenu_setmsrapid(np2cfg.MOUSERAPID); | xmenu_setmsrapid(np2cfg.MOUSERAPID); |
| xmenu_setsstp(np2oscfg.sstp); | xmenu_setsstp(np2oscfg.sstp); |
| xmenu_seti286save(np2oscfg.I286SAVE); | |
| ShowWindow(hWnd, nCmdShow); | ShowWindow(hWnd, nCmdShow); |
| UpdateWindow(hWnd); | UpdateWindow(hWnd); |
| Line 1405 int WINAPI WinMain(HINSTANCE hInstance, | Line 1651 int WINAPI WinMain(HINSTANCE hInstance, |
| xmenu_initialize(); | xmenu_initialize(); |
| DrawMenuBar(hWnd); | DrawMenuBar(hWnd); |
| // ver0.30 | if (file_attr_c(np2help) == (short)-1) { // ver0.30 |
| if (file_attr_c(np2help) == (short)-1) { | |
| EnableMenuItem(GetMenu(hWnd), IDM_HELP, MF_GRAYED); | EnableMenuItem(GetMenu(hWnd), IDM_HELP, MF_GRAYED); |
| } | } |
| Line 1415 int WINAPI WinMain(HINSTANCE hInstance, | Line 1660 int WINAPI WinMain(HINSTANCE hInstance, |
| sysmenu_setwinsnap(np2oscfg.WINSNAP); | sysmenu_setwinsnap(np2oscfg.WINSNAP); |
| sysmenu_setbackground(np2oscfg.background); | sysmenu_setbackground(np2oscfg.background); |
| sysmenu_setbgsound(np2oscfg.background); | sysmenu_setbgsound(np2oscfg.background); |
| sysmenu_setscrnmul(8); // ver0.26 | sysmenu_setscrnmul(8); |
| scrnmode = 0; | scrnmode = 0; |
| if (np2arg.fullscreen) { | if (np2arg.fullscreen) { |
| Line 1427 int WINAPI WinMain(HINSTANCE hInstance, | Line 1672 int WINAPI WinMain(HINSTANCE hInstance, |
| 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) { |
| if (sstpmsg_dxerror()) { | if (sstpmsg_dxerror()) |
| MessageBox(hWnd, "Couldn't create DirectDraw Object", | { |
| np2oscfg.titles, MB_OK | MB_ICONSTOP); | messagebox(hWnd, MAKEINTRESOURCE(IDS_ERROR_DIRECTDRAW), |
| MB_OK | MB_ICONSTOP); | |
| } | } |
| unloadextinst(); | |
| TRACETERM(); | |
| dosio_term(); | |
| return(FALSE); | return(FALSE); |
| } | } |
| } | } |
| if (soundmng_initialize() == SUCCESS) { | if (soundmng_initialize() == SUCCESS) { |
| soundmng_pcmload(SOUND_PCMSEEK, "SEEKWAV", EXTROMIO_RES); | soundmng_pcmload(SOUND_PCMSEEK, OEMTEXT("SEEKWAV"), EXTROMIO_RES); |
| soundmng_pcmload(SOUND_PCMSEEK1, "SEEK1WAV", EXTROMIO_RES); | soundmng_pcmload(SOUND_PCMSEEK1, OEMTEXT("SEEK1WAV"), EXTROMIO_RES); |
| soundmng_pcmvolume(SOUND_PCMSEEK, np2cfg.MOTORVOL); | soundmng_pcmvolume(SOUND_PCMSEEK, np2cfg.MOTORVOL); |
| soundmng_pcmvolume(SOUND_PCMSEEK1, np2cfg.MOTORVOL); | soundmng_pcmvolume(SOUND_PCMSEEK1, np2cfg.MOTORVOL); |
| } | } |
| Line 1446 int WINAPI WinMain(HINSTANCE hInstance, | Line 1695 int WINAPI WinMain(HINSTANCE hInstance, |
| juliet_initialize(); | juliet_initialize(); |
| } | } |
| mousemng_initialize(); | |
| if (np2oscfg.MOUSE_SW) { // ver0.30 | if (np2oscfg.MOUSE_SW) { // ver0.30 |
| mousemng_enable(MOUSEPROC_SYSTEM); | mousemng_enable(MOUSEPROC_SYSTEM); |
| } | } |
| // mousemng_enable(MOUSEPROC_WINUI); | |
| // mousemng_enable(MOUSEPROC_BG); | |
| commng_initialize(); | commng_initialize(); |
| sysmng_initialize(); | sysmng_initialize(); |
| joy_init(); | joymng_initialize(); |
| pccore_init(); | pccore_init(); |
| S98_init(); | S98_init(); |
| Line 1473 int WINAPI WinMain(HINSTANCE hInstance, | Line 1719 int WINAPI WinMain(HINSTANCE hInstance, |
| np2opening = 0; | np2opening = 0; |
| // れじうむ | // れじうむ |
| #if defined(SUPPORT_RESUME) | |
| if (np2oscfg.resume) { | if (np2oscfg.resume) { |
| int id; | int id; |
| id = flagload(str_sav, str_resume, FALSE); | id = flagload(hWnd, str_sav, _T("Resume"), FALSE); |
| if (id == IDYES) { | if (id == IDYES) { |
| for (i=0; i<4; i++) np2arg.disk[i] = NULL; | for (i=0; i<4; i++) { |
| np2arg.disk[i] = NULL; | |
| } | |
| } | } |
| else if (id == IDCANCEL) { | else if (id == IDCANCEL) { |
| DestroyWindow(hWnd); | DestroyWindow(hWnd); |
| Line 1488 int WINAPI WinMain(HINSTANCE hInstance, | Line 1737 int WINAPI WinMain(HINSTANCE hInstance, |
| sstp_destruct(); | sstp_destruct(); |
| soundmng_deinitialize(); | soundmng_deinitialize(); |
| scrnmng_destroy(); | scrnmng_destroy(); |
| unloadextinst(); | |
| TRACETERM(); | TRACETERM(); |
| dosio_term(); | dosio_term(); |
| viewer_term(); | viewer_term(); |
| return(0); | return(FALSE); |
| } | } |
| } | } |
| #endif | |
| // リセットしてから… コマンドラインのディスク挿入。 // ver0.29 | // リセットしてから… コマンドラインのディスク挿入。 |
| for (i=0; i<4; i++) { | for (i=0; i<4; i++) { |
| if (np2arg.disk[i]) { | if (np2arg.disk[i]) { |
| milstr_ncpy(diskdrv_fname[i], np2arg.disk[i], MAX_PATH); | diskdrv_readyfdd((REG8)i, np2arg.disk[i], 0); |
| diskdrv_delay[i] = 1; | |
| } | } |
| } | } |
| if (!(scrnmode & SCRNMODE_FULLSCREEN)) { | if (!(scrnmode & SCRNMODE_FULLSCREEN)) { |
| if (np2oscfg.toolwin) { | if (np2oscfg.toolwin) { |
| toolwin_create(); | toolwin_create(g_hInstance); |
| } | } |
| if (np2oscfg.keydisp) { | if (np2oscfg.keydisp) { |
| kdispwin_create(); | kdispwin_create(g_hInstance); |
| } | } |
| } | } |
| Line 1527 int WINAPI WinMain(HINSTANCE hInstance, | Line 1777 int WINAPI WinMain(HINSTANCE hInstance, |
| } | } |
| else { | else { |
| if (np2oscfg.NOWAIT) { | if (np2oscfg.NOWAIT) { |
| joy_flash(); | joymng_sync(); |
| mousemng_callback(); | mousemng_sync(); |
| pccore_exec(framecnt == 0); | pccore_exec(framecnt == 0); |
| #if defined(SUPPORT_DCLOCK) | |
| dclock_callback(); | dclock_callback(); |
| #endif | |
| if (np2oscfg.DRAW_SKIP) { // nowait frame skip | if (np2oscfg.DRAW_SKIP) { // nowait frame skip |
| framecnt++; | framecnt++; |
| if (framecnt >= np2oscfg.DRAW_SKIP) { | if (framecnt >= np2oscfg.DRAW_SKIP) { |
| Line 1546 int WINAPI WinMain(HINSTANCE hInstance, | Line 1798 int WINAPI WinMain(HINSTANCE hInstance, |
| } | } |
| else if (np2oscfg.DRAW_SKIP) { // frame skip | else if (np2oscfg.DRAW_SKIP) { // frame skip |
| if (framecnt < np2oscfg.DRAW_SKIP) { | if (framecnt < np2oscfg.DRAW_SKIP) { |
| joy_flash(); | joymng_sync(); |
| mousemng_callback(); | mousemng_sync(); |
| pccore_exec(framecnt == 0); | pccore_exec(framecnt == 0); |
| #if defined(SUPPORT_DCLOCK) | |
| dclock_callback(); | dclock_callback(); |
| #endif | |
| framecnt++; | framecnt++; |
| } | } |
| else { | else { |
| Line 1559 int WINAPI WinMain(HINSTANCE hInstance, | Line 1813 int WINAPI WinMain(HINSTANCE hInstance, |
| else { // auto skip | else { // auto skip |
| if (!waitcnt) { | if (!waitcnt) { |
| UINT cnt; | UINT cnt; |
| joy_flash(); | joymng_sync(); |
| mousemng_callback(); | mousemng_sync(); |
| pccore_exec(framecnt == 0); | pccore_exec(framecnt == 0); |
| #if defined(SUPPORT_DCLOCK) | |
| dclock_callback(); | dclock_callback(); |
| #endif | |
| framecnt++; | framecnt++; |
| cnt = timing_getcount(); | cnt = timing_getcount(); |
| if (framecnt > cnt) { | if (framecnt > cnt) { |
| Line 1602 int WINAPI WinMain(HINSTANCE hInstance, | Line 1858 int WINAPI WinMain(HINSTANCE hInstance, |
| } | } |
| toolwin_destroy(); | toolwin_destroy(); |
| kdispwin_destroy(); | kdispwin_destroy(); |
| skbdwin_destroy(); | |
| mdbgwin_destroy(); | |
| pccore_cfgupdate(); | pccore_cfgupdate(); |
| mousemng_disable(MOUSEPROC_WINUI); | mousemng_disable(MOUSEPROC_WINUI); |
| S98_trash(); | S98_trash(); |
| #if defined(SUPPORT_RESUME) | |
| if (np2oscfg.resume) { | if (np2oscfg.resume) { |
| flagsave(str_sav); | flagsave(str_sav); |
| } | } |
| else { | else { |
| flagdelete(str_sav); | flagdelete(str_sav); |
| } | } |
| #endif | |
| juliet_YMF288Reset(); | juliet_YMF288Reset(); |
| pccore_term(); | pccore_term(); |
| Line 1629 int WINAPI WinMain(HINSTANCE hInstance, | Line 1889 int WINAPI WinMain(HINSTANCE hInstance, |
| initsave(); | initsave(); |
| toolwin_writeini(); | toolwin_writeini(); |
| kdispwin_writeini(); | kdispwin_writeini(); |
| skbdwin_writeini(); | |
| mdbgwin_writeini(); | |
| } | } |
| skbdwin_deinitialize(); | |
| unloadextinst(); | |
| TRACETERM(); | TRACETERM(); |
| _MEM_USED("report.txt"); | _MEM_USED("report.txt"); |
| dosio_term(); | dosio_term(); |
| viewer_term(); // ver0.30 | viewer_term(); // ver0.30 |
| return(msg.wParam); | return((int)msg.wParam); |
| } | } |