Merge pull request #412 from ProjectRevoTPP/shop

finish decompiling shop.c
This commit is contained in:
Cameron Hall 2017-08-26 13:36:06 -05:00 committed by GitHub
commit 47e34a5ea3
10 changed files with 1138 additions and 2809 deletions

2613
asm/shop.s

File diff suppressed because it is too large Load Diff

View File

@ -1,69 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnknown_083CC6D0:: @ 83CC6D0
.4byte MartText_Buy, sub_80B2EFC
.4byte MartText_Sell, sub_80B2F30
.4byte MartText_Quit2, HandleShopMenuQuit
gUnknown_083CC6E8:: @ 83CC6E8
.byte 0, 1, 2
gUnknown_083CC6EB:: @ 83CC6EB
.byte 0, 2
@ unknown, unreferenced data
.align 1
.2byte 0x2
.2byte 0x3
.2byte 0x4
.2byte 0xD
.2byte 0x121
.2byte 0xE
.2byte 0xE
.2byte 0xE
.2byte 0xE
.2byte 0xE
.2byte 0xE
.2byte 0x0
.2byte 0x0
.align 2
gUnknown_083CC708:: @ 83CC708
.4byte sub_80B3BF4
.4byte sub_80B3D7C
.align 1
gUnknown_083CC710:: @ 83CC710
.2byte 0x41EE,0x7FFF
.align 1
gUnknown_083CC714:: @ 83CC714
.2byte 0x284,0x282,0x280
.align 1
gUnknown_083CC71A:: @ 83CC71A
.2byte 0x285,0x283,0x281
.align 1
gUnknown_083CC720:: @ 83CC720
.2byte 0x28C,0x28A,0x288
.align 1
gUnknown_083CC726:: @ 83CC726
.2byte 0x28D,0x28B,0x289
.align 1
gUnknown_083CC72C:: @ 83CC72C
.2byte 0x2A0,0x2A2,0x2A4
.align 1
gUnknown_083CC732:: @ 83CC732
.2byte 0x2A1,0x2A3,0x2A5
.align 1
gUnknown_083CC738:: @ 83CC738
.2byte 0x2A8,0x2AA,0x2AC

View File

@ -7,7 +7,7 @@ void sub_80B79E0(u32 *, u32);
void sub_80B79F8(u8 *buffer, u32 arg1, u8 arg2);
void sub_80B7A94(u32 arg0, u8 arg1, u8 x, u8 y);
void sub_80B7AEC(u32, u8 left, u8 top);
void sub_80B7B34(void);
void sub_80B7B34(u8, u8, int);
void sub_80B7BEC(u32, u8, u8);
void sub_80B7C14(u32, u8, u8);
void RemoveMoneyLabelObject(u8, u8);

View File

@ -1,6 +1,34 @@
#ifndef GUARD_SHOP_H
#define GUARD_SHOP_H
enum
{
MART_TYPE_0, // normal mart
MART_TYPE_1,
MART_TYPE_2,
};
// shop view window NPC info enum
enum
{
MAP_OBJ_ID,
X_COORD,
Y_COORD,
ANIM_NUM
};
struct MartInfo
{
/* 0x0 */ void (* callback) (void);
/* 0x4 */ u16 *itemList;
/* 0x8 */ u8 itemCount; // how many unique items are there for sale?
/* 0x9 */ u8 cursor; // this shows the on-screen true index of the cursor and not the current item selected.
/* 0xA */ u8 numChoices; // how many options does the mart have? can be either 2 or 1 (BUY/SELL vs BUY)
/* 0xB */ u8 choicesAbove; // when your cursor is far down, there are choices that have scrolled up past the top. this is the count of that.
/* 0xC */ u8 martType; // 0-2. 0 is normal mart while 1-2 seem to be decor shops or non-stackable purchases in general.
/* 0xD */ u8 curItemCount; // if you are selling an item, this is the count of the current item stack you have.
};
void sub_80B2E38(u8);
void HandleShopMenuQuit(u8);
void sub_80B2FA0(u8);
@ -11,8 +39,10 @@ void BuyMenuDrawMapGraphics(void);
void sub_80B3764(int, int);
void sub_80B37EC(void);
void sub_80B40E8(u8);
void CreatePokemartMenu(void *);
void CreateDecorationShop1Menu(void *);
void CreateDecorationShop2Menu(void *);
void CreatePokemartMenu(u16 *);
void CreateDecorationShop1Menu(u16 *);
void CreateDecorationShop2Menu(u16 *);
void sub_80B356C(void);
void sub_80B368C(void);
#endif // GUARD_SHOP_H

View File

@ -97,35 +97,35 @@ struct WindowConfig
struct Window
{
u8 textMode;
u8 fontNum;
u8 language;
u8 foregroundColor;
u8 backgroundColor;
u8 shadowColor;
u8 paletteNum;
u8 tilemapLeft;
u8 tilemapTop;
u8 width;
u8 height;
u8 win_field_B;
u8 win_field_C;
u8 delayCounter;
u8 spacing;
u8 win_field_F;
u8 cursorX;
u8 cursorY;
u8 left;
u16 top;
u16 state;
u16 downArrowCounter;
u16 tileDataStartOffset;
u16 tileDataOffset;
u16 textIndex;
const u8 *text;
u8 *tileData;
u16 *tilemap;
struct WindowConfig *config;
/*0x00*/ u8 textMode;
/*0x01*/ u8 fontNum;
/*0x02*/ u8 language;
/*0x03*/ u8 foregroundColor;
/*0x04*/ u8 backgroundColor;
/*0x05*/ u8 shadowColor;
/*0x06*/ u8 paletteNum;
/*0x07*/ u8 tilemapLeft;
/*0x08*/ u8 tilemapTop;
/*0x09*/ u8 width;
/*0x0A*/ u8 height;
/*0x0B*/ u8 win_field_B;
/*0x0C*/ u8 win_field_C;
/*0x0D*/ u8 delayCounter;
/*0x0E*/ u8 spacing;
/*0x0F*/ u8 win_field_F;
/*0x10*/ u8 cursorX;
/*0x11*/ u8 cursorY;
/*0x12*/ u8 left;
/*0x14*/ u16 top; // padded to 0x14
/*0x16*/ u16 state;
/*0x18*/ u16 downArrowCounter;
/*0x1A*/ u16 tileDataStartOffset;
/*0x1C*/ u16 tileDataOffset;
/*0x1E*/ u16 textIndex;
/*0x20*/ const u8 *text;
/*0x24*/ u8 *tileData;
/*0x28*/ u16 *tilemap;
/*0x2C*/ struct WindowConfig *config;
};
extern vu16 *const gBGControlRegs[];

View File

@ -159,7 +159,6 @@ SECTIONS {
src/matsuda_debug_menu.o(.text);
asm/contest.o(.text);
src/shop.o(.text);
asm/shop.o(.text);
src/berry.o(.text);
src/script_menu.o(.text);
src/naming_screen.o(.text);
@ -399,7 +398,7 @@ SECTIONS {
src/item.o(.rodata);
data/matsuda_debug_menu.o(.rodata);
data/contest.o(.rodata);
data/shop.o(.rodata);
src/shop.o(.rodata);
src/berry.o(.rodata);
src/script_menu.o(.rodata);
src/naming_screen.o(.rodata);

View File

@ -148,7 +148,7 @@ void sub_80B7AEC(u32 arg0, u8 left, u8 top)
}
__attribute__((naked))
void sub_80B7B34(void)
void sub_80B7B34(u8 var1, u8 var2, int var3)
{
asm(".syntax unified\n\
push {r4-r7,lr}\n\

1133
src/shop.c

File diff suppressed because it is too large Load Diff

View File

@ -53,12 +53,7 @@ gUnknown_030006DC: @ 30006DC
.include "src/field_effect.o"
.include "src/item_menu.o"
@ shop
gUnknown_03000708: @ 3000708
.space 0x10
.include "src/shop.o"
.include "src/record_mixing.o"
.include "src/tv.o"

View File

@ -510,29 +510,7 @@ gScriptContestCategory: @ 203869C
gScriptContestRank: @ 203869E
.space 0x2
@ shop
gUnknown_020386A0: @ 20386A0
.space 0x4
gUnknown_020386A4: @ 20386A4
.space 0x4
gUnknown_020386A8: @ 20386A8
.space 0x2
gUnknown_020386AA: @ 20386AA
.space 0x7A
gUnknown_02038724: @ 2038724
.space 0xC
gUnknown_02038730: @ 2038730
.space 0x1
gUnknown_02038731: @ 2038731
.space 0x3
.include "src/shop.o"
.include "src/money.o"
@ record_mixing