Skip to content

Commit

Permalink
use dialog instead of toast
Browse files Browse the repository at this point in the history
  • Loading branch information
Ishan09811 authored Feb 11, 2024
1 parent f5d3cc9 commit 711e42b
Showing 1 changed file with 11 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.os.Handler;
import android.util.Log;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import com.panda3ds.pandroid.AlberDriver;
import com.panda3ds.pandroid.data.SMDH;
import com.panda3ds.pandroid.data.config.GlobalConfig;
Expand Down Expand Up @@ -92,26 +93,16 @@ public void onSurfaceCreated(GL10 unused, EGLConfig config) {

// If loading the ROM failed, display an error message and early exit
if (!AlberDriver.LoadRom(romPath)) {
// Get a handler that can be used to post to the main thread
Handler mainHandler = new Handler(context.getMainLooper());

Runnable runnable = new Runnable() {
@Override
public void run() {
Toast
.makeText(
context, "Failed to load ROM! Make sure it's a valid 3DS ROM and that storage permissions are configured properly.",
Toast.LENGTH_LONG
)
.show();
}
};
mainHandler.post(runnable);

GameMetadata game = GameUtils.getCurrentGame();
GameUtils.removeGame(game);
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("Failed to load ROM")
.setMessage("Make sure it's a valid 3DS ROM and that storage permissions are configured properly.")
.setPositiveButton("OK", null)
.show();

GameMetadata game = GameUtils.getCurrentGame();
GameUtils.removeGame(game);
return;
}

// Load the SMDH
byte[] smdhData = AlberDriver.GetSmdh();
Expand Down

0 comments on commit 711e42b

Please sign in to comment.