|
|
| version 1.65, 2006/12/17 02:30:11 | version 1.71, 2007/01/08 08:52:21 |
|---|---|
| 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" |
| Line 45 | Line 43 |
| #include "debugsub.h" | #include "debugsub.h" |
| #include "subwind.h" | #include "subwind.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 |
| Line 55 static TCHAR szClassName[] = _T("NP2-Ma | Line 59 static TCHAR szClassName[] = _T("NP2-Ma |
| HWND hWndMain; | HWND hWndMain; |
| HINSTANCE hInst; | HINSTANCE hInst; |
| HINSTANCE hPrev; | HINSTANCE hPrev; |
| #if !defined(_WIN64) | |
| int mmxflag; | int mmxflag; |
| #endif | |
| UINT8 np2break = 0; // ver0.30 | UINT8 np2break = 0; // ver0.30 |
| BOOL winui_en; | BOOL winui_en; |
| NP2OSCFG np2oscfg = { | NP2OSCFG np2oscfg = { |
| #if !defined(SUPPORT_PC9821) | OEMTEXT(PROJECTNAME) OEMTEXT(PROJECTSUBNAME), |
| OEMTEXT("Neko Project II"), | |
| #else | |
| OEMTEXT("Neko Project 21"), | |
| #endif | |
| OEMTEXT("NP2"), | OEMTEXT("NP2"), |
| CW_USEDEFAULT, CW_USEDEFAULT, 1, 1, 0, 1, 0, 0, | 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, | {5, 0, 0x3e, 19200, |
| Line 78 static TCHAR szClassName[] = _T("NP2-Ma | Line 80 static TCHAR szClassName[] = _T("NP2-Ma |
| {0, 0, 0x3e, 19200, | {0, 0, 0x3e, 19200, |
| OEMTEXT(""), OEMTEXT(""), OEMTEXT(""), OEMTEXT("")}, | 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, 0}; | 0, 1, 0, 9801, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| OEMCHAR fddfolder[MAX_PATH]; | OEMCHAR fddfolder[MAX_PATH]; |
| OEMCHAR hddfolder[MAX_PATH]; | OEMCHAR hddfolder[MAX_PATH]; |
| Line 94 static int np2quitmsg = 0; | Line 96 static int np2quitmsg = 0; |
| static HMENU hStat = NULL; | static HMENU hStat = NULL; |
| static UINT8 scrnmode; | static UINT8 scrnmode; |
| static WINLOCEX smwlex; | static WINLOCEX smwlex; |
| static HMODULE resmod; | |
| static const OEMCHAR np2help[] = OEMTEXT("np2.chm"); | static const OEMCHAR np2help[] = OEMTEXT("np2.chm"); |
| static const OEMCHAR np2flagext[] = OEMTEXT("S%02d"); | static const OEMCHAR np2flagext[] = OEMTEXT("S%02d"); |
| static const OEMCHAR np2resext[] = OEMTEXT(".%u"); | |
| // ---- | |
| static HINSTANCE loadextinst(HINSTANCE hInstance) { | |
| OEMCHAR path[MAX_PATH]; | |
| OEMCHAR cpstr[16]; | |
| HMODULE dll; | |
| file_cpyname(path, modulefile, NELEMENTS(path)); | |
| file_cutext(path); | |
| OEMSPRINTF(cpstr, np2resext, GetOEMCP()); | |
| file_catname(path, cpstr, NELEMENTS(path)); | |
| dll = LoadLibrary(path); | |
| resmod = dll; | |
| if (dll != NULL) { | |
| hInstance = (HINSTANCE)dll; | |
| } | |
| return(hInstance); | |
| } | |
| static void unloadextinst(void) { | |
| HMODULE dll; | |
| dll = resmod; | |
| if (dll) { | |
| resmod = 0; | |
| FreeLibrary(dll); | |
| } | |
| } | |
| // ---- | |
| static void winuienter(void) { | static void winuienter(void) { |
| Line 322 static void np2popup(HWND hWnd, LPARAM l | Line 360 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 337 static void np2popup(HWND hWnd, LPARAM l | Line 375 static void np2popup(HWND hWnd, LPARAM l |
| static void np2cmd(HWND hWnd, UINT16 cmd) { | static void np2cmd(HWND hWnd, UINT16 cmd) { |
| HINSTANCE hInst; | HINSTANCE hinst; |
| UINT update; | UINT update; |
| BOOL b; | BOOL b; |
| hInst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); | hinst = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE); |
| update = 0; | update = 0; |
| switch(cmd) { | switch(cmd) { |
| case IDM_RESET: | case IDM_RESET: |
| Line 368 static void np2cmd(HWND hWnd, UINT16 cmd | Line 406 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(hinst, MAKEINTRESOURCE(IDD_CONFIG), |
| hWnd, (DLGPROC)CfgDialogProc); | hWnd, (DLGPROC)CfgDialogProc); |
| if (!scrnmng_isfullscreen()) { | if (!scrnmng_isfullscreen()) { |
| UINT8 thick; | UINT8 thick; |
| Line 809 static void np2cmd(HWND hWnd, UINT16 cmd | Line 847 static void np2cmd(HWND hWnd, UINT16 cmd |
| case IDM_MPUPC98: | case IDM_MPUPC98: |
| winuienter(); | winuienter(); |
| DialogBox(hInst, MAKEINTRESOURCE(IDD_MPUPC98), | DialogBox(hinst, MAKEINTRESOURCE(IDD_MPUPC98), |
| hWnd, (DLGPROC)MidiDialogProc); | hWnd, (DLGPROC)MidiDialogProc); |
| winuileave(); | winuileave(); |
| break; | break; |
| Line 857 static void np2cmd(HWND hWnd, UINT16 cmd | Line 895 static void np2cmd(HWND hWnd, UINT16 cmd |
| case IDM_CALENDAR: | case IDM_CALENDAR: |
| winuienter(); | winuienter(); |
| DialogBox(hInst, MAKEINTRESOURCE(IDD_CALENDAR), | DialogBox(hinst, MAKEINTRESOURCE(IDD_CALENDAR), |
| hWnd, (DLGPROC)ClndDialogProc); | hWnd, (DLGPROC)ClndDialogProc); |
| winuileave(); | winuileave(); |
| break; | break; |
| Line 905 static void np2cmd(HWND hWnd, UINT16 cmd | Line 943 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(hinst, MAKEINTRESOURCE(IDD_ABOUT), |
| hWnd, (DLGPROC)AboutDialogProc); | hWnd, (DLGPROC)AboutDialogProc); |
| winuileave(); | winuileave(); |
| } | } |
| Line 1028 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1066 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| case IDM_SCRNMUL16: | case IDM_SCRNMUL16: |
| if ((!scrnmng_isfullscreen()) && | if ((!scrnmng_isfullscreen()) && |
| !(GetWindowLong(hWndMain, GWL_STYLE) & WS_MINIMIZE)) { | !(GetWindowLong(hWndMain, GWL_STYLE) & WS_MINIMIZE)) { |
| sysmenu_setscrnmul(wParam - IDM_SCRNMUL); | sysmenu_setscrnmul((UINT8)(wParam - IDM_SCRNMUL)); |
| scrnmng_setmultiple(wParam - IDM_SCRNMUL); | scrnmng_setmultiple((int)(wParam - IDM_SCRNMUL)); |
| } | } |
| break; | break; |
| Line 1093 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1131 LRESULT CALLBACK WndProc(HWND hWnd, UINT |
| BITMAP bmp; | BITMAP bmp; |
| HDC hmdc; | HDC hmdc; |
| HBRUSH hbrush; | HBRUSH hbrush; |
| hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); | hinst = (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; |
| Line 1230 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1268 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 1259 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1300 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 1381 LRESULT CALLBACK WndProc(HWND hWnd, UINT | Line 1425 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(); |
| #endif | |
| kdispwin_draw((UINT8)cnt); | kdispwin_draw((UINT8)cnt); |
| skbdwin_process(); | skbdwin_process(); |
| mdbgwin_process(); | mdbgwin_process(); |
| Line 1406 static void processwait(UINT cnt) { | Line 1452 static void processwait(UINT cnt) { |
| soundmng_sync(); | soundmng_sync(); |
| } | } |
| int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst, | int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst, |
| LPSTR lpszCmdLine, int nCmdShow) { | LPSTR lpszCmdLine, int nCmdShow) { |
| WNDCLASS wc; | WNDCLASS wc; |
| Line 1445 int WINAPI WinMain(HINSTANCE hInstance, | Line 1490 int WINAPI WinMain(HINSTANCE hInstance, |
| return(FALSE); | return(FALSE); |
| } | } |
| hInst = hInstance; | hInst = loadextinst(hInstance); |
| hPrev = hPreInst; | hPrev = hPreInst; |
| #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(); |
| xrollkey = (np2oscfg.xrollkey == 0); | xrollkey = (np2oscfg.xrollkey == 0); |
| Line 1469 int WINAPI WinMain(HINSTANCE hInstance, | Line 1516 int WINAPI WinMain(HINSTANCE hInstance, |
| winkbd_setf12(np2oscfg.F12COPY); | winkbd_setf12(np2oscfg.F12COPY); |
| keystat_initialize(); | keystat_initialize(); |
| np2class_initialize(hInstance); | np2class_initialize(hInst); |
| if (!hPreInst) { | if (!hPreInst) { |
| 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 = hInst; |
| wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)); | wc.hIcon = LoadIcon(hInst, 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(hInstance); | toolwin_initapp(hInst); |
| kdispwin_initialize(hPreInst); | kdispwin_initialize(hPreInst); |
| skbdwin_initialize(hPreInst); | skbdwin_initialize(hPreInst); |
| mdbgwin_initialize(hPreInst); | mdbgwin_initialize(hPreInst); |
| Line 1499 int WINAPI WinMain(HINSTANCE hInstance, | Line 1549 int WINAPI WinMain(HINSTANCE hInstance, |
| } | } |
| hWnd = CreateWindowEx(0, szClassName, np2oscfg.titles, style, | hWnd = CreateWindowEx(0, szClassName, np2oscfg.titles, style, |
| np2oscfg.winx, np2oscfg.winy, 640, 400, | np2oscfg.winx, np2oscfg.winy, 640, 400, |
| NULL, NULL, hInstance, NULL); | NULL, NULL, hInst, NULL); |
| hWndMain = hWnd; | hWndMain = hWnd; |
| scrnmng_initialize(); | scrnmng_initialize(); |
| Line 1562 int WINAPI WinMain(HINSTANCE hInstance, | Line 1612 int WINAPI WinMain(HINSTANCE hInstance, |
| MessageBox(hWnd, _T("Couldn't create DirectDraw Object"), | MessageBox(hWnd, _T("Couldn't create DirectDraw Object"), |
| np2oscfg.titles, MB_OK | MB_ICONSTOP); | np2oscfg.titles, MB_OK | MB_ICONSTOP); |
| } | } |
| unloadextinst(); | |
| TRACETERM(); | |
| dosio_term(); | |
| return(FALSE); | return(FALSE); |
| } | } |
| } | } |
| Line 1619 int WINAPI WinMain(HINSTANCE hInstance, | Line 1672 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 | #endif |
| Line 1661 int WINAPI WinMain(HINSTANCE hInstance, | Line 1715 int WINAPI WinMain(HINSTANCE hInstance, |
| joymng_sync(); | joymng_sync(); |
| mousemng_sync(); | 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 1680 int WINAPI WinMain(HINSTANCE hInstance, | Line 1736 int WINAPI WinMain(HINSTANCE hInstance, |
| joymng_sync(); | joymng_sync(); |
| mousemng_sync(); | mousemng_sync(); |
| pccore_exec(framecnt == 0); | pccore_exec(framecnt == 0); |
| #if defined(SUPPORT_DCLOCK) | |
| dclock_callback(); | dclock_callback(); |
| #endif | |
| framecnt++; | framecnt++; |
| } | } |
| else { | else { |
| Line 1693 int WINAPI WinMain(HINSTANCE hInstance, | Line 1751 int WINAPI WinMain(HINSTANCE hInstance, |
| joymng_sync(); | joymng_sync(); |
| mousemng_sync(); | 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 1769 int WINAPI WinMain(HINSTANCE hInstance, | Line 1829 int WINAPI WinMain(HINSTANCE hInstance, |
| } | } |
| skbdwin_deinitialize(); | 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); |
| } | } |