Skip to content

Commit

Permalink
wip property rework
Browse files Browse the repository at this point in the history
  • Loading branch information
gulrak committed Oct 11, 2024
1 parent 5c9d5ba commit 1a399cf
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/cadmium.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,35 @@ class Cadmium : public emu::EmuHostEx

int getKeyPressed() override
{
#if 1
static uint32_t instruction = 0;
static int waitKeyUp = 0;
static int keyId = 0;
auto now = GetTime();
for(int i = 0; i < 16; ++i)
_keyScanTime[i] = now;
if(waitKeyUp && instruction == _chipEmu->focussedExecutionUnit()->getPC()) {
if(IsKeyUp(waitKeyUp)) {
waitKeyUp = 0;
instruction = 0;
return keyId;
}
return -1;
}
waitKeyUp = 0;
auto key = GetKeyPressed();
if (!gui::IsSysKeyDown() && key) {
for (int i = 0; i < 16; ++i) {
if (key == _keyMapping[i]) {
instruction = _chipEmu->focussedExecutionUnit()->getPC();
waitKeyUp = key;
keyId = i + 1;
return 0;
}
}
}
return waitKeyUp ? -1 : 0;
#else
//static uint32_t instruction = 0;
//static int waitKeyUp = 0;
//static int keyId = 0;
Expand Down Expand Up @@ -794,6 +823,7 @@ class Cadmium : public emu::EmuHostEx
}
return waitKeyUp ? -1 : 0;
*/
#endif
}

bool isKeyDown(uint8_t key) override
Expand Down

0 comments on commit 1a399cf

Please sign in to comment.