mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-08-05 18:25:13 +00:00
Restored keyboard handlers on start finally!
This commit is contained in:
@@ -453,6 +453,34 @@ public class Configuration implements Reconfigurable {
|
||||
return new File(System.getProperty("user.dir"), ".jace.conf");
|
||||
}
|
||||
|
||||
public static void registerKeyHandlers() {
|
||||
registerKeyHandlers(BASE, true);
|
||||
}
|
||||
|
||||
public static void registerKeyHandlers(ConfigNode node, boolean recursive) {
|
||||
Keyboard.unregisterAllHandlers(node.subject);
|
||||
InvokableActionRegistry registry = InvokableActionRegistry.getInstance();
|
||||
node.hotkeys.keySet().stream().forEach((name) -> {
|
||||
InvokableAction action = registry.getStaticMethodInfo(name);
|
||||
if (action != null) {
|
||||
for (String code : node.hotkeys.get(name)) {
|
||||
Keyboard.registerInvokableAction(action, node.subject, registry.getStaticFunction(name), code);
|
||||
}
|
||||
}
|
||||
action = registry.getInstanceMethodInfo(name);
|
||||
if (action != null) {
|
||||
for (String code : node.hotkeys.get(name)) {
|
||||
Keyboard.registerInvokableAction(action, node.subject, registry.getInstanceFunction(name), code);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (recursive) {
|
||||
node.getChildren().stream().forEach((child) -> {
|
||||
registerKeyHandlers(child, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply settings from node tree to the object model This also calls
|
||||
* "reconfigure" on objects in sequence
|
||||
@@ -507,22 +535,7 @@ public class Configuration implements Reconfigurable {
|
||||
|
||||
private static void doApply(ConfigNode node) {
|
||||
List<String> removeList = new ArrayList<>();
|
||||
Keyboard.unregisterAllHandlers(node.subject);
|
||||
InvokableActionRegistry registry = InvokableActionRegistry.getInstance();
|
||||
node.hotkeys.keySet().stream().forEach((name) -> {
|
||||
InvokableAction action = registry.getStaticMethodInfo(name);
|
||||
if (action != null) {
|
||||
for (String code : node.hotkeys.get(name)) {
|
||||
Keyboard.registerInvokableAction(action, node.subject, registry.getStaticFunction(name), code);
|
||||
}
|
||||
}
|
||||
action = registry.getInstanceMethodInfo(name);
|
||||
if (action != null) {
|
||||
for (String code : node.hotkeys.get(name)) {
|
||||
Keyboard.registerInvokableAction(action, node.subject, registry.getInstanceFunction(name), code);
|
||||
}
|
||||
}
|
||||
});
|
||||
registerKeyHandlers(node, false);
|
||||
|
||||
for (String f : node.settings.keySet()) {
|
||||
try {
|
||||
|
@@ -15,6 +15,7 @@ import jace.apple2e.SoftSwitches;
|
||||
import jace.apple2e.VideoNTSC;
|
||||
import jace.cheat.Cheats;
|
||||
import jace.config.ConfigurableField;
|
||||
import jace.config.Configuration;
|
||||
import jace.core.Video;
|
||||
import jace.library.MediaConsumer;
|
||||
|
||||
@@ -79,6 +80,7 @@ public class LawlessComputer extends Apple2e {
|
||||
((VideoNTSC) getVideo()).enableVideo7 = false;
|
||||
getMemory().configureActiveMemory();
|
||||
getVideo().configureVideoMode();
|
||||
Configuration.registerKeyHandlers();
|
||||
doResume();
|
||||
|
||||
if (!performedBootAnimation) {
|
||||
|
Reference in New Issue
Block a user