@@ -41,13 +41,12 @@ private void Btn_DragDrop(object sender, DragEventArgs e)
41
41
var btn = ( Button ) sender ;
42
42
43
43
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 ) ;
50
44
45
+ if ( ! File . Exists ( settings . CompilerPath ) )
46
+ SetCompilerPath ( ) ;
47
+
48
+ if ( File . Exists ( settings . CompilerPath ) )
49
+ Compile ( fileList , btn . Name . Contains ( "Decompile" ) ) ;
51
50
}
52
51
53
52
private void Btn_DragEnter ( object sender , DragEventArgs e )
@@ -120,6 +119,7 @@ private void Check_Changed(object sender, EventArgs e)
120
119
settings . Hook = chk_Hook . Checked ;
121
120
settings . Overwrite = chk_Overwrite . Checked ;
122
121
settings . SumBits = chk_SumBits . Checked ;
122
+ settings . BigEndianFlow = chk_BigEndianFlowP3RE . Checked ;
123
123
124
124
settings . SaveJson ( settings ) ;
125
125
}
@@ -132,6 +132,9 @@ private void ToggleTheme_Click(object sender, EventArgs e)
132
132
133
133
private void InjectMSG_Click ( object sender , EventArgs e )
134
134
{
135
+ if ( ! File . Exists ( settings . CompilerPath ) && ! SetCompilerPath ( ) )
136
+ return ;
137
+
135
138
string bfPath = "" ;
136
139
string msgPath = "" ;
137
140
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)
145
148
else
146
149
msgPath = msgSelect . FirstOrDefault ( ) ;
147
150
148
- FlowScript flowScript = FlowScript . FromFile ( bfPath , AtlusEncoding . GetByName ( comboBox_Encoding . SelectedItem . ToString ( ) ) ) ;
151
+ FlowScript flowScript = FlowScript . FromFile ( bfPath , GetSelectedEncoding ( ) ) ;
149
152
MessageScript messageScript ;
150
153
151
154
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 ( ) ) ;
153
156
else
154
157
using ( FileStream fileStream = File . OpenRead ( msgPath ) )
155
158
{
156
159
MessageScriptCompiler messageScriptCompiler = new MessageScriptCompiler (
157
- AtlusScriptLibrary . MessageScriptLanguage . FormatVersion . Version1BigEndian , AtlusEncoding . GetByName ( comboBox_Encoding . SelectedItem . ToString ( ) ) ) ;
160
+ AtlusScriptLibrary . MessageScriptLanguage . FormatVersion . Version1BigEndian , GetSelectedEncoding ( ) ) ;
158
161
messageScriptCompiler . AddListener ( new ConsoleLogListener ( true , LogLevel . Info | LogLevel . Warning
159
162
| LogLevel . Error | LogLevel . Fatal ) ) ;
160
163
messageScriptCompiler . Library = LibraryLookup . GetLibrary ( "P5R" ) ;
@@ -166,5 +169,14 @@ private void InjectMSG_Click(object sender, EventArgs e)
166
169
MessageBox . Show ( "Done injecting message into .BF!" ) ;
167
170
}
168
171
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
+ }
169
181
}
170
182
}
0 commit comments