StreamDB_Init cleanup

Removed unused third parameter from DevMsg call.
Added log for loading non override STBSP files.
This commit is contained in:
Kawe Mazidjatari 2022-06-23 20:08:07 +02:00
parent 965b4f4367
commit 2678fe2ec8
2 changed files with 8 additions and 7 deletions

View File

@ -10,12 +10,12 @@
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
// Purpose: loads and processes STBSP files // Purpose: loads and processes STBSP files
// (overrides level name if stbsp field has value in prerequisites file) // (overrides level name if stbsp field has value in prerequisites file)
// Input : *pszStreamDBFile - // Input : *pszLevelName -
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
void StreamDB_Init(const char* pszStreamDBFile) void StreamDB_Init(const char* pszLevelName)
{ {
ostringstream ostream; ostringstream ostream;
ostream << "platform\\scripts\\levels\\settings\\" << pszStreamDBFile << ".json"; ostream << "platform\\scripts\\levels\\settings\\" << pszLevelName << ".json";
fs::path fsPath = fs::current_path() /= ostream.str(); fs::path fsPath = fs::current_path() /= ostream.str();
if (FileExists(fsPath)) if (FileExists(fsPath))
@ -32,7 +32,7 @@ void StreamDB_Init(const char* pszStreamDBFile)
if (!jsIn["stbsp"].is_null()) if (!jsIn["stbsp"].is_null())
{ {
string svStreamDBFile = jsIn["stbsp"].get<string>(); string svStreamDBFile = jsIn["stbsp"].get<string>();
DevMsg(eDLL_T::MS, "%s: Loading override STBSP file '%s.stbsp'\n", __FUNCTION__, svStreamDBFile.c_str(), pszStreamDBFile); DevMsg(eDLL_T::MS, "%s: Loading override STBSP file '%s.stbsp'\n", __FUNCTION__, svStreamDBFile.c_str());
v_StreamDB_Init(svStreamDBFile.c_str()); v_StreamDB_Init(svStreamDBFile.c_str());
return; return;
} }
@ -40,10 +40,11 @@ void StreamDB_Init(const char* pszStreamDBFile)
} }
catch (const std::exception& ex) catch (const std::exception& ex)
{ {
DevMsg(eDLL_T::MS, "%s: Exception while parsing STBSP override: '%s'\n", __FUNCTION__, ex.what()); Warning(eDLL_T::MS, "%s: Exception while parsing STBSP override: '%s'\n", __FUNCTION__, ex.what());
} }
} }
v_StreamDB_Init(pszStreamDBFile); DevMsg(eDLL_T::MS, "%s: Loading STBSP file '%s.stbsp'\n", __FUNCTION__, pszLevelName);
v_StreamDB_Init(pszLevelName);
} }
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------

View File

@ -18,7 +18,7 @@ inline CMemory p_DrawStreamOverlay;
inline auto DrawStreamOverlay = p_DrawStreamOverlay.RCast<const char* (*)(void* thisptr, uint8_t* a2, void* unused, void* a4)>(); inline auto DrawStreamOverlay = p_DrawStreamOverlay.RCast<const char* (*)(void* thisptr, uint8_t* a2, void* unused, void* a4)>();
inline CMemory p_StreamDB_Init; inline CMemory p_StreamDB_Init;
inline auto v_StreamDB_Init = p_StreamDB_Init.RCast<void (*)(const char* pszStreamDbFile)>(); inline auto v_StreamDB_Init = p_StreamDB_Init.RCast<void (*)(const char* pszLevelName)>();
inline CMemory s_pRenderContext; inline CMemory s_pRenderContext;