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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ under "Unreleased" as they land, then move them under the new version's heading
AND SAVE writes `video.ini`), **Cheats** (unlock everything, infinite health / ammo / energy, no AI, weak enemies;
at once) and **Save states** (the slot, LOAD, SAVE, as F5 / F7). Triangle or Circle goes back. The controls stay in
F2.
- **QUIT GAME** at the bottom of PC SETTINGS: Cross, then Cross again, ends the game and closes the window.
- **Widescreen (16:9)**, off by default: in F2's Video tab, PC SETTINGS → Video, or `widescreen = on` in `video.ini`
(`PS2X_WIDESCREEN=1`). In one-player and two-player matches the game draws a 16:9 picture: it shows more at the
sides (its own views made wider, culling and all), nothing is stretched, and the HUD keeps its shape. The menus,
movies and loading screens stay 4:3, centred, and three- and four-player split screens stay 4:3.

## [0.6.0] - 2026-11-11

Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ those comparisons from actual native play. [docs/RECOMP_NOTES.md](docs/RECOMP_NO
| Multi-player split-screen, 2 to 4 players; frame-keyed scripts for unattended checks | ✅ |
| Settings (F2): controls, video, cheats; windowed / fullscreen / borderless | ✅ |
| PC SETTINGS in the game's Options screen: video, cheats and save states with the pad | ✅ |
| Widescreen 16:9 in one- and two-player matches (more at the sides, HUD unstretched; menus stay 4:3) | ✅ |
| 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 | 🧪 |
Expand Down Expand Up @@ -402,7 +403,7 @@ use physical US positions:

| Key | What it does |
|---|---|
| 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`. |
| F2 | Settings: Controls (per-player buttons, sticks, triggers, mouse and sensitivity), Video (resolution, window mode, render scale, presentation frame rate, texture upscaling and widescreen), 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. |
Expand All @@ -412,7 +413,12 @@ use physical US positions:

In the game, **Options → PC SETTINGS** (the last line, under the memory card lines) has the same Video, Cheats and
Save states with the pad: Up / Down to choose, Left / Right to change, Cross to open or act (Video's APPLY AND SAVE,
Save states' LOAD and SAVE), Triangle or Circle to go back. The controls are rebound in F2.
Save states' LOAD and SAVE), Triangle or Circle to go back. The controls are rebound in F2. **QUIT GAME** at the
bottom of PC SETTINGS closes the game (press Cross twice).

**Widescreen** (Video: Widescreen, off by default; `widescreen = on` in `video.ini`, `PS2X_WIDESCREEN=1`): one- and
two-player matches are drawn 16:9, showing more at the sides with nothing stretched. Menus, movies, loading screens
and three- or four-player split screens stay 4:3.

The picture stays 4:3 inside the window. Video can present at game rate, a fixed higher rate, or the monitor's rate
with interpolation; the game itself keeps its 60 Hz timing. Interpolation adds about one game frame of latency and
Expand Down
4 changes: 4 additions & 0 deletions bozo/tmb_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ int main(int argc, char **argv)
host.requestLoad(bozo::app::stateSlotPath(slot));
return true;
};
menuHooks.quit = [&] { host.requestStop(); };
menuHooks.widescreen = [] { return bozo::app::video::shared().applied.widescreen; };
menuHooks.setPictureAspect = [](float aspect) { bozo::app::setPictureAspect(aspect); };
bozo::app::video::offerWidescreen(true); // runtime/tmb_widescreen.cpp
tmb::menu::setHooks(std::move(menuHooks));
return bozo::app::runWindow(window, game, &pad);
}
13 changes: 9 additions & 4 deletions runtime/tmb_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ namespace tmb::native
bool enabled();
}

namespace tmb::widescreen
{
float screenWidth();
}

namespace tmb::textures
{
std::shared_ptr<const bozo::render::Texture> font();
Expand Down Expand Up @@ -752,7 +757,7 @@ namespace tmb::twod
const uint32_t def = word(rdram, kViews + 4u);
const float width = half(rdram, def + 8u), height = half(rdram, def + 0xau);
bozo::render::Screen screen;
screen.width = width > 0.0f ? width : 640.0f;
screen.width = std::max(width > 0.0f ? width : 640.0f, tmb::widescreen::screenWidth()); // widescreen: the bar centred
screen.height = height > 0.0f ? height : 448.0f;
screen.originX = 2048.0f - screen.width * 0.5f;
screen.originY = 2048.0f - screen.height * 0.5f;
Expand Down Expand Up @@ -902,13 +907,13 @@ namespace tmb::twod
return false;
constexpr float kFrameHeight = 448.0f;
bozo::render::Screen screen;
screen.originX = 2048.0f - 320.0f;
screen.width = tmb::widescreen::screenWidth(); // widescreen: the picture centred in its 640
screen.originX = 2048.0f - screen.width * 0.5f;
screen.originY = 2048.0f - kFrameHeight * 0.5f;
screen.width = 640.0f;
screen.height = kFrameHeight;
const float width = static_cast<float>(picture->width), height = static_cast<float>(picture->height);
if (!tmb::native::menusDrawn())
bozo::render::Renderer::instance().setBackdrop(std::move(picture), screen, screen.originX + (640.0f - width) * 0.5f,
bozo::render::Renderer::instance().setBackdrop(std::move(picture), screen, 2048.0f - 320.0f + (640.0f - width) * 0.5f,
screen.originY + (kFrameHeight - height) * 0.5f, width, height);
return true;
}
Expand Down
32 changes: 30 additions & 2 deletions runtime/tmb_menu.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// PC SETTINGS in the game's own Options screen: a ninth line under the game's eight, and behind it pages drawn with the
// game's font and steered with the pad, for what the settings window (F2) offers besides the controls: Video (the
// window's settings, applied and saved to video.ini), Cheats (runtime/tmb_cheats.cpp's switches, at once) and Save
// states (the slot, load, save). The controls stay in F2.
// window's settings, applied and saved to video.ini; widescreen: runtime/tmb_widescreen.cpp), Cheats
// (runtime/tmb_cheats.cpp's switches, at once) and Save states (the slot, load, save), and QUIT GAME (a second Cross
// ends the game). The controls stay in F2.
//
// The Options screen (uiOptions, 0x1911F0, screen 10 of uiMain's table; one call a frame), from its code:
// - Its cursor is options_main_line (0x4FB2F4), 0 to 7 (DIFFICULTY ... SAVE SETTINGS TO MEMORY CARD); options_subScreen
Expand Down Expand Up @@ -202,6 +203,7 @@ namespace tmb::menu
std::vector<std::pair<int, int>> resolutions;
int monitorRefresh = 0;
std::string status; // a line under the page: what Cross did
bool quitArmed = false; // QUIT GAME pressed once: a second Cross quits
} g_menu;

std::string upper(std::string s)
Expand Down Expand Up @@ -279,6 +281,7 @@ namespace tmb::menu
VUpscale,
VFilter,
VPack,
VWide,
VPause,
VFast,
VApply,
Expand All @@ -300,6 +303,7 @@ namespace tmb::menu
rows[VFilter] = {"UPSCALING FILTER", v.textureUpscale.filter == bozo::render::UpscaleFilter::Smooth ? "SMOOTH" : "EDGE"};
const bool pack = h.texturePackFolder && !h.texturePackFolder(packOn(v.texturePack) ? v.texturePack : "").empty();
rows[VPack] = {"TEXTURE PACK", pack ? onOff(packOn(v.texturePack)) : "NONE"};
rows[VWide] = {"WIDESCREEN", onOff(v.widescreen)};
rows[VPause] = {"PAUSE IN BACKGROUND", onOff(v.pauseInBackground)};
rows[VFast] = {"FAST FORWARD", v.fastForward == 0 ? "UNLIMITED" : timesText(v.fastForward / 100)};
rows[VApply] = {"APPLY AND SAVE", ""};
Expand Down Expand Up @@ -353,6 +357,7 @@ namespace tmb::menu
v.texturePack = packOn(v.texturePack) ? "off" : s_lastOn;
return true;
}
case VWide: v.widescreen = !v.widescreen; return true;
case VPause: v.pauseInBackground = !v.pauseInBackground; return true;
case VFast: v.fastForward = step(kFastForwards, v.fastForward, delta); return true;
default: return false;
Expand Down Expand Up @@ -479,6 +484,8 @@ namespace tmb::menu
std::vector<Row> rows;
for (const Page p : topPages(h))
rows.push_back({pageName(p), ""});
if (h.quit)
rows.push_back({m.quitArmed ? "QUIT GAME: PRESS X AGAIN" : "QUIT GAME", ""});
return rows;
}
case Page::Video: return videoRows(m, h);
Expand All @@ -505,6 +512,7 @@ namespace tmb::menu
m.page = page;
m.line = 0;
m.status.clear();
m.quitArmed = false;
if (page == Page::Video && h.videoShared)
{
const bozo::app::video::Shared s = h.videoShared();
Expand All @@ -528,6 +536,13 @@ namespace tmb::menu

if (pressed(kTriangle) || pressed(kCircle))
{
if (m.quitArmed)
{
m.quitArmed = false; // Back only disarms QUIT GAME
g.sound(kSoundBack);
rows = rowsOf(m, h);
goto draw;
}
g.sound(kSoundBack);
if (m.page == Page::Top)
{
Expand All @@ -543,6 +558,7 @@ namespace tmb::menu
else if (pressed(kUp) || pressed(kDown))
{
m.line = nextLine(rows, m.line, pressed(kUp) ? -1 : 1);
m.quitArmed = false;
g.sound(pressed(kUp) ? kSoundUp : kSoundDown);
m.status.clear();
}
Expand Down Expand Up @@ -577,6 +593,15 @@ namespace tmb::menu
open(m, pages[static_cast<size_t>(m.line)], h);
rows = rowsOf(m, h);
}
else if (h.quit && m.line == static_cast<int>(pages.size()))
{
// QUIT GAME: a second Cross ends the game (the window closes, as closing it does).
g.sound(kSoundAccept);
if (m.quitArmed)
h.quit();
m.quitArmed = !m.quitArmed;
rows = rowsOf(m, h);
}
}
else if (m.page == Page::Video && m.line == VApply && h.videoApply)
{
Expand All @@ -602,6 +627,7 @@ namespace tmb::menu
}
}

draw:
// The page's sliders hidden, as the game's controls page hides them (uiOptions shows them again on its page).
g.call(&blankSliders__Fi_0x19de38, kBlankSliders, {0u});
// Drawn: the title, then each line (the selected one larger and brighter, as the game's), its value to the right.
Expand Down Expand Up @@ -700,6 +726,8 @@ namespace tmb::menu
}
}

Hooks currentHooks() { return hooks(); }

void setHooks(Hooks h)
{
std::lock_guard lock(g_hooksMutex);
Expand Down
7 changes: 7 additions & 0 deletions runtime/tmb_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ namespace tmb::menu
std::function<void(int)> setStateSlot;
std::function<std::string(int)> slotSummary;
std::function<bool(int)> saveState, loadState;
// Ends the game (the window closes): QUIT GAME, confirmed by a second Cross.
std::function<void()> quit;
// Widescreen (runtime/tmb_widescreen.cpp): the setting applied now, and the window's picture shape (0 the
// default 4:3, 16:9 while a view is wide).
std::function<bool()> widescreen;
std::function<void(float)> setPictureAspect;
};
void setHooks(Hooks hooks);
Hooks currentHooks();

// A save state was loaded: the pages close (what they showed is gone).
void stateLoaded();
Expand Down
8 changes: 8 additions & 0 deletions runtime/tmb_native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
#include <cstdlib>
#include <cstring>

namespace tmb::widescreen
{
float screenWidth();
}

namespace tmb::twod
{
void publish();
Expand Down Expand Up @@ -112,6 +117,9 @@ namespace tmb::native
// A match draws fields (the frame's every other line), the shell's menus whole frames.
const float lines = menusNative() ? 2.0f : 1.0f;
screen.originY = 2048.0f - 112.0f * lines; // NTSC: a 640 x 224 field
// Widescreen: the views 853 wide about the same centre (runtime/tmb_widescreen.cpp).
screen.width = tmb::widescreen::screenWidth();
screen.originX = 2048.0f - screen.width * 0.5f;
screen.height = 224.0f * lines;
// GS Z is z / w itself (the microprograms write FTOI4 of z / w into XYZF2's 24-bit Z, that word over 16).
screen.gsZScale = 1.0f;
Expand Down
7 changes: 7 additions & 0 deletions runtime/tmb_overrides.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ namespace tmb::menu
void install(tmb::Registry &runtime);
}

namespace tmb::widescreen
{
void update(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime, bool match);
}

namespace tmb::meshes
{
void install(tmb::Registry &runtime);
Expand Down Expand Up @@ -501,6 +506,7 @@ namespace
g_lastMatchFrameNoted.store(hitchClock(), std::memory_order_relaxed);
tmb::cheats::onFrame(rdram); // the Cheats tab (runtime/tmb_cheats.cpp)
const uint32_t gp = getRegU32(ctx, 28);
tmb::widescreen::update(rdram, ctx, runtime, true); // widescreen: the match's views (runtime/tmb_widescreen.cpp)
tmb::native::onFrameEnd(); // TMB_NATIVE: publish the frame's native draws
timerEndOfRealTimeProcessing__Fv_0x1f67f0(rdram, ctx, runtime);
int32_t *frameTicks = reinterpret_cast<int32_t *>(rdram + ((gp + kFrameTicksGpOffset) & 0x1FFFFFFu));
Expand Down Expand Up @@ -550,6 +556,7 @@ namespace
{
g_pacer.setCap(static_cast<uint32_t>(fieldRate(rdram, gp)));
g_pacer.setPaced(bozo::port::realTime(runtime)); // a headless or checked run is not held to real time
tmb::widescreen::update(rdram, ctx, runtime, false); // the window's picture shape as the views are now
tmb::native::onMenuFrameEnd(); // TMB_NATIVE: publishes a menu frame's native draws (not in a match)
const double step = g_pacer.frameEnd();
tmb::cheats::logProgress(rdram, gp); // TMB_LOG_PROGRESS
Expand Down
Loading
Loading