Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys_usbd: Emulate Dimensions Toypad #15763

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

deReeperJosh
Copy link
Contributor

This PR aims to implement an Emulated Toypad for the Lego Dimensions games, which will close #15318

The Toypad behaves very similarly to the Infinity Base, with two interrupt endpoints (one for reading and one for writing), but the main difference is that the game will act as if the portal has been disconnected if an empty read message is returned. In order to get around this, I created a new method in sys_usbd.cpp to push the fake transfer to the list of fake transfers when there is actually a message to respond with.

The UI I have created is meant to resemble the physical Toypad (as closely as possible as I could with Qt), with the layout matching what you will see during the game:

Screenshot 2024-07-01 at 15 59 08

The UI also has a tool that allows you to easily move figures between spaces on the portal, which is often required in game:

Screenshot 2024-07-01 at 16 55 54

I still have a few commands that I need to understand how to respond to, but I haven't seen them called by the game as of yet - will unmark as draft when that is the case.

rpcs3/rpcs3qt/dimensions_dialog.cpp Outdated Show resolved Hide resolved
rpcs3/rpcs3qt/dimensions_dialog.cpp Outdated Show resolved Hide resolved
rpcs3/Emu/Io/Dimensions.h Outdated Show resolved Hide resolved
rpcs3/Emu/Io/Dimensions.h Outdated Show resolved Hide resolved
rpcs3/Emu/Io/Dimensions.h Outdated Show resolved Hide resolved
rpcs3/Emu/Io/Dimensions.cpp Outdated Show resolved Hide resolved
rpcs3/Emu/Io/Dimensions.cpp Outdated Show resolved Hide resolved
rpcs3/Emu/Io/Dimensions.cpp Outdated Show resolved Hide resolved
rpcs3/Emu/Io/Dimensions.cpp Outdated Show resolved Hide resolved
rpcs3/Emu/Io/Dimensions.cpp Outdated Show resolved Hide resolved
@Megamouse
Copy link
Contributor

Btw, please don't force push during code reviews.
Otherwise it's highly confusing to review changes.

@deReeperJosh
Copy link
Contributor Author

@Megamouse apologies - saw a notification come in with the first 3 comments so thought you had finished an initial review

rpcs3/Emu/Io/Dimensions.cpp Outdated Show resolved Hide resolved
rpcs3/rpcs3qt/dimensions_dialog.cpp Show resolved Hide resolved
rpcs3/rpcs3qt/dimensions_dialog.cpp Outdated Show resolved Hide resolved
@Megamouse
Copy link
Contributor

Megamouse commented Jul 1, 2024

LGTM for now except for that thread thing.
I have no idea if the PR works of course.
Let me know when you think you're finished.
You can rebase and clean up the commits for now if you like.
But please keep pushing new changes to new commits afterwards.

@deReeperJosh
Copy link
Contributor Author

@Megamouse much appreciated, thanks for the quick reviews! Will try to sort out some threading, and play a bit more of the game to see if I can complete the list of commands

@deReeperJosh
Copy link
Contributor Author

Latest commit adds more Dimensions crypto, so that users can use any existing dumps they have from their own toy tags, as well as creating blank figures with the correct data expected by the game

rpcs3/Emu/Io/Dimensions.cpp Outdated Show resolved Hide resolved
rpcs3/Emu/Io/Dimensions.cpp Outdated Show resolved Hide resolved
rpcs3/Emu/Io/Dimensions.cpp Outdated Show resolved Hide resolved
rpcs3/Emu/Io/Dimensions.cpp Outdated Show resolved Hide resolved
rpcs3/Emu/Io/Dimensions.cpp Outdated Show resolved Hide resolved
rpcs3/Emu/Io/Dimensions.cpp Outdated Show resolved Hide resolved
rpcs3/Emu/Io/Dimensions.cpp Outdated Show resolved Hide resolved
rpcs3/Emu/Io/Dimensions.cpp Outdated Show resolved Hide resolved
rpcs3/Emu/Io/Dimensions.cpp Outdated Show resolved Hide resolved
rpcs3/Emu/Io/Dimensions.cpp Outdated Show resolved Hide resolved
@deReeperJosh deReeperJosh force-pushed the dimensionstoypad branch 3 times, most recently from 97cebc8 to 65c9ba3 Compare July 9, 2024 20:01
@Megamouse
Copy link
Contributor

Is there anything missing or why is this a draft?

@deReeperJosh
Copy link
Contributor Author

Haven't had much time to play more of the game yet, but I am just waiting to mark this as not draft until I have been able to see what responses look like with a real toypad for the commands that are currently unimplemented (line 589 of Dimensions.cpp). I assume for the color commands that they will be blank responses as well as the ones already implemented, but will look to confirm this.

@deReeperJosh
Copy link
Contributor Author

I could mark as ready for now if you want this merged and look to retrospectively add the missing command implementations

@Megamouse
Copy link
Contributor

No rush, but if you think it's already "playable", we can merge

@deReeperJosh
Copy link
Contributor Author

I would say it's playable in it's current state, will keep an eye on discord/github issues if anything pops up. Let me just rebase against master and mark as ready for review

@deReeperJosh deReeperJosh marked this pull request as ready for review July 19, 2024 17:28
@Megamouse Megamouse merged commit 500bf0f into RPCS3:master Jul 19, 2024
6 checks passed
@taiko1
Copy link

taiko1 commented Jul 20, 2024

The lego dimensions toy pad emulator made by berny23 is open source and could maybe be to help.

@Matt14451
Copy link

Matt14451 commented Jul 20, 2024

Seems more stable than the other ToyPad emulator used before, but crashed the emulation when tried to move a figure to a position that was already filled, and doesn't always recognise the middle option like when doing master builds.

@taiko1
Copy link

taiko1 commented Jul 20, 2024

The scale keystone* that makes you bigger and smaller sometimes doesnt work when you for example try to move a character from big to small

@taiko1
Copy link

taiko1 commented Jul 20, 2024

Also isnt it possible to make the ui a bit smaller?

@taiko1
Copy link

taiko1 commented Jul 20, 2024

The scale keystone* that makes you bigger and smaller sometimes doesnt work when you for example try to move a character from big to small

Here is what happens

2024-07-20.22-43-11.1.mp4

@deReeperJosh
Copy link
Contributor Author

@taiko1 what is the first level where the scale keystone is used?

@Jack54guythecoder
Copy link

Is this PR based on Bernys`s work?
Or how did this came to be?

@Matt14451
Copy link

@taiko1 what is the first level where the scale keystone is used?

There's a scale puzzle in The Simpsons adventure world, behind The Simpsons house

@deReeperJosh
Copy link
Contributor Author

Is this PR based on Bernys`s work? Or how did this came to be?

Yes mostly based on Berny's toypad emulator/node-ld fork

@deReeperJosh
Copy link
Contributor Author

deReeperJosh commented Jul 21, 2024

@Matt14451 what platform are you using? I have no issues moving figures to a spot already filled on my Mac but could be platform specific

@Matt14451
Copy link

@Matt14451 what platform are you using? I have no issues moving figures to a spot already filled on my Mac but could be platform specific

Windows 11, might be one-off but game crashed as soon as did that

@deReeperJosh
Copy link
Contributor Author

If you can reproduce that would be helpful, was it immediately on the first move to a filled slot or was it after a few moves around?

@taiko1
Copy link

taiko1 commented Jul 22, 2024

If you can reproduce that would be helpful, was it immediately on the first move to a filled slot or was it after a few moves around?

Sorry for not responding but you can find these puzzles inside of different adventure worlds

@taiko1
Copy link

taiko1 commented Jul 22, 2024

I think the issue might be that it instantly moves the character causing it not to work but i could be wrong since it still reacts when i switch slot

@taiko1
Copy link

taiko1 commented Jul 22, 2024

I think it could be fixed by adding like a small delay when moving the character

@deReeperJosh
Copy link
Contributor Author

I will see if adding a pause between the replies sent to the portal for swapping the characters might help, might need to spend some more time with a real portal and see if it also does the same thing

@taiko1
Copy link

taiko1 commented Jul 28, 2024

Has it been fixed?

@deReeperJosh
Copy link
Contributor Author

I haven't made any changes to the timings of responses yet but if you want to raise an issue so I can track it that would be helpful

@taiko1
Copy link

taiko1 commented Jul 29, 2024

The update made it so that it takes out the character you have and places a new one of it when moving the same character causing the keystones not work properly

@sentrywasbored
Copy link

sentrywasbored commented Aug 4, 2024

attempting to utilize the rip keystone from the series 2 story packs causes Dimensions Manager to go into a connection loop.
#15888
Rip keystone is accessible within the start section of Paranormal Beginnings (Ghostbusters 2016 1st level)

@taiko1
Copy link

taiko1 commented Aug 5, 2024

Hello?

@deReeperJosh
Copy link
Contributor Author

This pr is closed, please raise an issue rather than commenting here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request] Virtual ToyPad integration to RPCS3
7 participants