UNF Progress (still broken LOL)
This commit is contained in:
1 parent
dba8608561
commit
c621be8f1d
16 files changed
+123
-53
No files matched your search
@@ -282,12 +282,12 @@ endif
|
||||
#==============================================================================#
|
||||
|
||||
# detect prefix for MIPS toolchain
|
||||
ifneq ($(call find-command,mips-linux-gnu-ld),)
|
||||
ifneq ($(call find-command,mips64-elf-ld),)
|
||||
CROSS := mips64-elf-
|
||||
else ifneq ($(call find-command,mips-linux-gnu-ld),)
|
||||
CROSS := mips-linux-gnu-
|
||||
else ifneq ($(call find-command,mips64-linux-gnu-ld),)
|
||||
CROSS := mips64-linux-gnu-
|
||||
else ifneq ($(call find-command,mips64-elf-ld),)
|
||||
CROSS := mips64-elf-
|
||||
else
|
||||
$(error Unable to detect a suitable MIPS toolchain installed)
|
||||
endif
|
||||
@@ -438,6 +438,7 @@ libultra: $(BUILD_DIR)/libultra.a
|
||||
# Extra object file dependencies
|
||||
$(BUILD_DIR)/asm/boot.o: $(IPL3_RAW_FILES)
|
||||
$(BUILD_DIR)/src/game/crash_screen.o: $(CRASH_TEXTURE_C_FILES)
|
||||
$(BUILD_DIR)/src/game/version.o: $(BUILD_DIR)/src/game/version_data.h
|
||||
$(BUILD_DIR)/lib/rsp.o: $(BUILD_DIR)/rsp/rspboot.bin $(BUILD_DIR)/rsp/fast3d.bin $(BUILD_DIR)/rsp/audio.bin
|
||||
$(SOUND_BIN_DIR)/sound_data.o: $(SOUND_BIN_DIR)/sound_data.ctl.inc.c $(SOUND_BIN_DIR)/sound_data.tbl.inc.c $(SOUND_BIN_DIR)/sequences.bin.inc.c $(SOUND_BIN_DIR)/bank_sets.inc.c
|
||||
$(BUILD_DIR)/levels/scripts.o: $(BUILD_DIR)/include/level_headers.h
|
||||
@@ -648,6 +649,9 @@ $(GLOBAL_ASM_DEP).$(NON_MATCHING):
|
||||
@$(RM) $(GLOBAL_ASM_DEP).*
|
||||
$(V)touch $@
|
||||
|
||||
# Generate version_data.h
|
||||
$(BUILD_DIR)/src/game/version_data.h: tools/make_version.sh
|
||||
tools/make_version.sh $(CROSS) > $@
|
||||
|
||||
#==============================================================================#
|
||||
# Compilation Recipes #
|
||||
|
||||
@@ -94,12 +94,7 @@ SECTIONS
|
||||
BUILD_DIR/src/audio/load.o(.bss*);
|
||||
BUILD_DIR/src/audio/data.o(.bss*);
|
||||
BUILD_DIR/src/audio*.o(.bss*);
|
||||
|
||||
#ifdef VERSION_EU
|
||||
. = ALIGN(0x200);
|
||||
#else
|
||||
. = ALIGN(0x1000);
|
||||
#endif
|
||||
BUILD_DIR/src/buffers/gfx_output_buffer.o(.bss*);
|
||||
}
|
||||
END_NOLOAD(buffers)
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "game/level_update.h"
|
||||
#include "game/object_list_processor.h"
|
||||
#include "game/camera.h"
|
||||
#include "usb/debug.h"
|
||||
#include "seq_ids.h"
|
||||
#include "dialog_ids.h"
|
||||
|
||||
@@ -2358,6 +2359,9 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) {
|
||||
u8 i;
|
||||
u8 foundIndex = 0;
|
||||
|
||||
#ifdef UNF
|
||||
debug_printf("Just play them immediately, stopping any old sequence.\n");
|
||||
#endif
|
||||
// Except for the background music player, we don't support queued
|
||||
// sequences. Just play them immediately, stopping any old sequence.
|
||||
if (player != SEQ_PLAYER_LEVEL) {
|
||||
@@ -2365,6 +2369,9 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef UNF
|
||||
debug_printf("Abort if the queue is already full.\n");
|
||||
#endif
|
||||
// Abort if the queue is already full.
|
||||
if (sBackgroundMusicQueueSize == MAX_BACKGROUND_MUSIC_QUEUE_SIZE) {
|
||||
return;
|
||||
@@ -2376,14 +2383,23 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) {
|
||||
for (i = 0; i < sBackgroundMusicQueueSize; i++) {
|
||||
if (sBackgroundMusicQueue[i].seqId == seqId) {
|
||||
if (i == 0) {
|
||||
#ifdef UNF
|
||||
debug_printf("seq_player_play_sequence\n");
|
||||
#endif
|
||||
seq_player_play_sequence(SEQ_PLAYER_LEVEL, seqId, fadeTimer);
|
||||
} else if (!gSequencePlayers[SEQ_PLAYER_LEVEL].enabled) {
|
||||
#ifdef UNF
|
||||
debug_printf("stop_background_music\n");
|
||||
#endif
|
||||
stop_background_music(sBackgroundMusicQueue[0].seqId);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef UNF
|
||||
debug_printf("Find the next sequence slot by priority.\n");
|
||||
#endif
|
||||
// Find the next sequence slot by priority.
|
||||
for (i = 0; i < sBackgroundMusicQueueSize; i++) {
|
||||
if (sBackgroundMusicQueue[i].priority <= priority) {
|
||||
@@ -2395,6 +2411,9 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) {
|
||||
// If the sequence ends up first in the queue, start it, and make space for
|
||||
// one more entry in the queue.
|
||||
if (foundIndex == 0) {
|
||||
#ifdef UNF
|
||||
debug_printf("seq_player_play_sequence\n");
|
||||
#endif
|
||||
seq_player_play_sequence(SEQ_PLAYER_LEVEL, seqId, fadeTimer);
|
||||
sBackgroundMusicQueueSize++;
|
||||
}
|
||||
|
||||
@@ -36,9 +36,3 @@ struct GfxPool gGfxPools[2];
|
||||
#ifdef VERSION_JP
|
||||
ALIGNED8 u8 gAudioSPTaskYieldBuffer[OS_YIELD_AUDIO_SIZE];
|
||||
#endif
|
||||
|
||||
// Probably Thread 2 stack space. Unreferenced, and stubbed out with f3dex to
|
||||
// avoid an overflowing .buffers segment.
|
||||
#if !defined(F3DEX_GBI_SHARED) && !defined(VERSION_EU)
|
||||
ALIGNED8 u8 gUnusedThread2Stack[0x1400];
|
||||
#endif
|
||||
@@ -14,8 +14,6 @@ extern u8 gAudioHeap[];
|
||||
|
||||
extern u8 gAudioSPTaskYieldBuffer[];
|
||||
|
||||
extern u8 gUnusedThread2Stack[];
|
||||
|
||||
extern u8 gIdleThreadStack[];
|
||||
extern u8 gThread3Stack[];
|
||||
extern u8 gThread4Stack[];
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
#include <ultra64.h>
|
||||
#include "gfx_output_buffer.h"
|
||||
|
||||
#ifdef VERSION_EU
|
||||
// 0x17e00 bytes, aligned to a 0x200-byte boundary through sm64.ld. The alignment
|
||||
// wastes 0x100 bytes of space.
|
||||
u64 gGfxSPTaskOutputBuffer[0x2fc0];
|
||||
#else
|
||||
// 0x1f000 bytes, aligned to a 0x1000-byte boundary through sm64.ld. (This results
|
||||
// in a bunch of unused space: ~0x100 in JP, ~0x300 in US.)
|
||||
u64 gGfxSPTaskOutputBuffer[0x3e00];
|
||||
#endif
|
||||
@@ -3,10 +3,6 @@
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#ifdef VERSION_EU
|
||||
extern u64 gGfxSPTaskOutputBuffer[0x2fc0];
|
||||
#else
|
||||
extern u64 gGfxSPTaskOutputBuffer[0x3e00];
|
||||
#endif
|
||||
|
||||
#endif // GFX_OUTPUT_BUFFER_H
|
||||
+30
-1
@@ -602,26 +602,53 @@ void thread5_game_loop(UNUSED void *arg) {
|
||||
struct LevelCommand *addr;
|
||||
|
||||
setup_game_memory();
|
||||
#ifdef UNF
|
||||
debug_printf("init_rumble_pak_scheduler_queue\n");
|
||||
#endif
|
||||
#if ENABLE_RUMBLE
|
||||
init_rumble_pak_scheduler_queue();
|
||||
#endif
|
||||
#ifdef UNF
|
||||
debug_initialize();
|
||||
debug_printf("init_controllers\n");
|
||||
#endif
|
||||
init_controllers();
|
||||
#if ENABLE_RUMBLE
|
||||
#ifdef UNF
|
||||
debug_printf("create_thread_6\n");
|
||||
#endif
|
||||
create_thread_6();
|
||||
#endif
|
||||
#ifdef UNF
|
||||
debug_printf("createHvqmThread\n");
|
||||
#endif
|
||||
createHvqmThread();
|
||||
#ifdef UNF
|
||||
debug_printf("save_file_load_all\n");
|
||||
#endif
|
||||
save_file_load_all();
|
||||
|
||||
#ifdef UNF
|
||||
debug_printf("set_vblank_handler\n");
|
||||
#endif
|
||||
set_vblank_handler(2, &gGameVblankHandler, &gGameVblankQueue, (OSMesg) 1);
|
||||
|
||||
#ifdef UNF
|
||||
debug_printf("point addr to the entry point into the level script data.\n");
|
||||
#endif
|
||||
// point addr to the entry point into the level script data.
|
||||
addr = segmented_to_virtual(level_script_entry);
|
||||
|
||||
#ifdef UNF
|
||||
debug_printf("play_music\n");
|
||||
#endif
|
||||
play_music(SEQ_PLAYER_SFX, SEQUENCE_ARGS(0, SEQ_SOUND_PLAYER), 0);
|
||||
#ifdef UNF
|
||||
debug_printf("set_sound_mode\n");
|
||||
#endif
|
||||
set_sound_mode(save_file_get_sound_mode());
|
||||
#ifdef UNF
|
||||
debug_printf("rendering_init\n");
|
||||
#endif
|
||||
rendering_init();
|
||||
|
||||
while (TRUE) {
|
||||
@@ -654,9 +681,11 @@ void thread5_game_loop(UNUSED void *arg) {
|
||||
// amount of free space remaining.
|
||||
print_text_fmt_int(180, 20, "BUF %d", gGfxPoolEnd - (u8 *) gDisplayListHead);
|
||||
}
|
||||
#if 0
|
||||
if (gPlayer1Controller->buttonPressed & L_TRIG) {
|
||||
osStartThread(&hvqmThread);
|
||||
osRecvMesg(&gDmaMesgQueue, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
+15
-4
@@ -12,6 +12,7 @@
|
||||
#include "segments.h"
|
||||
#include "main.h"
|
||||
#include "rumble_init.h"
|
||||
#include "version.h"
|
||||
#include "usb/usb.h"
|
||||
#include "usb/debug.h"
|
||||
|
||||
@@ -56,7 +57,6 @@ u32 gNumVblanks = 0;
|
||||
s8 gResetTimer = 0;
|
||||
s8 D_8032C648 = 0;
|
||||
s8 gDebugLevelSelect = FALSE;
|
||||
s8 D_8032C650 = 0;
|
||||
|
||||
s8 gShowProfiler = FALSE;
|
||||
s8 gShowDebugText = FALSE;
|
||||
@@ -312,6 +312,14 @@ void thread3_main(UNUSED void *arg) {
|
||||
load_engine_code_segment();
|
||||
crash_screen_init();
|
||||
|
||||
#ifdef UNF
|
||||
debug_printf("Super Mario 64\n");
|
||||
debug_printf("Built by: %s\n", __username__);
|
||||
debug_printf("Date : %s\n", __datetime__);
|
||||
debug_printf("Compiler: %s\n", __compiler__);
|
||||
debug_printf("Linker : %s\n", __linker__);
|
||||
#endif
|
||||
|
||||
create_thread(&gSoundThread, 4, thread4_sound, NULL, gThread4Stack + 0x2000, 20);
|
||||
osStartThread(&gSoundThread);
|
||||
|
||||
@@ -421,10 +429,12 @@ void thread1_idle(UNUSED void *arg) {
|
||||
osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON);
|
||||
osViSetSpecialFeatures(OS_VI_GAMMA_OFF);
|
||||
osCreatePiManager(OS_PRIORITY_PIMGR, &gPIMesgQueue, gPIMesgBuf, ARRAY_COUNT(gPIMesgBuf));
|
||||
#ifdef UNF
|
||||
debug_initialize();
|
||||
#endif
|
||||
create_thread(&gMainThread, 3, thread3_main, NULL, gThread3Stack + 0x2000, 100);
|
||||
if (D_8032C650 == 0) {
|
||||
osStartThread(&gMainThread);
|
||||
}
|
||||
osStartThread(&gMainThread);
|
||||
|
||||
osSetThreadPri(NULL, 0);
|
||||
|
||||
// halt
|
||||
@@ -435,6 +445,7 @@ void thread1_idle(UNUSED void *arg) {
|
||||
|
||||
void main_func(void) {
|
||||
osInitialize();
|
||||
|
||||
create_thread(&gIdleThread, 1, thread1_idle, NULL, gIdleThreadStack + 0x800, 100);
|
||||
osStartThread(&gIdleThread);
|
||||
}
|
||||
@@ -64,7 +64,6 @@ extern u32 gNumVblanks;
|
||||
extern s8 gResetTimer;
|
||||
extern s8 D_8032C648;
|
||||
extern s8 gDebugLevelSelect;
|
||||
extern s8 D_8032C650;
|
||||
extern s8 gShowProfiler;
|
||||
extern s8 gShowDebugText;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "memory.h"
|
||||
#include "segment_symbols.h"
|
||||
#include "segments.h"
|
||||
#include "usb/debug.h"
|
||||
|
||||
// round up to the next multiple
|
||||
#define ALIGN4(val) (((val) + 0x3) & ~0x3)
|
||||
@@ -364,10 +365,16 @@ void load_engine_code_segment(void) {
|
||||
UNUSED u32 alignedSize = ALIGN16(_engineSegmentRomEnd - _engineSegmentRomStart);
|
||||
|
||||
bzero(startAddr, totalSize);
|
||||
#ifdef UNF
|
||||
debug_printf("DMA-ing engine segment...");
|
||||
#endif
|
||||
osWritebackDCacheAll();
|
||||
dma_read(startAddr, _engineSegmentRomStart, _engineSegmentRomEnd);
|
||||
osInvalICache(startAddr, totalSize);
|
||||
osInvalDCache(startAddr, totalSize);
|
||||
#ifdef UNF
|
||||
debug_printf("\rDMA-ing engine segment...Done!\n");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#include "version.h"
|
||||
#include "src/game/version_data.h"
|
||||
|
||||
char __username__[] = __USERNAME__;
|
||||
char __datetime__[] = __DATETIME__;
|
||||
char __compiler__[] = __COMPILER__;
|
||||
char __linker__[] = __LINKER__;
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef VER_H
|
||||
#define VER_H
|
||||
|
||||
extern char __username__[];
|
||||
extern char __datetime__[];
|
||||
extern char __compiler__[];
|
||||
extern char __linker__[];
|
||||
|
||||
#endif
|
||||
+2
-2
@@ -7,8 +7,8 @@
|
||||
|
||||
// Settings
|
||||
#define DEBUG_MODE 1 // Enable/Disable debug mode
|
||||
#define DEBUG_INIT_MSG 0 // Print a message when debug mode has initialized
|
||||
#define USE_FAULTTHREAD 1 // Create a fault detection thread
|
||||
#define DEBUG_INIT_MSG 1 // Print a message when debug mode has initialized
|
||||
#define USE_FAULTTHREAD 0 // Create a fault detection thread
|
||||
#define OVERWRITE_OSPRINT 0 // Replaces osSyncPrintf calls with debug_printf
|
||||
#define MAX_COMMANDS 25 // The max amount of user defined commands possible
|
||||
|
||||
|
||||
+20
-17
@@ -258,7 +258,7 @@ char usb_initialize()
|
||||
|
||||
static void usb_findcart()
|
||||
{
|
||||
u32 buff;
|
||||
u32 buff __attribute__((aligned(8)));
|
||||
|
||||
// Read the cartridge and check if we have a 64Drive.
|
||||
#if USE_OSRAW
|
||||
@@ -493,7 +493,7 @@ void usb_purge()
|
||||
|
||||
static s8 usb_64drive_wait()
|
||||
{
|
||||
u32 ret;
|
||||
u32 ret __attribute__((aligned(8)));
|
||||
u32 timeout = 0; // I wanted to use osGetTime() but that requires the VI manager
|
||||
|
||||
// Wait until the cartridge interface is ready
|
||||
@@ -541,7 +541,7 @@ static void usb_64drive_setwritable(u8 enable)
|
||||
|
||||
static void usb_64drive_waitidle()
|
||||
{
|
||||
u32 status;
|
||||
u32 status __attribute__((aligned(8)));
|
||||
do
|
||||
{
|
||||
#if USE_OSRAW
|
||||
@@ -563,7 +563,7 @@ static void usb_64drive_waitidle()
|
||||
|
||||
static u32 usb_64drive_armstatus()
|
||||
{
|
||||
u32 status;
|
||||
u32 status __attribute__((aligned(8)));
|
||||
#if USE_OSRAW
|
||||
osPiRawReadIo(D64_CIBASE_ADDRESS + D64_REGISTER_USBCOMSTAT, &status);
|
||||
#else
|
||||
@@ -580,7 +580,7 @@ static u32 usb_64drive_armstatus()
|
||||
|
||||
static void usb_64drive_waitdisarmed()
|
||||
{
|
||||
u32 status;
|
||||
u32 status __attribute__((aligned(8)));
|
||||
do
|
||||
{
|
||||
#if USE_OSRAW
|
||||
@@ -680,7 +680,8 @@ static void usb_64drive_write(int datatype, const void* data, int size)
|
||||
|
||||
static void usb_64drive_arm(u32 offset, u32 size)
|
||||
{
|
||||
u32 ret = usb_64drive_armstatus();
|
||||
u32 ret __attribute__((aligned(8)));
|
||||
ret = usb_64drive_armstatus();
|
||||
|
||||
if (ret != D64_USB_ARMING && ret != D64_USB_ARMED)
|
||||
{
|
||||
@@ -726,7 +727,7 @@ static void usb_64drive_disarm()
|
||||
|
||||
static u32 usb_64drive_poll()
|
||||
{
|
||||
u32 ret;
|
||||
u32 ret __attribute__((aligned(8)));
|
||||
|
||||
// Arm the USB buffer
|
||||
usb_64drive_waitidle();
|
||||
@@ -852,7 +853,7 @@ static void usb_64drive_read()
|
||||
|
||||
static void usb_everdrive_wait_pidma()
|
||||
{
|
||||
u32 status;
|
||||
u32 status __attribute__((aligned(8)));
|
||||
do
|
||||
{
|
||||
status = *(volatile unsigned long *)(N64_PI_ADDRESS + N64_PI_STATUS);
|
||||
@@ -967,7 +968,7 @@ static void usb_everdrive_writereg(u64 reg, u32 value)
|
||||
|
||||
static void usb_everdrive_usbbusy()
|
||||
{
|
||||
u32 val;
|
||||
u32 val __attribute__((aligned(8)));
|
||||
do
|
||||
{
|
||||
usb_everdrive_readreg(ED_REG_USBCFG, &val);
|
||||
@@ -984,7 +985,8 @@ static void usb_everdrive_usbbusy()
|
||||
|
||||
static u8 usb_everdrive_canread()
|
||||
{
|
||||
u32 val, status = ED_USBSTAT_POWER;
|
||||
u32 val __attribute__((aligned(8)));
|
||||
u32 status = ED_USBSTAT_POWER;
|
||||
|
||||
// Read the USB register and check its status
|
||||
usb_everdrive_readreg(ED_REG_USBCFG, &val);
|
||||
@@ -1105,7 +1107,7 @@ static void usb_everdrive_write(int datatype, const void* data, int size)
|
||||
|
||||
static u32 usb_everdrive_poll()
|
||||
{
|
||||
char buff[16];
|
||||
char buff[16] __attribute__((aligned(8)));
|
||||
int len;
|
||||
int offset = 0;
|
||||
|
||||
@@ -1200,7 +1202,7 @@ static void usb_everdrive_read()
|
||||
|
||||
static u32 usb_sc64_read_usb_scr(void)
|
||||
{
|
||||
u32 usb_scr;
|
||||
u32 usb_scr __attribute__((aligned(8)));
|
||||
|
||||
#if USE_OSRAW
|
||||
osPiRawReadIo(SC64_REG_USB_SCR, &usb_scr);
|
||||
@@ -1220,7 +1222,7 @@ static u32 usb_sc64_read_usb_scr(void)
|
||||
|
||||
static u32 usb_sc64_read_usb_fifo(void)
|
||||
{
|
||||
u32 data;
|
||||
u32 data __attribute__((aligned(8)));
|
||||
|
||||
#if USE_OSRAW
|
||||
osPiRawReadIo(SC64_MEM_USB_FIFO_BASE, &data);
|
||||
@@ -1240,7 +1242,7 @@ static u32 usb_sc64_read_usb_fifo(void)
|
||||
|
||||
static s8 usb_sc64_waitidle(void)
|
||||
{
|
||||
u32 usb_scr;
|
||||
u32 usb_scr __attribute__((aligned(8)));
|
||||
|
||||
do
|
||||
{
|
||||
@@ -1265,7 +1267,7 @@ static s8 usb_sc64_waitidle(void)
|
||||
|
||||
static s32 usb_sc64_waitdata(u32 length)
|
||||
{
|
||||
u32 usb_scr;
|
||||
u32 usb_scr __attribute__((aligned(8)));
|
||||
u32 wait_length = ALIGN(MIN(length, SC64_MEM_USB_FIFO_LEN), 4);
|
||||
u32 bytes = 0;
|
||||
|
||||
@@ -1292,7 +1294,7 @@ static s32 usb_sc64_waitdata(u32 length)
|
||||
|
||||
static void usb_sc64_setwritable(u8 enable)
|
||||
{
|
||||
u32 scr;
|
||||
u32 scr __attribute__((aligned(8)));
|
||||
|
||||
#if USE_OSRAW
|
||||
osPiRawReadIo(SC64_REG_SCR, &scr);
|
||||
@@ -1437,7 +1439,8 @@ static void usb_sc64_write(int datatype, const void* data, int size)
|
||||
|
||||
static u32 usb_sc64_poll(void)
|
||||
{
|
||||
u32 buff, sdram_address;
|
||||
u32 buff __attribute__((aligned(8)));
|
||||
u32 sdram_address;
|
||||
int left;
|
||||
|
||||
// Load how many 32 bit words are in FIFO
|
||||
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
echo "#ifndef VER_DATA_H"
|
||||
echo "#define VER_DATA_H"
|
||||
echo "#define __USERNAME__ \"`whoami`@`hostname`\""
|
||||
echo "#define __DATETIME__ \"`date`\""
|
||||
echo "#define __COMPILER__ \"$1gcc version `$1gcc -dumpfullversion`\""
|
||||
echo "#define __LINKER__ \"$1ld: `$1ld -v`\""
|
||||
echo "#endif"
|
||||
Reference in new issue
Block a user