PyGL
Some checks failed
Build Dusk / build-linux (push) Failing after 2m5s
Build Dusk / build-psp (push) Has been cancelled

This commit is contained in:
2025-12-04 00:23:50 -06:00
parent de78be3e25
commit 6b22f547fe
3 changed files with 31 additions and 29 deletions

View File

@@ -17,7 +17,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
apt-get update apt-get update
apt-get install -y build-essential cmake python3 python3-pip python3-polib python3-pil libsdl2-dev libgl1-mesa-dev libzip-dev python3-dotenv python3-pyqt5 apt-get install -y build-essential cmake python3 python3-pip python3-polib python3-pil libsdl2-dev libgl1-mesa-dev libzip-dev python3-dotenv python3-pyqt5 python3-opengl
- name: Configure CMake - name: Configure CMake
run: cmake -S . -B build -DDUSK_TARGET_SYSTEM=linux run: cmake -S . -B build -DDUSK_TARGET_SYSTEM=linux
- name: Build - name: Build
@@ -39,7 +39,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
apt-get update apt-get update
apt-get install -y build-essential cmake python3 python3-pip python3-polib python3-pil libsdl2-dev libgl1-mesa-dev libzip-dev python3-dotenv python3-pyqt5 apt-get install -y build-essential cmake python3 python3-pip python3-polib python3-pil libsdl2-dev libgl1-mesa-dev libzip-dev python3-dotenv python3-pyqt5 python3-opengl
- name: Configure CMake - name: Configure CMake
run: cmake -S . -B build -DDUSK_TARGET_SYSTEM=psp run: cmake -S . -B build -DDUSK_TARGET_SYSTEM=psp
- name: Build - name: Build

View File

@@ -7,6 +7,7 @@
#include "scriptmanager.h" #include "scriptmanager.h"
#include "util/memory.h" #include "util/memory.h"
#include "assert/assert.h"
#include "asset/asset.h" #include "asset/asset.h"
@@ -28,31 +29,13 @@ errorret_t scriptManagerInit() {
luaL_openlibs(SCRIPT_MANAGER.luaState); luaL_openlibs(SCRIPT_MANAGER.luaState);
lua_register(SCRIPT_MANAGER.luaState, "luaCallable", luaCallable); lua_register(SCRIPT_MANAGER.luaState, "luaCallable", luaCallable);
// Script test. errorChain(scriptManagerExecFile("script/test.dsf"));
assetscript_t script;
assetLoad("script/test.dsf", &script);
if(lua_load(SCRIPT_MANAGER.luaState, assetScriptReader, &script, "script/test.dsf", NULL) != LUA_OK) {
const char_t *strErr = lua_tostring(SCRIPT_MANAGER.luaState, -1);
lua_pop(SCRIPT_MANAGER.luaState, 1);
errorThrow("Failed to load Lua script: %s", strErr);
}
if(lua_pcall(SCRIPT_MANAGER.luaState, 0, LUA_MULTRET, 0) != LUA_OK) {
const char_t *strErr = lua_tostring(SCRIPT_MANAGER.luaState, -1);
lua_pop(SCRIPT_MANAGER.luaState, 1);
errorThrow("Failed to execute Lua script: %s", strErr);
}
assetScriptDispose(&script);
errorOk(); errorOk();
} }
errorret_t scriptManagerExecString(const char_t *script) { errorret_t scriptManagerExecString(const char_t *script) {
if(SCRIPT_MANAGER.luaState == NULL) { assertNotNull(script, "Script cannot be NULL");
errorThrow("Lua state is not initialized"); assertNotNull(SCRIPT_MANAGER.luaState, "Lua state is not initialized");
}
if(luaL_dostring(SCRIPT_MANAGER.luaState, script) != LUA_OK) { if(luaL_dostring(SCRIPT_MANAGER.luaState, script) != LUA_OK) {
const char_t *strErr = lua_tostring(SCRIPT_MANAGER.luaState, -1); const char_t *strErr = lua_tostring(SCRIPT_MANAGER.luaState, -1);
@@ -64,16 +47,27 @@ errorret_t scriptManagerExecString(const char_t *script) {
} }
errorret_t scriptManagerExecFile(const char_t *filename) { errorret_t scriptManagerExecFile(const char_t *filename) {
if(SCRIPT_MANAGER.luaState == NULL) { assertNotNull(filename, "Filename cannot be NULL");
errorThrow("Lua state is not initialized"); assertNotNull(SCRIPT_MANAGER.luaState, "Lua state is not initialized");
}
if(luaL_dofile(SCRIPT_MANAGER.luaState, filename) != LUA_OK) { assetscript_t script;
errorChain(assetLoad(filename, &script));
if(lua_load(
SCRIPT_MANAGER.luaState, assetScriptReader, &script, filename, NULL
) != LUA_OK) {
const char_t *strErr = lua_tostring(SCRIPT_MANAGER.luaState, -1); const char_t *strErr = lua_tostring(SCRIPT_MANAGER.luaState, -1);
lua_pop(SCRIPT_MANAGER.luaState, 1); lua_pop(SCRIPT_MANAGER.luaState, 1);
errorThrow("Failed to execute Lua file: %s", strErr); errorThrow("Failed to load Lua script: %s", strErr);
} }
if(lua_pcall(SCRIPT_MANAGER.luaState, 0, LUA_MULTRET, 0) != LUA_OK) {
const char_t *strErr = lua_tostring(SCRIPT_MANAGER.luaState, -1);
lua_pop(SCRIPT_MANAGER.luaState, 1);
errorThrow("Failed to execute Lua script: %s", strErr);
}
errorChain(assetScriptDispose(&script));
errorOk(); errorOk();
} }

View File

@@ -30,7 +30,15 @@ errorret_t scriptManagerInit();
* @param script The script to execute. * @param script The script to execute.
* @return The error return value. * @return The error return value.
*/ */
errorret_t scriptManagerExec(const char_t *script); errorret_t scriptManagerExecString(const char_t *script);
/**
* Execute a Lua script from a file.
*
* @param filename The filename of the script to execute.
* @return The error return value.
*/
errorret_t scriptManagerExecFile(const char_t *filename);
/** /**
* Dispose of the script manager. * Dispose of the script manager.