Commit Graph

5714 Commits

Author SHA1 Message Date
Ray
7ac798cef9 REVIEWED: Shader attribute/uniform default names can not be overriden #5925 2026-07-01 10:04:24 +02:00
greymoth
67359073ca
[rcore] Add gamepad >= 0 lower-bound guard to six sibling functions (#5938)
Commit 3edfe194 added a `gamepad >= 0` lower-bound check to
GetGamepadAxisCount() and GetGamepadName(), but six sibling functions
were left with only the upper-bound check (`gamepad < MAX_GAMEPADS`).
A negative signed int passes that check and triggers out-of-bounds
access on CORE.Input.Gamepad.ready[gamepad] and related arrays (UB in C).

Apply the same `(gamepad >= 0) &&` guard added in 3edfe194 to:
- IsGamepadAvailable
- IsGamepadButtonPressed
- IsGamepadButtonDown
- IsGamepadButtonReleased
- IsGamepadButtonUp
- GetGamepadAxisMovement
2026-06-27 21:06:49 +02:00
Brandon Arrendondo
3edfe19438
[rcore] Bounds-check gamepad index in GetGamepadAxisCount() and GetGamepadName() (#5937)
* [rcore] Bounds-check gamepad index in GetGamepadAxisCount() and GetGamepadName()

Both public getters indexed CORE.Input.Gamepad.axisCount[gamepad] / .name[gamepad]
with an unvalidated gamepad argument -- an out-of-bounds read for gamepad < 0 or
gamepad >= MAX_GAMEPADS. Every sibling gamepad accessor (IsGamepadAvailable,
IsGamepadButton*, GetGamepadAxisMovement) already guards the index; add the same
check, returning a safe default (0 / NULL).

* Refactor GetGamepadName/GetGamepadAxisCount to single-return pattern

---------

Co-authored-by: Brandon Arrendondo <brandon.arrendondo@bissell.com>
2026-06-24 17:40:28 +02:00
Brandon Arrendondo
9215540015
[rtext] Fix buffer overflow in TextReplaceBetween() (#5936)
The MAX_TEXT_BUFFER_LENGTH guard present in TextReplace()/TextInsert() was
missing here, so the three strncpy() calls could write past the 1024-byte
static buffer for long inputs. Add the same length check before copying.

Co-authored-by: Brandon Arrendondo <brandon.arrendondo@bissell.com>
2026-06-24 16:41:19 +02:00
Brandon Arrendondo
83cb4cc210
[rlgl] Fix matrix stack overflow in rlPushMatrix() (#5935)
The RL_MAX_MATRIX_STACK_SIZE check logged an error but did not return, so
RLGL.State.stack[stackCounter] = *currentMatrix still executed when the stack
was full -- writing one element past stack[RL_MAX_MATRIX_STACK_SIZE] and
corrupting the adjacent RLGL.State members (stackCounter, etc.). rlPopMatrix()
already guards the symmetric underflow case; add the missing early return.

Co-authored-by: Brandon Arrendondo <brandon.arrendondo@bissell.com>
2026-06-24 16:38:08 +02:00
Ray
d1a14bee5d Update rmodels.c 2026-06-24 10:38:20 +02:00
eu
ba3b8f8370
Add comments for GenMeshTorus (#5934) 2026-06-24 10:36:30 +02:00
Ray
87a6e9693c Format tweaks 2026-06-19 12:27:02 +02:00
Ray
f9c41a0866 Reemove trailing spaces 2026-06-16 21:12:12 +02:00
Ray
fa8aca8789 Update rlgl.h 2026-06-16 13:06:16 +02:00
Ray
efef4e31dd REVIEWED: LoadImageFromTexture() for Wasm https://github.com/raysan5/rguistyler/issues/10
Let's see if it breaks on some other platform...
2026-06-16 13:01:50 +02:00
Ray
4d2b1d51e4 Update rcore_desktop_glfw.c 2026-06-15 23:19:27 +02:00
Ray
8713741782 Update rcore.c 2026-06-13 09:21:39 +02:00
InviseDivine
ac6526b731
[rcore] Fix `FileCopy` doesn't copy file when directory exists (#5920)
* Fix FileCopy result

* fix code style
2026-06-13 09:18:41 +02:00
Thomas Anderson
94897c4eca
[platform/RGFW] update rgfw (#5919)
* update rgfw + platform v1

* added drop events

* updates
2026-06-10 08:56:07 +02:00
Ray
aeea213873 Update raudio.c 2026-06-09 13:19:19 +02:00
Thomas Anderson
8d31d0c3cc
remove extra drflac_free (#5916) 2026-06-09 13:16:41 +02:00
Ray
aebfd788c7 WARNING: BREAKING: REDESIGNED: ImageDraw() API, align with DrawTexture() 2026-06-07 21:53:07 +02:00
Ray
d9335f6a95 ADDED: TODO: ImageDrawCircleGradient() 2026-06-07 21:51:02 +02:00
Ray
e57663c937 Update raylib.h 2026-06-07 21:29:26 +02:00
Ray
68c4b8a60f Removed old compatibility hack 2026-06-07 21:26:59 +02:00
Ray
ca0ba55050 Reviewed parameter names, added comment about order 2026-06-07 21:26:32 +02:00
Ray
236618f87b Reorder functions by drawing vertex/sides 2026-06-07 21:06:53 +02:00
Ray
4724e5fec3 ADDED: ImageDrawLineStrip() 2026-06-07 18:48:41 +02:00
Ray
d3d1b0cbcc ADDED: DrawCircleLinesEx(), simpler naming than DrawRing() 2026-06-07 18:48:16 +02:00
Ray
a41bb7c07a Reorder shapes drawing API functions by number of vertices
NOTE: Consistency between shapes and Image drawing functionality is being aligned (as much as possible)
2026-06-07 18:47:14 +02:00
Ray
869251e590 REVIEWED: Parameter name, shorter 2026-06-07 18:42:50 +02:00
Ray
15d25242be REVIEWED: Comments to be more descriptive 2026-06-07 18:41:44 +02:00
rvnfml
796e1ad22a
Use CORE.Input.Keyboard.exitKey instead of KEY_ESCAPE (#5911)
... in rcore_desktop_win32 when handling window closing
2026-06-06 22:25:48 +02:00
Luis
acfcf2f1d1
[rmodels] Fix minimum rings validation in DrawCapsule and DrawCapsuleWires (#5909)
Ensure rings is at least 1 to prevent rendering issues or crashes when 0 or negative values are passed.
2026-06-06 19:47:57 +02:00
fyl2xp1
ca46387b64
use inverse bind matrices for bind pose in gltf loader (#5832) 2026-06-05 09:27:05 +02:00
Luis
fd79b81918
Fix memory leak in UnloadModel() (#5907) 2026-06-04 23:32:52 +02:00
Ray
a85c9f4898 REVIEWED: File*() functions for consistent return result value
NOTE: `SaveFile*()` still follows original convention, returning true on success...
2026-06-03 21:07:07 +02:00
Ray
1a4445f510 Renamed parameters to align with internal implementations 2026-06-03 21:03:47 +02:00
Ray
2c690425c9 Reviewed comments, remove article usage 2026-06-03 21:02:59 +02:00
Ray
ee71f0f870 REVIEWED: GetPixelColor() const 2026-06-03 21:00:34 +02:00
Ray
cef7718468 RENAMED: Some Rectangle parameters with more descriptive names 2026-06-03 20:16:12 +02:00
Ray
f421b74c0f Revert "Enable GPU skinning for GL 3.3+, (#5902)"
This reverts commit f1d602029c.
2026-06-01 20:42:48 +02:00
Jeffery Myers
f1d602029c
Enable GPU skinning for GL 3.3+, (#5902)
only do GPU skinning if the shader supports bone IDs.
2026-06-01 20:25:09 +02:00
Bigfoot
10a889c482
[rlsw] Replace SW_TEXTURE_REPEAT_POT_FAST with SW_SUPPORT_NPOT_TEXTURE (#5901)
* replace `SW_TEXTURE_REPEAT_POT_FAST` by `SW_SUPPORT_NPOT_TEXTURE`

* tweak `SW_SUPPORT_NPOT_TEXTURE` comment

* remove extra comment
2026-05-30 19:44:45 +02:00
Kaggen67
b7f50b2fb6
[rtextures] ImageDrawLine() rounding and length fix (#5896)
* Fixing ImageDrawLine to be more pixel accurate

Changes to ImageDrawLine() function.
. Added one pixel to the length of a line so it wont draw lines one pixel short.
. Changed rounding by adding 0.5 in 16 bit fixed point to 'j' in for-loop.

* Changed ImagDrawLine to be more acurate
2026-05-30 19:39:16 +02:00
Ray
2ee6a76464 REVIEWED: GetWindowHandle(), to be consistent between backends, fix #5885
Returns the underlying window handle for platforms with some windowing system.
2026-05-30 12:20:58 +02:00
Alexandre Almeida
f0d3e9a5c8
Security fixes (rcore_desktop_win32.c) (#5899)
* Security fixes in rcore_desktop_win32.c

* Avoid calling strlen() twice
2026-05-30 08:49:34 +02:00
Alexandre Almeida
7c284cc5bc
Fix warning about unused variables (#5898) 2026-05-30 08:47:35 +02:00
Vasilis Narain
7b96144716
[rcore] GetCurrentMonitor(), fix for integer overflow in distance calculation (#5842)
* Fix signed integer overflow in GetCurrentMonitor distance calc

* Revert "Fix signed integer overflow in GetCurrentMonitor distance calc"

This reverts commit e0083bc7fe.

* fix GetCurrentMonitor() distance calc overflow

* fix GetCurrentMonitor() distance calc
2026-05-29 18:18:18 +02:00
Caleb Seelhoff
81c7cb6527
[rmodels] Fix glTF skinning when joints have non-joint parent nodes (#5876)
* [rmodels] Fix glTF skinning when joints have non-joint parent nodes

Some glTF exporters (notably wow.export, but also various other DCC pipelines) place skin joints under intermediate non-joint transform nodes that carry part of the bind-pose offset. raylib's existing LoadBoneInfoGLTF and LoadModelAnimationsGLTF only inspected a joint's immediate parent and only sampled joint-local TRS, so any transform stored on an intermediate non-joint ancestor was silently dropped, producing exploded or stretched meshes at runtime.

Two surgical changes:

LoadBoneInfoGLTF: walk the parent chain past any non-joint ancestors when looking up parentIndex, instead of comparing only against node.parent. Joints whose direct parent is a non-joint were previously treated as skeleton roots.

LoadModelAnimationsGLTF: precompute a per-joint extOffset matrix that bakes in the static TRS contribution of any intermediate non-joint nodes between the joint and its nearest joint ancestor. Apply it to each frame's joint TRS before BuildPoseFromParentJoints so the per-frame world transforms match the bind-pose world transforms (LoadGLTF already used cgltf_node_transform_world for bindPose, so this aligns the two code paths).

The replaced root-only worldTransform adjustment is a strict subset of the new per-joint extOffset machinery, so it has been removed.

Spec-compliant files (the six skeletal-skinning .glb examples shipped with raylib) render bit-identically before and after; previously broken files (e.g. wow.export's babyoctopus.gltf) now match the reference rendering from f3d, the Khronos sample viewer, and three.js.

* Resolve review: NULL-check joint offset allocation, fail fast

[rmodels] Address review feedback on glTF joint offset handling

Resolve the open review points raised on PR #5876 for the per-joint
extOffset precompute in LoadModelAnimationsGLTF.

* NULL check: validate the extOffset RL_MALLOC result before use, which
  was previously missing.

* Fail-fast handling: detect the allocation failure at its source and
  abort animation loading (log a warning, free resources, return NULL)
  instead of propagating a NULL pointer into the per-frame loop.

* Brace formatting: expand the collapsed one-line joint-match check
  (if (...) { isJoint = true; break; }) into raylib's standard Allman
  brace style.

* Readability: break the deeply nested MatrixMultiply(MatrixMultiply(...))
  into named nodeScale/nodeRotation/nodeTranslation/nodeTransform locals,
  mirroring the existing S/R/T composition later in the function.

* Spacing/line breaks: add blank lines within the precompute block to
  match the surrounding code style.
2026-05-29 18:17:04 +02:00
Colin James Wood
186d3ce9fb
[CMake] Properly remove raudio.c and rmodels.c if they're disabled modules (#5878)
* only build raudio.c in cmake if it's still enabled

* only compile rmodels if it's supported
2026-05-29 18:16:17 +02:00
Ray
ef8b3e6195 Update rlgl.h 2026-05-26 20:46:56 +02:00
Fipaan
7f9ded7642
[makefile] ANDROID_ARCH check (#5888) 2026-05-26 18:13:58 +02:00
Ray
f8270483e1 Merge branch 'master' of https://github.com/raysan5/raylib 2026-05-24 09:24:33 +02:00