--check: 938/3256 method bodies compile for x86_64 (28.8%), 32-bit layout asserts hold; boot path 3/626 curated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
160 lines
6.0 KiB
C++
160 lines
6.0 KiB
C++
#include "classes.h"
|
|
|
|
// 00835c90
|
|
void KeyConfigs::apply_to_device(int deviceId)
|
|
{
|
|
int iVar1;
|
|
char cVar2;
|
|
uint32_t uVar3;
|
|
int iVar4;
|
|
uint8_t *deviceNameChar;
|
|
char *pcVar5;
|
|
char *pcVar6;
|
|
char *pcVar7;
|
|
uint32_t *puVar8;
|
|
char **newEntryWord;
|
|
uint8_t *configNameChar;
|
|
bool isLess;
|
|
uint32_t actionOffset;
|
|
int targetDevice;
|
|
int *targetDeviceRef;
|
|
int *local_124;
|
|
int *deviceRef;
|
|
uint32_t actionId;
|
|
char *newEntry [65];
|
|
uint32_t local_14;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
char *local_8;
|
|
uint32_t binding;
|
|
uint8_t ch;
|
|
|
|
local_8 = GHIDRA_CAST<char *>(0xffffffff);
|
|
puStack_c = &LAB_00b0235b;
|
|
local_10 = ExceptionList;
|
|
uVar3 = __security_cookie ^ GHIDRA_UINT((newEntry + 0x45));
|
|
ExceptionList = &local_10;
|
|
local_14 = uVar3;
|
|
(GHIDRA_CAST<InputManager *>((&PTR_vftable_00c57b18)))->InputManager::get_device(&local_124,deviceId);
|
|
local_8 = GHIDRA_CAST<char *>(0x0);
|
|
if (local_124 != GHIDRA_CAST<int *>(0x0)) {
|
|
iVar4 = __RTDynamicCast(local_124,0,&KAGE::Input::InputDeviceBase::RTTI_Type_Descriptor,
|
|
&IsaacRepentancePlus::NetInputDevice::RTTI_Type_Descriptor,0,uVar3);
|
|
if (iVar4 == 0) {
|
|
puVar8 = *GHIDRA_CAST<uint32_t **>(this);
|
|
if (puVar8 != *GHIDRA_CAST<uint32_t **>((GHIDRA_CAST<char *>(this) + 4))) {
|
|
do {
|
|
configNameChar = GHIDRA_CAST<uint8_t *>(*puVar8);
|
|
deviceNameChar = GHIDRA_CAST<uint8_t *>((**(code **)(*local_124 + 0xc))());
|
|
do {
|
|
ch = *deviceNameChar;
|
|
isLess = ch < *configNameChar;
|
|
if (ch != *configNameChar) {
|
|
LAB_00835d40:
|
|
uVar3 = -GHIDRA_UINT(isLess) | 1;
|
|
goto LAB_00835d45;
|
|
}
|
|
if (ch == 0) break;
|
|
ch = deviceNameChar[1];
|
|
isLess = ch < configNameChar[1];
|
|
if (ch != configNameChar[1]) goto LAB_00835d40;
|
|
deviceNameChar = deviceNameChar + 2;
|
|
configNameChar = configNameChar + 2;
|
|
} while (ch != 0);
|
|
uVar3 = 0;
|
|
LAB_00835d45:
|
|
if (uVar3 == 0) {
|
|
(GHIDRA_CAST<InputManager *>((&PTR_vftable_00c57b18)))->InputManager::get_device(&targetDevice,deviceId);
|
|
local_8 = GHIDRA_CAST<char *>(CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),1));
|
|
if (targetDevice == 0) {
|
|
local_8 = GHIDRA_CAST<char *>(CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),2));
|
|
if (targetDeviceRef != GHIDRA_CAST<int *>(0x0)) {
|
|
cVar2 = (**(code **)(*targetDeviceRef + 0xc))();
|
|
if ((cVar2 != '\0') && (g_inputDeviceRelease != (void *)0x0)) {
|
|
(*g_inputDeviceRelease)(&targetDevice);
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
actionId = 0;
|
|
actionOffset = 0;
|
|
puVar8 = puVar8 + 1;
|
|
do {
|
|
uVar3 = 0;
|
|
do {
|
|
iVar1 = targetDevice;
|
|
binding = *puVar8;
|
|
iVar4 = *GHIDRA_CAST<int *>((targetDevice + 0x10));
|
|
if (GHIDRA_UINT((*GHIDRA_CAST<int *>((targetDevice + 0x14)) - iVar4 >> 4)) <= actionId) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("ActionId is out of range\n"));
|
|
iVar4 = *GHIDRA_CAST<int *>((iVar1 + 0x10));
|
|
}
|
|
puVar8 = puVar8 + 1;
|
|
*GHIDRA_CAST<uint32_t *>((actionOffset + iVar4 + uVar3)) = binding;
|
|
uVar3 = uVar3 + 4;
|
|
} while (uVar3 < 8);
|
|
actionId = actionId + 1;
|
|
actionOffset = actionOffset + 0x10;
|
|
} while (actionOffset < 0x200);
|
|
local_8 = GHIDRA_CAST<char *>(CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),3));
|
|
if (targetDeviceRef != GHIDRA_CAST<int *>(0x0)) {
|
|
cVar2 = (**(code **)(*targetDeviceRef + 0xc))();
|
|
if ((cVar2 != '\0') && (g_inputDeviceRelease != (void *)0x0)) {
|
|
(*g_inputDeviceRelease)(&targetDevice);
|
|
}
|
|
}
|
|
}
|
|
goto LAB_00835f18;
|
|
}
|
|
puVar8 = puVar8 + 0x41;
|
|
} while (puVar8 != *GHIDRA_CAST<uint32_t **>((GHIDRA_CAST<char *>(this) + 4)));
|
|
}
|
|
newEntryWord = newEntry;
|
|
for (iVar4 = 0x40; newEntryWord = newEntryWord + 1, iVar4 != 0; iVar4 = iVar4 + -1) {
|
|
*newEntryWord = GHIDRA_CAST<char *>(0xffffffff);
|
|
}
|
|
pcVar5 = GHIDRA_CAST<char *>((**(code **)(*local_124 + 0xc))());
|
|
pcVar7 = pcVar5 + 1;
|
|
do {
|
|
cVar2 = *pcVar5;
|
|
pcVar5 = pcVar5 + 1;
|
|
} while (cVar2 != '\0');
|
|
pcVar5 = operator_new_tracked(GHIDRA_UINT((pcVar5 + (1 - GHIDRA_INT(pcVar7)))));
|
|
newEntry[0] = pcVar5;
|
|
pcVar6 = GHIDRA_CAST<char *>((**(code **)(*local_124 + 0xc))());
|
|
pcVar7 = pcVar6 + 1;
|
|
do {
|
|
cVar2 = *pcVar6;
|
|
pcVar6 = pcVar6 + 1;
|
|
} while (cVar2 != '\0');
|
|
pcVar6 = pcVar6 + (1 - GHIDRA_INT(pcVar7));
|
|
pcVar7 = GHIDRA_CAST<char *>((**(code **)(*local_124 + 0xc))());
|
|
strncpy(pcVar5,pcVar7,(size_t)pcVar6);
|
|
FUN_00835ba0(deviceId);
|
|
puVar8 = *GHIDRA_CAST<uint32_t **>((GHIDRA_CAST<char *>(this) + 4));
|
|
if (puVar8 == *GHIDRA_CAST<uint32_t **>((GHIDRA_CAST<char *>(this) + 8))) {
|
|
FUN_008367e0(puVar8,newEntry);
|
|
}
|
|
else {
|
|
newEntryWord = newEntry;
|
|
for (iVar4 = 0x41; iVar4 != 0; iVar4 = iVar4 + -1) {
|
|
*puVar8 = *newEntryWord;
|
|
newEntryWord = newEntryWord + 1;
|
|
puVar8 = puVar8 + 1;
|
|
}
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) + 0x104;
|
|
}
|
|
}
|
|
}
|
|
LAB_00835f18:
|
|
local_8 = GHIDRA_CAST<char *>(0x4);
|
|
if (deviceRef != GHIDRA_CAST<int *>(0x0)) {
|
|
cVar2 = (**(code **)(*deviceRef + 0xc))();
|
|
if ((cVar2 != '\0') && (g_inputDeviceRelease != (void *)0x0)) {
|
|
(*g_inputDeviceRelease)(&local_124);
|
|
}
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|