Skip to content

Gamepad shortcut to Surf - #2387

Merged
nesbox merged 3 commits into
nesbox:mainfrom
LettucePie:gamepad-shortcut
Dec 9, 2023
Merged

nesbox merged 3 commits into
nesbox:mainfrom
LettucePie:gamepad-shortcut

Conversation

@LettucePie

Copy link
Copy Markdown
Contributor

Hello, haven't ever made a pull request before. Also exploring around this project is my introduction to C lang... memory management stuff completely soars over my head. I have very little idea of what I'm doing.

I forked the project a while ago in hopes of making a visual update to Surf called Launcher. Going for the tile-based look. I had some fun tinkering with it, and made a bit of progress, however I keep running into Segmentation Faults and other such errors. Whole original reason is that I'm planning on picking up the Retroid Pocket 2S this holiday. I read around the discord to see if others ever tried using it for tic80 and from what I saw; it's rough at first, mainly because of tic80 being oriented to a keyboard-console. Makes sense. Once people manage to get into the Surf menu though, the experience increases dramatically.

I'm putting a stop on my launcher project though, at least until I properly learn C lol. I figure in the meantime, this one if statement I added in seems pretty effective at getting to the Surf menu with just a controller/gamepad... so here it is.

I haven't actually tested it on the Retroid Pocket 2S or any other Retroid device, rather I tested it on Linux and my own phone using a 8BitDo SN30 Pro... So I'm just assuming at the moment. Probably ill-advised.

On linux, using bluetooth and wired in the x-input mode (the gamepad supports 4 input types) the button shortcut works. On my android phone (Pixel 6a) using wired it works with x-input mode, but not bluetooth. If I want to use bluetooth I have to switch the gamepad to d-input mode.

@Skeptim

Skeptim commented Dec 5, 2023

Copy link
Copy Markdown
Contributor

Which buttons are used for the shortcuts?

@LettucePie

Copy link
Copy Markdown
Contributor Author

The shortcut uses the X button (Xbox layout).

When I first made this I noticed that typing A on the keyboard would also launch Surf, so I added a check to distinguish.

Oh wait... Does this mess up rebinding/accessibility?

@LettucePie

Copy link
Copy Markdown
Contributor Author

I have further tested, and yes this does mess up rebinding/accessibility. If I rebind GamePad 1 X-button to any other key on the keyboard, it then opens the launcher using that Key input.

I looked further and noticed that in /src/core/core.c line(478) it filters the inputs, and just below my line on console.c it refers to a 'input.keyboard' property. I think if I rearrange my if statement to explicitly look for input.gamepad data, then check if it matches the x button (aka api_btn 6) this should work better.

I'll try it and come back. Hopefully pull requests can be updated?

changed it to check ram->input for keyboard actions.
@LettucePie

LettucePie commented Dec 5, 2023 •

Copy link
Copy Markdown
Contributor Author

Tested my changes on linux and android again, same setup as before; everything worked!

I even changed the gamepad bindings on my phone using a bluetooth keyboard to make sure none of their inputs would launch the Surf menu, and they didn't.

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

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants