mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-02-16 10:30:47 +00:00
- now have a menu bar to access settings - now handle user input to assign mappings - fixed some typos - now properly shutdown controller threads on exit - renamed GamepadSettings to GamepadMapping - created a lock to ensure we do not add/remove gamepads from the list while we are handling their events - fixed settings directory booch
66 lines
1.3 KiB
Java
66 lines
1.3 KiB
Java
package com.limelight.settings;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
|
|
public class SettingsManager {
|
|
|
|
public static String SETTINGS_DIR = System.getProperty("user.home") + File.separator + "Limelight";
|
|
|
|
//directory to hold limelight settings
|
|
private File settingsDir;
|
|
|
|
private File settingsFile;
|
|
private File gamepadFile;
|
|
|
|
private static SettingsManager manager;
|
|
|
|
private SettingsManager() {
|
|
settingsFile = new File(SETTINGS_DIR + File.separator + "settings.lime");
|
|
gamepadFile = new File(SETTINGS_DIR + File.separator + "gamepad.lime");
|
|
settingsDir = new File(SETTINGS_DIR);
|
|
}
|
|
|
|
public static SettingsManager getInstance() {
|
|
if (manager == null) {
|
|
manager = new SettingsManager();
|
|
}
|
|
return manager;
|
|
}
|
|
|
|
public File getGamepadFile() {
|
|
if (!settingsDir.exists()) {
|
|
settingsFile.mkdirs();
|
|
}
|
|
|
|
if (!gamepadFile.exists()) {
|
|
try {
|
|
gamepadFile.createNewFile();
|
|
} catch (IOException e) {
|
|
System.out.println("Unable to create gamepad file");
|
|
return null;
|
|
}
|
|
}
|
|
|
|
return gamepadFile;
|
|
}
|
|
|
|
public File getSettingsFile() {
|
|
if (!settingsDir.exists()) {
|
|
settingsFile.mkdirs();
|
|
}
|
|
|
|
if (!settingsFile.exists()) {
|
|
try {
|
|
settingsFile.createNewFile();
|
|
} catch (IOException e) {
|
|
System.out.println("Unable to create setting file");
|
|
return null;
|
|
}
|
|
}
|
|
|
|
return settingsFile;
|
|
}
|
|
|
|
}
|