Skip to content

Commit

Permalink
fix(glfw): remove CharSequence overload of glfwUpdateGamepadMappings. C…
Browse files Browse the repository at this point in the history
…lose #462

The gamepad mapping string is usually too large to be encoded on the
stack. Also, it's usually read from a file, so using a ByteBuffer
directly is more efficient.
  • Loading branch information
Spasi committed May 1, 2019
1 parent ea76ceb commit 396c5ea
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 34 deletions.
3 changes: 2 additions & 1 deletion doc/notes/3.2.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ This build includes the following changes:
```

- Core: Function address parameters in `org.lwjgl.system.JNI` & `org.lwjgl.system.jawt.JAWTFunctions` methods are now last, after normal parameters. **(S)**
* Enables tail-calls without argument shuffling, when Critical JNI Natives are used.
* Enables tail-calls without argument shuffling, when Critical JNI Natives are used.
- glfw: removed `CharSequence` overload of `glfwUpdateGamepadMappings`. **(S)** (#462)
32 changes: 0 additions & 32 deletions modules/lwjgl/glfw/src/generated/java/org/lwjgl/glfw/GLFW.java
Original file line number Diff line number Diff line change
Expand Up @@ -4267,38 +4267,6 @@ public static boolean glfwUpdateGamepadMappings(@NativeType("char const *") Byte
return nglfwUpdateGamepadMappings(memAddress(string)) != 0;
}

/**
* Adds the specified SDL_GameControllerDB gamepad mappings.
*
* <p>This function parses the specified ASCII encoded string and updates the internal list with any gamepad mappings it finds. This string may contain either
* a single gamepad mapping or many mappings separated by newlines. The parser supports the full format of the {@code gamecontrollerdb.txt} source file
* including empty lines and comments.</p>
*
* <p>See <a target="_blank" href="http://www.glfw.org/docs/latest/input.html#gamepad_mapping">gamepad_mapping</a> for a description of the format.</p>
*
* <p>If there is already a gamepad mapping for a given GUID in the internal list, it will be replaced by the one passed to this function. If the library is
* terminated and re-initialized the internal list will revert to the built-in default.</p>
*
* <p>This function must only be called from the main thread.</p>
*
* @param string the string containing the gamepad mappings
*
* @return {@code true}, or {@code false} if an error occurred
*
* @since version 3.3
*/
@NativeType("int")
public static boolean glfwUpdateGamepadMappings(@NativeType("char const *") CharSequence string) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
stack.nASCII(string, true);
long stringEncoded = stack.getPointerAddress();
return nglfwUpdateGamepadMappings(stringEncoded) != 0;
} finally {
stack.setPointer(stackPointer);
}
}

// --- [ glfwGetGamepadName ] ---

/** Unsafe version of: {@link #glfwGetGamepadName GetGamepadName} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3059,7 +3059,7 @@ if (hats[2] & GLFW_HAT_RIGHT)
This function must only be called from the main thread.
""",

charASCII.const.p("string", "the string containing the gamepad mappings"),
NullTerminated..char.const.p("string", "the string containing the gamepad mappings"),

returnDoc = "{@code true}, or {@code false} if an error occurred",
since = "version 3.3"
Expand Down

0 comments on commit 396c5ea

Please sign in to comment.