TASEmulators / BizHawk

BizHawk is a multi-system emulator written in C#. BizHawk provides nice features for casual gamers such as full screen, and joypad support in addition to full rerecording and debugging tools for all system cores.
http://tasvideos.org/BizHawk.html
Other
2.15k stars 380 forks source link

[Feature request] Relative-absolute toggle for DS touchscreen in Virtual Pad #1925

Open InfamousKnight opened 4 years ago

InfamousKnight commented 4 years ago

So to be more specific, in the DS virtualpad, you have the X and Y coordinates for the touch screen, and buttons to add and substract them manually, but it would be nice to have another box below it to automatically add and substract on frame advance. So then we don't have to painstakingly add/substract every time we advance a frame.

Sound like a good idea?

InfamousKnight commented 4 years ago

Is the title change equivalent to what it was originally?

adelikat commented 4 years ago

I like this idea, also it will affect other peripherals too such as zappers for various platforms, and I think it might be a good idea there too.

InfamousKnight commented 4 years ago

Yeah, and this should also increase motivation to make ds tases. Which was the whole point of using bizhawk instead of desmume.

InfamousKnight commented 4 years ago

Thats off topic. Really has nothing to do with what we are discussing here.

InfamousKnight commented 4 years ago

I have looked into implementing this myself, but was a little lost on the code. I haven't done any programming since 2014.

Wouldn't this be a good start if I were to help you guys?

YoshiRulz commented 4 years ago

It's not the worst idea. The relevant code is the WinForms Control VirtualPadTargetScreen.

InfamousKnight commented 4 years ago

I thought it was here: https://github.com/TASEmulators/BizHawk/blob/master/src/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/NdsSchema.cs

I'm more lost with the code you sent than the one I looked at in the first place.

YoshiRulz commented 4 years ago

The schemata specify the layouts for each type of controller. This switch in a loop creates the actual UI elements from those layouts: https://github.com/TASEmulators/BizHawk/blob/41109d6fc26f89ab82e456863eb01e6adf7f7e20/src/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPad.cs#L81-L132

One way to add this toggle would be putting a checkbox in VirtualPadTargetScreen beside or underneath the control(s) for the screen. You'd need to use the WinForms Designer to do that, which is a pain. Maybe you should start with something simpler?

InfamousKnight commented 4 years ago

Yeah, I looked through there, I'm still really lost..

I just don't know where I would add the add and subtract x and y coordinates. And wouldn't we have to tell another schema about that? How does it know that its for ds virtual pad?

On Thu, Aug 27, 2020, 8:51 AM James Groom notifications@github.com wrote:

The schemata specify the layouts for each type of controller. This switch in a loop creates the actual UI elements from those layouts:

https://github.com/TASVideos/BizHawk/blob/41109d6fc26f89ab82e456863eb01e6adf7f7e20/src/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPad.cs#L81-L132

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TASVideos/BizHawk/issues/1925#issuecomment-681928683, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAT4W4N2ZUKQAF7IOVSVI7LSCZJGDANCNFSM4MGUN5JA .

zeromus commented 4 years ago

isn't this something you can do with lua?

InfamousKnight commented 4 years ago

I'm not sure given how adilikats cross hair lua script doesn't run. Lua doesn't work on Linux either, so having it on virtual pad would make this more cross platform. I understand melonds still hasn't been compiled for Linux, but from the looks of lua support for Linux, they say it may never happen. Melonds looks like there's some hope left for it.

On Fri, Aug 28, 2020, 11:25 PM zeromus notifications@github.com wrote:

isn't this something you can do with lua?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TASVideos/BizHawk/issues/1925#issuecomment-683229195, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAT4W4NZELOPOJC4JSXK4CDSDBYLPANCNFSM4MGUN5JA .

zeromus commented 4 years ago

There's no reason lua can't work on linux. Don't we already support a fully managed lua in nlua+kopilua?

RetroEdit commented 4 years ago

@zeromus: YoshiRulz has documented some stuff about Linux compatibility in #1430 and I get the general impression #2260 is thought to be the way forward. But this seems like we're getting off-topic a bit because Lua not being supported in Linux is a more general problem we're already aware of that we need to solve for Linux compatibility progress.

zeromus commented 4 years ago

If lua can solve the problem then it's not off topic. We should not add junked up code for something lua should do, just because we can't right now get lua working on linux.

RetroEdit commented 4 years ago

I agree we shouldn't add junked up code. That doesn't necessarily mean some amount of feature redundancy is bad. Technically, everything you do in the Virtual Pad could be recoded from scratch in a Lua script, but that doesn't mean we should scrap the Virtual Pad completely and make the user code these interactions from scratch in Lua.

This feature request seems to be specifically about the Virtual Pad, so suggesting Lua doesn't actually address the issue, it only suggests closing the issue and instead using Lua. Which is fine if that's what we want to do, but that's not what I'm hearing from adelikat's comment.

adelikat commented 4 years ago

Lua can do things. But it doesn't man that are TargetPair control couldn't be better, it doesn't do anything particularly useful currently, and could be improved.

YoshiRulz commented 4 years ago

Two possible implementations:

  1. New checkbox in VirtualPadTargetScreen to change its behaviour. The previous frame's output values are cached; in relative mode, they're then added to the current pos before it's written out. It might prove annoying to click near the origin to get, for example, the point (2, 1) for 2 px over and 1 px up per frame. Another problem I haven't thought much about: I think the origin is in the top-left for the DS screen and other zapper-like axis pairs.
  2. New checkbox which replaces VirtualPadTargetScreen with a wrapper around VirtualPadAnalogStick, this wrapper doing the diff of values. (The two controls and the checkbox will also need to be in a parent control.) VirtualPadAnalogStick technically also uses absolute coordinates, but I think users' experience with "push the stick less to go slower" from 3D platformers will carry over to make it intuitive. We can limit the range of the stick to -10..10 or thereabouts (maybe configurable).

I'm not sure which would be better for the user. The first is probably the easier one to implement, I'd say it would be ~100 LOC including Designer changes.

edit 2021-10-03: This affects all light guns and mice as well as the DS touchscreen. I believe it would be possible, if a little janky, to use the host mouse (absolute) to control the SNES mouse (relative), and to use a host analog stick (interpreted as relative) to control the Genesis light gun (absolute). It's probably not useful to extend the latter to virtual analog sticks, but there's no reason to add another flag just to exclude them.