summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorcoco875 <59367621+coco875@users.noreply.github.com>2024-09-17 17:32:50 +0200
committerGitHub <noreply@github.com>2024-09-17 09:32:50 -0600
commit203090e5913f79df01ee273e40dea03b294f061e (patch)
tree2ee78c50742b20238c07610b8ba9f7f93c3a80e1 /include
parentd36d7dcd604d0f85b6b547a85e9b7a4fe3e59b5c (diff)
update with the decomp (#97)
* 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) Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * fix course (#659) Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * fix typo debug (#660) Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * fix typo data (#661) Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * replace number with const (#665) * fix typo buffers (#655) * fix typo buffers * tweak ld file * rename to sMemoryPool * add a warning --------- Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * fix typo src (#654) * fix typo src * fix non matcing * Update code_80091750.c --------- Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * fix typo racing (#653) * fix typo racing * get it match * replace G_LINE3D to G_QUAD --------- Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * fix typo src (#652) Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * 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 --------- Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * 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 --------- Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * 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) Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * start documenting animation (#668) * start documenting animation * Update course_data.c * change comment * update libultra asm (#648) * update libultra asm * fix gcc __osThreadTail --------- Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * 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 --------- Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * 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 --------- Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * Update linkonly_generator.py (#670) * some rename for torch (#588) * rename gBombKartSpawns, and fix cup ID * Update doxygen_syms.md * rename for gCourseIndexInCup and his constant * rename to gCupSelectedCourseIndex * forget a change in constant * fix compilation issue * Update Dockerfile to latest Ubuntu LTS + fixed missing cmake (#674) * Fix color font matrix function (#676) * Fix label variables used in menus (#675) * Fix label variables used in menus * split D_800F2BDC and clang format menu.c --------- Co-authored-by: coco875 <pereira.jannin@gmail.com> * Fix some libultra struct types (#677) * Uintptr (#671) * Update render_courses.c * Update math_util.c * Update math_util.c * Update math_util.h * Update render_courses.c * Clang suggest (#678) * add clang suggestion * Update clang-format-suggest.yml * Update clang-format-suggest.yml * simplify * switch to ubuntu * Update clang-format-suggest.yml * update ubuntu --------- Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * Clang pr (#679) * Create clang-pr.yml * Update clang-pr.yml * Update osCreateMesgQueue.c * Update osCreateMesgQueue.c * Update clang-pr.yml * Update clang-pr.yml * Update clang-format.yml * clang format (#680) Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com> * some rename in ceremony (#647) * rename ceremony * apply some suggestion * some rename --------- Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * clang format (#681) Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com> * Rename Object Timing Related Code (#673) * start making models extraction with blender * finishing extract model * Update fast64 * extract course * Update fast64 * Update fast64 * simplify import of course_displaylists and course_textures and remplace adress with texture * Update fast64 * change data format and simplify the thread queue * move in a blender folder * remove fast64 * re add fast64 * add model_extract and fast64_blender in makefile * multithread with make file split the models into multiple json and add course segment * Update fast64 * remove old model_extract * remove the error when he don't find blender * start rename around course section * rename around object * update submodule fast64 * fix compilation issue and add some model to extract * Update fast64 * remove fast64 * re add fast64 * update submodule * fix compilation issue * add other collision gfx and prepare reorganise file * re arrange json * Create README.MD * Update README.MD * Update README.MD * update fast64 * rename to initiate_next_state * Revert "Merge branch '3d-objects' into general-object" This reverts commit f5347b38cc75af4d10ee3726dc1524c1c71d6849, reversing changes made to a353c4d954fb5b50c8b48fe3f9d67c95ccaab299. * revert the revert... * revert 3d-models PR * finish some revert * Update code_80005FD0.c * fix code_80091750.c * Update code_80091750.c * rename isTimerRunning to isTimerActive and set_object_timer_running to set_object_timer_state * rename to initialize_next_state * rename to object_next_state --------- Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * extract models with blender (#577) * start making models extraction with blender * finishing extract model * Update fast64 * extract course * Update fast64 * Update fast64 * simplify import of course_displaylists and course_textures and remplace adress with texture * Update fast64 * change data format and simplify the thread queue * move in a blender folder * remove fast64 * re add fast64 * add model_extract and fast64_blender in makefile * multithread with make file split the models into multiple json and add course segment * Update fast64 * remove old model_extract * remove the error when he don't find blender * start rename around course section * update submodule fast64 * fix compilation issue and add some model to extract * Update fast64 * remove fast64 * re add fast64 * update submodule * fix compilation issue * add other collision gfx and prepare reorganise file * re arrange json * Create README.MD * Update README.MD * Update README.MD * update fast64 --------- Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> * other * fix some error of compilation * finish fix all error --------- Signed-off-by: Gabriel Ravier <gabravier@gmail.com> Co-authored-by: MegaMech <MegaMech@users.noreply.github.com> Co-authored-by: Gabriel Ravier <gabravier@gmail.com> Co-authored-by: MisterSheeple <27652712+MisterSheeple@users.noreply.github.com> Co-authored-by: AloXado320 <38191089+AloXado320@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
Diffstat (limited to 'include')
-rw-r--r--include/PR/os_rdp.h87
-rw-r--r--include/PR/os_thread.h72
-rw-r--r--include/PR/os_time.h26
-rw-r--r--include/PR/os_tlb.h102
-rw-r--r--include/common_structs.h29
-rw-r--r--include/course.h2
-rw-r--r--include/course_offsets.h2
-rw-r--r--include/decode.h3
-rw-r--r--include/defines.h27
-rw-r--r--include/libc/stddef.h4
-rw-r--r--include/libc/string.h4
-rw-r--r--include/macros.h10
-rw-r--r--include/objects.h23
-rw-r--r--include/vehicles.h6
14 files changed, 358 insertions, 39 deletions
diff --git a/include/PR/os_rdp.h b/include/PR/os_rdp.h
new file mode 100644
index 000000000..995bd4640
--- /dev/null
+++ b/include/PR/os_rdp.h
@@ -0,0 +1,87 @@
+
+/*====================================================================
+ * os_rdp.h
+ *
+ * Copyright 1995, Silicon Graphics, Inc.
+ * All Rights Reserved.
+ *
+ * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
+ * Inc.; the contents of this file may not be disclosed to third
+ * parties, copied or duplicated in any form, in whole or in part,
+ * without the prior written permission of Silicon Graphics, Inc.
+ *
+ * RESTRICTED RIGHTS LEGEND:
+ * Use, duplication or disclosure by the Government is subject to
+ * restrictions as set forth in subdivision (c)(1)(ii) of the Rights
+ * in Technical Data and Computer Software clause at DFARS
+ * 252.227-7013, and/or in similar or successor clauses in the FAR,
+ * DOD or NASA FAR Supplement. Unpublished - rights reserved under the
+ * Copyright Laws of the United States.
+ *====================================================================*/
+
+/*---------------------------------------------------------------------*
+ Copyright (C) 1998 Nintendo. (Originated by SGI)
+
+ $RCSfile: os_rdp.h,v $
+ $Revision: 1.1 $
+ $Date: 1998/10/09 08:01:16 $
+ *---------------------------------------------------------------------*/
+
+#ifndef _OS_RDP_H_
+#define _OS_RDP_H_
+
+#ifdef _LANGUAGE_C_PLUS_PLUS
+extern "C" {
+#endif
+
+#include <PR/ultratypes.h>
+
+#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
+
+/**************************************************************************
+ *
+ * Type definitions
+ *
+ */
+
+#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
+
+/**************************************************************************
+ *
+ * Global definitions
+ *
+ */
+
+#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
+
+/**************************************************************************
+ *
+ * Macro definitions
+ *
+ */
+
+/**************************************************************************
+ *
+ * Extern variables
+ *
+ */
+
+/**************************************************************************
+ *
+ * Function prototypes
+ *
+ */
+
+/* Display processor interface (Dp) */
+extern u32 osDpGetStatus(void);
+extern void osDpSetStatus(u32);
+extern void osDpGetCounters(u32*);
+extern s32 osDpSetNextBuffer(void*, u64);
+
+#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
+
+#ifdef _LANGUAGE_C_PLUS_PLUS
+}
+#endif
+
+#endif /* !_OS_RDP_H_ */
diff --git a/include/PR/os_thread.h b/include/PR/os_thread.h
new file mode 100644
index 000000000..0d74fadfc
--- /dev/null
+++ b/include/PR/os_thread.h
@@ -0,0 +1,72 @@
+#ifndef _ULTRA64_THREAD_H_
+#define _ULTRA64_THREAD_H_
+#include "ultratypes.h"
+/* Recommended priorities for system threads */
+#define OS_PRIORITY_MAX 255
+#define OS_PRIORITY_VIMGR 254
+#define OS_PRIORITY_RMON 250
+#define OS_PRIORITY_RMONSPIN 200
+#define OS_PRIORITY_PIMGR 150
+#define OS_PRIORITY_SIMGR 140
+#define OS_PRIORITY_APPMAX 127
+#define OS_PRIORITY_IDLE 0
+
+#define OS_STATE_STOPPED 1
+#define OS_STATE_RUNNABLE 2
+#define OS_STATE_RUNNING 4
+#define OS_STATE_WAITING 8
+
+/* Types */
+
+typedef s32 OSPri;
+typedef s32 OSId;
+
+typedef union {
+ struct {
+ f32 f_odd;
+ f32 f_even;
+ } f;
+} __OSfp;
+
+typedef struct {
+ /* registers */
+ /*0x20*/ u64 at, v0, v1, a0, a1, a2, a3;
+ /*0x58*/ u64 t0, t1, t2, t3, t4, t5, t6, t7;
+ /*0x98*/ u64 s0, s1, s2, s3, s4, s5, s6, s7;
+ /*0xD8*/ u64 t8, t9, gp, sp, s8, ra;
+ /*0x108*/ u64 lo, hi;
+ /*0x118*/ u32 sr, pc, cause, badvaddr, rcp;
+ /*0x12C*/ u32 fpcsr;
+ __OSfp fp0, fp2, fp4, fp6, fp8, fp10, fp12, fp14;
+ __OSfp fp16, fp18, fp20, fp22, fp24, fp26, fp28, fp30;
+} __OSThreadContext;
+
+typedef struct {
+ u32 flag;
+ u32 count;
+ u64 time;
+} __OSThreadprofile_s;
+
+typedef struct OSThread_s {
+ /*0x00*/ struct OSThread_s* next;
+ /*0x04*/ OSPri priority;
+ /*0x08*/ struct OSThread_s** queue;
+ /*0x0C*/ struct OSThread_s* tlnext;
+ /*0x10*/ u16 state;
+ /*0x12*/ u16 flags;
+ /*0x14*/ OSId id;
+ /*0x18*/ int fp;
+ /*0x1C*/ __OSThreadprofile_s* thprof;
+ /*0x20*/ __OSThreadContext context;
+} OSThread;
+
+/* Functions */
+
+void osCreateThread(OSThread* thread, OSId id, void (*entry)(void*), void* arg, void* sp, OSPri pri);
+OSId osGetThreadId(OSThread* thread);
+OSPri osGetThreadPri(OSThread* thread);
+void osSetThreadPri(OSThread* thread, OSPri pri);
+void osStartThread(OSThread* thread);
+void osStopThread(OSThread* thread);
+
+#endif
diff --git a/include/PR/os_time.h b/include/PR/os_time.h
new file mode 100644
index 000000000..a243cdf2d
--- /dev/null
+++ b/include/PR/os_time.h
@@ -0,0 +1,26 @@
+#ifndef _ULTRA64_TIME_H_
+#define _ULTRA64_TIME_H_
+
+#include <PR/ultratypes.h>
+#include <PR/os_message.h>
+
+/* Types */
+
+typedef struct OSTimer_str {
+ struct OSTimer_str* next;
+ struct OSTimer_str* prev;
+ u64 interval;
+ u64 remaining;
+ OSMesgQueue* mq;
+ OSMesg* msg;
+} OSTimer;
+
+typedef u64 OSTime;
+
+/* Functions */
+
+OSTime osGetTime(void);
+void osSetTime(OSTime time);
+u32 osSetTimer(OSTimer*, OSTime, u64, OSMesgQueue*, OSMesg);
+
+#endif
diff --git a/include/PR/os_tlb.h b/include/PR/os_tlb.h
new file mode 100644
index 000000000..0a84b4d00
--- /dev/null
+++ b/include/PR/os_tlb.h
@@ -0,0 +1,102 @@
+
+/*====================================================================
+ * os_tlb.h
+ *
+ * Copyright 1995, Silicon Graphics, Inc.
+ * All Rights Reserved.
+ *
+ * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
+ * Inc.; the contents of this file may not be disclosed to third
+ * parties, copied or duplicated in any form, in whole or in part,
+ * without the prior written permission of Silicon Graphics, Inc.
+ *
+ * RESTRICTED RIGHTS LEGEND:
+ * Use, duplication or disclosure by the Government is subject to
+ * restrictions as set forth in subdivision (c)(1)(ii) of the Rights
+ * in Technical Data and Computer Software clause at DFARS
+ * 252.227-7013, and/or in similar or successor clauses in the FAR,
+ * DOD or NASA FAR Supplement. Unpublished - rights reserved under the
+ * Copyright Laws of the United States.
+ *====================================================================*/
+
+/*---------------------------------------------------------------------*
+ Copyright (C) 1998 Nintendo. (Originated by SGI)
+
+ $RCSfile: os_tlb.h,v $
+ $Revision: 1.1 $
+ $Date: 1998/10/09 08:01:20 $
+ *---------------------------------------------------------------------*/
+
+#ifndef _OS_TLB_H_
+#define _OS_TLB_H_
+
+#ifdef _LANGUAGE_C_PLUS_PLUS
+extern "C" {
+#endif
+
+#include <PR/ultratypes.h>
+
+#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
+
+/**************************************************************************
+ *
+ * Type definitions
+ *
+ */
+
+typedef u32 OSPageMask;
+
+#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
+
+/**************************************************************************
+ *
+ * Global definitions
+ *
+ */
+
+/*
+ * Page size argument for TLB routines
+ */
+#define OS_PM_4K 0x0000000
+#define OS_PM_16K 0x0006000
+#define OS_PM_64K 0x001e000
+#define OS_PM_256K 0x007e000
+#define OS_PM_1M 0x01fe000
+#define OS_PM_4M 0x07fe000
+#define OS_PM_16M 0x1ffe000
+
+#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
+
+/**************************************************************************
+ *
+ * Macro definitions
+ *
+ */
+
+/**************************************************************************
+ *
+ * Extern variables
+ *
+ */
+
+/**************************************************************************
+ *
+ * Function prototypes
+ *
+ */
+
+/* TLB management routines */
+
+extern void osMapTLB(s32, OSPageMask, void*, u32, u32, s32);
+extern void osMapTLBRdb(void);
+extern void osUnmapTLB(s32);
+extern void osUnmapTLBAll(void);
+extern void osSetTLBASID(s32);
+
+#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
+
+#ifdef _LANGUAGE_C_PLUS_PLUS
+}
+#endif
+
+#endif /* !_OS_TLB_H_ */
diff --git a/include/common_structs.h b/include/common_structs.h
index 2e777f5a3..46e3895da 100644
--- a/include/common_structs.h
+++ b/include/common_structs.h
@@ -1,7 +1,11 @@
#ifndef _COMMON_STRUCTS_H_
#define _COMMON_STRUCTS_H_
+#ifndef TARGET_N64
#include <libultraship.h>
+#else
+#include <ultra64.h>
+#endif
typedef f32 Vec3f[3];
typedef f32 Vec4f[4];
@@ -364,22 +368,23 @@ typedef struct {
/* 0x0DAC */ f32 unk_DAC;
/* 0x0DB0 */ f32 unk_DB0;
/* 0x0DB4 */ struct UnkPlayerInner unk_DB4;
- /* 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;
+ /* 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
+} Player; // size = 0xDD8
typedef struct {
// Something related to time trial ghost data?
diff --git a/include/course.h b/include/course.h
index 3844361d4..14e1daacd 100644
--- a/include/course.h
+++ b/include/course.h
@@ -10,7 +10,7 @@
*/
typedef struct {
- uintptr_t addr;
+ Gfx* addr;
u8 surfaceType;
u8 sectionId;
u16 flags;
diff --git a/include/course_offsets.h b/include/course_offsets.h
index 8d73170b4..5f5ddfec9 100644
--- a/include/course_offsets.h
+++ b/include/course_offsets.h
@@ -60,7 +60,7 @@ extern Animation d_rainbow_road_unk2;
extern Animation* d_rainbow_road_unk3[];
extern u32 d_rainbow_road_unk5[];
-extern Gfx* koopa_troopa_beach_dls1[];
+extern Gfx* d_course_koopa_troopa_beach_dl_list1[];
extern Gfx* koopa_troopa_beach_dls2[];
extern uintptr_t d_course_koopa_troopa_beach_unk_data1[];
extern s16 d_course_koopa_troopa_beach_unk_data2[];
diff --git a/include/decode.h b/include/decode.h
index f37cbedcd..98ead2c49 100644
--- a/include/decode.h
+++ b/include/decode.h
@@ -2,6 +2,9 @@
#define _FUNCTIONS_H_
#include <common_structs.h>
+#ifdef TARGET_N64
+void mio0decode(u8* arg0, u8* arg1);
+#endif
// Unused mio0decode function.
void func_80040030(u8* arg0, u8* arg1);
diff --git a/include/defines.h b/include/defines.h
index dadb7fa6a..4172ae5a0 100644
--- a/include/defines.h
+++ b/include/defines.h
@@ -165,12 +165,14 @@ enum PlayerId {
* the battle courses could be displayed in the same
* 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
+enum { MUSHROOM_CUP, FLOWER_CUP, STAR_CUP, SPECIAL_CUP, BATTLE_CUP, NUM_CUPS };
+
+#define NUM_COURSES_PER_CUP 4
+
+/**
+ * @brief Options for gCourseIndexInCup
+ */
+enum { COURSE_ONE, COURSE_TWO, COURSE_THREE, COURSE_FOUR };
/**
* @brief Character IDs
@@ -297,12 +299,6 @@ enum PlayerId {
#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
-
/**
* @brief Item IDs
*/
@@ -341,6 +337,13 @@ enum KART_AI_BEHAVIOURS {
BEHAVIOUR_MAX_SPEED
};
+enum DIRECTION {
+ NORTH,
+ EAST,
+ SOUTH,
+ WEST
+};
+
/**
* @brief Balloon status
*/
diff --git a/include/libc/stddef.h b/include/libc/stddef.h
index dda1d4157..6e7cf80d6 100644
--- a/include/libc/stddef.h
+++ b/include/libc/stddef.h
@@ -1,7 +1,11 @@
#ifndef STDDEF_H
#define STDDEF_H
+#ifndef TARGET_N64
#include <libultra/types.h>
+#else
+#include <PR/ultratypes.h>
+#endif
#ifndef offsetof
#define offsetof(st, m) ((size_t) & (((st*) 0)->m))
diff --git a/include/libc/string.h b/include/libc/string.h
index db8521960..11d4c58a7 100644
--- a/include/libc/string.h
+++ b/include/libc/string.h
@@ -1,7 +1,11 @@
#ifndef STRING_H
#define STRING_H
+#ifndef TARGET_N64
#include <libultra/types.h>
+#else
+#include <PR/ultratypes.h>
+#endif
void* memcpy(void* dst, const void* src, size_t size);
size_t strlen(const char* str);
diff --git a/include/macros.h b/include/macros.h
index 6f82fb26b..4676e7023 100644
--- a/include/macros.h
+++ b/include/macros.h
@@ -87,6 +87,7 @@
}
// convert a virtual address to physical.
+#ifndef TARGET_N64
#define VIRTUAL_TO_PHYSICAL(addr) (addr)
// convert a physical address to virtual.
@@ -94,6 +95,15 @@
// another way of converting virtual to physical
#define VIRTUAL_TO_PHYSICAL2(addr) (addr)
+#else
+#define VIRTUAL_TO_PHYSICAL(addr) ((uintptr_t) (addr) & 0x1FFFFFFF)
+
+// convert a physical address to virtual.
+#define PHYSICAL_TO_VIRTUAL(addr) ((uintptr_t) (addr) | 0x80000000)
+
+// another way of converting virtual to physical
+#define VIRTUAL_TO_PHYSICAL2(addr) ((u8*) (addr) - 0x80000000U)
+#endif
// aligns an address to the next 16 bytes
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
diff --git a/include/objects.h b/include/objects.h
index 7dd2c1a66..c3ee37a1b 100644
--- a/include/objects.h
+++ b/include/objects.h
@@ -18,26 +18,35 @@ typedef struct {
/* 0x44 */ f32 surfaceHeight;
/* 0x48 */ s32 unk_048;
/* 0x4C */ s32 unk_04C;
- /* 0x50 */ s32 unk_050;
+ /* 0x50 */ s32 timer;
/* 0x54 */ s32 status;
/* 0x58 */ s32 unk_058;
/* 0x5C */ s32 unk_05C;
+#ifndef TARGET_N64
/* 0x60 */ const char* activeTLUT;
/* 0x64 */ const char* activeTexture;
+#else
+ /* 0x60 */ u8* activeTLUT;
+ /* 0x64 */ u8* activeTexture;
+#endif
/**
* "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
+#ifndef TARGET_N64
/* 0x6C */ const char** textureList;
+#else
+ /* 0x6C */ u8* textureList;
+#endif
/* 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;
+ /* 0x98 */ u16 animationTimer;
/* 0x9A */ u16 unk_09A;
/* 0x9C */ s16 unk_09C;
/* 0x9E */ s16 unk_09E;
@@ -57,14 +66,14 @@ typedef struct {
/* 0xC6 */ u16 unk_0C6;
/* 0xC8 */ u16 boundingBoxSize;
/* 0xCA */ s8 unk_0CA;
- /* 0xCB */ s8 unk_0CB;
+ /* 0xCB */ s8 isTimerActive;
/* 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;
+ /* 0xD2 */ s8 textureListIndex;
/* 0xD3 */ s8 unk_0D3;
/* 0xD4 */ s8 unk_0D4;
/* 0xD5 */ u8 unk_0D5;
@@ -93,7 +102,7 @@ typedef struct {
/* 0x44 */ f32 unk_044;
/* 0x48 */ s32 unk_048;
/* 0x4C */ s32 unk_04C;
- /* 0x50 */ s32 unk_050;
+ /* 0x50 */ s32 timer;
/* 0x54 */ s32 status;
/* 0x58 */ s32 unk_058;
/* 0x5C */ s32 unk_05C;
@@ -132,14 +141,14 @@ typedef struct {
/* 0xC6 */ u16 unk_0C6;
/* 0xC8 */ u16 unk_0C8;
/* 0xCA */ s8 unk_0CA;
- /* 0xCB */ s8 unk_0CB;
+ /* 0xCB */ s8 isTimerActive;
/* 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;
+ /* 0xD2 */ s8 textureListIndex;
/* 0xD3 */ s8 unk_0D3;
/* 0xD4 */ s8 unk_0D4;
/* 0xD5 */ u8 unk_0D5;
diff --git a/include/vehicles.h b/include/vehicles.h
index b4c424c0a..837cc2f2d 100644
--- a/include/vehicles.h
+++ b/include/vehicles.h
@@ -40,12 +40,6 @@
#define RENDER_VEHICLE 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
-
typedef struct {
/* 0x00 */ s16 isActive; // Only used for Tender and Passenger Cars, unused for Locomotives
/* 0x02 */ s16 compilerPadding;