Fixed more errors, we are rendering the logo, Yay

This commit is contained in:
KiritoDv 2024-05-03 18:20:20 -06:00
parent c78629d5b9
commit 1fbf28a78d
31 changed files with 273 additions and 252 deletions

4
.gitignore vendored
View File

@ -102,4 +102,6 @@ mingw64/
# torch
torch.hash.yml
build*
build*
cmake*
.idea

View File

@ -122,7 +122,7 @@ file(GLOB_RECURSE ALL_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"src/port/*.h"
"src/port/*.c"
"src/port/*.cpp"
"assets/code/*.c"
# "assets/code/*.c"
"courses/*.c"
"courses/*.h"
)

View File

@ -8099,7 +8099,7 @@ u8 d_course_koopa_troopa_beach_crab_frames[][4096] = {
// 0x06014828
// animations? lights?
u32 d_course_koopa_troopa_beach_unk_data1[] = {
uintptr_t d_course_koopa_troopa_beach_unk_data1[] = {
0x00000000,
0x00000001,
0x00000000,
@ -8107,7 +8107,7 @@ u32 d_course_koopa_troopa_beach_unk_data1[] = {
};
// 0x06014838
s16 d_course_koopa_troopa_beach_unk_data2[] = {
uintptr_t d_course_koopa_troopa_beach_unk_data2[] = {
0x0000, 0x0000,
0x0000, 0x0001,
0x0002, 0x0003,
@ -8539,7 +8539,7 @@ Gfx d_course_koopa_troopa_beach_dl_16990[] =
};
//! 0x60169b
u32 d_course_koopa_troopa_beach_unk4[] = {
uintptr_t d_course_koopa_troopa_beach_unk4[] = {
0x00000001,
0x00000002,
@ -8557,7 +8557,7 @@ u32 d_course_koopa_troopa_beach_unk4[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_koopa_troopa_beach_dl_16630,
(uintptr_t) d_course_koopa_troopa_beach_dl_16630,
0x00000000,
0x00000000,
0x00000000,
@ -8579,7 +8579,7 @@ u32 d_course_koopa_troopa_beach_unk4[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_koopa_troopa_beach_dl_16850,
(uintptr_t) d_course_koopa_troopa_beach_dl_16850,
0x00000000,
0x00000000,
0x00000000,
@ -8590,7 +8590,7 @@ u32 d_course_koopa_troopa_beach_unk4[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_koopa_troopa_beach_dl_168F0,
(uintptr_t) d_course_koopa_troopa_beach_dl_168F0,
0x00000024,
0x00000000,
0x00000000,
@ -8601,7 +8601,7 @@ u32 d_course_koopa_troopa_beach_unk4[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_koopa_troopa_beach_dl_16990,
(uintptr_t) d_course_koopa_troopa_beach_dl_16990,
0x00000019,
0x00000000,
0x00000000,
@ -8629,7 +8629,7 @@ u32 d_course_koopa_troopa_beach_unk4[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_koopa_troopa_beach_dl_16850,
(uintptr_t) d_course_koopa_troopa_beach_dl_16850,
0x00000000,
0x00000000,
0x00000000,
@ -8640,7 +8640,7 @@ u32 d_course_koopa_troopa_beach_unk4[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_koopa_troopa_beach_dl_168F0,
(uintptr_t) d_course_koopa_troopa_beach_dl_168F0,
0x00000024,
0x00000000,
0x00000000,
@ -8651,7 +8651,7 @@ u32 d_course_koopa_troopa_beach_unk4[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_koopa_troopa_beach_dl_16990,
(uintptr_t) d_course_koopa_troopa_beach_dl_16990,
0x00000019,
0x00000000,
0x00000000,
@ -8684,7 +8684,7 @@ animation_type_2 *d_course_koopa_troopa_beach_unk_data5[] = {
};
// No idea what this stuff is
u32 d_course_koopa_troopa_beach_unk_data6[] = {
uintptr_t d_course_koopa_troopa_beach_unk_data6[] = {
0x00000000,
0x00000000,
0x00000001,

View File

@ -312,7 +312,7 @@ extern TrackWaypoint d_course_koopa_troopa_beach_track_waypoints[];
extern TrackWaypoint d_course_koopa_troopa_beach_track_waypoints_2[];
extern u8 d_course_koopa_troopa_beach_crab_tlut[];
extern u8 d_course_koopa_troopa_beach_crab_frames[][4096];
extern u32 d_course_koopa_troopa_beach_unk_data1[];
extern uintptr_t d_course_koopa_troopa_beach_unk_data1[];
extern s16 d_course_koopa_troopa_beach_unk_data2[];
extern animation_type_3_triplet d_course_koopa_troopa_beach_unk_data3[];
extern animation_type_2 d_course_koopa_troopa_beach_unk_data4;
@ -331,9 +331,9 @@ extern Vtx d_course_koopa_troopa_beach_bird_wing_2_model[];
extern Gfx d_course_koopa_troopa_beach_dl_168F0[];
extern Vtx d_course_koopa_troopa_beach_bird_wing_3_model[];
extern Gfx d_course_koopa_troopa_beach_dl_16990[];
extern u32 d_course_koopa_troopa_beach_unk4[];
extern uintptr_t d_course_koopa_troopa_beach_unk4[];
extern animation_type_2 *d_course_koopa_troopa_beach_unk_data5[];
extern u32 d_course_koopa_troopa_beach_unk_data6[];
extern uintptr_t d_course_koopa_troopa_beach_unk_data6[];
extern Lights1 d_course_koopa_troopa_beach_light2;
extern Vtx d_course_koopa_troopa_beach_tree_model[];
extern Vtx d_course_koopa_troopa_beach_unknown_model4[];

View File

@ -3529,7 +3529,7 @@ animation_type_2 *d_rainbow_road_unk3[] = {
};
// 0x06016110
u32 d_rainbow_road_unk4[] = {
uintptr_t d_rainbow_road_unk4[] = {
0x00000001,
0x00000002,
@ -3547,7 +3547,7 @@ u32 d_rainbow_road_unk4[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_rainbow_road_dl_15550,
(uintptr_t) d_course_rainbow_road_dl_15550,
0x00000000,
0x00000000,
0x00000000,
@ -3555,7 +3555,7 @@ u32 d_rainbow_road_unk4[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_rainbow_road_dl_151A8,
(uintptr_t) d_course_rainbow_road_dl_151A8,
0x00000000,
0x00000000,
0x00000000,
@ -3577,7 +3577,7 @@ u32 d_rainbow_road_unk4[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_rainbow_road_dl_15C68,
(uintptr_t) d_course_rainbow_road_dl_15C68,
0x00000000,
0x00000000,
0x00000000,
@ -3585,7 +3585,7 @@ u32 d_rainbow_road_unk4[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_rainbow_road_dl_158C0,
(uintptr_t) d_course_rainbow_road_dl_158C0,
0x00000000,
0x00000000,
0x00000000,
@ -3593,7 +3593,7 @@ u32 d_rainbow_road_unk4[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_rainbow_road_dl_15F18,
(uintptr_t) d_course_rainbow_road_dl_15F18,
0x00000000,
0x00000000,
0x00000000,
@ -3609,7 +3609,7 @@ u32 d_rainbow_road_unk4[] = {
};
// No idea what this stuff is
u32 d_rainbow_road_unk5[] = {
uintptr_t d_rainbow_road_unk5[] = {
0x00000000,
0x00000000,
0x00000002,

View File

@ -4288,7 +4288,7 @@ Gfx d_course_sherbet_land_dl_8E00[] =
};
// 0x06008EB0
u32 d_course_sherbet_land_unk_data1[] = {
uintptr_t d_course_sherbet_land_unk_data1[] = {
0x00000001,
0x00000002,
@ -5209,7 +5209,7 @@ animation_type_2 *d_course_sherbet_land_unk_data11[] = {
};
// No idea what this stuff is
u32 d_course_sherbet_land_unk_data12[] = {
uintptr_t d_course_sherbet_land_unk_data12[] = {
0x00000000,
0x00000000,
0x00000001,

View File

@ -194,7 +194,7 @@ extern Vtx d_course_sherbet_land_penguin_body_model1[];
extern Vtx d_course_sherbet_land_penguin_body_model2[];
extern Gfx d_course_sherbet_land_dl_8D00[];
extern Gfx d_course_sherbet_land_dl_8E00[];
extern u32 d_course_sherbet_land_unk_data1[];
extern uintptr_t d_course_sherbet_land_unk_data1[];
extern s16 d_course_sherbet_land_unk_data2[];
extern animation_type_3_triplet d_course_sherbet_land_unk_data3[];
extern animation_type_2 d_course_sherbet_land_unk_data4;
@ -205,7 +205,7 @@ extern s16 d_course_sherbet_land_unk_data8[];
extern animation_type_3_triplet d_course_sherbet_land_unk_data9[];
extern animation_type_2 d_course_sherbet_land_unk_data10;
extern animation_type_2 *d_course_sherbet_land_unk_data11[];
extern u32 d_course_sherbet_land_unk_data12[];
extern uintptr_t d_course_sherbet_land_unk_data12[];
extern Gfx d_course_sherbet_land_dl_9AE8[];
extern struct ActorSpawnData d_course_sherbet_land_item_box_spawns[];
extern TrackSections d_course_sherbet_land_addr[];

View File

@ -10868,7 +10868,7 @@ animation_type_2 *d_course_yoshi_valley_unk4[] = {
};
//! 0x06014798
u32 d_course_yoshi_valley_unk5[] = {
uintptr_t d_course_yoshi_valley_unk5[] = {
0x00000001,
0x00000002,
@ -10886,7 +10886,7 @@ u32 d_course_yoshi_valley_unk5[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_yoshi_valley_dl_142C0,
(uintptr_t) d_course_yoshi_valley_dl_142C0,
0x00000000,
0x00000000,
0x00000000,
@ -10908,7 +10908,7 @@ u32 d_course_yoshi_valley_unk5[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_yoshi_valley_dl_143C8,
(uintptr_t) d_course_yoshi_valley_dl_143C8,
0x00000000,
0x00000000,
0x00000000,
@ -10919,7 +10919,7 @@ u32 d_course_yoshi_valley_unk5[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_yoshi_valley_dl_144A8,
(uintptr_t) d_course_yoshi_valley_dl_144A8,
0x000001cc,
0x00000000,
0x00000000,
@ -10930,7 +10930,7 @@ u32 d_course_yoshi_valley_unk5[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_yoshi_valley_dl_14500,
(uintptr_t) d_course_yoshi_valley_dl_14500,
0x000001cc,
0x00000000,
0x00000000,
@ -10941,7 +10941,7 @@ u32 d_course_yoshi_valley_unk5[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_yoshi_valley_dl_14558,
(uintptr_t) d_course_yoshi_valley_dl_14558,
0x00000158,
0x00000000,
0x00000000,
@ -10952,7 +10952,7 @@ u32 d_course_yoshi_valley_unk5[] = {
0x00000000,
0x00000007,
0x00000000,
(u32) d_course_yoshi_valley_dl_145D0,
(uintptr_t) d_course_yoshi_valley_dl_145D0,
0x00000120,
0x00000000,
0x00000000,
@ -10986,7 +10986,7 @@ u32 d_course_yoshi_valley_unk5[] = {
};
// No idea what this stuff is
u32 d_course_yoshi_valley_unk6[] = {
uintptr_t d_course_yoshi_valley_unk6[] = {
0x00000000,
0x00000001,
};

View File

@ -165,8 +165,8 @@ extern s16 d_course_yoshi_valley_unk1[];
extern animation_type_3_triplet d_course_yoshi_valley_unk2[];
extern animation_type_2 d_course_yoshi_valley_unk3;
extern animation_type_2 *d_course_yoshi_valley_unk4[];
extern u32 d_course_yoshi_valley_unk5[];
extern u32 d_course_yoshi_valley_unk6[];
extern uintptr_t d_course_yoshi_valley_unk5[];
extern uintptr_t d_course_yoshi_valley_unk6[];
extern u8 d_course_yoshi_valley_hedgehog_tlut[];
extern u8 d_course_yoshi_valley_hedgehog[];
extern Vtx d_course_yoshi_valley_tree_model[];

View File

@ -42,14 +42,14 @@
// Align to 8-byte boundary for DMA requirements
#ifdef __GNUC__
#define ALIGNED8 __attribute__((aligned(8)))
#define ALIGNED8
#else
#define ALIGNED8
#endif
// Align to 16-byte boundary for audio lib requirements
#ifdef __GNUC__
#define ALIGNED16 __attribute__((aligned(16)))
#define ALIGNED16
#else
#define ALIGNED16
#endif
@ -72,13 +72,13 @@
{((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) ((uintptr_t)(addr) & 0x1FFFFFFF)
#define VIRTUAL_TO_PHYSICAL(addr) (addr)
// convert a physical address to virtual.
#define PHYSICAL_TO_VIRTUAL(addr) ((uintptr_t)(addr) | 0x80000000)
#define PHYSICAL_TO_VIRTUAL(addr) (addr)
// another way of converting virtual to physical
#define VIRTUAL_TO_PHYSICAL2(addr) ((u8 *)(addr) - 0x80000000U)
#define VIRTUAL_TO_PHYSICAL2(addr) (addr)
// aligns an address to the next 16 bytes
#define ALIGN16(val) (((val) + 0xF) & ~0xF)

View File

@ -2,6 +2,7 @@
#define MK64_H
#include <libultraship.h>
#include <string.h>
/**
* @file mk64.h

View File

@ -11,6 +11,8 @@
#include "audio/port_eu.h"
#include "buffers/gfx_output_buffer.h"
#include <string.h>
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
struct SequencePlayer gSequencePlayers[SEQUENCE_PLAYERS];

View File

@ -413,6 +413,6 @@ extern s32 D_8016448C;
extern u16 D_801637BE;
extern u16 D_80163E2A;
extern Gfx D_0D0076F8[];
// extern Gfx D_0D0076F8[];
#endif

View File

@ -3312,12 +3312,12 @@ Gfx *func_80097AE4(Gfx *displayListHead, s8 fmt, s32 arg2, s32 arg3, u8 *arg4, s
dsdx = 0x8000 / (32 - width);
gDPLoadTextureTile(displayListHead++, arg4, fmt, G_IM_SIZ_16b, 64, 64, temp, i, temp + 32, i + 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(displayListHead++, (arg2 + width) << 2, arg3 << 2, (arg2 + 32) << 2, (arg3 + 32) << 2, 0, 0, 0, dsdx, 1024);
arg2 += 32;
gDPLoadTextureTile(displayListHead++, arg4, fmt, G_IM_SIZ_16b, 64, 64, temp + 32, i, temp + 64, i + 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(displayListHead++, arg2 << 2, arg3 << 2, ((arg2 - width) + 32) << 2, (arg3 + 32) << 2, 0, 0, 0, dsdx, 1024);
arg2 = arg2Copy;
arg3 += 32;
}
@ -3335,7 +3335,7 @@ Gfx *func_80097E58(Gfx *displayListHead, s8 fmt, u32 arg2, u32 arg3, u32 arg4, u
s32 temp2 = 32;
if (width >= 32) { return displayListHead; }
arg6Copy = arg6;
lrs = arg9 / 2;
@ -3524,17 +3524,15 @@ void func_80099110(void) {
* @return void*
*/
void *segmented_to_virtual_dupe(const void *addr) {
size_t segment = (uintptr_t) addr >> 24;
size_t offset = (uintptr_t) addr & 0x00FFFFFF;
return (void *) ((gSegmentTable[segment] + offset) + 0x80000000);
return addr;
}
void *segmented_to_virtual_dupe_2(const void *addr) {
size_t segment = (uintptr_t) addr >> 24;
/*size_t segment = (uintptr_t) addr >> 24;
size_t offset = (uintptr_t) addr & 0x00FFFFFF;
return (void *) ((gSegmentTable[segment] + offset) + 0x80000000);
return (void *) ((gSegmentTable[segment] + offset) + 0x80000000);*/
return addr;
}
#ifdef NON_MATCHING

View File

@ -8,6 +8,7 @@
#include "memory.h"
#include "main.h"
#include "math_util.h"
#include <stdlib.h>
/*** Data ***/
Ambient D_800E8680 = {{
@ -32,8 +33,8 @@ Vtx *D_8018EDBC;
#define SQ(x) ((x) * (x))
void func_800AF9B0(void) {
D_8018EDB8 = (void *)get_next_available_memory_addr(480 * sizeof(Vtx));
D_8018EDBC = (void *)get_next_available_memory_addr(480 * sizeof(Vtx));
D_8018EDB8 = (void *)calloc(480, sizeof(Vtx));
D_8018EDBC = (void *)calloc(480, sizeof(Vtx));
}
// could be a normal vertex, not a color...
@ -186,7 +187,7 @@ void func_800B0004(void) {
for (j = 0; j < 12; j++) {
res1 = sins(D_8018EDB0 - (j * D_8018EDB2)) * 84.0f * j * 0.18f;
res2 = sins(D_8018EDB0 - ((j + 1) * D_8018EDB2)) * 84.0f * (j + 1) * 0.18f;
func_800AF9E4(&(&vtxs[j * 4])[i * 48], j, i, 84, res1, res2, (j * 84), 84);
func_800AF9E4(&vtxs[j * 4 + i * 48], j, i, 84, res1, res2, (j * 84), 84);
}
}
func_800AFF58(vtxs);

View File

@ -258,5 +258,5 @@ void create_debug_thread(void) {
}
void start_debug_thread(void) {
osStartThread(&D_80162790);
// osStartThread(&D_80162790);
}

View File

@ -20,6 +20,7 @@
#include "main.h"
#include "menus.h"
#include "render_courses.h"
#include <string.h>
#define bcopy memcpy

View File

@ -17,6 +17,7 @@
#include "code_80005FD0.h"
#include "code_80281C40.h"
#include "math_util.h"
#include <string.h>
s32 fireworkConeColour[] = {
0x00FF4080, // pink

View File

@ -265,15 +265,17 @@ void start_sptask(s32 taskType) {
gActiveSPTask->state = SPTASK_STATE_RUNNING;
}
extern void Graphics_PushFrame(Gfx* data);
/**
* Initializes the Fast3D OSTask structure.
* Loads F3DEX or F3DLX based on the number of players
**/
void create_gfx_task_structure(void) {
gGfxSPTask->msgqueue = &gGfxVblankQueue;
gGfxSPTask->msg = OS_MESG_32(2);
gGfxSPTask->task.t.type = M_GFXTASK;
gGfxSPTask->task.t.flags = OS_TASK_DP_WAIT;
// gGfxSPTask->msg = OS_MESG_32(2);
// gGfxSPTask->task.t.type = M_GFXTASK;
// gGfxSPTask->task.t.flags = OS_TASK_DP_WAIT;
// gGfxSPTask->task.t.ucode_boot = rspF3DBootStart;
// gGfxSPTask->task.t.ucode_boot_size = ((u8 *) rspF3DBootEnd - (u8 *) rspF3DBootStart);
// The split-screen multiplayer racing state uses F3DLX which has a simple subpixel calculation.
@ -286,19 +288,21 @@ void create_gfx_task_structure(void) {
// gGfxSPTask->task.t.ucode = gspF3DLXTextStart;
// gGfxSPTask->task.t.ucode_data = gspF3DLXDataStart;
// }
gGfxSPTask->task.t.flags = 0;
gGfxSPTask->task.t.flags = OS_TASK_DP_WAIT;
// gGfxSPTask->task.t.flags = 0;
// gGfxSPTask->task.t.flags = OS_TASK_DP_WAIT;
// gGfxSPTask->task.t.ucode_size = SP_UCODE_SIZE;
// gGfxSPTask->task.t.ucode_data_size = SP_UCODE_DATA_SIZE;
gGfxSPTask->task.t.dram_stack = (u64 *) &gGfxSPTaskStack;
// gGfxSPTask->task.t.dram_stack_size = SP_DRAM_STACK_SIZE8;
gGfxSPTask->task.t.output_buff = (u64 *) &gGfxSPTaskOutputBuffer;
gGfxSPTask->task.t.output_buff_size = (u64 *) ((u8 *) gGfxSPTaskOutputBuffer + sizeof(gGfxSPTaskOutputBuffer));
gGfxSPTask->task.t.data_ptr = (u64 *) gGfxPool->gfxPool;
gGfxSPTask->task.t.data_size = (gDisplayListHead - gGfxPool->gfxPool) * sizeof(Gfx);
// gGfxSPTask->task.t.dram_stack = (u64 *) &gGfxSPTaskStack;
// // gGfxSPTask->task.t.dram_stack_size = SP_DRAM_STACK_SIZE8;
// gGfxSPTask->task.t.output_buff = (u64 *) &gGfxSPTaskOutputBuffer;
// gGfxSPTask->task.t.output_buff_size = (u64 *) ((u8 *) gGfxSPTaskOutputBuffer + sizeof(gGfxSPTaskOutputBuffer));
// gGfxSPTask->task.t.data_ptr = (u64 *) gGfxPool->gfxPool;
// gGfxSPTask->task.t.data_size = (gDisplayListHead - gGfxPool->gfxPool) * sizeof(Gfx);
func_8008C214();
gGfxSPTask->task.t.yield_data_ptr = (u64 *) &gGfxSPTaskYieldBuffer;
gGfxSPTask->task.t.yield_data_size = OS_YIELD_DATA_SIZE;
// gGfxSPTask->task.t.yield_data_ptr = (u64 *) &gGfxSPTaskYieldBuffer;
// gGfxSPTask->task.t.yield_data_size = OS_YIELD_DATA_SIZE;
Graphics_PushFrame(gGfxPool->gfxPool);
}
@ -353,7 +357,7 @@ void read_controllers(void) {
OSMesg msg;
osContStartReadData(&gSIEventMesgQueue);
osRecvMesg(&gSIEventMesgQueue, &msg, OS_MESG_BLOCK);
// osRecvMesg(&gSIEventMesgQueue, &msg, OS_MESG_BLOCK);
osContGetReadData(gControllerPads);
update_controller(0);
update_controller(1);
@ -454,14 +458,14 @@ void config_gfx_pool(void) {
*/
void display_and_vsync(void) {
profiler_log_thread5_time(BEFORE_DISPLAY_LISTS);
osRecvMesg(&gGfxVblankQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
// osRecvMesg(&gGfxVblankQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
exec_display_list(&gGfxPool->spTask);
profiler_log_thread5_time(AFTER_DISPLAY_LISTS);
osRecvMesg(&gGameVblankQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
// osRecvMesg(&gGameVblankQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
osViSwapBuffer((void *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[sRenderedFramebuffer]));
profiler_log_thread5_time(THREAD5_END);
osRecvMesg(&gGameVblankQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
crash_screen_set_framebuffer(gPhysicalFramebuffers[sRenderedFramebuffer]);
// osRecvMesg(&gGameVblankQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
// crash_screen_set_framebuffer(gPhysicalFramebuffers[sRenderedFramebuffer]);
if (++sRenderedFramebuffer == 3) {
sRenderedFramebuffer = 0;
@ -504,6 +508,8 @@ void dma_copy(u8 *dest, u8 *romAddr, size_t size) {
}
}
static u8 memoryPool[0xAB630];
/**
* Setup main segments and framebuffers.
*/
@ -515,14 +521,15 @@ void setup_game_memory(void) {
// uintptr_t allocatedMemory;
// UNUSED s32 unknown_padding;
// init_segment_racing();
// gHeapEndPtr = SEG_RACING;
init_segment_racing();
// gHeapEndPtr = SEG_RACING;
// set_segment_base_addr(0, (void *) SEG_START);
// // Memory pool size of 0xAB630
// initialize_memory_pool(MEMORY_POOL_START, MEMORY_POOL_END);
bzero(memoryPool, sizeof(memoryPool));
initialize_memory_pool(memoryPool, memoryPool + sizeof(memoryPool));
// func_80000BEC();
func_80000BEC();
// // Initialize trig tables segment
// osInvalDCache((void *) TRIG_TABLES, TRIG_TABLES_SIZE);
@ -1170,6 +1177,7 @@ void update_gamestate(void) {
}
void thread5_game_loop(void) {
setup_game_memory();
osCreateMesgQueue(&gGfxVblankQueue, gGfxMesgBuf, 1);
osCreateMesgQueue(&gGameVblankQueue, &gGameMesgBuf, 1);
init_controllers();
@ -1177,7 +1185,7 @@ void thread5_game_loop(void) {
clear_nmi_buffer();
}
set_vblank_handler(2, &gGameVblankHandler, &gGameVblankQueue, (OSMesg *)(OS_EVENT_SW2));
// set_vblank_handler(2, &gGameVblankHandler, &gGameVblankQueue, (OSMesg *)(OS_EVENT_SW2));
// These variables track stats such as player wins.
// In the event of a console reset, it remembers them.
gNmiUnknown1 = &pAppNmiBuffer[0]; // 2 u8's, tracks number of times player 1/2 won a VS race
@ -1189,22 +1197,22 @@ void thread5_game_loop(void) {
rendering_init();
read_controllers();
func_800C5CB8();
}
while(true) {
func_800CB2C4();
void thread5_iteration(void){
// func_800CB2C4();
// Update the gamestate if it has changed (racing, menus, credits, etc.).
if (gGamestateNext != gGamestate) {
gGamestate = gGamestateNext;
update_gamestate();
}
profiler_log_thread5_time(THREAD5_START);
config_gfx_pool();
read_controllers();
game_state_handler();
end_master_display_list();
display_and_vsync();
// Update the gamestate if it has changed (racing, menus, credits, etc.).
if (gGamestateNext != gGamestate) {
gGamestate = gGamestateNext;
update_gamestate();
}
profiler_log_thread5_time(THREAD5_START);
config_gfx_pool();
read_controllers();
game_state_handler();
end_master_display_list();
display_and_vsync();
}
/**

View File

@ -19,7 +19,7 @@
#define MTX_HUD_POOL_SIZE_MAX MTX_HUD_POOL_SIZE - 50
#endif
#define MTX_OBJECT_POOL_SIZE 128
#define MTX_OBJECT_POOL_SIZE 512
//! @todo Verify with proper documentation
// functions called by mtxShadow multiply by 8
@ -40,7 +40,7 @@
#define MTX_EFFECT_POOL_SIZE_MAX MTX_EFFECT_POOL_SIZE + 100
#endif
#define GFX_POOL_SIZE 7500
#define GFX_POOL_SIZE 15000
struct GfxPool {
/* 0x00000 */ Mtx mtxScreen; // Matrix for skybox and startup logo
@ -102,6 +102,7 @@ void func_8000262C(void);
void func_80002658(void);
void update_gamestate(void);
void thread5_game_loop(void);
void thread5_iteration(void);
void thread4_audio(void*);

View File

@ -1524,7 +1524,7 @@ void player_select_menu_act(struct Controller *controller, u16 arg1) {
if (!func_800B4520()) {
switch (D_8018EDEE) {
case 1:
case 1:
{
saved_selection = gCharacterGridSelections[arg1];
if (saved_selection == 0) {
@ -1565,7 +1565,7 @@ void player_select_menu_act(struct Controller *controller, u16 arg1) {
func_800B44AC();
gMenuTimingCounter = 0;
}
// L800B3768
if (D_8018EDE8[arg1] == 0) {
if ((btnAndStick & CONT_RIGHT) && (btnAndStick & CONT_DOWN)) {

View File

@ -49,7 +49,7 @@ extern f32 D_8018EDDC;
extern s32 D_8018EDE0;
extern s8 gCharacterGridSelections[];
extern s8 D_8018EDE8[];
extern bool D_8018EDE8[];
extern s8 D_8018EDEC;
extern s8 gMainMenuSelectionDepth;
extern s8 D_8018EDEE;

View File

@ -32,7 +32,7 @@
#include <libultraship.h>
void guMtxXFMF(Mtx *, float, float, float, float *, float *, float *);
// void guMtxXFMF(Mtx *, float, float, float, float *, float *, float *);
void guMtxCatF(float mf[4][4], float nf[4][4], float res[4][4]);
void guMtxCatL(Mtx *m, Mtx *n, Mtx *res) {

View File

@ -81,7 +81,7 @@ s32 __osSpSetPc(void *);
s32 __osSpDeviceBusy(void);
s32 __osSiDeviceBusy(void);
s32 __osSpRawStartDma(u32 dir, void *sp_ptr, void *dram_ptr, size_t size);
void __osSetHWIntrRoutine(OSHWIntr interrupt, s32 (*handler)(void));
void __osSetHWIntrRoutine(OSHWIntr interrupt, s32 (*callback)(void), void* sp);
s32 __osLeoInterrupt();
void __osViInit(void);
OSViContext *__osViGetCurrentContext(void);

View File

@ -22,7 +22,7 @@ GameEngine* GameEngine::Instance;
GameEngine::GameEngine() {
std::vector<std::string> OTRFiles;
if (const std::string cube_path = LUS::Context::GetPathRelativeToAppDirectory("sp.otr"); std::filesystem::exists(cube_path)) {
if (const std::string cube_path = LUS::Context::GetPathRelativeToAppDirectory("mkcube.otr"); std::filesystem::exists(cube_path)) {
OTRFiles.push_back(cube_path);
}
if (const std::string sm64_otr_path = LUS::Context::GetPathRelativeToAppBundle("sm64.otr"); std::filesystem::exists(sm64_otr_path)) {
@ -60,6 +60,7 @@ void GameEngine::Destroy(){
bool ShouldClearTextureCacheAtEndOfFrame = false;
void GameEngine::StartFrame() const{
using LUS::KbScancode;
const int32_t dwScancode = this->context->GetWindow()->GetLastScancode();

View File

@ -19,9 +19,10 @@ extern "C" void Timer_Update();
void push_frame() {
// GameEngine::StartAudioFrame();
GameEngine::Instance->StartFrame();
thread5_iteration();
// thread5_game_loop();
// Graphics_ThreadUpdate();w
// Timer_Update();
// thread5_iteration();
// GameEngine::EndAudioFrame();
}
@ -34,8 +35,8 @@ extern "C"
int main(int argc, char *argv[]) {
#endif
GameEngine::Create();
audio_init();
sound_init();
// audio_init();
// sound_init();
thread5_game_loop();
GameEngine::Instance->ProcessFrame(push_frame);
GameEngine::Instance->Destroy();

View File

@ -35,7 +35,7 @@ void set_vertex_data_with_defaults(Gfx*);
void set_vertex_data_with_default_section_id(Gfx*, s8);
void find_and_set_vertex_data(Gfx*, s8, u16);
void find_and_set_tile_size(uintptr_t, s32, s32);
void set_vertex_colours(u32, u32, s32, s8, u8, u8, u8);
void set_vertex_colours(uintptr_t, u32, s32, s8, u8, u8, u8);
void find_vtx_and_set_colours(uintptr_t, s8, u8, u8, u8);
void subtract_scaled_vector(Vec3f, f32, Vec3f);

View File

@ -16,7 +16,7 @@
s32 sGfxSeekPosition;
s32 sPackedSeekPosition;
u32 sPoolFreeSpace;
uintptr_t sPoolFreeSpace;
struct MainPoolBlock *sPoolListHeadL;
struct MainPoolBlock *sPoolListHeadR;
@ -34,11 +34,11 @@ s32 memoryPadding[2];
* @param size of memory to allocate.
* @return Address of free memory
*/
void *get_next_available_memory_addr(u32 size) {
u32 *freeSpace = (u32 *)gNextFreeMemoryAddress;
void *get_next_available_memory_addr(uintptr_t size) {
uintptr_t freeSpace = gNextFreeMemoryAddress;
size = ALIGN16(size);
gNextFreeMemoryAddress += size;
return freeSpace;
return (void*) freeSpace;
}
/**
@ -96,17 +96,18 @@ void initialize_memory_pool(uintptr_t poolStart, uintptr_t poolEnd) {
gFreeMemorySize = (poolEnd - poolStart) - 0x10;
gNextFreeMemoryAddress = poolStart;
int bp = 0;
}
/**
* @brief Allocates memory and adjusts gFreeMemorySize.
*/
void *allocate_memory(u32 size) {
u32 *freeSpace;
void *allocate_memory(uintptr_t size) {
uintptr_t freeSpace;
size = ALIGN16(size);
gFreeMemorySize -= size;
freeSpace = (u32 *) gNextFreeMemoryAddress;
freeSpace = (uintptr_t ) gNextFreeMemoryAddress;
gNextFreeMemoryAddress += size;
return (void *) freeSpace;
@ -122,7 +123,7 @@ UNUSED void func_802A7D54(s32 arg0, s32 arg1) {
*/
void *load_data(uintptr_t startAddr, uintptr_t endAddr) {
void *allocated;
u32 size = endAddr - startAddr;
uintptr_t size = endAddr - startAddr;
allocated = allocate_memory(size);
if (allocated != 0) {
@ -131,7 +132,7 @@ void *load_data(uintptr_t startAddr, uintptr_t endAddr) {
return (void *) allocated;
}
UNUSED void main_pool_init(u32 start, u32 end) {
UNUSED void main_pool_init(uintptr_t start, uintptr_t end) {
start = ALIGN16(start);
end = ALIGN16(end - 15);
@ -150,7 +151,7 @@ UNUSED void main_pool_init(u32 start, u32 end) {
* specified side of the pool (MEMORY_POOL_LEFT or MEMORY_POOL_RIGHT).
* If there is not enough space, return NULL.
*/
UNUSED void *main_pool_alloc(u32 size, u32 side) {
UNUSED void *main_pool_alloc(uintptr_t size, uintptr_t side) {
struct MainPoolBlock *newListHead;
void *addr = NULL;
@ -179,7 +180,7 @@ UNUSED void *main_pool_alloc(u32 size, u32 side) {
* newer blocks are freed as well.
* Return the amount of free space left in the pool.
*/
UNUSED u32 main_pool_free(void *addr) {
UNUSED uintptr_t main_pool_free(void *addr) {
struct MainPoolBlock *block = (struct MainPoolBlock *) ((u8 *) addr - 8);
struct MainPoolBlock *oldListHead = (struct MainPoolBlock *) ((u8 *) addr - 8);
@ -201,7 +202,7 @@ UNUSED u32 main_pool_free(void *addr) {
return sPoolFreeSpace;
}
// main_pool_realloc
UNUSED void *main_pool_realloc(void *addr, u32 size) {
UNUSED void *main_pool_realloc(void *addr, uintptr_t size) {
void *newAddr = NULL;
struct MainPoolBlock *block = (struct MainPoolBlock *) ((u8 *) addr - 8);
@ -212,13 +213,13 @@ UNUSED void *main_pool_realloc(void *addr, u32 size) {
return newAddr;
}
UNUSED s32 main_pool_available(void) {
UNUSED uintptr_t main_pool_available(void) {
return sPoolFreeSpace - 8;
}
UNUSED u32 main_pool_push_state(void) {
UNUSED uintptr_t main_pool_push_state(void) {
struct MainPoolState *prevState = gMainPoolState;
u32 freeSpace = sPoolFreeSpace;
uintptr_t freeSpace = sPoolFreeSpace;
struct MainPoolBlock *lhead = sPoolListHeadL;
struct MainPoolBlock *rhead = sPoolListHeadR;
@ -234,7 +235,7 @@ UNUSED u32 main_pool_push_state(void) {
* Restore pool state from a previous call to main_pool_push_state. Return the
* amount of free space left in the pool.
*/
UNUSED u32 main_pool_pop_state(void) {
UNUSED uintptr_t main_pool_pop_state(void) {
sPoolFreeSpace = gMainPoolState->freeSpace;
sPoolListHeadL = gMainPoolState->listHeadL;
sPoolListHeadR = gMainPoolState->listHeadR;
@ -244,8 +245,8 @@ UNUSED u32 main_pool_pop_state(void) {
// similar to sm64 dma_read
UNUSED void *func_802A80B0(u8 *dest, u8 *srcStart, u8 *srcEnd) {
void *addr;
u32 size = srcStart - dest;
addr = main_pool_alloc(size, (u32) srcEnd);
uintptr_t size = srcStart - dest;
addr = main_pool_alloc(size, (uintptr_t) srcEnd);
if (addr != 0) {
@ -269,12 +270,12 @@ UNUSED void *load_segment(s32 segment, u8 *srcStart, u8 *srcEnd, u8 *side) {
// Similar to sm64 load_to_fixed_pool_addr?
UNUSED void *func_802A8190(s32 arg0, u8 *arg1) {
//u32 srcSize = ALIGN16(srcEnd - srcStart);
//u32 destSize = ALIGN16((u8 *) sPoolListHeadR - destAddr);
//uintptr_t srcSize = ALIGN16(srcEnd - srcStart);
//uintptr_t destSize = ALIGN16((u8 *) sPoolListHeadR - destAddr);
void *addr;
u32 temp_v0 = D_802B8CD4[arg0].unk4;
u32 temp_v1 = D_802B8CD4[arg0].unk8;
u32 temp_v2 = D_802B8CD4[arg0].unk2;
uintptr_t temp_v0 = D_802B8CD4[arg0].unk4;
uintptr_t temp_v1 = D_802B8CD4[arg0].unk8;
uintptr_t temp_v2 = D_802B8CD4[arg0].unk2;
addr = func_802A80B0((u8 *) temp_v0, (u8 *) temp_v1, arg1);
//dest = main_pool_alloc(destSize, MEMORY_POOL_RIGHT);
@ -301,7 +302,7 @@ UNUSED void func_802A81EC(void) {
} while (phi_s0 != 3);
}
UNUSED struct AllocOnlyPool *alloc_only_pool_init(u32 size, u32 side) {
UNUSED struct AllocOnlyPool *alloc_only_pool_init(uintptr_t size, uintptr_t side) {
void *addr;
struct AllocOnlyPool *subPool = NULL;
@ -317,13 +318,13 @@ UNUSED struct AllocOnlyPool *alloc_only_pool_init(u32 size, u32 side) {
return subPool;
}
UNUSED u32 func_802A82AC(s32 arg0) {
u32 temp_v0;
u32 phi_v1;
UNUSED uintptr_t func_802A82AC(s32 arg0) {
uintptr_t temp_v0;
uintptr_t phi_v1;
temp_v0 = D_801502A0 - arg0;
phi_v1 = 0;
if (temp_v0 >= (u32) gDisplayListHead) {
if (temp_v0 >= (uintptr_t) gDisplayListHead) {
D_801502A0 = temp_v0;
phi_v1 = temp_v0;
}
@ -335,7 +336,7 @@ UNUSED u32 func_802A82AC(s32 arg0) {
*/
u8 *dma_compressed_vtx(u8 *start, u8 *end) {
u8 *freeSpace;
u32 size;
uintptr_t size;
size = ALIGN16(end - start);
freeSpace = (u8 *) gNextFreeMemoryAddress;
@ -345,8 +346,8 @@ u8 *dma_compressed_vtx(u8 *start, u8 *end) {
}
// unused mio0 decode func.
UNUSED s32 func_802A8348(s32 arg0, s32 arg1, s32 arg2) {
u32 offset;
UNUSED uintptr_t func_802A8348(s32 arg0, s32 arg1, s32 arg2) {
uintptr_t offset;
UNUSED void *pad;
uintptr_t oldAddr;
void *newAddr;
@ -355,9 +356,9 @@ UNUSED s32 func_802A8348(s32 arg0, s32 arg1, s32 arg2) {
oldAddr = gNextFreeMemoryAddress;
newAddr = (void *) (oldAddr + offset);
pad = &newAddr;
osInvalDCache(newAddr, offset);
// osInvalDCache(newAddr, offset);
//osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_other_texturesSegmentRomStart[SEGMENT_OFFSET(arg0)], newAddr, offset, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
// osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
func_80040030((u8 *) newAddr, (u8 *) oldAddr);
gNextFreeMemoryAddress += offset;
@ -396,8 +397,8 @@ u8 *dma_textures(u8 texture[], size_t arg1, size_t arg2) {
// return temp_v0;
}
u32 MIO0_0F(u8 *arg0, u32 arg1, u32 arg2) {
// u32 oldHeapEndPtr;
uintptr_t MIO0_0F(u8 *arg0, uintptr_t arg1, uintptr_t arg2) {
// uintptr_t oldHeapEndPtr;
// void *temp_v0;
// arg1 = ALIGN16(arg1);
@ -413,12 +414,12 @@ u32 MIO0_0F(u8 *arg0, u32 arg1, u32 arg2) {
// return oldHeapEndPtr;
}
void func_802A86A8(CourseVtx *data, u32 arg1) {
void func_802A86A8(CourseVtx *data, uintptr_t arg1) {
CourseVtx *courseVtx = data;
Vtx *vtx;
s32 tmp = ALIGN16(arg1 * 0x10);
#ifdef AVOID_UB
u32 i;
uintptr_t i;
#else
s32 i;
#endif
@ -429,7 +430,7 @@ void func_802A86A8(CourseVtx *data, u32 arg1) {
gHeapEndPtr -= tmp;
vtx = (Vtx *) gHeapEndPtr;
// s32 to u32 comparison required for matching.
// s32 to uintptr_t comparison required for matching.
for (i = 0; i < arg1; i++) {
if (gIsMirrorMode) {
vtx->v.ob[0] = -courseVtx->ob[0];
@ -457,7 +458,7 @@ void func_802A86A8(CourseVtx *data, u32 arg1) {
}
}
void decompress_vtx(CourseVtx *arg0, u32 vertexCount) {
void decompress_vtx(CourseVtx *arg0, uintptr_t vertexCount) {
s32 size = ALIGN16(vertexCount * 0x18);
void *freeSpace;
u8 *vtxCompressed = arg0;
@ -496,7 +497,7 @@ void unpack_lights(Gfx *arg0, UNUSED u8 *arg1, s8 arg2) {
}
void unpack_displaylist(Gfx *arg0, u8 *args, UNUSED s8 opcode) {
u32 temp_v0 = args[sPackedSeekPosition++];
uintptr_t temp_v0 = args[sPackedSeekPosition++];
uintptr_t temp_t7 = ((args[sPackedSeekPosition++]) << 8 | temp_v0) * 8;
arg0[sGfxSeekPosition].words.w0 = 0x06000000;
// Segment seven addr
@ -532,70 +533,70 @@ void unpack_cull_displaylist(Gfx *arg0, UNUSED u8 *arg1, UNUSED s8 arg2) {
sGfxSeekPosition++;
}
void unpack_combine_mode1(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
void unpack_combine_mode1(Gfx *arg0, UNUSED u8 *arg1, UNUSED uintptr_t arg2) {
Gfx macro[] = {gsDPSetCombineMode(G_CC_MODULATERGBA, G_CC_MODULATERGBA)};
arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
sGfxSeekPosition++;
}
void unpack_combine_mode2(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
void unpack_combine_mode2(Gfx *arg0, UNUSED u8 *arg1, UNUSED uintptr_t arg2) {
Gfx macro[] = {gsDPSetCombineMode(G_CC_MODULATERGBDECALA, G_CC_MODULATERGBDECALA)};
arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
sGfxSeekPosition++;
}
void unpack_combine_mode_shade(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
void unpack_combine_mode_shade(Gfx *arg0, UNUSED u8 *arg1, UNUSED uintptr_t arg2) {
Gfx macro[] = {gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE)};
arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
sGfxSeekPosition++;
}
void unpack_combine_mode4(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
void unpack_combine_mode4(Gfx *arg0, UNUSED u8 *arg1, UNUSED uintptr_t arg2) {
Gfx macro[] = {gsDPSetCombineMode(G_CC_MODULATERGBDECALA, G_CC_MODULATERGBDECALA)};
arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
sGfxSeekPosition++;
}
void unpack_combine_mode5(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
void unpack_combine_mode5(Gfx *arg0, UNUSED u8 *arg1, UNUSED uintptr_t arg2) {
Gfx macro[] = {gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA)};
arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
sGfxSeekPosition++;
}
void unpack_render_mode_opaque(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
void unpack_render_mode_opaque(Gfx *arg0, UNUSED u8 *arg1, UNUSED uintptr_t arg2) {
Gfx macro[] = {gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2)};
arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
sGfxSeekPosition++;
}
void unpack_render_mode_tex_edge(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
void unpack_render_mode_tex_edge(Gfx *arg0, UNUSED u8 *arg1, UNUSED uintptr_t arg2) {
Gfx macro[] = {gsDPSetRenderMode(G_RM_AA_ZB_TEX_EDGE, G_RM_AA_ZB_TEX_EDGE2)};
arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
sGfxSeekPosition++;
}
void unpack_render_mode_translucent(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
void unpack_render_mode_translucent(Gfx *arg0, UNUSED u8 *arg1, UNUSED uintptr_t arg2) {
Gfx macro[] = {gsDPSetRenderMode(G_RM_AA_ZB_XLU_SURF, G_RM_AA_ZB_XLU_SURF2)};
arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
sGfxSeekPosition++;
}
void unpack_render_mode_opaque_decal(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
void unpack_render_mode_opaque_decal(Gfx *arg0, UNUSED u8 *arg1, UNUSED uintptr_t arg2) {
Gfx macro[] = {gsDPSetRenderMode(G_RM_AA_ZB_OPA_DECAL, G_RM_AA_ZB_OPA_DECAL)};
arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
sGfxSeekPosition++;
}
void unpack_render_mode_translucent_decal(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
void unpack_render_mode_translucent_decal(Gfx *arg0, UNUSED u8 *arg1, UNUSED uintptr_t arg2) {
Gfx macro[] = {gsDPSetRenderMode(G_RM_AA_ZB_XLU_DECAL, G_RM_AA_ZB_XLU_DECAL)};
arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
@ -604,9 +605,9 @@ void unpack_render_mode_translucent_decal(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32
void unpack_tile_sync(Gfx *gfx, u8 *args, s8 opcode) {
Gfx tileSync[] = { gsDPTileSync() };
u32 temp_a0;
u32 lo;
u32 hi;
uintptr_t temp_a0;
uintptr_t lo;
uintptr_t hi;
s32 width;
s32 height;
@ -700,20 +701,20 @@ void unpack_tile_sync(Gfx *gfx, u8 *args, s8 opcode) {
}
void unpack_tile_load_sync(Gfx *gfx, u8 *args, s8 opcode) {
UNUSED u32 var;
UNUSED uintptr_t var;
Gfx tileSync[] = { gsDPTileSync() };
Gfx loadSync[] = { gsDPLoadSync() };
u32 arg;
u32 lo;
u32 hi;
u32 addr;
u32 width;
u32 height;
u32 fmt;
u32 siz;
u32 tmem;
u32 tile;
uintptr_t arg;
uintptr_t lo;
uintptr_t hi;
uintptr_t addr;
uintptr_t width;
uintptr_t height;
uintptr_t fmt;
uintptr_t siz;
uintptr_t tmem;
uintptr_t tile;
switch (opcode) {
case 32:
@ -806,11 +807,11 @@ void unpack_texture_off(Gfx *arg0, UNUSED u8 *args, UNUSED s8 arg2) {
}
void unpack_vtx1(Gfx *gfx, u8 *args, UNUSED s8 arg2) {
u32 temp_t7;
u32 temp_t7_2;
uintptr_t temp_t7;
uintptr_t temp_t7_2;
u32 temp = args[sPackedSeekPosition++];
u32 temp2 = ((args[sPackedSeekPosition++] << 8) | temp) * 0x10;
uintptr_t temp = args[sPackedSeekPosition++];
uintptr_t temp2 = ((args[sPackedSeekPosition++] << 8) | temp) * 0x10;
temp = args[sPackedSeekPosition++];
temp_t7 = temp & 0x3F;
@ -823,9 +824,9 @@ void unpack_vtx1(Gfx *gfx, u8 *args, UNUSED s8 arg2) {
}
void unpack_vtx2(Gfx *gfx, u8 *args, s8 arg2) {
u32 temp_t9;
u32 temp_v1;
u32 temp_v2;
uintptr_t temp_t9;
uintptr_t temp_v1;
uintptr_t temp_v2;
temp_v1 = args[sPackedSeekPosition++];
temp_v2 = ((args[sPackedSeekPosition++] << 8) | temp_v1) * 0x10;
@ -838,10 +839,10 @@ void unpack_vtx2(Gfx *gfx, u8 *args, s8 arg2) {
}
void unpack_triangle(Gfx *gfx, u8 *args, UNUSED s8 arg2) {
u32 temp_v0;
u32 phi_a0;
u32 phi_a2;
u32 phi_a3;
uintptr_t temp_v0;
uintptr_t phi_a0;
uintptr_t phi_a2;
uintptr_t phi_a3;
temp_v0 = args[sPackedSeekPosition++];
@ -864,13 +865,13 @@ void unpack_triangle(Gfx *gfx, u8 *args, UNUSED s8 arg2) {
}
void unpack_quadrangle(Gfx *gfx, u8 *args, UNUSED s8 arg2) {
u32 temp_v0;
u32 phi_t0;
u32 phi_a3;
u32 phi_a0;
u32 phi_t2;
u32 phi_t1;
u32 phi_a2;
uintptr_t temp_v0;
uintptr_t phi_t0;
uintptr_t phi_a3;
uintptr_t phi_a0;
uintptr_t phi_t2;
uintptr_t phi_t1;
uintptr_t phi_a2;
temp_v0 = args[sPackedSeekPosition++];
@ -910,11 +911,11 @@ void unpack_quadrangle(Gfx *gfx, u8 *args, UNUSED s8 arg2) {
}
void unpack_spline_3D(Gfx *gfx, u8 *arg1, UNUSED s8 arg2) {
u32 temp_v0;
u32 phi_a0;
u32 phi_t0;
u32 phi_a3;
u32 phi_a2;
uintptr_t temp_v0;
uintptr_t phi_a0;
uintptr_t phi_t0;
uintptr_t phi_a3;
uintptr_t phi_a2;
temp_v0 = arg1[sPackedSeekPosition++];
@ -959,11 +960,11 @@ UNUSED void func_802A9AEC(void) {
* This issue is prevented so long as the packed file adheres to correct opcodes and unpack code
* increments the file pointer the correct number of times.
*/
void displaylist_unpack(uintptr_t *data, uintptr_t finalDisplaylistOffset, u32 arg2) {
void displaylist_unpack(uintptr_t *data, uintptr_t finalDisplaylistOffset, uintptr_t arg2) {
u8 *packed_dl = data;
Gfx *gfx;
u32 addr;
uintptr_t addr;
u8 opcode;
@ -1254,19 +1255,19 @@ void displaylist_unpack(uintptr_t *data, uintptr_t finalDisplaylistOffset, u32 a
struct UnkStr_802AA7C8 {
u8 *unk0;
u32 unk4;
u32 unk8;
u32 unkC;
uintptr_t unk4;
uintptr_t unk8;
uintptr_t unkC;
};
void decompress_textures(u32 *arg0) {
void decompress_textures(uintptr_t arg0) {
struct UnkStr_802AA7C8 *phi_s0 =
(struct UnkStr_802AA7C8 *) arg0;
struct UnkStr_802AA7C8 *temp_s0;
u32 temp_t2;
uintptr_t temp_t2;
u8 *temp_a0;
u32 phi_v0;
u32 sp20;
uintptr_t phi_v0;
uintptr_t sp20;
phi_v0 = 0;
temp_s0 = phi_s0;
@ -1296,18 +1297,21 @@ void decompress_textures(u32 *arg0) {
}
void *decompress_segments(u8 *start, u8 *end) {
UNUSED u32 pad;
u32 sp28;
u32 size = ALIGN16(end - start);
int bp = 0;
return;
UNUSED uintptr_t pad;
uintptr_t sp28;
uintptr_t size = ALIGN16(end - start);
u8 *heapEnd;
u32 *freeSpace;
uintptr_t freeSpace;
heapEnd = (u8 *) gHeapEndPtr - size;
// sp20 = temp_a0;
dma_copy(heapEnd, start, size);
sp28 = *(u32 *) (heapEnd + 4);
sp28 = (uintptr_t) (heapEnd + 4);
sp28 = ALIGN16(sp28);
freeSpace = (u32 *) gNextFreeMemoryAddress;
freeSpace = (uintptr_t ) gNextFreeMemoryAddress;
mio0decode(heapEnd, (u8 *)freeSpace);
gNextFreeMemoryAddress += sp28;
return (void *)freeSpace;
@ -1326,12 +1330,12 @@ u8 *load_course(s32 courseId) {
// u8 *vertexRomStart; // mio0 compressed
// u8 *vertexRomEnd;
// UNUSED s32 pad2[2];
// u32 *textures;
// uintptr_t textures;
// CourseVtx *vertexStart; // mio0 compressed
// u8 *packedStart;
// u32 vertexCount;
// uintptr_t vertexCount;
// u8 *finalDisplaylistOffset;
// u32 unknown1;
// uintptr_t unknown1;
// s32 prevLoadedAddress_saved;
// u8 *offsetRomStart;
// u8 *offsetRomEnd;

View File

@ -8,7 +8,7 @@ struct MainPoolBlock {
};
struct MainPoolState {
u32 freeSpace;
uintptr_t freeSpace;
struct MainPoolBlock *listHeadL;
struct MainPoolBlock *listHeadR;
struct MainPoolState *prev;
@ -41,31 +41,31 @@ struct AllocOnlyPool {
extern f32 vtxStretchY;
void *get_next_available_memory_addr(u32);
void *get_next_available_memory_addr(uintptr_t);
uintptr_t set_segment_base_addr(s32, void*);
void *get_segment_base_addr(s32);
void *segmented_to_virtual(const void *);
void move_segment_table_to_dmem(void);
void initialize_memory_pool(uintptr_t, uintptr_t);
void *decompress_segments(u8*, u8*);
void *allocate_memory(u32);
void *allocate_memory(uintptr_t);
void *load_data(uintptr_t, uintptr_t);
void func_802A7D54(s32, s32);
void main_pool_init(u32, u32);
void *main_pool_alloc(u32, u32);
u32 main_pool_free(void*);
void *main_pool_realloc(void*, u32);
s32 main_pool_available(void);
u32 main_pool_push_state(void);
u32 main_pool_pop_state(void);
void main_pool_init(uintptr_t, uintptr_t);
void *main_pool_alloc(uintptr_t, uintptr_t);
uintptr_t main_pool_free(void*);
void *main_pool_realloc(void*, uintptr_t);
uintptr_t main_pool_available(void);
uintptr_t main_pool_push_state(void);
uintptr_t main_pool_pop_state(void);
void *func_802A80B0(u8*, u8*, u8*);
void func_802A81EC(void);
struct AllocOnlyPool *alloc_only_pool_init(u32, u32);
u32 func_802A82AC(s32);
s32 func_802A8348(s32, s32, s32);
u8 *dma_textures(u8*, u32, u32);
u32 MIO0_0F(u8*, u32, u32);
struct AllocOnlyPool *alloc_only_pool_init(uintptr_t, uintptr_t);
uintptr_t func_802A82AC(s32);
uintptr_t func_802A8348(s32, s32, s32);
u8 *dma_textures(u8*, size_t, size_t);
uintptr_t MIO0_0F(u8*, uintptr_t, uintptr_t);
void func_802A8844(void);
void unpack_lights(Gfx*, u8*, s8);
void unpack_displaylist(Gfx*, u8*, s8);
@ -73,16 +73,16 @@ void unpack_end_displaylist(Gfx*, u8*, s8);
void unpack_set_geometry_mode(Gfx*, u8*, s8);
void unpack_clear_geometry_mode(Gfx*, u8*, s8);
void unpack_cull_displaylist(Gfx*, u8*, s8);
void unpack_combine_mode1(Gfx*, u8*, u32);
void unpack_combine_mode2(Gfx*, u8*, u32);
void unpack_combine_mode_shade(Gfx*, u8*, u32);
void unpack_combine_mode4(Gfx*, u8*, u32);
void unpack_combine_mode5(Gfx*, u8*, u32);
void unpack_render_mode_opaque(Gfx*, u8*, u32);
void unpack_render_mode_tex_edge(Gfx*, u8*, u32);
void unpack_render_mode_translucent(Gfx*, u8*, u32);
void unpack_render_mode_opaque_decal(Gfx*, u8*, u32);
void unpack_render_mode_translucent_decal(Gfx*, u8*, u32);
void unpack_combine_mode1(Gfx*, u8*, uintptr_t);
void unpack_combine_mode2(Gfx*, u8*, uintptr_t);
void unpack_combine_mode_shade(Gfx*, u8*, uintptr_t);
void unpack_combine_mode4(Gfx*, u8*, uintptr_t);
void unpack_combine_mode5(Gfx*, u8*, uintptr_t);
void unpack_render_mode_opaque(Gfx*, u8*, uintptr_t);
void unpack_render_mode_tex_edge(Gfx*, u8*, uintptr_t);
void unpack_render_mode_translucent(Gfx*, u8*, uintptr_t);
void unpack_render_mode_opaque_decal(Gfx*, u8*, uintptr_t);
void unpack_render_mode_translucent_decal(Gfx*, u8*, uintptr_t);
void unpack_tile_sync(Gfx*, u8*, s8);
void unpack_tile_load_sync(Gfx*, u8*, s8);
void unpack_texture_on(Gfx*, u8*, s8);

View File

@ -200,7 +200,7 @@ void func_8007A88C(s32);
void func_8007A910(s32);
void update_object_lakitu(s32);
void func_8007AA44(s32);
void func_8007ABFC(s32, s32);
void func_8007ABFC(s32, bool);
void consume_item(s32);
u8 gen_random_item(s16, s16);
u8 gen_random_item_human(s16, s16);

View File

@ -2138,58 +2138,58 @@ D_0D02AA58:
width: 16
height: 16
format: rgba16
common_texture_particle_spark_1.i8.png:
symbol: common_texture_particle_spark_1.i8.png
common_texture_particle_spark_1:
symbol: common_texture_particle_spark_1
offset: 0x2AC58
width: 32
height: 32
ctype: u8
type: texture
format: i8
common_texture_particle_spark_2.i8.png:
symbol: common_texture_particle_spark_2.i8.png
common_texture_particle_spark_2:
symbol: common_texture_particle_spark_2
offset: 0x2B058
width: 32
height: 32
type: texture
format: i8
common_texture_particle_spark_3.i8.png:
symbol: common_texture_particle_spark_3.i8.png
common_texture_particle_spark_3:
symbol: common_texture_particle_spark_3
offset: 0x2B458
width: 32
height: 32
type: texture
format: i8
common_texture_particle_spark_4.i8.png:
symbol: common_texture_particle_spark_4.i8.png
common_texture_particle_spark_4:
symbol: common_texture_particle_spark_4
offset: 0x2B858
width: 32
height: 32
type: texture
format: i8
common_texture_particle_smoke_1.i8.png:
symbol: common_texture_particle_smoke_1.i8.png
common_texture_particle_smoke_1:
symbol: common_texture_particle_smoke_1
offset: 0x2BC58
width: 32
height: 32
type: texture
format: i8
common_texture_particle_smoke_2.i8.png:
symbol: common_texture_particle_smoke_2.i8.png
common_texture_particle_smoke_2:
symbol: common_texture_particle_smoke_2
offset: 0x2C058
width: 32
height: 32
type: texture
format: i8
common_texture_particle_smoke_3.i8.png:
symbol: common_texture_particle_smoke_3.i8.png
common_texture_particle_smoke_3:
symbol: common_texture_particle_smoke_3
offset: 0x2C458
width: 32
height: 32
type: texture
format: i8
common_texture_particle_smoke_4.i8.png:
symbol: common_texture_particle_smoke_4.i8.png
common_texture_particle_smoke_4:
symbol: common_texture_particle_smoke_4
offset: 0x2C858
width: 32
height: 32