no need to do unchecked operation as the sum of 0x530 bytes will never
overflow 31 bits.
capitalize Japanese
This commit is contained in:
Kurt
2017-04-10 16:47:08 -07:00
parent dbae1fb932
commit 6b65b905cc
8 changed files with 25 additions and 30 deletions

View File

@@ -254,14 +254,12 @@ public string[] getItemStrings(int generation, GameVersion game)
case GameVersion.XD:
return g3xditems;
default:
if (!Legal.EReaderBerryIsEnigma)
{
var g3itemsEBerry = new string[g3items.Length];
Array.Copy(g3items, g3itemsEBerry, g3items.Length);
g3itemsEBerry[175] = Legal.EReaderBerryDisplayName;
return g3itemsEBerry;
}
return g3items;
if (Legal.EReaderBerryIsEnigma)
return g3items;
var g3itemsEBerry = (string[])g3items.Clone();
g3itemsEBerry[175] = Legal.EReaderBerryDisplayName;
return g3itemsEBerry;
}
default:
return itemlist;

View File

@@ -3006,7 +3006,7 @@ private void ParseShedinjaEvolveMoves(int[] moves, ref CheckResult[] res)
{
List<int>[] ShedinjaEvoMoves = Legal.getShedinjaEvolveMoves(pkm);
var ShedinjaEvoMovesLearned = new List<int>();
for (int gen = Math.Min(pkm.Format,4); gen >= 3; gen--)
for (int gen = Math.Min(pkm.Format, 4); gen >= 3; gen--)
{
bool native = gen == pkm.Format;
for (int m = 0; m < 4; m++)

View File

@@ -15,6 +15,12 @@ public static partial class Legal
/// <summary>Setting to specify if an analysis should permit data sourced from the physical cartridge era of GameBoy games.</summary>
public static bool AllowGBCartEra = false;
/// <summary>Setting to specify if the e-berry index item is an eningma berry or a e-reader berry and the name of the e-reader berry</summary>
public static bool EReaderBerryIsEnigma = true;
public static string EReaderBerryName = string.Empty;
public static string EReaderBerryDisplayName => string.Format(V372, CultureInfo.CurrentCulture.TextInfo.ToTitleCase(EReaderBerryName.ToLower()));
public static bool SavegameJapanese = false;
// Gen 1
private static readonly Learnset[] LevelUpRB = Learnset1.getArray(Resources.lvlmove_rb, MaxSpeciesID_1);
private static readonly Learnset[] LevelUpY = Learnset1.getArray(Resources.lvlmove_y, MaxSpeciesID_1);
@@ -39,13 +45,7 @@ public static partial class Legal
private static readonly EggMoves[] EggMovesRS = EggMoves6.getArray(Data.unpackMini(Resources.eggmove_rs, "rs"));
private static readonly EvolutionTree Evolves3;
private static readonly EncounterArea[] SlotsR, SlotsS, SlotsE, SlotsFR, SlotsLG;
private static readonly EncounterStatic[] StaticR, StaticS, StaticE, StaticFR, StaticLG;
/// <summary>Setting to specify if the e-berry index item is an eningma berry or a e-reader berry and the name of the e-reader berry</summary>
public static bool EReaderBerryIsEnigma = true;
public static string EReaderBerryName = string.Empty;
public static string EReaderBerryDisplayName => string.Format(V372, CultureInfo.CurrentCulture.TextInfo.ToTitleCase(EReaderBerryName.ToLower()));
public static bool SavegameJapanese = false;
private static readonly EncounterStatic[] StaticR, StaticS, StaticE, StaticFR, StaticLG;
// Gen 4
private static readonly Learnset[] LevelUpDP = Learnset6.getArray(Data.unpackMini(Resources.lvlmove_dp, "dp"));

View File

@@ -363,7 +363,7 @@ public static class LegalityCheckStrings
public static string V368 {get; set;} = "Eggs can not be infected with Pokérus."; // Invalid
public static string V369 {get; set;} = "Invalid E-Reader Berry.";
public static string V370 {get; set;} = "Japanese E-Reader Berry in international savegame.";
public static string V371 {get; set;} = "American E-Reader Berry in japanese savegame.";
public static string V371 {get; set;} = "American E-Reader Berry in Japanese savegame.";
#endregion
}

View File

@@ -107,7 +107,7 @@ public static partial class Legal
005, // Safari Ball
};
internal static readonly bool[] ReleasedHeldItems_3 = Enumerable.Range(0, MaxItemID_3+1).Select(i => HeldItems_RS.Contains((ushort)i) && !UnreleasedItems_3.Contains(i)).ToArray();
internal static readonly string[] EReaderBerriesNames_USA = new[]
internal static readonly string[] EReaderBerriesNames_USA =
{
// USA Series 1
"PUMKIN",
@@ -117,7 +117,7 @@ public static partial class Legal
"CHILAN",
"NUTPEA",
};
internal static readonly string[] EReaderBerriesNames_JP = new[]
internal static readonly string[] EReaderBerriesNames_JP =
{
// JP Series 1
"カチャ", // PUMKIN

View File

@@ -303,4 +303,4 @@ V367 = Individual EV for a level 100 encounter in generation 4 cannot be greater
V368 = Eggs can not be infected with Pokérus.
V369 = Invalid E-Reader Berry.
V370 = Japanese E-Reader Berry in international savegame.
V371 = American E-Reader Berry in japanese savegame.
V371 = American E-Reader Berry in Japanese savegame.

View File

@@ -303,4 +303,4 @@ V367 = Individual EV for a level 100 encounter in generation 4 cannot be greater
V368 = Eggs can not be infected with Pokérus.
V369 = Invalid E-Reader Berry.
V370 = Japanese E-Reader Berry in international savegame.
V371 = American E-Reader Berry in japanese savegame.
V371 = American E-Reader Berry in Japanese savegame.

View File

@@ -610,16 +610,13 @@ private void LoadEReaderBerryData()
if (!GameVersion.RS.Contains(Version))
return;
byte[] chk = getData(BlockOfs[4] + OFFSET_EBERRY, SIZE_EBERRY - 4);
for (int i = 0; i < 8; i++)
//These 8 bytes are taken as 0x00 for chk calculation
chk[0xC + i] = 0x00;
byte[] data = getData(BlockOfs[4] + OFFSET_EBERRY, SIZE_EBERRY - 4);
var calc_cksum = 0;
for (int i = 0; i < chk.Length; i++)
calc_cksum = unchecked(calc_cksum + chk[i]);
eBerryChecksumValid = calc_cksum == eBerryChecksum;
// 8 bytes are 0x00 for chk calculation
for (int i = 0; i < 8; i++)
data[0xC + i] = 0x00;
uint chk = (uint)data.Sum(z => z);
eBerryChecksumValid = eBerryChecksum == chk;
}
#endregion
}