• 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
02-16-2017, 05:26 PM
#2
JosJuice Offline
Developer
**********
Developers (Some Administrators and Super Moderators)
Posts: 8,946
Threads: 7
Joined: Oct 2014
If you have working code for it, feel free to submit it at https://github.com/dolphin-emu/dolphin/pulls.
Find
Reply
02-17-2017, 01:32 AM
#3
nitro001 Offline
Junior Member
**
Posts: 24
Threads: 6
Joined: Jun 2016
(02-16-2017, 05:26 PM)JosJuice Wrote: If you have working code for it, feel free to submit it at https://github.com/dolphin-emu/dolphin/pulls.

OK, I know I probably did a developer faux pas, but I pulled my project source from a clone the master instead of creating a fork, but I do know better than to just check into master.  I wasn't sure of the process since most of my projects are with small groups and we base off of master. I can save off my changes, create and re-base from a fork.  I didn't find any documentation on that part of the setup on getting started with the project.  Please let me know if that is the correct procedure.

Thanks,
Nathan
Find
Reply
02-17-2017, 01:51 AM
#4
JosJuice Offline
Developer
**********
Developers (Some Administrators and Super Moderators)
Posts: 8,946
Threads: 7
Joined: Oct 2014
Whether you've done your work in your local master branch doesn't matter to us, since it isn't our master branch (but maybe it would be annoying to you if you want to use your local master branch for something else while the pull request is open). If you want to, you can copy over your changes to a different branch before you create a pull request, but it's not required. Just keep in mind that once the pull request is created, you can't change which branch the pull request uses.

If you haven't created a fork on GitHub yet, I think you'll need to do so. But it should be possible to push your existing changes to that fork repo instead of recreating them.

I'm not sure if I completely understand what you have done and haven't done this far, so please tell me if anything is unclear.
Find
Reply
02-17-2017, 02:50 AM
#5
nitro001 Offline
Junior Member
**
Posts: 24
Threads: 6
Joined: Jun 2016
(02-17-2017, 01:51 AM)JosJuice Wrote: Whether you've done your work in your local master branch doesn't matter to us, since it isn't our master branch (but maybe it would be annoying to you if you want to use your local master branch for something else while the pull request is open). If you want to, you can copy over your changes to a different branch before you create a pull request, but it's not required. Just keep in mind that once the pull request is created, you can't change which branch the pull request uses.

If you haven't created a fork on GitHub yet, I think you'll need to do so. But it should be possible to push your existing changes to that fork repo instead of recreating them.

I'm not sure if I completely understand what you have done and haven't done this far, so please tell me if anything is unclear.

Thank you for the help, I created a fork, re-based it, put in my change for the sort and created a pull request:
Android: Sort configuration ini files #4918
Find
Reply
02-17-2017, 04:12 AM
#6
nitro001 Offline
Junior Member
**
Posts: 24
Threads: 6
Joined: Jun 2016
(02-17-2017, 02:50 AM)nitro001 Wrote: Thank you for the help, I created a fork, re-based it, put in my change for the sort and created a pull request:
Android: Sort configuration ini files #4918
Corrected the re-case and consolidated commit files into new pull request:
Android: Sort configuration ini files #4919
Find
Reply
02-17-2017, 05:33 AM
#7
Helios Offline
Stellaaaaaaa
**********
Developers (Some Administrators and Super Moderators)
Posts: 4,395
Threads: 15
Joined: May 2012
Hey Nitro, it may be easier for you to communicate with us on IRC

freenode - #dolphin-dev
Find
Reply
« Next Oldest | Next Newest »


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


Users browsing this thread: 2 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode