Merge pull request #1 from ProjectRevoTPP/assert

add NDEBUG define
This commit is contained in:
Marcus Huderle
2018-01-11 18:11:01 -08:00
committed by GitHub
5 changed files with 43 additions and 72 deletions
+12
View File
@@ -1,6 +1,18 @@
#ifndef GUARD_CONFIG_H
#define GUARD_CONFIG_H
// In the Generation 3 games, Asserts were used in various debug builds.
// Ruby/Sapphire and Emerald do not have these asserts while Fire Red
// still has them in the ROM. This is because the developers forgot
// to define NDEBUG before release, however this has been changed as
// Ruby's actual debug build does not use the AGBPrint features.
// #define NDEBUG
// Fire Red likely forgot to define NDEBUG/NOAGBPRN before release, leading
// to the inclusion of asserts in the retail ROM. Don't try to re-enable this yet
// since not all baseroms and pointers have been dumped yet and will result in
// a broken ROM.
#define ENGLISH
#ifdef ENGLISH
+1 -1
View File
@@ -1,8 +1,8 @@
#ifndef GUARD_GLOBAL_H
#define GUARD_GLOBAL_H
#include "gba/gba.h"
#include "config.h"
#include "gba/gba.h"
// Prevent cross-jump optimization.
#define BLOCK_CROSS_JUMP asm("");
-35
View File
@@ -15,44 +15,9 @@ SECTIONS {
<EWRAM>
tools/agbcc/lib/libc.a:memcpy.o(.data);
tools/agbcc/lib/libc.a:memset.o(.data);
tools/agbcc/lib/libc.a:strcmp.o(.data);
tools/agbcc/lib/libc.a:strcpy.o(.data);
tools/agbcc/lib/libc.a:impure.o(.data);
tools/agbcc/lib/libc.a:vsprintf.o(.data);
tools/agbcc/lib/libc.a:vfprintf.o(.data);
tools/agbcc/lib/libc.a:wsetup.o(.data);
tools/agbcc/lib/libc.a:dtoa.o(.data);
tools/agbcc/lib/libc.a:fflush.o(.data);
tools/agbcc/lib/libc.a:findfp.o(.data);
tools/agbcc/lib/libc.a:freer.o(.data);
tools/agbcc/lib/libc.a:mtrim.o(.data);
tools/agbcc/lib/libc.a:fvwrite.o(.data);
tools/agbcc/lib/libc.a:fwalk.o(.data);
tools/agbcc/lib/libc.a:locale.o(.data);
tools/agbcc/lib/libc.a:makebuf.o(.data);
tools/agbcc/lib/libc.a:mallocr.o(.data);
tools/agbcc/lib/libc.a:mbtowc_r.o(.data);
tools/agbcc/lib/libc.a:memchr.o(.data);
tools/agbcc/lib/libc.a:memmove.o(.data);
tools/agbcc/lib/libc.a:mlock.o(.data);
tools/agbcc/lib/libc.a:mprec.o(.data);
tools/agbcc/lib/libc.a:s_isinf.o(.data);
tools/agbcc/lib/libc.a:s_isnan.o(.data);
tools/agbcc/lib/libc.a:sbrkr.o(.data);
tools/agbcc/lib/libc.a:stdio.o(.data);
tools/agbcc/lib/libc.a:strlen.o(.data);
tools/agbcc/lib/libc.a:syscalls.o(.data);
tools/agbcc/lib/libc.a:writer.o(.data);
tools/agbcc/lib/libc.a:callocr.o(.data);
tools/agbcc/lib/libc.a:closer.o(.data);
tools/agbcc/lib/libc.a:errno.o(.data);
tools/agbcc/lib/libc.a:fstatr.o(.data);
tools/agbcc/lib/libc.a:libcfunc.o(.data);
tools/agbcc/lib/libc.a:lseekr.o(.data);
tools/agbcc/lib/libc.a:readr.o(.data);
. = 0x40000;
}
+30
View File
@@ -1,5 +1,7 @@
#include <stdarg.h>
#include <stdio.h>
#include "global.h"
#include "config.h"
#include "gba/gba.h"
#define AGB_PRINT_FLUSH_ADDR 0x9FE209D
@@ -7,6 +9,12 @@
#define AGB_PRINT_PROTECT_ADDR 0x9FE2FFE
#define WSCNT_DATA (WAITCNT_PHI_OUT_16MHZ | WAITCNT_WS0_S_2 | WAITCNT_WS0_N_4)
// originally for auto no$gba support, the string "no$gba" should be at this address,
// the user needs to read this string out as the memory viewer won't show it.
#define NOCASHGBAIDADDR 0x4FFFA00
#define NOCASHGBAPRINTADDR1 0x4FFFA10 // automatically adds a newline after the string has finished
#define NOCASHGBAPRINTADDR2 0x4FFFA14 // does not automatically add the newline. by default, NOCASHGBAPRINTADDR2 is used. this is used to keep strings consistent between no$gba and VBA-RR, but a user can choose to forgo this.
struct AGBPrintStruct
{
u16 m_nRequest;
@@ -17,6 +25,8 @@ struct AGBPrintStruct
typedef void (*LPFN_PRINT_FLUSH)(void);
#ifndef NDEBUG
void AGBPrintFlush1Block(void);
void AGBPrintInit(void)
@@ -146,3 +156,23 @@ void AGBAssert(const char *pFile, int nLine, const char *pExpression, int nStopP
AGBPrintf("WARING FILE=[%s] LINE=[%d] EXP=[%s] \n", pFile, nLine, pExpression);
}
}
// no$gba print functions, uncomment to use
/*
void NoCashGBAPrint(const char *pBuf)
{
*(volatile u32*)NOCASHGBAPRINTADDR2 = (u32)pBuf;
}
void NoCashGBAPrintf(const char *pBuf, ...)
{
char bufPrint[0x100];
va_list vArgv;
va_start(vArgv, pBuf);
vsprintf(bufPrint, pBuf, vArgv);
va_end(vArgv);
NoCashGBAPrint(bufPrint);
}
*/
#endif
-36
View File
@@ -286,40 +286,4 @@ gUnknown_3002080: @ 3002080
.include "tools/agbcc/lib/libgcc.a:dp-bit.o"
.include "tools/agbcc/lib/libgcc.a:fp-bit.o"
.include "tools/agbcc/lib/libc.a:memcpy.o"
.include "tools/agbcc/lib/libc.a:memset.o"
.include "tools/agbcc/lib/libc.a:strcmp.o"
.include "tools/agbcc/lib/libc.a:strcpy.o"
.include "tools/agbcc/lib/libc.a:impure.o"
.include "tools/agbcc/lib/libc.a:vsprintf.o"
.include "tools/agbcc/lib/libc.a:vfprintf.o"
.include "tools/agbcc/lib/libc.a:wsetup.o"
.include "tools/agbcc/lib/libc.a:dtoa.o"
.include "tools/agbcc/lib/libc.a:fflush.o"
.include "tools/agbcc/lib/libc.a:findfp.o"
.include "tools/agbcc/lib/libc.a:freer.o"
.include "tools/agbcc/lib/libc.a:mtrim.o"
.include "tools/agbcc/lib/libc.a:fvwrite.o"
.include "tools/agbcc/lib/libc.a:fwalk.o"
.include "tools/agbcc/lib/libc.a:locale.o"
.include "tools/agbcc/lib/libc.a:makebuf.o"
.include "tools/agbcc/lib/libc.a:mallocr.o"
.include "tools/agbcc/lib/libc.a:mbtowc_r.o"
.include "tools/agbcc/lib/libc.a:memchr.o"
.include "tools/agbcc/lib/libc.a:memmove.o"
.include "tools/agbcc/lib/libc.a:mlock.o"
.include "tools/agbcc/lib/libc.a:mprec.o"
.include "tools/agbcc/lib/libc.a:s_isinf.o"
.include "tools/agbcc/lib/libc.a:s_isnan.o"
.include "tools/agbcc/lib/libc.a:sbrkr.o"
.include "tools/agbcc/lib/libc.a:stdio.o"
.include "tools/agbcc/lib/libc.a:strlen.o"
.include "tools/agbcc/lib/libc.a:syscalls.o"
.include "tools/agbcc/lib/libc.a:writer.o"
.include "tools/agbcc/lib/libc.a:callocr.o"
.include "tools/agbcc/lib/libc.a:closer.o"
.include "tools/agbcc/lib/libc.a:errno.o"
.include "tools/agbcc/lib/libc.a:fstatr.o"
.include "tools/agbcc/lib/libc.a:libcfunc.o"
.include "tools/agbcc/lib/libc.a:lseekr.o"
.include "tools/agbcc/lib/libc.a:readr.o"