Skip to content

Commit 0b7a967

Browse files
committed
Add Compiler Updater, Remove Exe Select
- Adds an option to update to latest AtlusScriptCompiler via GitHub - Remove option to set AtlusScriptCompiler path (defaults to installation in AtlusScriptGUI folder) - Auto-download latest AtlusScriptCompiler when Exe is not found - Add toggle for showing output log (will simply print whether task succeeded or failed, helpful to speed up process for large files)
1 parent 9768296 commit 0b7a967

16 files changed

+266
-81
lines changed

App.config

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<startup>
4-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
55
</startup>
66
<System.Windows.Forms.ApplicationConfigurationSection>
77
<add key="DpiAwareness" value="PerMonitorV2" />
88
<add key="EnableWindowsFormsHighDpiAutoResizing" value="false" />
99
</System.Windows.Forms.ApplicationConfigurationSection>
10+
<runtime>
11+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
12+
<dependentAssembly>
13+
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
14+
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
15+
</dependentAssembly>
16+
</assemblyBinding>
17+
</runtime>
1018
</configuration>

AtlusScriptGUI.csproj

+50-1
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,41 @@
5454
<Reference Include="MetroSet UI, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
5555
<HintPath>packages\MetroSet_UI.2.0.0\lib\net45\MetroSet UI.dll</HintPath>
5656
</Reference>
57+
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
58+
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.9.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
59+
</Reference>
5760
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
5861
<HintPath>packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
5962
</Reference>
6063
<Reference Include="System" />
64+
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
65+
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
66+
</Reference>
6167
<Reference Include="System.Core" />
6268
<Reference Include="System.Design" />
69+
<Reference Include="System.IO.Pipelines, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
70+
<HintPath>packages\System.IO.Pipelines.9.0.0\lib\net462\System.IO.Pipelines.dll</HintPath>
71+
</Reference>
72+
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
73+
<HintPath>packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
74+
</Reference>
75+
<Reference Include="System.Numerics" />
76+
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
77+
<HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
78+
</Reference>
79+
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
80+
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
81+
</Reference>
6382
<Reference Include="System.Runtime.Serialization" />
83+
<Reference Include="System.Text.Encodings.Web, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
84+
<HintPath>packages\System.Text.Encodings.Web.9.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
85+
</Reference>
86+
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
87+
<HintPath>packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
88+
</Reference>
89+
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
90+
<HintPath>packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
91+
</Reference>
6492
<Reference Include="System.Xaml" />
6593
<Reference Include="System.Xml.Linq" />
6694
<Reference Include="System.Data.DataSetExtensions" />
@@ -95,6 +123,12 @@
95123
<ItemGroup>
96124
<None Include="App.config" />
97125
<None Include="packages.config" />
126+
<None Include="Updater\AtlusScriptToolsUpdater.deps.json">
127+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
128+
</None>
129+
<None Include="Updater\AtlusScriptToolsUpdater.runtimeconfig.json">
130+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
131+
</None>
98132
</ItemGroup>
99133
<ItemGroup>
100134
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
@@ -113,7 +147,7 @@
113147
</ItemGroup>
114148
<ItemGroup>
115149
<ProjectReference Include="..\Atlus-Script-Tools\Source\AtlusScriptLibrary\AtlusScriptLibrary.csproj">
116-
<Project>{62ee486f-ae33-4dbb-ac4c-409a22cb04ad}</Project>
150+
<Project>{6d910840-55be-428d-a714-791fe0e01661}</Project>
117151
<Name>AtlusScriptLibrary</Name>
118152
</ProjectReference>
119153
<ProjectReference Include="..\ShrineFox.IO\ShrineFox.IO.csproj">
@@ -126,6 +160,21 @@
126160
<Content Include="Icons.txt">
127161
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
128162
</Content>
163+
<Content Include="Updater\AtlusScriptToolsUpdater.dll">
164+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
165+
</Content>
166+
<Content Include="Updater\AtlusScriptToolsUpdater.exe">
167+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
168+
</Content>
169+
<Content Include="Updater\AtlusScriptToolsUpdater.pdb">
170+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
171+
</Content>
172+
<Content Include="Updater\Octokit.dll">
173+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
174+
</Content>
175+
<Content Include="Updater\Version.txt">
176+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
177+
</Content>
129178
</ItemGroup>
130179
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
131180
</Project>

AtlusScriptGUI.sln

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AtlusScriptGUI", "AtlusScri
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShrineFox.IO", "..\ShrineFox.IO\ShrineFox.IO.csproj", "{7640412A-7372-4925-B20C-0178D8818A8F}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AtlusScriptLibrary", "..\Atlus-Script-Tools\Source\AtlusScriptLibrary\AtlusScriptLibrary.csproj", "{62EE486F-AE33-4DBB-AC4C-409A22CB04AD}"
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AtlusScriptLibrary", "..\Atlus-Script-Tools\Source\AtlusScriptLibrary\AtlusScriptLibrary.csproj", "{6D910840-55BE-428D-A714-791FE0E01661}"
1111
EndProject
1212
Global
1313
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -23,10 +23,10 @@ Global
2323
{7640412A-7372-4925-B20C-0178D8818A8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
2424
{7640412A-7372-4925-B20C-0178D8818A8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
2525
{7640412A-7372-4925-B20C-0178D8818A8F}.Release|Any CPU.Build.0 = Release|Any CPU
26-
{62EE486F-AE33-4DBB-AC4C-409A22CB04AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27-
{62EE486F-AE33-4DBB-AC4C-409A22CB04AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
28-
{62EE486F-AE33-4DBB-AC4C-409A22CB04AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
29-
{62EE486F-AE33-4DBB-AC4C-409A22CB04AD}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{6D910840-55BE-428D-A714-791FE0E01661}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{6D910840-55BE-428D-A714-791FE0E01661}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{6D910840-55BE-428D-A714-791FE0E01661}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{6D910840-55BE-428D-A714-791FE0E01661}.Release|Any CPU.Build.0 = Release|Any CPU
3030
EndGlobalSection
3131
GlobalSection(SolutionProperties) = preSolution
3232
HideSolutionNode = FALSE

Config.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Newtonsoft.Json;
2+
using ShrineFox.IO;
23
using System.IO;
34

45
namespace AtlusScriptGUI
@@ -7,14 +8,14 @@ public class Config
78
{
89
public string Game { get; set; } = "Persona 5 Royal (PC/Switch)";
910
public string Encoding { get; set; } = "P5R_EFIGS";
10-
public string CompilerPath { get; set; } = "./AtlusScriptCompiler.exe";
1111
public bool DarkMode { get; set; } = true;
1212
public bool Hook { get; set; } = true;
1313
public bool Disassemble { get; set; } = false;
1414
public bool Overwrite { get; set; } = false;
1515
public bool SumBits { get; set; } = true;
1616
public bool DeleteHeader { get; set; } = false;
1717
public bool BigEndianFlow { get; set; } = true;
18+
public bool CompilerLogOutput { get; set; } = true;
1819

1920
public void SaveJson(Config settings)
2021
{

Events.cs

+22-11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public partial class MainForm : MetroSetForm
1818
{
1919
private void Btn_Click(object sender, EventArgs e)
2020
{
21+
if (!File.Exists(CompilerPath))
22+
RunUpdater();
23+
2124
var btn = (Button)sender;
2225
bool decompile = btn.Name.Contains("Decompile");
2326

@@ -31,15 +34,14 @@ private void Btn_Click(object sender, EventArgs e)
3134

3235
private void Btn_DragDrop(object sender, DragEventArgs e)
3336
{
37+
if (!File.Exists(CompilerPath))
38+
RunUpdater();
39+
3440
var btn = (Button)sender;
3541

3642
string[] fileList = (string[])e.Data.GetData(DataFormats.FileDrop, false);
3743

38-
if (!File.Exists(settings.CompilerPath))
39-
SetCompilerPath();
40-
41-
if (File.Exists(settings.CompilerPath))
42-
Compile(fileList, btn.Name.Contains("Decompile"));
44+
Compile(fileList, btn.Name.Contains("Decompile"));
4345
}
4446

4547
private void Btn_DragEnter(object sender, DragEventArgs e)
@@ -67,6 +69,8 @@ private void Encoding_Changed(object sender, EventArgs e)
6769

6870
settings.Encoding = comboBox_Encoding.SelectedItem.ToString();
6971
settings.SaveJson(settings);
72+
var encoding = GetSelectedEncoding();
73+
Output.Log(encoding.EncodingName);
7074
}
7175

7276
private void VanillaText_Changed(object sender, EventArgs e)
@@ -107,6 +111,7 @@ private void Check_Changed(object sender, EventArgs e)
107111
if (!item.Enabled)
108112
return;
109113

114+
settings.CompilerLogOutput = chk_CompilerLogOutput.Checked;
110115
settings.DeleteHeader = chk_DeleteHeader.Checked;
111116
settings.Disassemble = chk_Disassemble.Checked;
112117
settings.Hook = chk_Hook.Checked;
@@ -125,8 +130,8 @@ private void ToggleTheme_Click(object sender, EventArgs e)
125130

126131
private void InjectMSG_Click(object sender, EventArgs e)
127132
{
128-
if (!File.Exists(settings.CompilerPath) && !SetCompilerPath())
129-
return;
133+
if (!File.Exists(CompilerPath))
134+
RunUpdater();
130135

131136
string bfPath = "";
132137
string msgPath = "";
@@ -162,14 +167,20 @@ private void InjectMSG_Click(object sender, EventArgs e)
162167
MessageBox.Show("Done injecting message into .BF!");
163168
}
164169

165-
private void SetScriptCompilerPath_Click(object sender, EventArgs e)
170+
private Encoding GetSelectedEncoding()
166171
{
167-
SetCompilerPath();
172+
return AtlusEncoding.GetEncodings().First(x => x.Name.Equals(comboBox_Encoding.SelectedItem.ToString())).GetEncoding();
168173
}
169174

170-
private Encoding GetSelectedEncoding()
175+
private void UpdateCompiler_Click(object sender, EventArgs e)
171176
{
172-
return AtlusEncoding.GetEncodings().First(x => x.Name.Equals(comboBox_Encoding.SelectedItem.ToString())).GetEncoding();
177+
RunUpdater();
178+
}
179+
180+
private void RunUpdater()
181+
{
182+
Exe.Run(Path.Combine(Exe.Directory(), "Updater/AtlusScriptToolsUpdater.exe"), Exe.Directory(), false, "", false, false);
183+
Environment.Exit(0);
173184
}
174185
}
175186
}

0 commit comments

Comments
 (0)