mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 03:18:13 +00:00
Fixed return value of SDL_AddGamepadMapping()
Fixes https://github.com/libsdl-org/SDL/issues/11095
This commit is contained in:
@@ -1935,12 +1935,13 @@ static int SDL_PrivateAddGamepadMapping(const char *mappingString, SDL_GamepadMa
|
|||||||
bool is_xinput_mapping = false;
|
bool is_xinput_mapping = false;
|
||||||
bool existing = false;
|
bool existing = false;
|
||||||
GamepadMapping_t *pGamepadMapping;
|
GamepadMapping_t *pGamepadMapping;
|
||||||
int result = false;
|
int result = -1;
|
||||||
|
|
||||||
SDL_AssertJoysticksLocked();
|
SDL_AssertJoysticksLocked();
|
||||||
|
|
||||||
if (!mappingString) {
|
if (!mappingString) {
|
||||||
return SDL_InvalidParamError("mappingString");
|
SDL_InvalidParamError("mappingString");
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // Extract and verify the hint field
|
{ // Extract and verify the hint field
|
||||||
@@ -1992,7 +1993,7 @@ static int SDL_PrivateAddGamepadMapping(const char *mappingString, SDL_GamepadMa
|
|||||||
value = !value;
|
value = !value;
|
||||||
}
|
}
|
||||||
if (!value) {
|
if (!value) {
|
||||||
result = true;
|
result = 0;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2041,7 +2042,7 @@ static int SDL_PrivateAddGamepadMapping(const char *mappingString, SDL_GamepadMa
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (existing) {
|
if (existing) {
|
||||||
result = true;
|
result = 0;
|
||||||
} else {
|
} else {
|
||||||
if (is_default_mapping) {
|
if (is_default_mapping) {
|
||||||
s_pDefaultMapping = pGamepadMapping;
|
s_pDefaultMapping = pGamepadMapping;
|
||||||
|
Reference in New Issue
Block a user