mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-13 11:24:40 +00:00
Merge branch 'master' into doc_pause_menu
This commit is contained in:
commit
eb75e00f91
94 changed files with 583 additions and 450 deletions
8
Makefile
8
Makefile
|
@ -64,13 +64,13 @@ N_THREADS ?= $(shell nproc)
|
|||
|
||||
#### Tools ####
|
||||
ifneq ($(shell type $(MIPS_BINUTILS_PREFIX)ld >/dev/null 2>/dev/null; echo $$?), 0)
|
||||
$(error Please install or build $(MIPS_BINUTILS_PREFIX))
|
||||
$(error Unable to find $(MIPS_BINUTILS_PREFIX)ld. Please install or build MIPS binutils, commonly mips-linux-gnu. (or set MIPS_BINUTILS_PREFIX if your MIPS binutils install uses another prefix))
|
||||
endif
|
||||
|
||||
# Detect compiler and set variables appropriately.
|
||||
ifeq ($(COMPILER),gcc)
|
||||
CC := $(MIPS_BINUTILS_PREFIX)gcc
|
||||
else
|
||||
else
|
||||
ifeq ($(COMPILER),ido)
|
||||
CC := tools/ido_recomp/$(DETECTED_OS)/7.1/cc
|
||||
CC_OLD := tools/ido_recomp/$(DETECTED_OS)/5.3/cc
|
||||
|
@ -121,7 +121,7 @@ ASFLAGS := -march=vr4300 -32 -no-pad-sections -Iinclude
|
|||
ifeq ($(COMPILER),gcc)
|
||||
CFLAGS += -G 0 -nostdinc $(INC) -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -mdivide-breaks -fno-zero-initialized-in-bss -fno-toplevel-reorder -ffreestanding -fno-common -fno-merge-constants -mno-explicit-relocs -mno-split-addresses $(CHECK_WARNINGS) -funsigned-char
|
||||
MIPS_VERSION := -mips3
|
||||
else
|
||||
else
|
||||
# we support Microsoft extensions such as anonymous structs, which the compiler does support but warns for their usage. Surpress the warnings with -woff.
|
||||
CFLAGS += -G 0 -non_shared -fullwarn -verbose -Xcpluscomm $(INC) -Wab,-r4300_mul -woff 516,649,838,712
|
||||
MIPS_VERSION := -mips2
|
||||
|
@ -281,7 +281,7 @@ $(ROM): $(ELF)
|
|||
$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) build/ldscript.txt build/undefined_syms.txt
|
||||
$(LD) -T build/undefined_syms.txt -T build/ldscript.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map build/z64.map -o $@
|
||||
|
||||
## Order-only prerequisites
|
||||
## Order-only prerequisites
|
||||
# These ensure e.g. the O_FILES are built before the OVL_RELOC_FILES.
|
||||
# The intermediate phony targets avoid quadratically-many dependencies between the targets and prerequisites.
|
||||
|
||||
|
|
|
@ -11,10 +11,8 @@
|
|||
<Texture Name="gMoriStalfosPlatformSideTex" OutName="stalfos_platform_side" Format="rgba16" Height="32" Width="64" Offset="0x3200"/>
|
||||
<Texture Name="gMoriStalfosPlatformTopTex" OutName="stalfos_platform_top" Format="rgba16" Height="32" Width="32" Offset="0x4200"/>
|
||||
|
||||
<Texture Name="gMoriHashiraPlatformsTex" OutName="hashira_platform" Format="rgba16" Height="32" Width="32" Offset="0x4A00"/>
|
||||
|
||||
<!-- This is just a guess since its unused -->
|
||||
<Texture Name="gMoriWaterTex" OutName="water" Format="rgba16" Height="8" Width="32" Offset="0x5200"/>
|
||||
<Texture Name="gMoriHashiraPlatformsTex" OutName="hashira_platform" Format="rgba16" Height="16" Width="16" Offset="0x4A00"/>
|
||||
<Texture Name="gMoriWaterTex" OutName="water" Format="rgba16" Height="32" Width="32" Offset="0x4C00"/>
|
||||
|
||||
<Texture Name="gMoriHashigoLadderTex" OutName="ladder" Format="rgba16" Height="32" Width="32" Offset="0x5400"/>
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<Texture Name="gBombchuShopkeeperFingersTex" OutName="fingers" Format="ci8" Width="16" Height="16" Offset="0x4568" TlutOffset="0x2EE8"/>
|
||||
<Texture Name="gBombchuShopkeeperVestTex" OutName="vest" Format="i8" Width="8" Height="16" Offset="0x4668"/>
|
||||
<Texture Name="gBombchuShopkeeperTorsoTex" OutName="torso" Format="ci8" Width="8" Height="32" Offset="0x46E8" TlutOffset="0x2EE8"/>
|
||||
|
||||
|
||||
<Limb Name="gBombchuShopkeeperTorsoLimb" LimbType="Standard" Offset="0x47E8"/>
|
||||
<Limb Name="gBombchuShopkeeperLeftUpperArmLimb" LimbType="Standard" Offset="0x47F4"/>
|
||||
<Limb Name="gBombchuShopkeeperLeftForearmLimb" LimbType="Standard" Offset="0x4800"/>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# VSCode
|
||||
|
||||
A lot of people on this project use VSCode as their coding environment.
|
||||
A lot of people on this project use VSCode as their coding environment.
|
||||
|
||||
## Extensions
|
||||
|
||||
|
@ -23,7 +23,7 @@ There are a number of useful extensions available to make work more efficient:
|
|||
- Ctrl + P offers a box to use to search for and open files.
|
||||
- Ctrl + Shift + P offers a box for commands like editing settings or reloading the window.
|
||||
|
||||
- Make use of VSCode's search/search-and-replace features.
|
||||
- Make use of VSCode's search/search-and-replace features.
|
||||
- Ctrl + Click goes to a definition.
|
||||
- Ctrl + F for search in current file
|
||||
- Ctrl + H for replace in current file
|
||||
|
|
|
@ -6,6 +6,7 @@ import os
|
|||
import signal
|
||||
import time
|
||||
import multiprocessing
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
EXTRACTED_ASSETS_NAMEFILE = ".extracted-assets.json"
|
||||
|
@ -21,7 +22,13 @@ def ExtractFile(xmlPath, outputPath, outputSourcePath):
|
|||
# Don't extract if another file wasn't extracted properly.
|
||||
return
|
||||
|
||||
execStr = f"tools/ZAPD/ZAPD.out e -eh -i {xmlPath} -b baserom/ -o {outputPath} -osf {outputSourcePath} -gsf 1 -rconf tools/ZAPDConfigs/MqDbg/Config.xml {ZAPDArgs}"
|
||||
zapdPath = Path("tools") / "ZAPD" / "ZAPD.out"
|
||||
configPath = Path("tools") / "ZAPDConfigs" / "MqDbg" / "Config.xml"
|
||||
|
||||
Path(outputPath).mkdir(parents=True, exist_ok=True)
|
||||
Path(outputSourcePath).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
execStr = f"{zapdPath} e -eh -i {xmlPath} -b baserom -o {outputPath} -osf {outputSourcePath} -gsf 1 -rconf {configPath} {ZAPDArgs}"
|
||||
|
||||
if "overlays" in xmlPath:
|
||||
execStr += " --static"
|
||||
|
@ -143,14 +150,21 @@ def main():
|
|||
if file.endswith(".xml"):
|
||||
xmlFiles.append(fullPath)
|
||||
|
||||
class CannotMultiprocessError(Exception):
|
||||
pass
|
||||
|
||||
try:
|
||||
numCores = int(args.jobs or 0)
|
||||
if numCores <= 0:
|
||||
numCores = 1
|
||||
print("Extracting assets with " + str(numCores) + " CPU core" + ("s" if numCores > 1 else "") + ".")
|
||||
with multiprocessing.get_context("fork").Pool(numCores, initializer=initializeWorker, initargs=(mainAbort, args.unaccounted, extractedAssetsTracker, manager)) as p:
|
||||
try:
|
||||
mp_context = multiprocessing.get_context("fork")
|
||||
except ValueError as e:
|
||||
raise CannotMultiprocessError() from e
|
||||
with mp_context.Pool(numCores, initializer=initializeWorker, initargs=(mainAbort, args.unaccounted, extractedAssetsTracker, manager)) as p:
|
||||
p.map(ExtractFunc, xmlFiles)
|
||||
except (multiprocessing.ProcessError, TypeError):
|
||||
except (multiprocessing.ProcessError, TypeError, CannotMultiprocessError):
|
||||
print("Warning: Multiprocessing exception ocurred.", file=os.sys.stderr)
|
||||
print("Disabling mutliprocessing.", file=os.sys.stderr)
|
||||
|
||||
|
|
|
@ -1741,11 +1741,11 @@ Gfx* GfxPrint_Close(GfxPrint* this);
|
|||
s32 GfxPrint_Printf(GfxPrint* this, const char* fmt, ...);
|
||||
void RcpUtils_PrintRegisterStatus(void);
|
||||
void RcpUtils_Reset(void);
|
||||
void* Overlay_AllocateAndLoad(uintptr_t vRomStart, uintptr_t vRomEnd, void* vRamStart, void* vRamEnd);
|
||||
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd);
|
||||
void MtxConv_F2L(Mtx* m1, MtxF* m2);
|
||||
void MtxConv_L2F(MtxF* m1, Mtx* m2);
|
||||
void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* overlayInfo, void* vRamStart);
|
||||
s32 Overlay_Load(uintptr_t vRomStart, uintptr_t vRomEnd, void* vRamStart, void* vRamEnd, void* allocatedVRamAddr);
|
||||
void Overlay_Relocate(void* allocatedRamAddress, OverlayRelocationSection* ovlRelocs, void* vramStart);
|
||||
s32 Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd, void* allocatedRamAddr);
|
||||
// ? func_800FC800(?);
|
||||
// ? func_800FC83C(?);
|
||||
// ? func_800FCAB4(?);
|
||||
|
|
|
@ -1165,24 +1165,34 @@ typedef struct ArenaNode {
|
|||
/* 0x28 */ u8 unk_28[0x30-0x28]; // probably padding
|
||||
} ArenaNode; // size = 0x30
|
||||
|
||||
#define RELOC_SECTION(reloc) ((reloc) >> 30)
|
||||
#define RELOC_OFFSET(reloc) ((reloc) & 0xFFFFFF)
|
||||
/* Relocation entry field getters */
|
||||
#define RELOC_SECTION(reloc) ((reloc) >> 30)
|
||||
#define RELOC_OFFSET(reloc) ((reloc) & 0xFFFFFF)
|
||||
#define RELOC_TYPE_MASK(reloc) ((reloc) & 0x3F000000)
|
||||
#define RELOC_TYPE_SHIFT 24
|
||||
|
||||
/* MIPS Relocation Types */
|
||||
#define R_MIPS_32 2
|
||||
#define R_MIPS_26 4
|
||||
/* MIPS Relocation Types, matches the MIPS ELF spec */
|
||||
#define R_MIPS_32 2
|
||||
#define R_MIPS_26 4
|
||||
#define R_MIPS_HI16 5
|
||||
#define R_MIPS_LO16 6
|
||||
|
||||
/* Reloc section id, must fit in 2 bits otherwise the relocation format must be modified */
|
||||
typedef enum {
|
||||
/* 0 */ RELOC_SECTION_NULL,
|
||||
/* 1 */ RELOC_SECTION_TEXT,
|
||||
/* 2 */ RELOC_SECTION_DATA,
|
||||
/* 3 */ RELOC_SECTION_RODATA,
|
||||
/* 4 */ RELOC_SECTION_MAX
|
||||
} RelocSectionId;
|
||||
|
||||
typedef struct OverlayRelocationSection {
|
||||
/* 0x00 */ u32 textSize;
|
||||
/* 0x04 */ u32 dataSize;
|
||||
/* 0x08 */ u32 rodataSize;
|
||||
/* 0x0C */ u32 bssSize;
|
||||
/* 0x10 */ u32 nRelocations;
|
||||
/* 0x14 */ u32 relocations[1];
|
||||
/* 0x14 */ u32 relocations[1]; // size is nRelocations
|
||||
} OverlayRelocationSection; // size >= 0x18
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -857,9 +857,9 @@ typedef struct {
|
|||
/* 0x1E38 */ OSMesg externalLoadMsgBuf[16];
|
||||
/* 0x1E78 */ OSMesgQueue preloadSampleQueue;
|
||||
/* 0x1E90 */ OSMesg preloadSampleMsgBuf[16];
|
||||
/* 0x1ED0 */ OSMesgQueue currAudioFrameDmaQueue;
|
||||
/* 0x1EE8 */ OSMesg currAudioFrameDmaMsgBuf[64];
|
||||
/* 0x1FE8 */ OSIoMesg currAudioFrameDmaIoMsgBuf[64];
|
||||
/* 0x1ED0 */ OSMesgQueue curAudioFrameDmaQueue;
|
||||
/* 0x1EE8 */ OSMesg curAudioFrameDmaMsgBuf[64];
|
||||
/* 0x1FE8 */ OSIoMesg curAudioFrameDmaIoMsgBuf[64];
|
||||
/* 0x25E8 */ OSMesgQueue syncDmaQueue;
|
||||
/* 0x2600 */ OSMesg syncDmaMesg;
|
||||
/* 0x2604 */ OSIoMesg syncDmaIoMesg;
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#define CAM_LETTERBOX_MEDIUM CAM_LETTERBOX(2)
|
||||
#define CAM_LETTERBOX_LARGE CAM_LETTERBOX(3)
|
||||
|
||||
#define CAM_LETTERBOX_INSTANT CAM_LETTERBOX(8) // Bit to determine whether to set the current value directly (on), or to set the size target (off)
|
||||
#define CAM_LETTERBOX_INSTANT CAM_LETTERBOX(8) // Bit to determine whether to set the current value directly (on), or to set the size target (off)
|
||||
#define CAM_LETTERBOX_IGNORE CAM_LETTERBOX(0xF) // No change in letterbox size, keep the previous size
|
||||
|
||||
// Camera-unique hud visibility mode macros
|
||||
|
@ -121,7 +121,7 @@
|
|||
#define CAM_VIEW_FOV (1 << 5) // camera->fov
|
||||
#define CAM_VIEW_ROLL (1 << 6) // camera->roll
|
||||
|
||||
// All scenes using `SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT` or `SCENE_CAM_TYPE_FIXED_TOGGLE_VIEWPOINT` are expected
|
||||
// All scenes using `SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT` or `SCENE_CAM_TYPE_FIXED_TOGGLE_VIEWPOINT` are expected
|
||||
// to have their first two bgCamInfo entries be the following:
|
||||
#define BGCAM_INDEX_TOGGLE_LOCKED 0
|
||||
#define BGCAM_INDEX_TOGGLE_PIVOT 1
|
||||
|
@ -170,7 +170,7 @@ typedef enum {
|
|||
/* 0x20 */ CAM_SET_START1, // Scene/room door transitions that snap the camera to a fixed location (example: ganon's towers doors climbing up)
|
||||
/* 0x21 */ CAM_SET_FREE0, // Full manual control is given over the camera
|
||||
/* 0x22 */ CAM_SET_FREE2, // Various OnePoint Cutscenes, 10 total (example: falling chest)
|
||||
/* 0x23 */ CAM_SET_PIVOT_CORNER, // Inside the carpenter jail cells from theives hideout "CIRCLE4"
|
||||
/* 0x23 */ CAM_SET_PIVOT_CORNER, // Inside the carpenter jail cells from thieves hideout "CIRCLE4"
|
||||
/* 0x24 */ CAM_SET_PIVOT_WATER_SURFACE, // Player diving from the surface of the water to underwater "CIRCLE5"
|
||||
/* 0x25 */ CAM_SET_CS_0, // Various cutscenes "DEMO0"
|
||||
/* 0x26 */ CAM_SET_CS_TWISTED_HALLWAY, // Never set to, but checked in twisting hallway (Forest Temple) "DEMO1"
|
||||
|
|
|
@ -212,7 +212,7 @@ typedef enum {
|
|||
} CutsceneTextType;
|
||||
|
||||
typedef enum {
|
||||
/* 0x03 */ CS_FADE_OUT_FANFARE = 3,
|
||||
/* 0x03 */ CS_FADE_OUT_FANFARE = 3,
|
||||
/* 0x04 */ CS_FADE_OUT_BGM_MAIN
|
||||
} CutsceneFadeOutSeqPlayer;
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@
|
|||
CMD_W(cmdType), CMD_W(entries)
|
||||
|
||||
/**
|
||||
* Defines a cue that an actor can listen for.
|
||||
* Defines a cue that an actor can listen for.
|
||||
* The actor can choose whether or not to use the position and rotation data supplied to it.
|
||||
* The cue `id` is a number that has an actor-specific meaning.
|
||||
*/
|
||||
|
@ -154,7 +154,7 @@
|
|||
CS_CMD_PLAYER_CUE, CMD_W(entries)
|
||||
|
||||
/**
|
||||
* A player cue is the same as `CS_ACTOR_CUE` but is specifically for player.
|
||||
* A player cue is the same as `CS_ACTOR_CUE` but is specifically for player.
|
||||
*/
|
||||
#define CS_PLAYER_CUE(id, startFrame, endFrame, rotX, rotY, rotZ, startX, startY, startZ, endX, endY, endZ, unused0, unused1, unused2) \
|
||||
CS_ACTOR_CUE(id, startFrame, endFrame, rotX, rotY, rotZ, startX, startY, startZ, endX, endY, endZ, unused0, unused1, unused2)
|
||||
|
@ -166,7 +166,7 @@
|
|||
CS_CMD_TEXT, CMD_W(entries)
|
||||
|
||||
/**
|
||||
* Starts a textbox at the specified time.
|
||||
* Starts a textbox at the specified time.
|
||||
* For `CS_TEXT_OCARINA_ACTION`, `textId` is used as an ocarina action.
|
||||
* For a choice textbox, `altTextId1` is the top text id to branch to and `altTextId2` is the bottom.
|
||||
*/
|
||||
|
@ -246,11 +246,11 @@
|
|||
CMD_HH(unused0, startFrame), CMD_HBB(endFrame, hour, min), CMD_W(0)
|
||||
|
||||
/**
|
||||
* Sends the player to a new destination.
|
||||
* Sends the player to a new destination.
|
||||
* `destination` maps to a custom block of code that must implement the scene transition on its own.
|
||||
* This custom code can also do other tasks like changing age, setting flags, or any other setup that is needed
|
||||
* before going to the next destination.
|
||||
*
|
||||
*
|
||||
* @see `CutsceneDestination`
|
||||
* @note `endFrame` is not used in the implementation of the command, so its value does not matter
|
||||
*/
|
||||
|
|
|
@ -51,7 +51,7 @@ typedef enum {
|
|||
|
||||
typedef enum {
|
||||
/* 0 */ LIGHTNING_OFF, // no lightning
|
||||
/* 1 */ LIGHTNING_ON, // request ligtning strikes at random intervals
|
||||
/* 1 */ LIGHTNING_ON, // request lightning strikes at random intervals
|
||||
/* 2 */ LIGHTNING_LAST // request one lightning strike before turning off
|
||||
} LightningState;
|
||||
|
||||
|
@ -148,8 +148,8 @@ typedef struct {
|
|||
|
||||
// `EnvLightSettings` is very similar to `CurrentEnvLightSettings` with one key difference.
|
||||
// The light settings data in the scene packs blend rate information with the fog near value.
|
||||
// The blendRate determines how fast the current light settings fade to the next one
|
||||
// (under LIGHT_MODE_SETTINGS, otherwise unused).
|
||||
// The blendRate determines how fast the current light settings fade to the next one
|
||||
// (under LIGHT_MODE_SETTINGS, otherwise unused).
|
||||
|
||||
// Get blend rate from `EnvLightSettings.blendRateAndFogNear` in 0-255 range
|
||||
#define ENV_LIGHT_SETTINGS_BLEND_RATE_U8(blendRateAndFogNear) (((blendRateAndFogNear) >> 10) * 4)
|
||||
|
@ -162,7 +162,7 @@ typedef struct {
|
|||
/* 0x09 */ s8 light2Dir[3];
|
||||
/* 0x0C */ u8 light2Color[3];
|
||||
/* 0x0F */ u8 fogColor[3];
|
||||
/* 0x12 */ s16 blendRateAndFogNear;
|
||||
/* 0x12 */ s16 blendRateAndFogNear;
|
||||
/* 0x14 */ s16 zFar;
|
||||
} EnvLightSettings; // size = 0x16
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define Z64ITEM_H
|
||||
|
||||
// Note that z_kaleido_scope_PAL.c assumes that the dimensions and texture format here also matches the dimensions and
|
||||
// texture format for MAP_NAME_TEX1_*
|
||||
// texture format for MAP_NAME_TEX1_*
|
||||
#define ITEM_NAME_TEX_WIDTH 128
|
||||
#define ITEM_NAME_TEX_HEIGHT 16
|
||||
#define ITEM_NAME_TEX_SIZE ((ITEM_NAME_TEX_WIDTH * ITEM_NAME_TEX_HEIGHT) / 2) // 128x16 IA4 texture
|
||||
|
|
|
@ -43,7 +43,7 @@ typedef struct {
|
|||
} Spawn;
|
||||
|
||||
// TODO: ZAPD Compatibility
|
||||
typedef Spawn EntranceEntry;
|
||||
typedef Spawn EntranceEntry;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 count; // number of points in the path
|
||||
|
|
|
@ -1172,7 +1172,7 @@ SampleCacheEntry* AudioHeap_AllocTemporarySampleCacheEntry(u32 size) {
|
|||
index = -1;
|
||||
for (i = 0; i < gAudioCtx.preloadSampleStackTop; i++) {
|
||||
preload = &gAudioCtx.preloadSampleStack[i];
|
||||
if (preload->isFree == false) {
|
||||
if (!preload->isFree) {
|
||||
startRamAddr = preload->ramAddr;
|
||||
endRamAddr = preload->ramAddr + preload->sample->size - 1;
|
||||
|
||||
|
@ -1408,7 +1408,7 @@ void AudioHeap_ApplySampleBankCacheInternal(s32 apply, s32 sampleBankId) {
|
|||
}
|
||||
|
||||
fakematch = &change.oldAddr;
|
||||
if ((apply != false) && (apply == true)) {
|
||||
if (apply && (apply == true)) {
|
||||
u32 temp = change.newAddr;
|
||||
|
||||
change.newAddr = *fakematch; // = change.oldAddr
|
||||
|
|
|
@ -192,8 +192,8 @@ void* AudioLoad_DmaSampleData(u32 devAddr, u32 size, s32 arg2, u8* dmaIndexRef,
|
|||
dma->ttl = 3;
|
||||
dma->devAddr = dmaDevAddr;
|
||||
dma->sizeUnused = transfer;
|
||||
AudioLoad_Dma(&gAudioCtx.currAudioFrameDmaIoMsgBuf[gAudioCtx.curAudioFrameDmaCount++], OS_MESG_PRI_NORMAL, OS_READ,
|
||||
dmaDevAddr, dma->ramAddr, transfer, &gAudioCtx.currAudioFrameDmaQueue, medium, "SUPERDMA");
|
||||
AudioLoad_Dma(&gAudioCtx.curAudioFrameDmaIoMsgBuf[gAudioCtx.curAudioFrameDmaCount++], OS_MESG_PRI_NORMAL, OS_READ,
|
||||
dmaDevAddr, dma->ramAddr, transfer, &gAudioCtx.curAudioFrameDmaQueue, medium, "SUPERDMA");
|
||||
*dmaIndexRef = dmaIndex;
|
||||
return (devAddr - dmaDevAddr) + dma->ramAddr;
|
||||
}
|
||||
|
@ -1166,8 +1166,8 @@ void AudioLoad_Init(void* heap, u32 heapSize) {
|
|||
gAudioCtx.rspTask[0].task.t.data_size = 0;
|
||||
gAudioCtx.rspTask[1].task.t.data_size = 0;
|
||||
osCreateMesgQueue(&gAudioCtx.syncDmaQueue, &gAudioCtx.syncDmaMesg, 1);
|
||||
osCreateMesgQueue(&gAudioCtx.currAudioFrameDmaQueue, gAudioCtx.currAudioFrameDmaMsgBuf,
|
||||
ARRAY_COUNT(gAudioCtx.currAudioFrameDmaMsgBuf));
|
||||
osCreateMesgQueue(&gAudioCtx.curAudioFrameDmaQueue, gAudioCtx.curAudioFrameDmaMsgBuf,
|
||||
ARRAY_COUNT(gAudioCtx.curAudioFrameDmaMsgBuf));
|
||||
osCreateMesgQueue(&gAudioCtx.externalLoadQueue, gAudioCtx.externalLoadMsgBuf,
|
||||
ARRAY_COUNT(gAudioCtx.externalLoadMsgBuf));
|
||||
osCreateMesgQueue(&gAudioCtx.preloadSampleQueue, gAudioCtx.preloadSampleMsgBuf,
|
||||
|
@ -1824,7 +1824,7 @@ s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) {
|
|||
preloadIndex >>= 24;
|
||||
preload = &gAudioCtx.preloadSampleStack[preloadIndex];
|
||||
|
||||
if (preload->isFree == false) {
|
||||
if (!preload->isFree) {
|
||||
sample = preload->sample;
|
||||
key = (u32)sample->sampleAddr + sample->size + sample->medium;
|
||||
if (key == preload->endAndMediumKey) {
|
||||
|
|
|
@ -1326,7 +1326,7 @@ Acmd* AudioSynth_ApplyHaasEffect(Acmd* cmd, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
aDMEMMove(cmd++, DMEM_TEMP, DMEM_HAAS_TEMP + haasEffectDelaySize, size);
|
||||
}
|
||||
|
||||
if (haasEffectDelaySize) { // != 0
|
||||
if ((u32)haasEffectDelaySize != 0) {
|
||||
// Save excessive samples for next iteration
|
||||
aSaveBuffer(cmd++, DMEM_HAAS_TEMP + size, synthState->synthesisBuffers->haasEffectDelayState,
|
||||
ALIGN16(haasEffectDelaySize));
|
||||
|
|
|
@ -27,7 +27,7 @@ void func_800AD950(struct_80166500* this) {
|
|||
void func_800AD958(struct_80166500* this, Gfx** gfxp) {
|
||||
Gfx* gfx = *gfxp;
|
||||
u16* tex = D_0E000000;
|
||||
s32 fmt = this->useRgba == false ? G_IM_FMT_IA : G_IM_FMT_RGBA;
|
||||
s32 fmt = !this->useRgba ? G_IM_FMT_IA : G_IM_FMT_RGBA;
|
||||
s32 y;
|
||||
s32 height = 6;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ AudioTask* func_800E5000(void) {
|
|||
s32 pad;
|
||||
s32 j;
|
||||
s32 sp5C;
|
||||
s16* currAiBuffer;
|
||||
s16* curAiBuffer;
|
||||
OSTask_t* task;
|
||||
s32 index;
|
||||
u32 sp4C;
|
||||
|
@ -88,21 +88,21 @@ AudioTask* func_800E5000(void) {
|
|||
|
||||
sp5C = gAudioCtx.curAudioFrameDmaCount;
|
||||
for (i = 0; i < gAudioCtx.curAudioFrameDmaCount; i++) {
|
||||
if (osRecvMesg(&gAudioCtx.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK) == 0) {
|
||||
if (osRecvMesg(&gAudioCtx.curAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK) == 0) {
|
||||
sp5C--;
|
||||
}
|
||||
}
|
||||
|
||||
if (sp5C != 0) {
|
||||
for (i = 0; i < sp5C; i++) {
|
||||
osRecvMesg(&gAudioCtx.currAudioFrameDmaQueue, NULL, OS_MESG_BLOCK);
|
||||
osRecvMesg(&gAudioCtx.curAudioFrameDmaQueue, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
sp48 = MQ_GET_COUNT(&gAudioCtx.currAudioFrameDmaQueue);
|
||||
sp48 = MQ_GET_COUNT(&gAudioCtx.curAudioFrameDmaQueue);
|
||||
if (sp48 != 0) {
|
||||
for (i = 0; i < sp48; i++) {
|
||||
osRecvMesg(&gAudioCtx.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK);
|
||||
osRecvMesg(&gAudioCtx.curAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ AudioTask* func_800E5000(void) {
|
|||
gAudioCtx.curAbiCmdBuf = gAudioCtx.abiCmdBufs[gAudioCtx.rspTaskIndex];
|
||||
|
||||
index = gAudioCtx.curAiBufIndex;
|
||||
currAiBuffer = gAudioCtx.aiBuffers[index];
|
||||
curAiBuffer = gAudioCtx.aiBuffers[index];
|
||||
|
||||
gAudioCtx.aiBufLengths[index] =
|
||||
(s16)((((gAudioCtx.audioBufferParameters.samplesPerFrameTarget - samplesRemainingInAi) +
|
||||
|
@ -162,7 +162,7 @@ AudioTask* func_800E5000(void) {
|
|||
}
|
||||
|
||||
gAudioCtx.curAbiCmdBuf =
|
||||
AudioSynth_Update(gAudioCtx.curAbiCmdBuf, &abiCmdCnt, currAiBuffer, gAudioCtx.aiBufLengths[index]);
|
||||
AudioSynth_Update(gAudioCtx.curAbiCmdBuf, &abiCmdCnt, curAiBuffer, gAudioCtx.aiBufLengths[index]);
|
||||
|
||||
// Update audioRandom to the next random number
|
||||
gAudioCtx.audioRandom = (gAudioCtx.audioRandom + gAudioCtx.totalTaskCount) * osGetCount();
|
||||
|
|
|
@ -140,7 +140,7 @@ void Audio_RemoveMatchingSfxRequests(u8 aspect, SfxBankEntry* cmp) {
|
|||
break;
|
||||
}
|
||||
if (remove) {
|
||||
req->sfxId = 0;
|
||||
req->sfxId = NA_SE_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -158,9 +158,11 @@ void Audio_ProcessSfxRequest(void) {
|
|||
|
||||
req = &sSfxRequests[gSfxRequestReadIndex];
|
||||
evictIndex = 0x80;
|
||||
if (req->sfxId == 0) {
|
||||
|
||||
if (req->sfxId == NA_SE_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
bankId = SFX_BANK(req->sfxId);
|
||||
if ((1 << bankId) & D_801333F0) {
|
||||
AudioDebug_ScrPrt("SE", req->sfxId);
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#include "global.h"
|
||||
|
||||
s32 Overlay_Load(uintptr_t vRomStart, uintptr_t vRomEnd, void* vRamStart, void* vRamEnd, void* allocatedVRamAddr) {
|
||||
s32 Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd, void* allocatedRamAddr) {
|
||||
s32 pad[3];
|
||||
uintptr_t end;
|
||||
OverlayRelocationSection* ovl;
|
||||
u32 ovlOffset;
|
||||
OverlayRelocationSection* ovlRelocs;
|
||||
u32 relocSectionOffset;
|
||||
size_t size;
|
||||
|
||||
size = vRomEnd - vRomStart;
|
||||
end = (uintptr_t)allocatedVRamAddr + size;
|
||||
size = vromEnd - vromStart;
|
||||
end = (uintptr_t)allocatedRamAddr + size;
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
// "Start loading dynamic link function"
|
||||
|
@ -17,44 +17,52 @@ s32 Overlay_Load(uintptr_t vRomStart, uintptr_t vRomEnd, void* vRamStart, void*
|
|||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
// "DMA transfer of TEXT, DATA, RODATA + rel (%08x-%08x)"
|
||||
osSyncPrintf("TEXT,DATA,RODATA+relをDMA転送します(%08x-%08x)\n", allocatedVRamAddr, end);
|
||||
osSyncPrintf("TEXT,DATA,RODATA+relをDMA転送します(%08x-%08x)\n", allocatedRamAddr, end);
|
||||
}
|
||||
|
||||
DmaMgr_RequestSync(allocatedVRamAddr, vRomStart, size);
|
||||
// DMA the overlay, wait until transfer completes
|
||||
DmaMgr_RequestSync(allocatedRamAddr, vromStart, size);
|
||||
|
||||
ovlOffset = ((s32*)end)[-1];
|
||||
// The overlay file is expected to contain a 32-bit offset from the end of the file to the start of the
|
||||
// relocation section.
|
||||
relocSectionOffset = ((s32*)end)[-1];
|
||||
ovlRelocs = (OverlayRelocationSection*)(end - relocSectionOffset);
|
||||
|
||||
ovl = (OverlayRelocationSection*)(end - ovlOffset);
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
osSyncPrintf("TEXT(%08x), DATA(%08x), RODATA(%08x), BSS(%08x)\n", ovl->textSize, ovl->dataSize, ovl->rodataSize,
|
||||
ovl->bssSize);
|
||||
osSyncPrintf("TEXT(%08x), DATA(%08x), RODATA(%08x), BSS(%08x)\n", ovlRelocs->textSize, ovlRelocs->dataSize,
|
||||
ovlRelocs->rodataSize, ovlRelocs->bssSize);
|
||||
}
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
osSyncPrintf("リロケーションします\n"); // "Relocate"
|
||||
}
|
||||
|
||||
Overlay_Relocate(allocatedVRamAddr, ovl, vRamStart);
|
||||
// Relocate pointers in overlay code and data
|
||||
Overlay_Relocate(allocatedRamAddr, ovlRelocs, vramStart);
|
||||
|
||||
if (ovl->bssSize != 0) {
|
||||
// Clear bss if present, bss is located immediately following the relocations
|
||||
if (ovlRelocs->bssSize != 0) {
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
// "Clear BSS area (% 08x-% 08x)"
|
||||
osSyncPrintf("BSS領域をクリアします(%08x-%08x)\n", end, end + ovl->bssSize);
|
||||
osSyncPrintf("BSS領域をクリアします(%08x-%08x)\n", end, end + ovlRelocs->bssSize);
|
||||
}
|
||||
bzero((void*)end, ovl->bssSize);
|
||||
bzero((void*)end, ovlRelocs->bssSize);
|
||||
}
|
||||
|
||||
size = (uintptr_t)&ovl->relocations[ovl->nRelocations] - (uintptr_t)ovl;
|
||||
size = (uintptr_t)&ovlRelocs->relocations[ovlRelocs->nRelocations] - (uintptr_t)ovlRelocs;
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
// "Clear REL area (%08x-%08x)"
|
||||
osSyncPrintf("REL領域をクリアします(%08x-%08x)\n", ovl, (uintptr_t)ovl + size);
|
||||
osSyncPrintf("REL領域をクリアします(%08x-%08x)\n", ovlRelocs, (uintptr_t)ovlRelocs + size);
|
||||
}
|
||||
|
||||
bzero(ovl, size);
|
||||
// Clear relocations, this space remains allocated and goes unused
|
||||
bzero(ovlRelocs, size);
|
||||
|
||||
size = (uintptr_t)vRamEnd - (uintptr_t)vRamStart;
|
||||
osWritebackDCache(allocatedVRamAddr, size);
|
||||
osInvalICache(allocatedVRamAddr, size);
|
||||
// Manually flush caches
|
||||
size = (uintptr_t)vramEnd - (uintptr_t)vramStart;
|
||||
osWritebackDCache(allocatedRamAddr, size);
|
||||
osInvalICache(allocatedRamAddr, size);
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
// "Finish loading dynamic link function"
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
#include "global.h"
|
||||
|
||||
void* Overlay_AllocateAndLoad(uintptr_t vRomStart, uintptr_t vRomEnd, void* vRamStart, void* vRamEnd) {
|
||||
void* allocatedVRamAddr = SystemArena_MallocRDebug((s32)vRamEnd - (s32)vRamStart, "../loadfragment2.c", 31);
|
||||
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd) {
|
||||
void* allocatedRamAddr = SystemArena_MallocRDebug((s32)vramEnd - (s32)vramStart, "../loadfragment2.c", 31);
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
osSyncPrintf("OVL:SPEC(%08x-%08x) REAL(%08x-%08x) OFFSET(%08x)\n", vRamStart, vRamEnd, allocatedVRamAddr,
|
||||
((uintptr_t)vRamEnd - (uintptr_t)vRamStart) + (uintptr_t)allocatedVRamAddr,
|
||||
(uintptr_t)vRamStart - (uintptr_t)allocatedVRamAddr);
|
||||
osSyncPrintf("OVL:SPEC(%08x-%08x) REAL(%08x-%08x) OFFSET(%08x)\n", vramStart, vramEnd, allocatedRamAddr,
|
||||
((uintptr_t)vramEnd - (uintptr_t)vramStart) + (uintptr_t)allocatedRamAddr,
|
||||
(uintptr_t)vramStart - (uintptr_t)allocatedRamAddr);
|
||||
}
|
||||
|
||||
if (allocatedVRamAddr != NULL) {
|
||||
Overlay_Load(vRomStart, vRomEnd, vRamStart, vRamEnd, allocatedVRamAddr);
|
||||
if (allocatedRamAddr != NULL) {
|
||||
Overlay_Load(vromStart, vromEnd, vramStart, vramEnd, allocatedRamAddr);
|
||||
}
|
||||
|
||||
return allocatedVRamAddr;
|
||||
return allocatedRamAddr;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,44 @@
|
|||
/**
|
||||
* @file relocation.c
|
||||
*
|
||||
* This file contains the routine responsible for runtime relocation of dynamically loadable code segments (overlays),
|
||||
* see the description of Overlay_Relocate for details.
|
||||
*
|
||||
* @see Overlay_Relocate
|
||||
*/
|
||||
#include "global.h"
|
||||
|
||||
void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* overlayInfo, void* vRamStart) {
|
||||
u32 sections[4];
|
||||
// Extract MIPS register rs from an instruction word
|
||||
#define MIPS_REG_RS(insn) (((insn) >> 0x15) & 0x1F)
|
||||
|
||||
// Extract MIPS register rt from an instruction word
|
||||
#define MIPS_REG_RT(insn) (((insn) >> 0x10) & 0x1F)
|
||||
|
||||
// Extract MIPS jump target from an instruction word
|
||||
#define MIPS_JUMP_TARGET(insn) (((insn)&0x03FFFFFF) << 2)
|
||||
|
||||
/**
|
||||
* Performs runtime relocation of overlay files, loadable code segments.
|
||||
*
|
||||
* Overlays are expected to be loadable anywhere in direct-mapped cached (KSEG0) memory, with some appropriate
|
||||
* alignment requirements; memory addresses in such code must be updated once loaded in order to execute properly.
|
||||
* When compiled, overlays are given 'fake' KSEG0 RAM addresses larger than the total possible available main memory
|
||||
* (>= 0x80800000), such addresses are referred to as Virtual RAM (VRAM) to distinguish them. When loading the overlay
|
||||
* the relocation table produced at compile time is consulted to determine where and how to update these VRAM addresses
|
||||
* to correct RAM addresses based on the location the overlay was loaded at, enabling the code to execute at this
|
||||
* address as if it were compiled to run at this address.
|
||||
*
|
||||
* Each relocation is represented by a packed 32-bit value, formatted in the following way:
|
||||
* - [31:30] 2-bit section id, taking values from the `RelocSectionId` enum.
|
||||
* - [29:24] 6-bit relocation type describing which relocation operation should be performed. Same as ELF32 MIPS.
|
||||
* - [23: 0] 24-bit section-relative offset indicating where in the section to apply this relocation.
|
||||
*
|
||||
* @param allocatedRamAddress Memory address the binary was loaded at.
|
||||
* @param ovlRelocs Overlay relocation section containing overlay section layout and runtime relocations.
|
||||
* @param vramStart Virtual RAM address that the overlay was compiled at.
|
||||
*/
|
||||
void Overlay_Relocate(void* allocatedRamAddress, OverlayRelocationSection* ovlRelocs, void* vramStart) {
|
||||
uintptr_t sections[RELOC_SECTION_MAX];
|
||||
u32 relocatedValue;
|
||||
u32 dbg;
|
||||
u32 relocOffset;
|
||||
|
@ -9,12 +46,18 @@ void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* over
|
|||
uintptr_t unrelocatedAddress;
|
||||
u32 i;
|
||||
u32* relocDataP;
|
||||
//! MIPS ELF relocation does not generally require tracking register values, so at first glance it appears this
|
||||
//! register tracking was an unnecessary complication. However there is a bug in the IDO compiler that can cause
|
||||
//! relocations to be emitted in the wrong order under rare circumstances when the compiler attempts to reuse a
|
||||
//! previous HI16 relocation for a different LO16 relocation as an optimization. This register tracking is likely
|
||||
//! a workaround to prevent improper matching of unrelated HI16 and LO16 relocations that would otherwise arise
|
||||
//! due to the incorrect ordering.
|
||||
u32* luiRefs[32];
|
||||
u32 luiVals[32];
|
||||
uintptr_t relocatedAddress;
|
||||
u32 reloc;
|
||||
u32* luiInstRef;
|
||||
uintptr_t allocu32 = (uintptr_t)allocatedVRamAddress;
|
||||
uintptr_t allocu32 = (uintptr_t)allocatedRamAddress;
|
||||
u32* regValP;
|
||||
u32 isLoNeg;
|
||||
s32 pad;
|
||||
|
@ -25,18 +68,21 @@ void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* over
|
|||
relocatedAddress = 0;
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
osSyncPrintf("DoRelocation(%08x, %08x, %08x)\n", allocatedVRamAddress, overlayInfo, vRamStart);
|
||||
osSyncPrintf("text=%08x, data=%08x, rodata=%08x, bss=%08x\n", overlayInfo->textSize, overlayInfo->dataSize,
|
||||
overlayInfo->rodataSize, overlayInfo->bssSize);
|
||||
osSyncPrintf("DoRelocation(%08x, %08x, %08x)\n", allocatedRamAddress, ovlRelocs, vramStart);
|
||||
osSyncPrintf("text=%08x, data=%08x, rodata=%08x, bss=%08x\n", ovlRelocs->textSize, ovlRelocs->dataSize,
|
||||
ovlRelocs->rodataSize, ovlRelocs->bssSize);
|
||||
}
|
||||
|
||||
sections[0] = 0;
|
||||
sections[1] = allocu32;
|
||||
sections[2] = allocu32 + overlayInfo->textSize;
|
||||
sections[3] = sections[2] + overlayInfo->dataSize;
|
||||
sections[RELOC_SECTION_NULL] = 0;
|
||||
sections[RELOC_SECTION_TEXT] = allocu32;
|
||||
sections[RELOC_SECTION_DATA] = allocu32 + ovlRelocs->textSize;
|
||||
sections[RELOC_SECTION_RODATA] = sections[RELOC_SECTION_DATA] + ovlRelocs->dataSize;
|
||||
|
||||
for (i = 0; i < overlayInfo->nRelocations; i++) {
|
||||
reloc = overlayInfo->relocations[i];
|
||||
for (i = 0; i < ovlRelocs->nRelocations; i++) {
|
||||
reloc = ovlRelocs->relocations[i];
|
||||
// This will always resolve to a 32-bit aligned address as each section containing code or pointers must be
|
||||
// aligned to at least 4 bytes and the MIPS ABI defines the offset of both 16-bit and 32-bit relocations to
|
||||
// be the start of the 32-bit word containing the target.
|
||||
relocDataP = (u32*)(sections[RELOC_SECTION(reloc)] + RELOC_OFFSET(reloc));
|
||||
relocData = *relocDataP;
|
||||
|
||||
|
@ -47,7 +93,7 @@ void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* over
|
|||
|
||||
// Check address is valid for relocation
|
||||
if ((*relocDataP & 0x0F000000) == 0) {
|
||||
relocOffset = *relocDataP - (uintptr_t)vRamStart;
|
||||
relocOffset = *relocDataP - (uintptr_t)vramStart;
|
||||
relocatedValue = relocOffset + allocu32;
|
||||
relocatedAddress = relocatedValue;
|
||||
unrelocatedAddress = relocData;
|
||||
|
@ -60,10 +106,10 @@ void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* over
|
|||
// Extract the address from the target field of the J-type MIPS instruction.
|
||||
// Relocate the address and update the instruction.
|
||||
|
||||
unrelocatedAddress = PHYS_TO_K0((*relocDataP & 0x03FFFFFF) << 2);
|
||||
relocOffset = unrelocatedAddress - (uintptr_t)vRamStart;
|
||||
unrelocatedAddress = PHYS_TO_K0(MIPS_JUMP_TARGET(*relocDataP));
|
||||
relocOffset = unrelocatedAddress - (uintptr_t)vramStart;
|
||||
relocatedValue = (*relocDataP & 0xFC000000) | (((allocu32 + relocOffset) & 0x0FFFFFFF) >> 2);
|
||||
relocatedAddress = PHYS_TO_K0((relocatedValue & 0x03FFFFFF) << 2);
|
||||
relocatedAddress = PHYS_TO_K0(MIPS_JUMP_TARGET(relocatedValue));
|
||||
*relocDataP = relocatedValue;
|
||||
break;
|
||||
|
||||
|
@ -72,8 +118,8 @@ void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* over
|
|||
// Store the reference to the LUI instruction (hi) using the `rt` register of the instruction.
|
||||
// This will be updated later in the `R_MIPS_LO16` section.
|
||||
|
||||
luiRefs[(*relocDataP >> 0x10) & 0x1F] = relocDataP;
|
||||
luiVals[(*relocDataP >> 0x10) & 0x1F] = *relocDataP;
|
||||
luiRefs[MIPS_REG_RT(*relocDataP)] = relocDataP;
|
||||
luiVals[MIPS_REG_RT(*relocDataP)] = *relocDataP;
|
||||
break;
|
||||
|
||||
case R_MIPS_LO16 << RELOC_TYPE_SHIFT:
|
||||
|
@ -83,13 +129,13 @@ void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* over
|
|||
// If the lo part is negative, add 1 to the LUI value.
|
||||
// Note: The lo instruction is assumed to have a signed immediate.
|
||||
|
||||
luiInstRef = luiRefs[(*relocDataP >> 0x15) & 0x1F];
|
||||
regValP = &luiVals[(*relocDataP >> 0x15) & 0x1F];
|
||||
luiInstRef = luiRefs[MIPS_REG_RS(*relocDataP)];
|
||||
regValP = &luiVals[MIPS_REG_RS(*relocDataP)];
|
||||
|
||||
// Check address is valid for relocation
|
||||
if ((((*regValP << 0x10) + (s16)*relocDataP) & 0x0F000000) == 0) {
|
||||
relocOffset = ((*regValP << 0x10) + (s16)*relocDataP) - (uintptr_t)vRamStart;
|
||||
isLoNeg = (((relocOffset + allocu32) & 0x8000) ? 1 : 0);
|
||||
relocOffset = ((*regValP << 0x10) + (s16)*relocDataP) - (uintptr_t)vramStart;
|
||||
isLoNeg = ((relocOffset + allocu32) & 0x8000) ? 1 : 0; // adjust for signed immediate
|
||||
unrelocatedAddress = (*luiInstRef << 0x10) + (s16)relocData;
|
||||
*luiInstRef =
|
||||
(*luiInstRef & 0xFFFF0000) | ((((relocOffset + allocu32) >> 0x10) & 0xFFFF) + isLoNeg);
|
||||
|
@ -101,18 +147,18 @@ void Overlay_Relocate(void* allocatedVRamAddress, OverlayRelocationSection* over
|
|||
break;
|
||||
}
|
||||
|
||||
dbg = 0x10;
|
||||
dbg = 16;
|
||||
switch (RELOC_TYPE_MASK(reloc)) {
|
||||
case R_MIPS_32 << RELOC_TYPE_SHIFT:
|
||||
dbg = 0x16;
|
||||
dbg += 6;
|
||||
FALLTHROUGH;
|
||||
case R_MIPS_26 << RELOC_TYPE_SHIFT:
|
||||
dbg += 0xA;
|
||||
dbg += 10;
|
||||
FALLTHROUGH;
|
||||
case R_MIPS_LO16 << RELOC_TYPE_SHIFT:
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
osSyncPrintf("%02d %08x %08x %08x ", dbg, relocDataP, relocatedValue, relocatedAddress);
|
||||
osSyncPrintf(" %08x %08x %08x %08x\n", (uintptr_t)relocDataP + (uintptr_t)vRamStart - allocu32,
|
||||
osSyncPrintf(" %08x %08x %08x %08x\n", (uintptr_t)relocDataP + (uintptr_t)vramStart - allocu32,
|
||||
relocData, unrelocatedAddress, relocOffset);
|
||||
}
|
||||
// Adding a break prevents matching
|
||||
|
|
|
@ -1610,7 +1610,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader
|
|||
customNodeListMax = sceneSubdivisionList[i].nodeListMax;
|
||||
}
|
||||
}
|
||||
if (useCustomSubdivisions == false) {
|
||||
if (!useCustomSubdivisions) {
|
||||
colCtx->subdivAmount.x = 16;
|
||||
colCtx->subdivAmount.y = 4;
|
||||
colCtx->subdivAmount.z = 16;
|
||||
|
@ -2296,7 +2296,7 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2,
|
|||
sectorMin.z += colCtx->subdivLength.z;
|
||||
sectorMax.z += colCtx->subdivLength.z;
|
||||
}
|
||||
} else if (BgCheck_PosInStaticBoundingBox(colCtx, posA) == false) {
|
||||
} else if (!BgCheck_PosInStaticBoundingBox(colCtx, posA)) {
|
||||
return false;
|
||||
} else {
|
||||
result =
|
||||
|
@ -2722,7 +2722,7 @@ s32 DynaPoly_SetBgActor(PlayState* play, DynaCollisionContext* dyna, Actor* acto
|
|||
}
|
||||
}
|
||||
|
||||
if (foundSlot == false) {
|
||||
if (!foundSlot) {
|
||||
osSyncPrintf(VT_FGCOL(RED));
|
||||
osSyncPrintf("DynaPolyInfo_setActor():ダイナミックポリゴン 空きインデックスはありません\n");
|
||||
osSyncPrintf(VT_RST);
|
||||
|
@ -2788,7 +2788,7 @@ void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgI
|
|||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
osSyncPrintf("DynaPolyInfo_delReserve():index %d\n", bgId);
|
||||
osSyncPrintf(VT_RST);
|
||||
if (DynaPoly_IsBgIdBgActor(bgId) == false) {
|
||||
if (!DynaPoly_IsBgIdBgActor(bgId)) {
|
||||
|
||||
if (bgId == -1) {
|
||||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
|
@ -3178,8 +3178,8 @@ f32 BgCheck_RaycastDownDyna(DynaRaycastDown* dynaRaycastDown) {
|
|||
|
||||
if (dynaRaycastDown->actor == dynaRaycastDown->colCtx->dyna.bgActors[i].actor ||
|
||||
dynaRaycastDown->pos->y < dynaRaycastDown->colCtx->dyna.bgActors[i].minY ||
|
||||
Math3D_XZInSphere(&dynaRaycastDown->colCtx->dyna.bgActors[i].boundingSphere, dynaRaycastDown->pos->x,
|
||||
dynaRaycastDown->pos->z) == false) {
|
||||
!Math3D_XZInSphere(&dynaRaycastDown->colCtx->dyna.bgActors[i].boundingSphere, dynaRaycastDown->pos->x,
|
||||
dynaRaycastDown->pos->z)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -3537,7 +3537,7 @@ s32 CollisionCheck_CylSideVsLineSeg(f32 radius, f32 height, f32 offset, Vec3f* a
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (intersect2 == false) {
|
||||
if (!intersect2) {
|
||||
if (frac1 < 0.0f || 1.0f < frac1) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -3564,7 +3564,7 @@ s32 CollisionCheck_CylSideVsLineSeg(f32 radius, f32 height, f32 offset, Vec3f* a
|
|||
((frac2 * itemStep.y + actorToItem.y < 0.0f) || (height < frac2 * itemStep.y + actorToItem.y))) {
|
||||
intersect2 = false;
|
||||
}
|
||||
if (intersect1 == false && intersect2 == false) {
|
||||
if (!intersect1 && !intersect2) {
|
||||
return 0;
|
||||
} else if ((intersect1 == true) && (intersect2 == true)) {
|
||||
out1->x = frac1 * itemStep.x + actorToItem.x + actorPos->x;
|
||||
|
|
|
@ -109,7 +109,7 @@ void Effect_Add(PlayState* play, s32* pIndex, s32 type, u8 arg3, u8 arg4, void*
|
|||
switch (type) {
|
||||
case EFFECT_SPARK:
|
||||
for (i = 0; i < SPARK_COUNT; i++) {
|
||||
if (sEffectContext.sparks[i].status.active == false) {
|
||||
if (!sEffectContext.sparks[i].status.active) {
|
||||
slotFound = true;
|
||||
*pIndex = i;
|
||||
effect = &sEffectContext.sparks[i].effect;
|
||||
|
@ -121,7 +121,7 @@ void Effect_Add(PlayState* play, s32* pIndex, s32 type, u8 arg3, u8 arg4, void*
|
|||
case EFFECT_BLURE1:
|
||||
case EFFECT_BLURE2:
|
||||
for (i = 0; i < BLURE_COUNT; i++) {
|
||||
if (sEffectContext.blures[i].status.active == false) {
|
||||
if (!sEffectContext.blures[i].status.active) {
|
||||
slotFound = true;
|
||||
*pIndex = i + SPARK_COUNT;
|
||||
effect = &sEffectContext.blures[i].effect;
|
||||
|
@ -132,7 +132,7 @@ void Effect_Add(PlayState* play, s32* pIndex, s32 type, u8 arg3, u8 arg4, void*
|
|||
break;
|
||||
case EFFECT_SHIELD_PARTICLE:
|
||||
for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) {
|
||||
if (sEffectContext.shieldParticles[i].status.active == false) {
|
||||
if (!sEffectContext.shieldParticles[i].status.active) {
|
||||
slotFound = true;
|
||||
*pIndex = i + SPARK_COUNT + BLURE_COUNT;
|
||||
effect = &sEffectContext.shieldParticles[i].effect;
|
||||
|
|
|
@ -183,7 +183,7 @@ void Message_CloseTextbox(PlayState* play) {
|
|||
msgCtx->stateTimer = 2;
|
||||
msgCtx->msgMode = MSGMODE_TEXT_CLOSING;
|
||||
msgCtx->textboxEndType = TEXTBOX_ENDTYPE_DEFAULT;
|
||||
Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
|
||||
Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultReverb);
|
||||
}
|
||||
}
|
||||
|
@ -743,10 +743,9 @@ u16 Message_DrawItemIcon(PlayState* play, u16 itemId, Gfx** p, u16 i) {
|
|||
MessageContext* msgCtx = &play->msgCtx;
|
||||
|
||||
// clang-format off
|
||||
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4,
|
||||
&gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultReverb);
|
||||
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { \
|
||||
Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultReverb);
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
|
@ -860,7 +859,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
|||
|
||||
play->msgCtx.textPosX = R_TEXT_INIT_XPOS;
|
||||
|
||||
if (sTextIsCredits == false) {
|
||||
if (!sTextIsCredits) {
|
||||
msgCtx->textPosY = R_TEXT_INIT_YPOS;
|
||||
} else {
|
||||
msgCtx->textPosY = YREG(1);
|
||||
|
@ -898,7 +897,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
|||
case MESSAGE_BOX_BREAK:
|
||||
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
|
||||
if (!sTextboxSkipped) {
|
||||
Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
msgCtx->msgMode = MSGMODE_TEXT_AWAIT_NEXT;
|
||||
Font_LoadMessageBoxIcon(font, TEXTBOX_ICON_TRIANGLE);
|
||||
|
@ -916,7 +915,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
|||
case MESSAGE_TEXTID:
|
||||
msgCtx->textboxEndType = TEXTBOX_ENDTYPE_HAS_NEXT;
|
||||
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
|
||||
Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
msgCtx->msgMode = MSGMODE_TEXT_DONE;
|
||||
Font_LoadMessageBoxIcon(font, TEXTBOX_ICON_TRIANGLE);
|
||||
|
@ -948,6 +947,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
|||
|
||||
if (character) {}
|
||||
}
|
||||
FALLTHROUGH;
|
||||
case MESSAGE_QUICKTEXT_DISABLE:
|
||||
break;
|
||||
case MESSAGE_AWAIT_BUTTON_PRESS:
|
||||
|
@ -996,10 +996,9 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
|||
break;
|
||||
case MESSAGE_BACKGROUND:
|
||||
// clang-format off
|
||||
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4,
|
||||
&gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultReverb);
|
||||
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { \
|
||||
Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
}
|
||||
// clang-format on
|
||||
gDPPipeSync(gfx++);
|
||||
|
@ -1113,7 +1112,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
|||
return;
|
||||
case MESSAGE_PERSISTENT:
|
||||
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) {
|
||||
Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
msgCtx->msgMode = MSGMODE_TEXT_DONE;
|
||||
msgCtx->textboxEndType = TEXTBOX_ENDTYPE_PERSISTENT;
|
||||
|
@ -1133,7 +1132,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
|||
default:
|
||||
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING && i + 1 == msgCtx->textDrawPos &&
|
||||
msgCtx->textDelayTimer == msgCtx->textDelay) {
|
||||
Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
}
|
||||
Message_DrawTextChar(play, &font->charTexBuf[charTexIdx], &gfx);
|
||||
|
@ -1755,7 +1754,7 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) {
|
|||
s32 textId;
|
||||
s16 j;
|
||||
s16 i;
|
||||
s16 noStop;
|
||||
s16 noStopDoAction;
|
||||
s32 k;
|
||||
|
||||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
|
@ -1781,7 +1780,7 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) {
|
|||
|
||||
// "Ocarina Number"
|
||||
osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ オカリナ番号=%d(%d) ☆☆☆☆☆\n" VT_RST, ocarinaActionId, 2);
|
||||
noStop = false;
|
||||
noStopDoAction = false;
|
||||
if (ocarinaActionId >= 0x893) {
|
||||
Message_OpenText(play, ocarinaActionId); // You played the [song name]
|
||||
textId = ocarinaActionId + 0x86E;
|
||||
|
@ -1805,7 +1804,7 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) {
|
|||
}
|
||||
} else {
|
||||
msgCtx->ocarinaAction = ocarinaActionId;
|
||||
noStop = true;
|
||||
noStopDoAction = true;
|
||||
if (ocarinaActionId >= OCARINA_ACTION_PLAYBACK_MINUET) {
|
||||
osSyncPrintf("222222222\n");
|
||||
Message_OpenText(play, 0x86D); // Play using [A] and [C].
|
||||
|
@ -1835,11 +1834,11 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) {
|
|||
msgCtx->msgMode = MSGMODE_TEXT_CONTINUING;
|
||||
}
|
||||
msgCtx->textboxColorAlphaCurrent = msgCtx->textboxColorAlphaTarget;
|
||||
if (noStop == false) {
|
||||
if (!noStopDoAction) {
|
||||
Interface_LoadActionLabelB(play, DO_ACTION_STOP);
|
||||
noStop = gSaveContext.hudVisibilityMode;
|
||||
noStopDoAction = gSaveContext.hudVisibilityMode;
|
||||
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_B_ALT);
|
||||
gSaveContext.hudVisibilityMode = noStop;
|
||||
gSaveContext.hudVisibilityMode = noStopDoAction;
|
||||
}
|
||||
// "Music Performance Start"
|
||||
osSyncPrintf("演奏開始\n");
|
||||
|
@ -2091,7 +2090,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
msgCtx->stateTimer = 20;
|
||||
msgCtx->msgMode = MSGMODE_SONG_DEMONSTRATION_SELECT_INSTRUMENT;
|
||||
} else {
|
||||
AudioOcarina_Start((1 << (msgCtx->ocarinaAction + 0x11)) + 0x8000);
|
||||
AudioOcarina_Start((1 << (msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET)) + 0x8000);
|
||||
// "Performance Check"
|
||||
osSyncPrintf("演奏チェック=%d\n", msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET);
|
||||
msgCtx->msgMode = MSGMODE_SONG_PLAYBACK;
|
||||
|
@ -2470,9 +2469,9 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
case MSGMODE_SONG_PLAYED_ACT:
|
||||
msgCtx->stateTimer--;
|
||||
if (msgCtx->stateTimer == 0) {
|
||||
if (msgCtx->lastPlayedSong < OCARINA_SONG_SARIAS &&
|
||||
(msgCtx->ocarinaAction < OCARINA_ACTION_PLAYBACK_MINUET ||
|
||||
msgCtx->ocarinaAction >= OCARINA_ACTION_PLAYBACK_SARIA)) {
|
||||
if ((msgCtx->lastPlayedSong <= OCARINA_SONG_PRELUDE) &&
|
||||
!(msgCtx->ocarinaAction >= OCARINA_ACTION_PLAYBACK_MINUET &&
|
||||
msgCtx->ocarinaAction <= OCARINA_ACTION_PLAYBACK_PRELUDE)) {
|
||||
if (msgCtx->disableWarpSongs || interfaceCtx->restrictions.warpSongs == 3) {
|
||||
Message_StartTextbox(play, 0x88C, NULL); // "You can't warp here!"
|
||||
play->msgCtx.ocarinaMode = OCARINA_MODE_04;
|
||||
|
@ -2500,7 +2499,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
osSyncPrintf(VT_FGCOL(YELLOW));
|
||||
osSyncPrintf("Ocarina_PC_Wind=%d(%d) ☆☆☆ ", OCARINA_ACTION_CHECK_MINUET,
|
||||
msgCtx->ocarinaAction - OCARINA_ACTION_CHECK_MINUET);
|
||||
if (msgCtx->lastPlayedSong + OCARINA_ACTION_CHECK_MINUET == msgCtx->ocarinaAction) {
|
||||
if (msgCtx->lastPlayedSong == (msgCtx->ocarinaAction - OCARINA_ACTION_CHECK_MINUET)) {
|
||||
play->msgCtx.ocarinaMode = OCARINA_MODE_03;
|
||||
} else {
|
||||
play->msgCtx.ocarinaMode = msgCtx->lastPlayedSong - 1;
|
||||
|
@ -2509,7 +2508,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
osSyncPrintf("Ocarina_C_Wind=%d(%d) ☆☆☆ ", OCARINA_ACTION_PLAYBACK_MINUET,
|
||||
msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET);
|
||||
if (msgCtx->lastPlayedSong + OCARINA_ACTION_PLAYBACK_MINUET == msgCtx->ocarinaAction) {
|
||||
if (msgCtx->lastPlayedSong == (msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET)) {
|
||||
play->msgCtx.ocarinaMode = OCARINA_MODE_03;
|
||||
} else {
|
||||
play->msgCtx.ocarinaMode = OCARINA_MODE_04;
|
||||
|
@ -2535,7 +2534,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
if (sOcarinaButtonIndexBufPos != 0 && msgCtx->ocarinaStaff->pos == 1) {
|
||||
sOcarinaButtonIndexBufPos = 0;
|
||||
}
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
msgCtx->lastOcarinaButtonIndex = sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] =
|
||||
msgCtx->ocarinaStaff->buttonIndex;
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID;
|
||||
|
@ -2548,7 +2548,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
break;
|
||||
case MSGMODE_SONG_PLAYBACK:
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff();
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->buttonIndex;
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID;
|
||||
sOcarinaButtonIndexBufPos++;
|
||||
|
@ -2595,7 +2596,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
case MSGMODE_SCARECROW_LONG_RECORDING_ONGOING:
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetRecordingStaff();
|
||||
osSyncPrintf("\nonpu_pt=%d, locate=%d", sOcarinaButtonIndexBufPos, msgCtx->ocarinaStaff->pos);
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
if (sOcarinaButtonIndexBufLen >= 8) {
|
||||
for (buttonIndexPos = sOcarinaButtonIndexBufLen - 8, i = 0; i < 8; i++, buttonIndexPos++) {
|
||||
sOcarinaButtonIndexBuf[buttonIndexPos] = sOcarinaButtonIndexBuf[buttonIndexPos + 1];
|
||||
|
@ -2646,7 +2648,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
case MSGMODE_SCARECROW_LONG_PLAYBACK:
|
||||
case MSGMODE_SCARECROW_SPAWN_PLAYBACK:
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff();
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
if (sOcarinaButtonIndexBufLen >= 8) {
|
||||
for (buttonIndexPos = sOcarinaButtonIndexBufLen - 8, i = 0; i < 8; i++, buttonIndexPos++) {
|
||||
sOcarinaButtonIndexBuf[buttonIndexPos] = sOcarinaButtonIndexBuf[buttonIndexPos + 1];
|
||||
|
@ -2681,7 +2684,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
break;
|
||||
case MSGMODE_SCARECROW_SPAWN_RECORDING_ONGOING:
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetRecordingStaff();
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
msgCtx->lastOcarinaButtonIndex = sOcarinaButtonIndexBuf[sOcarinaButtonIndexBufPos] =
|
||||
msgCtx->ocarinaStaff->buttonIndex;
|
||||
sOcarinaButtonIndexBufPos++;
|
||||
|
@ -2738,7 +2742,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
Audio_PlaySfxGeneral(NA_SE_SY_METRONOME_LV - SFX_FLAG, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff();
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->buttonIndex;
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID;
|
||||
sOcarinaButtonIndexBufPos++;
|
||||
|
@ -2761,7 +2766,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
case MSGMODE_MEMORY_GAME_LEFT_SKULLKID_WAIT:
|
||||
case MSGMODE_MEMORY_GAME_RIGHT_SKULLKID_WAIT:
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff();
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->buttonIndex;
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID;
|
||||
sOcarinaButtonIndexBufPos++;
|
||||
|
@ -2771,7 +2777,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
Audio_PlaySfxGeneral(NA_SE_SY_METRONOME_LV - SFX_FLAG, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff();
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->buttonIndex;
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID;
|
||||
sOcarinaButtonIndexBufPos++;
|
||||
|
@ -2796,7 +2803,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
break;
|
||||
case MSGMODE_MEMORY_GAME_ROUND_SUCCESS:
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff();
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->buttonIndex;
|
||||
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID;
|
||||
sOcarinaButtonIndexBufPos++;
|
||||
|
@ -2835,7 +2843,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
break;
|
||||
case MSGMODE_FROGS_PLAYING:
|
||||
msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff();
|
||||
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
|
||||
if (((u32)msgCtx->ocarinaStaff->pos != 0) &&
|
||||
(sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) {
|
||||
msgCtx->lastOcarinaButtonIndex = msgCtx->ocarinaStaff->buttonIndex;
|
||||
msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0;
|
||||
Message_ResetOcarinaNoteState();
|
||||
|
@ -3318,7 +3327,7 @@ void Message_Update(PlayState* play) {
|
|||
// Later, if the ocarina has not been played and another textbox is closed, this handling
|
||||
// for Saria's song will be carried out.
|
||||
player->naviTextId = -0xE0;
|
||||
player->naviActor->flags |= 0x10000;
|
||||
player->naviActor->flags |= ACTOR_FLAG_16;
|
||||
}
|
||||
if (msgCtx->ocarinaAction == OCARINA_ACTION_FREE_PLAY_DONE &&
|
||||
(play->msgCtx.ocarinaMode == OCARINA_MODE_01 || play->msgCtx.ocarinaMode == OCARINA_MODE_0B)) {
|
||||
|
|
|
@ -514,7 +514,7 @@ void Play_Update(PlayState* this) {
|
|||
}
|
||||
}
|
||||
|
||||
if (this->transitionMode) { // != TRANS_MODE_OFF
|
||||
if ((u32)this->transitionMode != TRANS_MODE_OFF) {
|
||||
switch (this->transitionMode) {
|
||||
case TRANS_MODE_SETUP:
|
||||
if (this->transitionTrigger != TRANS_TRIGGER_END) {
|
||||
|
|
|
@ -1322,7 +1322,7 @@ void func_80090A28(Player* this, Vec3f* vecs) {
|
|||
D_8012608C.x = D_80126080.x;
|
||||
|
||||
if (this->unk_845 >= 3) {
|
||||
this->unk_845 += 1;
|
||||
this->unk_845++;
|
||||
D_8012608C.x *= 1.0f + ((9 - this->unk_845) * 0.1f);
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ void ArrowFire_Hit(ArrowFire* this, PlayState* play) {
|
|||
|
||||
timer = this->timer;
|
||||
if (timer != 0) {
|
||||
this->timer -= 1;
|
||||
this->timer--;
|
||||
|
||||
if (this->timer >= 8) {
|
||||
offset = ((this->timer - 8) * (1.0f / 24.0f));
|
||||
|
|
|
@ -110,7 +110,7 @@ void ArrowIce_Hit(ArrowIce* this, PlayState* play) {
|
|||
|
||||
timer = this->timer;
|
||||
if (timer != 0) {
|
||||
this->timer -= 1;
|
||||
this->timer--;
|
||||
|
||||
if (this->timer >= 8) {
|
||||
offset = ((this->timer - 8) * (1.0f / 24.0f));
|
||||
|
|
|
@ -109,7 +109,7 @@ void ArrowLight_Hit(ArrowLight* this, PlayState* play) {
|
|||
|
||||
timer = this->timer;
|
||||
if (timer != 0) {
|
||||
this->timer -= 1;
|
||||
this->timer--;
|
||||
|
||||
if (this->timer >= 8) {
|
||||
offset = ((this->timer - 8) * (1.0f / 24.0f));
|
||||
|
|
|
@ -116,7 +116,7 @@ void BgGateShutter_Update(Actor* thisx, PlayState* play) {
|
|||
BgGateShutter* this = (BgGateShutter*)thisx;
|
||||
|
||||
if (this->unk_178 != 0) {
|
||||
this->unk_178 -= 1;
|
||||
this->unk_178--;
|
||||
}
|
||||
this->actionFunc(this, play);
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ void func_8087BAE4(BgHaka* this, PlayState* play) {
|
|||
s32 pad;
|
||||
|
||||
if (this->dyna.actor.params != 0) {
|
||||
this->dyna.actor.params -= 1;
|
||||
this->dyna.actor.params--;
|
||||
}
|
||||
if (this->dyna.unk_150 != 0.0f) {
|
||||
this->dyna.unk_150 = 0.0f;
|
||||
|
|
|
@ -112,7 +112,7 @@ void func_80889B5C(BgHidanKousi* this, PlayState* play) {
|
|||
}
|
||||
|
||||
void func_80889BC0(BgHidanKousi* this, PlayState* play) {
|
||||
this->unk_168 -= 1;
|
||||
this->unk_168--;
|
||||
if (this->dyna.actor.category == func_8005B198() || (this->unk_168 <= 0)) {
|
||||
BgHidanKousi_SetupAction(this, func_80889C18);
|
||||
}
|
||||
|
|
|
@ -83,8 +83,8 @@ void func_80899894(BgJyaKanaami* this, PlayState* play) {
|
|||
if (this->dyna.actor.world.pos.x > -1000.0f && this->unk_16A == 0) {
|
||||
OnePointCutscene_Init(play, 3450, -99, &this->dyna.actor, CAM_ID_MAIN);
|
||||
}
|
||||
this->unk_16A += 1;
|
||||
if (this->unk_16A >= 0xA) {
|
||||
this->unk_16A++;
|
||||
if (this->unk_16A >= 10) {
|
||||
func_8089993C(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,11 +89,11 @@ void BgMenkuriEye_Update(Actor* thisx, PlayState* play) {
|
|||
if (!Flags_GetSwitch(play, this->actor.params)) {
|
||||
if (this->framesUntilDisable != -1) {
|
||||
if (this->framesUntilDisable != 0) {
|
||||
this->framesUntilDisable -= 1;
|
||||
this->framesUntilDisable--;
|
||||
}
|
||||
if (this->framesUntilDisable == 0) {
|
||||
this->framesUntilDisable = -1;
|
||||
D_8089C1A0 -= 1;
|
||||
D_8089C1A0--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ void BgMenkuriEye_Update(Actor* thisx, PlayState* play) {
|
|||
this->collider.base.acFlags &= ~AC_HIT;
|
||||
if (this->framesUntilDisable == -1) {
|
||||
Actor_PlaySfx(&this->actor, NA_SE_EN_AMOS_DAMAGE);
|
||||
D_8089C1A0 += 1;
|
||||
D_8089C1A0++;
|
||||
D_8089C1A0 = CLAMP_MAX(D_8089C1A0, 4);
|
||||
}
|
||||
this->framesUntilDisable = 416;
|
||||
|
|
|
@ -312,7 +312,7 @@ void func_808B5240(BgSpot16Bombstone* this, PlayState* play) {
|
|||
func_800287AC(play, &position, &sVelocity, &sAcceleration, D_808B5EB0[index][4], D_808B5EB0[index][5],
|
||||
D_808B5EB0[index][6]);
|
||||
|
||||
this->unk_158 += 1;
|
||||
this->unk_158++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -345,7 +345,7 @@ void BgSpot16Bombstone_SpawnFragments(BgSpot16Bombstone* this, PlayState* play)
|
|||
|
||||
EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, -420, 0x31, 0xF, 0xF, 0, scale, 2, 0x40,
|
||||
160, KAKERA_COLOR_NONE, OBJECT_BOMBIWA, object_bombiwa_DL_0009E0);
|
||||
index += 1;
|
||||
index++;
|
||||
} while (index != ARRAY_COUNT(D_808B6074));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -277,7 +277,7 @@ void BgSpot18Obj_Update(Actor* thisx, PlayState* play) {
|
|||
BgSpot18Obj* this = (BgSpot18Obj*)thisx;
|
||||
|
||||
if (this->unk_168 > 0) {
|
||||
this->unk_168 -= 1;
|
||||
this->unk_168--;
|
||||
}
|
||||
this->actionFunc(this, play);
|
||||
}
|
||||
|
|
|
@ -1476,7 +1476,7 @@ void BossFd_UpdateEffects(BossFd* this, PlayState* play) {
|
|||
if ((this->timers[3] == 0) && (sqrtf(SQ(diff.x) + SQ(diff.y) + SQ(diff.z)) < 20.0f)) {
|
||||
this->timers[3] = 50;
|
||||
func_8002F6D4(play, NULL, 5.0f, effect->kbAngle, 0.0f, 0x30);
|
||||
if (player->isBurning == false) {
|
||||
if (!player->isBurning) {
|
||||
for (i2 = 0; i2 < PLAYER_BODYPART_MAX; i2++) {
|
||||
player->flameTimers[i2] = Rand_S16Offset(0, 200);
|
||||
}
|
||||
|
|
|
@ -2820,23 +2820,9 @@ void BossVa_Update(Actor* thisx, PlayState* play2) {
|
|||
BossVa_UpdateEffects(play);
|
||||
|
||||
for (i = 2; i >= 0; i--) {
|
||||
if ((play->envCtx.adjAmbientColor[i] - 1) > 0) {
|
||||
play->envCtx.adjAmbientColor[i] -= 1;
|
||||
} else {
|
||||
play->envCtx.adjAmbientColor[i] = 0;
|
||||
}
|
||||
|
||||
if ((play->envCtx.adjLight1Color[i] - 10) > 0) {
|
||||
play->envCtx.adjLight1Color[i] -= 10;
|
||||
} else {
|
||||
play->envCtx.adjLight1Color[i] = 0;
|
||||
}
|
||||
|
||||
if ((play->envCtx.adjFogColor[i] - 10) > 0) {
|
||||
play->envCtx.adjFogColor[i] -= 10;
|
||||
} else {
|
||||
play->envCtx.adjFogColor[i] = 0;
|
||||
}
|
||||
play->envCtx.adjAmbientColor[i] = MAX(play->envCtx.adjAmbientColor[i] - 1, 0);
|
||||
play->envCtx.adjLight1Color[i] = MAX(play->envCtx.adjLight1Color[i] - 10, 0);
|
||||
play->envCtx.adjFogColor[i] = MAX(play->envCtx.adjFogColor[i] - 10, 0);
|
||||
}
|
||||
|
||||
if (this->onCeiling > 0) {
|
||||
|
|
|
@ -1036,7 +1036,7 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play) {
|
|||
}
|
||||
}
|
||||
this->light.rotation += 6;
|
||||
this->light.scaleFlag += 1;
|
||||
this->light.scaleFlag++;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
|
|
@ -591,7 +591,7 @@ void DoorShutter_Idle(DoorShutter* this, PlayState* play) {
|
|||
if (this->unlockTimer != 0) {
|
||||
Flags_SetSwitch(play, DOORSHUTTER_GET_SWITCH_FLAG(&this->dyna.actor));
|
||||
if (this->doorType != SHUTTER_BOSS) {
|
||||
gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]--;
|
||||
gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] -= 1;
|
||||
Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK);
|
||||
} else {
|
||||
Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK_B);
|
||||
|
|
|
@ -212,7 +212,7 @@ void EfcErupc_UpdateEffects(EfcErupc* this, PlayState* play) {
|
|||
cur->vel.x += cur->accel.x;
|
||||
cur->vel.y += cur->accel.y;
|
||||
cur->vel.z += cur->accel.z;
|
||||
cur->animTimer += 1;
|
||||
cur->animTimer++;
|
||||
index = cur->animTimer % 4;
|
||||
color = &effectColors[index];
|
||||
cur->color.r = color->r;
|
||||
|
|
|
@ -136,7 +136,7 @@ void EffDust_UpdateFunc_8099DB28(EffDust* this, PlayState* play) {
|
|||
this->initialPositions[i].y = -800.0f * Math_SinS(theta);
|
||||
this->initialPositions[i].z = -800.0f * Math_SinS(fi) * Math_CosS(theta);
|
||||
this->distanceTraveled[i] = 0.0f;
|
||||
this->index += 1;
|
||||
this->index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ void EffDust_UpdateFunc_8099DD74(EffDust* this, PlayState* play) {
|
|||
this->initialPositions[i].y = 400.0f * Math_SinS(theta);
|
||||
this->initialPositions[i].z = 400.0f * Math_SinS(fi) * Math_CosS(theta);
|
||||
this->distanceTraveled[i] = 0.0f;
|
||||
this->index += 1;
|
||||
this->index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ void EffDust_UpdateFunc_8099DFC0(EffDust* this, PlayState* play) {
|
|||
|
||||
if (parent == NULL || parent->update == NULL || !(player->stateFlags1 & PLAYER_STATE1_12)) {
|
||||
if (this->life != 0) {
|
||||
this->life -= 1;
|
||||
this->life--;
|
||||
} else {
|
||||
Actor_Kill(&this->actor);
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ void EffDust_UpdateFunc_8099DFC0(EffDust* this, PlayState* play) {
|
|||
}
|
||||
|
||||
this->distanceTraveled[i] = 0.0f;
|
||||
this->index += 1;
|
||||
this->index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ typedef struct EnBird {
|
|||
/* 0x0194 */ u32 unk_194; // set to 0 but otherwise unused
|
||||
/* 0x0198 */ s32 timer;
|
||||
/* 0x019C */ s16 scaleAnimSpeed; // when true, anim speed scales with XZ speed while slowing down. otherwise anim plays full speed
|
||||
/* 0x01A0 */ f32 posYMag;
|
||||
/* 0x01A4 */ f32 rotYMag;
|
||||
/* 0x01A0 */ f32 posYMag;
|
||||
/* 0x01A4 */ f32 rotYMag;
|
||||
/* 0x01A8 */ f32 speedTarget;
|
||||
/* 0x01AC */ f32 speedStep;
|
||||
/* 0x01B0 */ f32 flightDistance; // radius of "home" area
|
||||
|
|
|
@ -160,7 +160,7 @@ void EnCow_Destroy(Actor* thisx, PlayState* play) {
|
|||
|
||||
void func_809DF494(EnCow* this, PlayState* play) {
|
||||
if (this->unk_278 > 0) {
|
||||
this->unk_278 -= 1;
|
||||
this->unk_278--;
|
||||
} else {
|
||||
this->unk_278 = Rand_ZeroFloat(500.0f) + 40.0f;
|
||||
Animation_Change(&this->skelAnime, &gCowBodyChewAnim, 1.0f, this->skelAnime.curFrame,
|
||||
|
@ -174,8 +174,8 @@ void func_809DF494(EnCow* this, PlayState* play) {
|
|||
}
|
||||
}
|
||||
|
||||
this->unk_27A += 1;
|
||||
if (this->unk_27A >= 0x31) {
|
||||
this->unk_27A++;
|
||||
if (this->unk_27A > 48) {
|
||||
this->unk_27A = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ void EnDaiku_Init(Actor* thisx, PlayState* play) {
|
|||
|
||||
if (isFree == true && play->sceneId == SCENE_THIEVES_HIDEOUT) {
|
||||
noKill = false;
|
||||
} else if (isFree == false && play->sceneId == SCENE_CARPENTERS_TENT) {
|
||||
} else if (!isFree && play->sceneId == SCENE_CARPENTERS_TENT) {
|
||||
noKill = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, PlayState* play) {
|
|||
run = false;
|
||||
|
||||
if (runDist <= 10.0f) {
|
||||
if (this->pathContinue == false) {
|
||||
if (!this->pathContinue) {
|
||||
this->waypoint++;
|
||||
|
||||
if (this->waypoint >= path->count) {
|
||||
|
@ -416,7 +416,7 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, PlayState* play) {
|
|||
|
||||
this->actor.world.rot.y = this->actor.shape.rot.y;
|
||||
|
||||
if (this->run == false) {
|
||||
if (!this->run) {
|
||||
if (angleStepDiff == 0) {
|
||||
this->run = true;
|
||||
} else {
|
||||
|
|
|
@ -226,7 +226,7 @@ void EnDoor_Idle(EnDoor* this, PlayState* play) {
|
|||
Animation_PlayOnceSetSpeed(&this->skelAnime, sDoorAnims[this->openAnim],
|
||||
(player->stateFlags1 & PLAYER_STATE1_27) ? 0.75f : 1.5f);
|
||||
if (this->lockTimer != 0) {
|
||||
gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]--;
|
||||
gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] -= 1;
|
||||
Flags_SetSwitch(play, ENDOOR_GET_LOCKED_SWITCH_FLAG(&this->actor));
|
||||
Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIN_KEY_UNLOCK);
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ void EnDs_TalkAfterBrewOddPotion(EnDs* this, PlayState* play) {
|
|||
|
||||
void EnDs_BrewOddPotion3(EnDs* this, PlayState* play) {
|
||||
if (this->brewTimer > 0) {
|
||||
this->brewTimer -= 1;
|
||||
this->brewTimer--;
|
||||
} else {
|
||||
this->actionFunc = EnDs_TalkAfterBrewOddPotion;
|
||||
Message_ContinueTextbox(play, 0x504D);
|
||||
|
@ -116,7 +116,7 @@ void EnDs_BrewOddPotion3(EnDs* this, PlayState* play) {
|
|||
|
||||
void EnDs_BrewOddPotion2(EnDs* this, PlayState* play) {
|
||||
if (this->brewTimer > 0) {
|
||||
this->brewTimer -= 1;
|
||||
this->brewTimer--;
|
||||
} else {
|
||||
this->actionFunc = EnDs_BrewOddPotion3;
|
||||
this->brewTimer = 60;
|
||||
|
@ -126,7 +126,7 @@ void EnDs_BrewOddPotion2(EnDs* this, PlayState* play) {
|
|||
|
||||
void EnDs_BrewOddPotion1(EnDs* this, PlayState* play) {
|
||||
if (this->brewTimer > 0) {
|
||||
this->brewTimer -= 1;
|
||||
this->brewTimer--;
|
||||
} else {
|
||||
this->actionFunc = EnDs_BrewOddPotion2;
|
||||
this->brewTimer = 20;
|
||||
|
|
|
@ -295,7 +295,7 @@ void EnExRuppy_WaitInGame(EnExRuppy* this, PlayState* play) {
|
|||
}
|
||||
|
||||
void EnExRuppy_Kill(EnExRuppy* this, PlayState* play) {
|
||||
this->invisible += 1;
|
||||
this->invisible++;
|
||||
this->invisible &= 1; // Net effect is this->invisible = !this->invisible;
|
||||
if (this->timer == 0) {
|
||||
Actor_Kill(&this->actor);
|
||||
|
|
|
@ -352,7 +352,7 @@ void EnFr_DivingIntoWater(EnFr* this, PlayState* play) {
|
|||
vec.z = this->actor.world.pos.z;
|
||||
EffectSsGSplash_Spawn(play, &vec, NULL, NULL, 1, 1);
|
||||
|
||||
if (this->isBelowWaterSurfaceCurrent == false) {
|
||||
if (!this->isBelowWaterSurfaceCurrent) {
|
||||
Actor_PlaySfx(&this->actor, NA_SE_EV_DIVE_INTO_WATER_L);
|
||||
} else {
|
||||
Actor_PlaySfx(&this->actor, NA_SE_EV_BOMB_DROP_WATER);
|
||||
|
@ -594,7 +594,7 @@ s32 EnFr_SetupJumpingUp(EnFr* this, s32 frogIndex) {
|
|||
EnFr* frog = sEnFrPointers.frogs[frogIndex];
|
||||
u8 semitone;
|
||||
|
||||
if (frog != NULL && frog->isJumpingUp == false) {
|
||||
if ((frog != NULL) && !frog->isJumpingUp) {
|
||||
semitone = frog->growingScaleIndex == 3 ? sLargeFrogNotes[frogIndex] : sSmallFrogNotes[frogIndex];
|
||||
if (this->songIndex == FROG_CHOIR_SONG) {
|
||||
frog->isJumpingToFrogSong = true;
|
||||
|
@ -756,7 +756,7 @@ void EnFr_ChildSong(EnFr* this, PlayState* play) {
|
|||
void EnFr_ChildSongFirstTime(EnFr* this, PlayState* play) {
|
||||
EnFr* frog = sEnFrPointers.frogs[sSongToFrog[this->songIndex]];
|
||||
|
||||
if (frog->isActive == false) {
|
||||
if (!frog->isActive) {
|
||||
this->actor.textId = 0x40A9;
|
||||
EnFr_SetupReward(this, play, true);
|
||||
}
|
||||
|
|
|
@ -685,7 +685,7 @@ void EnFz_Update(Actor* thisx, PlayState* play) {
|
|||
Actor_SetFocus(&this->actor, 50.0f);
|
||||
EnFz_ApplyDamage(this, play);
|
||||
this->actionFunc(this, play);
|
||||
if (this->isDespawning == false) {
|
||||
if (!this->isDespawning) {
|
||||
Collider_UpdateCylinder(&this->actor, &this->collider1);
|
||||
Collider_UpdateCylinder(&this->actor, &this->collider2);
|
||||
if (this->isFreezing) {
|
||||
|
|
|
@ -113,7 +113,7 @@ void func_80A5046C(EnGuest* this) {
|
|||
if (this->unk_2CA != 0) {
|
||||
this->unk_2CA--;
|
||||
} else {
|
||||
this->unk_30E += 1;
|
||||
this->unk_30E++;
|
||||
if (this->unk_30E >= 3) {
|
||||
this->unk_30E = 0;
|
||||
this->unk_30D = 0;
|
||||
|
|
|
@ -215,9 +215,9 @@ void EnHeishi3_Update(Actor* thisx, PlayState* play) {
|
|||
s32 pad;
|
||||
|
||||
Actor_SetFocus(&this->actor, 60.0f);
|
||||
this->unk_274 += 1;
|
||||
this->unk_274++;
|
||||
if (this->caughtTimer != 0) {
|
||||
this->caughtTimer -= 1;
|
||||
this->caughtTimer--;
|
||||
}
|
||||
this->actionFunc(this, play);
|
||||
this->actor.shape.rot = this->actor.world.rot;
|
||||
|
|
|
@ -355,7 +355,7 @@ void EnHeishi4_Update(Actor* thisx, PlayState* play) {
|
|||
this->headRot = this->interactInfo.headRot;
|
||||
this->torsoRot = this->interactInfo.torsoRot;
|
||||
}
|
||||
this->unk_27E += 1;
|
||||
this->unk_27E++;
|
||||
this->actionFunc(this, play);
|
||||
Actor_MoveXZGravity(thisx);
|
||||
Actor_UpdateBgCheckInfo(play, thisx, 10.0f, 10.0f, 30.0f,
|
||||
|
|
|
@ -1366,7 +1366,7 @@ void EnHorse_MountedGallop(EnHorse* this, PlayState* play) {
|
|||
if (this->noInputTimer <= 0.0f) {
|
||||
EnHorse_UpdateSpeed(this, play, 0.3f, -0.5f, 10.0f, 0.06f, 8.0f, 0x190);
|
||||
} else if (this->noInputTimer > 0.0f) {
|
||||
this->noInputTimer -= 1;
|
||||
this->noInputTimer--;
|
||||
this->actor.speed = 8.0f;
|
||||
}
|
||||
if (this->actor.speed < 6.0f) {
|
||||
|
@ -3033,7 +3033,7 @@ void EnHorse_MountDismount(EnHorse* this, PlayState* play) {
|
|||
Actor_SetRideActor(play, &this->actor, mountSide);
|
||||
}
|
||||
|
||||
if (this->playerControlled == false && Actor_IsMounted(play, &this->actor) == true) {
|
||||
if (!this->playerControlled && Actor_IsMounted(play, &this->actor) == true) {
|
||||
this->noInputTimer = 55;
|
||||
this->noInputTimerMax = 55;
|
||||
this->playerControlled = 1;
|
||||
|
@ -3205,8 +3205,8 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) {
|
|||
}
|
||||
|
||||
// too close to jump
|
||||
if ((movingFast == false && intersectDist < 80.0f) || (movingFast == true && intersectDist < 150.0f)) {
|
||||
if (movingFast == false) {
|
||||
if ((!movingFast && intersectDist < 80.0f) || (movingFast == true && intersectDist < 150.0f)) {
|
||||
if (!movingFast) {
|
||||
this->stateFlags |= ENHORSE_FORCE_REVERSING;
|
||||
} else if (movingFast == true) {
|
||||
this->stateFlags |= ENHORSE_FORCE_REVERSING;
|
||||
|
@ -3218,7 +3218,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) {
|
|||
dynaPoly = DynaPoly_GetActor(&play->colCtx, bgId);
|
||||
if ((this->stateFlags & ENHORSE_FLAG_26) &&
|
||||
((dynaPoly && dynaPoly->actor.id != ACTOR_BG_UMAJUMP) || dynaPoly == NULL)) {
|
||||
if (movingFast == false) {
|
||||
if (!movingFast) {
|
||||
this->stateFlags |= ENHORSE_FORCE_REVERSING;
|
||||
} else if (movingFast == true) {
|
||||
this->stateFlags |= ENHORSE_FORCE_REVERSING;
|
||||
|
@ -3275,7 +3275,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) {
|
|||
|
||||
obstaclePos = startPos;
|
||||
obstaclePos.y = this->actor.world.pos.y + 120.0f;
|
||||
if (movingFast == false) {
|
||||
if (!movingFast) {
|
||||
obstaclePos.x += (276.0f * Math_SinS(this->actor.world.rot.y));
|
||||
obstaclePos.z += (276.0f * Math_CosS(this->actor.world.rot.y));
|
||||
} else {
|
||||
|
@ -3308,7 +3308,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) {
|
|||
this->stateFlags |= ENHORSE_FORCE_REVERSING;
|
||||
EnHorse_StartBraking(this, play);
|
||||
}
|
||||
} else if (movingFast == false && obstacleHeight > 19.0f && obstacleHeight <= 40.0f) {
|
||||
} else if (!movingFast && obstacleHeight > 19.0f && obstacleHeight <= 40.0f) {
|
||||
EnHorse_Stub1(this);
|
||||
this->postDrawFunc = EnHorse_LowJumpInit;
|
||||
} else if ((movingFast == true && this->actor.speed < 13.8f && obstacleHeight > 19.0f && obstacleHeight <= 72.0f) ||
|
||||
|
|
|
@ -120,7 +120,7 @@ void func_80A686A8(EnHorseGanon* this, PlayState* play) {
|
|||
|
||||
func_80A68660(D_80A69248, this->unk_1EC, &vec);
|
||||
if (Math3D_Vec3f_DistXYZ(&vec, &this->actor.world.pos) <= 400.0f) {
|
||||
this->unk_1EC += 1;
|
||||
this->unk_1EC++;
|
||||
if (this->unk_1EC >= 14) {
|
||||
this->unk_1EC = 0;
|
||||
func_80A68660(D_80A69248, 0, &vec);
|
||||
|
|
|
@ -180,7 +180,7 @@ s16 EnKz_UpdateTalkState(PlayState* play, Actor* thisx) {
|
|||
|
||||
void EnKz_UpdateEyes(EnKz* this) {
|
||||
if (DECR(this->blinkTimer) == 0) {
|
||||
this->eyeIdx += 1;
|
||||
this->eyeIdx++;
|
||||
if (this->eyeIdx >= 3) {
|
||||
this->blinkTimer = Rand_S16Offset(30, 30);
|
||||
this->eyeIdx = 0;
|
||||
|
|
|
@ -211,7 +211,7 @@ s32 func_80AA08C4(EnMa1* this, PlayState* play) {
|
|||
|
||||
void EnMa1_UpdateEyes(EnMa1* this) {
|
||||
if (DECR(this->blinkTimer) == 0) {
|
||||
this->eyeIndex += 1;
|
||||
this->eyeIndex++;
|
||||
if (this->eyeIndex >= 3) {
|
||||
this->blinkTimer = Rand_S16Offset(30, 30);
|
||||
this->eyeIndex = 0;
|
||||
|
|
|
@ -175,7 +175,7 @@ s32 func_80AA1C68(EnMa2* this) {
|
|||
|
||||
void EnMa2_UpdateEyes(EnMa2* this) {
|
||||
if ((!func_80AA1C68(this)) && (DECR(this->blinkTimer) == 0)) {
|
||||
this->eyeIndex += 1;
|
||||
this->eyeIndex++;
|
||||
if (this->eyeIndex >= 3) {
|
||||
this->blinkTimer = Rand_S16Offset(30, 30);
|
||||
this->eyeIndex = 0;
|
||||
|
|
|
@ -229,7 +229,7 @@ s32 func_80AA2F28(EnMa3* this) {
|
|||
|
||||
void EnMa3_UpdateEyes(EnMa3* this) {
|
||||
if ((!func_80AA2F28(this)) && (DECR(this->blinkTimer) == 0)) {
|
||||
this->eyeIndex += 1;
|
||||
this->eyeIndex++;
|
||||
if (this->eyeIndex >= 3) {
|
||||
this->blinkTimer = Rand_S16Offset(30, 30);
|
||||
this->eyeIndex = 0;
|
||||
|
|
|
@ -308,7 +308,7 @@ void EnMb_Init(Actor* thisx, PlayState* play) {
|
|||
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFeet, 90.0f);
|
||||
this->actor.flags &= ~ACTOR_FLAG_0;
|
||||
this->actor.naviEnemyId += 1; // NAVI_ENEMY_MOBLIN_CLUB
|
||||
this->actor.naviEnemyId += NAVI_ENEMY_MOBLIN_CLUB - NAVI_ENEMY_MOBLIN;
|
||||
EnMb_SetupClubWaitPlayerNear(this);
|
||||
break;
|
||||
default: /* Spear Patrol */
|
||||
|
|
|
@ -161,7 +161,7 @@ void EnMs_Update(Actor* thisx, PlayState* play) {
|
|||
EnMs* this = (EnMs*)thisx;
|
||||
s32 pad;
|
||||
|
||||
this->activeTimer += 1;
|
||||
this->activeTimer++;
|
||||
Actor_SetFocus(&this->actor, 20.0f);
|
||||
this->actor.targetArrowOffset = 500.0f;
|
||||
Actor_SetScale(&this->actor, 0.015f);
|
||||
|
|
|
@ -230,7 +230,7 @@ void EnNy_Move(EnNy* this, PlayState* play) {
|
|||
func_80ABCD40(this);
|
||||
stoneTimer = this->stoneTimer;
|
||||
this->stoneTimer--;
|
||||
if ((stoneTimer <= 0) || (this->hitPlayer != false)) {
|
||||
if ((stoneTimer <= 0) || this->hitPlayer) {
|
||||
EnNy_SetupTurnToStone(this);
|
||||
} else {
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, this->unk_1F4, 0);
|
||||
|
|
|
@ -1248,7 +1248,7 @@ void EnSkj_Appear(EnSkj* this) {
|
|||
void EnSkj_OcarinaGameIdle(EnSkj* this, PlayState* play) {
|
||||
EnSkj_Appear(this);
|
||||
|
||||
if ((EnSkj_IsLeavingGame(this) == false) && (this->minigameState != 0)) {
|
||||
if (!EnSkj_IsLeavingGame(this) && (this->minigameState != 0)) {
|
||||
EnSkj_SetupPlayOcarinaGame(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ void func_80B11A94(EnSyatekiNiw* this, PlayState* play, s16 arg2) {
|
|||
this->unk_264 = -10000.0f;
|
||||
}
|
||||
|
||||
this->unk_28E += 1;
|
||||
this->unk_28E++;
|
||||
this->unk_254 = 3;
|
||||
if (!(this->unk_28E & 1)) {
|
||||
this->unk_264 = 0.0f;
|
||||
|
|
|
@ -43,7 +43,7 @@ typedef struct EnTa {
|
|||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ SkelAnime skelAnime;
|
||||
/* 0x0190 */ Vec3s jointTable[ENTA_LIMB_MAX];
|
||||
/* 0x01F6 */ Vec3s morphTable[ENTA_LIMB_MAX];
|
||||
/* 0x01F6 */ Vec3s morphTable[ENTA_LIMB_MAX];
|
||||
/* 0x025C */ EnTaActionFunc actionFunc;
|
||||
/* 0x0260 */ EnTaAnimFunc animFunc;
|
||||
/* 0x0264 */ ColliderCylinder collider;
|
||||
|
|
|
@ -196,7 +196,7 @@ void EnTite_Init(Actor* thisx, PlayState* play) {
|
|||
if (this->actor.params == TEKTITE_BLUE) {
|
||||
this->unk_2DC |= UPDBGCHECKINFO_FLAG_6; // Don't use the actor engine's ripple spawning code
|
||||
thisx->colChkInfo.health = 4;
|
||||
thisx->naviEnemyId += 1; // NAVI_ENEMY_BLUE_TEKTITE
|
||||
thisx->naviEnemyId += NAVI_ENEMY_BLUE_TEKTITE - NAVI_ENEMY_RED_TEKTITE;
|
||||
}
|
||||
EnTite_SetupIdle(this);
|
||||
}
|
||||
|
|
|
@ -1904,7 +1904,7 @@ void func_80B57AE0(EnZl3* this, PlayState* play) {
|
|||
f32 zDiff;
|
||||
|
||||
this->unk_344 = 0;
|
||||
this->unk_314 += 1;
|
||||
this->unk_314++;
|
||||
this->unk_360 = 0.0f;
|
||||
this->unk_364 = 0.0f;
|
||||
this->unk_368 = 0.0f;
|
||||
|
@ -1947,7 +1947,7 @@ void func_80B57CB4(EnZl3* this, PlayState* play) {
|
|||
Vec3f* thisPos = &this->actor.world.pos;
|
||||
f32 temp_f0;
|
||||
|
||||
this->unk_344 += 1;
|
||||
this->unk_344++;
|
||||
temp_f0 = Environment_LerpWeightAccelDecel(this->unk_346, 0, this->unk_344, 3, 3);
|
||||
thisPos->x = unk_348->x + (temp_f0 * (unk_354->x - unk_348->x));
|
||||
thisPos->y = (unk_348->y + (temp_f0 * (unk_354->y - unk_348->y))) + this->unk_360;
|
||||
|
@ -2002,7 +2002,7 @@ void func_80B57F1C(EnZl3* this, PlayState* play) {
|
|||
if (func_80B57D80(this, play) == 0) {
|
||||
func_80B54E14(this, &gZelda2Anime2Anim_009BE4, 0, -8.0f, 0);
|
||||
this->action = 34;
|
||||
this->unk_314 -= 1;
|
||||
this->unk_314--;
|
||||
func_80B57AE0(this, play);
|
||||
}
|
||||
}
|
||||
|
@ -2248,7 +2248,7 @@ void func_80B58C08(EnZl3* this, PlayState* play) {
|
|||
s32 sp28;
|
||||
f32 temp_f0;
|
||||
|
||||
this->unk_344 += 1;
|
||||
this->unk_344++;
|
||||
|
||||
unk_344 = this->unk_344;
|
||||
unk_346 = this->unk_346;
|
||||
|
|
|
@ -352,108 +352,108 @@ static u8 D_80853410[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
|
|||
|
||||
static PlayerAgeProperties sAgeProperties[] = {
|
||||
{
|
||||
56.0f,
|
||||
90.0f,
|
||||
1.0f,
|
||||
111.0f,
|
||||
70.0f,
|
||||
79.4f,
|
||||
59.0f,
|
||||
41.0f,
|
||||
19.0f,
|
||||
36.0f,
|
||||
44.8f,
|
||||
56.0f,
|
||||
68.0f,
|
||||
70.0f,
|
||||
18.0f,
|
||||
15.0f,
|
||||
70.0f,
|
||||
{ 9, 4671, 359 },
|
||||
56.0f, // unk_00
|
||||
90.0f, // unk_04
|
||||
1.0f, // unk_08
|
||||
111.0f, // unk_0C
|
||||
70.0f, // unk_10
|
||||
79.4f, // unk_14
|
||||
59.0f, // unk_18
|
||||
41.0f, // unk_1C
|
||||
19.0f, // unk_20
|
||||
36.0f, // unk_24
|
||||
44.8f, // unk_28
|
||||
56.0f, // unk_2C
|
||||
68.0f, // unk_30
|
||||
70.0f, // unk_34
|
||||
18.0f, // unk_38
|
||||
15.0f, // unk_3C
|
||||
70.0f, // unk_40
|
||||
{ 9, 4671, 359 }, // unk_44
|
||||
{
|
||||
{ 8, 4694, 380 },
|
||||
{ 9, 6122, 359 },
|
||||
{ 8, 4694, 380 },
|
||||
{ 9, 6122, 359 },
|
||||
},
|
||||
}, // unk_4A
|
||||
{
|
||||
{ 9, 6122, 359 },
|
||||
{ 9, 7693, 380 },
|
||||
{ 9, 6122, 359 },
|
||||
{ 9, 7693, 380 },
|
||||
},
|
||||
}, // unk_62
|
||||
{
|
||||
{ 8, 4694, 380 },
|
||||
{ 9, 6122, 359 },
|
||||
},
|
||||
}, // unk_7A
|
||||
{
|
||||
{ -1592, 4694, 380 },
|
||||
{ -1591, 6122, 359 },
|
||||
},
|
||||
0,
|
||||
0x80,
|
||||
&gPlayerAnim_link_demo_Tbox_open,
|
||||
&gPlayerAnim_link_demo_back_to_past,
|
||||
&gPlayerAnim_link_demo_return_to_past,
|
||||
&gPlayerAnim_link_normal_climb_startA,
|
||||
&gPlayerAnim_link_normal_climb_startB,
|
||||
}, // unk_86
|
||||
0, // unk_92
|
||||
0x80, // unk_94
|
||||
&gPlayerAnim_link_demo_Tbox_open, // unk_98
|
||||
&gPlayerAnim_link_demo_back_to_past, // unk_9C
|
||||
&gPlayerAnim_link_demo_return_to_past, // unk_A0
|
||||
&gPlayerAnim_link_normal_climb_startA, // unk_A4
|
||||
&gPlayerAnim_link_normal_climb_startB, // unk_A8
|
||||
{ &gPlayerAnim_link_normal_climb_upL, &gPlayerAnim_link_normal_climb_upR, &gPlayerAnim_link_normal_Fclimb_upL,
|
||||
&gPlayerAnim_link_normal_Fclimb_upR },
|
||||
{ &gPlayerAnim_link_normal_Fclimb_sideL, &gPlayerAnim_link_normal_Fclimb_sideR },
|
||||
{ &gPlayerAnim_link_normal_climb_endAL, &gPlayerAnim_link_normal_climb_endAR },
|
||||
{ &gPlayerAnim_link_normal_climb_endBR, &gPlayerAnim_link_normal_climb_endBL },
|
||||
&gPlayerAnim_link_normal_Fclimb_upR }, // unk_AC
|
||||
{ &gPlayerAnim_link_normal_Fclimb_sideL, &gPlayerAnim_link_normal_Fclimb_sideR }, // unk_BC
|
||||
{ &gPlayerAnim_link_normal_climb_endAL, &gPlayerAnim_link_normal_climb_endAR }, // unk_C4
|
||||
{ &gPlayerAnim_link_normal_climb_endBR, &gPlayerAnim_link_normal_climb_endBL }, // unk_CC
|
||||
},
|
||||
{
|
||||
40.0f,
|
||||
60.0f,
|
||||
11.0f / 17.0f,
|
||||
71.0f,
|
||||
50.0f,
|
||||
47.0f,
|
||||
39.0f,
|
||||
27.0f,
|
||||
19.0f,
|
||||
22.0f,
|
||||
29.6f,
|
||||
32.0f,
|
||||
48.0f,
|
||||
70.0f * (11.0f / 17.0f),
|
||||
14.0f,
|
||||
12.0f,
|
||||
55.0f,
|
||||
{ -24, 3565, 876 },
|
||||
40.0f, // unk_00
|
||||
60.0f, // unk_04
|
||||
11.0f / 17.0f, // unk_08
|
||||
71.0f, // unk_0C
|
||||
50.0f, // unk_10
|
||||
47.0f, // unk_14
|
||||
39.0f, // unk_18
|
||||
27.0f, // unk_1C
|
||||
19.0f, // unk_20
|
||||
22.0f, // unk_24
|
||||
29.6f, // unk_28
|
||||
32.0f, // unk_2C
|
||||
48.0f, // unk_30
|
||||
70.0f * (11.0f / 17.0f), // unk_34
|
||||
14.0f, // unk_38
|
||||
12.0f, // unk_3C
|
||||
55.0f, // unk_40
|
||||
{ -24, 3565, 876 }, // unk_44
|
||||
{
|
||||
{ -24, 3474, 862 },
|
||||
{ -24, 4977, 937 },
|
||||
{ 8, 4694, 380 },
|
||||
{ 9, 6122, 359 },
|
||||
},
|
||||
}, // unk_4A
|
||||
{
|
||||
{ -24, 4977, 937 },
|
||||
{ -24, 6495, 937 },
|
||||
{ 9, 6122, 359 },
|
||||
{ 9, 7693, 380 },
|
||||
},
|
||||
}, // unk_62
|
||||
{
|
||||
{ 8, 4694, 380 },
|
||||
{ 9, 6122, 359 },
|
||||
},
|
||||
}, // unk_7A
|
||||
{
|
||||
{ -1592, 4694, 380 },
|
||||
{ -1591, 6122, 359 },
|
||||
},
|
||||
0x20,
|
||||
0,
|
||||
&gPlayerAnim_clink_demo_Tbox_open,
|
||||
&gPlayerAnim_clink_demo_goto_future,
|
||||
&gPlayerAnim_clink_demo_return_to_future,
|
||||
&gPlayerAnim_clink_normal_climb_startA,
|
||||
&gPlayerAnim_clink_normal_climb_startB,
|
||||
}, // unk_86
|
||||
0x20, // unk_92
|
||||
0, // unk_94
|
||||
&gPlayerAnim_clink_demo_Tbox_open, // unk_98
|
||||
&gPlayerAnim_clink_demo_goto_future, // unk_9C
|
||||
&gPlayerAnim_clink_demo_return_to_future, // unk_A0
|
||||
&gPlayerAnim_clink_normal_climb_startA, // unk_A4
|
||||
&gPlayerAnim_clink_normal_climb_startB, // unk_A8
|
||||
{ &gPlayerAnim_clink_normal_climb_upL, &gPlayerAnim_clink_normal_climb_upR, &gPlayerAnim_link_normal_Fclimb_upL,
|
||||
&gPlayerAnim_link_normal_Fclimb_upR },
|
||||
{ &gPlayerAnim_link_normal_Fclimb_sideL, &gPlayerAnim_link_normal_Fclimb_sideR },
|
||||
{ &gPlayerAnim_clink_normal_climb_endAL, &gPlayerAnim_clink_normal_climb_endAR },
|
||||
{ &gPlayerAnim_clink_normal_climb_endBR, &gPlayerAnim_clink_normal_climb_endBL },
|
||||
&gPlayerAnim_link_normal_Fclimb_upR }, // unk_AC
|
||||
{ &gPlayerAnim_link_normal_Fclimb_sideL, &gPlayerAnim_link_normal_Fclimb_sideR }, // unk_BC
|
||||
{ &gPlayerAnim_clink_normal_climb_endAL, &gPlayerAnim_clink_normal_climb_endAR }, // unk_C4
|
||||
{ &gPlayerAnim_clink_normal_climb_endBR, &gPlayerAnim_clink_normal_climb_endBL }, // unk_CC
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ void EffectSsExtra_Draw(PlayState* play, u32 index, EffectSs* this) {
|
|||
|
||||
void EffectSsExtra_Update(PlayState* play, u32 index, EffectSs* this) {
|
||||
if (this->rTimer != 0) {
|
||||
this->rTimer -= 1;
|
||||
this->rTimer--;
|
||||
} else {
|
||||
this->velocity.y = 0.0f;
|
||||
}
|
||||
|
|
|
@ -379,7 +379,7 @@ void func_809AA230(EffectSs* this, PlayState* play) {
|
|||
this->velocity.z *= func_809A9818(0.9f, 0.2f);
|
||||
|
||||
if (this->rReg8 > 0) {
|
||||
this->rReg8 -= 1;
|
||||
this->rReg8--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1643,7 +1643,7 @@ void FileSelect_Main(GameState* thisx) {
|
|||
|
||||
if (this->stickAdjY < -30) {
|
||||
if (this->stickYDir == -1) {
|
||||
this->inputTimerY -= 1;
|
||||
this->inputTimerY--;
|
||||
if (this->inputTimerY < 0) {
|
||||
this->inputTimerY = 2;
|
||||
} else {
|
||||
|
@ -1655,7 +1655,7 @@ void FileSelect_Main(GameState* thisx) {
|
|||
}
|
||||
} else if (this->stickAdjY > 30) {
|
||||
if (this->stickYDir == 1) {
|
||||
this->inputTimerY -= 1;
|
||||
this->inputTimerY--;
|
||||
if (this->inputTimerY < 0) {
|
||||
this->inputTimerY = 2;
|
||||
} else {
|
||||
|
|
|
@ -161,7 +161,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
|
|||
|
||||
OPEN_DISPS(gfxCtx, "../z_kaleido_collect.c", 248);
|
||||
|
||||
if ((!pauseCtx->mainState /* PAUSE_MAIN_STATE_IDLE */ || (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT) ||
|
||||
if ((((u32)pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) || (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT) ||
|
||||
(pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG)) &&
|
||||
(pauseCtx->pageIndex == PAUSE_QUEST)) {
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
|
|||
while (cursorMoveResult == 0) {
|
||||
if (pauseCtx->stickAdjX < -30) {
|
||||
if (pauseCtx->cursorX[PAUSE_EQUIP] != EQUIP_CURSOR_X_UPG) {
|
||||
pauseCtx->cursorX[PAUSE_EQUIP] -= 1;
|
||||
pauseCtx->cursorX[PAUSE_EQUIP]--;
|
||||
pauseCtx->cursorPoint[PAUSE_EQUIP] -= 1;
|
||||
|
||||
if (pauseCtx->cursorX[PAUSE_EQUIP] == EQUIP_CURSOR_X_UPG) {
|
||||
|
@ -240,7 +240,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
|
|||
}
|
||||
} else {
|
||||
pauseCtx->cursorX[PAUSE_EQUIP] = cursorX;
|
||||
pauseCtx->cursorY[PAUSE_EQUIP] += 1;
|
||||
pauseCtx->cursorY[PAUSE_EQUIP]++;
|
||||
|
||||
if (pauseCtx->cursorY[PAUSE_EQUIP] >= 4) {
|
||||
pauseCtx->cursorY[PAUSE_EQUIP] = 0;
|
||||
|
@ -262,7 +262,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
|
|||
}
|
||||
} else if (pauseCtx->stickAdjX > 30) {
|
||||
if (pauseCtx->cursorX[PAUSE_EQUIP] < 3) {
|
||||
pauseCtx->cursorX[PAUSE_EQUIP] += 1;
|
||||
pauseCtx->cursorX[PAUSE_EQUIP]++;
|
||||
pauseCtx->cursorPoint[PAUSE_EQUIP] += 1;
|
||||
|
||||
if (pauseCtx->cursorX[PAUSE_EQUIP] == EQUIP_CURSOR_X_UPG) {
|
||||
|
@ -276,7 +276,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
|
|||
}
|
||||
} else {
|
||||
pauseCtx->cursorX[PAUSE_EQUIP] = cursorX;
|
||||
pauseCtx->cursorY[PAUSE_EQUIP] += 1;
|
||||
pauseCtx->cursorY[PAUSE_EQUIP]++;
|
||||
|
||||
if (pauseCtx->cursorY[PAUSE_EQUIP] >= 4) {
|
||||
pauseCtx->cursorY[PAUSE_EQUIP] = 0;
|
||||
|
@ -310,7 +310,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
|
|||
while (cursorMoveResult == 0) {
|
||||
if (pauseCtx->stickAdjY > 30) {
|
||||
if (pauseCtx->cursorY[PAUSE_EQUIP] != 0) {
|
||||
pauseCtx->cursorY[PAUSE_EQUIP] -= 1;
|
||||
pauseCtx->cursorY[PAUSE_EQUIP]--;
|
||||
pauseCtx->cursorPoint[PAUSE_EQUIP] -= 4;
|
||||
|
||||
if (pauseCtx->cursorX[PAUSE_EQUIP] == EQUIP_CURSOR_X_UPG) {
|
||||
|
@ -335,7 +335,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
|
|||
}
|
||||
} else if (pauseCtx->stickAdjY < -30) {
|
||||
if (pauseCtx->cursorY[PAUSE_EQUIP] < 3) {
|
||||
pauseCtx->cursorY[PAUSE_EQUIP] += 1;
|
||||
pauseCtx->cursorY[PAUSE_EQUIP]++;
|
||||
pauseCtx->cursorPoint[PAUSE_EQUIP] += 4;
|
||||
|
||||
if (pauseCtx->cursorX[PAUSE_EQUIP] == EQUIP_CURSOR_X_UPG) {
|
||||
|
|
|
@ -179,7 +179,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
|
|||
// if not left-most
|
||||
if (pauseCtx->cursorX[PAUSE_ITEM] != 0) {
|
||||
// move left
|
||||
pauseCtx->cursorX[PAUSE_ITEM] -= 1;
|
||||
pauseCtx->cursorX[PAUSE_ITEM]--;
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] -= 1;
|
||||
|
||||
// if there's an item there, stop there
|
||||
|
@ -191,7 +191,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
|
|||
|
||||
pauseCtx->cursorX[PAUSE_ITEM] = cursorX;
|
||||
|
||||
pauseCtx->cursorY[PAUSE_ITEM] += 1;
|
||||
pauseCtx->cursorY[PAUSE_ITEM]++;
|
||||
if (pauseCtx->cursorY[PAUSE_ITEM] >= ITEM_GRID_ROWS) {
|
||||
pauseCtx->cursorY[PAUSE_ITEM] = 0;
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
|
|||
}
|
||||
} else if (pauseCtx->stickAdjX > 30) {
|
||||
if (pauseCtx->cursorX[PAUSE_ITEM] < (ITEM_GRID_COLS - 1)) {
|
||||
pauseCtx->cursorX[PAUSE_ITEM] += 1;
|
||||
pauseCtx->cursorX[PAUSE_ITEM]++;
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] += 1;
|
||||
|
||||
if (gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) {
|
||||
|
@ -223,7 +223,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
|
|||
}
|
||||
} else {
|
||||
pauseCtx->cursorX[PAUSE_ITEM] = cursorX;
|
||||
pauseCtx->cursorY[PAUSE_ITEM] += 1;
|
||||
pauseCtx->cursorY[PAUSE_ITEM]++;
|
||||
|
||||
if (pauseCtx->cursorY[PAUSE_ITEM] >= ITEM_GRID_ROWS) {
|
||||
pauseCtx->cursorY[PAUSE_ITEM] = 0;
|
||||
|
@ -339,7 +339,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
|
|||
while (moveCursorResult == 0) {
|
||||
if (pauseCtx->stickAdjY > 30) {
|
||||
if (pauseCtx->cursorY[PAUSE_ITEM] != 0) {
|
||||
pauseCtx->cursorY[PAUSE_ITEM] -= 1;
|
||||
pauseCtx->cursorY[PAUSE_ITEM]--;
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] -= ITEM_GRID_COLS;
|
||||
|
||||
if (gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) {
|
||||
|
@ -353,7 +353,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
|
|||
}
|
||||
} else if (pauseCtx->stickAdjY < -30) {
|
||||
if (pauseCtx->cursorY[PAUSE_ITEM] < (ITEM_GRID_ROWS - 1)) {
|
||||
pauseCtx->cursorY[PAUSE_ITEM] += 1;
|
||||
pauseCtx->cursorY[PAUSE_ITEM]++;
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] += ITEM_GRID_COLS;
|
||||
|
||||
if (gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) {
|
||||
|
|
|
@ -1329,7 +1329,7 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
|
|||
|
||||
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA, G_CC_MODULATEIA);
|
||||
|
||||
if (!pauseCtx->pageIndex) { // pageIndex == PAUSE_ITEM
|
||||
if ((u32)pauseCtx->pageIndex == PAUSE_ITEM) {
|
||||
pauseCtx->itemPageRoll = pauseCtx->rollRotSavePrompt_ + 314.0f;
|
||||
|
||||
Matrix_Translate(0.0f, (f32)R_PAUSE_OFFSET_VERTICAL / 100.0f, -pauseCtx->savePromptOffsetDepth_ / 10.0f,
|
||||
|
@ -1703,7 +1703,8 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
|
|||
|
||||
if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->namedItem != PAUSE_ITEM_NONE) &&
|
||||
(pauseCtx->nameDisplayTimer < R_PAUSE_NAME_DISPLAY_TIMER_THRESHOLD_) &&
|
||||
(!pauseCtx->mainState /* PAUSE_MAIN_STATE_IDLE */ || (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PLAYBACK) ||
|
||||
(((u32)pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) ||
|
||||
(pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PLAYBACK) ||
|
||||
((pauseCtx->mainState >= PAUSE_MAIN_STATE_SONG_PROMPT_INIT) &&
|
||||
(pauseCtx->mainState <= PAUSE_MAIN_STATE_EQUIP_CHANGED)
|
||||
/* PAUSE_MAIN_STATE_SONG_PROMPT_INIT, PAUSE_MAIN_STATE_SONG_PROMPT,
|
||||
|
@ -1712,7 +1713,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
|
|||
(pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG)) &&
|
||||
(pauseCtx->cursorSpecialPos == 0)) {
|
||||
|
||||
if (!pauseCtx->mainState /* PAUSE_MAIN_STATE_IDLE */ ||
|
||||
if (((u32)pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) ||
|
||||
(pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PLAYBACK) ||
|
||||
((pauseCtx->mainState >= PAUSE_MAIN_STATE_SONG_PROMPT_INIT) &&
|
||||
(pauseCtx->mainState <= PAUSE_MAIN_STATE_EQUIP_CHANGED)
|
||||
|
@ -1845,7 +1846,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (!pauseCtx->pageIndex) { // pageIndex == PAUSE_ITEM
|
||||
if ((u32)pauseCtx->pageIndex == PAUSE_ITEM) {
|
||||
pauseCtx->infoPanelVtx[16].v.ob[0] = pauseCtx->infoPanelVtx[18].v.ob[0] =
|
||||
WREG(49 + gSaveContext.language);
|
||||
|
||||
|
@ -3480,7 +3481,7 @@ void KaleidoScope_Update(PlayState* play) {
|
|||
PAUSE_STATE_15, PAUSE_STATE_16, PAUSE_STATE_17, PAUSE_STATE_CLOSING */
|
||||
))) {
|
||||
|
||||
if ((!pauseCtx->mainState /* PAUSE_MAIN_STATE_IDLE */ ||
|
||||
if ((((u32)pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) ||
|
||||
(pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG)) &&
|
||||
(pauseCtx->state == PAUSE_STATE_MAIN)) {
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ for directory in dirs:
|
|||
continue
|
||||
|
||||
print("Processing asm//" + directory)
|
||||
|
||||
|
||||
folderName = os.path.splitext(directory)[0]
|
||||
lines = ReadAllLines("asm//" + directory)
|
||||
functions = list()
|
||||
|
@ -65,5 +65,5 @@ for directory in dirs:
|
|||
cLines.insert(len(cLines), "#pragma GLOBAL_ASM(\"asm/non_matchings/code/" + folderName + "/" + func.funcName + ".s\")\n")
|
||||
|
||||
WriteAllLines("c//" + folderName + ".c", cLines)
|
||||
|
||||
|
||||
print("Done!")
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
[subrepo]
|
||||
remote = git@github.com:EllipticEllipsis/fado.git
|
||||
branch = master
|
||||
commit = a0fa828089353ba48e378b281c23100c247b1c92
|
||||
parent = eadc477187888e1ae078d021b4a00b1366f0c9a4
|
||||
commit = 8d896ee97d565508755584803c409fc33bb0c953
|
||||
parent = 9f09505d34619883748a7dab05071883281c14fd
|
||||
method = merge
|
||||
cmdver = 0.4.3
|
||||
cmdver = 0.4.5
|
||||
|
|
|
@ -7,9 +7,9 @@ Contains
|
|||
- **Fado** a program for generating the `.ovl`/relocation section for Zelda64 overlay files
|
||||
- **Mido** an automatic dependency file generator
|
||||
|
||||
Compatible with both IDO and GCC (although [see below](N_B)).
|
||||
Compatible with both IDO and GCC (although [see below](N_B)). Both ordinary MIPS REL sections and RELA sections are now supported.
|
||||
|
||||
Format is the standard "Zelda64" .ovl section, with the relocs divided by section, as used by
|
||||
Output format is the standard "Zelda64" .ovl section, with the relocs divided by section, as used by
|
||||
- *The Legend of Zelda: Ocarina of Time* (all Nintendo 64/Gamecube/iQue releases)
|
||||
- *The Legend of Zelda: Majora's Mask* (all Nintendo 64/Gamecube releases)
|
||||
|
||||
|
|
|
@ -473,6 +473,14 @@ typedef struct {
|
|||
Elf32_Word r_info; /* Relocation type and symbol index */
|
||||
} Elf32_Rel;
|
||||
|
||||
/* Relocation table entry with addend (in section of type SHT_RELA). */
|
||||
|
||||
typedef struct {
|
||||
Elf32_Addr r_offset; /* Address */
|
||||
Elf32_Word r_info; /* Relocation type and symbol index */
|
||||
Elf32_Sword r_addend; /* Addend */
|
||||
} Elf32_Rela;
|
||||
|
||||
/* How to extract and insert information held in the r_info field. */
|
||||
|
||||
#define ELF32_R_SYM(val) ((val) >> 8)
|
||||
|
|
|
@ -105,7 +105,7 @@ bool Fairy_StartsWith(const char* string, const char* initial) {
|
|||
|
||||
FairyFileHeader* Fairy_ReadFileHeader(FairyFileHeader* header, FILE* file) {
|
||||
fseek(file, 0, SEEK_SET);
|
||||
assert(fread(header, 0x34, 1, file) != 0);
|
||||
assert(fread(header, sizeof(char), 0x34, file) == 0x34);
|
||||
|
||||
if (!Fairy_VerifyMagic(header->e_ident)) {
|
||||
fprintf(stderr, "Not a valid ELF file.\n");
|
||||
|
@ -150,7 +150,7 @@ FairySecHeader* Fairy_ReadSectionTable(FairySecHeader* sectionTable, FILE* file,
|
|||
size_t tableSize = number * entrySize;
|
||||
|
||||
fseek(file, tableOffset, SEEK_SET);
|
||||
assert(fread(sectionTable, tableSize, 1, file) != 0);
|
||||
assert(fread(sectionTable, sizeof(char), tableSize, file) == tableSize);
|
||||
|
||||
/* Since the section table happens to only have entries of width 4, we can byteswap it by pretending it is a raw
|
||||
* uint32_t array */
|
||||
|
@ -165,13 +165,21 @@ FairySecHeader* Fairy_ReadSectionTable(FairySecHeader* sectionTable, FILE* file,
|
|||
return sectionTable;
|
||||
}
|
||||
|
||||
FairySym* Fairy_ReadSymbolTable(FairySym* symbolTable, FILE* file, size_t tableOffset, size_t tableSize) {
|
||||
size_t Fairy_ReadSymbolTable(FairySym** symbolTableOut, FILE* file, size_t tableOffset, size_t tableSize) {
|
||||
size_t number = tableSize / sizeof(FairySym);
|
||||
FairySym* symbolTable = malloc(tableSize);
|
||||
|
||||
fseek(file, tableOffset, SEEK_SET);
|
||||
assert(fread(symbolTable, tableSize, 1, file) != 0);
|
||||
*symbolTableOut = NULL;
|
||||
|
||||
/* Reend the variables that are larger than bytes */
|
||||
if (symbolTable == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (fseek(file, tableOffset, SEEK_SET) != 0 || fread(symbolTable, sizeof(char), tableSize, file) != tableSize) {
|
||||
free(symbolTable);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Reend the variables that are wider than bytes */
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < number; i++) {
|
||||
|
@ -182,31 +190,65 @@ FairySym* Fairy_ReadSymbolTable(FairySym* symbolTable, FILE* file, size_t tableO
|
|||
}
|
||||
}
|
||||
|
||||
return symbolTable;
|
||||
*symbolTableOut = symbolTable;
|
||||
return number;
|
||||
}
|
||||
|
||||
/* Can be used for both the section header string table and the strtab */
|
||||
char* Fairy_ReadStringTable(char* stringTable, FILE* file, size_t tableOffset, size_t tableSize) {
|
||||
fseek(file, tableOffset, SEEK_SET);
|
||||
assert(fread(stringTable, tableSize, 1, file) != 0);
|
||||
assert(fread(stringTable, sizeof(char), tableSize, file) == tableSize);
|
||||
return stringTable;
|
||||
}
|
||||
|
||||
/* offset and number are attained from the section table */
|
||||
FairyRel* Fairy_ReadRelocs(FairyRel* relocTable, FILE* file, size_t offset, size_t size) {
|
||||
fseek(file, offset, SEEK_SET);
|
||||
assert(fread(relocTable, size, 1, file) != 0);
|
||||
/* offset and number are attained from the section table, the returned pointer must be freed */
|
||||
size_t Fairy_ReadRelocs(FairyRela** relocsOut, FILE* file, int type, size_t offset, size_t size) {
|
||||
/* Final size of the relocation table, relocations of type SHT_REL need more space for extra addend of 0 */
|
||||
size_t finalSize = (type == SHT_REL) ? ((size * sizeof(FairyRela)) / sizeof(FairyRel)) : size;
|
||||
void* readBuf = malloc(size);
|
||||
FairyRela* relocTable = malloc(finalSize);
|
||||
|
||||
/* Reend the variables that are larger than bytes */
|
||||
*relocsOut = NULL;
|
||||
|
||||
if (readBuf == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (relocTable == NULL) {
|
||||
free(readBuf);
|
||||
return 0;
|
||||
}
|
||||
if (fseek(file, offset, SEEK_SET) != 0 || fread(readBuf, sizeof(char), size, file) != size) {
|
||||
free(readBuf);
|
||||
free(relocTable);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Reend the variables that are wider than bytes */
|
||||
{
|
||||
size_t i;
|
||||
uint32_t* data = (uint32_t*)relocTable;
|
||||
uint32_t* data = (uint32_t*)readBuf;
|
||||
for (i = 0; i < size / sizeof(uint32_t); i++) {
|
||||
data[i] = REEND32(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return relocTable;
|
||||
/* Make the relocation table, for SHT_REL sections add an addend of 0 */
|
||||
if (type == SHT_REL) {
|
||||
size_t i;
|
||||
FairyRel* rel = (FairyRel*)readBuf;
|
||||
|
||||
for (i = 0; i < size / sizeof(FairyRel); i++) {
|
||||
relocTable[i].r_info = rel[i].r_info;
|
||||
relocTable[i].r_offset = rel[i].r_offset;
|
||||
relocTable[i].r_addend = 0;
|
||||
}
|
||||
} else {
|
||||
memcpy(relocTable, readBuf, size);
|
||||
}
|
||||
free(readBuf);
|
||||
|
||||
*relocsOut = relocTable;
|
||||
return finalSize / sizeof(FairyRela);
|
||||
}
|
||||
|
||||
char* Fairy_GetSectionName(FairySecHeader* sectionTable, char* shstrtab, size_t index) {
|
||||
|
@ -240,7 +282,8 @@ void Fairy_InitFile(FairyFileInfo* fileInfo, FILE* file) {
|
|||
|
||||
shstrtab = malloc(sectionTable[fileHeader.e_shstrndx].sh_size * sizeof(char));
|
||||
fseek(file, sectionTable[fileHeader.e_shstrndx].sh_offset, SEEK_SET);
|
||||
assert(fread(shstrtab, sectionTable[fileHeader.e_shstrndx].sh_size, 1, file) != 0);
|
||||
assert(fread(shstrtab, sizeof(char), sectionTable[fileHeader.e_shstrndx].sh_size, file) ==
|
||||
sectionTable[fileHeader.e_shstrndx].sh_size);
|
||||
|
||||
/* Search for the sections we need */
|
||||
{
|
||||
|
@ -251,6 +294,8 @@ void Fairy_InitFile(FairyFileInfo* fileInfo, FILE* file) {
|
|||
}
|
||||
|
||||
for (currentIndex = 0; currentIndex < fileHeader.e_shnum; currentIndex++) {
|
||||
size_t off = 0;
|
||||
|
||||
currentSection = sectionTable[currentIndex];
|
||||
|
||||
switch (currentSection.sh_type) {
|
||||
|
@ -299,10 +344,11 @@ void Fairy_InitFile(FairyFileInfo* fileInfo, FILE* file) {
|
|||
|
||||
case SHT_SYMTAB:
|
||||
if (strcmp(&shstrtab[currentSection.sh_name + 1], "symtab") == 0) {
|
||||
fileInfo->symtabInfo.sectionSize = currentSection.sh_size;
|
||||
fileInfo->symtabInfo.sectionData = malloc(currentSection.sh_size);
|
||||
Fairy_ReadSymbolTable(fileInfo->symtabInfo.sectionData, file, currentSection.sh_offset,
|
||||
currentSection.sh_size);
|
||||
fileInfo->symtabInfo.sectionType = SHT_SYMTAB;
|
||||
fileInfo->symtabInfo.sectionEntrySize = sizeof(FairySym);
|
||||
fileInfo->symtabInfo.sectionEntryCount =
|
||||
Fairy_ReadSymbolTable((FairySym**)&fileInfo->symtabInfo.sectionData, file,
|
||||
currentSection.sh_offset, currentSection.sh_size);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -314,30 +360,32 @@ void Fairy_InitFile(FairyFileInfo* fileInfo, FILE* file) {
|
|||
}
|
||||
break;
|
||||
|
||||
case SHT_RELA:
|
||||
off += 1;
|
||||
case SHT_REL:
|
||||
off += 5;
|
||||
/* This assumes only one reloc section of each name */
|
||||
// TODO: is this a problem?
|
||||
{
|
||||
FairySection relocSection = FAIRY_SECTION_OTHER;
|
||||
|
||||
/* Ignore the first 5 chars, which will always be ".rel." */
|
||||
if (strcmp(&shstrtab[currentSection.sh_name + 5], "text") == 0) {
|
||||
/* Ignore the first 5/6 chars, which will always be ".rel."/".rela." */
|
||||
if (strcmp(&shstrtab[currentSection.sh_name + off], "text") == 0) {
|
||||
relocSection = FAIRY_SECTION_TEXT;
|
||||
FAIRY_DEBUG_PRINTF("%s", "Found rel.text section\n");
|
||||
} else if (strcmp(&shstrtab[currentSection.sh_name + 5], "data") == 0) {
|
||||
} else if (strcmp(&shstrtab[currentSection.sh_name + off], "data") == 0) {
|
||||
relocSection = FAIRY_SECTION_DATA;
|
||||
FAIRY_DEBUG_PRINTF("%s", "Found rel.data section\n");
|
||||
} else if (strcmp(&shstrtab[currentSection.sh_name + 5], "rodata") == 0) {
|
||||
} else if (strcmp(&shstrtab[currentSection.sh_name + off], "rodata") == 0) {
|
||||
relocSection = FAIRY_SECTION_RODATA;
|
||||
FAIRY_DEBUG_PRINTF("%s", "Found rel.rodata section\n");
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
FAIRY_DEBUG_PRINTF("Found %s section\n", &shstrtab[currentSection.sh_name]);
|
||||
|
||||
fileInfo->relocTablesInfo[relocSection].sectionSize = currentSection.sh_size;
|
||||
fileInfo->relocTablesInfo[relocSection].sectionData = malloc(currentSection.sh_size);
|
||||
Fairy_ReadRelocs(fileInfo->relocTablesInfo[relocSection].sectionData, file,
|
||||
currentSection.sh_offset, currentSection.sh_size);
|
||||
fileInfo->relocTablesInfo[relocSection].sectionType = SHT_RELA;
|
||||
fileInfo->relocTablesInfo[relocSection].sectionEntrySize = sizeof(FairyRela);
|
||||
fileInfo->relocTablesInfo[relocSection].sectionEntryCount =
|
||||
Fairy_ReadRelocs((FairyRela**)&fileInfo->relocTablesInfo[relocSection].sectionData, file,
|
||||
currentSection.sh_type, currentSection.sh_offset, currentSection.sh_size);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ typedef Elf32_Ehdr FairyFileHeader;
|
|||
typedef Elf32_Shdr FairySecHeader;
|
||||
typedef Elf32_Sym FairySym;
|
||||
typedef Elf32_Rel FairyRel;
|
||||
typedef Elf32_Rela FairyRela;
|
||||
|
||||
typedef struct {
|
||||
int define;
|
||||
|
@ -32,7 +33,9 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
void* sectionData;
|
||||
size_t sectionSize;
|
||||
int sectionType;
|
||||
size_t sectionEntryCount;
|
||||
size_t sectionEntrySize;
|
||||
} FairySectionInfo;
|
||||
|
||||
typedef struct {
|
||||
|
@ -60,9 +63,9 @@ bool Fairy_StartsWith(const char* string, const char* initial);
|
|||
|
||||
FairyFileHeader* Fairy_ReadFileHeader(FairyFileHeader* header, FILE* file);
|
||||
FairySecHeader* Fairy_ReadSectionTable(FairySecHeader* sectionTable, FILE* file, size_t tableOffset, size_t number);
|
||||
FairySym* Fairy_ReadSymbolTable(FairySym* symbolTable, FILE* file, size_t tableOffset, size_t tableSize);
|
||||
char* Fairy_ReadStringTable(char* stringTable, FILE* file, size_t tableOffset, size_t tableSize);
|
||||
FairyRel* Fairy_ReadRelocs(FairyRel* relocTable, FILE* file, size_t offset, size_t number);
|
||||
size_t Fairy_ReadSymbolTable(FairySym** symbolTableOut, FILE* file, size_t tableOffset, size_t tableSize);
|
||||
size_t Fairy_ReadRelocs(FairyRela** relocsOut, FILE* file, int type, size_t offset, size_t size);
|
||||
|
||||
char* Fairy_GetSectionName(FairySecHeader* sectionTable, char* shstrtab, size_t index);
|
||||
char* Fairy_GetSymbolName(FairySym* symtab, char* strtab, size_t index);
|
||||
|
|
|
@ -32,7 +32,7 @@ void Fairy_PrintSymbolTable(FILE* inputFile) {
|
|||
shstrtab = malloc(sectionTable[shstrndx].sh_size * sizeof(char));
|
||||
|
||||
fseek(inputFile, sectionTable[shstrndx].sh_offset, SEEK_SET);
|
||||
assert(fread(shstrtab, sectionTable[shstrndx].sh_size, 1, inputFile) != 0);
|
||||
assert(fread(shstrtab, sizeof(char), sectionTable[shstrndx].sh_size, inputFile) == sectionTable[shstrndx].sh_size);
|
||||
|
||||
{
|
||||
size_t currentIndex;
|
||||
|
@ -44,9 +44,8 @@ void Fairy_PrintSymbolTable(FILE* inputFile) {
|
|||
case SHT_SYMTAB:
|
||||
if (strcmp(&shstrtab[currentHeader.sh_name], ".symtab") == 0) {
|
||||
printf("symtab found\n");
|
||||
symbolTableNum = currentHeader.sh_size / sizeof(FairySym);
|
||||
symbolTable = malloc(currentHeader.sh_size);
|
||||
Fairy_ReadSymbolTable(symbolTable, inputFile, currentHeader.sh_offset, currentHeader.sh_size);
|
||||
symbolTableNum = Fairy_ReadSymbolTable(&symbolTable, inputFile, currentHeader.sh_offset,
|
||||
currentHeader.sh_size);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -74,7 +73,8 @@ void Fairy_PrintSymbolTable(FILE* inputFile) {
|
|||
printf("and mallocked\n");
|
||||
fseek(inputFile, sectionTable[strtabndx].sh_offset, SEEK_SET);
|
||||
printf("file offset sought: %X\n", sectionTable[strtabndx].sh_offset);
|
||||
assert(fread(strtab, sectionTable[strtabndx].sh_size, 1, inputFile) != 0);
|
||||
assert(fread(strtab, sizeof(char), sectionTable[strtabndx].sh_size, inputFile) ==
|
||||
sectionTable[strtabndx].sh_size);
|
||||
printf("file read\n");
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ void Fairy_PrintSymbolTable(FILE* inputFile) {
|
|||
void Fairy_PrintRelocs(FILE* inputFile) {
|
||||
FairyFileHeader fileHeader;
|
||||
FairySecHeader* sectionTable;
|
||||
FairyRel* relocs;
|
||||
FairyRela* relocs;
|
||||
size_t shstrndx;
|
||||
char* shstrtab;
|
||||
size_t currentSection;
|
||||
|
@ -131,29 +131,28 @@ void Fairy_PrintRelocs(FILE* inputFile) {
|
|||
shstrtab = malloc(sectionTable[shstrndx].sh_size * sizeof(char));
|
||||
|
||||
fseek(inputFile, sectionTable[shstrndx].sh_offset, SEEK_SET);
|
||||
assert(fread(shstrtab, sectionTable[shstrndx].sh_size, 1, inputFile) != 0);
|
||||
assert(fread(shstrtab, sizeof(char), sectionTable[shstrndx].sh_size, inputFile) == sectionTable[shstrndx].sh_size);
|
||||
|
||||
for (currentSection = 0; currentSection < fileHeader.e_shnum; currentSection++) {
|
||||
if (sectionTable[currentSection].sh_type != SHT_REL) {
|
||||
size_t nRelocs;
|
||||
|
||||
if (sectionTable[currentSection].sh_type != SHT_REL || sectionTable[currentSection].sh_type != SHT_RELA) {
|
||||
continue;
|
||||
}
|
||||
printf("Section size: %d\n", sectionTable[currentSection].sh_size);
|
||||
|
||||
relocs = malloc(sectionTable[currentSection].sh_size * sizeof(char));
|
||||
|
||||
Fairy_ReadRelocs(relocs, inputFile, sectionTable[currentSection].sh_offset,
|
||||
sectionTable[currentSection].sh_size);
|
||||
nRelocs = Fairy_ReadRelocs(&relocs, inputFile, sectionTable[currentSection].sh_type,
|
||||
sectionTable[currentSection].sh_offset, sectionTable[currentSection].sh_size);
|
||||
|
||||
// fseek(inputFile, sectionTable[currentSection].sh_offset, SEEK_SET);
|
||||
// assert(fread(relocs, sectionTable[currentSection].sh_size, 1, inputFile) != 0);
|
||||
// assert(fread(relocs, sizeof(char), sectionTable[currentSection].sh_size, inputFile) ==
|
||||
// sectionTable[currentSection].sh_size);
|
||||
|
||||
printf("Relocs in section [%2zd]: %s:\n", currentSection, shstrtab + sectionTable[currentSection].sh_name);
|
||||
printf("Offset Info Type Symbol\n");
|
||||
{
|
||||
size_t currentReloc;
|
||||
for (currentReloc = 0; currentReloc < sectionTable[currentSection].sh_size / sizeof(*relocs);
|
||||
currentReloc++) {
|
||||
|
||||
for (currentReloc = 0; currentReloc < nRelocs; currentReloc++) {
|
||||
printf("%08X,%08X ", relocs[currentReloc].r_offset, relocs[currentReloc].r_info);
|
||||
|
||||
switch (ELF32_R_TYPE(relocs[currentReloc].r_info)) {
|
||||
|
@ -212,7 +211,7 @@ void Fairy_PrintSectionTable(FILE* inputFile) {
|
|||
shstrtab = malloc(sectionTable[shstrndx].sh_size * sizeof(char));
|
||||
|
||||
fseek(inputFile, sectionTable[shstrndx].sh_offset, SEEK_SET);
|
||||
assert(fread(shstrtab, sectionTable[shstrndx].sh_size, 1, inputFile) != 0);
|
||||
assert(fread(shstrtab, sizeof(char), sectionTable[shstrndx].sh_size, inputFile) == sectionTable[shstrndx].sh_size);
|
||||
|
||||
printf("[Nr] Name Type Addr Off Size ES Flg Lk Inf Al\n");
|
||||
for (currentSection = 0; currentSection < fileHeader.e_shnum; currentSection++) {
|
||||
|
@ -261,7 +260,7 @@ const char* relSectionStrings[] = {
|
|||
".rodata",
|
||||
};
|
||||
|
||||
static uint32_t Fairy_PackReloc(FairyOverlayRelSection sec, FairyRel rel) {
|
||||
static uint32_t Fairy_PackReloc(FairyOverlayRelSection sec, FairyRela rel) {
|
||||
return (sec << 0x1E) | (ELF32_R_TYPE(rel.r_info) << 0x18) | rel.r_offset;
|
||||
}
|
||||
|
||||
|
@ -290,7 +289,7 @@ void Fairy_PrintSectionSizes(FairySecHeader* sectionTable, FILE* inputFile, size
|
|||
bool strtabFound = false;
|
||||
/* Count the reloc sections */
|
||||
for (currentSection = 0; currentSection < number; currentSection++) {
|
||||
if (sectionTable[currentSection].sh_type == SHT_REL) {
|
||||
if (sectionTable[currentSection].sh_type == SHT_REL || sectionTable[currentSection].sh_type == SHT_RELA) {
|
||||
relocSectionsCount++;
|
||||
}
|
||||
}
|
||||
|
@ -301,6 +300,8 @@ void Fairy_PrintSectionSizes(FairySecHeader* sectionTable, FILE* inputFile, size
|
|||
|
||||
/* Find the section sizes and the reloc sections */
|
||||
for (currentSection = 0; currentSection < number; currentSection++) {
|
||||
size_t off = 0;
|
||||
|
||||
currentHeader = sectionTable[currentSection];
|
||||
sectionName = &shstrtab[currentHeader.sh_name + 1]; /* ignore the initial '.' */
|
||||
switch (currentHeader.sh_type) {
|
||||
|
@ -329,17 +330,19 @@ void Fairy_PrintSectionSizes(FairySecHeader* sectionTable, FILE* inputFile, size
|
|||
}
|
||||
break;
|
||||
|
||||
case SHT_RELA:
|
||||
off += 1;
|
||||
case SHT_REL:
|
||||
relocSectionIndices[currentRelocSection] = currentSection;
|
||||
sectionName += 4; /* ignore the "rel." part */
|
||||
if (Fairy_StartsWith(sectionName, "rodata")) {
|
||||
printf(".rel.rodata\n");
|
||||
off += 4; /* ignore the "rel."/"rela." part */
|
||||
if (Fairy_StartsWith(§ionName[off], "rodata")) {
|
||||
printf("%s\n", sectionName);
|
||||
relocSectionSection[currentRelocSection] = REL_SECTION_RODATA;
|
||||
} else if (Fairy_StartsWith(sectionName, "data")) {
|
||||
printf(".rel.data\n");
|
||||
} else if (Fairy_StartsWith(§ionName[off], "data")) {
|
||||
printf("%s\n", sectionName);
|
||||
relocSectionSection[currentRelocSection] = REL_SECTION_DATA;
|
||||
} else if (Fairy_StartsWith(sectionName, "text")) {
|
||||
printf(".rel.text\n");
|
||||
} else if (Fairy_StartsWith(§ionName[off], "text")) {
|
||||
printf("%s\n", sectionName);
|
||||
relocSectionSection[currentRelocSection] = REL_SECTION_TEXT;
|
||||
}
|
||||
|
||||
|
@ -373,36 +376,34 @@ void Fairy_PrintSectionSizes(FairySecHeader* sectionTable, FILE* inputFile, size
|
|||
printf(".word 0x%08X # .bss size\n\n", bssSize);
|
||||
|
||||
if (!symtabFound) {
|
||||
fprintf(stderr, "Symbol table not found");
|
||||
fprintf(stderr, "Symbol table not found\n");
|
||||
return;
|
||||
}
|
||||
/* Obtain the symbol table */
|
||||
symtab = malloc(symtabHeader.sh_size);
|
||||
|
||||
// TODO: Consider replacing this with a lighter-weight read: sufficient to get the name, shndx
|
||||
Fairy_ReadSymbolTable(symtab, inputFile, symtabHeader.sh_offset, symtabHeader.sh_size);
|
||||
Fairy_ReadSymbolTable(&symtab, inputFile, symtabHeader.sh_offset, symtabHeader.sh_size);
|
||||
|
||||
if (!strtabFound) {
|
||||
fprintf(stderr, "String table not found");
|
||||
fprintf(stderr, "String table not found\n");
|
||||
} else {
|
||||
/* Obtain the string table */
|
||||
strtab = malloc(strtabHeader.sh_size);
|
||||
fseek(inputFile, strtabHeader.sh_offset, SEEK_SET);
|
||||
assert(fread(strtab, strtabHeader.sh_size, 1, inputFile) != 0);
|
||||
assert(fread(strtab, sizeof(char), strtabHeader.sh_size, inputFile) == strtabHeader.sh_size);
|
||||
}
|
||||
|
||||
/* Do single-file relocs */
|
||||
{
|
||||
FairyRel* relocs;
|
||||
FairyRela* relocs;
|
||||
for (currentSection = 0; currentSection < relocSectionsCount; currentSection++) {
|
||||
size_t currentReloc;
|
||||
size_t sectionRelocCount;
|
||||
currentHeader = sectionTable[relocSectionIndices[currentSection]];
|
||||
sectionRelocCount = currentHeader.sh_size / sizeof(FairyRel);
|
||||
relocs = malloc(currentHeader.sh_size);
|
||||
Fairy_ReadRelocs(relocs, inputFile, currentHeader.sh_offset, currentHeader.sh_size);
|
||||
size_t nRelocs;
|
||||
|
||||
for (currentReloc = 0; currentReloc < sectionRelocCount; currentReloc++) {
|
||||
currentHeader = sectionTable[relocSectionIndices[currentSection]];
|
||||
nRelocs = Fairy_ReadRelocs(&relocs, inputFile, currentHeader.sh_type, currentHeader.sh_offset,
|
||||
currentHeader.sh_size);
|
||||
|
||||
for (currentReloc = 0; currentReloc < nRelocs; currentReloc++) {
|
||||
FairySym symbol = symtab[ELF32_R_SYM(relocs[currentReloc].r_info)];
|
||||
if (symbol.st_shndx == SHN_UNDEF) {
|
||||
continue; // TODO: this is where multifile has to look elsewhere
|
||||
|
@ -453,7 +454,7 @@ void PrintZeldaReloc(FILE* inputFile) {
|
|||
shstrtab = malloc(sectionTable[shstrndx].sh_size * sizeof(char));
|
||||
|
||||
fseek(inputFile, sectionTable[shstrndx].sh_offset, SEEK_SET);
|
||||
assert(fread(shstrtab, sectionTable[shstrndx].sh_size, 1, inputFile) != 0);
|
||||
assert(fread(shstrtab, sizeof(char), sectionTable[shstrndx].sh_size, inputFile) == sectionTable[shstrndx].sh_size);
|
||||
|
||||
Fairy_PrintSectionSizes(sectionTable, inputFile, fileHeader.e_shentsize * fileHeader.e_shnum, shstrtab);
|
||||
|
||||
|
|
|
@ -112,15 +112,15 @@ bool vc_vector_is_equals(vc_vector* vector1, vc_vector* vector2) {
|
|||
return memcmp(vector1->data, vector2->data, size_vector1) == 0;
|
||||
}
|
||||
|
||||
float vc_vector_get_growth_factor() {
|
||||
float vc_vector_get_growth_factor(void) {
|
||||
return GROWTH_FACTOR;
|
||||
}
|
||||
|
||||
size_t vc_vector_get_default_count_of_elements() {
|
||||
size_t vc_vector_get_default_count_of_elements(void) {
|
||||
return DEFAULT_COUNT_OF_ELEMENTS;
|
||||
}
|
||||
|
||||
size_t vc_vector_struct_size() {
|
||||
size_t vc_vector_struct_size(void) {
|
||||
return sizeof(vc_vector);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,13 +24,13 @@ void vc_vector_release(vc_vector* vector);
|
|||
bool vc_vector_is_equals(vc_vector* vector1, vc_vector* vector2);
|
||||
|
||||
// Returns constant value of the vector growth factor.
|
||||
float vc_vector_get_growth_factor();
|
||||
float vc_vector_get_growth_factor(void);
|
||||
|
||||
// Returns constant value of the vector default count of elements.
|
||||
size_t vc_vector_get_default_count_of_elements();
|
||||
size_t vc_vector_get_default_count_of_elements(void);
|
||||
|
||||
// Returns constant value of the vector struct size.
|
||||
size_t vc_vector_struct_size();
|
||||
size_t vc_vector_struct_size(void);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Element access
|
||||
|
|
|
@ -40,8 +40,7 @@ void Fado_ConstructStringVectors(vc_vector** stringVectors, FairyFileInfo* fileI
|
|||
stringVectors[currentFile] = vc_vector_create(0x40, sizeof(char**), NULL);
|
||||
|
||||
/* Build a vector of pointers to defined symbols' names */
|
||||
for (currentSym = 0; currentSym < fileInfo[currentFile].symtabInfo.sectionSize / sizeof(FairySym);
|
||||
currentSym++) {
|
||||
for (currentSym = 0; currentSym < fileInfo[currentFile].symtabInfo.sectionEntryCount; currentSym++) {
|
||||
if ((symtab[currentSym].st_shndx != STN_UNDEF) &&
|
||||
Fado_CheckInProgBitsSections(symtab[currentSym].st_shndx, fileInfo[currentFile].progBitsSections)) {
|
||||
/* Have to pass a double pointer so it copies the pointer instead of the start of the string */
|
||||
|
@ -86,7 +85,7 @@ typedef struct {
|
|||
} FadoRelocInfo;
|
||||
|
||||
/* Construct the Zelda64ovl-compatible reloc word from an ELF reloc */
|
||||
FadoRelocInfo Fado_MakeReloc(int file, FairySection section, FairyRel* data) {
|
||||
FadoRelocInfo Fado_MakeReloc(int file, FairySection section, FairyRela* data) {
|
||||
FadoRelocInfo relocInfo = { 0 };
|
||||
uint32_t sectionPrefix = 0;
|
||||
|
||||
|
@ -223,11 +222,10 @@ void Fado_Relocs(FILE* outputFile, int inputFilesCount, FILE** inputFiles, const
|
|||
relocList[section] = vc_vector_create(0x100, sizeof(FadoRelocInfo), NULL);
|
||||
|
||||
for (currentFile = 0; currentFile < inputFilesCount; currentFile++) {
|
||||
FairyRel* relSection = fileInfos[currentFile].relocTablesInfo[section].sectionData;
|
||||
if (relSection != NULL) {
|
||||
FairyRela* relSection = fileInfos[currentFile].relocTablesInfo[section].sectionData;
|
||||
|
||||
for (relocIndex = 0;
|
||||
relocIndex < fileInfos[currentFile].relocTablesInfo[section].sectionSize / sizeof(FairyRel);
|
||||
if (relSection != NULL) {
|
||||
for (relocIndex = 0; relocIndex < fileInfos[currentFile].relocTablesInfo[section].sectionEntryCount;
|
||||
relocIndex++) {
|
||||
FadoRelocInfo currentReloc = Fado_MakeReloc(currentFile, section, &relSection[relocIndex]);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include "version.inc"
|
||||
|
||||
void PrintVersion() {
|
||||
void PrintVersion(void) {
|
||||
printf("Fado (Fairy-Assisted relocations for Decompiled Overlays), version %s\n", versionNumber);
|
||||
printf("Copyright (C) 2021 Elliptic Ellipsis\n");
|
||||
printf("%s\n", credits);
|
||||
|
@ -88,7 +88,7 @@ static size_t posArgCount = ARRAY_COUNT(posArgInfo);
|
|||
static size_t optCount = ARRAY_COUNT(optInfo);
|
||||
static struct option longOptions[ARRAY_COUNT(optInfo)];
|
||||
|
||||
void ConstructLongOpts() {
|
||||
void ConstructLongOpts(void) {
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < optCount; i++) {
|
||||
|
@ -133,14 +133,15 @@ int main(int argc, char** argv) {
|
|||
outputFileName = optarg;
|
||||
outputFile = fopen(optarg, "wb");
|
||||
if (outputFile == NULL) {
|
||||
fprintf(stderr, "error: unable to open output file '%s' for writing", optarg);
|
||||
fprintf(stderr, "error: unable to open output file '%s' for writing\n", optarg);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
if (sscanf(optarg, "%u", &gVerbosity) == 0) {
|
||||
fprintf(stderr, "warning: verbosity argument '%s' should be a nonnegative decimal integer", optarg);
|
||||
fprintf(stderr, "warning: verbosity argument '%s' should be a nonnegative decimal integer\n",
|
||||
optarg);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -182,7 +183,7 @@ int main(int argc, char** argv) {
|
|||
FAIRY_INFO_PRINTF("Using input file %s\n", argv[optind + i]);
|
||||
inputFiles[i] = fopen(argv[optind + i], "rb");
|
||||
if (inputFiles[i] == NULL) {
|
||||
fprintf(stderr, "error: unable to open input file '%s' for reading", argv[optind + i]);
|
||||
fprintf(stderr, "error: unable to open input file '%s' for reading\n", argv[optind + i]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -214,14 +215,14 @@ int main(int argc, char** argv) {
|
|||
FILE* dependencyFile = fopen(dependencyFileName, "w");
|
||||
|
||||
if (dependencyFile == NULL) {
|
||||
fprintf(stderr, "error: unable to open dependency file '%s' for writing", dependencyFileName);
|
||||
fprintf(stderr, "error: unable to open dependency file '%s' for writing\n", dependencyFileName);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
strcpy(objectFile, outputFileName);
|
||||
extensionStart = strrchr(objectFile, '.');
|
||||
if (extensionStart == objectFile + fileNameLength) {
|
||||
fprintf(stderr, "error: file name should not end in a '.'");
|
||||
fprintf(stderr, "error: file name should not end in a '.'\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
strcpy(extensionStart, ".o");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (C) 2021 Elliptic Ellipsis */
|
||||
/* SPDX-License-Identifier: AGPL-3.0-only */
|
||||
const char versionNumber[] = "1.2.1";
|
||||
const char credits[] = "Written by Elliptic Ellipsis\nand AngheloAlf";
|
||||
const char versionNumber[] = "1.3.1";
|
||||
const char credits[] = "Written by Elliptic Ellipsis\nwith additions from AngheloAlf and Tharo";
|
||||
const char repo[] = "https://github.com/EllipticEllipsis/fado/";
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
#include "spec.h"
|
||||
#include "util.h"
|
||||
|
||||
// Note: *SECTION ALIGNMENT* Object files built with a compiler such as GCC can, by default, use narrower
|
||||
// Note: *SECTION ALIGNMENT* Object files built with a compiler such as GCC can, by default, use narrower
|
||||
// alignment for sections size, compared to IDO padding sections to a 0x10-aligned size.
|
||||
// To properly generate relocations relative to section starts, sections currently need to be aligned
|
||||
// explicitly (to 0x10 currently, a narrower alignment might work), otherwise the linker does implicit alignment
|
||||
// and inserts padding between the address indicated by section start symbols (such as *SegmentRoDataStart) and
|
||||
// To properly generate relocations relative to section starts, sections currently need to be aligned
|
||||
// explicitly (to 0x10 currently, a narrower alignment might work), otherwise the linker does implicit alignment
|
||||
// and inserts padding between the address indicated by section start symbols (such as *SegmentRoDataStart) and
|
||||
// the actual aligned start of the section.
|
||||
// With IDO, the padding of sections to an aligned size makes the section start at aligned addresses out of the box,
|
||||
// With IDO, the padding of sections to an aligned size makes the section start at aligned addresses out of the box,
|
||||
// so the explicit alignment has no further effect.
|
||||
|
||||
struct Segment *g_segments;
|
||||
|
|
|
@ -309,7 +309,7 @@ def cvt(m):
|
|||
|
||||
doubles = re.compile(r"(?<!\\)(\"\")")
|
||||
def fixup_message(message):
|
||||
return re.sub(doubles, cvt, ("\"" + message.replace("\n","\\n\"\n\"") + "\"")).replace("\n ","\n").replace("BOX_BREAK\"","\nBOX_BREAK\n\"").replace("BOX_BREAK ","\nBOX_BREAK\n").strip()
|
||||
return re.sub(doubles, cvt, ("\"" + message.replace("\n","\\n\"\n\"") + "\"")).replace("\n ","\n").replace("BOX_BREAK\"","\nBOX_BREAK\n\"").replace("BOX_BREAK ","\nBOX_BREAK\n").replace(" \n", "\n").strip()
|
||||
###
|
||||
|
||||
def dump_all_text():
|
||||
|
@ -391,7 +391,7 @@ def extract_all_text(text_out, staff_text_out):
|
|||
out += "\n#endif"
|
||||
out += "\n\n"
|
||||
|
||||
with open(text_out, "w") as outfile:
|
||||
with open(text_out, "w", encoding="utf8") as outfile:
|
||||
outfile.write(out.strip() + "\n")
|
||||
|
||||
if staff_text_out is not None:
|
||||
|
@ -402,5 +402,5 @@ def extract_all_text(text_out, staff_text_out):
|
|||
|
||||
out += f"DEFINE_MESSAGE(0x{message[0]:04X}, {textbox_type[message[1]]}, {textbox_ypos[message[2]]},\n{message[3]}\n)\n\n"
|
||||
|
||||
with open(staff_text_out, "w") as outfile:
|
||||
with open(staff_text_out, "w", encoding="utf8") as outfile:
|
||||
outfile.write(out.strip() + "\n")
|
||||
|
|
|
@ -153,7 +153,7 @@ STMTId get_stmt_id_by_stmt_name(const char *stmtName, int lineNum) {
|
|||
|
||||
bool parse_segment_statement(struct Segment *currSeg, STMTId stmt, char* args, int lineNum) {
|
||||
// ensure no duplicates (except for 'include' or 'pad_text')
|
||||
if (stmt != STMT_include && stmt != STMT_include_data_with_rodata && stmt != STMT_pad_text &&
|
||||
if (stmt != STMT_include && stmt != STMT_include_data_with_rodata && stmt != STMT_pad_text &&
|
||||
(currSeg->fields & (1 << stmt)))
|
||||
util_fatal_error("line %i: duplicate '%s' statement", lineNum, stmtNames[stmt]);
|
||||
|
||||
|
@ -292,7 +292,7 @@ void parse_rom_spec(char *spec, struct Segment **segments, int *segment_count)
|
|||
/**
|
||||
* @brief Parses the spec, looking only for the segment with the name `segmentName`.
|
||||
* Returns true if the segment was found, false otherwise
|
||||
*
|
||||
*
|
||||
* @param[out] dstSegment The Segment to be filled. Will only contain the data of the searched segment, or garbage if the segment was not found. dstSegment must be previously allocated, a stack variable is recommended
|
||||
* @param[in,out] spec A null-terminated string containing the whole spec file. This string will be modified by this function
|
||||
* @param[in] segmentName The name of the segment being searched
|
||||
|
@ -344,8 +344,8 @@ bool get_single_segment_by_name(struct Segment* dstSegment, char *spec, const ch
|
|||
|
||||
/**
|
||||
* @brief Frees the elements of the passed Segment. Will not free the pointer itself
|
||||
*
|
||||
* @param segment
|
||||
*
|
||||
* @param segment
|
||||
*/
|
||||
void free_single_segment_elements(struct Segment *segment) {
|
||||
if (segment->includes != NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue