libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.07k stars 1.81k forks source link

udev lightgun feature broken since 1.9.7 #12973

Open bozothegeek opened 3 years ago

bozothegeek commented 3 years ago

Description

As identified by recalbox team during beta testing of 1.9.8 and investigation, we identified that "lightgun" area is reduced. See issue here for more details/screenshots : https://gitlab.com/recalbox/recalbox/-/issues/1885 We did a modification that we could submit.

Expected behavior

Normally and as before, the cursor can move on the full screen in "lightgun" mode

Actual behavior

The cursor seems blocked in a smaller area at the top right corner.

Steps to reproduce the bug

1) Run retroarch with a lightgun game as "duck hunt" on nes for example 2) Use in options for core, set to "lightgun" 3) resume to play 4) the cursor is blocked in a smaller area at the top right corner.

Bisect Results

The problem is in a commit done before and released for 1.9.7

Version/Commit

Environment information

ghost commented 3 years ago

Hiya read up some of this first apologies for any issues. Did you by and chance log the abs min and max values returned by your lightgun? I added some code here for you test from current master.

edit: Could you please let me know if your still having issues with the light gun with the code pasted below as ive only tested the mouse. I dont have a lightgun gun but if you could paste any output of the values it would be appreciated. I would rather find what is triggering the issue if this doesnt fix it. https://github.com/libretro/RetroArch/pull/12977

bozothegeek commented 2 years ago

Hi @grant2258 , OK I will check mouse and lightgun on my retroarch build (using 1.9.8 but the code is similar, your patch will be compatible), I will keep you informed.

bozothegeek commented 2 years ago

FYI, please find the patch that I prepared now from your 3 commits on this issue, I will test with that retroarch-0006-from-#12977-fix-udev-light-gun-issue.patch.txt

bozothegeek commented 2 years ago

@grant2258 , sorry, I tested but still the issue :-(, it seems that lightgun feature need to have device->mouse.x_min and device->mouse.x_max initialized to absinfo and due to the new if(has_absolutes) we can't set, that's why in my initial proposal of change, I proposed to do a else with the previous code ;-) to avoid to disturb the code for "touch" devices... It's not marveulous, I know :-( but it's working as before for all cores (I tested on nes, snes, flycast, etc..) ... Other thing, I saw also that you declared 2 times struct input_absinfo absinfo; in the same function, is it volonteer ?

ghost commented 2 years ago

Thats fine to move remove the structur. I changed something else and that was legacy could you post the output of your logs that failed ? I think I know what the problem is to be honest but want to confirm we arent hitting >= condition first. The thing is abs im not having these issues at all on kms or x . It could be messa dirvers are supporting the viewport and the pi isint we need to trace this . I tried duckhunt the pointer worked and lightgun worked fine in teh zapper just no buttons worked.

I would need to speak to someone involved with RA on how now none abs devices should be treated practically. The lightgun and and touchpad are abs devices. If your using a none abs device you should be using the zapper and mouse. ie forcing the a none abs mouse to be abs should we be doing this at all? @markwkidd did you have any issues during testing mame2003-plus thats all I tested with I didnt check any other cores.

bozothegeek commented 2 years ago

FYI @grant2258 , the "lightgun" is historically a mode used with wiimote or aimtrack or other because less perturbation/moves to be played, it has been develop for that. The "mouse" mode is more adapted to have more precisions using cores for ordinosaurus ;-). A question for my culture.... what is a "abs" device ? I know for cars, but it should not be the same ;-) sorry if my question is stupid. I will check to have logs...

ghost commented 2 years ago

abs is absolute and the alternative is relative. ABS a touchpad basically will tell you where you touched it and point there touch the top right it will point there on the screen. Relative is how far you moved it from the last place it was. I dont want to bore you with details though. Basically i just need your log to see a if a condition is met.

Like if you read a touchpad or screen with RA input is should only return the abs thats what is was intended for. Same with light guns they should only return what they are designed for unless remapped to the mouse through RA itself. Well that's the way I understand it.

A few questions is it just on the pi (non X environment your having issues with) or you having it elsewhere and what device are you using.

bozothegeek commented 2 years ago

I tested previously and saw the problem on PC x86 64 bits & Raspberry Pi 4. We are using X on PC and not on Pi.

ghost commented 2 years ago

Could you post the logs of both with my patch and your ./configure options for compiling

bozothegeek commented 2 years ago

@grant2258 Please find the 2 log files but no differences really because we can't pass in the code of if(has_absolutes) where you added logs. log retroarch 1.9.8 patch bozo.txt log retroarch 1.9.8 patch grant.txt

ghost commented 2 years ago

@bozothegeek we arent meant too add abs to rel mice if(has_absolutes) doesnt support it we shouldnt be setting it. I will need to ask the libretro folk how we should handle this.

Can you try something for me as I know what core you are using now. Start fceumm with duckhunt and press f1

goto controls->port1 controls change device type to zapper. (make sire your mouse device is the right one as well)

go back to the quick menu then options change zapper mode to mouse return to the game and try move the cursor about.

bozothegeek commented 2 years ago

@grant2258 In fact, I already did the test previously and several times that why I know very well the usual behaviors of retroarch and cores:

Until 1.9.6 and as the patch proposed to avoid the regression:

From 1.9.7 or with the fix that you proposed:

I really can understand that you know "touch screen" needs and for sure your initial change is certainly adapted for that but for mouse and lightgun, it is really a pain now if we can't keep the initial modes as define historically in udev inputs of retroarch. We will be oblige to fork or patch retroarch definitively :-(

I let @twinaphex decide of what we want to do with retroarch for "retro" device used in retro games.

ghost commented 2 years ago

Hi sorry for the late reply. These tests aren't random. I'll need to check this on a pi 3 with a mouse. Only last test will involve mame2003 I worked with markwidd on. Will post details soon. I need to check if it's a core implementation or an mouse issue. Well its good the mouse does work that is as intended. The remap for the lightgun/touch should be done in the quick controls afaik. I just left some feedback for them to decide in the pull request pointing here if a rel device should be reporting back on a abs device touch/lighgun device input read . Personally it seems out of spec to me I will let them decide really sorry about this but we need consistency between platforms. So some clarity on driver level would help here.

winterelf commented 2 years ago

Hi, I'm using rpi4 with retropie 4.7.19 with dolphin bar + WII remote and lr-mame2003, it seems like the cursor can move only 1/4 of the whole screen, it is located in the bottom left rectangle corner. As I understand this issue is still open Note: when I access the libretro settings in the middle of a game, the lightgun cursor can access the whole area of the screen, but when I exit the settings, it is back to the 1/4 rectangle area. is any workaround for this?

bozothegeek commented 2 years ago

@winterelf Which version of Retroarch do you use ? We have the problem since 1.9.7 that why I created this issue ! no real workaround :-( we have to see if it's corrected in 1.10.X now...

ghost commented 2 years ago

@winterelf thing is none of us can reproduce this is it happening on the latest retropie and is it happening with a mouse as well? Also what xy device are you using in mame2003 plus options?

winterelf commented 2 years ago

@grant2258 I did to much changes so I decide to deleted everything and reinstall mame2003-plus and i'm using 0.78 romset. now I configured the wii remote in ES and started the operation wolf game. after pressing a tab, I try to configure my WII B and WII A buttons but they are not recognized. and also when moving the WII remote, nothing moves in game... and i have far less options as in the picture: IMG_20211015_155739

ghost commented 2 years ago

can you post a log when you start ra I can see your mouse detection I also need to see what version of ra your on that will show both things I need to see.

winterelf commented 2 years ago

@grant2258 what is ra? do u mean retroarch? how can I see the log and the version?

ghost commented 2 years ago

https://retropie.org.uk/docs/Runcommand/ yes RA is retroarch. I cant really help with retropie end of things atm as I dont have it installed.

winterelf commented 2 years ago

@grant2258 thanks anyways, I had too many issues when using retroarch with dolphin bar + wii that I give up and I decided to go with Sinden lightgun. i't being 1 year on/off configuring lightgun with different mame emulators. there were always broken games. Sinden lightgun might be the best solution for all

ghost commented 2 years ago

There is an issue with plus itself ill need to create one there and get it fixed it used to work with. There is multuple issues going on here RA and the cores themselves. There is an issue with plus Ill post details there for mark to look at and test on windows as I dont have windows installed.

ghost commented 2 years ago

@winterelf ive managed to recreate the problem in mame2003-plus can you tell me what game your using so i can test if the same things happening with that game.

winterelf commented 2 years ago

@grant2258 I use operation wolf with 0.78 romset

ghost commented 2 years ago

that the game that bugged out on me funnily enough. Im in the middle of fixing this but a quick fix is to delete you nvram, The file you want delete the game it will be in your roms folder. s mame2003-plus/nvram/othunder.nv or iif your using one of clones it will be that make sure mame is closed when you delete the file. The Switching the xy swap option caused this the way the code was reading the mouse being read and the game was re-calibrating. The pull request is in so will let know ill update you when its pulled

winterelf commented 2 years ago

I checked the folder /RetroPie/roms/mame-libretro/mame2003-plus it has nvram folder but it is empty. I deleted the folder anyway. but still the issue stay the same :/

ghost commented 2 years ago

your nvrams could be saving else where there should be something in there if you start the game with mame2003-plus. its depends what emulator is launching for mame as well if its 2003 it will save in that folder. The guys on the pie forums should be able to help with this. Have you setup your mouse index you need to access the retroarch menu settings input->port 1 controls youll see a mouse index there click on that and list will come up pick the mouse you want to use.

winterelf commented 2 years ago

@grant2258 Nice, I put the input-port1 to mouse index 1 (it was 0). now the WII remote actually moves! nice, but now it is just stack on 1/4 screen rectangle. so it's not playable :/

ghost commented 2 years ago

is emulation station launching mame2003-plus or mame2003 ? mame 2003 doesnt support pointer devices properly. When you launch the game keep on pressing your button a menu will come up and and tell you some info make sure 2003-plus lanuching and not 2000 you need to select options->input->xy device as lightgun.

For now we know your wii mote is working im waiting for a pull request to be done on 2003-plus. As soon as thats done ill test with a mouse on a pie ill need to set that up and let you know when to test good news is the more is working.

winterelf commented 2 years ago

ES is lunching mame2003-plus. I will wait for updates, thanks.

ghost commented 2 years ago

hi just a small update.You will need to updated mame2003-plus from the source in retropie setupup its on optional packages in teh manage packages section. Once its installed be sure to remove the othunder.nv ram

I need to search some things further your need to go to the tab menu after you start operation thunderbolt go to analog controls and set sensitivity to 100% its at 25 atm (1/4) (scroll the mouse round the edges of your tv to calibrate). Then goto settings->options->input select your xy device as a mouse. let me know how you get on with this setting

If that works I need you change the device to xy=lightgun and let me know how you get on with it as well.

ghost commented 2 years ago

@bozothegeek and @winneon @twinaphex ive ordered a dolphin bar. I ll sort this out once and for all. next pull request will be confirmed working. Some changes to the code will needed to account for abs devices without touch buttons so will get it all sorted for sure.

winterelf commented 2 years ago

@grant2258 Hi i updated mame2003-plus from source, and set sensitivity to 100 for both x and y, and it increase the rectangle mouse area to the whole screen, nice job. So I guess this is a bug? now it's working fine

ghost commented 2 years ago

Well there is an issue with the abs but this will let you play the game for now with a rel pointer where you dont need to set anything.

Dont worry about the details I dont want to bore you with them. When i get the bar tomorrow ill test the new code ive done and check if there is any other issues and ill fire you an update. Thanks for the feedback is very much appreciated ill update you when im done and provide a patch and instructions to fix retroarch on retropie as its using and older version of RA.

ghost commented 2 years ago

https://github.com/libretro/RetroArch/pull/13143 this is tested and fixed with a dolphin bar.

ghost commented 2 years ago

looks like retropie has a patch that will work now all you need to do is compile Retroarch from source @winterelf and youll be good to go.

winterelf commented 2 years ago

@grant2258 thanks I'll check this

ghost commented 2 years ago

@winterelf sorry its not committed in teh master branch yet as soon as they do you can use it. Ill let you know if i see any motion on it. Just a matter of waiting for the fix retropie end

LibretroAdmin commented 2 years ago

Where are we at with this issue? Is it fixed now or not?

bozothegeek commented 2 years ago

I will redo some tests also from my side about version that we use to tell you. In our case, may be, we kept a patch to avoid this issue.

bozothegeek commented 2 years ago

@LibretroAdmin First, I checked quickly in repo of recalbox, and I'm sorry, it's confirm that we continue to use a patch to correct this issue also in 1.10.0 (I don't now for version after), it's as I adviced initially since 1.9.7... https://gitlab.com/recalbox/recalbox/-/blob/master/package/retroarch/retroarch-0006-fix-min-max-udev-mouse-lightgun.patch Second, for sure, I will test without the patch to confirm you... please wait

MistyDreams commented 2 years ago

yes its fixed dolphin bar works fine on latest master with udev

bozothegeek commented 1 year ago

@MistyDreams Good, but do you confirm now that cursor can move on the screen, fully and as ´lightgun', I say lightgun because ´mouse ´ mode was not impacted and is not working by the same way.

MistyDreams commented 1 year ago

if your referring RETRO_DEVICE_ID_LIGHTGUN_SCREEN_X and RETRO_DEVICE_ID_LIGHTGUN_SCREEN_Y as well as the DEVICE_ID_POINTER_X DEVICE_ID_POINTER_Y (abs paths) yes they work. You need to clarify you question as im assuming this is what your asking