-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We'll start with just the SW Sea chart, but this should be expanded in the future to eventually support any arbitrary item(s) the player chooses.
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
|
||
typedef struct { | ||
uint8_t address; | ||
uint8_t bit; | ||
} ItemFlag; | ||
|
||
// define array of ints | ||
ItemFlag starting_items[] = { | ||
// Oshus sword | ||
// {0x0, 0x1}, // TODO: enable this to support "Start with sword setting" | ||
|
||
// SW Sea Chart | ||
{0x8, 0x2}, // TODO: make this dynamic when the starting island is randomized | ||
}; | ||
|
||
__attribute__((target("thumb"))) void set_starting_items(void) { | ||
uint8_t *base_address = (uint8_t *)(0x21BA604); | ||
|
||
for (int i = 0; i < sizeof(starting_items) / sizeof(ItemFlag); i++) { | ||
uint8_t *flag = (uint8_t *)(starting_items[i].address + base_address); | ||
*flag |= starting_items[i].bit; | ||
} | ||
} |