rpcs3 icon indicating copy to clipboard operation
rpcs3 copied to clipboard

[Feature Request] PS Move shake input emulation

Open legend800 opened this issue 5 years ago • 29 comments

Currently we can simulate ps move cursor and button input via mouse but the ability to shake is not available.

2020-02-02 10_01_21-Settings

This would be handy in several PS3 ps move games, especially House of the Dead 4 which is completely playable, except that you need a real PS4 pad to provide "shake" input (required to progress in a few areas).

legend800 avatar Feb 02 '20 18:02 legend800

Yes please!

superblobster avatar Mar 23 '20 17:03 superblobster

Hello, any improvment on this feature? Please, we really need it, espcially to play house of the dead 4.

thanks

ghibu avatar Oct 03 '20 07:10 ghibu

Ryujinx implementation of this here: https://github.com/Ryujinx/Ryujinx/pull/2039#discussion_r588930025

legend800 avatar Mar 06 '21 21:03 legend800

@legend800 That is a csharp implementation, and I'm just adding a very small addition to the existing one, which allows imitating the controller shake through a keyboard key. The actual implementation code is here: https://github.com/Ryujinx/Ryujinx/tree/master/Ryujinx/Modules/Motion

But RPCS3 is c++, a better source would probably be Yuzu's which a quick search seems to indicate it is mostly in these areas motion_input.cpp & input_common/udp

CeruleanSky avatar Mar 07 '21 09:03 CeruleanSky

Question: does anybody know if there is a common definition of "shake"... because from what I've found so far it seems like it is very much up to the individual game to make sense of the 3 sensors and determine if a shake has occured.

So... in order to simulate a shake one would have to supply data for these three sensors matching what the game expects to be a shake.

I doubt this is very complicated to get working in the majority of cases, just want to ask whether I've overlooked anything.

So long story short: does anybody know of a PS Move API for "shakes"? Or are we talking about simulating a shake via sensor data?

hansschmucker avatar Jan 16 '22 19:01 hansschmucker

Ah interesting. Seems like the magnometer is not available on all move controllers and as such not necessary to simulate a shake (well it wouldn't be much use anyway, but it's still good to know).

From what I'm seeing here that would mean that CellGemState, CellGemInertialState (and maybe CellGemImageState, but that seems unlikely) are the places that would need to be filled to simulate a shake, correct?

hansschmucker avatar Jan 16 '22 20:01 hansschmucker

From what I'm seeing everyting seems to be in place already... all the structs are there already and could potentially be filled by mouse_input_to_pad . However I'm not so sure about three things:

  1. We'd need something to keep track of our position in the shake sequence. Not sure what RPCS3 conventions are for such a simulation property. Would it be alright to add it straight to gem_config_data?
  2. Whether all other calls are in place to actually make use of any data we feed in... would it actually reach the emulated application? Looks like it, but I'm not sure.
  3. What data should we feed in? Anybody has a move controller connected to a PC that can provide real shake values?

hansschmucker avatar Jan 16 '22 20:01 hansschmucker

Before "simulating shake", there are many other things that don't work. The mouse handler is a barebone implementation at best.

Megamouse avatar Jan 16 '22 20:01 Megamouse

I know, but the mouse handler would probably still be sufficient... if the data itself is actually sent to the PS3 application. We'd just add an IF MOVE ENABLED AND BUTTON 3+4+5 SET LAST_SHAKE_REQUESTED=NOW and then on every call IF NOW-LAST_SHAKE_REQUESTED<SHAKE_SEQUENCE_LENGTH SET gem_state.pos/vel/accel/quat/angvel/angaccel/handle_pos/handle_vel/handle_accel=SHAKE_SEQUENCE[NOW-LAST_SHAKE_REQUESTED]

Problem is I don't know if the emulation part is enough. I can see there's a separate struct CellGemInertialState which seems relevant, but I can't find any use of it. Do you know off the top of your head if modifying CellGemState alone would be enough to simulate a shake?

hansschmucker avatar Jan 16 '22 20:01 hansschmucker

What I mean is, the current code is not correct. It doesn't work correctly for half of the games. So before adding any complex sequences, this stuff should be figured out. Btw, I already played around with that stuff. Idk if i already added it, but the mouse movement should add inertia anyway, so a shake shouldn't really be difficult to pull of without a special button, if implemented

Megamouse avatar Jan 16 '22 20:01 Megamouse

Ah good point, thank you very much for the explanation, I didn't think of that. You're right, it makes more sense to just make mouse movement affect sensor data than adding a separate hook.

Although down the road a "shake button" really is very useful in a lot of games, but you're right, that's something that should be done MUCH later.

I think you haven't added it yet, at least I can't see anything setting more complex values in mouse_pos_to_gem_state.

Thanks for all your work BTW. I'm currently having the time of my life playing HOTD 3 with gyro controlls :) : https://forums.rpcs3.net/thread-203655.html

hansschmucker avatar Jan 16 '22 21:01 hansschmucker

Lol. That's an interesting way of playing the game. You can probably map a real light gun to it as well

Megamouse avatar Jan 16 '22 21:01 Megamouse

Would probably be better, but setting it up this way was more fun ;)

hansschmucker avatar Jan 16 '22 21:01 hansschmucker

Lol. That's an interesting way of playing the game. You can probably map a real light gun to it as well

Yep, it work good with gun, i played on wiimote, but for few games still need gyro shake. House of the dead 4, resident chronicles and dead space. This not help make shake gyro on button? https://github.com/r57zone/DualShock4-emulator

dante3732 avatar May 30 '22 13:05 dante3732

general accelerometer things should have some sort of implementation

a lot of things in LittleBigPlanet 2 are broken because of it

TorutheRedFox avatar Jul 12 '22 10:07 TorutheRedFox

I really can't see why there has to be a button input for a ubiquitous action involving the motion controls, it would be like a button made specifically made for a button combo. I would rather like to see programmable motions that would include shake, but can also emulate any motion the game might need or you might want. Like a 3D bezier curve to simulate the motion control, from a 3D program or a UI interface in the emulator.

JimScript avatar Jul 12 '22 14:07 JimScript

I really can't see why there has to be a button input for a ubiquitous action involving the motion controls, it would be like a button made specifically made for a button combo. I would rather like to see programmable motions that would include shake, but can also emulate any motion the game might need or you might want. Like a 3D bezier curve to simulate the motion control, from a 3D program or a UI interface in the emulator.

I completely agree. The Dolphin emulator has several motion-to-button emulation controls. For example in Super Mario Galaxy 2 I have my R1 mapped to "shake" and its easy as pi. This is super frustrating that theres no real work-around to playing HOTD4 without the shake mapping or a real PS with motion controls. For example, if you have only health when playing against the first main boss in HOTD4 and he grabs you and you die, thats it...no insert coin to keep playing...you die and get punted to the beginning of the game again. Can someone please impliment this? Even something super simple like "map a key to shake wildly". At least thats a start. Maybe someday if I have more time I will code it myself but unfortunatelyI work 60+ hour weeks lately and Im lucky if I even have 20 minutes to fire up a game and play. I love HOTD4 though and would be thrilled to play it to completion on my Batocera / RPCS3 emulation. Thanks in advance.

LykosTactical avatar Aug 07 '22 00:08 LykosTactical

Shaking only is enough to pass most of the light gun games.

dante3732 avatar Dec 25 '22 20:12 dante3732

Instead od simulating shaking controllers, maybe we can try to simulate that shaking is already done and write that value into memory using patches with certain keys.

For example, if we isolate value for shaking when is done, when we press square, that value will be read from patch and will be written into memory.

It is stupid to leave constatntly writing into memory like with standard patches, because in that case each door will be opened when we approach to them.

I don't have real ps3 console or controller to try this myself. All what I can try and probbably will not success is to use sqare key to simulate throwing bomb, and if I did it that means that isolating values is possible and sending certain command (thorowing bomb) with certatin key (square) is possible.

skolomir avatar Jun 20 '23 14:06 skolomir

On dolphin you can assign buttons to several shake patterns. And maybe a modifier key by holding which- you can shake your mouse to simulate the shaking in game.

Having these functions would make House of Dead 4 playable.

RiasatSalminSami avatar Mar 03 '24 20:03 RiasatSalminSami

I'm guessing this'll be one of those "we accept PRs" type issues (no shade intended here), and someone that cares about Move implementation will have to step up and address this.

SeongGino avatar Mar 04 '24 03:03 SeongGino

Dualshock 4 gamepads already support six axis emulation in rpcs3. What if we can map psmove's cursor to DS4's gyro and then it already native shake support on top of that? Of course that would still mean mouse cannot be used, but at least move emulation with shake can become feasible with ds4 and other gyro supported gamepads.

Here's an example of gyro supported controller on another emulator (Teknoparrot) on House of The Dead 4, aiming the mouse cursor via gamepad's gyro and also shaking the gamepad:

https://youtu.be/xp7WRvMPNpg

RiasatSalminSami avatar Apr 09 '24 02:04 RiasatSalminSami

Dualshock 4 gamepads already support six axis emulation in rpcs3. What if we can map psmove's cursor to DS4's gyro and then it already native shake support on top of that? Of course that would still mean mouse cannot be used, but at least move emulation with shake can become feasible with ds4 and other gyro supported gamepads.

Here's an example of gyro supported controller on another emulator (Teknoparrot) on House of The Dead 4, aiming the mouse cursor via gamepad's gyro and also shaking the gamepad:

https://youtu.be/xp7WRvMPNpg

The cursor itself is already just a hacked up version of the Move gyro/camera. I don't think that much is something the developers aren't already keenly aware of.

Not to mention, Sega Lindbergh != PlayStation Move. Lindbergh shooters use a mouse anyways, so HOTD4's waggle, natively, already literally works how people imagine it wanting to work; but that's a core gameplay/input system difference.

I think the task is already well-understood enough to the people involved in terms of what the users want--all it takes is someone willing to submit a PR implementing this feature.

SeongGino avatar Apr 09 '24 06:04 SeongGino

In one of the posts above, I outlined how the simulation could work. I am not in favor of using any additional devices, such as physical controllers, because then the use of the term emulation itself is questionable.

For personal reasons, my goal is to simulate the vibration of the gyroscope in the emulator via the keyboard. I assume that in that case the program (that is, the rpcs3 emulator) should be informed that the movement has occurred along all axes (x,y and z).

In the meantime, I bought a PS dualshock 4 controller and checked that everything works properly in HOTD4 with the dualshock controller attached. Doors on the second level that couldn't be opened via the keyboard now open in HOTD4 when the controller is shaken. Thus, the game receives the information of the movement/movement of the gyroscope.

In order to better understand the solution to the problem, or rather to find a solution to the problem, I would have to know how the communication between the gyroscope and the computer takes place. Also, I need to know if the communication goes through a general Windows driver or if a special driver was written for this purpose, through which the rpcs3 emulator communicates with the DS4 controller.

My goal is to emulate a gyroscope without connecting any controller. What I don't know is whether it is enough to emulate only the gyroscope or in the case of emulation (for the gyroscope to work) the entire controller must be emulated.

This leads us to the conclusion that creating a virtual controller would be the best option. On that controller, in addition to the button mapping for the classic PS3 controller (game pad), the axis mapping buttons should also be set. Or, just maybe a single button to emulate the controller shake, which might make it possible to go through the entire HOTD4 game (I haven't gone through the whole game yet, just tested opening doors on the second level), but probably wouldn't be good for other games. In the game Heavy Fire - Afghanistan, the controller, i.e. the gyroscope, should have been moved up. Maybe shaking the controller would lead to the same result, but without a ready-made solution that simulates the shaking of the controller, which makes it possible to pass (at least the second level) HOTD4, I don't know if the other games could be passed with the shaking simulation. For this reason, making a virtual controller seems to me to be a safer (and probably more difficult) solution than the emulation of just shaking the controller.

Now let's look at where we are. The first post on this page is from 2020. If the developers wanted to integrate the gyroscope into rpcs3, they would have done it by now, I suspect. Given that nothing has been done on that issue for four years, the question is whether and when it will be done.

Programming is not my forte, but when I get some free time, with the help of GPT I will try to understand a little better what I need to know, to emulate a single key or, if that is impossible, then the entire controller.

It would mean if any of you could send me a link or the name of the driver that rpcs3 uses to communicate with the DS4 controller, or which driver is used to communicate with the gyroscope. But, as I said, the whole controller (in this case DS4, since I can experiment with it, since I own it) may have to be emulated to do the gyro emulation. It all depends on how rpcs3 receives commands.

I would like it the most if we could just emulate the shaking of the controller and have them do it in all games where a gyroscope is needed, but that's just my wishes.

In the event that it is possible to emulate a controller shake using a single button (without emulating the entire controller as a virtual device), an external program would have to be used for that. In that external program, we could set the key we want to simulate shaking and that program would somehow communicate with the rpcs3 emulator. But, as I said, the question is whether the rpcs3 emulator would be able to recognize that it is receiving a command/coming from a gyroscope, if it does not have a full controller selected in its control options, say "virtual DS4".

The only thing I can promise is that I will keep up to date with how things work, and if any of you have any programming knowledge, links to the rpcs3 emulator, that is, the driver it uses for the gyroscope, would be great if they could be sent to me. It would be best if the links were on this page so that anyone interested in this topic could see them and possibly help. It is also possible to contact me personally by email ([email protected]), so if necessary we will share the screen and hear each other via Viber (in English), so I guess we will do something.

From waiting for developers from the rpcs3 team, I don't expect a solution to this problem anytime soon, if at all.

skolomir avatar Apr 10 '24 01:04 skolomir

A quick clarification on this point I made in an earlier reply:

Lindbergh shooters use a mouse anyways, so HOTD4's waggle, natively, already literally works how people imagine it wanting to work;

Turns out, The House of the Dead 4's lightgun uses an accelerometer, so it isn't "literally" working how we imagine it to be (mouse waggle translating to shake motions) without a third-party hack--in this case, Lindbergh emulators (lindbergh-loader and TP) provide this functionality to patch the issue.

That being said, the original intent of my message still stands; let's try not to nag the maintainers on this issue. If someone is able to, then it'll be up to them to implement the feature.

SeongGino avatar Apr 11 '24 17:04 SeongGino

Stop writing useless messages, if the developers wanted or could, they would have already emulated shaking the gyroscope on the button or emulating movement on the buttons as in dolphin. I subscribed to this topic to keep track of the progress of creating this feature, and you are constantly updating it.

To emulate shaking on the mouse with the cursor of the ps move is nonsense, because reloading in some games may be triggered falsely during aiming.

dante3732 avatar Apr 11 '24 21:04 dante3732

Stop writing useless messages, if the developers wanted or could, they would have already emulated shaking the gyroscope on the button or emulating movement on the buttons as in dolphin. I subscribed to this topic to keep track of the progress of creating this feature, and you are constantly updating it.

Either you're writing this to someone else without clarifying, or you didn't read anything that I've posted where I've been saying literally exactly the same thing you're complaining about now. I don't much appreciate the tone that's unwarranted here.

To emulate shaking on the mouse with the cursor of the ps move is nonsense, because reloading in some games may be triggered falsely during aiming.

I for one wasn't telling anyone to do exactly this... But beyond that, it's effectively what you're doing on original Move hardware, so...

SeongGino avatar Apr 11 '24 21:04 SeongGino

To emulate shaking on the mouse with the cursor of the ps move is nonsense, because reloading in some games may be triggered falsely during aiming.

Wrong. This is EXACTLY how it works on Teknoparrot when playing the arcade HOD4 version on that loader. Shake mouse = shake the (arcade) gun to reload/shake enemies off in-game. Works perfectly. So that's an option as well as simply mapping it to a button like Citra/Yuzu, etc. Lot of options, we just need a dev to pick this up at some point. I'm sure Megamouse will look at it at some point.

legend800 avatar Apr 12 '24 05:04 legend800

I tried reWasd https://www.rewasd.com/advanced-controller-mapping but I didn't have luck.

Although there is a virtual ds4 controller option in this program, in practice I did not manage to make anything work, not even the start button (Options on the DS4 controller), nor the axis for simulating the gyroscope.

All I achieved was to make the virtual controller visible in the RPCS3 emulator and device manager. Device Manager sees this virtual controller in the HID section under the name "HID-cmpliand game controller". Look at the picture below.

In the reWASD program, I put the Simulate Options button on the O key. Then in RPCS3 for Handlers I choose DualShock and for Devices I can choose DS4 Pad #1 (connected). All I can do then, is map any key in the rpcs3 layout handle to assign the options button to any key. Look at the picture below.

For example, if I click on the layout for L1 and press the O key (to which we assigned the Options function in reWASD), on the layout the L1 key will have the Options function. In this way, it is as if we can change the native functions of the buttons, which is not our goal, our goal is only to add axes. Finally, pressing the O key in the game, nothing happened.

The reWASD program is not free, but there is a seven-day free trial. It also offers the use of a UDP server and the Reomote Play option, but I had no luck with that either.

I couldn't find a video on youtube that explains how to connect reWASD and rpcs3. We only need gyroscope simulation via keyboards, and in its options there are vGyro mapping keys. The problem is that the mapped commands of this program are not executed in the game.

I tested for a couple of days (about ten hours in total) with the game House of the Dead 4, and by pressing the Options button, when the game is started (when the killing of zombies has started), the options button affects the calling and disappearance of the menu. That was the safest way for me to see if the mapping worked in practice, so if it did, I would add the gyroscope buttons later.

Maybe one of you will have more luck than me with this program, so if anyone gets lucky, it would be nice to put the recording on YouTube and the link here.

ds4 dm ds4 connected

skolomir avatar Jul 18 '24 15:07 skolomir