Beta 2. No longer using STB_Image.
This commit is contained in:
parent
6d29632daf
commit
c614cb55df
21 changed files with 298 additions and 203 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,3 +5,4 @@
|
|||
cmake-build-debug/
|
||||
*.log
|
||||
*.user
|
||||
temp/
|
||||
|
|
|
@ -388,6 +388,8 @@ set(LIB_LIST
|
|||
${BUILD_DIR}/lib/libarchive.a
|
||||
${BUILD_DIR}/lib/libcrypto.a
|
||||
${BUILD_DIR}/lib/libssl.a
|
||||
${BUILD_DIR}/lib/libjpeg.a
|
||||
${BUILD_DIR}/lib/libpng.a
|
||||
)
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME}
|
||||
-Wl,--start-group
|
||||
|
|
|
@ -31,8 +31,9 @@ For all Singe 2 and later games, it will automatically appear in the menu.
|
|||
|
||||
To upgrade, back up any changes you may have made to files inside the Singe
|
||||
subdirectory that was generated during installation. (You really shouldn't
|
||||
be changing things in there!) Delete the Singe subdirectory and run the new
|
||||
Singe binary with no command line arguments to generate the new files.
|
||||
be changing things in there!) Delete the Singe subdirectory, Menu.bat (or
|
||||
.sh) and run the new Singe binary with no command line arguments to generate
|
||||
the new files.
|
||||
|
||||
|
||||
COMMAND LINE
|
||||
|
|
|
@ -26,7 +26,9 @@
|
|||
|
||||
SINGE_FRAMEWORK_VERSION = 2.10
|
||||
|
||||
DIR = singeGetScriptPath():match("(.*[/\\])") or "./"
|
||||
if singeGetScriptPath ~= nil then
|
||||
DIR = singeGetScriptPath():match("(.*[/\\])") or "./"
|
||||
end
|
||||
|
||||
|
||||
function utilDeepCopy(orig)
|
||||
|
|
129
build-all.sh
129
build-all.sh
|
@ -48,59 +48,7 @@ function buildAll() {
|
|||
|
||||
mkdir -p ${G_GENERATED}
|
||||
|
||||
if [[ 0 == 1 ]]; then
|
||||
pushd thirdparty/SDL2
|
||||
clearAndEnterBuild
|
||||
cmake ${COMMON} \
|
||||
-DSDL_SHARED=off \
|
||||
-DSDL_STATIC=on \
|
||||
..
|
||||
make install
|
||||
popd
|
||||
|
||||
pushd thirdparty/SDL2_image
|
||||
clearAndEnterBuild
|
||||
cmake ${COMMON} \
|
||||
-DBUILD_SHARED_LIBS=off \
|
||||
-DSDL2IMAGE_DEPS_SHARED=off \
|
||||
-DSDL2IMAGE_SAMPLES=off \
|
||||
-DSDL2IMAGE_TESTS=off \
|
||||
-DSDL2IMAGE_VENDORED=on \
|
||||
-DSDL2IMAGE_AVIF=off \
|
||||
-DSDL2IMAGE_JXL=off \
|
||||
-DSDL2IMAGE_TIF=off \
|
||||
-DSDL2IMAGE_WEBP=on \
|
||||
-DSDL2_DIR=${G_TARGET}/lib/cmake/SDL2 \
|
||||
..
|
||||
make install
|
||||
popd
|
||||
|
||||
pushd thirdparty/SDL2_mixer
|
||||
clearAndEnterBuild
|
||||
cmake ${COMMON} \
|
||||
-DBUILD_SHARED_LIBS=off \
|
||||
-DSDL2MIXER_CMD=off \
|
||||
-DSDL2MIXER_DEPS_SHARED=off \
|
||||
-DSDL2MIXER_VENDORED=on \
|
||||
-DSDL2MIXER_SAMPLES=off \
|
||||
-DSDL2_DIR=${G_TARGET}/lib/cmake/SDL2 \
|
||||
-DWAVPACK_ENABLE_ASM=no \
|
||||
..
|
||||
make install
|
||||
popd
|
||||
|
||||
pushd thirdparty/SDL2_ttf
|
||||
clearAndEnterBuild
|
||||
cmake ${COMMON} \
|
||||
-DBUILD_SHARED_LIBS=off \
|
||||
-DSDL2TTF_VENDORED=on \
|
||||
-DSDL2TTF_HARFBUZZ=off \
|
||||
-DSDL2TTF_SAMPLES=off \
|
||||
-DSDL2_DIR=${G_TARGET}/lib/cmake/SDL2 \
|
||||
..
|
||||
make install
|
||||
popd
|
||||
|
||||
if [[ 1 == 1 ]]; then
|
||||
pushd thirdparty/bzip2
|
||||
clearAndEnterBuild
|
||||
cmake ${COMMON} \
|
||||
|
@ -138,6 +86,79 @@ if [[ 0 == 1 ]]; then
|
|||
make install
|
||||
popd
|
||||
|
||||
pushd thirdparty/SDL2
|
||||
clearAndEnterBuild
|
||||
cmake ${COMMON} \
|
||||
-DSDL_SHARED=off \
|
||||
-DSDL_STATIC=on \
|
||||
..
|
||||
make install
|
||||
popd
|
||||
fi
|
||||
|
||||
pushd thirdparty/SDL2_image
|
||||
clearAndEnterBuild
|
||||
CFLAGS="-Iexternal/libpng -I${G_TARGET}/include" \
|
||||
cmake ${COMMON} \
|
||||
-DBUILD_SHARED_LIBS=off \
|
||||
-DSDL2IMAGE_DEPS_SHARED=off \
|
||||
-DSDL2IMAGE_SAMPLES=off \
|
||||
-DSDL2IMAGE_TESTS=off \
|
||||
-DSDL2IMAGE_VENDORED=on \
|
||||
-DSDL2IMAGE_BACKEND_STB=off \
|
||||
-DSDL2IMAGE_AVIF=off \
|
||||
-DSDL2IMAGE_JXL=off \
|
||||
-DSDL2IMAGE_TIF=off \
|
||||
-DSDL2IMAGE_WEBP=on \
|
||||
-DSDL_LIBRARY="${G_TARGET}/lib/libSDL2.a" \
|
||||
-DSDL_INCLUDE_DIR="${G_TARGET}/include" \
|
||||
-DWEBP_BUILD_ANIM_UTILS=off \
|
||||
-DWEBP_BUILD_CWEBP=off \
|
||||
-DWEBP_BUILD_DWEBP=off \
|
||||
-DWEBP_BUILD_GIF2WEBP=off \
|
||||
-DWEBP_BUILD_IMG2WEBP=off \
|
||||
-DWEBP_BUILD_VWEBP=off \
|
||||
-DWEBP_BUILD_WEBPINFO=off \
|
||||
-DWEBP_BUILD_WEBPMUX=off \
|
||||
-DWEBP_BUILD_EXTRAS=off \
|
||||
..
|
||||
# 'make install' failes on zlib, which we don't want anyway.
|
||||
make
|
||||
cp -f ../include/SDL_image.h "${G_TARGET}/include/SDL2/."
|
||||
cp -f libSDL2_image.a "${G_TARGET}/lib/."
|
||||
cp -f external/jpeg/libjpeg.a "${G_TARGET}/lib/."
|
||||
cp -f external/libpng/libpng.a "${G_TARGET}/lib/."
|
||||
cp -f external/libwebp/libwebp.a "${G_TARGET}/lib/."
|
||||
cp -f external/libwebp/libwebpdemux.a "${G_TARGET}/lib/."
|
||||
popd
|
||||
|
||||
if [[ 1 == 1 ]]; then
|
||||
pushd thirdparty/SDL2_mixer
|
||||
clearAndEnterBuild
|
||||
cmake ${COMMON} \
|
||||
-DBUILD_SHARED_LIBS=off \
|
||||
-DSDL2MIXER_CMD=off \
|
||||
-DSDL2MIXER_DEPS_SHARED=off \
|
||||
-DSDL2MIXER_VENDORED=on \
|
||||
-DSDL2MIXER_SAMPLES=off \
|
||||
-DSDL2_DIR=${G_TARGET}/lib/cmake/SDL2 \
|
||||
-DWAVPACK_ENABLE_ASM=no \
|
||||
..
|
||||
make install
|
||||
popd
|
||||
|
||||
pushd thirdparty/SDL2_ttf
|
||||
clearAndEnterBuild
|
||||
cmake ${COMMON} \
|
||||
-DBUILD_SHARED_LIBS=off \
|
||||
-DSDL2TTF_VENDORED=on \
|
||||
-DSDL2TTF_HARFBUZZ=off \
|
||||
-DSDL2TTF_SAMPLES=off \
|
||||
-DSDL2_DIR=${G_TARGET}/lib/cmake/SDL2 \
|
||||
..
|
||||
make install
|
||||
popd
|
||||
|
||||
pushd thirdparty/libarchive
|
||||
clearAndEnterBuild
|
||||
cmake ${COMMON} \
|
||||
|
@ -336,7 +357,7 @@ fi
|
|||
clearAndEnterBuild
|
||||
cmake ${COMMON} ${G_BUILDROOT}
|
||||
make
|
||||
#upx -9 --force singe2${SUFFIX}
|
||||
upx -9 --force singe2${SUFFIX}
|
||||
mv -f singe2${SUFFIX} ${G_BUILDROOT}/${G_BUILDDIR}/Singe-v2.10-${OS^}-${ARCH}${SUFFIX}
|
||||
popd
|
||||
}
|
||||
|
|
229
src/singe.c
229
src/singe.c
|
@ -3841,7 +3841,8 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
|
|||
progTrace("Creating Lua context for Singe setup");
|
||||
_global.luaContext = luaL_newstate();
|
||||
startLuaContext(_global.luaContext);
|
||||
// Load framework
|
||||
// Load framework - NOTE! SINGE API NOT AVAILABLE AT THIS POINT!
|
||||
// Any calls in the framework need to be wrapped with nil checks!
|
||||
progTrace("Loading Singe framework");
|
||||
if (luaL_loadbuffer(_global.luaContext, (char *)Framework_singe, Framework_singe_len, "Input Mappings") || lua_pcall(_global.luaContext, 0, 0, 0)) utilDie("%s", lua_tostring(_global.luaContext, -1));
|
||||
// Load default mappings
|
||||
|
@ -3938,6 +3939,119 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
|
|||
_global.luaContext = luaL_newstate();
|
||||
startLuaContext(_global.luaContext);
|
||||
|
||||
// Lua API for Singe
|
||||
lua_register(_global.luaContext, "colorBackground", apiColorBackground);
|
||||
lua_register(_global.luaContext, "colorForeground", apiColorForeground);
|
||||
|
||||
lua_register(_global.luaContext, "controllerGetAxis", apiControllerGetAxis);
|
||||
|
||||
lua_register(_global.luaContext, "debugPrint", apiDebugPrint);
|
||||
|
||||
lua_register(_global.luaContext, "discAudio", apiDiscAudio);
|
||||
lua_register(_global.luaContext, "discChangeSpeed", apiDiscChangeSpeed);
|
||||
lua_register(_global.luaContext, "discGetFrame", apiDiscGetFrame);
|
||||
lua_register(_global.luaContext, "discGetHeight", apiDiscGetHeight);
|
||||
lua_register(_global.luaContext, "discGetState", apiDiscGetState);
|
||||
lua_register(_global.luaContext, "discGetWidth", apiDiscGetWidth);
|
||||
lua_register(_global.luaContext, "discPause", apiDiscPause);
|
||||
lua_register(_global.luaContext, "discPauseAtFrame", apiDiscPauseAtFrame);
|
||||
lua_register(_global.luaContext, "discPlay", apiDiscPlay);
|
||||
lua_register(_global.luaContext, "discSearch", apiDiscSearch);
|
||||
lua_register(_global.luaContext, "discSearchBlanking", apiDiscSearchBlanking);
|
||||
lua_register(_global.luaContext, "discSetFPS", apiDiscSetFps);
|
||||
lua_register(_global.luaContext, "discSkipBackward", apiDiscSkipBackward);
|
||||
lua_register(_global.luaContext, "discSkipBlanking", apiDiscSkipBlanking);
|
||||
lua_register(_global.luaContext, "discSkipForward", apiDiscSkipForward);
|
||||
lua_register(_global.luaContext, "discSkipToFrame", apiDiscSkipToFrame);
|
||||
lua_register(_global.luaContext, "discStepBackward", apiDiscStepBackward);
|
||||
lua_register(_global.luaContext, "discStepForward", apiDiscStepForward);
|
||||
lua_register(_global.luaContext, "discStop", apiDiscStop);
|
||||
|
||||
lua_register(_global.luaContext, "fontLoad", apiFontLoad);
|
||||
lua_register(_global.luaContext, "fontPrint", apiFontPrint);
|
||||
lua_register(_global.luaContext, "fontQuality", apiFontQuality);
|
||||
lua_register(_global.luaContext, "fontSelect", apiFontSelect);
|
||||
lua_register(_global.luaContext, "fontToSprite", apiFontToSprite);
|
||||
lua_register(_global.luaContext, "fontUnload", apiFontUnload);
|
||||
|
||||
lua_register(_global.luaContext, "keyboardGetMode", apiKeyboardGetMode);
|
||||
lua_register(_global.luaContext, "keyboardSetMode", apiKeyboardSetMode);
|
||||
|
||||
lua_register(_global.luaContext, "mouseEnable", apiMouseEnable);
|
||||
lua_register(_global.luaContext, "mouseDisable", apiMouseDisable);
|
||||
lua_register(_global.luaContext, "mouseGetPosition", apiMouseGetPosition);
|
||||
lua_register(_global.luaContext, "mouseHowMany", apiMouseHowMany);
|
||||
lua_register(_global.luaContext, "mouseSetCaptured", apiMouseSetCaptured);
|
||||
lua_register(_global.luaContext, "mouseSetMode", apiMouseSetMode);
|
||||
|
||||
lua_register(_global.luaContext, "overlayBox", apiOverlayBox);
|
||||
lua_register(_global.luaContext, "overlayCircle", apiOverlayCircle);
|
||||
lua_register(_global.luaContext, "overlayClear", apiOverlayClear);
|
||||
lua_register(_global.luaContext, "overlayEllipse", apiOverlayEllipse);
|
||||
lua_register(_global.luaContext, "overlayGetHeight", apiOverlayGetHeight);
|
||||
lua_register(_global.luaContext, "overlayGetWidth", apiOverlayGetWidth);
|
||||
lua_register(_global.luaContext, "overlayLine", apiOverlayLine);
|
||||
lua_register(_global.luaContext, "overlayPlot", apiOverlayPlot);
|
||||
lua_register(_global.luaContext, "overlayPrint", apiOverlayPrint);
|
||||
lua_register(_global.luaContext, "overlaySetResolution", apiOverlaySetResolution);
|
||||
|
||||
lua_register(_global.luaContext, "scriptExecute", apiScriptExecute);
|
||||
lua_register(_global.luaContext, "scriptPush", apiScriptPush);
|
||||
|
||||
lua_register(_global.luaContext, "singeDisablePauseKey", apiSingeDisablePauseKey);
|
||||
lua_register(_global.luaContext, "singeEnablePauseKey", apiSingeEnablePauseKey);
|
||||
lua_register(_global.luaContext, "singeGetDataPath", apiSingeGetDataPath);
|
||||
lua_register(_global.luaContext, "singeGetHeight", apiSingeGetHeight);
|
||||
lua_register(_global.luaContext, "singeGetPauseFlag", apiSingeGetPauseFlag);
|
||||
lua_register(_global.luaContext, "singeGetScriptPath", apiSingeGetScriptPath);
|
||||
lua_register(_global.luaContext, "singeGetWidth", apiSingeGetWidth);
|
||||
lua_register(_global.luaContext, "singeScreenshot", apiSingeScreenshot);
|
||||
lua_register(_global.luaContext, "singeSetGameName", apiSingeSetGameName);
|
||||
lua_register(_global.luaContext, "singeSetPauseFlag", apiSingeSetPauseFlag);
|
||||
lua_register(_global.luaContext, "singeQuit", apiSingeQuit);
|
||||
lua_register(_global.luaContext, "singeVersion", apiSingeVersion);
|
||||
lua_register(_global.luaContext, "singeWantsCrosshairs", apiSingeWantsCrosshairs);
|
||||
|
||||
lua_register(_global.luaContext, "soundFullStop", apiSoundFullStop);
|
||||
lua_register(_global.luaContext, "soundGetVolume", apiSoundGetVolume);
|
||||
lua_register(_global.luaContext, "soundIsPlaying", apiSoundIsPlaying);
|
||||
lua_register(_global.luaContext, "soundLoad", apiSoundLoad);
|
||||
lua_register(_global.luaContext, "soundPause", apiSoundPause);
|
||||
lua_register(_global.luaContext, "soundPlay", apiSoundPlay);
|
||||
lua_register(_global.luaContext, "soundResume", apiSoundResume);
|
||||
lua_register(_global.luaContext, "soundSetVolume", apiSoundSetVolume);
|
||||
lua_register(_global.luaContext, "soundStop", apiSoundStop);
|
||||
lua_register(_global.luaContext, "soundUnload", apiSoundUnload);
|
||||
|
||||
lua_register(_global.luaContext, "spriteDraw", apiSpriteDraw);
|
||||
lua_register(_global.luaContext, "spriteGetHeight", apiSpriteGetHeight);
|
||||
lua_register(_global.luaContext, "spriteGetWidth", apiSpriteGetWidth);
|
||||
lua_register(_global.luaContext, "spriteLoad", apiSpriteLoad);
|
||||
lua_register(_global.luaContext, "spriteQuality", apiSpriteQuality);
|
||||
lua_register(_global.luaContext, "spriteRotate", apiSpriteRotate);
|
||||
lua_register(_global.luaContext, "spriteRotateAndScale", apiSpriteRotateAndScale);
|
||||
lua_register(_global.luaContext, "spriteScale", apiSpriteScale);
|
||||
lua_register(_global.luaContext, "spriteUnload", apiSpriteUnload);
|
||||
|
||||
lua_register(_global.luaContext, "videoDraw", apiVideoDraw);
|
||||
lua_register(_global.luaContext, "videoGetFrame", apiVideoGetFrame);
|
||||
lua_register(_global.luaContext, "videoGetFrameCount", apiVideoGetFrameCount);
|
||||
lua_register(_global.luaContext, "videoGetHeight", apiVideoGetHeight);
|
||||
lua_register(_global.luaContext, "videoGetVolume", apiVideoGetVolume);
|
||||
lua_register(_global.luaContext, "videoGetWidth", apiVideoGetWidth);
|
||||
lua_register(_global.luaContext, "videoIsPlaying", apiVideoIsPlaying);
|
||||
lua_register(_global.luaContext, "videoLoad", apiVideoLoad);
|
||||
lua_register(_global.luaContext, "videoPause", apiVideoPause);
|
||||
lua_register(_global.luaContext, "videoPlay", apiVideoPlay);
|
||||
lua_register(_global.luaContext, "videoSeek", apiVideoSeek);
|
||||
lua_register(_global.luaContext, "videoSetVolume", apiVideoSetVolume);
|
||||
lua_register(_global.luaContext, "videoUnload", apiVideoUnload);
|
||||
|
||||
lua_register(_global.luaContext, "vldpGetHeight", apiVldpGetHeight);
|
||||
lua_register(_global.luaContext, "vldpGetPixel", apiVldpGetPixel);
|
||||
lua_register(_global.luaContext, "vldpGetWidth", apiVldpGetWidth);
|
||||
lua_register(_global.luaContext, "vldpSetVerbose", apiVldpVerbose);
|
||||
|
||||
// Open main video file
|
||||
progTrace("Opening main video file");
|
||||
doIndexDisplay(-1);
|
||||
|
@ -4587,119 +4701,6 @@ void startLuaContext(lua_State *L) {
|
|||
lua_rawseti(L, -2, 1);
|
||||
// Remove the seachers and the package tables from the stack
|
||||
lua_pop(L, 2);
|
||||
|
||||
// Lua API for Singe
|
||||
lua_register(_global.luaContext, "colorBackground", apiColorBackground);
|
||||
lua_register(_global.luaContext, "colorForeground", apiColorForeground);
|
||||
|
||||
lua_register(_global.luaContext, "controllerGetAxis", apiControllerGetAxis);
|
||||
|
||||
lua_register(_global.luaContext, "debugPrint", apiDebugPrint);
|
||||
|
||||
lua_register(_global.luaContext, "discAudio", apiDiscAudio);
|
||||
lua_register(_global.luaContext, "discChangeSpeed", apiDiscChangeSpeed);
|
||||
lua_register(_global.luaContext, "discGetFrame", apiDiscGetFrame);
|
||||
lua_register(_global.luaContext, "discGetHeight", apiDiscGetHeight);
|
||||
lua_register(_global.luaContext, "discGetState", apiDiscGetState);
|
||||
lua_register(_global.luaContext, "discGetWidth", apiDiscGetWidth);
|
||||
lua_register(_global.luaContext, "discPause", apiDiscPause);
|
||||
lua_register(_global.luaContext, "discPauseAtFrame", apiDiscPauseAtFrame);
|
||||
lua_register(_global.luaContext, "discPlay", apiDiscPlay);
|
||||
lua_register(_global.luaContext, "discSearch", apiDiscSearch);
|
||||
lua_register(_global.luaContext, "discSearchBlanking", apiDiscSearchBlanking);
|
||||
lua_register(_global.luaContext, "discSetFPS", apiDiscSetFps);
|
||||
lua_register(_global.luaContext, "discSkipBackward", apiDiscSkipBackward);
|
||||
lua_register(_global.luaContext, "discSkipBlanking", apiDiscSkipBlanking);
|
||||
lua_register(_global.luaContext, "discSkipForward", apiDiscSkipForward);
|
||||
lua_register(_global.luaContext, "discSkipToFrame", apiDiscSkipToFrame);
|
||||
lua_register(_global.luaContext, "discStepBackward", apiDiscStepBackward);
|
||||
lua_register(_global.luaContext, "discStepForward", apiDiscStepForward);
|
||||
lua_register(_global.luaContext, "discStop", apiDiscStop);
|
||||
|
||||
lua_register(_global.luaContext, "fontLoad", apiFontLoad);
|
||||
lua_register(_global.luaContext, "fontPrint", apiFontPrint);
|
||||
lua_register(_global.luaContext, "fontQuality", apiFontQuality);
|
||||
lua_register(_global.luaContext, "fontSelect", apiFontSelect);
|
||||
lua_register(_global.luaContext, "fontToSprite", apiFontToSprite);
|
||||
lua_register(_global.luaContext, "fontUnload", apiFontUnload);
|
||||
|
||||
lua_register(_global.luaContext, "keyboardGetMode", apiKeyboardGetMode);
|
||||
lua_register(_global.luaContext, "keyboardSetMode", apiKeyboardSetMode);
|
||||
|
||||
lua_register(_global.luaContext, "mouseEnable", apiMouseEnable);
|
||||
lua_register(_global.luaContext, "mouseDisable", apiMouseDisable);
|
||||
lua_register(_global.luaContext, "mouseGetPosition", apiMouseGetPosition);
|
||||
lua_register(_global.luaContext, "mouseHowMany", apiMouseHowMany);
|
||||
lua_register(_global.luaContext, "mouseSetCaptured", apiMouseSetCaptured);
|
||||
lua_register(_global.luaContext, "mouseSetMode", apiMouseSetMode);
|
||||
|
||||
lua_register(_global.luaContext, "overlayBox", apiOverlayBox);
|
||||
lua_register(_global.luaContext, "overlayCircle", apiOverlayCircle);
|
||||
lua_register(_global.luaContext, "overlayClear", apiOverlayClear);
|
||||
lua_register(_global.luaContext, "overlayEllipse", apiOverlayEllipse);
|
||||
lua_register(_global.luaContext, "overlayGetHeight", apiOverlayGetHeight);
|
||||
lua_register(_global.luaContext, "overlayGetWidth", apiOverlayGetWidth);
|
||||
lua_register(_global.luaContext, "overlayLine", apiOverlayLine);
|
||||
lua_register(_global.luaContext, "overlayPlot", apiOverlayPlot);
|
||||
lua_register(_global.luaContext, "overlayPrint", apiOverlayPrint);
|
||||
lua_register(_global.luaContext, "overlaySetResolution", apiOverlaySetResolution);
|
||||
|
||||
lua_register(_global.luaContext, "scriptExecute", apiScriptExecute);
|
||||
lua_register(_global.luaContext, "scriptPush", apiScriptPush);
|
||||
|
||||
lua_register(_global.luaContext, "singeDisablePauseKey", apiSingeDisablePauseKey);
|
||||
lua_register(_global.luaContext, "singeEnablePauseKey", apiSingeEnablePauseKey);
|
||||
lua_register(_global.luaContext, "singeGetDataPath", apiSingeGetDataPath);
|
||||
lua_register(_global.luaContext, "singeGetHeight", apiSingeGetHeight);
|
||||
lua_register(_global.luaContext, "singeGetPauseFlag", apiSingeGetPauseFlag);
|
||||
lua_register(_global.luaContext, "singeGetScriptPath", apiSingeGetScriptPath);
|
||||
lua_register(_global.luaContext, "singeGetWidth", apiSingeGetWidth);
|
||||
lua_register(_global.luaContext, "singeScreenshot", apiSingeScreenshot);
|
||||
lua_register(_global.luaContext, "singeSetGameName", apiSingeSetGameName);
|
||||
lua_register(_global.luaContext, "singeSetPauseFlag", apiSingeSetPauseFlag);
|
||||
lua_register(_global.luaContext, "singeQuit", apiSingeQuit);
|
||||
lua_register(_global.luaContext, "singeVersion", apiSingeVersion);
|
||||
lua_register(_global.luaContext, "singeWantsCrosshairs", apiSingeWantsCrosshairs);
|
||||
|
||||
lua_register(_global.luaContext, "soundFullStop", apiSoundFullStop);
|
||||
lua_register(_global.luaContext, "soundGetVolume", apiSoundGetVolume);
|
||||
lua_register(_global.luaContext, "soundIsPlaying", apiSoundIsPlaying);
|
||||
lua_register(_global.luaContext, "soundLoad", apiSoundLoad);
|
||||
lua_register(_global.luaContext, "soundPause", apiSoundPause);
|
||||
lua_register(_global.luaContext, "soundPlay", apiSoundPlay);
|
||||
lua_register(_global.luaContext, "soundResume", apiSoundResume);
|
||||
lua_register(_global.luaContext, "soundSetVolume", apiSoundSetVolume);
|
||||
lua_register(_global.luaContext, "soundStop", apiSoundStop);
|
||||
lua_register(_global.luaContext, "soundUnload", apiSoundUnload);
|
||||
|
||||
lua_register(_global.luaContext, "spriteDraw", apiSpriteDraw);
|
||||
lua_register(_global.luaContext, "spriteGetHeight", apiSpriteGetHeight);
|
||||
lua_register(_global.luaContext, "spriteGetWidth", apiSpriteGetWidth);
|
||||
lua_register(_global.luaContext, "spriteLoad", apiSpriteLoad);
|
||||
lua_register(_global.luaContext, "spriteQuality", apiSpriteQuality);
|
||||
lua_register(_global.luaContext, "spriteRotate", apiSpriteRotate);
|
||||
lua_register(_global.luaContext, "spriteRotateAndScale", apiSpriteRotateAndScale);
|
||||
lua_register(_global.luaContext, "spriteScale", apiSpriteScale);
|
||||
lua_register(_global.luaContext, "spriteUnload", apiSpriteUnload);
|
||||
|
||||
lua_register(_global.luaContext, "videoDraw", apiVideoDraw);
|
||||
lua_register(_global.luaContext, "videoGetFrame", apiVideoGetFrame);
|
||||
lua_register(_global.luaContext, "videoGetFrameCount", apiVideoGetFrameCount);
|
||||
lua_register(_global.luaContext, "videoGetHeight", apiVideoGetHeight);
|
||||
lua_register(_global.luaContext, "videoGetVolume", apiVideoGetVolume);
|
||||
lua_register(_global.luaContext, "videoGetWidth", apiVideoGetWidth);
|
||||
lua_register(_global.luaContext, "videoIsPlaying", apiVideoIsPlaying);
|
||||
lua_register(_global.luaContext, "videoLoad", apiVideoLoad);
|
||||
lua_register(_global.luaContext, "videoPause", apiVideoPause);
|
||||
lua_register(_global.luaContext, "videoPlay", apiVideoPlay);
|
||||
lua_register(_global.luaContext, "videoSeek", apiVideoSeek);
|
||||
lua_register(_global.luaContext, "videoSetVolume", apiVideoSetVolume);
|
||||
lua_register(_global.luaContext, "videoUnload", apiVideoUnload);
|
||||
|
||||
lua_register(_global.luaContext, "vldpGetHeight", apiVldpGetHeight);
|
||||
lua_register(_global.luaContext, "vldpGetPixel", apiVldpGetPixel);
|
||||
lua_register(_global.luaContext, "vldpGetWidth", apiVldpGetWidth);
|
||||
lua_register(_global.luaContext, "vldpSetVerbose", apiVldpVerbose);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ extern "C" {
|
|||
// to leverage in-development code without breaking their stable builds.
|
||||
#define AVIF_VERSION_MAJOR 1
|
||||
#define AVIF_VERSION_MINOR 0
|
||||
#define AVIF_VERSION_PATCH 1
|
||||
#define AVIF_VERSION_PATCH 2
|
||||
#define AVIF_VERSION_DEVEL 0
|
||||
#define AVIF_VERSION \
|
||||
((AVIF_VERSION_MAJOR * 1000000) + (AVIF_VERSION_MINOR * 10000) + (AVIF_VERSION_PATCH * 100) + AVIF_VERSION_DEVEL)
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.0.2] - 2023-11-16
|
||||
|
||||
### Changed
|
||||
* Update avifCropRectConvertCleanApertureBox() to the revised requirements in
|
||||
ISO/IEC 23000-22:2019/Amd. 2:2021 Section 7.3.6.7.
|
||||
* Fix memory errors reported in crbug.com/1501766 and crbug.com/1501770.
|
||||
|
||||
## [1.0.1] - 2023-08-29
|
||||
|
||||
### Changed
|
||||
|
@ -980,6 +987,7 @@ code.
|
|||
- `avifVersion()` function
|
||||
|
||||
[Unreleased]: https://github.com/AOMediaCodec/libavif/compare/v1.0.0...HEAD
|
||||
[1.0.2]: https://github.com/AOMediaCodec/libavif/compare/v1.0.1...v1.0.2
|
||||
[1.0.1]: https://github.com/AOMediaCodec/libavif/compare/v1.0.0...v1.0.1
|
||||
[1.0.0]: https://github.com/AOMediaCodec/libavif/compare/v0.11.1...v1.0.0
|
||||
[0.11.1]: https://github.com/AOMediaCodec/libavif/compare/v0.11.0...v0.11.1
|
||||
|
|
|
@ -11,7 +11,7 @@ endif()
|
|||
# Specify search path for CMake modules to be loaded by include() and find_package()
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
|
||||
|
||||
project(libavif LANGUAGES C VERSION 1.0.1)
|
||||
project(libavif LANGUAGES C VERSION 1.0.2)
|
||||
|
||||
# Set C99 as the default
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
|
@ -25,7 +25,7 @@ set(CMAKE_C_STANDARD 99)
|
|||
# Increment PATCH.
|
||||
set(LIBRARY_VERSION_MAJOR 16)
|
||||
set(LIBRARY_VERSION_MINOR 0)
|
||||
set(LIBRARY_VERSION_PATCH 1)
|
||||
set(LIBRARY_VERSION_PATCH 2)
|
||||
set(LIBRARY_VERSION "${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}.${LIBRARY_VERSION_PATCH}")
|
||||
set(LIBRARY_SOVERSION ${LIBRARY_VERSION_MAJOR})
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ extern "C" {
|
|||
// to leverage in-development code without breaking their stable builds.
|
||||
#define AVIF_VERSION_MAJOR 1
|
||||
#define AVIF_VERSION_MINOR 0
|
||||
#define AVIF_VERSION_PATCH 1
|
||||
#define AVIF_VERSION_PATCH 2
|
||||
#define AVIF_VERSION_DEVEL 0
|
||||
#define AVIF_VERSION \
|
||||
((AVIF_VERSION_MAJOR * 1000000) + (AVIF_VERSION_MINOR * 10000) + (AVIF_VERSION_PATCH * 100) + AVIF_VERSION_DEVEL)
|
||||
|
|
|
@ -624,16 +624,15 @@ static avifBool overflowsInt32(int64_t x)
|
|||
static avifBool avifCropRectIsValid(const avifCropRect * cropRect, uint32_t imageW, uint32_t imageH, avifPixelFormat yuvFormat, avifDiagnostics * diag)
|
||||
|
||||
{
|
||||
// ISO/IEC 23000-22:2019/DAM 2:2021, Section 7.3.6.7:
|
||||
// ISO/IEC 23000-22:2019/Amd. 2:2021, Section 7.3.6.7:
|
||||
// The clean aperture property is restricted according to the chroma
|
||||
// sampling format of the input image (4:4:4, 4:2:2:, 4:2:0, or 4:0:0) as
|
||||
// follows:
|
||||
// - when the image is 4:0:0 (monochrome) or 4:4:4, the horizontal and
|
||||
// vertical cropped offsets and widths shall be integers;
|
||||
// - when the image is 4:2:2 the horizontal cropped offset and width
|
||||
// shall be even numbers and the vertical values shall be integers;
|
||||
// - when the image is 4:2:0 both the horizontal and vertical cropped
|
||||
// offsets and widths shall be even numbers.
|
||||
// ...
|
||||
// - If chroma is subsampled horizontally (i.e., 4:2:2 and 4:2:0), the
|
||||
// leftmost pixel of the clean aperture shall be even numbers;
|
||||
// - If chroma is subsampled vertically (i.e., 4:2:0), the topmost line
|
||||
// of the clean aperture shall be even numbers.
|
||||
|
||||
if ((cropRect->width == 0) || (cropRect->height == 0)) {
|
||||
avifDiagnosticsPrintf(diag, "[Strict] crop rect width and height must be nonzero");
|
||||
|
@ -646,14 +645,14 @@ static avifBool avifCropRectIsValid(const avifCropRect * cropRect, uint32_t imag
|
|||
}
|
||||
|
||||
if ((yuvFormat == AVIF_PIXEL_FORMAT_YUV420) || (yuvFormat == AVIF_PIXEL_FORMAT_YUV422)) {
|
||||
if (((cropRect->x % 2) != 0) || ((cropRect->width % 2) != 0)) {
|
||||
avifDiagnosticsPrintf(diag, "[Strict] crop rect X offset and width must both be even due to this image's YUV subsampling");
|
||||
if ((cropRect->x % 2) != 0) {
|
||||
avifDiagnosticsPrintf(diag, "[Strict] crop rect X offset must be even due to this image's YUV subsampling");
|
||||
return AVIF_FALSE;
|
||||
}
|
||||
}
|
||||
if (yuvFormat == AVIF_PIXEL_FORMAT_YUV420) {
|
||||
if (((cropRect->y % 2) != 0) || ((cropRect->height % 2) != 0)) {
|
||||
avifDiagnosticsPrintf(diag, "[Strict] crop rect Y offset and height must both be even due to this image's YUV subsampling");
|
||||
if ((cropRect->y % 2) != 0) {
|
||||
avifDiagnosticsPrintf(diag, "[Strict] crop rect Y offset must be even due to this image's YUV subsampling");
|
||||
return AVIF_FALSE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -769,6 +769,8 @@ static void avifMetaDestroy(avifMeta * meta)
|
|||
avifFree(meta);
|
||||
}
|
||||
|
||||
// CAUTION: This function could potentially resize the meta->items array thereby invalidating all existing pointers that are being
|
||||
// stored locally. So if this function is being called, exercise caution in the caller to not use invalid pointers.
|
||||
static avifDecoderItem * avifMetaFindItem(avifMeta * meta, uint32_t itemID)
|
||||
{
|
||||
if (itemID == 0) {
|
||||
|
@ -1417,7 +1419,7 @@ static avifBool avifDecoderGenerateImageGridTiles(avifDecoder * decoder, avifIma
|
|||
|
||||
if (tilesAvailable != grid->rows * grid->columns) {
|
||||
avifDiagnosticsPrintf(&decoder->diag,
|
||||
"Grid image of dimensions %ux%u requires %u tiles, and only %u were found",
|
||||
"Grid image of dimensions %ux%u requires %u tiles, but %u were found",
|
||||
grid->columns,
|
||||
grid->rows,
|
||||
grid->rows * grid->columns,
|
||||
|
@ -3614,17 +3616,20 @@ static avifBool avifDecoderItemIsAlphaAux(avifDecoderItem * item, uint32_t color
|
|||
return auxCProp && isAlphaURN(auxCProp->u.auxC.auxType);
|
||||
}
|
||||
|
||||
// Finds the alpha item whose parent item is colorItem and sets it in the alphaItem output parameter. Returns AVIF_RESULT_OK on
|
||||
// success. Note that *alphaItem can be NULL even if the return value is AVIF_RESULT_OK. If the colorItem is a grid and the alpha
|
||||
// item is represented as a set of auxl items to each color tile, then a fake item will be created and *isAlphaItemInInput will be
|
||||
// set to AVIF_FALSE. In this case, the alpha item merely exists to hold the locations of the alpha tile items. The data of this
|
||||
// item need not be read and the pixi property cannot be validated. Otherwise, *isAlphaItemInInput will be set to AVIF_TRUE when
|
||||
// *alphaItem is not NULL.
|
||||
// Finds the alpha item whose parent item is *colorItemPtr and sets it in the alphaItem output parameter. Returns AVIF_RESULT_OK
|
||||
// on success. Note that *alphaItem can be NULL even if the return value is AVIF_RESULT_OK. If the *colorItemPtr is a grid and the
|
||||
// alpha item is represented as a set of auxl items to each color tile, then a fake item will be created and *isAlphaItemInInput
|
||||
// will be set to AVIF_FALSE. In this case, the alpha item merely exists to hold the locations of the alpha tile items. The data
|
||||
// of this item need not be read and the pixi property cannot be validated. Otherwise, *isAlphaItemInInput will be set to
|
||||
// AVIF_TRUE when *alphaItem is not NULL. If the data->meta->items array is resized, then the value in *colorItemPtr could become
|
||||
// invalid. This function also resets *colorItemPtr to the right value if an alpha item was found and added to the data->meta->items
|
||||
// array.
|
||||
static avifResult avifDecoderDataFindAlphaItem(avifDecoderData * data,
|
||||
avifDecoderItem * colorItem,
|
||||
avifDecoderItem ** colorItemPtr,
|
||||
avifDecoderItem ** alphaItem,
|
||||
avifBool * isAlphaItemInInput)
|
||||
{
|
||||
const avifDecoderItem * colorItem = *colorItemPtr;
|
||||
for (uint32_t itemIndex = 0; itemIndex < data->meta->items.count; ++itemIndex) {
|
||||
avifDecoderItem * item = &data->meta->items.item[itemIndex];
|
||||
if (avifDecoderItemShouldBeSkipped(item)) {
|
||||
|
@ -3659,27 +3664,53 @@ static avifResult avifDecoderDataFindAlphaItem(avifDecoderData * data,
|
|||
maxItemID = item->id;
|
||||
}
|
||||
if (item->dimgForID == colorItem->id) {
|
||||
avifBool seenAlphaForCurrentItem = AVIF_FALSE;
|
||||
for (uint32_t j = 0; j < colorItem->meta->items.count; ++j) {
|
||||
avifDecoderItem * auxlItem = &colorItem->meta->items.item[j];
|
||||
if (avifDecoderItemIsAlphaAux(auxlItem, item->id)) {
|
||||
if (seenAlphaForCurrentItem || auxlItem->dimgForID != 0) {
|
||||
// One of the following invalid cases:
|
||||
// * Multiple items are claiming to be the alpha auxiliary of the current item.
|
||||
// * Alpha auxiliary is dimg for another item.
|
||||
avifFree(alphaItemIndices);
|
||||
*alphaItem = NULL;
|
||||
*isAlphaItemInInput = AVIF_FALSE;
|
||||
return AVIF_RESULT_INVALID_IMAGE_GRID;
|
||||
}
|
||||
alphaItemIndices[alphaItemCount++] = j;
|
||||
seenAlphaForCurrentItem = AVIF_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (alphaItemCount != colorItemCount) {
|
||||
// Not all the color items had an alpha auxiliary attached to it. Report this case as an image without alpha channel.
|
||||
if (!seenAlphaForCurrentItem) {
|
||||
// No alpha auxiliary item was found for the current item. Treat this as an image without alpha.
|
||||
avifFree(alphaItemIndices);
|
||||
*alphaItem = NULL;
|
||||
*isAlphaItemInInput = AVIF_FALSE;
|
||||
return AVIF_RESULT_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(alphaItemCount == colorItemCount);
|
||||
|
||||
int colorItemIndex = -1;
|
||||
for (uint32_t i = 0; i < data->meta->items.count; ++i) {
|
||||
if (colorItem->id == data->meta->items.item[i].id) {
|
||||
colorItemIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert(colorItemIndex >= 0);
|
||||
|
||||
*alphaItem = avifMetaFindItem(colorItem->meta, maxItemID + 1);
|
||||
if (*alphaItem == NULL) {
|
||||
avifFree(alphaItemIndices);
|
||||
*isAlphaItemInInput = AVIF_FALSE;
|
||||
return AVIF_RESULT_OUT_OF_MEMORY;
|
||||
}
|
||||
// avifMetaFindItem() could invalidate all existing item pointers. So reset the colorItem pointers.
|
||||
*colorItemPtr = &data->meta->items.item[colorItemIndex];
|
||||
colorItem = *colorItemPtr;
|
||||
|
||||
memcpy((*alphaItem)->type, "grid", 4);
|
||||
(*alphaItem)->width = colorItem->width;
|
||||
(*alphaItem)->height = colorItem->height;
|
||||
|
@ -3918,6 +3949,16 @@ avifResult avifDecoderReset(avifDecoder * decoder)
|
|||
decoder->imageDimensionLimit,
|
||||
data->diag),
|
||||
AVIF_RESULT_INVALID_IMAGE_GRID);
|
||||
// Validate that there are exactly the same number of dimg items to form the grid.
|
||||
uint32_t dimgItemCount = 0;
|
||||
for (uint32_t i = 0; i < colorItem->meta->items.count; ++i) {
|
||||
if (colorItem->meta->items.item[i].dimgForID == colorItem->id) {
|
||||
++dimgItemCount;
|
||||
}
|
||||
}
|
||||
if (dimgItemCount != data->color.grid.rows * data->color.grid.columns) {
|
||||
return AVIF_RESULT_INVALID_IMAGE_GRID;
|
||||
}
|
||||
colorCodecType = avifDecoderItemGetGridCodecType(colorItem);
|
||||
if (colorCodecType == AVIF_CODEC_TYPE_UNKNOWN) {
|
||||
return AVIF_RESULT_INVALID_IMAGE_GRID;
|
||||
|
@ -3929,7 +3970,7 @@ avifResult avifDecoderReset(avifDecoder * decoder)
|
|||
|
||||
avifBool isAlphaItemInInput;
|
||||
avifDecoderItem * alphaItem;
|
||||
AVIF_CHECKRES(avifDecoderDataFindAlphaItem(data, colorItem, &alphaItem, &isAlphaItemInInput));
|
||||
AVIF_CHECKRES(avifDecoderDataFindAlphaItem(data, &colorItem, &alphaItem, &isAlphaItemInInput));
|
||||
avifCodecType alphaCodecType = AVIF_CODEC_TYPE_UNKNOWN;
|
||||
if (alphaItem) {
|
||||
if (!memcmp(alphaItem->type, "grid", 4)) {
|
||||
|
|
|
@ -65,6 +65,15 @@ constexpr InvalidClapPropertyParam kInvalidClapPropertyTestParams[] = {
|
|||
722,
|
||||
AVIF_PIXEL_FORMAT_YUV420,
|
||||
{330, 1, 385, 1, static_cast<uint32_t>(-308), 1, 103, 1}},
|
||||
// pcX = -1/2 + (99 - 1)/2 = 48.5
|
||||
// pcY = -1/2 + (99 - 1)/2 = 48.5
|
||||
// leftmost = 48.5 - (99 - 1)/2 = -0.5 (not an integer)
|
||||
// topmost = 48.5 - (99 - 1)/2 = -0.5 (not an integer)
|
||||
{99,
|
||||
99,
|
||||
AVIF_PIXEL_FORMAT_YUV420,
|
||||
{99, 1, 99, 1, static_cast<uint32_t>(-1), 2, static_cast<uint32_t>(-1),
|
||||
2}},
|
||||
};
|
||||
|
||||
using InvalidClapPropertyTest =
|
||||
|
@ -112,6 +121,15 @@ constexpr ValidClapPropertyParam kValidClapPropertyTestParams[] = {
|
|||
{60, 1, 80, 1, static_cast<uint32_t>(-30), 1, static_cast<uint32_t>(-40),
|
||||
1},
|
||||
{0, 0, 60, 80}},
|
||||
// pcX = -1/2 + (100 - 1)/2 = 49
|
||||
// pcY = -1/2 + (100 - 1)/2 = 49
|
||||
// leftmost = 49 - (99 - 1)/2 = 0
|
||||
// topmost = 49 - (99 - 1)/2 = 0
|
||||
{100,
|
||||
100,
|
||||
AVIF_PIXEL_FORMAT_YUV420,
|
||||
{99, 1, 99, 1, static_cast<uint32_t>(-1), 2, static_cast<uint32_t>(-1), 2},
|
||||
{0, 0, 99, 99}},
|
||||
};
|
||||
|
||||
using ValidClapPropertyTest = ::testing::TestWithParam<ValidClapPropertyParam>;
|
||||
|
@ -126,7 +144,8 @@ TEST_P(ValidClapPropertyTest, ValidateClapProperty) {
|
|||
avifDiagnostics diag;
|
||||
EXPECT_TRUE(avifCropRectConvertCleanApertureBox(&crop_rect, ¶m.clap,
|
||||
param.width, param.height,
|
||||
param.yuv_format, &diag));
|
||||
param.yuv_format, &diag))
|
||||
<< diag.error;
|
||||
EXPECT_EQ(crop_rect.x, param.expected_crop_rect.x);
|
||||
EXPECT_EQ(crop_rect.y, param.expected_crop_rect.y);
|
||||
EXPECT_EQ(crop_rect.width, param.expected_crop_rect.width);
|
||||
|
|
2
thirdparty/SDL2_image/src/nanosvgrast.h
vendored
2
thirdparty/SDL2_image/src/nanosvgrast.h
vendored
|
@ -1290,7 +1290,7 @@ static void nsvg__initPaint(NSVGcachedPaint* cache, NSVGpaint* paint, float opac
|
|||
if (grad->nstops == 0) {
|
||||
for (i = 0; i < 256; i++)
|
||||
cache->colors[i] = 0;
|
||||
} if (grad->nstops == 1) {
|
||||
} else if (grad->nstops == 1) {
|
||||
for (i = 0; i < 256; i++)
|
||||
cache->colors[i] = nsvg__applyOpacity(grad->stops[i].color, opacity);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue