Files
isaac-port/generated-src/input_manager.cpp
T
shweetandClaude Opus 5.5 b85591bdf4 Curation round 7: Game::Start, level generation, Room, Camera, the Entity hierarchy, Entity_Player, the run frame
Six agents took over Game::Start, Level::SetNextStage, BossPool, save_game_state, level generation to the first room
(place_special_rooms, RoomDescriptor, load_room), Room, Camera, Entity/EntityList/EntityRef with a curated skeleton of
every Entity_* subclass, Entity_Player, Game::Render, Manager::Update's run branch, RoomTransition, ItemInfoHUD and
StatHUD. Integration wrote FirstTrinketOwner and room_shape_get_door_grid_index (checked against the decompile for
every shape and slot) and folded the duplicated constants. A run now generates its floor, loads the start room and
draws the HUD (under gdb); Isaac renders correctly when drawn, the room itself waits for Room::Render.
2479 functions taken over.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 05:33:11 -05:00

165 lines
5.9 KiB
C++

#include "classes.h"
// 0090ac70
void * InputManager::GetDeviceByPlayerEntity(Entity_Player *player)
{
void *pvVar1;
uint32_t uVar2;
int *playerCursor;
Entity_Player *mainTwin;
int *piVar3;
uint32_t uVar4;
int extraout_ECX;
Entity_Player *devicePlayer;
uint32_t uVar5;
uint32_t deviceIdx;
int *deviceCursor;
int deviceId;
if (player == GHIDRA_CAST<Entity_Player *>(0x0)) {
KAGE_LogMessage(8,GHIDRA_CAST<uint8_t *>("[Frame %d] GetDeviceByPlayerEntity() given NULL player entity \n"));
return (void *)0x0;
}
deviceCursor = *GHIDRA_CAST<int **>(this);
deviceIdx = 0;
uVar2 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) - GHIDRA_INT(deviceCursor) >> 2;
if (uVar2 != 0) {
piVar3 = (g_game->_playerManager)._playerList._begin;
uVar5 = GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT(piVar3) >> 2;
do {
pvVar1 = (void *)*deviceCursor;
uVar4 = 0;
deviceId = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0xc));
if (uVar5 != 0) {
playerCursor = piVar3;
do {
devicePlayer = GHIDRA_CAST<Entity_Player *>(*playerCursor);
if (devicePlayer->_controllerIndex == deviceId) goto LAB_0090ad07;
uVar4 = uVar4 + 1;
playerCursor = playerCursor + 1;
} while (uVar4 < uVar5);
}
devicePlayer = GHIDRA_CAST<Entity_Player *>(0x0);
LAB_0090ad07:
mainTwin = Entity_Player::GetMainTwin(player);
if ((devicePlayer == mainTwin) || (deviceId == *GHIDRA_CAST<int *>((extraout_ECX + 0x1618)))) {
return pvVar1;
}
deviceIdx = deviceIdx + 1;
deviceCursor = deviceCursor + 1;
} while (deviceIdx < uVar2);
}
KAGE_LogMessage(8,(uint8_t *)
"[Frame %d] GetDeviceByPlayerEntity() cannot find device for the given player entity \n "
);
KAGE_LogMessage(8,GHIDRA_CAST<uint8_t *>("----------------------------------------------------------- \n "));
KAGE_LogMessage(8,GHIDRA_CAST<uint8_t *>("playerEntity PlayerType: %d, Device ID: %d \n "));
KAGE_LogMessage(8,GHIDRA_CAST<uint8_t *>("Device List: \n "));
uVar2 = 0;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) - *GHIDRA_CAST<int *>(this) >> 2 == 0) {
LAB_0090ae59:
KAGE_LogMessage(8,GHIDRA_CAST<uint8_t *>("----------------------------------------------------------- \n"));
return (void *)0x0;
}
LAB_0090ada1:
KAGE_LogMessage(8,GHIDRA_CAST<uint8_t *>(" - UserID(%llu), DeviceID(%d), SourceDeviceID(%d) \n "));
uVar5 = 0;
deviceId = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(this) + uVar2 * 4)) + 0xc));
piVar3 = (g_game->_playerManager)._playerList._begin;
uVar4 = GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT(piVar3) >> 2;
if (uVar4 != 0) {
do {
if (*GHIDRA_CAST<int *>((piVar3[uVar5] + 0x1618)) == deviceId) {
if (piVar3[uVar5] != 0) {
uVar5 = 0;
goto LAB_0090ae80;
}
break;
}
uVar5 = uVar5 + 1;
} while (uVar5 < uVar4);
}
KAGE_LogMessage(8,GHIDRA_CAST<uint8_t *>(" - Device is not associated with a player entity!!! \n "));
goto LAB_0090ae42;
while( true ) {
uVar5 = uVar5 + 1;
piVar3 = piVar3 + 1;
if (uVar4 <= uVar5) break;
LAB_0090ae80:
if (*GHIDRA_CAST<int *>((*piVar3 + 0x1618)) == deviceId) break;
}
KAGE_LogMessage(8,GHIDRA_CAST<uint8_t *>(" - Device\'s Player Type: %d \n "));
LAB_0090ae42:
uVar2 = uVar2 + 1;
if (GHIDRA_UINT((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) - *GHIDRA_CAST<int *>(this) >> 2)) <= uVar2) goto LAB_0090ae59;
goto LAB_0090ada1;
}
// 0090aeb0
int InputManager::FirstLocalDeviceID()
{
char isLocal;
int iVar1;
uint32_t slotIndex;
slotIndex = 0;
iVar1 = *GHIDRA_CAST<int *>(this);
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) - iVar1 >> 2 != 0) {
do {
iVar1 = *GHIDRA_CAST<int *>((iVar1 + slotIndex * 4));
isLocal = (**(code **)(*GHIDRA_CAST<int *>((iVar1 + 0x370)) + 0x14))();
if (isLocal != '\0') {
iVar1 = *GHIDRA_CAST<int *>((iVar1 + 0x378));
if (iVar1 == 0) {
return -1;
}
return *GHIDRA_CAST<int *>((iVar1 + 0xc));
}
slotIndex = slotIndex + 1;
iVar1 = *GHIDRA_CAST<int *>(this);
} while (slotIndex < GHIDRA_UINT((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) - iVar1 >> 2)));
}
KAGE_LogMessage(8,(uint8_t *)
"[Frame %d] FirstLocalDeviceID() Could not find a device for the local user! \n "
);
return -1;
}
// 009562d0
float InputManager::GetActionValue(int action, int controllerIndex, Entity *entity, int unused)
{
char isNetplayHandled;
uint32_t in_ECX;
int iVar1;
uint32_t deviceIndex;
long double value;
Manager *manager;
int requestedAction;
requestedAction = action;
manager = g_manager;
if (((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((g_manager)) + 0x8)))) != 2) || (g_luaEngine == (void *)0x0)) ||
(isNetplayHandled = FUN_00864d80(entity,in_ECX,action,&action), isNetplayHandled == '\0')) {
iVar1 = manager->_netplayManager;
if ((iVar1 != *GHIDRA_CAST<int *>((manager + 1))) && (controllerIndex == -1)) {
deviceIndex = 0;
if (*GHIDRA_CAST<int *>((manager + 1)) - iVar1 >> 2 != 0) {
do {
action = *GHIDRA_CAST<uint32_t *>((**GHIDRA_CAST<int **>((iVar1 + deviceIndex * 4)) + 0x38));
value = (long double)(*(code *)action)(requestedAction);
if ((float)value != 0.0) {
return (float)value;
}
deviceIndex = deviceIndex + 1;
iVar1 = manager->_netplayManager;
} while (deviceIndex < GHIDRA_UINT((*GHIDRA_CAST<int *>((manager + 1)) - iVar1 >> 2)));
}
return 0.0;
}
entity = GHIDRA_CAST<Entity *>(requestedAction);
action = 0;
(**(code **)(PTR_vftable_00c57b18 + 0x74))(controllerIndex,FUN_00a20ab0,&entity,&action,0);
}
return (float)action;
}