summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDerek Hensley <hensley.derek58@gmail.com>2025-12-08 21:11:07 -0800
committerGitHub <noreply@github.com>2025-12-08 21:11:07 -0800
commit7b96e58622a3b8130b19c25d8633defd0beaeca1 (patch)
treee36a32bde24b3662f5bf3e272c9ba3e598416263 /include
parentf6b17e23584c17fd2d6ec0d1867b8e395a0ed747 (diff)
Multiversion code support (n64-jp-1.1) (#1826)
* setup n64-jp-1.1 disasm * Add versions * New microcode * Bootstrap z_sram * Bootstrap ovl_file_choose * Bootstrap kaleido scope * Bootstrap BgHeavyBlock * MessageContext shift * SaveContext shift * ItemId shift * Fix `PLAYER_CSACTION` shift * format * Add JP only to Heavy Block Description * Makefile multi version comment --------- Co-authored-by: Tom Overton <tom.overton@outlook.com>
Diffstat (limited to 'include')
-rw-r--r--include/tables/actor_table.h7
-rw-r--r--include/versions.h9
-rw-r--r--include/z64item.h54
-rw-r--r--include/z64message.h6
-rw-r--r--include/z64player.h2
-rw-r--r--include/z64save.h62
6 files changed, 138 insertions, 2 deletions
diff --git a/include/tables/actor_table.h b/include/tables/actor_table.h
index 9019e2b80..38adcf6a7 100644
--- a/include/tables/actor_table.h
+++ b/include/tables/actor_table.h
@@ -11,6 +11,7 @@
*
* DEFINE_ACTOR_UNSET is needed to define empty entries from the original game
*/
+#include "versions.h"
/* 0x000 */ DEFINE_ACTOR_INTERNAL(Player, ACTOR_PLAYER, ALLOCTYPE_NORMAL, "Player")
/* 0x001 */ DEFINE_ACTOR(En_Test, ACTOR_EN_TEST, ALLOCTYPE_NORMAL, "En_Test")
/* 0x002 */ DEFINE_ACTOR(En_GirlA, ACTOR_EN_GIRLA, ALLOCTYPE_NORMAL, "En_GirlA")
@@ -89,7 +90,11 @@
/* 0x04B */ DEFINE_ACTOR_UNSET(ACTOR_UNSET_4B)
/* 0x04C */ DEFINE_ACTOR(En_Rd, ACTOR_EN_RD, ALLOCTYPE_NORMAL, "En_Rd")
/* 0x04D */ DEFINE_ACTOR(Bg_F40_Flift, ACTOR_BG_F40_FLIFT, ALLOCTYPE_NORMAL, "Bg_F40_Flift")
-/* 0x04E */ DEFINE_ACTOR_UNSET(ACTOR_UNSET_4E)
+#if MM_VERSION >= N64_US
+/* 0x04E */ DEFINE_ACTOR_UNSET(ACTOR_BG_HEAVY_BLOCK)
+#else
+/* 0x04E */ DEFINE_ACTOR(Bg_Heavy_Block, ACTOR_BG_HEAVY_BLOCK, ALLOCTYPE_NORMAL, "Bg_Heavy_Block")
+#endif
/* 0x04F */ DEFINE_ACTOR(Obj_Mure, ACTOR_OBJ_MURE, ALLOCTYPE_NORMAL, "Obj_Mure")
/* 0x050 */ DEFINE_ACTOR(En_Sw, ACTOR_EN_SW, ALLOCTYPE_NORMAL, "En_Sw")
/* 0x051 */ DEFINE_ACTOR(Object_Kankyo, ACTOR_OBJECT_KANKYO, ALLOCTYPE_NORMAL, "Object_Kankyo")
diff --git a/include/versions.h b/include/versions.h
new file mode 100644
index 000000000..8f1b51379
--- /dev/null
+++ b/include/versions.h
@@ -0,0 +1,9 @@
+#ifndef VERSIONS_H
+#define VERSIONS_H
+
+// MM versions in build order
+
+#define N64_JP_1_1 2
+#define N64_US 4
+
+#endif
diff --git a/include/z64item.h b/include/z64item.h
index 69eca8c1b..636e13f61 100644
--- a/include/z64item.h
+++ b/include/z64item.h
@@ -1,6 +1,8 @@
#ifndef Z64ITEM_H
#define Z64ITEM_H
+#include "versions.h"
+
#define DROP_TABLE_SIZE 16
#define DROP_TABLE_NUMBER 17
@@ -180,19 +182,57 @@ typedef enum ItemId {
/* 0x21 */ ITEM_ZORA_EGG,
/* 0x22 */ ITEM_GOLD_DUST,
/* 0x23 */ ITEM_MUSHROOM,
+#if MM_VERSION < N64_US
+ ITEM_24_JP,
+ ITEM_25_JP,
+#endif
/* 0x24 */ ITEM_SEAHORSE,
/* 0x25 */ ITEM_CHATEAU,
/* 0x26 */ ITEM_HYLIAN_LOACH,
+#if MM_VERSION < N64_US
+ ITEM_29_JP,
+ ITEM_2A_JP,
+ ITEM_2B_JP,
+ ITEM_2C_JP,
+ ITEM_2D_JP,
+ ITEM_2E_JP,
+#endif
/* 0x27 */ ITEM_OBABA_DRINK,
/* 0x28 */ ITEM_MOONS_TEAR,
/* 0x29 */ ITEM_DEED_LAND,
/* 0x2A */ ITEM_DEED_SWAMP,
/* 0x2B */ ITEM_DEED_MOUNTAIN,
/* 0x2C */ ITEM_DEED_OCEAN,
+#if MM_VERSION < N64_US
+ ITEM_35_JP,
+ ITEM_36_JP,
+ ITEM_37_JP,
+ ITEM_38_JP,
+ ITEM_39_JP,
+#endif
/* 0x2D */ ITEM_ROOM_KEY,
/* 0x2E */ ITEM_LETTER_MAMA,
+#if MM_VERSION < N64_US
+ ITEM_3C_JP,
+ ITEM_3D_JP,
+ ITEM_3E_JP,
+ ITEM_3F_JP,
+ ITEM_40_JP,
+ ITEM_41_JP,
+ ITEM_42_JP,
+ ITEM_43_JP,
+#endif
/* 0x2F */ ITEM_LETTER_TO_KAFEI,
/* 0x30 */ ITEM_PENDANT_OF_MEMORIES,
+#if MM_VERSION < N64_US
+ ITEM_46_JP,
+ ITEM_47_JP,
+ ITEM_48_JP,
+ ITEM_49_JP,
+ ITEM_4A_JP,
+ ITEM_4B_JP,
+ ITEM_4C_JP,
+#endif
/* 0x31 */ ITEM_TINGLE_MAP,
/* 0x32 */ ITEM_MASK_DEKU,
/* 0x33 */ ITEM_MASK_GORON,
@@ -221,12 +261,20 @@ typedef enum ItemId {
/* 0x4A */ ITEM_BOW_FIRE,
/* 0x4B */ ITEM_BOW_ICE,
/* 0x4C */ ITEM_BOW_LIGHT,
+#if MM_VERSION < N64_US
+ ITEM_69_JP,
+ ITEM_6A_JP,
+ ITEM_6B_JP,
+#endif
/* 0x4D */ ITEM_SWORD_KOKIRI,
/* 0x4E */ ITEM_SWORD_RAZOR,
/* 0x4F */ ITEM_SWORD_GILDED,
/* 0x50 */ ITEM_SWORD_DEITY,
/* 0x51 */ ITEM_SHIELD_HERO,
/* 0x52 */ ITEM_SHIELD_MIRROR,
+#if MM_VERSION < N64_US
+ ITEM_72_JP,
+#endif
/* 0x53 */ ITEM_QUIVER_30,
/* 0x54 */ ITEM_QUIVER_40,
/* 0x55 */ ITEM_QUIVER_50,
@@ -326,7 +374,11 @@ typedef enum ItemId {
/* 0xB1 */ ITEM_MAP_POINT_MOUNTAIN_VILLAGE,
/* 0xB2 */ ITEM_MAP_POINT_MILK_ROAD,
/* 0xB3 */ ITEM_MAP_POINT_ZORA_CAPE,
- /* 0xB8 */ ITEM_B8 = 0xB8,
+ /* 0xB4 */ ITEM_B4,
+ /* 0xB5 */ ITEM_B5,
+ /* 0xB6 */ ITEM_B6,
+ /* 0xB7 */ ITEM_B7,
+ /* 0xB8 */ ITEM_B8,
/* 0xB9 */ ITEM_B9,
/* 0xBA */ ITEM_BA,
/* 0xBB */ ITEM_BB,
diff --git a/include/z64message.h b/include/z64message.h
index 77ebcfc0c..76e291976 100644
--- a/include/z64message.h
+++ b/include/z64message.h
@@ -4,6 +4,8 @@
#include "PR/ultratypes.h"
#include "stdbool.h"
+#include "versions.h"
+
#include "z64bombers_notebook.h"
#include "z64font.h"
#include "z64view.h"
@@ -269,7 +271,9 @@ typedef struct MessageContext {
/* 0x1207C */ s32 rupeesTotal; // Used for bank and doggy racetrack bet
/* 0x12080 */ struct MessageTableEntry* messageTable;
/* 0x12084 */ struct MessageTableEntry* messageTableNES;
+#if MM_VERSION >= N64_US
/* 0x12088 */ UNK_TYPE1 unk12088[0x4];
+#endif
/* 0x1208C */ struct MessageTableEntry* messageTableCredits;
/* 0x12090 */ s16 textIsCredits;
/* 0x12092 */ s16 messageHasSetSfx;
@@ -287,6 +291,7 @@ typedef struct MessageContext {
/* 0x120B1 */ u8 bombersNotebookEventQueueCount;
/* 0x120B2 */ u8 bombersNotebookEventQueue[10];
/* 0x120BC */ u16 hudVisibility;
+#if MM_VERSION >= N64_US
/* 0x120BE */ s16 unk120BE;
/* 0x120C0 */ s16 unk120C0;
/* 0x120C2 */ s16 unk120C2;
@@ -301,6 +306,7 @@ typedef struct MessageContext {
/* 0x120D6 */ s16 unk120D6;
/* 0x120D8 */ s16 unk120D8;
/* 0x120DA */ UNK_TYPE1 unk_120DA[0x6];
+#endif
} MessageContext; // size = 0x120E0
bool Message_ShouldAdvance(struct PlayState* play);
diff --git a/include/z64player.h b/include/z64player.h
index 8a0f2196b..eb6c89ec4 100644
--- a/include/z64player.h
+++ b/include/z64player.h
@@ -790,7 +790,9 @@ typedef enum PlayerCsAction {
/* 0x77 */ PLAYER_CSACTION_119,
/* 0x78 */ PLAYER_CSACTION_120,
/* 0x79 */ PLAYER_CSACTION_121,
+#if MM_VERSION >= N64_US
/* 0x7A */ PLAYER_CSACTION_122,
+#endif
/* 0x7B */ PLAYER_CSACTION_123,
/* 0x7C */ PLAYER_CSACTION_124,
/* 0x7D */ PLAYER_CSACTION_125,
diff --git a/include/z64save.h b/include/z64save.h
index 36e9f3bae..5a13877e8 100644
--- a/include/z64save.h
+++ b/include/z64save.h
@@ -4,6 +4,8 @@
#include "ultra64.h"
#include "PR/os.h"
+#include "versions.h"
+
#include "z64inventory.h"
#include "z64item.h"
#include "z64math.h"
@@ -307,6 +309,9 @@ typedef struct SaveInfo {
/* 0xED4 */ u8 weekEventReg[100]; // "week_event_reg"
/* 0xF38 */ u32 regionsVisited; // "area_arrival"
/* 0xF3C */ u32 worldMapCloudVisibility; // "cloud_clear"
+#if MM_VERSION < N64_US
+ UNK_TYPE1 unk_F40_jp[0x384];
+#endif
/* 0xF40 */ u8 unk_F40; // "oca_rec_flag" has scarecrows song
/* 0xF41 */ u8 scarecrowSpawnSongSet; // "oca_rec_flag8"
/* 0xF42 */ u8 scarecrowSpawnSong[128];
@@ -341,6 +346,7 @@ typedef struct Save {
typedef struct SaveContext {
/* 0x0000 */ Save save;
+#if MM_VERSION >= N64_US
/* 0x100C */ u8 eventInf[8]; // "event_inf"
/* 0x1014 */ u8 unk_1014; // "stone_set_flag"
/* 0x1015 */ u8 bButtonStatus;
@@ -395,6 +401,62 @@ typedef struct SaveContext {
/* 0x3F30 */ s16 magicFillTarget; // target used to fill magic "magic_now_now"
/* 0x3F32 */ s16 magicToConsume; // accumulated magic that is requested to be consumed "magic_used"
/* 0x3F34 */ s16 magicToAdd; // accumulated magic that is requested to be added "magic_recovery"
+#else
+ u8 pictoPhotoI5[PICTO_PHOTO_COMPRESSED_SIZE]; // buffer containing the pictograph photo, compressed to I5 from I8
+ s32 fileNum; // "file_no"
+ s16 powderKegTimer; // "big_bom_timer"
+ u8 unk_1014; // "stone_set_flag"
+ u8 unk_3CA7; // "day_night_flag"
+ u16 jinxTimer;
+ u8 unk_3CA6;
+ u8 bButtonStatus;
+ s32 gameMode; // "mode"
+ s32 sceneLayer; // "counter"
+ s32 respawnFlag; // "restart_flag"
+ RespawnData respawn[RESPAWN_MODE_MAX]; // "restart_data"
+ f32 entranceSpeed; // "player_wipe_speedF"
+ u16 entranceSound; // "player_wipe_door_SE"
+ u8 unk_3DBA; // "player_wipe_item"
+ u8 retainWeatherMode; // "next_walk"
+ s16 dogParams; // OoT leftover. "dog_flag"
+ u8 envHazardTextTriggerFlags; // "guide_status"
+ u8 showTitleCard; // "name_display"
+ s16 nayrusLoveTimer; // remnant of OoT, "shield_magic_timer"
+ u8 unk_3DC2; // "pad1"
+ s16 rupeeAccumulator; // "lupy_udct"
+ OSTime postmanTimerStopOsTime; // The osTime when the timer stops for the postman minigame. "get_time"
+ u8 timerStates[TIMER_ID_MAX]; // See the `TimerState` enum. "event_fg"
+ u8 timerDirections[TIMER_ID_MAX]; // See the `TimerDirection` enum. "calc_flag"
+ u64 timerCurTimes[TIMER_ID_MAX]; // For countdown, the remaining time left. For countup, the time since the start. In centiseconds (1/100th sec). "event_ostime"
+ u64 timerTimeLimits[TIMER_ID_MAX]; // The original total time given for the timer to count from, in centiseconds (1/100th sec). "event_sub"
+ OSTime timerStartOsTimes[TIMER_ID_MAX]; // The osTime when the timer starts. "func_time"
+ u64 timerStopTimes[TIMER_ID_MAX]; // The total amount of time taken between the start and end of the timer, in centiseconds (1/100th sec). "func_end_time"
+ OSTime timerPausedOsTimes[TIMER_ID_MAX]; // The cumulative osTime spent with the timer paused. "func_stop_time"
+ s16 timerX[TIMER_ID_MAX]; // "event_xp"
+ s16 timerY[TIMER_ID_MAX]; // "event_yp"
+ u8 bottleTimerStates[BOTTLE_MAX]; // See the `BottleTimerState` enum. "bottle_status"
+ OSTime bottleTimerStartOsTimes[BOTTLE_MAX]; // The osTime when the timer starts. "bottle_ostime"
+ u64 bottleTimerTimeLimits[BOTTLE_MAX]; // The original total time given before the timer expires, in centiseconds (1/100th sec). "bottle_sub"
+ u64 bottleTimerCurTimes[BOTTLE_MAX]; // The remaining time left before the timer expires, in centiseconds (1/100th sec). "bottle_time"
+ OSTime bottleTimerPausedOsTimes[BOTTLE_MAX]; // The cumulative osTime spent with the timer paused. "bottle_stop_time"
+ s16 unk_3F14; // "character_change"
+ u8 seqId; // "old_bgm"
+ u8 ambienceId; // "old_env"
+ u8 buttonStatus[6]; // "button_item"
+ u8 hudVisibilityForceButtonAlphasByStatus; // if btn alphas are updated through Interface_UpdateButtonAlphas, instead update them through Interface_UpdateButtonAlphasByStatus "ck_fg"
+ u16 nextHudVisibility; // triggers the hud to change visibility to the requested value. Reset to HUD_VISIBILITY_IDLE when target is reached "alpha_type"
+ u16 hudVisibility; // current hud visibility "prev_alpha_type"
+ u16 hudVisibilityTimer; // number of frames in the transition to a new hud visibility. Used to step alpha "alpha_count"
+ u16 prevHudVisibility; // used to store and recover hud visibility for pause menu and text boxes "last_time_type"
+ s16 magicState; // determines magic meter behavior on each frame "magic_flag"
+ s16 isMagicRequested; // a request to add magic has been given "recovery_magic_flag"
+ s16 magicFlag; // Set to 0 in func_80812D94(), otherwise unused "keep_magic_flag"
+ s16 magicCapacity; // maximum magic available "magic_now_max"
+ s16 magicFillTarget; // target used to fill magic "magic_now_now"
+ s16 magicToConsume; // accumulated magic that is requested to be consumed "magic_used"
+ s16 magicToAdd; // accumulated magic that is requested to be added "magic_recovery"
+ u8 eventInf[8]; // "event_inf"
+#endif
/* 0x3F36 */ u16 mapIndex; // set to enum DungeonSceneIndex when entering a dungeon related scene, or Map_GetMapIndexForOverworld on certain overworld scenes "scene_ID"
/* 0x3F38 */ u16 minigameStatus; // "yabusame_mode"
/* 0x3F3A */ u16 minigameScore; // "yabusame_total"