BlitterStudio/amiberry

Custom controls not loaded

Closed this issue · 37 comments

The existing uae-files are not recognized in terms of custom controls.
Easy test:
Open a game -> go into GUI -> change in Custom controls for exmple the East button from None to Joy2 Up (should be a Jump in a Jump'n Run Game) -> save the file -> go back to the game and enjoy jumping per button. Quit the game.
Then open the game again -> go into the GUI again -> take a look on the Custom controls and you will see that the change of before is not shown, and it also does not work in the game.
When I check the the uae-file I see it has the right entry but it's not shown and working in the GUI and game.

I tried these things again under 5.7.0. There everything works as it should be, uae-file changes are shown and active at the next start. Only the BattleIsle-Issue is under 5.7.0 worse with the addition of the WHDLoad panel, under 5.6.8 it was still possible to start it with the manual uae-line trick.

By the way:
Would it be possible to make "default sound" to a part of the amiberry.conf-file.
My try of "default_soundcard_default=true" did not work.

Originally posted by @NoobieMaks in #1353 (comment)

I cannot really recreate this here, at least with my setup.

I've tested in both Retroarch configs and non-Retroarch systems (e.g. a default RPI-OS installation), since the handling is different in these two scenarios. I created a config for AmigaTestKit, which would allow me to see what is pressed, in the "Controller Test" window it has.

Then I set a custom mapping for my PS4 controller I had connected, changing the East button to Joy2-Up, as you mentioned. Saved the config, started it up one, and verified that indeed, the East button now triggers the "Up" event.

I closed down Amiberry, started it up again and loaded the config. I could see the saved mapping in the GUI, and starting it up would still apply in AmigaTestKit as expected.

I followed the same steps for both environments (RetroArch and non-RA), and had the exact same results.

Could you post your config file here please, along with your controller mapping file? Maybe we can find some difference there.

@midwan Do you mean an uae-file with config file? I could give you my test files of Gremlin 2, do you want it from 5.7.0, 5.7.1, or 5.7.1+?
Which controller mapping file do you want? gamecontrollerdb.txt or one from retroarch/autoconfig folder?

I tried to give my tests more structure, therefore I made the excel-tables.
From my point of view the uae-files and also the xml-file are both not recognized since 5.7.1, but only in terms of the Custom controls.
The BattleIsle issue was solved with 5.7.1+ = 5.7.2.
Unfortunately the more important Custom controls problems have been undetected in my 5.7.1 tests.

I cannot believe that it is something wrong with my controllers, because every other (retrorch-)emulator works fine with it (NES, SNES, GB, PORTS, Megadrive, Masterdrive, Arcade, PS, N64, NDS, PC Engine).
When I'm in the GUI and chose my functions, I have them in the game, and when I save the uae-file, they are saved there under 5.7.1+, BUT when I start again they are not recognized, AND also not shown in the GUI, although they are clearly visible in the uae-file. With 5.7.1 the Custom controls changes have not been saved in the uae-file, so it was clear that this cannot work.

I'll need a copy of your .uae file that contains the custom mapping, your retroarch.cfg file (just in case) and a copy of your controller .cfg file that Retroarch saves, to compare against mine. Even though we probably don't have the same controller, it might help find anything that's different in my setup (which works) vs yours (which doesn't).

The aim here is to recreate the problem on my end, which will allow me to work on a solution. :)

Here you are. Hoping it will help you to find my troubles.
Gremlins2_v1.2_0489.uae.txt
retroarch.cfg.txt
Sony PLAYSTATION(R)3 Controller.cfg.txt
PLAYSTATION(R)3 Controller.cfg.txt
PS 3 Controller wireless and not wireless, I have the issue with both types.
I have chosen this game, because here are two parameters coming from the XML (Jump and Pause).
I guess the the Confirm/Shot functionality on button A will come from the slave.
I wanted to see how I can overwrite these things per uae-file respectively if I can use them in coexistence.

Seems for me that 5.7.1/+/2 are getting more and more problematic beside the most problematic issue with the custom controls.

I just found out that in the Chipset panel "Cycle Exact (Full)" and "Cycle Exact (DMA/Memory)" are now completly firm married. Until 5.7.0 I could activate the lower checkbox (DMA/Memory) what led to an automatic activation also of the upper checkbox (Full) and then I was able to inactivate the automatic appeared upper checkbox again, so that only the lower checkbox "Cycle Exact (DMA/Memory) remained as activated.
This was the solution for me to solve the flickering problem at Lupo Alberto and also at Ninja Mission.
When both checkboxes are activated then my RasPi 3B+ and or the game is extremly slow.
So now I can chose between unplayable slow or graphical issues.

I also found out that it is no more possible to show up the virtual keyboard. I think this is because of the inactivated Amiga Screen menus "Fullscreen:" and "Screen Mode:", both are now greyed out.
When I activate the VKbd checkbox and push the guide button, I can "feel" that the VKbd is opened because then I can't use the A Button for the game itself, but I can't see it, it must be out of the shown screen.
When I push the guide button again, then the invisble VKbd was closed and the A-Button is now again usable for the game and not bound for the VKbd control.
My experience with Auto-Crop (#1273) makes me think in this way.
I have to add that under 5.7.0 the VKbd works very fine, so I have a little experience with it.

Thanks for the files.

I also saved a config for the same game here, but without any modifications. Just whatever it picked up by default from the XML. Then I compared my .uae config with yours.

There are some interesting results that I found, and possibly related to the issue you're seeing.
Most of the differences were in the area of custom controls, so I suspect that something's fishy there. I'd like to suggest one test:

  • Rename your config file, so it's not picked up by the game automatically.
  • Run the game, let it pick up the XML defaults.
  • See if East is mapped to Up, as it should. From what I saw, it is part of the XML default mapping already.

If the above works, then save that config and try restarting the whole process. Does it still work?

If the answer to the above is yes, then save your other modifications (if any) on top of that config again. Does it still work after that?

This step-by-step process should help us figure out where things were wrong.

I already tested these 2 steps in this way in the afteroon and wrote it down in the excel sheets some comments above to see the differences between the versions, too. But of course I try it again.

I go one step further and do not only rename the uae-file, I even delete it.
So the XML file should be picked with the 2 entries (Joy2 Up and F1).
-> same result as in the afternoon: When I run the game and open the GUI I can't see these two entries. All buttons show None.

So I tried to save them per uae-file.
-> same result as in the afternoon with 5.7.1:
nothing was saved to the file, only all 42 buttons with None.
-> same result as in the afternoon with 5.7.1+:
my changes have been saved to the uae-file, but are not shown in the GUI when I open the game again.

In both cases the selected functions are of course also not activ in the game.
Even if I can find them in the XML-file and the uae-file.
They are only active for the time I select them in the Custom controls panel and go back to the game until I leave the it.

With 5.7.0 I see the XML entries in the GUI Custom controls panel.

Hm, that's strange - definitely not what I'm seeing here.
I'll need to run a test under RetroPie itself then, perhaps something there might show me different results. I'll get back to you after I've done that.

PS: The VKBD has a known bug with Auto-Crop enabled, will be fixed separately.

amiberry-master-debian-buster-armhf.zip

@NoobieMaks If you have time, can you do a test with the binary I'm pasting here?
This is a fresh compile from the latest master, for Debian buster 32-bit. It's the SDL2 build (no Dispmanx).
This is to see if the differences are somewhere in the code, between your patched binary and the current code in master.

@midwan

I can recreate this here using preview/x86-64 ... example config.uae files attached. For the title Zool, the only custom mapping used is;

joyport1_amiberry_custom_none_dpup=Joy2 CD32 Red

...which maps dpad up to CD32 Red (default 'jump' button for this title)

Test 1:

Launch amiberry, GUI -> load Zool_v2.0_CD32.uae -> Custom controls --> mapping appears correct ;

ex

Quit amiberry.

Direct autoload the whdload title....

./amiberry Zool_v2.0_CD32.lha

After emulation starts and you get to the Zool splash screen, hit F12 to see Custom controls unset ;

ex2

Follow on by hitting F12 again, and checking in game ~ indeed, the custom mapping does not work.

Note: This mapping does work at the time of config.uae file creation, that process being ...ie; when in game -> F12 -> Custom controls --> set dpad up = CD32 Red --> Resume to test mapping (works as expected) --> F12 -> Configurations panel --> Save -> Resume and keep playing, works as expected.

Test 2:

Given the above result made me suspicious that the whd-booter/XML process was overriding config.uae options, I retested using a floppy image based config.uae file .. ie; see attached Highway Hawks (1988)(Anco)(Disk 1 of 2).uae

The only custom controls used here are;

joyport1_amiberry_custom_none_leftshoulder=Insert previous Disk Swapper slot in DF0:
joyport1_amiberry_custom_none_rightshoulder=Insert next Disk Swapper slot in DF0:

Launch amiberry, GUI -> load Highway Hawks (1988)(Anco)(Disk 1 of 2).uae -> Custom controls --> the mappings appear correct...follow on with ...Start -> emulation begins, title gets to 'Insert Disk 2' screen --> hit rightshoulder ---> loads next disk in Disk Mapper, and title continues and loads game ....result: working as expected ... -->> Quit amiberry.

Cross-checks;

Direct autoload the floppy image title....

./amiberry floppies/"Highway Hawks (1988)(Anco)(Disk 1 of 2).adf"

Title starts, but Custom control mappings not present...ie; hitting rightshoulder does nothing --> F12 --> Custom controls shows the leftshoulder/rightshoulder mappings are unset (default values present) ---> Quit amiberry

Note: Examination of the logfile created with the above incantation does disclose that the associated config.uae file for this title is auto-detected and loaded...

Floppy... floppies/Highway Hawks (1988)(Anco)(Disk 1 of 2).adf
Loading configuration file /home/gcb/Amiberry/conf/Highway Hawks (1988)(Anco)(Disk 1 of 2).uae
target_cfgfile_load(): load file /home/gcb/Amiberry/conf/Highway Hawks (1988)(Anco)(Disk 1 of 2).uae
load config '/home/gcb/Amiberry/conf/Highway Hawks (1988)(Anco)(Disk 1 of 2).uae':3

Note2: The logfile also indicates that Highway Hawks (1988)(Anco)(Disk 1 of 2).uae is actually being parsed ~ this is based upon the fact the title 'Highway Hawks' will only run correctly in amiberry using a base A500/OCS/512K chip machine type, with KS-1.2 ROM (else graphics corruption & manic undefined madness ensue...quite funny actually =)...

2-946 [83 038=190]: =KS ROM v1.2 (A500,A1000,A2000) rev 33.180 (256k) [315093-01]

....and although the Custom control mappings are not present, I could ..F12 -> load Disk 2 into DF0: -> Resume, and the game continues and runs properly, which sort of infers that only Custom controls are not being parsed in?

Direct load the config.uae file...

./amiberry conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae"

Title starts, but Custom control mappings not present, exact same result as above example.

As this is debian 12.5 without any retroarch environment present, I'm thinking juicy bug ;^)

Zool_v2.0_CD32.uae.gz

Highway Hawks (1988)(Anco)(Disk 1 of 2).uae.gz

@midwan
I just testet with your fresh binary (called 5.7.3 in the uae-file) and unfortunately all my problems are also present there,
even one more.

Test Game: Gremlins 2

  1. XML-Custom controls not visible in GUI Custom controls panel

  2. AND they are not active in the game (should be Jump on East and Pause on Start)

  3. Personal selected uae-file Custom controls are saved in the uae-file = positiv

  4. BUT they are also not visible in the GUI Custom controls panel after a new game start
    So it seems identical to me as 5.7.1+

  5. BUT I noticed one deterioration: Any change in the GUI (I tried Fullwindow, some custom controls and enabling VKBd) will cause a game abort when you leave the GUI back to the game. If you have saved it before the savings are recognized at the next start, with exception of the Custom controls :)

Positiv is, that in this version the VKBd seems to work for me as it was with 5.7.0.
Also positiv: BattleIsle starts with a manual edited uae-file.

@midwan Is it possible for you to compare the coding of 5.7.0 with the current coding especially for the handling of Customer controls from XML first and uae finally. My tests would say it was nearly ok with 5.7.0.
Although it was not possible to overwrite the XML-settings. For me it would be more correct when the same button is setted in XML and uae the uae selection will win.

image

I finally managed to recreate this:

  • It only happens in the process of autoloading something from the command line.
  • If we follow the same process from the GUI, it works normally (custom controls are loaded).
  • It only affects custom controls (from what I can see), all other options, including other Input options, are loaded. I tested with Mouse Map on the LStick, for instance (worked).

Now that I can recreate it, I can start working on a fix.

This is now fixed, at least according to all my tests 🤞

There were a few issues combined here, which needed some refactoring and some changes to solve correctly.

Not fixed wrt my Test 2 case as above....

./amiberry floppies/"Highway Hawks (1988)(Anco)(Disk 1 of 2).adf"

Note: Custom control settings now appear in GUI->Custom controls as they should.

ex

However.... in the emulation, the Custom control events are not recognized.....ie; hitting rightshoulder does NOT insert next disk in Disk Mapper. Check .. F12 ->Custom controls appears as they should but not working.

I'll redo all the tests to establish where we are with this ;)

Edit:

./amiberry Zool_v2.0_CD32.lha //references conf/Zool_v2.0_CD32.uae

Does not work ~ Custom control mapping not shown in GUI, and does not work in game.

./amiberry conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae"

Loads config.uae into GUI -> Custom controls --> custom mappings appear correct ---> Start

Does not work ~ left/rightshoulder not loading Disk Mapper --> F12 -> Custom controls --> custom mappings are now no longer set (defaults present) ....it's as though they got reset to defaults after Start of emulation.

./amiberry conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae" -G

Does not work ~ same as result above.

Launch amiberry, GUI -> load Highway Hawks (1988)(Anco)(Disk 1 of 2).uae -> Custom controls --> the mappings appear correct...follow on with ...Start --- works as expected, so still good being launched this way.

I was checking that it shows up in the GUI as expected, didn't test that it also worked as the mapped function. You're right, this still needs some work.

@giantclambake Could you please run another test with preview after the commit above?
I think it works better now.

@midwan ...Certainly, here's the results....


./amiberry Zool_v2.0_CD32.lha

//references conf/Zool_v2.0_CD32.uae

Working as expected ~ Custom control mapping appears correct in GUI, and also working in game.

|

./amiberry floppies/"Highway Hawks (1988)(Anco)(Disk 1 of 2).adf"

//references conf/Highway Hawks (1988)(Anco)(Disk 1 of 2).uae

Working as expected ~ Custom control mappings appear correct in GUI, and also working in game.

|

./amiberry conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae"

Loads config.uae into GUI -> Custom controls --> custom mappings appear correct ---> Start

Does not work ~ left/rightshoulder not loading Disk Mapper --> F12 -> Custom controls --> custom mappings are now no longer set (defaults present) ....it's as though they got reset to defaults after Start of emulation.

./amiberry conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae" -G

Does not work ~ does not appear to load config.uae at all ?? (boots to KS-1.3 insert disk splash, which is wrong)

|

Launch amiberry, GUI -> load Highway Hawks (1988)(Anco)(Disk 1 of 2).uae -> Custom controls --> the mappings appear correct...follow on with ...Start --- works as expected, so still good being launched this way.


Ergo, 3 out of 4... just direct autoloading of the floppy image based config.uae file not working as expected.

Attaching logfile wrt failed test ./amiberry conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae" -G ....it would seem no attempt made to load the config.uae file?

amiberry.log.gz

@giantclambake
Can you try again now, please?

@midwan ~ sure, still fails this;

./amiberry conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae"

Loads config.uae into GUI -> Custom controls --> custom mappings appear correct ---> Start

Does not work ~ left/rightshoulder not loading Disk Mapper --> F12 -> Custom controls --> custom mappings are now no longer set (defaults present) ....it's as though they got reset to defaults after Start of emulation.

./amiberry conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae" -G

Does not work ~ does not appear to load config.uae at all ?? (boots to KS-1.3 insert disk splash, which is wrong)

All other tests pass, just direct autoloading of the config.uae file seems to be the stumbling block ;)

@giantclambake
I can't really recreate this anymore. It seems to work properly for me, even using your steps above.
I had to recreate the config manually here of course, since we have different paths, controllers etc.

What mode do you have your controller in? I used CD32 here, perhaps that might be relevant?
I've also added some more logging details in the loading of config files, which I had removed earlier.

What mode do you have your controller in? I used CD32 here, perhaps that might be relevant?

The mode was actually set to Default --> recreated Highway Hawks (1988)(Anco)(Disk 1 of 2).uae with mode set to CD32 (same insert next/previous in disk mapper to DF0: custom controls ), and retested...

./amiberry conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae"

Loads config.uae into GUI -> Custom controls --> custom mappings appear correct ---> Start

Working as expected ~ Custom control mappings appear correct in GUI, and also working in game.
Ergo, controller mode was participle here... nice catch...

However....

./amiberry conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae" -G

Does not work ~ does not appear to load config.uae at all ?? (boots to KS-1.3 insert disk splash, which is wrong)

Logfile attached of the failed invocation (I see no loading of the config.uae file therein at all)

amiberry.log.gz

Edit:

./amiberry -f conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae" -G

./amiberry --config conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae" -G

Both of these above invocations work as expected...

...Question: should ./amiberry conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae" -G direct autoload & start the emulation?

@giantclambake
By design, the command line options had a fallback to try and load a config file or savestate, if no parameter was specified, but that would only get triggered if it was the last parameter in the line. If you add one more (-G in your case), the file wouldn't get loaded because it never entered the fallback, leading to a default A500 config starting up.

I've changed that with a slight refactoring, so it will work even if it's not the last parameter now. That should conclude the last item in this issue, so hopefully we can close it once you confirm it works. :)

@midwan
As always, thanks for the details ;)

./amiberry conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae" -G now works as expected, as do the other tests...

However.... this problem has returned;

./amiberry conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae"

Loads config.uae into GUI -> Custom controls --> custom mappings appear correct ---> Start

Does not work ~ left/rightshoulder not loading Disk Mapper --> F12 -> Custom controls --> custom mappings are now no longer set (defaults present) ....it's as though they got reset to defaults after Start of emulation.

You can check that by invoking ./amiberry conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae" --> in the GUI all seems correct, Start emulation, but after title starts (highway hawks splash screen) --> F12 -> Custom controls --> custom mappings have been reset to defaults. Also apparent with;

./amiberry -f conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae"
./amiberry --config conf/"Highway Hawks (1988)(Anco)(Disk 1 of 2).uae"

Note: the config.uae seems to be parsed correctly, just the Custom control settings are reset to defaults after the emulation starts.

Logfile & config.uae attached.

amiberry.log.gz
Highway Hawks (1988)(Anco)(Disk 1 of 2).uae.gz

It's interesting that it's rather specific to the above config - i.e. testing the exact same thing with a config for another game (like Zool CD32), to which I also assigned custom controls, does work.

I'll investigate further.

Indeed, that's why I attached it ~ the same thought crossed my mind.

Do note, appending -G to any of these failing invocations, actually works as expected ~ it's only when loading the config.uae into the GUI --> Start, that the issue manifests itself....

...as you note, whdload titles are good it seems ~ I'll test another set of floppy image & CDimage config loading after dinner ;)

I found that the difference in configs that triggers the change in behavior, is the Open GUI setting. If that's enabled, then the behavior is incorrect (custom mapping shows in the GUI, but is reset after we leave it). If it's disabled, the GUI doesn't open and the mapping remains correct.

I found the source: the SDL2 event for Joystick Inserted or Removed is triggered after the GUI opens and has already loaded the config. That even in turn, triggers an import of all joysticks, which triggers the default mapping being applied for every joystick detected. At that point, we lose any custom mapping previously applied.

You want the above process to happen if you insert or remove a joystick when the GUI is open, since you want it to be picked up and show in the dropdowns. But it should not happen if you didn't add or remove a joystick, of course. Yet, SDL2 triggers it for some reason, even if I didn't touch my controller. :(

I'll think about some kind of failsafe mechanism, to avoid re-applying the mapping if the joysticks haven't actually changed.

I admire your diligence/patience/skill with these sorts of issues ~ such makes the process of testing, a truly rewarding chore ; kudos =)

TBH, that's been an unasked question in my head, wrt reading through logfiles, and wondering just why the blazes the input controllers were being initialized multiple times, when as you say, IRL nothing had changed. Now, I need not ask the question... yet another instance of 1 - 1 = SDL2 =)

New update, hopefully fixing this behavior. This can still be improved further, but it will require more refactoring (ripping out WinUAE stuff and making it simpler).

Happy to report, all test cases work correctly and as expected, great work kind sir ;)

I'd consider this fixed now afaict with my various tests ~ if you need any further testing done wrt removing WinUAE stuffs, just give me a heads-up ;)

Thanks for confirming!