summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorcoco875 <59367621+coco875@users.noreply.github.com>2024-08-28 01:47:39 +0200
committerGitHub <noreply@github.com>2024-08-27 17:47:39 -0600
commita1f0d32d666c07d0754d97f107a5be59153768fd (patch)
treefcc84d9daa940274be8cf76715be902d93338e64 /include
parentbb3cbe0500197f894c83230a9a170a2cbe7aa3e8 (diff)
Update decomp clang (#67)
* Update menus.c (#634) * Update common_data.yml (#635) * Renames for screenId and other changes (#636) * screenId renames * Rename surface map to collision mesh (#637) * Rename some stack vars (#638) * Fix syntax error (#639) * Rename some stack vars * Update collision.c * Collision Documentation (#640) * Collision related renames * update doxygen (#649) * change bool (#644) Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * Update (#642) * Delete trig_tables_bss.c (#650) * fix typo audio (#656) * fix typo src actor (#657) Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * fix typo include (#658) * fix course (#659) * fix typo debug (#660) * fix typo data (#661) * replace number with const (#665) * fix typo buffers (#655) * fix typo buffers * tweak ld file * rename to sMemoryPool * add a warning --------- * fix typo src (#654) * fix typo src * fix non matcing * Update code_80091750.c --------- * fix typo racing (#653) * fix typo racing * get it match * replace G_LINE3D to G_QUAD --------- * fix typo src (#652) * fix ending typo (#651) * Action more info when it doesn't match and fix first diff (#662) * Update linux-compile.yml * fix first-diff * Update first-diff.py --------- * document texture of kart (#663) * document texture of kart * change screenPlayerId to screenId * some documentation around object * Revert "some documentation around object" This reverts commit cbb39078e036bf2a417bed67359e910213acab28. * more rename --------- * Make evaluate_collision_players_palm_tree better (#667) This matches just the same as before, but using those two casts instead of shifts seems more likely to be accurate to the original source code Signed-off-by: Gabriel Ravier <gabravier@gmail.com> * add fedora instruciton (#666) * start documenting animation (#668) * start documenting animation * Update course_data.c * change comment * update libultra asm (#648) * update libultra asm * fix gcc __osThreadTail --------- * Document Vehicles (#641) * start doc collision * fix merge * finish rename fonction related to vehicle * document around waypoint of vehicle * make some modification * make some change and rename one * copy_ to oldPos * doc smoke ferry and train * some rename * fix some renaming * precise index * rename a funciton * simplify waypoint_vehicles * change some name * change some name * rename move_to_point_direction * fix some conflict * Update code_80005FD0.c * Update code_80005FD0.h --------- * Label a save info loop (#645) * save info * more gcc progress * fix a value and do a rename (#669) * update clang and add action (#664) * update clang and add action * try clang on course folder only * forget two file * Update course_displaylists.inc.c * forget few other file * Update course_vertices.inc.c * format all code while get it match * second pass * format other dir * disable clang format on bad ido code * fix some tabulation * revert format on tool dir * Update clang-format.yml * ignore gbi.h * add some read me instruction * fix error * format and fixing error * Update README.md --------- * Update linkonly_generator.py (#670) * format more file * update * fix compilation issue * remove course_metadata folder * re add course metadata folder * fix banshee bordwalk crash * fix windows eurk * Update CMakeLists.txt ---------
Diffstat (limited to 'include')
-rw-r--r--include/PR/libaudio.h10
-rw-r--r--include/actor_types.h55
-rw-r--r--include/align_asset_macro.h8
-rw-r--r--include/bomb_kart.h76
-rw-r--r--include/common_structs.h161
-rw-r--r--include/course.h2
-rw-r--r--include/course_offsets.h29
-rw-r--r--include/debug.h31
-rw-r--r--include/defines.h210
-rw-r--r--include/kart_attributes.h24
-rw-r--r--include/libc/stdarg.h35
-rw-r--r--include/libc/stddef.h2
-rw-r--r--include/libc/stdio.h2
-rw-r--r--include/libc/stdlib.h6
-rw-r--r--include/libc/string.h6
-rw-r--r--include/macros.h40
-rw-r--r--include/mk64.h65
-rw-r--r--include/objects.h155
-rw-r--r--include/save_data.h5
-rw-r--r--include/segments.h103
-rw-r--r--include/sounds.h9
-rw-r--r--include/spline.h1
-rw-r--r--include/stubs.h31
-rw-r--r--include/vehicles.h131
-rw-r--r--include/waypoints.h29
25 files changed, 619 insertions, 607 deletions
diff --git a/include/PR/libaudio.h b/include/PR/libaudio.h
index 209a43227..21960abb5 100644
--- a/include/PR/libaudio.h
+++ b/include/PR/libaudio.h
@@ -3,19 +3,17 @@
#include <libultra/abi.h>
-typedef struct
-{
- u8 *offset;
+typedef struct {
+ u8* offset;
s32 len;
} ALSeqData;
-typedef struct
-{
+typedef struct {
s16 revision;
s16 seqCount;
ALSeqData seqArray[1];
} ALSeqFile;
-void alSeqFileNew(ALSeqFile *f, u8 *base);
+void alSeqFileNew(ALSeqFile* f, u8* base);
#endif
diff --git a/include/actor_types.h b/include/actor_types.h
index c8b611b88..9c41a2e0d 100644
--- a/include/actor_types.h
+++ b/include/actor_types.h
@@ -5,9 +5,9 @@
#include <macros.h>
#include <common_structs.h>
-//#pragma GCC diagnostic push
-//#pragma GCC diagnostic ignored "-Wmicrosoft-extension"
-//#pragma GCC diagnostic ignored "-Wmissing-member-name-in-structure-/-union"
+// #pragma GCC diagnostic push
+// #pragma GCC diagnostic ignored "-Wmicrosoft-extension"
+// #pragma GCC diagnostic ignored "-Wmissing-member-name-in-structure-/-union"
/**
* gActorList should be understood to be populated by generic Actor structs.
@@ -90,16 +90,16 @@ enum ActorType {
// Actor shell->state (green, red and blue)
enum ShellState {
- HELD_SHELL, // Single shell that has not been dropped. (probably holding Z).
- RELEASED_SHELL, // This is the short window where single shells aren't being held or launched.
- MOVING_SHELL, // Moving towards its target after being shot.
- RED_SHELL_LOCK_ON, // Red shell is targeting.
- TRIPLE_GREEN_SHELL, // Loses triple shell state when shot.
- GREEN_SHELL_HIT_A_RACER, // A racer has been hit by a green shell.
- TRIPLE_RED_SHELL, // Loses triple shell state when shot.
- DESTROYED_SHELL, // Collision with the shell.
- BLUE_SHELL_LOCK_ON, // A blue shell has found a target and is hastily approaching it.
- BLUE_SHELL_TARGET_ELIMINATED // Mission completed, well done boss.
+ HELD_SHELL, // Single shell that has not been dropped. (probably holding Z).
+ RELEASED_SHELL, // This is the short window where single shells aren't being held or launched.
+ MOVING_SHELL, // Moving towards its target after being shot.
+ RED_SHELL_LOCK_ON, // Red shell is targeting.
+ TRIPLE_GREEN_SHELL, // Loses triple shell state when shot.
+ GREEN_SHELL_HIT_A_RACER, // A racer has been hit by a green shell.
+ TRIPLE_RED_SHELL, // Loses triple shell state when shot.
+ DESTROYED_SHELL, // Collision with the shell.
+ BLUE_SHELL_LOCK_ON, // A blue shell has found a target and is hastily approaching it.
+ BLUE_SHELL_TARGET_ELIMINATED // Mission completed, well done boss.
};
// Actor banana->state
@@ -113,7 +113,7 @@ enum BananaState {
};
// Actor fakeItemBox->state
-#define HELD_FAKE_ITEM_BOX 0 // Item box is being held be Z.
+#define HELD_FAKE_ITEM_BOX 0 // Item box is being held be Z.
#define FAKE_ITEM_BOX_ON_GROUND 1 // Item box is on the ground.
#define DESTROYED_FAKE_ITEM_BOX 2 // Collision with fake item box.
@@ -200,7 +200,7 @@ struct ActorSpawnData {
* So, this struct type acts as both spawn data AND a stripped down Actor for those trees.
* Give the tree a position, a byte for flags stuffed into an s16 used to indicate tree sub-type,
* and an s16 containing as the tree's original Y position.
-**/
+ **/
struct UnkActorSpawnData {
/* 0x00 */ Vec3s pos;
// Techinically only the bottom byte of someId is the "id". The top byte is used for flags.
@@ -230,9 +230,11 @@ struct YoshiValleyEgg {
struct KiwanoFruit {
/* 0x00 */ s16 type;
/* 0x02 */ s16 flags;
- /* 0x04 */ s16 targetPlayer; // Id of the player this actor tracks. Each player has their own kiwano actor just for them
+ /* 0x04 */ s16
+ targetPlayer; // Id of the player this actor tracks. Each player has their own kiwano actor just for them
/* 0x06 */ s16 state;
- /* 0x08 */ f32 bonkTimer; // bonkState? Not sure what this is tracking, but its some form of count down that starts after the fruit hits you
+ /* 0x08 */ f32 bonkTimer; // bonkState? Not sure what this is tracking, but its some form of count down that starts
+ // after the fruit hits you
/* 0x0C */ f32 boundingBoxSize;
/* 0x10 */ s16 animState;
/* 0x12 */ s16 animTimer;
@@ -315,8 +317,9 @@ struct ShellActor {
/* 0x0C */ f32 boundingBoxSize;
/* 0x10 */ s16 rotVelocity; // Change in rotAngle on a per-update basis
union {
- /* 0x12 */ s16 rotAngle; // Angle of rotation around player (or parent?), not the rotation of the shell itself
- /* 0x12 */ u16 pathIndex; // Index in the set of points that make up the "path" the red/blue shell follows (may be GP mode exclusive)
+ /* 0x12 */ s16 rotAngle; // Angle of rotation around player (or parent?), not the rotation of the shell itself
+ /* 0x12 */ u16 pathIndex; // Index in the set of points that make up the "path" the red/blue shell follows (may
+ // be GP mode exclusive)
};
/* 0x14 */ s16 playerId; // Id of the player that "owns" the shell
/* 0x16 */ s16 unk_16;
@@ -331,8 +334,8 @@ struct ItemBox {
/* 0x04 */ s16 someTimer;
/* 0x06 */ s16 state;
/* 0x08 */ f32 resetDistance; // Value added to the Y position when box is touched. Expected to be negative
- // Distance at which a player can activate the item box
- // Named "bounding box" to match the name used for the "size" of a kart
+ // Distance at which a player can activate the item box
+ // Named "bounding box" to match the name used for the "size" of a kart
/* 0x0C */ f32 boundingBoxSize;
/* 0x10 */ Vec3s rot;
/* 0x16 */ s16 unk_16;
@@ -366,7 +369,7 @@ struct BananaBunchParent {
/* 0x06 */ s16 state;
/* 0x08 */ f32 unk_08;
/* 0x0C */ f32 unk_0C;
- /* 0x10 */ s16 playerId; // Player that own the bananas
+ /* 0x10 */ s16 playerId; // Player that own the bananas
/* 0x12 */ s16 bananaIndices[5]; // Indices in gActorList for the bananas owned by this parent
/* 0x1C */ s16 bananasAvailable;
/* 0x1E */ s16 unk_1E;
@@ -385,9 +388,9 @@ struct BananaActor {
union {
/* 0x10 */ Vec3s rot;
struct {
- /* 0x10 */ s16 playerId; // Id of the player that owns this banana
- /* 0x12 */ s16 elderIndex; // Index in gActorList of the next-oldest banana in the bunch
- /* 0x14 */ s16 youngerIndex; // Index in gActorList of the next-youngest banana in the bunch
+ /* 0x10 */ s16 playerId; // Id of the player that owns this banana
+ /* 0x12 */ s16 elderIndex; // Index in gActorList of the next-oldest banana in the bunch
+ /* 0x14 */ s16 youngerIndex; // Index in gActorList of the next-youngest banana in the bunch
};
};
/* 0x16 */ s16 unk_16;
@@ -396,6 +399,6 @@ struct BananaActor {
/* 0x30 */ Collision unk30;
}; // size = 0x70
-//#pragma GCC diagnostic pop
+// #pragma GCC diagnostic pop
#endif // ACTOR_TYPES_H
diff --git a/include/align_asset_macro.h b/include/align_asset_macro.h
index 457efe5ad..972f7f0b5 100644
--- a/include/align_asset_macro.h
+++ b/include/align_asset_macro.h
@@ -3,10 +3,12 @@
uint8_t GameEngine_OTRSigCheck(char* imgData);
#if defined(_WIN32)
- #define ALIGN_ASSET(x) __declspec(align(x))
+#define ALIGN_ASSET(x) __declspec(align(x))
#else
- #define ALIGN_ASSET(x) __attribute__((aligned (x)))
+#define ALIGN_ASSET(x) __attribute__((aligned(x)))
#endif
-#define LOAD_ASSET(path) (path == NULL ? NULL : (GameEngine_OTRSigCheck((const char*) path) ? ResourceGetDataByName((const char*) path) : path))
+#define LOAD_ASSET(path) \
+ (path == NULL ? NULL \
+ : (GameEngine_OTRSigCheck((const char*) path) ? ResourceGetDataByName((const char*) path) : path))
#define LOAD_ASSET_RAW(path) ResourceGetDataByName((const char*) path)
diff --git a/include/bomb_kart.h b/include/bomb_kart.h
index 528183949..0ae47f309 100644
--- a/include/bomb_kart.h
+++ b/include/bomb_kart.h
@@ -4,53 +4,53 @@
#include <common_structs.h>
#include <mk64.h>
-#define NUM_BOMB_KARTS_MAX 7
+#define NUM_BOMB_KARTS_MAX 7
#define NUM_BOMB_KARTS_VERSUS 7
#define NUM_BOMB_KARTS_BATTLE 4
-#define BOMB_STATE_INACTIVE 0
-#define BOMB_STATE_CCW 1
-#define BOMB_STATE_CW 2
+#define BOMB_STATE_INACTIVE 0
+#define BOMB_STATE_CCW 1
+#define BOMB_STATE_CW 2
#define BOMB_STATE_STATIONARY 3 // Paused?
-#define BOMB_STATE_EXPLODED 4 // Or maybe exploding?
-#define BOMB_STATE_UNKNOWN 5
+#define BOMB_STATE_EXPLODED 4 // Or maybe exploding?
+#define BOMB_STATE_UNKNOWN 5
typedef struct {
- /* 0x00 */ u16 waypointIndex;
- /* 0x02 */ u16 startingState;
- /* 0x04 */ f32 unk_04; // Used to set the value of unk_3C in BombKart
- /* 0x08 */ f32 startingXPos;
- /* 0x0C */ f32 startingZPos;
- /**
- * These 2 never seem to get referenced. They also only have non-zero
- * data for the Yoshi Valley set of spawns
- **/
- /* 0x10 */ f32 unk_10;
- /* 0x14 */ f32 unk_14;
+ /* 0x00 */ u16 waypointIndex;
+ /* 0x02 */ u16 startingState;
+ /* 0x04 */ f32 unk_04; // Used to set the value of unk_3C in BombKart
+ /* 0x08 */ f32 startingXPos;
+ /* 0x0C */ f32 startingZPos;
+ /**
+ * These 2 never seem to get referenced. They also only have non-zero
+ * data for the Yoshi Valley set of spawns
+ **/
+ /* 0x10 */ f32 unk_10;
+ /* 0x14 */ f32 unk_14;
} BombKartSpawn; // size = 0x18
typedef struct {
- /**
- * This struct is in part representative of the
- * bomb kart hazards in VS mode.
- * There may be objects associated with them too
- **/
- /* 0x00 */ Vec3f bombPos;
- /* 0x0C */ Vec3f wheel1Pos;
- /* 0x18 */ Vec3f wheel2Pos;
- /* 0x24 */ Vec3f wheel3Pos;
- /* 0x30 */ Vec3f wheel4Pos;
- /* 0x3C */ f32 unk_3C;
- /* 0x40 */ u16 someRot; // seems like an angle of some variety, can't figure out its purpose
- /* 0x42 */ u16 waypointIndex; // probably the waypoint that the bomb circles
- /* 0x44 */ u16 state;
- /* 0x46 */ u16 bounceTimer; // timer? state? height?
- /* 0x48 */ u16 circleTimer; // timer? state? Somehow controls how it circles around
- /* 0x4A */ u16 unk_4A;
- /* 0x4C */ s16 unk_4C;
- /* 0x4E */ // s16 compilerPadding;
- /* 0x50 */ f32 yPos; // Y position of the center of the circle
-} BombKart; // size = 0x54
+ /**
+ * This struct is in part representative of the
+ * bomb kart hazards in VS mode.
+ * There may be objects associated with them too
+ **/
+ /* 0x00 */ Vec3f bombPos;
+ /* 0x0C */ Vec3f wheel1Pos;
+ /* 0x18 */ Vec3f wheel2Pos;
+ /* 0x24 */ Vec3f wheel3Pos;
+ /* 0x30 */ Vec3f wheel4Pos;
+ /* 0x3C */ f32 unk_3C;
+ /* 0x40 */ u16 someRot; // seems like an angle of some variety, can't figure out its purpose
+ /* 0x42 */ u16 waypointIndex; // probably the waypoint that the bomb circles
+ /* 0x44 */ u16 state;
+ /* 0x46 */ u16 bounceTimer; // timer? state? height?
+ /* 0x48 */ u16 circleTimer; // timer? state? Somehow controls how it circles around
+ /* 0x4A */ u16 unk_4A;
+ /* 0x4C */ s16 unk_4C;
+ /* 0x4E */ // s16 compilerPadding;
+ /* 0x50 */ f32 yPos; // Y position of the center of the circle
+} BombKart; // size = 0x54
//! Indexes for the objects associated with the Bomb Karts
extern s32 gIndexObjectBombKart[NUM_BOMB_KARTS_MAX];
diff --git a/include/common_structs.h b/include/common_structs.h
index 9ad258ea3..2e777f5a3 100644
--- a/include/common_structs.h
+++ b/include/common_structs.h
@@ -16,20 +16,13 @@ typedef f32 Mat3[3][3];
typedef f32 Mat4[4][4];
// might not be real, used by func_8002C954
-typedef struct
-{
- f32 x, y, z;
+typedef struct {
+ f32 x, y, z;
} Vec3fs;
// This was added as a silly idea:
// In the data to use "A, B, Z, R" instead of hex numbers.
-typedef enum {
- A = 0x80,
- B = 0x40,
- Z = 0x20,
- R = 0x10
-} GhostController;
-
+typedef enum { A = 0x80, B = 0x40, Z = 0x20, R = 0x10 } GhostController;
/*** types.h ***/
@@ -47,17 +40,15 @@ enum SpTaskState {
SPTASK_STATE_FINISHED_DP
};
-struct SPTask
-{
+struct SPTask {
/*0x00*/ OSTask task;
- /*0x40*/ OSMesgQueue *msgqueue;
+ /*0x40*/ OSMesgQueue* msgqueue;
/*0x44*/ OSMesg msg;
/*0x48*/ enum SpTaskState state;
}; // size = 0x4C, align = 0x8
-struct VblankHandler
-{
- OSMesgQueue *queue;
+struct VblankHandler {
+ OSMesgQueue* queue;
OSMesg msg;
};
@@ -75,8 +66,8 @@ struct Controller {
u16 buttonPressed; // OnTriggered
u16 buttonDepressed; // OffTriggered
u16 stickDirection;
- u16 stickPressed; // OffTriggered
- u16 stickDepressed; // OnTriggered
+ u16 stickPressed; // OffTriggered
+ u16 stickDepressed; // OnTriggered
};
// Camera path struct? Or something like that. For GP race won scene?
@@ -119,14 +110,17 @@ struct UnkStruct_802B53C8 {
// end math util structs
struct UnkStruct_800DDB68 {
- s32 *D_800ED600; s32 *D_800ED608; s32 *D_800ED610; s32 *D_800ED618;
- s32 *D_800ED620; s32 *D_800ED628; s32 *D_800ED630; s32 *D_800ED638;
+ s32* D_800ED600;
+ s32* D_800ED608;
+ s32* D_800ED610;
+ s32* D_800ED618;
+ s32* D_800ED620;
+ s32* D_800ED628;
+ s32* D_800ED630;
+ s32* D_800ED638;
};
/*** Types.h end ***/
-
-
-
typedef struct {
u8 button;
s8 frameDuration;
@@ -182,9 +176,9 @@ typedef struct {
// This struct is almost identical to the GBI Vtx_t type,
// except that its missing the "flag" member.
typedef struct {
- s16 ob[3]; /* x, y, z */
- s16 tc[2]; /* texture coord */
- s8 ca[4]; /* color & alpha */
+ s16 ob[3]; /* x, y, z */
+ s16 tc[2]; /* texture coord */
+ s8 ca[4]; /* color & alpha */
} CourseVtx;
/*
@@ -195,26 +189,25 @@ The original author is assumed to be RenaKunisaki
*/
typedef struct {
/* 0x00 */ u16 flags;
- // Top bytes is a collections of flags, bottom byte is of unknown purpose
- //bit 7: 1 = only tangible if landed on, not if driven onto?
- // very weird. game crashes sometimes when playing with this.
- //bit 6: 1 = Lakitu can drop you here (XXX verify)
- //bit 4: 1 = out of bounds
- //bit 3: 1 = player tumbles upon contact (may fall right through)
+ // Top bytes is a collections of flags, bottom byte is of unknown purpose
+ // bit 7: 1 = only tangible if landed on, not if driven onto?
+ // very weird. game crashes sometimes when playing with this.
+ // bit 6: 1 = Lakitu can drop you here (XXX verify)
+ // bit 4: 1 = out of bounds
+ // bit 3: 1 = player tumbles upon contact (may fall right through)
/* 0x02 */ u16 surfaceType;
- // For AABB bounding-box style collision. Box style collision is cheaper than checking each vtx.
- /* 0x04 */ s16 minX; // Minimum x coordinate
- s16 minY; // Minimum y coordinate
- s16 minZ; // Minimum z coordinate
- s16 maxX; // Maximum x coordinate
- s16 maxY; // Maximum y coordinate
- /* 0x0A */ s16 maxZ; // Maximum z coordinate
- // Three vertices to make a triangle
- /* 0x10 */ Vtx *vtx1;
- Vtx *vtx2;
- Vtx *vtx3;
- // Face normal. Should really be Vec3f normal
+ // For AABB bounding-box style collision. Box style collision is cheaper than checking each vtx.
+ /* 0x04 */ s16 minX; // Minimum x coordinate
+ s16 minY; // Minimum y coordinate
+ s16 minZ; // Minimum z coordinate
+ s16 maxX; // Maximum x coordinate
+ s16 maxY; // Maximum y coordinate
+ /* 0x0A */ s16 maxZ; // Maximum z coordinate
+ /* 0x10 */ Vtx* vtx1; // pointer to the 3 vertices of this poly
+ Vtx* vtx2;
+ Vtx* vtx3;
+ // Face normal. Should really be Vec3f normal
/* 0x1C */ f32 normalX;
/* 0x20 */ f32 normalY;
/* 0x24 */ f32 normalZ;
@@ -223,20 +216,20 @@ typedef struct {
typedef struct {
/* 0x00 */ Vec3f pos;
- /* 0x0C */ u8 surfaceType; // Surface type that the tyre is touching.
- /* 0x0D */ u8 surfaceFlags;
+ /* 0x0C */ u8 surfaceType; // Surface type that the tyre is touching.
+ /* 0x0D */ u8 surfaceFlags;
/* 0x0E */ u16 collisionMeshIndex; // Index into gCollisionMesh
- // Height of tyre attached to ground. When flying it floats with the kart.
+ // Height of tyre attached to ground. When flying it floats with the kart.
/* 0x10 */ f32 baseHeight;
// Something lighting related. 1 when in a shaded region, 2 when in a tree's shadow
// 3 when getting crushed by a whomp, but curiously only the front left tyre will ever have this value
/* 0x14 */ s32 unk_14;
} KartTyre; // size = 0x18
-#define FRONT_LEFT 0
+#define FRONT_LEFT 0
#define FRONT_RIGHT 1
-#define BACK_LEFT 2
-#define BACK_RIGHT 3
+#define BACK_LEFT 2
+#define BACK_RIGHT 3
struct UnkPlayerInner {
/* 0xDB4 */ s16 unk0;
@@ -260,7 +253,7 @@ typedef struct {
/* 0x0006 */ u16 unk_006;
/* 0x0008 */ s16 lapCount;
/* 0x000A */ char unk_00A[0x2];
- /* 0x000C */ s32 soundEffects; // Bitflag.
+ /* 0x000C */ s32 soundEffects; // Bitflag.
/* 0x0010 */ s16 currentItemCopy; // Has no effect on what item the players has, It is just a synced copy
/* 0x0012 */ s16 unk_012;
/* 0x0014 */ Vec3f pos;
@@ -371,22 +364,32 @@ typedef struct {
/* 0x0DAC */ f32 unk_DAC;
/* 0x0DB0 */ f32 unk_DB0;
/* 0x0DB4 */ struct UnkPlayerInner unk_DB4;
- u32 nControlFlags; // Is racer human, ai, or networked controlled?
- s32 nCharacter; // Networked character choice
- s32 nStartingRank;
- u32 nHasAuthority;
+ /* 0x0DB6 */ // s16 unk_DB6;
+ /* 0x0DB8 */ // f32 unk_DB8;
+ /* 0x0DBC */ // f32 unk_DBC;
+ /* 0x0DC0 */ // f32 unk_DC0;
+ /* 0x0DC4 */ // f32 unk_DC4;
+ /* 0x0DC8 */ // f32 unk_DC8;
+ /* 0x0DCC */ // s16 unk_DCC;
+ /* 0x0DCE */ // s16 unk_DCE;
+ /* 0x0DD0 */ // s16 unk_DD0;
+ /* 0x0DD2 */ // s16 unk_DD2;
+ /* 0x0DD4 */ // s16 unk_DD4;
+ u32 nControlFlags; // Is racer human, ai, or networked controlled?
+ s32 nCharacter; // Networked character choice
+ s32 nStartingRank;
+ u32 nHasAuthority;
} Player; // size = 0xDD8
-typedef struct
-{
+typedef struct {
// Something related to time trial ghost data?
/* 0x00 */ s32 unk_00;
- /* 0x04 */ u8 ghostDataSaved;
- /* 0x05 */ s8 courseIndex;
- /* 0x06 */ u8 characterId;
- /* 0x07 */ u8 unk_07[0x3C];
- /* 0x43 */ u8 pad_43[0x7F-0x43];
- /* 0x7F */ u8 checksum;
+ /* 0x04 */ u8 ghostDataSaved;
+ /* 0x05 */ s8 courseIndex;
+ /* 0x06 */ u8 characterId;
+ /* 0x07 */ u8 unk_07[0x3C];
+ /* 0x43 */ u8 pad_43[0x7F - 0x43];
+ /* 0x7F */ u8 checksum;
} struct_8018EE10_entry; // size = 0x80
typedef struct {
@@ -400,9 +403,9 @@ typedef struct {
// Also might be used for the camera during the post race screens
typedef struct {
/* 0x00 */ f32 unknownScaling; // Looks to be some type of scaling, unknown use
- /* 0x04 */ f32 rankScaling; // Scaling done on the rank text in the bottom left corner of the screen
- // All time measurements are in centiseconds
- /* 0x08 */ u32 someTimer; // The someTimers seem to always have the same value, the total time since race start
+ /* 0x04 */ f32 rankScaling; // Scaling done on the rank text in the bottom left corner of the screen
+ // All time measurements are in centiseconds
+ /* 0x08 */ u32 someTimer; // The someTimers seem to always have the same value, the total time since race start
/* 0x0C */ u32 someTimer1;
/* 0x10 */ u32 timeLastTouchedFinishLine; // Sum of time of all completed laps
// Times at which each lap was completed
@@ -445,30 +448,33 @@ typedef struct {
// These 4 X coordinates are "slide" values
union {
struct {
- /* 0x50 */ s16 lap1CompletionTimeX; // Pulls double-duty as timerAfterImage1X
- /* 0x52 */ s16 lap2CompletionTimeX; // Pulls double-duty as timerAfterImage2X
- /* 0x54 */ s16 lap3CompletionTimeX;
+ /* 0x50 */ s16 lap1CompletionTimeX; // Pulls double-duty as timerAfterImage1X
+ /* 0x52 */ s16 lap2CompletionTimeX; // Pulls double-duty as timerAfterImage2X
+ /* 0x54 */ s16 lap3CompletionTimeX;
};
/* 0x50 */ s16 lapCompletionTimeXs[3];
};
/* 0x56 */ s16 totalTimeX;
- /* 0x58 */ s16 timerY; // Y coordinate of the on screen timer (used as Y coordinate for lap completion times in post-race screen)
- /* 0x5A */ s16 lapX; // X coordinate of the on screen lap counter
- // 0x5C and 0x5E seem to be relative to lapX
+ /* 0x58 */ s16 timerY; // Y coordinate of the on screen timer (used as Y coordinate for lap completion times in
+ // post-race screen)
+ /* 0x5A */ s16 lapX; // X coordinate of the on screen lap counter
+ // 0x5C and 0x5E seem to be relative to lapX
/* 0x5C */ s16 lapAfterImage1X;
/* 0x5E */ s16 lapAfterImage2X;
- /* 0x60 */ s16 lapY; // Y coordinate of the on screen lap counter
+ /* 0x60 */ s16 lapY; // Y coordinate of the on screen lap counter
/* 0x62 */ s16 rankX; // X coordinate of the on screen rank indicator
/* 0x64 */ s16 rankY; // Y coordinate of the on screen rank indicator
- /* 0x66 */ s16 slideRankX; // Adds with the other rankX, used during post race screen to make the rank "slide" into place
- /* 0x68 */ s16 slideRankY; // Adds with the other rankY, used during post race screen to make the rank "slide" into place
+ /* 0x66 */ s16
+ slideRankX; // Adds with the other rankX, used during post race screen to make the rank "slide" into place
+ /* 0x68 */ s16
+ slideRankY; // Adds with the other rankY, used during post race screen to make the rank "slide" into place
/* 0x6A */ s16 stagingPosition; // Position to take during race staging
// These s16's occasionally have values, but I have yet to identify any places that read them
// They appear to have values when in 3/4 player split screen mode, otherwise they're 0
/* 0x6C */ s16 unk_6C;
/* 0x6E */ s16 unk_6E;
/* 0x70 */ s8 raceCompleteBool; // Indicates if race is over?
- /* 0x71 */ s8 lapCount; // This increases to 3 when a race is over, while alsoLapCount stays at 2
+ /* 0x71 */ s8 lapCount; // This increases to 3 when a race is over, while alsoLapCount stays at 2
/* 0x72 */ s8 alsoLapCount;
// Related to the timer blinking on lap completion
// If blinkTimer is counting down:
@@ -481,7 +487,8 @@ typedef struct {
/* 0x76 */ u8 itemOverride; // Something related to item generation. If non-zero, it determines the item you get
/* 0x77 */ s8 unk_77;
// 0x78 to 0x7F appear to be some type of "state" trackers for the lap and timer text during a race start
- // When a race starts those texts (and their afterimages) slide in and "bounce" a bit. These states control the bouncing (somehow)
+ // When a race starts those texts (and their afterimages) slide in and "bounce" a bit. These states control the
+ // bouncing (somehow)
/* 0x78 */ u8 unk_78;
/* 0x79 */ u8 unk_79;
/* 0x7A */ u8 unk_7A;
diff --git a/include/course.h b/include/course.h
index 511916ac2..3844361d4 100644
--- a/include/course.h
+++ b/include/course.h
@@ -7,7 +7,7 @@
/**
* @file Include for course gfx.inc.c.
-*/
+ */
typedef struct {
uintptr_t addr;
diff --git a/include/course_offsets.h b/include/course_offsets.h
index 72f046c75..c1e441a33 100644
--- a/include/course_offsets.h
+++ b/include/course_offsets.h
@@ -7,9 +7,8 @@
#include <assets/other_textures.h>
#include "animation.h"
-typedef struct
-{
- u8 *addr; // segmented address texture file
+typedef struct {
+ u8* addr; // segmented address texture file
u32 file_size; // compressed file size
u32 data_size; // uncompressed texture size
u32 padding; // always zero
@@ -25,30 +24,30 @@ extern Animation d_course_sherbet_land_unk_data7;
extern s16 d_course_sherbet_land_unk_data8[];
extern AnimationLimbVector d_course_sherbet_land_unk_data9[];
extern Animation d_course_sherbet_land_unk_data10;
-extern Animation *d_course_sherbet_land_unk_data11[];
+extern Animation* d_course_sherbet_land_unk_data11[];
extern u32 d_course_sherbet_land_unk_data12[];
extern s16 d_rainbow_road_chomp_jaw_animation[];
extern AnimationLimbVector d_rainbow_road_unk1[];
extern Animation d_rainbow_road_unk2;
-extern Animation *d_rainbow_road_unk3[];
+extern Animation* d_rainbow_road_unk3[];
extern uintptr_t d_rainbow_road_unk4[];
extern u32 d_rainbow_road_unk5[];
-extern Gfx *koopa_troopa_beach_dls1[];
-extern Gfx *koopa_troopa_beach_dls2[];
+extern Gfx* koopa_troopa_beach_dls1[];
+extern Gfx* koopa_troopa_beach_dls2[];
extern u32 d_course_koopa_troopa_beach_unk_data1[];
extern s16 d_course_koopa_troopa_beach_unk_data2[];
extern AnimationLimbVector d_course_koopa_troopa_beach_unk_data3[];
extern Animation d_course_koopa_troopa_beach_unk_data4;
extern uintptr_t d_course_koopa_troopa_beach_unk4[];
-extern Animation *d_course_koopa_troopa_beach_unk_data5[];
+extern Animation* d_course_koopa_troopa_beach_unk_data5[];
extern u32 d_course_koopa_troopa_beach_unk_data6[];
extern s16 d_course_yoshi_valley_unk1[];
extern AnimationLimbVector d_course_yoshi_valley_unk2[];
extern Animation d_course_yoshi_valley_unk3;
-extern Animation *d_course_yoshi_valley_unk4[];
+extern Animation* d_course_yoshi_valley_unk4[];
extern uintptr_t d_course_yoshi_valley_unk5[];
extern u32 d_course_yoshi_valley_unk6[];
@@ -62,28 +61,28 @@ extern Animation d_course_sherbet_land_unk_data7;
extern s16 d_course_sherbet_land_unk_data8[];
extern AnimationLimbVector d_course_sherbet_land_unk_data9[];
extern Animation d_course_sherbet_land_unk_data10;
-extern Animation *d_course_sherbet_land_unk_data11[];
+extern Animation* d_course_sherbet_land_unk_data11[];
extern u32 d_course_sherbet_land_unk_data12[];
extern s16 d_rainbow_road_chomp_jaw_animation[];
extern AnimationLimbVector d_rainbow_road_unk1[];
extern Animation d_rainbow_road_unk2;
-extern Animation *d_rainbow_road_unk3[];
+extern Animation* d_rainbow_road_unk3[];
extern u32 d_rainbow_road_unk5[];
-extern Gfx *koopa_troopa_beach_dls1[];
-extern Gfx *koopa_troopa_beach_dls2[];
+extern Gfx* koopa_troopa_beach_dls1[];
+extern Gfx* koopa_troopa_beach_dls2[];
extern u32 d_course_koopa_troopa_beach_unk_data1[];
extern s16 d_course_koopa_troopa_beach_unk_data2[];
extern AnimationLimbVector d_course_koopa_troopa_beach_unk_data3[];
extern Animation d_course_koopa_troopa_beach_unk_data4;
-extern Animation *d_course_koopa_troopa_beach_unk_data5[];
+extern Animation* d_course_koopa_troopa_beach_unk_data5[];
extern u32 d_course_koopa_troopa_beach_unk_data6[];
extern s16 d_course_yoshi_valley_unk1[];
extern AnimationLimbVector d_course_yoshi_valley_unk2[];
extern Animation d_course_yoshi_valley_unk3;
-extern Animation *d_course_yoshi_valley_unk4[];
+extern Animation* d_course_yoshi_valley_unk4[];
extern u32 d_course_yoshi_valley_unk6[];
#endif // COURSE_OFFSETS_H
diff --git a/include/debug.h b/include/debug.h
index ba30c8698..93542ef68 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -27,14 +27,14 @@
#define TEXT_X_POSSITION -0x5
// flags
-#define DISPLAY_DECIMAL_NUMBER 0x1
-#define DISPLAY_HEXIDECIMAL_NUMBER 0x2
-#define DISPLAY_OCTAL_NUMBER 0x4
-#define DISPLAY_BINARY_NUMBER 0x8
-#define DISPLAY_SIGNED_NUMBER 0x10
-#define DISPLAY_FLOAT_AS_TYPE 0x20
-#define DISPLAY_FLOAT_WITH_ROUNDING 0x40
-#define DISPLAY_FLOAT_NUMBER 0x80
+#define DISPLAY_DECIMAL_NUMBER 0x1
+#define DISPLAY_HEXIDECIMAL_NUMBER 0x2
+#define DISPLAY_OCTAL_NUMBER 0x4
+#define DISPLAY_BINARY_NUMBER 0x8
+#define DISPLAY_SIGNED_NUMBER 0x10
+#define DISPLAY_FLOAT_AS_TYPE 0x20
+#define DISPLAY_FLOAT_WITH_ROUNDING 0x40
+#define DISPLAY_FLOAT_NUMBER 0x80
#define HEXIDECIMAL 16
#define DECIMAL 10
@@ -45,14 +45,13 @@
* This structure is the heart of the DVDL.
* only the first 4 attributes should be set by the user, the other 2 are used by the program.
*/
-typedef struct
-{
- char *variableName; // name of the variable to be displayed
- void *variablePointer; // pointer to the variable so it can display it
- u8 variableSize; // size of the variable to make up for templates from C++
- u8 variableFlag; // flag to change how the variable is displayed
- char buffer[CHARACTER_BUFFER_SIZE]; // when converting a variable to string this will be filled
- char *characterBuffer; // silly pointer so i don't need to do stuff
+typedef struct {
+ char* variableName; // name of the variable to be displayed
+ void* variablePointer; // pointer to the variable so it can display it
+ u8 variableSize; // size of the variable to make up for templates from C++
+ u8 variableFlag; // flag to change how the variable is displayed
+ char buffer[CHARACTER_BUFFER_SIZE]; // when converting a variable to string this will be filled
+ char* characterBuffer; // silly pointer so i don't need to do stuff
} variableWatchAttributes;
/**
diff --git a/include/defines.h b/include/defines.h
index e18d6ac9c..dadb7fa6a 100644
--- a/include/defines.h
+++ b/include/defines.h
@@ -1,7 +1,6 @@
#ifndef DEFINES_H
#define DEFINES_H
-
/**
* @brief Options for Controller Pak state
*/
@@ -10,23 +9,23 @@
/**
* @brief Enable debug mode
- *
+ *
* Press start to skip through menus
- *
+ *
* Toggle resource meters by holding R and tapping B. L must not be held.
- *
+ *
* Reset to start screen by holding A, B, R, and L.
- *
+ *
* View player direction and currentPathPoint in a single player race during staging tap L while holding A and B.
* Turn off this UI by tapping R while holding A and B.
* @bug This looks like it should work at any point in the race.
- *
+ *
* Set player 1 to the final lap by tapping D-pad up.
* Set player 1 and player 2 to the final lap by tapping D-pad right.
* Set player all players to the final lap by tapping D-pad down.
- *
+ *
* Immediately start the race if any controller presses Z.
- *
+ *
* As the ceremony cutscene starts hold a C or D-pad to switch characters.
* C UP = LUIGI
* C LEFT = YOSHI
@@ -36,17 +35,18 @@
* D-pad LEFT = PEACH
* D-pad RIGHT = BOWSER
* D-pad DOWN = MARIO
- *
+ *
*/
#if defined(GCC) || defined(DEBUG)
- #define DEBUG_MODE 1
- #define DEBUG_MENU 2
+#define DEBUG_MODE 1
+#define DEBUG_MENU 2
#else
- #define DEBUG_MODE 1
- #define DEBUG_MENU 2
+#define DEBUG_MODE 1
+#define DEBUG_MENU 2
#endif
-#define HOLD_ALL_DPAD_AND_C_BUTTONS (U_JPAD | L_JPAD | R_JPAD | D_JPAD | U_CBUTTONS | L_CBUTTONS | R_CBUTTONS | D_CBUTTONS)
+#define HOLD_ALL_DPAD_AND_C_BUTTONS \
+ (U_JPAD | L_JPAD | R_JPAD | D_JPAD | U_CBUTTONS | L_CBUTTONS | R_CBUTTONS | D_CBUTTONS)
/**
* @brief Options for gDebugMenuSelection
@@ -75,11 +75,11 @@
#define DEMO_MODE_INACTIVE 0
#ifdef VERSION_EU
-#define COURSE_TIMER_ITER 0.020041665999999999 // 1 / 50
-#define COURSE_TIMER_ITER_f 0.020041665999999999f // 1 / 50
+#define COURSE_TIMER_ITER 0.020041665999999999 // 1 / 50
+#define COURSE_TIMER_ITER_f 0.020041665999999999f // 1 / 50
#else
-#define COURSE_TIMER_ITER 0.01666666 // 1 / 60
-#define COURSE_TIMER_ITER_f 0.01666666f // 1 / 60
+#define COURSE_TIMER_ITER 0.01666666 // 1 / 60
+#define COURSE_TIMER_ITER_f 0.01666666f // 1 / 60
#endif
#define V_BlANK_TIMER_ITER 0.01666666
@@ -90,16 +90,16 @@
* Start sequence means waiting for the light to turn green.
* Used in the Player struct's 'type' member: player->type
*/
-#define PLAYER_INACTIVE 0 // 0x0000
-#define PLAYER_UNKNOWN_0x40 (1 << 6) // 0x0040
-#define PLAYER_INVISIBLE_OR_BOMB (1 << 8) // 0x0100
-#define PLAYER_STAGING (1 << 9) // 0x0200
-#define PLAYER_UNKNOWN (1 << 10) // 0x0400 // unused ?
-#define PLAYER_CINEMATIC_MODE (1 << 11) // 0x0800 // Also used to track eliminations in Battle mode.
-#define PLAYER_KART_AI (1 << 12) // 0x1000
-#define PLAYER_START_SEQUENCE (1 << 13) // 0x2000
-#define PLAYER_HUMAN (1 << 14) // 0x4000
-#define PLAYER_EXISTS (1 << 15) // 0x8000
+#define PLAYER_INACTIVE 0 // 0x0000
+#define PLAYER_UNKNOWN_0x40 (1 << 6) // 0x0040
+#define PLAYER_INVISIBLE_OR_BOMB (1 << 8) // 0x0100
+#define PLAYER_STAGING (1 << 9) // 0x0200
+#define PLAYER_UNKNOWN (1 << 10) // 0x0400 // unused ?
+#define PLAYER_CINEMATIC_MODE (1 << 11) // 0x0800 // Also used to track eliminations in Battle mode.
+#define PLAYER_KART_AI (1 << 12) // 0x1000
+#define PLAYER_START_SEQUENCE (1 << 13) // 0x2000
+#define PLAYER_HUMAN (1 << 14) // 0x4000
+#define PLAYER_EXISTS (1 << 15) // 0x8000
// Compiles to -0x1000 in diff.py
#define PLAYER_HUMAN_AND_KART_AI PLAYER_EXISTS | PLAYER_HUMAN | PLAYER_KART_AI | PLAYER_START_SEQUENCE
@@ -125,13 +125,13 @@ enum PlayerId {
#define NUM_PLAYERS 8
-#define MARIO_SIZE 0.75f
-#define LUIGI_SIZE 0.75f
-#define YOSHI_SIZE 0.75f
-#define TOAD_SIZE 0.75f
-#define DK_SIZE 0.75f
-#define WARIO_SIZE 0.75f
-#define PEACH_SIZE 0.75f
+#define MARIO_SIZE 0.75f
+#define LUIGI_SIZE 0.75f
+#define YOSHI_SIZE 0.75f
+#define TOAD_SIZE 0.75f
+#define DK_SIZE 0.75f
+#define WARIO_SIZE 0.75f
+#define PEACH_SIZE 0.75f
#define BOWSER_SIZE 0.75f
// 2P Game has Grand Prix, VS, and Battle as available game types
@@ -140,10 +140,10 @@ enum PlayerId {
/**
* @brief Options for gModeSelection
*/
-#define GRAND_PRIX 0
+#define GRAND_PRIX 0
#define TIME_TRIALS 1
-#define VERSUS 2
-#define BATTLE 3
+#define VERSUS 2
+#define BATTLE 3
/**
* @brief Options for gCCSelection
@@ -153,11 +153,11 @@ enum PlayerId {
* Generally, the main determiner of horsepower output.
*/
-#define CC_50 0
-#define CC_100 1
-#define CC_150 2
-#define CC_EXTRA 3
-#define CC_BATTLE 4
+#define CC_50 0
+#define CC_100 1
+#define CC_150 2
+#define CC_EXTRA 3
+#define CC_BATTLE 4
/**
* @brief Options for gCupSelection
@@ -166,11 +166,11 @@ enum PlayerId {
* way race courses are.
*/
#define MUSHROOM_CUP 0
-#define FLOWER_CUP 1
-#define STAR_CUP 2
-#define SPECIAL_CUP 3
-#define BATTLE_CUP 4
-#define NUM_CUPS 5
+#define FLOWER_CUP 1
+#define STAR_CUP 2
+#define SPECIAL_CUP 3
+#define BATTLE_CUP 4
+#define NUM_CUPS 5
/**
* @brief Character IDs
@@ -178,13 +178,13 @@ enum PlayerId {
* found in gCharacterGridSelections as those are
* ordered by table
*/
-#define MARIO 0
-#define LUIGI 1
-#define YOSHI 2
-#define TOAD 3
-#define DK 4
-#define WARIO 5
-#define PEACH 6
+#define MARIO 0
+#define LUIGI 1
+#define YOSHI 2
+#define TOAD 3
+#define DK 4
+#define WARIO 5
+#define PEACH 6
#define BOWSER 7
/**
@@ -220,7 +220,8 @@ enum PlayerId {
#define DATA_SELECTION 2
#define PLAYER_NUM_SELECTION 3
#define GAME_MODE_SELECTION 4
-#define GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION 5 // Selecting CC for GP and Versus. Selecting "Begin" or "Data" for Time Trials. Unused for Battle
+#define GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION \
+ 5 // Selecting CC for GP and Versus. Selecting "Begin" or "Data" for Time Trials. Unused for Battle
#define CONFIRM_OK_SELECTION 6
#define CONFIRM_OK_SELECTION_FROM_BACK_OUT 7
#define TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT 8
@@ -256,7 +257,7 @@ enum PlayerId {
#define TIME_TRIAL_3LAP_RECORD_3 2
#define TIME_TRIAL_3LAP_RECORD_4 3
#define TIME_TRIAL_3LAP_RECORD_5 4
-#define TIME_TRIAL_1LAP_RECORD 5
+#define TIME_TRIAL_1LAP_RECORD 5
/**
* @brief Text color options
@@ -266,10 +267,10 @@ enum PlayerId {
* flashing between 2 colors, but also cause individual characters
* to be cutoff on their right side
*/
-#define TEXT_BLUE 0
-#define TEXT_GREEN 1
-#define TEXT_RED 2
-#define TEXT_YELLOW 3
+#define TEXT_BLUE 0
+#define TEXT_GREEN 1
+#define TEXT_RED 2
+#define TEXT_YELLOW 3
#define TEXT_BLUE_GREEN_RED_CYCLE_1 4
#define TEXT_BLUE_GREEN_RED_CYCLE_2 5
@@ -278,28 +279,28 @@ enum PlayerId {
* Option 2 appears to be unused, as such its probably not
* a valid option
*/
-#define SOUND_STEREO 0
-#define SOUND_HEADPHONES 1
-#define SOUND_UNUSED 2
-#define SOUND_MONO 3
-#define NUM_SOUND_MODES 4
+#define SOUND_STEREO 0
+#define SOUND_HEADPHONES 1
+#define SOUND_UNUSED 2
+#define SOUND_MONO 3
+#define NUM_SOUND_MODES 4
/**
* @brief Title screen demo options
* All demos use 100 CC
*/
-#define DEMO_ONE 0 // Mario, Mario Raceway, Grand Prix
-#define DEMO_TWO 1 // Yoshi DK, Choco Mountain, Versus
+#define DEMO_ONE 0 // Mario, Mario Raceway, Grand Prix
+#define DEMO_TWO 1 // Yoshi DK, Choco Mountain, Versus
#define DEMO_THREE 2 // Luigi, Kalamari Desert, Grand Prix
-#define DEMO_FOUR 3 // Wario Yoshi Bowser, Wario Stadium, Versus
-#define DEMO_FIVE 4 // Bowser, Bowser Castle, Grand Prix
-#define DEMO_SIX 5 // Mario Luigi Peach Toad, Sherbert Land, Versus
-#define NUM_DEMOS 6
-
-#define CUP_COURSE_ONE 0
-#define CUP_COURSE_TWO 1
-#define CUP_COURSE_THREE 2
-#define CUP_COURSE_FOUR 3
+#define DEMO_FOUR 3 // Wario Yoshi Bowser, Wario Stadium, Versus
+#define DEMO_FIVE 4 // Bowser, Bowser Castle, Grand Prix
+#define DEMO_SIX 5 // Mario Luigi Peach Toad, Sherbert Land, Versus
+#define NUM_DEMOS 6
+
+#define CUP_COURSE_ONE 0
+#define CUP_COURSE_TWO 1
+#define CUP_COURSE_THREE 2
+#define CUP_COURSE_FOUR 3
#define NUM_COURSES_PER_CUP 4
/**
@@ -343,9 +344,9 @@ enum KART_AI_BEHAVIOURS {
/**
* @brief Balloon status
*/
-#define BALLOON_STATUS_GONE 0
-#define BALLOON_STATUS_PRESENT 1
-#define BALLOON_STATUS_DEPARTING 2
+#define BALLOON_STATUS_GONE 0
+#define BALLOON_STATUS_PRESENT 1
+#define BALLOON_STATUS_DEPARTING 2
/**
* @brief Max representable time, 100 minutes measured in centiseconds
@@ -356,33 +357,33 @@ enum KART_AI_BEHAVIOURS {
* @brief sound effect of player's
* for soundEffect
*/
-#define HIT_SOUND_EFFECT 0x100 // hitting an object
-#define BOOST_SOUND_EFFECT 0x200 // being boosted by trigger a mushroom
-#define BOO_SOUND_EFFECT 0x800 // being a boo
-#define STAR_SOUND_EFFECT 0x2000 // being a star
-#define HIT_ROTATING_SOUND_EFFECT 0x4000 // hitting a rotating object
-#define BOOST_RAMP_WOOD_SOUND_EFFECT 0x8000 // being boosted by a ramp
-#define HOLD_BANANA_SOUND_EFFECT 0x40000 // holding a banana
-#define REVERSE_SOUND_EFFECT 0x400000 // being in the wrong direction
-#define BOOST_RAMP_ASPHALT_SOUND_EFFECT 0x800000 // being boosted by a boost pad
-#define HIT_BY_ITEM_SOUND_EFFECT 0x1000000 // being hit by an item
+#define HIT_SOUND_EFFECT 0x100 // hitting an object
+#define BOOST_SOUND_EFFECT 0x200 // being boosted by trigger a mushroom
+#define BOO_SOUND_EFFECT 0x800 // being a boo
+#define STAR_SOUND_EFFECT 0x2000 // being a star
+#define HIT_ROTATING_SOUND_EFFECT 0x4000 // hitting a rotating object
+#define BOOST_RAMP_WOOD_SOUND_EFFECT 0x8000 // being boosted by a ramp
+#define HOLD_BANANA_SOUND_EFFECT 0x40000 // holding a banana
+#define REVERSE_SOUND_EFFECT 0x400000 // being in the wrong direction
+#define BOOST_RAMP_ASPHALT_SOUND_EFFECT 0x800000 // being boosted by a boost pad
+#define HIT_BY_ITEM_SOUND_EFFECT 0x1000000 // being hit by an item
/**
* @brief effect of player's
* for effects
*/
-#define BOOST_RAMP_WOOD_EFFECT 0x4 // being boosted by a ramp
-#define STAR_EFFECT 0x200 // being a star
-#define BOOST_EFFECT 0x2000 // being boosted by trigger a mushroom
-#define BOOST_RAMP_ASPHALT_EFFECT 0x100000 // being boosted by a boost pad
-#define HIT_BY_ITEM_EFFECT 0x2000000 // being hit by an item
-#define HIT_EFFECT 0x4000000 // hitting an object
-#define LIGHTNING_EFFECT 0x40000000 // being hit by lightning
-#define BOO_EFFECT 0x80000000 // being a boo
+#define BOOST_RAMP_WOOD_EFFECT 0x4 // being boosted by a ramp
+#define STAR_EFFECT 0x200 // being a star
+#define BOOST_EFFECT 0x2000 // being boosted by trigger a mushroom
+#define BOOST_RAMP_ASPHALT_EFFECT 0x100000 // being boosted by a boost pad
+#define HIT_BY_ITEM_EFFECT 0x2000000 // being hit by an item
+#define HIT_EFFECT 0x4000000 // hitting an object
+#define LIGHTNING_EFFECT 0x40000000 // being hit by lightning
+#define BOO_EFFECT 0x80000000 // being a boo
/**
* @brief shell state
- *
+ *
*/
#define SPAWN_FIRST_SHELL 0
#define SPAWN_SECOND_SHELL 1
@@ -390,17 +391,16 @@ enum KART_AI_BEHAVIOURS {
#define GPACK_RGB888(r, g, b) (((r) << 16) | ((g) << 8) | (b))
#define COLOR_LIGHT GPACK_RGB888(0x1C, 0x00, 0x00)
-#define COLOR_LAVA GPACK_RGB888(0x34, 0x00, 0x00)
-#define COLOR_BLACK GPACK_RGB888(0, 0, 0)
+#define COLOR_LAVA GPACK_RGB888(0x34, 0x00, 0x00)
+#define COLOR_BLACK GPACK_RGB888(0, 0, 0)
#endif // DEFINES_H
-
/**
- *
+ *
* Collision mesh flags
- *
-*/
+ *
+ */
#define GRID_SIZE 32
diff --git a/include/kart_attributes.h b/include/kart_attributes.h
index d94a4144e..53cfb977a 100644
--- a/include/kart_attributes.h
+++ b/include/kart_attributes.h
@@ -8,28 +8,28 @@ extern f32 D_800E2380[8];
extern f32 D_800E23A0[8];
extern f32 D_800E23C0[8];
extern f32 D_800E23E0[8];
-extern f32 *D_800E2400[5];
+extern f32* D_800E2400[5];
extern f32 D_800E2414[8];
extern f32 D_800E2434[8];
extern f32 D_800E2454[8];
extern f32 D_800E2474[8];
extern f32 D_800E2494[8];
-extern f32 *D_800E24B4[5];
+extern f32* D_800E24B4[5];
extern f32 D_800E24C8[8];
extern f32 D_800E24E8[8];
extern f32 D_800E2508[8];
extern f32 D_800E2528[8];
extern f32 D_800E2548[8];
-extern f32 *D_800E2568[5];
+extern f32* D_800E2568[5];
extern f32 gTopSpeed50cc[8];
extern f32 gTopSpeed100cc[8];
extern f32 gTopSpeed150cc[8];
extern f32 gTopSpeedExtra[8];
extern f32 gTopSpeedBattle[8];
-extern f32 *gTopSpeedTable[5];
+extern f32* gTopSpeedTable[5];
extern f32 gKartFrictionTable[8];
extern f32 gKartGravityTable[8];
@@ -53,8 +53,8 @@ extern f32 D_800E29A0[15];
extern f32 D_800E29DC[15];
extern f32 D_800E2A18[15];
extern f32 D_800E2A54[15];
-extern f32 *D_800E2A90[8];
-extern f32 *D_800E2AB0[8];
+extern f32* D_800E2A90[8];
+extern f32* D_800E2AB0[8];
extern f32 D_800E2AD0[15];
extern f32 D_800E2B0C[15];
@@ -72,8 +72,8 @@ extern f32 D_800E2DA0[15];
extern f32 D_800E2DDC[15];
extern f32 D_800E2E18[15];
extern f32 D_800E2E54[15];
-extern f32 *D_800E2E90[8];
-extern f32 *D_800E2EB0[8];
+extern f32* D_800E2E90[8];
+extern f32* D_800E2EB0[8];
extern f32 gKartAccelerationMario[10];
extern f32 gKartAccelerationLuigi[10];
@@ -83,7 +83,7 @@ extern f32 gKartAccelerationDK[10];
extern f32 gKartAccelerationWario[10];
extern f32 gKartAccelerationPeach[10];
extern f32 gKartAccelerationBowser[10];
-extern f32 *gKartAccelerationTables[8];
+extern f32* gKartAccelerationTables[8];
extern f32 D_800E3030[15];
extern f32 D_800E306C[15];
@@ -93,7 +93,7 @@ extern f32 D_800E3120[15];
extern f32 D_800E315C[15];
extern f32 D_800E3198[15];
extern f32 D_800E31D4[15];
-extern f32 *D_800E3210[8];
+extern f32* D_800E3210[8];
extern f32 D_800E3230[15];
extern f32 D_800E326C[15];
@@ -103,7 +103,7 @@ extern f32 D_800E3320[15];
extern f32 D_800E335C[15];
extern f32 D_800E3398[15];
extern f32 D_800E33D4[15];
-extern f32 *D_800E3410[8];
+extern f32* D_800E3410[8];
extern f32 D_800E3430[15];
extern f32 D_800E346C[15];
@@ -113,7 +113,7 @@ extern f32 D_800E3520[15];
extern f32 D_800E355C[15];
extern f32 D_800E3598[15];
extern f32 D_800E35D4[15];
-extern f32 *D_800E3610[8];
+extern f32* D_800E3610[8];
extern f32 gKartHandlingTable[8];
extern f32 gKartTable800E3650[8];
diff --git a/include/libc/stdarg.h b/include/libc/stdarg.h
index aa7e3393b..a0a572554 100644
--- a/include/libc/stdarg.h
+++ b/include/libc/stdarg.h
@@ -9,33 +9,30 @@
#define va_end __builtin_va_end
#else
-typedef char *va_list;
+typedef char* va_list;
#define _FP 1
#define _INT 0
#define _STRUCT 2
#define _VA_FP_SAVE_AREA 0x10
-#define _VA_ALIGN(p, a) (((unsigned int)(((char *)p) + ((a) > 4 ? (a) : 4) - 1)) & -((a) > 4 ? (a) : 4))
-#define va_start(vp, parmN) (vp = ((va_list)&parmN + sizeof(parmN)))
+#define _VA_ALIGN(p, a) (((unsigned int) (((char*) p) + ((a) > 4 ? (a) : 4) - 1)) & -((a) > 4 ? (a) : 4))
+#define va_start(vp, parmN) (vp = ((va_list) & parmN + sizeof(parmN)))
-#define __va_stack_arg(list, mode) \
- ( \
- ((list) = (char *)_VA_ALIGN(list, __builtin_alignof(mode)) + \
- _VA_ALIGN(sizeof(mode), 4)), \
- (((char *)list) - (_VA_ALIGN(sizeof(mode), 4) - sizeof(mode))))
+#define __va_stack_arg(list, mode) \
+ (((list) = (char*) _VA_ALIGN(list, __builtin_alignof(mode)) + _VA_ALIGN(sizeof(mode), 4)), \
+ (((char*) list) - (_VA_ALIGN(sizeof(mode), 4) - sizeof(mode))))
-#define __va_double_arg(list, mode) \
- ( \
- (((long)list & 0x1) /* 1 byte aligned? */ \
- ? (list = (char *)((long)list + 7), (char *)((long)list - 6 - _VA_FP_SAVE_AREA)) \
- : (((long)list & 0x2) /* 2 byte aligned? */ \
- ? (list = (char *)((long)list + 10), (char *)((long)list - 24 - _VA_FP_SAVE_AREA)) \
- : __va_stack_arg(list, mode))))
+#define __va_double_arg(list, mode) \
+ ((((long) list & 0x1) /* 1 byte aligned? */ \
+ ? (list = (char*) ((long) list + 7), (char*) ((long) list - 6 - _VA_FP_SAVE_AREA)) \
+ : (((long) list & 0x2) /* 2 byte aligned? */ \
+ ? (list = (char*) ((long) list + 10), (char*) ((long) list - 24 - _VA_FP_SAVE_AREA)) \
+ : __va_stack_arg(list, mode))))
-#define va_arg(list, mode) ((mode *)(((__builtin_classof(mode) == _FP && \
- __builtin_alignof(mode) == sizeof(double)) \
- ? __va_double_arg(list, mode) \
- : __va_stack_arg(list, mode))))[-1]
+#define va_arg(list, mode) \
+ ((mode*) (((__builtin_classof(mode) == _FP && __builtin_alignof(mode) == sizeof(double)) \
+ ? __va_double_arg(list, mode) \
+ : __va_stack_arg(list, mode))))[-1]
#define va_end(__list)
#endif
diff --git a/include/libc/stddef.h b/include/libc/stddef.h
index 467c140da..dda1d4157 100644
--- a/include/libc/stddef.h
+++ b/include/libc/stddef.h
@@ -4,7 +4,7 @@
#include <libultra/types.h>
#ifndef offsetof
-#define offsetof(st, m) ((size_t)&(((st *)0)->m))
+#define offsetof(st, m) ((size_t) & (((st*) 0)->m))
#endif
#endif
diff --git a/include/libc/stdio.h b/include/libc/stdio.h
index 1cd4d0a3f..1919a132f 100644
--- a/include/libc/stdio.h
+++ b/include/libc/stdio.h
@@ -1,6 +1,6 @@
#ifndef STDIO_H
#define STDIO_H
-extern int sprintf(char *s, const char *fmt, ...);
+extern int sprintf(char* s, const char* fmt, ...);
#endif
diff --git a/include/libc/stdlib.h b/include/libc/stdlib.h
index c23b4542e..886b29ba2 100644
--- a/include/libc/stdlib.h
+++ b/include/libc/stdlib.h
@@ -1,14 +1,12 @@
#ifndef STDLIB_H
#define STDLIB_H
-typedef struct lldiv_t
-{
+typedef struct lldiv_t {
long long quot;
long long rem;
} lldiv_t;
-typedef struct ldiv_t
-{
+typedef struct ldiv_t {
long quot;
long rem;
} ldiv_t;
diff --git a/include/libc/string.h b/include/libc/string.h
index 70eb56dcb..db8521960 100644
--- a/include/libc/string.h
+++ b/include/libc/string.h
@@ -3,8 +3,8 @@
#include <libultra/types.h>
-void *memcpy(void *dst, const void *src, size_t size);
-size_t strlen(const char *str);
-char *strchr(const char *str, s32 ch);
+void* memcpy(void* dst, const void* src, size_t size);
+size_t strlen(const char* str);
+char* strchr(const char* str, s32 ch);
#endif
diff --git a/include/macros.h b/include/macros.h
index 795f48170..ca02b48ad 100644
--- a/include/macros.h
+++ b/include/macros.h
@@ -11,12 +11,12 @@
#if !defined(__sgi) && (!defined(NON_MATCHING) || !defined(AVOID_UB))
// asm-process isn't supported outside of IDO, and undefined behavior causes
// crashes.
-//#error Matching build is only possible on IDO; please build with NON_MATCHING=1.
+// #error Matching build is only possible on IDO; please build with NON_MATCHING=1.
#endif
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
-#define GLUE(a, b) a ## b
+#define GLUE(a, b) a##b
#define GLUE2(a, b) GLUE(a, b)
// Avoid compiler warnings for unused variables
@@ -62,21 +62,29 @@
#endif
// Fixed point macros
-#define FTOFIX(f) ((s32)((f) * 65536.0))
-#define ITOFIX(i) ((s32)((i) << 16))
-#define FIXTOF(x) ((double)((x) / 65536.0))
-#define FIXTOI(x) ((s32)((x) >> 16))
+#define FTOFIX(f) ((s32) ((f) * 65536.0))
+#define ITOFIX(i) ((s32) ((i) << 16))
+#define FIXTOF(x) ((double) ((x) / 65536.0))
+#define FIXTOI(x) ((s32) ((x) >> 16))
// Split fixed-point values into its integer or fractional parts.
-#define toFixedInt(f) (FTOFIX(f) >> 16)
-#define toFrac(f) (FTOFIX(f) & 0xFFFF)
+#define toFixedInt(f) (FTOFIX(f) >> 16)
+#define toFrac(f) (FTOFIX(f) & 0xFFFF)
// Setup a fixed-point matrix using floats or doubles. Recommend using doubles for more precision.
-#define toFixedPointMatrix(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16) \
- {{((toFixedInt(x1)) << 16) | toFixedInt(x2), ((toFixedInt(x3)) << 16) | toFixedInt(x4), (toFixedInt(x5) << 16) | toFixedInt(x6), (toFixedInt(x7) << 16) | toFixedInt(x8)}, \
- {((toFixedInt(x9)) << 16) | toFixedInt(x10), ((toFixedInt(x11)) << 16) | toFixedInt(x12), (toFixedInt(x13) << 16) | toFixedInt(x14), (toFixedInt(x15) << 16) | toFixedInt(x16)}, \
- {((toFrac(x1)) << 16) | toFrac(x2), ((toFrac(x3)) << 16) | toFrac(x4), (toFrac(x5) << 16) | toFrac(x6), (toFrac(x7) << 16) | toFrac(x8)}, \
- {((toFrac(x9)) << 16) | toFrac(x10), ((toFrac(x11)) << 16) | toFrac(x12), (toFrac(x13) << 16) | toFrac(x14), (toFrac(x15) << 16) | toFrac(x16)}}
+#define toFixedPointMatrix(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16) \
+ { \
+ { ((toFixedInt(x1)) << 16) | toFixedInt(x2), ((toFixedInt(x3)) << 16) | toFixedInt(x4), \
+ (toFixedInt(x5) << 16) | toFixedInt(x6), (toFixedInt(x7) << 16) | toFixedInt(x8) }, \
+ { ((toFixedInt(x9)) << 16) | toFixedInt(x10), ((toFixedInt(x11)) << 16) | toFixedInt(x12), \
+ (toFixedInt(x13) << 16) | toFixedInt(x14), (toFixedInt(x15) << 16) | toFixedInt(x16) }, \
+ { ((toFrac(x1)) << 16) | toFrac(x2), ((toFrac(x3)) << 16) | toFrac(x4), (toFrac(x5) << 16) | toFrac(x6), \
+ (toFrac(x7) << 16) | toFrac(x8) }, \
+ { \
+ ((toFrac(x9)) << 16) | toFrac(x10), ((toFrac(x11)) << 16) | toFrac(x12), \
+ (toFrac(x13) << 16) | toFrac(x14), (toFrac(x15) << 16) | toFrac(x16) \
+ } \
+ }
// convert a virtual address to physical.
#define VIRTUAL_TO_PHYSICAL(addr) (addr)
@@ -93,9 +101,9 @@
// Envelopes are always stored as big endian, to match sequence files which are
// byte blobs and can embed envelopes. Hence this byteswapping macro.
#if IS_BIG_ENDIAN
- #define BSWAP16(x) (x)
+#define BSWAP16(x) (x)
#else
- #define BSWAP16(x) (((x) & 0xff) << 8 | (((x) >> 8) & 0xff))
+#define BSWAP16(x) (((x) & 0xff) << 8 | (((x) >> 8) & 0xff))
#endif
/**
@@ -104,6 +112,6 @@
* - sizeof(dl[0]) : walk back 1 Gfx macro
* - 0x07000000 : get just the offset
**/
-#define GET_PACKED_END(dl) (((u8 *) dl) + sizeof(dl) - sizeof(dl[0]) - 0x07000000)
+#define GET_PACKED_END(dl) (((u8*) dl) + sizeof(dl) - sizeof(dl[0]) - 0x07000000)
#endif
diff --git a/include/mk64.h b/include/mk64.h
index e1218178f..3cf7e4498 100644
--- a/include/mk64.h
+++ b/include/mk64.h
@@ -14,11 +14,10 @@
Configuration
=======================*/
-
#define AUDIO_HEAP_SIZE 0x48C00
#define AUDIO_HEAP_INIT_SIZE 0x2600
-#define DOUBLE_SIZE_ON_64_BIT(size) ((size) * (sizeof(void *) / 4))
+#define DOUBLE_SIZE_ON_64_BIT(size) ((size) * (sizeof(void*) / 4))
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
@@ -77,54 +76,56 @@ typedef enum {
/**
* @brief The different types of surface in the game.
-*/
+ */
enum SURFACE_TYPE {
/* -0x1 */ SURFACE_DEFAULT = -1,
/* 0x00 */ AIRBORNE,
- /* 0x01 */ ASPHALT, // Luigi's Raceway, Toad's Turnpike, Koopa Troop beach shortcut tunnel, Mario Raceway, Royal Raceway, Rainbow Road, Block Fort, Double Deck, Skyscraper
- /* 0x02 */ DIRT, // Luigi's Raceway, Moo Moo Farm, Kalimiari Desert on course, Choco Mountain, Wario Stadium, DK Jungle on course, Yoshi Valley
- /* 0x03 */ SAND, // Koopa Troopa Beach light color, Royal Raceway
- /* 0x04 */ STONE, // Royal Raceway castle entrance, Bowser's Castle
- /* 0x05 */ SNOW, // Frappe Snowland on course, Sherber Land tunnel
- /* 0x06 */ BRIDGE, // Royal Raceway castle bridges (even the wooden one), Banshee's Boardwalk, Big Donut
+ /* 0x01 */ ASPHALT, // Luigi's Raceway, Toad's Turnpike, Koopa Troop beach shortcut tunnel, Mario Raceway, Royal
+ // Raceway, Rainbow Road, Block Fort, Double Deck, Skyscraper
+ /* 0x02 */ DIRT, // Luigi's Raceway, Moo Moo Farm, Kalimiari Desert on course, Choco Mountain, Wario Stadium, DK
+ // Jungle on course, Yoshi Valley
+ /* 0x03 */ SAND, // Koopa Troopa Beach light color, Royal Raceway
+ /* 0x04 */ STONE, // Royal Raceway castle entrance, Bowser's Castle
+ /* 0x05 */ SNOW, // Frappe Snowland on course, Sherber Land tunnel
+ /* 0x06 */ BRIDGE, // Royal Raceway castle bridges (even the wooden one), Banshee's Boardwalk, Big Donut
/* 0x07 */ SAND_OFFROAD, // Mario Raceway
- /* 0x08 */ GRASS, // Luigi's Raceway, Mario Raceway, Royal Raceway, Bowser's Castle, DK Jungle, Yoshi Valley
- /* 0x09 */ ICE, // Sherbert Land
- /* 0x0A */ WET_SAND, // Koop Troopa Beach dark color
+ /* 0x08 */ GRASS, // Luigi's Raceway, Mario Raceway, Royal Raceway, Bowser's Castle, DK Jungle, Yoshi Valley
+ /* 0x09 */ ICE, // Sherbert Land
+ /* 0x0A */ WET_SAND, // Koop Troopa Beach dark color
/* 0x0B */ SNOW_OFFROAD, // Frappe Snowland off course
- /* 0x0C */ CLIFF, // Koopa Troopa Beach, Choco Mountain
+ /* 0x0C */ CLIFF, // Koopa Troopa Beach, Choco Mountain
/* 0x0D */ DIRT_OFFROAD, // Kalimari Desert off course
- /* 0x0E */ TRAIN_TRACK, // Kalimari Desert
- /* 0x0F */ CAVE, // DK Jungle cave
- /* 0x10 */ ROPE_BRIDGE, // Bowser's Castle bridge 2, DK Jungle bridge
- /* 0x11 */ WOOD_BRIDGE, // Frappe Snowland bridge, Bowser's Castle bridge 1,3, Yoshi Valley bridge 2
+ /* 0x0E */ TRAIN_TRACK, // Kalimari Desert
+ /* 0x0F */ CAVE, // DK Jungle cave
+ /* 0x10 */ ROPE_BRIDGE, // Bowser's Castle bridge 2, DK Jungle bridge
+ /* 0x11 */ WOOD_BRIDGE, // Frappe Snowland bridge, Bowser's Castle bridge 1,3, Yoshi Valley bridge 2
/* 0xFC */ BOOST_RAMP_WOOD = 0xFC, // DK Jungle
- /* 0xFD */ OUT_OF_BOUNDS, // DK Jungle river island
- /* 0xFE */ BOOST_RAMP_ASPHALT, // Royal Raceway
- /* 0xFF */ RAMP // Koopa Troopa beach
+ /* 0xFD */ OUT_OF_BOUNDS, // DK Jungle river island
+ /* 0xFE */ BOOST_RAMP_ASPHALT, // Royal Raceway
+ /* 0xFF */ RAMP // Koopa Troopa beach
};
-#define GFX_GET_OPCODE(var) ((uint32_t)((var) & 0xFF000000))
+#define GFX_GET_OPCODE(var) ((uint32_t) ((var) & 0xFF000000))
// Pointer casting is technically UB, and avoiding it gets rid of endian issues
// as well as a nice side effect.
#ifdef AVOID_UB
-#define GET_HIGH_U16_OF_32(var) ((u16)((var) >> 16))
-#define GET_HIGH_S16_OF_32(var) ((s16)((var) >> 16))
-#define GET_LOW_U16_OF_32(var) ((u16)((var) & 0xFFFF))
-#define GET_LOW_S16_OF_32(var) ((s16)((var) & 0xFFFF))
+#define GET_HIGH_U16_OF_32(var) ((u16) ((var) >> 16))
+#define GET_HIGH_S16_OF_32(var) ((s16) ((var) >> 16))
+#define GET_LOW_U16_OF_32(var) ((u16) ((var) & 0xFFFF))
+#define GET_LOW_S16_OF_32(var) ((s16) ((var) & 0xFFFF))
#define SET_HIGH_U16_OF_32(var, x) ((var) = ((var) & 0xFFFF) | ((x) << 16))
#define SET_HIGH_S16_OF_32(var, x) ((var) = ((var) & 0xFFFF) | ((x) << 16))
#else
-#define GET_HIGH_U16_OF_32(var) (((u16 *)&(var))[0])
-#define GET_HIGH_S16_OF_32(var) (((s16 *)&(var))[0])
-#define GET_LOW_U16_OF_32(var) (((u16 *)&(var))[1])
-#define GET_LOW_S16_OF_32(var) (((s16 *)&(var))[1])
-#define SET_HIGH_U16_OF_32(var, x) ((((u16 *)&(var))[0]) = (x))
-#define SET_HIGH_S16_OF_32(var, x) ((((s16 *)&(var))[0]) = (x))
+#define GET_HIGH_U16_OF_32(var) (((u16*) &(var))[0])
+#define GET_HIGH_S16_OF_32(var) (((s16*) &(var))[0])
+#define GET_LOW_U16_OF_32(var) (((u16*) &(var))[1])
+#define GET_LOW_S16_OF_32(var) (((s16*) &(var))[1])
+#define SET_HIGH_U16_OF_32(var, x) ((((u16*) &(var))[0]) = (x))
+#define SET_HIGH_S16_OF_32(var, x) ((((s16*) &(var))[0]) = (x))
#endif
-#define MACRO_COLOR_FLAG(r, g, b, flag) (r&~0x3) | (flag & 0x3), (g&~0x3) | ((flag>>2) & 0x3), b
+#define MACRO_COLOR_FLAG(r, g, b, flag) (r & ~0x3) | (flag & 0x3), (g & ~0x3) | ((flag >> 2) & 0x3), b
// Extra gbi commands
void gSPSegmentLoadRes(void* value, int segNum, uintptr_t target);
diff --git a/include/objects.h b/include/objects.h
index ec0f4ac4a..7dd2c1a66 100644
--- a/include/objects.h
+++ b/include/objects.h
@@ -7,8 +7,7 @@
#define OBJECT_LIST_SIZE 0x226
#define SOME_OBJECT_INDEX_LIST_SIZE 32
-typedef struct
-{
+typedef struct {
/* 0x00 */ f32 sizeScaling;
/* 0x04 */ Vec3f pos;
/* 0x10 */ Vec3f origin_pos;
@@ -23,20 +22,20 @@ typedef struct
/* 0x54 */ s32 status;
/* 0x58 */ s32 unk_058;
/* 0x5C */ s32 unk_05C;
- /* 0x60 */ const char *activeTLUT;
- /* 0x64 */ const char *activeTexture;
+ /* 0x60 */ const char* activeTLUT;
+ /* 0x64 */ const char* activeTexture;
/**
* "list" is something of a misnomer for the names here
* they can be pointers to just 1 tlut/texture, but it is common for one or the other
* to be a pointer to an array of tluts/textures.
- **/
- /* 0x68 */ u8 *tlutList; // I feel like this should actually be `u8 (*tlutList)[512]`, but that causes mismatches
- /* 0x6C */ const char **textureList;
- /* 0x70 */ Gfx *model;
- /* 0x74 */ Vtx *vertex;
- /* 0x78 */ s8 unk_078[0x04];
- /* 0x7C */ SplineControlPoint *controlPoints;
- /* 0x80 */ SplineData *spline;
+ **/
+ /* 0x68 */ u8* tlutList; // I feel like this should actually be `u8 (*tlutList)[512]`, but that causes mismatches
+ /* 0x6C */ const char** textureList;
+ /* 0x70 */ Gfx* model;
+ /* 0x74 */ Vtx* vertex;
+ /* 0x78 */ s8 unk_078[0x04];
+ /* 0x7C */ SplineControlPoint* controlPoints;
+ /* 0x80 */ SplineData* spline;
/* 0x84 */ s16 unk_084[0xA];
/* 0x98 */ u16 timer;
/* 0x9A */ u16 unk_09A;
@@ -57,34 +56,33 @@ typedef struct
/* 0xC4 */ u16 unk_0C4;
/* 0xC6 */ u16 unk_0C6;
/* 0xC8 */ u16 boundingBoxSize;
- /* 0xCA */ s8 unk_0CA;
- /* 0xCB */ s8 unk_0CB;
- /* 0xCC */ s8 unk_0CC;
- /* 0xCD */ s8 unk_0CD;
- /* 0xCE */ s8 unk_0CE;
- /* 0xCF */ s8 unk_0CF;
- /* 0xD0 */ s8 unk_0D0;
- /* 0xD1 */ s8 unk_0D1;
- /* 0xD2 */ s8 itemDisplay;
- /* 0xD3 */ s8 unk_0D3;
- /* 0xD4 */ s8 unk_0D4;
- /* 0xD5 */ u8 unk_0D5;
- /* 0xD6 */ u8 unk_0D6;
- /* 0xD7 */ u8 unk_0D7;
- /* 0xD8 */ u8 unk_0D8;
- /* 0xD9 */ u8 textureWidth;
- /* 0xDA */ u8 textureHeight;
- /* 0xDB */ u8 unk_0DB;
- /* 0xDC */ u8 unk_0DC;
- /* 0xDD */ u8 unk_0DD;
- /* 0xDE */ s8 unk_0DE;
- /* 0xDF */ u8 unk_0DF;
+ /* 0xCA */ s8 unk_0CA;
+ /* 0xCB */ s8 unk_0CB;
+ /* 0xCC */ s8 unk_0CC;
+ /* 0xCD */ s8 unk_0CD;
+ /* 0xCE */ s8 unk_0CE;
+ /* 0xCF */ s8 unk_0CF;
+ /* 0xD0 */ s8 unk_0D0;
+ /* 0xD1 */ s8 unk_0D1;
+ /* 0xD2 */ s8 itemDisplay;
+ /* 0xD3 */ s8 unk_0D3;
+ /* 0xD4 */ s8 unk_0D4;
+ /* 0xD5 */ u8 unk_0D5;
+ /* 0xD6 */ u8 unk_0D6;
+ /* 0xD7 */ u8 unk_0D7;
+ /* 0xD8 */ u8 unk_0D8;
+ /* 0xD9 */ u8 textureWidth;
+ /* 0xDA */ u8 textureHeight;
+ /* 0xDB */ u8 unk_0DB;
+ /* 0xDC */ u8 unk_0DC;
+ /* 0xDD */ u8 unk_0DD;
+ /* 0xDE */ s8 unk_0DE;
+ /* 0xDF */ u8 unk_0DF;
} Object; // size = 0xE0
extern Object gObjectList[];
-typedef struct
-{
+typedef struct {
/* 0x00 */ f32 sizeScaling;
/* 0x04 */ Vec3f pos;
/* 0x10 */ Vec3f origin_pos;
@@ -99,20 +97,20 @@ typedef struct
/* 0x54 */ s32 status;
/* 0x58 */ s32 unk_058;
/* 0x5C */ s32 unk_05C;
- /* 0x60 */ u8 *activeTLUT;
- /* 0x64 */ u8 *activeTexture;
+ /* 0x60 */ u8* activeTLUT;
+ /* 0x64 */ u8* activeTexture;
/**
* "list" is something of a misnomer for the names here
* they can be pointers to just 1 tlut/texture, but it is common for one or the other
* to be a pointer to an array of tluts/textures.
- **/
- /* 0x68 */ u8 *tlutList; // I feel like this should actually be `u8 (*tlutList)[512]`, but that causes mismatches
- /* 0x6C */ u8 *textureList;
- /* 0x70 */ Gfx *model;
- /* 0x74 */ Vtx *vertex;
- /* 0x78 */ s8 unk_078[0x04];
- /* 0x7C */ Vec4s *unk_07C;
- /* 0x80 */ Vec4s *unk_080; // unk_080[][4]?
+ **/
+ /* 0x68 */ u8* tlutList; // I feel like this should actually be `u8 (*tlutList)[512]`, but that causes mismatches
+ /* 0x6C */ u8* textureList;
+ /* 0x70 */ Gfx* model;
+ /* 0x74 */ Vtx* vertex;
+ /* 0x78 */ s8 unk_078[0x04];
+ /* 0x7C */ Vec4s* unk_07C;
+ /* 0x80 */ Vec4s* unk_080; // unk_080[][4]?
/* 0x84 */ s16 unk_084[0xA];
/* 0x98 */ u16 goldenMushroomTimer;
/* 0x9A */ u16 unk_09A;
@@ -133,28 +131,28 @@ typedef struct
/* 0xC4 */ u16 unk_0C4;
/* 0xC6 */ u16 unk_0C6;
/* 0xC8 */ u16 unk_0C8;
- /* 0xCA */ s8 unk_0CA;
- /* 0xCB */ s8 unk_0CB;
- /* 0xCC */ s8 unk_0CC;
- /* 0xCD */ s8 unk_0CD;
- /* 0xCE */ s8 unk_0CE;
- /* 0xCF */ s8 unk_0CF;
- /* 0xD0 */ s8 unk_0D0;
- /* 0xD1 */ s8 unk_0D1;
- /* 0xD2 */ s8 itemDisplay;
- /* 0xD3 */ s8 unk_0D3;
- /* 0xD4 */ s8 unk_0D4;
- /* 0xD5 */ u8 unk_0D5;
- /* 0xD6 */ u8 unk_0D6;
- /* 0xD7 */ u8 unk_0D7;
- /* 0xD8 */ u8 unk_0D8;
- /* 0xD9 */ u8 textureWidth;
- /* 0xDA */ u8 textureHeight;
- /* 0xDB */ u8 unk_0DB;
- /* 0xDC */ u8 unk_0DC;
- /* 0xDD */ u8 unk_0DD;
- /* 0xDE */ s8 unk_0DE;
- /* 0xDF */ u8 unk_0DF;
+ /* 0xCA */ s8 unk_0CA;
+ /* 0xCB */ s8 unk_0CB;
+ /* 0xCC */ s8 unk_0CC;
+ /* 0xCD */ s8 unk_0CD;
+ /* 0xCE */ s8 unk_0CE;
+ /* 0xCF */ s8 unk_0CF;
+ /* 0xD0 */ s8 unk_0D0;
+ /* 0xD1 */ s8 unk_0D1;
+ /* 0xD2 */ s8 itemDisplay;
+ /* 0xD3 */ s8 unk_0D3;
+ /* 0xD4 */ s8 unk_0D4;
+ /* 0xD5 */ u8 unk_0D5;
+ /* 0xD6 */ u8 unk_0D6;
+ /* 0xD7 */ u8 unk_0D7;
+ /* 0xD8 */ u8 unk_0D8;
+ /* 0xD9 */ u8 textureWidth;
+ /* 0xDA */ u8 textureHeight;
+ /* 0xDB */ u8 unk_0DB;
+ /* 0xDC */ u8 unk_0DC;
+ /* 0xDD */ u8 unk_0DD;
+ /* 0xDE */ s8 unk_0DE;
+ /* 0xDF */ u8 unk_0DF;
} ItemWindowObjects; // size = 0xE0
// This are other lists of indices in gObjectList.
@@ -199,10 +197,11 @@ extern Collision D_8018C0B0[];
/**
* indexObjectList1, indexObjectList2, indexObjectList3, and indexObjectList4 are all lists of indices in gObjectList.
* init_object_list_index initializes them in such a way that the indicies in each list are not adjacent.
- * First indexObjectList1 gets an unused index, then indexObjectList2, then indexObjectList3, then indexObjectList4, and then it loops.
- *
+ * First indexObjectList1 gets an unused index, then indexObjectList2, then indexObjectList3, then indexObjectList4, and
+ *then it loops.
+ *
* The objects found at the indices in each list appears to be course dependent
- **/
+ **/
#define NUM_YV_FLAG_POLES 4
@@ -235,12 +234,12 @@ typedef struct {
/* 0x2 */ s16 startZ;
/* 0x4 */ s16 unk_4; // Group Id?
/* 0x6 */ s16 unk_6; // Starting State?
-} ThwompSpawn; // size = 0x8;
+} ThwompSpawn; // size = 0x8;
extern ThwompSpawn gThomwpSpawns50CC[];
extern ThwompSpawn gThwompSpawns100CCExtra[];
extern ThwompSpawn gThomwpSpawns150CC[];
-extern ThwompSpawn *gThowmpSpawnList;
+extern ThwompSpawn* gThowmpSpawnList;
extern s16 gNumActiveThwomps;
@@ -267,14 +266,14 @@ extern s32 indexObjectList1[];
typedef struct {
/* 0x0 */ Vec3s pos;
/* 0x6 */ s16 unk_6; // Group Id?
-} SnowmanSpawn; // size = 0x8;
+} SnowmanSpawn; // size = 0x8;
extern SnowmanSpawn gSnowmanSpawns[];
typedef struct {
/* 0x0 */ Vec3s pos;
/* 0x6 */ s16 unk_06; // Group Id?
-} HegdehogSpawn; // size = 0x8;
+} HegdehogSpawn; // size = 0x8;
extern HegdehogSpawn gHedgehogSpawns[];
extern Vec3s gHedgehogPatrolPoints[];
@@ -311,15 +310,15 @@ extern s32 indexObjectList3[];
extern s32 indexObjectList4[];
#define gObjectParticle1_SIZE 128
-#define NUM_GROUP1_MOLES 8
+#define NUM_GROUP1_MOLES 8
#define NUM_GROUP2_MOLES 11
#define NUM_GROUP3_MOLES 12
-#define NUM_TOTAL_MOLES (NUM_GROUP1_MOLES + NUM_GROUP2_MOLES + NUM_GROUP3_MOLES)
+#define NUM_TOTAL_MOLES (NUM_GROUP1_MOLES + NUM_GROUP2_MOLES + NUM_GROUP3_MOLES)
#define NUM_SNOWFLAKES 0x32
typedef union {
Vec3s asVec3sList[NUM_TOTAL_MOLES];
- s16 asFlatList[NUM_TOTAL_MOLES*3];
+ s16 asFlatList[NUM_TOTAL_MOLES * 3];
} MoleSpawnUnion;
extern MoleSpawnUnion gMoleSpawns;
diff --git a/include/save_data.h b/include/save_data.h
index 8ead373ad..2f16ad1f1 100644
--- a/include/save_data.h
+++ b/include/save_data.h
@@ -35,7 +35,6 @@ typedef struct {
u8 unknownBytes[8];
} OnlyBestTimeTrialRecords; // size = 0x38
-
typedef struct {
// GP Points scored for each CC mode
// 1st place is 3 points, 2nd is 2, etc.
@@ -58,13 +57,13 @@ typedef struct {
* Instead of 4 entries, one per cup. Or even just one big entry for all 4 cups
* Its also unknown why these are here when they're identical to the values found
* in allCourseTimeTrialRecords
- **/
+ **/
/* 0x188 */ OnlyBestTimeTrialRecords onlyBestTimeTrialRecords[2];
/**
* If checksum[1] or checksum[2] does not match their expected value,
* the grandPrixPoints and soundMode are reset. Then if the backup data's
* checksums are valid, copy the backup data to the main data.
- **/
+ **/
/* 0x1F8 */ Stuff backup;
} SaveData; // size = 0x200
diff --git a/include/segments.h b/include/segments.h
index 9c3d8d673..7a2387adb 100644
--- a/include/segments.h
+++ b/include/segments.h
@@ -38,80 +38,79 @@ extern u8 _startupLogoSegmentRomEnd[];
* main 0x80000400
* ending 0x80280000 size 0xDF00
* race 0x8028DF00 size 0x2C470
-**/
-
-
-#define SEG_START 0x80000000
+ **/
+#define SEG_START 0x80000000
// Defines duplicated even if the same for both for easier readability
#ifdef AVOID_UB
+#if 0
+#define MEMORY_POOL_START (uintptr_t) & _memoryPoolSegmentNoloadStart[0]
+#define MEMORY_POOL_END (uintptr_t) & _memoryPoolSegmentNoloadEnd[0]
- // #define MEMORY_POOL_START (uintptr_t) &_memoryPoolSegmentNoloadStart[0]
- // #define MEMORY_POOL_END (uintptr_t) &_memoryPoolSegmentNoloadEnd[0]
-
- // #define SEG_ENDING (uintptr_t) &_endingSegmentStart[0]
- // #define SEG_ENDING_ROM_START (uintptr_t) &_endingSegmentRomStart[0]
- // /**
- // * Ending segment original size is 0xDF00 but much of that remains unused.
- // * This auto fits the segment to its proper size.
- // */
- // #define SEG_ENDING_SIZE (size_t) ALIGN16( (ptrdiff_t) (&_endingSegmentNoloadEnd[0] - &_endingSegmentStart[0]) )
- // #define SEG_ENDING_ROM_SIZE (size_t) ALIGN16( (ptrdiff_t) (&_endingSegmentRomEnd[0] - &_endingSegmentRomStart[0]) )
-
- // #define SEG_RACING (uintptr_t) &_racingSegmentStart[0]
- // #define SEG_RACING_ROM_START (uintptr_t) &_racingSegmentRomStart[0]
- // #define SEG_RACING_SIZE (size_t) ALIGN16( (ptrdiff_t) (&_racingSegmentNoloadEnd[0] - &_racingSegmentStart[0]) )
- // #define SEG_RACING_ROM_SIZE (size_t) ALIGN16( (ptrdiff_t) (&_racingSegmentRomEnd[0] - &_racingSegmentRomStart[0]) )
+#define SEG_ENDING (uintptr_t) & _endingSegmentStart[0]
+#define SEG_ENDING_ROM_START (uintptr_t) & _endingSegmentRomStart[0]
+/**
+ * Ending segment original size is 0xDF00 but much of that remains unused.
+ * This auto fits the segment to its proper size.
+ */
+#define SEG_ENDING_SIZE (size_t) ALIGN16((ptrdiff_t) (&_endingSegmentNoloadEnd[0] - &_endingSegmentStart[0]))
+#define SEG_ENDING_ROM_SIZE (size_t) ALIGN16((ptrdiff_t) (&_endingSegmentRomEnd[0] - &_endingSegmentRomStart[0]))
- // #define TRIG_TABLES (uintptr_t) &_trigTablesSegmentStart[0]
- // #define TRIG_TABLES_ROM_START (uintptr_t) &_trigTablesSegmentRomStart[0]
- // #define TRIG_TABLES_SIZE (size_t) _trigTablesSegmentSize
+#define SEG_RACING (uintptr_t) & _racingSegmentStart[0]
+#define SEG_RACING_ROM_START (uintptr_t) & _racingSegmentRomStart[0]
+#define SEG_RACING_SIZE (size_t) ALIGN16((ptrdiff_t) (&_racingSegmentNoloadEnd[0] - &_racingSegmentStart[0]))
+#define SEG_RACING_ROM_SIZE (size_t) ALIGN16((ptrdiff_t) (&_racingSegmentRomEnd[0] - &_racingSegmentRomStart[0]))
- // #define SEG_DATA_START (uintptr_t) &_data_segment2SegmentRomStart[0]
- // #define SEG_DATA_END (uintptr_t) &_data_segment2SegmentRomEnd[0]
+#define TRIG_TABLES (uintptr_t) & _trigTablesSegmentStart[0]
+#define TRIG_TABLES_ROM_START (uintptr_t) & _trigTablesSegmentRomStart[0]
+#define TRIG_TABLES_SIZE (size_t) _trigTablesSegmentSize
- // #define COMMON_TEXTURES_ROM_START (uintptr_t) &_common_texturesSegmentRomStart[0]
- // #define COMMON_TEXTURES_SIZE (ptrdiff_t) (&_common_texturesSegmentRomEnd[0] - &_common_texturesSegmentRomStart[0])
+#define SEG_DATA_START (uintptr_t) & _data_segment2SegmentRomStart[0]
+#define SEG_DATA_END (uintptr_t) & _data_segment2SegmentRomEnd[0]
- // #define CEREMONY_DATA_ROM_START &_ceremonyDataSegmentRomStart[0]
- // #define CEREMONY_DATA_ROM_END &_ceremonyDataSegmentRomEnd[0]
+#define COMMON_TEXTURES_ROM_START (uintptr_t) & _common_texturesSegmentRomStart[0]
+#define COMMON_TEXTURES_SIZE (ptrdiff_t)(&_common_texturesSegmentRomEnd[0] - &_common_texturesSegmentRomStart[0])
- // #define STARTUP_LOGO_ROM_START &_startupLogoSegmentRomStart[0]
- // #define STARTUP_LOGO_ROM_END &_startupLogoSegmentRomEnd[0]
+#define CEREMONY_DATA_ROM_START &_ceremonyDataSegmentRomStart[0]
+#define CEREMONY_DATA_ROM_END &_ceremonyDataSegmentRomEnd[0]
+#define STARTUP_LOGO_ROM_START &_startupLogoSegmentRomStart[0]
+#define STARTUP_LOGO_ROM_END &_startupLogoSegmentRomEnd[0]
+#endif
#else // Required for ok
- #define MEMORY_POOL_START (uintptr_t) &_memoryPoolSegmentNoloadStart
- #define MEMORY_POOL_END (uintptr_t) 0x80242F00
+#define MEMORY_POOL_START (uintptr_t) & _memoryPoolSegmentNoloadStart
+#define MEMORY_POOL_END (uintptr_t) 0x80242F00
- #define SEG_ENDING (uintptr_t) 0x80280000
- #define SEG_ENDING_ROM_START (u8 *) &_endingSegmentRomStart[0]
+#define SEG_ENDING (uintptr_t) 0x80280000
+#define SEG_ENDING_ROM_START (u8*) &_endingSegmentRomStart[0]
- #define SEG_ENDING_SIZE (size_t) 0xDF00
- #define SEG_ENDING_ROM_SIZE (size_t) ALIGN16( (ptrdiff_t) (&_endingSegmentRomEnd[0] - &_endingSegmentRomStart[0]) )
+#define SEG_ENDING_SIZE (size_t) 0xDF00
+#define SEG_ENDING_ROM_SIZE (size_t) ALIGN16((ptrdiff_t) (&_endingSegmentRomEnd[0] - &_endingSegmentRomStart[0]))
- #define SEG_RACING (uintptr_t) 0x8028DF00
- #define SEG_RACING_ROM_START (u8 *) &_racingSegmentRomStart[0]
- #define SEG_RACING_SIZE (size_t) 0x2C470
+#define SEG_RACING (uintptr_t) 0x8028DF00
+#define SEG_RACING_ROM_START (u8*) &_racingSegmentRomStart[0]
+#define SEG_RACING_SIZE (size_t) 0x2C470
- #define SEG_RACING_ROM_SIZE (size_t) ALIGN16( (ptrdiff_t) (&_racingSegmentRomEnd[0] - &_racingSegmentRomStart[0]) )
+#define SEG_RACING_ROM_SIZE (size_t) ALIGN16((ptrdiff_t) (&_racingSegmentRomEnd[0] - &_racingSegmentRomStart[0]))
- #define TRIG_TABLES (uintptr_t) 0x802BA370
- #define TRIG_TABLES_ROM_START (uintptr_t) &_trigTablesSegmentRomStart[0]
- #define TRIG_TABLES_SIZE (size_t) 0x5810
+#define TRIG_TABLES (uintptr_t) 0x802BA370
+#define TRIG_TABLES_ROM_START (uintptr_t) & _trigTablesSegmentRomStart[0]
+#define TRIG_TABLES_SIZE (size_t) 0x5810
- #define SEG_DATA_START (uintptr_t) &_data_segment2SegmentRomStart[0]
- #define SEG_DATA_END (uintptr_t) &_data_segment2SegmentRomEnd[0]
+#define SEG_DATA_START (uintptr_t) & _data_segment2SegmentRomStart[0]
+#define SEG_DATA_END (uintptr_t) & _data_segment2SegmentRomEnd[0]
- #define COMMON_TEXTURES_ROM_START (uintptr_t) &_common_texturesSegmentRomStart[0]
- #define COMMON_TEXTURES_SIZE (ptrdiff_t) ((uintptr_t)&_common_texturesSegmentRomEnd - (uintptr_t)&_common_texturesSegmentRomStart)
+#define COMMON_TEXTURES_ROM_START (uintptr_t) & _common_texturesSegmentRomStart[0]
+#define COMMON_TEXTURES_SIZE \
+ (ptrdiff_t)((uintptr_t) & _common_texturesSegmentRomEnd - (uintptr_t) & _common_texturesSegmentRomStart)
- #define CEREMONY_DATA_ROM_START &_ceremonyDataSegmentRomStart[0]
- #define CEREMONY_DATA_ROM_END &_ceremonyDataSegmentRomEnd[0]
+#define CEREMONY_DATA_ROM_START &_ceremonyDataSegmentRomStart[0]
+#define CEREMONY_DATA_ROM_END &_ceremonyDataSegmentRomEnd[0]
- #define STARTUP_LOGO_ROM_START &_startupLogoSegmentRomStart[0]
- #define STARTUP_LOGO_ROM_END &_startupLogoSegmentRomEnd[0]
+#define STARTUP_LOGO_ROM_START &_startupLogoSegmentRomStart[0]
+#define STARTUP_LOGO_ROM_END &_startupLogoSegmentRomEnd[0]
#endif /* AVOID_UB */
diff --git a/include/sounds.h b/include/sounds.h
index 2e5fdc49f..b164bd17e 100644
--- a/include/sounds.h
+++ b/include/sounds.h
@@ -15,7 +15,7 @@
((sound_bank << 24) | (byte2 << 16) | (byte3 << 8) | sound_id)
/* Intro */
-#define SOUND_INTRO_LOGO SOUND_ARG_LOAD(0x49, 0x01, 0x80, 0x08) //SOUND_ARG_LOAD(0x49, 0x01, 0x80, 0x08)
+#define SOUND_INTRO_LOGO SOUND_ARG_LOAD(0x49, 0x01, 0x80, 0x08) // SOUND_ARG_LOAD(0x49, 0x01, 0x80, 0x08)
// Welcome to Mario Kart. Used in intro and credits.
#define SOUND_INTRO_WELCOME SOUND_ARG_LOAD(0x49, 0x00, 0x90, 0x09)
#define SOUND_INTRO_ENTER_MENU SOUND_ARG_LOAD(0x49, 0x00, 0x80, 0x1A)
@@ -66,7 +66,6 @@
#define SOUND_MENU_HEADPHONES SOUND_ARG_LOAD(0x49, 0x00, 0x80, 0x25)
#define SOUND_MENU_MONO SOUND_ARG_LOAD(0x49, 0x00, 0x80, 0x29)
-
/* Staging */
// Red and orange staging lights that Lakitu holds.
#define SOUND_ACTION_COUNTDOWN_LIGHT SOUND_ARG_LOAD(0x49, 0x00, 0x80, 0x03)
@@ -93,7 +92,6 @@
#define SOUND_ITEM_STAR SOUND_ARG_LOAD(0x31, 0x02, 0x90, 0x08)
#define SOUND_ITEM_THUNDERBOLT SOUND_ARG_LOAD(0x51, 0x01, 0xC0, 0x0C)
-
/* Score Screen */
// Coin pickup sound (perfect fourth; B to E)
#define SOUND_ACTION_COUNT_SCORE SOUND_ARG_LOAD(0x49, 0x00, 0x80, 0x17)
@@ -101,7 +99,6 @@
// Same sound as ENTER_MENU
#define SOUND_ACTION_CONTINUE_UNKNOWN SOUND_ARG_LOAD(0x49, 0x00, 0x80, 0x1B)
-
/* Ceremony */
// Congratulation
#define SOUND_CEREMONY_CONGRATULATION SOUND_ARG_LOAD(0x49, 0x00, 0x90, 0x14)
@@ -118,8 +115,4 @@
// Hey, you're very good. See you next time!
#define SOUND_CREDITS_FAREWELL SOUND_ARG_LOAD(0x49, 0x00, 0x80, 0x26)
-
-
-
-
#endif // SOUNDS_H
diff --git a/include/spline.h b/include/spline.h
index a7f4d0c3b..0d06a0ece 100644
--- a/include/spline.h
+++ b/include/spline.h
@@ -48,7 +48,6 @@ typedef struct {
// Seagulls in KoopaTroopaBeach x 1
// length of 24
-
// Ghosts in BansheeBoardwalk x 1
// Seagulls in KoopaTroopaBeach x 1
// Penguins in Sherbet Land x 1
diff --git a/include/stubs.h b/include/stubs.h
index d4a45ad14..cf91f24fd 100644
--- a/include/stubs.h
+++ b/include/stubs.h
@@ -1,7 +1,7 @@
#include <libultraship.h>
#ifdef _WIN32
-#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
+#define bzero(b, len) (memset((b), '\0', (len)), (void) 0)
#define bcopy(b1, b2, len) (memmove((b2), (b1), (len)), (void) 0)
#endif
@@ -18,20 +18,21 @@ void mio0decode(u8* arg0, u8* arg1);
s32 mio0encode(s32 input, s32, s32);
void tkmk00decode(u8*, u8*, u8*, s32);
void osStartThread(OSThread* thread);
-void osCreateThread(OSThread *thread, OSId id, void (*entry)(void *), void *arg, void *sp, OSPri pri);
+void osCreateThread(OSThread* thread, OSId id, void (*entry)(void*), void* arg, void* sp, OSPri pri);
void osInitialize(void);
-void osSetThreadPri(OSThread *thread, OSPri pri);
-void osSpTaskLoad(OSTask *task);
-void osSpTaskStartGo(OSTask *task);
+void osSetThreadPri(OSThread* thread, OSPri pri);
+void osSpTaskLoad(OSTask* task);
+void osSpTaskStartGo(OSTask* task);
void osSpTaskYield(void);
-OSYieldResult osSpTaskYielded(OSTask *task);
-s32 osPfsDeleteFile(OSPfs *pfs, u16 company_code, u32 game_code, u8 *game_name, u8 *ext_name);
-s32 osPfsReadWriteFile(OSPfs *pfs, s32 file_no, u8 flag, int offset, int size_in_bytes, u8 *data_buffer);
-s32 osPfsAllocateFile(OSPfs *pfs, u16 company_code, u32 game_code, u8 *game_name, u8 *ext_name, int file_size_in_bytes, s32 *file_no);
+OSYieldResult osSpTaskYielded(OSTask* task);
+s32 osPfsDeleteFile(OSPfs* pfs, u16 company_code, u32 game_code, u8* game_name, u8* ext_name);
+s32 osPfsReadWriteFile(OSPfs* pfs, s32 file_no, u8 flag, int offset, int size_in_bytes, u8* data_buffer);
+s32 osPfsAllocateFile(OSPfs* pfs, u16 company_code, u32 game_code, u8* game_name, u8* ext_name, int file_size_in_bytes,
+ s32* file_no);
void osSetTime(OSTime time);
-s32 osPfsIsPlug(OSMesgQueue *queue, u8 *pattern);
-s32 osPfsInit(OSMesgQueue *queue, OSPfs *pfs, int channel);
-s32 osPfsNumFiles(OSPfs *pfs, s32 *max_files, s32 *files_used);
-s32 osPfsFileState(OSPfs *pfs, s32 file_no, OSPfsState *state);
-s32 osPfsFreeBlocks(OSPfs *pfs, s32 *bytes_not_used);
-s32 osPfsFindFile(OSPfs *pfs, u16 company_code, u32 game_code, u8 *game_name, u8 *ext_name, s32 *file_no); \ No newline at end of file
+s32 osPfsIsPlug(OSMesgQueue* queue, u8* pattern);
+s32 osPfsInit(OSMesgQueue* queue, OSPfs* pfs, int channel);
+s32 osPfsNumFiles(OSPfs* pfs, s32* max_files, s32* files_used);
+s32 osPfsFileState(OSPfs* pfs, s32 file_no, OSPfsState* state);
+s32 osPfsFreeBlocks(OSPfs* pfs, s32* bytes_not_used);
+s32 osPfsFindFile(OSPfs* pfs, u16 company_code, u32 game_code, u8* game_name, u8* ext_name, s32* file_no);
diff --git a/include/vehicles.h b/include/vehicles.h
index f740213dd..b4c424c0a 100644
--- a/include/vehicles.h
+++ b/include/vehicles.h
@@ -3,12 +3,17 @@
#include <common_structs.h>
-#define NUM_1P_PASSENGER_CARS 4
-#define NUM_2P_PASSENGER_CARS 1
+#define NUM_1P_PASSENGER_CARS 4
+#define NUM_2P_PASSENGER_CARS 1
#define NUM_PASSENGER_CAR_ENTRIES 5 // Max 16
-#define NUM_TENDERS 1
-#define NUM_TRAINS 2
-#define LOCOMOTIVE_ONLY 0
+#define NUM_TENDERS 1
+#define NUM_TRAINS 2
+#define LOCOMOTIVE_ONLY 0
+
+#define NUM_CROSSINGS 2
+// This allows karts to jump the train despite the crossing being activated.
+// but still stop for the train once it's close
+#define FRAMES_SINCE_CROSSING_ACTIVATED 240
#define NUM_CROSSINGS 2
// This allows karts to jump the train despite the crossing being activated.
@@ -19,15 +24,21 @@
#define NUM_ACTIVE_PADDLE_BOATS 1
#define NUM_PADDLE_BOATS 2
-#define NUM_RACE_BOX_TRUCKS 7
-#define NUM_RACE_SCHOOL_BUSES 7
+#define NUM_RACE_BOX_TRUCKS 7
+#define NUM_RACE_SCHOOL_BUSES 7
#define NUM_RACE_TANKER_TRUCKS 7
-#define NUM_RACE_CARS 7
+#define NUM_RACE_CARS 7
-#define NUM_TIME_TRIAL_BOX_TRUCKS (NUM_RACE_BOX_TRUCKS + 1)
-#define NUM_TIME_TRIAL_SCHOOL_BUSES (NUM_RACE_SCHOOL_BUSES + 1)
+#define NUM_TIME_TRIAL_BOX_TRUCKS (NUM_RACE_BOX_TRUCKS + 1)
+#define NUM_TIME_TRIAL_SCHOOL_BUSES (NUM_RACE_SCHOOL_BUSES + 1)
#define NUM_TIME_TRIAL_TANKER_TRUCKS (NUM_RACE_TANKER_TRUCKS + 1)
-#define NUM_TIME_TRIAL_CARS (NUM_RACE_CARS + 1)
+#define NUM_TIME_TRIAL_CARS (NUM_RACE_CARS + 1)
+
+#define TRAIN_SMOKE_RENDER_DISTANCE 2000.0f
+#define TRAIN_CROSSING_AI_DISTANCE 1000.0f
+#define BOAT_SMOKE_RENDER_DISTANCE 2000.0f
+
+#define RENDER_VEHICLE 1
#define TRAIN_SMOKE_RENDER_DISTANCE 2000.0f
#define TRAIN_CROSSING_AI_DISTANCE 1000.0f
@@ -36,62 +47,62 @@
#define RENDER_VEHICLE 1
typedef struct {
- /* 0x00 */ s16 isActive; // Only used for Tender and Passenger Cars, unused for Locomotives
- /* 0x02 */ s16 compilerPadding;
- /* 0x04 */ Vec3f position;
- /* 0x10 */ Vec3f velocity;
- /* 0x1C */ u16 waypointIndex;
- /* 0x1E */ s16 actorIndex;
- /* 0x20 */ s32 unused; // Not read or written. Could be padding?
-} TrainCarStuff; // size = 0x24;
+ /* 0x00 */ s16 isActive; // Only used for Tender and Passenger Cars, unused for Locomotives
+ /* 0x02 */ s16 compilerPadding;
+ /* 0x04 */ Vec3f position;
+ /* 0x10 */ Vec3f velocity;
+ /* 0x1C */ u16 waypointIndex;
+ /* 0x1E */ s16 actorIndex;
+ /* 0x20 */ s32 unused; // Not read or written. Could be padding?
+} TrainCarStuff; // size = 0x24;
typedef struct {
- /* 0x000 */ TrainCarStuff locomotive;
- /* 0x024 */ TrainCarStuff tender;
- /* 0x048 */ TrainCarStuff passengerCars[NUM_PASSENGER_CAR_ENTRIES];
- /* 0x0FC */ f32 speed;
- /* 0x100 */ s32 someFlags;
- /* 0x104 */ s32 numCars; // Non-locomotive car count?
- /* 0x108 */ s32 unused; // Not read or written. Could be padding?
-} TrainStuff; // size = 0x10C
+ /* 0x000 */ TrainCarStuff locomotive;
+ /* 0x024 */ TrainCarStuff tender;
+ /* 0x048 */ TrainCarStuff passengerCars[NUM_PASSENGER_CAR_ENTRIES];
+ /* 0x0FC */ f32 speed;
+ /* 0x100 */ s32 someFlags;
+ /* 0x104 */ s32 numCars; // Non-locomotive car count?
+ /* 0x108 */ s32 unused; // Not read or written. Could be padding?
+} TrainStuff; // size = 0x10C
typedef struct {
- /* 0x00 */ s16 isActive; // The paddle wheel boat only shows up if the number of players is < 3
- /* 0x02 */ // s16 compilerPadding;
- /* 0x04 */ Vec3f position; //
- /* 0x10 */ Vec3f velocity; //
- /* 0x1C */ u16 waypointIndex; //
- /* 0x1E */ s16 actorIndex; //
- /* 0x20 */ f32 speed; //
- /* 0x24 */ s16 rotY; // Only Y rotation is tracked in this struct
- /* 0x26 */ // s16 compilerPadding2;
- /**
- * Bit field that tracks whether a given human player is within a certain distance of the boat
- * Probably audio related
- **/
- /* 0x28 */ s32 someFlags;
+ /* 0x00 */ s16 isActive; // The paddle wheel boat only shows up if the number of players is < 3
+ /* 0x02 */ // s16 compilerPadding;
+ /* 0x04 */ Vec3f position; //
+ /* 0x10 */ Vec3f velocity; //
+ /* 0x1C */ u16 waypointIndex; //
+ /* 0x1E */ s16 actorIndex; //
+ /* 0x20 */ f32 speed; //
+ /* 0x24 */ s16 rotY; // Only Y rotation is tracked in this struct
+ /* 0x26 */ // s16 compilerPadding2;
+ /**
+ * Bit field that tracks whether a given human player is within a certain distance of the boat
+ * Probably audio related
+ **/
+ /* 0x28 */ s32 someFlags;
} PaddleBoatStuff; // size = 0x2C
typedef struct {
- /* 0x00 */ s16 unused; // Gets set to 0, but doesn't seem to have any purpose
- /* 0x02 */ // s16 compilerPadding;
- /* 0x04 */ Vec3f position;
- /* 0x10 */ Vec3f velocity;
- /* 0x1C */ u16 waypointIndex;
- /* 0x1E */ s16 actorIndex;
- /* 0x20 */ f32 speed; //
- /* 0x24 */ f32 someMultiplierTheSequel; //
- /* 0x28 */ Vec3s rotation;
- /* 0x2E */ s16 someType; //
- /**
- * Each set of flags seems to be a bit field tracking whether a given human player
- * is within a certain distance of the vehicle. Likely related to audio stuff
- * Seems to turn on/off based on player distance from the vehicle
- **/
- /* 0x30 */ s8 someFlags; //
- /* 0x31 */ s8 someFlagsTheSequel; //
- /* 0x32 */ // s16 compilerPadding2;
-} VehicleStuff; // size = 0x34
+ /* 0x00 */ s16 unused; // Gets set to 0, but doesn't seem to have any purpose
+ /* 0x02 */ // s16 compilerPadding;
+ /* 0x04 */ Vec3f position;
+ /* 0x10 */ Vec3f velocity;
+ /* 0x1C */ u16 waypointIndex;
+ /* 0x1E */ s16 actorIndex;
+ /* 0x20 */ f32 speed; //
+ /* 0x24 */ f32 someMultiplierTheSequel; //
+ /* 0x28 */ Vec3s rotation;
+ /* 0x2E */ s16 someType; //
+ /**
+ * Each set of flags seems to be a bit field tracking whether a given human player
+ * is within a certain distance of the vehicle. Likely related to audio stuff
+ * Seems to turn on/off based on player distance from the vehicle
+ **/
+ /* 0x30 */ s8 someFlags; //
+ /* 0x31 */ s8 someFlagsTheSequel; //
+ /* 0x32 */ // s16 compilerPadding2;
+} VehicleStuff; // size = 0x34
extern TrainStuff gTrainList[];
diff --git a/include/waypoints.h b/include/waypoints.h
index d35e5413a..2583e8a11 100644
--- a/include/waypoints.h
+++ b/include/waypoints.h
@@ -13,24 +13,24 @@ typedef struct {
/**
* These are per-path arrays that contain some information relating to waypoints
* The arrays in D_80164550 contain X/Y/Z and track segment information
- * The arrays in D_80164560 and D_80164570 track some other X/Y/Z, but the track segment is always 0 (so, untracked/unused)
- * Its unclear how these arrays relate to each other
+ * The arrays in D_80164560 and D_80164570 track some other X/Y/Z, but the track segment is always 0 (so,
+ *untracked/unused) Its unclear how these arrays relate to each other
**/
-extern TrackWaypoint *D_80164550[];
-extern TrackWaypoint *D_80164560[];
-extern TrackWaypoint *D_80164570[];
+extern TrackWaypoint* D_80164550[];
+extern TrackWaypoint* D_80164560[];
+extern TrackWaypoint* D_80164570[];
/**
* Don't know what exactly these are, but like D_80164550, D_80164560, and D_80164570
* they track something about the waypoints on a per-path basis
**/
// Waypoint types?
-extern s16 *D_80164580[];
+extern s16* D_80164580[];
// Based on func_80010DBC this may be angles between waypoints
// D_80164590[i] = atan2(waypoint_i, waypoint_i+1)?
-extern s16 *D_80164590[];
+extern s16* D_80164590[];
// No idea. Adjacency list?
-extern s16 *D_801645A0[];
+extern s16* D_801645A0[];
/**
* Certain parts of the waypoint logic will copy some path/player specific data to a temporary variable.
@@ -42,20 +42,19 @@ extern s16 sSomeNearestWaypoint;
// Shadows values from gPathIndexByPlayerId
extern s32 D_80163448;
// Shadows values from D_80164560
-extern TrackWaypoint *D_801631D0;
+extern TrackWaypoint* D_801631D0;
// Shadows values from D_80164570
-extern TrackWaypoint *D_801631D4;
+extern TrackWaypoint* D_801631D4;
// Shadows values from D_80164580
-extern s16 *D_801631D8;
+extern s16* D_801631D8;
// Shadows values from D_80164590
-extern s16 *D_801631DC;
+extern s16* D_801631DC;
// Shadowd values from gWaypointCountByPathIndex
extern u16 D_80164430;
// Shadows values from D_80164550
-extern TrackWaypoint *D_80164490;
+extern TrackWaypoint* D_80164490;
// Shadows values from D_801645A0
-extern s16 *D_801645E0;
-
+extern s16* D_801645E0;
extern u16 gNearestWaypointByPlayerId[]; // D_80164438
// Total waypoints passed by playerId?