Commit 43020c9

Nick committed on
Adding GBS Export
commit 43020c98d37f042e3fe8adf0893d94a4cc5bf39c parent 83029d0
4 changed files +184−80
Modifiedcodegen.pas +66−26
@@ -5,19 +5,14 @@ unit Codegen;
5 interface 5 interface
6 6
7 uses 7 uses
8 Classes, SysUtils, math, 8 Classes, SysUtils, math, Instruments, Song, Utils,
9 Waves, Instruments, Song, Utils, 9 HugeDatatypes, Constants, dialogs, strutils, FileUtil, LazFileUtils;
10 HugeDatatypes, Constants, dialogs;
11 10
12 function RenderOrderTable(OrderMatrix: TOrderMatrix): String; 11 type
13 function RenderInstruments(Instruments: TInstrumentBank): String; 12 TExportMode = (emNormal, emPreview, emGBS);
14 function RenderPattern(Name: String; Pattern: TPattern): String;
15 function RenderWaveforms(Waves: TWaveBank): String;
16 13
17 function RenderPreviewRom(Song: TSong): Boolean; 14 function RenderPreviewRom(Song: TSong): Boolean;
18 procedure RenderSongToFile(Song: TSong; Filename: String); 15 function RenderSongToFile(Song: TSong; Filename: String; Mode: TExportMode = emNormal): Boolean;
19
20 //TODO: RenderRoutines
21 16
22 implementation 17 implementation
23 18
@@ -142,14 +137,48 @@ begin
142 ResultSL.Free; 137 ResultSL.Free;
143 end; 138 end;
144 139
140 function RenderConstants(Song: TSong; Mode: TExportMode): String;
141 var
142 SL: TStringList;
143 begin
144 SL := TSTringList.Create;
145
146 if Mode = emPreview then
147 SL.Add('PREVIEW_MODE EQU 1')
148 else if Mode = emGBS then begin
149 SL.Add('GBS_MODE EQU 1');
150 SL.Add('GBS_TITLE EQUS "\"' + PadRight(Song.Name, 32) + '\""');
151 SL.Add('GBS_AUTHOR EQUS "\"' + PadRight(Song.Artist, 32) + '\""');
152 SL.Add('GBS_COPYRIGHT EQUS "\"' + PadRight(IntToStr(CurrentYear), 32) + '\""');
153 end;
154 SL.Add('TICKS EQU '+IntToStr(Song.TicksPerRow));
155
156 Result := SL.Text;
157 SL.Free;
158 end;
159
145 function RenderPreviewROM(Song: TSong): Boolean; 160 function RenderPreviewROM(Song: TSong): Boolean;
161 begin
162 Result := RenderSongToFile(Song, 'preview.gb', emPreview);
163 end;
164
165 function RenderSongToFile(Song: TSong; Filename: String; Mode: TExportMode = emNormal): Boolean;
146 var 166 var
147 OutFile: Text; 167 OutFile: Text;
148 I: Integer; 168 I: Integer;
149 Proc: TProcess; 169 Proc: TProcess;
150 OutSL: TStringList; 170 OutSL: TStringList;
171 FilePath: String;
151 label AssemblyError, Cleanup; 172 label AssemblyError, Cleanup;
152 begin 173 begin
174 FilePath := Filename;
175 Filename := ExtractFileNameWithoutExt(ExtractFileNameOnly(Filename));
176
177 AssignFile(OutFile, './hUGEDriver/constants.htt');
178 Rewrite(OutFile);
179 Write(OutFile, RenderConstants(Song, Mode));
180 CloseFile(OutFile);
181
153 AssignFile(OutFile, './hUGEDriver/wave.htt'); 182 AssignFile(OutFile, './hUGEDriver/wave.htt');
154 Rewrite(OutFile); 183 Rewrite(OutFile);
155 Write(OutFile, RenderWaveforms(Song.Waves)); 184 Write(OutFile, RenderWaveforms(Song.Waves));
@@ -182,27 +211,42 @@ begin
182 211
183 Proc.Executable := 'rgbasm'; 212 Proc.Executable := 'rgbasm';
184 Proc.Parameters.Clear; 213 Proc.Parameters.Clear;
185 Proc.Parameters.add('-opreview.obj'); 214 Proc.Parameters.add('-o'+Filename+'.obj');
186 Proc.Parameters.add('driverLite.z80'); 215 Proc.Parameters.add('driverLite.z80');
187 Proc.Execute; 216 Proc.Execute;
188 if Proc.ExitCode <> 0 then goto AssemblyError; 217 if Proc.ExitCode <> 0 then goto AssemblyError;
189 218
190 Proc.Executable := 'rgblink'; 219 Proc.Executable := 'rgblink';
191 Proc.Parameters.Clear; 220 Proc.Parameters.Clear;
192 Proc.Parameters.add('-mpreview.map'); 221 Proc.Parameters.add('-m'+Filename+'.map');
193 Proc.Parameters.add('-npreview.sym'); 222 Proc.Parameters.add('-n'+Filename+'.sym');
194 Proc.Parameters.add('-opreview.gb'); 223 if Mode = emGBS then
195 Proc.Parameters.add('preview.obj'); 224 Proc.Parameters.add('-o'+Filename+'.gbs')
225 else
226 Proc.Parameters.add('-o'+Filename+'.gb');
227 Proc.Parameters.add(Filename+'.obj');
196 Proc.Execute; 228 Proc.Execute;
197 if Proc.ExitCode <> 0 then goto AssemblyError; 229 if Proc.ExitCode <> 0 then goto AssemblyError;
198 230
199 Proc.Executable := 'rgbfix'; 231 if Mode <> emGBS then begin
200 Proc.Parameters.Clear; 232 Proc.Executable := 'rgbfix';
201 Proc.Parameters.add('-p0'); 233 Proc.Parameters.Clear;
202 Proc.Parameters.add('-v'); 234 Proc.Parameters.add('-p0');
203 Proc.Parameters.add('preview.gb'); 235 Proc.Parameters.add('-v');
204 Proc.Execute; 236 Proc.Parameters.add(Filename+'.gb');
205 if Proc.ExitCode <> 0 then goto AssemblyError; 237 Proc.Execute;
238 if Proc.ExitCode <> 0 then goto AssemblyError;
239 end;
240
241 if not CopyFile(Filename+IfThen(Mode = emGBS, '.gbs', '.gb'), FilePath) then begin
242 MessageDlg('Error!',
243 'Couldn''t move the file to its new location. Make sure your path is correct!',
244 mtError,
245 [mbOk],
246 0);
247 Result := False;
248 goto Cleanup;
249 end;
206 250
207 Result := True; 251 Result := True;
208 goto Cleanup; 252 goto Cleanup;
@@ -226,9 +270,5 @@ begin
226 Chdir('..'); 270 Chdir('..');
227 end; 271 end;
228 272
229 procedure RenderSongToFile(Song: TSong; Filename: String);
230 begin
231 end;
232
233 end. 273 end.
234 274
ModifiedhUGEDriver +1−1
@@ -1 +1 @@
1 Subproject commit 0f883e4c8992a2e7dfd8794e98a5ac5cb383141a 1 Subproject commit 160c12c1e3e709df05160b4904b93b882f432c84
Modifiedtracker.lfm +95−41
@@ -1,7 +1,7 @@
1 object frmTracker: TfrmTracker 1 object frmTracker: TfrmTracker
2 Left = 839 2 Left = 634
3 Height = 1275 3 Height = 1275
4 Top = 187 4 Top = 354
5 Width = 2056 5 Width = 2056
6 Caption = 'hUGETracker' 6 Caption = 'hUGETracker'
7 ClientHeight = 1241 7 ClientHeight = 1241
@@ -55,15 +55,15 @@ object frmTracker: TfrmTracker
55 Height = 845 55 Height = 845
56 Top = 0 56 Top = 0
57 Width = 1709 57 Width = 1709
58 ActivePage = InstrumentTabSheet 58 ActivePage = CommentsTabSheet
59 Align = alClient 59 Align = alClient
60 ParentFont = False 60 ParentFont = False
61 TabIndex = 2 61 TabIndex = 4
62 TabOrder = 0 62 TabOrder = 0
63 object GeneralTabSheet: TTabSheet 63 object GeneralTabSheet: TTabSheet
64 Caption = 'General' 64 Caption = 'General'
65 ClientHeight = 903 65 ClientHeight = 802
66 ClientWidth = 1857 66 ClientWidth = 1701
67 ParentFont = False 67 ParentFont = False
68 object SongInformationGroupbox: TGroupBox 68 object SongInformationGroupbox: TGroupBox
69 Left = 14 69 Left = 14
@@ -139,17 +139,17 @@ object frmTracker: TfrmTracker
139 end 139 end
140 object PatternTabSheet: TTabSheet 140 object PatternTabSheet: TTabSheet
141 Caption = 'Patterns' 141 Caption = 'Patterns'
142 ClientHeight = 903 142 ClientHeight = 802
143 ClientWidth = 1857 143 ClientWidth = 1701
144 ParentFont = False 144 ParentFont = False
145 object Panel3: TPanel 145 object Panel3: TPanel
146 Left = 392 146 Left = 392
147 Height = 903 147 Height = 802
148 Top = 0 148 Top = 0
149 Width = 1465 149 Width = 1309
150 Align = alClient 150 Align = alClient
151 ClientHeight = 903 151 ClientHeight = 802
152 ClientWidth = 1465 152 ClientWidth = 1309
153 ParentFont = False 153 ParentFont = False
154 TabOrder = 0 154 TabOrder = 0
155 object HeaderControl1: THeaderControl 155 object HeaderControl1: THeaderControl
@@ -157,7 +157,7 @@ object frmTracker: TfrmTracker
157 Height = 52 157 Height = 52
158 Hint = 'Left click to mute, right click to solo' 158 Hint = 'Left click to mute, right click to solo'
159 Top = 1 159 Top = 1
160 Width = 1463 160 Width = 1307
161 DragReorder = False 161 DragReorder = False
162 Images = ImageList2 162 Images = ImageList2
163 Sections = < 163 Sections = <
@@ -197,9 +197,9 @@ object frmTracker: TfrmTracker
197 end 197 end
198 object ScrollBox1: TScrollBox 198 object ScrollBox1: TScrollBox
199 Left = 1 199 Left = 1
200 Height = 849 200 Height = 748
201 Top = 53 201 Top = 53
202 Width = 1463 202 Width = 1307
203 HorzScrollBar.Increment = 1 203 HorzScrollBar.Increment = 1
204 HorzScrollBar.Page = 1 204 HorzScrollBar.Page = 1
205 HorzScrollBar.Smooth = True 205 HorzScrollBar.Smooth = True
@@ -216,7 +216,7 @@ object frmTracker: TfrmTracker
216 end 216 end
217 object OrderEditStringGrid: TStringGrid 217 object OrderEditStringGrid: TStringGrid
218 Left = 0 218 Left = 0
219 Height = 903 219 Height = 802
220 Top = 0 220 Top = 0
221 Width = 392 221 Width = 392
222 Align = alLeft 222 Align = alLeft
@@ -1111,16 +1111,16 @@ object frmTracker: TfrmTracker
1111 end 1111 end
1112 object WavesTabSheet: TTabSheet 1112 object WavesTabSheet: TTabSheet
1113 Caption = 'Waves' 1113 Caption = 'Waves'
1114 ClientHeight = 903 1114 ClientHeight = 802
1115 ClientWidth = 1857 1115 ClientWidth = 1701
1116 ParentFont = False 1116 ParentFont = False
1117 object WaveEditPaintBox: TPaintBox 1117 object WaveEditPaintBox: TPaintBox
1118 AnchorSideTop.Control = WaveEditGroupBox 1118 AnchorSideTop.Control = WaveEditGroupBox
1119 AnchorSideTop.Side = asrBottom 1119 AnchorSideTop.Side = asrBottom
1120 Left = 0 1120 Left = 0
1121 Height = 623 1121 Height = 522
1122 Top = 280 1122 Top = 280
1123 Width = 1857 1123 Width = 1701
1124 Align = alBottom 1124 Align = alBottom
1125 Anchors = [akTop, akLeft, akRight, akBottom] 1125 Anchors = [akTop, akLeft, akRight, akBottom]
1126 BorderSpacing.Top = 23 1126 BorderSpacing.Top = 23
@@ -1183,16 +1183,16 @@ object frmTracker: TfrmTracker
1183 end 1183 end
1184 object CommentsTabSheet: TTabSheet 1184 object CommentsTabSheet: TTabSheet
1185 Caption = 'Comments' 1185 Caption = 'Comments'
1186 ClientHeight = 903 1186 ClientHeight = 802
1187 ClientWidth = 1857 1187 ClientWidth = 1701
1188 ParentFont = False 1188 ParentFont = False
1189 object CommentMemo: TMemo 1189 object CommentMemo: TMemo
1190 AnchorSideTop.Control = Label17 1190 AnchorSideTop.Control = Label17
1191 AnchorSideTop.Side = asrBottom 1191 AnchorSideTop.Side = asrBottom
1192 Left = 0 1192 Left = 0
1193 Height = 836 1193 Height = 735
1194 Top = 67 1194 Top = 67
1195 Width = 1857 1195 Width = 1701
1196 Align = alBottom 1196 Align = alBottom
1197 Anchors = [akTop, akLeft, akRight, akBottom] 1197 Anchors = [akTop, akLeft, akRight, akBottom]
1198 BorderSpacing.Top = 23 1198 BorderSpacing.Top = 23
@@ -1894,7 +1894,7 @@ object frmTracker: TfrmTracker
1894 ParentShowHint = False 1894 ParentShowHint = False
1895 end 1895 end
1896 object PanicToolButton: TToolButton 1896 object PanicToolButton: TToolButton
1897 Left = 428 1897 Left = 547
1898 Hint = 'Stops all sound output' 1898 Hint = 'Stops all sound output'
1899 Top = 0 1899 Top = 0
1900 AutoSize = True 1900 AutoSize = True
@@ -1918,13 +1918,13 @@ object frmTracker: TfrmTracker
1918 ImageIndex = 73 1918 ImageIndex = 73
1919 OnClick = ToolButton4Click 1919 OnClick = ToolButton4Click
1920 end 1920 end
1921 object ToolButton5: TToolButton 1921 object ExportGBButton: TToolButton
1922 Left = 284 1922 Left = 284
1923 Top = 0 1923 Top = 0
1924 AutoSize = True 1924 AutoSize = True
1925 Caption = 'Export song' 1925 Caption = 'Export .GB'
1926 ImageIndex = 76 1926 ImageIndex = 76
1927 OnClick = ToolButton5Click 1927 OnClick = ExportGBButtonClick
1928 end 1928 end
1929 object ToolButton8: TToolButton 1929 object ToolButton8: TToolButton
1930 Left = 120 1930 Left = 120
@@ -1941,14 +1941,14 @@ object frmTracker: TfrmTracker
1941 Style = tbsDivider 1941 Style = tbsDivider
1942 end 1942 end
1943 object ToolButton7: TToolButton 1943 object ToolButton7: TToolButton
1944 Left = 420 1944 Left = 539
1945 Height = 39 1945 Height = 39
1946 Top = 0 1946 Top = 0
1947 Caption = 'ToolButton7' 1947 Caption = 'ToolButton7'
1948 Style = tbsSeparator 1948 Style = tbsSeparator
1949 end 1949 end
1950 object OctaveSpinEdit: TSpinEdit 1950 object OctaveSpinEdit: TSpinEdit
1951 Left = 589 1951 Left = 708
1952 Height = 38 1952 Height = 38
1953 Top = 0 1953 Top = 0
1954 Width = 158 1954 Width = 158
@@ -1957,14 +1957,14 @@ object frmTracker: TfrmTracker
1957 TabOrder = 0 1957 TabOrder = 0
1958 end 1958 end
1959 object ToolButton9: TToolButton 1959 object ToolButton9: TToolButton
1960 Left = 504 1960 Left = 623
1961 Height = 39 1961 Height = 39
1962 Top = 0 1962 Top = 0
1963 Caption = 'ToolButton9' 1963 Caption = 'ToolButton9'
1964 Style = tbsSeparator 1964 Style = tbsSeparator
1965 end 1965 end
1966 object Label22: TLabel 1966 object Label22: TLabel
1967 Left = 512 1967 Left = 631
1968 Height = 30 1968 Height = 30
1969 Top = 0 1969 Top = 0
1970 Width = 77 1970 Width = 77
@@ -1972,7 +1972,7 @@ object frmTracker: TfrmTracker
1972 ParentColor = False 1972 ParentColor = False
1973 end 1973 end
1974 object Label23: TLabel 1974 object Label23: TLabel
1975 Left = 747 1975 Left = 866
1976 Height = 30 1976 Height = 30
1977 Top = 0 1977 Top = 0
1978 Width = 125 1978 Width = 125
@@ -1980,7 +1980,7 @@ object frmTracker: TfrmTracker
1980 ParentColor = False 1980 ParentColor = False
1981 end 1981 end
1982 object InstrumentComboBox: TComboBox 1982 object InstrumentComboBox: TComboBox
1983 Left = 872 1983 Left = 991
1984 Height = 38 1984 Height = 38
1985 Top = 0 1985 Top = 0
1986 Width = 375 1986 Width = 375
@@ -2010,7 +2010,7 @@ object frmTracker: TfrmTracker
2010 Text = '(no instrument)' 2010 Text = '(no instrument)'
2011 end 2011 end
2012 object Label24: TLabel 2012 object Label24: TLabel
2013 Left = 1247 2013 Left = 1366
2014 Height = 30 2014 Height = 30
2015 Top = 0 2015 Top = 0
2016 Width = 64 2016 Width = 64
@@ -2018,7 +2018,7 @@ object frmTracker: TfrmTracker
2018 ParentColor = False 2018 ParentColor = False
2019 end 2019 end
2020 object StepSpinEdit: TSpinEdit 2020 object StepSpinEdit: TSpinEdit
2021 Left = 1311 2021 Left = 1430
2022 Height = 38 2022 Height = 38
2023 Top = 0 2023 Top = 0
2024 Width = 88 2024 Width = 88
@@ -2033,6 +2033,13 @@ object frmTracker: TfrmTracker
2033 ImageIndex = 74 2033 ImageIndex = 74
2034 OnClick = ToolButton3Click 2034 OnClick = ToolButton3Click
2035 end 2035 end
2036 object ExportGBSButton: TToolButton
2037 Left = 406
2038 Top = 0
2039 Caption = 'Export .GBS'
2040 ImageIndex = 77
2041 OnClick = ExportGBSButtonClick
2042 end
2036 end 2043 end
2037 object MainMenu1: TMainMenu 2044 object MainMenu1: TMainMenu
2038 Images = ImageList1 2045 Images = ImageList1
@@ -2206,7 +2213,7 @@ object frmTracker: TfrmTracker
2206 left = 232 2213 left = 232
2207 top = 80 2214 top = 80
2208 Bitmap = { 2215 Bitmap = {
2209 4C694D0000001000000010000000000000000000000000000000000000000000 2216 4C694E0000001000000010000000000000000000000000000000000000000000
2210 0000000000000000000000000000000000000000000000000000000000000000 2217 0000000000000000000000000000000000000000000000000000000000000000
2211 0000000000000000000000000000000000000000000000000000000000000000 2218 0000000000000000000000000000000000000000000000000000000000000000
2212 0000000000000000000000000000000000000000000000000000000000000000 2219 0000000000000000000000000000000000000000000000000000000000000000
@@ -4670,7 +4677,39 @@ object frmTracker: TfrmTracker
4670 0B6600000026000000260000002600000026000000260000002600000B660000 4677 0B6600000026000000260000002600000026000000260000002600000B660000
4671 12D1000012D100000B660000001E0000000F000000170000001A0000001A0000 4678 12D1000012D100000B660000001E0000000F000000170000001A0000001A0000
4672 001A0000001A0000001A0000001A0000001A0000001A0000001A0000001A0000 4679 001A0000001A0000001A0000001A0000001A0000001A0000001A0000001A0000
4673 001A0000001A000000170000000F 4680 001A0000001A000000170000000FFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
4681 FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
4682 FF00FFFFFF00FFFFFF00FFFFFF00FFBB5500FFBB5500FFBB5500FFBB5500FFBB
4683 5500FFBB55FFFFBB5513FFBB5500FFBB5500FFBB5500FFBB5500402F16000000
4684 0000000000000000000000000000FFBB5500FFBB5500FFBB5500FFBB5500FFBB
4685 5500FFBB55FFFFBB5584FFBB5500FEB14B00FDAB4500FDAB4500FDAB4500BE81
4686 3400744F2000704A1C0069441700FFBB5500FFBB5500FFBB5500FFBB5500FFBB
4687 5500FFBB55FFFFBB55FDFFBB554EFEB14B00FDAB4500FDAB4500FDAB4500FDAB
4688 4500E89D3F00DF943800D2872E00FEB14B00FEB14B00FEB14B00FEB14B00FEB1
4689 4B00FEB14BFFE5942ED9FEB14BF4FEAE4835FDAB4500FDAB4500FDAB4500FDAB
4690 4500E89D3F00DF943800D2872E00FA952F00FA952F00FA952F00FA952F00FA95
4691 2F00FA952FFFFB9D370EE48620C6FA952FE9F887211AF7801A00F7801A00F190
4692 2D00E89D3F00DF943800D2872E00F77C1600F77C1600F77C1600F77C1600F77C
4693 1600F77C16FFF8831D00F8872107E27A14C9F77C16A2F77C1600F77C1600F18E
4694 2B00E89D3F00DF943800D2872E00EC862300EF892500F97B1500F97B1500F97B
4695 1500F97B15FFF97B1500F9831D00F97B1524EE7B15F1F97B1500F97B1500E89D
4696 3F00E89D3F00DF943800D2872E00E0943300E7993700F2993500FF8F2800FF8F
4697 2800FF8F28FFFF8F2800FF973100FF922B0CFF8F28F4FF8F2800F3953300E89D
4698 3F00E89D3F00DF943800D2872E00E0943300E7993700EE9E3B00F39F3B00FFA4
4699 3D00FFA43DFFFFA53E00FFA84200FFA43DFFFF9B3420EA903000E69B3D00E79C
4700 3E99E79C3E5CDF943800D2872E00E0943300E7993700EE9E3B00EE9E3B00F3A1
4701 3E00FCA843FFFCA84300FCA843FFF5A23F20D58A3100D58A3100D98E3400DF94
4702 38CCDF9438CCDE93375CD2872E00E0943300E4973540E79937CAE79937FCE799
4703 37FFE79937FCEA9B3900EE9E3C00D0852D99D2872ECCD2872ECCD2872ECCD287
4704 2ECCFFE597FFD2872ECCD0852D5CCB812400CB8124E7E8A745FFFAC25DFFEDB1
4705 4EFFCB8124DBCB812400C3792300C37923CCFFE392FFFFD56AFFFFD15DFFFFD1
4706 5DFFFFD15DFFFFD873FFC37923CC2D1C0500AE680FF2E19A38FFDF9837FFB671
4707 17FF844F0D6C2D1C05002E1C070089501399B56A18CCB56A18CCB56A18CCB56A
4708 18CCFFC538FFB56A18CCB76C195C00000020683B02879B5702F29A5702E56137
4709 02850000003300000031000000230000001300000004854D1000AE631300A75C
4710 0DCCA75C0DCCA95E0E5CB56A1800000000100000001A0000001A0000001A0000
4711 001A0000001A00000019000000120000000A00000002000000009D5206009C51
4712 06999C51065CA75C0D00B56A1800
4674 } 4713 }
4675 end 4714 end
4676 object OpenDialog1: TOpenDialog 4715 object OpenDialog1: TOpenDialog
@@ -4678,10 +4717,10 @@ object frmTracker: TfrmTracker
4678 left = 737 4717 left = 737
4679 top = 75 4718 top = 75
4680 end 4719 end
4681 object SaveDialog1: TSaveDialog 4720 object InstrumentSaveDialog: TSaveDialog
4682 Filter = 'hUGETracker Instruments|*.ugi' 4721 Filter = 'hUGETracker Instruments|*.ugi'
4683 left = 868 4722 left = 632
4684 top = 75 4723 top = 192
4685 end 4724 end
4686 object OrderEditPopup: TPopupMenu 4725 object OrderEditPopup: TPopupMenu
4687 left = 376 4726 left = 376
@@ -4984,4 +5023,19 @@ object frmTracker: TfrmTracker
4984 left = 504 5023 left = 504
4985 top = 80 5024 top = 80
4986 end 5025 end
5026 object GBSSaveDialog: TSaveDialog
5027 Filter = 'Gameboy Soundtrack|*.gbs'
5028 left = 920
5029 top = 200
5030 end
5031 object WaveSaveDialog: TSaveDialog
5032 Filter = 'hUGETracker Waves|*.ugw'
5033 left = 784
5034 top = 168
5035 end
5036 object GBSaveDialog: TSaveDialog
5037 Filter = 'Gameboy ROM|*.GB'
5038 left = 456
5039 top = 184
5040 end
4987 end 5041 end
Modifiedtracker.pas +22−12
@@ -21,6 +21,8 @@ type
21 InstrumentComboBox: TComboBox; 21 InstrumentComboBox: TComboBox;
22 CutAction: TAction; 22 CutAction: TAction;
23 ImageList2: TImageList; 23 ImageList2: TImageList;
24 GBSaveDialog: TSaveDialog;
25 WaveSaveDialog: TSaveDialog;
24 Label22: TLabel; 26 Label22: TLabel;
25 Label23: TLabel; 27 Label23: TLabel;
26 Label24: TLabel; 28 Label24: TLabel;
@@ -37,8 +39,10 @@ type
37 MenuItem20: TMenuItem; 39 MenuItem20: TMenuItem;
38 Duty1Visualizer: TPaintBox; 40 Duty1Visualizer: TPaintBox;
39 OctaveSpinEdit: TSpinEdit; 41 OctaveSpinEdit: TSpinEdit;
42 GBSSaveDialog: TSaveDialog;
40 StepSpinEdit: TSpinEdit; 43 StepSpinEdit: TSpinEdit;
41 Timer1: TTimer; 44 Timer1: TTimer;
45 ExportGBSButton: TToolButton;
42 ToolButton3: TToolButton; 46 ToolButton3: TToolButton;
43 ToolButton9: TToolButton; 47 ToolButton9: TToolButton;
44 WaveVisualizer: TPaintBox; 48 WaveVisualizer: TPaintBox;
@@ -81,7 +85,7 @@ type
81 MenuItem9: TMenuItem; 85 MenuItem9: TMenuItem;
82 OpenDialog1: TOpenDialog; 86 OpenDialog1: TOpenDialog;
83 OrderEditPopup: TPopupMenu; 87 OrderEditPopup: TPopupMenu;
84 SaveDialog1: TSaveDialog; 88 InstrumentSaveDialog: TSaveDialog;
85 ScrollBox1: TScrollBox; 89 ScrollBox1: TScrollBox;
86 TicksPerRowSpinEdit: TSpinEdit; 90 TicksPerRowSpinEdit: TSpinEdit;
87 ToolBar1: TToolBar; 91 ToolBar1: TToolBar;
@@ -89,7 +93,7 @@ type
89 PanicToolButton: TToolButton; 93 PanicToolButton: TToolButton;
90 ToolButton2: TToolButton; 94 ToolButton2: TToolButton;
91 ToolButton4: TToolButton; 95 ToolButton4: TToolButton;
92 ToolButton5: TToolButton; 96 ExportGBButton: TToolButton;
93 ToolButton6: TToolButton; 97 ToolButton6: TToolButton;
94 ToolButton7: TToolButton; 98 ToolButton7: TToolButton;
95 ToolButton8: TToolButton; 99 ToolButton8: TToolButton;
@@ -230,10 +234,11 @@ type
230 procedure StepSpinEditChange(Sender: TObject); 234 procedure StepSpinEditChange(Sender: TObject);
231 procedure TicksPerRowSpinEditChange(Sender: TObject); 235 procedure TicksPerRowSpinEditChange(Sender: TObject);
232 procedure Timer1Timer(Sender: TObject); 236 procedure Timer1Timer(Sender: TObject);
237 procedure ExportGBSButtonClick(Sender: TObject);
233 procedure ToolButton2Click(Sender: TObject); 238 procedure ToolButton2Click(Sender: TObject);
234 procedure ToolButton3Click(Sender: TObject); 239 procedure ToolButton3Click(Sender: TObject);
235 procedure ToolButton4Click(Sender: TObject); 240 procedure ToolButton4Click(Sender: TObject);
236 procedure ToolButton5Click(Sender: TObject); 241 procedure ExportGBButtonClick(Sender: TObject);
237 procedure WaveEditNumberSpinnerChange(Sender: TObject); 242 procedure WaveEditNumberSpinnerChange(Sender: TObject);
238 procedure WaveEditPaintBoxMouseDown(Sender: TObject; Button: TMouseButton; 243 procedure WaveEditPaintBoxMouseDown(Sender: TObject; Button: TMouseButton;
239 Shift: TShiftState; X, Y: Integer); 244 Shift: TShiftState; X, Y: Integer);
@@ -918,9 +923,8 @@ end;
918 procedure TfrmTracker.ExportWaveButtonClick(Sender: TObject); 923 procedure TfrmTracker.ExportWaveButtonClick(Sender: TObject);
919 var F: file of TWave; 924 var F: file of TWave;
920 begin 925 begin
921 SaveDialog1.Filter := 'hUGETracker waves|*.ugw'; 926 if WaveSaveDialog.Execute then begin
922 if SaveDialog1.Execute then begin 927 AssignFile(F, WaveSaveDialog.FileName);
923 AssignFile(F, OpenDialog1.FileName);
924 Rewrite(F); 928 Rewrite(F);
925 Write(F, CurrentWave^); 929 Write(F, CurrentWave^);
926 CloseFile(F); 930 CloseFile(F);
@@ -931,9 +935,8 @@ procedure TfrmTracker.InstrumentExportButtonClick(Sender: TObject);
931 var 935 var
932 F: file of TInstrument; 936 F: file of TInstrument;
933 begin 937 begin
934 OpenDialog1.Filter := 'hUGETracker instruments|*.ugi'; 938 if InstrumentSaveDialog.Execute then begin
935 if SaveDialog1.Execute then begin 939 AssignFile(F, InstrumentSaveDialog.FileName);
936 AssignFile(F, SaveDialog1.FileName);
937 Rewrite(F); 940 Rewrite(F);
938 Write(F, CurrentInstrument^); 941 Write(F, CurrentInstrument^);
939 CloseFile(F); 942 CloseFile(F);
@@ -1134,6 +1137,7 @@ end;
1134 1137
1135 procedure TfrmTracker.MenuItem16Click(Sender: TObject); 1138 procedure TfrmTracker.MenuItem16Click(Sender: TObject);
1136 begin 1139 begin
1140 RenderSongToFile(Song, 'song');
1137 end; 1141 end;
1138 1142
1139 procedure TfrmTracker.MenuItem17Click(Sender: TObject); 1143 procedure TfrmTracker.MenuItem17Click(Sender: TObject);
@@ -1324,6 +1328,12 @@ begin
1324 if Max2 > LEDMeter2.Position then LEDMeter2.Position := Max2; 1328 if Max2 > LEDMeter2.Position then LEDMeter2.Position := Max2;
1325 end; 1329 end;
1326 1330
1331 procedure TfrmTracker.ExportGBSButtonClick(Sender: TObject);
1332 begin
1333 if GBSSaveDialog.Execute then
1334 RenderSongToFile(Song, GBSSaveDialog.FileName, emGBS);
1335 end;
1336
1327 procedure TfrmTracker.ToolButton2Click(Sender: TObject); 1337 procedure TfrmTracker.ToolButton2Click(Sender: TObject);
1328 begin 1338 begin
1329 if Playing then ResetEmulationThread; 1339 if Playing then ResetEmulationThread;
@@ -1352,10 +1362,10 @@ begin
1352 ResetEmulationThread; 1362 ResetEmulationThread;
1353 end; 1363 end;
1354 1364
1355 procedure TfrmTracker.ToolButton5Click(Sender: TObject); 1365 procedure TfrmTracker.ExportGBButtonClick(Sender: TObject);
1356 begin 1366 begin
1357 if SaveDialog1.Execute then begin 1367 if GBSaveDialog.Execute then begin
1358 RenderSongToFile(Song, SaveDialog1.FileName); 1368 RenderSongToFile(Song, GBSaveDialog.FileName);
1359 end; 1369 end;
1360 end; 1370 end;
1361 1371