Skip to content

Commit 6660629

Browse files
committed
Add P3R support
- Added P3R to games list - Added ability to decompile uassets to .flow/.msg and vice versa - Added toggle for V4/V4BE BF output - Check for AtlusScriptCompiler.exe path when picking files instead of at startup - Added option to change AtlusScriptCompiler.exe path
1 parent 2a16de6 commit 6660629

File tree

5 files changed

+140
-42
lines changed

5 files changed

+140
-42
lines changed

Config.cs

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class Config
1919
public bool Overwrite { get; set; } = false;
2020
public bool SumBits { get; set; } = true;
2121
public bool DeleteHeader { get; set; } = false;
22+
public bool BigEndianFlow { get; set; } = true;
2223

2324
public void SaveJson(Config settings)
2425
{

Events.cs

+21-9
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,12 @@ private void Btn_DragDrop(object sender, DragEventArgs e)
4141
var btn = (Button)sender;
4242

4343
string[] fileList = (string[])e.Data.GetData(DataFormats.FileDrop, false);
44-
if (File.Exists(CompilerPath))
45-
Compile(fileList, btn.Name.Contains("Decompile"));
46-
else
47-
MessageBox.Show("Could not find AtlusScriptCompiler.exe. " +
48-
"Change the path in Config.json and try running this program again!",
49-
"Critical Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
5044

45+
if (!File.Exists(settings.CompilerPath))
46+
SetCompilerPath();
47+
48+
if (File.Exists(settings.CompilerPath))
49+
Compile(fileList, btn.Name.Contains("Decompile"));
5150
}
5251

5352
private void Btn_DragEnter(object sender, DragEventArgs e)
@@ -120,6 +119,7 @@ private void Check_Changed(object sender, EventArgs e)
120119
settings.Hook = chk_Hook.Checked;
121120
settings.Overwrite = chk_Overwrite.Checked;
122121
settings.SumBits = chk_SumBits.Checked;
122+
settings.BigEndianFlow = chk_BigEndianFlowP3RE.Checked;
123123

124124
settings.SaveJson(settings);
125125
}
@@ -132,6 +132,9 @@ private void ToggleTheme_Click(object sender, EventArgs e)
132132

133133
private void InjectMSG_Click(object sender, EventArgs e)
134134
{
135+
if (!File.Exists(settings.CompilerPath) && !SetCompilerPath())
136+
return;
137+
135138
string bfPath = "";
136139
string msgPath = "";
137140
var bfSelect = ShrineFox.IO.WinFormsDialogs.SelectFile("Choose Original BF File", false, new string[] { "Flowscript Binary (.BF)" });
@@ -145,16 +148,16 @@ private void InjectMSG_Click(object sender, EventArgs e)
145148
else
146149
msgPath = msgSelect.FirstOrDefault();
147150

148-
FlowScript flowScript = FlowScript.FromFile(bfPath, AtlusEncoding.GetByName(comboBox_Encoding.SelectedItem.ToString()));
151+
FlowScript flowScript = FlowScript.FromFile(bfPath, GetSelectedEncoding());
149152
MessageScript messageScript;
150153

151154
if (Path.GetExtension(msgPath).ToLower() == ".bmd")
152-
messageScript = MessageScript.FromFile(msgPath, AtlusScriptLibrary.MessageScriptLanguage.FormatVersion.Version1BigEndian, AtlusEncoding.GetByName(comboBox_Encoding.SelectedItem.ToString()));
155+
messageScript = MessageScript.FromFile(msgPath, AtlusScriptLibrary.MessageScriptLanguage.FormatVersion.Version1BigEndian, GetSelectedEncoding());
153156
else
154157
using (FileStream fileStream = File.OpenRead(msgPath))
155158
{
156159
MessageScriptCompiler messageScriptCompiler = new MessageScriptCompiler(
157-
AtlusScriptLibrary.MessageScriptLanguage.FormatVersion.Version1BigEndian, AtlusEncoding.GetByName(comboBox_Encoding.SelectedItem.ToString()));
160+
AtlusScriptLibrary.MessageScriptLanguage.FormatVersion.Version1BigEndian, GetSelectedEncoding());
158161
messageScriptCompiler.AddListener(new ConsoleLogListener(true, LogLevel.Info | LogLevel.Warning
159162
| LogLevel.Error | LogLevel.Fatal));
160163
messageScriptCompiler.Library = LibraryLookup.GetLibrary("P5R");
@@ -166,5 +169,14 @@ private void InjectMSG_Click(object sender, EventArgs e)
166169
MessageBox.Show("Done injecting message into .BF!");
167170
}
168171

172+
private void SetScriptCompilerPath_Click(object sender, EventArgs e)
173+
{
174+
SetCompilerPath();
175+
}
176+
177+
private Encoding GetSelectedEncoding()
178+
{
179+
return AtlusEncoding.GetEncodings().First(x => x.Name.Equals(comboBox_Encoding.SelectedItem.ToString())).GetEncoding();
180+
}
169181
}
170182
}

Forms/MainForm.Designer.cs

+36-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Forms/MainForm.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ namespace AtlusScriptGUI
1212
{
1313
public partial class MainForm : MetroSetForm
1414
{
15-
public static Version version = new Version(3, 3);
15+
public static Version version = new Version(3, 4);
1616
public Config settings = new Config();
17-
public string CompilerPath { get; set; } = "./AtlusScriptCompiler.exe";
1817

1918
public MainForm(string[] args)
2019
{
@@ -26,12 +25,10 @@ public MainForm(string[] args)
2625
MenuStripHelper.SetMenuStripIcons(MenuStripHelper.GetMenuStripIconPairs("Icons.txt"), this);
2726

2827
ApplyCheckboxStates();
29-
SetCompilerPath(args);
3028
SetDropDowns();
3129
SetLogging();
3230

3331
this.Text += $" v{version.Major}.{version.Minor}";
3432
}
35-
3633
}
3734
}

0 commit comments

Comments
 (0)