merge master

This commit is contained in:
petrie911
2021-09-27 20:59:19 -05:00
64 changed files with 3192 additions and 372 deletions
+2
View File
@@ -1,6 +1,8 @@
#ifndef _ULTRA64_CONVERT_H_
#define _ULTRA64_CONVERT_H_
#include "stdint.h"
#define OS_CLOCK_RATE 62500000LL
#define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4)
+34
View File
@@ -0,0 +1,34 @@
#ifndef FIXED_POINT_H
#define FIXED_POINT_H
#include "ultra64.h"
extern f32 qNaN0x3FFFFF;
extern f32 qNaN0x10000;
extern f32 sNaN0x3FFFFF;
f32 floorf(f32 x);
f64 floor(f64 x);
s32 lfloorf(f32 x);
s32 lfloor(f64 x);
f32 ceilf(f32 x);
f64 ceil(f64 x);
s32 lceilf(f32 x);
s32 lceil(f64 x);
f32 truncf(f32 x);
f64 trunc(f64 x);
s32 ltruncf(f32 x);
s32 ltrunc(f64 x);
f32 nearbyintf(f32 x);
f64 nearbyint(f64 x);
s32 lnearbyintf(f32 x);
s32 lnearbyint(f64 x);
f32 roundf(f32 x);
f64 round(f64 x);
s32 lroundf(f32 x);
s32 lround(f64 x);
#endif
+32 -32
View File
@@ -236,8 +236,8 @@ u32 __osCheckArena(Arena* heap);
void* proutSprintf(void* s, const char* buf, size_t n);
s32 vsprintf(char* dst, char* fmt, va_list args);
s32 sprintf(char* s, char* fmt, ...);
void PrintUtils_VPrintf(void* callback, const char* fmt, va_list args);
// void PrintUtils_Printf(void);
void PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args);
void PrintUtils_Printf(PrintCallback* pfn, const char* fmt, ...);
void Sleep_Cycles(OSTime time);
// void Sleep_Nsec(void);
void Sleep_Usec(s32);
@@ -696,7 +696,7 @@ void func_800B40E0(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3,
void func_800B42F8(Actor* actor, Lights* mapper, GlobalContext* globalCtx);
// void func_800B4A98(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
void func_800B4AEC(GlobalContext* globalCtx, Actor* actor, f32 param_3);
void func_800B4B50(Actor* actor, s32 iParm2, GlobalContext* globalCtx);
void func_800B4B50(Actor* actor, Lights* mapper, GlobalContext* globalCtx);
void func_800B4EDC(GlobalContext* globalCtx, Vec3f* pzParm2, Vec3f* pzParm3, f32* pfParm4);
// void func_800B4F40(TargetContext* targetCtx, s32 param_2, UNK_TYPE4 param_3, UNK_TYPE4 param_4, UNK_TYPE4 param_5);
void func_800B4F78(TargetContext* targetCtx, u8 type, GlobalContext* globalCtx);
@@ -789,7 +789,7 @@ void func_800B75A0(CollisionPoly* param_1, Vec3f* param_2, s16* param_3);
// UNK_TYPE4 func_800B7678(GlobalContext* globalCtx, Actor* param_2, s32 param_3, u32 param_4);
void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallCheckHeight, f32 wallCheckRadius, f32 ceilingCheckHeight, u32 flags);
// void func_800B7E04(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
s32 func_800B7FE0(f32* param_1, f32* param_2, f32* param_3, GraphicsContext* gfxCtx);
Hilite* func_800B7FE0(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx);
// void func_800B8018(void);
void func_800B8050(Actor* actor, GlobalContext* globalCtx, s32 iParm3);
void func_800B8118(Actor* actor, GlobalContext* globalCtx, s32 iParm3);
@@ -1108,9 +1108,9 @@ u32 func_800C9D8C(CollisionContext* param_1, CollisionPoly* param_2, s32 param_3
u32 func_800C9E18(CollisionContext* colCtx, CollisionPoly* polygon, s32 index);
u32 func_800C9E40(CollisionContext* colCtx, CollisionPoly* polygon, s32 index);
u32 func_800C9E88(CollisionContext* colCtx, CollisionPoly* polygon, s32 index);
// void func_800C9EBC(GlobalContext* globalCtx, CollisionContext* colCtx, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
s32 func_800C9EBC(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox, s32* bgId);
s32 func_800CA1AC(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox);
void func_800CA1E8(GlobalContext* globalCtx, CollisionContext* colCtx, f32 arg2, f32 arg3, f32* arg4, UNK_PTR arg5);
s32 func_800CA1E8(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox);
// void func_800CA22C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
// void func_800CA568(void);
// void func_800CA634(void);
@@ -1687,7 +1687,7 @@ s16 ActorCutscene_GetLength(s16 index);
// void func_800F2178(void);
s16 ActorCutscene_GetCurrentCamera(s16 index);
// void func_800F21CC(void);
// UNK_TYPE4 func_800F22C4(s16 param_1, Actor* actor);
s32 func_800F22C4(s16 param_1, Actor* actor);
void ActorCutscene_SetReturnCamera(s16 index);
// void func_800F23E0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
// void func_800F2478(void);
@@ -1775,7 +1775,7 @@ void func_800FB320(GlobalContext* globalCtx, u8 param_2);
void func_800FBF3C(GlobalContext* globalCtx);
// void func_800FC158(void);
// void func_800FC3DC(void);
// void func_800FC444(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE1 param_6);
void func_800FC444(GraphicsContext* gfxCtx, u8 arg1, u8 arg2, u8 arg3, u8 arg4, UNK_TYPE arg5);
// void func_800FC64C(void);
// void func_800FD2B4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
void func_800FD538(Color_RGB8* param_1, Color_RGB8* param_2, f32 param_3, Vec3s* param_4);
@@ -2178,7 +2178,7 @@ void func_80115A14(s32 arg0, s16 arg1);
// void func_80118BA4(void);
// void func_80119030(void);
// void func_80119610(void);
// void func_8011B4E0(void);
void func_8011B4E0(GlobalContext* globalCtx, s32 arg1);
// void func_8011B5C0(void);
// void func_8011B9E0(void);
// void func_8011BF70(void);
@@ -2238,7 +2238,7 @@ void func_80123D50(GlobalContext* globalCtx, Player* player, UNK_TYPE arg2, UNK_
void func_80123DA4(Player* player);
// void func_80123DC0(void);
void func_80123E90(GlobalContext* globalCtx, Actor* actor);
// void func_80123F2C(void);
void func_80123F2C(GlobalContext* globalCtx, s32 arg1);
// void func_80123F48(void);
// void func_80124020(void);
u8 Player_GetMask(GlobalContext* globalCtx);
@@ -2814,9 +2814,9 @@ void func_801434E4(GameState* gamestate, SkyboxContext* skyboxCtx, s16 skyType);
// void func_80143A04(void);
void func_80143A10(u8 owlId);
// void func_80143A54(void);
// void func_80143AC4(void);
void func_80143AC4(void);
void func_80143B0C(GlobalContext* globalCtx);
// void Sram_IncrementDay(void);
void Sram_IncrementDay(void);
u32 Sram_CalcChecksum(u8* data, u32 length);
// void func_80144628(void);
// void Sram_GenerateRandomSaveFields(void);
@@ -2831,8 +2831,8 @@ void func_80146580(s32 param_1, SramContext* param_2, s32 param_3);
// void func_80146628(void);
// void func_80146AA0(void);
// void func_80146DF8(void);
// void func_80146E40(void);
void Sram_Alloc(GameState* gamestate, SramContext* iParm2);
void func_80146E40(GameState* gameState, SramContext* sramCtx);
void Sram_Alloc(GameState* gamestate, SramContext* sramCtx);
// void func_80146EBC(SramContext* param_1, UNK_TYPE4 param_2, UNK_TYPE4 param_3);
// void func_80146EE8(void);
// void func_80146F5C(void);
@@ -2918,18 +2918,18 @@ void func_8015E7EC(GlobalContext* globalCtx, UNK_PTR puParm2);
// void func_80160B40(void);
// void func_80160B80(void);
// void func_80160BC0(void);
void ShrinkWindow_SetLetterboxTarget(s8 target);
// s32 ShrinkWindow_GetLetterboxTarget(void);
void ShrinkWindow_SetLetterboxMagnitude(s8 magnitude);
void ShrinkWindow_SetLetterboxTarget(s32 target);
s32 ShrinkWindow_GetLetterboxTarget(void);
void ShrinkWindow_SetLetterboxMagnitude(s32 magnitude);
s32 ShrinkWindow_GetLetterboxMagnitude(void);
void ShrinkWindow_SetPillarboxTarget(s8 target);
// s32 ShrinkWindow_GetPillarboxTarget(void);
void ShrinkWindow_SetPillarboxMagnitude(u8 magnitude);
// s32 ShrinkWindow_GetPillarboxMagnitude(void);
// void ShrinkWindow_Init(void);
// void ShrinkWindow_Fini(void);
void ShrinkWindow_SetPillarboxTarget(s32 target);
s32 ShrinkWindow_GetPillarboxTarget(void);
void ShrinkWindow_SetPillarboxMagnitude(s32 magnitude);
s32 ShrinkWindow_GetPillarboxMagnitude(void);
void ShrinkWindow_Init(void);
void ShrinkWindow_Fini(void);
void ShrinkWindow_Step(s32 framerateDivisor);
void ShrinkWindow_Draw(GlobalContext* globalCtx);
void ShrinkWindow_Draw(GraphicsContext* gfxCtx);
// void func_80161180(void);
// void func_8016119C(void);
// void func_8016122C(void);
@@ -3061,7 +3061,7 @@ s32 FrameAdvance_IsEnabled(GlobalContext* globalCtx);
// void func_8016A168(void);
// void func_8016A178(void);
// void func_8016A268(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE1 param_6);
void Play_Init(GlobalContext* globalCtx);
void Play_Init(GameState* gameState);
// void func_8016AC10(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10);
// void func_8016AE1C(void);
// void func_8016B278(void);
@@ -3186,7 +3186,7 @@ void func_80174AA0(ListAlloc* alloc);
// void func_80174B20(void);
void func_80174BA0(ListAlloc* alloc);
void Main(void* arg);
// u32 Padmgr_GetControllerBitmask(void);
u32 Padmgr_GetControllerBitmask(void);
// void func_80174F24(void);
// void func_80174F44(void);
// void func_80174F7C(void);
@@ -3269,9 +3269,9 @@ void Check_ClearRGBA16(s16* buffer);
// void Check_DrawRegionLockErrorMessage(void);
// void Check_ExpansionPak(void);
// void Check_RegionIsSupported(void);
f32 func_80179300(f32 param_1);
f32 func_80179400(s32 param_1);
f32 pow_int(f32 x, s32 pow);
f32 func_80179300(f32 n);
f32 func_80179400(s32 n);
f32 pow_int(f32 base, s32 exp);
f32 sin_rad(f32 rad);
f32 cos_rad(f32 rad);
f32 Rand_ZeroFloat(f32 scale);
@@ -3911,8 +3911,8 @@ void func_801A246C(u8 param_1, u8 param_2);
// void func_801A27E8(void);
// void func_801A281C(void);
void func_801A29D4(UNK_TYPE arg0, f32 arg1, UNK_TYPE arg2);
// void func_801A2BB8(void);
// void func_801A2C20(void);
void func_801A2BB8(s32 arg0);
void func_801A2C20(void);
// void func_801A2C44(void);
// void func_801A2C88(void);
// void func_801A2D54(void);
@@ -3992,7 +3992,7 @@ UNK_TYPE func_801A51F0(UNK_TYPE arg0);
void func_801A5BD0(s32 param_1);
// void func_801A5C28(void);
// void func_801A5C8C(void);
void func_801A5CFC(u16 arg0, Vec3f* arg1, s32 arg2, f32* arg3, f32* arg4, s8* arg5);
void func_801A5CFC(u16 sfxId, Vec3f* arg1, s32 arg2, f32* arg3, f32* arg4, s8* arg5);
// void func_801A5DDC(void);
// void func_801A5F7C(void);
// void func_801A6430(void);
+5 -2
View File
@@ -1,8 +1,9 @@
#ifndef _MACROS_H_
#define _MACROS_H_
#include "convert.h"
#include "stdint.h"
#include "convert.h"
#include "z64.h"
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
#define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0]))
@@ -34,7 +35,7 @@
//#define LINK_IS_CHILD (gSaveContext.linkAge != 0)
#define LINK_IS_ADULT (gSaveContext.linkAge == 0)
#define CURRENT_DAY (gSaveContext.day % 5)
#define CURRENT_DAY (((void)0, gSaveContext.day) % 5)
#define CLOCK_TIME(hr, min) ((s32)(((hr) * 60 + (min)) * 0x10000 / (24 * 60)))
@@ -116,6 +117,8 @@ extern GraphicsContext* __gfxCtx;
#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x))
#define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x))
#define ROUND(x) (s32)(((x) >= 0.0) ? ((x) + 0.5) : ((x) - 0.5))
#define SWAP(type, a, b) \
{ \
type _temp = (a); \
+1 -2
View File
@@ -12,12 +12,11 @@
#define DEGTORAD(x) ((x) * (M_PI / 180.0f))
typedef union {
f64 d;
struct {
u32 hi;
u32 lo;
} word;
f64 d;
} du;
typedef union {
+13 -1
View File
@@ -19,6 +19,18 @@
DECLARE_SEGMENT(ovl_##name) \
DECLARE_ROM_SEGMENT(ovl_##name)
#define SEGMENT_START(segment) (_ ## segment ## SegmentStart)
#define SEGMENT_END(segment) (_ ## segment ## SegmentEnd)
#define SEGMENT_SIZE(segment) ((uintptr_t)SEGMENT_END(segment) - (uintptr_t)SEGMENT_START(segment))
#define SEGMENT_ROM_START(segment) (_ ## segment ## SegmentRomStart)
#define SEGMENT_ROM_END(segment) (_ ## segment ## SegmentRomEnd)
#define SEGMENT_ROM_SIZE(segment) ((uintptr_t)SEGMENT_ROM_END(segment) - (uintptr_t)SEGMENT_ROM_START(segment))
#define SEGMENT_BSS_START(segment) (_ ## segment ## SegmentBssStart)
#define SEGMENT_BSS_END(segment) (_ ## segment ## SegmentBssEnd)
#define SEGMENT_BSS_SIZE(segment) ((uintptr_t)SEGMENT_BSS_END(segment) - (uintptr_t)SEGMENT_BSS_START(segment))
DECLARE_SEGMENT(boot)
DECLARE_ROM_SEGMENT(boot)
@@ -1156,7 +1168,7 @@ DECLARE_ROM_SEGMENT(week_static)
DECLARE_ROM_SEGMENT(daytelop_static)
DECLARE_ROM_SEGMENT(ger_daytelop_static)
DECLARE_ROM_SEGMENT(fra_daytelop_static)
DECLARE_ROM_SEGMENT(spa_daytelop_static)
DECLARE_ROM_SEGMENT(esp_daytelop_static)
DECLARE_ROM_SEGMENT(d2_fine_static)
DECLARE_ROM_SEGMENT(d2_cloud_static)
DECLARE_ROM_SEGMENT(d2_fine_pal_static)
+2 -2
View File
@@ -983,7 +983,7 @@ extern u8 kanfontOrdering[92];
// extern UNK_TYPE1 D_801BDBBC;
// extern UNK_TYPE1 D_801BDBC0;
// extern UNK_TYPE1 D_801BDBC4;
// extern UNK_TYPE1 D_801BDBC8;
extern u8 D_801BDBC8;
// extern UNK_TYPE1 D_801BDBCC;
// extern UNK_TYPE1 D_801BDCF4;
// extern UNK_TYPE1 D_801BE38E;
@@ -1670,7 +1670,7 @@ extern PadMgr* padmgrContext;
// extern UNK_TYPE4 controllerInputsCaptured;
// extern UNK_TYPE4 D_801D1538;
extern UNK_PTR D_801D1540;
extern f32 D_801D1570[13];
// extern f32 sFactorialTbl[13];
extern Vec3f D_801D15B0;
extern Vec3s D_801D15BC;
extern RSPMatrix D_801D1DE0;
+1 -1
View File
@@ -1574,7 +1574,7 @@ struct GlobalContext {
/* 0x18784 */ s32 (*damagePlayer)(struct GlobalContext* globalCtx, s32 damage);
/* 0x18788 */ void (*talkWithPlayer)(struct GlobalContext* globalCtx, Actor* actor);
/* 0x1878C */ void (*unk_1878C)(struct GlobalContext* globalCtx);
/* 0x18790 */ void* unk_18790; //! @TODO: Determine function prototype
/* 0x18790 */ void (*unk_18790)(struct GlobalContext* globalCtx, s16 arg1, Actor* actor);
/* 0x18794 */ void* unk_18794; //! @TODO: Determine function prototype
/* 0x18798 */ s32 (*setPlayerTalkAnim)(struct GlobalContext* globalCtx, void* talkAnim, s32 arg2);
/* 0x1879C */ s16 unk_1879C[10];
+1 -1
View File
@@ -7,7 +7,7 @@
#include "z64math.h"
#define LINK_ANIMETION_OFFSET(addr, offset) \
(((u32)&_link_animetionSegmentRomStart) + ((u32)addr & 0xFFFFFF) + ((u32)offset))
(SEGMENT_ROM_START(link_animetion) + ((u32)addr & 0xFFFFFF) + ((u32)offset))
#define LIMB_DONE 0xFF
#define ANIMATION_ENTRY_MAX 50
+7 -3
View File
@@ -89,9 +89,13 @@ typedef enum {
/* 0x1B */ GI_BOMB_BAG_20,
/* 0x1C */ GI_BOMB_BAG_30,
/* 0x1D */ GI_BOMB_BAG_40,
/* 0x1E */ GI_ARROWS_SMALL,
/* 0x1F */ GI_ARROWS_MEDIUM,
/* 0x20 */ GI_ARROWS_LARGE,
/* 0x1E */ GI_ARROWS_10,
/* 0x1F */ GI_ARROWS_30,
/* 0x20 */ GI_ARROWS_40,
/* 0x21 */ GI_ARROWS_50,
/* 0x22 */ GI_QUIVER_30,
/* 0x23 */ GI_QUIVER_40,
/* 0x24 */ GI_QUIVER_50,
/* 0x28 */ GI_NUTS_1 = 0x28,
/* 0x2A */ GI_NUTS_10 = 0x2A,
/* 0x32 */ GI_SHIELD_HERO = 0x32,
+1 -1
View File
@@ -159,7 +159,7 @@ typedef struct {
/* 0x3F45 */ u8 zTargetSetting; // 0: Switch; 1: Hold
/* 0x3F46 */ u16 unk_3F46; // "NottoriBgm"
/* 0x3F48 */ u8 unk_3F48; // "fade_go"
/* 0x3F4A */ u16 unk_3F4A; // "next_daytime"
/* 0x3F4A */ u16 nextCutsceneIndex; // "next_daytime"
/* 0x3F4C */ u8 cutsceneTrigger; // "doukidemo"
/* 0x3F4D */ u8 unk_3F4D; // "Kenjya_no"
/* 0x3F4E */ u16 nextDayTime; // "next_zelda_time"