Merge branch 'raysan5:master' into master

This commit is contained in:
hkc 2022-10-13 16:23:59 +03:00 committed by GitHub
commit d30bcf6606
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 12 deletions

View File

@ -23,6 +23,7 @@ Some people ported raylib to other languages in form of bindings or wrappers to
| raylib-go | **4.2** | [Go](https://golang.org/) | Zlib | https://github.com/gen2brain/raylib-go | | raylib-go | **4.2** | [Go](https://golang.org/) | Zlib | https://github.com/gen2brain/raylib-go |
| raylib-guile | auto | [Guile](https://www.gnu.org/software/guile/) | Zlib | https://github.com/petelliott/raylib-guile | | raylib-guile | auto | [Guile](https://www.gnu.org/software/guile/) | Zlib | https://github.com/petelliott/raylib-guile |
| gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | MIT | https://github.com/ArnautDaniel/gforth-raylib | | gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | MIT | https://github.com/ArnautDaniel/gforth-raylib |
| h-raylib | 4.5-dev | [Haskell](https://haskell.org/) | Apache-2.0 | https://github.com/Anut-py/h-raylib |
| raylib-hx | 4.0 | [Haxe](https://haxe.org/) | Zlib | https://github.com/foreignsasquatch/raylib-hx | | raylib-hx | 4.0 | [Haxe](https://haxe.org/) | Zlib | https://github.com/foreignsasquatch/raylib-hx |
| hb-raylib | 3.5 | [Harbour](https://harbour.github.io) | MIT | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib | | hb-raylib | 3.5 | [Harbour](https://harbour.github.io) | MIT | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib |
| jaylib | **4.2** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3+CE | https://github.com/electronstudio/jaylib/ | | jaylib | **4.2** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3+CE | https://github.com/electronstudio/jaylib/ |

View File

@ -13,7 +13,7 @@
* Enjoy using raylib. :) * Enjoy using raylib. :)
* *
* Example originally created with raylib 1.0, last time updated with raylib 1.0 * Example originally created with raylib 1.0, last time updated with raylib 1.0
*
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *

View File

@ -67,7 +67,7 @@ revision history:
#define VOX_SUCCESS (0) #define VOX_SUCCESS (0)
#define VOX_ERROR_FILE_NOT_FOUND (-1) #define VOX_ERROR_FILE_NOT_FOUND (-1)
#define VOX_ERROR_INVALID_FORMAT (-2) #define VOX_ERROR_INVALID_FORMAT (-2)
#define VOX_ERROR_FILE_VERSION_TOO_OLD (-3) #define VOX_ERROR_FILE_VERSION_NOT_MATCH (-3)
// VoxColor, 4 components, R8G8B8A8 (32bit) // VoxColor, 4 components, R8G8B8A8 (32bit)
typedef struct { typedef struct {
@ -538,31 +538,26 @@ int Vox_LoadFromMemory(unsigned char* pvoxData, unsigned int voxDataSize, VoxArr
// @raysan5: Reviewed (unsigned long) -> (unsigned int), possible issue with Ubuntu 18.04 64bit // @raysan5: Reviewed (unsigned long) -> (unsigned int), possible issue with Ubuntu 18.04 64bit
// @raysan5: reviewed signature loading // @raysan5: reviewed signature loading
unsigned char signature[4] = { 0 };
unsigned char* fileData = pvoxData; unsigned char* fileData = pvoxData;
unsigned char* fileDataPtr = fileData; unsigned char* fileDataPtr = fileData;
unsigned char* endfileDataPtr = fileData + voxDataSize; unsigned char* endfileDataPtr = fileData + voxDataSize;
signature[0] = fileDataPtr[0]; if (strncmp((char*)fileDataPtr, "VOX ", 4) != 0)
signature[1] = fileDataPtr[1];
signature[2] = fileDataPtr[2];
signature[3] = fileDataPtr[3];
fileDataPtr += 4;
if ((signature[0] != 'V') && (signature[0] != 'O') && (signature[0] != 'X') && (signature[0] != ' '))
{ {
return VOX_ERROR_INVALID_FORMAT; //"Not an MagicaVoxel File format" return VOX_ERROR_INVALID_FORMAT; //"Not an MagicaVoxel File format"
} }
fileDataPtr += 4;
// @raysan5: reviewed version loading // @raysan5: reviewed version loading
unsigned int version = 0; unsigned int version = 0;
version = ((unsigned int*)fileDataPtr)[0]; version = ((unsigned int*)fileDataPtr)[0];
fileDataPtr += 4; fileDataPtr += 4;
if (version < 150) if (version != 150)
{ {
return VOX_ERROR_FILE_VERSION_TOO_OLD; //"MagicaVoxel version too old" return VOX_ERROR_FILE_VERSION_NOT_MATCH; //"MagicaVoxel version doesn't match"
} }