From 863a8cb73b96c805a5b7973d94cb9be9e4ccd403 Mon Sep 17 00:00:00 2001 From: Cuyler36 Date: Mon, 24 Apr 2023 17:30:53 -0400 Subject: [PATCH] Implement more save structs and headers --- include/m_common_data.h | 25 ++++++++++++++++++--- include/m_config.h | 22 +++++++++++++++++++ include/m_kabu_manager.h | 14 ++++++++++++ include/m_notice.h | 24 ++++++++++++++++++++ include/m_police_box.h | 22 +++++++++++++++++++ include/m_post_office.h | 40 ++++++++++++++++++++++++++++++++++ include/m_shop.h | 47 ++++++++++++++++++++++++++++++++++++++++ include/m_snowman.h | 29 +++++++++++++++++++++++++ 8 files changed, 220 insertions(+), 3 deletions(-) create mode 100644 include/m_config.h create mode 100644 include/m_notice.h create mode 100644 include/m_police_box.h create mode 100644 include/m_post_office.h create mode 100644 include/m_snowman.h diff --git a/include/m_common_data.h b/include/m_common_data.h index 44137c53..8f3336e0 100644 --- a/include/m_common_data.h +++ b/include/m_common_data.h @@ -10,6 +10,13 @@ #include "m_private.h" #include "m_npc.h" #include "m_field_make.h" +#include "m_notice.h" +#include "m_shop.h" +#include "m_kabu_manager.h" +#include "m_post_office.h" +#include "m_police_box.h" +#include "m_snowman.h" +#include "m_config.h" #ifdef __cplusplus extern "C" { @@ -40,15 +47,27 @@ typedef struct Save_s { /* 0x000019 */ u8 remove_animal_idx; /* index of the villager which is scheduled to leave town, 0xFF when none selected */ /* 0x00001A */ u16 copy_protect; /* 'unique' value between [1, 65520] used for copy protection (see mCD_get_land_copyProtect) */ /* 0x00001C */ u8 pad_1C[4]; - /* 0x000020 */ Private_c private[PLAYER_NUM]; + /* 0x000020 */ Private_c private[PLAYER_NUM]; /* player data */ /* 0x009120 */ mLd_land_info_c land_info; /* town name & id */ - /* 0x00912C */ u8 _tmp1[0xBBC]; /* notice board info goes here */ + /* 0x00912C */ mNtc_board_post_c noticeboard[mNtc_BOARD_POST_COUNT]; /* noticeboard posts */ + /* 0x009CE4 */ u8 pad_9CE4[4]; /* 0x009CE8 */ mHm_hs_c homes[PLAYER_NUM]; /* player house data */ /* 0x0137A8 */ mFM_fg_c fg[FG_BLOCK_Z_NUM][FG_BLOCK_X_NUM]; /* fg items (fg = foreground?) */ /* 0x0173A8 */ mFM_combination_c combi_table[BLOCK_Z_NUM][BLOCK_X_NUM]; /* acre 'combination' data */ /* 0x017438 */ Animal_c animals[ANIMAL_NUM_MAX]; /* villagers in town */ /* 0x020330 */ AnmPersonalID_c last_removed_animal_id; /* ID of last villager who left town */ - /* 0x02033E */ u8 _tmp3[0xBD6]; + /* 0x020340 */ Shop_c shop; /* Nook's shop */ + /* 0x020480 */ Kabu_price_c kabu_price_schedule; /* Stalk Market info */ + /* 0x020498 */ u8 _tmp3[0x1F0]; /* saved events go here, but have a lot of structs in a union so holding off */ + /* 0x020688 */ mActor_name_t fruit; /* town fruit type */ + /* 0x02068A */ u8 house_arrangement; /* 2 bits for each player for the # of house they own */ + /* 0x02068B */ u8 num_statues; /* number of statues built for players who have paid off their debts */ + /* 0x02068C */ lbRTC_time_c all_grow_renew_time; /* renewal time for fg items handled by mAgrw_RenewalFgItem_ovl */ + /* 0x020694 */ PostOffice_c post_office; /* post office data */ + /* 0x020ED0 */ PoliceBox_c police_box; /* police station lost & found */ + /* 0x020EF8 */ mSN_snowman_save_c snowmen; /* saved snowmen data */ + /* 0x020F08 */ u64 melody; /* town tune, each nibble is a note (16 notes) */ + /* 0x020F10 */ Config_c config; /* saved config for sound mode, voice mode, and vibration */ /* 0x020F14 */ lbRTC_ymd_t renew_time; /* next renew date */ /* 0x020F18 */ u8 station_type; /* train station type */ /* 0x020F19 */ u8 weather; /* upper nibble is intensity, lower nibble is type */ diff --git a/include/m_config.h b/include/m_config.h new file mode 100644 index 00000000..6efa7364 --- /dev/null +++ b/include/m_config.h @@ -0,0 +1,22 @@ +#ifndef M_CONFIG_H +#define M_CONFIG_H + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* sizeof(Config_c) == 4 */ +typedef struct config_s { + /* 0x00 */ u8 sound_mode; /* mono, stereo, ... */ + /* 0x01 */ u8 voice_mode; /* silent, babblese, animalese */ + /* 0x02 */ u8 vibration_enabled; /* true/false */ + /* 0x03 */ u8 unused; /* might not exist */ +} Config_c; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/m_kabu_manager.h b/include/m_kabu_manager.h index 7a7c6059..534c28f3 100644 --- a/include/m_kabu_manager.h +++ b/include/m_kabu_manager.h @@ -2,11 +2,25 @@ #define M_KABU_MANAGER_H #include "types.h" +#include "lb_rtc.h" #ifdef __cplusplus extern "C" { #endif +enum { + Kabu_TRADE_MARKET_TYPE_A, /* spike trend */ + Kabu_TRADE_MARKET_TYPE_B, /* random trend */ + Kabu_TRADE_MARKET_TYPE_C /* falling trend */ +}; + +/* sizeof(Kabu_price_c) == 0x18 */ +typedef struct kabu_price_s { + /* 0x00 */ u16 daily_price[lbRTC_WEEKDAYS_MAX]; + /* 0x0E */ u16 trade_market; + /* 0x10 */ lbRTC_time_c update_time; +} Kabu_price_c; + extern void Kabu_manager(); #ifdef __cplusplus diff --git a/include/m_notice.h b/include/m_notice.h new file mode 100644 index 00000000..0fff4aff --- /dev/null +++ b/include/m_notice.h @@ -0,0 +1,24 @@ +#ifndef M_NOTICE_H +#define M_NOTICE_H + +#include "types.h" +#include "m_mail.h" +#include "lb_rtc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define mNtc_BOARD_POST_COUNT 15 + +/* sizeof(mNtc_board_post) == 0xC8 */ +typedef struct notice_board_post_s { + /* 0x00 */ u8 message[MAIL_BODY_LEN]; /* post contents */ + /* 0xC0 */ lbRTC_time_c post_time; /* date-time of post */ +} mNtc_board_post_c; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/m_police_box.h b/include/m_police_box.h new file mode 100644 index 00000000..b93c4567 --- /dev/null +++ b/include/m_police_box.h @@ -0,0 +1,22 @@ +#ifndef M_POLICE_BOX_H +#define M_POLICE_BOX_H + +#include "types.h" +#include "m_actor_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define mPB_POLICE_BOX_ITEM_STORAGE_COUNT 20 + +/* sizeof(PoliceBox_c) == 0x28 */ +typedef struct police_box_s { + /* 0x00 */ mActor_name_t keep_items[mPB_POLICE_BOX_ITEM_STORAGE_COUNT]; +} PoliceBox_c; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/m_post_office.h b/include/m_post_office.h new file mode 100644 index 00000000..5981e90c --- /dev/null +++ b/include/m_post_office.h @@ -0,0 +1,40 @@ +#ifndef M_POST_OFFICE_H +#define M_POST_OFFICE_H + +#include "types.h" +#include "m_mail.h" +#include "lb_rtc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define mPO_MAIL_STORAGE_SIZE 5 + +/* sizeof(PostOffice_c) == 0x83C */ +typedef struct post_office_s { + /* 0x000 */ s16 keep_mail_sum_players; /* sum of stored mail from players, see mPO_get_keep_mail_sum */ + /* 0x002 */ s16 keep_mail_sum_npcs; /* sum of stored mail from NPCs, see mPO_get_keep_mail_sum */ + /* 0x004 */ s16 mail_recipient_flags; /* flags to keep track of which players will receive mail */ + /* 0x006 */ u16 unused_6; /* definitely here, as Mail_c has 2 byte alignment */ + /* 0x008 */ Mail_c mail[mPO_MAIL_STORAGE_SIZE]; + /* 0x5DA */ Mail_c leaflet; + /* 0x704 */ Mail_c event_leaflet; + + /* certainly a union based on code usage */ + /* 0x830 */ union { + /* 0x830 */ int raw; /* used in mPO_post_office_init */ + struct { + /* 0x830 */ s16 leaflet_flags; /* bitfield of players who will receive the current 'leaflet' */ + /* 0x832 */ s16 event_flags; /* bitfield of players who will receive the current 'event leaflet' */ + }; + } leaflet_recipient_flags; /* similar to mail_recipient_flags, just for 'leaflets' */ + + /* 0x834 */ lbRTC_time_c delivery_time; /* time when Pete should 'deliver' the mail */ +} PostOffice_c; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/m_shop.h b/include/m_shop.h index e64a31b5..8de62b9d 100644 --- a/include/m_shop.h +++ b/include/m_shop.h @@ -3,11 +3,58 @@ #include "types.h" #include "libu64/gfxprint.h" +#include "lb_rtc.h" +#include "m_personal_id.h" +#include "m_actor_type.h" #ifdef __cplusplus extern "C" { #endif +#define mSP_PERSONAL_ID_COUNT 10 +#define mSP_GOODS_COUNT 39 +#define mSP_LOTTERY_ITEM_COUNT 3 + +enum { + mSP_LIST_FURNITURE, + mSP_LIST_PAPER, + mSP_LIST_CLOTH, + mSP_LIST_CARPET, + mSP_LIST_WALLPAPER, + + mSP_LIST_MAX +}; + +/* sizeof(mSP_goods_priority_list_c) == 1 */ +typedef struct shop_goods_priority_list_s { + u8 a:2; /* list A rarity */ + u8 b:2; /* list B rarity */ + u8 c:2; /* list C rarity */ + u8 pad:2; +} mSP_goods_priority_list_c; + +/* sizeof(Shop_c) == 0x140 */ +typedef struct shop_s { + /* 0x000 */ mSP_goods_priority_list_c priority_lists[mSP_LIST_MAX]; /* ABC list rarity (known internally as priority) */ + /* 0x006 */ PersonalID_c unused_ids[mSP_PERSONAL_ID_COUNT]; /* unused personal ids */ + /* 0x0CE */ mActor_name_t items[mSP_GOODS_COUNT]; /* standard shop items */ + /* 0x11C */ mActor_name_t rare_item; /* spotlight rare item taken from rare furniture ABC list */ + /* 0x11E */ mActor_name_t lottery_items[mSP_LOTTERY_ITEM_COUNT]; /* lottery items */ + /* 0x124 */ s8 flowers_candy_grab_bag_count; /* count of items that are flowers, candy, or grab bags */ + /* 0x126 */ struct { + /* 0x126 */ u16 shop_level:2; /* shop type, 0 = Cranny, 1 = Nook 'n Go, 2 = Nookway, 3 = Nookington's */ + /* 0x126 */ u16 upgrading_today:1; /* enabled when the shop is 'undergoing renovations' */ + /* 0x126 */ u16 send_upgrade_notice:1; /* triggers the upgrade letter to be sent out */ + /* 0x126 */ u16 not_loaded_before:1; /* cleared when the shop actor has loaded for the first time in a play session */ + /* 0x126/0x127 */ u16 paint_color:4; /* paint bucket color being sold */ + /* 0x127 */ u16 unused:7; /* seems to be unused */ + } shop_info; + /* 0x128 */ u32 sales_sum; /* current money towards upgrading shop */ + /* 0x12C */ lbRTC_time_c exchange_time; /* last time the shop's items were updated */ + /* 0x134 */ lbRTC_time_c renewal_time; /* last time the shop was 'renewed' which includes upgrading its 'level' */ + /* 0x13C */ int visitor_flag; /* set when a foreign player enters Nook's shop, required for Nookington's */ +} Shop_c; + extern void mSP_PrintNowShopSalesSum(gfxprint_t* gfxprint); extern void mItemDebug_ItemDebugMain(); diff --git a/include/m_snowman.h b/include/m_snowman.h new file mode 100644 index 00000000..5fbef453 --- /dev/null +++ b/include/m_snowman.h @@ -0,0 +1,29 @@ +#ifndef M_SNOWMAN_H +#define M_SNOWMAN_H + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define mSN_SAVE_COUNT 3 + +/* sizeof(mSN_snowman_data_c) == 4 */ +typedef struct snowman_data_s { + /* 0x00 */ u8 exists; /* when non-zero, snowman 'exists' */ + /* 0x01 */ u8 head_size; /* size of the snowman's head */ + /* 0x02 */ u8 body_size; /* size of the snowman's body */ + /* 0x03 */ u8 score; /* score based on snowman proportions */ +} mSN_snowman_data_c; + +/* sizeof(mSN_snowman_save_c) == 0xC */ +typedef struct snowman_save_data_s { + /* 0x00 */ mSN_snowman_data_c snowmen_data[mSN_SAVE_COUNT]; +} mSN_snowman_save_c; + +#ifdef __cplusplus +} +#endif + +#endif