DEADSOFTWARE

fixed "unused variable" varning for non-droid builds
[d2df-sdl.git] / src / game / Doom2DF.lpr
index 3c3c94a706a5f93a11c0733af44340fe056bf4cc..3239be1e6fd0bd800cee48c3a34d2d362f708093 100644 (file)
@@ -141,6 +141,9 @@ function SDL_main(argc: CInt; argv: PPChar): CInt; cdecl;
 var
   f: Integer;
   noct: Boolean = false;
+{$IFDEF ANDROID}
+  storage: String;
+{$ENDIF}
   //tfo: Text;
 begin
   SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); //k8: fuck off, that's why
@@ -148,17 +151,25 @@ begin
 {$IFDEF ANDROID}
 {$I-}
   e_SetSafeSlowLog(true);
-  Chdir(SDL_AndroidGetExternalStoragePath());
+  if SDL_AndroidGetExternalStorageState() <> 0 then
+  begin
+    storage := SDL_AndroidGetExternalStoragePath();
+    Chdir(storage);
+    e_WriteLog('Use external storage: ' + storage, TMsgType.Notify)
+  end
+  else
+  begin
+    storage := SDL_AndroidGetInternalStoragePath();
+    Chdir(storage);
+    e_WriteLog('Use internal storage: ' + storage, TMsgType.Notify)
+  end;
   if IOresult <> 0 then
   begin
-    Chdir(SDL_AndroidGetInternalStoragePath());
-    if IOresult <> 0 then
-    begin
-      e_WriteLog('Fuck! Cant chdir to any game directory :(', TMsgType.Fatal);
-      result := 1;
-      exit;
-    end;
+    SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, PChar('Invalid path'), PChar('Can''t chdir to ' + storage), nil);
+    result := 1;
+    exit
   end;
+  SetEnvVar('TIMIDITY_CFG', 'timidity.cfg');
 {$ENDIF ANDROID}
 
   for f := 1 to ParamCount do