@@ -161,22 +161,17 @@ begin |
| 161 |
SL.Free; |
161 |
SL.Free; |
| 162 |
end; |
162 |
end; |
| 163 |
|
163 |
|
| 164 |
function RenderRoutines(Routines: TRoutineBank): String; |
164 |
procedure WriteRoutinesToFile(Routines: TRoutineBank); |
| 165 |
var |
165 |
var |
| 166 |
I: Integer; |
166 |
I: Integer; |
| 167 |
SL: TStringList; |
167 |
F: Text; |
| 168 |
begin |
168 |
begin |
| 169 |
SL := TStringList.Create; |
|
|
| 170 |
|
|
|
| 171 |
for I := Low(TRoutineBank) to High(TRoutineBank) do begin |
169 |
for I := Low(TRoutineBank) to High(TRoutineBank) do begin |
| 172 |
SL.Add(Format('__hUGE_Routine_%d:', [I])); |
170 |
AssignFile(F, './hUGEDriver/routine'+IntToStr(I)+'.htt'); |
| 173 |
SL.Add(Routines[I]); |
171 |
Rewrite(F); |
| 174 |
SL.Add(Format('__end_hUGE_Routine_%d:', [I])); |
172 |
Write(F, Routines[I]); |
| 175 |
SL.Add(Format('ds 16 - (__end_hUGE_Routine_%d - __hUGE_Routine_%d)', [I, I])); |
173 |
CloseFile(F); |
| 176 |
end; |
174 |
end; |
| 177 |
|
|
|
| 178 |
Result := SL.Text; |
|
|
| 179 |
SL.Free |
|
|
| 180 |
end; |
175 |
end; |
| 181 |
|
176 |
|
| 182 |
function RenderPreviewROM(Song: TSong): Boolean; |
177 |
function RenderPreviewROM(Song: TSong): Boolean; |
@@ -216,10 +211,7 @@ begin |
| 216 |
Write(OutFile, RenderInstruments(Song.Instruments)); |
211 |
Write(OutFile, RenderInstruments(Song.Instruments)); |
| 217 |
CloseFile(OutFile); |
212 |
CloseFile(OutFile); |
| 218 |
|
213 |
|
| 219 |
AssignFile(OutFile, './hUGEDriver/routine.htt'); |
214 |
WriteRoutinesToFile(Song.Routines); |
| 220 |
Rewrite(OutFile); |
|
|
| 221 |
Write(OutFile, RenderRoutines(Song.Routines)); |
|
|
| 222 |
CloseFile(OutFile); |
|
|
| 223 |
|
215 |
|
| 224 |
AssignFile(OutFile, './hUGEDriver/pattern.htt'); |
216 |
AssignFile(OutFile, './hUGEDriver/pattern.htt'); |
| 225 |
Rewrite(OutFile); |
217 |
Rewrite(OutFile); |
@@ -283,16 +275,27 @@ begin |
| 283 |
AssemblyError: |
275 |
AssemblyError: |
| 284 |
Result := False; |
276 |
Result := False; |
| 285 |
OutSL.LoadFromStream(Proc.Output); |
277 |
OutSL.LoadFromStream(Proc.Output); |
| 286 |
MessageDlg( |
278 |
|
| 287 |
'Error!', |
279 |
if OutSL.Text.Contains('routine') then |
| 288 |
'There was an error assembling the song for playback.'+LineEnding+LineEnding+ |
280 |
MessageDlg( |
| 289 |
Proc.Executable+' output:'+LineEnding+ |
281 |
'Error!', |
| 290 |
OutSL.Text+LineEnding+LineEnding+ |
282 |
'There was an error assembling the song for playback.'+LineEnding+LineEnding+ |
| 291 |
'Please report this issue on the hUGETracker GitHub issues page, and '+ |
283 |
Proc.Executable+' output:'+LineEnding+ |
| 292 |
'post your song file!', |
284 |
OutSL.Text, |
| 293 |
mtError, |
285 |
mtError, |
| 294 |
[mbOK], |
286 |
[mbOK], |
| 295 |
0); |
287 |
0) |
|
|
288 |
else |
|
|
289 |
MessageDlg( |
|
|
290 |
'Error!', |
|
|
291 |
'There was an error assembling the song for playback.'+LineEnding+LineEnding+ |
|
|
292 |
Proc.Executable+' output:'+LineEnding+ |
|
|
293 |
OutSL.Text+LineEnding+LineEnding+ |
|
|
294 |
'Please report this issue on the hUGETracker GitHub issues page, and '+ |
|
|
295 |
'post your song file!', |
|
|
296 |
mtError, |
|
|
297 |
[mbOK], |
|
|
298 |
0); |
| 296 |
|
299 |
|
| 297 |
Cleanup: |
300 |
Cleanup: |
| 298 |
Proc.Free; |
301 |
Proc.Free; |