Curation round 5: Game construction, FXLayers, PlayerManager, the menus; the main menu renders

Eight agents took over ScoreSheet, DeathmatchManager, giantbook and boss overlays, FXLayers, PlayerManager, the menu
manager with the save and prompt flow, twelve menus (character wheel, options, challenges, daily (offline), special
seeds, leaderboard (local), collection, bestiary, stats, controller select, key config, cutscenes), console text input
and gamepad hot-plug through platform listeners. Integration moved input to device ids.
KAGE's projection matrix now reaches the 'ProjectionMatrix' uniform the basic shaders from afterbirthp.a declare, as
well as the exe's 'Transform', which takes the color-mod and HQ4X passes from black to correct output.
Under gdb with stubs skipped, the intro, title, file select, main menu and character wheel render as in the game.
1330 functions taken over, boot path 261/615. build/isaac stops at OnlineEmotes::init in Game::LoadConfigXmls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-11-20 02:59:23 -05:00
1 parent fd8b965350
commit 233d5123e8
128 files changed
+10194 -36967

No files matched your search

+114
View File
@@ -0,0 +1,114 @@
#include "menu_controller_select.h"
#include "kage_input.h"
#include "manager.h"
#include "menu_manager.h"
constexpr const char* CONTROLLER_SELECT_ANM2 = "gfx/ui/main menu/ControllerSelectMenu.anm2";
constexpr std::string_view NAME_ELLIPSIS = "..";
constexpr size_t NAME_MAX_LENGTH = 18;
constexpr size_t NAME_CUT_LENGTH = 16;
constexpr size_t ENTRY_LIMIT = 6;
constexpr int CURSOR_LAYER = 2;
constexpr int LANGUAGE_ENGLISH = 0;
constexpr float LIST_X = 265;
constexpr float LIST_Y = 60;
constexpr float ROW_HEIGHT = 20;
constexpr float ROW_SLANT = 4;
constexpr uint32_t TEXT_ARGB = 0xff362f2d;
// Loads the menu, playing, and resets it, at its place on the menu sheet. Inlined in MenuManager::Init.
void Menu_ControllerSelect::Init(Vector menuPosition)
{
LoadGraphics();
reset();
position = menuPosition;
}
// Loads the menu again, playing. Inlined in MenuManager::LoadGraphics.
void Menu_ControllerSelect::LoadGraphics()
{
controllerSelectSprite.Load(CONTROLLER_SELECT_ANM2, GRAPHICS_LOAD);
controllerSelectSprite.Play(ANIMATION_IDLE);
}
// 008c9dd0 Puts the cursor on the first device of an empty list.
void Menu_ControllerSelect::reset()
{
selectedElement = 0;
entries.clear();
holdInputTimer = 0;
}
// Lists the first six devices, each name cut to 16 characters and an ellipsis when it is longer than 18.
void Menu_ControllerSelect::entries_load()
{
KAGE::Input::Manager& input = KAGE::Input::manager;
entries.clear();
for (int i = 0; i < input.get_device_count() && entries.size() < ENTRY_LIMIT; i++)
{
std::shared_ptr<KAGE::Input::InputDevice> device = input.get_device(i);
if (!device) continue;
std::string name = device->name;
if (name.size() > NAME_MAX_LENGTH) name = name.substr(0, NAME_CUT_LENGTH).append(NAME_ELLIPSIS);
entries.push_back({name, device->id});
}
}
// 008c9530 Steps the menu and lists the devices, keeping the cursor on the list. Confirm binds the selected device's
// keys with the hotkeys off, back leaves, and up and down move the cursor, wrapping and repeating while held.
// The original reads before an empty list on confirm. Confirm does nothing then.
void Menu_ControllerSelect::Update()
{
controllerSelectSprite.Update();
entries_load();
int count = (int)entries.size();
if ((size_t)selectedElement >= entries.size()) selectedElement = count - 1;
if (is_action(ACTION_MENU_CONFIRM, ACTION_TRIGGERED))
{
if (count == 0) return;
g_menuControllerIndex = entries[selectedElement].deviceId;
g_menuManager->push_menu(MENU_KEY_CONFIG);
g_manager->isHotkeysEnabled = false;
}
else if (is_action(ACTION_MENU_BACK, ACTION_TRIGGERED)) g_menuManager->pop_menu();
else if (is_action(ACTION_MENU_DOWN, ACTION_PRESSED))
{
if (is_key_repeat(holdInputTimer) && ++selectedElement >= count) selectedElement = 0;
}
else if (is_action(ACTION_MENU_UP, ACTION_PRESSED))
{
if (is_key_repeat(holdInputTimer) && --selectedElement < 0) selectedElement = count - 1;
}
bool isHeld = is_action(ACTION_MENU_UP, ACTION_PRESSED) || is_action(ACTION_MENU_DOWN, ACTION_PRESSED);
holdInputTimer = isHeld ? holdInputTimer + 1 : 0;
}
// 008c99b0 Draws the menu without its cursor, the device names down a slant, then the cursor by the selected one.
// Untranslated text uses the smaller font.
void Menu_ControllerSelect::Render()
{
SpriteDraw draw = g_menuManager->menu_draw_get(position);
Font& font = g_manager->stringTable.language == LANGUAGE_ENGLISH ? g_manager->font1_TeamMeatEx10
: g_manager->font2_TeamMeatEx12;
controllerSelectSprite.GetLayer(CURSOR_LAYER)->isVisible = false;
controllerSelectSprite.Render(draw);
for (size_t row = 0; row < entries.size(); row++)
{
FontSettings settings;
Vector textPosition = vector_make(draw.position.x + LIST_X - (float)row * ROW_SLANT,
draw.position.y + LIST_Y + (float)row * ROW_HEIGHT);
font.DrawString(entries[row].name, textPosition, vector_make(1, 1), kcolor_argb(TEXT_ARGB), settings);
}
SpriteDraw cursor;
cursor.position = vector_make(draw.position.x - (float)selectedElement * ROW_SLANT,
draw.position.y + (float)selectedElement * ROW_HEIGHT);
controllerSelectSprite.GetLayer(CURSOR_LAYER)->isVisible = true;
controllerSelectSprite.RenderLayer(CURSOR_LAYER, cursor);
}