mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
use is_debug.c on jp (#507)
This commit is contained in:
parent
3ae962f064
commit
8a380bf6ea
3
.vscode/c_cpp_properties.json
vendored
3
.vscode/c_cpp_properties.json
vendored
@ -21,7 +21,8 @@
|
|||||||
"_LANGUAGE_C",
|
"_LANGUAGE_C",
|
||||||
"_MIPS_SZLONG=32",
|
"_MIPS_SZLONG=32",
|
||||||
"SCRIPT(...)={}",
|
"SCRIPT(...)={}",
|
||||||
"VERSION=us"
|
"VERSION=us",
|
||||||
|
"VERSION_US"
|
||||||
],
|
],
|
||||||
"cStandard": "c89",
|
"cStandard": "c89",
|
||||||
"cppStandard": "c++17"
|
"cppStandard": "c++17"
|
||||||
|
@ -87,15 +87,20 @@ u32 is_debug_print(void* arg0, const unsigned char* str, u32 count) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef VERSION_US
|
||||||
// Nop issue with the rodata string
|
// Nop issue with the rodata string
|
||||||
#ifdef NON_MATCHING
|
#ifdef NON_MATCHING
|
||||||
void func_80025F44(const char* message, char* file, s32 line) {
|
void func_80025F44(const char* message, char* file, s32 line) {
|
||||||
osSyncPrintf("File:%s Line:%d %s \n", file, line, message);
|
osSyncPrintf("File:%s Line:%d %s \n", file, line, message);
|
||||||
|
PANIC();
|
||||||
while (TRUE) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
INCLUDE_ASM(void, "is_debug", func_80025F44, char* arg0, char* file, s32 line);
|
INCLUDE_ASM(void, "is_debug", func_80025F44, char* arg0, char* file, s32 line);
|
||||||
|
#endif
|
||||||
|
#elif VERSION_JP
|
||||||
|
extern const char D_80097D10[]; // "File:%s Line:%d %s \n\0\0\0"
|
||||||
|
void func_80025F44(char* arg0, char* file, s32 line, char* arg3) {
|
||||||
|
osSyncPrintf(D_80097D10, file, line, arg0);
|
||||||
|
PANIC();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,87 +0,0 @@
|
|||||||
#include "common.h"
|
|
||||||
#include "stdlib/stdarg.h"
|
|
||||||
#include "nu/nusys.h"
|
|
||||||
|
|
||||||
// TODO: use src/is_debug.c instead as this file is identical between versions
|
|
||||||
|
|
||||||
u32 func_80025D74(void* arg0, const unsigned char* str, u32 count);
|
|
||||||
|
|
||||||
void func_80025C60(void) {
|
|
||||||
OSPiHandle** handle = &nuPiCartHandle;
|
|
||||||
|
|
||||||
osEPiWriteIo(*handle, 0xB3FF0014, 0);
|
|
||||||
osEPiWriteIo(*handle, 0xB3FF0004, 0);
|
|
||||||
osEPiWriteIo(*handle, 0xB3FF0000, ASCII_TO_U32('I', 'S', '6', '4'));
|
|
||||||
}
|
|
||||||
|
|
||||||
void func_80025CC0(const char* fmt, ...) {
|
|
||||||
va_list args;
|
|
||||||
va_start(args, fmt);
|
|
||||||
|
|
||||||
_Printf(&func_80025D74, NULL, fmt, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void func_80025CFC(const char* fmt, ...) {
|
|
||||||
va_list args;
|
|
||||||
va_start(args, fmt);
|
|
||||||
|
|
||||||
_Printf(&func_80025D74, NULL, fmt, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void func_80025D38(const char* fmt, ...) {
|
|
||||||
va_list args;
|
|
||||||
va_start(args, fmt);
|
|
||||||
|
|
||||||
_Printf(&func_80025D74, NULL, fmt, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 func_80025D74(void* arg0, const unsigned char* str, u32 count) {
|
|
||||||
u32 data;
|
|
||||||
s32 pos;
|
|
||||||
s32 start;
|
|
||||||
s32 end;
|
|
||||||
|
|
||||||
osEPiReadIo(nuPiCartHandle, 0xB3FF0000, &data);
|
|
||||||
if (data != ASCII_TO_U32('I', 'S', '6', '4')) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
osEPiReadIo(nuPiCartHandle, 0xB3FF0004, &data);
|
|
||||||
pos = data;
|
|
||||||
osEPiReadIo(nuPiCartHandle, 0xB3FF0014, &data);
|
|
||||||
start = data;
|
|
||||||
end = start + count;
|
|
||||||
if (end >= 0xffe0) {
|
|
||||||
end -= 0xffe0;
|
|
||||||
if (pos < end || start < pos) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (start < pos && pos < end) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (count) {
|
|
||||||
if (*str) {
|
|
||||||
u32 addr = 0xB3FF0020 + (start & 0xffffffc);
|
|
||||||
s32 shift = ((3 - (start & 3)) * 8);
|
|
||||||
|
|
||||||
osEPiReadIo(nuPiCartHandle, addr, &data);
|
|
||||||
osEPiWriteIo(nuPiCartHandle, addr, (data & ~(0xff << shift)) | (*str << shift));
|
|
||||||
|
|
||||||
start++;
|
|
||||||
if (start >= 0xffe0) {
|
|
||||||
start -= 0xffe0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
count--;
|
|
||||||
str++;
|
|
||||||
}
|
|
||||||
osEPiWriteIo(nuPiCartHandle, 0xB3FF0014, start);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern const char D_80097D10[]; // "File:%s Line:%d %s \n\0\0\0"
|
|
||||||
void func_80025F44(char* arg0, char* file, s32 line, char* arg3) {
|
|
||||||
func_80025CFC(D_80097D10, file, line, arg0);
|
|
||||||
PANIC();
|
|
||||||
}
|
|
@ -103,31 +103,31 @@ def write_ninja_rules(ninja: ninja_syntax.Writer, cpp: str, cppflags: str, extra
|
|||||||
|
|
||||||
ninja.rule("cc",
|
ninja.rule("cc",
|
||||||
description="gcc $in",
|
description="gcc $in",
|
||||||
command=f"bash -o pipefail -c '{cpp} {CPPFLAGS} {cppflags} -MD -MF $out.d $in -o - | {iconv} > $out.i && {ccache}{cc} {cflags} $cflags $out.i -o $out'",
|
command=f"bash -o pipefail -c '{cpp} {CPPFLAGS} {cppflags} $cppflags -MD -MF $out.d $in -o - | {iconv} > $out.i && {ccache}{cc} {cflags} $cflags $out.i -o $out'",
|
||||||
depfile="$out.d",
|
depfile="$out.d",
|
||||||
deps="gcc",
|
deps="gcc",
|
||||||
)
|
)
|
||||||
|
|
||||||
ninja.rule("cc_dsl",
|
ninja.rule("cc_dsl",
|
||||||
description="dsl $in",
|
description="dsl $in",
|
||||||
command=f"bash -o pipefail -c '{cpp} {CPPFLAGS} {cppflags} -MD -MF $out.d $in -o - | {compile_script} | {iconv} > $out.i && {cc} {cflags} $cflags $out.i -o $out'",
|
command=f"bash -o pipefail -c '{cpp} {CPPFLAGS} {cppflags} $cppflags -MD -MF $out.d $in -o - | {compile_script} | {iconv} > $out.i && {cc} {cflags} $cflags $out.i -o $out'",
|
||||||
depfile="$out.d",
|
depfile="$out.d",
|
||||||
deps="gcc",
|
deps="gcc",
|
||||||
)
|
)
|
||||||
|
|
||||||
ninja.rule("cc_ido",
|
ninja.rule("cc_ido",
|
||||||
description="ido $in",
|
description="ido $in",
|
||||||
command=f"{ccache}{cc_ido} -w {CPPFLAGS_COMMON} {cppflags} -c -mips1 -O0 -G0 -non_shared -Xfullwarn -Xcpluscomm -o $out $in",
|
command=f"{ccache}{cc_ido} -w {CPPFLAGS_COMMON} {cppflags} $cppflags -c -mips1 -O0 -G0 -non_shared -Xfullwarn -Xcpluscomm -o $out $in",
|
||||||
)
|
)
|
||||||
|
|
||||||
ninja.rule("cc_kmc",
|
ninja.rule("cc_kmc",
|
||||||
description="kmc $in",
|
description="kmc $in",
|
||||||
command=f"bash -o pipefail -c 'N64ALIGN=ON VR4300MUL=ON {cc_kmc} {CPPFLAGS_LIBULTRA} {cppflags} {kmc_cflags} $cflags $in -o $out && mips-linux-gnu-objcopy -N $in $out'",
|
command=f"bash -o pipefail -c 'N64ALIGN=ON VR4300MUL=ON {cc_kmc} {CPPFLAGS_LIBULTRA} {cppflags} $cppflags {kmc_cflags} $cflags $in -o $out && mips-linux-gnu-objcopy -N $in $out'",
|
||||||
)
|
)
|
||||||
|
|
||||||
ninja.rule("cxx",
|
ninja.rule("cxx",
|
||||||
description="cxx $in",
|
description="cxx $in",
|
||||||
command=f"bash -o pipefail -c '{cpp} {CPPFLAGS} {cppflags} -MD -MF $out.d $in -o - | {iconv} > $out.i && {ccache}{cxx} {cflags} $cflags $out.i -o $out'",
|
command=f"bash -o pipefail -c '{cpp} {CPPFLAGS} {cppflags} $cppflags -MD -MF $out.d $in -o - | {iconv} > $out.i && {ccache}{cxx} {cflags} $cflags $out.i -o $out'",
|
||||||
depfile="$out.d",
|
depfile="$out.d",
|
||||||
deps="gcc",
|
deps="gcc",
|
||||||
)
|
)
|
||||||
@ -398,7 +398,10 @@ class Configure:
|
|||||||
|
|
||||||
cflags = cflags.replace("kmc", "")
|
cflags = cflags.replace("kmc", "")
|
||||||
|
|
||||||
build(entry.object_path, entry.src_paths, task, variables={"cflags": cflags})
|
build(entry.object_path, entry.src_paths, task, variables={
|
||||||
|
"cflags": cflags,
|
||||||
|
"cppflags": f"-DVERSION_{self.version.upper()}",
|
||||||
|
})
|
||||||
|
|
||||||
# images embedded inside data aren't linked, but they do need to be built into .inc.c files
|
# images embedded inside data aren't linked, but they do need to be built into .inc.c files
|
||||||
if isinstance(seg, segtypes.common.group.CommonSegGroup):
|
if isinstance(seg, segtypes.common.group.CommonSegGroup):
|
||||||
|
@ -24,7 +24,7 @@ glabel func_80025F70
|
|||||||
/* 13B8 80025FB8 080097EE */ j .L80025FB8
|
/* 13B8 80025FB8 080097EE */ j .L80025FB8
|
||||||
/* 13BC 80025FBC 00000000 */ nop
|
/* 13BC 80025FBC 00000000 */ nop
|
||||||
.L80025FC0:
|
.L80025FC0:
|
||||||
/* 13C0 80025FC0 0C009718 */ jal func_80025C60
|
/* 13C0 80025FC0 0C009718 */ jal is_debug_init
|
||||||
/* 13C4 80025FC4 00000000 */ nop
|
/* 13C4 80025FC4 00000000 */ nop
|
||||||
/* 13C8 80025FC8 0C017C84 */ jal func_8005F210
|
/* 13C8 80025FC8 0C017C84 */ jal func_8005F210
|
||||||
/* 13CC 80025FCC 00000000 */ nop
|
/* 13CC 80025FCC 00000000 */ nop
|
||||||
|
@ -33,7 +33,7 @@ segments:
|
|||||||
subalign: 8
|
subalign: 8
|
||||||
subsegments:
|
subsegments:
|
||||||
- [0x1000, hasm, entry_point]
|
- [0x1000, hasm, entry_point]
|
||||||
- [0x1060, c, jp/1060] # 1060 (identical)
|
- [0x1060, c, is_debug]
|
||||||
- [0x1370, c, jp/1370] # 1370
|
- [0x1370, c, jp/1370] # 1370
|
||||||
- [0x1B10, c, jp/1B10] # 1B40
|
- [0x1B10, c, jp/1B10] # 1B40
|
||||||
- [0x2570, c, jp/2570]
|
- [0x2570, c, jp/2570]
|
||||||
|
Loading…
Reference in New Issue
Block a user