diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2019-07-03 10:12:16 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2019-07-03 10:12:16 -0400 |
commit | 0f19a99599ffa77a34535925a683113464095b8e (patch) | |
tree | b29aad22f1c2416c5ea49268fc7ba06405964d1d | |
parent | 8cf019bb3ac6373ad9b834639f2af47afcc1316f (diff) |
Remove the FLOAT_Uxx and DOUBLE_Uxx macros
-rw-r--r-- | INSTALL.md | 16 | ||||
-rw-r--r-- | include/gba/macro.h | 25 | ||||
-rw-r--r-- | src/pokemon_size_record.c | 2 | ||||
-rw-r--r-- | src/roulette_gfx.c | 10 |
4 files changed, 22 insertions, 31 deletions
diff --git a/INSTALL.md b/INSTALL.md index ad3262007..040e1def8 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -125,3 +125,19 @@ If you have 8 cores, run: If you've only changed `.c` or `.s` files, you can turn off the dependency scanning temporarily. Changes to any other files will be ignored, and the build will either fail or not reflect those changes. make NODEP=1 + +# Using present-day toolchains + +`agbcc` is based on GCC 2.95.1, which is primitive by today's standards and compiles inoptimal instructions. You can overcome this by swapping in a more modern compiler. Makefile rules have been set up for you to do this, all you need to do is run + + make MODERN=1 + +or + + make modern + +You can build Sapphire and other Ruby revisions by appending `_modern` to the target name: + + make sapphire_rev1_modern + +Bear in mind that the resulting ROM will not match vanilla Ruby and may exhibit undefined, buggy behavior. We are trying to resolve this as much as possible, so please report anything you find. diff --git a/include/gba/macro.h b/include/gba/macro.h index 109e4e003..ab42c9da3 100644 --- a/include/gba/macro.h +++ b/include/gba/macro.h @@ -220,29 +220,4 @@ #define Dma3FillLarge16_(value, dest, size) Dma3FillLarge_(value, dest, size, 16) #define Dma3FillLarge32_(value, dest, size) Dma3FillLarge_(value, dest, size, 32) -#if MODERN -#define FLOAT_UNS(x, bit) ({ \ - s##bit sx = x; \ - float fx = (float)sx; \ - if (sx < 0) fx += (1 << (bit - 1)) * 2.0f; \ - fx; \ -}) -#define DOUBLE_UNS(x, bit) ({ \ - s##bit sx = x; \ - double dx = (double)sx; \ - if (sx < 0) dx += (1 << (bit - 1)) * 2.0; \ - dx; \ -}) -#else -#define FLOAT_UNS(x, bit) ((float)(x)) -#define DOUBLE_UNS(x, bit) ((double)(x)) -#endif //MODERN - -#define FLOAT_U8(x) FLOAT_UNS(x, 8) -#define FLOAT_U16(x) FLOAT_UNS(x, 16) -#define FLOAT_U32(x) FLOAT_UNS(x, 32) -#define DOUBLE_U8(x) DOUBLE_UNS(x, 8) -#define DOUBLE_U16(x) DOUBLE_UNS(x, 16) -#define DOUBLE_U32(x) DOUBLE_UNS(x, 32) - #endif // GUARD_GBA_MACRO_H diff --git a/src/pokemon_size_record.c b/src/pokemon_size_record.c index 42de71e14..6a7ee69b3 100644 --- a/src/pokemon_size_record.c +++ b/src/pokemon_size_record.c @@ -96,7 +96,7 @@ static void FormatMonSizeRecord(u8 *string, u32 size) #ifdef UNITS_IMPERIAL //Convert size from centimeters to inches - size = DOUBLE_U32(size * 10) / (CM_PER_INCH * 10); + size = (double)(size * 10) / (CM_PER_INCH * 10); #endif string = ConvertIntToDecimalStringN(string, size / 10, 0, 8); diff --git a/src/roulette_gfx.c b/src/roulette_gfx.c index c309a27d3..55662ba39 100644 --- a/src/roulette_gfx.c +++ b/src/roulette_gfx.c @@ -1502,7 +1502,7 @@ void sub_8118F8C(struct Sprite *sprite) const struct StructgUnknown_083F8DF4 *p; eRoulette->var90 = 0.0f; p = gUnknown_083F8DF4; - eRoulette->var8C -= (FLOAT_U8(p[eRoulette->var04_0].var03)) + eRoulette->var8C -= ((float)(p[eRoulette->var04_0].var03)) / ((float)(s16)(p[eRoulette->var04_0].var04 + 1)); sprite->data[1] = 4; #if DEBUG @@ -1532,8 +1532,8 @@ void sub_8119088(struct Sprite *sprite) sub_8118724(sprite); if (!(eRoulette->var94 > 40.f)) { - eRoulette->var98 = - ( 4.0f / FLOAT_U16((u16)eRoulette->var86)); - eRoulette->var90 = - (eRoulette->var8C / FLOAT_U16((u16)eRoulette->var86)); + eRoulette->var98 = - ( 4.0f / (float)((u16)eRoulette->var86)); + eRoulette->var90 = - (eRoulette->var8C / (float)((u16)eRoulette->var86)); sprite->animNum = 2; sprite->animBeginning = TRUE; sprite->animEnded = FALSE; @@ -1548,8 +1548,8 @@ void sub_8119134(struct Sprite *sprite) if (!(eRoulette->var94 > 60.0f)) { m4aSongNumStartOrChange(SE_TAMAKORO_E); - eRoulette->var98 = - ( 20.0f / FLOAT_U16((u16)eRoulette->var84)); - eRoulette->var90 = ((1.0f - eRoulette->var8C) / FLOAT_U16((u16)eRoulette->var84)); + eRoulette->var98 = - ( 20.0f / (float)((u16)eRoulette->var84)); + eRoulette->var90 = ((1.0f - eRoulette->var8C) / (float)((u16)eRoulette->var84)); sprite->animNum = 1; sprite->animBeginning = TRUE; sprite->animEnded = FALSE; |