1
0
forked from Clones/Controlify

Config option delegate_setup to not discover controllers immediately.

This commit is contained in:
isXander
2023-05-15 22:16:59 +01:00
parent f54a504dc3
commit d81b1f59cc
6 changed files with 59 additions and 17 deletions

View File

@ -13,6 +13,7 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -119,12 +120,16 @@ public class ControlifyConfig {
setDirty();
}
this.compoundJoysticks = object
.getAsJsonArray("compound_joysticks")
.asList()
.stream()
.map(element -> GSON.fromJson(element, CompoundJoystickInfo.class))
.collect(Collectors.toMap(info -> info.type().mappingId(), Function.identity()));
if (object.has("compound_joysticks")) {
this.compoundJoysticks = object
.getAsJsonArray("compound_joysticks")
.asList()
.stream()
.map(element -> GSON.fromJson(element, CompoundJoystickInfo.class))
.collect(Collectors.toMap(info -> info.type().mappingId(), Function.identity()));
} else {
this.compoundJoysticks = Map.of();
}
if (object.has("current_controller")) {
JsonElement element = object.get("current_controller");