|
|
| version 1.1, 2009/03/24 13:52:51 | version 1.2, 2009/03/25 21:36:10 |
|---|---|
| Line 9 | Line 9 |
| static void touch() | static void touch() |
| { | { |
| static uint16 s_wLastButtons = (uint16)-1; | static uint16 s_wLastButtons = static_cast<uint16>(-1); |
| touchPosition pos; | touchPosition pos; |
| ZeroMemory(&pos, sizeof(pos)); | ZeroMemory(&pos, sizeof(pos)); |
| Line 17 static void touch() | Line 17 static void touch() |
| uint16 wButtons = REG_KEYXY; | uint16 wButtons = REG_KEYXY; |
| if (!((wButtons ^ s_wLastButtons) & (1 << 6))) | if (!((wButtons ^ s_wLastButtons) & (1 << 6))) |
| { | { |
| #if (LIBNDS_VERSION >= 0x010302) | |
| touchReadXY(&pos); | |
| const bool bRel = ((pos.rawx == 0) || (pos.rawy == 0)); | |
| #else // (LIBNDS_VERSION >= 0x010302) | |
| pos = touchReadXY(); | pos = touchReadXY(); |
| if ((pos.x == 0) || (pos.y == 0)) | const bool bRel = ((pos.x == 0) || (pos.y == 0)); |
| #endif // (LIBNDS_VERSION >= 0x010302) | |
| if (bRel) | |
| { | { |
| wButtons |= (1 << 6); | wButtons |= (1 << 6); |
| s_wLastButtons = wButtons; | s_wLastButtons = wButtons; |
| Line 30 static void touch() | Line 36 static void touch() |
| wButtons |= (1 << 6); | wButtons |= (1 << 6); |
| } | } |
| IPC->touchX = pos.x; | TransferRegion volatile* pIpc = getIPC(); |
| IPC->touchY = pos.y; | #if (LIBNDS_VERSION >= 0x010302) |
| IPC->touchXpx = pos.px; | pIpc->touchX = pos.rawx; |
| IPC->touchYpx = pos.py; | pIpc->touchY = pos.rawy; |
| IPC->touchZ1 = pos.z1; | #else // (LIBNDS_VERSION >= 0x010302) |
| IPC->touchZ2 = pos.z2; | pIpc->touchX = pos.x; |
| IPC->buttons = wButtons; | pIpc->touchY = pos.y; |
| #endif // (LIBNDS_VERSION >= 0x010302) | |
| pIpc->touchXpx = pos.px; | |
| pIpc->touchYpx = pos.py; | |
| pIpc->touchZ1 = pos.z1; | |
| pIpc->touchZ2 = pos.z2; | |
| pIpc->buttons = wButtons; | |
| } | } |
| Line 44 static void VblankHandler() | Line 56 static void VblankHandler() |
| { | { |
| touch(); | touch(); |
| const uint16 wButtons = IPC->buttons; | const TransferRegion volatile* pcIpc = getIPC(); |
| const uint16 wButtons = pcIpc->buttons; | |
| if (!(wButtons & (1 << 6))) | if (!(wButtons & (1 << 6))) |
| { | { |
| softkbd7_down(IPC->touchXpx, IPC->touchYpx); | softkbd7_down(pcIpc->touchXpx, pcIpc->touchYpx); |
| } | } |
| else | else |
| { | { |
| Line 63 int nds7main() | Line 76 int nds7main() |
| readUserSettings(); | readUserSettings(); |
| //enable sound | //enable sound |
| #if (LIBNDS_VERSION >= 0x010302) | |
| powerOn(PM_SOUND_AMP); | |
| #else // (LIBNDS_VERSION >= 0x010302) | |
| powerON(POWER_SOUND); | powerON(POWER_SOUND); |
| #endif // (LIBNDS_VERSION >= 0x010302) | |
| writePowerManagement(PM_CONTROL_REG, (readPowerManagement(PM_CONTROL_REG) & (~PM_SOUND_MUTE)) | PM_SOUND_AMP); | writePowerManagement(PM_CONTROL_REG, (readPowerManagement(PM_CONTROL_REG) & (~PM_SOUND_MUTE)) | PM_SOUND_AMP); |
| SOUND_CR = SOUND_ENABLE | SOUND_VOL(0x7F); | SOUND_CR = SOUND_ENABLE | SOUND_VOL(0x7F); |