Skip to content

Commit

Permalink
Merge branch 'new_flags' into dev-fenhl
Browse files Browse the repository at this point in the history
# Conflicts:
#	ASM/build/asm_symbols.txt
#	ASM/build/bundle.o
#	ASM/build/c_symbols.txt
#	ASM/c/item_draw_functions.c
#	ASM/c/item_draw_functions.h
#	ASM/c/item_draw_table.c
#	ASM/c/item_table.c
#	ASM/c/save.h
#	ASM/src/build.asm
#	ASM/src/hacks.asm
#	CI.py
#	Patches.py
#	Plandomizer.py
#	data/generated/rom_patch.txt
#	data/generated/symbols.json
#	data/presets_default.json
  • Loading branch information
fenhl committed Jun 8, 2024
2 parents 8bb968b + a3ddded commit 986e4f8
Show file tree
Hide file tree
Showing 39 changed files with 40,365 additions and 40,058 deletions.
2,854 changes: 1,430 additions & 1,424 deletions ASM/build/asm_symbols.txt

Large diffs are not rendered by default.

Binary file modified ASM/build/bundle.o
Binary file not shown.
1,283 changes: 646 additions & 637 deletions ASM/build/c_symbols.txt

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions ASM/c/actor.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ extern xflag_t* spawn_actor_with_flag;
#define EN_G_SWITCH 0x0117 //Silver Rupee
#define EN_WONDER_ITEM 0x0112 // Wonder Item

ActorOverlay* gActorOverlayTable = (ActorOverlay*)ACTOR_OVERLAY_TABLE_ADDR;

// Get a pointer to the additional data that is stored at the beginning of every actor
// This is calculated as the actor's address + the actor instance size from the overlay table.
ActorAdditionalData* Actor_GetAdditionalData(z64_actor_t* actor) {
Expand Down
31 changes: 2 additions & 29 deletions ASM/c/actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,9 @@
#define ACTOR_H

#include "z64.h"
#include "get_items.h"
#include <stdbool.h>

#define ACTOR_OVERLAY_TABLE_ADDR 0x800E8530

typedef void (*ActorFunc)(z64_actor_t*, z64_game_t*);

typedef struct {
/* 0x00 */ int16_t id;
/* 0x02 */ uint8_t category; // Classifies actor and determines when it will update or draw
/* 0x04 */ uint32_t flags;
/* 0x08 */ int16_t objectId;
/* 0x0C */ uint32_t instanceSize;
/* 0x10 */ ActorFunc init; // Constructor
/* 0x14 */ ActorFunc destroy; // Destructor
/* 0x18 */ ActorFunc update; // Update Function
/* 0x1C */ ActorFunc draw; // Draw function
} ActorInit; // size = 0x20

typedef struct {
/* 0x00 */ uintptr_t vromStart;
/* 0x04 */ uintptr_t vromEnd;
/* 0x08 */ void* vramStart;
/* 0x0C */ void* vramEnd;
/* 0x10 */ void* loadedRamAddr; // original name: "allocp"
/* 0x14 */ ActorInit* initInfo;
/* 0x18 */ char* name;
/* 0x1C */ uint16_t allocType; // See `ACTOROVL_ALLOC_` defines
/* 0x1E */ int8_t numLoaded; // original name: "clients"
} ActorOverlay; // size = 0x20

// New data added to the end of every actor.
// Make sure the size of this struct is equal to the amount of space added added in Actor_Spawn_Malloc_Hack from actor.asm
typedef struct {
Expand All @@ -49,5 +22,5 @@ void after_spawn_override_silver_rupee(z64_actor_t* actor, bool overridden);
void Actor_BuildFlag(z64_actor_t* actor, xflag_t* flag, uint16_t actor_index, uint8_t subflag);
ActorAdditionalData* Actor_GetAdditionalData(z64_actor_t* actor);
override_t get_newflag_override(xflag_t* flag);

extern ActorOverlay gActorOverlayTable[];
#endif
33 changes: 33 additions & 0 deletions ASM/c/demo_effect.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include "z64.h"
#include "util.h"
#include "demo_effect.h"
#include "models.h"

extern void DemoEffect_DrawJewel(z64_actor_t* this, z64_game_t* globalCtx, void* func);
extern void* DemoEffect_DrawJewel_AfterHook;

extern override_key_t CFG_BIGOCTO_OVERRIDE_KEY;

// Overrides the item model for the dungeon reward shown before the Big Octo fight
void DemoEffect_DrawJewel_Hook(DemoEffect* this, z64_game_t* globalCtx) {
if (!this->override_initialized) {
if (globalCtx->scene_index == 0x02) {
if (CFG_BIGOCTO_OVERRIDE_KEY.all) {
this->override = lookup_override_by_key(CFG_BIGOCTO_OVERRIDE_KEY);
}
if (this->override.key.all) {
this->actor.rot_2.x = 0;
this->actor.scale = (z64_xyzf_t) { 0.02f, 0.02f, 0.02f };
}
}

this->override_initialized = true;
}
if (this->override.key.all) {
model_t model;
lookup_model_by_override(&model, this->override);
draw_model(model, &this->actor, globalCtx, 5.0);
} else {
DemoEffect_DrawJewel(this, globalCtx, resolve_overlay_addr(&DemoEffect_DrawJewel_AfterHook, 0x008B));
}
}
110 changes: 110 additions & 0 deletions ASM/c/demo_effect.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#ifndef _DEMO_EFFECT_H_
#define _DEMO_EFFECT_H_
#include "z64.h"
#include "get_items.h"

typedef struct {
/* 0x00 */ uint8_t timer;
} DemoEffectFireBall;

typedef struct {
/* 0x00 */ uint8_t alpha;
/* 0x01 */ uint8_t scale;
/* 0x02 */ uint8_t pad;
/* 0x04 */ int16_t rotation;
} DemoEffectBlueOrb;

typedef struct {
/* 0x00 */ uint8_t alpha;
/* 0x01 */ uint8_t scaleFlag;
/* 0x02 */ uint8_t flicker;
/* 0x04 */ int16_t rotation;
} DemoEffectLight;

typedef struct {
/* 0x00 */ uint8_t alpha;
} DemoEffectLgtShower;

typedef struct {
/* 0x00 */ uint8_t type;
/* 0x01 */ uint8_t lightRingSpawnDelay;
/* 0x02 */ uint8_t rotation;
/* 0x04 */ int16_t lightRingSpawnTimer;
} DemoEffectGodLgt;

typedef struct {
/* 0x00 */ uint8_t timerIncrement;
/* 0x01 */ uint8_t alpha;
/* 0x02 */ uint8_t pad;
/* 0x04 */ int16_t timer;
} DemoEffectLightRing;

typedef struct {
/* 0x00 */ uint8_t triforceSpotOpacity;
/* 0x01 */ uint8_t lightColumnOpacity;
/* 0x02 */ uint8_t crystalLightOpacity;
/* 0x04 */ int16_t rotation;
} DemoEffectTriforceSpot;

typedef struct {
/* 0x00 */ uint8_t isPositionInit;
/* 0x01 */ uint8_t isLoaded;
/* 0x02 */ uint8_t drawId;
/* 0x04 */ int16_t rotation;
} DemoEffectGetItem;

typedef struct {
/* 0x00 */ uint8_t pad;
/* 0x01 */ uint8_t pad2;
/* 0x02 */ uint8_t pad3;
/* 0x04 */ int16_t shrinkTimer;
} DemoEffectTimeWarp;

typedef struct {
/* 0x00 */ uint8_t type;
/* 0x01 */ uint8_t isPositionInit;
/* 0x02 */ uint8_t alpha;
/* 0x04 */ int16_t timer;
} DemoEffectJewel;

typedef struct {
/* 0x00 */ uint8_t timer;
} DemoEffectDust;

typedef void (*DemoEffectFunc)(struct DemoEffect*, z64_game_t*);

typedef struct DemoEffect {
/* 0x0000 */ z64_actor_t actor;
/* 0x013C */ uint8_t skelCurve[0x20]; // size = 0x20
/* 0x015C */ uint8_t requiredObjectSlot;
/* 0x0160 */ Gfx* jewelDisplayList;
/* 0x0164 */ Gfx* jewelHolderDisplayList;
/* 0x0168 */ uint8_t primXluColor[3];
/* 0x016B */ uint8_t envXluColor[3];
/* 0x016E */ uint8_t primOpaColor[3];
/* 0x0171 */ uint8_t envOpaColor[3];
/* 0x0174 */ union {
DemoEffectFireBall fireBall;
DemoEffectBlueOrb blueOrb;
DemoEffectLight light;
DemoEffectLgtShower lgtShower;
DemoEffectGodLgt godLgt;
DemoEffectLightRing lightRing;
DemoEffectTriforceSpot triforceSpot;
DemoEffectGetItem getItem;
DemoEffectTimeWarp timeWarp;
DemoEffectJewel jewel;
DemoEffectDust dust;
};
/* 0x017A */ int16_t effectFlags;
/* 0x017C */ int16_t cueChannel;
/* 0x017E */ z64_xyz_t jewelCsRotation;
/* 0x0184 */ DemoEffectFunc initUpdateFunc;
/* 0x0188 */ ActorFunc initDrawFunc;
/* 0x018C */ DemoEffectFunc updateFunc;
// original size = 0x0190
/* 0x0190 */ override_t override;
/* 0x0xxx*/ bool override_initialized;
} DemoEffect;

#endif
8 changes: 4 additions & 4 deletions ASM/c/dungeon_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ void draw_dungeon_info(z64_disp_buf_t* db) {
if (total_keys < 0) total_keys = 0;
if (total_keys > 9) total_keys = 9;

char count[5] = "O(O)";
char count[5] = "O(O)"; // we use O instead of 0 because it's easier to distinguish from 8
if (current_keys > 0) count[0] = current_keys + '0';
if (total_keys > 0) count[2] = total_keys + '0';
int top = start_top + ((icon_size + padding) * i) + 1;
Expand Down Expand Up @@ -645,7 +645,7 @@ void draw_dungeon_info(z64_disp_buf_t* db) {

left += icon_size + padding;

// Draw reward worlds
// Draw reward world numbers

if (CFG_DUNGEON_INFO_REWARD_WORLDS_ENABLE) {
for (int i = 0; i < 9; i++) {
Expand Down Expand Up @@ -674,7 +674,7 @@ void draw_dungeon_info(z64_disp_buf_t* db) {
continue;
}
uint8_t world = CFG_DUNGEON_REWARD_WORLDS[i];
char world_text[5] = "WOOO";
char world_text[5] = "WOOO"; // we use O instead of 0 because it's easier to distinguish from 8
if (world < 100) {
world_text[0] = ' ';
world_text[1] = 'W';
Expand Down Expand Up @@ -786,7 +786,7 @@ void draw_dungeon_info(z64_disp_buf_t* db) {
if (total_keys < 0) total_keys = 0;
if (total_keys > 9) total_keys = 9;

char count[5] = "O(O)";
char count[5] = "O(O)"; // we use O instead of 0 because it's easier to distinguish from 8
if (current_keys > 0) count[0] = current_keys + '0';
if (total_keys > 0) count[2] = total_keys + '0';
int top = start_top + ((icon_size + padding) * i) + 1;
Expand Down
24 changes: 12 additions & 12 deletions ASM/c/item_draw_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,18 @@ item_draw_table_entry_t item_draw_table[] = {
[0x91] = { draw_gi_c_button_vertical, { 0x06000960, 0xFFA000FF, 1 } }, // Cdown button
[0x92] = { draw_gi_c_button_horizontal, { 0x06000E10, 0xFFA000FF, 1 } }, // Cleft button
[0x93] = { draw_gi_c_button_horizontal, { 0x06000E10, 0xFFA000FF, 0 } }, // Cright button
[0x94] = { draw_gi_magic_meter, { 0x06000A80, 0x06000F80, 0x060014C0, 0x00CE00FF, 0xFFFFFFFF, 0x000000FF } }, // Magic Meter , 0x000000FF -- 0x06000F70, 0x00CE00FF, --, 0x06009C0, 0x06001030, 0x00CE00FF, 0xFFFFFFFF
[0x95] = { draw_gi_medallions, { 0x060004d0, 0x06000f80 } }, // Light Medallion
[0x96] = { draw_gi_medallions, { 0x06000370, 0x06000e40 } }, // Forest Medallion
[0x97] = { draw_gi_medallions, { 0x060001b0, 0x06000c30 } }, // Fire Medallion
[0x98] = { draw_gi_medallions, { 0x06000330, 0x06000e00 } }, // Water Medallion
[0x99] = { draw_gi_medallions, { 0x060002d0, 0x06000d60 } }, // Shadow Medallion
[0x9A] = { draw_gi_medallions, { 0x06000380, 0x06000e40 } }, // Spirit Medallion
[0x9B] = { draw_gi_stones, { 0x06000b50, 0x06001290, 0xffffa0ff, 0x00ff00ff } }, // Kokiri Emerald
[0x9C] = { draw_gi_stones, { 0x06000620, 0x06000920, 0xffaaffff, 0xff0064ff } }, // Goron Ruby
[0x9D] = { draw_gi_stones, { 0x06000b00, 0x060012f0, 0x32ffffff, 0x320096ff } }, // Zora Sapphire
[0x9E] = { draw_gi_fairy, { 0x06000EF0 } }, // Fairy (not in a bottle but uses the fairy from the bottle)
[0x9F] = { draw_gi_nothing, {} },
[0x94] = { draw_gi_medallions, { 0x060004d0, 0x06000f80 } }, // Light Medallion
[0x95] = { draw_gi_medallions, { 0x06000370, 0x06000e40 } }, // Forest Medallion
[0x96] = { draw_gi_medallions, { 0x060001b0, 0x06000c30 } }, // Fire Medallion
[0x97] = { draw_gi_medallions, { 0x06000330, 0x06000e00 } }, // Water Medallion
[0x98] = { draw_gi_medallions, { 0x060002d0, 0x06000d60 } }, // Shadow Medallion
[0x99] = { draw_gi_medallions, { 0x06000380, 0x06000e40 } }, // Spirit Medallion
[0x9A] = { draw_gi_stones, { 0x06000b50, 0x06001290, 0xffffa0ff, 0x00ff00ff } }, // Kokiri Emerald
[0x9B] = { draw_gi_stones, { 0x06000620, 0x06000920, 0xffaaffff, 0xff0064ff } }, // Goron Ruby
[0x9C] = { draw_gi_stones, { 0x06000b00, 0x060012f0, 0x32ffffff, 0x320096ff } }, // Zora Sapphire
[0x9D] = { draw_gi_fairy, { 0x06000EF0 } }, // Fairy (not in a bottle but uses the fairy from the bottle)
[0x9E] = { draw_gi_nothing, {} },
[0x9F] = { draw_gi_magic_meter, { 0x06000A80, 0x06000F80, 0x060014C0, 0x00CE00FF, 0xFFFFFFFF, 0x000000FF } }, // Magic Meter , 0x000000FF -- 0x06000F70, 0x00CE00FF, --, 0x06009C0, 0x06001030, 0x00CE00FF, 0xFFFFFFFF
};

void base_draw_gi_model(z64_game_t* game, uint32_t draw_id) {
Expand Down
26 changes: 13 additions & 13 deletions ASM/c/item_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ item_row_t item_table[] = {
[0x00B7] = ITEM_ROW(0x53, SILVER_CHEST, 0x41, -1, 0x00A1, 0x00AA, 0x02, no_upgrade, give_small_key, CASTLE_ID, -1, resolve_text_small_keys), // Ganon's Castle Small Key

[0x00B8] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x00E9, 0x0194, 0x13, no_upgrade, give_defense, -1, -1, NULL), // Double Defense
[0x00B9] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x00E4, 0x01AB, 0x95, no_upgrade, give_magic, -1, -1, NULL), // Magic Meter
[0x00BA] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x00E8, 0x01AB, 0x95, no_upgrade, give_double_magic, -1, -1, NULL), // Double Magic
[0x00B9] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x00E4, 0x01B4, 0xA0, no_upgrade, give_magic, -1, -1, NULL), // Magic Meter
[0x00BA] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x00E8, 0x01B4, 0xA0, no_upgrade, give_double_magic, -1, -1, NULL), // Double Magic

[0x00BB] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x9091, 0x0196, 0x78, no_upgrade, give_quest_item, 6, -1, NULL), // Minuet of Forest
[0x00BC] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x9092, 0x0196, 0x79, no_upgrade, give_quest_item, 7, -1, NULL), // Bolero of Fire
Expand Down Expand Up @@ -328,20 +328,20 @@ item_row_t item_table[] = {
[0x0117] = ITEM_ROW(0x53, SILVER_CHEST, 0x41, -1, 0x00A1, 0x01A1, 0x88, no_upgrade, give_small_key, CASTLE_ID, -1, resolve_text_small_keys), // Ganon's Castle Small Key
[0x0118] = ITEM_ROW(0x53, SILVER_CHEST, 0x41, -1, 0x00F3, 0x01A2, 0x89, no_upgrade, give_small_key, TCG_ID, -1, resolve_text_small_keys_cmg), // Small Key (Chest Game)

[0x0119] = ITEM_ROW(0x53, BROWN_CHEST, 0x41, -1, 0x90B4, 0x0177, 0x9F, no_upgrade, full_heal, -1, -1, NULL), // Fairy
[0x011A] = ITEM_ROW(0x53, BROWN_CHEST, 0x41, -1, 0x90B5, 0x0177, 0xA0, no_upgrade, no_effect, -1, -1, NULL), // Nothing :)
[0x0119] = ITEM_ROW(0x53, BROWN_CHEST, 0x41, -1, 0x90B4, 0x0177, 0x9E, no_upgrade, full_heal, -1, -1, NULL), // Fairy
[0x011A] = ITEM_ROW(0x53, BROWN_CHEST, 0x41, -1, 0x90B5, 0x0177, 0x9F, no_upgrade, no_effect, -1, -1, NULL), // Nothing :)

// 0x011B through 0x0126 reserved for https://github.com/OoTRandomizer/OoT-Randomizer/pull/2108

[0x0127] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x0080, 0x01AC, 0x9C, no_upgrade, give_quest_item, 18, -1, NULL), // Kokiri Emerald
[0x0128] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x0081, 0x01AD, 0x9D, no_upgrade, give_quest_item, 19, -1, NULL), // Goron Ruby
[0x0129] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x0082, 0x01AE, 0x9E, no_upgrade, give_quest_item, 20, -1, NULL), // Zora Sapphire
[0x012A] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x0040, 0x01AF, 0x96, no_upgrade, give_quest_item, 5, -1, NULL), // Light Medallion
[0x012B] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x003E, 0x01B0, 0x97, no_upgrade, give_quest_item, 0, -1, NULL), // Forest Medallion
[0x012C] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x003C, 0x01B1, 0x98, no_upgrade, give_quest_item, 1, -1, NULL), // Fire Medallion
[0x012D] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x003D, 0x01B2, 0x99, no_upgrade, give_quest_item, 2, -1, NULL), // Water Medallion
[0x012E] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x0041, 0x01B3, 0x9A, no_upgrade, give_quest_item, 4, -1, NULL), // Shadow Medallion
[0x012F] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x003F, 0x01B4, 0x9B, no_upgrade, give_quest_item, 3, -1, NULL), // Spirit Medallion
[0x0127] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x0080, 0x01AB, 0x9B, no_upgrade, give_quest_item, 18, -1, NULL), // Kokiri Emerald
[0x0128] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x0081, 0x01AC, 0x9C, no_upgrade, give_quest_item, 19, -1, NULL), // Goron Ruby
[0x0129] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x0082, 0x01AD, 0x9D, no_upgrade, give_quest_item, 20, -1, NULL), // Zora Sapphire
[0x012A] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x0040, 0x01AE, 0x95, no_upgrade, give_quest_item, 5, -1, NULL), // Light Medallion
[0x012B] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x003E, 0x01AF, 0x96, no_upgrade, give_quest_item, 0, -1, NULL), // Forest Medallion
[0x012C] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x003C, 0x01B0, 0x97, no_upgrade, give_quest_item, 1, -1, NULL), // Fire Medallion
[0x012D] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x003D, 0x01B1, 0x98, no_upgrade, give_quest_item, 2, -1, NULL), // Water Medallion
[0x012E] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x0041, 0x01B2, 0x99, no_upgrade, give_quest_item, 4, -1, NULL), // Shadow Medallion
[0x012F] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x003F, 0x01B3, 0x9A, no_upgrade, give_quest_item, 3, -1, NULL), // Spirit Medallion

// New items in dev-fenhl which are not in main Dev
// Some previously used IDs may be skipped, to simplify auto-tracker support
Expand Down
1 change: 0 additions & 1 deletion ASM/c/models.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#define object_size 0x1E70
#define num_vanilla_objects 0x192


extern uint8_t SHUFFLE_CHEST_GAME;
extern uint32_t EXTENDED_OBJECT_TABLE;
extern EnItem00* collectible_mutex;
Expand Down
6 changes: 4 additions & 2 deletions ASM/c/models.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ typedef struct model_t {

typedef struct {
uint16_t object_id;
uint8_t *buf;
uint8_t* buf;
} loaded_object_t;


void models_init();
void models_reset();
void draw_model(model_t model, z64_actor_t *actor, z64_game_t *game, float base_scale);

void lookup_model_by_override(model_t *model, override_t override);
void draw_model(model_t model, z64_actor_t* actor, z64_game_t* game, float base_scale);

#endif
1 change: 0 additions & 1 deletion ASM/c/obj_kibako2.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#define CRATE_CI8_TEXTURE_TOP_OFFSET 0x200
#define CRATE_CI8_TEXTURE_SIDE_OFFSET 0xA00


extern uint8_t POTCRATE_TEXTURES_MATCH_CONTENTS;
extern uint8_t POTCRATE_GOLD_TEXTURE;
extern uint8_t POTCRATE_GILDED_TEXTURE;
Expand Down
10 changes: 10 additions & 0 deletions ASM/c/util.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "util.h"
#include "z64.h"
#include "actor.h"

extern char C_HEAP[];
void* heap_next = NULL;
Expand All @@ -20,3 +22,11 @@ void file_init(file_t* file) {
file->buf = heap_alloc(file->size);
read_file(file->buf, file->vrom_start, file->size);
}

void* resolve_overlay_addr(void* addr, uint16_t overlay_id) {
ActorOverlay overlay = gActorOverlayTable[overlay_id];
if (overlay.loadedRamAddr) {
return addr - overlay.vramStart + overlay.loadedRamAddr;
}
return NULL;
}
1 change: 1 addition & 0 deletions ASM/c/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ typedef void (*read_file_fn)(void* mem_addr, uint32_t vrom_addr,
#define read_file ((read_file_fn)0x80000DF0)

void file_init(file_t* file);
void* resolve_overlay_addr(void* addr, uint16_t overlay_id);

#endif
Loading

0 comments on commit 986e4f8

Please sign in to comment.