mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
decompile decompress.s
This commit is contained in:
parent
7ecdcc5ed8
commit
7a831c215e
@ -1380,7 +1380,7 @@ _0805DC58:
|
||||
adds r0, r2, 0
|
||||
adds r2, r5, 0
|
||||
adds r3, r6, 0
|
||||
bl DecompressMonPicWithoutDuplicatingDeoxysTiles_DetectFrontOrBack
|
||||
bl HandleLoadSpecialPokePic_DontHandleDeoxys
|
||||
mov r3, r8
|
||||
lsls r2, r3, 4
|
||||
movs r0, 0x80
|
||||
@ -1551,7 +1551,7 @@ _0805DE00:
|
||||
ldr r1, [r1]
|
||||
adds r2, r5, 0
|
||||
adds r3, r4, 0
|
||||
bl DecompressMonPicWithoutDuplicatingDeoxysTiles_DetectFrontOrBack
|
||||
bl HandleLoadSpecialPokePic_DontHandleDeoxys
|
||||
b _0805DE46
|
||||
.pool
|
||||
_0805DE2C:
|
||||
@ -1566,7 +1566,7 @@ _0805DE2C:
|
||||
ldr r1, [r1]
|
||||
adds r2, r5, 0
|
||||
adds r3, r4, 0
|
||||
bl DecompressMonPic_DetectFrontOrBack
|
||||
bl HandleLoadSpecialPokePic
|
||||
_0805DE46:
|
||||
mov r2, r8
|
||||
lsls r1, r2, 4
|
||||
@ -2447,7 +2447,7 @@ _0805E59C:
|
||||
ldr r3, [r2]
|
||||
_0805E5FA:
|
||||
mov r2, r8
|
||||
bl DecompressMonPicWithoutDuplicatingDeoxysTiles_DetectFrontOrBack
|
||||
bl HandleLoadSpecialPokePic_DontHandleDeoxys
|
||||
b _0805E662
|
||||
.pool
|
||||
_0805E618:
|
||||
@ -2484,7 +2484,7 @@ _0805E618:
|
||||
adds r2, r3
|
||||
ldr r3, [r2]
|
||||
mov r2, r8
|
||||
bl DecompressMonPicWithoutDuplicatingDeoxysTiles_DetectFrontOrBack
|
||||
bl HandleLoadSpecialPokePic_DontHandleDeoxys
|
||||
_0805E662:
|
||||
ldr r0, =gUnknown_020244D4
|
||||
ldr r0, [r0]
|
||||
|
@ -6746,7 +6746,7 @@ sub_80DB174: @ 80DB174
|
||||
ldr r1, [r1, 0x4]
|
||||
adds r2, r5, 0
|
||||
adds r3, r6, 0
|
||||
bl DecompressMonPic_DetectFrontOrBack_2
|
||||
bl HandleLoadSpecialPokePic_2
|
||||
b _080DB1CC
|
||||
.pool
|
||||
_080DB1B8:
|
||||
@ -6758,7 +6758,7 @@ _080DB1B8:
|
||||
ldr r1, [r1, 0x4]
|
||||
adds r2, r5, 0
|
||||
adds r3, r6, 0
|
||||
bl DecompressMonPicWithoutDuplicatingDeoxysTiles_DetectFrontOrBack
|
||||
bl HandleLoadSpecialPokePic_DontHandleDeoxys
|
||||
_080DB1CC:
|
||||
adds r0, r5, 0
|
||||
adds r1, r7, 0
|
||||
|
@ -1399,7 +1399,7 @@ _080F648C:
|
||||
ldr r1, [r1, 0x8]
|
||||
adds r2, r6, 0
|
||||
adds r3, r4, 0
|
||||
bl DecompressMonPic_DetectFrontOrBack_2
|
||||
bl HandleLoadSpecialPokePic_2
|
||||
b _080F64F2
|
||||
.pool
|
||||
_080F64E0:
|
||||
@ -1410,7 +1410,7 @@ _080F64E0:
|
||||
ldr r1, [r1, 0x8]
|
||||
adds r2, r6, 0
|
||||
adds r3, r4, 0
|
||||
bl DecompressMonPicWithoutDuplicatingDeoxysTiles_DetectFrontOrBack
|
||||
bl HandleLoadSpecialPokePic_DontHandleDeoxys
|
||||
_080F64F2:
|
||||
adds r0, r6, 0
|
||||
adds r1, r5, 0
|
||||
|
@ -587,7 +587,7 @@ sub_81302E8: @ 81302E8
|
||||
ldr r2, [r6]
|
||||
ldr r3, [r2]
|
||||
adds r2, r5, 0
|
||||
bl DecompressMonPicWithoutDuplicatingDeoxysTiles_DetectFrontOrBack
|
||||
bl HandleLoadSpecialPokePic_DontHandleDeoxys
|
||||
ldr r0, [r4]
|
||||
ldr r0, [r0, 0x8]
|
||||
ldr r1, [r7]
|
||||
@ -606,7 +606,7 @@ _08130348:
|
||||
ldr r2, [r6]
|
||||
ldr r3, [r2]
|
||||
adds r2, r5, 0
|
||||
bl DecompressMonPicWithoutDuplicatingDeoxysTiles_DetectFrontOrBack
|
||||
bl HandleLoadSpecialPokePic_DontHandleDeoxys
|
||||
ldr r0, [r4]
|
||||
ldr r0, [r0, 0x4]
|
||||
ldr r1, [r7]
|
||||
|
1019
asm/decompress.s
1019
asm/decompress.s
File diff suppressed because it is too large
Load Diff
@ -409,7 +409,7 @@ _08071688:
|
||||
adds r2, r1
|
||||
ldr r1, [r2]
|
||||
adds r2, r4, 0
|
||||
bl DecompressMonPicWithoutDuplicatingDeoxysTiles_DetectFrontOrBack
|
||||
bl HandleLoadSpecialPokePic_DontHandleDeoxys
|
||||
adds r0, r5, 0
|
||||
bl sub_806E794
|
||||
bl LoadCompressedObjectPalette
|
||||
|
@ -68989,7 +68989,7 @@ _0802CA32:
|
||||
adds r0, r1
|
||||
ldr r3, [r7, 0x8]
|
||||
mov r1, r8
|
||||
bl DecompressMonPic_DetectFrontOrBack
|
||||
bl HandleLoadSpecialPokePic
|
||||
mov r3, r8
|
||||
str r3, [sp, 0x18]
|
||||
adds r4, r6, 0
|
||||
|
@ -327,7 +327,7 @@ _08179E48:
|
||||
ldr r1, [r1, 0x8]
|
||||
adds r2, r5, 0
|
||||
adds r3, r4, 0
|
||||
bl DecompressMonPic_DetectFrontOrBack_2
|
||||
bl HandleLoadSpecialPokePic_2
|
||||
ldr r0, =gUnknown_0203BD18
|
||||
ldr r1, [r0]
|
||||
b _08179F5E
|
||||
|
@ -5236,7 +5236,7 @@ _080A8488:
|
||||
str r2, [sp]
|
||||
adds r2, r6, 0
|
||||
mov r3, r8
|
||||
bl DecompressMonPic_2
|
||||
bl LoadSpecialPokePic_2
|
||||
b _080A8540
|
||||
.pool
|
||||
_080A84B0:
|
||||
@ -5287,7 +5287,7 @@ _080A850A:
|
||||
str r2, [sp]
|
||||
adds r2, r6, 0
|
||||
mov r3, r8
|
||||
bl DecompressMonPicWithoutDuplicatingDeoxysTiles
|
||||
bl LoadSpecialPokePic_DontHandleDeoxys
|
||||
b _080A8540
|
||||
.pool
|
||||
_080A8524:
|
||||
@ -5303,7 +5303,7 @@ _080A8524:
|
||||
str r2, [sp]
|
||||
adds r2, r6, 0
|
||||
mov r3, r8
|
||||
bl DecompressMonPic_2
|
||||
bl LoadSpecialPokePic_2
|
||||
_080A8540:
|
||||
ldr r5, =gUnknown_020244D4
|
||||
ldr r0, [r5]
|
||||
|
@ -6038,7 +6038,7 @@ sub_80CA44C: @ 80CA44C
|
||||
movs r2, 0x1
|
||||
str r2, [sp]
|
||||
adds r2, r4, 0
|
||||
bl DecompressMonPic
|
||||
bl LoadSpecialPokePic
|
||||
ldr r1, [r6]
|
||||
ldr r2, =0x00000cdc
|
||||
adds r0, r1, r2
|
||||
|
@ -14912,7 +14912,7 @@ _0818D03C:
|
||||
adds r1, r5, 0
|
||||
adds r2, r4, 0
|
||||
adds r3, r6, 0
|
||||
bl DecompressMonPic
|
||||
bl LoadSpecialPokePic
|
||||
b _0818D08E
|
||||
.pool
|
||||
_0818D050:
|
||||
@ -14924,7 +14924,7 @@ _0818D054:
|
||||
adds r1, r5, 0
|
||||
adds r2, r4, 0
|
||||
adds r3, r6, 0
|
||||
bl DecompressMonPicWithoutDuplicatingDeoxysTiles
|
||||
bl LoadSpecialPokePic_DontHandleDeoxys
|
||||
b _0818D08E
|
||||
.pool
|
||||
_0818D068:
|
||||
|
@ -17398,7 +17398,7 @@ _081C46A6:
|
||||
_081C46B0:
|
||||
ldr r1, [r1, 0x8]
|
||||
ldr r3, [r5, 0xC]
|
||||
bl DecompressMonPic_DetectFrontOrBack_2
|
||||
bl HandleLoadSpecialPokePic_2
|
||||
b _081C4768
|
||||
.pool
|
||||
_081C46CC:
|
||||
@ -17409,7 +17409,7 @@ _081C46CC:
|
||||
ldr r1, [r3, 0x8]
|
||||
_081C46D6:
|
||||
ldr r3, [r5, 0xC]
|
||||
bl DecompressMonPicWithoutDuplicatingDeoxysTiles_DetectFrontOrBack
|
||||
bl HandleLoadSpecialPokePic_DontHandleDeoxys
|
||||
b _081C4768
|
||||
.pool
|
||||
_081C46E4:
|
||||
@ -17439,7 +17439,7 @@ _081C4700:
|
||||
ldrh r2, [r5, 0x2]
|
||||
ldr r3, [r5, 0xC]
|
||||
adds r0, r4, 0
|
||||
bl DecompressMonPic_DetectFrontOrBack_2
|
||||
bl HandleLoadSpecialPokePic_2
|
||||
b _081C4768
|
||||
.pool
|
||||
_081C472C:
|
||||
@ -17454,7 +17454,7 @@ _081C472C:
|
||||
ldrh r2, [r5, 0x2]
|
||||
ldr r3, [r5, 0xC]
|
||||
adds r0, r4, 0
|
||||
bl DecompressMonPicWithoutDuplicatingDeoxysTiles_DetectFrontOrBack
|
||||
bl HandleLoadSpecialPokePic_DontHandleDeoxys
|
||||
b _081C4768
|
||||
.pool
|
||||
_081C4750:
|
||||
@ -35972,7 +35972,7 @@ _081CDBD0:
|
||||
str r2, [sp]
|
||||
adds r2, r4, 0
|
||||
adds r3, r5, 0
|
||||
bl DecompressMonPic
|
||||
bl LoadSpecialPokePic
|
||||
adds r0, r4, 0
|
||||
mov r1, r8
|
||||
adds r2, r5, 0
|
||||
@ -46848,7 +46848,7 @@ _081D30C4:
|
||||
mov r1, r8
|
||||
adds r2, r4, 0
|
||||
adds r3, r5, 0
|
||||
bl DecompressMonPic
|
||||
bl LoadSpecialPokePic
|
||||
adds r0, r4, 0
|
||||
adds r1, r6, 0
|
||||
adds r2, r5, 0
|
||||
|
@ -715,7 +715,7 @@ _080F8D44:
|
||||
ldr r1, [r1, 0x8]
|
||||
adds r2, r6, 0
|
||||
adds r3, r5, 0
|
||||
bl DecompressMonPic_DetectFrontOrBack_2
|
||||
bl HandleLoadSpecialPokePic_2
|
||||
b _080F8DD8
|
||||
.pool
|
||||
_080F8DC4:
|
||||
@ -727,7 +727,7 @@ _080F8DC4:
|
||||
ldr r1, [r1, 0x8]
|
||||
adds r2, r6, 0
|
||||
adds r3, r5, 0
|
||||
bl DecompressMonPicWithoutDuplicatingDeoxysTiles_DetectFrontOrBack
|
||||
bl HandleLoadSpecialPokePic_DontHandleDeoxys
|
||||
_080F8DD8:
|
||||
adds r0, r6, 0
|
||||
mov r1, r8
|
||||
|
@ -7133,7 +7133,7 @@ _0807AD58:
|
||||
ldr r1, [r1, 0x8]
|
||||
adds r2, r5, 0
|
||||
adds r3, r7, 0
|
||||
bl DecompressMonPic_DetectFrontOrBack_2
|
||||
bl HandleLoadSpecialPokePic_2
|
||||
movs r4, 0
|
||||
b _0807ADB2
|
||||
.pool
|
||||
@ -7151,7 +7151,7 @@ _0807AD94:
|
||||
ldr r1, [r2]
|
||||
adds r2, r5, 0
|
||||
adds r3, r7, 0
|
||||
bl DecompressMonPicWithoutDuplicatingDeoxysTiles_DetectFrontOrBack
|
||||
bl HandleLoadSpecialPokePic_DontHandleDeoxys
|
||||
_0807ADB2:
|
||||
mov r0, r8
|
||||
bl sub_806E794
|
||||
@ -10373,7 +10373,7 @@ _0807CCEE:
|
||||
ldr r1, [r1]
|
||||
ldr r1, [r1, 0x10]
|
||||
ldr r3, [r3, 0x6C]
|
||||
bl DecompressMonPic_DetectFrontOrBack_2
|
||||
bl HandleLoadSpecialPokePic_2
|
||||
ldr r1, [r7]
|
||||
b _0807CF4C
|
||||
.pool
|
||||
@ -12478,7 +12478,7 @@ _0807E13A:
|
||||
ldr r1, [r1]
|
||||
ldr r1, [r1, 0x10]
|
||||
ldr r3, [r3, 0x6C]
|
||||
bl DecompressMonPic_DetectFrontOrBack_2
|
||||
bl HandleLoadSpecialPokePic_2
|
||||
ldr r1, [r7]
|
||||
b _0807E398
|
||||
.pool
|
||||
|
17
include/decompress.h
Normal file
17
include/decompress.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef GUARD_DECOMPRESS_H
|
||||
#define GUARD_DECOMPRESS_H
|
||||
|
||||
#include "sprite.h"
|
||||
|
||||
void LZDecompressWram(const void *src, void *dest);
|
||||
void LZDecompressVram(const void *src, void *dest);
|
||||
u16 LoadCompressedObjectPic(const struct CompressedSpriteSheet *src);
|
||||
void LoadCompressedObjectPicOverrideBuffer(const struct CompressedSpriteSheet *src, void *buffer);
|
||||
void LoadCompressedObjectPalette(const struct CompressedSpritePalette *src);
|
||||
void LoadCompressedObjectPaletteOverrideBuffer(const struct CompressedSpritePalette *a, void *buffer);
|
||||
void DecompressPicFromTable(const struct CompressedSpriteSheet *src, void* buffer, s32 species);
|
||||
void HandleLoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality);
|
||||
void LoadSpecialPokePic_2(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic);
|
||||
void LoadSpecialPokePic_DontHandleDeoxys(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic);
|
||||
|
||||
#endif // GUARD_DECOMPRESS_H
|
@ -9,13 +9,10 @@ SECTIONS {
|
||||
ewram (NOLOAD) :
|
||||
ALIGN(4)
|
||||
{
|
||||
gHeap = .;
|
||||
|
||||
. = 0x20000;
|
||||
|
||||
<EWRAM>
|
||||
|
||||
. = 0x40000;
|
||||
. = 0x60000;
|
||||
}
|
||||
|
||||
. = 0x3000000;
|
||||
@ -55,7 +52,7 @@ SECTIONS {
|
||||
asm/rtc.o(.text);
|
||||
asm/main_menu.o(.text);
|
||||
asm/rom3.o(.text);
|
||||
asm/decompress.o(.text);
|
||||
src/decompress.o(.text);
|
||||
asm/rom_8034C54.o(.text);
|
||||
asm/battle_3.o(.text);
|
||||
asm/battle_4.o(.text);
|
||||
|
597
src/decompress.c
Normal file
597
src/decompress.c
Normal file
@ -0,0 +1,597 @@
|
||||
#include "global.h"
|
||||
#include "decompress.h"
|
||||
#include "species.h"
|
||||
#include "text.h"
|
||||
#include "malloc.h"
|
||||
|
||||
EWRAM_DATA ALIGNED(4) u8 gDecompressionBuffer[0x4000] = {0};
|
||||
|
||||
extern const struct CompressedSpriteSheet gMonFrontPicTable[];
|
||||
extern const struct CompressedSpriteSheet gMonBackPicTable[];
|
||||
|
||||
extern void DrawSpindaSpots(u16 species, u32 personality, void* dest, bool8 isFrontPic);
|
||||
|
||||
static void DuplicateDeoxysTiles(void *pointer, s32 species);
|
||||
|
||||
void LZDecompressWram(const void *src, void *dest)
|
||||
{
|
||||
LZ77UnCompWram(src, dest);
|
||||
}
|
||||
|
||||
void LZDecompressVram(const void *src, void *dest)
|
||||
{
|
||||
LZ77UnCompVram(src, dest);
|
||||
}
|
||||
|
||||
u16 LoadCompressedObjectPic(const struct CompressedSpriteSheet *src)
|
||||
{
|
||||
struct SpriteSheet dest;
|
||||
|
||||
LZ77UnCompWram(src->data, gDecompressionBuffer);
|
||||
dest.data = gDecompressionBuffer;
|
||||
dest.size = src->size;
|
||||
dest.tag = src->tag;
|
||||
return LoadSpriteSheet(&dest);
|
||||
}
|
||||
|
||||
void LoadCompressedObjectPicOverrideBuffer(const struct CompressedSpriteSheet *src, void *buffer)
|
||||
{
|
||||
struct SpriteSheet dest;
|
||||
|
||||
LZ77UnCompWram(src->data, buffer);
|
||||
dest.data = buffer;
|
||||
dest.size = src->size;
|
||||
dest.tag = src->tag;
|
||||
LoadSpriteSheet(&dest);
|
||||
}
|
||||
|
||||
void LoadCompressedObjectPalette(const struct CompressedSpritePalette *src)
|
||||
{
|
||||
struct SpritePalette dest;
|
||||
|
||||
LZ77UnCompWram(src->data, gDecompressionBuffer);
|
||||
dest.data = (void*) gDecompressionBuffer;
|
||||
dest.tag = src->tag;
|
||||
LoadSpritePalette(&dest);
|
||||
}
|
||||
|
||||
void LoadCompressedObjectPaletteOverrideBuffer(const struct CompressedSpritePalette *a, void *buffer)
|
||||
{
|
||||
struct SpritePalette dest;
|
||||
|
||||
LZ77UnCompWram(a->data, buffer);
|
||||
dest.data = buffer;
|
||||
dest.tag = a->tag;
|
||||
LoadSpritePalette(&dest);
|
||||
}
|
||||
|
||||
void DecompressPicFromTable(const struct CompressedSpriteSheet *src, void* buffer, s32 species)
|
||||
{
|
||||
if (species > SPECIES_EGG)
|
||||
LZ77UnCompWram(gMonFrontPicTable[0].data, buffer);
|
||||
else
|
||||
LZ77UnCompWram(src->data, buffer);
|
||||
DuplicateDeoxysTiles(buffer, species);
|
||||
}
|
||||
|
||||
void HandleLoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality)
|
||||
{
|
||||
bool8 isFrontPic;
|
||||
|
||||
if (src == &gMonFrontPicTable[species])
|
||||
isFrontPic = TRUE; // frontPic
|
||||
else
|
||||
isFrontPic = FALSE; // backPic
|
||||
|
||||
LoadSpecialPokePic_2(src, dest, species, personality, isFrontPic);
|
||||
}
|
||||
|
||||
void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic)
|
||||
{
|
||||
if (species == SPECIES_UNOWN)
|
||||
{
|
||||
u16 i = (((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 3)) % 0x1C;
|
||||
|
||||
// The other Unowns are separate from Unown A.
|
||||
if (i == 0)
|
||||
i = SPECIES_UNOWN;
|
||||
else
|
||||
i += SPECIES_UNOWN_B - 1;
|
||||
|
||||
if (!isFrontPic)
|
||||
LZ77UnCompWram(gMonBackPicTable[i].data, dest);
|
||||
else
|
||||
LZ77UnCompWram(gMonFrontPicTable[i].data, dest);
|
||||
}
|
||||
else if (species > SPECIES_EGG) // is species unknown? draw the ? icon
|
||||
LZ77UnCompWram(gMonFrontPicTable[0].data, dest);
|
||||
else
|
||||
LZ77UnCompWram(src->data, dest);
|
||||
|
||||
DuplicateDeoxysTiles(dest, species);
|
||||
DrawSpindaSpots(species, personality, dest, isFrontPic);
|
||||
}
|
||||
|
||||
void Unused_LZDecompressWramIndirect(const void **src, void *dest)
|
||||
{
|
||||
LZ77UnCompWram(*src, dest);
|
||||
}
|
||||
|
||||
// This one (unused) function is really challenging, won't even try to decompile it.
|
||||
__attribute__((naked))
|
||||
void sub_803471C()
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
push {r4-r7,lr}\n\
|
||||
mov r7, r10\n\
|
||||
mov r6, r9\n\
|
||||
mov r5, r8\n\
|
||||
push {r5-r7}\n\
|
||||
sub sp, 0x24\n\
|
||||
mov r9, r0\n\
|
||||
str r1, [sp]\n\
|
||||
str r2, [sp, 0x4]\n\
|
||||
adds r5, r3, 0\n\
|
||||
movs r0, 0x1\n\
|
||||
mov r1, r9\n\
|
||||
ands r0, r1\n\
|
||||
cmp r0, 0\n\
|
||||
bne _0803473C\n\
|
||||
b _080348D4\n\
|
||||
_0803473C:\n\
|
||||
asrs r0, r1, 1\n\
|
||||
adds r0, 0x4\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r0, 24\n\
|
||||
str r0, [sp, 0x8]\n\
|
||||
movs r0, 0\n\
|
||||
ldr r2, [sp]\n\
|
||||
cmp r0, r2\n\
|
||||
blt _08034750\n\
|
||||
b _08034964\n\
|
||||
_08034750:\n\
|
||||
movs r4, 0x8\n\
|
||||
subs r1, r4, r1\n\
|
||||
str r1, [sp, 0x10]\n\
|
||||
_08034756:\n\
|
||||
movs r7, 0\n\
|
||||
adds r0, 0x1\n\
|
||||
str r0, [sp, 0x14]\n\
|
||||
ldr r0, [sp, 0x10]\n\
|
||||
cmp r7, r0\n\
|
||||
bge _080347D2\n\
|
||||
ldr r1, [sp, 0x8]\n\
|
||||
lsls r1, 8\n\
|
||||
str r1, [sp, 0x18]\n\
|
||||
movs r2, 0\n\
|
||||
mov r10, r2\n\
|
||||
mov r0, r9\n\
|
||||
movs r4, 0x8\n\
|
||||
subs r0, r4, r0\n\
|
||||
str r0, [sp, 0xC]\n\
|
||||
_08034774:\n\
|
||||
movs r3, 0\n\
|
||||
asrs r0, r7, 1\n\
|
||||
adds r1, r7, 0\n\
|
||||
movs r2, 0x1\n\
|
||||
ands r1, r2\n\
|
||||
str r1, [sp, 0x20]\n\
|
||||
lsls r0, 8\n\
|
||||
mov r8, r0\n\
|
||||
mov r12, r5\n\
|
||||
_08034786:\n\
|
||||
lsls r1, r3, 5\n\
|
||||
ldr r4, [sp, 0x18]\n\
|
||||
adds r0, r5, r4\n\
|
||||
adds r0, r1\n\
|
||||
mov r1, r8\n\
|
||||
adds r2, r0, r1\n\
|
||||
mov r1, r12\n\
|
||||
add r1, r8\n\
|
||||
movs r6, 0xF\n\
|
||||
_08034798:\n\
|
||||
ldr r4, [sp, 0x20]\n\
|
||||
cmp r4, 0\n\
|
||||
bne _080347A8\n\
|
||||
strb r4, [r1]\n\
|
||||
add r4, sp, 0x20\n\
|
||||
ldrb r4, [r4]\n\
|
||||
strb r4, [r2, 0x10]\n\
|
||||
b _080347B6\n\
|
||||
_080347A8:\n\
|
||||
mov r0, r10\n\
|
||||
strb r0, [r1, 0x10]\n\
|
||||
movs r4, 0x80\n\
|
||||
lsls r4, 1\n\
|
||||
adds r4, r2, r4\n\
|
||||
str r4, [sp, 0x1C]\n\
|
||||
strb r0, [r4]\n\
|
||||
_080347B6:\n\
|
||||
adds r2, 0x1\n\
|
||||
adds r1, 0x1\n\
|
||||
subs r6, 0x1\n\
|
||||
cmp r6, 0\n\
|
||||
bge _08034798\n\
|
||||
movs r0, 0x20\n\
|
||||
add r12, r0\n\
|
||||
adds r3, 0x1\n\
|
||||
cmp r3, 0x7\n\
|
||||
ble _08034786\n\
|
||||
adds r7, 0x1\n\
|
||||
ldr r1, [sp, 0xC]\n\
|
||||
cmp r7, r1\n\
|
||||
blt _08034774\n\
|
||||
_080347D2:\n\
|
||||
movs r7, 0\n\
|
||||
movs r2, 0\n\
|
||||
_080347D6:\n\
|
||||
movs r6, 0\n\
|
||||
adds r4, r7, 0x1\n\
|
||||
mov r8, r4\n\
|
||||
lsls r4, r7, 5\n\
|
||||
_080347DE:\n\
|
||||
adds r0, r6, 0x1\n\
|
||||
mov r10, r0\n\
|
||||
lsls r1, r6, 8\n\
|
||||
adds r0, r1, 0\n\
|
||||
adds r0, 0xC0\n\
|
||||
adds r0, r5, r0\n\
|
||||
adds r0, r4\n\
|
||||
adds r1, r5, r1\n\
|
||||
adds r1, r4\n\
|
||||
movs r3, 0x1F\n\
|
||||
_080347F2:\n\
|
||||
strb r2, [r1]\n\
|
||||
strb r2, [r0]\n\
|
||||
adds r0, 0x1\n\
|
||||
adds r1, 0x1\n\
|
||||
subs r3, 0x1\n\
|
||||
cmp r3, 0\n\
|
||||
bge _080347F2\n\
|
||||
mov r6, r10\n\
|
||||
cmp r6, 0x7\n\
|
||||
ble _080347DE\n\
|
||||
mov r7, r8\n\
|
||||
cmp r7, 0x1\n\
|
||||
ble _080347D6\n\
|
||||
mov r1, r9\n\
|
||||
cmp r1, 0x5\n\
|
||||
bne _08034818\n\
|
||||
movs r2, 0x90\n\
|
||||
lsls r2, 1\n\
|
||||
adds r5, r2\n\
|
||||
_08034818:\n\
|
||||
movs r7, 0\n\
|
||||
cmp r7, r9\n\
|
||||
bge _080348AE\n\
|
||||
_0803481E:\n\
|
||||
movs r3, 0\n\
|
||||
adds r7, 0x1\n\
|
||||
mov r8, r7\n\
|
||||
cmp r3, r9\n\
|
||||
bge _0803488E\n\
|
||||
_08034828:\n\
|
||||
adds r3, 0x1\n\
|
||||
mov r10, r3\n\
|
||||
ldr r4, [sp, 0x4]\n\
|
||||
adds r4, 0x20\n\
|
||||
adds r7, r5, 0\n\
|
||||
adds r7, 0x20\n\
|
||||
movs r0, 0x12\n\
|
||||
adds r0, r5\n\
|
||||
mov r12, r0\n\
|
||||
ldr r2, [sp, 0x4]\n\
|
||||
adds r3, r5, 0\n\
|
||||
movs r6, 0x3\n\
|
||||
_08034840:\n\
|
||||
ldrb r0, [r2]\n\
|
||||
mov r1, r12\n\
|
||||
strb r0, [r1]\n\
|
||||
ldrb r0, [r2, 0x1]\n\
|
||||
strb r0, [r1, 0x1]\n\
|
||||
ldrb r0, [r2, 0x2]\n\
|
||||
strb r0, [r1, 0x1E]\n\
|
||||
ldrb r0, [r2, 0x3]\n\
|
||||
strb r0, [r1, 0x1F]\n\
|
||||
movs r0, 0x81\n\
|
||||
lsls r0, 1\n\
|
||||
adds r1, r3, r0\n\
|
||||
ldrb r0, [r2, 0x10]\n\
|
||||
strb r0, [r1]\n\
|
||||
ldr r0, =0x00000103\n\
|
||||
adds r1, r3, r0\n\
|
||||
ldrb r0, [r2, 0x11]\n\
|
||||
strb r0, [r1]\n\
|
||||
movs r0, 0x90\n\
|
||||
lsls r0, 1\n\
|
||||
adds r1, r3, r0\n\
|
||||
ldrb r0, [r2, 0x12]\n\
|
||||
strb r0, [r1]\n\
|
||||
ldr r0, =0x00000121\n\
|
||||
adds r1, r3, r0\n\
|
||||
ldrb r0, [r2, 0x13]\n\
|
||||
strb r0, [r1]\n\
|
||||
movs r1, 0x4\n\
|
||||
add r12, r1\n\
|
||||
adds r2, 0x4\n\
|
||||
adds r3, 0x4\n\
|
||||
subs r6, 0x1\n\
|
||||
cmp r6, 0\n\
|
||||
bge _08034840\n\
|
||||
str r4, [sp, 0x4]\n\
|
||||
adds r5, r7, 0\n\
|
||||
mov r3, r10\n\
|
||||
cmp r3, r9\n\
|
||||
blt _08034828\n\
|
||||
_0803488E:\n\
|
||||
mov r2, r9\n\
|
||||
cmp r2, 0x7\n\
|
||||
bne _080348A0\n\
|
||||
adds r5, 0x20\n\
|
||||
b _080348A8\n\
|
||||
.pool\n\
|
||||
_080348A0:\n\
|
||||
mov r4, r9\n\
|
||||
cmp r4, 0x5\n\
|
||||
bne _080348A8\n\
|
||||
adds r5, 0x60\n\
|
||||
_080348A8:\n\
|
||||
mov r7, r8\n\
|
||||
cmp r7, r9\n\
|
||||
blt _0803481E\n\
|
||||
_080348AE:\n\
|
||||
mov r0, r9\n\
|
||||
cmp r0, 0x7\n\
|
||||
bne _080348BC\n\
|
||||
movs r1, 0x80\n\
|
||||
lsls r1, 1\n\
|
||||
adds r5, r1\n\
|
||||
b _080348C8\n\
|
||||
_080348BC:\n\
|
||||
mov r2, r9\n\
|
||||
cmp r2, 0x5\n\
|
||||
bne _080348C8\n\
|
||||
movs r4, 0xF0\n\
|
||||
lsls r4, 1\n\
|
||||
adds r5, r4\n\
|
||||
_080348C8:\n\
|
||||
ldr r0, [sp, 0x14]\n\
|
||||
ldr r1, [sp]\n\
|
||||
cmp r0, r1\n\
|
||||
bge _080348D2\n\
|
||||
b _08034756\n\
|
||||
_080348D2:\n\
|
||||
b _08034964\n\
|
||||
_080348D4:\n\
|
||||
movs r6, 0\n\
|
||||
ldr r2, [sp]\n\
|
||||
cmp r6, r2\n\
|
||||
bge _08034964\n\
|
||||
_080348DC:\n\
|
||||
adds r6, 0x1\n\
|
||||
mov r10, r6\n\
|
||||
mov r4, r9\n\
|
||||
cmp r4, 0x6\n\
|
||||
bne _080348F4\n\
|
||||
movs r0, 0\n\
|
||||
movs r3, 0xFF\n\
|
||||
_080348EA:\n\
|
||||
strb r0, [r5]\n\
|
||||
adds r5, 0x1\n\
|
||||
subs r3, 0x1\n\
|
||||
cmp r3, 0\n\
|
||||
bge _080348EA\n\
|
||||
_080348F4:\n\
|
||||
movs r7, 0\n\
|
||||
cmp r7, r9\n\
|
||||
bge _08034948\n\
|
||||
_080348FA:\n\
|
||||
adds r7, 0x1\n\
|
||||
mov r8, r7\n\
|
||||
mov r1, r9\n\
|
||||
lsls r0, r1, 5\n\
|
||||
cmp r1, 0x6\n\
|
||||
bne _08034914\n\
|
||||
movs r1, 0\n\
|
||||
movs r3, 0x1F\n\
|
||||
_0803490A:\n\
|
||||
strb r1, [r5]\n\
|
||||
adds r5, 0x1\n\
|
||||
subs r3, 0x1\n\
|
||||
cmp r3, 0\n\
|
||||
bge _0803490A\n\
|
||||
_08034914:\n\
|
||||
adds r1, r0, 0\n\
|
||||
cmp r1, 0\n\
|
||||
ble _0803492E\n\
|
||||
adds r3, r1, 0\n\
|
||||
_0803491C:\n\
|
||||
ldr r2, [sp, 0x4]\n\
|
||||
ldrb r0, [r2]\n\
|
||||
strb r0, [r5]\n\
|
||||
adds r2, 0x1\n\
|
||||
str r2, [sp, 0x4]\n\
|
||||
adds r5, 0x1\n\
|
||||
subs r3, 0x1\n\
|
||||
cmp r3, 0\n\
|
||||
bne _0803491C\n\
|
||||
_0803492E:\n\
|
||||
mov r4, r9\n\
|
||||
cmp r4, 0x6\n\
|
||||
bne _08034942\n\
|
||||
movs r0, 0\n\
|
||||
movs r3, 0x1F\n\
|
||||
_08034938:\n\
|
||||
strb r0, [r5]\n\
|
||||
adds r5, 0x1\n\
|
||||
subs r3, 0x1\n\
|
||||
cmp r3, 0\n\
|
||||
bge _08034938\n\
|
||||
_08034942:\n\
|
||||
mov r7, r8\n\
|
||||
cmp r7, r9\n\
|
||||
blt _080348FA\n\
|
||||
_08034948:\n\
|
||||
mov r0, r9\n\
|
||||
cmp r0, 0x6\n\
|
||||
bne _0803495C\n\
|
||||
movs r0, 0\n\
|
||||
movs r3, 0xFF\n\
|
||||
_08034952:\n\
|
||||
strb r0, [r5]\n\
|
||||
adds r5, 0x1\n\
|
||||
subs r3, 0x1\n\
|
||||
cmp r3, 0\n\
|
||||
bge _08034952\n\
|
||||
_0803495C:\n\
|
||||
mov r6, r10\n\
|
||||
ldr r1, [sp]\n\
|
||||
cmp r6, r1\n\
|
||||
blt _080348DC\n\
|
||||
_08034964:\n\
|
||||
add sp, 0x24\n\
|
||||
pop {r3-r5}\n\
|
||||
mov r8, r3\n\
|
||||
mov r9, r4\n\
|
||||
mov r10, r5\n\
|
||||
pop {r4-r7}\n\
|
||||
pop {r0}\n\
|
||||
bx r0\n\
|
||||
.syntax divided");
|
||||
}
|
||||
|
||||
u32 sub_8034974(void* ptr)
|
||||
{
|
||||
u8* ptr_ = (u8*)(ptr);
|
||||
return (ptr_[3] << 16) | (ptr_[2] << 8) | (ptr_[1]);
|
||||
}
|
||||
|
||||
bool8 LoadCompressedObjectPicUsingHeap(struct CompressedSpriteSheet* src)
|
||||
{
|
||||
struct SpriteSheet dest;
|
||||
void* buffer;
|
||||
|
||||
buffer = AllocZeroed(*((u32*)(&src->data[0])) >> 8);
|
||||
LZ77UnCompWram(src->data, buffer);
|
||||
|
||||
dest.data = buffer;
|
||||
dest.size = src->size;
|
||||
dest.tag = src->tag;
|
||||
|
||||
LoadSpriteSheet(&dest);
|
||||
Free(buffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 LoadCompressedObjectPaletteUsingHeap(const struct CompressedSpritePalette *src)
|
||||
{
|
||||
struct SpritePalette dest;
|
||||
void* buffer;
|
||||
|
||||
buffer = AllocZeroed(*((u32*)(&src->data[0])) >> 8);
|
||||
LZ77UnCompWram(src->data, buffer);
|
||||
dest.data = buffer;
|
||||
dest.tag = src->tag;
|
||||
|
||||
LoadSpritePalette(&dest);
|
||||
Free(buffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void DecompressPicFromTable_2(const struct CompressedSpriteSheet *src, void* buffer, s32 species) // a copy of DecompressPicFromTable
|
||||
{
|
||||
if (species > SPECIES_EGG)
|
||||
LZ77UnCompWram(gMonFrontPicTable[0].data, buffer);
|
||||
else
|
||||
LZ77UnCompWram(src->data, buffer);
|
||||
DuplicateDeoxysTiles(buffer, species);
|
||||
}
|
||||
|
||||
void LoadSpecialPokePic_2(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic) // a copy of LoadSpecialPokePic
|
||||
{
|
||||
if (species == SPECIES_UNOWN)
|
||||
{
|
||||
u16 i = (((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 3)) % 0x1C;
|
||||
|
||||
// The other Unowns are separate from Unown A.
|
||||
if (i == 0)
|
||||
i = SPECIES_UNOWN;
|
||||
else
|
||||
i += SPECIES_UNOWN_B - 1;
|
||||
|
||||
if (!isFrontPic)
|
||||
LZ77UnCompWram(gMonBackPicTable[i].data, dest);
|
||||
else
|
||||
LZ77UnCompWram(gMonFrontPicTable[i].data, dest);
|
||||
}
|
||||
else if (species > SPECIES_EGG) // is species unknown? draw the ? icon
|
||||
LZ77UnCompWram(gMonFrontPicTable[0].data, dest);
|
||||
else
|
||||
LZ77UnCompWram(src->data, dest);
|
||||
|
||||
DuplicateDeoxysTiles(dest, species);
|
||||
DrawSpindaSpots(species, personality, dest, isFrontPic);
|
||||
}
|
||||
|
||||
void HandleLoadSpecialPokePic_2(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality) // a copy of HandleLoadSpecialPokePic
|
||||
{
|
||||
bool8 isFrontPic;
|
||||
|
||||
if (src == &gMonFrontPicTable[species])
|
||||
isFrontPic = TRUE; // frontPic
|
||||
else
|
||||
isFrontPic = FALSE; // backPic
|
||||
|
||||
LoadSpecialPokePic_2(src, dest, species, personality, isFrontPic);
|
||||
}
|
||||
|
||||
void DecompressPicFromTable_DontHandleDeoxys(const struct CompressedSpriteSheet *src, void* buffer, s32 species) // a copy of DecompressPicFromTable
|
||||
{
|
||||
if (species > SPECIES_EGG)
|
||||
LZ77UnCompWram(gMonFrontPicTable[0].data, buffer);
|
||||
else
|
||||
LZ77UnCompWram(src->data, buffer);
|
||||
}
|
||||
|
||||
void HandleLoadSpecialPokePic_DontHandleDeoxys(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality) // a copy of HandleLoadSpecialPokePic
|
||||
{
|
||||
bool8 isFrontPic;
|
||||
|
||||
if (src == &gMonFrontPicTable[species])
|
||||
isFrontPic = TRUE; // frontPic
|
||||
else
|
||||
isFrontPic = FALSE; // backPic
|
||||
|
||||
LoadSpecialPokePic_DontHandleDeoxys(src, dest, species, personality, isFrontPic);
|
||||
}
|
||||
|
||||
void LoadSpecialPokePic_DontHandleDeoxys(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic) // a copy of LoadSpecialPokePic
|
||||
{
|
||||
if (species == SPECIES_UNOWN)
|
||||
{
|
||||
u16 i = (((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 3)) % 0x1C;
|
||||
|
||||
// The other Unowns are separate from Unown A.
|
||||
if (i == 0)
|
||||
i = SPECIES_UNOWN;
|
||||
else
|
||||
i += SPECIES_UNOWN_B - 1;
|
||||
|
||||
if (!isFrontPic)
|
||||
LZ77UnCompWram(gMonBackPicTable[i].data, dest);
|
||||
else
|
||||
LZ77UnCompWram(gMonFrontPicTable[i].data, dest);
|
||||
}
|
||||
else if (species > SPECIES_EGG) // is species unknown? draw the ? icon
|
||||
LZ77UnCompWram(gMonFrontPicTable[0].data, dest);
|
||||
else
|
||||
LZ77UnCompWram(src->data, dest);
|
||||
|
||||
DrawSpindaSpots(species, personality, dest, isFrontPic);
|
||||
}
|
||||
|
||||
static void DuplicateDeoxysTiles(void *pointer, s32 species)
|
||||
{
|
||||
if (species == SPECIES_DEOXYS)
|
||||
CpuCopy32(pointer + 0x800, pointer, 0x800);
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
#include "global.h"
|
||||
|
||||
EWRAM_DATA u8 gHeap[0x1C000] = {0};
|
||||
|
||||
static void *sHeapStart;
|
||||
static u32 sHeapSize;
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
.include "src/malloc.o"
|
||||
.include "src/decompress.o"
|
||||
|
||||
gTrainerId: @ 2020000
|
||||
.space 0x4
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user