Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BozoEngine
Submodule BozoEngine updated 74 files
+12 −1 docs/native-irx.md
+108 −0 docs/save-states.md
+6 −0 docs/specs/kernel.md
+7 −2 docs/specs/libraries.md
+16 −1 recompiler/src/emitter.cpp
+3 −0 recompiler/src/emitter.h
+5 −2 recompiler/src/main.cpp
+4 −0 runtime/CMakeLists.txt
+114 −1 runtime/app/panel.cpp
+12 −1 runtime/app/window.cpp
+66 −0 runtime/audio/audio_state.cpp
+17 −1 runtime/audio/libsd.cpp
+13 −0 runtime/core/runtime_core.cpp
+122 −0 runtime/core/state.cpp
+54 −1 runtime/ee/dispatcher.cpp
+87 −0 runtime/ee/kernel.cpp
+162 −0 runtime/host/free_host.cpp
+8 −0 runtime/include/bozo/app/panel.h
+12 −0 runtime/include/bozo/app/window.h
+3 −1 runtime/include/bozo/audio/libsd.h
+8 −0 runtime/include/bozo/audio/mixer.h
+18 −2 runtime/include/bozo/ee/dispatcher.h
+27 −1 runtime/include/bozo/ee/kernel.h
+29 −0 runtime/include/bozo/host/free_host.h
+11 −0 runtime/include/bozo/libs/cd.h
+70 −4 runtime/include/bozo/libs/libraries.h
+7 −1 runtime/include/bozo/libs/mc.h
+21 −0 runtime/include/bozo/libs/mpeg.h
+7 −0 runtime/include/bozo/libs/pad.h
+7 −0 runtime/include/bozo/libs/sif.h
+8 −0 runtime/include/bozo/libs/snd.h
+2 −0 runtime/include/bozo/libs/snd989.h
+11 −0 runtime/include/bozo/native/compiled_libraries.h
+38 −0 runtime/include/bozo/ops_mmi.h
+9 −0 runtime/include/bozo/port.h
+1 −0 runtime/include/bozo/render/mesh_draw.h
+4 −0 runtime/include/bozo/render/mesh_pack.h
+18 −3 runtime/include/bozo/render/renderer.h
+11 −1 runtime/include/bozo/runtime.h
+234 −0 runtime/include/bozo/state.h
+42 −14 runtime/libs/cd.cpp
+13 −1 runtime/libs/libm.cpp
+99 −5 runtime/libs/libraries.cpp
+201 −0 runtime/libs/libraries_state.cpp
+56 −8 runtime/libs/mc.cpp
+114 −32 runtime/libs/mpeg.cpp
+195 −0 runtime/libs/pad2.cpp
+1 −1 runtime/libs/sif.cpp
+292 −0 runtime/libs/snd989.cpp
+42 −31 runtime/libs/timer.cpp
+444 −27 runtime/native/compiled_libraries.cpp
+2 −0 runtime/render/mesh_draw.cpp
+12 −0 runtime/render/mesh_pack.cpp
+46 −5 runtime/render/present_gl.cpp
+14 −0 runtime/render/renderer.cpp
+37 −0 tests/CMakeLists.txt
+75 −0 tests/audio/audio_tests.cpp
+3 −0 tests/instr/asm.h
+24 −0 tests/instr/cases.cpp
+12 −0 tests/libs/cd_callback_tests.cpp
+161 −0 tests/libs/libs_tests.cpp
+53 −0 tests/native/library_disc_commands_tests.cpp
+142 −0 tests/native/library_event_flags_tests.cpp
+61 −0 tests/native/library_heap_queries_tests.cpp
+89 −0 tests/native/library_sreg_tests.cpp
+7 −0 tests/native/test_irx.py
+57 −0 tests/native/test_overrides_take_jumps.py
+40 −1 tests/render/image_processing_gpu_tests.cpp
+6 −3 tests/render/image_processing_tests.cpp
+24 −0 tests/render/render_targets_tests.cpp
+211 −0 tests/runtime/state_tests.cpp
+27 −0 tests/runtime/syscall_tests.cpp
+21 −3 tools/native_irx/recompile.py
+2 −2 tools/native_irx/relocate.py
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ those comparisons from actual native play. [docs/RECOMP_NOTES.md](docs/RECOMP_NO
| Original heat haze enabled by default | ✅ |
| Multi-player split-screen, 2 to 4 players; frame-keyed scripts for unattended checks | ✅ |
| Settings (F2): controls, video, cheats; windowed / fullscreen / borderless | ✅ |
| Save states (F5 save, F7 load, ten slots; `--save-state` / `--load-state` for scripted runs) | ✅ |
| Higher internal resolution (2× by default; Video's render scale) | ✅ |
| Interpolated presentation above 60 Hz; rain, snow, flares and some trails still update at game rate | 🧪 |
| Every Challenge arena rechecked on BozoEngine | 🔧 |
Expand Down Expand Up @@ -402,6 +403,8 @@ use physical US positions:
|---|---|
| F2 | Settings: Controls (per-player buttons, sticks, triggers, mouse and sensitivity), Video (resolution, window mode, render scale, presentation frame rate and texture upscaling), Cheats. Controls save to `input.ini`; video saves to `video.ini`. |
| F3 | Toggle the frame-rate counter. |
| F5 / F7 | Save / load a save state in the current slot (`states/slot<n>.state` in the user folder). A state loads only into the build that wrote it; a save waits while a movie plays. |
| F6, Shift+F6 | Next / previous save-state slot (0-9); F2 → Save states lists them. |
| F11, Alt+Enter | Switch between the window and the last fullscreen mode. |
| F8 | Capture consecutive presents (the sequence settings below). |
| F9 | Start/stop a capture burst, ten captures per second. |
Expand Down
28 changes: 26 additions & 2 deletions bozo/tmb_headless.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@
//
// tmb-headless [--frames n] [--elf SCUS_971.01] [--iso image] [--pad-script [n=]file]... [--card-dir dir]
// [--out run.ref] [--report n] [--quiet] [--wav file [--wav-frames a-b]] [--no-sound]
// [--save-state file --save-state-at n] [--load-state file [--load-state-at n]] [--dump-ram file]
//
// --pad-script n=file: player n's frame-keyed script (1 when omitted; players 2-4 are the multitap's slots, as the
// reference's PS2X_PAD2_SCRIPT..PS2X_PAD4_SCRIPT).
//
// --wav: the sound the mixer made (48 kHz stereo, 16-bit), from game frame a to b (all of it by default); --no-sound:
// the mixer is not brought up at the frames' ends (as before milestone M3).
// --save-state / --load-state: BozoEngine's save states (BozoEngine/docs/save-states.md): the whole run written when n
// frames have ended, or loaded before the first frame (or when n frames have ended). --dump-ram: EE RAM at the run's end.
// Every --report frames (500 by default) and at the end: the frame, the EE clock, the function that waited for the
// frame's end (the game's loop: uiTitle_Main__Fv at the title), the Shell (the menus' object, gp - 0x4148) and the
// overrides that ran.
#include "tmb_host.h"
#include "tmb_port.h"
#include "tmb_state.h"

#include "bozo/app/determinism.h"
#include "bozo/audio/wav.h"
Expand All @@ -39,7 +43,7 @@ int main(int argc, char **argv)
bozo::host::FreeOptions opt;
opt.elf = BOZO_RUN_DEFAULT_ELF;
uint64_t report = 500;
std::string wavPath;
std::string wavPath, dumpRam;
uint64_t wavFrom = 0, wavTo = UINT64_MAX;
for (int k = 1; k < argc; ++k)
{
Expand Down Expand Up @@ -84,10 +88,21 @@ int main(int argc, char **argv)
}
else if (a == "--no-sound")
opt.sound = false;
else if (a == "--save-state")
opt.saveState = value();
else if (a == "--save-state-at")
opt.saveStateFrame = static_cast<uint32_t>(std::stoull(value()));
else if (a == "--load-state")
opt.loadState = value();
else if (a == "--load-state-at")
opt.loadStateFrame = static_cast<uint32_t>(std::stoull(value()));
else if (a == "--dump-ram")
dumpRam = value();
else
{
std::fprintf(stderr, "usage: tmb-headless [--frames n] [--elf path] [--iso image] [--pad-script [n=]file]... [--card-dir dir] "
"[--out run.ref] [--report n] [--print] [--quiet] [--wav file [--wav-frames a-b]] [--no-sound]\n");
"[--out run.ref] [--report n] [--print] [--quiet] [--wav file [--wav-frames a-b]] [--no-sound] "
"[--save-state file --save-state-at n] [--load-state file [--load-state-at n]] [--dump-ram file]\n");
return 2;
}
}
Expand Down Expand Up @@ -120,9 +135,12 @@ int main(int argc, char **argv)
return 2;
}

opt.gameTag = "SCUS-97101";
bozo::host::FreeHost host(opt);
host.onStateMessage = [](bool, const std::string &message) { std::printf("[state] %s\n", message.c_str()); };
bozo::ee::Dispatcher d(host);
tmb::scene::Binding scene(&d.runtime());
tmb::addStateSection(host, &d.runtime());
d.setFunctions(tmb_function_table, tmb_function_count, tmb_resume_table, tmb_resume_count);
std::string error;
if (!host.setUp(d, tmb_external_table, tmb_external_count, &registry, error))
Expand Down Expand Up @@ -196,6 +214,12 @@ int main(int argc, char **argv)
};
}
const uint64_t frames = host.run();
if (!dumpRam.empty())
if (FILE *f = std::fopen(dumpRam.c_str(), "wb"))
{
std::fwrite(d.runtime().memory.ram(), 1, 0x2000000u, f);
std::fclose(f);
}
if (wav.isOpen())
{
std::printf("wav: %s, %.1f s of sound\n", wavPath.c_str(), wav.frames() / 48000.0);
Expand Down
Loading
Loading