mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-04-03 22:46:14 +00:00
36 lines
1.0 KiB
Java
36 lines
1.0 KiB
Java
package com.limelight.settings;
|
|
|
|
import java.io.File;
|
|
|
|
import com.limelight.input.gamepad.GamepadMapping;
|
|
|
|
public abstract class GamepadSettingsManager {
|
|
private static GamepadMapping cachedSettings;
|
|
|
|
|
|
public static GamepadMapping getSettings() {
|
|
if (cachedSettings == null) {
|
|
System.out.println("Reading Gamepad Settings");
|
|
File gamepadFile = SettingsManager.getInstance().getGamepadFile();
|
|
GamepadMapping savedMapping = (GamepadMapping)SettingsManager.readSettings(gamepadFile);
|
|
cachedSettings = savedMapping;
|
|
}
|
|
if (cachedSettings == null) {
|
|
System.out.println("Unable to get gamepad settings. Using an empty mapping instead.");
|
|
cachedSettings = new GamepadMapping();
|
|
writeSettings(cachedSettings);
|
|
}
|
|
return cachedSettings;
|
|
}
|
|
|
|
public static void writeSettings(GamepadMapping settings) {
|
|
cachedSettings = settings;
|
|
System.out.println("Writing Gamepad Settings");
|
|
|
|
File gamepadFile = SettingsManager.getInstance().getGamepadFile();
|
|
|
|
SettingsManager.writeSettings(gamepadFile, settings);
|
|
}
|
|
|
|
}
|