Commit 585d4eb

Nick Faro committed on
Emit null in C export when empty array
commit 585d4eb26f532e4f4857e960f9e86f01a5029b55 parent 0623f3f
1 changed files +7−0
Modifiedsrc/codegen.pas +7−0
@@ -266,6 +266,10 @@ procedure RenderSongToGBDKC(Song: TSong; DescriptorName: String; Filename: strin
266 itWave: InstrType := 'hUGEWaveInstr_t'; 266 itWave: InstrType := 'hUGEWaveInstr_t';
267 itNoise: InstrType := 'hUGENoiseInstr_t'; 267 itNoise: InstrType := 'hUGENoiseInstr_t';
268 end; 268 end;
269
270 if Limit = -1 then
271 Exit('static const ' + InstrType + '* ' + Name + ' = NULL;'+LineEnding);
272
269 Result := 'static const ' + InstrType + ' ' + Name + '[] = {'+LineEnding; 273 Result := 'static const ' + InstrType + ' ' + Name + '[] = {'+LineEnding;
270 for I := Low(Bank) to Limit do begin 274 for I := Low(Bank) to Limit do begin
271 Result += ' '+RenderGBDKInstrument(Bank[I], I) + ','+LineEnding; 275 Result += ' '+RenderGBDKInstrument(Bank[I], I) + ','+LineEnding;
@@ -277,6 +281,9 @@ procedure RenderSongToGBDKC(Song: TSong; DescriptorName: String; Filename: strin
277 var 281 var
278 I, J: integer; 282 I, J: integer;
279 begin 283 begin
284 if Limit = -1 then
285 Exit('static const unsigned char* waves = NULL;'+LineEnding);
286
280 Result := 'static const unsigned char waves[] = {'+LineEnding; 287 Result := 'static const unsigned char waves[] = {'+LineEnding;
281 for I := Low(Waves) to Limit do 288 for I := Low(Waves) to Limit do
282 begin 289 begin