Skip to content

Commit

Permalink
Libretro: Minor cleanups and fixes.
Browse files Browse the repository at this point in the history
MIDlets can close themselves without much of a problem in the
libretro rendition, so no need for that MIDlet conditional anymore.

Also use SIGSTOP for pausing, as it cannot be ignored.
  • Loading branch information
AShiningRay committed Feb 23, 2025
1 parent 6086cbc commit 53a44a8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/javax/microedition/midlet/MIDlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static void initAppProperties(HashMap<String, String> initProperties)
public final void notifyDestroyed()
{
Mobile.log(Mobile.LOG_INFO, MIDlet.class.getPackage().getName() + "." + MIDlet.class.getSimpleName() + ": " + "MIDlet sent Destroyed Notification");
if(!Mobile.getPlatform().isLibretro) { System.exit(0); }
System.exit(0);
}

public final void notifyPaused() { }
Expand Down
2 changes: 1 addition & 1 deletion src/libretro/freej2me_libretro.c
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ void pauseFreeJ2ME(bool pause)
{
#ifdef __linux__
// NOTE: Despite being a "kill" function, it really just sends a signal to stop and continue the process here
if(pause) { kill(javaProcess, SIGTSTP); }
if(pause) { kill(javaProcess, SIGSTOP); }
else { kill(javaProcess, SIGCONT); }
#elif _WIN32
// NOTE: Untested, tries to suspend/resume java app's main thread.
Expand Down
4 changes: 1 addition & 3 deletions src/org/recompile/freej2me/Libretro.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,11 @@ public Libretro(String args[])
private class LibretroIO
{
private Timer keytimer;
private TimerTask keytask;

public void start()
{
keytimer = new Timer();
keytask = new LibretroTimerTask();
keytimer.schedule(keytask, 0, 1);
keytimer.schedule(new LibretroTimerTask(), 0, 1);
}

private class LibretroTimerTask extends TimerTask
Expand Down

0 comments on commit 53a44a8

Please sign in to comment.