• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Dolphin Emulator Discussion and Support › Development Discussion v
« Previous 1 ... 25 26 27 28 29 ... 117 Next »

Code suggestion for android ini files
View New Posts | View Today's Posts

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
Code suggestion for android ini files
02-16-2017, 09:11 AM
#1
nitro001 Offline
Junior Member
**
Posts: 24
Threads: 6
Joined: Jun 2016
Hello,
Not sure the official channel on how to suggest these changes, so I thought I would add it here.
I noticed that on Android the ini files are written kind of randomly.  The section headers are in reverse order, especially the WiimodeNew.ini, and the entries in the section are random.

I found the code that writes this:
In the Android\app\src\main\java\org\dolphinemu\dolphinemu\utils\SettingsFile.java file, under the saveFile function:

Code:
Set<String> keySet = sections.keySet();

for (String key : keySet)
{
SettingSection section = sections.get(key);
writeSection(writer, section);
}

I found adding in a TreeSet and looping on it instead sorts the section headers:

Code:
Set<String> keySet = sections.keySet();
[b]Set<String> sortedKeySet = new TreeSet<>(keySet);[/b]

[b]for (String key : sortedKeySet)[/b]
{
SettingSection section = sections.get(key);
writeSection(writer, section);
}

Also in the same file, the writeSection, the existing code just adds them to the file in the order they are in:

Code:
HashMap<String, Setting> settings = section.getSettings();
Set<String> keySet = settings.keySet();
 

for (String key : keySet)
{
Setting setting = settings.get(key);
String settingString = settingAsString(setting);

writer.println(settingString);
}

Adding in the same Treeset and itterating over it sorts all the entries in the list:

Code:
HashMap<String, Setting> settings = section.getSettings();
Set<String> keySet = settings.keySet();
       [b]Set<String> sortedKeySet = new TreeSet<>(keySet);[/b]


       [b]for (String key : sortedKeySet)[/b]
{
Setting setting = settings.get(key);
String settingString = settingAsString(setting);

writer.println(settingString);
}

It was a matter of adding in 2 lines and editing 2 for loops to use it.
This really helps in terms of looking for options in a file.

If there is an official way to request a feature like this with code example, please let me know.

Thanks,
Nathan
Find
Reply
« Next Oldest | Next Newest »


Messages In This Thread
Code suggestion for android ini files - nitro001 - 02-16-2017, 09:11 AM
RE: Code suggestion for android ini files - JosJuice - 02-16-2017, 05:26 PM
RE: Code suggestion for android ini files - nitro001 - 02-17-2017, 01:32 AM
RE: Code suggestion for android ini files - JosJuice - 02-17-2017, 01:51 AM
RE: Code suggestion for android ini files - nitro001 - 02-17-2017, 02:50 AM
RE: Code suggestion for android ini files - nitro001 - 02-17-2017, 04:12 AM
RE: Code suggestion for android ini files - Helios - 02-17-2017, 05:33 AM

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 1 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode