Skip to content

Commit 4cef79c

Browse files
author
geralis.a
committed
update upstream
1 parent b0e722b commit 4cef79c

15 files changed

Lines changed: 2897 additions & 1223 deletions

File tree

src/raylib/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@
189189
//------------------------------------------------------------------------------------
190190
// Module: rtextures - Configuration Flags
191191
//------------------------------------------------------------------------------------
192-
// Selecte desired fileformats to be supported for image data loading
192+
// Selected desired fileformats to be supported for image data loading
193193
#define SUPPORT_FILEFORMAT_PNG 1
194194
//#define SUPPORT_FILEFORMAT_BMP 1
195195
//#define SUPPORT_FILEFORMAT_TGA 1

src/raylib/external/dr_flac.h

Lines changed: 241 additions & 221 deletions
Large diffs are not rendered by default.

src/raylib/external/dr_mp3.h

Lines changed: 701 additions & 198 deletions
Large diffs are not rendered by default.

src/raylib/external/dr_wav.h

Lines changed: 339 additions & 151 deletions
Large diffs are not rendered by default.

src/raylib/external/glfw/src/mappings.h

Lines changed: 1503 additions & 604 deletions
Large diffs are not rendered by default.

src/raylib/platforms/rcore_desktop_sdl.c

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,8 @@ void ClosePlatform(void); // Close platform
424424

425425
static KeyboardKey ConvertScancodeToKey(SDL_Scancode sdlScancode); // Help convert SDL scancodes to raylib key
426426

427+
static int GetCodepointNextSDL(const char *text, int *codepointSize); // Get next codepoint in a byte sequence and bytes processed
428+
427429
//----------------------------------------------------------------------------------
428430
// Module Functions Declaration
429431
//----------------------------------------------------------------------------------
@@ -1601,13 +1603,18 @@ void PollInputEvents(void)
16011603
{
16021604
// NOTE: event.text.text data comes an UTF-8 text sequence but we register codepoints (int)
16031605

1604-
int codepointSize = 0;
1605-
16061606
// Check if there is space available in the queue
16071607
if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
16081608
{
16091609
// Add character (codepoint) to the queue
1610-
CORE.Input.Keyboard.charPressedQueue[CORE.Input.Keyboard.charPressedQueueCount] = GetCodepointNext(event.text.text, &codepointSize);
1610+
#if defined(PLATFORM_DESKTOP_SDL3)
1611+
unsigned int textLen = strlen(event.text.text);
1612+
unsigned int codepoint = (unsigned int)SDL_StepUTF8(&event.text.text, textLen);
1613+
#else
1614+
int codepointSize = 0;
1615+
int codepoint = GetCodepointNextSDL(event.text.text, &codepointSize);
1616+
#endif
1617+
CORE.Input.Keyboard.charPressedQueue[CORE.Input.Keyboard.charPressedQueueCount] = codepoint;
16111618
CORE.Input.Keyboard.charPressedQueueCount++;
16121619
}
16131620
} break;
@@ -2093,4 +2100,42 @@ static KeyboardKey ConvertScancodeToKey(SDL_Scancode sdlScancode)
20932100

20942101
return KEY_NULL; // No equivalent key in Raylib
20952102
}
2096-
// EOF
2103+
2104+
// Get next codepoint in a byte sequence and bytes processed
2105+
static int GetCodepointNextSDL(const char *text, int *codepointSize)
2106+
{
2107+
const char *ptr = text;
2108+
int codepoint = 0x3f; // Codepoint (defaults to '?')
2109+
*codepointSize = 1;
2110+
2111+
// Get current codepoint and bytes processed
2112+
if (0xf0 == (0xf8 & ptr[0]))
2113+
{
2114+
// 4 byte UTF-8 codepoint
2115+
if (((ptr[1] & 0xC0) ^ 0x80) || ((ptr[2] & 0xC0) ^ 0x80) || ((ptr[3] & 0xC0) ^ 0x80)) { return codepoint; } // 10xxxxxx checks
2116+
codepoint = ((0x07 & ptr[0]) << 18) | ((0x3f & ptr[1]) << 12) | ((0x3f & ptr[2]) << 6) | (0x3f & ptr[3]);
2117+
*codepointSize = 4;
2118+
}
2119+
else if (0xe0 == (0xf0 & ptr[0]))
2120+
{
2121+
// 3 byte UTF-8 codepoint */
2122+
if (((ptr[1] & 0xC0) ^ 0x80) || ((ptr[2] & 0xC0) ^ 0x80)) { return codepoint; } // 10xxxxxx checks
2123+
codepoint = ((0x0f & ptr[0]) << 12) | ((0x3f & ptr[1]) << 6) | (0x3f & ptr[2]);
2124+
*codepointSize = 3;
2125+
}
2126+
else if (0xc0 == (0xe0 & ptr[0]))
2127+
{
2128+
// 2 byte UTF-8 codepoint
2129+
if ((ptr[1] & 0xC0) ^ 0x80) { return codepoint; } // 10xxxxxx checks
2130+
codepoint = ((0x1f & ptr[0]) << 6) | (0x3f & ptr[1]);
2131+
*codepointSize = 2;
2132+
}
2133+
else if (0x00 == (0x80 & ptr[0]))
2134+
{
2135+
// 1 byte UTF-8 codepoint
2136+
codepoint = ptr[0];
2137+
*codepointSize = 1;
2138+
}
2139+
2140+
return codepoint;
2141+
}

src/raylib/raudio.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
#include "utils.h" // Required for: fopen() Android mapping
8282
#endif
8383

84-
#if defined(SUPPORT_MODULE_RAUDIO)
84+
#if defined(SUPPORT_MODULE_RAUDIO) || defined(RAUDIO_STANDALONE)
8585

8686
#if defined(_WIN32)
8787
// To avoid conflicting windows.h symbols with raylib, some flags are defined
@@ -1037,6 +1037,8 @@ void UnloadSoundAlias(Sound alias)
10371037
}
10381038

10391039
// Update sound buffer with new data
1040+
// NOTE 1: data format must match sound.stream.sampleSize
1041+
// NOTE 2: frameCount must not exceed sound.frameCount
10401042
void UpdateSound(Sound sound, const void *data, int frameCount)
10411043
{
10421044
if (sound.stream.buffer != NULL)
@@ -1869,6 +1871,7 @@ void SeekMusicStream(Music music, float position)
18691871
void UpdateMusicStream(Music music)
18701872
{
18711873
if (music.stream.buffer == NULL) return;
1874+
if (!music.stream.buffer->playing) return;
18721875

18731876
ma_mutex_lock(&AUDIO.System.lock);
18741877

src/raylib/raylib.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,8 +1424,8 @@ RLAPI bool IsTextureValid(Texture2D texture);
14241424
RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
14251425
RLAPI bool IsRenderTextureValid(RenderTexture2D target); // Check if a render texture is valid (loaded in GPU)
14261426
RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
1427-
RLAPI void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data
1428-
RLAPI void UpdateTextureRec(Texture2D texture, rlRectangle rec, const void *pixels); // Update GPU texture rectangle with new data
1427+
RLAPI void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data (pixels should be able to fill texture)
1428+
RLAPI void UpdateTextureRec(Texture2D texture, rlRectangle rec, const void *pixels); // Update GPU texture rectangle with new data (pixels and rec should fit in texture)
14291429

14301430
// Texture configuration functions
14311431
RLAPI void GenTextureMipmaps(Texture2D *texture); // Generate GPU mipmaps for a texture
@@ -1646,7 +1646,7 @@ RLAPI Sound LoadSound(const char *fileName); // Load so
16461646
RLAPI Sound LoadSoundFromWave(Wave wave); // Load sound from wave data
16471647
RLAPI Sound LoadSoundAlias(Sound source); // Create a new sound that shares the same sample data as the source sound, does not own the sound data
16481648
RLAPI bool IsSoundValid(Sound sound); // Checks if a sound is valid (data loaded and buffers initialized)
1649-
RLAPI void UpdateSound(Sound sound, const void *data, int sampleCount); // Update sound buffer with new data
1649+
RLAPI void UpdateSound(Sound sound, const void *data, int sampleCount); // Update sound buffer with new data (data and frame count should fit in sound)
16501650
RLAPI void UnloadWave(Wave wave); // Unload wave data
16511651
RLAPI void UnloadSound(Sound sound); // Unload sound
16521652
RLAPI void UnloadSoundAlias(Sound alias); // Unload a sound alias (does not deallocate sample data)

src/raylib/rcore.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3757,7 +3757,8 @@ static void ScanDirectoryFiles(const char *basePath, FilePathList *files, const
37573757
// Scan all files and directories recursively from a base path
37583758
static void ScanDirectoryFilesRecursively(const char *basePath, FilePathList *files, const char *filter)
37593759
{
3760-
static char path[MAX_FILEPATH_LENGTH] = { 0 };
3760+
// WARNING: Path can not be static or it will be reused between recursive function calls!
3761+
char path[MAX_FILEPATH_LENGTH] = { 0 };
37613762
memset(path, 0, MAX_FILEPATH_LENGTH);
37623763

37633764
struct dirent *dp = NULL;

src/raylib/rlgl.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,7 +1885,7 @@ void rlActiveDrawBuffers(int count)
18851885

18861886
if (count > 0)
18871887
{
1888-
if (count > 8) TRACELOG(LOG_WARNING, "GL: Max color buffers limited to 8");
1888+
if (count > 8) TRACELOG(RL_LOG_WARNING, "GL: Max color buffers limited to 8");
18891889
else
18901890
{
18911891
unsigned int buffers[8] = {
@@ -1902,7 +1902,7 @@ void rlActiveDrawBuffers(int count)
19021902
glDrawBuffers(count, buffers);
19031903
}
19041904
}
1905-
else TRACELOG(LOG_WARNING, "GL: One color buffer active by default");
1905+
else TRACELOG(RL_LOG_WARNING, "GL: One color buffer active by default");
19061906
#endif
19071907
}
19081908

@@ -2219,10 +2219,10 @@ static void GLAPIENTRY rlDebugMessageCallback(GLenum source, GLenum type, GLuint
22192219
default: break;
22202220
}
22212221

2222-
TRACELOG(LOG_WARNING, "GL: OpenGL debug message: %s", message);
2223-
TRACELOG(LOG_WARNING, " > Type: %s", msgType);
2224-
TRACELOG(LOG_WARNING, " > Source = %s", msgSource);
2225-
TRACELOG(LOG_WARNING, " > Severity = %s", msgSeverity);
2222+
TRACELOG(RL_LOG_WARNING, "GL: OpenGL debug message: %s", message);
2223+
TRACELOG(RL_LOG_WARNING, " > Type: %s", msgType);
2224+
TRACELOG(RL_LOG_WARNING, " > Source = %s", msgSource);
2225+
TRACELOG(RL_LOG_WARNING, " > Severity = %s", msgSeverity);
22262226
}
22272227
#endif
22282228

@@ -4178,6 +4178,9 @@ unsigned int rlCompileShader(const char *shaderCode, int type)
41784178
RL_FREE(log);
41794179
}
41804180

4181+
// Unload object allocated by glCreateShader(),
4182+
// despite failing in the compilation process
4183+
glDeleteShader(shader);
41814184
shader = 0;
41824185
}
41834186
else

0 commit comments

Comments
 (0)