Defines for Expansion version number (#3454)

This commit is contained in:
Martin Griffin 2023-11-10 11:08:36 +00:00 committed by GitHub
parent 7ccdd4b5b3
commit 3fc47d137a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 81 additions and 0 deletions

View file

@ -206,4 +206,13 @@ DebugText_DaycareOnePokemon:
DebugText_DaycarePokemonNotCompatible:
.string "Your Pokémon at Daycare can't\nhave babies together!$"
Debug_ShowExpansionVersion::
callnative BufferExpansionVersion
msgbox Debug_ExpansionVersion, MSGBOX_DEFAULT
release
end
Debug_ExpansionVersion:
.string "pokeemerald-expansion {STR_VAR_1}$"
.endif

View file

@ -0,0 +1,12 @@
#ifndef GUARD_CONSTANTS_EXPANSION_H
#define GUARD_CONSTANTS_EXPANSION_H
#define EXPANSION_VERSION_MAJOR 1
#define EXPANSION_VERSION_MINOR 7
#define EXPANSION_VERSION_PATCH 0
// FALSE if this this version of Expansion is not a tagged commit, i.e.
// it contains unreleased changes.
#define EXPANSION_TAGGED_RELEASE FALSE
#endif

View file

@ -52,6 +52,7 @@ SECTIONS {
{
src/rom_header.o(.text);
src/rom_header_gf.o(.text.*);
src/rom_header_rhh.o(.text.*);
src/crt0.o(.text);
src/main.o(.text);
gflib/malloc.o(.text);

View file

@ -51,6 +51,7 @@ SECTIONS {
{
src/rom_header.o(.text*);
src/rom_header_gf.o(.text.*);
src/rom_header_rhh.o(.text.*);
src/crt0.o(.text);
src/main.o(.text);
gflib/*.o(.text*);

View file

@ -62,6 +62,7 @@ SECTIONS {
{
src/rom_header.o(.text);
src/rom_header_gf.o(.text.*);
src/rom_header_rhh.o(.text.*);
src/*.o(.text);
gflib/*.o(.text);
} =0

View file

@ -55,6 +55,7 @@
#include "constants/battle_ai.h"
#include "constants/battle_frontier.h"
#include "constants/coins.h"
#include "constants/expansion.h"
#include "constants/flags.h"
#include "constants/items.h"
#include "constants/map_groups.h"
@ -97,6 +98,7 @@ enum UtilMenu
DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES,
DEBUG_UTIL_MENU_ITEM_CHEAT,
DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG,
DEBUG_UTIL_MENU_ITEM_EXPANSION_VER,
};
enum ScriptMenu
@ -339,6 +341,7 @@ static void DebugAction_Util_Player_Id(u8 taskId);
static void DebugAction_Util_Clear_Boxes(u8 taskId);
static void DebugAction_Util_CheatStart(u8 taskId);
static void DebugAction_Util_HatchAnEgg(u8 taskId);
static void DebugAction_Util_ExpansionVersion(u8 taskId);
static void DebugAction_FlagsVars_Flags(u8 taskId);
static void DebugAction_FlagsVars_FlagsSelect(u8 taskId);
@ -418,6 +421,7 @@ extern const u8 PlayersHouse_2F_EventScript_CheckWallClock[];
extern const u8 Debug_CheckSaveBlock[];
extern const u8 Debug_CheckROMSpace[];
extern const u8 Debug_BoxFilledMessage[];
extern const u8 Debug_ShowExpansionVersion[];
#include "data/map_group_count.h"
@ -471,6 +475,7 @@ static const u8 sDebugText_Util_Player_Id[] = _("New Trainer Id")
static const u8 sDebugText_Util_Clear_Boxes[] = _("Clear Storage Boxes");
static const u8 sDebugText_Util_CheatStart[] = _("CHEAT Start");
static const u8 sDebugText_Util_HatchAnEgg[] = _("Hatch an Egg");
static const u8 sDebugText_Util_ExpansionVersion[] = _("Expansion Version");
// Flags/Vars Menu
static const u8 sDebugText_FlagsVars_Flags[] = _("Set Flag XYZ…{CLEAR_TO 110}{RIGHT_ARROW}");
static const u8 sDebugText_FlagsVars_Flag[] = _("Flag: {STR_VAR_1}{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}\n{STR_VAR_3}");
@ -637,6 +642,7 @@ static const struct ListMenuItem sDebugMenu_Items_Utilities[] =
[DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES] = {sDebugText_Util_Clear_Boxes, DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES},
[DEBUG_UTIL_MENU_ITEM_CHEAT] = {sDebugText_Util_CheatStart, DEBUG_UTIL_MENU_ITEM_CHEAT},
[DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG] = {sDebugText_Util_HatchAnEgg, DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG},
[DEBUG_UTIL_MENU_ITEM_EXPANSION_VER] = {sDebugText_Util_ExpansionVersion,DEBUG_UTIL_MENU_ITEM_EXPANSION_VER},
};
static const struct ListMenuItem sDebugMenu_Items_Scripts[] =
@ -780,6 +786,7 @@ static void (*const sDebugMenu_Actions_Utilities[])(u8) =
[DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES] = DebugAction_Util_Clear_Boxes,
[DEBUG_UTIL_MENU_ITEM_CHEAT] = DebugAction_Util_CheatStart,
[DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG] = DebugAction_Util_HatchAnEgg,
[DEBUG_UTIL_MENU_ITEM_EXPANSION_VER] = DebugAction_Util_ExpansionVersion,
};
static void (*const sDebugMenu_Actions_Scripts[])(u8) =
@ -2122,6 +2129,30 @@ static void DebugAction_Util_HatchAnEgg(u8 taskId)
Debug_DestroyMenu_Full_Script(taskId, Debug_HatchAnEgg);
}
static void DebugAction_Util_ExpansionVersion(u8 taskId)
{
Debug_DestroyMenu_Full(taskId);
LockPlayerFieldControls();
ScriptContext_SetupScript(Debug_ShowExpansionVersion);
}
void BufferExpansionVersion(struct ScriptContext *ctx)
{
static const u8 sText_Released[] = _("\nRelease Build");
static const u8 sText_Unreleased[] = _("\nDevelopment Build");
u8 *string = gStringVar1;
*string++ = CHAR_v;
string = ConvertIntToDecimalStringN(string, EXPANSION_VERSION_MAJOR, STR_CONV_MODE_LEFT_ALIGN, 3);
*string++ = CHAR_PERIOD;
string = ConvertIntToDecimalStringN(string, EXPANSION_VERSION_MINOR, STR_CONV_MODE_LEFT_ALIGN, 3);
*string++ = CHAR_PERIOD;
string = ConvertIntToDecimalStringN(string, EXPANSION_VERSION_PATCH, STR_CONV_MODE_LEFT_ALIGN, 3);
if (EXPANSION_TAGGED_RELEASE)
string = StringCopy(string, sText_Released);
else
string = StringCopy(string, sText_Unreleased);
}
// *******************************
// Actions Scripts
static void DebugAction_Util_Script_1(u8 taskId)

26
src/rom_header_rhh.c Normal file
View file

@ -0,0 +1,26 @@
#include "global.h"
#include "constants/expansion.h"
// Similar to the GF ROM header, this struct allows external programs to
// detect details about Expansion.
// For this structure to be useful we have to maintain backwards binary
// compatibility. This means that we should only ever append data to the
// end. If there are any structs as members then those structs should
// not be modified after being introduced.
struct RHHRomHeader
{
/*0x00*/ char rhh_magic[6]; // 'RHHEXP'. Useful to locate the header if it shifts.
/*0x06*/ u8 expansionVersionMajor;
/*0x07*/ u8 expansionVersionMinor;
/*0x08*/ u8 expansionVersionPatch;
/*0x09*/ u8 expansionVersionFlags;
};
static const struct RHHRomHeader sRHHRomHeader =
{
.rhh_magic = { 'R', 'H', 'H', 'E', 'X', 'P' },
.expansionVersionMajor = EXPANSION_VERSION_MAJOR,
.expansionVersionMinor = EXPANSION_VERSION_MINOR,
.expansionVersionPatch = EXPANSION_VERSION_PATCH,
.expansionVersionFlags = (EXPANSION_TAGGED_RELEASE << 0),
};