Fix DynOS packs Lua code execution (#1194)
Some checks failed
Build coop / build-linux (push) Has been cancelled
Build coop / build-steamos (push) Has been cancelled
Build coop / build-windows-opengl (push) Has been cancelled
Build coop / build-windows-directx (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled

* Fix dynos packs code execution

* make mod player models ignore dynos local player model only
This commit is contained in:
PeachyPeach 2026-04-12 01:42:21 +02:00 committed by GitHub
parent 21dd1ce81d
commit b0e1f1e465
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 11 additions and 3 deletions

View file

@ -22,7 +22,8 @@ extern "C" {
#define FUNCTION_BHV 2
#define FUNCTION_LVL 3
#define MOD_PACK_INDEX 99
#define MOD_PACK_INDEX -1 // the pack index for actors loaded from mods
#define PACK_MOD_INDEX -1 // the mod index for actors loaded from packs
//
// Enums

View file

@ -94,6 +94,9 @@ GfxData *DynOS_Actor_LoadFromBinary(const SysPath &aPackFolder, const char *aAct
BinFile *_File = DynOS_Bin_Decompress(aFilename);
if (_File) {
_GfxData = New<GfxData>();
if (aAddToPack) {
_GfxData->mModIndex = PACK_MOD_INDEX;
}
for (bool _Done = false; !_Done;) {
switch (_File->Read<u8>()) {
case DATA_TYPE_LIGHT: DynOS_Lights_Load (_File, _GfxData); break;

View file

@ -465,6 +465,10 @@ void *DynOS_Pointer_Load(BinFile *aFile, GfxData *aGfxData, u32 aValue, u8 aFunc
// LUAV
if (aValue == LUA_VAR_CODE) {
String token; token.Read(aFile);
if (aGfxData->mModIndex == PACK_MOD_INDEX) {
sys_fatal("Invalid use of Lua function in DynOS pack: %s", token.begin());
return NULL;
}
for (s32 i = 0; i < aGfxData->mLuaTokenList.Count(); i++) {
if (token == aGfxData->mLuaTokenList[i]) {
return (void*)(uintptr_t)(i+1);

View file

@ -220,7 +220,7 @@ void DynOS_Actor_Override(struct Object* obj, void** aSharedChild) {
obj->behavior == smlua_override_behavior(bhvMetalCap) ||
obj->behavior == smlua_override_behavior(bhvVanishCap))) {
struct NetworkPlayer* np = network_player_from_global_index(obj->globalPlayerIndex);
if (np && np->localIndex > 0 && configDynosLocalPlayerModelOnly) {
if (np && np->localIndex > 0 && configDynosLocalPlayerModelOnly && it->second.mPackIndex != MOD_PACK_INDEX) {
return;
}
}

View file

@ -2087,7 +2087,7 @@ static String DynOS_Builtin_Func_CheckMisuse_Internal(s32 aIndex, const char* aD
if (aFuncType != builtinFunc.type && (
aIndex == i || (aDataName && strcmp(aDataName, builtinFunc.name) == 0) || aData == builtinFunc.func)) {
return String(
"Invalid use of function %s: trying to assign %s function to %s",
"Invalid use of %s function in %s: %s",
builtinFunc.name,
sDynosBuiltinFuncTypeNames[builtinFunc.type],
sDynosBuiltinFuncTypeNames[aFuncType]