From 72f9c0f9b70f55d7f0345575a857dd822a0295cf Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Sun, 30 Mar 2025 18:15:53 -0500 Subject: [PATCH] Exported: * GetLumpContainer * GetContainerName * GetLumpFullPath for WADS struct, useful for debugging custom-made parsers and identifying where problems may arise. All credit goes to Jay for the code. --- src/common/scripting/interface/vmnatives.cpp | 21 ++++++++++++++++++++ wadsrc/static/zscript/engine/base.zs | 3 +++ 2 files changed, 24 insertions(+) diff --git a/src/common/scripting/interface/vmnatives.cpp b/src/common/scripting/interface/vmnatives.cpp index c1bb2a2b5..1b4cdb746 100644 --- a/src/common/scripting/interface/vmnatives.cpp +++ b/src/common/scripting/interface/vmnatives.cpp @@ -853,6 +853,27 @@ DEFINE_ACTION_FUNCTION(_Wads, GetLumpFullName) ACTION_RETURN_STRING(fileSystem.GetFileFullName(lump)); } +DEFINE_ACTION_FUNCTION(_Wads, GetLumpContainer) +{ + PARAM_PROLOGUE; + PARAM_INT(lump); + ACTION_RETURN_INT(fileSystem.GetFileContainer(lump)); +} + +DEFINE_ACTION_FUNCTION(_Wads, GetContainerName) +{ + PARAM_PROLOGUE; + PARAM_INT(lump); + ACTION_RETURN_STRING(fileSystem.GetResourceFileName(lump)); +} + +DEFINE_ACTION_FUNCTION(_Wads, GetLumpFullPath) +{ + PARAM_PROLOGUE; + PARAM_INT(lump); + ACTION_RETURN_STRING(fileSystem.GetFileFullPath(lump)); +} + DEFINE_ACTION_FUNCTION(_Wads, GetLumpNamespace) { PARAM_PROLOGUE; diff --git a/wadsrc/static/zscript/engine/base.zs b/wadsrc/static/zscript/engine/base.zs index 33c14eef6..48eb46343 100644 --- a/wadsrc/static/zscript/engine/base.zs +++ b/wadsrc/static/zscript/engine/base.zs @@ -893,6 +893,9 @@ struct Wads // todo: make FileSystem an alias to 'Wads' native static string GetLumpName(int lump); native static string GetLumpFullName(int lump); native static int GetLumpNamespace(int lump); + native static int GetLumpContainer(int lump); + native static string GetContainerName(int lump); + native static string GetLumpFullPath(int lump); } enum EmptyTokenType