Improved the trainer name length grammar and added a manual override for values other than 12

This commit is contained in:
Miguel Terol Espino 2023-10-03 14:04:07 +02:00 committed by AdAstra-LD
parent d842e558d7
commit 2da0ab23f4
2 changed files with 39 additions and 23 deletions

View File

@ -9038,15 +9038,25 @@ namespace DSPRE {
private void trainerSaveCurrentButton_Click(object sender, EventArgs e) {
if (!ROMToolboxDialog.flag_TrainerNamesExpanded && trainerNameTextBox.Text.Length > TrainerFile.maxNameLen) {
DialogResult d;
DialogResult d, d2;
MessageBox.Show($"The length of this Trainer name exceeds {TrainerFile.maxNameLen} characters.",
"Trainer data could not be saved!", MessageBoxButtons.OK, MessageBoxIcon.Error);
d = MessageBox.Show("Within the RomToolBox (found near the wild editor) you can expand this limit if you are working on an ENglish or Spanish rom (for now).",
"Do you wish to go there now?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
d = MessageBox.Show("This tool currently checks if you have performed an ARM9 edit to change the max trainer name length to " + ROMToolboxDialog.expandedTrainerNameLength + ".\n" +
"However you may have already manually edited max trainer length to be something other than that.",
"Have you done so?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (d == DialogResult.Yes)
{
romToolBoxToolStripMenuItem_Click(null, null);
ROMToolboxDialog.flag_TrainerNamesExpanded = true;
}
else
{
d2 = MessageBox.Show("Within the RomToolBox (found near the wild editor) you can expand this limit if you are working on an English or Spanish rom (for now).",
"Do you wish to go there now?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (d2 == DialogResult.Yes)
{
romToolBoxToolStripMenuItem_Click(null, null);
}
}
return;
}
if(trainerNameTextBox.Text.Length > ROMToolboxDialog.expandedTrainerNameLength)

View File

@ -319,28 +319,34 @@ namespace DSPRE {
public void CheckExpandedTrainerNamespatchApplied()
{
uint position = 0x6AC32;
switch (RomInfo.gameFamily)
if(!flag_TrainerNamesExpanded)
{
case gFamEnum.DP:
if (RomInfo.gameLanguage.Equals(gLangEnum.English)) position = 0x6AC32;
else if (RomInfo.gameLanguage.Equals(gLangEnum.Spanish)) position = 0x6AC8E;
break;
case gFamEnum.Plat:
if (RomInfo.gameLanguage.Equals(gLangEnum.English)) position = 0x791DE;
else if (RomInfo.gameLanguage.Equals(gLangEnum.Spanish)) position = 0x7927E;
break;
case gFamEnum.HGSS:
if (RomInfo.gameLanguage.Equals(gLangEnum.English) || RomInfo.gameVersion.Equals(gVerEnum.SoulSilver)) position = 0x7342E;
else if (RomInfo.gameLanguage.Equals(gLangEnum.Spanish)) position = 0x73426;
break;
}
byte initValue = DSUtils.ARM9.ReadByte(position);
if (initValue == (byte)ROMToolboxDialog.expandedTrainerNameLength)
uint position = 0x6AC32;
switch (RomInfo.gameFamily)
{
case gFamEnum.DP:
if (RomInfo.gameLanguage.Equals(gLangEnum.English)) position = 0x6AC32;
else if (RomInfo.gameLanguage.Equals(gLangEnum.Spanish)) position = 0x6AC8E;
break;
case gFamEnum.Plat:
if (RomInfo.gameLanguage.Equals(gLangEnum.English)) position = 0x791DE;
else if (RomInfo.gameLanguage.Equals(gLangEnum.Spanish)) position = 0x7927E;
break;
case gFamEnum.HGSS:
if (RomInfo.gameLanguage.Equals(gLangEnum.English) || RomInfo.gameVersion.Equals(gVerEnum.SoulSilver)) position = 0x7342E;
else if (RomInfo.gameLanguage.Equals(gLangEnum.Spanish)) position = 0x73426;
break;
}
byte initValue = DSUtils.ARM9.ReadByte(position);
if (initValue == (byte)ROMToolboxDialog.expandedTrainerNameLength)
{
DisableTrainerNameExpansionPatch("Already\nApplied");
ROMToolboxDialog.flag_TrainerNamesExpanded = true;
}
} else
{
DisableTrainerNameExpansionPatch("Already\nApplied");
ROMToolboxDialog.flag_TrainerNamesExpanded = true;
}
}
}
#endregion