Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions base/code/main.asm
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,20 @@
ldr r0, [r0]
pop pc

.thumb
@set_starting_items:
push lr

push r1 ; save r1, as it's used later on in the original code
bl set_starting_items
pop r1 ; restore r1

; These three instructions are the original instructions that the `bl` to this current
; function replaced. They are needed to be able to return to the original code.
mov r0, 0x3C
mul r0, r1

pop pc
.pool
.endarea

Expand Down Expand Up @@ -130,6 +144,16 @@
.pool
.endarea

.thumb
.org 0x20ad20e
.area 0x6, 0x00
; hook into the function that sets the starting item flags
bl @set_starting_items
; original instruction, do not change
b 0x20ad216
.pool
.endarea

.thumb
.org 0x20ae1c2
.area 0x6, 0x00
Expand Down Expand Up @@ -479,5 +503,6 @@
.importobj "code/spawn_custom_freestanding_item.o"
.importobj "code/custom_salvage_item.o"
.importobj "code/extend_give_item_function.o"
.importobj "code/set_starting_items.o"
.endarea
.close
7 changes: 7 additions & 0 deletions base/code/set_starting_items.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "ph.h"
#include <stdbool.h>
#include <stdint.h>

__attribute__((target("thumb"))) void set_starting_items(void) {
gItemManager->mItemFlags[1] |= 0x2; // start player with SW sea chart
}
Loading