First Compile (#7)

* Update torch

* A lot of fixes

* First compile
This commit is contained in:
MegaMech
2024-05-03 12:17:36 -06:00
committed by GitHub
parent 6a6a78f719
commit 1548512084
26 changed files with 771 additions and 675 deletions
-2
View File
@@ -3,8 +3,6 @@
#include "common_structs.h"
void mio0decode(u8* arg0, u8* arg1);
// Unused mio0decode function.
void func_80040030(u8* arg0, u8* arg1);
+25 -25
View File
@@ -47,38 +47,38 @@ extern u8 _startupLogoSegmentRomEnd[];
// Defines duplicated even if the same for both for easier readability
#ifdef AVOID_UB
#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_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_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 TRIG_TABLES (uintptr_t) &_trigTablesSegmentStart[0]
#define TRIG_TABLES_ROM_START (uintptr_t) &_trigTablesSegmentRomStart[0]
#define TRIG_TABLES_SIZE (size_t) _trigTablesSegmentSize
// #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_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) (&_common_texturesSegmentRomEnd[0] - &_common_texturesSegmentRomStart[0])
// #define COMMON_TEXTURES_ROM_START (uintptr_t) &_common_texturesSegmentRomStart[0]
// #define COMMON_TEXTURES_SIZE (ptrdiff_t) (&_common_texturesSegmentRomEnd[0] - &_common_texturesSegmentRomStart[0])
#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]
#else // Required for ok
+23 -1
View File
@@ -12,4 +12,26 @@ extern u8 osAppNmiBuffer[64];
void rmonPrintf(const char* fmt, ...);
void func_80040030(u8* arg0, u8* arg1);
void func_80040174(void*, s32, s32);
void func_80040174(void*, s32, s32);
s32 osAiSetFrequency(u32 freq);
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 osInitialize(void);
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);
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);
+1
View File
@@ -1,5 +1,6 @@
#include <libultraship.h>
#include <macros.h>
#include <stubs.h>
#include "audio/data.h"
#include "audio/effects.h"
+38 -36
View File
@@ -784,9 +784,11 @@ void audio_init(void) {
gAudioLoadLock = 0;
for (i = 0; i < gAudioHeapSize / 8; i++) {
((u64 *) D_803B71B0)[i] = 0;
}
// for (i = 0; i < gAudioHeapSize / 8; i++) {
// ((u64 *) D_803B71B0)[i] = 0;
// }
memset(D_803B71B0, 0, gAudioHeapSize);
#ifdef TARGET_N64
// It seems boot.s doesn't clear the .bss area for audio, so do it here.
@@ -842,40 +844,40 @@ void audio_init(void) {
gAudioResetPresetIdToLoad = 0;
gAudioResetStatus = one;
audio_shut_down_and_reset_step();
gSeqFileHeader = (ALSeqFile *) sp60;
test = &_sequencesSegmentRomStart;
audio_dma_copy_immediate(test, gSeqFileHeader, 0x00000010U);
gSequenceCount = gSeqFileHeader->seqCount;
size = gSequenceCount * sizeof(ALSeqData) + 4;
size = ALIGN16(size);
gSeqFileHeader = soundAlloc(&gAudioInitPool, size);
audio_dma_copy_immediate(test, gSeqFileHeader, size);
func_800BB43C(gSeqFileHeader, test);
gAlCtlHeader = (ALSeqFile *) sp60;
test = &_audio_banksSegmentRomStart;
audio_dma_copy_immediate(test, gAlCtlHeader, 0x00000010U);
aaa = gAlCtlHeader->seqCount;
size = ALIGN16(aaa * sizeof(ALSeqData) + 4);
gAlCtlHeader = soundAlloc(&gAudioInitPool, size);
audio_dma_copy_immediate(test, gAlCtlHeader, size);
func_800BB43C(gAlCtlHeader, test);
gCtlEntries = soundAlloc(&gAudioInitPool, aaa * 0xC);
for (i = 0; i < aaa; i++) {
audio_dma_copy_immediate(gAlCtlHeader->seqArray[i].offset, sp60, 0x00000010U);
// gSeqFileHeader = (ALSeqFile *) sp60;
// test = &_sequencesSegmentRomStart;
// audio_dma_copy_immediate(test, gSeqFileHeader, 0x00000010U);
// gSequenceCount = gSeqFileHeader->seqCount;
// size = gSequenceCount * sizeof(ALSeqData) + 4;
// size = ALIGN16(size);
// gSeqFileHeader = soundAlloc(&gAudioInitPool, size);
// audio_dma_copy_immediate(test, gSeqFileHeader, size);
// func_800BB43C(gSeqFileHeader, test);
// gAlCtlHeader = (ALSeqFile *) sp60;
// test = &_audio_banksSegmentRomStart;
// audio_dma_copy_immediate(test, gAlCtlHeader, 0x00000010U);
// aaa = gAlCtlHeader->seqCount;
// size = ALIGN16(aaa * sizeof(ALSeqData) + 4);
// gAlCtlHeader = soundAlloc(&gAudioInitPool, size);
// audio_dma_copy_immediate(test, gAlCtlHeader, size);
// func_800BB43C(gAlCtlHeader, test);
// gCtlEntries = soundAlloc(&gAudioInitPool, aaa * 0xC);
// for (i = 0; i < aaa; i++) {
// audio_dma_copy_immediate(gAlCtlHeader->seqArray[i].offset, sp60, 0x00000010U);
gCtlEntries[i].numInstruments = sp60[0];
gCtlEntries[i].numDrums = sp60[1];
}
gAlTbl = (ALSeqFile *) sp60;
test = &_audio_tablesSegmentRomStart;
audio_dma_copy_immediate(test, gAlTbl, 0x00000010U);
size = gAlTbl->seqCount * sizeof(ALSeqData) + 4;
size = ALIGN16(size);
gAlTbl = soundAlloc(&gAudioInitPool, size);
audio_dma_copy_immediate(test, gAlTbl, size);
func_800BB43C(gAlTbl, test);
gAlBankSets = soundAlloc(&gAudioInitPool, 0x00000100U);
audio_dma_copy_immediate((u32) &_instrument_setsSegmentRomStart, gAlBankSets, 0x00000100U);
// gCtlEntries[i].numInstruments = sp60[0];
// gCtlEntries[i].numDrums = sp60[1];
// }
// gAlTbl = (ALSeqFile *) sp60;
// test = &_audio_tablesSegmentRomStart;
// audio_dma_copy_immediate(test, gAlTbl, 0x00000010U);
// size = gAlTbl->seqCount * sizeof(ALSeqData) + 4;
// size = ALIGN16(size);
// gAlTbl = soundAlloc(&gAudioInitPool, size);
// audio_dma_copy_immediate(test, gAlTbl, size);
// func_800BB43C(gAlTbl, test);
// gAlBankSets = soundAlloc(&gAudioInitPool, 0x00000100U);
// audio_dma_copy_immediate((u32) &_instrument_setsSegmentRomStart, gAlBankSets, 0x00000100U);
sound_alloc_pool_init(&gUnkPool1.pool, soundAlloc(&gAudioInitPool, (u32) D_800EA5D8), (u32) D_800EA5D8);
init_sequence_players();
gAudioLoadLock = 0x76557364;
+78
View File
@@ -0,0 +1,78 @@
#include <libultraship.h>
#include "mixer.h"
#pragma GCC optimize ("unroll-loops")
#define ROUND_UP_64(v) (((v) + 63) & ~63)
#define ROUND_UP_32(v) (((v) + 31) & ~31)
#define ROUND_UP_16(v) (((v) + 15) & ~15)
#define ROUND_UP_8(v) (((v) + 7) & ~7)
#define ROUND_DOWN_16(v) ((v) & ~0xf)
#ifdef NEW_AUDIO_UCODE
#define BUF_SIZE 2880
#define BUF_U8(a) (rspa.buf.as_u8 + ((a) - 0x450))
#define BUF_S16(a) (rspa.buf.as_s16 + ((a) - 0x450) / sizeof(int16_t))
#else
#define BUF_SIZE 2512
#define BUF_U8(a) (rspa.buf.as_u8 + (a))
#define BUF_S16(a) (rspa.buf.as_s16 + (a) / sizeof(int16_t))
#endif
static struct {
uint16_t in;
uint16_t out;
uint16_t nbytes;
#ifdef NEW_AUDIO_UCODE
uint16_t vol[2];
uint16_t rate[2];
uint16_t vol_wet;
uint16_t rate_wet;
#else
int16_t vol[2];
uint16_t dry_right;
uint16_t wet_left;
uint16_t wet_right;
int16_t target[2];
int32_t rate[2];
int16_t vol_dry;
int16_t vol_wet;
#endif
ADPCM_STATE *adpcm_loop_state;
int16_t adpcm_table[8][2][8];
#ifdef NEW_AUDIO_UCODE
uint16_t filter_count;
int16_t filter[8];
#endif
union {
int16_t as_s16[BUF_SIZE / sizeof(int16_t)];
uint8_t as_u8[BUF_SIZE];
} buf;
} rspa;
void aDownsampleHalfImpl(uint16_t n_samples, uint16_t in_addr, uint16_t out_addr) {
int16_t *in = BUF_S16(in_addr);
int16_t *out = BUF_S16(out_addr);
int n = ROUND_UP_8(n_samples);
do {
*out++ = *in++; in++;
*out++ = *in++; in++;
*out++ = *in++; in++;
*out++ = *in++; in++;
*out++ = *in++; in++;
*out++ = *in++; in++;
*out++ = *in++; in++;
*out++ = *in++; in++;
n -= 8;
} while (n > 0);
}
+12
View File
@@ -0,0 +1,12 @@
#ifndef MIXER_H
#define MIXER_H
#include <libultraship.h>
void aDownsampleHalfImpl(uint16_t n_samples, uint16_t in_addr, uint16_t out_addr);
#undef aDownsampleHalf
#define aDownsampleHalf(pkt, nSamples, i, o) aDownsampleHalfImpl(nSamples, i, o)
#endif
+1
View File
@@ -1,4 +1,5 @@
#include <libultraship.h>
#include "mixer.h"
#include <macros.h>
#include "audio/synthesis.h"
#include "audio/heap.h"
+10 -10
View File
@@ -111,17 +111,17 @@ void clear_object_list() {
u8 *func_8006ED94(u8 *devAddr, u8 *baseAddress, u32 size, u32 offset)
{
u8 **tempAddress;
u8 *address;
address = baseAddress + offset;
// u8 **tempAddress;
// u8 *address;
// address = baseAddress + offset;
size = ALIGN16(size);
osInvalDCache(address, (size));
osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t)&_other_texturesSegmentRomStart[((u32) devAddr) & 0xFFFFFF], address, size, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
tempAddress = &address;
mio0decode(*tempAddress, (u8 *) baseAddress);
return baseAddress;
// size = ALIGN16(size);
// osInvalDCache(address, (size));
// osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t)&_other_texturesSegmentRomStart[((u32) devAddr) & 0xFFFFFF], address, size, &gDmaMesgQueue);
// osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
// tempAddress = &address;
// mio0decode(*tempAddress, (u8 *) baseAddress);
// return baseAddress;
}
void func_8006EE44(void) {
+93 -89
View File
@@ -1,6 +1,7 @@
#include <libultraship.h>
#include <macros.h>
#include <mk64.h>
#include <stubs.h>
#include <defines.h>
#include <segments.h>
#include <libultra/types.h>
@@ -1412,7 +1413,7 @@ void func_80091B78(void) {
}
if (gMenuSelection == LOGO_INTRO_MENU) {
gNextFreeMemoryAddress = gFreeMemoryResetAnchor;
set_segment_base_addr(6, decompress_segments((u8 *) STARTUP_LOGO_ROM_START, (u8 *) STARTUP_LOGO_ROM_END));
// set_segment_base_addr(6, decompress_segments((u8 *) STARTUP_LOGO_ROM_START, (u8 *) STARTUP_LOGO_ROM_END));
}
gNextFreeMemoryAddress = gFreeMemoryResetAnchor;
// Hypothetically, this should be a ptr... But only hypothetically.
@@ -3070,7 +3071,8 @@ Gfx *func_800963F0(Gfx *displayListHead, s8 arg1, s32 arg2, s32 arg3, f32 arg4,
return displayListHead;
}
extern u8 D_0B002A00[];
#define D_0B002A00 gTextureTitleChocoMountain
#ifdef NON_MATCHING
// https://decomp.me/scratch/xV83r
// Possibly a missed variable rename or just weird diffs.
@@ -3284,6 +3286,8 @@ Gfx *func_80097274(Gfx *displayListHead, s8 arg1, s32 arg2, s32 arg3, s32 arg4,
GLOBAL_ASM("asm/non_matchings/code_80091750/func_80097274.s")
#endif
#undef D_0B002A00
Gfx *func_80097A14(Gfx *displayListHead, s8 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, u8* arg8, u32 arg9, u32 argA) {
gDPPipeSync(displayListHead++);
gDPSetCycleType(displayListHead++, G_CYC_COPY);
@@ -3491,21 +3495,21 @@ Gfx *func_80098FC8(Gfx *displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry) {
}
void dma_copy_base_729a30(u64 *arg0, size_t nbytes, void *vaddr) {
OSIoMesg sp30;
OSMesg sp2C;
// OSIoMesg sp30;
// OSMesg sp2C;
osInvalDCache(vaddr, nbytes);
osPiStartDma(&sp30, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_textures_0aSegmentRomStart[SEGMENT_OFFSET(arg0)], vaddr, nbytes, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &sp2C, OS_MESG_BLOCK);
// osInvalDCache(vaddr, nbytes);
// osPiStartDma(&sp30, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_textures_0aSegmentRomStart[SEGMENT_OFFSET(arg0)], vaddr, nbytes, &gDmaMesgQueue);
// osRecvMesg(&gDmaMesgQueue, &sp2C, OS_MESG_BLOCK);
}
void dma_copy_base_7fa3c0(u64 *arg0, size_t nbytes, void *vaddr) {
OSIoMesg sp30;
OSMesg sp2C;
// OSIoMesg sp30;
// OSMesg sp2C;
osInvalDCache(vaddr, nbytes);
osPiStartDma(&sp30, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_textures_0bSegmentRomStart[SEGMENT_OFFSET(arg0)], vaddr, nbytes, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &sp2C, OS_MESG_BLOCK);
// osInvalDCache(vaddr, nbytes);
// osPiStartDma(&sp30, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_textures_0bSegmentRomStart[SEGMENT_OFFSET(arg0)], vaddr, nbytes, &gDmaMesgQueue);
// osRecvMesg(&gDmaMesgQueue, &sp2C, OS_MESG_BLOCK);
}
void func_80099110(void) {
@@ -3650,7 +3654,7 @@ void func_8009952C(MkTexture *arg0) {
}
}
if (var_a1 == 0) {
dma_copy_base_729a30(var_s1->textureData, 0x00008000U, D_8018D9B4);
//dma_copy_base_729a30(var_s1->textureData, 0x00008000U, D_8018D9B4);
mio0decode(D_8018D9B4, (u8*)&D_8018D9B0[gD_8018E118TotalSize]);
thing = &D_8018E118[gNumD_8018E118Entries];
@@ -3822,7 +3826,7 @@ void func_80099AEC(void) {
var_s0 = ((var_s0 / 8) * 8) + 8;
}
osInvalDCache(D_8018D9B4, var_s0);
osPiStartDma(&sp68, 0, 0, (uintptr_t)&_textures_0aSegmentRomStart[SEGMENT_OFFSET(temp_s2->textureData)], D_8018D9B4, var_s0, &gDmaMesgQueue);
//osPiStartDma(&sp68, 0, 0, (uintptr_t)&_textures_0aSegmentRomStart[SEGMENT_OFFSET(temp_s2->textureData)], D_8018D9B4, var_s0, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &sp64, 1);
while (1) {
if ((var_s1 + 1)->texture == NULL) {
@@ -3839,7 +3843,7 @@ void func_80099AEC(void) {
var_s0 = ((var_s0 / 8) * 8) + 8;
}
osInvalDCache(D_8018D9B4 + sp60*4, var_s0);
osPiStartDma(&sp68, 0, 0, (uintptr_t)&_textures_0aSegmentRomStart[SEGMENT_OFFSET(temp_s2->textureData)], D_8018D9B4 + sp60*4, var_s0, &gDmaMesgQueue);
//osPiStartDma(&sp68, 0, 0, (uintptr_t)&_textures_0aSegmentRomStart[SEGMENT_OFFSET(temp_s2->textureData)], D_8018D9B4 + sp60*4, var_s0, &gDmaMesgQueue);
}
mio0decode(D_8018D9B4, (u8*)&D_8018D9B0[D_8018E118[var_s1->unk_4].offset]);
var_s1->texture = NULL;
@@ -3860,7 +3864,7 @@ void func_80099AEC(void) {
var_s0 = ((var_s0 / 8) * 8) + 8;
}
osInvalDCache(D_8018D9B4, var_s0);
osPiStartDma(&sp68, 0, 0, (uintptr_t)&_textures_0aSegmentRomStart[SEGMENT_OFFSET(temp_s2->textureData)], D_8018D9B4, var_s0, &gDmaMesgQueue);
//osPiStartDma(&sp68, 0, 0, (uintptr_t)&_textures_0aSegmentRomStart[SEGMENT_OFFSET(temp_s2->textureData)], D_8018D9B4, var_s0, &gDmaMesgQueue);
}
mio0decode(D_8018D9B4 + sp60*4, (u8*)&D_8018D9B0[D_8018E118[var_s1->unk_4].offset]);
var_s1->texture = NULL;
@@ -3894,82 +3898,82 @@ void func_80099E60(MkTexture *arg0, s32 arg1, s32 arg2) {
// Some fakematch nonsense, may or may not be necessary
// Issue is with instruction ordering near the first `osPiStartDma` call
void func_80099EC4(void) {
s8 var_s4;
s32 var_s0;
UNUSED s32 stackPadding0;
UNUSED s32 stackPadding1;
OSIoMesg sp68;
OSMesg sp64;
s32 huh;
u8 *test;
MkTexture *temp_s2;
struct_8018E0E8_entry *var_s1;
// s8 var_s4;
// s32 var_s0;
// UNUSED s32 stackPadding0;
// UNUSED s32 stackPadding1;
// OSIoMesg sp68;
// OSMesg sp64;
// s32 huh;
// u8 *test;
// MkTexture *temp_s2;
// struct_8018E0E8_entry *var_s1;
var_s4 = 0;
var_s1 = D_8018E0E8;
temp_s2 = var_s1->mk64Texture;
// var_s4 = 0;
// var_s1 = D_8018E0E8;
// temp_s2 = var_s1->mk64Texture;
if (temp_s2 == NULL) return;
// if (temp_s2 == NULL) return;
huh = temp_s2->size;
if (huh != 0) {
var_s0 = huh;
} else {
var_s0 = 0x1400;
}
if (var_s0 % 8) {
var_s0 = ((var_s0 / 8) * 8) + 8;
}
osInvalDCache(D_8018D9B4, var_s0);
test = &_textures_0aSegmentRomStart[SEGMENT_OFFSET(temp_s2->textureData)];
osPiStartDma(&sp68, 0, 0, (uintptr_t)test, D_8018D9B4, var_s0, &gDmaMesgQueue);
if ((var_s0 && var_s0) && var_s0) {}
// osPiStartDma(&sp68, 0, 0, &_textures_0aSegmentRomStart[SEGMENT_OFFSET(temp_s2->textureData)], D_8018D9B4, var_s0, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &sp64, 1);
while (1) {
if ((var_s1 + 1)->mk64Texture == NULL) {
var_s4 += 1;
} else {
temp_s2 = (var_s1 + 1)->mk64Texture;
huh = (var_s1 + 1)->mk64Texture->size;
if (huh != 0) {
var_s0 = huh;
} else {
var_s0 = 0x1400;
}
if (var_s0 % 8) {
var_s0 = ((var_s0 / 8) * 8) + 8;
}
osInvalDCache(D_8018D9B4 + 0x1400, var_s0);
osPiStartDma(&sp68, 0, 0, (uintptr_t)&_textures_0aSegmentRomStart[SEGMENT_OFFSET(temp_s2->textureData)], D_8018D9B4 + 0x1400, var_s0, &gDmaMesgQueue);
}
mio0decode(D_8018D9B4, D_802BFB80.arraySize4[var_s1->unk6][var_s1->unk4 / 2][(var_s1->unk4 % 2) + 2].pixel_index_array);
var_s1->mk64Texture = NULL;
var_s1++;
if (var_s4 != 0) break;
osRecvMesg(&gDmaMesgQueue, &sp64, 1);
if ((var_s1 + 1)->mk64Texture == NULL) {
var_s4 += 1;
} else {
temp_s2 = (var_s1 + 1)->mk64Texture;
huh = (var_s1 + 1)->mk64Texture->size;
if (huh != 0) {
var_s0 = huh;
} else {
var_s0 = 0x1400;
}
if (var_s0 % 8) {
var_s0 = ((var_s0 / 8) * 8) + 8;
}
osInvalDCache(D_8018D9B4, var_s0);
osPiStartDma(&sp68, 0, 0, (uintptr_t)&_textures_0aSegmentRomStart[SEGMENT_OFFSET(temp_s2->textureData)], D_8018D9B4, var_s0, &gDmaMesgQueue);
}
mio0decode(D_8018D9B4 + 0x1400, D_802BFB80.arraySize4[var_s1->unk6][var_s1->unk4 / 2][(var_s1->unk4 % 2) + 2].pixel_index_array);
var_s1->mk64Texture = NULL;
var_s1++;
if (var_s4 != 0) break;
osRecvMesg(&gDmaMesgQueue, &sp64, 1);
}
// huh = temp_s2->size;
// if (huh != 0) {
// var_s0 = huh;
// } else {
// var_s0 = 0x1400;
// }
// if (var_s0 % 8) {
// var_s0 = ((var_s0 / 8) * 8) + 8;
// }
// osInvalDCache(D_8018D9B4, var_s0);
// test = &_textures_0aSegmentRomStart[SEGMENT_OFFSET(temp_s2->textureData)];
// osPiStartDma(&sp68, 0, 0, (uintptr_t)test, D_8018D9B4, var_s0, &gDmaMesgQueue);
// if ((var_s0 && var_s0) && var_s0) {}
// // osPiStartDma(&sp68, 0, 0, &_textures_0aSegmentRomStart[SEGMENT_OFFSET(temp_s2->textureData)], D_8018D9B4, var_s0, &gDmaMesgQueue);
// osRecvMesg(&gDmaMesgQueue, &sp64, 1);
// while (1) {
// if ((var_s1 + 1)->mk64Texture == NULL) {
// var_s4 += 1;
// } else {
// temp_s2 = (var_s1 + 1)->mk64Texture;
// huh = (var_s1 + 1)->mk64Texture->size;
// if (huh != 0) {
// var_s0 = huh;
// } else {
// var_s0 = 0x1400;
// }
// if (var_s0 % 8) {
// var_s0 = ((var_s0 / 8) * 8) + 8;
// }
// osInvalDCache(D_8018D9B4 + 0x1400, var_s0);
// osPiStartDma(&sp68, 0, 0, (uintptr_t)&_textures_0aSegmentRomStart[SEGMENT_OFFSET(temp_s2->textureData)], D_8018D9B4 + 0x1400, var_s0, &gDmaMesgQueue);
// }
// mio0decode(D_8018D9B4, D_802BFB80.arraySize4[var_s1->unk6][var_s1->unk4 / 2][(var_s1->unk4 % 2) + 2].pixel_index_array);
// var_s1->mk64Texture = NULL;
// var_s1++;
// if (var_s4 != 0) break;
// osRecvMesg(&gDmaMesgQueue, &sp64, 1);
// if ((var_s1 + 1)->mk64Texture == NULL) {
// var_s4 += 1;
// } else {
// temp_s2 = (var_s1 + 1)->mk64Texture;
// huh = (var_s1 + 1)->mk64Texture->size;
// if (huh != 0) {
// var_s0 = huh;
// } else {
// var_s0 = 0x1400;
// }
// if (var_s0 % 8) {
// var_s0 = ((var_s0 / 8) * 8) + 8;
// }
// osInvalDCache(D_8018D9B4, var_s0);
// osPiStartDma(&sp68, 0, 0, (uintptr_t)&_textures_0aSegmentRomStart[SEGMENT_OFFSET(temp_s2->textureData)], D_8018D9B4, var_s0, &gDmaMesgQueue);
// }
// mio0decode(D_8018D9B4 + 0x1400, D_802BFB80.arraySize4[var_s1->unk6][var_s1->unk4 / 2][(var_s1->unk4 % 2) + 2].pixel_index_array);
// var_s1->mk64Texture = NULL;
// var_s1++;
// if (var_s4 != 0) break;
// osRecvMesg(&gDmaMesgQueue, &sp64, 1);
// }
}
#else
GLOBAL_ASM("asm/non_matchings/code_80091750/func_80099EC4.s")
+2 -3
View File
@@ -397,7 +397,6 @@ void func_800AF740(struct_8018D9E0_entry*);
// This really, really shouldn't be in this header file, but I don't know where else to put it
void rmonPrintf(const char *, ...);
void tkmk00decode(u8*, u8*, u8*, s32);
/* File specific defines */
@@ -454,8 +453,8 @@ extern s32 D_8018E854;
extern s32 D_8018E858[];
extern s32 D_8018E85C;
extern u8 _textures_0aSegmentRomStart[];
extern u8 _textures_0bSegmentRomStart[];
//extern u8 _textures_0aSegmentRomStart[];
//extern u8 _textures_0bSegmentRomStart[];
extern Unk_D_800E70A0 D_800E70A0[];
extern Unk_D_800E70A0 D_800E70E8[];
+185 -185
View File
@@ -26,225 +26,225 @@ extern s32 osRecvMesg(OSMesgQueue *, OSMesg *, s32);
s32 sCounter = 0;
u8 crashScreenFont[][8] = {
#include "textures/crash_screen/crash_screen_font.ia1.inc.c"
};
// u8 crashScreenFont[][8] = {
// #include "textures/crash_screen/crash_screen_font.ia1.inc.c"
// };
u16 sCrashScreenButtonSequence[] = {
L_TRIG, U_JPAD, L_JPAD, D_JPAD, R_JPAD, R_TRIG, L_TRIG, B_BUTTON, A_BUTTON, DRAW_CODE
};
// u16 sCrashScreenButtonSequence[] = {
// L_TRIG, U_JPAD, L_JPAD, D_JPAD, R_JPAD, R_TRIG, L_TRIG, B_BUTTON, A_BUTTON, DRAW_CODE
// };
void crash_screen_draw_glyph(u16 *framebuffer, s32 x, s32 y, s32 glyph) {
s32 data;
s32 ptr;
s32 i, j;
// void crash_screen_draw_glyph(u16 *framebuffer, s32 x, s32 y, s32 glyph) {
// s32 data;
// s32 ptr;
// s32 i, j;
for(i = 0; i < 8; i++) {
// for(i = 0; i < 8; i++) {
data = crashScreenFont[glyph][i];
// data = crashScreenFont[glyph][i];
for (j = 5; j >= 0; j--) {
// for (j = 5; j >= 0; j--) {
ptr = (y + i) * 320 + (x + j);
// ptr = (y + i) * 320 + (x + j);
if (data & 1) {
framebuffer[ptr] = 0xffff;
}
data = data >> 1;
}
}
}
// if (data & 1) {
// framebuffer[ptr] = 0xffff;
// }
// data = data >> 1;
// }
// }
// }
void crash_screen_draw_square(u16 *framebuffer);
// Functionally Equivallent.
#ifdef NON_MATCHING
// void crash_screen_draw_square(u16 *framebuffer);
// // Functionally Equivallent.
// #ifdef NON_MATCHING
// 0xRGBA (I think A maybe not).
#define WHITE_COLOUR 0xFFFF
#define RED_COLOUR 0xF801
// // 0xRGBA (I think A maybe not).
// #define WHITE_COLOUR 0xFFFF
// #define RED_COLOUR 0xF801
/**
* The big mismatch is the handling of the '6' used in the if statement
* In the target assembly that 6 is saved to 5 different temp registers,
* while in this non-matching decomp its only saved to one temp register.
* This seems to be related to how the innermost for loop is unrolled, but
* its not clear why the target assembley would save the same immediate to
* 5 different registers instead of just re-using one
* There's some stack related differences too, maybe that's related?
**/
void crash_screen_draw_square(u16 *framebuffer)
{
s32 s0_end;
s32 s2_start;
s32 row;
s32 column;
// /**
// * The big mismatch is the handling of the '6' used in the if statement
// * In the target assembly that 6 is saved to 5 different temp registers,
// * while in this non-matching decomp its only saved to one temp register.
// * This seems to be related to how the innermost for loop is unrolled, but
// * its not clear why the target assembley would save the same immediate to
// * 5 different registers instead of just re-using one
// * There's some stack related differences too, maybe that's related?
// **/
// void crash_screen_draw_square(u16 *framebuffer)
// {
// s32 s0_end;
// s32 s2_start;
// s32 row;
// s32 column;
for (s2_start = 0x28, s0_end = s2_start + 6; s0_end != 0x2C; s0_end--, s2_start++) {
for (row = s2_start; row < s0_end; row++) {
for (column = s2_start; column < s0_end; column++) {
framebuffer[row * 320 + column] = s0_end - s2_start == 6 ? 0xF801 : 0xFFFF;
}
}
}
// for (s2_start = 0x28, s0_end = s2_start + 6; s0_end != 0x2C; s0_end--, s2_start++) {
// for (row = s2_start; row < s0_end; row++) {
// for (column = s2_start; column < s0_end; column++) {
// framebuffer[row * 320 + column] = s0_end - s2_start == 6 ? 0xF801 : 0xFFFF;
// }
// }
// }
osWritebackDCacheAll();
osViSwapBuffer(framebuffer);
}
#else
GLOBAL_ASM("asm/non_matchings/crash_screen/crash_screen_draw_square.s")
#endif
// osWritebackDCacheAll();
// osViSwapBuffer(framebuffer);
// }
// #else
// GLOBAL_ASM("asm/non_matchings/crash_screen/crash_screen_draw_square.s")
// #endif
/**
* Draws three black boxes then prints crash info in the following format:
* Line 1: threadId - address of faulted instruction - error code
* Line 2: Address in the return address register
* Line 3: Machine code of faulted instruction
*
* The R4300i manual discusses exceptions in more depth.
*
* @param framebuffer
* @param faulted thread
**/
// /**
// * Draws three black boxes then prints crash info in the following format:
// * Line 1: threadId - address of faulted instruction - error code
// * Line 2: Address in the return address register
// * Line 3: Machine code of faulted instruction
// *
// * The R4300i manual discusses exceptions in more depth.
// *
// * @param framebuffer
// * @param faulted thread
// **/
// 0xRGBA
#define BLACK_COLOUR 0x0001
// // 0xRGBA
// #define BLACK_COLOUR 0x0001
void crash_screen_draw_info(u16 *framebuffer, OSThread *thread) {
__OSThreadContext *context = &thread->context;
s32 i, j, x, y, h;
uintptr_t faultedAddr;
u32 exception;
s32 math;
u32 crashInfo;
s32 temp;
// void crash_screen_draw_info(u16 *framebuffer, OSThread *thread) {
// __OSThreadContext *context = &thread->context;
// s32 i, j, x, y, h;
// uintptr_t faultedAddr;
// u32 exception;
// s32 math;
// u32 crashInfo;
// s32 temp;
// Draw three black boxes
for (h = 0; h < 3; h++) {
// // Draw three black boxes
// for (h = 0; h < 3; h++) {
math = (48 + (sCounter * 24)) + h * 20;
// math = (48 + (sCounter * 24)) + h * 20;
for (i = 0; i < 16; i++) {
for (j = 0; j < 120; j++) {
// Set pixels to black
framebuffer[((i + math) * 320) + (j + 100)] = BLACK_COLOUR;
}
}
}
// for (i = 0; i < 16; i++) {
// for (j = 0; j < 120; j++) {
// // Set pixels to black
// framebuffer[((i + math) * 320) + (j + 100)] = BLACK_COLOUR;
// }
// }
// }
// Draw crash information over the black boxes.
temp = (sCounter * 24);
y = temp + 53;
crash_screen_draw_glyph(framebuffer, 108, y, thread->id & 0xF);
crash_screen_draw_glyph(framebuffer, 116, y, CHARACTER_DASH);
// // Draw crash information over the black boxes.
// temp = (sCounter * 24);
// y = temp + 53;
// crash_screen_draw_glyph(framebuffer, 108, y, thread->id & 0xF);
// crash_screen_draw_glyph(framebuffer, 116, y, CHARACTER_DASH);
// Address of faulted instruction.
crashInfo = context->pc;
// // Address of faulted instruction.
// crashInfo = context->pc;
for (x = 180; x >= 124; x -= 8) {
crash_screen_draw_glyph(framebuffer, x, y, crashInfo & 0xF);
crashInfo >>= 4;
}
// for (x = 180; x >= 124; x -= 8) {
// crash_screen_draw_glyph(framebuffer, x, y, crashInfo & 0xF);
// crashInfo >>= 4;
// }
exception = (context->cause >> 2) & 0x1F;
crash_screen_draw_glyph(framebuffer, 188, y, CHARACTER_DASH);
crash_screen_draw_glyph(framebuffer, 196, y, exception >> 4);
crash_screen_draw_glyph(framebuffer, 204, y, exception & 0xF);
// exception = (context->cause >> 2) & 0x1F;
// crash_screen_draw_glyph(framebuffer, 188, y, CHARACTER_DASH);
// crash_screen_draw_glyph(framebuffer, 196, y, exception >> 4);
// crash_screen_draw_glyph(framebuffer, 204, y, exception & 0xF);
// Address in the Return Address register.
crashInfo = context->ra;
// // Address in the Return Address register.
// crashInfo = context->ra;
for (x = 180; x >= 124; x -= 8) {
crash_screen_draw_glyph(framebuffer, x, 73, crashInfo & 0xF);
crashInfo >>= 4;
}
// for (x = 180; x >= 124; x -= 8) {
// crash_screen_draw_glyph(framebuffer, x, 73, crashInfo & 0xF);
// crashInfo >>= 4;
// }
// Address of faulted instruction.
faultedAddr = context->pc & (~3);
// // Address of faulted instruction.
// faultedAddr = context->pc & (~3);
// Ensure the address to the faulted instruction is a memory address.
//! @bug if this check fails, the ra register is printed a second time.
if ((faultedAddr > 0x80000000) && (faultedAddr < 0x803FFF7F)) {
// Cast the address to its value; the faulty machine code.
crashInfo = *(u32*)faultedAddr;
}
for (x = 180; x >= 124; x -= 4) {
crash_screen_draw_glyph(framebuffer, x, 93, crashInfo & 0xF);
x -= 4;
crashInfo >>= 4;
}
osWritebackDCacheAll();
osViSwapBuffer(framebuffer);
}
// // Ensure the address to the faulted instruction is a memory address.
// //! @bug if this check fails, the ra register is printed a second time.
// if ((faultedAddr > 0x80000000) && (faultedAddr < 0x803FFF7F)) {
// // Cast the address to its value; the faulty machine code.
// crashInfo = *(u32*)faultedAddr;
// }
// for (x = 180; x >= 124; x -= 4) {
// crash_screen_draw_glyph(framebuffer, x, 93, crashInfo & 0xF);
// x -= 4;
// crashInfo >>= 4;
// }
// osWritebackDCacheAll();
// osViSwapBuffer(framebuffer);
// }
OSThread *get_faulted_thread(void) {
OSThread *thread;
// OSThread *get_faulted_thread(void) {
// OSThread *thread;
thread = __osGetCurrFaultedThread();
while (thread->priority != -1) {
if (thread->priority > OS_PRIORITY_IDLE && thread->priority <= OS_PRIORITY_APPMAX
&& (thread->flags & 3) != 0) {
return thread;
}
thread = thread->tlnext;
}
return NULL;
}
// thread = __osGetCurrFaultedThread();
// while (thread->priority != -1) {
// if (thread->priority > OS_PRIORITY_IDLE && thread->priority <= OS_PRIORITY_APPMAX
// && (thread->flags & 3) != 0) {
// return thread;
// }
// thread = thread->tlnext;
// }
// return NULL;
// }
/**
* @brief Retrieves faulted thread and displays debug info after the user inputs the button sequence.
* Button sequence: L, Up, Left, Down, Right, R, L, B, A
**/
void thread9_crash_screen(UNUSED void *arg0)
{
static OSThread *thread;
OSMesg mesg;
OSMesg newMesg;
newMesg.data16 = 16;
// /**
// * @brief Retrieves faulted thread and displays debug info after the user inputs the button sequence.
// * Button sequence: L, Up, Left, Down, Right, R, L, B, A
// **/
// void thread9_crash_screen(UNUSED void *arg0)
// {
// static OSThread *thread;
// OSMesg mesg;
// OSMesg newMesg;
// newMesg.data16 = 16;
osSetEventMesg(12, &D_80162D40, newMesg);
osSetEventMesg(10, &D_80162D40, newMesg);
sButtonSequenceIndex = 0;
// osSetEventMesg(12, &D_80162D40, newMesg);
// osSetEventMesg(10, &D_80162D40, newMesg);
// sButtonSequenceIndex = 0;
while (true) {
osRecvMesg(&D_80162D40, &mesg, 1);
thread = get_faulted_thread();
// while (true) {
// osRecvMesg(&D_80162D40, &mesg, 1);
// thread = get_faulted_thread();
if (thread) {
// Run only on the first iteration.
if (sCounter == 0) {
crash_screen_draw_square(pFramebuffer);
#ifndef DEBUG
while(true)
{
read_controllers();
// if (thread) {
// // Run only on the first iteration.
// if (sCounter == 0) {
// crash_screen_draw_square(pFramebuffer);
// #ifndef DEBUG
// while(true)
// {
// read_controllers();
if (!gControllerOne->buttonPressed) { continue; }
// if (!gControllerOne->buttonPressed) { continue; }
if (gControllerOne->buttonPressed == sCrashScreenButtonSequence[sButtonSequenceIndex]) {
sButtonSequenceIndex++;
} else {
sButtonSequenceIndex = 0;
}
// if (gControllerOne->buttonPressed == sCrashScreenButtonSequence[sButtonSequenceIndex]) {
// sButtonSequenceIndex++;
// } else {
// sButtonSequenceIndex = 0;
// }
// draws crash info when DRAW_CODE is reached
if (sCrashScreenButtonSequence[sButtonSequenceIndex] == DRAW_CODE) {
break;
}
}
#endif
#if DEBUG
//crash_screen_draw(thread);
#else
crash_screen_draw_info(pFramebuffer, thread);
#endif
// // draws crash info when DRAW_CODE is reached
// if (sCrashScreenButtonSequence[sButtonSequenceIndex] == DRAW_CODE) {
// break;
// }
// }
// #endif
// #if DEBUG
// //crash_screen_draw(thread);
// #else
// crash_screen_draw_info(pFramebuffer, thread);
// #endif
}
if (sCounter < 5) {
sCounter++;
}
}
}
}
// }
// if (sCounter < 5) {
// sCounter++;
// }
// }
// }
// }
void crash_screen_set_framebuffer(u16 *framebuffer) {
pFramebuffer = framebuffer;
@@ -253,8 +253,8 @@ void crash_screen_set_framebuffer(u16 *framebuffer) {
extern void thread9_crash_screen(void *);
void create_debug_thread(void) {
osCreateMesgQueue(&D_80162D40, &D_80162D58, 1);
osCreateThread((OSThread *) &D_80162790, 9, (void *)thread9_crash_screen, 0, &D_80162D40, 0x7F);
//osCreateMesgQueue(&D_80162D40, &D_80162D58, 1);
//osCreateThread((OSThread *) &D_80162790, 9, (void *)thread9_crash_screen, 0, &D_80162D40, 0x7F);
}
void start_debug_thread(void) {
+1 -1
View File
@@ -138,7 +138,7 @@ void load_credits(void) {
gNextFreeMemoryAddress = gFreeMemoryResetAnchor;
load_course(gCurrentCourseId);
D_8015F730 = gNextFreeMemoryAddress;
set_segment_base_addr(0xB, (void *) decompress_segments((u8 *) CEREMONY_DATA_ROM_START, (u8 *) CEREMONY_DATA_ROM_END));
//set_segment_base_addr(0xB, (void *) decompress_segments((u8 *) CEREMONY_DATA_ROM_START, (u8 *) CEREMONY_DATA_ROM_END));
gCourseMinX = -0x15A1;
gCourseMinY = -0x15A1;
+2 -2
View File
@@ -114,8 +114,8 @@ void load_ceremony_cutscene(void) {
gModeSelection = GRAND_PRIX;
load_course(gCurrentCourseId);
D_8015F730 = (s32) gNextFreeMemoryAddress;
set_segment_base_addr(0xB, (void *) decompress_segments((u8 *) CEREMONY_DATA_ROM_START, (u8 *) CEREMONY_DATA_ROM_END));
set_segment_base_addr(6, (void *) decompress_segments((u8 *) &_course_banshee_boardwalk_dl_mio0SegmentRomStart, (u8 *) &_course_yoshi_valley_dl_mio0SegmentRomStart));
//set_segment_base_addr(0xB, (void *) decompress_segments((u8 *) CEREMONY_DATA_ROM_START, (u8 *) CEREMONY_DATA_ROM_END));
//set_segment_base_addr(6, (void *) decompress_segments((u8 *) &_course_banshee_boardwalk_dl_mio0SegmentRomStart, (u8 *) &_course_yoshi_valley_dl_mio0SegmentRomStart));
D_8015F8E4 = -2000.0f;
gCourseMinX = -0x15A1;
+127 -127
View File
@@ -1699,65 +1699,65 @@ void load_kart_texture(Player *player, s8 playerId, s8 arg2, s8 arg3, s8 arg4) {
if (player->animFrameSelector[arg2] != 0) {
osInvalDCache(&D_802DFB80[arg4][arg3][playerId], D_800DDEB0[player->characterId]);
osPiStartDma(
&gDmaIoMesg,
OS_MESG_PRI_NORMAL, OS_READ,
(uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
gKartTextureTable1[player->characterId][player->animGroupSelector[arg2]][player->animFrameSelector[arg2]]
)],
&D_802DFB80[arg4][arg3][playerId],
D_800DDEB0[player->characterId],
&gDmaMesgQueue
);
// osPiStartDma(
// &gDmaIoMesg,
// OS_MESG_PRI_NORMAL, OS_READ,
// (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
// gKartTextureTable1[player->characterId][player->animGroupSelector[arg2]][player->animFrameSelector[arg2]]
// )],
// &D_802DFB80[arg4][arg3][playerId],
// D_800DDEB0[player->characterId],
// &gDmaMesgQueue
// );
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
} else {
osInvalDCache(&D_802DFB80[arg4][arg3][playerId], D_800DDEB0[player->characterId]);
osPiStartDma(
&gDmaIoMesg,
OS_MESG_PRI_NORMAL,
OS_READ,
(uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
gKartTextureTable0[player->characterId][player->animGroupSelector[arg2]][player->animFrameSelector[arg2]]
)],
&D_802DFB80[arg4][arg3][playerId],
D_800DDEB0[player->characterId],
&gDmaMesgQueue
);
// osPiStartDma(
// &gDmaIoMesg,
// OS_MESG_PRI_NORMAL,
// OS_READ,
// (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
// gKartTextureTable0[player->characterId][player->animGroupSelector[arg2]][player->animFrameSelector[arg2]]
// )],
// &D_802DFB80[arg4][arg3][playerId],
// D_800DDEB0[player->characterId],
// &gDmaMesgQueue
// );
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
}
} else if (((temp & 0x400) == 0x400) || ((temp & 0x01000000) == 0x01000000) || ((temp & 0x02000000) == 0x02000000) || ((temp & 0x10000) == 0x10000)) {
osInvalDCache(&D_802DFB80[arg4][arg3][playerId], 0x780U);
// player->unk_0A8 >> 8 converts an 8.8 fixed-point animation frame to a whole number.
osPiStartDma(
&gDmaIoMesg,
OS_MESG_PRI_NORMAL,
OS_READ,
(uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
gKartTextureTumbles[player->characterId][player->unk_0A8 >> 8]
)],
&D_802DFB80[arg4][arg3][playerId],
0x900,
&gDmaMesgQueue
);
// osPiStartDma(
// &gDmaIoMesg,
// OS_MESG_PRI_NORMAL,
// OS_READ,
// (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
// gKartTextureTumbles[player->characterId][player->unk_0A8 >> 8]
// )],
// &D_802DFB80[arg4][arg3][playerId],
// 0x900,
// &gDmaMesgQueue
// );
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
} else {
osInvalDCache(&D_802DFB80[arg4][arg3][playerId], D_800DDEB0[player->characterId]);
osPiStartDma(
&gDmaIoMesg,
OS_MESG_PRI_NORMAL,
OS_READ,
(uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
gKartTextureTable0[player->characterId][player->animGroupSelector[arg2]][player->animFrameSelector[arg2]]
)],
&D_802DFB80[arg4][arg3][playerId],
D_800DDEB0[player->characterId],
&gDmaMesgQueue
);
// osPiStartDma(
// &gDmaIoMesg,
// OS_MESG_PRI_NORMAL,
// OS_READ,
// (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
// gKartTextureTable0[player->characterId][player->animGroupSelector[arg2]][player->animFrameSelector[arg2]]
// )],
// &D_802DFB80[arg4][arg3][playerId],
// D_800DDEB0[player->characterId],
// &gDmaMesgQueue
// );
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
}
@@ -1771,62 +1771,62 @@ void func_80027560(Player *player, s8 arg1, s8 arg2, s8 arg3, s8 arg4) {
if (player->animFrameSelector[arg2] != 0) {
osInvalDCache(&D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId]);
osPiStartDma(
&gDmaIoMesg,
OS_MESG_PRI_NORMAL,
OS_READ,
(uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
gKartTextureTable1[player->characterId][player->animGroupSelector[arg2]][player->animFrameSelector[arg2]]
)],
&D_802DFB80[arg4][arg3][arg1],
D_800DDEB0[player->characterId],
&gDmaMesgQueue
);
// osPiStartDma(
// &gDmaIoMesg,
// OS_MESG_PRI_NORMAL,
// OS_READ,
// (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
// gKartTextureTable1[player->characterId][player->animGroupSelector[arg2]][player->animFrameSelector[arg2]]
// )],
// &D_802DFB80[arg4][arg3][arg1],
// D_800DDEB0[player->characterId],
// &gDmaMesgQueue
// );
} else {
osInvalDCache(&D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId]);
osPiStartDma(
&gDmaIoMesg,
OS_MESG_PRI_NORMAL,
OS_READ,
(uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
gKartTextureTable0[player->characterId][player->animGroupSelector[arg2]][player->animFrameSelector[arg2]]
)],
&D_802DFB80[arg4][arg3][arg1],
D_800DDEB0[player->characterId],
&gDmaMesgQueue
);
// osPiStartDma(
// &gDmaIoMesg,
// OS_MESG_PRI_NORMAL,
// OS_READ,
// (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
// gKartTextureTable0[player->characterId][player->animGroupSelector[arg2]][player->animFrameSelector[arg2]]
// )],
// &D_802DFB80[arg4][arg3][arg1],
// D_800DDEB0[player->characterId],
// &gDmaMesgQueue
// );
}
} else if (((temp & 0x400) == 0x400) || ((temp & 0x01000000) == 0x01000000) ||
((temp & 0x02000000) == 0x02000000) || ((temp & 0x10000) == 0x10000))
{
osInvalDCache(&D_802DFB80[arg4][arg3][arg1], 0x780);
// player->unk_0A8 >> 8 converts an 8.8 fixed-point animation frame to a whole number.
osPiStartDma(
&gDmaIoMesg,
OS_MESG_PRI_NORMAL,
OS_READ,
(uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
gKartTextureTumbles[player->characterId][player->unk_0A8 >> 8]
)],
&D_802DFB80[arg4][arg3][arg1],
0x900,
&gDmaMesgQueue
);
// osPiStartDma(
// &gDmaIoMesg,
// OS_MESG_PRI_NORMAL,
// OS_READ,
// (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
// gKartTextureTumbles[player->characterId][player->unk_0A8 >> 8]
// )],
// &D_802DFB80[arg4][arg3][arg1],
// 0x900,
// &gDmaMesgQueue
// );
} else {
osInvalDCache(&D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId]);
osPiStartDma(
&gDmaIoMesg,
OS_MESG_PRI_NORMAL,
OS_READ,
(uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
gKartTextureTable0[player->characterId][player->animGroupSelector[arg2]][player->animFrameSelector[arg2]]
)],
&D_802DFB80[arg4][arg3][arg1],
D_800DDEB0[player->characterId],
&gDmaMesgQueue
);
// osPiStartDma(
// &gDmaIoMesg,
// OS_MESG_PRI_NORMAL,
// OS_READ,
// (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
// gKartTextureTable0[player->characterId][player->animGroupSelector[arg2]][player->animFrameSelector[arg2]]
// )],
// &D_802DFB80[arg4][arg3][arg1],
// D_800DDEB0[player->characterId],
// &gDmaMesgQueue
// );
}
}
@@ -1842,34 +1842,34 @@ void load_kart_palette(Player *player, s8 playerId, s8 arg2, s8 arg3) {
case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL:
osInvalDCache(temp_s0, sizeof(struct_D_802F1F80));
osPiStartDma(
&gDmaIoMesg,
OS_MESG_PRI_NORMAL,
OS_READ,
(uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
gKartPalettes[player->characterId]
)],
temp_s0,
sizeof(struct_D_802F1F80),
&gDmaMesgQueue
);
// osPiStartDma(
// &gDmaIoMesg,
// OS_MESG_PRI_NORMAL,
// OS_READ,
// (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
// gKartPalettes[player->characterId]
// )],
// temp_s0,
// sizeof(struct_D_802F1F80),
// &gDmaMesgQueue
// );
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
break;
case SCREEN_MODE_3P_4P_SPLITSCREEN: // Code identical to above
osInvalDCache(temp_s0, sizeof(struct_D_802F1F80));
osPiStartDma(
&gDmaIoMesg,
OS_MESG_PRI_NORMAL,
OS_READ,
(uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
gKartPalettes[player->characterId]
)],
temp_s0,
sizeof(struct_D_802F1F80),
&gDmaMesgQueue
);
// osPiStartDma(
// &gDmaIoMesg,
// OS_MESG_PRI_NORMAL,
// OS_READ,
// (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(
// gKartPalettes[player->characterId]
// )],
// temp_s0,
// sizeof(struct_D_802F1F80),
// &gDmaMesgQueue
// );
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
break;
@@ -1879,15 +1879,15 @@ void load_kart_palette(Player *player, s8 playerId, s8 arg2, s8 arg3) {
void func_80027BDC(UNUSED Player *player, s32 arg1, void *vAddr, u16 size) {
osInvalDCache(vAddr, size);
osPiStartDma(
&gDmaIoMesg,
OS_MESG_PRI_NORMAL,
OS_READ,
(uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(arg1)],
vAddr,
size,
&gDmaMesgQueue
);
// osPiStartDma(
// &gDmaIoMesg,
// OS_MESG_PRI_NORMAL,
// OS_READ,
// (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(arg1)],
// vAddr,
// size,
// &gDmaMesgQueue
// );
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
}
@@ -1895,13 +1895,13 @@ void func_80027BDC(UNUSED Player *player, s32 arg1, void *vAddr, u16 size) {
void func_80027C74(UNUSED Player *player, s32 arg1, void *vAddr, u16 size) {
osInvalDCache(vAddr, size);
osPiStartDma(
&gDmaIoMesg,
OS_MESG_PRI_NORMAL,
OS_READ,
(uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(arg1)],
vAddr,
size,
&gDmaMesgQueue
);
// osPiStartDma(
// &gDmaIoMesg,
// OS_MESG_PRI_NORMAL,
// OS_READ,
// (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(arg1)],
// vAddr,
// size,
// &gDmaMesgQueue
// );
}
+1 -1
View File
@@ -2806,6 +2806,6 @@ extern u8 gKartDK318[];
extern u8 gKartDK319[];
extern u8 gKartDK320[];
extern u8 _kart_texturesSegmentRomStart[];
//extern u8 _kart_texturesSegmentRomStart[];
#endif
+49 -49
View File
@@ -216,7 +216,7 @@ void main_func(void) {
create_thread(&gIdleThread, 1, &thread1_idle, NULL, gIdleThreadStack + ARRAY_COUNT(gIdleThreadStack), 100);
osStartThread(&gIdleThread);
}
extern OSViMode osViModeTable[];
//extern OSViMode osViModeTable[];
/**
* Initialize hardware, start main thread, then idle.
*/
@@ -226,9 +226,9 @@ void thread1_idle(void *arg) {
osViSetMode(&osViModeTable[OS_VI_PAL_LAN1]);
#else // VERSION_US
if (osTvType == OS_TV_NTSC) {
osViSetMode(&osViModeTable[OS_VI_NTSC_LAN1]);
//osViSetMode(&osViModeTable[OS_VI_NTSC_LAN1]);
} else {
osViSetMode(&osViModeTable[OS_VI_MPAL_LAN1]);
//osViSetMode(&osViModeTable[OS_VI_MPAL_LAN1]);
}
#endif
osViBlack(true);
@@ -473,19 +473,19 @@ void display_and_vsync(void) {
}
void init_segment_ending_sequences(void) {
bzero((void *) SEG_ENDING, SEG_ENDING_SIZE);
osWritebackDCacheAll();
dma_copy((u8 *) SEG_ENDING, (u8 *) SEG_ENDING_ROM_START, SEG_ENDING_ROM_SIZE);
osInvalICache((void *) SEG_ENDING, SEG_ENDING_SIZE);
osInvalDCache((void *) SEG_ENDING, SEG_ENDING_SIZE);
// bzero((void *) SEG_ENDING, SEG_ENDING_SIZE);
// osWritebackDCacheAll();
// dma_copy((u8 *) SEG_ENDING, (u8 *) SEG_ENDING_ROM_START, SEG_ENDING_ROM_SIZE);
// osInvalICache((void *) SEG_ENDING, SEG_ENDING_SIZE);
// osInvalDCache((void *) SEG_ENDING, SEG_ENDING_SIZE);
}
void init_segment_racing(void) {
bzero((void *) SEG_RACING, SEG_RACING_SIZE);
osWritebackDCacheAll();
dma_copy((u8 *) SEG_RACING, (u8 *) SEG_RACING_ROM_START, SEG_RACING_ROM_SIZE);
osInvalICache((void *) SEG_RACING, SEG_RACING_SIZE);
osInvalDCache((void *) SEG_RACING, SEG_RACING_SIZE);
// bzero((void *) SEG_RACING, SEG_RACING_SIZE);
// osWritebackDCacheAll();
// dma_copy((u8 *) SEG_RACING, (u8 *) SEG_RACING_ROM_START, SEG_RACING_ROM_SIZE);
// osInvalICache((void *) SEG_RACING, SEG_RACING_SIZE);
// osInvalDCache((void *) SEG_RACING, SEG_RACING_SIZE);
}
void dma_copy(u8 *dest, u8 *romAddr, size_t size) {
@@ -508,51 +508,51 @@ void dma_copy(u8 *dest, u8 *romAddr, size_t size) {
* Setup main segments and framebuffers.
*/
void setup_game_memory(void) {
UNUSED u32 pad[2];
ptrdiff_t commonCourseDataSize; // Compressed mio0 size
uintptr_t textureSegSize;
ptrdiff_t textureSegStart;
uintptr_t allocatedMemory;
UNUSED s32 unknown_padding;
// UNUSED u32 pad[2];
// ptrdiff_t commonCourseDataSize; // Compressed mio0 size
// uintptr_t textureSegSize;
// ptrdiff_t textureSegStart;
// uintptr_t allocatedMemory;
// UNUSED s32 unknown_padding;
init_segment_racing();
gHeapEndPtr = SEG_RACING;
set_segment_base_addr(0, (void *) SEG_START);
// 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);
// // Memory pool size of 0xAB630
// initialize_memory_pool(MEMORY_POOL_START, MEMORY_POOL_END);
func_80000BEC();
// func_80000BEC();
// Initialize trig tables segment
osInvalDCache((void *) TRIG_TABLES, TRIG_TABLES_SIZE);
osPiStartDma(&gDmaIoMesg, 0, 0, TRIG_TABLES_ROM_START, (void *) TRIG_TABLES, TRIG_TABLES_SIZE, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
// // Initialize trig tables segment
// osInvalDCache((void *) TRIG_TABLES, TRIG_TABLES_SIZE);
// osPiStartDma(&gDmaIoMesg, 0, 0, TRIG_TABLES_ROM_START, (void *) TRIG_TABLES, TRIG_TABLES_SIZE, &gDmaMesgQueue);
// osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
set_segment_base_addr(2, (void *) load_data(SEG_DATA_START, SEG_DATA_END));
// set_segment_base_addr(2, (void *) load_data(SEG_DATA_START, SEG_DATA_END));
commonCourseDataSize = COMMON_TEXTURES_SIZE;
commonCourseDataSize = ALIGN16(commonCourseDataSize);
// commonCourseDataSize = COMMON_TEXTURES_SIZE;
// commonCourseDataSize = ALIGN16(commonCourseDataSize);
#ifdef AVOID_UB
textureSegStart = (ptrdiff_t) SEG_RACING - commonCourseDataSize;
#else
textureSegStart = SEG_RACING - commonCourseDataSize;
#endif
osPiStartDma(&gDmaIoMesg, 0, 0, COMMON_TEXTURES_ROM_START, (void *) textureSegStart, commonCourseDataSize, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
// #ifdef AVOID_UB
// textureSegStart = (ptrdiff_t) SEG_RACING - commonCourseDataSize;
// #else
// textureSegStart = SEG_RACING - commonCourseDataSize;
// #endif
// osPiStartDma(&gDmaIoMesg, 0, 0, COMMON_TEXTURES_ROM_START, (void *) textureSegStart, commonCourseDataSize, &gDmaMesgQueue);
// osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
textureSegSize = *(uintptr_t *)(textureSegStart + 4);
textureSegSize = ALIGN16(textureSegSize);
allocatedMemory = gNextFreeMemoryAddress;
mio0decode((u8 *) textureSegStart, (u8 *) allocatedMemory);
set_segment_base_addr(0xD, (void *) allocatedMemory);
// textureSegSize = *(uintptr_t *)(textureSegStart + 4);
// textureSegSize = ALIGN16(textureSegSize);
// allocatedMemory = gNextFreeMemoryAddress;
// mio0decode((u8 *) textureSegStart, (u8 *) allocatedMemory);
// set_segment_base_addr(0xD, (void *) allocatedMemory);
gNextFreeMemoryAddress += textureSegSize;
// gNextFreeMemoryAddress += textureSegSize;
// Common course data does not get reloaded when the race state resets.
// Therefore, only reset the memory ptr to after the common course data.
gFreeMemoryResetAnchor = gNextFreeMemoryAddress;
// // Common course data does not get reloaded when the race state resets.
// // Therefore, only reset the memory ptr to after the common course data.
// gFreeMemoryResetAnchor = gNextFreeMemoryAddress;
}
/**
@@ -992,7 +992,7 @@ void handle_vblank(void) {
/* This is where I would put my rumble code... If I had any. */
#if ENABLE_RUMBLE
rumble_thread_update_vi();
// rumble_thread_update_vi();
#endif
if (gVblankHandler1 != NULL) {
+2
View File
@@ -3,4 +3,6 @@
extern "C" {
u64 osClockRate = 62500000;
}
+26 -26
View File
@@ -356,7 +356,7 @@ UNUSED s32 func_802A8348(s32 arg0, s32 arg1, s32 arg2) {
newAddr = (void *) (oldAddr + offset);
pad = &newAddr;
osInvalDCache(newAddr, offset);
osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_other_texturesSegmentRomStart[SEGMENT_OFFSET(arg0)], newAddr, offset, &gDmaMesgQueue);
//osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_other_texturesSegmentRomStart[SEGMENT_OFFSET(arg0)], newAddr, offset, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
func_80040030((u8 *) newAddr, (u8 *) oldAddr);
@@ -373,7 +373,7 @@ UNUSED u8 *func_802A841C(u8* arg0, s32 arg1, s32 arg2) {
arg2 = ALIGN16(arg2);
osInvalDCache(temp_a0, arg1);
osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_other_texturesSegmentRomStart[SEGMENT_OFFSET(arg0)],temp_a0, arg1, &gDmaMesgQueue);
//osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_other_texturesSegmentRomStart[SEGMENT_OFFSET(arg0)],temp_a0, arg1, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
func_80040030((u8 *) temp_a0, temp_v0);
gNextFreeMemoryAddress += arg2;
@@ -381,36 +381,36 @@ UNUSED u8 *func_802A841C(u8* arg0, s32 arg1, s32 arg2) {
}
u8 *dma_textures(u8 texture[], size_t arg1, size_t arg2) {
u8 *temp_v0;
void *temp_a0;
// u8 *temp_v0;
// void *temp_a0;
temp_v0 = (u8 *) gNextFreeMemoryAddress;
temp_a0 = temp_v0 + arg2;
arg1 = ALIGN16(arg1);
arg2 = ALIGN16(arg2);
osInvalDCache((void *) temp_a0, arg1);
osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_other_texturesSegmentRomStart[SEGMENT_OFFSET(texture)], (void *)temp_a0, arg1, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, (int) 1);
mio0decode((u8 *) temp_a0, temp_v0);
gNextFreeMemoryAddress += arg2;
return temp_v0;
// temp_v0 = (u8 *) gNextFreeMemoryAddress;
// temp_a0 = temp_v0 + arg2;
// arg1 = ALIGN16(arg1);
// arg2 = ALIGN16(arg2);
// osInvalDCache((void *) temp_a0, arg1);
// osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_other_texturesSegmentRomStart[SEGMENT_OFFSET(texture)], (void *)temp_a0, arg1, &gDmaMesgQueue);
// osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, (int) 1);
// mio0decode((u8 *) temp_a0, temp_v0);
// gNextFreeMemoryAddress += arg2;
// return temp_v0;
}
u32 MIO0_0F(u8 *arg0, u32 arg1, u32 arg2) {
u32 oldHeapEndPtr;
void *temp_v0;
// u32 oldHeapEndPtr;
// void *temp_v0;
arg1 = ALIGN16(arg1);
arg2 = ALIGN16(arg2);
oldHeapEndPtr = gHeapEndPtr;
temp_v0 = (void *) gNextFreeMemoryAddress;
// arg1 = ALIGN16(arg1);
// arg2 = ALIGN16(arg2);
// oldHeapEndPtr = gHeapEndPtr;
// temp_v0 = (void *) gNextFreeMemoryAddress;
osInvalDCache(temp_v0, arg1);
osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_other_texturesSegmentRomStart[SEGMENT_OFFSET(arg0)], temp_v0, arg1, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
mio0decode((u8 *) temp_v0, (u8 *) oldHeapEndPtr);
gHeapEndPtr += arg2;
return oldHeapEndPtr;
// osInvalDCache(temp_v0, arg1);
// osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_other_texturesSegmentRomStart[SEGMENT_OFFSET(arg0)], temp_v0, arg1, &gDmaMesgQueue);
// osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
// mio0decode((u8 *) temp_v0, (u8 *) oldHeapEndPtr);
// gHeapEndPtr += arg2;
// return oldHeapEndPtr;
}
void func_802A86A8(CourseVtx *data, u32 arg1) {
+1
View File
@@ -1,6 +1,7 @@
#include <libultraship.h>
#include <macros.h>
#include <mk64.h>
#include <stubs.h>
#include <common_structs.h>
#include <defines.h>
#include "code_800029B0.h"
+1
View File
@@ -1,6 +1,7 @@
#include <libultraship.h>
#include <macros.h>
#include <defines.h>
#include <stubs.h>
#include "save.h"
+1
View File
@@ -1,5 +1,6 @@
#include <defines.h>
#include <mk64.h>
#include <stubs.h>
#include "spawn_players.h"
#include "code_800029B0.h"
+1 -3
View File
@@ -15,8 +15,6 @@
#include "code_80057C60.h"
#include "kart_dma.h"
extern s32 mio0encode(s32 input, s32, s32);
u8 *D_80162D80;
s16 D_80162D84;
s16 D_80162D86;
@@ -71,7 +69,7 @@ extern StaffGhost *d_luigi_raceway_staff_ghost;
void func_80004EF0(void) {
D_80162DA4 = (u32 *) &D_802BFB80.arraySize8[0][2][3];
osInvalDCache(&D_80162DA4[0], 0x4000);
osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(D_80162DC4)], D_80162DA4, 0x4000, &gDmaMesgQueue);
//osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(D_80162DC4)], D_80162DA4, 0x4000, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
D_80162D9C = (*D_80162DA4 & 0xFF0000);
D_80162DA0 = 0;
+90
View File
@@ -18,4 +18,94 @@ void func_80040030(u8* arg0, u8* arg1) {
void func_80040174(void* arg0, s32 arg1, s32 arg2) {
}
s32 osAiSetFrequency(u32 freq)
{
return 1;
}
void mio0decode(u8* arg0, u8* arg1) {
}
s32 mio0encode(s32 input, s32 arg1, s32 arg2) {
return 1;
}
void tkmk00decode(u8* arg0, u8* arg1, u8* arg2, s32 arg3) {
}
void osStartThread(OSThread* thread)
{
}
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 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) {
}
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) {
return 0;
}
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) {
}
+1 -1
View File
@@ -1207,7 +1207,7 @@ void func_80074510(uintptr_t devAddr, void * vaddr, size_t nbytes) {
}
void func_80074574(u8 *arg0, void *arg1, u16 arg2, u16 arg3) {
func_80074510((uintptr_t) &_other_texturesSegmentRomStart[SEGMENT_OFFSET(arg0)], arg1, arg2 * arg3);
//func_80074510((uintptr_t) &_other_texturesSegmentRomStart[SEGMENT_OFFSET(arg0)], arg1, arg2 * arg3);
}
//! @todo arg1 should likely be a u8 *
-114
View File
@@ -11,16 +11,6 @@
- '#include <libultraship.h>'
- '#include <common_structs.h>'
tables:
common_grand_prix_human_item_curve:
range: [0x8150, 0x840C]
common_grand_prix_kart_ai_item_curve:
range: [0x8470, 0x872C]
common_versus_2_player_item_curve:
range: [0x8790, 0x87F4]
common_versus_3_player_item_curve:
range: [0x8858, 0x8920]
common_versus_4_player_item_curve:
range: [0x8984, 0x8AB0]
common_texture_hud_place:
range: [0xD258, 0x14258]
mode: APPEND
@@ -851,110 +841,6 @@ D_0D008138:
symbol: D_0D008138
type: gfx
offset: 0x8138
common_grand_prix_human_item_curve:
symbol: common_grand_prix_human_item_curve
type: mk64:item_curve
offset: 0x8150
common_grand_prix_human_item_curve2:
symbol: common_grand_prix_human_item_curve2
type: mk64:item_curve
offset: 0x81B4
common_grand_prix_human_item_curve3:
symbol: common_grand_prix_human_item_curve3
type: mk64:item_curve
offset: 0x8218
common_grand_prix_human_item_curve4:
symbol: common_grand_prix_human_item_curve4
type: mk64:item_curve
offset: 0x827C
common_grand_prix_human_item_curve5:
symbol: common_grand_prix_human_item_curve5
type: mk64:item_curve
offset: 0x82E0
common_grand_prix_human_item_curve6:
symbol: common_grand_prix_human_item_curve6
type: mk64:item_curve
offset: 0x8344
common_grand_prix_human_item_curve7:
symbol: common_grand_prix_human_item_curve7
type: mk64:item_curve
offset: 0x83A8
common_grand_prix_human_item_curve8:
symbol: common_grand_prix_human_item_curve8
type: mk64:item_curve
offset: 0x840C
common_grand_prix_kart_ai_item_curve:
symbol: common_grand_prix_kart_ai_item_curve
type: mk64:item_curve
offset: 0x8470
common_grand_prix_kart_ai_item_curve2:
symbol: common_grand_prix_kart_ai_item_curve2
type: mk64:item_curve
offset: 0x84D4
common_grand_prix_kart_ai_item_curve3:
symbol: common_grand_prix_kart_ai_item_curve3
type: mk64:item_curve
offset: 0x8538
common_grand_prix_kart_ai_item_curve4:
symbol: common_grand_prix_kart_ai_item_curve4
type: mk64:item_curve
offset: 0x859C
common_grand_prix_kart_ai_item_curve5:
symbol: common_grand_prix_kart_ai_item_curve5
type: mk64:item_curve
offset: 0x8600
common_grand_prix_kart_ai_item_curve6:
symbol: common_grand_prix_kart_ai_item_curve6
type: mk64:item_curve
offset: 0x8664
common_grand_prix_kart_ai_item_curve7:
symbol: common_grand_prix_kart_ai_item_curve7
type: mk64:item_curve
offset: 0x86C8
common_grand_prix_kart_ai_item_curve8:
symbol: common_grand_prix_kart_ai_item_curve8
type: mk64:item_curve
offset: 0x872C
common_versus_2_player_item_curve:
symbol: common_versus_2_player_item_curve
type: mk64:item_curve
offset: 0x8790
common_versus_2_player_item_curve2:
symbol: common_versus_2_player_item_curve2
type: mk64:item_curve
offset: 0x87F4
common_versus_3_player_item_curve:
symbol: common_versus_3_player_item_curve
type: mk64:item_curve
offset: 0x8858
common_versus_3_player_item_curve2:
symbol: common_versus_3_player_item_curve2
type: mk64:item_curve
offset: 0x88BC
common_versus_3_player_item_curve3:
symbol: common_versus_3_player_item_curve3
type: mk64:item_curve
offset: 0x8920
common_versus_4_player_item_curve:
symbol: common_versus_4_player_item_curve
type: mk64:item_curve
offset: 0x8984
common_versus_4_player_item_curve2:
symbol: common_versus_4_player_item_curve2
type: mk64:item_curve
offset: 0x89E8
common_versus_4_player_item_curve3:
symbol: common_versus_4_player_item_curve3
type: mk64:item_curve
offset: 0x8A4C
common_versus_4_player_item_curve4:
symbol: common_versus_4_player_item_curve4
type: mk64:item_curve
offset: 0x8AB0
common_battle_item_curve:
symbol: common_battle_item_curve
type: mk64:item_curve
offset: 0x8B14
D_0D008B78:
symbol: D_0D008B78
type: vtx