mirror of
https://github.com/TheBozos/TMB_Recomp.git
synced 2026-11-30 18:23:18 -10:00
A ninth line under the game's Options (after SAVE SETTINGS TO MEMORY CARD)
opens pages drawn with the game's own font and steered with the pad:
- Video: display mode, resolution, render scale, frame rate, anti-aliasing,
texture smoothing, upscaling and its filter, texture pack, pause in
background, fast forward; APPLY AND SAVE posts them to the window and
writes video.ini (bozo::app::video::post).
- Cheats: unlock everything, infinite health / ammo / energy (off, player 1,
all players), no AI, weak enemies; at once (tmb::cheats::values /
setValues, the F2 tab's switches).
- Save states: the slot, LOAD, SAVE (the host's requests, the slot's
picture through BozoEngine's captureStatePicture, as F5 / F7).
Triangle or Circle goes back; the controls stay in F2.
runtime/tmb_menu.cpp, from the game's code (uiOptions 0x1911F0):
- uiGetInput's override (for the Options page's call, 0x19128C) lets the
cursor (options_main_line) reach 8: every other use of the cursor is a
compare, so 8 selects none of the game's lines. Cross there opens the
pages instead of the game's accept-and-leave.
- uiOptions' override draws the line after the game's page and, while the
pages are open, draws them instead (the 3D shell stays the game's, its
sliders hidden by blankSliders as the controls page does).
- The game's font, sound and input functions run on a copy of the context
(BozoEngine kernel.md section 3b): guest code there never leaves the
override. Calling them on the thread's context let fontSpritePrint leave
at a checkpoint and return later into uiMain on the pages' stack.
- Only where the graphics are native (every free run); a save state's load
closes the pages.
BozoEngine at master 5d34d41 (#151's captureStatePicture, with the other
ports' merges since f93b5af).
Checked: the 11 native suites pass; the 1P (9,500) and 4P (8,500) replays
match main 89d5306 on every recorded field, RAM image and sound, before and
after the engine move; the pinned boot and match1p checks match (match1p
16000/16000 frames). Hidden window runs: the line, Up from DIFFICULTY onto
it and Down off it, each page, render scale applied and saved, slot 0
saved (state and picture) and loaded, and 8,100 frames on the Video page
without a fault.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
54 lines
2.5 KiB
C++
54 lines
2.5 KiB
C++
// Save states: TMB's section (tmb_state.h). The engine saves the runtime, its libraries (989SND included) and the host;
|
|
// this adds what TMB keeps itself: what the game told its hooks once, the native renderer's retained records, and the
|
|
// overrides' own counters. Caches decoded from guest memory are dropped on a load.
|
|
#include "tmb_state.h"
|
|
|
|
#include "tmb_scene.h"
|
|
|
|
#include "bozo/host/free_host.h"
|
|
#include "bozo/state.h"
|
|
|
|
#include <string>
|
|
#include <type_traits>
|
|
|
|
namespace tmb
|
|
{
|
|
void overridesState(bozo::state::Archive &a); // tmb_overrides.cpp
|
|
namespace meshes { void state(bozo::state::Archive &); }
|
|
namespace textures { void state(bozo::state::Archive &); }
|
|
namespace particles { void state(bozo::state::Archive &); }
|
|
namespace cheats { void state(bozo::state::Archive &); }
|
|
namespace twod { void stateLoaded(); }
|
|
namespace menu { void stateLoaded(); }
|
|
|
|
void addStateSection(bozo::host::FreeHost &host, Runtime *runtime)
|
|
{
|
|
host.stateSections()->add({"tmb",
|
|
[runtime](bozo::state::Archive &a) {
|
|
overridesState(a);
|
|
// The native hierarchy's retained records (the frames, lights, renderer
|
|
// parameters the game's VU programs kept between draws).
|
|
static_assert(std::is_trivially_copyable_v<scene::Scene>);
|
|
a.begin("scene");
|
|
bozo::state::pod(a, scene::get(runtime));
|
|
a.end();
|
|
a.begin("meshes");
|
|
meshes::state(a);
|
|
a.end();
|
|
a.begin("textures");
|
|
textures::state(a);
|
|
a.end();
|
|
a.begin("particles");
|
|
particles::state(a);
|
|
a.end();
|
|
cheats::state(a);
|
|
if (a.loading())
|
|
{
|
|
twod::stateLoaded();
|
|
menu::stateLoaded();
|
|
}
|
|
},
|
|
[] { return std::string(); }});
|
|
}
|
|
}
|