From def94e02d3720f3f62ecfee13dad7dbb8e12156b Mon Sep 17 00:00:00 2001 From: Martin Gerhardy Date: Tue, 7 Jul 2026 14:58:56 +0200 Subject: [PATCH 1/2] TWINE: add extract and translation tools Assisted-by: Cursor:auto --- .gitignore | 5 + Makefile.common | 18 + dists/win32/ScummVM Tools.iss | 1 + engines/twine/create_twine_translation.cpp | 600 ++++++++++++++++ engines/twine/extract_twine.cpp | 549 ++++++++++++++ engines/twine/extract_twine_convert.cpp | 792 +++++++++++++++++++++ engines/twine/extract_twine_convert.h | 94 +++ engines/twine/extract_twine_font.cpp | 400 +++++++++++ engines/twine/extract_twine_island.cpp | 525 ++++++++++++++ engines/twine/extract_twine_obj.cpp | 237 ++++++ engines/twine/hqr.cpp | 127 +++- engines/twine/hqr.h | 10 + engines/twine/parser/body.cpp | 548 ++++++++++++++ engines/twine/parser/body.h | 86 +++ engines/twine/parser/bodytypes.h | 117 +++ 15 files changed, 4096 insertions(+), 13 deletions(-) create mode 100644 engines/twine/create_twine_translation.cpp create mode 100644 engines/twine/extract_twine.cpp create mode 100644 engines/twine/extract_twine_convert.cpp create mode 100644 engines/twine/extract_twine_convert.h create mode 100644 engines/twine/extract_twine_font.cpp create mode 100644 engines/twine/extract_twine_island.cpp create mode 100644 engines/twine/extract_twine_obj.cpp create mode 100644 engines/twine/parser/body.cpp create mode 100644 engines/twine/parser/body.h create mode 100644 engines/twine/parser/bodytypes.h diff --git a/.gitignore b/.gitignore index ab28e83b..2d704fd6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,16 +7,21 @@ /.gdb_history /construct_mohawk +/create_macs2_translation /create_sjisfnt +/create_twine_translation /decine /decompile /degob /dekyra +/demacs2 /deprince /descumm /desword2 /detwine +/extract_twine /extract_hadesch_img +/extract_macs2 /extract_mohawk /extract_mps /extract_gob_cdi diff --git a/Makefile.common b/Makefile.common index 9fa390f1..84064c65 100644 --- a/Makefile.common +++ b/Makefile.common @@ -31,11 +31,13 @@ PROGRAMS = \ descumm \ desword2 \ detwine \ + extract_twine \ gob_loadcalc \ extract_gob_cdi \ extract_mohawk \ extract_macs2 \ create_macs2_translation \ + create_twine_translation \ extract_ngi \ construct_mohawk \ msn_convert_mod \ @@ -149,6 +151,11 @@ extract_macs2_OBJS := \ create_macs2_translation_OBJS := \ engines/macs2/create_macs2_translation.o +create_twine_translation_OBJS := \ + engines/twine/create_twine_translation.o \ + engines/twine/hqr.o \ + $(UTILS) + extract_hadesch_OBJS := \ engines/hadesch/extract_hadesch.o \ $(UTILS) @@ -232,6 +239,17 @@ detwine_OBJS := \ version.o \ $(UTILS) +extract_twine_OBJS := \ + engines/twine/extract_twine.o \ + engines/twine/extract_twine_convert.o \ + engines/twine/extract_twine_font.o \ + engines/twine/extract_twine_island.o \ + engines/twine/extract_twine_obj.o \ + engines/twine/parser/body.o \ + engines/twine/hqr.o \ + $(UTILS) +extract_twine_LIBS := $(LIBS) + gob_loadcalc_OBJS := \ engines/gob/gob_loadcalc.o diff --git a/dists/win32/ScummVM Tools.iss b/dists/win32/ScummVM Tools.iss index cfdf029e..2aa0dd3a 100755 --- a/dists/win32/ScummVM Tools.iss +++ b/dists/win32/ScummVM Tools.iss @@ -35,6 +35,7 @@ Source: "deprince.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "descumm.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "desword2.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "detwine.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "extract_twine.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "extract_gob_cdi.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "extract_hadesch.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "extract_hadesch_img.exe"; DestDir: "{app}"; Flags: ignoreversion diff --git a/engines/twine/create_twine_translation.cpp b/engines/twine/create_twine_translation.cpp new file mode 100644 index 00000000..1ba579bd --- /dev/null +++ b/engines/twine/create_twine_translation.cpp @@ -0,0 +1,600 @@ +/* ScummVM Tools + * + * ScummVM Tools is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * LBA (TwinE) TEXT.HQR translation tool + * + * Workflow: + * 1. Extract: create_twine_translation extract [--lang N] [--lba1|--lba2] + * 2. Translate the .po file (Poedit, Weblate, etc.) + * 3. Pack: create_twine_translation pack