mirror of
https://github.com/JezuzLizard/T4SP-Server-Plugin.git
synced 2025-04-19 13:12:53 +00:00
Add pluto sdk
This commit is contained in:
parent
b0ccd678d3
commit
4c77045add
@ -1,40 +1,11 @@
|
||||
#include <stdinc.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
#include "component/signatures.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
PLUTONIUM_API plutonium::sdk::plugin* PLUTONIUM_CALLBACK on_initialize()
|
||||
{
|
||||
return plugin::get();
|
||||
}
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE /*module_*/, DWORD ul_reason_for_call, LPVOID /*reserved_*/)
|
||||
{
|
||||
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
if (game::environment::t4sp())
|
||||
{
|
||||
if (!signatures::process())
|
||||
{
|
||||
MessageBoxA(NULL,
|
||||
std::format("This version of t4sp-server-plugin is outdated.\n" \
|
||||
"Download the latest dll from here: https://github.com/JezuzLizard/T4SP-Server-Plugin/releases\n" \
|
||||
"'{}' failed", signatures::get_err_reason()).c_str(),
|
||||
"ERROR", MB_ICONERROR);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (game::plutonium::printf.get() != nullptr)
|
||||
{
|
||||
utils::hook::jump(reinterpret_cast<uintptr_t>(&printf), game::plutonium::printf);
|
||||
}
|
||||
|
||||
component_loader::post_unpack();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBoxA(nullptr, "Unsupported game executable. (t4sp is only supported)", "ERROR, BRO!", 0);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
73
src/plugin.cpp
Normal file
73
src/plugin.cpp
Normal file
@ -0,0 +1,73 @@
|
||||
#include <stdinc.hpp>
|
||||
#include "component/signatures.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
namespace plugin
|
||||
{
|
||||
std::uint32_t plugin::plugin_version()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char* plugin::plugin_name()
|
||||
{
|
||||
return "t4sp-server-plugin";
|
||||
}
|
||||
|
||||
bool plugin::is_game_supported(plutonium::sdk::game game)
|
||||
{
|
||||
return game == plutonium::sdk::game::t4;
|
||||
}
|
||||
|
||||
void plugin::on_startup(plutonium::sdk::iinterface* interface_ptr, plutonium::sdk::game game)
|
||||
{
|
||||
this->interface_ = interface_ptr;
|
||||
this->game_ = game;
|
||||
|
||||
if (!game::environment::t4sp())
|
||||
{
|
||||
MessageBoxA(nullptr, "Unsupported game executable. (t4sp is only supported)", "ERROR, BRO!", 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!signatures::process())
|
||||
{
|
||||
MessageBoxA(NULL,
|
||||
std::format("This version of t4sp-server-plugin is outdated.\n" \
|
||||
"Download the latest dll from here: https://github.com/JezuzLizard/T4SP-Server-Plugin/releases\n" \
|
||||
"'{}' failed", signatures::get_err_reason()).c_str(),
|
||||
"ERROR", MB_ICONERROR);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (game::plutonium::printf.get() != nullptr)
|
||||
{
|
||||
utils::hook::jump(reinterpret_cast<uintptr_t>(&printf), game::plutonium::printf);
|
||||
}
|
||||
|
||||
component_loader::post_unpack();
|
||||
}
|
||||
|
||||
void plugin::on_shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
plutonium::sdk::iinterface* plugin::get_interface()
|
||||
{
|
||||
return this->interface_;
|
||||
}
|
||||
|
||||
plutonium::sdk::game plugin::get_game()
|
||||
{
|
||||
return this->game_;
|
||||
}
|
||||
|
||||
plugin* get()
|
||||
{
|
||||
static plugin instance;
|
||||
return &instance;
|
||||
}
|
||||
}
|
30
src/plugin.hpp
Normal file
30
src/plugin.hpp
Normal file
@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include <plutonium_sdk.hpp>
|
||||
|
||||
namespace plugin
|
||||
{
|
||||
class plugin : public plutonium::sdk::plugin
|
||||
{
|
||||
public:
|
||||
~plugin() = default;
|
||||
|
||||
std::uint32_t plugin_version() override;
|
||||
const char* plugin_name() override;
|
||||
|
||||
bool is_game_supported(plutonium::sdk::game game) override;
|
||||
|
||||
void on_startup(plutonium::sdk::iinterface* interface_ptr, plutonium::sdk::game game) override;
|
||||
void on_shutdown() override;
|
||||
|
||||
plutonium::sdk::iinterface* get_interface();
|
||||
plutonium::sdk::game get_game();
|
||||
|
||||
private:
|
||||
plutonium::sdk::iinterface* interface_{};
|
||||
plutonium::sdk::game game_{};
|
||||
|
||||
};
|
||||
|
||||
plugin* get();
|
||||
}
|
@ -71,6 +71,8 @@
|
||||
#include "game/structs.hpp"
|
||||
#include "game/symbols.hpp"
|
||||
|
||||
#include "plugin.hpp"
|
||||
|
||||
std::string build_gsc_dump(game::scriptInstance_t inst);
|
||||
void push_opcode_history(game::scriptInstance_t inst, game::OpcodeVM op);
|
||||
void push_builtin_history(game::scriptInstance_t inst, int idx);
|
||||
|
Loading…
x
Reference in New Issue
Block a user