function key input from shared memory
parent
d741335a4a
commit
ec17bbc82c
|
@ -26,6 +26,40 @@ static uint8_t aime_io_felica_id[8];
|
||||||
static bool aime_io_aime_id_present;
|
static bool aime_io_aime_id_present;
|
||||||
static bool aime_io_felica_id_present;
|
static bool aime_io_felica_id_present;
|
||||||
|
|
||||||
|
struct IPCMemoryInfo
|
||||||
|
{
|
||||||
|
uint8_t airIoStatus[6];
|
||||||
|
uint8_t sliderIoStatus[32];
|
||||||
|
uint8_t ledRgbData[32 * 3];
|
||||||
|
uint8_t testBtn;
|
||||||
|
uint8_t serviceBtn;
|
||||||
|
uint8_t coinInsertion;
|
||||||
|
uint8_t cardRead;
|
||||||
|
};
|
||||||
|
typedef struct IPCMemoryInfo IPCMemoryInfo;
|
||||||
|
static HANDLE FileMappingHandle;
|
||||||
|
IPCMemoryInfo* FileMapping;
|
||||||
|
|
||||||
|
void initSharedMemory()
|
||||||
|
{
|
||||||
|
if (FileMapping)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((FileMappingHandle = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, sizeof(IPCMemoryInfo), "Local\\BROKENITHM_SHARED_BUFFER")) == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((FileMapping = (IPCMemoryInfo*)MapViewOfFile(FileMappingHandle, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(IPCMemoryInfo))) == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(FileMapping, 0, sizeof(IPCMemoryInfo));
|
||||||
|
SetThreadExecutionState(ES_DISPLAY_REQUIRED | ES_CONTINUOUS);
|
||||||
|
}
|
||||||
|
|
||||||
static void aime_io_config_read(
|
static void aime_io_config_read(
|
||||||
struct aime_io_config *cfg,
|
struct aime_io_config *cfg,
|
||||||
const wchar_t *filename);
|
const wchar_t *filename);
|
||||||
|
@ -166,6 +200,8 @@ HRESULT aime_io_init(void)
|
||||||
{
|
{
|
||||||
aime_io_config_read(&aime_io_cfg, L".\\segatools.ini");
|
aime_io_config_read(&aime_io_cfg, L".\\segatools.ini");
|
||||||
|
|
||||||
|
initSharedMemory();
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +225,12 @@ HRESULT aime_io_nfc_poll(uint8_t unit_no)
|
||||||
|
|
||||||
/* Don't do anything more if the scan key is not held */
|
/* Don't do anything more if the scan key is not held */
|
||||||
|
|
||||||
sense = GetAsyncKeyState(aime_io_cfg.vk_scan) & 0x8000;
|
if (FileMapping && FileMapping->cardRead) {
|
||||||
|
sense = true;
|
||||||
|
FileMapping->cardRead = 0;
|
||||||
|
} else {
|
||||||
|
sense = GetAsyncKeyState(aime_io_cfg.vk_scan) & 0x8000;
|
||||||
|
}
|
||||||
|
|
||||||
if (!sense) {
|
if (!sense) {
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -20,6 +20,10 @@ struct IPCMemoryInfo
|
||||||
uint8_t airIoStatus[6];
|
uint8_t airIoStatus[6];
|
||||||
uint8_t sliderIoStatus[32];
|
uint8_t sliderIoStatus[32];
|
||||||
uint8_t ledRgbData[32 * 3];
|
uint8_t ledRgbData[32 * 3];
|
||||||
|
uint8_t testBtn;
|
||||||
|
uint8_t serviceBtn;
|
||||||
|
uint8_t coinInsertion;
|
||||||
|
uint8_t cardRead;
|
||||||
};
|
};
|
||||||
typedef struct IPCMemoryInfo IPCMemoryInfo;
|
typedef struct IPCMemoryInfo IPCMemoryInfo;
|
||||||
static HANDLE FileMappingHandle;
|
static HANDLE FileMappingHandle;
|
||||||
|
@ -60,13 +64,18 @@ void chuni_io_jvs_read_coin_counter(uint16_t *out)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetAsyncKeyState(chuni_io_cfg.vk_coin)) {
|
if (FileMapping && FileMapping->coinInsertion) {
|
||||||
if (!chuni_io_coin) {
|
chuni_io_coins++;
|
||||||
chuni_io_coin = true;
|
FileMapping->coinInsertion = 0;
|
||||||
chuni_io_coins++;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
chuni_io_coin = false;
|
if (GetAsyncKeyState(chuni_io_cfg.vk_coin)) {
|
||||||
|
if (!chuni_io_coin) {
|
||||||
|
chuni_io_coin = true;
|
||||||
|
chuni_io_coins++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
chuni_io_coin = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*out = chuni_io_coins;
|
*out = chuni_io_coins;
|
||||||
|
@ -76,11 +85,11 @@ void chuni_io_jvs_poll(uint8_t *opbtn, uint8_t *beams)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (GetAsyncKeyState(chuni_io_cfg.vk_test)) {
|
if ((FileMapping && FileMapping->testBtn) || GetAsyncKeyState(chuni_io_cfg.vk_test)) {
|
||||||
*opbtn |= 0x01; /* Test */
|
*opbtn |= 0x01; /* Test */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetAsyncKeyState(chuni_io_cfg.vk_service)) {
|
if ((FileMapping && FileMapping->serviceBtn) || GetAsyncKeyState(chuni_io_cfg.vk_service)) {
|
||||||
*opbtn |= 0x02; /* Service */
|
*opbtn |= 0x02; /* Service */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue