From e3585d7d6641b9f8338a8ac34e0b898e6fb5a982 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Mon, 1 Jan 2018 19:21:30 -0600 Subject: Review fixes --- include/field_effect.h | 2 ++ include/fldeff_teleport.h | 7 +++++++ include/overworld.h | 3 +++ include/party_menu.h | 2 ++ include/rom6.h | 1 + 5 files changed, 15 insertions(+) create mode 100644 include/fldeff_teleport.h (limited to 'include') diff --git a/include/field_effect.h b/include/field_effect.h index 772b20d37..fb0f20f6f 100644 --- a/include/field_effect.h +++ b/include/field_effect.h @@ -75,5 +75,7 @@ u32 FieldEffectStart(u8); bool8 FieldEffectActiveListContains(u8 id); void sub_80B69DC(void); void FieldEffectStop(struct Sprite *sprite, u8 id); +void sub_80B7FC8(void); +void FieldEffectActiveListRemove(u8 id); #endif //GUARD_FIELD_EFFECTS_H diff --git a/include/fldeff_teleport.h b/include/fldeff_teleport.h new file mode 100644 index 000000000..71fb64ad2 --- /dev/null +++ b/include/fldeff_teleport.h @@ -0,0 +1,7 @@ +#ifndef GUARD_FLDEFF_TELEPORT_H +#define GUARD_FLDEFF_TELEPORT_H + +void hm_teleport_run_dp02scr(void); +void sub_817C94C(void); + +#endif // GUARD_FLDEFF_TELEPORT_H diff --git a/include/overworld.h b/include/overworld.h index a5fba0c10..d6f90b666 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -42,6 +42,9 @@ void sub_8084EBC(s16, s16); void player_avatar_init_params_reset(void); +bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 mapType); +void Overworld_ResetStateAfterTeleport(void); + void Overworld_SetFlashLevel(s32 a1); //u8 Overworld_GetFlashLevel(void); void sub_8085524(u16); diff --git a/include/party_menu.h b/include/party_menu.h index 3756ef569..1d1661cee 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -16,5 +16,7 @@ void sub_81B58A8(void); void DoWallyTutorialBagMenu(void); u8 pokemon_ailments_get_primary(u32 status); u8 *GetMonNickname(struct Pokemon *mon, u8 *dst); +u8 GetCursorSelectionMonId(void); +bool8 FieldCallback_Teleport(void); #endif // GUARD_PARTY_MENU_H diff --git a/include/rom6.h b/include/rom6.h index fc33b7d1f..f91b34b4a 100644 --- a/include/rom6.h +++ b/include/rom6.h @@ -11,5 +11,6 @@ void UpdateBirchState(u16 days); void UpdateFrontierManiac(u16 days); void UpdateFrontierGambler(u16 days); void SetShoalItemFlag(u16 days); +u8 oei_task_add(void); #endif //GUARD_ROM6_H -- cgit v1.2.3 From 601ec28721b250d74e7fd61300226ff07c8a710b Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Sat, 6 Jan 2018 00:35:48 -0600 Subject: remove explicit memcpy and add HEAP_SIZE constant --- include/global.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/global.h b/include/global.h index b6a496dd1..7943fc569 100644 --- a/include/global.h +++ b/include/global.h @@ -31,6 +31,8 @@ char* strcpy(char *dst0, const char *src0); #define POKEMON_NAME_LENGTH 10 #define OT_NAME_LENGTH 7 +#define HEAP_SIZE 0x1C000 + extern u8 gStringVar1[]; extern u8 gStringVar2[]; extern u8 gStringVar3[]; -- cgit v1.2.3 From 7be61cfb1a55feb9ab30cfda9e78ed33c74eb097 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sat, 6 Jan 2018 21:12:42 -0500 Subject: add assert support to pokeemerald. --- include/assert.h | 43 +++++++++++++++++++++++++++++++++++++++++++ include/config.h | 10 ++++++++++ include/global.h | 1 + 3 files changed, 54 insertions(+) create mode 100755 include/assert.h (limited to 'include') diff --git a/include/assert.h b/include/assert.h new file mode 100755 index 000000000..0c1e5bf77 --- /dev/null +++ b/include/assert.h @@ -0,0 +1,43 @@ +#ifndef GUARD_GBASDKASSERT_H +#define GUARD_GBASDKASSERT_H + +// this header is based on the +// GBA SDK IsAgbAssert.h. + +#ifdef NOAGBPRN + #define AGBPrintInit() + #define AGBPutc(pBuf) + #define AGBPrint(pBuf) + #define AGBPrintf(...) + #define AGBPrintFlush1Block() + #define AGBPrintFlush() + #define AGBAssert(pFile, nLine, pExpression, nStopProgram) +#else + // without NOAGBPRN defined, this enables asserts for usage + // on a standard GBA debugger unit or in emulators that + // support it. + + void AGBPrintInit(void); + void AGBPutc(const char pBuf); + void AGBPrint(const char *pBuf); + void AGBPrintf(const char *pBuf, ...); + void AGBPrintFlush1Block(void); + void AGBPrintFlush(void); + void AGBAssert(const char *pFile, int nLine, const char *pExpression, int nStopProgram); +#endif + +// when using AGB_WARNING, be sure to flush after as AGBAssert does not flush the string to console +// immediately after usage. +#ifdef NOAGBPRN + #define AGB_ASSERT(expression) +#else + #define AGB_ASSERT(expression) (expression) ? ((void *)0) : AGBAssert(__FILE__, __LINE__, #expression, 1); +#endif + +#ifdef NOAGBPRN + #define AGB_WARNING(expression) +#else + #define AGB_WARNING(expression) (expression) ? ((void *)0) : AGBAssert(__FILE__, __LINE__, #expression, 0); +#endif + +#endif diff --git a/include/config.h b/include/config.h index 162af3143..ce8e4ae74 100644 --- a/include/config.h +++ b/include/config.h @@ -1,6 +1,16 @@ #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 NOAGBPRN before release, which is actually supposed to be +// NDEBUG, however this has been changed as Ruby's actual debug build +// does not use the AGBPrint features. +#define NOAGBPRN +// NOTE: Don't try to enable assert right now as many pointers +// still exist in defines and WILL likely result in a broken ROM. + #define ENGLISH #ifdef ENGLISH diff --git a/include/global.h b/include/global.h index 7943fc569..1d0962cf6 100644 --- a/include/global.h +++ b/include/global.h @@ -3,6 +3,7 @@ #include "gba/gba.h" #include "config.h" +#include "assert.h" // Prevent cross-jump optimization. #define BLOCK_CROSS_JUMP asm(""); -- cgit v1.2.3 From 419e6d885baa060506489a947718b8610173b450 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sat, 6 Jan 2018 21:38:34 -0500 Subject: use firered isagbprint header. --- include/assert.h | 43 ----------------------------------------- include/gba/gba.h | 1 + include/gba/isagbprint.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 43 deletions(-) delete mode 100755 include/assert.h create mode 100755 include/gba/isagbprint.h (limited to 'include') diff --git a/include/assert.h b/include/assert.h deleted file mode 100755 index 0c1e5bf77..000000000 --- a/include/assert.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef GUARD_GBASDKASSERT_H -#define GUARD_GBASDKASSERT_H - -// this header is based on the -// GBA SDK IsAgbAssert.h. - -#ifdef NOAGBPRN - #define AGBPrintInit() - #define AGBPutc(pBuf) - #define AGBPrint(pBuf) - #define AGBPrintf(...) - #define AGBPrintFlush1Block() - #define AGBPrintFlush() - #define AGBAssert(pFile, nLine, pExpression, nStopProgram) -#else - // without NOAGBPRN defined, this enables asserts for usage - // on a standard GBA debugger unit or in emulators that - // support it. - - void AGBPrintInit(void); - void AGBPutc(const char pBuf); - void AGBPrint(const char *pBuf); - void AGBPrintf(const char *pBuf, ...); - void AGBPrintFlush1Block(void); - void AGBPrintFlush(void); - void AGBAssert(const char *pFile, int nLine, const char *pExpression, int nStopProgram); -#endif - -// when using AGB_WARNING, be sure to flush after as AGBAssert does not flush the string to console -// immediately after usage. -#ifdef NOAGBPRN - #define AGB_ASSERT(expression) -#else - #define AGB_ASSERT(expression) (expression) ? ((void *)0) : AGBAssert(__FILE__, __LINE__, #expression, 1); -#endif - -#ifdef NOAGBPRN - #define AGB_WARNING(expression) -#else - #define AGB_WARNING(expression) (expression) ? ((void *)0) : AGBAssert(__FILE__, __LINE__, #expression, 0); -#endif - -#endif diff --git a/include/gba/gba.h b/include/gba/gba.h index 42ae3cdde..349344031 100644 --- a/include/gba/gba.h +++ b/include/gba/gba.h @@ -7,5 +7,6 @@ #include "gba/multiboot.h" #include "gba/syscall.h" #include "gba/macro.h" +#include "gba/isagbprint.h" #endif // GUARD_GBA_GBA_H diff --git a/include/gba/isagbprint.h b/include/gba/isagbprint.h new file mode 100755 index 000000000..c5eb456c3 --- /dev/null +++ b/include/gba/isagbprint.h @@ -0,0 +1,50 @@ +#ifndef GUARD_GBA_ISAGBPRINT_H +#define GUARD_GBA_ISAGBPRINT_H + +#ifdef NDEBUG +#define AGBPrintInit() +#define AGBPutc(cChr) +#define AGBPrint(pBuf) +#define AGBPrintf(pBuf, ...) +#define AGBPrintFlush1Block() +#define AGBPrintFlush() +#define AGBAssert(pFile, nLine, pExpression, nStopProgram) +#else +void AGBPrintInit(void); +void AGBPutc(const char cChr); +void AGBPrint(const char *pBuf); +void AGBPrintf(const char *pBuf, ...); +void AGBPrintFlush1Block(void); +void AGBPrintFlush(void); +void AGBAssert(const char *pFile, int nLine, const char *pExpression, int nStopProgram); +#endif + +#undef AGB_ASSERT +#ifdef NDEBUG +#define AGB_ASSERT(exp) +#else +#define AGB_ASSERT(exp) (exp) ? ((void*)0) : AGBAssert(__FILE__, __LINE__, #exp, 1); +#endif + +#undef AGB_WARNING +#ifdef NDEBUG +#define AGB_WARNING(exp) +#else +#define AGB_WARNING(exp) (exp) ? ((void*)0) : AGBAssert(__FILE__, __LINE__, #exp, 0); +#endif + +// for matching purposes + +#ifdef NDEBUG +#define AGB_ASSERT_EX(exp, file, line) +#else +#define AGB_ASSERT_EX(exp, file, line) (exp) ? ((void*)0) : AGBAssert(file, line, #exp, 1); +#endif + +#ifdef NDEBUG +#define AGB_WARNING_EX(exp, file, line) +#else +#define AGB_WARNING_EX(exp, file, line) (exp) ? ((void*)0) : AGBAssert(file, line, #exp, 0); +#endif + +#endif // GUARD_GBA_ISAGBPRINT_H -- cgit v1.2.3 From 10ddfac7abab614d2c4488244cee35054ed06fa8 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sat, 6 Jan 2018 22:00:08 -0500 Subject: consistency --- include/config.h | 4 ++-- include/global.h | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/config.h b/include/config.h index ce8e4ae74..7ee4503c7 100644 --- a/include/config.h +++ b/include/config.h @@ -4,10 +4,10 @@ // 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 NOAGBPRN before release, which is actually supposed to be +// to define NDEBUG before release, which is actually supposed to be // NDEBUG, however this has been changed as Ruby's actual debug build // does not use the AGBPrint features. -#define NOAGBPRN +#define NDEBUG // NOTE: Don't try to enable assert right now as many pointers // still exist in defines and WILL likely result in a broken ROM. diff --git a/include/global.h b/include/global.h index 1d0962cf6..3e260fd2a 100644 --- a/include/global.h +++ b/include/global.h @@ -1,9 +1,8 @@ #ifndef GUARD_GLOBAL_H #define GUARD_GLOBAL_H +#include "config.h" // we need to define config before gba headers as print stuff needs the functions nulled before defines. #include "gba/gba.h" -#include "config.h" -#include "assert.h" // Prevent cross-jump optimization. #define BLOCK_CROSS_JUMP asm(""); -- cgit v1.2.3 From a11c65ff1ac380cd213b26d0bb7a2787936b33f9 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Sun, 7 Jan 2018 17:50:13 -0600 Subject: Port field_door --- include/field_camera.h | 1 + include/field_door.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) (limited to 'include') diff --git a/include/field_camera.h b/include/field_camera.h index a8559e1c2..f68c67854 100644 --- a/include/field_camera.h +++ b/include/field_camera.h @@ -24,5 +24,6 @@ extern u16 gUnknown_03005DE8; void DrawWholeMapView(void); void CurrentMapDrawMetatileAt(int x, int y); +void DrawDoorMetatileAt(int x, int y, u16 *arr); #endif //GUARD_FIELD_CAMERA_H diff --git a/include/field_door.h b/include/field_door.h index f1dfc551d..dd039a5c2 100644 --- a/include/field_door.h +++ b/include/field_door.h @@ -1,11 +1,27 @@ #ifndef GUARD_FIELDDOOR_H #define GUARD_FIELDDOOR_H +struct DoorGraphics +{ + u16 metatileNum; + u8 sound; + u8 size; + const void *tiles; + const void *palette; +}; + +struct DoorAnimFrame +{ + u8 time; + u16 offset; +}; + void FieldSetDoorOpened(u32, u32); void FieldSetDoorClosed(u32, u32); s8 FieldAnimateDoorClose(u32, u32); s8 FieldAnimateDoorOpen(u32, u32); bool8 FieldIsDoorAnimationRunning(void); u32 GetDoorSoundEffect(u32 x, u32 y); +bool8 sub_808A964(void); #endif -- cgit v1.2.3 From 0eadf71b1a0676f70024ac93a7b4bfa325fa09a3 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Sun, 7 Jan 2018 18:58:52 -0600 Subject: Move forward declaration --- include/field_door.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/field_door.h b/include/field_door.h index dd039a5c2..8b4955cac 100644 --- a/include/field_door.h +++ b/include/field_door.h @@ -22,6 +22,5 @@ s8 FieldAnimateDoorClose(u32, u32); s8 FieldAnimateDoorOpen(u32, u32); bool8 FieldIsDoorAnimationRunning(void); u32 GetDoorSoundEffect(u32 x, u32 y); -bool8 sub_808A964(void); #endif -- cgit v1.2.3 From d98c14444ade7e975585e991ef89c7597295f1b4 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sun, 7 Jan 2018 23:46:35 -0500 Subject: NDEBUG which is supposed to be NDEBUG... --- include/config.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/config.h b/include/config.h index 7ee4503c7..53502c6c2 100644 --- a/include/config.h +++ b/include/config.h @@ -4,9 +4,8 @@ // 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, which is actually supposed to be -// NDEBUG, however this has been changed as Ruby's actual debug build -// does not use the AGBPrint features. +// to define NDEBUG before release, however this has been changed as +// Ruby's actual debug build does not use the AGBPrint features. #define NDEBUG // NOTE: Don't try to enable assert right now as many pointers // still exist in defines and WILL likely result in a broken ROM. -- cgit v1.2.3 From 3b097262f5c0244d3517008df76e8683f61e459d Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Sun, 7 Jan 2018 23:59:42 -0600 Subject: completely label and document dma3_manager.c --- include/dma3.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/dma3.h b/include/dma3.h index 265b47824..d58e41850 100644 --- a/include/dma3.h +++ b/include/dma3.h @@ -3,8 +3,8 @@ void ClearDma3Requests(void); void ProcessDma3Requests(void); -int RequestDma3Copy(const void *src, void *dest, u16 size, u8 mode); -int RequestDma3Fill(s32 value, void *dest, u16 size, u8 mode); +s16 RequestDma3Copy(const void *src, void *dest, u16 size, u8 mode); +s16 RequestDma3Fill(s32 value, void *dest, u16 size, u8 mode); int CheckForSpaceForDma3Request(s16 index); #endif // GUARD_DMA3_H -- cgit v1.2.3 From 0bf530da12f671c678f7e524b4318213d49b30e0 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Mon, 8 Jan 2018 22:03:07 -0500 Subject: nocashgba printf --- include/config.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/config.h b/include/config.h index 53502c6c2..318ed39d8 100644 --- a/include/config.h +++ b/include/config.h @@ -7,6 +7,14 @@ // to define NDEBUG before release, however this has been changed as // Ruby's actual debug build does not use the AGBPrint features. #define NDEBUG + +// To enable print debugging, comment out "#define NDEBUG". This allows +// the various AGBPrint functions to be used. (See include/gba/isagbprint.h). +// Some emulators support a debug console window: uncomment NoCashGBAPrint() +// and NoCashGBAPrintf() in libisagbprn.c to use no$gba's own proprietary +// printing system. Use NoCashGBAPrint() and NoCashGBAPrintf() like you +// would normally use AGBPrint() and AGBPrintf(). + // NOTE: Don't try to enable assert right now as many pointers // still exist in defines and WILL likely result in a broken ROM. -- cgit v1.2.3