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

+55 -31
View File
@@ -1,10 +1,11 @@
#include "menu_save.h"
#include "log.h"
#include <algorithm>
#include <cstdio>
#include <span>
#include "manager.h"
#include "menu_manager.h"
#include <algorithm>
#include <cstdio>
#include <filesystem>
#include <span>
constexpr const char* SAVE_MENU_ANM2 = "gfx/ui/main menu/SaveSelectMenu.anm2";
constexpr const char* DRAWING_ANM2 = "gfx/ui/main menu/SaveSelectMenu_Drawing.anm2";
@@ -31,14 +32,15 @@ constexpr int HEART_FIRST_LAYER = 2;
constexpr unsigned int HEART_PIECES = 11;
constexpr int PHOTO_FULL_PIECES = 5;
constexpr ColorMod DELETE_PICK_COLOR = {{1, 0.6f, 0.4f, 1}, {0, 0, 0, 0}, {0, 0, 0}};
constexpr int PROMPT_LINES = 5;
constexpr int PROMPT_YES = 1;
constexpr int BACKUP_DATE_FIRST = 20000000;
constexpr int BACKUP_DATE_LAST = 99999999;
constexpr int DATE_PART = 100;
constexpr int DATE_YEAR = 10000;
constexpr int DATE_LINE_SIZE = 100;
constexpr int BACKUP_DATE_LINE = 2;
constexpr const char* SHARED_SAVE_FILE = "sharedsave";
constexpr const char* SAVE_FILE_EXTENSION = ".dat";
constexpr const char* BACKUP_FOLDER = "save_backups/";
constexpr int ACHIEVEMENT_DEAD_GOD = 637;
constexpr int ACHIEVEMENT_STRANGE_DOOR = 635;
@@ -177,17 +179,6 @@ bool is_slot_complete()
return true;
}
// The prompt's internals: GenericPrompt is not taken over and classes.h holds its sprite and answer as bytes.
static bool is_prompt_animating(GenericPrompt&)
{
reconstruction_missing("Menu_Save::Update 009d9c60: GenericPrompt's sprite, read inline");
}
static int prompt_answer_get(GenericPrompt&)
{
reconstruction_missing("Menu_Save::Update 009d9c60: GenericPrompt's answer, read inline");
}
// 009d8ee0 Loads the menu, its delete button and confirmation, the prompt and the three file drawings, each still on
// its idle frame, at its place on the menu sheet.
void Menu_Save::Init(Vector menuPosition)
@@ -196,7 +187,7 @@ void Menu_Save::Init(Vector menuPosition)
deleteButtonSprite.Load(SAVE_MENU_ANM2, GRAPHICS_LOAD);
deletePopupSprite.Load(SAVE_MENU_ANM2, GRAPHICS_LOAD);
log_printf(LOG_INFO, "Menu_Save Pre Prompt init\n");
prompt.Initialize(0);
prompt.Initialize(PROMPT_LARGE);
log_printf(LOG_INFO, "Menu_Save loading slot drawings\n");
for (int i = 0; i < SAVE_SLOT_COUNT; i++)
{
@@ -215,7 +206,7 @@ void Menu_Save::LoadGraphics()
saveSelectMenuSprite.Load(SAVE_MENU_ANM2, GRAPHICS_LOAD);
deleteButtonSprite.Load(SAVE_MENU_ANM2, GRAPHICS_LOAD);
deletePopupSprite.Load(SAVE_MENU_ANM2, GRAPHICS_LOAD);
prompt.Initialize(0);
prompt.Initialize(PROMPT_LARGE);
for (ANM2& drawing : drawingSprites)
{
drawing.Load(DRAWING_ANM2, GRAPHICS_DEFER);
@@ -230,8 +221,8 @@ void Menu_Save::unload_graphics()
saveSelectMenuSprite.Reset();
deleteButtonSprite.Reset();
deletePopupSprite.Reset();
reconstruction_missing("Menu_Save::unload_graphics 009d92c0: GenericPrompt's sprite reset, inline");
prompt._isOnlineVote = false;
prompt.sprite.Reset();
prompt.isOnlineVote = false;
for (ANM2& drawing : drawingSprites) drawing.Reset();
}
@@ -263,7 +254,7 @@ void Menu_Save::Reset()
for (int i = 0; i < SAVE_SLOT_COUNT; i++)
{
g_manager->SetSaveSlot(SLOT_IDS[i]);
reconstruction_missing("Menu_Save::load_slot_data 00919980, the shared save merge of PersistentGameData");
load_slot_data();
slot_read(i);
}
update_save_drawings();
@@ -271,6 +262,20 @@ void Menu_Save::Reset()
g_manager->SetSaveSlot(current);
}
// 00919980 Merges the online progress shared into the current save file (sharedsave<slot>.dat) and loads the file
// again. Only online play writes that file, along with the flag this clears, so offline there is nothing to merge.
void Menu_Save::load_slot_data()
{
Manager& manager = *g_manager;
std::string path = platform.userDataDirectory + SHARED_SAVE_FILE + std::to_string(manager.currentSaveSlot) +
SAVE_FILE_EXTENSION;
std::error_code error;
if (std::filesystem::exists(path, error))
reconstruction_missing("Menu_Save::load_slot_data 00919980: merging an online shared save");
manager.SetSaveSlot(manager.currentSaveSlot);
}
// Reads a file's progress into its drawing, status and completion, the current save file being that file.
void Menu_Save::slot_read(int index)
{
@@ -341,8 +346,8 @@ void Menu_Save::select_slot(uint32_t slot)
std::snprintf(dateLine, sizeof(dateLine), lines[BACKUP_DATE_LINE].c_str(), month, day, year);
lines[BACKUP_DATE_LINE] = dateLine;
}
reconstruction_missing("Menu_Save::select_slot 009d98f0: GenericPrompt's five text lines, FUN_00838230");
prompt.Show(0);
prompt.SetText(lines);
prompt.Show(PROMPT_LOCAL);
state = SAVE_STATE_PROMPT;
}
@@ -361,19 +366,38 @@ void Menu_Save::selection_move(int step)
selectedSave = (selectedSave + step + SAVE_SLOT_COUNT) % SAVE_SLOT_COUNT;
}
// Loads the latest backup over the current save file and saves it there, as the file it replaces.
// Steam Cloud is offline.
void Menu_Save::backup_restore()
{
PersistentGameData& data = g_manager->persistentGameData;
std::string savePath = data.filePath;
data.Load(platform.userDataDirectory + BACKUP_FOLDER + std::to_string(backupDate) + "." + data.get_save_file_name());
data.isChangesMade = true;
data.filePath = savePath;
if (!data.isFileLoaded) return;
data.isChangesMade = false;
data.Save();
}
// Answers the corrupted file prompt once it closed: yes restores the latest backup, or starts the file over without
// one, then reads the file's drawing again.
// one (the original's helper clears and saves it), then reads the file's drawing again.
void Menu_Save::prompt_close()
{
Manager& manager = *g_manager;
if (is_prompt_animating(prompt) || state != SAVE_STATE_PROMPT) return;
if (prompt.IsActive() || state != SAVE_STATE_PROMPT) return;
state = SAVE_STATE_SELECT;
if (prompt_answer_get(prompt) != PROMPT_YES) return;
if (prompt.submittedSelection != PROMPT_ANSWER_YES) return;
if (backupDate < 1) FUN_00926460(1);
else if (backupDate >= BACKUP_DATE_FIRST && backupDate <= BACKUP_DATE_LAST)
reconstruction_missing("Menu_Save::Update 009d9c60: restoring a backup needs PersistentGameData's save path");
if (backupDate < 1)
{
manager.persistentGameData.Clear(CLEAR_ALL);
manager.persistentGameData.Save();
}
else if (backupDate >= BACKUP_DATE_FIRST && backupDate <= BACKUP_DATE_LAST) backup_restore();
ANM2& drawing = drawingSprites[manager.currentSaveSlot - 1];
replace_slot_graphics(drawing);
drawing.LoadGraphics();
@@ -438,14 +462,14 @@ void Menu_Save::Update()
{
if (state == SAVE_STATE_DELETE_CONFIRM) deletePopupSprite.Play(ANIMATION_CONFIRM_DISAPPEAR);
else if (state == SAVE_STATE_DELETE_PICK) state = SAVE_STATE_SELECT;
else if (state == SAVE_STATE_PROMPT) reconstruction_missing("GenericPrompt::Disappear 00838190 on Menu_Save::prompt");
else if (state == SAVE_STATE_PROMPT) prompt.Disappear();
else g_menuManager->pop_menu();
}
bool isHeld = is_action(ACTION_MENU_LEFT, ACTION_PRESSED) || is_action(ACTION_MENU_RIGHT, ACTION_PRESSED);
holdInputTimer = isHeld ? holdInputTimer + 1 : 0;
update_sprites();
prompt.Update(1);
prompt.Update(PROMPT_INPUT_READ);
prompt_close();
}