Skip to content
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.

Commit

Permalink
Support for other language addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
supremetakoyaki committed Oct 19, 2022
1 parent 077e325 commit d177722
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
7 changes: 6 additions & 1 deletion Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,11 @@ private void connectButton_Click(object sender, EventArgs e)
}

string buildId = _connectionManager.SendCommandAsIs("getBuildID", 33)[..16].Trim();
string languageCode = _connectionManager.SendCommandAsIs("getSystemLanguage", 5)[..2].Trim();
if (languageCode != "1" && _savedBuildReader.GetBuild($"{buildId}.{languageCode}") is not null)
{
buildId += $".{languageCode}";
}
SavedBuild? build = _savedBuildReader.GetBuild(buildId);
if (build == null)
{
Expand Down Expand Up @@ -689,7 +694,7 @@ private void metaDataButton_Click(object sender, EventArgs e)

string titleId = _connectionManager.SendCommandAsIs("getTitleID", 33)[..16];
string buildId = _connectionManager.SendCommandAsIs("getBuildID", 33)[..16];
string languageCode = _connectionManager.SendCommandAsIs("getSystemLanguage", 4)[..1];
string languageCode = _connectionManager.SendCommandAsIs("getSystemLanguage", 5)[..2].Trim();
string mainAddress = _connectionManager.SendCommandAsIs("getMainNsoBase", 33)[..16];
string heapAddress = _connectionManager.SendCommandAsIs("getHeapBase", 33)[..16];

Expand Down
16 changes: 14 additions & 2 deletions IO/SavedBuildReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ internal SavedBuildReader()
foreach (string fileName in Directory.GetFiles("addresses/"))
{
string[] contents = File.ReadAllLines(fileName);
string buildId = Path.GetFileNameWithoutExtension(fileName);
string buildId = Path.GetFileNameWithoutExtension(fileName)[..16];
string? language = null;
string? version = null;
string? moneyBase = null;
string? chunkBase = null;
Expand Down Expand Up @@ -44,6 +45,10 @@ internal SavedBuildReader()
version = data[1];
break;

case "language":
language = data[1];
break;

case "moneyBase":
moneyBase = data[1];
break;
Expand Down Expand Up @@ -105,7 +110,14 @@ internal SavedBuildReader()
pointSteps.Add(new(pStep[0], Convert.ToInt64(pStep[1..], 16)));
}

_savedBuilds.Add(buildId, new(buildId, version, moneyBase, chunkBase, foodTicketBase, drinkTicketBase, gearBase, tableTurfRankBase, new(tableTurfSpecialBase, specialSteps, tableTurfPointBase, pointSteps)));
if (language == "1")
{
_savedBuilds.Add(buildId, new(buildId, version, moneyBase, chunkBase, foodTicketBase, drinkTicketBase, gearBase, tableTurfRankBase, new(tableTurfSpecialBase, specialSteps, tableTurfPointBase, pointSteps)));
}
else
{
_savedBuilds.Add($"{buildId}.{language}", new($"{buildId}.{language}", version, moneyBase, chunkBase, foodTicketBase, drinkTicketBase, gearBase, tableTurfRankBase, new(tableTurfSpecialBase, specialSteps, tableTurfPointBase, pointSteps)));
}
}
}

Expand Down

0 comments on commit d177722

Please sign in to comment.