add NDEBUG define for wbx cores (release only), fixes #3594

This commit is contained in:
CasualPokePlayer 2023-03-28 17:23:06 -07:00
parent 0a2d4405f0
commit 1643bf01bc
20 changed files with 23 additions and 10 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -36,7 +36,7 @@ COMMONFLAGS := -fvisibility=hidden -I$(WATERBOX_DIR)/emulibc -Wall -mcmodel=larg
CCFLAGS := $(COMMONFLAGS) $(CCFLAGS)
LDFLAGS := $(LDFLAGS) -static -no-pie -Wl,--eh-frame-hdr,-O2 -T $(LINKSCRIPT) #-Wl,--plugin,$(LD_PLUGIN)
CCFLAGS_DEBUG := -O0 -g
CCFLAGS_RELEASE := -O3 -flto
CCFLAGS_RELEASE := -O3 -flto -DNDEBUG
CCFLAGS_RELEASE_ASONLY := -O3
LDFLAGS_DEBUG :=
LDFLAGS_RELEASE :=

View File

@ -89,9 +89,13 @@ void CDHLEInit(void)
{
jaguarCdInserted = true;
cd_toc_callback(&toc);
assert(toc.num_sessions >= 2); // need at least 2 sessions
int32_t bootTrackNum = 0;
for (uint32_t i = 0; i < 127; i++)
if (toc.num_sessions < 2)
{
fprintf(stderr, "%s\n", "need at least 2 sessions!!!");
return;
}
uint32_t bootTrackNum = 0;
for (uint32_t i = 1; i < 127; i++)
{
if (toc.tracks[i].session_num == 1)
{
@ -99,7 +103,11 @@ void CDHLEInit(void)
break;
}
}
assert(bootTrackNum != 0);
if (bootTrackNum == 0)
{
fprintf(stderr, "%s\n", "could not find boot track!!!");
return;
}
Track& bootTrack = toc.tracks[bootTrackNum];
int32_t startLba = bootTrack.start_mins * 4500 + bootTrack.start_secs * 75 + bootTrack.start_frames - 150;
fprintf(stderr, "timecode: %02d:%02d:%02d, startLba %04X\n", bootTrack.start_mins, bootTrack.start_secs, bootTrack.start_frames, startLba);
@ -109,12 +117,13 @@ void CDHLEInit(void)
for (int32_t i = 0; i < numLbas; i++)
{
cd_read_callback(startLba + i, buf2352);
static const char* atariHeader = "ATARI APPROVED DATA HEADER ATRI ";
static const char* byteSwappedHeader = "TARA IPARPVODED TA AEHDAREA RT I"; // some dumps are byteswapped, detect these and fix them
// the ? here represents a wildcard, these are suppose to be ' ' for the first data track, but it appears the CD bios doesn't actually check it?
static const char* atariHeader = "ATARI APPROVED DATA HEADER ATRI?";
static const char* byteSwappedHeader = "TARA IPARPVODED TA AEHDAREA RT?I"; // some dumps are byteswapped, detect these and fix them
for (uint32_t j = 0; j < (2352 - 32 - 4 - 4); j++)
{
if (!memcmp(&buf2352[j], atariHeader, 32))
if (!memcmp(&buf2352[j], atariHeader, 32 - 1))
{
fprintf(stderr, "startLba + i %04X\n", startLba + i);
cd_boot_addr = GET32(buf2352, j + 32);
@ -127,7 +136,7 @@ void CDHLEInit(void)
break;
}
if (!memcmp(&buf2352[j], byteSwappedHeader, 32))
if (!memcmp(&buf2352[j], byteSwappedHeader, 32 - 2))
{
fprintf(stderr, "(byteswapped) startLba + i %04X\n", startLba + i);
cd_boot_addr = *(uint16_t*)&buf2352[j + 32] << 16 | *(uint16_t*)&buf2352[j + 32 + 2];
@ -143,7 +152,11 @@ void CDHLEInit(void)
if (foundHeader) break;
}
assert(foundHeader);
if (!foundHeader)
{
fprintf(stderr, "%s\n", "could not find boot track header!!!");
return;
}
}
CDHLEReset();