fix building without NDEBUG on agbcc

This commit is contained in:
sbird 2022-04-16 19:03:20 +02:00
parent 8103caea15
commit 59cff2190d
3 changed files with 49 additions and 8 deletions

View File

@ -20,7 +20,9 @@ SECTIONS {
. = 0x1C000; . = 0x1C000;
INCLUDE "sym_ewram.ld" INCLUDE "sym_ewram.ld"
*libc.a:impure.o(.data);
*libc.a:locale.o(.data);
*libc.a:mallocr.o(.data);
. = 0x40000; . = 0x40000;
} }
@ -462,6 +464,7 @@ SECTIONS {
src/mystery_gift_server.o(.rodata); src/mystery_gift_server.o(.rodata);
src/mystery_gift_client.o(.rodata); src/mystery_gift_client.o(.rodata);
src/mystery_gift_scripts.o(.rodata); src/mystery_gift_scripts.o(.rodata);
src/wonder_news.o(.rodata);
src/union_room_chat.o(.rodata); src/union_room_chat.o(.rodata);
src/berry_crush.o(.rodata); src/berry_crush.o(.rodata);
src/berry_powder.o(.rodata); src/berry_powder.o(.rodata);
@ -1245,9 +1248,43 @@ SECTIONS {
src/librfu_sio32id.o(.rodata); src/librfu_sio32id.o(.rodata);
*libgcc.a:_divdi3.o(.rodata); *libgcc.a:_divdi3.o(.rodata);
*libgcc.a:_udivdi3.o(.rodata); *libgcc.a:_udivdi3.o(.rodata);
*libc.a(.rodata); *libc.a:memcpy.o(.rodata);
*libc.a(.data); *libc.a:memset.o(.rodata);
*libc.a:strcmp.o(.rodata);
*libc.a:strcpy.o(.rodata);
*libc.a:impure.o(.rodata);
*libc.a:vsprintf.o(.rodata);
*libc.a:vfprintf.o(.rodata);
*libc.a:wsetup.o(.rodata);
*libc.a:dtoa.o(.rodata);
*libc.a:fflush.o(.rodata);
*libc.a:findfp.o(.rodata);
*libc.a:freer.o(.rodata);
*libc.a:mtrim.o(.rodata);
*libc.a:fvwrite.o(.rodata);
*libc.a:fwalk.o(.rodata);
*libc.a:locale.o(.rodata);
*libc.a:makebuf.o(.rodata);
*libc.a:mallocr.o(.rodata);
*libc.a:mbtowc_r.o(.rodata);
*libc.a:memchr.o(.rodata);
*libc.a:memmove.o(.rodata);
*libc.a:mlock.o(.rodata);
*libc.a:mprec.o(.rodata);
*libc.a:s_isinf.o(.rodata);
*libc.a:s_isnan.o(.rodata);
*libc.a:sbrkr.o(.rodata);
*libc.a:stdio.o(.rodata);
*libc.a:strlen.o(.rodata);
*libc.a:syscalls.o(.rodata); *libc.a:syscalls.o(.rodata);
*libc.a:writer.o(.rodata);
*libc.a:callocr.o(.rodata);
*libc.a:closer.o(.rodata);
*libc.a:errno.o(.rodata);
*libc.a:fstatr.o(.rodata);
*libc.a:libcfunc.o(.rodata);
*libc.a:lseekr.o(.rodata);
*libc.a:readr.o(.rodata);
src/libisagbprn.o(.rodata); src/libisagbprn.o(.rodata);
} =0 } =0

View File

@ -31,7 +31,7 @@ void AGBPrintFlush1Block(void);
void AGBPrintInit(void) void AGBPrintInit(void)
{ {
volatile struct AGBPrintStruct *pPrint = (struct AGBPrintStruct *)AGB_PRINT_STRUCT_ADDR; volatile struct AGBPrintStruct *pPrint = (struct AGBPrintStruct *)AGB_PRINT_STRUCT_ADDR;
u16 *pWSCNT = &REG_WAITCNT; vu16 *pWSCNT = &REG_WAITCNT;
u16 *pProtect = (u16 *)AGB_PRINT_PROTECT_ADDR; u16 *pProtect = (u16 *)AGB_PRINT_PROTECT_ADDR;
u16 nOldWSCNT = *pWSCNT; u16 nOldWSCNT = *pWSCNT;
*pWSCNT = WSCNT_DATA; *pWSCNT = WSCNT_DATA;
@ -57,7 +57,7 @@ static void AGBPutcInternal(const char cChr)
void AGBPutc(const char cChr) void AGBPutc(const char cChr)
{ {
u16 *pWSCNT = &REG_WAITCNT; vu16 *pWSCNT = &REG_WAITCNT;
u16 nOldWSCNT = *pWSCNT; u16 nOldWSCNT = *pWSCNT;
volatile struct AGBPrintStruct *pPrint; volatile struct AGBPrintStruct *pPrint;
*pWSCNT = WSCNT_DATA; *pWSCNT = WSCNT_DATA;
@ -71,7 +71,7 @@ void AGBPutc(const char cChr)
void AGBPrint(const char *pBuf) void AGBPrint(const char *pBuf)
{ {
volatile struct AGBPrintStruct *pPrint = (struct AGBPrintStruct *)AGB_PRINT_STRUCT_ADDR; volatile struct AGBPrintStruct *pPrint = (struct AGBPrintStruct *)AGB_PRINT_STRUCT_ADDR;
u16 *pWSCNT = &REG_WAITCNT; vu16 *pWSCNT = &REG_WAITCNT;
u16 nOldWSCNT = *pWSCNT; u16 nOldWSCNT = *pWSCNT;
*pWSCNT = WSCNT_DATA; *pWSCNT = WSCNT_DATA;
while (*pBuf) while (*pBuf)
@ -95,9 +95,9 @@ void AGBPrintf(const char *pBuf, ...)
static void AGBPrintTransferDataInternal(u32 bAllData) static void AGBPrintTransferDataInternal(u32 bAllData)
{ {
LPFN_PRINT_FLUSH lpfnFuncFlush; LPFN_PRINT_FLUSH lpfnFuncFlush;
u16 *pIME; vu16 *pIME;
u16 nIME; u16 nIME;
u16 *pWSCNT; vu16 *pWSCNT;
u16 nOldWSCNT; u16 nOldWSCNT;
u16 *pProtect; u16 *pProtect;
volatile struct AGBPrintStruct *pPrint; volatile struct AGBPrintStruct *pPrint;

View File

@ -506,9 +506,13 @@ static void IncrementCardStat(u32 statType)
} }
if (stat == NULL) if (stat == NULL)
{
AGB_ASSERT(0); AGB_ASSERT(0);
}
else if (++(*stat) > MAX_WONDER_CARD_STAT) else if (++(*stat) > MAX_WONDER_CARD_STAT)
{
*stat = MAX_WONDER_CARD_STAT; *stat = MAX_WONDER_CARD_STAT;
}
} }
} }