Android: Move profile check to when it is saving

This commit is contained in:
zackhow 2018-10-14 15:09:21 -04:00
parent 405b37deaa
commit 471485071d
1 changed files with 17 additions and 13 deletions

View File

@ -499,6 +499,22 @@ public final class SettingsFile
{
String profile = gameId + "_Wii" + padId;
String wiiConfigPath =
DirectoryInitialization.getUserDirectory() + "/Config/Profiles/Wiimote/" +
profile + ".ini";
File wiiProfile = new File(wiiConfigPath);
// If it doesn't exist, create it
if (!wiiProfile.exists())
{
String defautlWiiProfilePath =
DirectoryInitialization.getUserDirectory() +
"/Config/Profiles/Wiimote/WiimoteProfile.ini";
DirectoryInitialization.copyFile(defautlWiiProfilePath, wiiConfigPath);
NativeLibrary.SetProfileSetting(profile, Settings.SECTION_PROFILE, "Device",
"Android/" + (Integer.valueOf(padId) + 4) + "/Touchscreen");
}
NativeLibrary.SetProfileSetting(profile, Settings.SECTION_PROFILE, key,
value);
@ -565,19 +581,7 @@ public final class SettingsFile
DirectoryInitialization.getUserDirectory() + "/Config/Profiles/Wiimote/" +
profile + ".ini";
File wiiProfile = new File(wiiConfigPath);
// If it doesn't exist, create it
if (!wiiProfile.exists())
{
String defautlWiiProfilePath =
DirectoryInitialization.getUserDirectory() +
"/Config/Profiles/Wiimote/WiimoteProfile.ini";
DirectoryInitialization.copyFile(defautlWiiProfilePath, wiiConfigPath);
NativeLibrary.SetProfileSetting(profile, Settings.SECTION_PROFILE, "Device",
"Android/" + (Integer.valueOf(padId) + 4) + "/Touchscreen");
}
return wiiProfile;
return new File(wiiConfigPath);
}
private static SettingSection sectionFromLine(String line, boolean isCustomGame)