mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
Modern gcc + shiftability work (#942)
* wip changes for modern gcc * more * wip * blah * Define explicit size for symbol * Clean up evt_handle_exec1 * wip * . * fixes & VLA macro * VLA innit * wipz * Fix potential UB * meowp * meowp2 * fixies * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "e1f0b17917" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "e1f0b17917" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * fixules * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "3ba3277e57" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "3ba3277e57" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * more shiftability + symbols work * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "02879e52a7" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "02879e52a7" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * more * revert bss changes for now, new heaps overlay for aligning stuff to 0x1000 (not sure how necessary that is, so maybe will revert later on) * 'fixing' jp shift build * more * more syms * more progress * more * ididid * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "de54da38f5" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "de54da38f5" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "a27dc436a6" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "a27dc436a6" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "aa416e4" * blah * stuff's broken, but at least it's maybe cleaner * modern gcc back * revert * shifting all overlays - works so far * progs * another * modern gcc flag, re-enabled all ifdef shift stuff * fixies * progress * fixes, matching build * heaps3 overlay and some symbol names * changies * PR comments & cleanup
This commit is contained in:
parent
8c688c82d7
commit
a37f30dc94
13
.vscode/settings.json
vendored
13
.vscode/settings.json
vendored
@ -17,14 +17,13 @@
|
||||
],
|
||||
"git.ignoreLimitWarning": true,
|
||||
"search.exclude": {
|
||||
"**/build/src": true,
|
||||
"docs/doxygen": true,
|
||||
"ctx.c": true,
|
||||
"ver/current": true,
|
||||
"ver/us/build": true,
|
||||
"ver/jp/build": true,
|
||||
"expected": true,
|
||||
"**/*.i": true,
|
||||
"**/build/src": true,
|
||||
"ctx.c": true,
|
||||
"docs/doxygen": true,
|
||||
"expected": true,
|
||||
"ver/jp/expected": true,
|
||||
"ver/us/expected": true
|
||||
},
|
||||
"python.autoComplete.extraPaths": [
|
||||
"./tools"
|
||||
|
@ -2509,11 +2509,4 @@ typedef struct LavaPiranhaVine {
|
||||
/* 0x1DC */ s32 numPoints;
|
||||
} LavaPiranhaVine;
|
||||
|
||||
// TODO look into making options here better. it's really an array of 5 substructs, each having and [8][2] array
|
||||
typedef struct PlayerCelebrationAnimOptions {
|
||||
/* 0x00 */ s16 randomChance;
|
||||
/* 0x02 */ s16 hpBasedChance;
|
||||
/* 0x04 */ s32 options[0];
|
||||
} PlayerCelebrationAnimOptions; // size = 0x8
|
||||
|
||||
#endif
|
||||
|
@ -1524,10 +1524,6 @@ typedef struct RadiatingEnergyOrbFXData {
|
||||
/* 0x30 */ f32 unk_30;
|
||||
} RadiatingEnergyOrbFXData; // size = 0x34
|
||||
|
||||
typedef struct QuizmoAnswerFXData {
|
||||
/* 0x00 */ char todo[0];
|
||||
} QuizmoAnswerFXData; // size = unknown
|
||||
|
||||
typedef struct MotionBlurFlameFXData {
|
||||
/* 0x00 */ s32 unk_00;
|
||||
/* 0x04 */ f32 unk_04;
|
||||
@ -2719,7 +2715,7 @@ typedef union {
|
||||
struct ChompDropFXData* chompDrop;
|
||||
struct QuizmoStageFXData* quizmoStage;
|
||||
struct RadiatingEnergyOrbFXData* radiatingEnergyOrb;
|
||||
struct QuizmoAnswerFXData* quizmoAnswer;
|
||||
void* quizmoAnswer;
|
||||
struct MotionBlurFlameFXData* motionBlurFlame;
|
||||
struct EnergyOrbWaveFXData* energyOrbWave;
|
||||
struct MerlinHouseStarsFXData* merlinHouseStars;
|
||||
|
@ -5,9 +5,23 @@
|
||||
#include "include_asm.h"
|
||||
|
||||
#ifndef M2CTX
|
||||
|
||||
#ifdef SHIFT
|
||||
#define SHIFT_BSS __attribute__ ((section (".bss")))
|
||||
#else
|
||||
#define SHIFT_BSS extern
|
||||
#endif
|
||||
|
||||
#ifdef SHIFT
|
||||
#define MATCHING_BSS(size)
|
||||
#else
|
||||
#define MATCHING_BSS(size) static BSS u8 padding_bss[size];
|
||||
#endif
|
||||
|
||||
#define BSS __attribute__ ((section (".bss")))
|
||||
#define TRANSPARENT_UNION __attribute__ ((__transparent_union__))
|
||||
#else
|
||||
#define SHIFT_BSS static
|
||||
#define BSS static
|
||||
#define TRANSPARENT_UNION
|
||||
#endif
|
||||
@ -90,6 +104,12 @@
|
||||
#define SCREEN_WIDTH 320
|
||||
#define SCREEN_HEIGHT 240
|
||||
|
||||
#define COLLISION_HEAP_SIZE 0x18000
|
||||
#define GENERAL_HEAP_SIZE 0x54000
|
||||
#define SPRITE_HEAP_SIZE 0x40000
|
||||
#define BATTLE_HEAP_SIZE 0x25800
|
||||
#define FRAME_BUFFER_SIZE 0x25800
|
||||
|
||||
#define CAM_NEAR_CLIP 16
|
||||
#define CAM_FAR_CLIP 4096
|
||||
|
||||
@ -193,4 +213,10 @@
|
||||
.models = { names } \
|
||||
}
|
||||
|
||||
#ifdef OLD_GCC
|
||||
#define VLA 0
|
||||
#else
|
||||
#define VLA
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -83,7 +83,7 @@ typedef ModelTransformGroup* ModelTransformGroupList[MAX_MODEL_TRANSFORM_GROUPS]
|
||||
|
||||
typedef struct ModelIDList {
|
||||
u16 count;
|
||||
u16 list[0];
|
||||
u16 list[VLA];
|
||||
} ModelIDList;
|
||||
|
||||
typedef struct ModelLocalVertexCopy {
|
||||
@ -150,6 +150,8 @@ typedef enum ExtraTileTypes {
|
||||
EXTRA_TILE_4 = 4,
|
||||
} ExtraTileTypes;
|
||||
|
||||
#define SHAPE_SIZE_LIMIT 0x8000
|
||||
|
||||
typedef struct ShapeFile {
|
||||
/* 0x00 */ ModelNode* root;
|
||||
/* 0x04 */ Vtx_t* vertexTable;
|
||||
@ -158,7 +160,7 @@ typedef struct ShapeFile {
|
||||
/* 0x10 */ char** zoneNames;
|
||||
/* 0x14 */ unsigned char pad_14[0xC];
|
||||
// end header
|
||||
/* 0x20 */ u8 data[0];
|
||||
/* 0x20 */ u8 data[SHAPE_SIZE_LIMIT - 0x20];
|
||||
} ShapeFile; // size = variable
|
||||
|
||||
typedef ModelTreeInfo ModelTreeInfoList[0x200];
|
||||
|
@ -127,7 +127,6 @@ extern char wMapTexName[];
|
||||
extern char wMapHitName[];
|
||||
extern char wMapShapeName[];
|
||||
extern char wMapBgName[];
|
||||
extern struct ShapeFile D_80210000;
|
||||
extern u8 D_802D9D70; // player alpha1 copy?
|
||||
extern u8 D_802D9D71; // player alpha2 copy?
|
||||
|
||||
@ -214,17 +213,8 @@ extern AnimID HammerBroDisguiseExtraAnims[];
|
||||
|
||||
extern s16 gCurrentCamID;
|
||||
|
||||
extern HeapNode gSpriteHeapPtr;
|
||||
|
||||
extern s32 D_8029C890[10][5];
|
||||
|
||||
// frame buffers
|
||||
extern u16 D_8038F800[];
|
||||
extern u16 D_803B5000[];
|
||||
extern u16 D_803DA800[];
|
||||
|
||||
extern HeapNode heap_collisionHead;
|
||||
extern HeapNode heap_generalHead;
|
||||
extern HeapNode heap_battleHead;
|
||||
|
||||
extern u32 bMarioIdleAnims[];
|
||||
|
@ -10,6 +10,8 @@
|
||||
#endif
|
||||
|
||||
extern s32 spr_allocateBtlComponentsOnWorldHeap;
|
||||
extern HeapNode heap_generalHead;
|
||||
extern HeapNode heap_spriteHead;
|
||||
|
||||
BSS s32 spr_asset_entry[2];
|
||||
BSS s32 D_802DFEB8[101];
|
||||
@ -91,9 +93,9 @@ SpriteAnimData* spr_load_sprite(s32 idx, s32 isPlayerSprite, s32 useTailAlloc) {
|
||||
ptr1++;
|
||||
|
||||
if (useTailAlloc) {
|
||||
animData = _heap_malloc_tail(&gSpriteHeapPtr, *ptr1);
|
||||
animData = _heap_malloc_tail(&heap_spriteHead, *ptr1);
|
||||
} else {
|
||||
animData = _heap_malloc(&gSpriteHeapPtr, *ptr1);
|
||||
animData = _heap_malloc(&heap_spriteHead, *ptr1);
|
||||
}
|
||||
decode_yay0(data, animData);
|
||||
general_heap_free(data);
|
||||
@ -146,7 +148,6 @@ SpriteAnimData* spr_load_sprite(s32 idx, s32 isPlayerSprite, s32 useTailAlloc) {
|
||||
return animData;
|
||||
}
|
||||
|
||||
#ifndef SHIFT
|
||||
void spr_init_player_raster_cache(s32 cacheSize, s32 maxRasterSize) {
|
||||
void* raster;
|
||||
s32 i;
|
||||
@ -157,7 +158,7 @@ void spr_init_player_raster_cache(s32 cacheSize, s32 maxRasterSize) {
|
||||
SpriteDataHeader[0] += SPRITE_ROM_START;
|
||||
SpriteDataHeader[1] += SPRITE_ROM_START;
|
||||
SpriteDataHeader[2] += SPRITE_ROM_START;
|
||||
raster = _heap_malloc(&gSpriteHeapPtr, maxRasterSize * cacheSize);
|
||||
raster = _heap_malloc(&heap_spriteHead, maxRasterSize * cacheSize);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(PlayerRasterCache); i++) {
|
||||
PlayerRasterCache[i].raster = raster;
|
||||
@ -174,9 +175,6 @@ void spr_init_player_raster_cache(s32 cacheSize, s32 maxRasterSize) {
|
||||
nuPiReadRom(SpriteDataHeader[0], &PlayerRasterHeader, sizeof(PlayerRasterHeader));
|
||||
nuPiReadRom(SpriteDataHeader[0] + PlayerRasterHeader[0], D_802E0C20, sizeof(D_802E0C20));
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM_SHIFT(void, "101b90_len_8f0", spr_init_player_raster_cache);
|
||||
#endif
|
||||
|
||||
IMG_PTR spr_get_player_raster(s32 rasterIndex, s32 playerSpriteID) {
|
||||
PlayerSpriteCacheEntry* temp_s0;
|
||||
@ -341,7 +339,7 @@ void spr_load_npc_extra_anims(SpriteAnimData* header, u32* extraAnimList) {
|
||||
}
|
||||
}
|
||||
|
||||
_heap_realloc(&gSpriteHeapPtr, header, (s32)writePos - (s32)header);
|
||||
_heap_realloc(&heap_spriteHead, header, (s32)writePos - (s32)header);
|
||||
}
|
||||
|
||||
SpriteComponent** spr_allocate_components(s32 count) {
|
||||
@ -362,7 +360,7 @@ SpriteComponent** spr_allocate_components(s32 count) {
|
||||
listPos = listStart;
|
||||
component = (SpriteComponent*) listPos;
|
||||
} else {
|
||||
listStart = _heap_malloc(&gSpriteHeapPtr, totalSize);
|
||||
listStart = _heap_malloc(&heap_spriteHead, totalSize);
|
||||
listPos = listStart;
|
||||
component = (SpriteComponent*) listPos;
|
||||
}
|
||||
|
18
src/16F740.c
18
src/16F740.c
@ -11,10 +11,10 @@ extern StageListRow* gCurrentStagePtr;
|
||||
extern s16 D_802809F6;
|
||||
extern s16 D_802809F8;
|
||||
extern s32 BattleScreenFadeAmt;
|
||||
extern EvtScript EVS_OnBattleInit[];
|
||||
extern EvtScript EVS_OnBattleInit;
|
||||
extern s32 D_80281454[];
|
||||
extern EvtScript EVS_Mario_OnActorCreate[];
|
||||
extern EvtScript EVS_Peach_OnActorCreate[];
|
||||
extern EvtScript EVS_Mario_OnActorCreate;
|
||||
extern EvtScript EVS_Peach_OnActorCreate;
|
||||
|
||||
BSS s32 BattleEnemiesCreated;
|
||||
BSS u8 D_8029F244;
|
||||
@ -29,6 +29,8 @@ BSS s32 D_8029F264;
|
||||
|
||||
s32 dispatch_damage_event_player_0(s32 damageAmount, s32 event);
|
||||
|
||||
extern ShapeFile gMapShapeData;
|
||||
|
||||
void btl_merlee_on_start_turn(void) {
|
||||
BattleStatus* battleStatus = &gBattleStatus;
|
||||
EncounterStatus* currentEncounter = &gCurrentEncounter;
|
||||
@ -217,12 +219,12 @@ void btl_state_update_normal_start(void) {
|
||||
BattleEnemiesCreated = battle->formationSize;
|
||||
set_screen_overlay_params_back(255, -1.0f);
|
||||
compressedAsset = load_asset_by_name(stage->shape, &size);
|
||||
decode_yay0(compressedAsset, &D_80210000);
|
||||
decode_yay0(compressedAsset, &gMapShapeData);
|
||||
general_heap_free(compressedAsset);
|
||||
|
||||
ASSERT(size <= 0x8000);
|
||||
|
||||
model = D_80210000.root;
|
||||
model = gMapShapeData.root;
|
||||
textureRom = get_asset_offset(stage->texture, &size);
|
||||
if (model != NULL) {
|
||||
load_data_for_models(model, textureRom, size);
|
||||
@ -311,7 +313,7 @@ void btl_state_update_normal_start(void) {
|
||||
battleStatus->buffEffect = fx_partner_buff(0, 0.0f, 0.0f, 0.0f, 0.0f, 0);
|
||||
func_800E9810();
|
||||
gCurrentCameraID = CAM_BATTLE;
|
||||
script = start_script(EVS_OnBattleInit, EVT_PRIORITY_A, 0);
|
||||
script = start_script(&EVS_OnBattleInit, EVT_PRIORITY_A, 0);
|
||||
battleStatus->camMovementScript = script;
|
||||
battleStatus->camMovementScriptID = script->id;
|
||||
gBattleSubState = BTL_SUBSTATE_NORMAL_START_CREATE_ENEMIES;
|
||||
@ -382,9 +384,9 @@ void btl_state_update_normal_start(void) {
|
||||
load_player_actor();
|
||||
actor = battleStatus->playerActor;
|
||||
if (gBattleStatus.flags2 & BS_FLAGS2_PEACH_BATTLE) {
|
||||
script = start_script(EVS_Peach_OnActorCreate, EVT_PRIORITY_A, 0);
|
||||
script = start_script(&EVS_Peach_OnActorCreate, EVT_PRIORITY_A, 0);
|
||||
} else {
|
||||
script = start_script(EVS_Mario_OnActorCreate, EVT_PRIORITY_A, 0);
|
||||
script = start_script(&EVS_Mario_OnActorCreate, EVT_PRIORITY_A, 0);
|
||||
}
|
||||
actor->takeTurnScript = script;
|
||||
actor->takeTurnScriptID = script->id;
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "sprite/npc/Twink.h"
|
||||
#include "sprite/npc/BattleMerlee.h"
|
||||
#include "battle/action_cmd/flee.h"
|
||||
#include "battle/battle.h"
|
||||
|
||||
extern HudScript HES_Happy;
|
||||
extern HudScript HES_HPDrain;
|
||||
|
@ -1653,8 +1653,9 @@ ApiStatus PlayerTestEnemy(Evt* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus DispatchDamagePlayerEvent(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 damageAmount = evt_get_variable(script, *args++);
|
||||
|
||||
if (dispatch_damage_event_player_0(evt_get_variable(script, *args++), *args++) < 0) {
|
||||
if (dispatch_damage_event_player_0(damageAmount, *args++) < 0) {
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
|
||||
|
@ -127,6 +127,4 @@ ApiStatus LoadStarPowerScript(Evt* script, s32 isInitialCall) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
#ifndef SHIFT
|
||||
static BSS u8 bss_padding[0x1390];
|
||||
#endif
|
||||
MATCHING_BSS(0x1390);
|
||||
|
25
src/415D90.c
25
src/415D90.c
@ -409,9 +409,6 @@ BSS s32 D_802AD658[5]; // msg IDs
|
||||
BSS s32 D_802AD66C;
|
||||
BSS s32 D_802AD670;
|
||||
|
||||
//TODO remove it in func_802A45D8 and use D_802AD670 instead
|
||||
extern s8 D_802AD673;
|
||||
|
||||
BSS s32 D_802AD674; // unused?
|
||||
BSS s32 D_802AD678[6];
|
||||
BSS s32 D_802AD690[6];
|
||||
@ -438,6 +435,9 @@ void btl_init_menu_partner(void);
|
||||
void func_800F52BC(void);
|
||||
void func_800F16CC(void);
|
||||
|
||||
void btl_init_menu_boots(void);
|
||||
void btl_init_menu_hammer(void);
|
||||
|
||||
void btl_main_menu_init(void) {
|
||||
D_802AD006 = 255;
|
||||
BattleMenuAlpha = 255;
|
||||
@ -1664,8 +1664,8 @@ void func_802A45D8(void) {
|
||||
s8 temp802AD673;
|
||||
|
||||
BattleSubmenuStratsState = 0;
|
||||
D_802AD605 = D_802AD673;
|
||||
D_802AD606 = D_802AD673;
|
||||
D_802AD605 = D_802AD670;
|
||||
D_802AD606 = D_802AD670;
|
||||
D_802AD608 = 0;
|
||||
D_802AD60A = D_802AD66C;
|
||||
|
||||
@ -1681,12 +1681,12 @@ void func_802A45D8(void) {
|
||||
|
||||
D_802AD624 = 255;
|
||||
D_802AD60B = 1;
|
||||
temp802AD673 = D_802AD673;
|
||||
temp802AD673 = D_802AD670;
|
||||
|
||||
if (D_802AD673 < 0) {
|
||||
D_802AD608 = D_802AD673;
|
||||
if ((s8) D_802AD670 < 0) {
|
||||
D_802AD608 = D_802AD670;
|
||||
}
|
||||
if (D_802AD673 >= D_802AD609) {
|
||||
if ((s8) D_802AD670 >= D_802AD609) {
|
||||
D_802AD608 = (temp802AD673 + 1 - D_802AD60A);
|
||||
}
|
||||
|
||||
@ -1696,7 +1696,7 @@ void func_802A45D8(void) {
|
||||
}
|
||||
|
||||
D_802AD60C = -D_802AD608 * 13;
|
||||
D_802AD60E = (D_802AD673 - D_802AD608) * 13;
|
||||
D_802AD60E = ((s8) D_802AD670 - D_802AD608) * 13;
|
||||
D_802AD607 = 0;
|
||||
D_802AD6D4 = 0;
|
||||
}
|
||||
@ -2138,7 +2138,7 @@ s32 can_btl_state_update_switch_to_player(void) {
|
||||
}
|
||||
}
|
||||
|
||||
extern s32 D_8008EEF0[];
|
||||
extern s32 D_8008EEF0[]; // TODO MOVE
|
||||
|
||||
s32 func_802A58D0(void) {
|
||||
BattleStatus* battleStatus = &gBattleStatus;
|
||||
@ -2183,9 +2183,6 @@ s32 func_802A58D0(void) {
|
||||
return !partnerCantMove;
|
||||
}
|
||||
|
||||
void btl_init_menu_boots(void);
|
||||
void btl_init_menu_hammer(void);
|
||||
|
||||
void btl_state_update_player_menu(void) {
|
||||
BattleStatus* battleStatus = &gBattleStatus;
|
||||
PlayerData* playerData = &gPlayerData;
|
||||
|
@ -8,8 +8,7 @@
|
||||
#include "ld_addrs.h"
|
||||
|
||||
#ifdef SHIFT
|
||||
// TODO same address as all world actions - picked the first one
|
||||
#define PLAYER_ACTION_VRAM_DEF world_action_idle_VRAM
|
||||
#define PLAYER_ACTION_VRAM_DEF texture_memory_VRAM_END
|
||||
#else
|
||||
#define PLAYER_ACTION_VRAM_DEF (void*) 0x802B6000
|
||||
#endif
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "hud_element.h"
|
||||
#include "camera.h"
|
||||
|
||||
f32 D_8009A5EC;
|
||||
//extern f32 D_8009A5EC; TODO BSS
|
||||
|
||||
void render_models(void);
|
||||
void execute_render_tasks(void);
|
||||
|
@ -6,17 +6,21 @@
|
||||
#include "hud_element.h"
|
||||
#include "effects.h"
|
||||
#include "nu/nusys.h"
|
||||
#include "model_clear_render_tasks.h"
|
||||
|
||||
extern Addr MapTextureMemory;
|
||||
|
||||
#ifdef SHIFT
|
||||
#define MODEL_TEXTURE_BASE_ADDRESS 0x8028E000 // TODO shiftability
|
||||
#define BATTLE_ENTITY_HEAP_BASE 0x80267FF0 // TODO shiftability
|
||||
#define AREA_SPECIFIC_ENTITY_VRAM entity_default_VRAM
|
||||
#define BATTLE_ENTITY_HEAP_BOTTOM 0x80250000 // TODO shiftability
|
||||
extern Addr WorldEntityHeapBase;
|
||||
#define WORLD_ENTITY_HEAP_BOTTOM 0x80650000 // TODO shiftability (used only for munchlesia, hacky as hell)
|
||||
#define WORLD_ENTITY_HEAP_BASE (s32) WorldEntityHeapBase
|
||||
// TODO this only refers to one of 3 overlays which happen to share the same address space
|
||||
// but don't necessarily have to
|
||||
#define AREA_SPECIFIC_ENTITY_VRAM (s32) entity_default_VRAM
|
||||
#else
|
||||
#define MODEL_TEXTURE_BASE_ADDRESS 0x8028E000
|
||||
#define BATTLE_ENTITY_HEAP_BASE 0x80267FF0
|
||||
#define WORLD_ENTITY_HEAP_BOTTOM 0x80250000
|
||||
#define WORLD_ENTITY_HEAP_BASE 0x80267FF0
|
||||
#define AREA_SPECIFIC_ENTITY_VRAM 0x802BAE00
|
||||
#define BATTLE_ENTITY_HEAP_BOTTOM 0x80250000
|
||||
#endif
|
||||
|
||||
typedef struct Fog {
|
||||
@ -398,7 +402,7 @@ Gfx D_8014B400[21][5] = {
|
||||
},
|
||||
};
|
||||
|
||||
void* mdl_textureBaseAddress = (void*) MODEL_TEXTURE_BASE_ADDRESS;
|
||||
void* mdl_textureBaseAddress = (void*) &MapTextureMemory;
|
||||
|
||||
u8 mdl_bgMultiplyColorA = 0;
|
||||
u8 mdl_bgMultiplyColorR = 0;
|
||||
@ -1115,9 +1119,7 @@ extern s32 mdl_renderTaskCount;
|
||||
|
||||
extern TextureHandle mdl_textureHandles[128];
|
||||
|
||||
extern RenderTask mdl_clearRenderTasks[3][0x100];
|
||||
|
||||
extern s32 D_801A7000; // todo ???
|
||||
extern Addr BattleEntityHeapBottom; // todo ???
|
||||
|
||||
extern u16 depthCopyBuffer[16];
|
||||
|
||||
@ -1145,6 +1147,8 @@ void load_model_transforms(ModelNode* model, ModelNode* parent, Matrix4f mdlTxMt
|
||||
s32 is_identity_fixed_mtx(Mtx* mtx);
|
||||
void build_custom_gfx(void);
|
||||
|
||||
MATCHING_BSS(0x3A0);
|
||||
|
||||
void update_entities(void) {
|
||||
s32 i;
|
||||
|
||||
@ -1883,10 +1887,10 @@ void clear_entity_data(s32 arg0) {
|
||||
}
|
||||
|
||||
if (!gGameStatusPtr->isBattle) {
|
||||
gEntityHeapBottom = BATTLE_ENTITY_HEAP_BOTTOM;
|
||||
gEntityHeapBase = BATTLE_ENTITY_HEAP_BASE;
|
||||
gEntityHeapBottom = WORLD_ENTITY_HEAP_BOTTOM;
|
||||
gEntityHeapBase = WORLD_ENTITY_HEAP_BASE;
|
||||
} else {
|
||||
gEntityHeapBottom = (s32)&D_801A7000;
|
||||
gEntityHeapBottom = (s32)BattleEntityHeapBottom;
|
||||
gEntityHeapBase = gEntityHeapBottom + 0x3000;
|
||||
}
|
||||
|
||||
@ -1904,8 +1908,8 @@ void clear_entity_data(s32 arg0) {
|
||||
|
||||
void init_entity_data(void) {
|
||||
if (!gGameStatusPtr->isBattle) {
|
||||
gEntityHeapBottom = BATTLE_ENTITY_HEAP_BOTTOM;
|
||||
gEntityHeapBase = BATTLE_ENTITY_HEAP_BASE;
|
||||
gEntityHeapBottom = WORLD_ENTITY_HEAP_BOTTOM;
|
||||
gEntityHeapBase = WORLD_ENTITY_HEAP_BASE;
|
||||
reload_world_entity_data();
|
||||
} else {
|
||||
s32 i;
|
||||
@ -1913,7 +1917,7 @@ void init_entity_data(void) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
bEntityBlueprint[i] = 0;
|
||||
}
|
||||
gEntityHeapBottom = (s32)&D_801A7000;
|
||||
gEntityHeapBottom = (s32)BattleEntityHeapBottom;
|
||||
gEntityHeapBase = gEntityHeapBottom + 0x3000;
|
||||
}
|
||||
gCurrentEntityListPtr = get_entity_list();
|
||||
@ -3672,7 +3676,13 @@ void func_80114B58(u32 romOffset, TextureHandle* handle, TextureHeader* header,
|
||||
handle->gfx = (Gfx*) mdl_nextTextureAddress;
|
||||
memcpy(&handle->header, header, sizeof(*header));
|
||||
func_801180E8(header, (Gfx**)&mdl_nextTextureAddress, handle->raster, handle->palette, handle->auxRaster, handle->auxPalette, 0, 0, 0, 0);
|
||||
|
||||
#ifndef OLD_GCC
|
||||
gSPEndDisplayList(mdl_nextTextureAddress);
|
||||
mdl_nextTextureAddress += 8;
|
||||
#else
|
||||
gSPEndDisplayList(((Gfx*)mdl_nextTextureAddress)++);
|
||||
#endif
|
||||
}
|
||||
|
||||
void load_tile_header(ModelNodeProperty* propertyName, s32 romOffset, s32 size) {
|
||||
@ -3938,7 +3948,7 @@ void _load_model_textures(ModelNode* model, s32 romOffset, s32 size) {
|
||||
}
|
||||
|
||||
void load_model_textures(ModelNode* model, s32 romOffset, s32 size) {
|
||||
s32 battleOffset = ((gGameStatusPtr->isBattle != 0) << 17);
|
||||
s32 battleOffset = ((gGameStatusPtr->isBattle != 0) << 17); // TODO FIX
|
||||
|
||||
mdl_nextTextureAddress = mdl_textureBaseAddress + battleOffset;
|
||||
|
||||
|
@ -810,12 +810,17 @@ ApiStatus SetAnimation(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 actorID = evt_get_variable(script, *args++);
|
||||
Actor* actor;
|
||||
s32 a1;
|
||||
s32 animationIndex;
|
||||
|
||||
if (actorID == ACTOR_SELF) {
|
||||
actorID = script->owner1.actorID;
|
||||
}
|
||||
|
||||
set_animation(actorID, evt_get_variable(script, *args++), evt_get_variable(script, *args++));
|
||||
a1 = evt_get_variable(script, *args++);
|
||||
animationIndex = evt_get_variable(script, *args++);
|
||||
|
||||
set_animation(actorID, a1, animationIndex);
|
||||
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
@ -845,12 +850,17 @@ ApiStatus SetAnimationRate(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 actorID = evt_get_variable(script, *args++);
|
||||
Actor* actor;
|
||||
s32 partIndex;
|
||||
f32 rate;
|
||||
|
||||
if (actorID == ACTOR_SELF) {
|
||||
actorID = script->owner1.actorID;
|
||||
}
|
||||
|
||||
set_animation_rate(actorID, evt_get_variable(script, *args++), evt_get_float_variable(script, *args++));
|
||||
partIndex = evt_get_variable(script, *args++);
|
||||
rate = evt_get_float_variable(script, *args++);
|
||||
|
||||
set_animation_rate(actorID, partIndex, rate);
|
||||
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
@ -885,12 +895,17 @@ ApiStatus GetActorYaw(Evt* script, s32 isInitialCall) {
|
||||
ApiStatus SetPartYaw(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 actorID = evt_get_variable(script, *args++);
|
||||
s32 partIndex;
|
||||
s32 yaw;
|
||||
|
||||
if (actorID == ACTOR_SELF) {
|
||||
actorID = script->owner1.actorID;
|
||||
}
|
||||
|
||||
set_part_yaw(actorID, evt_get_variable(script, *args++), evt_get_variable(script, *args++));
|
||||
partIndex = evt_get_variable(script, *args++);
|
||||
yaw = evt_get_variable(script, *args++);
|
||||
|
||||
set_part_yaw(actorID, partIndex, yaw);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ extern AuSynDriver auSynDriver;
|
||||
extern u64 rspbootUcodeBuffer[];
|
||||
extern u64 n_aspMain_text_bin[];
|
||||
extern u64 n_aspMain_data_bin[];
|
||||
|
||||
extern u8 AuHeapBase[AUDIO_HEAP_SIZE];
|
||||
extern u64 AuStack[NU_AU_STACK_SIZE / sizeof(u64)];
|
||||
|
||||
|
@ -21,7 +21,6 @@ void func_80052E30(u8 index) {
|
||||
voice->priority = AU_PRIORITY_FREE;
|
||||
}
|
||||
|
||||
#ifndef SHIFT
|
||||
void au_engine_init(s32 outputRate) {
|
||||
AuGlobals* globals;
|
||||
ALHeap* alHeap;
|
||||
@ -41,7 +40,6 @@ void au_engine_init(s32 outputRate) {
|
||||
gBGMPlayerA->soundManager = gSoundManager;
|
||||
gAuAmbienceManager->globals = gSoundGlobals;
|
||||
|
||||
|
||||
globals = gSoundGlobals;
|
||||
dummyTrackData = alHeapAlloc(alHeap, 1, 0x8000);
|
||||
globals->dataBGM[0] = (BGMHeader*) &dummyTrackData[0];
|
||||
@ -49,7 +47,7 @@ void au_engine_init(s32 outputRate) {
|
||||
globals->dataMSEQ[0] = (MSEQHeader*) &dummyTrackData[0x1C00];
|
||||
globals->dataMSEQ[1] = (MSEQHeader*) &dummyTrackData[0x1400];
|
||||
|
||||
for (i = 0; i < 1; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(globals->unk_globals_6C); i++) {
|
||||
globals->unk_globals_6C[i].bgmPlayer = alHeapAlloc(alHeap, 1, sizeof(BGMPlayer));
|
||||
}
|
||||
|
||||
@ -67,7 +65,7 @@ void au_engine_init(s32 outputRate) {
|
||||
globals->audioThreadCallbacks[0] = NULL;
|
||||
globals->audioThreadCallbacks[1] = NULL;
|
||||
|
||||
for (i = 0; i < 1; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(globals->unk_globals_6C); i++) {
|
||||
globals->unk_globals_6C[i].unk_4 = 0;
|
||||
globals->unk_globals_6C[i].unk_5 = 0;
|
||||
}
|
||||
@ -96,7 +94,7 @@ void au_engine_init(s32 outputRate) {
|
||||
|
||||
au_load_INIT(globals, SBN_ROM_OFFSET, alHeap);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(globals->banks); i++) {
|
||||
globals->banks[i] = alHeapAlloc(alHeap, 1, 0x840);
|
||||
}
|
||||
|
||||
@ -145,9 +143,6 @@ void au_engine_init(s32 outputRate) {
|
||||
au_delay_channel(0);
|
||||
func_80055050(alHeap);
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM_SHIFT(void, "audio/2e230_len_2190", au_engine_init);
|
||||
#endif
|
||||
|
||||
static void au_reset_instrument(Instrument* instrument) {
|
||||
instrument->base = DummyInstrumentBase;
|
||||
|
@ -31,13 +31,22 @@ extern ActorBlueprint b_area_kzn2_petit_piranha_bomb;
|
||||
extern Formation N(formation_petit_piranha_1);
|
||||
extern Formation N(formation_petit_piranha_2);
|
||||
|
||||
static s32 N(unusedArray)[64];
|
||||
|
||||
MATCHING_BSS(0x8A0);
|
||||
|
||||
BSS u8 Vine3Base[0x2000];
|
||||
BSS u8 Vine2Base[0x3000];
|
||||
BSS u8 Vine1Base[0x3000];
|
||||
BSS u8 Vine0Base[0x4000];
|
||||
|
||||
enum {
|
||||
VINE_1 = 1,
|
||||
VINE_2 = 2,
|
||||
};
|
||||
|
||||
#define VINE_1_BASE AUX_DATA_ADDR_1
|
||||
#define VINE_2_BASE AUX_DATA_ADDR_2
|
||||
#define VINE_1_BASE (s32) Vine1Base
|
||||
#define VINE_2_BASE (s32) Vine2Base
|
||||
|
||||
s32 N(idleAnimations)[] = {
|
||||
STATUS_NORMAL, ANIM_LavaBud_Anim03,
|
||||
@ -161,8 +170,6 @@ ActorBlueprint NAMESPACE = {
|
||||
.statusMessageOffset = { 0, 0 },
|
||||
};
|
||||
|
||||
static s32 N(unusedArray)[64];
|
||||
|
||||
EvtScript N(init) = {
|
||||
EVT_USE_ARRAY(N(unusedArray))
|
||||
EVT_CALL(SetActorVar, ACTOR_SELF, 5, 0)
|
||||
|
@ -279,10 +279,21 @@ enum {
|
||||
VINE_4 = 4,
|
||||
};
|
||||
|
||||
#define VINE_0_BASE AUX_DATA_ADDR_0
|
||||
#define VINE_1_BASE AUX_DATA_ADDR_1
|
||||
#define VINE_2_BASE AUX_DATA_ADDR_2
|
||||
#define VINE_3_BASE AUX_DATA_ADDR_3
|
||||
#ifdef SHIFT
|
||||
extern Addr Vine3Base;
|
||||
extern Addr Vine2Base;
|
||||
extern Addr Vine1Base;
|
||||
extern Addr Vine0Base;
|
||||
#define VINE_0_BASE (s32) Vine0Base
|
||||
#define VINE_1_BASE (s32) Vine1Base
|
||||
#define VINE_2_BASE (s32) Vine2Base
|
||||
#define VINE_3_BASE (s32) Vine3Base
|
||||
#else
|
||||
#define VINE_0_BASE 0x80234000
|
||||
#define VINE_1_BASE 0x80231000
|
||||
#define VINE_2_BASE 0x8022E000
|
||||
#define VINE_3_BASE 0x8022C000
|
||||
#endif
|
||||
|
||||
BSS LavaPiranhaVine N(VineData)[NUM_VINES];
|
||||
BSS s32 N(VineRenderState);
|
||||
|
@ -400,6 +400,13 @@ typedef struct ActorOffsets {
|
||||
/* 0x03 */ s8 shadow;
|
||||
} ActorOffsets; // size = 0x04
|
||||
|
||||
// TODO look into making options here better. it's really an array of 5 substructs, each having an [8][2] array
|
||||
typedef struct PlayerCelebrationAnimOptions {
|
||||
/* 0x00 */ s16 randomChance;
|
||||
/* 0x02 */ s16 hpBasedChance;
|
||||
/* 0x04 */ s32 options[80];
|
||||
} PlayerCelebrationAnimOptions; // size = 0x8
|
||||
|
||||
extern Battle* gCurrentBattlePtr;
|
||||
|
||||
extern ActorOffsets bActorOffsets[ACTOR_TYPE_COUNT];
|
||||
@ -408,16 +415,4 @@ void func_80072BCC(s32 arg0);
|
||||
void load_demo_battle(u32 index);
|
||||
Actor* create_actor(Formation formation);
|
||||
|
||||
#ifdef SHIFT
|
||||
#define AUX_DATA_ADDR_0 world_model_anim_kzn_01_VRAM // (picked the first overlay among those with this address)
|
||||
#define AUX_DATA_ADDR_1 battle_area_omo2_1_VRAM // (picked the first overlay among those with this address)
|
||||
#define AUX_DATA_ADDR_2 0x8022E000 // TODO shiftability
|
||||
#define AUX_DATA_ADDR_3 0x8022C000 // TODO shiftability
|
||||
#else
|
||||
#define AUX_DATA_ADDR_0 0x80234000
|
||||
#define AUX_DATA_ADDR_1 0x80231000
|
||||
#define AUX_DATA_ADDR_2 0x8022E000
|
||||
#define AUX_DATA_ADDR_3 0x8022C000
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -8,3 +8,5 @@ ApiStatus func_802A10E4_785C04(Evt* script, s32 isInitialCall) {
|
||||
script->varTable[0] = 3;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
MATCHING_BSS(0x3CC0);
|
||||
|
@ -40,8 +40,6 @@ typedef struct HurricaneState {
|
||||
/* 0x74 */ char unk_74[0x10];
|
||||
} HurricaneState;
|
||||
|
||||
|
||||
|
||||
static s32 sSavedHurricaneIntensity;
|
||||
static s32 sBreathSizeIncrease;
|
||||
static s32 sMaxPower;
|
||||
@ -1768,3 +1766,5 @@ EvtScript N(hurricane) = {
|
||||
EVT_RETURN
|
||||
EVT_END
|
||||
};
|
||||
|
||||
MATCHING_BSS(0xCC0);
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
typedef struct FoliageModelList {
|
||||
s32 count;
|
||||
s32 models[0];
|
||||
s32 models[VLA];
|
||||
} FoliageModelList;
|
||||
|
||||
typedef struct FoliageDropList {
|
||||
@ -15,12 +15,12 @@ typedef struct FoliageDropList {
|
||||
s32 spawnMode;
|
||||
Bytecode pickupFlag;
|
||||
Bytecode spawnFlag;
|
||||
} drops[0];
|
||||
} drops[VLA];
|
||||
} FoliageDropList;
|
||||
|
||||
typedef struct FoliageVectorList {
|
||||
s32 count;
|
||||
Vec3i vectors[0];
|
||||
Vec3i vectors[VLA];
|
||||
} FoliageVectorList;
|
||||
|
||||
typedef struct SearchBushConfig {
|
||||
|
@ -3,8 +3,10 @@
|
||||
|
||||
API_CALLABLE(N(StartRumbleWithParams)) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 var0 = evt_get_variable(script, *args++);
|
||||
s32 var1 = evt_get_variable(script, *args++);
|
||||
|
||||
start_rumble(evt_get_variable(script, *args++), evt_get_variable(script, *args++));
|
||||
start_rumble(var0, var1);
|
||||
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
@ -70,6 +70,8 @@ typedef struct PackedVtx {
|
||||
|
||||
typedef FoldState FoldStateList[90];
|
||||
|
||||
extern HeapNode heap_spriteHead;
|
||||
|
||||
// BSS
|
||||
extern FoldImageRec D_80156920;
|
||||
extern Vtx* D_80156948[2];
|
||||
@ -167,10 +169,10 @@ void fold_init(void) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(D_80156948); i++) {
|
||||
D_80156948[i] = _heap_malloc(&gSpriteHeapPtr, D_8014EE60 * sizeof(*(D_80156948[0])));
|
||||
D_80156948[i] = _heap_malloc(&heap_spriteHead, D_8014EE60 * sizeof(*(D_80156948[0])));
|
||||
}
|
||||
|
||||
D_80156954 = (FoldStateList*)_heap_malloc(&gSpriteHeapPtr, ARRAY_COUNT(*D_80156954) * sizeof((*D_80156954)[0]));
|
||||
D_80156954 = (FoldStateList*)_heap_malloc(&heap_spriteHead, ARRAY_COUNT(*D_80156954) * sizeof((*D_80156954)[0]));
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(*D_80156954); i++) {
|
||||
fold_init_state(&(*D_80156954)[i]);
|
||||
|
@ -11,7 +11,8 @@ typedef struct DefaultWindowStyle {
|
||||
/* 0x07 */ Color_RGBA8 color2;
|
||||
} DefaultWindowStyle; // size = 0x0B
|
||||
|
||||
static Vtx gBoxQuadBuffer[][16];
|
||||
#define BOX_QUAD_BUFFER_NUM 21
|
||||
extern Vtx gBoxQuadBuffer[BOX_QUAD_BUFFER_NUM][16];
|
||||
|
||||
DefaultWindowStyle gBoxDefaultStyles[] = {
|
||||
{
|
||||
@ -432,7 +433,7 @@ s32 draw_box(s32 flags, WindowStyle windowStyle, s32 posX, s32 posY, s32 posZ, s
|
||||
|
||||
if (flags & DRAW_FLAG_ROTSCALE) {
|
||||
quads = gBoxQuadBuffer[gBoxQuadIndex++];
|
||||
if (gBoxQuadIndex > 20) {
|
||||
if (gBoxQuadIndex > BOX_QUAD_BUFFER_NUM - 1) {
|
||||
gBoxQuadIndex = 0;
|
||||
}
|
||||
}
|
||||
@ -761,7 +762,7 @@ s32 draw_box(s32 flags, WindowStyle windowStyle, s32 posX, s32 posY, s32 posZ, s
|
||||
gDPSetTexturePersp(gMasterGfxPos++, G_TP_NONE);
|
||||
gDPSetCycleType(gMasterGfxPos++, G_CYC_1CYCLE);
|
||||
if(fpDrawContents != NULL) {
|
||||
if(quads != NULL) {
|
||||
if (quads != NULL) {
|
||||
void* mdl_address = mdl_get_next_texture_address(width * height * 2);
|
||||
if(mdl_address != 0) {
|
||||
gDPSetColorImage(gMasterGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, OS_K0_TO_PHYSICAL(mdl_address));
|
||||
|
@ -6,14 +6,13 @@
|
||||
typedef s32 TlbEntry[0x1000 / 4];
|
||||
typedef TlbEntry TlbMappablePage[15];
|
||||
|
||||
extern TlbMappablePage D_80197000;
|
||||
|
||||
#define EFFECT_LOADED 1
|
||||
|
||||
extern EffectGraphics gEffectGraphicsData[15];
|
||||
extern EffectInstance* gEffectInstances[96];
|
||||
extern s32 D_801A6000;
|
||||
|
||||
extern TlbMappablePage D_80197000;
|
||||
extern Addr D_801A6000;
|
||||
|
||||
#define FX_ENTRY(name, gfx_name) { \
|
||||
name##_main, effect_##name##_ROM_START, effect_##name##_ROM_END, effect_##name##_VRAM, gfx_name##_ROM_START, \
|
||||
|
@ -8,7 +8,7 @@ ApiStatus SetEncounterStatusFlags(Evt* script, s32 isInitialCall) {
|
||||
EncounterStatus* currentEncounter = &gCurrentEncounter;
|
||||
s32 flagBits = *args++;
|
||||
|
||||
if (evt_get_variable(script, *args)) {
|
||||
if (evt_get_variable(script, *args++)) {
|
||||
currentEncounter->flags |= flagBits;
|
||||
} else {
|
||||
currentEncounter->flags &= ~flagBits;
|
||||
@ -369,7 +369,7 @@ ApiStatus BindNpcIdle(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* owner = script->owner1.enemy;
|
||||
s32 npcID = evt_get_variable(script, *args++);
|
||||
EvtScript* aiBytecode = (EvtScript*)evt_get_variable(script, *args);
|
||||
EvtScript* aiBytecode = (EvtScript*)evt_get_variable(script, *args++);
|
||||
|
||||
if (npcID == NPC_SELF) {
|
||||
npcID = owner->npcID;
|
||||
@ -419,7 +419,7 @@ ApiStatus EnableNpcAI(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
s32 npcID = evt_get_variable(script, *args++);
|
||||
s32 var2 = evt_get_variable(script, *args);
|
||||
s32 var2 = evt_get_variable(script, *args++);
|
||||
|
||||
if (npcID == NPC_SELF) {
|
||||
npcID = npc->npcID;
|
||||
@ -487,7 +487,7 @@ ApiStatus BindNpcAux(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
s32 npcID = evt_get_variable(script, *args++);
|
||||
EvtScript* auxBytecode = (EvtScript*)evt_get_variable(script, *args);
|
||||
EvtScript* auxBytecode = (EvtScript*)evt_get_variable(script, *args++);
|
||||
|
||||
if (npcID == NPC_SELF) {
|
||||
npcID = npc->npcID;
|
||||
@ -536,7 +536,7 @@ ApiStatus EnableNpcAux(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
s32 npcID = evt_get_variable(script, *args++);
|
||||
s32 var2 = evt_get_variable(script, *args);
|
||||
s32 var2 = evt_get_variable(script, *args++);
|
||||
|
||||
if (npcID == NPC_SELF) {
|
||||
npcID = npc->npcID;
|
||||
@ -559,7 +559,7 @@ ApiStatus BindNpcInteract(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
s32 npcID = evt_get_variable(script, *args++);
|
||||
EvtScript* interactBytecode = (EvtScript*)evt_get_variable(script, *args);
|
||||
EvtScript* interactBytecode = (EvtScript*)evt_get_variable(script, *args++);
|
||||
|
||||
if (npcID == NPC_SELF) {
|
||||
npcID = npc->npcID;
|
||||
@ -579,7 +579,7 @@ ApiStatus BindNpcHit(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
s32 npcID = evt_get_variable(script, *args++);
|
||||
EvtScript* hitBytecode = (EvtScript*)evt_get_variable(script, *args);
|
||||
EvtScript* hitBytecode = (EvtScript*)evt_get_variable(script, *args++);
|
||||
|
||||
if (npcID == NPC_SELF) {
|
||||
npcID = npc->npcID;
|
||||
@ -599,7 +599,7 @@ ApiStatus BindNpcDefeat(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
s32 npcID = evt_get_variable(script, *args++);
|
||||
EvtScript* defeatBytecode = (EvtScript*)evt_get_variable(script, *args);
|
||||
EvtScript* defeatBytecode = (EvtScript*)evt_get_variable(script, *args++);
|
||||
|
||||
if (npcID == -1) {
|
||||
npcID = npc->npcID;
|
||||
@ -623,8 +623,11 @@ ApiStatus SetSelfVar(Evt* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus GetSelfVar(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* owner = script->owner1.enemy;
|
||||
s32 var1 = evt_get_variable(script, *args++);
|
||||
s32 var0 = *args++;
|
||||
|
||||
evt_set_variable(script, *args++, script->owner1.enemy->varTable[evt_get_variable(script, *args++)]);
|
||||
evt_set_variable(script, var0, owner->varTable[var1]);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -633,7 +636,7 @@ ApiStatus SetNpcVar(Evt* script, s32 isInitialCall) {
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
s32 npcID = evt_get_variable(script, *args++);
|
||||
s32 varIdx = evt_get_variable(script, *args++);
|
||||
s32 val = evt_get_variable(script, *args);
|
||||
s32 val = evt_get_variable(script, *args++);
|
||||
|
||||
if (npcID == NPC_SELF) {
|
||||
npcID = npc->npcID;
|
||||
@ -686,7 +689,7 @@ ApiStatus SetSelfEnemyFlagBits(Evt* script, s32 isInitialCall) {
|
||||
Enemy* owner = script->owner1.enemy;
|
||||
s32 bits = *args++;
|
||||
|
||||
if (evt_get_variable(script, *args)) {
|
||||
if (evt_get_variable(script, *args++)) {
|
||||
owner->flags |= bits;
|
||||
} else {
|
||||
owner->flags &= ~bits;
|
||||
@ -699,7 +702,7 @@ ApiStatus SelfEnemyOverrideSyncPos(Evt* script, s32 isInitialCall) {
|
||||
Enemy* owner = script->owner1.enemy;
|
||||
Npc* npc = get_npc_unsafe(script->owner2.npcID);
|
||||
|
||||
owner->unk_07 = evt_get_variable(script, *args);
|
||||
owner->unk_07 = evt_get_variable(script, *args++);
|
||||
owner->unk_10.x = npc->pos.x;
|
||||
owner->unk_10.y = npc->pos.y;
|
||||
owner->unk_10.z = npc->pos.z;
|
||||
@ -708,7 +711,9 @@ ApiStatus SelfEnemyOverrideSyncPos(Evt* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
ApiStatus GetSelfNpcID(Evt* script, s32 isInitialCall) {
|
||||
evt_set_variable(script, *script->ptrReadPos, script->owner1.enemy->npcID);
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
|
||||
evt_set_variable(script, *args++, script->owner1.enemy->npcID);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -730,7 +735,7 @@ ApiStatus SetEnemyFlagBits(Evt* script, s32 isInitialCall) {
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
s32 npcID = evt_get_variable(script, *args++);
|
||||
s32 bits = *args++;
|
||||
s32 var2 = evt_get_variable(script, *args);
|
||||
s32 var2 = evt_get_variable(script, *args++);
|
||||
|
||||
if (npcID == NPC_SELF) {
|
||||
npcID = npc->npcID;
|
||||
@ -738,7 +743,7 @@ ApiStatus SetEnemyFlagBits(Evt* script, s32 isInitialCall) {
|
||||
|
||||
npc = get_enemy(npcID);
|
||||
|
||||
if (var2 != NULL) {
|
||||
if (var2) {
|
||||
npc->flags |= bits;
|
||||
} else {
|
||||
npc->flags &= ~bits;
|
||||
@ -804,7 +809,8 @@ ApiStatus func_800458CC(Evt* script, s32 isInitialCall) {
|
||||
ApiStatus OnPlayerFled(Evt* script, s32 isInitialCall) {
|
||||
Enemy* enemy = script->owner1.enemy;
|
||||
Npc* npc = get_npc_unsafe(enemy->npcID);
|
||||
s32 skipReaction = evt_get_variable(script, *script->ptrReadPos);
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 skipReaction = evt_get_variable(script, *args++);
|
||||
|
||||
enemy->aiFlags |= ENEMY_AI_FLAG_SUSPEND;
|
||||
|
||||
@ -838,7 +844,7 @@ ApiStatus OnPlayerFled(Evt* script, s32 isInitialCall) {
|
||||
ApiStatus SetTattleMessage(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 enemyId = evt_get_variable(script, *args++);
|
||||
u32 tattleMsg = evt_get_variable(script, *args);
|
||||
u32 tattleMsg = evt_get_variable(script, *args++);
|
||||
Enemy* npc = get_enemy(enemyId);
|
||||
|
||||
npc->tattleMsg = tattleMsg;
|
||||
|
@ -229,7 +229,7 @@ void Entity_BoardedFloor_shatter(Entity* entity) {
|
||||
entity_set_render_script(entity, &Entity_BoardedFloor_RenderScriptShattered);
|
||||
}
|
||||
|
||||
EntityScript Entity_BoardedFloor_Script = {
|
||||
EntityModelScript Entity_BoardedFloor_Script = {
|
||||
es_ClearFlags(ENTITY_FLAG_DISABLE_COLLISION)
|
||||
es_SetCallback(Entity_BoardedFloor_idle, 0)
|
||||
es_PlaySound(SOUND_2092)
|
||||
|
@ -272,3 +272,5 @@ EntityBlueprint Entity_BombableRock2 = {
|
||||
.entityType = ENTITY_TYPE_BOMBABLE_ROCK,
|
||||
.aabbSize = { 50, 50, 100 }
|
||||
};
|
||||
|
||||
MATCHING_BSS(0x100);
|
||||
|
@ -124,8 +124,10 @@ ApiStatus evt_handle_wait_seconds(Evt* script) {
|
||||
|
||||
ApiStatus evt_handle_if_equal(Evt* script) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 val1 = evt_get_variable(script, *args++);
|
||||
s32 val2 = evt_get_variable(script, *args++);
|
||||
|
||||
if (evt_get_variable(script, *args++) != evt_get_variable(script, *args++)) {
|
||||
if (val1 != val2) {
|
||||
script->ptrNextLine = evt_skip_if(script);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
@ -134,8 +136,10 @@ ApiStatus evt_handle_if_equal(Evt* script) {
|
||||
|
||||
ApiStatus evt_handle_if_not_equal(Evt* script) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 val1 = evt_get_variable(script, *args++);
|
||||
s32 val2 = evt_get_variable(script, *args++);
|
||||
|
||||
if (evt_get_variable(script, *args++) == evt_get_variable(script, *args++)) {
|
||||
if (val1 == val2) {
|
||||
script->ptrNextLine = evt_skip_if(script);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
@ -144,8 +148,10 @@ ApiStatus evt_handle_if_not_equal(Evt* script) {
|
||||
|
||||
ApiStatus evt_handle_if_less(Evt* script) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 val1 = evt_get_variable(script, *args++);
|
||||
s32 val2 = evt_get_variable(script, *args++);
|
||||
|
||||
if (evt_get_variable(script, *args++) >= evt_get_variable(script, *args++)) {
|
||||
if (val1 >= val2) {
|
||||
script->ptrNextLine = evt_skip_if(script);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
@ -154,8 +160,10 @@ ApiStatus evt_handle_if_less(Evt* script) {
|
||||
|
||||
ApiStatus evt_handle_if_greater(Evt* script) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 val1 = evt_get_variable(script, *args++);
|
||||
s32 val2 = evt_get_variable(script, *args++);
|
||||
|
||||
if (evt_get_variable(script, *args++) <= evt_get_variable(script, *args++)) {
|
||||
if (val1 <= val2) {
|
||||
script->ptrNextLine = evt_skip_if(script);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
@ -164,8 +172,10 @@ ApiStatus evt_handle_if_greater(Evt* script) {
|
||||
|
||||
ApiStatus evt_handle_if_less_equal(Evt* script) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 val1 = evt_get_variable(script, *args++);
|
||||
s32 val2 = evt_get_variable(script, *args++);
|
||||
|
||||
if (evt_get_variable(script, *args++) > evt_get_variable(script, *args++)) {
|
||||
if (val1 > val2) {
|
||||
script->ptrNextLine = evt_skip_if(script);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
@ -174,8 +184,10 @@ ApiStatus evt_handle_if_less_equal(Evt* script) {
|
||||
|
||||
ApiStatus evt_handle_if_greater_equal(Evt* script) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 val1 = evt_get_variable(script, *args++);
|
||||
s32 val2 = evt_get_variable(script, *args++);
|
||||
|
||||
if (evt_get_variable(script, *args++) < evt_get_variable(script, *args++)) {
|
||||
if (val1 < val2) {
|
||||
script->ptrNextLine = evt_skip_if(script);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
@ -186,7 +198,7 @@ ApiStatus evt_handle_if_AND(Evt* script) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Bytecode var = *args++;
|
||||
|
||||
if ((evt_get_variable(script, var) & *args) == 0) {
|
||||
if ((evt_get_variable(script, var) & *args++) == 0) {
|
||||
script->ptrNextLine = evt_skip_if(script);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
@ -197,7 +209,7 @@ ApiStatus evt_handle_if_not_AND(Evt* script) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Bytecode var = *args++;
|
||||
|
||||
if ((evt_get_variable(script, var) & *args) != 0) {
|
||||
if ((evt_get_variable(script, var) & *args++) != 0) {
|
||||
script->ptrNextLine = evt_skip_if(script);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
@ -214,7 +226,8 @@ ApiStatus evt_handle_end_if(Evt* script) {
|
||||
}
|
||||
|
||||
ApiStatus evt_handle_switch(Evt* script) {
|
||||
Bytecode value = evt_get_variable(script, *script->ptrReadPos);
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Bytecode value = evt_get_variable(script, *args++);
|
||||
s32 switchDepth = ++script->switchDepth;
|
||||
|
||||
ASSERT(switchDepth < 8);
|
||||
@ -246,7 +259,7 @@ ApiStatus evt_handle_case_equal(Evt* script) {
|
||||
|
||||
ASSERT(switchDepth >= 0);
|
||||
|
||||
var = evt_get_variable(script, *args);
|
||||
var = evt_get_variable(script, *args++);
|
||||
switchBlockValue = script->switchBlockValue[switchDepth];
|
||||
|
||||
if (script->switchBlockState[switchDepth] <= 0) {
|
||||
@ -269,7 +282,7 @@ ApiStatus evt_handle_case_not_equal(Evt* script) {
|
||||
|
||||
ASSERT(switchDepth >= 0);
|
||||
|
||||
var = evt_get_variable(script, *args);
|
||||
var = evt_get_variable(script, *args++);
|
||||
switchBlockValue = script->switchBlockValue[switchDepth];
|
||||
|
||||
if (script->switchBlockState[switchDepth] <= 0) {
|
||||
@ -292,7 +305,7 @@ ApiStatus evt_handle_case_less(Evt* script) {
|
||||
|
||||
ASSERT(switchDepth >= 0);
|
||||
|
||||
var = evt_get_variable(script, *args);
|
||||
var = evt_get_variable(script, *args++);
|
||||
switchBlockValue = script->switchBlockValue[switchDepth];
|
||||
|
||||
if (script->switchBlockState[switchDepth] <= 0) {
|
||||
@ -315,7 +328,7 @@ ApiStatus evt_handle_case_less_equal(Evt* script) {
|
||||
|
||||
ASSERT(switchDepth >= 0);
|
||||
|
||||
var = evt_get_variable(script, *args);
|
||||
var = evt_get_variable(script, *args++);
|
||||
switchBlockValue = script->switchBlockValue[switchDepth];
|
||||
|
||||
if (script->switchBlockState[switchDepth] <= 0) {
|
||||
@ -338,7 +351,7 @@ ApiStatus evt_handle_case_greater(Evt* script) {
|
||||
|
||||
ASSERT(switchDepth >= 0);
|
||||
|
||||
var = evt_get_variable(script, *args);
|
||||
var = evt_get_variable(script, *args++);
|
||||
switchBlockValue = script->switchBlockValue[switchDepth];
|
||||
|
||||
if (script->switchBlockState[switchDepth] <= 0) {
|
||||
@ -361,7 +374,7 @@ ApiStatus evt_handle_case_greater_equal(Evt* script) {
|
||||
|
||||
ASSERT(switchDepth >= 0);
|
||||
|
||||
var = evt_get_variable(script, *args);
|
||||
var = evt_get_variable(script, *args++);
|
||||
switchBlockValue = script->switchBlockValue[switchDepth];
|
||||
|
||||
if (script->switchBlockState[switchDepth] <= 0) {
|
||||
@ -426,7 +439,7 @@ ApiStatus evt_handle_case_AND(Evt* script) {
|
||||
|
||||
ASSERT(switchDepth >= 0);
|
||||
|
||||
var = *args;
|
||||
var = *args++;
|
||||
switchBlockValue = script->switchBlockValue[switchDepth];
|
||||
switchBlockState = script->switchBlockState[switchDepth];
|
||||
|
||||
@ -451,7 +464,7 @@ ApiStatus evt_handle_case_equal_OR(Evt* script) {
|
||||
|
||||
ASSERT(switchDepth >= 0);
|
||||
|
||||
var = evt_get_variable(script, *args);
|
||||
var = evt_get_variable(script, *args++);
|
||||
switchBlockValue = script->switchBlockValue[switchDepth];
|
||||
switchBlockState = script->switchBlockState[switchDepth];
|
||||
|
||||
@ -476,7 +489,7 @@ ApiStatus evt_handle_case_equal_AND(Evt* script) {
|
||||
|
||||
ASSERT(switchDepth >= 0);
|
||||
|
||||
var = evt_get_variable(script, *args);
|
||||
var = evt_get_variable(script, *args++);
|
||||
switchBlockValue = script->switchBlockValue[switchDepth];
|
||||
switchBlockState = script->switchBlockState[switchDepth];
|
||||
|
||||
@ -531,9 +544,9 @@ ApiStatus evt_handle_end_switch(Evt* script) {
|
||||
|
||||
ApiStatus evt_handle_set_var(Evt* script) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 curPtrReadPos = args[0];
|
||||
s32 curPtrReadPos = *args++;
|
||||
|
||||
evt_set_variable(script, curPtrReadPos, evt_get_variable(script, args[1]));
|
||||
evt_set_variable(script, curPtrReadPos, evt_get_variable(script, *args++));
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -546,7 +559,7 @@ ApiStatus evt_handle_set_float(Evt* script) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Bytecode var = *args++;
|
||||
|
||||
evt_set_float_variable(script, var, evt_get_float_variable(script, *args));
|
||||
evt_set_float_variable(script, var, evt_get_float_variable(script, *args++));
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -741,7 +754,7 @@ ApiStatus evt_handle_get_Nth_word(Evt* script) {
|
||||
Bytecode var;
|
||||
|
||||
var = *args++;
|
||||
evt_set_variable(script, var, script->buffer[evt_get_variable(script, *args)]);
|
||||
evt_set_variable(script, var, script->buffer[evt_get_variable(script, *args++)]);
|
||||
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
@ -815,7 +828,7 @@ ApiStatus evt_handle_get_Nth_float(Evt* script) {
|
||||
Bytecode var;
|
||||
|
||||
var = *args++;
|
||||
evt_set_float_variable(script, var, script->buffer[evt_get_variable(script, *args)]);
|
||||
evt_set_float_variable(script, var, script->buffer[evt_get_variable(script, *args++)]);
|
||||
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
@ -906,23 +919,22 @@ ApiStatus evt_handle_call(Evt* script) {
|
||||
}
|
||||
|
||||
ApiStatus evt_handle_exec1(Evt* script) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Evt* newScript;
|
||||
s32 i;
|
||||
|
||||
newScript = start_script_in_group((EvtScript*)evt_get_variable(script, *script->ptrReadPos), script->priority, 0,
|
||||
newScript = start_script_in_group((EvtScript*)evt_get_variable(script, *args++), script->priority, 0,
|
||||
script->groupFlags);
|
||||
|
||||
newScript->owner1 = script->owner1;
|
||||
newScript->owner2 = script->owner2;
|
||||
|
||||
i = 0;
|
||||
while (i < ARRAY_COUNT(script->varTable)) {
|
||||
newScript->varTable[i] = script->varTable[i++];
|
||||
for (i = 0; i < ARRAY_COUNT(script->varTable); i++) {
|
||||
newScript->varTable[i] = script->varTable[i];
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (i < ARRAY_COUNT(script->varFlags)) {
|
||||
newScript->varFlags[i] = script->varFlags[i++];
|
||||
for (i = 0; i < ARRAY_COUNT(script->varFlags); i++) {
|
||||
newScript->varFlags[i] = script->varFlags[i];
|
||||
}
|
||||
|
||||
newScript->array = script->array;
|
||||
@ -931,6 +943,7 @@ ApiStatus evt_handle_exec1(Evt* script) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
|
||||
ApiStatus evt_handle_exec1_get_id(Evt* script) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
EvtScript* newSource = (EvtScript*)evt_get_variable(script, *args++);
|
||||
@ -1341,7 +1354,7 @@ ApiStatus func_802C73B0(Evt* script) {
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
s32 func_802C73B8(Evt* script) {
|
||||
ApiStatus func_802C73B8(Evt* script) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < MAX_SCRIPTS; i++) {
|
||||
@ -1349,7 +1362,7 @@ s32 func_802C73B8(Evt* script) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
return ApiStatus_DONE1;
|
||||
}
|
||||
|
||||
s32 evt_execute_next_command(Evt* script) {
|
||||
|
@ -450,13 +450,12 @@ ApiStatus GetNextPathPos(Evt* script, s32 isInitialCall) {
|
||||
ApiStatus GetDist2D(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Bytecode outVar = *args++;
|
||||
f32 ax = evt_get_float_variable(script, *args++);
|
||||
f32 ay = evt_get_float_variable(script, *args++);
|
||||
f32 bx = evt_get_float_variable(script, *args++);
|
||||
f32 by = evt_get_float_variable(script, *args++);
|
||||
|
||||
evt_set_float_variable(script, outVar, dist2D(
|
||||
evt_get_float_variable(script, *args++),
|
||||
evt_get_float_variable(script, *args++),
|
||||
evt_get_float_variable(script, *args++),
|
||||
evt_get_float_variable(script, *args++)
|
||||
));
|
||||
evt_set_float_variable(script, outVar, dist2D(ax, ay, bx, by));
|
||||
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
@ -537,16 +536,18 @@ ApiStatus SetGameMode(Evt* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus ClampAngleInt(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 angle = evt_get_variable(script, *args);
|
||||
|
||||
evt_set_variable(script, *args++, clamp_angle(evt_get_variable(script, *args)));
|
||||
evt_set_variable(script, *args++, clamp_angle(angle));
|
||||
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus ClampAngleFloat(Evt* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
f32 angle = evt_get_float_variable(script, *args);
|
||||
|
||||
evt_set_float_variable(script, *args++, clamp_angle(evt_get_float_variable(script, *args)));
|
||||
evt_set_float_variable(script, *args++, clamp_angle(angle));
|
||||
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ typedef union {
|
||||
#define __ll_lowpart(t) ((USItype) (t) % __ll_B)
|
||||
#define __ll_highpart(t) ((USItype) (t) / __ll_B)
|
||||
|
||||
#ifdef SHIFT
|
||||
#ifndef OLD_GCC
|
||||
#define umul_ppmm(w1, w0, u, v) \
|
||||
do { \
|
||||
UDItype __x = (UDItype) (USItype) (u) * (USItype) (v); \
|
||||
|
@ -1,7 +1,10 @@
|
||||
#include "common.h"
|
||||
|
||||
extern HeapNode heap_generalHead;
|
||||
extern HeapNode heap_collisionHead;
|
||||
|
||||
HeapNode* general_heap_create(void) {
|
||||
return _heap_create(&heap_generalHead, 0x54000);
|
||||
return _heap_create(&heap_generalHead, GENERAL_HEAP_SIZE);
|
||||
}
|
||||
|
||||
void* general_heap_malloc(s32 size) {
|
||||
@ -17,7 +20,7 @@ s32 general_heap_free(void* data) {
|
||||
}
|
||||
|
||||
s32 battle_heap_create(void) {
|
||||
if ((s32)_heap_create(&heap_battleHead, 0x25800) == -1) {
|
||||
if ((s32)_heap_create(&heap_battleHead, BATTLE_HEAP_SIZE) == -1) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
@ -45,7 +48,7 @@ s32 heap_free(void* data) {
|
||||
}
|
||||
|
||||
s32 collision_heap_create(void) {
|
||||
if ((s32)_heap_create(&heap_collisionHead, 0x18000) == -1) {
|
||||
if ((s32)_heap_create(&heap_collisionHead, COLLISION_HEAP_SIZE) == -1) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
16
src/heaps.c
Normal file
16
src/heaps.c
Normal file
@ -0,0 +1,16 @@
|
||||
#include "common.h"
|
||||
#include "audio.h"
|
||||
#include "model.h"
|
||||
|
||||
typedef s32 TlbEntry[0x1000 / 4];
|
||||
typedef TlbEntry TlbMappablePage[15];
|
||||
|
||||
BSS TlbMappablePage D_80197000;
|
||||
BSS u8 D_801A6000[0x1000];
|
||||
BSS u8 BattleEntityHeapBottom[0x3000];
|
||||
BSS u8 AuHeapBase[AUDIO_HEAP_SIZE];
|
||||
BSS u8 D_80200000[0x4000];
|
||||
BSS u8 D_80204000[0x3000];
|
||||
BSS u8 D_80207000[0x3000];
|
||||
BSS u8 D_8020A000[0x6000];
|
||||
BSS ShapeFile gMapShapeData;
|
4
src/heaps2.c
Normal file
4
src/heaps2.c
Normal file
@ -0,0 +1,4 @@
|
||||
#include "common.h"
|
||||
|
||||
BSS u8 WorldEntityHeapBase[0x10];
|
||||
BSS u8 heap_collisionHead[COLLISION_HEAP_SIZE];
|
7
src/heaps3.c
Normal file
7
src/heaps3.c
Normal file
@ -0,0 +1,7 @@
|
||||
#include "common.h"
|
||||
|
||||
BSS u8 heap_generalHead[GENERAL_HEAP_SIZE];
|
||||
BSS u8 heap_spriteHead[SPRITE_HEAP_SIZE];
|
||||
BSS u16 gFrameBuf0[FRAME_BUFFER_SIZE / 2];
|
||||
BSS u16 gFrameBuf1[FRAME_BUFFER_SIZE / 2];
|
||||
BSS u16 gFrameBuf2[FRAME_BUFFER_SIZE / 2];
|
@ -259,3 +259,5 @@ void func_802B79C8_E20AD8(void) {
|
||||
func_800EF3D4(0);
|
||||
partner_reset_tether_distance();
|
||||
}
|
||||
|
||||
MATCHING_BSS(0x30);
|
||||
|
@ -1,3 +1,3 @@
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM(s32, "7E00", func_8002CA00);
|
||||
INCLUDE_ASM(s32, "7E00", load_obfuscation_shims);
|
||||
|
@ -8,7 +8,7 @@ extern s8 obfuscated_obfuscation_shims_VRAM[];
|
||||
|
||||
#ifdef SHIFT
|
||||
void load_obfuscation_shims(void) {
|
||||
dma_copy(obfuscation_shims_ROM_START, obfuscation_shims_ROM_END, obfuscation_shims_VRAM);
|
||||
// no-op since in shiftable builds, we bypass the obfuscation
|
||||
}
|
||||
#else
|
||||
void load_obfuscation_shims(void) {
|
||||
|
16
src/main.c
16
src/main.c
@ -18,7 +18,6 @@ void gfx_init_state(void);
|
||||
#ifdef VERSION_US
|
||||
extern s32 D_80073E00;
|
||||
#else
|
||||
void func_8002CA00(void);
|
||||
extern s32 D_80073DE0;
|
||||
#endif
|
||||
extern u16* D_80073E04;
|
||||
@ -27,6 +26,13 @@ extern s16 D_80073E0A;
|
||||
extern s32 D_80073E10[];
|
||||
extern u16* D_8009A680;
|
||||
|
||||
#ifdef SHIFT
|
||||
void create_audio_system(void);
|
||||
void load_engine_data(void);
|
||||
#define shim_create_audio_system_obfuscated create_audio_system
|
||||
#define shim_load_engine_data_obfuscated load_engine_data
|
||||
#endif
|
||||
|
||||
void boot_main(void* data) {
|
||||
#ifdef VERSION_JP
|
||||
if (osTvType == OS_TV_NTSC) {
|
||||
@ -37,7 +43,7 @@ void boot_main(void* data) {
|
||||
} else {
|
||||
PANIC();
|
||||
}
|
||||
#else // VERSION_JP
|
||||
#else // not VERSION_JP
|
||||
if (osTvType == OS_TV_NTSC) {
|
||||
osViSetMode(&osViModeNtscLan1);
|
||||
osViSetSpecialFeatures(OS_VI_GAMMA_OFF | OS_VI_GAMMA_DITHER_OFF | OS_VI_DIVOT_ON | OS_VI_DITHER_FILTER_ON);
|
||||
@ -55,15 +61,9 @@ void boot_main(void* data) {
|
||||
is_debug_init();
|
||||
nuGfxInit();
|
||||
gGameStatusPtr->contBitPattern = nuContInit();
|
||||
#ifdef VERSION_US
|
||||
load_obfuscation_shims();
|
||||
shim_create_audio_system_obfuscated();
|
||||
shim_load_engine_data_obfuscated();
|
||||
#else
|
||||
func_8002CA00();
|
||||
shim_create_audio_system_obfuscated();
|
||||
shim_load_engine_data_obfuscated();
|
||||
#endif
|
||||
nuGfxFuncSet((NUGfxFunc) gfxRetrace_Callback);
|
||||
nuGfxPreNMIFuncSet(gfxPreNMI_Callback);
|
||||
gRandSeed += osGetCount();
|
||||
|
@ -68,7 +68,7 @@ Gfx D_80074230[] = {
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
s32 timeFreezeMode;
|
||||
//extern s32 timeFreezeMode; // TODO bss
|
||||
|
||||
extern s16 D_8009A690;
|
||||
|
||||
|
3
src/model_clear_render_tasks.c
Normal file
3
src/model_clear_render_tasks.c
Normal file
@ -0,0 +1,3 @@
|
||||
#include "model_clear_render_tasks.h"
|
||||
|
||||
BSS RenderTask mdl_clearRenderTasks[NUM_RENDER_TASK_LISTS][NUM_RENDER_TASKS_IN_LIST];
|
6
src/model_clear_render_tasks.h
Normal file
6
src/model_clear_render_tasks.h
Normal file
@ -0,0 +1,6 @@
|
||||
#include "common.h"
|
||||
|
||||
#define NUM_RENDER_TASK_LISTS 3
|
||||
#define NUM_RENDER_TASKS_IN_LIST 0x100
|
||||
|
||||
extern RenderTask mdl_clearRenderTasks[NUM_RENDER_TASK_LISTS][NUM_RENDER_TASKS_IN_LIST];
|
14
src/msg.c
14
src/msg.c
@ -11,8 +11,11 @@ enum RewindArrowStates {
|
||||
REWIND_ARROW_STATE_CHANGE_COLOR_BACK = 4,
|
||||
};
|
||||
|
||||
// todo consider symbol
|
||||
#ifdef SHIFT
|
||||
#define MSG_ROM_START (s32)msg_ROM_START
|
||||
#else
|
||||
#define MSG_ROM_START 0x1B83000
|
||||
#endif
|
||||
|
||||
typedef MessageImageData* MessageImageDataList[1];
|
||||
|
||||
@ -61,7 +64,7 @@ extern u16 gMsgGlobalWaveCounter;
|
||||
extern MessageImageDataList gMsgVarImages;
|
||||
extern s32 gMsgBGScrollAmtY;
|
||||
extern Gfx* D_80151338;
|
||||
extern char gMessageBuffers[][1024];
|
||||
extern char gMessageBuffers[2][1024];
|
||||
extern u8 gMessageMsgVars[3][32];
|
||||
extern s16 D_80155C98;
|
||||
extern Mtx gMessageWindowProjMatrix[2];
|
||||
@ -1347,7 +1350,6 @@ void initialize_printer(MessagePrintState* printer, s32 arg1, s32 arg2) {
|
||||
printer->sizeScale = 1.0f;
|
||||
}
|
||||
|
||||
#ifndef SHIFT
|
||||
void dma_load_msg(u32 msgID, void* dest) {
|
||||
u8* addr = (u8*) MSG_ROM_START + (msgID >> 14); // (msgID >> 16) * 4
|
||||
u8* offset[2]; // start, end
|
||||
@ -1360,10 +1362,6 @@ void dma_load_msg(u32 msgID, void* dest) {
|
||||
// Load the msg data
|
||||
dma_copy(MSG_ROM_START + offset[0], MSG_ROM_START + offset[1], dest);
|
||||
}
|
||||
#else
|
||||
void dma_load_msg(u32 msgID, void* dest);
|
||||
INCLUDE_ASM_SHIFT(void, "msg", dma_load_msg);
|
||||
#endif
|
||||
|
||||
s8* load_message_to_buffer(s32 msgID) {
|
||||
s8* prevBufferPos;
|
||||
@ -1372,7 +1370,7 @@ s8* load_message_to_buffer(s32 msgID) {
|
||||
prevBufferPos = gMessageBuffers[gNextMessageBuffer];
|
||||
|
||||
gNextMessageBuffer++;
|
||||
if (gNextMessageBuffer >= 2) {
|
||||
if (gNextMessageBuffer >= ARRAY_COUNT(gMessageBuffers)) {
|
||||
gNextMessageBuffer = 0;
|
||||
}
|
||||
|
||||
|
@ -115,3 +115,5 @@ BSS IMG_BIN D_802EE8D0[0x5100];
|
||||
BSS IMG_BIN D_802F39D0[0xB88];
|
||||
BSS char MSG_unused[8];
|
||||
BSS PAL_BIN D_802F4560[80][8];
|
||||
|
||||
MATCHING_BSS(0x6DA0);
|
||||
|
@ -8,8 +8,11 @@ NUUcode nugfx_ucode = {
|
||||
gspF3DEX2kawase_fifo_text_bin, gspF3DEX2kawase_fifo_data_bin,
|
||||
};
|
||||
|
||||
u16* FrameBuf[3] = {
|
||||
D_8038F800, D_803B5000, D_803DA800
|
||||
extern u16 gFrameBuf0[];
|
||||
extern u16 gFrameBuf1[];
|
||||
extern u16 gFrameBuf2[];
|
||||
u16* FrameBuf[] = {
|
||||
gFrameBuf0, gFrameBuf1, gFrameBuf2
|
||||
};
|
||||
|
||||
Gfx rdpstateinit_dl[] = {
|
||||
|
11
src/sprite.c
11
src/sprite.c
@ -1,5 +1,8 @@
|
||||
#include "sprite.h"
|
||||
|
||||
extern HeapNode heap_generalHead;
|
||||
extern HeapNode heap_spriteHead;
|
||||
|
||||
BSS s32 D_802DF520; // unused?
|
||||
BSS s32 spr_allocateBtlComponentsOnWorldHeap;
|
||||
BSS s32 D_802DF528[2]; // unused?
|
||||
@ -126,7 +129,7 @@ PlayerSpriteSet spr_playerSpriteSets[] = {
|
||||
void spr_init_quad_cache(void) {
|
||||
s32 i;
|
||||
|
||||
D_802DFE44 = _heap_malloc(&gSpriteHeapPtr, ARRAY_COUNT(D_802DFE48) * sizeof(*D_802DFE44));
|
||||
D_802DFE44 = _heap_malloc(&heap_spriteHead, ARRAY_COUNT(D_802DFE48) * sizeof(*D_802DFE44));
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(D_802DFE48); i++) {
|
||||
D_802DFE48[i] = -1;
|
||||
@ -771,7 +774,7 @@ void spr_init_sprites(s32 playerSpriteSet) {
|
||||
s32 i;
|
||||
|
||||
spr_allocateBtlComponentsOnWorldHeap = FALSE;
|
||||
_heap_create(&gSpriteHeapPtr, 0x40000);
|
||||
_heap_create(&heap_spriteHead, 0x40000);
|
||||
fold_init();
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(spr_playerSprites); i++) {
|
||||
@ -1200,13 +1203,13 @@ s32 spr_free_sprite(s32 spriteInstanceID) {
|
||||
|
||||
if (NpcSpriteInstanceCount[spriteIndex] == 0) {
|
||||
NpcSpriteData[spriteIndex] = NULL;
|
||||
_heap_free(&gSpriteHeapPtr, spriteData);
|
||||
_heap_free(&heap_spriteHead, spriteData);
|
||||
}
|
||||
|
||||
if (spr_allocateBtlComponentsOnWorldHeap) {
|
||||
_heap_free(&heap_generalHead, compList);
|
||||
} else {
|
||||
_heap_free(&gSpriteHeapPtr, compList);
|
||||
_heap_free(&heap_spriteHead, compList);
|
||||
}
|
||||
|
||||
SpriteInstances[spriteInstanceID].spriteIndex = 0;
|
||||
|
@ -75,7 +75,7 @@ typedef struct SpriteAnimData {
|
||||
/* 0x04 */ PAL_PTR* palettesOffset;
|
||||
/* 0x08 */ s32 maxComponents;
|
||||
/* 0x0C */ s32 colorVariations;
|
||||
/* 0x10 */ SpriteAnimComponent** animListStart[0];
|
||||
/* 0x10 */ SpriteAnimComponent** animListStart[VLA];
|
||||
} SpriteAnimData; // size = 0x14
|
||||
|
||||
typedef struct SpriteInstance {
|
||||
|
@ -6,8 +6,11 @@
|
||||
#include "battle/battle.h"
|
||||
#include "model.h"
|
||||
|
||||
u16* D_800778A0[] = {
|
||||
D_8038F800, D_803B5000, D_803DA800
|
||||
extern u16 gFrameBuf0[];
|
||||
extern u16 gFrameBuf1[];
|
||||
extern u16 gFrameBuf2[];
|
||||
u16* bFrameBuffers[] = {
|
||||
gFrameBuf0, gFrameBuf1, gFrameBuf2
|
||||
};
|
||||
|
||||
s32 D_800778AC[] = {
|
||||
@ -18,6 +21,12 @@ s32 D_800778AC[] = {
|
||||
extern s32 D_800A0904;
|
||||
extern s32 D_800A0908;
|
||||
|
||||
#ifdef SHIFT
|
||||
#define shim_battle_heap_create_obfuscated battle_heap_create
|
||||
#endif
|
||||
|
||||
extern ShapeFile gMapShapeData;
|
||||
|
||||
void state_init_battle(void) {
|
||||
D_800A0900 = 5;
|
||||
}
|
||||
@ -41,7 +50,7 @@ void state_step_battle(void) {
|
||||
return;
|
||||
} else {
|
||||
D_800A0900 = -1;
|
||||
nuGfxSetCfb(D_800778A0, 2);
|
||||
nuGfxSetCfb(bFrameBuffers, 2);
|
||||
nuContRmbForceStopEnd();
|
||||
sfx_stop_env_sounds();
|
||||
func_8003B1A8();
|
||||
@ -125,7 +134,7 @@ void state_step_end_battle(void) {
|
||||
MapConfig* mapConfig;
|
||||
|
||||
D_800A0900 = -1;
|
||||
nuGfxSetCfb(D_800778A0, 3);
|
||||
nuGfxSetCfb(bFrameBuffers, 3);
|
||||
gOverrideFlags &= ~GLOBAL_OVERRIDES_8;
|
||||
nuContRmbForceStopEnd();
|
||||
sfx_stop_env_sounds();
|
||||
@ -163,7 +172,7 @@ void state_step_end_battle(void) {
|
||||
partner_init_after_battle(playerData->currentPartner);
|
||||
load_map_script_lib();
|
||||
mapShape = load_asset_by_name(wMapShapeName, &sizeTemp);
|
||||
decode_yay0(mapShape, &D_80210000);
|
||||
decode_yay0(mapShape, &gMapShapeData);
|
||||
general_heap_free(mapShape);
|
||||
initialize_collision();
|
||||
restore_map_collision_data();
|
||||
|
@ -6,7 +6,10 @@
|
||||
#include "sprite.h"
|
||||
#include "model.h"
|
||||
|
||||
u16* D_80077980[] = { D_8038F800, D_803B5000, D_803DA800 };
|
||||
extern u16 gFrameBuf0[];
|
||||
extern u16 gFrameBuf1[];
|
||||
extern u16 gFrameBuf2[];
|
||||
u16* fsFrameBuffers[] = { gFrameBuf0, gFrameBuf1, gFrameBuf2 };
|
||||
|
||||
NUPiOverlaySegment D_8007798C = {
|
||||
.romStart = filemenu_ROM_START,
|
||||
@ -23,6 +26,7 @@ NUPiOverlaySegment D_8007798C = {
|
||||
u8 D_800779B0 = 0;
|
||||
|
||||
extern s32 D_80200000;
|
||||
extern ShapeFile gMapShapeData;
|
||||
|
||||
void state_init_language_select(void) {
|
||||
D_800A0931 = 0;
|
||||
@ -99,7 +103,7 @@ void state_step_language_select(void) {
|
||||
case 2:
|
||||
D_800A0930--;
|
||||
if (D_800A0930 == 0) {
|
||||
nuGfxSetCfb(D_80077980, 2);
|
||||
nuGfxSetCfb(fsFrameBuffers, 2);
|
||||
if (nuGfxCfb[2] == nuGfxCfb_ptr) {
|
||||
gOverrideFlags &= ~GLOBAL_OVERRIDES_8;
|
||||
} else {
|
||||
@ -265,7 +269,7 @@ void state_step_exit_language_select(void) {
|
||||
BackgroundHeader* bgHeader;
|
||||
|
||||
D_800A0930 = -1;
|
||||
nuGfxSetCfb(D_80077980, ARRAY_COUNT(D_80077980));
|
||||
nuGfxSetCfb(fsFrameBuffers, ARRAY_COUNT(fsFrameBuffers));
|
||||
filemenu_cleanup();
|
||||
gOverrideFlags &= ~GLOBAL_OVERRIDES_8;
|
||||
mapSettings = get_current_map_settings();
|
||||
@ -288,7 +292,7 @@ void state_step_exit_language_select(void) {
|
||||
init_entity_data();
|
||||
init_trigger_list();
|
||||
mapShape = load_asset_by_name(wMapShapeName, &mapShapeSize);
|
||||
decode_yay0(mapShape, &D_80210000);
|
||||
decode_yay0(mapShape, &gMapShapeData);
|
||||
general_heap_free(mapShape);
|
||||
initialize_collision();
|
||||
restore_map_collision_data();
|
||||
|
@ -6,7 +6,12 @@
|
||||
#include "sprite.h"
|
||||
#include "model.h"
|
||||
|
||||
u16* D_80077950[] = { D_8038F800, D_803B5000, D_803DA800 };
|
||||
extern u16 gFrameBuf0[];
|
||||
extern u16 gFrameBuf1[];
|
||||
extern u16 gFrameBuf2[];
|
||||
u16* pause_frameBuffers[] = { gFrameBuf0, gFrameBuf1, gFrameBuf2 };
|
||||
|
||||
extern ShapeFile gMapShapeData;
|
||||
|
||||
NUPiOverlaySegment D_8007795C = {
|
||||
.romStart = pause_ROM_START,
|
||||
@ -56,7 +61,7 @@ void state_step_pause(void) {
|
||||
|
||||
if (D_800A0920 == 0) {
|
||||
D_800A0920 = -1;
|
||||
nuGfxSetCfb(D_80077950, 2);
|
||||
nuGfxSetCfb(pause_frameBuffers, 2);
|
||||
gGameStatusPtr->savedBackgroundDarkness = gGameStatusPtr->backgroundDarkness;
|
||||
sfx_stop_env_sounds();
|
||||
func_8003B1A8();
|
||||
@ -133,11 +138,11 @@ void state_step_unpause(void) {
|
||||
if (D_800A0920 == 0) {
|
||||
MapSettings* mapSettings;
|
||||
MapConfig* mapConfig;
|
||||
void* assetData;
|
||||
void* mapShape;
|
||||
s32 assetSize;
|
||||
|
||||
D_800A0920 = -1;
|
||||
nuGfxSetCfb(D_80077950, ARRAY_COUNT(D_80077950));
|
||||
nuGfxSetCfb(pause_frameBuffers, ARRAY_COUNT(pause_frameBuffers));
|
||||
pause_cleanup();
|
||||
gOverrideFlags &= ~GLOBAL_OVERRIDES_8;
|
||||
mapSettings = get_current_map_settings();
|
||||
@ -164,9 +169,9 @@ void state_step_unpause(void) {
|
||||
sfx_set_reverb_mode(SavedReverbMode);
|
||||
bgm_reset_max_volume();
|
||||
load_map_script_lib();
|
||||
assetData = load_asset_by_name(wMapShapeName, &assetSize);
|
||||
decode_yay0(assetData, &D_80210000);
|
||||
general_heap_free(assetData);
|
||||
mapShape = load_asset_by_name(wMapShapeName, &assetSize);
|
||||
decode_yay0(mapShape, &gMapShapeData);
|
||||
general_heap_free(mapShape);
|
||||
initialize_collision();
|
||||
restore_map_collision_data();
|
||||
|
||||
|
6
src/texture_memory.c
Normal file
6
src/texture_memory.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include "common.h"
|
||||
|
||||
#define MAP_TEXTURE_MEMORY_SIZE 0x20000
|
||||
#define BTL_TEXTURE_MEMORY_SIZE 0x8000
|
||||
|
||||
BSS u8 MapTextureMemory[MAP_TEXTURE_MEMORY_SIZE + BTL_TEXTURE_MEMORY_SIZE];
|
@ -285,3 +285,5 @@ void action_update_use_spinning_flower(void) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MATCHING_BSS(0x100);
|
||||
|
@ -3580,3 +3580,5 @@ Mtx N(D_80253960_C111E0) = {{
|
||||
}};
|
||||
|
||||
#include "smash_bridges_anim.inc.c"
|
||||
|
||||
MATCHING_BSS(0x4930);
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "end_00.h"
|
||||
#include "effects.h"
|
||||
|
||||
extern HeapNode heap_spriteHead;
|
||||
|
||||
extern s32 spr_allocateBtlComponentsOnWorldHeap;
|
||||
extern ParadeNpcInfo N(ParadeNpcsTable)[];
|
||||
|
||||
@ -53,7 +55,7 @@ API_CALLABLE(N(ParadeSpriteHeapMalloc)) {
|
||||
s32 heapSize = evt_get_variable(script, *args++);
|
||||
s32 outVar = *args++;
|
||||
|
||||
evt_set_variable(script, outVar, (s32) _heap_malloc(&gSpriteHeapPtr, heapSize));
|
||||
evt_set_variable(script, outVar, (s32) _heap_malloc(&heap_spriteHead, heapSize));
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -61,7 +63,7 @@ API_CALLABLE(N(ParadeSpriteHeapFree)) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 pointer = *args++;
|
||||
|
||||
_heap_free(&gSpriteHeapPtr, (void*) evt_get_variable(script, pointer));
|
||||
_heap_free(&heap_spriteHead, (void*) evt_get_variable(script, pointer));
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "end_01.h"
|
||||
#include "effects.h"
|
||||
|
||||
extern HeapNode heap_spriteHead;
|
||||
|
||||
extern s32 spr_allocateBtlComponentsOnWorldHeap;
|
||||
extern ParadeNpcInfo N(ParadeNpcsTable)[];
|
||||
|
||||
@ -49,7 +51,7 @@ API_CALLABLE(N(ParadeSpriteHeapMalloc)) {
|
||||
s32 heapSize = evt_get_variable(script, *args++);
|
||||
s32 outVar = *args++;
|
||||
|
||||
evt_set_variable(script, outVar, (s32) _heap_malloc(&gSpriteHeapPtr, heapSize));
|
||||
evt_set_variable(script, outVar, (s32) _heap_malloc(&heap_spriteHead, heapSize));
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -57,7 +59,7 @@ API_CALLABLE(N(ParadeSpriteHeapFree)) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 pointer = *args++;
|
||||
|
||||
_heap_free(&gSpriteHeapPtr, (void*) evt_get_variable(script, pointer));
|
||||
_heap_free(&heap_spriteHead, (void*) evt_get_variable(script, pointer));
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
|
@ -1488,7 +1488,9 @@ void N(worker_draw_story_graphics)(void) {
|
||||
}
|
||||
|
||||
#ifdef SHIFT
|
||||
#define TAPE_OFFSET title_tape_ROM_START - title_bg_1_ROM_START
|
||||
// TODO this breaks stuff to enable it for the shift build
|
||||
// #define TAPE_OFFSET title_tape_ROM_START - title_bg_1_ROM_START
|
||||
#define TAPE_OFFSET 0x2A440
|
||||
#else
|
||||
#define TAPE_OFFSET 0x2A440
|
||||
#endif
|
||||
|
@ -98,21 +98,20 @@ s32 N(LetterBodyStringIDs)[] = {
|
||||
MSG_Document_Letter_Mario12_Body,
|
||||
};
|
||||
|
||||
//TODO shiftability -- these are offsets relative to 0x10F1B0
|
||||
s32 N(LetterDmaOffsets)[] = {
|
||||
0x0000B290, 0x0000D158,
|
||||
0x0000D178, 0x0000EB78,
|
||||
0x0000ED78, 0x00010778,
|
||||
0x00010978, 0x00012378,
|
||||
0x00012578, 0x00013F78,
|
||||
0x00014178, 0x00015B78,
|
||||
0x00015D78, 0x00017778,
|
||||
0x00017978, 0x00019378,
|
||||
0x00019578, 0x0001AF78,
|
||||
0x0001B178, 0x0001CB78,
|
||||
0x0001CD78, 0x0001E778,
|
||||
0x0001E978, 0x00020378,
|
||||
0x00020578, 0x00021F78,
|
||||
(s32) charset_postcard_OFFSET, (s32) charset_postcard_pal_OFFSET + 5,
|
||||
(s32) charset_letter_content_1_OFFSET, (s32) charset_letter_content_1_pal_OFFSET + 6,
|
||||
(s32) charset_letter_content_2_OFFSET, (s32) charset_letter_content_2_pal_OFFSET + 6,
|
||||
(s32) charset_letter_content_3_OFFSET, (s32) charset_letter_content_3_pal_OFFSET + 6,
|
||||
(s32) charset_letter_content_4_OFFSET, (s32) charset_letter_content_4_pal_OFFSET + 6,
|
||||
(s32) charset_letter_content_5_OFFSET, (s32) charset_letter_content_5_pal_OFFSET + 6,
|
||||
(s32) charset_letter_content_6_OFFSET, (s32) charset_letter_content_6_pal_OFFSET + 6,
|
||||
(s32) charset_letter_content_7_OFFSET, (s32) charset_letter_content_7_pal_OFFSET + 6,
|
||||
(s32) charset_letter_content_8_OFFSET, (s32) charset_letter_content_8_pal_OFFSET + 6,
|
||||
(s32) charset_letter_content_9_OFFSET, (s32) charset_letter_content_9_pal_OFFSET + 6,
|
||||
(s32) charset_letter_content_10_OFFSET, (s32) charset_letter_content_10_pal_OFFSET + 6,
|
||||
(s32) charset_letter_content_11_OFFSET, (s32) charset_letter_content_11_pal_OFFSET + 6,
|
||||
(s32) charset_letter_content_12_OFFSET, (s32) charset_letter_content_12_pal_OFFSET + 6,
|
||||
};
|
||||
|
||||
API_CALLABLE(N(InitLetters)){
|
||||
|
@ -6,7 +6,7 @@ typedef struct TitleDataFile {
|
||||
/* 0x08 */ s32 img_offset_press_start;
|
||||
/* 0x0C */ unsigned char unk_0C[4];
|
||||
// end of header
|
||||
/* 0x10 */ s8 data[0];
|
||||
/* 0x10 */ s8 data[VLA];
|
||||
} TitleDataFile; // size may vary
|
||||
|
||||
static TitleDataFile* TitleData;
|
||||
|
@ -2,8 +2,9 @@
|
||||
|
||||
API_CALLABLE(N(MakeCastleChainAngle)) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 angle = evt_get_variable(script, *args);
|
||||
|
||||
evt_set_variable(script, *args++, sin_deg(evt_get_variable(script, *args)) * 20.0f);
|
||||
evt_set_variable(script, *args++, sin_deg(angle) * 20.0f);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
|
@ -196,5 +196,5 @@ typedef struct DripVolume {
|
||||
|
||||
typedef struct DripVolumeList {
|
||||
/* 0x00 */ s32 count;
|
||||
/* 0x04 */ DripVolume volumes[0];
|
||||
/* 0x04 */ DripVolume volumes[VLA];
|
||||
} DripVolumeList; // size = variable
|
||||
|
@ -6,12 +6,21 @@ enum {
|
||||
NUM_VINES = 4
|
||||
};
|
||||
|
||||
enum {
|
||||
VINE_0_BASE = 0x80200000,
|
||||
VINE_1_BASE = 0x80204000,
|
||||
VINE_2_BASE = 0x80207000,
|
||||
VINE_3_BASE = 0x8020A000,
|
||||
}; // TODO shiftability -- hard-coded addresses in gBackgroundImage
|
||||
#ifdef SHIFT
|
||||
extern Addr D_80200000;
|
||||
extern Addr D_80204000;
|
||||
extern Addr D_80207000;
|
||||
extern Addr D_8020A000;
|
||||
#define VINE_0_BASE (s32) &D_80200000
|
||||
#define VINE_1_BASE (s32) &D_80204000
|
||||
#define VINE_2_BASE (s32) &D_80207000
|
||||
#define VINE_3_BASE (s32) &D_8020A000
|
||||
#else
|
||||
#define VINE_0_BASE 0x80200000
|
||||
#define VINE_1_BASE 0x80204000
|
||||
#define VINE_2_BASE 0x80207000
|
||||
#define VINE_3_BASE 0x8020A000
|
||||
#endif
|
||||
|
||||
#include "world/common/lava_piranha/skele1.c"
|
||||
#include "world/common/lava_piranha/skele2.c"
|
||||
|
@ -13,12 +13,21 @@ enum {
|
||||
NUM_VINES = 4
|
||||
};
|
||||
|
||||
enum {
|
||||
VINE_0_BASE = 0x80200000,
|
||||
VINE_1_BASE = 0x80204000,
|
||||
VINE_2_BASE = 0x80207000,
|
||||
VINE_3_BASE = 0x8020A000,
|
||||
}; // TODO shiftability -- hard-coded addresses in gBackgroundImage
|
||||
#ifdef SHIFT
|
||||
extern Addr D_80200000;
|
||||
extern Addr D_80204000;
|
||||
extern Addr D_80207000;
|
||||
extern Addr D_8020A000;
|
||||
#define VINE_0_BASE (s32) &D_80200000
|
||||
#define VINE_1_BASE (s32) &D_80204000
|
||||
#define VINE_2_BASE (s32) &D_80207000
|
||||
#define VINE_3_BASE (s32) &D_8020A000
|
||||
#else
|
||||
#define VINE_0_BASE 0x80200000
|
||||
#define VINE_1_BASE 0x80204000
|
||||
#define VINE_2_BASE 0x80207000
|
||||
#define VINE_3_BASE 0x8020A000
|
||||
#endif
|
||||
|
||||
#include "./kzn_19_anim1.c"
|
||||
#include "./kzn_19_anim2.c"
|
||||
|
@ -1295,3 +1295,5 @@ AnimScript LavaPiranha_ModelScript_0A = {
|
||||
AS_END_LOOP,
|
||||
AS_END,
|
||||
};
|
||||
|
||||
MATCHING_BSS(0x8FB0);
|
||||
|
@ -1197,3 +1197,5 @@ EvtScript world_lakilester_while_riding = {
|
||||
EVT_RETURN
|
||||
EVT_END
|
||||
};
|
||||
|
||||
MATCHING_BSS(0xB0);
|
||||
|
@ -468,3 +468,5 @@ EvtScript BaseEnterDoor = {
|
||||
EVT_RETURN
|
||||
EVT_END
|
||||
};
|
||||
|
||||
MATCHING_BSS(0x7AB0);
|
||||
|
@ -41,8 +41,8 @@ s32 pad_map_table[] = { 0, 0 };
|
||||
#define ASSET_TABLE_FIRST_ENTRY (ASSET_TABLE_ROM_START + ASSET_TABLE_HEADER_SIZE)
|
||||
|
||||
// bss
|
||||
MapSettings gMapSettings;
|
||||
MapConfig* gMapConfig;
|
||||
extern MapSettings gMapSettings;
|
||||
extern MapConfig* gMapConfig;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ char name[16];
|
||||
@ -54,6 +54,12 @@ typedef struct {
|
||||
void fio_deserialize_state(void);
|
||||
void load_map_hit_asset(void);
|
||||
|
||||
#ifdef SHIFT
|
||||
#define shim_general_heap_create_obfuscated general_heap_create
|
||||
#endif
|
||||
|
||||
extern ShapeFile gMapShapeData;
|
||||
|
||||
void load_map_script_lib(void) {
|
||||
dma_copy(world_script_api_ROM_START, world_script_api_ROM_END, world_script_api_VRAM);
|
||||
}
|
||||
@ -118,7 +124,7 @@ void load_map_by_IDs(s16 areaID, s16 mapID, s16 loadType) {
|
||||
}
|
||||
|
||||
if (!skipLoadingAssets) {
|
||||
ShapeFile* shapeFile = &D_80210000;
|
||||
ShapeFile* shapeFile = &gMapShapeData;
|
||||
void* yay0Asset = load_asset_by_name(wMapShapeName, &decompressedSize);
|
||||
|
||||
decode_yay0(yay0Asset, shapeFile);
|
||||
@ -233,7 +239,6 @@ s32 get_map_IDs_by_name(const char* mapName, s16* areaID, s16* mapID) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifndef SHIFT
|
||||
void* load_asset_by_name(const char* assetName, u32* decompressedSize) {
|
||||
AssetHeader firstHeader;
|
||||
AssetHeader* assetTableBuffer;
|
||||
@ -254,11 +259,7 @@ void* load_asset_by_name(const char* assetName, u32* decompressedSize) {
|
||||
heap_free(assetTableBuffer);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM_SHIFT(void*, "world/world", load_asset_by_name);
|
||||
#endif
|
||||
|
||||
#ifndef SHIFT
|
||||
s32 get_asset_offset(char* assetName, s32* compressedSize) {
|
||||
AssetHeader firstHeader;
|
||||
AssetHeader* assetTableBuffer;
|
||||
@ -277,9 +278,6 @@ s32 get_asset_offset(char* assetName, s32* compressedSize) {
|
||||
heap_free(assetTableBuffer);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM_SHIFT(s32, "world/world", get_asset_offset);
|
||||
#endif
|
||||
|
||||
#define AREA(area, jp_name) { ARRAY_COUNT(area##_maps), area##_maps, "area_" #area, jp_name }
|
||||
|
||||
|
@ -203,3 +203,5 @@ EvtScript EVS_World_UseItem = {
|
||||
EVT_RETURN
|
||||
EVT_END
|
||||
};
|
||||
|
||||
MATCHING_BSS(0x2700);
|
||||
|
@ -33,7 +33,7 @@ def exec_shell(command: List[str]) -> str:
|
||||
return ret.stdout
|
||||
|
||||
def write_ninja_rules(ninja: ninja_syntax.Writer, cpp: str, cppflags: str, extra_cflags: str, use_ccache: bool,
|
||||
non_matching: bool, debug: bool):
|
||||
non_matching: bool, shift: bool, debug: bool):
|
||||
# platform-specific
|
||||
if sys.platform == "darwin":
|
||||
iconv = "tools/iconv.py UTF-8 SHIFT-JIS"
|
||||
@ -68,15 +68,24 @@ def write_ninja_rules(ninja: ninja_syntax.Writer, cpp: str, cppflags: str, extra
|
||||
"-DVERSION=$version -DF3DEX_GBI_2 -D_MIPS_SZLONG=32 -nostdinc"
|
||||
|
||||
cflags = f"-c -G0 -O2 -gdwarf-2 -x c -B {BUILD_TOOLS}/cc/gcc/ {extra_cflags}"
|
||||
cflags_modern = f"-c -G0 -fno-builtin-bcopy -fno-tree-loop-distribute-patterns -funsigned-char -mabi=32 -mgp32 -mfp32 -mno-gpopt -mabi=32 -mfix4300 -fno-toplevel-reorder -mno-abicalls -fno-pic -fno-exceptions -fno-stack-protector -fno-zero-initialized-in-bss -O2 -march=vr4300 -w -gdwarf-2 -x c {extra_cflags}"
|
||||
cflags_modern = f"-c -G0 -fno-builtin-bcopy -fno-tree-loop-distribute-patterns -funsigned-char -mabi=32 -mgp32 -mfp32 -mno-gpopt -mabi=32 -mfix4300 -fno-toplevel-reorder -mno-abicalls -fno-pic -fno-exceptions -fno-stack-protector -fno-zero-initialized-in-bss -O2 -march=vr4300 -Wno-builtin-declaration-mismatch -gdwarf-2 -x c {extra_cflags}"
|
||||
cflags_272 = f"-c -G0 -mgp32 -mfp32 -mips3 {extra_cflags}"
|
||||
cflags_272 = cflags_272.replace("-ggdb3","-g1")
|
||||
|
||||
ninja.variable("python", sys.executable)
|
||||
|
||||
ld_args = f"-T ver/$version/build/undefined_syms.txt -T ver/$version/undefined_syms_auto.txt -T ver/$version/undefined_funcs_auto.txt -Map $mapfile --no-check-sections -T $in -o $out"
|
||||
|
||||
if shift:
|
||||
ninja.rule("ld",
|
||||
description="link($version) $out",
|
||||
command=f"{cross}ld -T ver/$version/build/undefined_syms.txt -T ver/$version/undefined_syms_auto.txt -T ver/$version/undefined_funcs_auto.txt -Map $mapfile --no-check-sections -T $in -o $out",
|
||||
command=f"{cross}ld $$(tools/build/ld/multilink_calc.py $version hardcode) {ld_args} && \
|
||||
{cross}ld $$(tools/build/ld/multilink_calc.py $version calc) {ld_args}",
|
||||
)
|
||||
else:
|
||||
ninja.rule("ld",
|
||||
description="link($version) $out",
|
||||
command=f"{cross}ld {ld_args}",
|
||||
)
|
||||
|
||||
Z64_DEBUG = ""
|
||||
@ -244,7 +253,7 @@ class Configure:
|
||||
self.version_path = ROOT / f"ver/{version}"
|
||||
self.linker_entries = None
|
||||
|
||||
def split(self, assets: bool, code: bool, debug: bool):
|
||||
def split(self, assets: bool, code: bool, shift: bool, debug: bool):
|
||||
import split
|
||||
|
||||
modes = ["ld"]
|
||||
@ -259,6 +268,9 @@ class Configure:
|
||||
if debug:
|
||||
splat_file += [str(self.version_path / "splat-debug.yaml")]
|
||||
|
||||
if shift:
|
||||
splat_file += [str(self.version_path / "splat-shift.yaml")]
|
||||
|
||||
split.main(
|
||||
splat_file,
|
||||
modes,
|
||||
@ -316,7 +328,8 @@ class Configure:
|
||||
# ¯\_(ツ)_/¯
|
||||
return path
|
||||
|
||||
def write_ninja(self, ninja: ninja_syntax.Writer, skip_outputs: Set[str], non_matching: bool, debug: bool):
|
||||
def write_ninja(self, ninja: ninja_syntax.Writer, skip_outputs: Set[str], non_matching: bool, modern_gcc: bool,
|
||||
debug: bool):
|
||||
import segtypes
|
||||
import segtypes.common.data
|
||||
import segtypes.n64.yay0
|
||||
@ -326,7 +339,8 @@ class Configure:
|
||||
built_objects = set()
|
||||
generated_headers = []
|
||||
|
||||
def build(object_paths: Union[Path, List[Path]], src_paths: List[Path], task: str, variables: Dict[str, str] = {}, implicit_outputs: List[str] = []):
|
||||
def build(object_paths: Union[Path, List[Path]], src_paths: List[Path], task: str,
|
||||
variables: Dict[str, str] = {}, implicit_outputs: List[str] = []):
|
||||
if not isinstance(object_paths, list):
|
||||
object_paths = [object_paths]
|
||||
|
||||
@ -393,9 +407,8 @@ class Configure:
|
||||
if entry.src_paths[0].suffixes[-1] == ".cpp":
|
||||
task = "cxx"
|
||||
|
||||
top_lev_name = seg.get_most_parent().name
|
||||
# if "evt" in top_lev_name:
|
||||
# task = "cc_modern"
|
||||
if modern_gcc:
|
||||
task = "cc_modern"
|
||||
|
||||
if seg.name.endswith("osFlash"):
|
||||
task = "cc_ido"
|
||||
@ -405,7 +418,7 @@ class Configure:
|
||||
cflags = cflags.replace("gcc_272", "")
|
||||
|
||||
# Dead cod
|
||||
if isinstance(seg, segtypes.common.c.CommonSegC) and seg.rom_start >= 0xEA0900:
|
||||
if isinstance(seg, segtypes.common.c.CommonSegC) and isinstance(seg.rom_start, int) and seg.rom_start >= 0xEA0900:
|
||||
obj_path = str(entry.object_path)
|
||||
init_obj_path = Path(obj_path + ".dead")
|
||||
build(init_obj_path, entry.src_paths, task, variables={
|
||||
@ -702,6 +715,8 @@ class Configure:
|
||||
implicit=[CRC_TOOL],
|
||||
variables={ "version": self.version },
|
||||
)
|
||||
|
||||
if not non_matching:
|
||||
ninja.build(
|
||||
str(self.rom_ok_path()),
|
||||
"sha1sum",
|
||||
@ -736,6 +751,7 @@ if __name__ == "__main__":
|
||||
parser.add_argument("-d", "--debug", action="store_true", help="Generate debugging information")
|
||||
parser.add_argument("-n", "--non-matching", action="store_true", help="Compile nonmatching code. Combine with --debug for more detailed debug info")
|
||||
parser.add_argument("--shift", action="store_true", help="Build a shiftable ROM")
|
||||
parser.add_argument("--modern-gcc", action="store_true", help="Use modern GCC instead of the original compiler")
|
||||
parser.add_argument("-w", "--no-warn", action="store_true", help="Inhibit compiler warnings")
|
||||
parser.add_argument("--ccache", action="store_true", help="Use ccache")
|
||||
args = parser.parse_args()
|
||||
@ -800,6 +816,9 @@ if __name__ == "__main__":
|
||||
if args.shift:
|
||||
cppflags += " -DSHIFT"
|
||||
|
||||
if not args.modern_gcc:
|
||||
cppflags += " -DOLD_GCC"
|
||||
|
||||
if not args.no_warn:
|
||||
cflags += " -Wmissing-braces -Wimplicit -Wredundant-decls -Wstrict-prototypes"
|
||||
|
||||
@ -808,7 +827,9 @@ if __name__ == "__main__":
|
||||
|
||||
ninja = ninja_syntax.Writer(open(str(ROOT / "build.ninja"), "w"), width=9999)
|
||||
|
||||
write_ninja_rules(ninja, args.cpp or "cpp", cppflags, cflags, args.ccache, args.non_matching, args.debug)
|
||||
non_matching = args.non_matching or args.modern_gcc or args.shift
|
||||
|
||||
write_ninja_rules(ninja, args.cpp or "cpp", cppflags, cflags, args.ccache, args.non_matching, args.shift, args.debug)
|
||||
write_ninja_for_tools(ninja)
|
||||
|
||||
skip_files = set()
|
||||
@ -823,12 +844,16 @@ if __name__ == "__main__":
|
||||
if not first_configure:
|
||||
first_configure = configure
|
||||
|
||||
configure.split(not args.no_split_assets, args.split_code, args.debug)
|
||||
configure.write_ninja(ninja, skip_files, args.non_matching, args.debug)
|
||||
configure.split(not args.no_split_assets, args.split_code, args.shift, args.debug)
|
||||
configure.write_ninja(ninja, skip_files, non_matching, args.modern_gcc, args.debug)
|
||||
|
||||
all_rom_oks.append(str(configure.rom_ok_path()))
|
||||
|
||||
assert(first_configure)
|
||||
first_configure.make_current(ninja)
|
||||
|
||||
if non_matching:
|
||||
ninja.build("all", "phony", [str(first_configure.rom_path())])
|
||||
else:
|
||||
ninja.build("all", "phony", all_rom_oks)
|
||||
ninja.default("all")
|
||||
|
88
tools/build/ld/multilink_calc.py
Executable file
88
tools/build/ld/multilink_calc.py
Executable file
@ -0,0 +1,88 @@
|
||||
#! /usr/bin/python3
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
import sys
|
||||
from typing import Dict, List
|
||||
|
||||
script_dir = Path(os.path.dirname(os.path.realpath(__file__)))
|
||||
root_dir = script_dir / "../../.."
|
||||
|
||||
HARDCODED_ADDR = 0x80000000
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 3:
|
||||
print(f"Usage: {sys.argv[0]} <version> <mode>")
|
||||
print("mode: hardcode, calc")
|
||||
sys.exit(1)
|
||||
|
||||
version = sys.argv[1]
|
||||
mode = sys.argv[2]
|
||||
|
||||
syms_to_max = {
|
||||
"entity_data_vram_end" : [
|
||||
"entity_default_VRAM_END",
|
||||
"entity_jan_iwa_VRAM_END",
|
||||
"entity_sbk_omo_VRAM_END",
|
||||
],
|
||||
"world_action_vram_end": [
|
||||
"world_action_idle_VRAM_END",
|
||||
"world_action_walk_VRAM_END",
|
||||
"world_action_jump_VRAM_END",
|
||||
"world_action_step_up_VRAM_END",
|
||||
"world_action_land_VRAM_END",
|
||||
"world_action_hammer_VRAM_END",
|
||||
"world_action_spin_VRAM_END",
|
||||
"world_action_tornado_jump_VRAM_END",
|
||||
"world_action_spin_jump_VRAM_END",
|
||||
"world_action_slide_VRAM_END",
|
||||
"world_action_hit_fire_VRAM_END",
|
||||
"world_action_hit_lava_VRAM_END",
|
||||
"world_action_knockback_VRAM_END",
|
||||
"world_action_misc_VRAM_END",
|
||||
"world_action_use_munchlesia_VRAM_END",
|
||||
"world_action_use_spinning_flower_VRAM_END",
|
||||
"world_action_use_tweester_VRAM_END",
|
||||
"world_action_sneaky_parasol_VRAM_END",
|
||||
]
|
||||
}
|
||||
|
||||
addrs: Dict[str, List[int]] = {}
|
||||
|
||||
if mode == "hardcode":
|
||||
out = ""
|
||||
for sym in syms_to_max:
|
||||
addrs[sym] = [HARDCODED_ADDR]
|
||||
elif mode == "calc":
|
||||
with open(root_dir / "ver" / version / "build/papermario.map") as f:
|
||||
lines = f.readlines()
|
||||
|
||||
finished = False
|
||||
syms_to_go = set(syms_to_max.keys())
|
||||
for line in lines:
|
||||
for sym in syms_to_max:
|
||||
for max_sym in syms_to_max[sym]:
|
||||
if f"{max_sym} = ." in line:
|
||||
if sym not in addrs:
|
||||
addrs[sym] = []
|
||||
addrs[sym].append(int(line.strip().split()[0], 16))
|
||||
syms_to_max[sym].remove(max_sym)
|
||||
if len(syms_to_max[sym]) == 0:
|
||||
syms_to_go.remove(sym)
|
||||
if not syms_to_go:
|
||||
finished = True
|
||||
if finished:
|
||||
break
|
||||
|
||||
if syms_to_go:
|
||||
print(f"Error: {syms_to_max} not found in map file")
|
||||
sys.exit(1)
|
||||
|
||||
out_addrs = {sym: max(addrs[sym]) for sym in addrs}
|
||||
|
||||
out_addrs["entity_data_vram_end"] = out_addrs["entity_data_vram_end"] + out_addrs["world_action_vram_end"] - HARDCODED_ADDR
|
||||
|
||||
out = ""
|
||||
for sym in out_addrs:
|
||||
out += f" --defsym {sym}=0x{out_addrs[sym]:X}"
|
||||
print(out)
|
@ -25,7 +25,7 @@ glabel func_8005A3A4
|
||||
/* 357F4 8005A3F4 2402FF7F */ addiu $v0, $zero, -0x81
|
||||
/* 357F8 8005A3F8 00621824 */ and $v1, $v1, $v0
|
||||
/* 357FC 8005A3FC ACA30000 */ sw $v1, ($a1)
|
||||
/* 35800 8005A400 0C00B280 */ jal func_8002CA00
|
||||
/* 35800 8005A400 0C00B280 */ jal load_obfuscation_shims
|
||||
/* 35804 8005A404 A0800084 */ sb $zero, 0x84($a0)
|
||||
/* 35808 8005A408 0C0AC81E */ jal func_802B2078
|
||||
/* 3580C 8005A40C 00108400 */ sll $s0, $s0, 0x10
|
||||
@ -166,7 +166,7 @@ glabel func_8005A3A4
|
||||
/* 35A08 8005A608 0C052B88 */ jal func_8014AE20
|
||||
/* 35A0C 8005A60C 00000000 */ nop
|
||||
.L8005A610:
|
||||
/* 35A10 8005A610 0C00B280 */ jal func_8002CA00
|
||||
/* 35A10 8005A610 0C00B280 */ jal load_obfuscation_shims
|
||||
/* 35A14 8005A614 00000000 */ nop
|
||||
/* 35A18 8005A618 0C0AC81E */ jal func_802B2078
|
||||
/* 35A1C 8005A61C 00000000 */ nop
|
||||
|
@ -1,7 +1,7 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
glabel func_8002CA00
|
||||
glabel load_obfuscation_shims
|
||||
/* 7E00 8002CA00 27BDFFC0 */ addiu $sp, $sp, -0x40
|
||||
/* 7E04 8002CA04 AFB60030 */ sw $s6, 0x30($sp)
|
||||
/* 7E08 8002CA08 3C16759A */ lui $s6, 0x759a
|
@ -52,7 +52,7 @@ glabel func_80033574
|
||||
/* EA28 80033628 24020001 */ addiu $v0, $zero, 1
|
||||
/* EA2C 8003362C 0C016AD4 */ jal func_8005AB50
|
||||
/* EA30 80033630 A0620070 */ sb $v0, 0x70($v1)
|
||||
/* EA34 80033634 0C00B280 */ jal func_8002CA00
|
||||
/* EA34 80033634 0C00B280 */ jal load_obfuscation_shims
|
||||
/* EA38 80033638 00000000 */ nop
|
||||
/* EA3C 8003363C 0C0AC82D */ jal func_802B20B4
|
||||
/* EA40 80033640 00000000 */ nop
|
||||
|
2
ver/jp/splat-shift.yaml
Normal file
2
ver/jp/splat-shift.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
options:
|
||||
ld_use_follows: True
|
@ -1,2 +1,4 @@
|
||||
osTvType = 0x80000300;
|
||||
osViModeNtscLan1 = 0x80095800;
|
||||
load_engine_data = 0x80000000;
|
||||
create_audio_system = 0x80000000;
|
||||
|
@ -18,8 +18,8 @@ glabel spr_init_player_raster_cache
|
||||
/* 101E84 802DED94 2406000C */ addiu $a2, $zero, 0xc
|
||||
/* 101E88 802DED98 3C060194 */ lui $a2, %hi(_1943000_ROM_START + 0x10)
|
||||
/* 101E8C 802DED9C 34C63010 */ addiu $a2, $a2, %lo(_1943000_ROM_START + 0x10)
|
||||
/* 101E90 802DEDA0 3C048035 */ lui $a0, %hi(gSpriteHeapPtr)
|
||||
/* 101E94 802DEDA4 2484F800 */ addiu $a0, $a0, %lo(gSpriteHeapPtr)
|
||||
/* 101E90 802DEDA0 3C048035 */ lui $a0, %hi(heap_spriteHead)
|
||||
/* 101E94 802DEDA4 2484F800 */ addiu $a0, $a0, %lo(heap_spriteHead)
|
||||
/* 101E98 802DEDA8 8E020000 */ lw $v0, ($s0)
|
||||
/* 101E9C 802DEDAC 02510018 */ mult $s2, $s1
|
||||
/* 101EA0 802DEDB0 3C01802E */ lui $at, %hi(PlayerRasterCacheSize)
|
||||
|
2
ver/us/splat-shift.yaml
Normal file
2
ver/us/splat-shift.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
options:
|
||||
ld_use_follows: True
|
File diff suppressed because it is too large
Load Diff
@ -1381,14 +1381,14 @@ D_80077814 = 0x80077814; // type:data rom:0x52C14
|
||||
D_80077828 = 0x80077828; // type:data rom:0x52C28
|
||||
D_8007783C = 0x8007783C; // type:data rom:0x52C3C
|
||||
gameModeMap = 0x80077850; // type:data rom:0x52C50
|
||||
D_800778A0 = 0x800778A0; // type:data rom:0x52CA0
|
||||
bFrameBuffers = 0x800778A0; // type:data rom:0x52CA0
|
||||
D_800778AC = 0x800778AC; // type:data rom:0x52CAC
|
||||
D_800778C0 = 0x800778C0; // type:data rom:0x52CC0
|
||||
D_800778C8 = 0x800778C8; // type:data rom:0x52CC8
|
||||
D_80077908 = 0x80077908; // type:data rom:0x52D08
|
||||
D_80077950 = 0x80077950; // type:data rom:0x52D50
|
||||
pause_frameBuffers = 0x80077950; // type:data rom:0x52D50
|
||||
D_8007795C = 0x8007795C; // type:data rom:0x52D5C
|
||||
D_80077980 = 0x80077980; // type:data rom:0x52D80
|
||||
fsFrameBuffers = 0x80077980; // type:data rom:0x52D80
|
||||
D_8007798C = 0x8007798C; // type:data rom:0x52D8C
|
||||
D_800779B0 = 0x800779B0; // type:data rom:0x52DB0
|
||||
D_800779C0 = 0x800779C0; // type:data rom:0x52DC0
|
||||
@ -26050,11 +26050,11 @@ D_80164000 = 0x80164000; // type:data
|
||||
dead_gCollisionStatus = 0x80169B10; // type:data
|
||||
D_80197000 = 0x80197000; // type:data
|
||||
D_801A6000 = 0x801A6000; // type:data
|
||||
D_801A7000 = 0x801A7000; // type:data
|
||||
BattleEntityHeapBottom = 0x801A7000; // type:data
|
||||
AuHeapBase = 0x801AA000; // type:data
|
||||
D_80200000 = 0x80200000; // type:data
|
||||
gBackgroundImage = 0x80200000; //
|
||||
D_80210000 = 0x80210000; // type:data
|
||||
gMapShapeData = 0x80210000; // type:data
|
||||
D_80219040 = 0x80219040; // type:data
|
||||
spiked_goomba = 0x8021B0AC; // type:data
|
||||
paragoomba = 0x8021CD00; // type:data
|
||||
@ -27265,10 +27265,10 @@ D_802EE8D0 = 0x802EE8D0; // type:data
|
||||
D_802F39D0 = 0x802F39D0; // type:data
|
||||
D_802F4560 = 0x802F4560; // type:data
|
||||
heap_generalHead = 0x802FB800; // type:data
|
||||
gSpriteHeapPtr = 0x8034F800; // type:data
|
||||
D_8038F800 = 0x8038F800; // type:data
|
||||
D_803B5000 = 0x803B5000; // type:data
|
||||
D_803DA800 = 0x803DA800; // type:data
|
||||
heap_spriteHead = 0x8034F800; // type:data
|
||||
gFrameBuf0 = 0x8038F800; // type:data
|
||||
gFrameBuf1 = 0x803B5000; // type:data
|
||||
gFrameBuf2 = 0x803DA800; // type:data
|
||||
heap_battleHead = 0x803DA800; // type:data
|
||||
D_A0000000 = 0xA0000000; // type:data
|
||||
D_A4000000 = 0xA4000000; // type:data
|
||||
@ -27335,3 +27335,11 @@ dead_evt_get_variable = 0x802D4E8C; // type:func dead:yes
|
||||
dead_evt_set_variable = 0x802D5468; // type:func dead:yes
|
||||
dead_evt_get_float_variable = 0x802D57FC; // type:func dead:yes
|
||||
dead_evt_set_float_variable = 0x802D5A10; // type:func dead:yes
|
||||
battle_partner_vram_start = 0x80238000; // type:data appears_after_overlays_addr:0x80218000
|
||||
battle_code_vram_start = 0x8023E000; // type:data appears_after_overlays_addr:0x80238000
|
||||
world_model_data_vram_end = 0x80240000; // type:data appears_after_overlays_addr:0x80234000
|
||||
map_vram_end = 0x80267FF0; // type:data appears_after_overlays_addr:0x80240000
|
||||
//world_action_vram_end = 0x802B7000; // type:data appears_after_overlays_addr:0x802B6000
|
||||
world_misc_vram_end = 0x802B7E00; // type:data appears_after_overlays_addr:0x802B7000
|
||||
//entity_data_vram_end = 0x802BD100; // type:data appears_after_overlays_addr:0x802BAE00
|
||||
world_partner_vram_end = 0x802C3000; // type:data appears_after_overlays_addr:0x802BD100
|
||||
|
@ -1,38 +1,92 @@
|
||||
// Obfuscation symbols
|
||||
obfuscated_battle_heap_create = battle_heap_create - 0xFEFFFFF;
|
||||
obfuscated_general_heap_create = general_heap_create - 0xFEFEFEF;
|
||||
obfuscated_load_engine_data = load_engine_data - 0x315;
|
||||
obfuscated_create_audio_system = create_audio_system - 0x7B;
|
||||
obfuscated_obfuscation_shims_VRAM = obfuscation_shims_VRAM - 0xA912928;
|
||||
obfuscated_obfuscation_shims_ROM_START = obfuscation_shims_ROM_START - 0x8939221;
|
||||
// hard-coded things
|
||||
gBackgroundImage = 0x80200000; // hard-coded inside mapfs for now
|
||||
gMapShapeData = 0x80210000; // needs to be hard-coded atm due to pointers in shape data
|
||||
|
||||
heap_battleHead = gFrameBuf2;
|
||||
|
||||
D_804DC500 = 0x804DC500;
|
||||
|
||||
// hacks for various things
|
||||
fx_sun_undeclared = fx_sun;
|
||||
D_802AD673 = 0x802AD673; // remove when func_802A45D8 is decompiled with D_802AD670 instead of D_802AD673
|
||||
|
||||
#ifdef SHIFT
|
||||
mdl_clearRenderTasks = MAX(inspect_icon_VRAM_END, speech_bubble_VRAM_END);
|
||||
mdl_clearRenderTasks = MAX(mdl_clearRenderTasks, pulse_stone_VRAM_END);
|
||||
mdl_clearRenderTasks = MAX(mdl_clearRenderTasks, i_spy_VRAM_END);
|
||||
#else
|
||||
mdl_clearRenderTasks = 0x802B7E00;
|
||||
#endif
|
||||
battle_move_end = mushroom_VRAM_END;
|
||||
battle_move_end = MAX(battle_move_end, fire_flower_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, dusty_hammer_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, pow_block_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, pebble_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, volt_shroom_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, thunder_rage_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, snowman_doll_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, dried_shroom_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, shooting_star_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, sleepy_sheep_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, stone_cap_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, tasty_tonic_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, thunder_bolt_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, ultra_shroom_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, unknown_item_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, super_soda_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, hustle_drink_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, stop_watch_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, dizzy_dial_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, please_come_back_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, egg_missile_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, insecticide_herb_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, fright_jar_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, mystery_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, repel_gel_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, life_shroom_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, coconut_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, electro_pop_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, strange_cake_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, food_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_hammer_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_spin_smash_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_quake_hammer_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_jump_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_multibounce_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_power_bounce_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_sleep_stomp_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_dizzy_stomp_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_d_down_pound_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_jump_charge_0_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_hammer_charge_0_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_hammer_throw_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_mega_quake_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_hammer_charge_1_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_jump_charge_1_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_hammer_charge_2_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_jump_charge_2_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_auto_smash_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_auto_jump_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_power_quake_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_auto_multibounce_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_power_jump_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_super_jump_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_mega_jump_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_power_smash_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_super_smash_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_mega_smash_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_unknown_move_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_shrink_smash_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_shell_crack_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_d_down_jump_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_shrink_stomp_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_move_earthquake_jump_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_star_focus_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_star_refresh_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_star_lullaby_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_star_star_storm_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_star_chill_out_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_star_smooch_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_star_time_out_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_star_up_and_away_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_star_star_beam_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_star_peach_beam_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_star_peach_focus_VRAM_END);
|
||||
battle_move_end = MAX(battle_move_end, battle_star_peach_dash_VRAM_END);
|
||||
|
||||
// hard-coded heapy things
|
||||
D_80197000 = 0x80197000; // effect tlb stuff
|
||||
D_801A6000 = 0x801A6000; // effect tlb stuff
|
||||
D_801A7000 = 0x801A7000;
|
||||
AuHeapBase = 0x801AA000;
|
||||
D_80200000 = 0x80200000;
|
||||
gBackgroundImage = 0x80200000;
|
||||
D_80210000 = 0x80210000;
|
||||
heap_collisionHead = 0x80268000;
|
||||
heap_generalHead = 0x802FB800;
|
||||
gSpriteHeapPtr = 0x8034F800;
|
||||
D_8038F800 = 0x8038F800;
|
||||
D_803B5000 = 0x803B5000;
|
||||
D_803DA800 = 0x803DA800;
|
||||
heap_battleHead = 0x803DA800;
|
||||
world_battle_vram_end = battle_code_VRAM_END;
|
||||
world_battle_vram_end = MAX(world_battle_vram_end, world_script_api_VRAM_END);
|
||||
|
||||
// boot
|
||||
D_A0000000 = 0xA0000000;
|
||||
@ -57,6 +111,14 @@ D_B0000000 = 0xB0000000;
|
||||
D_B0000008 = 0xB0000008;
|
||||
D_B0000010 = 0xB0000010;
|
||||
|
||||
// Obfuscation symbols
|
||||
obfuscated_battle_heap_create = battle_heap_create - 0xFEFFFFF;
|
||||
obfuscated_general_heap_create = general_heap_create - 0xFEFEFEF;
|
||||
obfuscated_load_engine_data = load_engine_data - 0x315;
|
||||
obfuscated_create_audio_system = create_audio_system - 0x7B;
|
||||
obfuscated_obfuscation_shims_VRAM = obfuscation_shims_VRAM - 0xA912928;
|
||||
obfuscated_obfuscation_shims_ROM_START = obfuscation_shims_ROM_START - 0x8939221;
|
||||
|
||||
// Invalid pointers from dead code
|
||||
dead_transform_point = transform_point + 0x12F0;
|
||||
dead_dma_copy = dma_copy + 0x12F0;
|
||||
|
Loading…
Reference in New Issue
Block a user