Skip to content

Commit

Permalink
db_assert.cpp OK
Browse files Browse the repository at this point in the history
I hate mwcc weak ordering bs
  • Loading branch information
CelestialAmber committed Sep 16, 2024
1 parent 7d4df62 commit b22a815
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 51 deletions.
5 changes: 4 additions & 1 deletion config/eu/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2099,7 +2099,10 @@ libs/nw4r/db/db_DbgPrintBase.temp.cpp:
.text start:0x803D9958 end:0x803D997C

libs/nw4r/db/db_assert.temp.cpp:
.text start:0x803D997C end:0x803D9B74
.text start:0x803D997C end:0x803D9B30

libs/nw4r/dw/dw_Window.temp.cpp:
.text start:0x803D9B30 end:0x803D9B74

libs/nw4r/g3d/res/g3d_rescommon.temp.cpp:
.text start:0x803D9B74 end:0x803D9CC4
Expand Down
5 changes: 4 additions & 1 deletion config/jp/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5110,12 +5110,15 @@ libs/nw4r/db/db_DbgPrintBase.cpp:
.text start:0x803D7318 end:0x803D733C

libs/nw4r/db/db_assert.cpp:
.text start:0x803D733C end:0x803D7810
.text start:0x803D733C end:0x803D77CC
.data start:0x8056C7B0 end:0x8056C840
.bss start:0x8061D710 end:0x8061D740
.sdata start:0x80665D80 end:0x80665D88
.sbss start:0x80667D18 end:0x80667D28

libs/nw4r/dw/dw_Window.cpp:
.text start:0x803D77CC end:0x803D7810

libs/nw4r/g3d/res/g3d_rescommon.cpp:
.text start:0x803D7810 end:0x803D7960

Expand Down
49 changes: 26 additions & 23 deletions config/jp/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41192,20 +41192,23 @@ jumptable_8056C728 = .data:0x8056C728; // type:object size:0x1C scope:global ali
jumptable_8056C744 = .data:0x8056C744; // type:object size:0x24 scope:global align:4
jumptable_8056C768 = .data:0x8056C768; // type:object size:0x1C scope:global align:4
jumptable_8056C784 = .data:0x8056C784; // type:object size:0x28 scope:global align:4
lbl_8056C7B0 = .data:0x8056C7B0; // type:object size:0x60 scope:global align:8
lbl_8056C810 = .data:0x8056C810; // type:object size:0x10 scope:global align:8
lbl_8056C820 = .data:0x8056C820; // type:object size:0x20 scope:global align:8
ResNameData_Models__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C840; // type:object size:0x20 scope:global align:4
ResNameData_Pltts__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C860; // type:object size:0x20 scope:global align:4
ResNameData_Textures__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C880; // type:object size:0x20 scope:global align:4
ResNameData_AnmChr__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C8A0; // type:object size:0x20 scope:global align:4
ResNameData_AnmVis__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C8C0; // type:object size:0x20 scope:global align:4
ResNameData_AnmClr__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C8E0; // type:object size:0x20 scope:global align:4
ResNameData_AnmTexPat__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C900; // type:object size:0x20 scope:global align:4
ResNameData_AnmTexSrt__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C920; // type:object size:0x20 scope:global align:4
ResNameData_AnmShp__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C940; // type:object size:0x20 scope:global align:4
ResNameData_AnmScn__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C960; // type:object size:0x20 scope:global align:4
ResNameData_Ext__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C980; // type:object size:0x20 scope:global align:4
...data.0 = .data:0x8056C7B0; // type:label scope:local
@2426 = .data:0x8056C7B0; // type:object size:0x28 scope:local align:4 data:string
@2427 = .data:0x8056C7D8; // type:object size:0x20 scope:local align:4 data:string
@2428 = .data:0x8056C7F8; // type:object size:0x15 scope:local align:4 data:string
@2453 = .data:0x8056C810; // type:object size:0xD scope:local align:4 data:string
@2485 = .data:0x8056C820; // type:object size:0xF scope:local align:4 data:string
ResNameData_Models__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C840; // type:object size:0x20 scope:global align:32
ResNameData_Pltts__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C860; // type:object size:0x20 scope:global align:32
ResNameData_Textures__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C880; // type:object size:0x20 scope:global align:32
ResNameData_AnmChr__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C8A0; // type:object size:0x20 scope:global align:32
ResNameData_AnmVis__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C8C0; // type:object size:0x20 scope:global align:32
ResNameData_AnmClr__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C8E0; // type:object size:0x20 scope:global align:32
ResNameData_AnmTexPat__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C900; // type:object size:0x20 scope:global align:32
ResNameData_AnmTexSrt__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C920; // type:object size:0x20 scope:global align:32
ResNameData_AnmShp__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C940; // type:object size:0x20 scope:global align:32
ResNameData_AnmScn__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C960; // type:object size:0x20 scope:global align:32
ResNameData_Ext__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056C980; // type:object size:0x20 scope:global align:32
lbl_8056C9A0 = .data:0x8056C9A0; // type:object size:0x20 scope:global align:4
ResNameData_LightSet__Q34nw4r3g3d27@unnamed@g3d_resanmscn_cpp@ = .data:0x8056C9C0; // type:object size:0x20 scope:global align:4
ResNameData_AmbLights__Q34nw4r3g3d27@unnamed@g3d_resanmscn_cpp@ = .data:0x8056C9E0; // type:object size:0x20 scope:global align:4
Expand Down Expand Up @@ -42480,7 +42483,7 @@ sfxa_work = .bss:0x8061D370; // type:object size:0x128 scope:global align:4 data
sfxz_work = .bss:0x8061D498; // type:object size:0x26C scope:global align:4 data:4byte
sud_init_cnt = .bss:0x8061D708; // type:object size:0x4 scope:global align:8 data:4byte
sud_dummy = .bss:0x8061D70C; // type:object size:0x4 scope:global align:4 data:4byte
sWarningAlarm = .bss:0x8061D710; // type:object size:0x30 scope:global align:4
sWarningAlarm$2312 = .bss:0x8061D710; // type:object size:0x30 scope:global align:4
sGenMode2__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x8061D740; // type:object size:0xC scope:global align:4 data:byte
sTexCoordScale__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x8061D74C; // type:object size:0x74 scope:global align:4 data:4byte
sTex__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x8061D7C0; // type:object size:0x120 scope:global align:4 data:4byte
Expand Down Expand Up @@ -43477,8 +43480,8 @@ lowDone = .sdata:0x806659A0; // type:object size:0x4 scope:global align:4 data:4
DiFD = .sdata:0x806659A8; // type:object size:0x4 scope:global align:4 data:4byte
@1724 = .sdata:0x806659B0; // type:object size:0x8 scope:local align:8 data:string
__ENCVersion = .sdata:0x806659B8; // type:object size:0x4 scope:global align:8 data:4byte
enc_tbl_jp_loaded = .sdata:0x806659C0; // type:object size:0x8 scope:global align:8 data:4byte
__esFd = .sdata:0x806659C8; // type:object size:0x4 scope:global align:4 data:4byte
enc_tbl_jp_loaded = .sdata:0x806659C0; // type:object size:0x4 scope:global align:8 data:4byte
__esFd = .sdata:0x806659C8; // type:object size:0x4 scope:global align:8 data:4byte
@747 = .sdata:0x806659D0; // type:object size:0x8 scope:local align:8 data:string
__EXIVersion = .sdata:0x806659D8; // type:object size:0x4 scope:global align:4 data:4byte
__fsFd = .sdata:0x806659E0; // type:object size:0x4 scope:global align:8 data:4byte
Expand Down Expand Up @@ -43638,8 +43641,8 @@ lbl_80665D5C = .sdata:0x80665D5C; // type:object size:0xC scope:global align:4
lbl_80665D68 = .sdata:0x80665D68; // type:object size:0x8 scope:global align:8
lbl_80665D70 = .sdata:0x80665D70; // type:object size:0x8 scope:global align:8
lbl_80665D78 = .sdata:0x80665D78; // type:object size:0x8 scope:global align:8
sDispWarningAuto__Q24nw4r2db = .sdata:0x80665D80; // type:object size:0x4 scope:global align:4 data:byte
lbl_80665D84 = .sdata:0x80665D84; // type:object size:0x4 scope:global align:4
sDispWarningAuto__Q24nw4r2db = .sdata:0x80665D80; // type:object size:0x1 scope:local align:4 data:byte
@2429 = .sdata:0x80665D84; // type:object size:0x2 scope:local align:4 data:string
lbl_80665D88 = .sdata:0x80665D88; // type:object size:0x8 scope:global align:8
smBaseUpdateRate__Q34nw4r3g3d9FrameCtrl = .sdata:0x80665D90; // type:object size:0x4 scope:global align:8 data:float
lbl_80665D98 = .sdata:0x80665D98; // type:object size:0x4 scope:global align:8 data:4byte
Expand Down Expand Up @@ -45115,10 +45118,10 @@ _scFlush = .sbss:0x80667D14; // type:object size:0x1 scope:global align:1 data:b
_wudTarget = .sbss:0x80667D15; // type:object size:0x1 scope:global align:1 data:byte
_wudDiscRssi = .sbss:0x80667D16; // type:object size:0x1 scope:global align:1 data:byte
_wudDiscNumResps = .sbss:0x80667D17; // type:object size:0x1 scope:global align:1 data:byte
sWarningTime__Q24nw4r2db = .sbss:0x80667D18; // type:object size:0x4 scope:global align:4 data:4byte
sAssertionConsole__Q24nw4r2db = .sbss:0x80667D1C; // type:object size:0x4 scope:global align:4 data:4byte
sInitializedAlarm = .sbss:0x80667D20; // type:object size:0x8 scope:global align:8 data:byte
sSyncGX__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .sbss:0x80667D28; // type:object size:0x4 scope:global align:4 data:byte
sWarningTime__Q24nw4r2db = .sbss:0x80667D18; // type:object size:0x4 scope:local align:4 data:4byte
sAssertionConsole__Q24nw4r2db = .sbss:0x80667D1C; // type:object size:0x4 scope:local align:4 data:4byte
sInitializedAlarm$2313 = .sbss:0x80667D20; // type:object size:0x1 scope:local align:4 data:byte
sSyncGX__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .sbss:0x80667D28; // type:object size:0x4 scope:global align:8 data:byte
sCurrMtx__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .sbss:0x80667D2C; // type:object size:0x4 scope:global align:4 data:byte
sPostTexMtx__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .sbss:0x80667D30; // type:object size:0x4 scope:global align:4 data:4byte
sTev__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .sbss:0x80667D34; // type:object size:0x4 scope:global align:4 data:4byte
Expand Down
10 changes: 8 additions & 2 deletions config/us/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2093,10 +2093,16 @@ libs/CriWare/sofdec/sud/sud_lib.temp.c:
.text start:0x803D96F0 end:0x803D9884

libs/nw4r/db/db_console.temp.cpp:
.text start:0x803D9884 end:0x803D997C
.text start:0x803D9884 end:0x803D9958

libs/nw4r/db/db_DbgPrintBase.temp.cpp:
.text start:0x803D9958 end:0x803D997C

libs/nw4r/db/db_assert.temp.cpp:
.text start:0x803D997C end:0x803D9B74
.text start:0x803D997C end:0x803D9B30

libs/nw4r/dw/dw_Window.temp.cpp:
.text start:0x803D9B30 end:0x803D9B74

libs/nw4r/g3d/res/g3d_rescommon.temp.cpp:
.text start:0x803D9B74 end:0x803D9CC4
Expand Down
8 changes: 7 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1392,9 +1392,15 @@ def nw4rLib(lib_name, objects, extra_cflags=[]):
[
Object(Matching, "db/db_console.cpp"),
Object(Matching, "db/db_DbgPrintBase.cpp"),
Object(NonMatching, "db/db_assert.cpp"),
Object(Matching, "db/db_assert.cpp", extra_cflags=["-ipa file"]),
],
),
nw4rLib(
"libnw4r_dw",
[
Object(Matching, "dw/dw_Window.cpp"), #Stupid
]
),
nw4rLib(
"libnw4r_g3d",
[
Expand Down
18 changes: 9 additions & 9 deletions libs/nw4r/include/nw4r/db/db_console.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,24 @@ namespace nw4r
void Console_VisitString(detail::ConsoleHead* console, VisitStringCallback visitor);
long Console_GetTotalLines(detail::ConsoleHead* console);

long Console_SetViewBaseLine(detail::ConsoleHead* console, long line);
u16 Console_GetViewHeight(detail::ConsoleHead* console);
static long Console_SetViewBaseLine(detail::ConsoleHead* console, long line);
static u16 Console_GetViewHeight(detail::ConsoleHead* console);

//Stubbed in final
void Console_VPrintf(detail::ConsoleHead* console, const char* format, __va_list_struct* vlist)
static void Console_VPrintf(detail::ConsoleHead* console, const char* format, __va_list_struct* vlist)
{
}

u8 Console_SetVisible(detail::ConsoleHead* console, bool isVisible)
static bool Console_SetVisible(detail::ConsoleHead* console, bool isVisible)
{
u8 before = console->isVisible;
bool before = console->isVisible;
console->isVisible = isVisible;
return before;
}

long Console_ShowLatestLine(detail::ConsoleHead* console)
static long Console_ShowLatestLine(detail::ConsoleHead* console)
{
long baseLine = Console_GetTotalLines(console) - Console_GetViewHeight(console);
long baseLine = Console_GetTotalLines(console) - Console_GetViewHeight(console);

if(baseLine < 0){
baseLine = 0;
Expand All @@ -86,14 +86,14 @@ namespace nw4r
return baseLine;
}

long Console_SetViewBaseLine(detail::ConsoleHead* console, long line)
static long Console_SetViewBaseLine(detail::ConsoleHead* console, long line)
{
long before = console->viewTopLine;
console->viewTopLine = line;
return before;
}

u16 Console_GetViewHeight(detail::ConsoleHead* console)
static u16 Console_GetViewHeight(detail::ConsoleHead* console)
{
return console->viewLines;
}
Expand Down
5 changes: 4 additions & 1 deletion libs/nw4r/src/db/db_DbgPrintBase.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#include "db_DbgPrintBase.h"

//Unused file. Only here to force the function CharWriter::SetTextColor(ut::Color&)
//into the right place.

namespace nw4r
{
namespace db
{
//Dummy function to force SetTextColor to be generated here
//Dummy function
void dummy(ut::CharWriter* pCharWriter){
ut::Color color;
pCharWriter->SetTextColor(color);
Expand Down
28 changes: 15 additions & 13 deletions libs/nw4r/src/db/db_assert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,27 @@ namespace nw4r

void VPanic(const char* file, int line, const char* fmt, __va_list_struct* vlist, bool halt)
{
u32 stackPointer;
register u32 stackPointer;

//Get the stack pointer
//This feels fake but I can't think of how else it would've been done
asm{
lwz stackPointer, 0(r1)
}

OSDisableInterrupts();
OSDisableScheduler();
VISetPreRetraceCallback(nullptr);
VISetPostRetraceCallback(nullptr);

/*
if(sAssertionConsole != nullptr){
DirectPrint_SetupFB(0);
}
*/

ShowStack_(stackPointer);

if(sAssertionConsole == nullptr){
if(sAssertionConsole != nullptr){
Console_Printf(sAssertionConsole, "%s:%d Panic:", file, line);
Console_VPrintf(sAssertionConsole, fmt, vlist);
Console_VPrintf(sAssertionConsole, fmt, vlist); //Does nothing in final
Console_Printf(sAssertionConsole, "\n");
Console_ShowLatestLine(sAssertionConsole);
Console_SetVisible(sAssertionConsole, true);
//Console_DrawDirect(sAssertionConsole);
}else{
OSReport("%s:%d Panic:", file, line);
OSVReport(fmt, vlist);
Expand All @@ -94,17 +93,17 @@ namespace nw4r
va_list vlist;
va_start(vlist, fmt);
VPanic(file, line, fmt, vlist, true);
PPCHalt();
PPCHalt(); //PPCHalt is called in VPanic, so this never gets called.
}

void VWarning(const char* file, int line, const char* fmt, __va_list_struct* vlist)
{
if(sAssertionConsole != nullptr){
Console_Printf(sAssertionConsole, "%s:%d Warning:", file, line);
Console_VPrintf(sAssertionConsole, fmt, vlist); //does nothing in final
Console_VPrintf(sAssertionConsole, fmt, vlist); //Does nothing in final
Console_Printf(sAssertionConsole, "\n");
Console_ShowLatestLine(sAssertionConsole);
if(!sDispWarningAuto){
if(sDispWarningAuto){
Assertion_ShowConsole(sWarningTime);
}
}else{
Expand All @@ -122,18 +121,21 @@ namespace nw4r
VWarning(file, line, fmt, vlist);
}

//unused
void Log(const char* fmt)
{
va_list vlist;
}

//unused
ConsoleHead* Assertion_SetConsole(ConsoleHead* console)
{
ConsoleHead* before = sAssertionConsole;
sAssertionConsole = console;
return before;
}

//unused
ConsoleHead* Assertion_GetConsole()
{
return sAssertionConsole;
Expand Down
18 changes: 18 additions & 0 deletions libs/nw4r/src/dw/dw_Window.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "types_nw4r.h"
#include "ut_CharWriter.h"

//Unused file. Only here to force the function CharWriter::SetTextColor(ut::Color&, ut::Color&)
//into the right place.

namespace nw4r
{
namespace dw
{
//Dummy function
void dummy(ut::CharWriter* charWriter)
{
ut::Color color;
charWriter->SetTextColor(color, color);
}
}
}

0 comments on commit b22a815

Please sign in to comment.