OnionUI / Onion

OS overhaul for Miyoo Mini and Mini+
https://onionui.github.io
GNU General Public License v3.0
3.16k stars 190 forks source link

FIX: Setting Swap L1<>L2 in Drastic breaks Menu Exits #1582

Closed theUnBurn closed 1 month ago

theUnBurn commented 1 month ago

Description

This fixes a bug described below. This is due to the keymon assuming the exit button combo is MENU+L1, which is not the case when we swap L triggers. This commit now checks the JSON first, and swaps the exit button accordingly.

Steps to Reproduce

  1. Open NDS Game
  2. Press MENU + START to open Drastic Settings Menu
  3. Scroll down and toggle "Swap L1-L2" to "Yes"
  4. Press B to return to Game
  5. Press Menu

Expected Result

Actual Result

theUnBurn commented 1 month ago

@Aemiii91 I tried the solution you mentioned in Discord, however ran into some problems.

1) The Drastic Emu does not update the values in settings.json in real time, but rather on MENU press, meaning there's no way to see what the value is from outside the emu until after the emu is closed. 2) It always updates the last_modified value for settings.json on MENU press, meaning even if we were only reading the value if it was modified, we'd still be reading it on every MENU press.

The only solution I could come up with was storing the data as a tmp flag before opening Drastic. This way, we can just check if that file exists or not. This in turn created a small change to the launch.sh for NDS.

Please let me know if this is a preferable path than just checking every time! Thanks in advance!

Aemiii91 commented 1 month ago

That's a much cleaner solution indeed 👌