aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-05-11 01:54:37 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-05-11 01:54:37 +0100
commit2dba51a6a281573ea40cc52c80d10155387d4720 (patch)
treed6040ec27d365b0facc18f6f1b761ff5c0b403db
parent5644c1aaabb9487ef2a4c3e5110c8a21bf7b6a59 (diff)
downloadNorthstarLauncher-2dba51a6a281573ea40cc52c80d10155387d4720.tar.gz
NorthstarLauncher-2dba51a6a281573ea40cc52c80d10155387d4720.zip
normalise mod fs paths to be lowercase
-rw-r--r--NorthstarDedicatedTest/audio.cpp4
-rw-r--r--NorthstarDedicatedTest/filesystem.cpp186
-rw-r--r--NorthstarDedicatedTest/filesystem.h9
-rw-r--r--NorthstarDedicatedTest/keyvalues.cpp4
-rw-r--r--NorthstarDedicatedTest/logging.cpp5
-rw-r--r--NorthstarDedicatedTest/modmanager.cpp39
-rw-r--r--NorthstarDedicatedTest/modmanager.h1
-rw-r--r--NorthstarDedicatedTest/pdef.cpp2
-rw-r--r--NorthstarDedicatedTest/rpakfilesystem.cpp3
-rw-r--r--NorthstarDedicatedTest/scriptsrson.cpp2
-rw-r--r--NorthstarDedicatedTest/squirrel.cpp4
11 files changed, 135 insertions, 124 deletions
diff --git a/NorthstarDedicatedTest/audio.cpp b/NorthstarDedicatedTest/audio.cpp
index 20ea8467..f9db1ee6 100644
--- a/NorthstarDedicatedTest/audio.cpp
+++ b/NorthstarDedicatedTest/audio.cpp
@@ -230,10 +230,8 @@ EventOverrideData::EventOverrideData(const std::string& data, const fs::path& pa
}
// read from after the header first to preserve the empty header, then read the header last
- wavStream.seekg(sizeof(EMPTY_WAVE), std::ios::beg);
- wavStream.read(&data[sizeof(EMPTY_WAVE)], fileSize - sizeof(EMPTY_WAVE));
wavStream.seekg(0, std::ios::beg);
- wavStream.read(data, sizeof(EMPTY_WAVE));
+ wavStream.read(data, fileSize);
wavStream.close();
spdlog::info("Finished async read of audio sample {}", pathString);
diff --git a/NorthstarDedicatedTest/filesystem.cpp b/NorthstarDedicatedTest/filesystem.cpp
index 3410bdd4..72d7d4fc 100644
--- a/NorthstarDedicatedTest/filesystem.cpp
+++ b/NorthstarDedicatedTest/filesystem.cpp
@@ -8,72 +8,58 @@
#include <iostream>
#include <sstream>
-// hook forward declares
-typedef FileHandle_t (*ReadFileFromVPKType)(VPKData* vpkInfo, __int64* b, char* filename);
-ReadFileFromVPKType readFileFromVPK;
-FileHandle_t ReadFileFromVPKHook(VPKData* vpkInfo, __int64* b, char* filename);
-
-typedef bool (*ReadFromCacheType)(IFileSystem* filesystem, char* path, void* result);
-ReadFromCacheType readFromCache;
-bool ReadFromCacheHook(IFileSystem* filesystem, char* path, void* result);
+using namespace R2FS;
-typedef void (*AddSearchPathType)(IFileSystem* fileSystem, const char* pPath, const char* pathID, SearchPathAdd_t addType);
-AddSearchPathType addSearchPathOriginal;
-void AddSearchPathHook(IFileSystem* fileSystem, const char* pPath, const char* pathID, SearchPathAdd_t addType);
-
-typedef FileHandle_t (*ReadFileFromFilesystemType)(
- IFileSystem* filesystem, const char* pPath, const char* pOptions, int64_t a4, uint32_t a5);
-ReadFileFromFilesystemType readFileFromFilesystem;
-FileHandle_t ReadFileFromFilesystemHook(IFileSystem* filesystem, const char* pPath, const char* pOptions, int64_t a4, uint32_t a5);
-
-typedef VPKData* (*MountVPKType)(IFileSystem* fileSystem, const char* vpkPath);
-MountVPKType mountVPK;
-VPKData* MountVPKHook(IFileSystem* fileSystem, const char* vpkPath);
+bool bReadingOriginalFile = false;
+std::string sCurrentModPath;
-bool readingOriginalFile;
-std::string currentModPath;
-SourceInterface<IFileSystem>* g_Filesystem;
+ConVar* Cvar_ns_fs_log_reads;
-ON_DLL_LOAD("filesystem_stdio.dll", Filesystem, [](HMODULE baseAddress)
+namespace R2FS
{
- g_Filesystem = new SourceInterface<IFileSystem>("filesystem_stdio.dll", "VFileSystem017");
+ std::string ReadVPKFile(const char* path)
+ {
+ // read scripts.rson file, todo: check if this can be overwritten
+ FileHandle_t fileHandle = (*g_pFilesystem)->m_vtable2->Open(&(*g_pFilesystem)->m_vtable2, path, "rb", "GAME", 0);
- // create hooks
- HookEnabler hook;
- ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x5CBA0, &ReadFileFromVPKHook, reinterpret_cast<LPVOID*>(&readFileFromVPK));
- ENABLER_CREATEHOOK(hook, (*g_Filesystem)->m_vtable->ReadFromCache, &ReadFromCacheHook, reinterpret_cast<LPVOID*>(&readFromCache));
- ENABLER_CREATEHOOK(
- hook, (*g_Filesystem)->m_vtable->AddSearchPath, &AddSearchPathHook, reinterpret_cast<LPVOID*>(&addSearchPathOriginal));
- ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x15F20, &ReadFileFromFilesystemHook, reinterpret_cast<LPVOID*>(&readFileFromFilesystem));
- ENABLER_CREATEHOOK(hook, (*g_Filesystem)->m_vtable->MountVPK, &MountVPKHook, reinterpret_cast<LPVOID*>(&mountVPK));
-})
+ std::stringstream fileStream;
+ int bytesRead = 0;
+ char data[4096];
+ do
+ {
+ bytesRead = (*g_pFilesystem)->m_vtable2->Read(&(*g_pFilesystem)->m_vtable2, data, (int)std::size(data), fileHandle);
+ fileStream.write(data, bytesRead);
+ } while (bytesRead == std::size(data));
-std::string ReadVPKFile(const char* path)
-{
- // read scripts.rson file, todo: check if this can be overwritten
- FileHandle_t fileHandle = (*g_Filesystem)->m_vtable2->Open(&(*g_Filesystem)->m_vtable2, path, "rb", "GAME", 0);
+ (*g_pFilesystem)->m_vtable2->Close(*g_pFilesystem, fileHandle);
- std::stringstream fileStream;
- int bytesRead = 0;
- char data[4096];
- do
+ return fileStream.str();
+ }
+
+ std::string ReadVPKOriginalFile(const char* path)
{
- bytesRead = (*g_Filesystem)->m_vtable2->Read(&(*g_Filesystem)->m_vtable2, data, (int)std::size(data), fileHandle);
- fileStream.write(data, bytesRead);
- } while (bytesRead == std::size(data));
+ bReadingOriginalFile = true;
+ std::string ret = ReadVPKFile(path);
+ bReadingOriginalFile = false;
- (*g_Filesystem)->m_vtable2->Close(*g_Filesystem, fileHandle);
+ return ret;
+ }
- return fileStream.str();
+ SourceInterface<IFileSystem>* g_pFilesystem;
}
-std::string ReadVPKOriginalFile(const char* path)
+typedef void (*AddSearchPathType)(IFileSystem* fileSystem, const char* pPath, const char* pathID, SearchPathAdd_t addType);
+AddSearchPathType AddSearchPath;
+void AddSearchPathHook(IFileSystem* fileSystem, const char* pPath, const char* pathID, SearchPathAdd_t addType)
{
- readingOriginalFile = true;
- std::string ret = ReadVPKFile(path);
- readingOriginalFile = false;
+ AddSearchPath(fileSystem, pPath, pathID, addType);
- return ret;
+ // make sure current mod paths are at head
+ if (!strcmp(pathID, "GAME") && sCurrentModPath.compare(pPath) && addType == PATH_ADD_TO_HEAD)
+ {
+ AddSearchPath(fileSystem, sCurrentModPath.c_str(), "GAME", PATH_ADD_TO_HEAD);
+ AddSearchPath(fileSystem, GetCompiledAssetsPath().string().c_str(), "GAME", PATH_ADD_TO_HEAD);
+ }
}
void SetNewModSearchPaths(Mod* mod)
@@ -82,30 +68,30 @@ void SetNewModSearchPaths(Mod* mod)
// in the future we could also determine whether the file we're setting paths for needs a mod dir, or compiled assets
if (mod != nullptr)
{
- if ((fs::absolute(mod->ModDirectory) / MOD_OVERRIDE_DIR).string().compare(currentModPath))
+ if ((fs::absolute(mod->ModDirectory) / MOD_OVERRIDE_DIR).string().compare(sCurrentModPath))
{
- spdlog::info("changing mod search path from {} to {}", currentModPath, mod->ModDirectory.string());
+ spdlog::info("changing mod search path from {} to {}", sCurrentModPath, mod->ModDirectory.string());
- addSearchPathOriginal(
- &*(*g_Filesystem), (fs::absolute(mod->ModDirectory) / MOD_OVERRIDE_DIR).string().c_str(), "GAME", PATH_ADD_TO_HEAD);
- currentModPath = (fs::absolute(mod->ModDirectory) / MOD_OVERRIDE_DIR).string();
+ AddSearchPath(
+ &*(*g_pFilesystem), (fs::absolute(mod->ModDirectory) / MOD_OVERRIDE_DIR).string().c_str(), "GAME", PATH_ADD_TO_HEAD);
+ sCurrentModPath = (fs::absolute(mod->ModDirectory) / MOD_OVERRIDE_DIR).string();
}
}
else // push compiled to head
- addSearchPathOriginal(&*(*g_Filesystem), fs::absolute(GetCompiledAssetsPath()).string().c_str(), "GAME", PATH_ADD_TO_HEAD);
+ AddSearchPath(&*(*g_pFilesystem), fs::absolute(GetCompiledAssetsPath()).string().c_str(), "GAME", PATH_ADD_TO_HEAD);
}
-bool TryReplaceFile(char* path, bool shouldCompile)
+bool TryReplaceFile(const char* pPath, bool shouldCompile)
{
- if (readingOriginalFile)
+ if (bReadingOriginalFile)
return false;
if (shouldCompile)
- (*g_ModManager).CompileAssetsForFile(path);
+ g_ModManager->CompileAssetsForFile(pPath);
// idk how efficient the lexically normal check is
// can't just set all /s in path to \, since some paths aren't in writeable memory
- auto file = g_ModManager->m_modFiles.find(fs::path(path).lexically_normal().string());
+ auto file = g_ModManager->m_modFiles.find(g_ModManager->NormaliseModFilePath(fs::path(pPath)));
if (file != g_ModManager->m_modFiles.end())
{
SetNewModSearchPaths(file->second.owningMod);
@@ -115,10 +101,22 @@ bool TryReplaceFile(char* path, bool shouldCompile)
return false;
}
+typedef bool (*ReadFromCacheType)(IFileSystem* filesystem, char* path, void* result);
+ReadFromCacheType ReadFromCache;
+bool ReadFromCacheHook(IFileSystem* filesystem, char* pPath, void* result)
+{
+ if (TryReplaceFile(pPath, false))
+ return false;
+
+ return ReadFromCache(filesystem, pPath, result);
+}
+
+typedef FileHandle_t (*ReadFileFromVPKType)(VPKData* vpkInfo, __int64* b, char* filename);
+ReadFileFromVPKType ReadFileFromVPK;
FileHandle_t ReadFileFromVPKHook(VPKData* vpkInfo, __int64* b, char* filename)
{
// move this to a convar at some point when we can read them in native
- // spdlog::info("ReadFileFromVPKHook {} {}", filename, vpkInfo->path);
+ //spdlog::info("ReadFileFromVPKHook {} {}", filename, vpkInfo->path);
// there is literally never any reason to compile here, since we'll always compile in ReadFileFromFilesystemHook in the same codepath
// this is called
@@ -128,46 +126,30 @@ FileHandle_t ReadFileFromVPKHook(VPKData* vpkInfo, __int64* b, char* filename)
return b;
}
- return readFileFromVPK(vpkInfo, b, filename);
-}
-
-bool ReadFromCacheHook(IFileSystem* filesystem, char* path, void* result)
-{
- // move this to a convar at some point when we can read them in native
- // spdlog::info("ReadFromCacheHook {}", path);
-
- if (TryReplaceFile(path, true))
- return false;
-
- return readFromCache(filesystem, path, result);
-}
+ return ReadFileFromVPK(vpkInfo, b, filename);
+}
-void AddSearchPathHook(IFileSystem* fileSystem, const char* pPath, const char* pathID, SearchPathAdd_t addType)
-{
- addSearchPathOriginal(fileSystem, pPath, pathID, addType);
-
- // make sure current mod paths are at head
- if (!strcmp(pathID, "GAME") && currentModPath.compare(pPath) && addType == PATH_ADD_TO_HEAD)
- {
- addSearchPathOriginal(fileSystem, currentModPath.c_str(), "GAME", PATH_ADD_TO_HEAD);
- addSearchPathOriginal(fileSystem, GetCompiledAssetsPath().string().c_str(), "GAME", PATH_ADD_TO_HEAD);
- }
-}
-
-FileHandle_t ReadFileFromFilesystemHook(IFileSystem* filesystem, const char* pPath, const char* pOptions, int64_t a4, uint32_t a5)
+typedef FileHandle_t (*CBaseFileSystem__OpenExType)(
+ IFileSystem* filesystem, const char* pPath, const char* pOptions, uint32_t flags, const char* pPathID, char** ppszResolvedFilename);
+CBaseFileSystem__OpenExType CBaseFileSystem__OpenEx;
+FileHandle_t CBaseFileSystem__OpenExHook(IFileSystem* filesystem, const char* pPath, const char* pOptions, uint32_t flags, const char* pPathID, char **ppszResolvedFilename)
{
+ //if (Cvar_ns_fs_log_reads->GetBool())
+
// this isn't super efficient, but it's necessary, since calling addsearchpath in readfilefromvpk doesn't work, possibly refactor later
// it also might be possible to hook functions that are called later, idk look into callstack for ReadFileFromVPK
- if (!readingOriginalFile)
- TryReplaceFile((char*)pPath, true);
+ if (!bReadingOriginalFile)
+ TryReplaceFile(pPath, true);
- return readFileFromFilesystem(filesystem, pPath, pOptions, a4, a5);
+ return CBaseFileSystem__OpenEx(filesystem, pPath, pOptions, flags, pPathID, ppszResolvedFilename);
}
+typedef VPKData* (*MountVPKType)(IFileSystem* fileSystem, const char* vpkPath);
+MountVPKType MountVPK;
VPKData* MountVPKHook(IFileSystem* fileSystem, const char* vpkPath)
{
spdlog::info("MountVPK {}", vpkPath);
- VPKData* ret = mountVPK(fileSystem, vpkPath);
+ VPKData* ret = MountVPK(fileSystem, vpkPath);
for (Mod mod : g_ModManager->m_loadedMods)
{
@@ -187,11 +169,25 @@ VPKData* MountVPKHook(IFileSystem* fileSystem, const char* vpkPath)
continue;
}
- VPKData* loaded = mountVPK(fileSystem, vpkEntry.m_sVpkPath.c_str());
+ VPKData* loaded = MountVPK(fileSystem, vpkEntry.m_sVpkPath.c_str());
if (!ret) // this is primarily for map vpks and stuff, so the map's vpk is what gets returned from here
ret = loaded;
}
}
return ret;
-} \ No newline at end of file
+}
+
+ON_DLL_LOAD("filesystem_stdio.dll", Filesystem, [](HMODULE baseAddress)
+{
+ R2FS::g_pFilesystem = new SourceInterface<IFileSystem>("filesystem_stdio.dll", "VFileSystem017");
+
+ // create hooks
+ HookEnabler hook;
+ ENABLER_CREATEHOOK(hook, (*g_pFilesystem)->m_vtable->ReadFromCache, &ReadFromCacheHook, reinterpret_cast<LPVOID*>(&ReadFromCache));
+ ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x5CBA0, &ReadFileFromVPKHook, reinterpret_cast<LPVOID*>(&ReadFileFromVPK));
+ ENABLER_CREATEHOOK(
+ hook, (char*)baseAddress + 0x15F50, &CBaseFileSystem__OpenExHook, reinterpret_cast<LPVOID*>(&CBaseFileSystem__OpenEx));
+ ENABLER_CREATEHOOK(hook, (*g_pFilesystem)->m_vtable->AddSearchPath, &AddSearchPathHook, reinterpret_cast<LPVOID*>(&AddSearchPath));
+ ENABLER_CREATEHOOK(hook, (*g_pFilesystem)->m_vtable->MountVPK, &MountVPKHook, reinterpret_cast<LPVOID*>(&MountVPK));
+}) \ No newline at end of file
diff --git a/NorthstarDedicatedTest/filesystem.h b/NorthstarDedicatedTest/filesystem.h
index 803a2d23..5348cd51 100644
--- a/NorthstarDedicatedTest/filesystem.h
+++ b/NorthstarDedicatedTest/filesystem.h
@@ -67,7 +67,10 @@ class IFileSystem
VTable2* m_vtable2;
};
-std::string ReadVPKFile(const char* path);
-std::string ReadVPKOriginalFile(const char* path);
+namespace R2FS
+{
+ extern SourceInterface<IFileSystem>* g_pFilesystem;
-extern SourceInterface<IFileSystem>* g_Filesystem; \ No newline at end of file
+ std::string ReadVPKFile(const char* path);
+ std::string ReadVPKOriginalFile(const char* path);
+} // namespace R2FS \ No newline at end of file
diff --git a/NorthstarDedicatedTest/keyvalues.cpp b/NorthstarDedicatedTest/keyvalues.cpp
index a2c7281a..0d6ae964 100644
--- a/NorthstarDedicatedTest/keyvalues.cpp
+++ b/NorthstarDedicatedTest/keyvalues.cpp
@@ -40,7 +40,7 @@ void ModManager::TryBuildKeyValues(const char* filename)
{
spdlog::info("Building KeyValues for file {}", filename);
- std::string normalisedPath = fs::path(filename).lexically_normal().string();
+ std::string normalisedPath = g_ModManager->NormaliseModFilePath(fs::path(filename));
fs::path compiledPath = GetCompiledAssetsPath() / filename;
fs::path compiledDir = compiledPath.parent_path();
fs::create_directories(compiledDir);
@@ -87,7 +87,7 @@ void ModManager::TryBuildKeyValues(const char* filename)
newKvs += "\"\n";
// load original file, so we can parse out the name of the root obj (e.g. WeaponData for weapons)
- std::string originalFile = ReadVPKOriginalFile(filename);
+ std::string originalFile = R2FS::ReadVPKOriginalFile(filename);
if (!originalFile.length())
{
diff --git a/NorthstarDedicatedTest/logging.cpp b/NorthstarDedicatedTest/logging.cpp
index 0c7e374f..39babf29 100644
--- a/NorthstarDedicatedTest/logging.cpp
+++ b/NorthstarDedicatedTest/logging.cpp
@@ -236,8 +236,9 @@ void InitialiseLogging()
hExceptionFilter = AddVectoredExceptionHandler(TRUE, ExceptionFilter);
AllocConsole();
- freopen("CONOUT$", "w", stdout);
- freopen("CONOUT$", "w", stderr);
+ // seem to cause issues with console log initialisation occasionally
+ //freopen("CONOUT$", "w", stdout);
+ //freopen("CONOUT$", "w", stderr);
spdlog::default_logger()->set_pattern("[%H:%M:%S] [%l] %v");
SetConsoleCtrlHandler(ConsoleHandlerRoutine, true);
diff --git a/NorthstarDedicatedTest/modmanager.cpp b/NorthstarDedicatedTest/modmanager.cpp
index 7aaf5846..dd8e55cd 100644
--- a/NorthstarDedicatedTest/modmanager.cpp
+++ b/NorthstarDedicatedTest/modmanager.cpp
@@ -376,7 +376,7 @@ void ModManager::LoadMods()
modVpk.m_sVpkPath = vpkName;
if (m_hasLoadedMods && modVpk.m_bAutoLoad)
- (*g_Filesystem)->m_vtable->MountVPK(*g_Filesystem, vpkName.c_str());
+ (*R2FS::g_pFilesystem)->m_vtable->MountVPK(*R2FS::g_pFilesystem, vpkName.c_str());
}
}
}
@@ -444,7 +444,7 @@ void ModManager::LoadMods()
{
if (fs::is_regular_file(file))
{
- std::string kvStr = file.path().lexically_relative(mod.ModDirectory / "keyvalues").lexically_normal().string();
+ std::string kvStr = g_ModManager->NormaliseModFilePath(file.path().lexically_relative(mod.ModDirectory / "keyvalues"));
mod.KeyValues.emplace(STR_HASH(kvStr), kvStr);
}
}
@@ -502,14 +502,14 @@ void ModManager::LoadMods()
{
for (fs::directory_entry file : fs::recursive_directory_iterator(m_loadedMods[i].ModDirectory / MOD_OVERRIDE_DIR))
{
- fs::path path = file.path().lexically_relative(m_loadedMods[i].ModDirectory / MOD_OVERRIDE_DIR).lexically_normal();
-
- if (file.is_regular_file() && m_modFiles.find(path.string()) == m_modFiles.end())
+ std::string path =
+ g_ModManager->NormaliseModFilePath(file.path().lexically_relative(m_loadedMods[i].ModDirectory / MOD_OVERRIDE_DIR));
+ if (file.is_regular_file() && m_modFiles.find(path) == m_modFiles.end())
{
ModOverrideFile modFile;
modFile.owningMod = &m_loadedMods[i];
modFile.path = path;
- m_modFiles.insert(std::make_pair(path.string(), modFile));
+ m_modFiles.insert(std::make_pair(path, modFile));
}
}
}
@@ -585,6 +585,17 @@ void ModManager::UnloadMods()
m_loadedMods.clear();
}
+std::string ModManager::NormaliseModFilePath(const fs::path path)
+{
+ std::string str = path.lexically_normal().string();
+ // go to lowercase
+ for (char& c : str)
+ if (c <= 'Z' && c >= 'A')
+ c = c - ('Z' - 'z');
+
+ return str;
+}
+
void ModManager::CompileAssetsForFile(const char* filename)
{
size_t fileHash = STR_HASH(fs::path(filename).lexically_normal().string());
@@ -615,13 +626,6 @@ void ConCommand_reload_mods(const CCommand& args)
g_ModManager->LoadMods();
}
-ON_DLL_LOAD_RELIESON("engine.dll", ModManager, ConCommand, [](HMODULE baseAddress)
-{
- g_ModManager = new ModManager;
-
- RegisterConCommand("reload_mods", ConCommand_reload_mods, "reloads mods", FCVAR_NONE);
-})
-
fs::path GetModFolderPath()
{
return fs::path(GetNorthstarPrefix() + MOD_FOLDER_SUFFIX);
@@ -629,4 +633,11 @@ fs::path GetModFolderPath()
fs::path GetCompiledAssetsPath()
{
return fs::path(GetNorthstarPrefix() + COMPILED_ASSETS_SUFFIX);
-} \ No newline at end of file
+}
+
+ON_DLL_LOAD_RELIESON("engine.dll", ModManager, ConCommand, [](HMODULE baseAddress)
+{
+ g_ModManager = new ModManager;
+
+ RegisterConCommand("reload_mods", ConCommand_reload_mods, "reloads mods", FCVAR_NONE);
+}) \ No newline at end of file
diff --git a/NorthstarDedicatedTest/modmanager.h b/NorthstarDedicatedTest/modmanager.h
index ac7f7425..faaba7db 100644
--- a/NorthstarDedicatedTest/modmanager.h
+++ b/NorthstarDedicatedTest/modmanager.h
@@ -132,6 +132,7 @@ class ModManager
ModManager();
void LoadMods();
void UnloadMods();
+ std::string NormaliseModFilePath(const fs::path path);
void CompileAssetsForFile(const char* filename);
// compile asset type stuff, these are done in files under Mods/Compiled/
diff --git a/NorthstarDedicatedTest/pdef.cpp b/NorthstarDedicatedTest/pdef.cpp
index 86642874..fdd1dfa4 100644
--- a/NorthstarDedicatedTest/pdef.cpp
+++ b/NorthstarDedicatedTest/pdef.cpp
@@ -14,7 +14,7 @@ void ModManager::BuildPdef()
fs::path MOD_PDEF_PATH = fs::path(GetCompiledAssetsPath() / MOD_PDEF_SUFFIX);
fs::remove(MOD_PDEF_PATH);
- std::string pdef = ReadVPKOriginalFile(VPK_PDEF_PATH);
+ std::string pdef = R2FS::ReadVPKOriginalFile(VPK_PDEF_PATH);
for (Mod& mod : m_loadedMods)
{
diff --git a/NorthstarDedicatedTest/rpakfilesystem.cpp b/NorthstarDedicatedTest/rpakfilesystem.cpp
index c9f01b89..03df9917 100644
--- a/NorthstarDedicatedTest/rpakfilesystem.cpp
+++ b/NorthstarDedicatedTest/rpakfilesystem.cpp
@@ -188,7 +188,8 @@ void* ReadFullFileFromDiskHook(const char* requestedPath, void* a2)
spdlog::info("LoadStreamBsp: {}", filename.string());
// resolve modded stbsp path so we can load mod stbsps
- auto modFile = g_ModManager->m_modFiles.find(fs::path("maps" / filename).lexically_normal().string());
+
+ auto modFile = g_ModManager->m_modFiles.find(g_ModManager->NormaliseModFilePath(fs::path("maps" / filename)));
if (modFile != g_ModManager->m_modFiles.end())
{
// need to allocate a new string for this
diff --git a/NorthstarDedicatedTest/scriptsrson.cpp b/NorthstarDedicatedTest/scriptsrson.cpp
index 25a2f5f9..6de78d12 100644
--- a/NorthstarDedicatedTest/scriptsrson.cpp
+++ b/NorthstarDedicatedTest/scriptsrson.cpp
@@ -12,7 +12,7 @@ void ModManager::BuildScriptsRson()
fs::path MOD_SCRIPTS_RSON_PATH = fs::path(GetCompiledAssetsPath() / MOD_SCRIPTS_RSON_SUFFIX);
fs::remove(MOD_SCRIPTS_RSON_PATH);
- std::string scriptsRson = ReadVPKOriginalFile(VPK_SCRIPTS_RSON_PATH);
+ std::string scriptsRson = R2FS::ReadVPKOriginalFile(VPK_SCRIPTS_RSON_PATH);
scriptsRson += "\n\n// START MODDED SCRIPT CONTENT\n\n"; // newline before we start custom stuff
for (Mod& mod : m_loadedMods)
diff --git a/NorthstarDedicatedTest/squirrel.cpp b/NorthstarDedicatedTest/squirrel.cpp
index ea23672a..32092ec9 100644
--- a/NorthstarDedicatedTest/squirrel.cpp
+++ b/NorthstarDedicatedTest/squirrel.cpp
@@ -143,8 +143,8 @@ template <ScriptContext context> void ScriptCompileErrorHook(void* sqvm, const c
.c_str(),
cmd_source_t::kCommandSrcCode);
- if (realContext == ScriptContext::UI)
- Cbuf_AddText(Cbuf_GetCurrentPlayer(), "showconsole", cmd_source_t::kCommandSrcCode); // likely temp: show console so user can see any errors
+ if (realContext == ScriptContext::UI) // likely temp: show console so user can see any errors
+ Cbuf_AddText(Cbuf_GetCurrentPlayer(), "showconsole", cmd_source_t::kCommandSrcCode);
}
// dont call the original function since it kills game lol