11 Commits
Author SHA1 Message Date
boubou666 02a590f184 Merge pull request #72 from TheBozos/release/v0.7.0
Release 0.7.0
2026-12-01 14:07:44 +01:00
Thomas MartinandClaude Opus 5.5 1234cf4f0f Release 0.7.0
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 14:04:45 +01:00
boubou666 8a9cf7781d Merge pull request #71 from TheBozos/dc/language
Game language: French, German, Italian from the disc's own translations
2026-12-01 14:02:54 +01:00
Thomas MartinandClaude Opus 5.5 767b3e9557 Options -> Language in the game
A Language entry in the game's own Options (between Travel and Quit
Game): English, Francais, Deutsch, Italiano, the one in use and the one
saved for the next start marked. Cross writes game.ini (as the launcher
does); the running game keeps its language until it starts again, since
part of its text is loaded once at boot. Without the game window
(headless) the page only says it needs it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 13:58:16 +01:00
Thomas MartinandClaude Opus 5.5 851b6244d7 Launcher: Game language beside Resolution, "Français" fixed
The row of its own pushed the Settings card past the window's bottom at
the default size; beside Resolution it costs no height. The label's
ç was written as two characters.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 13:35:54 +01:00
Thomas MartinandClaude Opus 5.5 95903df0c9 Add a game language setting: French, German, Italian
The USA disc also carries the European release's translations of the
text (message files <name>_<n>.mes) and menus (commenu/a_fre, a_ger,
a_ita), and the program still picks them by LanguageCode (0x2A1E88,
1 on the USA disc). The port sets it before the first frame from
--language en|fr|de|it or <user folder>/game.ini, which the launcher's
Settings -> Game language and RecompLauncher's Language write.

Spanish is not offered: the USA disc lacks 42 of its 90 story text
files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 13:32:55 +01:00
Thomas MartinandClaude Opus 5.5 6481ee4cb4 Engine fetch: the unpacked release's files dated now
cmake/bozo_engine_fetch.cmake unpacked the pinned BozoEngine release with the
archive's own file dates, older than objects already built. After a pin bump
Ninja then kept port objects compiled against the previous release's headers
(found in Shinobido_WOTN_Recomp, 0.7.0 -> 0.7.3: shino_gs_state.cpp and
shino_render.cpp stayed on the old renderer.h, the picture lost its objects and
HUD while the game state was identical). Every unpacked file is now touched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 12:31:22 +01:00
boubou666 112cf4152f Merge pull request #70 from TheBozos/release/v0.6.1
Release 0.6.1
2026-12-01 01:32:23 +01:00
Thomas MartinandClaude Opus 5.5 98b2b54de7 Release 0.6.1
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 01:28:39 +01:00
boubou666 538902b3c0 Merge pull request #69 from TheBozos/dc/game-log
Write the game's log and crash reports
2026-12-01 01:28:22 +01:00
Thomas MartinandClaude Opus 5.5 07ac1d561f Write the game's log and crash reports
dc_main.cpp now calls bozo::app::startLogging() and installCrashHandler()
after setIdentity, as TMB's window does. Neither ran before, so
<user folder>/logs (DC Launcher's "Open game logs", RecompLauncher's Logs
in recompdata) and crashes/ stayed empty. Found by Amplitude's session.

Checked: a hidden, muted 300-frame run with its own PS2X_USER_DIR writes
logs/DC_Recomp.log (83 lines: the header and all 82 lines it printed), and
the pipe still gets all 82; the port's suites pass (139/139).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 01:25:30 +01:00
17 changed files with 418 additions and 23 deletions

No files matched your search

+17
View File
@@ -1,5 +1,22 @@
# Changelog
## [0.7.0] - 2026-12-01
### Added
- Game language: French, German and Italian ([#64](https://github.com/TheBozos/DC_Recomp/issues/64)). The USA disc also carries the European release's translations of the text and menus, and the game picks them by a language code it still has; the port sets it when the game starts, from the launcher's **Settings → Game language**, the game's **Options → Language** (applied at the next start), RecompLauncher's **Language** (all three write `game.ini` in the user folder) or `--language en|fr|de|it`. Spanish is not offered: the USA disc lacks about half of its story text.
### Fixed
- Building after an update that moves to a newer BozoEngine release compiles the port's files again: the engine's unpacked files took the archive's old dates, so the build could keep files compiled against the previous engine.
### Known limits
- Some European texts are longer than the boxes the USA layout gives them and run past their edge (the name entry's help).
- The Italian text names Circle for confirming in places (the name entry's help and its Yes/No); Cross confirms, as in the USA game.
## [0.6.1] - 2026-12-01
### Fixed
- The game now writes its log (`logs\` in its user folder: `%APPDATA%\DC_Recomp`, or RecompLauncher's `recompdata`), so the launcher's **Open game logs** and RecompLauncher's **Logs** show it, and a crash leaves a report in `crashes\`. Until now the game started neither, so both stayed empty.
## [0.6.0] - 2026-12-01
### Added
+11 -3
View File
@@ -107,13 +107,15 @@ target_link_libraries(dc_cheats PUBLIC bozo_host)
add_library(dc_warp STATIC runtime/dc_warp.cpp)
target_link_libraries(dc_warp PUBLIC dc_cheats dc_pad bozo_host)
add_library(dc_ingame_cheats STATIC runtime/dc_ingame_cheats.cpp)
target_link_libraries(dc_ingame_cheats PUBLIC dc_cheats dc_warp bozo_host)
target_link_libraries(dc_ingame_cheats PUBLIC dc_cheats dc_warp dc_language bozo_host)
add_library(dc_pad STATIC runtime/dc_pad.cpp)
target_link_libraries(dc_pad PUBLIC bozo_host)
add_library(dc_language STATIC runtime/dc_language.cpp)
target_include_directories(dc_language PUBLIC ${CMAKE_SOURCE_DIR}/runtime)
add_library(dc_sound STATIC runtime/dc_sound.cpp)
target_link_libraries(dc_sound PUBLIC bozo_host)
add_executable(dc-headless runtime/dc_main.cpp runtime/dc_state.cpp runtime/dc_port.cpp runtime/dc_sound.cpp runtime/dc_native.cpp)
target_link_libraries(dc-headless PRIVATE dc_game bozo_host dc_cheats dc_ingame_cheats dc_warp dc_pad)
target_link_libraries(dc-headless PRIVATE dc_game bozo_host dc_cheats dc_ingame_cheats dc_warp dc_pad dc_language)
if(MINGW)
target_link_options(dc-headless PRIVATE -static)
endif()
@@ -148,7 +150,7 @@ add_dependencies(dc-headless dc_native_audio)
if(DC_WINDOW)
add_executable(dc runtime/dc_main.cpp runtime/dc_state.cpp runtime/dc_port.cpp runtime/dc_sound.cpp runtime/dc_native.cpp runtime/dc_audio.cpp runtime/dc_cheats_ui.cpp $<TARGET_OBJECTS:dc_audio_code>)
target_link_libraries(dc PRIVATE dc_game bozo_host bozo_app dc_cheats dc_ingame_cheats dc_warp dc_pad)
target_link_libraries(dc PRIVATE dc_game bozo_host bozo_app dc_cheats dc_ingame_cheats dc_warp dc_pad dc_language)
if(WIN32)
enable_language(RC)
string(REPLACE "." "," DC_FILEVERSION "${PROJECT_VERSION}.0")
@@ -215,6 +217,12 @@ if(DC_ENGINE_TESTS)
target_link_options(dc-pad-tests PRIVATE -static)
endif()
add_test(NAME dc_native_pad COMMAND dc-pad-tests)
add_executable(dc-language-tests tests/dc_language_tests.cpp)
target_link_libraries(dc-language-tests PRIVATE dc_language)
if(MINGW)
target_link_options(dc-language-tests PRIVATE -static)
endif()
add_test(NAME dc_language COMMAND dc-language-tests)
add_executable(dc-sound-tests tests/dc_sound_tests.cpp)
target_link_libraries(dc-sound-tests PRIVATE dc_sound bozo_host)
if(MINGW)
+12 -5
View File
@@ -28,7 +28,7 @@ BozoEngine replaces the PS2Recomp fork completely; there is no emulation fallbac
## For players (Windows)
Download **`DC_Recomp-0.6.0-bozo.zip`** from [Releases](https://github.com/TheBozos/DC_Recomp/releases/latest),
Download **`DC_Recomp-0.7.0-bozo.zip`** from [Releases](https://github.com/TheBozos/DC_Recomp/releases/latest),
check its `.sha256`, and extract it to a writable folder such as `D:\Games\DC_Recomp_Bozo`.
Open **DC Launcher.exe**, select your own USA disc image (`.iso` or `.bin`/`.cue`), click **Prepare the game**,
then **Play**. Preparation runs locally with the bundled offline tools; no developer software is needed.
@@ -38,7 +38,7 @@ You need Windows 10 version 1903 or newer (or Windows 11), an AVX2/FMA CPU, Open
Only the unmodified `SCUS-97111` version 1.02 disc is supported; the executable and both overlays are verified.
The unsigned launcher may trigger Windows SmartScreen. Game files and generated game code are never distributed.
Use the launcher's **Settings** for display options, logs, maintenance and updates. **F2** opens the game's
Use the launcher's **Settings** for display options, the game's language, logs, maintenance and updates. **F2** opens the game's
settings. Saves, controls, video settings and cheats are stored in `%APPDATA%\DC_Recomp` and survive launcher
updates. Existing development saves are kept separately; copy only the desired card files into that directory.
The in-game pause menu includes **Graphics** (widescreen, anti-aliasing and more), **Cheats**, **Travel** and **Quit Game**. Updates offer a rebuild when the source changes.
@@ -46,7 +46,7 @@ See [CHANGELOG.md](CHANGELOG.md) for release changes and the checked routes abov
**RecompLauncher.** Releases carry a [`recomplauncher.json`](recomplauncher.json), so
[RecompLauncher](https://recomplauncher.com) can install DC_Recomp, check your disc, prepare the game with the
same build (its setup step), show the video settings on the game's page and back up the memory cards. A game
same build (its setup step), show the language and video settings on the game's page and back up the memory cards. A game
set up there keeps its saves, settings and logs in its own `recompdata` folder, not in `%APPDATA%\DC_Recomp`:
copy `mc0` across to bring saves from DC Launcher.
@@ -75,6 +75,7 @@ A complete story playthrough and full visual parity remain unverified.
| Complete story played by hand, all companions, locations and effects | 🔧 |
| Linux build | ⏳ |
| Widescreen, with the HUD at the screen's edges | ✅ |
| French, German and Italian text and menus, from the disc's own European translations | 🔧 |
| Travel: any town, area, dungeon floor and story chapter (cheats, scripted runs) | ✅ |
**Native port.** Models, textures, camera, lights and drawing routines feed native PC draws.
@@ -226,7 +227,7 @@ an update, use the game's own memory-card saves. `--save-state FILE --save-state
`--load-state FILE [--load-state-at FRAME]` do the same from the command line.
The game's **Options** entry page offers **Game Options** (the original settings), **Graphics**, **Cheats**,
**Travel** and **Quit Game**. Up/Down selects rows, Cross confirms and Circle goes back. **Graphics** sets the display
**Travel**, **Language** and **Quit Game**. Up/Down selects rows, Cross confirms and Circle goes back. **Graphics** sets the display
mode, resolution, render scale, frame rate, widescreen, anti-aliasing and texture smoothing; **Apply and save** writes
them to `video.ini` (shared with the launcher's Settings and **F2 → Video**). **Widescreen** shows a 16:9 picture
with more of the scene at the sides; the HUD moves to the screen's edges while menus and full-screen pictures stay
@@ -265,6 +266,12 @@ ABS at 1× and movement at 100%. See [the cheat reference](docs/CHEATS.md) for l
map and advances the story to a chosen chapter. Each request waits until you walk freely, then goes through the
game's own fade and loading. Save before advancing the story: it is meant for testing.
**Language.** The USA disc also carries the European release's French, German and Italian text and menus, and its
program still picks them by a language code. The launcher's **Settings → Game language**, the game's own
**Options → Language** and RecompLauncher's **Language** write `language = en`, `fr`, `de` or `it` to `game.ini` in
the user folder; the game reads it when it starts, so a change made in the game applies at its next start. `--language fr` does the same for one run. Spanish is not offered: the USA disc lacks about half its story
text. Some European texts are longer than their English boxes (the name entry's help, for one) and run past them.
### Memory cards and data paths
The windowed runner uses BozoEngine's per-user memory-card directory. Existing `game/mc0` saves migrate
@@ -316,7 +323,7 @@ licences and corresponding toolchain sources, and audits the archives for game d
```bash
python tools/make_build_kit.py --out D:/dc_kit/kit
scripts/bench_run.sh --alone 20 "release package" python tools/make_release.py \
--version 0.6.0 --kit D:/dc_kit/kit --out D:/dc_release --with-sources
--version 0.7.0 --kit D:/dc_kit/kit --out D:/dc_release --with-sources
```
Only committed source is exported. Follow [the release checklist](docs/RELEASE_CHECKLIST.md) before publishing;
+1 -1
View File
@@ -1 +1 @@
0.6.0
0.7.0
+5
View File
@@ -47,6 +47,11 @@ if(NOT bozo_engine_have STREQUAL bozo_engine_want)
set(bozo_engine_unpack "${bozo_engine_root}/.BozoEngine-unpack")
file(REMOVE_RECURSE "${bozo_engine_tree}" "${bozo_engine_unpack}")
file(ARCHIVE_EXTRACT INPUT "${bozo_engine_archive}" DESTINATION "${bozo_engine_unpack}")
# Its files dated now: unpacked with the archive's own dates (the release's, older than objects built since), a
# build made on the last release kept objects compiled against the old headers after a pin bump (Shinobido 0.7.0 ->
# 0.7.3: two files built on the old renderer.h, objects and the HUD missing from the picture).
file(GLOB_RECURSE bozo_engine_files LIST_DIRECTORIES false "${bozo_engine_unpack}/*")
file(TOUCH_NOCREATE ${bozo_engine_files})
file(WRITE "${bozo_engine_unpack}/${bozo_engine_name}/.release" "${bozo_engine_want}\n")
file(RENAME "${bozo_engine_unpack}/${bozo_engine_name}" "${bozo_engine_tree}")
file(REMOVE_RECURSE "${bozo_engine_unpack}")
+20
View File
@@ -126,6 +126,26 @@ bool VideoConfig::save(const std::string &file) const
return writeAtomically(file, text);
}
bool GameConfig::load(const std::string &file)
{
std::map<std::string, std::string> v;
if (!readIni(file, v, true))
return false;
const std::string l = v["language"];
if (l == "en" || l == "fr" || l == "de" || l == "it")
language = l;
return true;
}
bool GameConfig::save(const std::string &file) const
{
std::string text = "# Dark Cloud's own settings (the launcher and RecompLauncher write this file; the game reads it when it starts).\n"
"# language: en (English), fr (French), de (German) or it (Italian), from the disc's own text and menus.\n"
"\n[game]\n";
text += "language = " + language + "\n";
return writeAtomically(file, text);
}
std::vector<std::pair<int, int>> offeredResolutions(int monitorWidth, int monitorHeight)
{
static const std::pair<int, int> kCommon[] = {
+9
View File
@@ -36,6 +36,15 @@ struct VideoConfig
bool save(const std::string &file) const;
};
// The game's own settings (game.ini in the user folder, read by the game when it starts; RecompLauncher writes it too).
struct GameConfig
{
std::string language = "en"; // en, fr, de, it: the text and menus the game shows (runtime/dc_language.h)
bool load(const std::string &file);
bool save(const std::string &file) const;
};
// The sizes the game's Video tab offers on this monitor (ps2_video::resolutions): common 4:3 and 16:9 ones that fit,
// and the monitor's own.
std::vector<std::pair<int, int>> offeredResolutions(int monitorWidth, int monitorHeight);
+30 -2
View File
@@ -342,7 +342,7 @@ struct Paths
{
std::string release, source, kit, python, script, buildOut, buildLogs, game, gameExe, elf, iso;
std::string releaseIni, builtFrom; // the source's release stamp, and the one of the code the game was built from
std::string user, launcherIni, videoIni, logs, crashes;
std::string user, launcherIni, videoIni, gameIni, logs, crashes;
};
struct App
@@ -350,6 +350,8 @@ struct App
Paths p;
LauncherConfig cfg;
VideoConfig video;
GameConfig gameCfg;
bool gameCfgSaved = false;
Phase phase = Phase::Welcome;
Tab tab = Tab::Play;
std::string missingPart; // Incomplete: what is not there
@@ -440,12 +442,14 @@ struct App
const fs::path u = plat::path(p.user);
p.launcherIni = plat::str(u / L"launcher.ini");
p.videoIni = plat::str(u / L"video.ini");
p.gameIni = plat::str(u / L"game.ini");
p.logs = plat::str(u / L"logs");
p.crashes = plat::str(u / L"crashes");
cfg.load(p.launcherIni);
g_fr = (cfg.language.empty() ? plat::systemLanguage() : cfg.language) == "fr";
video.load(p.videoIni);
gameCfg.load(p.gameIni);
if (!exists(p.script))
missingPart = "source\\tools\\dc_build.py";
@@ -1301,6 +1305,8 @@ static void drawSettings(App &app, float inner)
}
}
gap(6);
const float settingsRowY = ImGui::GetCursorPosY();
ImGui::BeginGroup(); // Resolution, with Game language beside it
ui::text(L("Resolution", "Résolution"), 17, ui::color::inkFaint);
const auto sizes = offeredResolutions(win::monitorWidth(), win::monitorHeight());
auto label = [&](int w, int h)
@@ -1336,6 +1342,28 @@ static void drawSettings(App &app, float inner)
}
ImGui::PopFont();
}
ImGui::EndGroup();
// The game's language (game.ini): the disc's own English, French, German and Italian text and menus, level
// with Resolution (placed, not SameLine: a same-line label would take the combo's baseline offset).
const float belowResolution = ImGui::GetCursorPosY();
ImGui::SetCursorPos(ImVec2(ImGui::GetItemRectMax().x - ImGui::GetWindowPos().x + S(56), settingsRowY));
ImGui::BeginGroup();
ui::text(L("Game language", "Langue du jeu"), 17, ui::color::inkFaint);
static const char *gameLanguages[4][2] = {{"en", "English"}, {"fr", "Français"}, {"de", "Deutsch"}, {"it", "Italiano"}};
for (int i = 0; i < 4; ++i)
{
if (i)
ImGui::SameLine(0, S(8));
char langId[64];
std::snprintf(langId, sizeof(langId), "%s##game-%s", gameLanguages[i][1], gameLanguages[i][0]);
if (ui::pill(langId, app.gameCfg.language == gameLanguages[i][0], 18) && app.gameCfg.language != gameLanguages[i][0])
{
app.gameCfg.language = gameLanguages[i][0];
app.gameCfgSaved = app.gameCfg.save(app.p.gameIni);
}
}
ImGui::EndGroup();
ImGui::SetCursorPosY(std::max(belowResolution, ImGui::GetCursorPosY()));
if (changed)
{
VideoConfig out = v;
@@ -1347,7 +1375,7 @@ static void drawSettings(App &app, float inner)
out.save(app.p.videoIni);
app.video.exists = true;
}
if (v.exists)
if (v.exists || app.gameCfgSaved)
ui::text(L("Saved. The game uses it the next time it starts.", "Enregistré. Le jeu l'utilisera au prochain démarrage."), 16,
ui::color::good);
gap(12);
+15 -1
View File
@@ -31,8 +31,22 @@
"logs": [{ "path": "{data}/logs" }]
},
"saves": ["{data}/mc0", "{data}/mc1"],
"config": [{ "format": "ini", "file": [{ "path": "{data}/video.ini" }] }],
"config": [
{ "format": "ini", "file": [{ "path": "{data}/video.ini" }] },
{ "id": "game", "format": "ini", "file": [{ "path": "{data}/game.ini" }] }
],
"settings": [
{
"id": "language", "label": "Language", "in": "game",
"help": "The game's text and menus: the disc's own English, or the European release's French, German or Italian, which the USA disc also carries.",
"choices": [
{ "label": "English", "set": { "game/language": "en" } },
{ "label": "Français", "set": { "game/language": "fr" } },
{ "label": "Deutsch", "set": { "game/language": "de" } },
{ "label": "Italiano", "set": { "game/language": "it" } }
],
"defaults": { "game/language": "en" }
},
{
"id": "mode", "label": "Display mode",
"choices": [
+53 -8
View File
@@ -2,6 +2,7 @@
// text buffers, menu-table extensions, save-format changes or console packets.
#include "dc_ingame_cheats.h"
#include "dc_cheats.h"
#include "dc_language.h"
#include "dc_warp.h"
#include "bozo/port.h"
#include "bozo/runtime.h"
@@ -14,6 +15,7 @@
#include <cmath>
#include <cstdio>
#include <cstring>
#include <filesystem>
#include <iterator>
#include <memory>
#include <stdexcept>
@@ -28,7 +30,7 @@ constexpr uint32_t kPhase=0x1da8a50,kFade=0x1da8a54,kLoaded=0x1da8ac4,kPad=0x1cb
constexpr uint32_t kUp=0x1000,kDown=0x4000,kLeft=0x8000,kRight=0x2000,kCross=0x40,kCircle=0x20;
constexpr uint32_t kL1=4,kR1=8,kL2=1,kR2=2;
constexpr float identity[16]={1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1};
enum class Page { Root, Game, Graphics, Cheats, Quit, Travel }; // Travel last: saved states keep their values
enum class Page { Root, Game, Graphics, Cheats, Quit, Travel, Language }; // new pages last: saved states keep their values
struct Menu {
bool active=false,queued=false;
Page page=Page::Root;
@@ -40,9 +42,14 @@ struct Menu {
bozo::app::video::Settings graphics;
const char *graphicsStatus="";
} menu;
constexpr int rootCount=5;
const char *const rootLabels[rootCount]={"Game Options","Graphics","Cheats","Travel","Quit Game"};
const Page rootPages[rootCount]={Page::Game,Page::Graphics,Page::Cheats,Page::Travel,Page::Quit};
constexpr int rootCount=6;
const char *const rootLabels[rootCount]={"Game Options","Graphics","Cheats","Travel","Language","Quit Game"};
const Page rootPages[rootCount]={Page::Game,Page::Graphics,Page::Cheats,Page::Travel,Page::Language,Page::Quit};
// Language: game.ini's choice (dc_language.h), read by the game when it starts; the page saves it for the next start
// (what the game has loaded stays in the language it started in). Not in save states: it is set again on opening.
std::filesystem::path languageFile; // set by the windowed build before the game thread starts; empty: unavailable
struct LanguagePage { int row=0; const language::Choice *running=nullptr,*saved=nullptr; const char *status=""; } languagePage;
const char *const languageLabels[]={"English","Francais","Deutsch","Italiano"}; // the menu font is ASCII
enum GraphicsRow { Display, Resolution, RenderScale, FrameRate, Widescreen, AntiAliasing, Smoothing, ApplyGraphics, GraphicsRowEnd };
constexpr int antiAliasings[]={0,2,4,8},smoothings[]={0,1,2,4,8,16};
constexpr float renderScales[]={0.5f,0.75f,1.f,1.5f,2.f};
@@ -268,16 +275,30 @@ void travelKey(uint32_t pressed)
else if(travel.row==World){dc::warp::requestWorld();travel.note="Queued: opened when play resumes";}
else if(travel.row==Advance){dc::warp::requestChapter(travel.chapter);travel.note="Queued: applied when play resumes";}
}
void drawLanguage(std::vector<bozo::render::Vertex> &v,uint32_t white,uint32_t gold,uint32_t dim)
{
const auto &list=language::choices();
for(int i=0;i<int(list.size());++i){
const float y=130.f+i*34;const auto c=i==languagePage.row?gold:white;
text(v,languageLabels[i],164,y,1.5f,c);if(i==languagePage.row)text(v,">",132,y,1.5f,c);
const char *note=&list[i]==languagePage.running?"in use":&list[i]==languagePage.saved?"next start":"";
text(v,note,526-float(std::strlen(note))*10,y+4,1.25f,dim);
}
text(v,"Text and menus change when the game",128,282,1,white);
text(v,"starts again. Spanish is incomplete on disc.",128,300,1,white);
const char *help=languageFile.empty()?"Needs the game window; O: Back":*languagePage.status?languagePage.status:"X: Choose for the next start O: Back";
text(v,help,112,354,1,white);
}
void drawPage(int alpha)
{
if(prepareScene)prepareScene();panel(alpha);
std::vector<bozo::render::Vertex> v;
const uint32_t white=colour(0x808080,alpha),gold=colour(0x207080,alpha),dim=colour(0x484848,alpha);
const auto heading=menu.page==Page::Root?"OPTIONS":menu.page==Page::Quit?"QUIT GAME?":menu.page==Page::Graphics?"GRAPHICS":
menu.page==Page::Travel?"TRAVEL":"CHEATS";
menu.page==Page::Travel?"TRAVEL":menu.page==Page::Language?"LANGUAGE":"CHEATS";
text(v,heading,320-float(std::strlen(heading))*8,76,2,gold);
if(menu.page==Page::Root){
for(int i=0;i<rootCount;++i){const float y=126.f+i*40;const auto c=i==menu.root?gold:white;text(v,rootLabels[i],164,y,1.5f,c);if(i==menu.root)text(v,">",132,y,1.5f,c);}
for(int i=0;i<rootCount;++i){const float y=120.f+i*36;const auto c=i==menu.root?gold:white;text(v,rootLabels[i],164,y,1.5f,c);if(i==menu.root)text(v,">",132,y,1.5f,c);}
text(v,"D-pad: Select X: Open O: Back",120,352,1,white);
}else if(menu.page==Page::Quit){
text(v,"Close the game?",200,150,1.5f,white);
@@ -289,6 +310,8 @@ void drawPage(int alpha)
drawGraphics(v,white,gold,dim);
}else if(menu.page==Page::Travel){
drawTravel(v,white,gold,dim);
}else if(menu.page==Page::Language){
drawLanguage(v,white,gold,dim);
}else{
const char *labels[]={"Infinite health","Weapon durability","Infinite thirst","Combo stamina",
"Equipped weapon ATK","Apply weapon ATK","Weapon ABS multiplier","Gilda","Apply Gilda",
@@ -357,6 +380,14 @@ void init(uint8_t *r,R5900Context *c,Runtime *rt)
refreshPlayer(r,c);menu={};menu.active=true;menu.font=fontFromGame(r);if(!menu.font)menu.page=Page::Game;
originalInit(r,c,rt);
}
void openLanguage(const uint8_t *r)
{
languagePage={};languagePage.running=language::current(r);
languagePage.saved=languageFile.empty()?nullptr:language::find(language::readIni(languageFile));
if(!languagePage.saved)languagePage.saved=languagePage.running;
const auto &list=language::choices();
for(int i=0;i<int(list.size());++i)if(&list[i]==languagePage.saved)languagePage.row=i;
}
void exit(uint8_t *r,R5900Context *c,Runtime *rt){applyPlayerEdits(r,c);menu={};originalExit(r,c,rt);}
void key(uint8_t *r,R5900Context *c,Runtime *rt)
{
@@ -367,7 +398,7 @@ void key(uint8_t *r,R5900Context *c,Runtime *rt)
return;
}
if(pressed&kCircle){
if(menu.page==Page::Cheats || menu.page==Page::Graphics || menu.page==Page::Quit || menu.page==Page::Travel){menu.page=Page::Root;menu.held=menu.ticks=0;done(c);}
if(menu.page==Page::Cheats || menu.page==Page::Graphics || menu.page==Page::Quit || menu.page==Page::Travel || menu.page==Page::Language){menu.page=Page::Root;menu.held=menu.ticks=0;done(c);}
else {
// The original Circle boundary starts this fade. Do not also run
// hidden Game Options navigation if Circle and a direction coincide.
@@ -378,7 +409,8 @@ void key(uint8_t *r,R5900Context *c,Runtime *rt)
if(menu.page==Page::Root){
if(pressed&kUp)menu.root=(menu.root+rootCount-1)%rootCount;else if(pressed&kDown)menu.root=(menu.root+1)%rootCount;
if(pressed&kCross){menu.page=rootPages[menu.root];travel.note="";
menu.graphics=windowSettings().applied;menu.graphicsRow=0;menu.graphicsStatus="";menu.quitChoice=0;menu.held=menu.ticks=0;menu.attack=std::max(0,equippedWeaponAttack());menu.gold=std::max(0,gilda());menu.capacity=std::clamp(inventorySize(),1,100);menu.quantity=std::max(1,activeConsumable(menu.slot).quantity);menu.queued=false;}
menu.graphics=windowSettings().applied;menu.graphicsRow=0;menu.graphicsStatus="";menu.quitChoice=0;menu.held=menu.ticks=0;menu.attack=std::max(0,equippedWeaponAttack());menu.gold=std::max(0,gilda());menu.capacity=std::clamp(inventorySize(),1,100);menu.quantity=std::max(1,activeConsumable(menu.slot).quantity);menu.queued=false;
if(menu.page==Page::Language)openLanguage(r);}
}else if(menu.page==Page::Graphics){
const video::Shared shared=windowSettings();
if(shared.open){
@@ -394,6 +426,17 @@ void key(uint8_t *r,R5900Context *c,Runtime *rt)
}
}else if(menu.page==Page::Travel){
travelKey(pressed);
}else if(menu.page==Page::Language){
const int count=int(language::choices().size());
if(pressed&kUp)languagePage.row=(languagePage.row+count-1)%count;else if(pressed&kDown)languagePage.row=(languagePage.row+1)%count;
if(pressed&(kUp|kDown))languagePage.status="";
if((pressed&kCross) && !languageFile.empty()){
const language::Choice &choice=language::choices()[languagePage.row];
if(language::writeIni(languageFile,choice)){
languagePage.saved=&choice;
languagePage.status=&choice==languagePage.running?"Saved; already in use":"Saved; restart the game to apply";
}else languagePage.status="Could not save game.ini";
}
}else if(menu.page==Page::Quit){
if(pressed&(kUp|kDown|kLeft|kRight))menu.quitChoice^=1;
if(pressed&kCross){if(menu.quitChoice)quitRequested.store(true,std::memory_order_relaxed);else menu.page=Page::Root;}
@@ -473,8 +516,10 @@ void menuState(bozo::state::Archive &a,const uint8_t *ram)
if(!a.loading())return;
menu.font=menu.active?fontFromGame(ram):nullptr;
menu.graphicsStatus="";
if(menu.active && menu.page==Page::Language)openLanguage(ram);
quitRequested.store(false,std::memory_order_relaxed);
}
void setLanguageFile(const std::filesystem::path &file){languageFile=file;}
void setGraphicsAccess(bozo::app::video::Shared (*shared)(),void (*post)(const bozo::app::video::Settings &,bool))
{videoPost.store(post,std::memory_order_release);videoShared.store(shared,std::memory_order_release);}
}
+4
View File
@@ -1,5 +1,6 @@
#pragma once
#include "bozo/app/video_settings.h"
#include <filesystem>
struct Runtime;
namespace bozo::port { class Registry; }
namespace bozo::state { class Archive; }
@@ -11,6 +12,9 @@ namespace dc::cheats {
// The windowed build, before the game thread starts: the window's settings for the Graphics page (without them,
// as headless, the page says they are unavailable).
void setGraphicsAccess(bozo::app::video::Shared (*shared)(), void (*post)(const bozo::app::video::Settings &, bool));
// The windowed build, before the game thread starts: game.ini, where the Language page saves the choice for the
// next start (without it, as headless, the page says it needs the game window).
void setLanguageFile(const std::filesystem::path &gameIni);
// Save states: the native Options pages' state; on load the font is decoded again from `ram`.
void menuState(bozo::state::Archive &, const uint8_t *ram);
}
+79
View File
@@ -0,0 +1,79 @@
#include "dc_language.h"
#include <algorithm>
#include <cctype>
#include <cstring>
#include <fstream>
namespace dc::language
{
const std::vector<Choice> &choices()
{
static const std::vector<Choice> list = {
{"en", "English", 1}, {"fr", "Fran\xC3\xA7" "ais", 3}, {"de", "Deutsch", 4}, {"it", "Italiano", 5}};
return list;
}
const Choice *find(const std::string &key)
{
std::string k = key;
std::transform(k.begin(), k.end(), k.begin(), [](unsigned char c) { return char(std::tolower(c)); });
for (const Choice &c : choices())
if (k == c.key)
return &c;
return nullptr;
}
std::string readIni(const std::filesystem::path &file)
{
std::ifstream in(file);
std::string line, value;
auto trim = [](std::string s)
{
const size_t first = s.find_first_not_of(" \t\r");
return first == std::string::npos ? std::string() : s.substr(first, s.find_last_not_of(" \t\r") - first + 1);
};
while (std::getline(in, line))
{
line = trim(line.substr(0, line.find_first_of("#;")));
const size_t equal = line.find('=');
if (line.empty() || line.front() == '[' || equal == std::string::npos)
continue;
if (trim(line.substr(0, equal)) == "language")
value = trim(line.substr(equal + 1));
}
return value;
}
bool writeIni(const std::filesystem::path &file, const Choice &choice)
{
const std::filesystem::path tmp = file.string() + ".tmp";
{
std::ofstream out(tmp, std::ios::binary | std::ios::trunc);
out << "# Dark Cloud's own settings (the launcher and RecompLauncher write this file; the game reads it when it starts).\n"
"# language: en (English), fr (French), de (German) or it (Italian), from the disc's own text and menus.\n"
"\n[game]\nlanguage = "
<< choice.key << "\n";
if (!out)
return false;
}
std::error_code ec;
std::filesystem::rename(tmp, file, ec);
return !ec;
}
const Choice *current(const uint8_t *ram)
{
uint32_t code = 0;
std::memcpy(&code, ram + kLanguageCode, sizeof(code));
for (const Choice &c : choices())
if (c.code == code)
return &c;
return nullptr;
}
void apply(uint8_t *ram, const Choice &choice)
{
std::memcpy(ram + kLanguageCode, &choice.code, sizeof(choice.code));
}
} // namespace dc::language
+39
View File
@@ -0,0 +1,39 @@
#pragma once
// The game's language. The USA disc carries the European release's French, German and Italian text and menus next
// to the English ones (message files <name>_<n>.mes, menu folders commenu/a_<lang>), and its program still has the
// European language code: LanguageCode (0x2A1E88, 1 on the USA disc) picks the files when the game loads them. The
// port sets it at boot from --language or <user folder>/game.ini. Spanish (6) is not offered: the USA disc lacks 42
// of its 90 story text files.
#include <cstdint>
#include <filesystem>
#include <string>
#include <vector>
namespace dc::language
{
constexpr uint32_t kLanguageCode = 0x2A1E88;
struct Choice
{
const char *key; // in game.ini and --language
const char *name; // in its own language
uint32_t code; // LanguageCode
};
const std::vector<Choice> &choices(); // English (1), French (3), German (4), Italian (5)
// A choice by key ("en", "fr", "de", "it"; any case), or nullptr.
const Choice *find(const std::string &key);
// game.ini's "language" value: name = value lines, '#' and ';' start comments, [sections] are skipped; "" when the
// file or the key is missing.
std::string readIni(const std::filesystem::path &file);
// Writes game.ini with that language (as the launcher writes it); false when it cannot.
bool writeIni(const std::filesystem::path &file, const Choice &choice);
// The choice LanguageCode in guest memory holds, or nullptr (Spanish, or a code no choice has).
const Choice *current(const uint8_t *ram);
// The game's language for its next loads: LanguageCode in guest memory (before the first frame).
void apply(uint8_t *ram, const Choice &choice);
} // namespace dc::language
+38 -2
View File
@@ -6,6 +6,7 @@
#include "dc_functions.h"
#include "dc_cheats.h"
#include "dc_ingame_cheats.h"
#include "dc_language.h"
#include "dc_pad.h"
#include "dc_state.h"
#include "dc_warp.h"
@@ -46,6 +47,10 @@ int main(int argc, char **argv)
#ifdef DC_WITH_WINDOW
window = true;
bozo::app::setIdentity({"Dark Cloud", "DC_Recomp", "dc-recomp", "SCUS_971.11"});
// What the game prints goes on to its console or pipe as before, and also into <user folder>/logs/<name>.log (the
// launcher's "Open game logs", RecompLauncher's Logs); a crash writes <user folder>/crashes/crash-<time>.txt.
bozo::app::startLogging();
bozo::app::installCrashHandler();
bozo::app::WindowOptions windowOptions;
windowOptions.title = "Dark Cloud - BozoEngine";
windowOptions.width = 960;
@@ -55,7 +60,7 @@ int main(int argc, char **argv)
options.iso = DC_DEFAULT_ISO;
options.frames = window ? 0 : 120;
options.printGameOutput = true;
std::string wav, livePad, assetDir, dumpRam;
std::string wav, livePad, assetDir, dumpRam, language; // language: --language, else game.ini's
for (int i = 1; i < argc; ++i)
{
const std::string a = argv[i];
@@ -77,6 +82,8 @@ int main(int argc, char **argv)
options.iso = argv[++i];
else if (a == "--wav" && i + 1 < argc)
wav = argv[++i];
else if (a == "--language" && i + 1 < argc) // en, fr, de, it (dc_language.h)
language = argv[++i];
else if (a == "--headless")
window = false;
else if (a == "--profile-io")
@@ -114,7 +121,7 @@ int main(int argc, char **argv)
" [--out FILE] [--capture-dir DIR] [--capture-frame N] [--profile-io]\n"
" [--fullscreen] [--hidden] [--mute] [--no-vsync] [--dump-ram FILE]\n"
" [--load-state FILE [--load-state-at FRAME]] [--save-state FILE --save-state-at FRAME]\n"
" [--cheat-script FILE]\n");
" [--cheat-script FILE] [--language en|fr|de|it]\n");
return a == "--help" ? 0 : 2;
}
}
@@ -164,6 +171,33 @@ int main(int argc, char **argv)
d.runtime().functions.addModule(0x1dabd00, 0x1f00000, d.runtime().memory.ram() + 0x1dabd00, std::move(id),
table, count, resume, resumes);
};
// The game's language (dc_language.h): --language, else <user folder>/game.ini (the launcher's and RecompLauncher's
// Game language), else English. The program is in memory now and has not run: its first file loads use it.
bool languageFromIni = false;
#ifdef DC_WITH_WINDOW
if (language.empty() && window && !bozo::app::userDirectory().empty())
{
language = dc::language::readIni(bozo::app::userDirectory() / "game.ini");
languageFromIni = !language.empty();
}
#endif
if (!language.empty())
{
const dc::language::Choice *choice = dc::language::find(language);
if (!choice && !languageFromIni)
{
std::fprintf(stderr, "--language %s: not one of en, fr, de, it\n", language.c_str());
return 2;
}
if (!choice)
std::fprintf(stderr, "[dc] game.ini: language '%s' is not one of en, fr, de, it; English\n", language.c_str());
else
{
dc::language::apply(d.runtime().memory.ram(), *choice);
if (choice->code != 1)
std::printf("[dc] language: %s (%s)\n", choice->name, choice->key);
}
}
module("title", title_function_table, title_function_count, title_resume_table, title_resume_count);
module("dun", dun_function_table, dun_function_count, dun_resume_table, dun_resume_count);
bozo::app::FramePacer pacer;
@@ -292,6 +326,8 @@ int main(int argc, char **argv)
windowOptions.videoSettings = true;
bozo::app::video::offerWidescreen(true); // the Video tab's Widescreen (see the frame hook)
dc::cheats::setGraphicsAccess(&bozo::app::video::shared, &bozo::app::video::post);
if (!bozo::app::userDirectory().empty()) // Options -> Language saves game.ini for the next start
dc::cheats::setLanguageFile(bozo::app::userDirectory() / "game.ini");
bozo::app::Game game;
game.run = run;
game.stop = [&] { host.requestStop(); };
+17
View File
@@ -3,6 +3,8 @@
#include "../runtime/dc_ingame_cheats.h"
#include "../runtime/dc_cheats.h"
#include "../runtime/dc_warp.h"
#include "../runtime/dc_language.h"
#include <filesystem>
#include "bozo/port.h"
#include "bozo/runtime.h"
#include "bozo/render/renderer.h"
@@ -147,6 +149,21 @@ int main(){
check(postCalls==2 && posted.mode==video::WindowMode::Borderless && posted.width==1280 && posted.height==960,
"Borderless keeps the window size it returns to");
const int exitsBefore=exitCalls;tap(*rt,p,0x20);tap(*rt,p,0x20);finishFade(*rt,p);check(exitCalls==exitsBefore+1,"Options still closes after Graphics");
// Language: the fifth entry. Without game.ini's place (headless) it only explains; with it, Cross saves the choice
// for the next start and leaves the running game's LanguageCode alone.
write<uint32_t>(r,dc::language::kLanguageCode,1);
call(*rt,p,initPc);finishFade(*rt,p);for(int i=0;i<4;++i)tap(*rt,p,0x4000);tap(*rt,p,0x40); // Root -> Language
tap(*rt,p,0x4000);tap(*rt,p,0x40);draw(*rt,p);const auto noFile=bozo::render::Renderer::instance().published();
check(noFile && noFile->batches.size()>=2,"Language without game.ini's place draws its notice");
const auto ini=std::filesystem::temp_directory_path()/"dc_menu_language_test.ini";std::filesystem::remove(ini);
dc::cheats::setLanguageFile(ini);tap(*rt,p,0x20);tap(*rt,p,0x40); // back to Root, Language again: opens on English
tap(*rt,p,0x4000);tap(*rt,p,0x40); // Francais
check(dc::language::readIni(ini)=="fr","Cross on Francais saves language = fr");
check(read<uint32_t>(r,dc::language::kLanguageCode)==1,"the running game keeps its language until it starts again");
tap(*rt,p,0x20);tap(*rt,p,0x40); // reopened: the cursor is on the saved choice
tap(*rt,p,0x4000);tap(*rt,p,0x40);check(dc::language::readIni(ini)=="de","the page opens on the saved choice (Down from Francais is Deutsch)");
draw(*rt,p);const auto langPage=bozo::render::Renderer::instance().published();check(langPage && langPage->batches.size()>=2,"Language page draws native text and board");
tap(*rt,p,0x20);tap(*rt,p,0x20);finishFade(*rt,p);std::filesystem::remove(ini);dc::cheats::setLanguageFile({});
std::memset(r+record+8,0,32);call(*rt,p,initPc);finishFade(*rt,p);const int fallback=drawCalls;draw(*rt,p);
check(drawCalls==fallback+1,"missing font falls back to original Options without trapping input");
for(int i=0;i<4;++i)dc::cheats::setEnabled(static_cast<dc::cheats::Cheat>(i),false);
+56
View File
@@ -0,0 +1,56 @@
// The game's language setting (dc_language.h): the choices, game.ini's reading and LanguageCode in guest memory.
#include "dc_language.h"
#include <cstdio>
#include <cstring>
#include <fstream>
#include <vector>
namespace
{
int failures = 0;
void check(bool ok, const char *what)
{
if (!ok)
{
++failures;
std::printf("FAIL: %s\n", what);
}
}
std::string iniWith(const std::filesystem::path &file, const char *text)
{
std::ofstream(file, std::ios::binary | std::ios::trunc) << text;
return dc::language::readIni(file);
}
}
int main(int, char **argv)
{
using namespace dc::language;
check(choices().size() == 4, "four languages");
check(find("en") && find("en")->code == 1, "English is the USA disc's own code 1");
check(find("fr") && find("fr")->code == 3, "French 3");
check(find("DE") && find("DE")->code == 4, "German 4, any case");
check(find("it") && find("it")->code == 5, "Italian 5");
check(!find("es") && !find("") && !find("jp") && !find("english"), "Spanish and anything else refused");
const auto file = std::filesystem::path(argv[0]).parent_path() / "dc_language_test.ini";
check(iniWith(file, "# Dark Cloud\n[game]\nlanguage = fr\n") == "fr", "section and comment skipped");
check(iniWith(file, "[game]\r\n language=it ; Italiano\r\n") == "it", "CRLF, spaces and a trailing comment");
check(iniWith(file, "[game]\nlanguages = de\nlang = de\n") == "", "only the language key");
check(iniWith(file, "# language = de\n") == "", "a commented line");
std::filesystem::remove(file);
check(readIni(file) == "", "no file");
std::vector<uint8_t> ram(32u << 20, 0);
const uint32_t usa = 1;
std::memcpy(ram.data() + kLanguageCode, &usa, 4);
apply(ram.data(), *find("de"));
uint32_t code = 0;
std::memcpy(&code, ram.data() + kLanguageCode, 4);
check(code == 4, "LanguageCode written");
check(ram[kLanguageCode - 1] == 0 && ram[kLanguageCode + 4] == 0, "nothing around it");
std::printf("%s (%d failures)\n", failures ? "FAILED" : "dc_language: all checks passed", failures);
return failures ? 1 : 0;
}
+12 -1
View File
@@ -475,10 +475,16 @@ class RecompLauncherTests(unittest.TestCase):
def test_settings_are_keys_the_game_reads(self):
m = self.manifest()
self.assertEqual(m['config'], [{'format': 'ini', 'file': [{'path': '{data}/video.ini'}]}])
self.assertEqual(m['config'], [{'format': 'ini', 'file': [{'path': '{data}/video.ini'}]},
{'id': 'game', 'format': 'ini', 'file': [{'path': '{data}/game.ini'}]}])
source = (ROOT / 'BozoEngine' / 'runtime' / 'app' / 'video_settings.cpp').read_text(encoding='utf-8')
written = set(re.findall(r'<< "([a-z_]+) = "', source))
self.assertIn('widescreen', written)
# game.ini (the game's language): the keys runtime/dc_language.cpp reads, the values it accepts.
language = (ROOT / 'runtime' / 'dc_language.cpp').read_text(encoding='utf-8')
self.assertIn('"language"', language)
accepted = set(re.findall(r'\{"([a-z]{2})", "', language))
self.assertEqual(accepted, {'en', 'fr', 'de', 'it'})
ids = [s['id'] for s in m['settings']]
self.assertEqual(len(ids), len(set(ids)))
for setting in m['settings']:
@@ -487,6 +493,11 @@ class RecompLauncherTests(unittest.TestCase):
self.assertEqual(set(choice['set']), keys, setting['id'])
for key in keys:
section, name = key.split('/')
if setting.get('in') == 'game':
self.assertEqual(key, 'game/language')
self.assertTrue({c['set'][key] for c in setting['choices']} <= accepted)
continue
self.assertNotIn('in', setting)
self.assertEqual(section, 'video')
self.assertIn(name, written)
values = [c['set'][k] for c in setting['choices'] for k in keys]