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
|
|
|
{
|
2022-03-17 14:50:20 -04:00
|
|
|
if (params->size() < 2)
|
2017-01-19 16:23:59 -05:00
|
|
|
{
|
|
|
|
Logger::Print("Specify a filename!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
FileSystem::File file(params->join(1));
|
|
|
|
if (file.exists())
|
|
|
|
{
|
|
|
|
Utils::IO::WriteFile("raw/" + file.getName(), file.getBuffer());
|
2022-06-12 17:07:53 -04:00
|
|
|
Logger::Print("File '{}' written to raw!\n", file.getName());
|
2017-01-19 16:23:59 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* data = Game::LoadModdableRawfile(0, file.getName().data());
|
|
|
|
|
|
|
|
if (data)
|
|
|
|
{
|
|
|
|
Utils::IO::WriteFile("raw/" + file.getName(), data);
|
2022-06-12 17:07:53 -04:00
|
|
|
Logger::Print("File '{}' written to raw!\n", file.getName());
|
2017-01-19 16:23:59 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-06-12 17:07:53 -04:00
|
|
|
Logger::Print("File '{}' does not exist!\n", file.getName());
|
2017-01-19 16:23:59 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|