skyfloogle / red-viper

A Virtual Boy emulator for the 3DS
764 stars 17 forks source link

Please support more buttons #32

Closed Epic0522 closed 4 months ago

Epic0522 commented 4 months ago

The control in game Red Alarm is quite difficult. please add personalized button palette and allow use ZL ZR buttonšŸ™

skyfloogle commented 4 months ago

In the short term I'm planning on optionally allowing for mapping the A/B buttons to one set of triggers, while the other is still L/R. Does this sound like it matches your use case?

Epic0522 commented 4 months ago

Circle pad for left dpad on the VB controller and 3ds dpad for right dpad is the best solution i thinkļ¼Œapart from the Z buttons on New models

ChrisHighwind commented 4 months ago

Red Alarm actually has 4 button configs in-game, and the configs on the right side of the screen make it so the right d-pad can be used to adjust the speed of the ship and slide left and right. Try setting the in-game controls to one of those configs (the configs on the bottom invert the up/down flight controls) and have the emulator swap the right d-pad and A/B buttons so that the former are on the face buttons, as the speed/slide configs make it so A and B aren't used.

vaguerant commented 4 months ago

I have a very not-OK hacked together version I'm running locally that has configurable shoulder buttons. I won't bother PRing it because my code is pure spaghetti, but it basically adds a toggle to the controls screen that lets you swap the shoulder buttons like so:

![2024-03-04_21-02-43 693_bot](https://github.com/skyfloogle/red-viper/assets/5259025/ed42b8bc-d19e-44ee-96e8-2ac7634def1c) | x | L | ZL | ZR | R | | :-: |:-:|:-: |:-: |:-:| |**0**| L | B | A | R | |**1**| L | A | B | R | |**2**| B | L | R | A | |**3**| A | L | R | B |

I think this covers every possible layout somebody could realistically want for the L/R/ZL/ZR buttons. The inverted A/B layouts (numbering from 0-3, that's 1 and 3) could probably be dropped but something roughly like this should do the job.

Obviously, I'll post my diff if it's wanted, but it would be better if implemented from scratch by somebody competent.

Test build: red-viper_v0.9.1_sliders-and-shoulders.zip Note, this build also contains a different slider configuration I was experimenting with during that discussion, don't mind that.

This also just assumes you're running a New 3DS, I don't advise running this build on models without a second set of shoulder buttons.

Epic0522 commented 4 months ago

Thank for your workļ¼ I think the second dpadā€™s left and right buttons should be mapped on the shouldersšŸ¤”

skyfloogle commented 4 months ago

@vaguerant's proposal is basically what I had in mind, except I was thinking of also mapping L and R to both pairs, but maybe that's not necessary.

vaguerant commented 4 months ago

Thank for your workļ¼ I think the second dpadā€™s left and right buttons should be mapped on the shouldersšŸ¤”

I guess this could be automated based on whether you have the buttons or D-pad on the touch screen. If you already have A/B on the face buttons, you don't really need A/B on the Z buttons as well. In theory it could be set up so that D-pad left/right are on whichever shoulder buttons are currently "spare" when you don't need them to be A/B. That way, there's no need for additional config options.

pmsobrado commented 4 months ago

@skyfloogle will you support using the right C-Stick of New 3DS?

Epic0522 commented 4 months ago

@skyfloogle will you support using the right C-Stick of New 3DS?

It already supported for the right dpad on the original VB controller

Epic0522 commented 4 months ago

Thank for your workļ¼ I think the second dpadā€™s left and right buttons should be mapped on the shouldersšŸ¤”

I guess this could be automated based on whether you have the buttons or D-pad on the touch screen. If you already have A/B on the face buttons, you don't really need A/B on the Z buttons as well. In theory it could be set up so that D-pad left/right are on whichever shoulder buttons are currently "spare" when you don't need them to be A/B. That way, there's no need for additional config options.

Or just map the left dpad on main stick and the right dpad on the 3dsā€™ dpad I think it is the best solution because the cstick is too hard to use

pmsobrado commented 4 months ago

@skyfloogle will you support using the right C-Stick of New 3DS?

It already supported for the right dpad on the original VB controller

Damn, didn't noticed it haha thanks!

vaguerant commented 4 months ago

Or just map the left dpad on main stick and the right dpad on the 3dsā€™ dpad I think it is the best solution because the cstick is too hard to use

How many games would that really be useful in? For Jack Bros. and Red Alarm, you really need access to both D-pads at the same time (under different thumbs) to play properly. Having the Circle Pad and D-pad be the Virtual Boy D-pads would be extremely limiting because you only have one left thumb.

I was talking about my awful spaghetti code earlier and this is the kind of stuff I mean. Absolutely untenable.

        C2D_DrawText(
            tVBOpt.ABLR_MODE <= 1 ? &text_L :
            !buttons_on_screen ? &text_RPAD_L : tVBOpt.ABLR_MODE == 2 ? &text_B : &text_A,
            C2D_AlignCenter | C2D_WithColor, SHOULDX - SHOULDW/2 + SHOULDH*0.75f, SHOULDY + SHOULDH/2 - 8, 0, 0.5, 0.5, C2D_Color32(255, 255, 255, 255));
        C2D_DrawText(
            tVBOpt.ABLR_MODE == 0 ? !buttons_on_screen ? &text_RPAD_L : &text_B :
            tVBOpt.ABLR_MODE == 1 ? !buttons_on_screen ? &text_RPAD_L : &text_A : &text_L,
            C2D_AlignCenter | C2D_WithColor, SHOULDX - SHOULDW/2 + SHOULDH*1.67f, SHOULDY + SHOULDH/2 - 8, 0, 0.5, 0.5, C2D_Color32(255, 255, 255, 255));
        C2D_DrawText(
            tVBOpt.ABLR_MODE == 0 ? !buttons_on_screen ? &text_RPAD_R : &text_A :
            tVBOpt.ABLR_MODE == 1 ? !buttons_on_screen ? &text_RPAD_R : &text_B : &text_R,
            C2D_AlignCenter | C2D_WithColor, SHOULDX - SHOULDW/2 + SHOULDW - SHOULDH*1.67f, SHOULDY + SHOULDH/2 - 8, 0, 0.5, 0.5, C2D_Color32(255, 255, 255, 255));
        C2D_DrawText(
            tVBOpt.ABLR_MODE <= 1 ? &text_R :
            !buttons_on_screen ? &text_RPAD_R : tVBOpt.ABLR_MODE == 2 ? &text_A : &text_B,
            C2D_AlignCenter | C2D_WithColor, SHOULDX - SHOULDW/2 + SHOULDW - SHOULDH*0.75f, SHOULDY + SHOULDH/2 - 8, 0, 0.5, 0.5, C2D_Color32(255, 255, 255, 255));

@skyfloogle If you do end up (optionally) putting the D-pad on ZL/ZR which is what that hideous mess above is doing, you might find the Unicode codepoints for various Nintendo buttons useful:

![image](https://github.com/skyfloogle/red-viper/assets/5259025/13792781-46be-49af-922c-28bf7aef1070)

e.g. I was able to use \uE07B and \uE07C to put D-pad directions in the toggle:

![2024-03-05_20-58-52 141_bot](https://github.com/skyfloogle/red-viper/assets/5259025/9ec96b3a-300e-45a8-8d0e-39739f8eee3c)
    C2D_TextParse(&text_RPAD_L, static_textbuf, "\uE07B");
    C2D_TextOptimize(&text_RPAD_L);
    C2D_TextParse(&text_RPAD_R, static_textbuf, "\uE07C");
    C2D_TextOptimize(&text_RPAD_R);

Test build: red-viper_v0.9.1_this-monstrosity_hotfix.zip This is absolutely disgusting.

vaguerant commented 4 months ago

Re: The button glyphs, going all in actually looks kind of nice, I think. I don't know that I'd say better, but looks a bit more Nintendo-esque certainly.

![2024-03-05_23-00-14 865_bot](https://github.com/skyfloogle/red-viper/assets/5259025/f696ceb0-1707-489c-8554-5b228882825b)
Epic0522 commented 4 months ago

Woo thatā€™s awesome! this emulator made 3ds great again

Epic0522 commented 4 months ago

Or just map the left dpad on main stick and the right dpad on the 3dsā€™ dpad I think it is the best solution because the cstick is too hard to use

How many games would that really be useful in? For Jack Bros. and Red Alarm, you really need access to both D-pads at the same time (under different thumbs) to play properly. Having the Circle Pad and D-pad be the Virtual Boy D-pads would be extremely limiting because you only have one left thumb.

I was talking about my awful spaghetti code earlier and this is the kind of stuff I mean. Absolutely untenable.

        C2D_DrawText(
            tVBOpt.ABLR_MODE <= 1 ? &text_L :
            !buttons_on_screen ? &text_RPAD_L : tVBOpt.ABLR_MODE == 2 ? &text_B : &text_A,
            C2D_AlignCenter | C2D_WithColor, SHOULDX - SHOULDW/2 + SHOULDH*0.75f, SHOULDY + SHOULDH/2 - 8, 0, 0.5, 0.5, C2D_Color32(255, 255, 255, 255));
        C2D_DrawText(
            tVBOpt.ABLR_MODE == 0 ? !buttons_on_screen ? &text_RPAD_L : &text_B :
            tVBOpt.ABLR_MODE == 1 ? !buttons_on_screen ? &text_RPAD_L : &text_A : &text_L,
            C2D_AlignCenter | C2D_WithColor, SHOULDX - SHOULDW/2 + SHOULDH*1.67f, SHOULDY + SHOULDH/2 - 8, 0, 0.5, 0.5, C2D_Color32(255, 255, 255, 255));
        C2D_DrawText(
            tVBOpt.ABLR_MODE == 0 ? !buttons_on_screen ? &text_RPAD_R : &text_A :
            tVBOpt.ABLR_MODE == 1 ? !buttons_on_screen ? &text_RPAD_R : &text_B : &text_R,
            C2D_AlignCenter | C2D_WithColor, SHOULDX - SHOULDW/2 + SHOULDW - SHOULDH*1.67f, SHOULDY + SHOULDH/2 - 8, 0, 0.5, 0.5, C2D_Color32(255, 255, 255, 255));
        C2D_DrawText(
            tVBOpt.ABLR_MODE <= 1 ? &text_R :
            !buttons_on_screen ? &text_RPAD_R : tVBOpt.ABLR_MODE == 2 ? &text_A : &text_B,
            C2D_AlignCenter | C2D_WithColor, SHOULDX - SHOULDW/2 + SHOULDW - SHOULDH*0.75f, SHOULDY + SHOULDH/2 - 8, 0, 0.5, 0.5, C2D_Color32(255, 255, 255, 255));

@skyfloogle If you do end up (optionally) putting the D-pad on ZL/ZR which is what that hideous mess above is doing, you might find the Unicode codepoints for various Nintendo buttons useful:

image

e.g. I was able to use \uE07B and \uE07C to put D-pad directions in the toggle:

2024-03-05_20-58-52 141_bot

    C2D_TextParse(&text_RPAD_L, static_textbuf, "\uE07B");
    C2D_TextOptimize(&text_RPAD_L);
    C2D_TextParse(&text_RPAD_R, static_textbuf, "\uE07C");
    C2D_TextOptimize(&text_RPAD_R);

Test build: red-viper_v0.9.1_this-monstrosity_hotfix.zip This is absolutely disgusting.

itā€™s true that controlling two dpad is hectic ļ¼Œbut using that stupid cstick is more unbearable

skyfloogle commented 4 months ago

I'm pretty sure this use case is covered by putting the D-Pad on the face buttons using the "switch" button in the top right.

vaguerant commented 4 months ago

I'm working on cleaning up my shoulder button stuff, so if you haven't already got it going on your end I will throw a PR your way once that's done. I still have no idea what I'm doing, so no hard feelings if you're already working on it or just prefer to reject and do it properly.