Skip to content

Commit

Permalink
Add support for german translation
Browse files Browse the repository at this point in the history
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
  • Loading branch information
snesrev committed Mar 10, 2023
1 parent 366da3c commit 9dde4a7
Show file tree
Hide file tree
Showing 26 changed files with 1,314 additions and 992 deletions.
671 changes: 332 additions & 339 deletions assets.h

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ static bool HandleIniConfig(int section, const char *key, char *value) {
return ParseBool(value, &g_config.display_perf_title);
} else if (StringEqualsNoCase(key, "DisableFrameDelay")) {
return ParseBool(value, &g_config.disable_frame_delay);
} else if (StringEqualsNoCase(key, "Language")) {
g_config.language = value;
return true;
}
} else if (section == 4) {
if (StringEqualsNoCase(key, "ItemSwitchLR")) {
Expand Down
1 change: 1 addition & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ typedef struct Config {
char *memory_buffer;
const char *shader;
const char *msu_path;
const char *language;
} Config;

enum {
Expand Down
14 changes: 7 additions & 7 deletions load_gfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ static const int8 kGraphicsLoadSp6[20] = {
static const uint8 kMirrorWarp_LoadNext_NmiLoad[15] = {0, 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, 18, 19, 20, 0};

static const uint8 *GetCompSpritePtr(int i) {
return kSprGfx + *(uint32 *)(kSprGfx + i * 4);
return kSprGfx(i).ptr;
}

void ApplyPaletteFilter_bounce() {
Expand Down Expand Up @@ -932,7 +932,7 @@ void Graphics_LoadChrHalfSlot() { // 80e3fa
}

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

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

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

int Decompress(uint8 *dst, const uint8 *src) { // 80e79e
Expand Down
5 changes: 5 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ int main(int argc, char** argv) {
g_config.extend_y * kPpuRenderFlags_Height240 |
g_config.no_sprite_limits * kPpuRenderFlags_NoSpriteLimits;
ZeldaEnableMsu(g_config.enable_msu);
ZeldaSetLanguage(g_config.language);

if (g_config.fullscreen == 1)
g_win_flags ^= SDL_WINDOW_FULLSCREEN_DESKTOP;
Expand Down Expand Up @@ -865,3 +866,7 @@ static void SwitchDirectory() {
pos--;
}
}

MemBlk FindInAssetArray(int asset, int idx) {
return FindIndexInMemblk((MemBlk) { g_asset_ptrs[asset], g_asset_sizes[asset] }, idx);
}
Loading

0 comments on commit 9dde4a7

Please sign in to comment.