Commit 01d9a44

Nick committed on
Adding error checking for files on startup
commit 01d9a44ead2ad41132ada25989f38947a819bbf0 parent fd8abd6
2 changed files +15−15
Modifiedtracker.lfm +2−1
@@ -4902,7 +4902,8 @@ object frmTracker: TfrmTracker
4902 } 4902 }
4903 end 4903 end
4904 object OscilloscopeUpdateTimer: TTimer 4904 object OscilloscopeUpdateTimer: TTimer
4905 Interval = 1 4905 Enabled = False
4906 Interval = 200
4906 OnTimer = OscilloscopeUpdateTimerTimer 4907 OnTimer = OscilloscopeUpdateTimerTimer
4907 left = 512 4908 left = 512
4908 top = 64 4909 top = 64
Modifiedtracker.pas +13−14
@@ -952,15 +952,23 @@ end;
952 procedure TfrmTracker.FormCreate(Sender: TObject); 952 procedure TfrmTracker.FormCreate(Sender: TObject);
953 var 953 var
954 I: Integer; 954 I: Integer;
955 Stream: TStream;
956 begin 955 begin
957 if Screen.Fonts.IndexOf('PixeliteTTF') < 0 then 956 if Screen.Fonts.IndexOf('PixeliteTTF') = -1 then
958 MessageDlg('Warning', 'You don''t have the Pixelite font installed. '+ 957 MessageDlg('Warning', 'You don''t have the Pixelite font installed. '+
959 'On Windows, this probably means you didn''t extract hUGETracker before running it, '+ 958 'On Windows, this probably means you didn''t extract hUGETracker before running it, '+
960 'so please extract the .zip and run again! On Linux, you need to manually install the '+ 959 'so please extract the .zip and run again! On Linux, you need to manually install the '+
961 'font file, so please install PixeliteTTF.ttf and relaunch! Thanks.', 960 'font file, so please install PixeliteTTF.ttf and relaunch. Thanks!',
962 mtWarning, [mbOk], 0); 961 mtWarning, [mbOk], 0);
963 962
963 if (not FileExists('halt.gb')) or (not DirectoryExists('hUGEDriver')) then begin
964 MessageDlg('Error',
965 'hUGETracker can''t load a required file which comes with '+
966 'the tracker. This likely means that you haven''t extracted the program ' +
967 'before running it. Please do so, and relaunch. Thanks!',
968 mtError, [mbOk], 0);
969 Halt;
970 end;
971
964 VisualizerBuffer := TBGRABitmap.Create(Duty1Visualizer.Width, Duty1Visualizer.Height); 972 VisualizerBuffer := TBGRABitmap.Create(Duty1Visualizer.Width, Duty1Visualizer.Height);
965 973
966 ReturnNilIfGrowHeapFails := False; 974 ReturnNilIfGrowHeapFails := False;
@@ -1009,17 +1017,8 @@ begin
1009 EmulationThread.Start; 1017 EmulationThread.Start;
1010 ResetEmulationThread; //TODO: remove this hack 1018 ResetEmulationThread; //TODO: remove this hack
1011 1019
1012 if (not OptionsFile.ReadBool('hUGETracker', 'firstrun', False)) and FileExists('Sample Songs\Cognition.uge') then begin 1020 // Start the Oscilloscope repaint timer
1013 stream := TFileStream.Create('Sample Songs\Cognition.uge', fmOpenRead); 1021 OscilloscopeUpdateTimer.Enabled := True;
1014 try
1015 ReadSongFromStream(stream, Song);
1016 finally
1017 stream.Free;
1018 end;
1019 UpdateUIAfterLoad;
1020
1021 OptionsFile.WriteBool('hUGETracker', 'firstrun', True);
1022 end;
1023 1022
1024 {$ifdef DEVELOPMENT} 1023 {$ifdef DEVELOPMENT}
1025 DebugShiteButton.Visible := True; 1024 DebugShiteButton.Visible := True;