fix: el fade en el titol al anar a jugar es podia interrumpir continuament
This commit is contained in:
2231
gamecontrollerdb.txt
Normal file
2231
gamecontrollerdb.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,40 @@
|
|||||||
|
|
||||||
#include <iostream> // for basic_ostream, operator<<, cout, basi...
|
#include <iostream> // for basic_ostream, operator<<, cout, basi...
|
||||||
|
|
||||||
|
// Emscripten-only: SDL 3.4+ ja no casa el GUID dels mandos de Chrome Android
|
||||||
|
// amb gamecontrollerdb (el gamepad.id d'Android no porta Vendor/Product, el
|
||||||
|
// parser extreu valors escombraries, el GUID resultant no està a la db i el
|
||||||
|
// gamepad queda obert amb un mapping incorrecte). Com el W3C Gamepad API
|
||||||
|
// garanteix el layout estàndard quan el navegador reporta mapping=="standard",
|
||||||
|
// injectem un mapping SDL amb eixe layout per al GUID del joystick abans
|
||||||
|
// d'obrir-lo com gamepad. Fora d'Emscripten és un no-op.
|
||||||
|
static void installWebStandardMapping(SDL_JoystickID jid) {
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
SDL_GUID guid = SDL_GetJoystickGUIDForID(jid);
|
||||||
|
char guidStr[33];
|
||||||
|
SDL_GUIDToString(guid, guidStr, sizeof(guidStr));
|
||||||
|
const char *name = SDL_GetJoystickNameForID(jid);
|
||||||
|
if (!name || !*name) name = "Standard Gamepad";
|
||||||
|
|
||||||
|
char mapping[512];
|
||||||
|
SDL_snprintf(mapping, sizeof(mapping),
|
||||||
|
"%s,%s,"
|
||||||
|
"a:b0,b:b1,x:b2,y:b3,"
|
||||||
|
"leftshoulder:b4,rightshoulder:b5,"
|
||||||
|
"lefttrigger:b6,righttrigger:b7,"
|
||||||
|
"back:b8,start:b9,"
|
||||||
|
"leftstick:b10,rightstick:b11,"
|
||||||
|
"dpup:b12,dpdown:b13,dpleft:b14,dpright:b15,"
|
||||||
|
"guide:b16,"
|
||||||
|
"leftx:a0,lefty:a1,rightx:a2,righty:a3,"
|
||||||
|
"platform:Emscripten",
|
||||||
|
guidStr, name);
|
||||||
|
SDL_AddGamepadMapping(mapping);
|
||||||
|
#else
|
||||||
|
(void)jid;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Input::Input(std::string file) {
|
Input::Input(std::string file) {
|
||||||
// Fichero gamecontrollerdb.txt
|
// Fichero gamecontrollerdb.txt
|
||||||
@@ -224,6 +258,7 @@ bool Input::discoverGameController() {
|
|||||||
for (int i = 0; i < nJoysticks; i++) {
|
for (int i = 0; i < nJoysticks; i++) {
|
||||||
if (!SDL_IsGamepad(joysticks[i])) continue;
|
if (!SDL_IsGamepad(joysticks[i])) continue;
|
||||||
|
|
||||||
|
installWebStandardMapping(joysticks[i]);
|
||||||
SDL_Gamepad *pad = SDL_OpenGamepad(joysticks[i]);
|
SDL_Gamepad *pad = SDL_OpenGamepad(joysticks[i]);
|
||||||
if (pad != nullptr) {
|
if (pad != nullptr) {
|
||||||
const std::string name = buildControllerName(pad, padIndex);
|
const std::string name = buildControllerName(pad, padIndex);
|
||||||
@@ -264,6 +299,7 @@ bool Input::handleGamepadAdded(SDL_JoystickID jid, std::string &outName) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
installWebStandardMapping(jid);
|
||||||
SDL_Gamepad *pad = SDL_OpenGamepad(jid);
|
SDL_Gamepad *pad = SDL_OpenGamepad(jid);
|
||||||
if (pad == nullptr) {
|
if (pad == nullptr) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ void Title::update() {
|
|||||||
updateBG();
|
updateBG();
|
||||||
|
|
||||||
// Comprueba las entradas para el menu
|
// Comprueba las entradas para el menu
|
||||||
if (menuVisible == true) {
|
if (menuVisible == true && !fade->isEnabled()) {
|
||||||
menu.active->update();
|
menu.active->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user