From e7ea49dc389fde77b9f515c4fc3bebc3fa37b1d1 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Thu, 5 Jan 2017 17:08:36 -0600 Subject: decompile up to sub_813D584 --- include/sprite.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'include/sprite.h') diff --git a/include/sprite.h b/include/sprite.h index 57926fc68..3c8da394f 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -130,13 +130,13 @@ struct SpriteTemplate struct Sprite { - struct OamData oam; - union AnimCmd **anims; - struct SpriteFrameImage *images; - union AffineAnimCmd **affineAnims; - const struct SpriteTemplate *template; - struct SubspriteTable *subspriteTables; - void (*callback)(struct Sprite *); + /*0x00*/ struct OamData oam; + /*0x08*/ union AnimCmd **anims; + /*0x0C*/ struct SpriteFrameImage *images; + /*0x10*/ union AffineAnimCmd **affineAnims; + /*0x14*/ const struct SpriteTemplate *template; + /*0x18*/ struct SubspriteTable *subspriteTables; + /*0x1C*/ void (*callback)(struct Sprite *); /*0x20*/ struct Coords16 pos1; /*0x24*/ struct Coords16 pos2; -- cgit v1.2.3 From b6b9ebd3ee7b4cfce12f0b062bdd65a70b0ee45a Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Fri, 6 Jan 2017 20:32:46 -0600 Subject: decompile more intro functions --- include/sprite.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/sprite.h') diff --git a/include/sprite.h b/include/sprite.h index 3c8da394f..13d94e9f3 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -179,10 +179,10 @@ struct Sprite /*0x40*/ u16 sheetTileStart; - u8 subspriteTableNum:6; - u8 subspriteMode:2; + /*0x42*/ u8 subspriteTableNum:6; + u8 subspriteMode:2; - u8 subpriority; + /*0x43*/ u8 subpriority; }; extern s16 gSpriteCoordOffsetX; -- cgit v1.2.3 From 9442bdcbf3abf3e44d2829ec72bfe23649c7d8ac Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Tue, 24 Jan 2017 22:31:44 -0600 Subject: decompile more of naming_screen (#216) * decompile more code * incbin graphics data * decompile more code --- include/sprite.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include/sprite.h') diff --git a/include/sprite.h b/include/sprite.h index 13d94e9f3..447a8decb 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -135,7 +135,7 @@ struct Sprite /*0x0C*/ struct SpriteFrameImage *images; /*0x10*/ union AffineAnimCmd **affineAnims; /*0x14*/ const struct SpriteTemplate *template; - /*0x18*/ struct SubspriteTable *subspriteTables; + /*0x18*/ const struct SubspriteTable *subspriteTables; /*0x1C*/ void (*callback)(struct Sprite *); /*0x20*/ struct Coords16 pos1; @@ -227,14 +227,14 @@ u16 LoadSpriteSheet(struct SpriteSheet *sheet); void LoadSpriteSheets(struct SpriteSheet *sheets); u16 AllocTilesForSpriteSheet(struct SpriteSheet *sheet); void AllocTilesForSpriteSheets(struct SpriteSheet *sheets); -void LoadTilesForSpriteSheet(struct SpriteSheet *sheet); +void LoadTilesForSpriteSheet(const struct SpriteSheet *sheet); void LoadTilesForSpriteSheets(struct SpriteSheet *sheets); void FreeSpriteTilesByTag(u16 tag); void FreeSpriteTileRanges(void); u16 GetSpriteTileStartByTag(u16 tag); u16 GetSpriteTileTagByTileStart(u16 start); -void RequestSpriteSheetCopy(struct SpriteSheet *sheet); -u16 LoadSpriteSheetDeferred(struct SpriteSheet *sheet); +void RequestSpriteSheetCopy(const struct SpriteSheet *sheet); +u16 LoadSpriteSheetDeferred(const struct SpriteSheet *sheet); void FreeAllSpritePalettes(void); u8 LoadSpritePalette(const struct SpritePalette *palette); void LoadSpritePalettes(const struct SpritePalette *palettes); @@ -242,7 +242,7 @@ u8 AllocSpritePalette(u16 tag); u8 IndexOfSpritePaletteTag(u16 tag); u16 GetSpritePaletteTagByPaletteNum(u8 paletteNum); void FreeSpritePaletteByTag(u16 tag); -void SetSubspriteTables(struct Sprite *sprite, struct SubspriteTable *subspriteTables); +void SetSubspriteTables(struct Sprite *sprite, const struct SubspriteTable *subspriteTables); bool8 AddSpriteToOamBuffer(struct Sprite *object, u8 *oamIndex); bool8 AddSubspritesToOamBuffer(struct Sprite *sprite, struct OamData *destOam, u8 *oamIndex); void CopyToSprites(u8 *src); -- cgit v1.2.3 From 448acff16e53485c5cfb90983a7a1e1b4644c30b Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Thu, 26 Jan 2017 01:07:36 -0500 Subject: finish decompiling naming_screen (#217) * decompile more code * incbin graphics data * decompile more code * decompile more code * finish decompiling * name some functions and variables --- include/sprite.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/sprite.h') diff --git a/include/sprite.h b/include/sprite.h index 447a8decb..721616e9e 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -223,8 +223,8 @@ u8 AllocOamMatrix(void); void FreeOamMatrix(u8 matrixNum); void InitSpriteAffineAnim(struct Sprite *sprite); void SetOamMatrixRotationScaling(u8 matrixNum, s16 xScale, s16 yScale, u16 rotation); -u16 LoadSpriteSheet(struct SpriteSheet *sheet); -void LoadSpriteSheets(struct SpriteSheet *sheets); +u16 LoadSpriteSheet(const struct SpriteSheet *sheet); +void LoadSpriteSheets(const struct SpriteSheet *sheets); u16 AllocTilesForSpriteSheet(struct SpriteSheet *sheet); void AllocTilesForSpriteSheets(struct SpriteSheet *sheets); void LoadTilesForSpriteSheet(const struct SpriteSheet *sheet); -- cgit v1.2.3 From b9ff56bd89ac11a9b40b34f834dcf7a5be4d90a6 Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Fri, 27 Jan 2017 13:06:20 -0500 Subject: define more data in C (#219) * define some graphics data in C * define wild pokemon in C * use less #ifdefs * define data in berry.c --- include/sprite.h | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'include/sprite.h') diff --git a/include/sprite.h b/include/sprite.h index 721616e9e..7a2dd8494 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -5,7 +5,7 @@ struct SpriteSheet { - u8 *data; + const u8 *data; u16 size; u16 tag; }; @@ -18,7 +18,7 @@ struct SpriteFrameImage struct SpritePalette { - u16 *data; + const u16 *data; u16 tag; }; @@ -53,6 +53,13 @@ union AnimCmd struct AnimJumpCmd jump; }; +#define ANIMCMD_FRAME(_imageValue, _duration) \ + {.frame = {.imageValue = _imageValue, .duration = _duration}} +#define ANIMCMD_JUMP(_target) \ + {.jump = {.type = -2, .target = _target}} +#define ANIMCMD_END \ + {.type = -1} + struct AffineAnimFrameCmd { s16 xScale; @@ -61,6 +68,11 @@ struct AffineAnimFrameCmd u8 duration; }; +#define AFFINEANIMCMD_FRAME(_xScale, _yScale, _rotation, _duration) \ + {.frame = {.xScale = _xScale, .yScale = _yScale, .rotation = _rotation, .duration = _duration}} +#define AFFINEANIMCMD_END \ + {.type = 0x7FFF} + struct AffineAnimLoopCmd { s16 type; @@ -121,19 +133,19 @@ struct SpriteTemplate { u16 tileTag; u16 paletteTag; - struct OamData *oam; - union AnimCmd **anims; + const struct OamData *oam; + const union AnimCmd *const *anims; struct SpriteFrameImage *images; - union AffineAnimCmd **affineAnims; + const union AffineAnimCmd *const *affineAnims; void (*callback)(struct Sprite *); }; struct Sprite { /*0x00*/ struct OamData oam; - /*0x08*/ union AnimCmd **anims; + /*0x08*/ const union AnimCmd *const *anims; /*0x0C*/ struct SpriteFrameImage *images; - /*0x10*/ union AffineAnimCmd **affineAnims; + /*0x10*/ const union AffineAnimCmd *const *affineAnims; /*0x14*/ const struct SpriteTemplate *template; /*0x18*/ const struct SubspriteTable *subspriteTables; /*0x1C*/ void (*callback)(struct Sprite *); @@ -204,7 +216,7 @@ void SetOamMatrix(u8 matrixNum, u16 a, u16 b, u16 c, u16 d); void CalcCenterToCornerVec(struct Sprite *sprite, u8 shape, u8 size, u8 affineMode); void SpriteCallbackDummy(struct Sprite *sprite); void ProcessSpriteCopyRequests(void); -void RequestSpriteCopy(u8 *src, u8 *dest, u16 size); +void RequestSpriteCopy(const u8 *src, u8 *dest, u16 size); void FreeSpriteTiles(struct Sprite *sprite); void FreeSpritePalette(struct Sprite *sprite); void FreeSpriteOamMatrix(struct Sprite *sprite); @@ -249,4 +261,6 @@ void CopyToSprites(u8 *src); void CopyFromSprites(u8 *dest); u8 SpriteTileAllocBitmapOp(u16 bit, u8 op); +extern const union AffineAnimCmd *const gDummySpriteAffineAnimTable[]; + #endif // GUARD_SPRITE_H -- cgit v1.2.3 From b9f1143d3e9b32120cc62fcc7a822d3bca8ef976 Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Sat, 28 Jan 2017 01:31:09 -0500 Subject: define more data in C (#220) * define more data in C * correct typo in comments --- include/sprite.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'include/sprite.h') diff --git a/include/sprite.h b/include/sprite.h index 7a2dd8494..2725d0bab 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -45,6 +45,9 @@ struct AnimJumpCmd u32 target:6; }; +// The first halfword of this union specifies the type of command. +// If it -2, then it is a jump command. If it is -1, then it is the end of the script. +// Otherwise, it is the imageValue for a frame command. union AnimCmd { s16 type; @@ -53,8 +56,8 @@ union AnimCmd struct AnimJumpCmd jump; }; -#define ANIMCMD_FRAME(_imageValue, _duration) \ - {.frame = {.imageValue = _imageValue, .duration = _duration}} +#define ANIMCMD_FRAME(...) \ + {.frame = {__VA_ARGS__}} #define ANIMCMD_JUMP(_target) \ {.jump = {.type = -2, .target = _target}} #define ANIMCMD_END \ @@ -68,11 +71,6 @@ struct AffineAnimFrameCmd u8 duration; }; -#define AFFINEANIMCMD_FRAME(_xScale, _yScale, _rotation, _duration) \ - {.frame = {.xScale = _xScale, .yScale = _yScale, .rotation = _rotation, .duration = _duration}} -#define AFFINEANIMCMD_END \ - {.type = 0x7FFF} - struct AffineAnimLoopCmd { s16 type; @@ -93,6 +91,11 @@ union AffineAnimCmd struct AffineAnimJumpCmd jump; }; +#define AFFINEANIMCMD_FRAME(_xScale, _yScale, _rotation, _duration) \ + {.frame = {.xScale = _xScale, .yScale = _yScale, .rotation = _rotation, .duration = _duration}} +#define AFFINEANIMCMD_END \ + {.type = 0x7FFF} + struct AffineAnimState { u8 animNum; -- cgit v1.2.3 From 2c66ef8ef361de78f1b6529f177e299207d2006e Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Fri, 3 Feb 2017 01:04:43 -0600 Subject: decompile more code --- include/sprite.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/sprite.h') diff --git a/include/sprite.h b/include/sprite.h index 447a8decb..54b0fd76b 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -194,7 +194,7 @@ void ResetSpriteData(void); void AnimateSprites(void); void BuildOamBuffer(void); u8 CreateSprite(const struct SpriteTemplate *template, s16 x, s16 y, u8 subpriority); -u8 CreateSpriteAtEnd(const struct SpriteTemplate *template, u16 x, u16 y, u8 subpriority); +u8 CreateSpriteAtEnd(const struct SpriteTemplate *template, s16 x, s16 y, u8 subpriority); u8 CreateInvisibleSprite(void (*callback)(struct Sprite *)); u8 CreateSpriteAndAnimate(struct SpriteTemplate *template, s16 x, s16 y, u8 subpriority); void DestroySprite(struct Sprite *sprite); -- cgit v1.2.3 From 2afc20150b1cf5e9bcc8008c0323ac57af353718 Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Sat, 4 Feb 2017 21:47:11 -0600 Subject: decompile more of field_map_obj (#231) * decompile more code * decompile more of field_map_obj * decompile more of field_map_obj --- include/sprite.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/sprite.h') diff --git a/include/sprite.h b/include/sprite.h index 4e3074ebb..42620c9e9 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -147,7 +147,7 @@ struct Sprite { /*0x00*/ struct OamData oam; /*0x08*/ const union AnimCmd *const *anims; - /*0x0C*/ struct SpriteFrameImage *images; + /*0x0C*/ const struct SpriteFrameImage *images; /*0x10*/ const union AffineAnimCmd *const *affineAnims; /*0x14*/ const struct SpriteTemplate *template; /*0x18*/ const struct SubspriteTable *subspriteTables; @@ -200,6 +200,10 @@ struct Sprite /*0x43*/ u8 subpriority; }; +extern const struct OamData gDummyOamData; +extern const union AnimCmd *const gDummySpriteAnimTable[]; +extern const union AffineAnimCmd *const gDummySpriteAffineAnimTable[]; + extern s16 gSpriteCoordOffsetX; extern s16 gSpriteCoordOffsetY; -- cgit v1.2.3 From 218b9abd41fced633c28e15e3a000f18bfb1c0d4 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Wed, 3 May 2017 18:02:14 -0700 Subject: Struct_0202F7D4 -> AffineAnimCmd --- include/sprite.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'include/sprite.h') diff --git a/include/sprite.h b/include/sprite.h index 42620c9e9..bda635885 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -74,7 +74,7 @@ struct AffineAnimFrameCmd struct AffineAnimLoopCmd { s16 type; - u16 count; + s16 count; }; struct AffineAnimJumpCmd @@ -91,10 +91,14 @@ union AffineAnimCmd struct AffineAnimJumpCmd jump; }; +#define AFFINEANIMCMDTYPE_LOOP 0x7FFD +#define AFFINEANIMCMDTYPE_JUMP 0x7FFE +#define AFFINEANIMCMDTYPE_END 0x7FFF + #define AFFINEANIMCMD_FRAME(_xScale, _yScale, _rotation, _duration) \ {.frame = {.xScale = _xScale, .yScale = _yScale, .rotation = _rotation, .duration = _duration}} #define AFFINEANIMCMD_END \ - {.type = 0x7FFF} + {.type = AFFINEANIMCMDTYPE_END} struct AffineAnimState { -- cgit v1.2.3 From 28f5eee3737942c9779b6943fac6c30160efa3b8 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 12 Jun 2017 20:37:47 -0400 Subject: Convert data/field_effect.s to C --- include/sprite.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 include/sprite.h (limited to 'include/sprite.h') diff --git a/include/sprite.h b/include/sprite.h old mode 100644 new mode 100755 index bda635885..6bf7a38c5 --- a/include/sprite.h +++ b/include/sprite.h @@ -131,7 +131,7 @@ struct Subsprite struct SubspriteTable { u8 subspriteCount; - struct Subsprite *subsprites; + const struct Subsprite *subsprites; }; struct Sprite; @@ -142,7 +142,7 @@ struct SpriteTemplate u16 paletteTag; const struct OamData *oam; const union AnimCmd *const *anims; - struct SpriteFrameImage *images; + const struct SpriteFrameImage *images; const union AffineAnimCmd *const *affineAnims; void (*callback)(struct Sprite *); }; -- cgit v1.2.3 From 520514d47d13dd912ef649b0b24470bb0a1e8525 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 13 Jun 2017 08:43:43 -0400 Subject: data/decoration.s, 3 --- include/sprite.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) mode change 100644 => 100755 include/sprite.h (limited to 'include/sprite.h') diff --git a/include/sprite.h b/include/sprite.h old mode 100644 new mode 100755 index bda635885..13c03ab51 --- a/include/sprite.h +++ b/include/sprite.h @@ -16,6 +16,8 @@ struct SpriteFrameImage u16 size; }; +#define obj_frame_tiles(ptr) {.data = (u8 *)ptr, .size = sizeof ptr} + struct SpritePalette { const u16 *data; @@ -142,7 +144,7 @@ struct SpriteTemplate u16 paletteTag; const struct OamData *oam; const union AnimCmd *const *anims; - struct SpriteFrameImage *images; + const struct SpriteFrameImage *images; const union AffineAnimCmd *const *affineAnims; void (*callback)(struct Sprite *); }; -- cgit v1.2.3 From ae287a511fd1759fd7a666c43f68279d00da495d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 13 Jun 2017 19:19:58 -0400 Subject: File modes NotLikeThis --- include/sprite.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 include/sprite.h (limited to 'include/sprite.h') diff --git a/include/sprite.h b/include/sprite.h old mode 100755 new mode 100644 -- cgit v1.2.3 From 3d4c2f73cb19ef1f5215600c15272dd4d54c4fc0 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 14 Jun 2017 22:54:42 -0400 Subject: FILE MODES BrokeBack --- include/sprite.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 include/sprite.h (limited to 'include/sprite.h') diff --git a/include/sprite.h b/include/sprite.h old mode 100755 new mode 100644 -- cgit v1.2.3 From 33520725b88621ace3c66da55b92f2a83ffb4545 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 17 Jun 2017 17:09:22 -0400 Subject: Decompile all data in data/graphics/field_objects/*.inc --- include/sprite.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/sprite.h') diff --git a/include/sprite.h b/include/sprite.h index dd9d5efb7..aa86f9d31 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -60,6 +60,8 @@ union AnimCmd #define ANIMCMD_FRAME(...) \ {.frame = {__VA_ARGS__}} +#define ANIMCMD_LOOP(_count) \ + {.loop = {.type = -3, .count = _count}} #define ANIMCMD_JUMP(_target) \ {.jump = {.type = -2, .target = _target}} #define ANIMCMD_END \ @@ -101,6 +103,10 @@ union AffineAnimCmd {.frame = {.xScale = _xScale, .yScale = _yScale, .rotation = _rotation, .duration = _duration}} #define AFFINEANIMCMD_END \ {.type = AFFINEANIMCMDTYPE_END} +#define AFFINEANIMCMD_LOOP(_count) \ + {.loop = {.type = AFFINEANIMCMDTYPE_LOOP, .count = _count}} +#define AFFINEANIMCMD_JUMP(_target) \ + {.jump = {.type = AFFINEANIMCMDTYPE_JUMP, .target = _target}} struct AffineAnimState { -- cgit v1.2.3 From e072ddd6fbae8b303de546d0e9bd5ace2ecb20a1 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Mon, 19 Jun 2017 13:34:32 -0500 Subject: move data to C and introduce CompressedSpriteSheet and CompressedSpritePalette --- include/sprite.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'include/sprite.h') diff --git a/include/sprite.h b/include/sprite.h index dd9d5efb7..3f893132e 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -5,11 +5,18 @@ struct SpriteSheet { - const u8 *data; + const u8 *data; // Raw uncompressed pixel data u16 size; u16 tag; }; +struct CompressedSpriteSheet +{ + const u8 *data; // LZ77 compressed pixel data + u16 size; // Uncompressed size of pixel data + u16 tag; +}; + struct SpriteFrameImage { u8 *data; @@ -20,7 +27,13 @@ struct SpriteFrameImage struct SpritePalette { - const u16 *data; + const u16 *data; // Raw uncompressed palette data + u16 tag; +}; + +struct CompressedSpritePalette +{ + const u8 *data; // LZ77 compressed palette data u16 tag; }; @@ -99,6 +112,10 @@ union AffineAnimCmd #define AFFINEANIMCMD_FRAME(_xScale, _yScale, _rotation, _duration) \ {.frame = {.xScale = _xScale, .yScale = _yScale, .rotation = _rotation, .duration = _duration}} +#define AFFINEANIMCMD_LOOP(_count) \ + {.loop = {.type = AFFINEANIMCMDTYPE_LOOP, .count = _count}} +#define AFFINEANIMCMD_JUMP(_target) \ + {.jump = {.type = AFFINEANIMCMDTYPE_JUMP, .target = _target}} #define AFFINEANIMCMD_END \ {.type = AFFINEANIMCMDTYPE_END} -- cgit v1.2.3