Skip to content

Commit

Permalink
Merge pull request #6267 from mahdihijazi/gc_pad_settings
Browse files Browse the repository at this point in the history
[Android] Fix a bug when you open the gc pad settings after fresh install
  • Loading branch information
JosJuice committed Dec 24, 2017
2 parents 3daeb6b + 58ee9d2 commit bedc814
Showing 1 changed file with 22 additions and 0 deletions.
Expand Up @@ -336,6 +336,11 @@ else if ((current != null))
}
}

if (fileName.equals(SettingsFile.FILE_NAME_DOLPHIN))
{
addGcPadSettingsIfTheyDontExist(sections);
}

return sections;
}

Expand Down Expand Up @@ -398,6 +403,23 @@ private static SettingSection sectionFromLine(String line)
return new SettingSection(sectionName);
}

private static void addGcPadSettingsIfTheyDontExist(HashMap<String, SettingSection> sections)
{
SettingSection coreSection = sections.get(SettingsFile.SECTION_CORE);

for (int i = 0; i < 4; i++)
{
String key = SettingsFile.KEY_GCPAD_TYPE + i;
if (coreSection.getSetting(key) == null)
{
Setting gcPadSetting = new IntSetting(key, SettingsFile.SECTION_CORE, SettingsFile.SETTINGS_DOLPHIN, 0);
coreSection.putSetting(gcPadSetting);
}
}

sections.put(SettingsFile.SECTION_CORE, coreSection);
}

/**
* For a line of text, determines what type of data is being represented, and returns
* a Setting object containing this data.
Expand Down

0 comments on commit bedc814

Please sign in to comment.