amiberry icon indicating copy to clipboard operation
amiberry copied to clipboard

A few Custom Events not working

Open giantclambake opened this issue 1 year ago • 4 comments

Iirc we've previously touched on this, and knew some things were broken here (inheritance from winuae).

I'm only going to concern myself with custom events that have been mentioned in wiki & helptext ...

"Various emulator functions (e.g. Autocrop, Quit, Reset, Enter GUI)" (end of https://github.com/BlitterStudio/amiberry/wiki/GUI:-Custom)

Tested that AutoCrop & Quit emulator events did not work --- the Reset & Enter GUI events do work as expected.

As you know, we now have the disk swapper helptext referencing some custom events, and neither the 'Next slot in Disk Swapper' nor 'Previous slot in Disk Swapper' events are working afaict.

I'm really only concerned with these two disk swapper events not working TBH, Quit emulator should probably work, Autocrop I'm not so sure...I can't see myself needing to map that function to a controller button. The next/previous slot events would likely be how most ppl would use a controller here...ie; only 2 buttons required. Any chance you can fix these events?

The .uae config file used for testing is attached.

TIA

defaultwb13.uae.gz

giantclambake avatar Nov 15 '23 13:11 giantclambake

AutoCrop in a Custom event is a one-time trigger - meaning it will AutoCrop once, when you press the button, and no more. This is useful if the full auto-crop option isn't good enough (it may mess up some screens in games or demos that have multiple layers, for instance). With the manual AutoCrop mapped, you can just trigger it when you want, and leave it like that afterwards.

I'm pretty sure I've tested both AutoCrop and Quit emulator mapped to a controller, but I'll give it another round of tests to double check.

midwan avatar Nov 15 '23 16:11 midwan

Just tested both events:

  • AutoCrop, mapped to R. Shoulder button on my PS4 controller = works fine
  • Quit, mapped to L. Shoulder button on my PS4 controller = works fine

I don't see a problem here. How did you test this exactly? Maybe some steps were different?

midwan avatar Nov 15 '23 17:11 midwan

I don't see a problem here. How did you test this exactly? Maybe some steps were different?

Going by your description, it's likely I'm using different steps ; to elucidate...

In the provided .uae config file, you will see the lines;

joyport1_amiberry_custom_none_leftshoulder=Previous slot in Disk Swapper joyport1_amiberry_custom_none_rightshoulder=Next slot in Disk Swapper

Those entries were obtained from using GUI -> Custom controls, and selecting the named events from the dropdown list ...ie;

example

Does that make the issue clearer?

edit: I mentioned initially here that the custom event 'Enter GUI' works as expected, so I decided to investigate that much. This is defined in src/osdep/amiberry_input.cpp as INPUTEVENT_SPC_ENTERGUI --- when I glimpse the tree for that;

amiberry_input.cpp: INPUTEVENT_SPC_ENTERGUI, INPUTEVENT_SPC_QUIT, INPUTEVENT_SPC_PAUSE, amiberry_input.cpp: setid(uid, i, ID_BUTTON_OFFSET + retroarch_offset + 1, 0, port, INPUTEVENT_SPC_ENTERGUI, gp); /src/osdep/keyboard.cpp: //{ SDL_SCANCODE_F12, INPUTEVENT_SPC_ENTERGUI }, /src/inputdevice.cpp: if (nr == INPUTEVENT_SPC_ENTERGUI)

I'm expecting the custom events Next slot in Disk Swapper & Previous slot in Disk Swapper to work like Enter GUI

Those custom events are defined as;

INPUTEVENT_SPC_DISKSWAPPER_NEXT & INPUTEVENT_SPC_DISKSWAPPER_PREV

Afaict, these custom events should map to the keyboard multimedia keys of 'Next track/Previous track' (in playlist)?

When I glimpse the tree to find out how these are implemented, I get ;

$ glimpse INPUTEVENT_SPC_DISKSWAPPER_NEXT /src/osdep/amiberry_input.cpp: INPUTEVENT_SPC_DISKSWAPPER_NEXT, INPUTEVENT_SPC_DISKSWAPPER_PREV,

$ glimpse INPUTEVENT_SPC_DISKSWAPPER_PREV /src/osdep/amiberry_input.cpp: INPUTEVENT_SPC_DISKSWAPPER_NEXT, INPUTEVENT_SPC_DISKSWAPPER_PREV,

HTH

giantclambake avatar Nov 16 '23 00:11 giantclambake

Just note, I'm really only concerned with ;

INPUTEVENT_SPC_DISKSWAPPER_NEXT & INPUTEVENT_SPC_DISKSWAPPER_PREV

...because I referenced Custom controls in the disk swapper helptext to this end (and I can't figure out how to set these events)

c1

giantclambake avatar Dec 05 '23 01:12 giantclambake

@giantclambake I haven't really used DiskSwapper much, but the code is identical to that of WinUAE in the events being triggered. By looking at the code, it seems that it's not enough to just select the Previous/Next slot in the disk swapper, but then you have to also Insert that slot into a drive (which is a separate event, or I should say, events - one per drive, for the first 4 drives).

So in summary, I think the logic goes like this:

  • Select a Previous or Next slot
  • Insert the selected slot into a drive (DF0-DF3)

Changing the slot to NEXT/PREVIOUS only changes the variable of swapperslot, but that variable is not actually used until you do an Insert.

midwan avatar Feb 29 '24 18:02 midwan

Hmmm ....you're referring to this I suppose ;

action_disk_swapper_next
action_disk_swapper_prev
action_disk_swapper_insert_0
action_disk_swapper_insert_1
action_disk_swapper_insert_2
action_disk_swapper_insert_3

...if when basic unexpanded A500/A1200 (single floppy drive) that reduces to...

action_disk_swapper_next action_disk_swapper_prev action_disk_swapper_insert_0

Afaik the underlying Amigaos has no 'media changed' cue ~ it has to spin/read whatever is in DF0: to determine if you've inserted the requested disk (the 'Retry' button on the disk request window)....(or does it use disk_present switch? I no longer recall...ie; drive click is seeking disk id)...

...so when I see this;

x

....I'm expecting the custom actions Previous/Next slot in the disk swapper, to actually end up doing this;

x2

...the process being game pops disk requestor -> use Next slot in the disk swapper to change which image DF0: points to, then click 'Retry' in the disk requestor which opens whatever's in DF0: (if that doesn't happen automagically)...

I'm probably not understanding what F12 does under the hood?

giantclambake avatar Mar 01 '24 04:03 giantclambake

Your assumption about the events is correct. You need to use the Previous/Next slot in combination with Insert current slot into drive DF0 (or any other drive).

I just did a test here to try this out, using the following setup:

  • WB 3.1 installed in HDD, just so that it boots into an environment that makes it easy to see any disks inserted/removed.
  • A PS4 controller connected, and set the custom events as follows:
  • L Shoulder: Previous slot in Disk Swapper
  • R Shoulder: Next slot in Disk Swapper
  • Select: Insert selected slot in DF0

I then added a few disks in the disk swapper. Nothing special, just made sure they are system friendly, so that I can see which one is inserted at each time (otherwise you'd always see "NDOS" when one was inserted).

After WB has booted, I used RShoulder to move the slot to the next position, then Select, to insert that disk in the drive. Sure enough, the disk popped up in the Workbench. I then used RShoulder again, to move to the next slot, and Select again, to insert it. The disk was swapped as expected.

The Amiga can detect disks being removed/inserted at a hardware level, so that's not an issue. In games, you may have to click on a "Retry" button some times, while other times the game itself will detect the disk change and continue automatically.

Either way, from what I can tell, this works exactly as it was designed.

midwan avatar Mar 01 '24 17:03 midwan

@midwan - thanks for taking the time to check it out -- documentation on some custom actions is scant. I recreated what you describe above, and it does seem that's how it was designed ~ I don't particularly agree with the logic behind it, in as much considering disk-swapper being like a CD changer, which in this case it very much isn't -- if one does press the 'next/previous' disk on such machines, it moves the mechanism to the next/previous CD and starts playing, you don't have to 'insert' the disk....because you can't, it's already inserted ;)

Personally, I consider selecting the images to be 'loaded' into the disk-swapper, is the act of inserting the disk.

To myself .... and therein only considering multi-disk Amiga titles that are hardcoded for DF0: only.... the available custom actions in disk-swapper don't really address that scenario ....that is to say...if the custom commands were... ;

Insert Next slot in Disk Swapper into DF0: Insert Previous slot in Disk Swapper into DF0:

...that'd make it 'right' so to speak. Such wouldn't interfere with Amiga titles that can address multiple drives ...ie; the disk requestor typically reads 'Insert disk -name- into any drive', such doesn't interfere with other disk-swapper custom actions either, and directly caters for those titles wherein the disk requestor reads 'Insert disk -name- into DF0:'

If it were possible to make those custom commands one button press simple, I think it'd be an improvement overall.

Any chance of considering that as an enhancement, or do you consider it's not really worth the effort?

giantclambake avatar Mar 04 '24 10:03 giantclambake

I could do that, but it would mean an extra custom event (or two, actually). Currently it's following what WinUAE has, so this would be an Amiberry specific expansion, essentially.

midwan avatar Mar 04 '24 10:03 midwan

Understood .... in which case it falls under the auspices of the ReadMe quote...;

"On top of that, there are some unique features developed specifically for Amiberry, such as the WHDLoad booter, support for RetroArch controller mapping, and several more."

Certainly I (and my young teenage users) would appreciate such a unique feature ;)

giantclambake avatar Mar 05 '24 03:03 giantclambake