Remove PUBLIC_RELEASE flag and tie asserts to debug config (#287)

Removes the -DPUBLIC_RELEASE flag. Cemu's debug asserts are now only enabled if the build configuration is Debug. Similarly, on Windows the console is only shown for Debug builds.
This commit is contained in:
Exzap 2022-09-24 08:43:27 +02:00 committed by GitHub
parent b720d17a97
commit 3bceb39966
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
68 changed files with 154 additions and 186 deletions

View file

@ -119,7 +119,7 @@ void coreinitExport_OSPanic(PPCInterpreter_t* hCPU)
debug_printf("File: %s:%d\n", memory_getPointerFromVirtualOffset(hCPU->gpr[3]), hCPU->gpr[4]);
debug_printf("Msg: %s\n", memory_getPointerFromVirtualOffset(hCPU->gpr[5]));
DebugLogStackTrace(coreinit::OSGetCurrentThread(), coreinit::OSGetStackPointer());
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
assert_dbg();
while (true) std::this_thread::sleep_for(std::chrono::milliseconds(100));
#endif
@ -203,7 +203,7 @@ typedef struct
void coreinitExport_OSDriver_Register(PPCInterpreter_t* hCPU)
{
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
forceLog_printf("OSDriver_Register(0x%08x,0x%08x,0x%08x,0x%08x,0x%08x,0x%08x)", hCPU->gpr[3], hCPU->gpr[4], hCPU->gpr[5], hCPU->gpr[6], hCPU->gpr[7], hCPU->gpr[8]);
#endif
OSDriverCallbacks_t* driverCallbacks = (OSDriverCallbacks_t*)memory_getPointerFromVirtualOffset(hCPU->gpr[5]);

View file

@ -70,7 +70,7 @@ namespace coreinit
return;
// debug begin
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
uint64 prevTick = 0;
auto itr = g_activeAlarmList.begin();
while (itr != g_activeAlarmList.end())

View file

@ -349,7 +349,7 @@ namespace coreinit
}
if (entryFound == false)
{
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
assert_dbg();
#endif
}

View file

@ -99,7 +99,7 @@ namespace coreinit
if (deallocAddr < lcAddr[coreIndex] || deallocAddr >= (lcAddr[coreIndex] + LC_LOCKED_CACHE_SIZE))
{
// out of bounds
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
forceLog_printf("LCDealloc(): Out of bounds");
#endif
osLib_returnFromFunction(hCPU, 0);
@ -198,7 +198,7 @@ namespace coreinit
assert_dbg();
#endif
LCIsEnabled[PPCInterpreter_getCoreIndex(hCPU)]--;
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
if (LCIsEnabled[PPCInterpreter_getCoreIndex(hCPU)] == 0)
{
uint32 coreIndex = PPCInterpreter_getCoreIndex(hCPU);

View file

@ -462,7 +462,7 @@ namespace coreinit
if (block != NULL)
{
MPTR blockMPTR = memory_getVirtualOffsetFromPointer(block);
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
if (block->isFree != 0)
assert_dbg();
_blockHeapDebugVerifyLinkOrder(blockHeapHead);

View file

@ -938,7 +938,7 @@ void export_MEMSetGroupIDForExpHeap(PPCInterpreter_t* hCPU)
ppcDefineParamMEMPTR(heap, MEMHeapBase, 0);
ppcDefineParamU16(groupId, 1);
coreinitMemLog_printf("MEMSetGroupIDForExpHeap(0x%08x, %d)", heap.GetMPTR(), groupId);
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
assert_dbg(); // someone test this and the entire groupId feature
#endif
uint16 oldGroupId = MEMSetGroupIDForExpHeap(heap.GetPtr(), groupId);

View file

@ -149,7 +149,7 @@ namespace coreinit
void _debugCheckChain(OSThread_t* thread, OSThreadLink* threadLink)
{
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
cemu_assert_debug(tail.IsNull() == head.IsNull());
size_t linkOffset = getLinkOffset(thread, threadLink);
// expects thread to be in the chain

View file

@ -20,7 +20,7 @@ void gx2Export_GX2InitColorBufferRegs(PPCInterpreter_t* hCPU)
LatteAddrLib::GX2CalculateSurfaceInfo(colorBuffer->surface.format, colorBuffer->surface.width, colorBuffer->surface.height, colorBuffer->surface.depth, colorBuffer->surface.dim, colorBuffer->surface.tileMode, colorBuffer->surface.aa, _swapEndianU32(colorBuffer->viewMip), &surfaceInfo);
uint32 pitchHeight = (surfaceInfo.height * surfaceInfo.pitch) >> 6;
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
if (colorBuffer->viewNumSlices != _swapEndianU32(1))
forceLogDebug_printf("GX2InitColorBufferRegs(): With unsupported slice count %d", _swapEndianU32(colorBuffer->viewNumSlices));
if (surfaceInfo.pitch < 7)
@ -139,7 +139,7 @@ void gx2Export_GX2SetColorBuffer(PPCInterpreter_t* hCPU)
GX2ColorBuffer* colorBufferBE = (GX2ColorBuffer*)memory_getPointerFromVirtualOffset(hCPU->gpr[3]);
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
gx2Log_printf("ColorBuffer tileMode %01x PhysAddr %08x fmt %04x res %dx%d Mip %d Slice %d", (uint32)colorBufferBE->surface.tileMode.value(), (uint32)colorBufferBE->surface.imagePtr, (uint32)colorBufferBE->surface.format.value(), (uint32)colorBufferBE->surface.width, (uint32)colorBufferBE->surface.height, _swapEndianU32(colorBufferBE->viewMip), _swapEndianU32(colorBufferBE->viewFirstSlice));
#endif

View file

@ -397,7 +397,7 @@ void gx2Export_GX2CopySurfaceEx(PPCInterpreter_t* hCPU)
forceLogDebug_printf("rect left-top: %d/%d size: %d/%d", _swapEndianU32(rectSrc->left), _swapEndianU32(rectSrc->top), _swapEndianU32(rectSrc->right) - _swapEndianU32(rectSrc->left), _swapEndianU32(rectSrc->bottom) - _swapEndianU32(rectSrc->top));
}
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
if( rectCount != 1 )
assert_dbg();
if( srcMip != 0 )
@ -440,7 +440,7 @@ void gx2Export_GX2ResolveAAColorBuffer(PPCInterpreter_t* hCPU)
uint32 srcSlice = _swapEndianU32(srcColorBuffer->viewFirstSlice);
uint32 dstSlice = hCPU->gpr[6];
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
if( _swapEndianU32(srcColorBuffer->viewMip) != 0 || _swapEndianU32(srcColorBuffer->viewFirstSlice) != 0 )
assert_dbg();
#endif

View file

@ -839,7 +839,7 @@ size_t header_callback(char* buffer, size_t size, size_t nitems, void* userdata)
if (msg.order != QueueOrder_CBDone)
cemu_assert_suspicious();
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
char debug[500];
cemu_assert_debug((size*nitems) < 500);
memcpy(debug, buffer, size*nitems);

View file

@ -592,7 +592,7 @@ namespace nn
ppcDefineParamMPTR(funcMPTR, 1);
ppcDefineParamMPTR(customParam, 2);
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
assert_dbg();
#endif
fpdPrepareRequest();

View file

@ -537,7 +537,7 @@ namespace nsyshid
_debugPrintHex("HIDSetReport", data, dataLength);
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
if (reportRelatedUkn != 2 || reportId != 0)
assert_dbg();
#endif

View file

@ -116,7 +116,7 @@ sint32 _translateError(sint32 returnCode, sint32 wsaError, sint32 mode = _ERROR_
break;
case WSAECONNABORTED:
debug_printf("WSAECONNABORTED\n");
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
assert_dbg();
#endif
break;
@ -652,7 +652,7 @@ void nsysnetExport_inet_pton(PPCInterpreter_t* hCPU)
invalidIp = true;
if (d3 < 0 || d3 > 255)
invalidIp = true;
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
if (invalidIp)
assert_dbg();
#endif
@ -1245,7 +1245,7 @@ void nsysnetExport_gethostbyaddr(PPCInterpreter_t* hCPU)
return;
}
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
if (he->h_addrtype != AF_INET)
assert_dbg();
if (he->h_length != sizeof(in_addr))

View file

@ -692,7 +692,7 @@ namespace snd_core
{
if (internalShadowCopy->biquad.on == AX_BIQUAD_OFF)
return;
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
if (internalShadowCopy->biquad.on != 0x0200)
{
forceLogDebug_printf("AX_ApplyBiquad() with incorrect biquad.on value 0x%04x", _swapEndianU16(internalShadowCopy->biquad.on));

View file

@ -702,7 +702,7 @@ namespace snd_core
{
AXVPBInternal_t* internal = __AXVPBInternalVoiceArray + (sint32)vpb->index;
ratio *= 65536.0f;
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
if (ratio >= 4294967296.0f)
assert_dbg();
#endif

View file

@ -309,13 +309,13 @@ void cbDeserializeArg_MiiMaker(deserializedArg_t* deserializedArg, void* customP
}
else if (strcmp(deserializedArg->argument, "slot_id") == 0)
{
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
assert_dbg();
#endif
}
else
{
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
assert_dbg();
#endif
}