More fixes
This commit is contained in:
parent
91aa9cc0b8
commit
84cba76ae3
1
deps/premake/libtommath.lua
vendored
1
deps/premake/libtommath.lua
vendored
@ -18,6 +18,7 @@ function libtommath.includes()
|
|||||||
defines {
|
defines {
|
||||||
"LTM_DESC",
|
"LTM_DESC",
|
||||||
"__STDC_IEC_559__",
|
"__STDC_IEC_559__",
|
||||||
|
"MP_NO_DEV_URANDOM",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ namespace demonware
|
|||||||
return this->write_bytes(bytes, reinterpret_cast<const unsigned char*>(data));
|
return this->write_bytes(bytes, reinterpret_cast<const unsigned char*>(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bit_buffer::write_bytes(unsigned int bytes, const unsigned char* data)
|
bool bit_buffer::write_bytes(const unsigned int bytes, const unsigned char* data)
|
||||||
{
|
{
|
||||||
return this->write(bytes * 8, data);
|
return this->write(bytes * 8, data);
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ namespace demonware
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool byte_buffer::read(int bytes, void* output)
|
bool byte_buffer::read(const int bytes, void* output)
|
||||||
{
|
{
|
||||||
if (bytes + this->current_byte_ > this->buffer_.size()) return false;
|
if (bytes + this->current_byte_ > this->buffer_.size()) return false;
|
||||||
|
|
||||||
@ -276,9 +276,9 @@ namespace demonware
|
|||||||
return this->write(data.size(), data.data());
|
return this->write(data.size(), data.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void byte_buffer::set_use_data_types(bool _useDataTypes)
|
void byte_buffer::set_use_data_types(const bool use_data_types)
|
||||||
{
|
{
|
||||||
this->use_data_types_ = _useDataTypes;
|
this->use_data_types_ = use_data_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t byte_buffer::size() const
|
size_t byte_buffer::size() const
|
||||||
|
@ -15,7 +15,10 @@ namespace demonware
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
raw_reply() = default;
|
raw_reply() = default;
|
||||||
explicit raw_reply(std::string data) : buffer_(std::move(data)) {}
|
|
||||||
|
explicit raw_reply(std::string data) : buffer_(std::move(data))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
virtual std::string get_data() override
|
virtual std::string get_data() override
|
||||||
{
|
{
|
||||||
@ -29,7 +32,9 @@ namespace demonware
|
|||||||
class typed_reply : public raw_reply
|
class typed_reply : public raw_reply
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typed_reply(uint8_t _type) : type_(_type) {}
|
typed_reply(uint8_t _type) : type_(_type)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint8_t get_type() const { return this->type_; }
|
uint8_t get_type() const { return this->type_; }
|
||||||
@ -45,6 +50,7 @@ namespace demonware
|
|||||||
{
|
{
|
||||||
this->buffer_.append(bbuffer->get_buffer());
|
this->buffer_.append(bbuffer->get_buffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
encrypted_reply(const uint8_t type, byte_buffer* bbuffer) : typed_reply(type)
|
encrypted_reply(const uint8_t type, byte_buffer* bbuffer) : typed_reply(type)
|
||||||
{
|
{
|
||||||
this->buffer_.append(bbuffer->get_buffer());
|
this->buffer_.append(bbuffer->get_buffer());
|
||||||
@ -60,6 +66,7 @@ namespace demonware
|
|||||||
{
|
{
|
||||||
this->buffer_.append(bbuffer->get_buffer());
|
this->buffer_.append(bbuffer->get_buffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
unencrypted_reply(uint8_t _type, byte_buffer* bbuffer) : typed_reply(_type)
|
unencrypted_reply(uint8_t _type, byte_buffer* bbuffer) : typed_reply(_type)
|
||||||
{
|
{
|
||||||
this->buffer_.append(bbuffer->get_buffer());
|
this->buffer_.append(bbuffer->get_buffer());
|
||||||
@ -86,7 +93,8 @@ namespace demonware
|
|||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::shared_ptr<service_reply> create_reply(uint8_t type, uint32_t error = 0 /*Game::bdLobbyErrorCode::BD_NO_ERROR*/)
|
virtual std::shared_ptr<service_reply> create_reply(uint8_t type,
|
||||||
|
uint32_t error = 0 /*Game::bdLobbyErrorCode::BD_NO_ERROR*/)
|
||||||
{
|
{
|
||||||
auto reply = std::make_shared<service_reply>(this, type, error);
|
auto reply = std::make_shared<service_reply>(this, type, error);
|
||||||
return reply;
|
return reply;
|
||||||
@ -96,7 +104,9 @@ namespace demonware
|
|||||||
class remote_reply final
|
class remote_reply final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
remote_reply(i_server* server, uint8_t _type) : type_(_type), server_(server) {}
|
remote_reply(i_server* server, uint8_t _type) : type_(_type), server_(server)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
template <typename BufferType>
|
template <typename BufferType>
|
||||||
void send(BufferType* buffer, const bool encrypted)
|
void send(BufferType* buffer, const bool encrypted)
|
||||||
@ -119,14 +129,23 @@ namespace demonware
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~i_serializable() = default;
|
virtual ~i_serializable() = default;
|
||||||
virtual void serialize(byte_buffer* /*buffer*/) {}
|
|
||||||
virtual void deserialize(byte_buffer* /*buffer*/) {}
|
virtual void serialize(byte_buffer* /*buffer*/)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void deserialize(byte_buffer* /*buffer*/)
|
||||||
|
{
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class service_reply final
|
class service_reply final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
service_reply(i_server* _server, uint8_t _type, uint32_t _error) : type_(_type), error_(_error), reply_(_server, 1) {}
|
service_reply(i_server* _server, uint8_t _type, uint32_t _error) : type_(_type), error_(_error),
|
||||||
|
reply_(_server, 1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t send()
|
uint64_t send()
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ namespace demonware
|
|||||||
return this->address_;
|
return this->address_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void stun_server::ip_discovery(SOCKET s, const sockaddr* to, int tolen) const
|
void stun_server::ip_discovery(SOCKET s, const sockaddr* to, const int tolen) const
|
||||||
{
|
{
|
||||||
const uint32_t ip = 0x0100007f;
|
const uint32_t ip = 0x0100007f;
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ namespace demonware
|
|||||||
dw::send_datagram_packet(s, buffer.get_buffer(), to, tolen);
|
dw::send_datagram_packet(s, buffer.get_buffer(), to, tolen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void stun_server::nat_discovery(SOCKET s, const sockaddr* to, int tolen) const
|
void stun_server::nat_discovery(SOCKET s, const sockaddr* to, const int tolen) const
|
||||||
{
|
{
|
||||||
const uint32_t ip = 0x0100007f;
|
const uint32_t ip = 0x0100007f;
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ namespace demonware
|
|||||||
dw::send_datagram_packet(s, buffer.get_buffer(), to, tolen);
|
dw::send_datagram_packet(s, buffer.get_buffer(), to, tolen);
|
||||||
}
|
}
|
||||||
|
|
||||||
int stun_server::send(const SOCKET s, const char* buf, int len, const sockaddr* to, int tolen) const
|
int stun_server::send(const SOCKET s, const char* buf, const int len, const sockaddr* to, const int tolen) const
|
||||||
{
|
{
|
||||||
uint8_t type, version, padding;
|
uint8_t type, version, padding;
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ namespace game
|
|||||||
|
|
||||||
void Conbuf_AppendText(const char* message)
|
void Conbuf_AppendText(const char* message)
|
||||||
{
|
{
|
||||||
if(is_dedi())
|
if (is_dedi())
|
||||||
{
|
{
|
||||||
conbuf_append_text_dedicated(message);
|
conbuf_append_text_dedicated(message);
|
||||||
}
|
}
|
||||||
@ -247,7 +247,8 @@ namespace game
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return reinterpret_cast<void(*)(unsigned int, unsigned int, unsigned int)>(0x4EFAA0)(id, stringValue, paramcount);
|
return reinterpret_cast<void(*)(unsigned int, unsigned int, unsigned int)>(0x4EFAA0)(
|
||||||
|
id, stringValue, paramcount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,7 +298,7 @@ namespace game
|
|||||||
|
|
||||||
launcher::mode get_mode()
|
launcher::mode get_mode()
|
||||||
{
|
{
|
||||||
if(mode == launcher::mode::none)
|
if (mode == launcher::mode::none)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Launcher mode not valid. Something must be wrong.");
|
throw std::runtime_error("Launcher mode not valid. Something must be wrong.");
|
||||||
}
|
}
|
||||||
@ -330,7 +331,8 @@ namespace game
|
|||||||
|
|
||||||
native::DB_LoadXAssets = native::DB_LoadXAssets_t(SELECT_VALUE(0x48A8E0, 0x4CD020, 0x44F770));
|
native::DB_LoadXAssets = native::DB_LoadXAssets_t(SELECT_VALUE(0x48A8E0, 0x4CD020, 0x44F770));
|
||||||
|
|
||||||
native::Dvar_SetFromStringByName = native::Dvar_SetFromStringByName_t(SELECT_VALUE(0x4DD090, 0x5BF740, 0x518DF0));
|
native::Dvar_SetFromStringByName = native::Dvar_SetFromStringByName_t(
|
||||||
|
SELECT_VALUE(0x4DD090, 0x5BF740, 0x518DF0));
|
||||||
|
|
||||||
native::G_RunFrame = native::G_RunFrame_t(SELECT_VALUE(0x52EAA0, 0x50CB70, 0x48AD60));
|
native::G_RunFrame = native::G_RunFrame_t(SELECT_VALUE(0x52EAA0, 0x50CB70, 0x48AD60));
|
||||||
|
|
||||||
@ -358,11 +360,11 @@ namespace game
|
|||||||
|
|
||||||
native::scr_VmPub = reinterpret_cast<native::scrVmPub_t*>(SELECT_VALUE(0x1BF2580, 0x20B4A80, 0x1F5B080));
|
native::scr_VmPub = reinterpret_cast<native::scrVmPub_t*>(SELECT_VALUE(0x1BF2580, 0x20B4A80, 0x1F5B080));
|
||||||
|
|
||||||
native::scr_instanceFunctions = reinterpret_cast<native::scr_call_t*>( SELECT_VALUE(0x184CDB0, 0x1D4F258,
|
native::scr_instanceFunctions = reinterpret_cast<native::scr_call_t*>(SELECT_VALUE(0x184CDB0, 0x1D4F258,
|
||||||
0x1BF59C8));
|
0x1BF59C8));
|
||||||
native::scr_globalFunctions = reinterpret_cast<native::scr_call_t*>( SELECT_VALUE(0x186C68C, 0x1D6EB34,
|
native::scr_globalFunctions = reinterpret_cast<native::scr_call_t*>(SELECT_VALUE(0x186C68C, 0x1D6EB34,
|
||||||
0x1C152A4
|
0x1C152A4
|
||||||
));
|
));
|
||||||
|
|
||||||
native::g_script_error_level = reinterpret_cast<int*>(SELECT_VALUE(0x1BEFCFC, 0x20B21FC, 0x1F5B058));
|
native::g_script_error_level = reinterpret_cast<int*>(SELECT_VALUE(0x1BEFCFC, 0x20B21FC, 0x1F5B058));
|
||||||
native::g_script_error = reinterpret_cast<jmp_buf*>(SELECT_VALUE(0x1BF1D18, 0x20B4218, 0x1F5A818));
|
native::g_script_error = reinterpret_cast<jmp_buf*>(SELECT_VALUE(0x1BF1D18, 0x20B4218, 0x1F5A818));
|
||||||
|
@ -20,7 +20,7 @@ namespace game
|
|||||||
typedef void (*DB_LoadXAssets_t)(XZoneInfo* zoneInfo, unsigned int zoneCount, int sync);
|
typedef void (*DB_LoadXAssets_t)(XZoneInfo* zoneInfo, unsigned int zoneCount, int sync);
|
||||||
extern DB_LoadXAssets_t DB_LoadXAssets;
|
extern DB_LoadXAssets_t DB_LoadXAssets;
|
||||||
|
|
||||||
typedef void (*Dvar_SetFromStringByName_t)(const char *dvarName, const char *string);
|
typedef void (*Dvar_SetFromStringByName_t)(const char* dvarName, const char* string);
|
||||||
extern Dvar_SetFromStringByName_t Dvar_SetFromStringByName;
|
extern Dvar_SetFromStringByName_t Dvar_SetFromStringByName;
|
||||||
|
|
||||||
typedef int (*G_RunFrame_t)(int, int);
|
typedef int (*G_RunFrame_t)(int, int);
|
||||||
|
@ -116,7 +116,7 @@ namespace game
|
|||||||
{
|
{
|
||||||
if (this->entity_id_)
|
if (this->entity_id_)
|
||||||
{
|
{
|
||||||
native::VariableValue value{};
|
native::VariableValue value;
|
||||||
value.type = native::SCRIPT_OBJECT;
|
value.type = native::SCRIPT_OBJECT;
|
||||||
value.u.entityId = this->entity_id_;
|
value.u.entityId = this->entity_id_;
|
||||||
native::AddRefToValue(&value);
|
native::AddRefToValue(&value);
|
||||||
|
@ -102,7 +102,7 @@ namespace game
|
|||||||
|
|
||||||
void event_handler::remove(const event_listener_handle& handle)
|
void event_handler::remove(const event_listener_handle& handle)
|
||||||
{
|
{
|
||||||
for (auto task : this->event_listeners_)
|
for (const auto task : this->event_listeners_)
|
||||||
{
|
{
|
||||||
if (task->id == handle.id)
|
if (task->id == handle.id)
|
||||||
{
|
{
|
||||||
@ -111,7 +111,7 @@ namespace game
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto task : this->generic_event_listeners_)
|
for (const auto task : this->generic_event_listeners_)
|
||||||
{
|
{
|
||||||
if (task->id == handle.id)
|
if (task->id == handle.id)
|
||||||
{
|
{
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
namespace game
|
namespace game
|
||||||
{
|
{
|
||||||
namespace scripting
|
namespace scripting
|
||||||
|
@ -100,7 +100,8 @@ namespace game
|
|||||||
else if (value.get_type_info() == typeid(std::vector<chaiscript::Boxed_Value>))
|
else if (value.get_type_info() == typeid(std::vector<chaiscript::Boxed_Value>))
|
||||||
{
|
{
|
||||||
float values[3];
|
float values[3];
|
||||||
const auto real_value = this->context_->get_chai()->boxed_cast<std::vector<chaiscript::Boxed_Value>>(value);
|
const auto real_value = this->context_->get_chai()->boxed_cast<std::vector<chaiscript::Boxed_Value>
|
||||||
|
>(value);
|
||||||
if (real_value.size() != 3)
|
if (real_value.size() != 3)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Invalid vector length. Size must be exactly 3");
|
throw std::runtime_error("Invalid vector length. Size must be exactly 3");
|
||||||
|
@ -18,12 +18,14 @@ namespace game
|
|||||||
return lhs = rhs;
|
return lhs = rhs;
|
||||||
}), "=");
|
}), "=");
|
||||||
|
|
||||||
chai->add(chaiscript::fun([this](const std::function<void()>& callback, const long long milliseconds) -> task_handle
|
chai->add(chaiscript::fun(
|
||||||
|
[this](const std::function<void()>& callback, const long long milliseconds) -> task_handle
|
||||||
{
|
{
|
||||||
return this->add(callback, milliseconds, true);
|
return this->add(callback, milliseconds, true);
|
||||||
}), "setTimeout");
|
}), "setTimeout");
|
||||||
|
|
||||||
chai->add(chaiscript::fun([this](const std::function<void()>& callback, const long long milliseconds) -> task_handle
|
chai->add(chaiscript::fun(
|
||||||
|
[this](const std::function<void()>& callback, const long long milliseconds) -> task_handle
|
||||||
{
|
{
|
||||||
return this->add(callback, milliseconds, false);
|
return this->add(callback, milliseconds, false);
|
||||||
}), "setInterval");
|
}), "setInterval");
|
||||||
@ -79,14 +81,14 @@ namespace game
|
|||||||
|
|
||||||
this->tasks_.add(task);
|
this->tasks_.add(task);
|
||||||
|
|
||||||
return { task.id };
|
return {task.id};
|
||||||
}
|
}
|
||||||
|
|
||||||
void scheduler::remove(const task_handle& handle)
|
void scheduler::remove(const task_handle& handle)
|
||||||
{
|
{
|
||||||
for (auto task : this->tasks_)
|
for (auto task : this->tasks_)
|
||||||
{
|
{
|
||||||
if(task->id == handle.id)
|
if (task->id == handle.id)
|
||||||
{
|
{
|
||||||
this->tasks_.remove(task);
|
this->tasks_.remove(task);
|
||||||
break;
|
break;
|
||||||
|
@ -43,6 +43,6 @@ int html_argument::get_number() const
|
|||||||
|
|
||||||
bool html_argument::get_bool() const
|
bool html_argument::get_bool() const
|
||||||
{
|
{
|
||||||
if(!this->is_bool()) return false;
|
if (!this->is_bool()) return false;
|
||||||
return this->value_->boolVal != FALSE;
|
return this->value_->boolVal != FALSE;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ FARPROC loader::load(const utils::nt::module& module) const
|
|||||||
const auto buffer = binary_loader::load(this->mode_);
|
const auto buffer = binary_loader::load(this->mode_);
|
||||||
if (buffer.empty()) return nullptr;
|
if (buffer.empty()) return nullptr;
|
||||||
|
|
||||||
utils::nt::module source(HMODULE(buffer.data()));
|
const utils::nt::module source(HMODULE(buffer.data()));
|
||||||
if (!source) return nullptr;
|
if (!source) return nullptr;
|
||||||
|
|
||||||
this->load_sections(module, source);
|
this->load_sections(module, source);
|
||||||
@ -58,8 +58,8 @@ FARPROC loader::load(const utils::nt::module& module) const
|
|||||||
.get_optional_header()->DataDirectory[
|
.get_optional_header()->DataDirectory[
|
||||||
IMAGE_DIRECTORY_ENTRY_IMPORT];
|
IMAGE_DIRECTORY_ENTRY_IMPORT];
|
||||||
std::memmove(module.get_nt_headers(), source.get_nt_headers(),
|
std::memmove(module.get_nt_headers(), source.get_nt_headers(),
|
||||||
sizeof(IMAGE_NT_HEADERS) + (source.get_nt_headers()->FileHeader.NumberOfSections * (sizeof(
|
sizeof(IMAGE_NT_HEADERS) + source.get_nt_headers()->FileHeader.NumberOfSections * sizeof(
|
||||||
IMAGE_SECTION_HEADER))));
|
IMAGE_SECTION_HEADER));
|
||||||
|
|
||||||
return FARPROC(module.get_ptr() + source.get_relative_entry_point());
|
return FARPROC(module.get_ptr() + source.get_relative_entry_point());
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ bool module_loader::post_start()
|
|||||||
module_->post_start();
|
module_->post_start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(premature_shutdown_trigger&)
|
catch (premature_shutdown_trigger&)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ void* module_loader::load_import(const std::string& module, const std::string& f
|
|||||||
for (const auto& module_ : *modules_)
|
for (const auto& module_ : *modules_)
|
||||||
{
|
{
|
||||||
const auto module_function_ptr = module_->load_import(module, function);
|
const auto module_function_ptr = module_->load_import(module, function);
|
||||||
if(module_function_ptr)
|
if (module_function_ptr)
|
||||||
{
|
{
|
||||||
function_ptr = module_function_ptr;
|
function_ptr = module_function_ptr;
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,12 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template <typename T>
|
||||||
static T* get()
|
static T* get()
|
||||||
{
|
{
|
||||||
for(const auto& module_ : *modules_)
|
for (const auto& module_ : *modules_)
|
||||||
{
|
{
|
||||||
if(typeid(*module_.get()) == typeid(T))
|
if (typeid(*module_.get()) == typeid(T))
|
||||||
{
|
{
|
||||||
return reinterpret_cast<T*>(module_.get());
|
return reinterpret_cast<T*>(module_.get());
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ int main()
|
|||||||
auto mode = detect_mode_from_arguments();
|
auto mode = detect_mode_from_arguments();
|
||||||
if (mode == launcher::mode::none)
|
if (mode == launcher::mode::none)
|
||||||
{
|
{
|
||||||
launcher launcher;
|
const launcher launcher;
|
||||||
mode = launcher.run();
|
mode = launcher.run();
|
||||||
if (mode == launcher::mode::none) return 0;
|
if (mode == launcher::mode::none) return 0;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ void scheduler::execute_error()
|
|||||||
const char* message;
|
const char* message;
|
||||||
int level;
|
int level;
|
||||||
|
|
||||||
if(get_next_error(&message, &level) && message)
|
if (get_next_error(&message, &level) && message)
|
||||||
{
|
{
|
||||||
game::native::Com_Error(level, "%s", message);
|
game::native::Com_Error(level, "%s", message);
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ void scheduler::execute_error()
|
|||||||
bool scheduler::get_next_error(const char** error_message, int* error_level)
|
bool scheduler::get_next_error(const char** error_message, int* error_level)
|
||||||
{
|
{
|
||||||
std::lock_guard _(mutex_);
|
std::lock_guard _(mutex_);
|
||||||
if(errors_.empty())
|
if (errors_.empty())
|
||||||
{
|
{
|
||||||
*error_message = nullptr;
|
*error_message = nullptr;
|
||||||
return false;
|
return false;
|
||||||
|
@ -19,7 +19,8 @@ public:
|
|||||||
->quick();
|
->quick();
|
||||||
|
|
||||||
utils::hook(SELECT_VALUE(0x4F9706, 0x5772A0, 0x4FAB88), &frame_stub, HOOK_CALL).install()->quick();
|
utils::hook(SELECT_VALUE(0x4F9706, 0x5772A0, 0x4FAB88), &frame_stub, HOOK_CALL).install()->quick();
|
||||||
utils::hook(SELECT_VALUE(0x4FFA48, 0x5774AB, 0x4FEFD7), &frame_stub, HOOK_CALL).install()->quick(); // Only relevant one?
|
utils::hook(SELECT_VALUE(0x4FFA48, 0x5774AB, 0x4FEFD7), &frame_stub, HOOK_CALL).install()->quick();
|
||||||
|
// Only relevant one?
|
||||||
|
|
||||||
utils::hook(SELECT_VALUE(0x6109F3, 0x56B637, 0x4EDFF7), &vm_notify_stub, HOOK_CALL).install()->quick();
|
utils::hook(SELECT_VALUE(0x6109F3, 0x56B637, 0x4EDFF7), &vm_notify_stub, HOOK_CALL).install()->quick();
|
||||||
utils::hook(SELECT_VALUE(0x6128BE, 0x56D541, 0x4EFAF9), &vm_notify_stub, HOOK_CALL).install()->quick();
|
utils::hook(SELECT_VALUE(0x6128BE, 0x56D541, 0x4EFAF9), &vm_notify_stub, HOOK_CALL).install()->quick();
|
||||||
@ -149,7 +150,7 @@ private:
|
|||||||
game::native::VM_Notify(notify_id, type, stack);
|
game::native::VM_Notify(notify_id, type, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int frame_stub(int a1, int a2)
|
static int frame_stub(const int a1, const int a2)
|
||||||
{
|
{
|
||||||
module_loader::get<scripting>()->run_frame();
|
module_loader::get<scripting>()->run_frame();
|
||||||
return game::native::G_RunFrame(a1, a2);
|
return game::native::G_RunFrame(a1, a2);
|
||||||
|
@ -8,7 +8,7 @@ class security final : public module
|
|||||||
public:
|
public:
|
||||||
void post_load() override
|
void post_load() override
|
||||||
{
|
{
|
||||||
if(game::is_mp())
|
if (game::is_mp())
|
||||||
{
|
{
|
||||||
utils::hook(0x4AECD4, read_p2p_auth_ticket_stub, HOOK_JUMP).install()->quick();
|
utils::hook(0x4AECD4, read_p2p_auth_ticket_stub, HOOK_JUMP).install()->quick();
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ private:
|
|||||||
|
|
||||||
this->client_utils_.invoke<void>("SetAppIDForCurrentPipe", app_id, false);
|
this->client_utils_.invoke<void>("SetAppIDForCurrentPipe", app_id, false);
|
||||||
|
|
||||||
utils::nt::module self;
|
const utils::nt::module self;
|
||||||
const auto path = self.get_path();
|
const auto path = self.get_path();
|
||||||
|
|
||||||
char our_directory[MAX_PATH] = {0};
|
char our_directory[MAX_PATH] = {0};
|
||||||
|
@ -14,3 +14,25 @@ char payload_data[BINARY_PAYLOAD_SIZE];
|
|||||||
|
|
||||||
#pragma data_seg(".main")
|
#pragma data_seg(".main")
|
||||||
char main_data[200] = {1};
|
char main_data[200] = {1};
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
int s_read_arc4random(void*, size_t)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int s_read_getrandom(void*, size_t)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int s_read_urandom(void*, size_t)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int s_read_ltm_rng(void*, size_t)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#include "interface.hpp"
|
#include "interface.hpp"
|
||||||
#include "utils/memory.hpp"
|
#include "utils/memory.hpp"
|
||||||
#include "utils/nt.hpp"
|
#include "utils/nt.hpp"
|
||||||
#include <minwinbase.h>
|
|
||||||
|
|
||||||
namespace steam
|
namespace steam
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "steam/steam.hpp"
|
#include "steam/steam.hpp"
|
||||||
#include "module/scheduler.hpp"
|
|
||||||
|
|
||||||
namespace steam
|
namespace steam
|
||||||
{
|
{
|
||||||
@ -37,8 +36,7 @@ namespace steam
|
|||||||
{
|
{
|
||||||
std::lock_guard _(mutex_);
|
std::lock_guard _(mutex_);
|
||||||
|
|
||||||
result result{};
|
result result;
|
||||||
|
|
||||||
result.call = call;
|
result.call = call;
|
||||||
result.data = data;
|
result.data = data;
|
||||||
result.size = size;
|
result.size = size;
|
||||||
|
@ -9,7 +9,8 @@ namespace utils
|
|||||||
class element final
|
class element final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit element(std::recursive_mutex* mutex, std::shared_ptr<T> entry = {}, std::shared_ptr<element> next = {}) :
|
explicit element(std::recursive_mutex* mutex, std::shared_ptr<T> entry = {},
|
||||||
|
std::shared_ptr<element> next = {}) :
|
||||||
mutex_(mutex),
|
mutex_(mutex),
|
||||||
entry_(std::move(entry)),
|
entry_(std::move(entry)),
|
||||||
next_(std::move(next))
|
next_(std::move(next))
|
||||||
|
@ -123,8 +123,9 @@ namespace utils
|
|||||||
ltc_mp = ltm_desc;
|
ltc_mp = ltm_desc;
|
||||||
|
|
||||||
auto result = 0;
|
auto result = 0;
|
||||||
return ( ecc_verify_hash(reinterpret_cast<const uint8_t*>(signature.data()), signature.size(),
|
return (ecc_verify_hash(reinterpret_cast<const uint8_t*>(signature.data()), signature.size(),
|
||||||
reinterpret_cast<const uint8_t*>(message.data()), message.size(), &result, key.get()) == CRYPT_OK && result != 0);
|
reinterpret_cast<const uint8_t*>(message.data()), message.size(), &result,
|
||||||
|
key.get()) == CRYPT_OK && result != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string rsa::encrypt(const std::string& data, const std::string& hash, const std::string& key)
|
std::string rsa::encrypt(const std::string& data, const std::string& hash, const std::string& key)
|
||||||
@ -247,7 +248,7 @@ namespace utils
|
|||||||
return compute(reinterpret_cast<const uint8_t*>(data.data()), data.size(), hex);
|
return compute(reinterpret_cast<const uint8_t*>(data.data()), data.size(), hex);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string sha1::compute(const uint8_t* data, size_t length, const bool hex)
|
std::string sha1::compute(const uint8_t* data, const size_t length, const bool hex)
|
||||||
{
|
{
|
||||||
uint8_t buffer[20] = {0};
|
uint8_t buffer[20] = {0};
|
||||||
|
|
||||||
@ -262,12 +263,12 @@ namespace utils
|
|||||||
return string::dump_hex(hash, "");
|
return string::dump_hex(hash, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string sha256::compute(const std::string& data, bool hex)
|
std::string sha256::compute(const std::string& data, const bool hex)
|
||||||
{
|
{
|
||||||
return compute(reinterpret_cast<const uint8_t*>(data.data()), data.size(), hex);
|
return compute(reinterpret_cast<const uint8_t*>(data.data()), data.size(), hex);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string sha256::compute(const uint8_t* data, size_t length, bool hex)
|
std::string sha256::compute(const uint8_t* data, const size_t length, const bool hex)
|
||||||
{
|
{
|
||||||
uint8_t buffer[32] = {0};
|
uint8_t buffer[32] = {0};
|
||||||
|
|
||||||
@ -282,12 +283,12 @@ namespace utils
|
|||||||
return string::dump_hex(hash, "");
|
return string::dump_hex(hash, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string sha512::compute(const std::string& data, bool hex)
|
std::string sha512::compute(const std::string& data, const bool hex)
|
||||||
{
|
{
|
||||||
return compute(reinterpret_cast<const uint8_t*>(data.data()), data.size(), hex);
|
return compute(reinterpret_cast<const uint8_t*>(data.data()), data.size(), hex);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string sha512::compute(const uint8_t* data, size_t length, bool hex)
|
std::string sha512::compute(const uint8_t* data, const size_t length, const bool hex)
|
||||||
{
|
{
|
||||||
uint8_t buffer[64] = {0};
|
uint8_t buffer[64] = {0};
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "memory.hpp"
|
|
||||||
|
|
||||||
namespace utils
|
namespace utils
|
||||||
{
|
{
|
||||||
@ -24,7 +23,7 @@ namespace utils
|
|||||||
|
|
||||||
void deserialize(const std::string& key);
|
void deserialize(const std::string& key);
|
||||||
|
|
||||||
std::string serialize(const int type = PK_PRIVATE) const;
|
std::string serialize(int type = PK_PRIVATE) const;
|
||||||
|
|
||||||
void free();
|
void free();
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "memory.hpp"
|
|
||||||
|
|
||||||
namespace utils
|
namespace utils
|
||||||
{
|
{
|
||||||
|
@ -113,7 +113,7 @@ namespace utils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hook::iat(nt::module module, const std::string& target_module, const std::string& process, void* stub)
|
bool hook::iat(const nt::module module, const std::string& target_module, const std::string& process, void* stub)
|
||||||
{
|
{
|
||||||
if (!module.is_valid()) return false;
|
if (!module.is_valid()) return false;
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ namespace utils
|
|||||||
{
|
{
|
||||||
if (!this->is_valid()) return nullptr;
|
if (!this->is_valid()) return nullptr;
|
||||||
|
|
||||||
module other_module(module_name);
|
const module other_module(module_name);
|
||||||
if (!other_module.is_valid()) return nullptr;
|
if (!other_module.is_valid()) return nullptr;
|
||||||
|
|
||||||
const auto target_function = other_module.get_proc<void*>(proc_name);
|
const auto target_function = other_module.get_proc<void*>(proc_name);
|
||||||
@ -199,7 +199,7 @@ namespace utils
|
|||||||
void raise_hard_exception()
|
void raise_hard_exception()
|
||||||
{
|
{
|
||||||
int data = false;
|
int data = false;
|
||||||
utils::nt::module ntdll("ntdll.dll");
|
const module ntdll("ntdll.dll");
|
||||||
ntdll.invoke_pascal<void>("RtlAdjustPrivilege", 19, true, false, &data);
|
ntdll.invoke_pascal<void>("RtlAdjustPrivilege", 19, true, false, &data);
|
||||||
ntdll.invoke_pascal<void>("NtRaiseHardError", 0xC000007B, 0, nullptr, nullptr, 6, &data);
|
ntdll.invoke_pascal<void>("NtRaiseHardError", 0xC000007B, 0, nullptr, nullptr, 6, &data);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user