Fix the strings length issue

This commit is contained in:
DizzyEggg
2018-09-01 22:03:21 +02:00
parent 5c7ca813e7
commit e28ce3be78
18 changed files with 58 additions and 58 deletions

View File

@@ -207,6 +207,7 @@ extern const u8 BattleScript_ActionSelectionItemsCantBeUsed[];
extern const u8 BattleScript_ArenaTurnBeginning[];
extern const u8 BattleScript_82DB881[];
extern const u8 BattleScript_82DB8F3[];
extern const u8 BattleScript_82DAA0B[];
extern const u8 BattleScript_AskIfWantsToForfeitMatch[];
extern const u8 BattleScript_PrintPlayerForfeited[];
extern const u8 BattleScript_PrintPlayerForfeitedLinkBattle[];

View File

@@ -6,7 +6,7 @@ struct RSBattleTowerRecord
/*0x00*/ u8 battleTowerLevelType; // 0 = level 50, 1 = level 100
/*0x01*/ u8 trainerClass;
/*0x02*/ u16 winStreak;
/*0x04*/ u8 name[8];
/*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1];
/*0x0C*/ u8 trainerId[4];
/*0x10*/ struct {
u16 easyChat[6];
@@ -22,10 +22,12 @@ union BattleTowerRecord
struct EmeraldBattleTowerRecord emerald;
};
#define FRONTIER_TRAINER_NAME_LENGTH 7
struct BattleFrontierTrainer
{
u32 facilityClass;
u8 trainerName[8];
u8 trainerName[FRONTIER_TRAINER_NAME_LENGTH + 1];
u16 speechBefore[6];
u16 speechWin[6];
u16 speechLose[6];

View File

@@ -1,12 +1,12 @@
#ifndef GUARD_GLOBAL_BERRY_H
#define GUARD_GLOBAL_BERRY_H
#define BERRY_NAME_COUNT 7
#define BERRY_NAME_LENGTH 6
#define BERRY_ITEM_EFFECT_COUNT 18
struct Berry
{
const u8 name[BERRY_NAME_COUNT];
const u8 name[BERRY_NAME_LENGTH + 1];
u8 firmness;
u16 size;
u8 maxYield;
@@ -26,7 +26,7 @@ struct Berry
struct Berry2
{
u8 name[BERRY_NAME_COUNT];
u8 name[BERRY_NAME_LENGTH + 1];
u8 firmness;
u16 size;
u8 maxYield;
@@ -53,7 +53,7 @@ struct EnigmaBerry
struct BattleEnigmaBerry
{
/*0x00*/ u8 name[BERRY_NAME_COUNT];
/*0x00*/ u8 name[BERRY_NAME_LENGTH + 1];
/*0x07*/ u8 holdEffect;
/*0x08*/ u8 itemEffect[BERRY_ITEM_EFFECT_COUNT];
/*0x1A*/ u8 holdEffectParam;

View File

@@ -57,8 +57,6 @@
#define PARTY_SIZE 6
#define POKEMON_SLOTS_NUMBER 412
#define POKEMON_NAME_LENGTH 10
#define OT_NAME_LENGTH 7
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) >= (b) ? (a) : (b))
@@ -134,8 +132,7 @@ enum LanguageId
// string lengths
#define ITEM_NAME_LENGTH 14
#define POKEMON_NAME_LENGTH 10
#define OT_NAME_LENGTH 7
#define PLAYER_NAME_LENGTH 8
#define PLAYER_NAME_LENGTH 7
#define MAIL_WORDS_COUNT 9
enum
@@ -326,7 +323,7 @@ struct EmeraldBattleTowerRecord
/*0x00*/ u8 battleTowerLevelType; // 0 = level 50, 1 = level 100
/*0x01*/ u8 trainerClass;
/*0x02*/ u16 winStreak;
/*0x04*/ u8 name[8];
/*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1];
/*0x0C*/ u8 trainerId[4];
/*0x10*/ struct {
u16 easyChat[6];
@@ -450,7 +447,7 @@ struct BattleFrontier
/*0xEBF*/ u8 field_EBF;
/*0xEC0*/ u16 field_EC0[16];
/*0xEE0*/ u8 field_EE0;
/*0xEE1*/ u8 field_EE1[2][PLAYER_NAME_LENGTH];
/*0xEE1*/ u8 field_EE1[2][PLAYER_NAME_LENGTH + 1];
/*0xEF1*/ u8 field_EF1[2][4];
/*0xEF9*/ u8 field_EF9;
/*0xEFA*/ u8 field_EFA;
@@ -460,7 +457,7 @@ struct BattleFrontier
struct SaveBlock2
{
/*0x00*/ u8 playerName[PLAYER_NAME_LENGTH];
/*0x00*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x08*/ u8 playerGender; // MALE, FEMALE
/*0x09*/ u8 specialSaveWarp;
/*0x0A*/ u8 playerTrainerId[4];
@@ -516,7 +513,7 @@ struct SecretBaseRecord
/*0x1A9D*/ u8 gender:1;
/*0x1A9D*/ u8 sbr_field_1_5:1;
/*0x1A9D*/ u8 sbr_field_1_6:2;
/*0x1A9E*/ u8 trainerName[OT_NAME_LENGTH];
/*0x1A9E*/ u8 trainerName[PLAYER_NAME_LENGTH];
/*0x1AA5*/ u8 trainerId[4]; // byte 0 is used for determining trainer class
/*0x1AA9*/ u8 language;
/*0x1AAA*/ u16 sbr_field_e;
@@ -602,7 +599,7 @@ struct EasyChatPair
struct MailStruct
{
/*0x00*/ u16 words[MAIL_WORDS_COUNT];
/*0x12*/ u8 playerName[PLAYER_NAME_LENGTH];
/*0x12*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x1A*/ u8 trainerId[4];
/*0x1E*/ u16 species;
/*0x20*/ u16 itemId;
@@ -691,7 +688,7 @@ struct RecordMixing_UnknownStruct
struct LinkBattleRecord
{
u8 name[8];
u8 name[PLAYER_NAME_LENGTH + 1];
u16 trainerId;
u16 wins;
u16 losses;
@@ -724,15 +721,15 @@ struct ContestWinner
u32 trainerId;
u16 species;
u8 contestCategory;
u8 monName[11];
u8 trainerName[8];
u8 monName[POKEMON_NAME_LENGTH + 1];
u8 trainerName[PLAYER_NAME_LENGTH + 1];
u8 contestRank;
};
struct DayCareMail
{
struct MailStruct message;
u8 OT_name[OT_NAME_LENGTH + 1];
u8 OT_name[PLAYER_NAME_LENGTH + 1];
u8 monName[POKEMON_NAME_LENGTH + 1];
u8 gameLanguage:4;
u8 monLanguage:4;
@@ -773,7 +770,7 @@ struct LilycoveLadyQuiz
/*0x002*/ u16 unk_002[9];
/*0x014*/ u16 unk_014;
/*0x016*/ u16 unk_016;
/*0x018*/ u8 playerName[8];
/*0x018*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x020*/ u16 playerTrainerId[4];
/*0x028*/ u16 itemId;
/*0x02a*/ u8 unk_02a;
@@ -788,7 +785,7 @@ struct LilycoveLadyFavour
/*0x001*/ u8 phase;
/*0x002*/ u8 unk_002;
/*0x003*/ u8 unk_003;
/*0x004*/ u8 playerName[8];
/*0x004*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x00c*/ u8 unk_00c;
/*0x00e*/ u16 itemId;
/*0x010*/ u16 unk_010;
@@ -801,7 +798,7 @@ struct LilycoveLadyContest
/*0x001*/ u8 phase;
/*0x002*/ u8 fave_pkblk;
/*0x003*/ u8 other_pkblk;
/*0x004*/ u8 playerName[8];
/*0x004*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x00c*/ u8 max_sheen;
/*0x00d*/ u8 category;
/*0x00e*/ u8 language;
@@ -828,7 +825,7 @@ struct WaldaPhrase
struct UnkSaveSubstruct_3b98 {
u32 trainerId;
u8 trainerName[8];
u8 trainerName[PLAYER_NAME_LENGTH + 1];
};
struct SaveBlock1

View File

@@ -205,7 +205,7 @@ struct BoxPokemon
u8 hasSpecies:1;
u8 isEgg:1;
u8 unused:5;
u8 otName[OT_NAME_LENGTH];
u8 otName[PLAYER_NAME_LENGTH];
u8 markings;
u16 checksum;
u16 unknown;

View File

@@ -6,7 +6,7 @@ struct UnkRecordMixingStruct2a
{
u8 playerId[4];
u16 field_4;
u8 playerName[PLAYER_NAME_LENGTH];
u8 playerName[PLAYER_NAME_LENGTH + 1];
u8 language;
};
@@ -15,8 +15,8 @@ struct UnkRecordMixingStruct2b
u8 playerId1[4];
u8 playerId2[4];
u16 field_8;
u8 playerName1[PLAYER_NAME_LENGTH];
u8 playerName2[PLAYER_NAME_LENGTH];
u8 playerName1[PLAYER_NAME_LENGTH + 1];
u8 playerName2[PLAYER_NAME_LENGTH + 1];
u8 language;
};