Dolphin, the GameCube and Wii emulator - Forums
Dolphin Android SingleChoiceClick String instead of int? - Printable Version

+- Dolphin, the GameCube and Wii emulator - Forums (https://forums.dolphin-emu.org)
+-- Forum: Dolphin Emulator Discussion and Support (https://forums.dolphin-emu.org/Forum-dolphin-emulator-discussion-and-support)
+--- Forum: Development Discussion (https://forums.dolphin-emu.org/Forum-development-discussion)
+--- Thread: Dolphin Android SingleChoiceClick String instead of int? (/Thread-dolphin-android-singlechoiceclick-string-instead-of-int)



Dolphin Android SingleChoiceClick String instead of int? - nitro001 - 02-16-2017

Hello,
I am trying to test out adding in the setting for:
Options/Sideways Wiimote

The problem I am having is that the setting in the file is not an integer but a double:
When it is enabled, it looks like:
Code:
Options/Sideways Wiimote = 1.0000000000000000

Usually when it is disabled I don't see it in the file, but I assume that putting it like:
Code:
Options/Sideways Wiimote = 0.0000000000000000
would invalidate it.

However, I am trying to find the best way to do this.  In the SettingsFragmentPresenter.java file, in the addWiimoteSubsettings function, I first tried to add it as a new CheckBoxSetting(..).  Unfortunately this adds it with an = true or = false value.  I am now trying to add it as a new SingleChoiceSetting(..):
Code:
sl.add(new HeaderSetting(null, null, R.string.wiimote_sideways, 0));
Setting wiimoteSetting = mSettings.get(SettingsFile.SETTINGS_WIIMOTE).get(SettingsFile.SECTION_WIIMOTE + (wiimoteNumber - 3)).getSetting(SettingsFile.KEY_WIIBIND_SIDEWAYS);
       sl.add(new SingleChoiceSetting(SettingsFile.KEY_WIIBIND_SIDEWAYS, SettingsFile.SECTION_WIIMOTE + (wiimoteNumber - 3), SettingsFile.SETTINGS_WIIMOTE, R.string.generic_sideways, R.string.generic_sideways_descrip, R.array.wiimoteSidewaysEntries, R.array.wiimoteSidewaysValues, 0, wiimoteSetting));

I have configured the SettingsFile variables properly, however since the values are doubles and there is no double-array support in the arrays.xml, I tried to use a string-array, like:
Code:
<string-array name="wiimoteSidewaysEntries">
       <item>Disabled</item>
       <item>Enabled</item>
   </string-array>
   <string-array name="wiimoteSidewaysValues">
       <item>0.0000000000000000</item>
       <item>1.0000000000000000</item>
   </string-array>

Unfortunately the code in the SettingsAdapter.java for the getSelectionForSingleChoiceValue looks only for integer value arrays, not string arrays.

I am not sure why the original code in windows spits it out as the double with that many 0's behind it.  If it wasn't needed, I could just use an int with a 0 or 1, but I don't want to break compatibility with the file.

Would anyone have an idea on how to approach this?

Thanks,
Nathan


RE: Dolphin Android SingleChoiceClick String instead of int? - JosJuice - 02-16-2017

In recent development builds of Dolphin, the values "True" and "False" are used for this, not numbers. But I think there's some backwards compatibility thing that treats a 1 (or 1.0000000000000000?) in the INI the same way as a True.

EDIT: Wait a little... For some reason, we're saving it as Sideways Wii Remote in the INI now, not Sideways Wiimote. That has got to be a mistake from when we re-labeled it in the GUI. I'll look into changing it back.


RE: Dolphin Android SingleChoiceClick String instead of int? - nitro001 - 02-17-2017

(02-16-2017, 05:21 PM)JosJuice Wrote: In recent development builds of Dolphin, the values "True" and "False" are used for this, not numbers. But I think there's some backwards compatibility thing that treats a 1 (or 1.0000000000000000?) in the INI the same way as a True.

EDIT: Wait a little... For some reason, we're saving it as Sideways Wii Remote in the INI now, not Sideways Wiimote. That has got to be a mistake from when we re-labeled it in the GUI. I'll look into changing it back.

I checked the history on the WiimoteEmu.cpp in the core where the Sideways Wii Remote is being checked.  It looks like the name reference was changed back on October 25th by Pringo in that file and others. I will test this with the new Options/Sideways Wii Remote and using a checkbox as well to see if it accepts it on the Shield.


RE: Dolphin Android SingleChoiceClick String instead of int? - JosJuice - 02-17-2017

Yeah, Pringo was the one who made the PR for changing "Wiimote" to "Wii Remote" in the GUI. I reviewed that PR, so this problem not getting caught is on me.

Feel free to try that out, but keep in mind that it might get changed back to Sideways Wiimote in later versions of Dolphin. We'll see how soon I'll be able to make a PR and if it will get accepted.