Skip to content

Commit

Permalink
Sync upstream (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
bates64 authored May 27, 2024
2 parents 6a33ff5 + af7a1a3 commit 5f087ea
Show file tree
Hide file tree
Showing 288 changed files with 1,911 additions and 13,104 deletions.
6 changes: 5 additions & 1 deletion include/PR/os_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ typedef struct OSMesgQueue_s {

/* Events */
#ifdef _FINALROM
#define OS_NUM_EVENTS 15
# ifndef BBPLAYER
# define OS_NUM_EVENTS 15
# else
# define OS_NUM_EVENTS 32
# endif
#else
#define OS_NUM_EVENTS 23
#endif
Expand Down
1 change: 0 additions & 1 deletion include/PR/osint.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ extern u32 __osShutdown;

extern __OSEventState __osEventStateTab[OS_NUM_EVENTS];


//not sure if this should be here
extern s32 osViClock;
extern void __osTimerServicesInit(void);
Expand Down
6 changes: 1 addition & 5 deletions include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@
#include "enums.h"
#include "evt.h"
#include "messages.h"
#include "battle/formation_names.h"
#include "battle/battle_names.h"
#include "battle/stage_names.h"
#include "battle/actor_types.h"

#ifdef PERMUTER
extern int TEXEL0, TEXEL1, PRIMITIVE, PRIMITIVE_ALPHA;
#endif

#endif
2 changes: 1 addition & 1 deletion include/common_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,7 @@ typedef struct LavaReset {

typedef struct BombTrigger {
/* 0x00 */ Vec3f pos;
/* 0x0C */ s32 diameter; // effective 'size' of the object, usually set to zero because bombettes explosion radius is large enough
/* 0x0C */ f32 diameter; // effective 'size' of the object, usually set to zero because bombettes explosion radius is large enough
} BombTrigger; // size = 0x10;

typedef struct AnimatedModel {
Expand Down
22 changes: 13 additions & 9 deletions include/effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -1360,15 +1360,17 @@ typedef struct RadiatingEnergyOrbFXData {
/* 0x30 */ f32 unk_30;
} RadiatingEnergyOrbFXData; // size = 0x34

#define UNK_ARRAY_SIZE_1 4

typedef struct MotionBlurFlameFXData {
/* 0x00 */ s32 unk_00;
/* 0x04 */ f32 unk_04;
/* 0x08 */ f32 unk_08;
/* 0x0C */ f32 unk_0C;
/* 0x10 */ Vec3f pos;
/* 0x1C */ f32 unk_1C[4];
/* 0x2C */ f32 unk_2C[4];
/* 0x3C */ f32 unk_3C[4];
/* 0x1C */ f32 unk_1C[UNK_ARRAY_SIZE_1];
/* 0x2C */ f32 unk_2C[UNK_ARRAY_SIZE_1];
/* 0x3C */ f32 unk_3C[UNK_ARRAY_SIZE_1];
/* 0x4C */ s32 unk_4C;
/* 0x50 */ s32 unk_50;
/* 0x54 */ s32 unk_54;
Expand Down Expand Up @@ -2121,6 +2123,8 @@ typedef struct Effect75FXData {
/* 0x7C */ f32 unk_7C;
} Effect75FXData; // size = 0x80

#define ROCKET_BUF_SIZE 4

typedef struct FireworkRocketFXData {
/* 0x00 */ s32 variation;
/* 0x04 */ Vec3f pos;
Expand All @@ -2138,12 +2142,12 @@ typedef struct FireworkRocketFXData {
/* 0x44 */ f32 radius;
/* 0x48 */ f32 maxRadius;
/* 0x4C */ s32 isExploded;
/* 0x50 */ f32 rocketX[4];
/* 0x60 */ f32 rocketY[4];
/* 0x70 */ f32 rocketZ[4];
/* 0x80 */ f32 rocketVelX[4];
/* 0x90 */ f32 rocketVelY[4];
/* 0xA0 */ f32 rocketVelZ[4];
/* 0x50 */ f32 rocketX[ROCKET_BUF_SIZE];
/* 0x60 */ f32 rocketY[ROCKET_BUF_SIZE];
/* 0x70 */ f32 rocketZ[ROCKET_BUF_SIZE];
/* 0x80 */ f32 rocketVelX[ROCKET_BUF_SIZE];
/* 0x90 */ f32 rocketVelY[ROCKET_BUF_SIZE];
/* 0xA0 */ f32 rocketVelZ[ROCKET_BUF_SIZE];
} FireworkRocketFXData; // size = 0xB0

typedef struct PeachStarBeamSpirit {
Expand Down
22 changes: 12 additions & 10 deletions include/entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,19 +263,21 @@ typedef struct PadlockData {
/* 0x18 */ Gfx* shackleGfx;
} PadlockData; // size = 0x1C

#define FRAGMENT_BUF_SIZE 13

typedef struct BoardedFloorData {
/* 0x000 */ Gfx** fragmentsGfx;
/* 0x004 */ f32 inititalY;
/* 0x008 */ s8 fragmentRebounds[13];
/* 0x015 */ u8 fragmentMoveAngle[13];
/* 0x022 */ u8 fragmentRotX[13];
/* 0x02F */ u8 fragmentRotY[13];
/* 0x03C */ u8 fragmentLateralSpeed[13];
/* 0x04C */ f32 fragmentRotSpeed[13];
/* 0x080 */ f32 fragmentPosX[13];
/* 0x0B4 */ f32 fragmentPosY[13];
/* 0x0E8 */ f32 fragmentPosZ[13];
/* 0x11C */ f32 fragmentFallSpeed[13];
/* 0x008 */ s8 fragmentRebounds[FRAGMENT_BUF_SIZE];
/* 0x015 */ u8 fragmentMoveAngle[FRAGMENT_BUF_SIZE];
/* 0x022 */ u8 fragmentRotX[FRAGMENT_BUF_SIZE];
/* 0x02F */ u8 fragmentRotY[FRAGMENT_BUF_SIZE];
/* 0x03C */ u8 fragmentLateralSpeed[FRAGMENT_BUF_SIZE];
/* 0x04C */ f32 fragmentRotSpeed[FRAGMENT_BUF_SIZE];
/* 0x080 */ f32 fragmentPosX[FRAGMENT_BUF_SIZE];
/* 0x0B4 */ f32 fragmentPosY[FRAGMENT_BUF_SIZE];
/* 0x0E8 */ f32 fragmentPosZ[FRAGMENT_BUF_SIZE];
/* 0x11C */ f32 fragmentFallSpeed[FRAGMENT_BUF_SIZE];
} BoardedFloorData; // size = 0x150

typedef struct BombableRockData {
Expand Down
2 changes: 1 addition & 1 deletion include/include_asm.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define STRINGIFY_(x) #x
#define STRINGIFY(x) STRINGIFY_(x)

#if !defined(SPLAT) && !defined(__CTX__) && !defined(PERMUTER)
#if !defined(SPLAT) && !defined(__CTX__)
#ifndef INCLUDE_ASM
#define INCLUDE_ASM_INTERNAL(TYPE, BASE_FOLDER, FOLDER, NAME, ARGS...) \
__asm__( \
Expand Down
41 changes: 6 additions & 35 deletions include/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,18 @@
#include "types.h"
#include "include_asm.h"

#ifndef M2CTX

#ifdef SHIFT
#define SHIFT_BSS __attribute__ ((section (".bss")))
#else
#define SHIFT_BSS extern
#endif

#ifdef SHIFT
#define MATCHING_BSS(size)
#else
#define MATCHING_BSS(size) static BSS u8 padding_bss[size];
#endif

#define BSS __attribute__ ((section (".bss")))
#define BSS __attribute__ ((nocommon, section (".bss")))
#define TRANSPARENT_UNION __attribute__ ((__transparent_union__))
#else
#define SHIFT_BSS static
#define BSS static
#define TRANSPARENT_UNION
#endif

#define ALIGNED(x) __attribute__((aligned(x)))

#ifndef BBPLAYER
# define ALIGNED(x) __attribute__((aligned(x)))
# define OSALIGNED(x) ALIGNED(x)
#else
# define ALIGNED(x)
# define OSALIGNED(x)
#endif

#define BBALIGNED(x) __attribute__((aligned(x)))
# define BBALIGNED(x) ALIGNED(x)

#define ALIGN16(val) (((val) + 0xF) & ~0xF)
#define ALIGN8(val) (((val) + 0x7) & ~0x7)
Expand All @@ -44,14 +27,6 @@

#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))

#if !defined(PERMUTER) && !defined(M2CTX) && defined(OLD_GCC)
#define NOP_FIX __asm__(".set nogpopt");
#define NOP_UNFIX __asm__(".set gpopt");
#else
#define NOP_FIX
#define NOP_UNFIX
#endif

#define PTR_LIST_END ((void*) -1)

#define API_CALLABLE(name) ApiStatus name(Evt* script, b32 isInitialCall)
Expand Down Expand Up @@ -529,10 +504,6 @@
#define VLA
#endif

#ifdef M2CTX
#define VLA 0
#endif

#if VERSION_PAL
#define DT (50.0f/60.0f)
#else
Expand Down
1 change: 1 addition & 0 deletions include/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ typedef struct ShapeFile {
} ShapeFile; // size = variable

typedef ModelTreeInfo ModelTreeInfoList[0x200];

extern ModelTreeInfoList* gCurrentModelTreeNodeInfo;
extern ModelList* gCurrentModels;

Expand Down
5 changes: 2 additions & 3 deletions include/npc.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,8 @@ typedef struct EncounterStatus {
/* 0x0A8 */ FieldStatus unusedAttack2;
/* 0x0AC */ FieldStatus unusedAttack3;
/* 0x0B0 */ s32 defeatFlags[60][12];
/* 0xFB0 */ s16 recentMaps[2];
/* 0xFB4 */ char unk_FB4[4];
} EncounterStatus; // size = 0xFB8
/* 0xBF0 */ s16 recentMaps[2];
} EncounterStatus; // size = 0xBF4

extern EncounterStatus gCurrentEncounter;

Expand Down
1 change: 1 addition & 0 deletions include/nu/nualsgi.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ typedef void (*NUAuMgrFunc)(void); /* Acmd callback function */
/*--------------------------------------*/
/* audio variables */
/*--------------------------------------*/

extern u64* nuAuMgrStack;
extern NUScTask nuAuTask; /* Audio task buffer*/
extern s16* nuAuBuffer_ptr[]; /* Audio buffer */
Expand Down
16 changes: 0 additions & 16 deletions include/script_api/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,26 +200,10 @@
/// }
/// This macro expands to the given opcode and argv, with argc calculated automatically.

#ifndef PERMUTER
#ifndef M2CTX
#define EVT_CMD(opcode, argv...) \
opcode, \
(sizeof((Bytecode[]){argv})/sizeof(Bytecode)), \
##argv
#else
// This definition that passes in 0 for the number of args is used for pycparser since it can't handle varargs
#define EVT_CMD(opcode, argv...) \
opcode, \
0, \
##argv
#endif
#else
// This definition that passes in 0 for the number of args is used for pycparser since it can't handle varargs
#define EVT_CMD(opcode, argv...) \
opcode, \
0, \
##argv
#endif

/// Signals the end of EVT script data. A script missing this will likely crash on load.
#define End EVT_CMD(EVT_OP_END),
Expand Down
2 changes: 0 additions & 2 deletions include/stdlib/stdarg.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ typedef void *__gnuc_va_list;
(AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))

#undef va_end
#ifndef M2CTX
void va_end (__gnuc_va_list); /* Defined in libgcc.a */
#endif
#define va_end(AP) ((void)0)

/* We cast to void * and then to TYPE * because this avoids
Expand Down
2 changes: 0 additions & 2 deletions include/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ extern WindowStyle gWindowStyles[];
extern u16 gCurrentDoorSounds;
extern u16 gCurrentRoomDoorSounds;

extern b8 D_8014C248;

extern UNK_FUN_PTR(TalkNotificationCallback);
extern UNK_FUN_PTR(InteractNotificationCallback);
extern UNK_FUN_PTR(ISpyNotificationCallback);
Expand Down
10 changes: 5 additions & 5 deletions src/111f0_len_860.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#include "nu/nusys.h"
#include "game_modes.h"

SHIFT_BSS s16 gMapTransitionAlpha;
SHIFT_BSS s16 gMapTransitionFadeRate;
SHIFT_BSS s16 gMapTransitionState;
SHIFT_BSS s16 gMapTransitionStateTime;
SHIFT_BSS s16 gLoadedFromFileSelect;
BSS s16 gMapTransitionAlpha;
BSS s16 gMapTransitionFadeRate;
BSS s16 gMapTransitionState;
BSS s16 gMapTransitionStateTime;
BSS s16 gLoadedFromFileSelect;

void set_map_change_fade_rate(s16 fadeRate) {
gMapTransitionFadeRate = fadeRate;
Expand Down
25 changes: 14 additions & 11 deletions src/77480.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ extern Addr inspect_icon_ROM_START;
extern Addr inspect_icon_ROM_END;
#endif

SHIFT_BSS void (*ISpyNotificationCallback)(void);
SHIFT_BSS void (*PulseStoneNotificationCallback)(void);
SHIFT_BSS void (*TalkNotificationCallback)(void);
SHIFT_BSS void (*InteractNotificationCallback)(void);
SHIFT_BSS s32 D_8010C950;
void (*ISpyNotificationCallback)(void);
void (*PulseStoneNotificationCallback)(void);
void (*TalkNotificationCallback)(void);
void (*InteractNotificationCallback)(void);
s32 D_8010C950;

PlayerStatus gPlayerStatus;
PlayerData gPlayerData;

extern s32 WorldTattleInteractionID;

Expand Down Expand Up @@ -509,7 +512,7 @@ HitID player_test_move_without_slipping(PlayerStatus* playerStatus, f32* x, f32*
f32 depthDiff;
f32 height;
s32 ret;
s32 raycastID;
s32 hitID;
f32 targetDx;
f32 targetDz;
f32 dx, dz;
Expand All @@ -524,28 +527,28 @@ HitID player_test_move_without_slipping(PlayerStatus* playerStatus, f32* x, f32*
dx = radius * sinTheta;
ret = NO_COLLIDER;

raycastID = player_raycast_general(PLAYER_COLLISION_0, *x, *y + 0.1, *z, sinTheta, 0, cosTheta, &hitX, &hitY, &hitZ, &hitDepth, &hitNx, &hitNy, &hitNz);
if (raycastID > NO_COLLIDER && hitDepth <= depth) {
hitID = player_raycast_general(PLAYER_COLLISION_0, *x, *y + 0.1, *z, sinTheta, 0, cosTheta, &hitX, &hitY, &hitZ, &hitDepth, &hitNx, &hitNy, &hitNz);
if (hitID > NO_COLLIDER && hitDepth <= depth) {
*hasClimbableStep = TRUE;
}

depth = length + radius;
hitDepth = depth;
dz = radius * cosTheta;

raycastID = player_raycast_general(PLAYER_COLLISION_0, *x, *y + height, *z, sinTheta, 0, cosTheta, &hitX, &hitY, &hitZ, &hitDepth, &hitNx, &hitNy, &hitNz);
hitID = player_raycast_general(PLAYER_COLLISION_0, *x, *y + height, *z, sinTheta, 0, cosTheta, &hitX, &hitY, &hitZ, &hitDepth, &hitNx, &hitNy, &hitNz);

targetDx = 0.0f;
targetDz = 0.0f;

if (raycastID > NO_COLLIDER && hitDepth <= depth) {
if (hitID > NO_COLLIDER && hitDepth <= depth) {
depthDiff = hitDepth - depth;
dx = depthDiff * sinTheta;
dz = depthDiff * cosTheta;
player_get_slip_vector(&slipDx, &slipDz, 0.0f, 0.0f, hitNx, hitNz);
*x += dx + slipDx;
*z += dz + slipDz;
ret = raycastID;
ret = hitID;
}
*x += targetDx;
*z += targetDz;
Expand Down
19 changes: 10 additions & 9 deletions src/7B440.c
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#include "common.h"
#include "dx/debug_menu.h"

SHIFT_BSS s32 PeachDisguiseNpcIndex;
SHIFT_BSS Entity* TweesterTouchingPartner;
SHIFT_BSS Entity* TweesterTouchingPlayer;
SHIFT_BSS s32 PrevPlayerDirection;
SHIFT_BSS s32 PlayerRunStateTime;
SHIFT_BSS f32 PlayerNormalYaw;
SHIFT_BSS f32 PlayerNormalPitch;
SHIFT_BSS PlayerSpinState gPlayerSpinState;
SHIFT_BSS s32 PlayerYInterpUpdateDelay;
s32 PeachDisguiseNpcIndex;
Entity* TweesterTouchingPartner;
Entity* TweesterTouchingPlayer;
s32 PrevPlayerDirection;
s32 PlayerRunStateTime;
f32 PlayerNormalYaw;
f32 PlayerNormalPitch;
PlayerSpinState gPlayerSpinState;

BSS s32 PlayerYInterpUpdateDelay;

// default move speeds
f32 DefaultWalkSpeed = 2.0f;
Expand Down
10 changes: 5 additions & 5 deletions src/7BB60.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#include "sprite/player.h"
#include "dx/debug_menu.h"

SHIFT_BSS CollisionStatus gCollisionStatus;
SHIFT_BSS f32 JumpedOnSwitchX;
SHIFT_BSS f32 JumpedOnSwitchZ;
SHIFT_BSS f32 StepUpLastY; // never read, remove?
SHIFT_BSS f32 StepUpLastYaw; // never read, remove?
CollisionStatus gCollisionStatus;
f32 JumpedOnSwitchX;
f32 JumpedOnSwitchZ;
f32 StepUpLastYaw; // never read, remove?
f32 StepUpLastY; // never read, remove?

s16 FootstepSoundSelector = 0;

Expand Down
Loading

0 comments on commit 5f087ea

Please sign in to comment.