Skip to content

Commit

Permalink
Update support for Japanese version
Browse files Browse the repository at this point in the history
  • Loading branch information
HylianFreddy committed Dec 30, 2021
1 parent a5d4eb6 commit 5d3cd37
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 22 deletions.
Binary file modified code.ips
Binary file not shown.
Binary file modified code_citra_eur.ips
Binary file not shown.
Binary file added code_citra_jp.ips
Binary file not shown.
Binary file modified code_citra_us.ips
Binary file not shown.
Binary file modified code_eur.ips
Binary file not shown.
Binary file modified code_j.ips
Binary file not shown.
8 changes: 7 additions & 1 deletion include/z3D/z3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,13 @@ typedef Actor* (*Actor_Spawn_proc)(ActorContext *actorCtx,GlobalContext *globalC
#define Actor_Spawn ((Actor_Spawn_proc)Actor_Spawn_addr)

typedef void (*Player_SetEquipmentData_proc)(GlobalContext* globalCtx, Player* player);
#define Player_SetEquipmentData_addr 0x34913C //works on EUR, confirm for JP

#ifdef Version_JP
#define Player_SetEquipmentData_addr 0x348C54
#else //USA & EUR
#define Player_SetEquipmentData_addr 0x34913C
#endif

#define Player_SetEquipmentData ((Player_SetEquipmentData_proc)Player_SetEquipmentData_addr)

/*
Expand Down
56 changes: 56 additions & 0 deletions oot_j.ld
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ SECTIONS
*(.patch_loader)
}

.patch_InstantTextFirstLine 0x2DFFB4 : {
*(.patch_InstantTextFirstLine)
}

.patch_InstantTextBoxBreak 0x2E017C : {
*(.patch_InstantTextBoxBreak)
}

.patch_InstantTextRemoveOff 0x2E01E0 : {
*(.patch_InstantTextRemoveOff)
}

/*.patch_load 0x2E32A8 : {
*(.patch_load)
}*/
Expand All @@ -16,10 +28,54 @@ SECTIONS
*(.patch_Gfx_Update)
}

.patch_SetBGMEntrance 0x330B60 : {
*(.patch_SetBGMEntrance)
}

.patch_TurboTextSignalNPC 0x34650C : {
*(.patch_TurboTextSignalNPC)
}

.patch_PlaySound 0x35C040 : {
*(.patch_PlaySound)
}

.patch_SetBGMEvent 0x36E758 : {
*(.patch_SetBGMEvent)
}

.patch_SleepQueryCallback 0x3FD6C4 : {
*(.patch_SleepQueryCallback)
}

.patch_ItemUsability_Shield 0x42E2D0 : {
*(.patch_ItemUsability_Shield)
}

.patch_OverrideSceneSetup 0x448790 : {
*(.patch_OverrideSceneSetup)
}

.patch_after_GlobalContext_Update 0x45240C : {
*(.patch_after_GlobalContext_Update)
}

.patch_ItemUsability 0x476CF4 : {
*(.patch_ItemUsability)
}

.patch_TurboTextAdvance 0x480900 : {
*(.patch_TurboTextAdvance)
}

.patch_SetBGMDayNight 0x483C60 : {
*(.patch_SetBGMDayNight)
}

.patch_TurboTextClose 0x4881EC : {
*(.patch_TurboTextClose)
}

. = 0x4C99A8;
. = ALIGN(4);
.loader : {
Expand Down
7 changes: 0 additions & 7 deletions src/cheats.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,10 @@ ToggleMenu CheatsMenu = {
{0, "Infinite Rupees", .method = Cheats_Toggle},
{0, "Infinite Nayru's Love", .method = Cheats_Toggle},
{0, "Freeze time of day", .method = Cheats_Toggle},
#ifdef Version_JP
{0, "No music (TODO)", .method = NULL},
{0, "Usable Items (TODO)", .method = NULL},
{0, "ISG", .method = Cheats_Toggle},
{0, "Turbo Text (TODO)", .method = NULL},
#else
{0, "No music", .method = Cheats_Toggle},
{0, "Unrestricted Items - Forced mode OFF", .method = Cheats_Toggle},
{0, "ISG", .method = Cheats_Toggle},
{0, "Turbo Text", .method = Cheats_Toggle},
#endif
}
};

Expand Down
10 changes: 2 additions & 8 deletions src/equips.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ void Equips_EquipsMenuInit(void){
} else {
EquipsMenu.items[EQUIP_SWORD].title = "Sword (0-3) - Swordless Flag OFF";
}

#ifdef Version_JP
EquipsMenu.items[EQUIP_SHIELD].title = "Shield (0-3, applies on reload)";
EquipsMenu.items[EQUIP_TUNIC].title = "Tunic (0-3, applies on reload)";
EquipsMenu.items[EQUIP_BOOTS].title = "Boots (0-3, applies on reload)";
#endif
}

void Equips_ShowEquipsMenu(void){
Expand Down Expand Up @@ -73,9 +67,9 @@ void Equips_ModifyGear(s32 selected){
EquipsMenu.items[EQUIP_SWORD].title = "Sword (0-3) - Swordless Flag OFF";
}
}
#ifndef Version_JP

Player_SetEquipmentData(gGlobalContext, PLAYER);
#endif

}

AmountMenu EquipsMenu = {
Expand Down
36 changes: 35 additions & 1 deletion src/hooks.s
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,23 @@ hook_PlaySound:
bl Cheats_RemoveBGM
pop {r1-r12, lr}
push {r3-r7, lr}
.if _JP_==1
b 0x35C044
.else
b 0x35C52C
.endif

.global hook_SetBGMEntrance
hook_SetBGMEntrance:
push {r1-r12, lr}
bl Cheats_RemoveBGM
pop {r1-r12, lr}
push {r4-r6, lr}
.if _JP_==1
b 0x330B64
.else
b 0x33104C
.endif

.global hook_SetBGMDayNight
hook_SetBGMDayNight:
Expand All @@ -71,6 +79,9 @@ hook_SetBGMDayNight:
.if _EUR_==1
b 0x483CAC
.endif
.if _JP_==1
b 0x483C64
.endif

.global hook_SetBGMEvent
hook_SetBGMEvent:
Expand All @@ -80,7 +91,11 @@ hook_SetBGMEvent:
cpy r1,r0
pop {r0, r2-r12, lr}
push {r4-r11, lr}
.if _JP_==1
b 0x36E75C
.else
b 0x36EC44
.endif

.global hook_InstantTextFirstLine
hook_InstantTextFirstLine:
Expand Down Expand Up @@ -108,25 +123,39 @@ hook_InstantTextBoxBreak:
bl Cheats_IsInstantText
cmp r0,#0x1
pop {r0-r12, lr}
.if _JP_==1
bne 0x2E09F8
.else
bne 0x2E0EE0
.endif
push {r0-r12, lr}
ldr r0,[r5,#0x0]
ldr r1,[r0,#0x20]
cpy r0,r5
blx r1
strb r11,[r4,#0x24]
pop {r0-r12, lr}
b 0x2E0EE0
.if _JP_==1
bne 0x2E09F8
.else
bne 0x2E0EE0
.endif

.global hook_InstantTextRemoveOff
hook_InstantTextRemoveOff:
push {r0-r12, lr}
bl Cheats_IsInstantText
cmp r0,#0x1
pop {r0-r12, lr}
.if _JP_==1
beq 0x2E09EC
ldr r0,[r5,#0x0]
b 0x2E01E4
.else
beq 0x2E0ED4
ldr r0,[r5,#0x0]
b 0x2E06CC
.endif

.global hook_TurboTextAdvance
hook_TurboTextAdvance:
Expand Down Expand Up @@ -180,6 +209,11 @@ hook_ItemUsability_Shield:
cmp r0,#0x0
b 0x42E2E8
.endif
.if _JP_==1
bne 0x42E3B4
cmp r0,#0x0
b 0x42E2D4
.endif

.global hook_Gfx_SleepQueryCallback
hook_Gfx_SleepQueryCallback:
Expand Down
7 changes: 2 additions & 5 deletions src/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ u32 GetCurrentPadState(void) {
u32 hid_shared_mem = *(u32*)(0x005AEC5C);
return *(volatile u32*)(hid_shared_mem + 0x1C);
}
#ifdef Version_JP
#define HID_PAD (REG32(0x10146000) ^ 0xFFF) //doesn't work on Citra
#else
#define HID_PAD (GetCurrentPadState())
#endif

#define HID_PAD (GetCurrentPadState())

#define dpadButtons (BUTTON_UP | BUTTON_DOWN | BUTTON_LEFT | BUTTON_RIGHT)

Expand Down

0 comments on commit 5d3cd37

Please sign in to comment.