Add IS-Viewer faking
This commit is contained in:
1 parent
5048caff1e
commit
ca05f4a5fd
9 files changed
+81
-12
No files matched your search
@@ -63,6 +63,10 @@
|
||||
#define FLOAT_CAST(x) (f32) (s32) (x)
|
||||
#endif
|
||||
|
||||
#if defined(ISVPRINT) || defined(UNF)
|
||||
#define stubbed_printf osSyncPrintf
|
||||
#else
|
||||
|
||||
// No-op printf macro which leaves string literals in rodata in IDO. IDO
|
||||
// doesn't support variadic macros, so instead we let the parameter list
|
||||
// expand to a no-op comma expression. Another possibility is that it might
|
||||
@@ -73,6 +77,7 @@
|
||||
#else
|
||||
#define stubbed_printf(...)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_EU
|
||||
#define eu_stubbed_printf_0(msg) stubbed_printf(msg)
|
||||
|
||||
+25
-8
@@ -319,13 +319,11 @@ void thread3_main(UNUSED void *arg) {
|
||||
crash_screen_init();
|
||||
#endif
|
||||
|
||||
#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
|
||||
osSyncPrintf("Super Mario 64\n");
|
||||
osSyncPrintf("Built by: %s\n", __username__);
|
||||
osSyncPrintf("Date : %s\n", __datetime__);
|
||||
osSyncPrintf("Compiler: %s\n", __compiler__);
|
||||
osSyncPrintf("Linker : %s\n", __linker__);
|
||||
|
||||
create_thread(&gSoundThread, 4, thread4_sound, NULL, gThread4Stack + 0x2000, 20);
|
||||
osStartThread(&gSoundThread);
|
||||
@@ -477,14 +475,33 @@ void thread1_idle(UNUSED void *arg) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ClearRAM(void)
|
||||
void ClearRAM(void)
|
||||
{
|
||||
bzero(_mainSegmentEnd, (size_t)osMemSize - (size_t)OS_K0_TO_PHYSICAL(_mainSegmentEnd));
|
||||
}
|
||||
|
||||
#ifdef ISVPRINT
|
||||
extern u32 gISVDbgPrnAdrs;
|
||||
extern u32 gISVFlag;
|
||||
|
||||
void osInitialize_fakeisv() {
|
||||
/* global flag to skip `__checkHardware_isv` from being called. */
|
||||
gISVFlag = 0x49533634; // 'IS64'
|
||||
|
||||
/* printf writes go to this address, cen64(1) has this hardcoded. */
|
||||
gISVDbgPrnAdrs = 0x13FF0000;
|
||||
|
||||
/* `__printfunc`, used by `osSyncPrintf` will be set. */
|
||||
__osInitialize_isv();
|
||||
}
|
||||
#endif
|
||||
|
||||
void main_func(void) {
|
||||
ClearRAM();
|
||||
__osInitialize_common();
|
||||
#ifdef ISVPRINT
|
||||
osInitialize_fakeisv();
|
||||
#endif
|
||||
|
||||
create_thread(&gIdleThread, 1, thread1_idle, NULL, gIdleThreadStack + 0x800, 100);
|
||||
osStartThread(&gIdleThread);
|
||||
|
||||
@@ -346,6 +346,7 @@ void *load_segment_decompress(s32 segment, u8 *srcStart, u8 *srcEnd) {
|
||||
dma_read(compressed, srcStart, srcEnd);
|
||||
dest = main_pool_alloc(*size, MEMORY_POOL_LEFT);
|
||||
if (dest != NULL) {
|
||||
osSyncPrintf("start decompress\n");
|
||||
#ifdef GZIP
|
||||
expand_gzip(compressed, dest, compSize, (u32)size);
|
||||
#elif RNC1
|
||||
@@ -357,6 +358,7 @@ void *load_segment_decompress(s32 segment, u8 *srcStart, u8 *srcEnd) {
|
||||
#elif MIO0
|
||||
decompress(compressed, dest);
|
||||
#endif
|
||||
osSyncPrintf("end decompress\n");
|
||||
set_segment_base_addr(segment, dest);
|
||||
main_pool_free(compressed);
|
||||
} else {
|
||||
|
||||
@@ -869,6 +869,11 @@ f64 stub_renderer_1(UNUSED f64 x) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
#if defined(ISVPRINT) || defined(UNF)
|
||||
#define stubbed_printf osSyncPrintf
|
||||
#else
|
||||
|
||||
/* 249BCC -> 24A19C */
|
||||
void gd_printf(const char *format, ...) {
|
||||
s32 i;
|
||||
@@ -967,6 +972,7 @@ void gd_printf(const char *format, ...) {
|
||||
fatal_printf("printf too long");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 24A19C -> 24A1D4 */
|
||||
void gd_exit(UNUSED s32 code) {
|
||||
|
||||
@@ -43,7 +43,12 @@ f32 get_time_scale(void);
|
||||
f64 gd_sin_d(f64 x);
|
||||
f64 gd_cos_d(f64 x);
|
||||
f64 gd_sqrt_d(f64 x);
|
||||
|
||||
#if defined(ISVPRINT) || defined(UNF)
|
||||
#define gd_printf osSyncPrintf
|
||||
#else
|
||||
void gd_printf(const char *format, ...);
|
||||
#endif
|
||||
void gd_exit(UNUSED s32 code) NORETURN;
|
||||
void gd_free(void *ptr);
|
||||
void *gd_allocblock(u32 size);
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
#define DEBUG_MODE 1 // Enable/Disable debug mode
|
||||
#define DEBUG_INIT_MSG 1 // Print a message when debug mode has initialized
|
||||
#define USE_FAULTTHREAD 1 // Create a fault detection thread (libultra only)
|
||||
#define OVERWRITE_OSPRINT 0 // Replaces osSyncPrintf calls with debug_printf (libultra only)
|
||||
#define OVERWRITE_OSPRINT 1 // Replaces osSyncPrintf calls with debug_printf (libultra only)
|
||||
#define MAX_COMMANDS 25 // The max amount of user defined commands possible
|
||||
|
||||
// Fault thread definitions (libultra only)
|
||||
|
||||
Reference in new issue
Block a user