Skip to content

Commit 9dde4a7

Browse files
committed
Add support for german translation
First extract the german dialogue: python restool.py --extract-dialogue -r german.sfc Then extract resources / build the assert file: python restool.py --extract-from-rom --languages=de
1 parent 366da3c commit 9dde4a7

26 files changed

+1314
-992
lines changed

assets.h

+332-339
Large diffs are not rendered by default.

config.c

+3
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,9 @@ static bool HandleIniConfig(int section, const char *key, char *value) {
442442
return ParseBool(value, &g_config.display_perf_title);
443443
} else if (StringEqualsNoCase(key, "DisableFrameDelay")) {
444444
return ParseBool(value, &g_config.disable_frame_delay);
445+
} else if (StringEqualsNoCase(key, "Language")) {
446+
g_config.language = value;
447+
return true;
445448
}
446449
} else if (section == 4) {
447450
if (StringEqualsNoCase(key, "ItemSwitchLR")) {

config.h

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ typedef struct Config {
7373
char *memory_buffer;
7474
const char *shader;
7575
const char *msu_path;
76+
const char *language;
7677
} Config;
7778

7879
enum {

load_gfx.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ static const int8 kGraphicsLoadSp6[20] = {
325325
static const uint8 kMirrorWarp_LoadNext_NmiLoad[15] = {0, 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, 18, 19, 20, 0};
326326

327327
static const uint8 *GetCompSpritePtr(int i) {
328-
return kSprGfx + *(uint32 *)(kSprGfx + i * 4);
328+
return kSprGfx(i).ptr;
329329
}
330330

331331
void ApplyPaletteFilter_bounce() {
@@ -932,7 +932,7 @@ void Graphics_LoadChrHalfSlot() { // 80e3fa
932932
}
933933

934934
void TransferFontToVRAM() { // 80e556
935-
memcpy(&g_zenv.vram[0x7000], kFontData, 0x800 * sizeof(uint16));
935+
memcpy(&g_zenv.vram[0x7000], FindIndexInMemblk(kDialogueFont(0), 0).ptr, 0x800 * sizeof(uint16));
936936
}
937937

938938
void Do3To4High(uint16 *vram_ptr, const uint8 *decomp_addr) { // 80e5af
@@ -991,17 +991,17 @@ void LoadCommonSprites() { // 80e6b7
991991
int Decomp_spr(uint8 *dst, int gfx) { // 80e772
992992
if (gfx < 12)
993993
gfx = 12; // ensure it wont decode bad sheets.
994+
MemBlk blk = kSprGfx(gfx);
994995
const uint8 *sprite_data = GetCompSpritePtr(gfx);
995996
// If the size is not 0x600 then it's compressed
996-
if (gfx >= 103 || (((uint32 *)kSprGfx)[gfx + 1] - ((uint32 *)kSprGfx)[gfx]) != 0x600)
997-
return Decompress(dst, sprite_data);
998-
memcpy(dst, sprite_data, 0x600);
997+
if (gfx >= 103 || blk.size != 0x600)
998+
return Decompress(dst, blk.ptr);
999+
memcpy(dst, blk.ptr, 0x600);
9991000
return 0x600;
10001001
}
10011002

10021003
int Decomp_bg(uint8 *dst, int gfx) { // 80e78f
1003-
const uint8 *p = kBgGfx + *(uint32 *)(kBgGfx + gfx * 4);
1004-
return Decompress(dst, p);
1004+
return Decompress(dst, kBgGfx(gfx).ptr);
10051005
}
10061006

10071007
int Decompress(uint8 *dst, const uint8 *src) { // 80e79e

main.c

+5
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ int main(int argc, char** argv) {
304304
g_config.extend_y * kPpuRenderFlags_Height240 |
305305
g_config.no_sprite_limits * kPpuRenderFlags_NoSpriteLimits;
306306
ZeldaEnableMsu(g_config.enable_msu);
307+
ZeldaSetLanguage(g_config.language);
307308

308309
if (g_config.fullscreen == 1)
309310
g_win_flags ^= SDL_WINDOW_FULLSCREEN_DESKTOP;
@@ -865,3 +866,7 @@ static void SwitchDirectory() {
865866
pos--;
866867
}
867868
}
869+
870+
MemBlk FindInAssetArray(int asset, int idx) {
871+
return FindIndexInMemblk((MemBlk) { g_asset_ptrs[asset], g_asset_sizes[asset] }, idx);
872+
}

0 commit comments

Comments
 (0)