BlitterStudio / amiberry

Optimized Amiga emulator for Linux/macOS
https://amiberry.com
GNU General Public License v3.0
663 stars 89 forks source link

Generic questions about WHDL Autoloader and overriding of parameters #491

Closed Voljega closed 4 years ago

Voljega commented 5 years ago

Hello everyone,

Recalbox is now using Amiberry WHDL Autoloader.

While the compatibility is really good and much better than the previous methods, I have a few questions for which I'm not really sure of the response.

TLDR : what part of the original uae parameters are overriden by the WHDL Autoloader once it boots and ignored ?

Voljega commented 5 years ago

hmmm anyone ? @HoraceAndTheSpider I assume you should know ? ;)

HoraceAndTheSpider commented 5 years ago

The autoloader only uses existing settings functions, so there certainly should not be disparity with what is shown in the GUI.

So initially it determines ecs/Aga/cd32 and uses the QuickStart functions to do this.

This would override any uaeconfig default parameters.

To set the other prefs which are in the Xml, It basically manually parses commands as they would be specified in the .uae file .... unless there is a uae file in which case that is used instead.

You’ll need to check the wiki here to see what hardware setting get set by the xml, but it’s not many - chipset changes etc for compatibility and memory are the big ones, plus of course mounting the HDs.

Lastly (I think) it sets anything required which is host specific (I.e hostprefs) by the same method.

If something like cd32 controls are missing... do you still have Cd32 in the file name? Perhaps on recallbox the name parsing is not performing correctly (I.e it’s an OS difference)

Voljega commented 5 years ago

So I guess the issue might be that we generate an uae and not launch the lha of the game directly or something ? EDIT: yeah I checked we are not using autowhdl= with the game, but -config= with an uae containing paths using your launcher, might it be the issue ?

Because CD32 is totally in the lha name (standard whdl lha are used)

Couldn't find in the wiki a page listing precisely what parameters the loader uses/sets, do you have a link ?

I also couldn't find the hostprefs file in our installation, shoukd it be manually created and where ?

Lastly if I read your comment right, graphical resolution is not set by the whdl autoloader ?

Voljega commented 5 years ago

@HoraceAndTheSpider So I was able to better investigate.

First lha games are launched with the command line : /usr/bin/amiberry -config=/tmp/amiga/conf/uaeconfig.uae

Amiberry's WHDL AutoBooter is clearly used but something is amiss I tested two games, for each of them you can find a link to a zip containing :

Cybernoid_v1.3_1088 : https://www86.zippyshare.com/v/6vez8WiP/file.html

conf for the game in the whdl xml used in our install is :

<game filename="Cybernoid_v1.3_1088"  sha1="4737366e59a35ad17c890fd7f3d6c93142c76484">
        <name>Cybernoid - The Fighting Machine</name>
        <subpath>Cybernoid</subpath>
        <variant_uuid>9f754842-164a-5493-a6fc-5e2c47fe7f49</variant_uuid>
        <slave_count>1</slave_count>
        <slave_default>Cybernoid.Slave</slave_default>
        <slave number="1">
            <filename>Cybernoid.Slave</filename>
            <datapath>data</datapath>
        </slave>
        <hardware>
        PRIMARY_CONTROL=JOYSTICK
        PORT0=CD32
        PORT1=CD32
        JIT=FALSE
        SCREEN_HEIGHT=200
        SCREEN_Y_OFFSET=3       
        </hardware>
    </game>

As you can see in GUI captures, no CD32 joystick is used, screen height is not 200 and despite a hotkey beeing used correctly , it doesn't show in the custom controls page, nor the already configurated controls (I expect to see something like the capture in the wiki page about controls)

ChaosEngine_v1.2_AGA_1324 https://www23.zippyshare.com/v/MPfPrxMo/file.html

Both controlllers are connected and configured before launching the game

<game filename="ChaosEngine_v1.2_AGA_1324"  sha1="5e5f668071eeca8b35b61c0d34fd1a29d7aaf63e">
        <name>Chaos Engine [AGA]</name>
        <subpath>ChaosEngineAGA</subpath>
        <variant_uuid>d64ec2c9-daea-51c8-915d-7c1111cb1fb5</variant_uuid>
        <slave_count>1</slave_count>
        <slave_default>ChaosEngineAGA.Slave</slave_default>
        <slave number="1">
            <filename>ChaosEngineAGA.Slave</filename>
            <datapath></datapath>
        </slave>
        <hardware>
        PRIMARY_CONTROL=JOYSTICK
        PORT0=JOY
        PORT1=JOY
        JIT=FALSE
        CLOCK=28
        CHIPSET=AGA
        SCREEN_HEIGHT=200
        SCREEN_Y_OFFSET=8

        </hardware>
    </game>

As you can see in GUI captures, screen height is not 200 and despite a hotkey beeing used correctly , it doesn't show in the custom controls page, nor the already configurated controls Joystick for player 2, although seemingly being configured (maybe not in right port as mouse still appear as port0) doesn't work in game

HoraceAndTheSpider commented 5 years ago

Config= is not enough to trigger the autoloader, but possibly this is being ignored anyway if you are pointing at the default Config, which will never working together with the autoloader

You need to use autoload= and point to the LHA, so your implementation needs changing.

Voljega commented 5 years ago

@HoraceAndTheSpider

OK I replaced launching line by using autowhdload : /usr/bin/amiberry -autowhdload=/recalbox/share/roms/amiga1200/[ShootEmUp]/Cybernoid_v1.3_1088.lha

Staying on the same two examples, it's better as specific parameters of the whdl db seems to be taken into account, but there are still a lot of issues

Caps for Cybernoid : https://imgur.com/a/e10YnEB Caps for Chaos Engine : https://imgur.com/a/SMPAyYP

First whdl db conf specifies SCREEN_HEIGHT of 200 for both games, which translate to 640*200 in GUI and it doesn't seem to be the right screen size for both game ? Especially Cybernoid misses a lot of the picture that way, I included screen caps in 200 and in more to show the difference.

Controls is also better, joystick type are setted correctly, but PORT0 device always stays as mouse for both game. But I can actually select my two controllers on the drop down and replace the mouse by the second one, and it works in game after that

Custom controls are again totally and utterly false... see hotkey set as none and absolutely no button beeing set.

And I have two joysticks connected, configured and on before launching the game .... The two controllers are of the same type, PLAYSTATION(R)3 Controller and there is a single PLAYSTATION(R)3 Controller.cfg describing the controls ?

input_a_btn = "1"
input_b_btn = "0"
input_down_btn = "14"
input_enable_hotkey_btn = "10"
input_exit_emulator_btn = "9"
input_l2_btn = "6"
input_l3_btn = "11"
input_l_btn = "4"
input_l_x_minus_axis = "-0"
input_l_x_plus_axis = "+0"
input_l_y_minus_axis = "-1"
input_l_y_plus_axis = "+1"
input_left_btn = "15"
input_menu_toggle_btn = "0"
input_r2_btn = "7"
input_r3_btn = "12"
input_r_btn = "5"
input_r_x_minus_axis = "-3"
input_r_x_plus_axis = "+3"
input_r_y_minus_axis = "-4"
input_r_y_plus_axis = "+4"
input_reset_btn = "2"
input_right_btn = "16"
input_select_btn = "8"
input_start_btn = "9"
input_up_btn = "13"
input_x_btn = "2"
input_y_btn = "3"

You can find the rest of conf / retroarch files in my previous post

How to specify to the loader that they are two controllers to use ? It seems it doesn't find the second one

midwan commented 5 years ago

I believe the hostprefs.conf can have global settings such as preferred controllers, that will be used with the WHDLoad booter. Have you checked there?

Also, please use -autoload= instead of -autowhdload=. They both do the same thing, but the second one is there for compatibility reasons only and might be removed at some point in the future. ;-)

Voljega commented 5 years ago

Thanks Dimitris for the response !

I tried looking for the hostprefs.conf file but actually couldn't find it anywhere on Recalbox.

And the controllers GUI issue also appears with ADF where this file hostprefs.conf isn't taken into account anyway I guess ?

Coincidentally, the same issues with controllers GUI part also appears on Batocera distribution, but I didn't really investigate code there, suffice to say that the code implementation are different anyway...

midwan commented 5 years ago

@Voljega It should be under the whdboot directory, did you check there?

Take a look at the relevant wiki article also: https://github.com/midwan/amiberry/wiki/WHDLoad-Auto-booting

Voljega commented 5 years ago

So it seems this file was indeed missing, creating it with values of the wiki

CONTROLLER_1=joy1
CONTROLLER_2=joy2
;CONTROLLER_3=joy0
;CONTROLLER_4=joy3
CONTROLLER_MOUSE_1=mouse
CONTROLLER_MOUSE_2=joy0
;RETROARCH_QUIT=TRUE
;RETROARCH_MENU=TRUE
;RETROARCH_RESET=TRUE
;KEY_FOR_QUIT=F12
;KEY_FOR_MENU=F11
;DEADZONE=33
;STEREO_SPLIT=1
;SOUND_ON=FALSE
;ASPECT_RATIO_FIX=TRUE
;FRAMESKIP=TRUE

partially solves one of the issue : "Controls is also better, joystick type are setted correctly, but PORT0 device always stays as mouse for both game. But I can actually select my two controllers on the drop down and replace the mouse by the second one, and it works in game after that"

Now on start of the game, the two controllers are well configured and there is no need to go in GUI to modify the one in PORT0, it is already set to one of the joystick, as is PORT1

But sadly, keeping the same hotsprefs.conf, if only one controller is connected, this controller is not selected anymore in the GUI, you only see port 0: mouse and port1: keyboard as joystick. You can still reassociate it, but it is not there by default, and you can't even enter GUI with it or exit game, you need the keyboard

The issue with the missing custom configuration for hotkey and associated buttons is still there too, but I will maybe create a separate issue for that as it seems it is a specific one, also appearing for ADF

HoraceAndTheSpider commented 4 years ago

If the game is one player , port 0 will likely default to mouse: this is a more natural Amiga behaviour.

If there is a 2 player game that has the mouse set, and shouldn’t, check it is correct in the xml.

If the xml is wrong, please report it on the xml builds github and we will fix it :)

HoraceAndTheSpider commented 4 years ago

You should make sure you don’t have “redundant” joy2 etc settings in the hostprefs - I.e only use controller_1=joy2 if you have multiple controllers connected.

Otherwise it attempts to connect a controller which isn’t there, and can reset the other inputs you’ve already set

Voljega commented 4 years ago

So ideally the hostprefs file should also be custom generated based on how many controllers are currently connected before launching each game ?

HoraceAndTheSpider commented 4 years ago

So ideally the hostprefs file should also be custom generated based on how many controllers are currently connected before launching each game ?

The hostprefs should reflect whatever is available on the specific host machine. Doesnt need to be before every game - most users are not changing the number of controllers they have connected.

midwan commented 4 years ago

@Voljega The hostprefs.conf file is now obsolete - all relevant options have been moved to amiberry.conf instead, which includes several defaults. Unless a config file (or the WHDLoad XML) overrides them, the defaults will be used instead.

You can check the wiki for a full documentation of what's available: https://github.com/midwan/amiberry/wiki/Amiberry.conf-options