You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
Refresh 14
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
diff --git a/asm/crash.s b/asm/crash.s
|
||||
new file mode 100644
|
||||
index 00000000..0b2a5574
|
||||
index 00000000..033bf952
|
||||
--- /dev/null
|
||||
+++ b/asm/crash.s
|
||||
@@ -0,0 +1,153 @@
|
||||
+# SM64 Crash Handler
|
||||
+# See Readme below.
|
||||
+// SM64 Crash Handler
|
||||
+// See Readme below.
|
||||
+
|
||||
+.include "macros.inc"
|
||||
+#include "macros.inc"
|
||||
+
|
||||
+/* ---------------------------------------------------------------
|
||||
+ * IMPORTANT README:
|
||||
@@ -58,7 +58,7 @@ index 00000000..0b2a5574
|
||||
+ sw $a3, %lo(nAssertStopProgram)($at)
|
||||
+ beqz $a3, .end_2
|
||||
+ nop
|
||||
+ syscall # trigger crash screen
|
||||
+ syscall // trigger crash screen
|
||||
+.end_2:
|
||||
+ jr $ra
|
||||
+ nop
|
||||
@@ -75,15 +75,15 @@ index 00000000..0b2a5574
|
||||
+ jr $ra
|
||||
+ mfc0 $v0, COP0_BADVADDR
|
||||
+
|
||||
+# If the error code field of cop0's cause register is non-zero,
|
||||
+# draw crash details to the screen and hang
|
||||
+#
|
||||
+# If there wasn't an error, continue to the original handler
|
||||
+// If the error code field of cop0's cause register is non-zero,
|
||||
+// draw crash details to the screen and hang
|
||||
+
|
||||
+// If there wasn't an error, continue to the original handler
|
||||
+
|
||||
+glabel __crash_handler_entry
|
||||
+ mfc0 $k1, COP0_CAUSE
|
||||
+ andi $k1, $k1, (0x1F << 2)
|
||||
+ beqzl $k1, .end2 # exit if ExCode is 0
|
||||
+ beqzl $k1, .end2 // exit if ExCode is 0
|
||||
+ lui $k0, %hi(__osException)
|
||||
+ la $k0, exceptionRegContext
|
||||
+ sd $zero, 0x018 ($k0)
|
||||
@@ -116,7 +116,7 @@ index 00000000..0b2a5574
|
||||
+ sd $sp, 0x0F0 ($k0)
|
||||
+ sd $fp, 0x0F8 ($k0)
|
||||
+ sd $ra, 0x100 ($k0)
|
||||
+ # cop unusable exception fired twice on startup so we'll ignore it for now
|
||||
+ // cop unusable exception fired twice on startup so we'll ignore it for now
|
||||
+ li $t0, (0x0B << 2)
|
||||
+ beq $k1, $t0, .end
|
||||
+ nop
|
||||
@@ -155,14 +155,14 @@ index 00000000..0b2a5574
|
||||
+ lui $k0, %hi(__osException)
|
||||
+ .end2:
|
||||
+ addiu $k0, $k0, %lo(__osException)
|
||||
+ jr $k0 # run the original handler
|
||||
+ jr $k0 // run the original handler
|
||||
+ nop
|
||||
diff --git a/lib/asm/__osExceptionPreamble.s b/lib/asm/__osExceptionPreamble.s
|
||||
index e14928ce..4d12129e 100644
|
||||
index c3b97993..c552a485 100644
|
||||
--- a/lib/asm/__osExceptionPreamble.s
|
||||
+++ b/lib/asm/__osExceptionPreamble.s
|
||||
@@ -18,8 +18,8 @@
|
||||
.endif
|
||||
@@ -11,8 +11,8 @@
|
||||
#endif
|
||||
|
||||
glabel __osExceptionPreamble
|
||||
- lui $k0, %hi(__osException)
|
||||
@@ -173,10 +173,10 @@ index e14928ce..4d12129e 100644
|
||||
nop
|
||||
|
||||
diff --git a/sm64.ld b/sm64.ld
|
||||
index f80f5b4d..569344bc 100755
|
||||
index 7d9b5b4a..c7bb81b9 100755
|
||||
--- a/sm64.ld
|
||||
+++ b/sm64.ld
|
||||
@@ -116,6 +116,7 @@ SECTIONS
|
||||
@@ -117,6 +117,7 @@ SECTIONS
|
||||
BUILD_DIR/src/game/rendering_graph_node.o(.text);
|
||||
BUILD_DIR/src/game/profiler.o(.text);
|
||||
BUILD_DIR/asm/decompress.o(.text);
|
||||
|
||||
@@ -2,10 +2,10 @@ diff --git a/src/game/area.c b/src/game/area.c
|
||||
index af9d0156..c68a7f6e 100644
|
||||
--- a/src/game/area.c
|
||||
+++ b/src/game/area.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "engine/geo_layout.h"
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "save_file.h"
|
||||
#include "level_table.h"
|
||||
#include "dialog_ids.h"
|
||||
+#include "debug_box.h"
|
||||
|
||||
struct SpawnInfo gPlayerSpawnInfos[1];
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
diff --git a/src/game/game_init.c b/src/game/game_init.c
|
||||
index b6334688..62ed106c 100644
|
||||
index b961ca52..531231cf 100644
|
||||
--- a/src/game/game_init.c
|
||||
+++ b/src/game/game_init.c
|
||||
@@ -59,6 +59,47 @@ struct DemoInput *gCurrDemoInput = NULL; // demo input sequence
|
||||
u16 gDemoInputListID = 0;
|
||||
struct DemoInput gRecordedDemoInput = { 0 }; // possibly removed in EU. TODO: Check
|
||||
@@ -82,6 +82,47 @@ struct DemoInput gRecordedDemoInput = { 0 };
|
||||
// Display
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
|
||||
+// SDK states that 1 cycle takes about 21.33 nanoseconds
|
||||
+#define SECONDS_PER_CYCLE 0.00000002133f
|
||||
@@ -48,9 +48,9 @@ index b6334688..62ed106c 100644
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* Initializes the Reality Display Processor (RDP).
|
||||
* This function initializes settings such as texture filtering mode,
|
||||
@@ -633,5 +674,7 @@ void thread5_game_loop(UNUSED void *arg) {
|
||||
* Sets the initial RDP (Reality Display Processor) rendering settings.
|
||||
*/
|
||||
@@ -694,5 +735,7 @@ void thread5_game_loop(UNUSED void *arg) {
|
||||
// amount of free space remaining.
|
||||
print_text_fmt_int(180, 20, "BUF %d", gGfxPoolEnd - (u8 *) gDisplayListHead);
|
||||
}
|
||||
|
||||
@@ -13,16 +13,16 @@ index 00000000..e60550ab
|
||||
+extern enum ConsoleType get_console_type(void);
|
||||
diff --git a/lib/asm/skGetId.s b/lib/asm/skGetId.s
|
||||
new file mode 100644
|
||||
index 00000000..8fb4c449
|
||||
index 00000000..58e7d4f9
|
||||
--- /dev/null
|
||||
+++ b/lib/asm/skGetId.s
|
||||
@@ -0,0 +1,18 @@
|
||||
+# Code by stuckpixel
|
||||
+// Code by stuckpixel
|
||||
+
|
||||
+.set noreorder
|
||||
+.set gp=64
|
||||
+
|
||||
+.include "macros.inc"
|
||||
+#include "macros.inc"
|
||||
+
|
||||
+glabel skGetId
|
||||
+ li $v0, 0
|
||||
@@ -36,10 +36,10 @@ index 00000000..8fb4c449
|
||||
+ nop
|
||||
+ nop
|
||||
diff --git a/lib/src/__osViSwapContext.c b/lib/src/__osViSwapContext.c
|
||||
index b9d364b1..fa149b5d 100644
|
||||
index 990cb11f..22756e91 100644
|
||||
--- a/lib/src/__osViSwapContext.c
|
||||
+++ b/lib/src/__osViSwapContext.c
|
||||
@@ -52,7 +52,9 @@ void __osViSwapContext() {
|
||||
@@ -54,7 +54,9 @@ void __osViSwapContext() {
|
||||
HW_REG(VI_INTR_REG, u32) = s0->fldRegs[field].vIntr;
|
||||
HW_REG(VI_X_SCALE_REG, u32) = s1->unk20;
|
||||
HW_REG(VI_Y_SCALE_REG, u32) = s1->unk2c;
|
||||
@@ -269,7 +269,7 @@ index 1a86477b..a94f8721 100644
|
||||
return sp34;
|
||||
}
|
||||
diff --git a/lib/src/osInitialize.c b/lib/src/osInitialize.c
|
||||
index ea247636..4adb45cb 100644
|
||||
index ba73024b..6deaf407 100644
|
||||
--- a/lib/src/osInitialize.c
|
||||
+++ b/lib/src/osInitialize.c
|
||||
@@ -1,6 +1,7 @@
|
||||
@@ -280,7 +280,7 @@ index ea247636..4adb45cb 100644
|
||||
|
||||
#define PIF_ADDR_START (void *) 0x1FC007FC
|
||||
|
||||
@@ -54,6 +55,7 @@ void osInitialize(void) {
|
||||
@@ -51,6 +52,7 @@ void osInitialize(void) {
|
||||
UNUSED u32 eu_sp30;
|
||||
#endif
|
||||
UNUSED u32 sp2c;
|
||||
@@ -289,24 +289,24 @@ index ea247636..4adb45cb 100644
|
||||
__osSetSR(__osGetSR() | 0x20000000);
|
||||
__osSetFpcCsr(0x01000800);
|
||||
diff --git a/sm64.ld b/sm64.ld
|
||||
index f80f5b4d..e53d4e40 100755
|
||||
index 7d9b5b4a..be853a3b 100755
|
||||
--- a/sm64.ld
|
||||
+++ b/sm64.ld
|
||||
@@ -300,6 +300,8 @@ SECTIONS
|
||||
#ifdef VERSION_SH
|
||||
BUILD_DIR/libultra.a:unk_shindou_file_3.o(.text)
|
||||
@@ -306,6 +306,8 @@ SECTIONS
|
||||
#if ENABLE_RUMBLE
|
||||
BUILD_DIR/libultra.a:unk_shindou_file_3.o(.text);
|
||||
#endif
|
||||
+ BUILD_DIR/libultra.a:consoleType.o(.text)
|
||||
+ BUILD_DIR/libultra.a:skGetId.o(.text)
|
||||
BUILD_DIR/lib/rsp.o(.text);
|
||||
#else
|
||||
BUILD_DIR/src/game*.o(.text);
|
||||
@@ -410,6 +412,8 @@ SECTIONS
|
||||
BUILD_DIR/libultra.a:__osGetCause.o(.text);
|
||||
BUILD_DIR/libultra.a:__osAtomicDec.o(.text);
|
||||
BUILD_DIR/libultra.a:guLookAtRef.o(.text); /* Fast3DEX2 only */
|
||||
+ BUILD_DIR/libultra.a:consoleType.o(.text);
|
||||
+ BUILD_DIR/libultra.a:skGetId.o(.text);
|
||||
@@ -428,6 +430,8 @@ SECTIONS
|
||||
#if ENABLE_RUMBLE
|
||||
BUILD_DIR/libultra.a:unk_shindou_file_3.o(.text);
|
||||
#endif
|
||||
+ BUILD_DIR/libultra.a:consoleType.o(.text)
|
||||
+ BUILD_DIR/libultra.a:skGetId.o(.text)
|
||||
BUILD_DIR/lib/rsp.o(.text);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
diff --git a/Makefile b/Makefile
|
||||
index f81fd27b..318140f2 100644
|
||||
index f50b7622..124c7ec6 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -419,6 +419,7 @@ $(BUILD_DIR)/include/text_strings.h: $(BUILD_DIR)/include/text_menu_strings.h
|
||||
@@ -478,6 +478,7 @@ $(BUILD_DIR)/include/text_strings.h: $(BUILD_DIR)/include/text_menu_strings.h
|
||||
$(BUILD_DIR)/src/menu/file_select.o: $(BUILD_DIR)/include/text_strings.h
|
||||
$(BUILD_DIR)/src/menu/star_select.o: $(BUILD_DIR)/include/text_strings.h
|
||||
$(BUILD_DIR)/src/game/ingame_menu.o: $(BUILD_DIR)/include/text_strings.h
|
||||
@@ -11,12 +11,12 @@ index f81fd27b..318140f2 100644
|
||||
|
||||
#==============================================================================#
|
||||
diff --git a/include/segments.h b/include/segments.h
|
||||
index a8c1bf97..84c3d7a4 100644
|
||||
index a97d6ee8..186c968e 100644
|
||||
--- a/include/segments.h
|
||||
+++ b/include/segments.h
|
||||
@@ -1,6 +1,9 @@
|
||||
#ifndef SEGMENTS_H
|
||||
#define SEGMENTS_H
|
||||
@@ -3,6 +3,9 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
+/* Use expansion pack RAM */
|
||||
+#define USE_EXT_RAM 1
|
||||
@@ -58,7 +58,7 @@ index 17c773ed..677a5ae9 100644
|
||||
+ JUMP(/*target*/ level_script_entry_error_screen),
|
||||
+};
|
||||
diff --git a/levels/intro/geo.c b/levels/intro/geo.c
|
||||
index 7a297fe7..71b16442 100644
|
||||
index 30a87806..6bf7b79a 100644
|
||||
--- a/levels/intro/geo.c
|
||||
+++ b/levels/intro/geo.c
|
||||
@@ -15,6 +15,24 @@
|
||||
@@ -100,7 +100,7 @@ index 99277e86..04797cd7 100644
|
||||
+
|
||||
#endif
|
||||
diff --git a/levels/intro/script.c b/levels/intro/script.c
|
||||
index a130cc04..926c0d09 100644
|
||||
index 04b8fc4c..ca9058c4 100644
|
||||
--- a/levels/intro/script.c
|
||||
+++ b/levels/intro/script.c
|
||||
@@ -18,6 +18,21 @@
|
||||
@@ -138,7 +138,7 @@ index d41a91c8..7d047236 100644
|
||||
struct LevelCommand *level_script_execute(struct LevelCommand *cmd);
|
||||
|
||||
diff --git a/src/game/main.c b/src/game/main.c
|
||||
index 9615f25a..e2d7b3d4 100644
|
||||
index 1a9d9e7e..f4f7a9e5 100644
|
||||
--- a/src/game/main.c
|
||||
+++ b/src/game/main.c
|
||||
@@ -11,6 +11,7 @@
|
||||
@@ -149,7 +149,7 @@ index 9615f25a..e2d7b3d4 100644
|
||||
|
||||
// Message IDs
|
||||
#define MESG_SP_COMPLETE 100
|
||||
@@ -127,6 +128,10 @@ void alloc_pool(void) {
|
||||
@@ -131,6 +132,10 @@ void alloc_pool(void) {
|
||||
void *start = (void *) SEG_POOL_START;
|
||||
void *end = (void *) SEG_POOL_END;
|
||||
|
||||
@@ -160,7 +160,7 @@ index 9615f25a..e2d7b3d4 100644
|
||||
main_pool_init(start, end);
|
||||
gEffectsMemoryPool = mem_pool_init(0x4000, MEMORY_POOL_LEFT);
|
||||
}
|
||||
@@ -332,7 +337,10 @@ void thread3_main(UNUSED void *arg) {
|
||||
@@ -336,7 +341,10 @@ void thread3_main(UNUSED void *arg) {
|
||||
create_thread(&gSoundThread, 4, thread4_sound, NULL, gThread4Stack + 0x2000, 20);
|
||||
osStartThread(&gSoundThread);
|
||||
|
||||
@@ -174,7 +174,7 @@ index 9615f25a..e2d7b3d4 100644
|
||||
while (TRUE) {
|
||||
diff --git a/src/game/mem_error_screen.c b/src/game/mem_error_screen.c
|
||||
new file mode 100644
|
||||
index 00000000..81efaf91
|
||||
index 00000000..f432927c
|
||||
--- /dev/null
|
||||
+++ b/src/game/mem_error_screen.c
|
||||
@@ -0,0 +1,104 @@
|
||||
@@ -274,15 +274,14 @@ index 00000000..81efaf91
|
||||
+
|
||||
+ addr = segmented_to_virtual(level_script_entry_error_screen);
|
||||
+
|
||||
+ rendering_init();
|
||||
+ render_init();
|
||||
+
|
||||
+ while (1) {
|
||||
+ config_gfx_pool();
|
||||
+ select_gfx_pool();
|
||||
+ addr = level_script_execute(addr);
|
||||
+ display_and_vsync();
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/game/mem_error_screen.h b/src/game/mem_error_screen.h
|
||||
new file mode 100644
|
||||
index 00000000..9fbff34c
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/src/game/game_init.c b/src/game/game_init.c
|
||||
index b6334688..9363074b 100644
|
||||
index b961ca52..adfde049 100644
|
||||
--- a/src/game/game_init.c
|
||||
+++ b/src/game/game_init.c
|
||||
@@ -11,6 +11,7 @@
|
||||
@@ -10,9 +10,9 @@ index b6334688..9363074b 100644
|
||||
#include "profiler.h"
|
||||
#include "save_file.h"
|
||||
#include "seq_ids.h"
|
||||
@@ -335,6 +336,45 @@ void display_and_vsync(void) {
|
||||
gGlobalTimer++;
|
||||
}
|
||||
@@ -386,6 +387,45 @@ void display_and_vsync(void) {
|
||||
// Controls
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
|
||||
+/*
|
||||
+ * This enhancement allows you to record gameplay demos for the mario head screen.
|
||||
@@ -24,7 +24,7 @@ index b6334688..9363074b 100644
|
||||
+ *
|
||||
+*/
|
||||
+
|
||||
+#include "../src/game/mario.h"
|
||||
+#include "mario.h"
|
||||
+
|
||||
+#define DEMOREC_STATUS_NOT_RECORDING 0
|
||||
+#define DEMOREC_STATUS_PREPARING 1
|
||||
@@ -53,15 +53,15 @@ index b6334688..9363074b 100644
|
||||
+struct DemoInput* gRecordedInputsPtr = (struct DemoInput*)gRecordedInputs;
|
||||
+struct DemoInput gRecordedDemoInputCopy;
|
||||
+
|
||||
// this function records distinct inputs over a 255-frame interval to RAM locations and was likely
|
||||
// used to record the demo sequences seen in the final game. This function is unused.
|
||||
static void record_demo(void) {
|
||||
@@ -368,6 +408,118 @@ static void record_demo(void) {
|
||||
/**
|
||||
* This function records distinct inputs over a 255-frame interval to RAM locations and was likely
|
||||
* used to record the demo sequences seen in the final game. This function is unused.
|
||||
@@ -420,6 +460,118 @@ UNUSED static void record_demo(void) {
|
||||
gRecordedDemoInput.timer++;
|
||||
}
|
||||
|
||||
+void record_new_demo_input(void) {
|
||||
+ if(gRecordedDemoInput.timer == 1 && gRecordedDemoInputCopy.timer > 0) {
|
||||
+ if (gRecordedDemoInput.timer == 1 && gRecordedDemoInputCopy.timer > 0) {
|
||||
+ gRecordedInputs[gNumOfRecordedInputs].timer = gRecordedDemoInputCopy.timer;
|
||||
+ gRecordedInputs[gNumOfRecordedInputs + 1].timer = 0;
|
||||
+ gRecordedInputs[gNumOfRecordedInputs].rawStickX = gRecordedDemoInputCopy.rawStickX;
|
||||
@@ -86,13 +86,13 @@ index b6334688..9363074b 100644
|
||||
+void recording(void) {
|
||||
+
|
||||
+ // Force-stop when someone makes too many inputs.
|
||||
+ if(gNumOfRecordedInputs + 1 > DEMOREC_MAX_INPUTS) {
|
||||
+ if (gNumOfRecordedInputs + 1 > DEMOREC_MAX_INPUTS) {
|
||||
+ gRecordingStatus = DEMOREC_STATUS_STOPPING;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ copy_gRecordedDemoInput();
|
||||
+ record_demo(); // Defined in game.c
|
||||
+ record_demo();
|
||||
+ record_new_demo_input();
|
||||
+}
|
||||
+
|
||||
@@ -112,10 +112,10 @@ index b6334688..9363074b 100644
|
||||
+ case DEMOREC_STATUS_NOT_RECORDING:
|
||||
+ break;
|
||||
+ case DEMOREC_STATUS_PREPARING:
|
||||
+ if(gMarioObject != NULL && gCurrLevelNum >= 5) { // If the game is in an active level
|
||||
+ if (gMarioObject != NULL && gCurrLevelNum != LEVEL_NONE) { // If the game is in an active level
|
||||
+ gRecordingStatus = DEMOREC_STATUS_RECORDING;
|
||||
+
|
||||
+ // A bit of a hack, but it works.
|
||||
+ // First 4 values in demo inputs are used to define level ID
|
||||
+ gNumOfRecordedInputs = 1;
|
||||
+ gRecordedInputs[0].timer = gCurrLevelNum;
|
||||
+ gRecordedInputs[0].rawStickX = 0;
|
||||
@@ -127,7 +127,7 @@ index b6334688..9363074b 100644
|
||||
+ recording();
|
||||
+ break;
|
||||
+ case DEMOREC_STATUS_DONE:
|
||||
+ if(gDoneDelay > DEMOREC_DONE_DELAY)
|
||||
+ if (gDoneDelay > DEMOREC_DONE_DELAY)
|
||||
+ gRecordingStatus = DEMOREC_STATUS_NOT_RECORDING;
|
||||
+ else
|
||||
+ gDoneDelay++;
|
||||
@@ -159,8 +159,8 @@ index b6334688..9363074b 100644
|
||||
+ // so the debug level select is used for that.
|
||||
+ gDebugLevelSelect = TRUE;
|
||||
+
|
||||
+ if(gPlayer1Controller->buttonPressed & L_TRIG) {
|
||||
+ if(gRecordingStatus == DEMOREC_STATUS_NOT_RECORDING) {
|
||||
+ if (gPlayer1Controller->buttonPressed & L_TRIG) {
|
||||
+ if (gRecordingStatus == DEMOREC_STATUS_NOT_RECORDING) {
|
||||
+ gRecordingStatus = DEMOREC_STATUS_PREPARING;
|
||||
+ } else if (gRecordingStatus == DEMOREC_STATUS_RECORDING) {
|
||||
+ gRecordingStatus = DEMOREC_STATUS_STOPPING;
|
||||
@@ -172,12 +172,12 @@ index b6334688..9363074b 100644
|
||||
+ print_status();
|
||||
+}
|
||||
+
|
||||
// take the updated controller struct and calculate
|
||||
// the new x, y, and distance floats.
|
||||
void adjust_analog_stick(struct Controller *controller) {
|
||||
@@ -623,6 +775,7 @@ void thread5_game_loop(UNUSED void *arg) {
|
||||
/**
|
||||
* Take the updated controller struct and calculate the new x, y, and distance floats.
|
||||
*/
|
||||
@@ -684,6 +836,7 @@ void thread5_game_loop(UNUSED void *arg) {
|
||||
audio_game_loop_tick();
|
||||
config_gfx_pool();
|
||||
select_gfx_pool();
|
||||
read_controller_inputs();
|
||||
+ recordingDemo();
|
||||
addr = level_script_execute(addr);
|
||||
|
||||
Reference in New Issue
Block a user