load native binaries from mod resources/binaries/<platform/

This commit is contained in:
matcool 2024-01-18 12:35:18 -03:00
parent 25dc6eea5b
commit acd9bd7884
6 changed files with 20 additions and 3 deletions

View file

@ -403,9 +403,6 @@ void Loader::Impl::loadModGraph(Mod* node, bool early) {
return;
}
if (node->getID() == "absolllute.megahack")
log::debug("megahack creepypasta");
for (auto const& dep : node->m_impl->m_dependants) {
m_modsToLoad.push_front(dep);
}

View file

@ -83,6 +83,7 @@ namespace geode {
void updateModResources(Mod* mod);
void addSearchPaths();
void addNativeBinariesPath(ghc::filesystem::path const& path);
Result<> setup();
void forceReset();

View file

@ -46,8 +46,13 @@ Result<> Mod::Impl::setup() {
}
if (!m_resourcesLoaded) {
auto searchPathRoot = dirs::getModRuntimeDir() / m_metadata.getID() / "resources";
// TODO: why is this commented out
// CCFileUtils::get()->addSearchPath(searchPathRoot.string().c_str());
const auto binariesDir = searchPathRoot / m_metadata.getID() / "binaries" / PlatformID::toShortString(GEODE_PLATFORM_TARGET);
if (ghc::filesystem::exists(binariesDir))
LoaderImpl::get()->addNativeBinariesPath(binariesDir);
m_resourcesLoaded = true;
}

View file

@ -32,3 +32,7 @@ std::string Loader::Impl::getGameVersion() {
bool Loader::Impl::userTriedToLoadDLLs() const {
return false;
}
void Loader::Impl::addNativeBinariesPath(ghc::filesystem::path const& path) {
log::warn("LoaderImpl::addNativeBinariesPath not implement on this platform, not adding path {}", path.string());
}

View file

@ -135,3 +135,8 @@ void Loader::Impl::setupIPC() {
bool Loader::Impl::userTriedToLoadDLLs() const {
return false;
}
void Loader::Impl::addNativeBinariesPath(ghc::filesystem::path const& path) {
log::warn("LoaderImpl::addNativeBinariesPath not implement on this platform, not adding path {}", path.string());
}

View file

@ -74,3 +74,8 @@ bool Loader::Impl::userTriedToLoadDLLs() const {
return triedToLoadDLLs;
}
void Loader::Impl::addNativeBinariesPath(ghc::filesystem::path const& path) {
// adds a search directory for native dlls (the name is misleading)
SetDllDirectoryW(path.wstring().c_str());
}