2022-02-27 07:53:44 -05:00
|
|
|
#include <STDInclude.hpp>
|
2017-01-19 16:23:59 -05:00
|
|
|
|
|
|
|
namespace Components
|
|
|
|
{
|
|
|
|
void* RawFiles::LoadModdableRawfileFunc(const char* filename)
|
|
|
|
{
|
|
|
|
return Game::LoadModdableRawfile(0, filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
RawFiles::RawFiles()
|
|
|
|
{
|
|
|
|
Utils::Hook(0x632155, RawFiles::LoadModdableRawfileFunc, HOOK_CALL).install()->quick();
|
|
|
|
Utils::Hook(0x5FA46C, RawFiles::LoadModdableRawfileFunc, HOOK_CALL).install()->quick();
|
|
|
|
Utils::Hook(0x5FA4D6, RawFiles::LoadModdableRawfileFunc, HOOK_CALL).install()->quick();
|
|
|
|
Utils::Hook(0x6321EF, RawFiles::LoadModdableRawfileFunc, HOOK_CALL).install()->quick();
|
2017-04-08 09:32:51 -04:00
|
|
|
//Utils::Hook(0x630A88, RawFiles::LoadModdableRawfileFunc, HOOK_CALL).install()->quick(); // Arena parsing, handled by usermap hook
|
2017-01-19 16:23:59 -05:00
|
|
|
Utils::Hook(0x59A6F8, RawFiles::LoadModdableRawfileFunc, HOOK_CALL).install()->quick();
|
|
|
|
Utils::Hook(0x57F1E6, RawFiles::LoadModdableRawfileFunc, HOOK_CALL).install()->quick();
|
|
|
|
Utils::Hook(0x57ED36, RawFiles::LoadModdableRawfileFunc, HOOK_CALL).install()->quick();
|
2017-02-22 13:03:22 -05:00
|
|
|
//Utils::Hook(0x609832, RawFiles::LoadModdableRawfileFunc, HOOK_CALL).install()->quick();
|
2017-01-19 16:23:59 -05:00
|
|
|
|
|
|
|
// remove fs_game check for moddable rawfiles - allows non-fs_game to modify rawfiles
|
|
|
|
Utils::Hook::Nop(0x61AB76, 2);
|
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
Command::Add("dumpraw", [](Command::Params* params)
|
2017-01-19 16:23:59 -05:00
|
|
|
{
|
|
|
|
if (params->length() < 2)
|
|
|
|
{
|
|
|
|
Logger::Print("Specify a filename!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
FileSystem::File file(params->join(1));
|
|
|
|
if (file.exists())
|
|
|
|
{
|
|
|
|
Utils::IO::WriteFile("raw/" + file.getName(), file.getBuffer());
|
|
|
|
Logger::Print("File '%s' written to raw!\n", file.getName().data());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* data = Game::LoadModdableRawfile(0, file.getName().data());
|
|
|
|
|
|
|
|
if (data)
|
|
|
|
{
|
|
|
|
Utils::IO::WriteFile("raw/" + file.getName(), data);
|
|
|
|
Logger::Print("File '%s' written to raw!\n", file.getName().data());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Logger::Print("File '%s' does not exist!\n", file.getName().data());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|