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

[WIP] Balance Board emulation #8268

Draft
wants to merge 16 commits into
base: master
from

Conversation

@Pokechu22
Copy link
Contributor

commented Jul 28, 2019

This PR adds support for balance board emulation.

This isn't completely finished, and the UI for it isn't too great. In particular, there isn't any way to specify the current weight on the main UI, only to adjust the weight in terms of percentages, though it does exist on the TAS UI. The UI also doesn't support all possible inputs, only cases where actual balance is used; this means that e.g. walking doesn't work too well (or the step game). The balance board is treated as a regular extension and can be set on any remote, and also needs to be manually set for the actual balance board. Also, games that don't support the balance board will continuously disconnect it, and dolphin will then repeatedly attempt to reconnect it. But it is perfectly usable.

One thing I haven't tested is whether this works with movies; the documentation (rev 31 specifically) mentions that a single byte is used to indicate the connected controllers, and adding a 5th pseudo-wiimote probably causes issues there. I currently have a commit that adds an excessive number of bounds-checks for movies, which ideally should be replaced with proper support.

@lioncash
Copy link
Member

left a comment

Left a few preliminary comments, if any don't apply due to the WIP status, feel free to disregard them.

Show resolved Hide resolved Source/Core/Core/HW/WiimoteEmu/Extension/BalanceBoard.cpp Outdated
Show resolved Hide resolved Source/Core/Core/HW/WiimoteEmu/Extension/BalanceBoard.cpp Outdated
Show resolved Hide resolved Source/Core/Core/HW/WiimoteEmu/Extension/BalanceBoard.cpp Outdated
Show resolved Hide resolved Source/Core/Core/HW/WiimoteEmu/Extension/BalanceBoard.cpp Outdated
Show resolved Hide resolved Source/Core/Core/HW/WiimoteEmu/Extension/BalanceBoard.cpp Outdated
Show resolved Hide resolved Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp Outdated
Show resolved Hide resolved Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp Outdated
Show resolved Hide resolved Source/Core/DolphinQt/TAS/BalanceBoardWidget.cpp Outdated
Show resolved Hide resolved Source/Core/DolphinQt/TAS/BalanceBoardWidget.cpp
Show resolved Hide resolved Source/Core/DolphinQt/TAS/BalanceBoardWidget.cpp Outdated

@Pokechu22 Pokechu22 force-pushed the Pokechu22:balance-board branch from 67104bd to 207f8cd Jul 28, 2019

@Pokechu22

This comment has been minimized.

Copy link
Contributor Author

commented Jul 29, 2019

I've implemented movie support, which seems to work correctly at least when starting from a save state right before selecting a game. Wii Fit (Plus) seems to be rather annoying with synchronization though, especially with the random fitness tips on startup. (Possibly I just don't know how to work with the realtime clock or saves or something; I haven't used the movie functionality much.)

I haven't tested netplay yet, and I suspect it also has the same expectations of 4 wiimotes or gamecube controllers. I'm looking into that one now. (I don't have anything to test it on either as Wii Fit isn't really a multiplayer game and you can only use one balance board, but I should be able to make the same kinds of code changes.)

EDIT: I don't think I'll be able to handle netplay at the moment; I don't feel confident in modifying the protocol for it which I'm pretty sure would be needed to add support (especially since you'd generally have one player using both the remote and the balance board)

Show resolved Hide resolved Source/Core/Core/Movie.cpp Outdated

@Pokechu22 Pokechu22 force-pushed the Pokechu22:balance-board branch from f8984fc to 0b47e16 Jul 31, 2019

@Starmann

This comment has been minimized.

Copy link

commented Aug 4, 2019

For anyone who wants to try with Netplay, Tetris Party is a multiplayer game that supports Wii Balance board. As is Super Monkey Ball Step and Roll.

@Pokechu22 Pokechu22 force-pushed the Pokechu22:balance-board branch from 0b47e16 to 07eacde Aug 13, 2019

@Pokechu22 Pokechu22 force-pushed the Pokechu22:balance-board branch from 07eacde to fcfcd2e Aug 14, 2019

@Pokechu22

This comment has been minimized.

Copy link
Contributor Author

commented Aug 16, 2019

I've found my previous code that calibrated 34kg as 34000 was causing overflows when leaning far to the side and also causing underflows as one of the sensors goes negative if leaning too far. I've changed it so that the difference between 0kg and 34kg is 3400 instead and that works fine; games don't mind/like the negative value (though I haven't tested if it occurs on hardware; I've only confirmed that it makes sense math-wise).

I've also adjusted the TAS code to use 4 doubles internally instead of direct sensor values. That seems to be causing some issues (a stackoverflow sometimes) which I haven't fixed yet, but the UI looks and behaves about the way I want it to. Fixed point is probably preferable in the long run.

The only thing that I'd say is missing is a more complete UI for normal use. Everything works balance-wise, but for functions involving walking or jumping it's a bit of a mess and there's no way to directly specify a weight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.