Preserve English overwrite question in translation (by Codex)
This commit is contained in:
1 parent
fcb6ac14bb
commit
a275ffa1a9
4 files changed
+36
-3
No files matched your search
@@ -26,6 +26,7 @@ constexpr uint32_t kEnFileOffset = 0x496d;
|
||||
constexpr uint32_t kEnDataStart = ::bmh::layout::EnDataStart, kEnDataEnd = ::bmh::layout::Career_CompetitionPointersEnglish_RuntimeField;
|
||||
constexpr uint32_t kFltdSize = 507925;
|
||||
constexpr uint32_t kEnglishCalendarDateSetup = 0x684;
|
||||
constexpr uint32_t kEnglishOverwriteQuestionPointer = 0x6c43c;
|
||||
// The German image the engine expects: LE objects from layout field, data object GermanDataSegmentBegin-layout field.
|
||||
constexpr uint32_t kDeBase = 0x10000, kDeEnd = ::bmh::layout::GermanImageEnd;
|
||||
// A zero byte in the German BSS: the empty string of empty_pointers entries.
|
||||
|
||||
@@ -122,7 +122,15 @@
|
||||
{::bmh::layout::TransferMarket_Click_RuntimeField, 2, Kind::copy, ::bmh::layout::EnglishLayoutTranslation246, {}},
|
||||
{::bmh::layout::TransferMarket_Click_RuntimeField2, 2, Kind::copy, ::bmh::layout::EnglishLayoutTranslation246, {}},
|
||||
{::bmh::layout::TransferMarket_Click_RuntimeField3, 74, Kind::copy, ::bmh::layout::EnglishLayoutTranslation247, {}},
|
||||
{::bmh::layout::Bank_OriginalToUtf8_RuntimeField, 144, Kind::empty_pointers, 0, {}},
|
||||
// Keep the overwrite pointer's next entry exactly four bytes away: copy
|
||||
// entries extend to their following destination, while other slots stay empty.
|
||||
{::bmh::layout::Bank_OriginalToUtf8_RuntimeField,
|
||||
::bmh::layout::SaveLoad_OverwriteQuestionPointer - ::bmh::layout::Bank_OriginalToUtf8_RuntimeField,
|
||||
Kind::empty_pointers, 0, {}},
|
||||
{::bmh::layout::SaveLoad_OverwriteQuestionPointer, 4, Kind::copy, kEnglishOverwriteQuestionPointer, {}},
|
||||
{::bmh::layout::SaveLoad_OverwriteQuestionPointer + 4,
|
||||
::bmh::layout::Bank_OriginalToUtf8_RuntimeField + 144 - (::bmh::layout::SaveLoad_OverwriteQuestionPointer + 4),
|
||||
Kind::empty_pointers, 0, {}},
|
||||
{::bmh::layout::Analytics_FormatError_ExecutableField, 72, Kind::copy, ::bmh::layout::EnglishLayoutTranslation50, {}}, // EN196f1: graph labels, distinct from fund-name suffixes
|
||||
{::bmh::layout::AdGroupId, 1, Kind::copy, ::bmh::layout::EnglishLayoutTranslation51, {}},
|
||||
{::bmh::layout::GameEnd_SourceHyphenator_ExecutableField, 18, Kind::copy, ::bmh::layout::EnglishLayoutTranslation52, {}},
|
||||
|
||||
@@ -379,7 +379,7 @@ ResolvedGame resolve_game(const fs::path& input, const fs::path& cache) {
|
||||
const fs::path marker = prepared / ".openbmh-english";
|
||||
// the version of the translation (launch/fltd.cpp, fltd_map.inc): a cache built
|
||||
// by another version is built again
|
||||
constexpr const char* kTranslation = "english translation 15"; // 15: original pitch affinity tables and pointer bitmap (14: calendar epoch)
|
||||
constexpr const char* kTranslation = "english translation 16"; // 16: overwrite question pointer (15: original pitch affinity tables and pointer bitmap)
|
||||
std::string built;
|
||||
{
|
||||
std::ifstream in(marker);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
int main() {
|
||||
using namespace bmh;
|
||||
@@ -19,6 +20,19 @@ int main() {
|
||||
source[0] = 'M'; source[1] = 'Z';
|
||||
const auto put = [&](uint32_t address, uint8_t value) { source.at(address + 0x496d) = value; };
|
||||
const auto check = [](bool value, const char* message) { if (!value) throw std::runtime_error(message); };
|
||||
const auto put_pointer = [&](uint32_t address, uint32_t value) {
|
||||
for (uint32_t i = 0; i < 4; ++i) put(address + i, uint8_t(value >> (i * 8)));
|
||||
};
|
||||
constexpr uint32_t english_overwrite_pointer = 0x6c43c;
|
||||
constexpr uint32_t authored_question_address = layout::EnDataStart + 0x100;
|
||||
const std::string authored_question = "Authored overwrite question?";
|
||||
put_pointer(english_overwrite_pointer, authored_question_address);
|
||||
for (uint32_t i = 0; i <= authored_question.size(); ++i)
|
||||
put(authored_question_address + i, i < authored_question.size() ? uint8_t(authored_question[i]) : 0);
|
||||
// Adjacent English pointers are intentionally distinct from the retained
|
||||
// empty German slots. An over-wide copy must not import either one.
|
||||
put_pointer(english_overwrite_pointer - 4, authored_question_address + 1);
|
||||
put_pointer(english_overwrite_pointer + 4, authored_question_address + 2);
|
||||
const uint8_t toggle_rows[] = {3, 7, 11, 13, 17, 19};
|
||||
put(layout::EnglishLayoutTranslation16 - 1, 99); // alignment padding is not a toggle row
|
||||
for (uint32_t i = 0; i < 6; ++i) put(layout::EnglishLayoutTranslation16 + i, toggle_rows[i]);
|
||||
@@ -32,6 +46,16 @@ int main() {
|
||||
const auto path = root / "FLTD.EXE";
|
||||
{ std::ofstream out(path, std::ios::binary); out.write(reinterpret_cast<const char*>(source.data()), std::streamsize(source.size())); }
|
||||
const auto image = launch::translate_fltd(path);
|
||||
check(image.u32(layout::SaveLoad_OverwriteQuestionPointer) == authored_question_address,
|
||||
"overwrite question pointer must select the original English source slot");
|
||||
check(image.string_at_pointer(layout::SaveLoad_OverwriteQuestionPointer) == authored_question,
|
||||
"overwrite question must retain its complete source text");
|
||||
for (uint32_t address = layout::Bank_OriginalToUtf8_RuntimeField;
|
||||
address < layout::Bank_OriginalToUtf8_RuntimeField + 144; address += 4) {
|
||||
if (address == layout::SaveLoad_OverwriteQuestionPointer) continue;
|
||||
check(image.u32(address) == layout::EmptyString,
|
||||
"mapping the overwrite question must preserve every adjacent empty pointer");
|
||||
}
|
||||
for (uint32_t i = 0; i < 6; ++i)
|
||||
check(image.u8(layout::Setup_FormatError_RuntimeField8 + i) == toggle_rows[i], "toggle mapping includes alignment padding");
|
||||
check(image.u8(layout::Desktop_Copy_TextPointer) == 0xfb, "negative balance colour");
|
||||
@@ -42,7 +66,7 @@ int main() {
|
||||
check(image.u8(layout::Desktop_Render_RuntimeField3 + i) == 30 + i, "socket source x");
|
||||
}
|
||||
std::filesystem::remove_all(root);
|
||||
std::cout << "FLTD setup, colour and desktop-control mappings passed\n";
|
||||
std::cout << "FLTD setup, colour, desktop-control and overwrite-question mappings passed\n";
|
||||
return 0;
|
||||
} catch (const std::exception& error) {
|
||||
if (!root.empty()) { std::error_code ec; std::filesystem::remove_all(root, ec); }
|
||||
|
||||
Reference in new issue
Block a user