iw4x-client/src/Components/Modules/FileSystem.cpp

44 lines
801 B
C++
Raw Normal View History

#include "STDInclude.hpp"
2015-12-23 21:26:46 -05:00
namespace Components
{
void FileSystem::File::Read()
{
char* buffer = nullptr;
int size = Game::FS_ReadFile(this->FilePath.data(), &buffer);
this->Buffer.clear();
if (size < 0)
{
if (buffer)
{
Game::FS_FreeFile(buffer);
}
}
else
{
this->Buffer.append(buffer, size);
Game::FS_FreeFile(buffer);
}
}
2016-01-02 12:28:47 -05:00
int FileSystem::ExecIsFSStub(const char* execFilename)
{
return !File(execFilename).Exists();
}
2015-12-23 21:26:46 -05:00
FileSystem::FileSystem()
{
2016-01-02 12:28:47 -05:00
// Filesystem config checks
Utils::Hook(0x6098FD, FileSystem::ExecIsFSStub, HOOK_CALL).Install()->Quick();
2015-12-23 21:26:46 -05:00
2016-01-02 12:28:47 -05:00
// exec whitelist removal (YAYFINITY WARD)
Utils::Hook::Nop(0x609685, 5);
Utils::Hook::Nop(0x60968C, 2);
2016-01-03 22:25:15 -05:00
// ignore 'no iwd files found in main'
Utils::Hook::Nop(0x642A4B, 5);
2015-12-23 21:26:46 -05:00
}
}