Add debug key M to open the main menu directly
M invokes mm_activate immediately, bypassing the intro chain, to isolate menu rendering from the state machine.
This commit is contained in:
@@ -8,6 +8,8 @@ import dev.quoije.umd.player.PlaybackEngine;
|
||||
import dev.quoije.umd.playlist.Playlist;
|
||||
import dev.quoije.umd.rco.RcoFile;
|
||||
import dev.quoije.umd.rco.vsmx.Vsmx;
|
||||
import dev.quoije.umd.rco.vsmx.interpreter.VsmxBaseObject;
|
||||
import dev.quoije.umd.rco.vsmx.interpreter.VsmxFunction;
|
||||
import dev.quoije.umd.rco.vsmx.interpreter.VsmxInterpreter;
|
||||
import dev.quoije.umd.rco.vsmx.interpreter.VsmxNativeObject;
|
||||
import dev.quoije.umd.rco.vsmx.objects.Controller;
|
||||
@@ -66,6 +68,9 @@ public final class PlayerApp extends Application {
|
||||
private int videoBufferIndex = 0;
|
||||
private volatile boolean skipRequested = false;
|
||||
|
||||
private volatile VsmxInterpreter menuInterpreter;
|
||||
private volatile VsmxBaseObject mmActivate;
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) {
|
||||
// Gradle's --args splits on whitespace; rejoin so paths with spaces work.
|
||||
@@ -119,6 +124,10 @@ public final class PlayerApp extends Application {
|
||||
skipRequested = true;
|
||||
return;
|
||||
}
|
||||
case M -> {
|
||||
openMenuDirectly();
|
||||
return;
|
||||
}
|
||||
default -> { }
|
||||
}
|
||||
|
||||
@@ -136,6 +145,15 @@ public final class PlayerApp extends Application {
|
||||
}
|
||||
}
|
||||
|
||||
private void openMenuDirectly() {
|
||||
VsmxBaseObject fn = mmActivate;
|
||||
VsmxInterpreter interpreter = menuInterpreter;
|
||||
if (fn instanceof VsmxFunction function && interpreter != null) {
|
||||
System.err.println("[debug] opening menu directly");
|
||||
interpreter.interpretFunction(function, null, new VsmxBaseObject[0]);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadMenu(String isoPath) {
|
||||
try (UmdIsoReader iso = new UmdIsoReader(Path.of(isoPath))) {
|
||||
Playlist playlist = Playlist.parse(iso);
|
||||
@@ -189,6 +207,8 @@ public final class PlayerApp extends Application {
|
||||
interpreter.run(globals);
|
||||
controller = (Controller) controllerObject.getObject();
|
||||
moviePlayer = (MoviePlayer) movieplayer.getObject();
|
||||
menuInterpreter = interpreter;
|
||||
mmActivate = globals.getPropertyValue("mm_activate");
|
||||
controller.callCallback(interpreter, "onAutoPlay", null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user