Various debug conditional compilation cleanup (#2915)

* Global: Define DEBUG as 0 if not already defined

* Clean up DEBUG-guarded code
This commit is contained in:
Max Roncace
2025-12-06 16:34:47 -05:00
committed by GitHub
parent 9f1a648851
commit a30e617e5a
316 changed files with 1133 additions and 1267 deletions
+4 -4
View File
@@ -145,7 +145,7 @@ void JASDriver::updateDSP() {
JASProbe::start(3, "SFR-UPDATE");
JASDsp::invalChannelAll();
#ifdef DEBUG
#if DEBUG
JASDsp::dspMutex = 1;
#endif
@@ -160,7 +160,7 @@ void JASDriver::updateDSP() {
JUT_ASSERT(254, subFrame <= 10);
history[subFrame - r26] = r27;
if (subFrame != r26 && f32(history[0]) / r27 < 1.1f) {
#ifdef DEBUG
#if DEBUG
static int killCounter;
JASReport("kill DSP channel", killCounter);
JASDSPChannel::killActiveChannel();
@@ -173,7 +173,7 @@ void JASDriver::updateDSP() {
JASChannel::receiveBankDisposeMsg();
JASDSPChannel::updateAll();
#ifdef DEBUG
#if DEBUG
JASDsp::dspMutex = 0;
#endif
@@ -198,7 +198,7 @@ void JASDriver::readDspBuffer(s16* param_0, u32 param_1) {
for (int i = param_1; i < param_1 * 2; i++) {
sDspDacBuffer[sDspDacReadBuffer][i] = (s16)r24;
}
#ifdef DEBUG
#if DEBUG
JASReport("readDspBuffer nbuf:%d sWBuf:%d BCount:%d stat:%d", nbuf, sDspDacWriteBuffer,
data_804507A8, sDspStatus);
#endif
+1 -1
View File
@@ -659,6 +659,6 @@ u16 DSP_CreateMap2(u32 param_0) {
u32 JASWaveInfo::one = 1;
#ifdef DEBUG
#if DEBUG
s32 dspMutex = 1;
#endif
+2 -6
View File
@@ -27,9 +27,7 @@ bool JASHeap::alloc(JASHeap* mother, u32 param_1) {
JUT_ASSERT(120, mother != NULL);
JASMutexLock lock(&mMutex);
if (isAllocated()) {
#ifdef DEBUG
OSReport("[JASHeap::alloc] すでにヒープは確保されています。初期化してからにしてください。\n");
#endif
OS_REPORT("[JASHeap::alloc] すでにヒープは確保されています。初期化してからにしてください。\n");
return 0;
}
if (!mother->isAllocated()) {
@@ -71,9 +69,7 @@ bool JASHeap::alloc(JASHeap* mother, u32 param_1) {
}
}
if (!local_43) {
#ifdef DEBUG
OSReport("[JASHeap::alloc] マザーメモリが足りないので確保できません。\n");
#endif
OS_REPORT("[JASHeap::alloc] マザーメモリが足りないので確保できません。\n");
return 0;
}
mother->insertChild(this, local_30, local_34, param_1, false);
+1 -3
View File
@@ -143,9 +143,7 @@ cleanup:
JKRFreeToSysHeap(mem);
}
if (mMountMode == 0) {
#ifdef DEBUG
OSReport(":::[%s: %d] Cannot alloc memory\n", __FILE__, 415);
#endif
OS_REPORT(":::[%s: %d] Cannot alloc memory\n", __FILE__, 415);
if (mDvdFile != NULL) {
delete mDvdFile;
}
+2 -4
View File
@@ -206,10 +206,8 @@ bool JKRCompArchive::open(s32 entryNum) {
{
JKRFreeToSysHeap(arcHeader);
}
if(mMountMode == 0) {
#ifdef DEBUG
OSReport(":::[%s: %d] Cannot alloc memory in mounting CompArchive\n", __FILE__, 567);
#endif
if (mMountMode == 0) {
OS_REPORT(":::[%s: %d] Cannot alloc memory in mounting CompArchive\n", __FILE__, 567);
if(mDvdFile != NULL) {
delete mDvdFile;
}
+1 -3
View File
@@ -127,9 +127,7 @@ cleanup:
}
if (mMountMode == UNKNOWN_MOUNT_MODE) {
#ifdef DEBUG
OSReport(":::Cannot alloc memory [%s][%d]\n", __FILE__, 397);
#endif
OS_REPORT(":::Cannot alloc memory [%s][%d]\n", __FILE__, 397);
if (mDvdFile) {
delete mDvdFile;
}
+2 -4
View File
@@ -12,7 +12,7 @@
bool data_804508B0 = 1;
#ifdef DEBUG
#if DEBUG
u8 data_804508B1;
u8 data_804508B2;
u8 data_804508B3;
@@ -355,10 +355,8 @@ void JKRHeap::copyMemory(void* dst, void* src, u32 size) {
}
void JKRDefaultMemoryErrorRoutine(void* heap, u32 size, int alignment) {
#ifdef DEBUG
OSReport("Error: Cannot allocate memory %d(0x%x)byte in %d byte alignment from %08x\n", size,
OS_REPORT("Error: Cannot allocate memory %d(0x%x)byte in %d byte alignment from %08x\n", size,
size, alignment, heap);
#endif
JUTException::panic(__FILE__, 831, "abort\n");
}
+1 -1
View File
@@ -94,7 +94,7 @@ bool JKRMemArchive::open(s32 entryNum, JKRArchive::EMountDirection mountDirectio
mIsOpen = true;
}
#ifdef DEBUG
#if DEBUG
if (mMountMode == 0) {
OSReport(":::Cannot alloc memory [%s][%d]\n", __FILE__, 460);
}
+2 -2
View File
@@ -73,7 +73,7 @@ s32 JKRSolidHeap::adjustSize(void) {
}
void* JKRSolidHeap::do_alloc(u32 size, int alignment) {
#ifdef DEBUG
#if DEBUG
// TODO(Julgodis): JUTAssertion::setConfirmMessage
/* if (alignment != 0) {
int u = abs(alignment);
@@ -179,7 +179,7 @@ void JKRSolidHeap::do_freeTail(void) {
}
void JKRSolidHeap::do_fillFreeArea() {
#ifdef DEBUG
#if DEBUG
// fillMemory(mSolidHead, mEnd - mSolidHead, (uint)DAT_8074a8ba);
#endif
}
+5 -9
View File
@@ -185,10 +185,10 @@ void JKRThreadSwitch::callback(OSThread* current, OSThread* next) {
next_heap = JKRHeap::getCurrentHeap();
} else if (JKRHeap::getRootHeap()->isSubHeap(next_heap)) {
continue;
#ifdef DEBUG
#if PLATFORM_WII || PLATFORM_SHIELD
} else if (!JKRHeap::getRootHeap2()->isSubHeap(next_heap)) {
continue;
#endif
#endif
} else {
switch (thread->getCurrentHeapError()) {
case 0:
@@ -224,10 +224,8 @@ void JKRThreadSwitch::draw(JKRThreadName_* thread_name_list, JUTConsole* console
const char* print_1 = " -------------------------------------\n";
if (!console) {
#ifdef DEBUG
OSReport(print_0, getTotalCount(), (int)this->field_0x18, this->field_0x10);
OSReport(print_1);
#endif
OS_REPORT(print_0, getTotalCount(), (int)this->field_0x18, this->field_0x10);
OS_REPORT(print_1);
} else {
console->clear();
console->print_f(print_0, getTotalCount(), (int)this->field_0x18, this->field_0x10);
@@ -264,10 +262,8 @@ void JKRThreadSwitch::draw(JKRThreadName_* thread_name_list, JUTConsole* console
u32 cost_int = (u32)(cost_per_0x18 * 100.0f);
u32 cost_float = (u32)(cost_per_0x18 * 1000.0f) % 10;
if (!console) {
#ifdef DEBUG
OSReport(" [%10s] switch:%5d cost:%2d.%d%%\n", thread_print_name, switch_count,
OS_REPORT(" [%10s] switch:%5d cost:%2d.%d%%\n", thread_print_name, switch_count,
cost_int, cost_float);
#endif
} else {
console->print_f(" [%10s] switch:%5d cost:%2d.%d%%\n", thread_print_name,
switch_count, cost_int, cost_float);
+1 -1
View File
@@ -243,7 +243,7 @@ bool JMessage::TParse::parseBlock_next(const void** ppData_inout, u32* puData_ou
}
}
} else {
#ifdef DEBUG
#if DEBUG
JMessage::TResource* pResource = rcResource.Get_groupID(u16GroupID);
if (pResource != pResource_) {
JGADGET_WARNMSG1(444, "group-ID already exist : ", u16GroupID);
@@ -678,7 +678,7 @@ void TFunctionValue_list_parameter::data_set(const f32* pf, u32 u) {
dat1.set(pfData_);
dat2.set(&pfData_[uData_ * 2]);
dat3 = dat1;
#ifdef DEBUG
#if DEBUG
pfnUpdate_ = NULL;
#endif
}
@@ -36,7 +36,7 @@ void JStudio_JStage::TAdaptor_actor::adaptor_do_prepare() {
void JStudio_JStage::TAdaptor_actor::adaptor_do_begin() {
adaptor_object_begin_();
const JStage::TActor* pActor = get_pJSG_();
#ifdef DEBUG
#if DEBUG
{ // This block is needed to match the stack in debug
const JStudio::TObject* pObject = adaptor_getObject();
JUT_ASSERT(72, pObject!=NULL);