[CommonPatch]: Changed the loading the files from miles.
This commit is contained in:
parent
16ad327121
commit
8379b23ec8
@ -246,6 +246,60 @@ namespace Components
|
|||||||
TextRenderer::UpdateGameFontsAndText();
|
TextRenderer::UpdateGameFontsAndText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CommonPatch::CheckMilesFiles()
|
||||||
|
{
|
||||||
|
if (!Utils::IO::DirectoryExists("iw3sp_data/miles"))
|
||||||
|
{
|
||||||
|
MessageBoxA(nullptr, "The 'iw3sp_data/miles' folder does not exist.", nullptr, MB_ICONERROR);
|
||||||
|
Utils::Library::Terminate();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> requiredFiles =
|
||||||
|
{
|
||||||
|
"milesEq.flt",
|
||||||
|
"mssds3d.flt",
|
||||||
|
"mssdsp.flt",
|
||||||
|
"msseax.flt",
|
||||||
|
"mssmp3.asi",
|
||||||
|
"mssvoice.asi"
|
||||||
|
};
|
||||||
|
|
||||||
|
std::filesystem::path basePath = std::filesystem::path(Dvars::Functions::Dvar_FindVar("fs_basepath")->current.string) / "iw3sp_data" / "miles";
|
||||||
|
const auto path = (basePath).generic_string();
|
||||||
|
const auto files = Utils::IO::ListFiles(path);
|
||||||
|
|
||||||
|
std::vector<std::string> unexpectedFiles;
|
||||||
|
for (const auto& file : files)
|
||||||
|
{
|
||||||
|
auto fileName = std::filesystem::path(file).filename().string();
|
||||||
|
if (std::find(requiredFiles.begin(), requiredFiles.end(), fileName) == requiredFiles.end())
|
||||||
|
{
|
||||||
|
unexpectedFiles.push_back(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!unexpectedFiles.empty())
|
||||||
|
{
|
||||||
|
std::string errorMessage = "In COD4 ROOT iw3sp_data/miles folder was spotted custom .asi files:\n";
|
||||||
|
for (const auto& file : unexpectedFiles)
|
||||||
|
{
|
||||||
|
errorMessage += file + "\n";
|
||||||
|
}
|
||||||
|
errorMessage += "For run the IW3SP-MOD need remove the above .asi files.";
|
||||||
|
MessageBoxA(nullptr, errorMessage.c_str(), nullptr, MB_ICONERROR);
|
||||||
|
Utils::Library::Terminate();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* __stdcall CommonPatch::AIL_set_redist_directory_Stub(const char* directory)
|
||||||
|
{
|
||||||
|
return Utils::Hook::Call<const char* (__stdcall)(const char*)>(0x63F7EA)("iw3sp_data/miles");
|
||||||
|
}
|
||||||
|
|
||||||
void CommonPatch::RunModStub()
|
void CommonPatch::RunModStub()
|
||||||
{
|
{
|
||||||
char mod[260];
|
char mod[260];
|
||||||
@ -468,6 +522,9 @@ namespace Components
|
|||||||
Dvars::allowCompactFolderForMod = Dvars::Register::Dvar_RegisterBool("allowCompactFolderForMod", "Enable/Disable compact loading of the mod files.", false, Game::saved);
|
Dvars::allowCompactFolderForMod = Dvars::Register::Dvar_RegisterBool("allowCompactFolderForMod", "Enable/Disable compact loading of the mod files.", false, Game::saved);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Change the folder for loading files from miles
|
||||||
|
Utils::Hook(0x591D15, AIL_set_redist_directory_Stub, HOOK_CALL).install()->quick();
|
||||||
|
|
||||||
// Hook for correct works the latched dvars
|
// Hook for correct works the latched dvars
|
||||||
Utils::Hook(0x5F68DB, R_RegisterSunDvarsStub, HOOK_CALL).install()->quick();
|
Utils::Hook(0x5F68DB, R_RegisterSunDvarsStub, HOOK_CALL).install()->quick();
|
||||||
|
|
||||||
|
@ -24,5 +24,8 @@ namespace Components
|
|||||||
static void RegisterConColorStub4();
|
static void RegisterConColorStub4();
|
||||||
static void RegisterConColorStub5();
|
static void RegisterConColorStub5();
|
||||||
static void LanguageSetValueConfig(int langIndex);
|
static void LanguageSetValueConfig(int langIndex);
|
||||||
|
|
||||||
|
static bool CheckMilesFiles();
|
||||||
|
static const char* __stdcall AIL_set_redist_directory_Stub(const char* directory);
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user