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

New Feature Request - Support SDL Combo Key in pcsx-rearmed and libpicofe for rpi handheld device #155

Open
wwhheerree opened this issue Feb 9, 2020 · 2 comments

Comments

@wwhheerree
Copy link

wwhheerree commented Feb 9, 2020

rpi GPI case does not have extra key to be used as menu hot key.
For example, GPI case only has Select, Start, A, B, X, Y. If we need a menu hot key, a key will be lost in game.
If pcsx-rearmed supports combo key for SDL input, we can use "Select+Start" to pop up menu.
I think this is a problem for all handheld device.

I checked libpicofe input.c, it does support combo key. But it does not support SDL input.
I modified in_sdl.c to use "Select+Start" to pop up menu. It works perfectly on my GPI.

I am willing to help to enhance pcsx-rearmed cfg file and in_sdl of libpicofe.

@notaz
Copy link
Owner

notaz commented Feb 10, 2020

I don't have resources to develop such a feature, but I can take pull requests or patches.

@wwhheerree
Copy link
Author

wwhheerree commented Feb 11, 2020

Here is the simple patch to support "START + SELECT" to pop up menu for GPI case.
I will enhance it to support customize combo key in pcsx-rearmed and in_sdl lib.

static int in_sdl_update(void *drv_data, const int *binds, int *result)
{
struct in_sdl_state *state = drv_data;
keybits_t mask;
int i, sym, bit, b;

collect_events(state, NULL, NULL);

for (i = 0; i < SDLK_LAST / KEYBITS_WORD_BITS + 1; i++) {
	mask = state->keystate[i];
	if (mask == 0)
		continue;

	// For GPI case scan code, Start = 0xA7, Select = 0xA6
	// mask is 4 byte long -> 4 * 8 -> 32 bit
	// scan code 0xA0 - 0xA7 -> 32 * 5 (0xA0)
	// Its mask should be 1100 0000b, and index is 5 
	if (mask == 0xC0 && i == 5)
	{
		// Enter menu 
		result[0] |= 0x2; // 1 << SACTION_ENTER_MENU
		result[1] |= 0x0;
		return 0;
	}

	for (bit = 0; mask != 0; bit++, mask >>= 1) {
		if ((mask & 1) == 0)
			continue;
		sym = i * KEYBITS_WORD_BITS + bit;

		for (b = 0; b < IN_BINDTYPE_COUNT; b++)
			result[b] |= binds[IN_BIND_OFFS(sym, b)];
	}
}

return 0;

}

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

No branches or pull requests

2 participants