--- np2/macosx/mackbd.cpp 2003/10/19 14:56:15 1.3 +++ np2/macosx/mackbd.cpp 2003/11/08 17:54:26 1.9 @@ -6,6 +6,11 @@ #include "pccore.h" #include "iocore.h" +#if defined(NP2GCC) +#include "mousemng.h" +#include "menu.h" +#include "sysmng.h" +#endif #define NC 0xff @@ -25,7 +30,7 @@ static const BYTE keymac[128] = { // TAB, SPC, , BS, , ESC, , apl ; 0x30 0x0f,0x34, NC,0x0e, NC,0x00, NC, NC, // sft, ctl, alt, cps, , , , ; 0x38 - 0x70,0x74,0x73,0x79, NC, NC, NC, NC, + 0x70,0x74,0x73,0x71, NC, NC, NC, NC, // , [.], , [*], , , [+], ; 0x40 NC,0x50, NC,0x45, NC, NC,0x49, NC, // , , , , ret, , [-], clr ; 0x48 @@ -88,6 +93,7 @@ void mackbd_initialize(void) { ZeroMemory(&keymap, sizeof(keymap)); } +#if 0 void mackbd_callback(void) { UINT32 tick; @@ -127,28 +133,69 @@ void mackbd_callback(void) { } } } +#endif + +static const BYTE f12keys[] = { + 0x61, 0x60, 0x4d, 0x4f}; + + +static BYTE getf12key(void) { + + UINT key; + + key = np2oscfg.F12COPY - 1; + if (key < (sizeof(f12keys)/sizeof(BYTE))) { + return(f12keys[key]); + } + else { + return(NC); + } +} -void mackbd_f12down(int keycode) { +void mackbd_keydown(int keycode) { if (keycode == 0x6f) { - if (np2oscfg.F12COPY == 1) { - keystat_senddata(0x61); - } - else if (np2oscfg.F12COPY == 2) { - keystat_senddata(0x60); + if (np2oscfg.F12COPY) { + keystat_senddata(getf12key()); + } +#if defined(NP2GCC) + else { + mouse_running(MOUSE_XOR); + menu_setmouse(np2oscfg.MOUSE_SW ^ 1); + sysmng_update(SYS_UPDATECFG); } +#endif + } + else { + BYTE data; + data = keymac[keycode]; + if (data != NC) { + keystat_senddata(data); + } } } -void mackbd_f12up(int keycode) { +void mackbd_keyup(int keycode) { if (keycode == 0x6f) { - if (np2oscfg.F12COPY == 1) { - keystat_senddata(0x61 | 0x80); - } - else if (np2oscfg.F12COPY == 2) { - keystat_senddata(0x60 | 0x80); + if (np2oscfg.F12COPY) { + keystat_senddata(getf12key() | 0x80); } + } + else { + BYTE data; + data = keymac[keycode]; + if (data != NC) { + keystat_senddata(data | 0x80); + } } } +void mackbd_resetf12(void) { + + UINT i; + + for (i=0; i<(sizeof(f12keys)/sizeof(BYTE)); i++) { + keystat_forcerelease(f12keys[i]); + } +}