Lime-3DS-Emulator
Lime-3DS-Emulator copied to clipboard
Refactor android code to use LargeScreen layout instead of MobileLandscape
This is a first step toward adding the Small Screen Position feature #332 . It removes the invisible internal "Mobile Landscape" layout and replaces it with "Large Screen Layout", but uses an #ifdef and new default proportion setting to modify it on Android so it looks identical to the old MobileLandscape layout.
This is necessary to eventually expose the small screen position and large screen proportion settings on android UI.
For now, the only user-facing change will be the menu saying "Large Screen" instead of "Default" for the layout on mobile. That can be changed back if desired.
This change appears to cause issues with existing configurations. The Large Screen layout appears to be selected, however the Original layout is displayed. The Large Screen layout must be selected again for the issue to go away. Is the Original layout used as a fallback?
This change appears to cause issues with existing configurations. The Large Screen layout appears to be selected, however the Original layout is displayed. The Large Screen layout must be selected again for the issue to go away. Is the Original layout used as a fallback?
Hmm I'll try to recreate and track down what isn't working. It should default to Large Screen (this why it appears selected) but maybe that default isn't resetting on launch and making it out of android into the c++ code, so if the (no longer supported) MobileLandscape layout was already saved as a pref it's trying to load that instead. And then since that doesn't exist, yes, it falls back onto the desktop default.
Okay, yes, that's the issue. If you had a previously saved config in android that was in the previous default mode (MobileLandscape internally, value 6, a value that no longer really makes sense), then that setting gets read in and passed to the core without any error checking. There doesn't appear to be any error checking code to make sure that a setting in the INI file matches an "allowed" setting, just fallback, and of course the fallback is built with desktop in mind. This also maybe partially explains how somebody on discord accidentally had the original LargeScreen layout showing up on android - the config file had an unsupported layout in it somehow.
I can build in specific error checking code for this setting only right after the ReadSetting call for layout specifically, but we might want to consider whether its worth expanding across the board by setting an optional "allowed values" array parameter for reading string or int variables from the config, and force a fallback to the default value at read otherwise.
Okay, I think this fixes the issue. It's not particularly elegant but it works. I ran 2116 and set default then loaded this build and got large screen as intended. I then ran 2116 and set side by side then loaded this one and got side by side. So it seems to be working correctly.