1
0
mirror of synced 2024-11-12 00:40:47 +01:00

Rebindable aime keys

This commit is contained in:
Bottersnike 2023-07-14 20:31:38 +01:00
parent 8ca5b1a051
commit 07f2c9d020
No known key found for this signature in database
6 changed files with 107 additions and 48 deletions

View File

@ -246,7 +246,7 @@ static void nfc_poll(com_device_t* dev, comio_recv_head_t* req) {
PNFC_CARD lpCard = p1 ? &nfcCardReaderP1 : &nfcCardReaderP2;
SHORT key = GetAsyncKeyState(p1 ? 'P' : 'L');
SHORT key = GetAsyncKeyState(p1 ? MiceConfig.keys.card_p1 : MiceConfig.keys.card_p2);
if (key < 0) {
LPCSTR cardId = GetCardIdentifier(p1 ? 0 : 1);
BYTE nCardBytes = TN32PopulateCard(lpCard, cardId);

View File

@ -91,7 +91,7 @@ static JVS_STATUS Transact(PMICE_JVS this, BYTE command) {
if (MiceInputGetButtonState(&(this->m_Bindings[1]))) this->m_CoinCounts[1]++;
for (unsigned char slot = 0; slot < coin_count; slot++) {
MiceJvsWrite(this, this->m_CoinCounts[slot] >> 8);
MiceJvsWrite(this, (this->m_CoinCounts[slot] >> 8) & 0xff);
MiceJvsWrite(this, this->m_CoinCounts[slot] & 0xff);
}
return JVS_STATUS_OK;

View File

@ -893,56 +893,113 @@ void tab_system_buttons() {
igNextColumn();
igSeparator();
igTextUnformatted("System Test", NULL);
igNextColumn();
if (MiceConfig.keys.test == 0) {
igTextColored(DISABLED_COL, "None");
} else {
GetKeyNameTextA(MapVirtualKey(MiceConfig.keys.test, MAPVK_VK_TO_VSC) << 16, keyName,
_countof(keyName));
igTextUnformatted(keyName, NULL);
}
igNextColumn();
if (igButton("Bind##BindTest", vec0)) igOpenPopup_Str("BindSysTest", ImGuiPopupFlags_None);
if (MiceConfig.keys.test) {
igSameLine(0, -1);
if (igButton("Clear##ClearTest", vec0)) {
MiceConfig.keys.test = 0;
save_current_config(false);
{
igTextUnformatted("System Test", NULL);
igNextColumn();
if (MiceConfig.keys.test == 0) {
igTextColored(DISABLED_COL, "None");
} else {
GetKeyNameTextA(MapVirtualKey(MiceConfig.keys.test, MAPVK_VK_TO_VSC) << 16, keyName,
_countof(keyName));
igTextUnformatted(keyName, NULL);
}
}
igNextColumn();
if (igKeyBindPopup("BindSysTest", &boundKey))
if (boundKey != -1) {
MiceConfig.keys.test = boundKey;
save_current_config(false);
igNextColumn();
if (igButton("Bind##BindTest", vec0)) igOpenPopup_Str("BindSysTest", ImGuiPopupFlags_None);
if (MiceConfig.keys.test) {
igSameLine(0, -1);
if (igButton("Clear##ClearTest", vec0)) {
MiceConfig.keys.test = 0;
save_current_config(false);
}
}
igTextUnformatted("System Service", NULL);
igNextColumn();
if (MiceConfig.keys.service == 0) {
igTextColored(DISABLED_COL, "None");
} else {
GetKeyNameTextA(MapVirtualKey(MiceConfig.keys.service, MAPVK_VK_TO_VSC) << 16, keyName,
_countof(keyName));
igTextUnformatted(keyName, NULL);
igNextColumn();
if (igKeyBindPopup("BindSysTest", &boundKey))
if (boundKey != -1) {
MiceConfig.keys.test = boundKey;
save_current_config(false);
}
}
igNextColumn();
if (igButton("Bind##BindService", vec0))
igOpenPopup_Str("BindSysService", ImGuiPopupFlags_None);
if (MiceConfig.keys.service) {
igSameLine(0, -1);
if (igButton("Clear##ClearService", vec0)) {
MiceConfig.keys.service = 0;
save_current_config(false);
{
igTextUnformatted("System Service", NULL);
igNextColumn();
if (MiceConfig.keys.service == 0) {
igTextColored(DISABLED_COL, "None");
} else {
GetKeyNameTextA(MapVirtualKey(MiceConfig.keys.service, MAPVK_VK_TO_VSC) << 16, keyName,
_countof(keyName));
igTextUnformatted(keyName, NULL);
}
igNextColumn();
if (igButton("Bind##BindService", vec0))
igOpenPopup_Str("BindSysService", ImGuiPopupFlags_None);
if (MiceConfig.keys.service) {
igSameLine(0, -1);
if (igButton("Clear##ClearService", vec0)) {
MiceConfig.keys.service = 0;
save_current_config(false);
}
}
igNextColumn();
if (igKeyBindPopup("BindSysService", &boundKey))
if (boundKey != -1) {
MiceConfig.keys.service = boundKey;
save_current_config(false);
}
}
igNextColumn();
if (igKeyBindPopup("BindSysService", &boundKey))
if (boundKey != -1) {
MiceConfig.keys.service = boundKey;
save_current_config(false);
{
igTextUnformatted("Insert card 1P", NULL);
igNextColumn();
if (MiceConfig.keys.card_p1 == 0) {
igTextColored(DISABLED_COL, "None");
} else {
GetKeyNameTextA(MapVirtualKey(MiceConfig.keys.card_p1, MAPVK_VK_TO_VSC) << 16, keyName,
_countof(keyName));
igTextUnformatted(keyName, NULL);
}
igNextColumn();
if (igButton("Bind##Bind1P", vec0))
igOpenPopup_Str("BindSys1P", ImGuiPopupFlags_None);
if (MiceConfig.keys.card_p1) {
igSameLine(0, -1);
if (igButton("Clear##Clear1P", vec0)) {
MiceConfig.keys.card_p1 = 0;
save_current_config(false);
}
}
igNextColumn();
if (igKeyBindPopup("BindSys1P", &boundKey))
if (boundKey != -1) {
MiceConfig.keys.card_p1 = boundKey;
save_current_config(false);
}
}
{
igTextUnformatted("Insert card 2P", NULL);
igNextColumn();
if (MiceConfig.keys.card_p2 == 0) {
igTextColored(DISABLED_COL, "None");
} else {
GetKeyNameTextA(MapVirtualKey(MiceConfig.keys.card_p2, MAPVK_VK_TO_VSC) << 16, keyName,
_countof(keyName));
igTextUnformatted(keyName, NULL);
}
igNextColumn();
if (igButton("Bind##Bind2P", vec0))
igOpenPopup_Str("BindSys2P", ImGuiPopupFlags_None);
if (MiceConfig.keys.card_p2) {
igSameLine(0, -1);
if (igButton("Clear##Clear2P", vec0)) {
MiceConfig.keys.card_p2 = 0;
save_current_config(false);
}
}
igNextColumn();
if (igKeyBindPopup("BindSys2P", &boundKey))
if (boundKey != -1) {
MiceConfig.keys.card_p2 = boundKey;
save_current_config(false);
}
}
}
void tab_main_keybinds() {

View File

@ -84,7 +84,7 @@ void SetDataForHandle(HANDLE hObject, PVOID pData, BOOL isHeap) {
};
MiceDAGrowAndSet(g_handleData, dwIndex, &newHandleData);
}
BOOL RemoveDataForHandle(HANDLE hObject, DWORD type) {
BOOL RemoveDataForHandle(HANDLE hObject) {
if (hObject == INVALID_HANDLE_VALUE) return FALSE;
if (!hObject & MICE_HANDLE_MASK) return FALSE;
DWORD_PTR dwIndex = (DWORD_PTR)hObject >> 2;

View File

@ -107,6 +107,8 @@ ENDSECTION(hooks)
SECTION(keys, "Raw keybinding data. Edit this using the built in binding tool!")
CFG_int(keys, test, 0, "")
CFG_int(keys, service, 0, "")
CFG_int(keys, card_p1, 13, "")
CFG_int(keys, card_p2, 32, "")
ENDSECTION(keys)
SECTION(devices, "Register attached hardware devices. COM4 is reserved for JVS.")

View File

@ -32,7 +32,7 @@ DWORD GetOutermostMiceId(void) {
CHAR baseName[MAX_PATH + 1];
if (GetModuleFileNameEx(hProcess, NULL, baseName, sizeof baseName)) {
// TODO: Better
if (stricmp(PathFindFileNameA(baseName), MICEEXE) == 0)
if (_stricmp(PathFindFileNameA(baseName), MICEEXE) == 0)
return pid;
}
CloseHandle(hProcess);