|
|
| version 1.1, 2003/10/16 17:59:36 | version 1.5, 2003/10/19 14:48:07 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include "resource.h" | #include "resource.h" |
| #include "strres.h" | |
| #include "np2.h" | #include "np2.h" |
| #include "dosio.h" | #include "dosio.h" |
| #include "scrnmng.h" | #include "scrnmng.h" |
| Line 26 | Line 27 |
| #include "fddfile.h" | #include "fddfile.h" |
| #include "statsave.h" | #include "statsave.h" |
| #if defined(NP2GCC) | |
| #include "mousemng.h" | |
| #endif | |
| #define USE_RESUME | #define USE_RESUME |
| #if defined(NP2GCC) | |
| NP2OSCFG np2oscfg = {0, 2, 0, 0, 0, 0}; | |
| #else | |
| NP2OSCFG np2oscfg = {0, 2, 0, 0, 0}; | NP2OSCFG np2oscfg = {0, 2, 0, 0, 0}; |
| #endif | |
| WindowPtr hWndMain; | WindowPtr hWndMain; |
| BOOL np2running; | BOOL np2running; |
| Line 50 static BYTE scrnmode; | Line 58 static BYTE scrnmode; |
| static char target[MAX_PATH] = DEFAULTPATH; | static char target[MAX_PATH] = DEFAULTPATH; |
| static const char np2resume[] = "sav"; | |
| // ---- おまじない | // ---- おまじない |
| #if TARGET_CARBON | #if TARGET_CARBON |
| Line 459 static void HandleMouseDown(EventRecord | Line 470 static void HandleMouseDown(EventRecord |
| break; | break; |
| case inContent: | case inContent: |
| #if defined(NP2GCC) | |
| if (controlKey & GetCurrentKeyModifiers() ) { | |
| mouse_btn(MOUSE_RIGHTDOWN); | |
| } | |
| else { | |
| mouse_btn(MOUSE_LEFTDOWN); | |
| } | |
| #endif | |
| break; | break; |
| case inGoAway: | case inGoAway: |
| Line 487 static void eventproc(EventRecord *event | Line 506 static void eventproc(EventRecord *event |
| } | } |
| } | } |
| else { | else { |
| #if defined(NP2GCC) | |
| if ((((event->message) & keyCodeMask) >> 8 == 0x6f) && (!np2oscfg.F12COPY)) { | |
| mouse_running(MOUSE_XOR); | |
| menu_setmouse(np2oscfg.MOUSE_SW ^ 1); | |
| sysmng_update(SYS_UPDATECFG); | |
| } | |
| else { | |
| mackbd_down(0, ((event->message) & keyCodeMask) >> 8); | |
| } | |
| #else | |
| mackbd_down(0, ((event->message) & keyCodeMask) >> 8); | mackbd_down(0, ((event->message) & keyCodeMask) >> 8); |
| #endif | |
| } | } |
| break; | break; |
| case keyUp: | case keyUp: |
| mackbd_up(((event->message) & keyCodeMask) >> 8); | mackbd_up(((event->message) & keyCodeMask) >> 8); |
| break; | break; |
| #if defined(NP2GCC) | |
| case mouseUp: | |
| if (controlKey & GetCurrentKeyModifiers()) { | |
| mouse_btn(MOUSE_RIGHTUP); | |
| } | |
| else { | |
| mouse_btn(MOUSE_LEFTUP); | |
| } | |
| break; | |
| #endif | |
| } | } |
| } | } |
| Line 503 static void processwait(UINT waitcnt) { | Line 543 static void processwait(UINT waitcnt) { |
| if (timing_getcount() >= waitcnt) { | if (timing_getcount() >= waitcnt) { |
| timing_setcount(0); | timing_setcount(0); |
| framecnt = 0; | framecnt = 0; |
| if (np2oscfg.DISPCLK & 2) { | if (np2oscfg.DISPCLK & 3) { |
| if (sysmng_workclockrenewal()) { | if (sysmng_workclockrenewal()) { |
| sysmng_updatecaption(2); | sysmng_updatecaption(3); |
| } | } |
| } | } |
| } | } |
| } | } |
| static void getstatfilename(char *path, const char *ext, int size) { | |
| 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 flagload(const char *ext) { | |
| char path[MAX_PATH]; | |
| char buf[1024]; | |
| int ret; | |
| getstatfilename(path, ext, sizeof(path)); | |
| ret = statsave_check(path, buf, sizeof(buf)); | |
| if (ret == NP2FLAG_SUCCESS) { | |
| statsave_load(path); | |
| } | |
| } | |
| int main(int argc, char *argv[]) { | int main(int argc, char *argv[]) { |
| Rect wRect; | Rect wRect; |
| Line 564 int main(int argc, char *argv[]) { | Line 632 int main(int argc, char *argv[]) { |
| pccore_init(); | pccore_init(); |
| S98_init(); | S98_init(); |
| #if defined(NP2GCC) | |
| if (np2oscfg.MOUSE_SW) { // ver0.30 | |
| mouse_running(MOUSE_ON); | |
| } | |
| #endif | |
| scrndraw_redraw(); | scrndraw_redraw(); |
| pccore_reset(); | pccore_reset(); |
| #if defined(USE_RESUME) | #if defined(USE_RESUME) |
| statsave_load(":np2.sav"); | flagload(np2resume); |
| #endif | #endif |
| SetEventMask(everyEvent); | SetEventMask(everyEvent); |
| Line 580 int main(int argc, char *argv[]) { | Line 653 int main(int argc, char *argv[]) { |
| } | } |
| else { | else { |
| if (np2oscfg.NOWAIT) { | if (np2oscfg.NOWAIT) { |
| #if defined(NP2GCC) | |
| mouse_callback(); | |
| #endif | |
| mackbd_callback(); | mackbd_callback(); |
| pccore_exec(framecnt == 0); | pccore_exec(framecnt == 0); |
| if (np2oscfg.DRAW_SKIP) { // nowait frame skip | if (np2oscfg.DRAW_SKIP) { // nowait frame skip |
| Line 597 int main(int argc, char *argv[]) { | Line 673 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 | |
| mackbd_callback(); | mackbd_callback(); |
| pccore_exec(framecnt == 0); | pccore_exec(framecnt == 0); |
| framecnt++; | framecnt++; |
| Line 607 int main(int argc, char *argv[]) { | Line 686 int main(int argc, char *argv[]) { |
| } | } |
| else { // auto skip | else { // auto skip |
| if (!waitcnt) { | if (!waitcnt) { |
| #if defined(NP2GCC) | |
| mouse_callback(); | |
| #endif | |
| mackbd_callback(); | mackbd_callback(); |
| pccore_exec(framecnt == 0); | pccore_exec(framecnt == 0); |
| framecnt++; | framecnt++; |
| Line 635 int main(int argc, char *argv[]) { | Line 717 int main(int argc, char *argv[]) { |
| pccore_cfgupdate(); | pccore_cfgupdate(); |
| #if defined(USE_RESUME) | #if defined(USE_RESUME) |
| statsave_save(":np2.sav"); | flagsave(np2resume); |
| #endif | #endif |
| pccore_term(); | pccore_term(); |
| S98_trash(); | S98_trash(); |
| #if defined(NP2GCC) | |
| mouse_running(MOUSE_OFF); | |
| #endif | |
| scrnmng_destroy(); | scrnmng_destroy(); |
| if (sys_updates & (SYS_UPDATECFG | SYS_UPDATEOSCFG)) { | if (sys_updates & (SYS_UPDATECFG | SYS_UPDATEOSCFG)) { |