Move mods to config dir & updates for macOS

This commit is contained in:
Luke Street
2026-04-24 09:52:04 -06:00
parent b7f9bc91b4
commit e25a1f3ef6
6 changed files with 28 additions and 5 deletions
+3
View File
@@ -549,6 +549,7 @@ if (APPLE)
set(DUSK_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/platforms/tvos)
else ()
set(DUSK_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/platforms/macos)
set(DUSK_ENTITLEMENTS ${DUSK_RESOURCE_DIR}/Dusk.entitlements)
endif ()
set(DUSK_INFO_PLIST ${DUSK_RESOURCE_DIR}/Info.plist.in)
file(GLOB_RECURSE DUSK_RESOURCE_FILES
@@ -579,6 +580,8 @@ if (APPLE)
OUTPUT_NAME Dusk
XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "YES"
XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "YES"
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${DUSK_ENTITLEMENTS}
XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME "YES"
)
endif ()
+4
View File
@@ -51,6 +51,10 @@ add_dusk_mod(my_mod
After building, `my_mod.dusk` is placed in `mods/` next to the project root (`DUSK_MODS_OUTPUT_DIR` cache variable). Copy it to the game's `mods/` folder and launch.
- Windows: `%APPDATA%\TwilitRealm\Dusk\mods`
- Linux: `~/.local/share/TwilitRealm/Dusk/mods`
- macOS: `~/Library/Application Support/TwilitRealm/Dusk/mods`
The `.dusk` archive is a standard zip containing `mod.json`, the compiled library, and an optional `res/` tree. `add_dusk_mod()` creates it automatically.
---
+1 -1
View File
@@ -55,7 +55,7 @@ public:
private:
std::vector<LoadedMod> m_mods;
std::filesystem::path m_modsDir = "mods";
std::filesystem::path m_modsDir;
bool m_initialized = false;
void tryLoadDusk(const std::filesystem::path& modPath);
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
</dict>
</plist>
+2 -2
View File
@@ -253,7 +253,7 @@ void ModLoader::tryLoadDusk(const std::filesystem::path& modPath) {
return;
}
const fs::path cacheDir = fs::path("mods") / ".cache" / modPath.stem();
const fs::path cacheDir = m_modsDir / ".cache" / modPath.stem();
std::error_code ec;
fs::create_directories(cacheDir, ec);
@@ -315,7 +315,7 @@ void ModLoader::init() {
m_initialized = true;
namespace fs = std::filesystem;
if (!fs::exists(m_modsDir)) {
if (!fs::is_directory(m_modsDir)) {
DuskLog.info("ModLoader: mods directory '{}' not found — mod loading skipped",
m_modsDir.string());
return;
+10 -2
View File
@@ -493,7 +493,7 @@ int game_main(int argc, char* argv[]) {
("h,help", "Print usage")
("console", "Show the Windows console window for logs", cxxopts::value<bool>()->default_value("false")->implicit_value("true"))
("dvd", "Path to DVD image file", cxxopts::value<std::string>())
("mods", "Path to mods directory", cxxopts::value<std::string>()->default_value("mods"))
("mods", "Path to mods directory", cxxopts::value<std::string>())
("backend", "Graphics API backend to use (auto, d3d12, metal, vulkan, null)", cxxopts::value<std::string>())
("cvar", "Override configuration variables without modifying config", cxxopts::value<std::vector<std::string>>());
@@ -619,7 +619,15 @@ int game_main(int argc, char* argv[]) {
mDoMain::developmentMode = 1; // Force Dev Mode for Debugging
mDoDvdThd::SyncWidthSound = false;
dusk::ModLoader::instance().setModsDir(parsed_arg_options["mods"].as<std::string>());
// Setup mods
if (parsed_arg_options.contains("mods") &&
!parsed_arg_options["mods"].as<std::string>().empty())
{
dusk::ModLoader::instance().setModsDir(parsed_arg_options["mods"].as<std::string>());
} else {
dusk::ModLoader::instance().setModsDir(dusk::ConfigPath / "mods");
}
OSReport("Starting main01 (Game Loop)...\n");
main01();