mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-07 19:31:19 -04:00
Allow code mods to be disabled on build, disable them by default for now.
This commit is contained in:
@@ -461,6 +461,16 @@ if(ANDROID)
|
||||
list(APPEND GAME_COMPILE_DEFS TARGET_ANDROID=1)
|
||||
endif ()
|
||||
|
||||
set(DUSK_ENABLE_CODE_MODS_DEFAULT OFF)
|
||||
option(DUSK_ENABLE_CODE_MODS "Enable code mods" ${DUSK_ENABLE_CODE_MODS_DEFAULT})
|
||||
if (DUSK_ENABLE_CODE_MODS)
|
||||
if (NOT ANDROID AND NOT IOS AND NOT TVOS)
|
||||
list(APPEND GAME_COMPILE_DEFS DUSK_CODE_MODS=1)
|
||||
else ()
|
||||
message(FATAL_ERROR "Code mods not supported on the target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# game_debug is for game code files that we know work when compiled with DEBUG=1
|
||||
# Of course, if building a release build, this distinction is irrelevant
|
||||
set(GAME_DEBUG_FILES
|
||||
|
||||
@@ -412,6 +412,11 @@ static bool checkDuplicateMod(const ModMetadata& metadata, const std::vector<Loa
|
||||
}
|
||||
|
||||
bool ModLoader::tryLoadNativeMod(LoadedMod& mod) {
|
||||
if (!EnableCodeMods) {
|
||||
DuskLog.error("Code mods are not available in this build");
|
||||
return false;
|
||||
}
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
auto [dllEntry, dllFallback] = LocateDllInBundle(*mod.bundle);
|
||||
|
||||
@@ -3,8 +3,18 @@
|
||||
#include <filesystem>
|
||||
#include "miniz.h"
|
||||
|
||||
#if __APPLE__
|
||||
#include <TargetConditionals.h>
|
||||
#endif
|
||||
|
||||
namespace dusk::modding {
|
||||
|
||||
#if DUSK_CODE_MODS
|
||||
constexpr bool EnableCodeMods = true;
|
||||
#else
|
||||
constexpr bool EnableCodeMods = false;
|
||||
#endif
|
||||
|
||||
class ModBundle {
|
||||
public:
|
||||
virtual ~ModBundle() = default;
|
||||
|
||||
Reference in New Issue
Block a user