mirror of
https://github.com/JezuzLizard/T4SP-Server-Plugin.git
synced 2025-06-25 22:01:49 +00:00
Add pluto patches to compiler
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
#include <stdinc.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
#include "gsc.hpp"
|
||||
|
||||
#include "scheduler.hpp"
|
||||
|
||||
@ -107,6 +108,11 @@ namespace gsc
|
||||
{
|
||||
functions.insert_or_assign(name, function);
|
||||
}
|
||||
|
||||
const std::unordered_map<std::string, game::BuiltinFunction>& get()
|
||||
{
|
||||
return functions;
|
||||
}
|
||||
}
|
||||
|
||||
namespace method
|
||||
@ -115,6 +121,11 @@ namespace gsc
|
||||
{
|
||||
methods.insert_or_assign(name, method);
|
||||
}
|
||||
|
||||
const std::unordered_map<std::string, game::BuiltinMethod>& get()
|
||||
{
|
||||
return methods;
|
||||
}
|
||||
}
|
||||
|
||||
class component final : public component_interface
|
||||
@ -122,6 +133,7 @@ namespace gsc
|
||||
public:
|
||||
void post_unpack() override
|
||||
{
|
||||
// for when we dont use the decomp
|
||||
// custom gsc methods
|
||||
if (game::plutonium::scr_get_method_stub != nullptr)
|
||||
{
|
||||
|
@ -5,10 +5,12 @@ namespace gsc
|
||||
namespace function
|
||||
{
|
||||
void add(const std::string& name, const game::BuiltinFunction function);
|
||||
const std::unordered_map<std::string, game::BuiltinFunction>& get();
|
||||
}
|
||||
|
||||
namespace method
|
||||
{
|
||||
void add(const std::string& name, const game::BuiltinMethod method);
|
||||
const std::unordered_map<std::string, game::BuiltinMethod>& get();
|
||||
}
|
||||
}
|
@ -139,15 +139,13 @@ namespace signatures
|
||||
|
||||
std::string err_reason;
|
||||
|
||||
std::string get_err_reason()
|
||||
const std::string& get_err_reason()
|
||||
{
|
||||
return err_reason;
|
||||
}
|
||||
|
||||
bool process_printf()
|
||||
bool process_printf(std::unordered_map<std::string, std::string> &cache_info)
|
||||
{
|
||||
auto cache_info = get_cache_info_for_our_version();
|
||||
|
||||
if (cache_info.contains("printf"))
|
||||
{
|
||||
game::plutonium::printf.set(std::atoi(cache_info.at("printf").c_str()));
|
||||
@ -165,7 +163,6 @@ namespace signatures
|
||||
game::plutonium::printf.set(string_ref + 4 + 5 + offset);
|
||||
|
||||
cache_info.insert_or_assign("printf", std::to_string(string_ref + 4 + 5 + offset));
|
||||
save_cache_info_for_our_version(cache_info);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -201,6 +198,12 @@ namespace signatures
|
||||
{
|
||||
size_t addr1;
|
||||
size_t addr2;
|
||||
auto cache_info = get_cache_info_for_our_version();
|
||||
|
||||
if (!process_printf(cache_info))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SAFE_SET_PLUTO_SYMBOL_DOUBLE(load_custom_script_func, 0x689C80, 0x6);
|
||||
SAFE_SET_PLUTO_SYMBOL_DOUBLE(script_preprocess, 0x689BCF, 0x2);
|
||||
@ -210,9 +213,16 @@ namespace signatures
|
||||
SAFE_SET_PLUTO_SYMBOL_DOUBLE(scr_execentthread_update_codepos_func, 0x699640, 0x7);
|
||||
SAFE_SET_PLUTO_SYMBOL_DOUBLE(scr_addexecthread_update_codepos_func, 0x699730, 0x7);
|
||||
SAFE_SET_PLUTO_SYMBOL_DOUBLE(at_codepose_va, 0x68B3A5, 0xA);
|
||||
SAFE_SET_PLUTO_SYMBOL_DOUBLE(store_func_codepos, 0x688909, 0x3);
|
||||
|
||||
SAFE_SET_PLUTO_SYMBOL(cscr_get_function_hook, 0x682DC0);
|
||||
SAFE_SET_PLUTO_SYMBOL(scr_get_function_stub, 0x682D99);
|
||||
SAFE_SET_PLUTO_SYMBOL(scr_get_method_stub, 0x683043);
|
||||
SAFE_SET_PLUTO_SYMBOL(cscr_get_method_hook, 0x68305C);
|
||||
SAFE_SET_PLUTO_SYMBOL_DOUBLE(scr_get_method_hook, 0x683043, 0x4);
|
||||
SAFE_SET_PLUTO_SYMBOL_DOUBLE(scr_get_function_hook, 0x682D99, 0x8);
|
||||
|
||||
save_cache_info_for_our_version(cache_info);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -221,6 +231,6 @@ namespace signatures
|
||||
{
|
||||
utils::cryptography::des::set_key("694201337");
|
||||
|
||||
return handle_funcs() && process_printf();
|
||||
return handle_funcs();
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,6 @@
|
||||
|
||||
namespace signatures
|
||||
{
|
||||
std::string get_err_reason();
|
||||
const std::string& get_err_reason();
|
||||
bool process();
|
||||
}
|
Reference in New Issue
Block a user