|
|
| version 1.6, 2003/10/24 08:07:33 | version 1.38, 2004/08/16 09:15:07 |
|---|---|
| Line 3 | Line 3 |
| #include "strres.h" | #include "strres.h" |
| #include "np2.h" | #include "np2.h" |
| #include "dosio.h" | #include "dosio.h" |
| #include "commng.h" | |
| #include "mousemng.h" | |
| #include "scrnmng.h" | #include "scrnmng.h" |
| #include "soundmng.h" | #include "soundmng.h" |
| #include "sysmng.h" | #include "sysmng.h" |
| Line 18 | Line 20 |
| #include "pc9861k.h" | #include "pc9861k.h" |
| #include "mpu98ii.h" | #include "mpu98ii.h" |
| #include "timing.h" | #include "timing.h" |
| #include "keystat.h" | |
| #include "debugsub.h" | #include "debugsub.h" |
| #include "bios.h" | #include "bios.h" |
| #include "scrndraw.h" | #include "scrndraw.h" |
| Line 26 | Line 29 |
| #include "s98.h" | #include "s98.h" |
| #include "diskdrv.h" | #include "diskdrv.h" |
| #include "fddfile.h" | #include "fddfile.h" |
| #include "statsave.h" | |
| #if defined(NP2GCC) | |
| #include "mousemng.h" | |
| #endif | |
| #define USE_RESUME | |
| NP2OSCFG np2oscfg = {100, 100, | |
| NP2OSCFG np2oscfg = {0, 2, 0, 0, 0, 0}; | 0, 0, 0, 0, |
| 0, 0, | |
| #if defined(SUPPORT_RESUME) | |
| 0, | |
| #endif | |
| #if defined(SUPPORT_STATSAVE) | |
| 0, | |
| #endif | |
| 0, 0}; | |
| WindowPtr hWndMain; | WindowPtr hWndMain; |
| BOOL np2running; | BOOL np2running; |
| Line 54 static BYTE scrnmode; | Line 59 static BYTE scrnmode; |
| #endif | #endif |
| static char target[MAX_PATH] = DEFAULTPATH; | static char target[MAX_PATH] = DEFAULTPATH; |
| #if !defined(SUPPORT_PC9821) | |
| static const char np2app[] = "np2"; | |
| #else | |
| static const char np2app[] = "np21"; | |
| #endif | |
| // ---- | |
| #if defined(SUPPORT_RESUME) | |
| static const char np2resumeext[] = ".sav"; | |
| #endif | |
| #if defined(SUPPORT_STATSAVE) | |
| static const char np2flagext[] = ".sv%u"; | |
| #endif | |
| static const char np2resume[] = "sav"; | #if defined(SUPPORT_RESUME) || defined(SUPPORT_STATSAVE) |
| static void getstatfilename(char *path, const char *ext, UINT size) { | |
| file_cpyname(path, file_getcd(np2app), size); | |
| file_catname(path, ext, size); | |
| } | |
| static void flagsave(const char *ext) { | |
| char path[MAX_PATH]; | |
| getstatfilename(path, ext, sizeof(path)); | |
| statsave_save(path); | |
| } | |
| static void flagdelete(const char *ext) { | |
| char path[MAX_PATH]; | |
| getstatfilename(path, ext, sizeof(path)); | |
| file_delete(path); | |
| } | |
| static int flagload(const char *ext, BOOL force) { | |
| char path[MAX_PATH]; | |
| char buf[1024]; | |
| int r; | |
| int ret; | |
| getstatfilename(path, ext, sizeof(path)); | |
| r = statsave_check(path, buf, sizeof(buf)); | |
| if (r & (~STATFLAG_DISKCHG)) { | |
| ResumeErrorDialogProc(); | |
| ret = IDCANCEL; | |
| } | |
| else if ((!force) && (r & STATFLAG_DISKCHG)) { | |
| ret = ResumeWarningDialogProc(buf); | |
| } | |
| else { | |
| ret = IDOK; | |
| } | |
| if (ret == IDOK) { | |
| statsave_load(path); | |
| } | |
| return(ret); | |
| } | |
| #endif | |
| // ---- おまじない | // ---- おまじない |
| Line 99 static void InitToolBox(void) { | Line 166 static void InitToolBox(void) { |
| static void MenuBarInit(void) { | static void MenuBarInit(void) { |
| Handle hMenu; | Handle hdl; |
| MenuHandle happlemenu; | MenuHandle hmenu; |
| hMenu = GetNewMBar(IDM_MAINMENU); | hdl = GetNewMBar(IDM_MAINMENU); |
| if (!hMenu) { | if (hdl == NULL) { |
| ExitToShell(); | ExitToShell(); |
| } | } |
| SetMenuBar(hMenu); | SetMenuBar(hdl); |
| happlemenu = GetMenuHandle(IDM_APPLE); | hmenu = GetMenuHandle(IDM_APPLE); |
| if (happlemenu) { | if (hmenu) { |
| AppendResMenu(happlemenu, 'DRVR'); | AppendResMenu(hmenu, 'DRVR'); |
| } | |
| #if !defined(SUPPORT_SCSI) | |
| hmenu = GetMenuHandle(IDM_HARDDISK); | |
| if (hmenu) { | |
| DeleteMenuItem(hmenu, 7); | |
| DeleteMenuItem(hmenu, 6); | |
| DeleteMenuItem(hmenu, 5); | |
| DeleteMenuItem(hmenu, 4); | |
| DeleteMenuItem(hmenu, 3); | |
| } | |
| #endif | |
| if (!np2oscfg.I286SAVE) { | |
| hmenu = GetMenuHandle(IDM_OTHER); | |
| if (hmenu) { | |
| DeleteMenuItem(hmenu, 9); | |
| } | |
| } | } |
| InsertMenu(GetMenu(IDM_SASI1), -1); | InsertMenu(GetMenu(IDM_SASI1), -1); |
| InsertMenu(GetMenu(IDM_SASI2), -1); | InsertMenu(GetMenu(IDM_SASI2), -1); |
| #if defined(SUPPORT_SCSI) | |
| InsertMenu(GetMenu(IDM_SCSI0), -1); | |
| InsertMenu(GetMenu(IDM_SCSI1), -1); | |
| InsertMenu(GetMenu(IDM_SCSI2), -1); | |
| InsertMenu(GetMenu(IDM_SCSI3), -1); | |
| #endif | |
| InsertMenu(GetMenu(IDM_KEYBOARD), -1); | InsertMenu(GetMenu(IDM_KEYBOARD), -1); |
| InsertMenu(GetMenu(IDM_SOUND), -1); | InsertMenu(GetMenu(IDM_SOUND), -1); |
| InsertMenu(GetMenu(IDM_MEMORY), -1); | InsertMenu(GetMenu(IDM_MEMORY), -1); |
| #if TARGET_API_MAC_CARBON | |
| hmenu = GetMenuHandle(IDM_FDD2); | |
| SetItemCmd(hmenu, LoWord(IDM_FDD2OPEN), 'D'); | |
| SetMenuItemModifiers(hmenu, LoWord(IDM_FDD2OPEN), kMenuShiftModifier); | |
| SetItemCmd(hmenu, LoWord(IDM_FDD2EJECT), 'E'); | |
| SetMenuItemModifiers(hmenu, LoWord(IDM_FDD2EJECT), kMenuShiftModifier); | |
| hmenu = GetMenuHandle(IDM_SASI2); | |
| SetItemCmd(hmenu, LoWord(IDM_SASI2OPEN), 'O'); | |
| SetMenuItemModifiers(hmenu, LoWord(IDM_SASI2OPEN), kMenuShiftModifier); | |
| #else | |
| EnableItem(GetMenuHandle(IDM_DEVICE), LoWord(IDM_MOUSE)); | |
| EnableItem(GetMenuHandle(IDM_KEYBOARD), LoWord(IDM_F12MOUSE)); | |
| #endif | |
| if (!(np2cfg.fddequip & 1)) { | |
| DeleteMenu(IDM_FDD1); | |
| } | |
| if (!(np2cfg.fddequip & 2)) { | |
| DeleteMenu(IDM_FDD2); | |
| } | |
| if (!(np2cfg.fddequip & 4)) { | |
| DeleteMenu(IDM_FDD3); | |
| } | |
| if (!(np2cfg.fddequip & 8)) { | |
| DeleteMenu(IDM_FDD4); | |
| } | |
| #if defined(SUPPORT_STATSAVE) | |
| if (!np2oscfg.statsave) { | |
| #endif | |
| DeleteMenu(IDM_STATSAVE); | |
| #if defined(SUPPORT_STATSAVE) | |
| } | |
| #endif | |
| DrawMenuBar(); | DrawMenuBar(); |
| } | } |
| Line 128 static void HandleMenuChoice(long wParam | Line 253 static void HandleMenuChoice(long wParam |
| UINT update; | UINT update; |
| Str255 applname; | Str255 applname; |
| #if defined(SUPPORT_STATSAVE) | |
| UINT num; | |
| char ext[16]; | |
| #endif | |
| update = 0; | update = 0; |
| switch(wParam) { | switch(wParam) { |
| Line 172 static void HandleMenuChoice(long wParam | Line 301 static void HandleMenuChoice(long wParam |
| diskdrv_setfdd(1, NULL, 0); | diskdrv_setfdd(1, NULL, 0); |
| break; | break; |
| case IDM_FDD3OPEN: | |
| dialog_changefdd(2); | |
| break; | |
| case IDM_FDD3EJECT: | |
| diskdrv_setfdd(2, NULL, 0); | |
| break; | |
| case IDM_FDD4OPEN: | |
| dialog_changefdd(3); | |
| break; | |
| case IDM_FDD4EJECT: | |
| diskdrv_setfdd(3, NULL, 0); | |
| break; | |
| case IDM_SASI1OPEN: | case IDM_SASI1OPEN: |
| dialog_changehdd(0); | dialog_changehdd(0x00); |
| break; | break; |
| case IDM_SASI1REMOVE: | case IDM_SASI1REMOVE: |
| diskdrv_sethdd(0, NULL); | diskdrv_sethdd(0x00, NULL); |
| break; | break; |
| case IDM_SASI2OPEN: | case IDM_SASI2OPEN: |
| dialog_changehdd(1); | dialog_changehdd(0x01); |
| break; | break; |
| case IDM_SASI2REMOVE: | case IDM_SASI2REMOVE: |
| diskdrv_sethdd(1, NULL); | diskdrv_sethdd(0x01, NULL); |
| break; | |
| case IDM_SCSI0OPEN: | |
| dialog_changehdd(0x20); | |
| break; | |
| case IDM_SCSI0REMOVE: | |
| diskdrv_sethdd(0x20, NULL); | |
| break; | |
| case IDM_SCSI1OPEN: | |
| dialog_changehdd(0x21); | |
| break; | |
| case IDM_SCSI1REMOVE: | |
| diskdrv_sethdd(0x21, NULL); | |
| break; | |
| case IDM_SCSI2OPEN: | |
| dialog_changehdd(0x22); | |
| break; | |
| case IDM_SCSI2REMOVE: | |
| diskdrv_sethdd(0x22, NULL); | |
| break; | |
| case IDM_SCSI3OPEN: | |
| dialog_changehdd(0x23); | |
| break; | |
| case IDM_SCSI3REMOVE: | |
| diskdrv_sethdd(0x23, NULL); | |
| break; | break; |
| case IDM_ROLNORMAL: | case IDM_ROLNORMAL: |
| Line 245 static void HandleMenuChoice(long wParam | Line 422 static void HandleMenuChoice(long wParam |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; |
| break; | break; |
| #if defined(NP2GCC) | case IDM_SCREENOPT: |
| case IDM_MOUSE: | dialog_scropt(); |
| mouse_running(MOUSE_XOR); | break; |
| menu_setmouse(np2oscfg.MOUSE_SW ^ 1); | |
| sysmng_update(SYS_UPDATECFG); | case IDM_MOUSE: |
| mousemng_toggle(MOUSEPROC_SYSTEM); | |
| menu_setmouse(np2oscfg.MOUSE_SW ^ 1); | |
| update |= SYS_UPDATECFG; | |
| break; | |
| case IDM_MIDIOPT: | |
| MPU98DialogProc(); | |
| break; | |
| case IDM_MIDIPANIC: | |
| rs232c_midipanic(); | |
| mpu98ii_midipanic(); | |
| pc9861k_midipanic(); | |
| break; | break; |
| #endif | |
| case IDM_KEY: | case IDM_KEY: |
| menu_setkey(0); | menu_setkey(0); |
| keystat_resetjoykey(); | keystat_resetjoykey(); |
| update |= SYS_UPDATECFG; | |
| break; | break; |
| case IDM_JOY1: | case IDM_JOY1: |
| menu_setkey(1); | menu_setkey(1); |
| keystat_resetjoykey(); | keystat_resetjoykey(); |
| update |= SYS_UPDATECFG; | |
| break; | break; |
| case IDM_JOY2: | case IDM_JOY2: |
| menu_setkey(2); | menu_setkey(2); |
| keystat_resetjoykey(); | keystat_resetjoykey(); |
| update |= SYS_UPDATECFG; | |
| break; | break; |
| case IDM_MOUSEKEY: | case IDM_MOUSEKEY: |
| menu_setkey(3); | menu_setkey(3); |
| keystat_resetjoykey(); | keystat_resetjoykey(); |
| update |= SYS_UPDATECFG; | |
| break; | break; |
| case IDM_XSHIFT: | case IDM_XSHIFT: |
| menu_setxshift(np2cfg.XSHIFT ^ 1); | menu_setxshift(np2cfg.XSHIFT ^ 1); |
| keystat_forcerelease(0x70); | keystat_forcerelease(0x70); |
| update |= SYS_UPDATECFG; | |
| break; | break; |
| case IDM_XCTRL: | case IDM_XCTRL: |
| menu_setxshift(np2cfg.XSHIFT ^ 2); | menu_setxshift(np2cfg.XSHIFT ^ 2); |
| keystat_forcerelease(0x74); | keystat_forcerelease(0x74); |
| update |= SYS_UPDATECFG; | |
| break; | break; |
| case IDM_XGRPH: | case IDM_XGRPH: |
| menu_setxshift(np2cfg.XSHIFT ^ 4); | menu_setxshift(np2cfg.XSHIFT ^ 4); |
| keystat_forcerelease(0x73); | keystat_forcerelease(0x73); |
| update |= SYS_UPDATECFG; | |
| break; | |
| case IDM_F11KANA: | |
| menu_setf11key(0); | |
| mackbd_resetf11(); | |
| update |= SYS_UPDATEOSCFG; | |
| break; | |
| case IDM_F11STOP: | |
| menu_setf11key(1); | |
| mackbd_resetf11(); | |
| update |= SYS_UPDATEOSCFG; | |
| break; | |
| case IDM_F11NFER: | |
| menu_setf11key(3); | |
| mackbd_resetf11(); | |
| update |= SYS_UPDATEOSCFG; | |
| break; | |
| case IDM_F11USER: | |
| menu_setf11key(4); | |
| mackbd_resetf11(); | |
| update |= SYS_UPDATEOSCFG; | |
| break; | break; |
| case IDM_F12MOUSE: | case IDM_F12MOUSE: |
| menu_setf12copy(0); | menu_setf12key(0); |
| keystat_resetcopyhelp(); | mackbd_resetf12(); |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATEOSCFG; |
| break; | break; |
| case IDM_F12COPY: | case IDM_F12COPY: |
| menu_setf12copy(1); | menu_setf12key(1); |
| keystat_resetcopyhelp(); | mackbd_resetf12(); |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATEOSCFG; |
| break; | break; |
| case IDM_F12STOP: | case IDM_F12XFER: |
| menu_setf12copy(2); | menu_setf12key(3); |
| keystat_resetcopyhelp(); | mackbd_resetf12(); |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATEOSCFG; |
| break; | |
| case IDM_F12USER: | |
| menu_setf12key(4); | |
| mackbd_resetf12(); | |
| update |= SYS_UPDATEOSCFG; | |
| break; | break; |
| case IDM_BEEPOFF: | case IDM_BEEPOFF: |
| Line 375 static void HandleMenuChoice(long wParam | Line 601 static void HandleMenuChoice(long wParam |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; |
| break; | break; |
| case IDM_AMD98: | |
| menu_setsound(0x80); | |
| update |= SYS_UPDATECFG; | |
| break; | |
| case IDM_JASTSND: | |
| menu_setjastsnd(np2oscfg.jastsnd ^ 1); | |
| update |= SYS_UPDATEOSCFG; | |
| break; | |
| case IDM_SEEKSND: | case IDM_SEEKSND: |
| menu_setmotorflg(np2cfg.MOTOR ^ 1); | menu_setmotorflg(np2cfg.MOTOR ^ 1); |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; |
| Line 400 static void HandleMenuChoice(long wParam | Line 636 static void HandleMenuChoice(long wParam |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; |
| break; | break; |
| case IDM_MEM116: | |
| menu_setextmem(11); | |
| update |= SYS_UPDATECFG; | |
| break; | |
| case IDM_MEM136: | |
| menu_setextmem(13); | |
| update |= SYS_UPDATECFG; | |
| break; | |
| case IDM_BMPSAVE: | case IDM_BMPSAVE: |
| dialog_writebmp(); | dialog_writebmp(); |
| break; | break; |
| case IDM_CALENDAR: | |
| CalendarDialogProc(); | |
| break; | |
| case IDM_DISPCLOCK: | case IDM_DISPCLOCK: |
| menu_setdispclk(np2oscfg.DISPCLK ^ 1); | menu_setdispclk(np2oscfg.DISPCLK ^ 1); |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; |
| Line 436 static void HandleMenuChoice(long wParam | Line 686 static void HandleMenuChoice(long wParam |
| (void)OpenDeskAcc(applname); | (void)OpenDeskAcc(applname); |
| #endif | #endif |
| } | } |
| #if defined(SUPPORT_STATSAVE) | |
| else if (HiWord(wParam) == IDM_STATSAVE) { | |
| num = LoWord(wParam); | |
| if ((num >= 1) && (num < (1 + 10))) { | |
| SPRINTF(ext, np2flagext, num - 1); | |
| flagsave(ext); | |
| } | |
| else if ((num >= 12) && (num < (12 + 10))) { | |
| SPRINTF(ext, np2flagext, num - 12); | |
| flagload(ext, TRUE); | |
| } | |
| } | |
| #endif | |
| break; | break; |
| } | } |
| sysmng_update(update); | sysmng_update(update); |
| Line 466 static void HandleMouseDown(EventRecord | Line 729 static void HandleMouseDown(EventRecord |
| case inMenuBar: | case inMenuBar: |
| if (np2running) { | if (np2running) { |
| soundmng_stop(); | soundmng_stop(); |
| mousemng_disable(MOUSEPROC_MACUI); | |
| HandleMenuChoice(MenuSelect(pevent->where)); | HandleMenuChoice(MenuSelect(pevent->where)); |
| mousemng_enable(MOUSEPROC_MACUI); | |
| soundmng_play(); | |
| } | } |
| break; | break; |
| Line 487 static void HandleMouseDown(EventRecord | Line 753 static void HandleMouseDown(EventRecord |
| break; | break; |
| case inContent: | case inContent: |
| #if defined(NP2GCC) | mousemng_buttonevent((pevent->modifiers & (1 << 12)) |
| if (controlKey & GetCurrentKeyModifiers() ) { | ?MOUSEMNG_RIGHTDOWN:MOUSEMNG_LEFTDOWN); |
| mouse_btn(MOUSE_RIGHTDOWN); | |
| } | |
| else { | |
| mouse_btn(MOUSE_LEFTDOWN); | |
| } | |
| #endif | |
| break; | break; |
| case inGoAway: | case inGoAway: |
| Line 506 static void HandleMouseDown(EventRecord | Line 766 static void HandleMouseDown(EventRecord |
| static void eventproc(EventRecord *event) { | static void eventproc(EventRecord *event) { |
| int keycode; | |
| keycode = (event->message & keyCodeMask) >> 8; | |
| switch(event->what) { | switch(event->what) { |
| case mouseDown: | case mouseDown: |
| HandleMouseDown(event); | HandleMouseDown(event); |
| Line 517 static void eventproc(EventRecord *event | Line 780 static void eventproc(EventRecord *event |
| case keyDown: | case keyDown: |
| case autoKey: | case autoKey: |
| if (np2running) { | if (!np2running) { |
| mackbd_f12down(((event->message) & keyCodeMask) >> 8); | break; |
| if (event->modifiers & cmdKey) { | } |
| HandleMenuChoice(MenuKey(event->message & charCodeMask)); | #if !TARGET_API_MAC_CARBON |
| if ((keycode == 0x6f) && (np2oscfg.F12KEY == 0)) { | |
| HandleMenuChoice(IDM_MOUSE); | |
| break; | |
| } | |
| #endif | |
| if (event->modifiers & cmdKey) { | |
| #if !TARGET_API_MAC_CARBON | |
| if (mackbd_keydown(keycode, TRUE)) { | |
| break; | |
| } | } |
| #endif | |
| soundmng_stop(); | |
| mousemng_disable(MOUSEPROC_MACUI); | |
| #if TARGET_API_MAC_CARBON | |
| HandleMenuChoice(MenuEvent(event)); | |
| #else | |
| HandleMenuChoice(MenuKey(event->message & charCodeMask)); | |
| #endif | |
| mousemng_enable(MOUSEPROC_MACUI); | |
| soundmng_play(); | |
| } | |
| else { | |
| mackbd_keydown(keycode, FALSE); | |
| } | } |
| break; | break; |
| case keyUp: | case keyUp: |
| mackbd_f12up(((event->message) & keyCodeMask) >> 8); | mackbd_keyup(keycode); |
| break; | break; |
| #if defined(NP2GCC) | case mouseUp: |
| case mouseUp: | mousemng_buttonevent(MOUSEMNG_LEFTUP); |
| if (controlKey & GetCurrentKeyModifiers()) { | mousemng_buttonevent(MOUSEMNG_RIGHTUP); |
| mouse_btn(MOUSE_RIGHTUP); | break; |
| } | |
| else { | case activateEvt: |
| mouse_btn(MOUSE_LEFTUP); | mackbd_activate((event->modifiers & activeFlag)?TRUE:FALSE); |
| } | |
| break; | break; |
| #endif | |
| } | } |
| } | } |
| // ---- | // ---- |
| static void processwait(UINT waitcnt) { | static void framereset(void) { |
| if (timing_getcount() >= waitcnt) { | framecnt = 0; |
| timing_setcount(0); | if (np2oscfg.DISPCLK & 3) { |
| framecnt = 0; | if (sysmng_workclockrenewal()) { |
| if (np2oscfg.DISPCLK & 3) { | sysmng_updatecaption(3); |
| if (sysmng_workclockrenewal()) { | |
| sysmng_updatecaption(3); | |
| } | |
| } | } |
| } | } |
| } | } |
| static void getstatfilename(char *path, const char *ext, int size) { | static void processwait(UINT waitcnt) { |
| file_cpyname(path, file_getcd("np2"), size); | |
| file_catname(path, str_dot, size); | |
| file_catname(path, ext, size); | |
| } | |
| static void flagsave(const char *ext) { | |
| char path[MAX_PATH]; | |
| getstatfilename(path, ext, sizeof(path)); | |
| statsave_save(path); | |
| } | |
| static void flagdelete(const char *ext) { | |
| char path[MAX_PATH]; | |
| getstatfilename(path, ext, sizeof(path)); | |
| file_delete(path); | |
| } | |
| static int flagload(const char *ext) { | |
| int ret; | |
| char path[MAX_PATH]; | |
| char buf[1024]; | |
| int r; | |
| ret = IDOK; | if (timing_getcount() >= waitcnt) { |
| getstatfilename(path, ext, sizeof(path)); | timing_setcount(0); |
| r = statsave_check(path, buf, sizeof(buf)); | framereset(); |
| if (r & (~NP2FLAG_DISKCHG)) { | |
| ResumeErrorDialogProc(); | |
| ret = IDCANCEL; | |
| } | |
| else if (r & NP2FLAG_DISKCHG) { | |
| ret = ResumeWarningDialogProc(buf); | |
| } | |
| if (ret == IDOK) { | |
| statsave_load(path); | |
| } | } |
| return(ret); | |
| } | } |
| int main(int argc, char *argv[]) { | int main(int argc, char *argv[]) { |
| Line 609 int main(int argc, char *argv[]) { | Line 851 int main(int argc, char *argv[]) { |
| Rect wRect; | Rect wRect; |
| EventRecord event; | EventRecord event; |
| UINT t; | UINT t; |
| GrafPtr saveport; | |
| Point pt; | |
| dosio_init(); | dosio_init(); |
| file_setcd(target); | file_setcd(target); |
| InitToolBox(); | InitToolBox(); |
| macossub_init(); | macossub_init(); |
| MenuBarInit(); | |
| initload(); | initload(); |
| MenuBarInit(); | |
| TRACEINIT(); | TRACEINIT(); |
| SetRect(&wRect, 100, 100, 100, 100); | keystat_initialize(); |
| SetRect(&wRect, np2oscfg.posx, np2oscfg.posy, 100, 100); | |
| #if !defined(SUPPORT_PC9821) | |
| hWndMain = NewWindow(0, &wRect, "\pNeko Project II", FALSE, | hWndMain = NewWindow(0, &wRect, "\pNeko Project II", FALSE, |
| noGrowDocProc, (WindowPtr)-1, TRUE, 0); | noGrowDocProc, (WindowPtr)-1, TRUE, 0); |
| #else | |
| hWndMain = NewWindow(0, &wRect, "\pNeko Project 21", FALSE, | |
| noGrowDocProc, (WindowPtr)-1, TRUE, 0); | |
| #endif | |
| if (!hWndMain) { | if (!hWndMain) { |
| TRACETERM(); | TRACETERM(); |
| macossub_term(); | macossub_term(); |
| Line 640 int main(int argc, char *argv[]) { | Line 891 int main(int argc, char *argv[]) { |
| menu_setframe(np2oscfg.DRAW_SKIP); | menu_setframe(np2oscfg.DRAW_SKIP); |
| menu_setkey(0); | menu_setkey(0); |
| menu_setxshift(0); | menu_setxshift(0); |
| menu_setf12copy(np2oscfg.F12COPY); | menu_setf11key(np2oscfg.F11KEY); |
| menu_setf12key(np2oscfg.F12KEY); | |
| menu_setbeepvol(np2cfg.BEEP_VOL); | menu_setbeepvol(np2cfg.BEEP_VOL); |
| menu_setsound(np2cfg.SOUND_SW); | menu_setsound(np2cfg.SOUND_SW); |
| menu_setjastsnd(np2oscfg.jastsnd); | |
| menu_setmotorflg(np2cfg.MOTOR); | menu_setmotorflg(np2cfg.MOTOR); |
| menu_setextmem(np2cfg.EXTMEM); | menu_setextmem(np2cfg.EXTMEM); |
| menu_setdispclk(np2oscfg.DISPCLK); | menu_setdispclk(np2oscfg.DISPCLK); |
| Line 666 int main(int argc, char *argv[]) { | Line 919 int main(int argc, char *argv[]) { |
| } | } |
| } | } |
| commng_initialize(); | |
| sysmng_initialize(); | sysmng_initialize(); |
| mackbd_initialize(); | mackbd_initialize(); |
| pccore_init(); | pccore_init(); |
| S98_init(); | S98_init(); |
| #if defined(NP2GCC) | mousemng_initialize(); |
| if (np2oscfg.MOUSE_SW) { // ver0.30 | if (np2oscfg.MOUSE_SW) { // ver0.30 |
| mouse_running(MOUSE_ON); | mousemng_enable(MOUSEPROC_SYSTEM); |
| } | } |
| #endif | |
| // scrndraw_redraw(); | // scrndraw_redraw(); |
| pccore_reset(); | pccore_reset(); |
| #if defined(SUPPORT_RESUME) | |
| if (np2oscfg.resume) { | if (np2oscfg.resume) { |
| flagload(np2resume); | flagload(np2resumeext, FALSE); |
| } | } |
| #endif | |
| SetEventMask(everyEvent); | SetEventMask(everyEvent); |
| Line 692 int main(int argc, char *argv[]) { | Line 947 int main(int argc, char *argv[]) { |
| } | } |
| else { | else { |
| if (np2oscfg.NOWAIT) { | if (np2oscfg.NOWAIT) { |
| #if defined(NP2GCC) | |
| mouse_callback(); | |
| #endif | |
| soundmng_play(); | |
| mackbd_callback(); | mackbd_callback(); |
| mousemng_callback(); | |
| pccore_exec(framecnt == 0); | pccore_exec(framecnt == 0); |
| if (np2oscfg.DRAW_SKIP) { // nowait frame skip | if (np2oscfg.DRAW_SKIP) { // nowait frame skip |
| framecnt++; | framecnt++; |
| Line 713 int main(int argc, char *argv[]) { | Line 965 int main(int argc, char *argv[]) { |
| } | } |
| else if (np2oscfg.DRAW_SKIP) { // frame skip | else if (np2oscfg.DRAW_SKIP) { // frame skip |
| if (framecnt < np2oscfg.DRAW_SKIP) { | if (framecnt < np2oscfg.DRAW_SKIP) { |
| #if defined(NP2GCC) | |
| mouse_callback(); | |
| #endif | |
| soundmng_play(); | |
| mackbd_callback(); | mackbd_callback(); |
| mousemng_callback(); | |
| pccore_exec(framecnt == 0); | pccore_exec(framecnt == 0); |
| framecnt++; | framecnt++; |
| } | } |
| Line 728 int main(int argc, char *argv[]) { | Line 977 int main(int argc, char *argv[]) { |
| else { // auto skip | else { // auto skip |
| if (!waitcnt) { | if (!waitcnt) { |
| UINT cnt; | UINT cnt; |
| #if defined(NP2GCC) | |
| mouse_callback(); | |
| #endif | |
| soundmng_play(); | |
| mackbd_callback(); | mackbd_callback(); |
| mousemng_callback(); | |
| pccore_exec(framecnt == 0); | pccore_exec(framecnt == 0); |
| framecnt++; | framecnt++; |
| cnt = timing_getcount(); | cnt = timing_getcount(); |
| Line 752 int main(int argc, char *argv[]) { | Line 998 int main(int argc, char *argv[]) { |
| else { | else { |
| timing_setcount(cnt - framecnt); | timing_setcount(cnt - framecnt); |
| } | } |
| framecnt = 0; | framereset(); |
| } | } |
| } | } |
| else { | else { |
| Line 762 int main(int argc, char *argv[]) { | Line 1008 int main(int argc, char *argv[]) { |
| } | } |
| } | } |
| } | } |
| GetPort(&saveport); | |
| #if TARGET_API_MAC_CARBON | |
| SetPortWindowPort(hWndMain); | |
| #else | |
| SetPort(hWndMain); | |
| #endif | |
| pt.h = 0; | |
| pt.v = 0; | |
| LocalToGlobal(&pt); | |
| SetPort(saveport); | |
| if ((np2oscfg.posx != pt.h) || (np2oscfg.posy != pt.v)) { | |
| np2oscfg.posx = pt.h; | |
| np2oscfg.posy = pt.v; | |
| sysmng_update(SYS_UPDATEOSCFG); | |
| } | |
| np2running = FALSE; | np2running = FALSE; |
| pccore_cfgupdate(); | pccore_cfgupdate(); |
| #if defined(SUPPORT_RESUME) | |
| if (np2oscfg.resume) { | if (np2oscfg.resume) { |
| flagsave(np2resume); | flagsave(np2resumeext); |
| } | } |
| else { | else { |
| flagdelete(np2resume); | flagdelete(np2resumeext); |
| } | } |
| #endif | |
| pccore_term(); | pccore_term(); |
| S98_trash(); | S98_trash(); |
| #if defined(NP2GCC) | mousemng_disable(MOUSEPROC_SYSTEM); |
| mouse_running(MOUSE_OFF); | |
| #endif | |
| scrnmng_destroy(); | scrnmng_destroy(); |