mirror of
https://github.com/zeldaret/tww.git
synced 2026-08-22 06:20:02 -04:00
JUTAssert: simplify assert
This commit is contained in:
@@ -4,18 +4,14 @@
|
||||
#include "dolphin/types.h"
|
||||
#include "dolphin/os/OS.h"
|
||||
|
||||
#define JUT_ASSERT(FILE, LINE, COND) \
|
||||
#define JUT_ASSERT(LINE, COND) \
|
||||
if (!(COND)) { \
|
||||
JUTAssertion::showAssert(JUTAssertion::getSDevice(), FILE, LINE, #COND); \
|
||||
OSPanic(FILE, LINE, "Halt"); \
|
||||
JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, #COND); \
|
||||
OSPanic(__FILE__, LINE, "Halt"); \
|
||||
}
|
||||
|
||||
#define JUT_WARN(FILE, LINE, ...) \
|
||||
JUTAssertion::setWarningMessage_f(JUTAssertion::getSDevice(), FILE, LINE, __VA_ARGS__); \
|
||||
|
||||
#define JUT_PANIC(FILE, LINE, TEXT) \
|
||||
JUTAssertion::showAssert(JUTAssertion::getSDevice(), FILE, LINE, TEXT); \
|
||||
OSPanic(FILE, LINE, "Halt");
|
||||
#define JUT_WARN(LINE, ...) \
|
||||
JUTAssertion::setWarningMessage_f(JUTAssertion::getSDevice(), __FILE__, LINE, __VA_ARGS__); \
|
||||
|
||||
namespace JUTAssertion {
|
||||
u32 getSDevice();
|
||||
|
||||
+6
-6
@@ -73,7 +73,7 @@ BOOL DynamicModuleControlBase::link() {
|
||||
mDoLinkCount++;
|
||||
}
|
||||
}
|
||||
JUT_ASSERT(__FILE__, 100, mLinkCount < 65535);
|
||||
JUT_ASSERT(100, mLinkCount < 65535);
|
||||
if (mLinkCount < 65535) {
|
||||
mLinkCount++;
|
||||
}
|
||||
@@ -343,8 +343,8 @@ BOOL DynamicModuleControl::do_link() {
|
||||
do_load();
|
||||
}
|
||||
if (mModule != NULL) {
|
||||
JUT_ASSERT(__FILE__, 613, mModule->info.sectionInfoOffset < 0x80000000);
|
||||
JUT_ASSERT(__FILE__, 615, (u32)mModule + mModule->fixSize < 0x82000000);
|
||||
JUT_ASSERT(613, mModule->info.sectionInfoOffset < 0x80000000);
|
||||
JUT_ASSERT(615, (u32)mModule + mModule->fixSize < 0x82000000);
|
||||
OSGetTime();
|
||||
OSGetTime();
|
||||
if (mModule->mModuleVersion >= 3) {
|
||||
@@ -412,7 +412,7 @@ BOOL DynamicModuleControl::do_link() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
JUT_ASSERT(__FILE__, 724, 0);
|
||||
JUT_ASSERT(724, 0);
|
||||
}
|
||||
OSGetTime();
|
||||
sAllocBytes = sAllocBytes + getModuleSize();
|
||||
@@ -494,7 +494,7 @@ void ModuleUnresolved() {
|
||||
}
|
||||
|
||||
void ModuleConstructorsX(const VoidFunc* _ctors) {
|
||||
JUT_ASSERT(__FILE__, 850, _ctors);
|
||||
JUT_ASSERT(850, _ctors);
|
||||
while (*_ctors != 0) {
|
||||
(**_ctors)();
|
||||
_ctors++;
|
||||
@@ -502,7 +502,7 @@ void ModuleConstructorsX(const VoidFunc* _ctors) {
|
||||
}
|
||||
|
||||
void ModuleDestructorsX(const VoidFunc* _dtors) {
|
||||
JUT_ASSERT(__FILE__, 864, _dtors);
|
||||
JUT_ASSERT(864, _dtors);
|
||||
while (*_dtors != 0) {
|
||||
(**_dtors)();
|
||||
_dtors++;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
/* 802BC610-802BC6B4 .text read__7JKRFileFPvll */
|
||||
s32 JKRFile::read(void* data, s32 length, long offset) {
|
||||
JUT_ASSERT("JKRFile.cpp", 34, ( length & 0x1f ) == 0);
|
||||
JUT_ASSERT(34, ( length & 0x1f ) == 0);
|
||||
while (true) {
|
||||
s32 result = readData(data, length, offset);
|
||||
if (length != result)
|
||||
|
||||
@@ -17,7 +17,7 @@ JPATextureArc::JPATextureArc(const unsigned char * pData) {
|
||||
/* 802586D0-80258BB4 .text initialize__17JPADefaultTextureFP7JKRHeap */
|
||||
void JPADefaultTexture::initialize(JKRHeap* pHeap) {
|
||||
imgBuf = (u8*)JKRHeap::alloc(0x80, 0x20, pHeap);
|
||||
JUT_ASSERT("JPATexture.cpp", 50, imgBuf);
|
||||
JUT_ASSERT(50, imgBuf);
|
||||
imgBuf[0x00] = 0x00;
|
||||
imgBuf[0x01] = 0xff;
|
||||
imgBuf[0x02] = 0x00;
|
||||
|
||||
@@ -28,7 +28,7 @@ void JUTNameTab::setResource(const ResNTAB* pNameTable) {
|
||||
}
|
||||
|
||||
s32 JUTNameTab::getIndex(const char* pName) const {
|
||||
JUT_ASSERT("JUTNameTab.cpp", 101, mNameTable != 0);
|
||||
JUT_ASSERT(101, mNameTable != 0);
|
||||
|
||||
const ResNTAB::Entry* pEntry = mNameTable->mEntries;
|
||||
u16 keyCode = calcKeyCode(pName);
|
||||
@@ -42,7 +42,7 @@ s32 JUTNameTab::getIndex(const char* pName) const {
|
||||
}
|
||||
|
||||
const char* JUTNameTab::getName(u16 index) const {
|
||||
JUT_ASSERT("JUTNameTab.cpp", 138, mNameTable != 0);
|
||||
JUT_ASSERT(138, mNameTable != 0);
|
||||
|
||||
if (index < mNameNum)
|
||||
return mNameTable->getName(index);
|
||||
|
||||
@@ -94,7 +94,7 @@ int fopOvlpM_Cancel() {
|
||||
|
||||
if (fopOvlpReq_Cancel((overlap_request_class*)l_fopOvlpM_overlap[0]) == true) {
|
||||
l_fopOvlpM_overlap[0] = NULL;
|
||||
JUT_WARN("f_op_overlap_mng.cpp", 331, "%s", "fopOvlpM_Cancel SUCCESSED");
|
||||
JUT_WARN(331, "%s", "fopOvlpM_Cancel SUCCESSED");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ u32 fopScnM_ReRequest(s16 param_1, u32 param_2) {
|
||||
|
||||
void fopScnM_Management() {
|
||||
if (!fopScnRq_Handler())
|
||||
JUT_ASSERT("f_op_scene_mng.cpp", 326, 0);
|
||||
JUT_ASSERT(326, 0);
|
||||
}
|
||||
|
||||
void fopScnM_Init() {
|
||||
|
||||
@@ -68,7 +68,7 @@ s32 fpcDt_ToDeleteQ(base_process_class* i_proc) {
|
||||
layer_class* layer = &procNode->mLayer;
|
||||
|
||||
if (!fpcLy_Cancel(layer))
|
||||
JUT_ASSERT("f_pc_deletor.cpp", 196, 0);
|
||||
JUT_ASSERT(196, 0);
|
||||
|
||||
if (fpcLyIt_OnlyHereLY(layer, (fpcLyIt_OnlyHereFunc)fpcDt_ToDeleteQ, NULL) == 0) {
|
||||
return 0;
|
||||
|
||||
@@ -85,10 +85,10 @@ void fpcM_Management(fpcM_ManagementFunc callBack1, fpcM_ManagementFunc callBack
|
||||
cAPIGph_Painter();
|
||||
fpcDt_Handler();
|
||||
if (!fpcPi_Handler())
|
||||
JUT_ASSERT("f_pc_manager.cpp", 548, 0);
|
||||
JUT_ASSERT(548, 0);
|
||||
|
||||
if (!fpcCt_Handler())
|
||||
JUT_ASSERT("f_pc_manager.cpp", 552, 0);
|
||||
JUT_ASSERT(552, 0);
|
||||
|
||||
if (callBack1 != NULL)
|
||||
callBack1();
|
||||
|
||||
Reference in New Issue
Block a user