This commit is contained in:
Aure7138 2023-03-19 23:19:13 +08:00 committed by GitHub
parent a1bc7517af
commit ddaee3f069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 49 additions and 52 deletions

View File

@ -92,9 +92,9 @@ namespace big::functions
using fipackfile_unmount = bool (*)(const char* mount_point);
using start_get_session_by_gamer_handle = bool (*)(int profile_index, rage::rlGamerHandle* handles, int count, rage::rlSessionByGamerTaskResult* result, int unk, bool* success, rage::rlTaskStatus* state);
using start_matchmaking_find_sessions = bool (*)(int profile_index, int available_slots, NetworkGameFilterMatchmakingComponent* m_filter, unsigned int max_sessions, rage::rlSessionInfo* result_sessions, int* result_session_count, rage::rlTaskStatus* state);
using start_get_presence_attributes = bool (*)(int profile_index, rage::rlScHandle* handle, rage::rlQueryPresenceAttributesContext* contexts, int count, rage::rlTaskStatus* state);
using join_session_by_info = bool (*)(Network* network, rage::rlSessionInfo* info, int unk, int flags, rage::rlGamerHandle* handles, int handlecount);
using start_matchmaking_find_sessions = bool (*)(int profile_index, int available_slots, NetworkGameFilterMatchmakingComponent* m_filter, unsigned int max_sessions, rage::rlSessionInfo* result_sessions, int* result_session_count, rage::rlTaskStatus* state);
using start_get_presence_attributes = bool (*)(int profile_index, rage::rlScHandle* handle, rage::rlQueryPresenceAttributesContext* contexts, int count, rage::rlTaskStatus* state);
using join_session_by_info = bool (*)(Network* network, rage::rlSessionInfo* info, int unk, int flags, rage::rlGamerHandle* handles, int handlecount);
using generate_uuid = bool (*)(std::uint64_t* uuid);
@ -109,10 +109,10 @@ namespace big::functions
using send_chat_message = bool (*)(int64_t* send_chat_ptr, rage::rlGamerInfo* gamer_info, char* message, bool is_team);
using send_network_damage = void (*)(CEntity* source, CEntity* target, rage::fvector3* position, int hit_component, bool override_default_damage, int weapon_type, float override_damage, int tire_index, int suspension_index, int flags, std::uint32_t action_result_hash, std::int16_t action_result_id, int action_unk, bool hit_weapon, bool hit_weapon_ammo_attachment, bool silenced, bool unk, rage::fvector3* impact_direction);
using request_ragdoll = void (*)(uint16_t object_id);
using request_control = void (*)(rage::netObject* net_object);
using request_ragdoll = void (*)(uint16_t object_id);
using request_control = void (*)(rage::netObject* net_object);
using get_connection_peer = rage::netConnectionPeer* (*)(rage::netConnectionManager* manager, int peer_id);
using get_connection_peer = rage::netConnectionPeer* (*)(rage::netConnectionManager* manager, int peer_id);
using send_remove_gamer_cmd = void (*)(rage::netConnectionManager* net_connection_mgr, rage::netConnectionPeer* player, int connection_id, rage::snMsgRemoveGamersFromSessionCmd* cmd, int flags);
using handle_remove_gamer_cmd = void* (*)(rage::snSession* session, rage::snPlayer* origin, rage::snMsgRemoveGamersFromSessionCmd* cmd);
@ -127,8 +127,8 @@ namespace big::functions
using save_json_data = char* (*)(datafile_commands::SveFileObject* object, int* out_length, const char* reason);
using sync_network_time = bool (*)(rage::netConnectionManager* mgr, rage::netConnectionPeer* peer, int connection_id, rage::netTimeSyncMsg* msg, int flags);
using send_packet = bool (*)(rage::netConnectionManager* mgr, rage::netConnectionPeer* peer, int connection_id, void* data, int size, int flags);
using connect_to_peer = bool (*)(rage::netConnectionManager* mgr, rage::rlGamerInfoBase* gamer_info, rage::snConnectToPeerTaskData* data, rage::snConnectToPeerTaskResult* result, rage::rlTaskStatus* status);
using send_packet = bool (*)(rage::netConnectionManager* mgr, rage::netConnectionPeer* peer, int connection_id, void* data, int size, int flags);
using connect_to_peer = bool (*)(rage::netConnectionManager* mgr, rage::rlGamerInfoBase* gamer_info, rage::snConnectToPeerTaskData* data, rage::snConnectToPeerTaskResult* result, rage::rlTaskStatus* status);
using clear_ped_tasks_network = void (*)(CPed* ped, bool immediately);

View File

@ -624,8 +624,8 @@ namespace big
// Sound Overload Detour
main_batch.add("SOD", "66 45 3B C1 74 38", [this](memory::handle ptr) {
g_sound_overload_ret_addr = ptr.add(13 + 15).as<decltype(g_sound_overload_ret_addr)>();
std::vector<byte> bytes = {0xFF, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90}; // far jump opcode + a nop opcode
g_sound_overload_ret_addr = ptr.add(13 + 15).as<decltype(g_sound_overload_ret_addr)>();
std::vector<byte> bytes = {0xFF, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90}; // far jump opcode + a nop opcode
*(void**)(bytes.data() + 6) = sound_overload_detour;
memory::byte_patch::make(ptr.add(13).as<void*>(), bytes)->apply();
});

View File

@ -116,7 +116,7 @@ namespace big
call(thread, gta_util::find_script_program(m_script), args);
delete[] stack;
delete[] (uint8_t*)thread; // without the cast it ends up calling the destructor which leads to some pretty funny crashes
delete[](uint8_t*) thread; // without the cast it ends up calling the destructor which leads to some pretty funny crashes
}
void script_function::operator()(std::initializer_list<std::uint64_t> args)

View File

@ -120,7 +120,7 @@ namespace big
for (auto& item : components)
{
ImGui::SetNextItemWidth(60);
if (ImGui::InputInt(std::format("{} [0,{}]", item.label, item.drawable_id_max).c_str(), &item.drawable_id, ImGuiInputTextFlags_None))
if (ImGui::InputInt(std::format("{} [0,{}]", item.label, item.drawable_id_max).c_str(), &item.drawable_id, 0))
{
g_fiber_pool->queue_job([item] {
PED::SET_PED_COMPONENT_VARIATION(self::ped, item.id, item.drawable_id, 0, PED::GET_PED_PALETTE_VARIATION(self::ped, item.id));
@ -135,7 +135,7 @@ namespace big
for (auto& item : components)
{
ImGui::SetNextItemWidth(60);
if (ImGui::InputInt(std::format("{} {} [0,{}]", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), &item.texture_id, ImGuiInputTextFlags_None))
if (ImGui::InputInt(std::format("{} {} [0,{}]", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), &item.texture_id, 0))
{
g_fiber_pool->queue_job([item] {
PED::SET_PED_COMPONENT_VARIATION(self::ped, item.id, item.drawable_id, item.texture_id, PED::GET_PED_PALETTE_VARIATION(self::ped, item.id));
@ -150,7 +150,7 @@ namespace big
for (auto& item : props)
{
ImGui::SetNextItemWidth(60);
if (ImGui::InputInt(std::format("{} [0,{}]", item.label, item.drawable_id_max).c_str(), &item.drawable_id, ImGuiInputTextFlags_None))
if (ImGui::InputInt(std::format("{} [0,{}]", item.label, item.drawable_id_max).c_str(), &item.drawable_id, 0))
{
g_fiber_pool->queue_job([item] {
if (item.drawable_id == -1)
@ -168,7 +168,7 @@ namespace big
for (auto& item : props)
{
ImGui::SetNextItemWidth(60);
if (ImGui::InputInt(std::format("{} {} [0,{}]", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), &item.texture_id, ImGuiInputTextFlags_None))
if (ImGui::InputInt(std::format("{} {} [0,{}]", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), &item.texture_id, 0))
{
g_fiber_pool->queue_job([item] {
PED::SET_PED_PROP_INDEX(self::ped, item.id, item.drawable_id, item.texture_id, TRUE, 1);
@ -192,39 +192,36 @@ namespace big
ImGui::SameLine();
components::button("OUTFIT_SAVE_CURRENT"_T, [] {
if (outfit_name[0] != '\0')
nlohmann::json j;
nlohmann::json j_components;
nlohmann::json j_props;
for (auto& item : components)
{
nlohmann::json j;
nlohmann::json j_components;
nlohmann::json j_props;
for (auto& item : components)
{
nlohmann::json tmp;
tmp["drawable_id"] = item.drawable_id;
tmp["texture_id"] = item.texture_id;
j_components[std::to_string(item.id)] = tmp;
}
for (auto& item : props)
{
nlohmann::json tmp;
tmp["drawable_id"] = item.drawable_id;
tmp["texture_id"] = item.texture_id;
j_props[std::to_string(item.id)] = tmp;
}
j["components"] = j_components;
j["props"] = j_props;
size_t index = 0;
std::string str = outfit_name;
while (saved_outfit_path.get_file(str + ".json").exists())
str = std::format("{} ({})", outfit_name, ++index);
std::ofstream o(saved_outfit_path.get_file(str + ".json").get_path());
o << std::setw(4) << j << std::endl;
nlohmann::json tmp;
tmp["drawable_id"] = item.drawable_id;
tmp["texture_id"] = item.texture_id;
j_components[std::to_string(item.id)] = tmp;
}
for (auto& item : props)
{
nlohmann::json tmp;
tmp["drawable_id"] = item.drawable_id;
tmp["texture_id"] = item.texture_id;
j_props[std::to_string(item.id)] = tmp;
}
j["components"] = j_components;
j["props"] = j_props;
size_t index = 0;
std::string str = outfit_name;
while (saved_outfit_path.get_file(str + ".json").exists())
str = std::format("{}({})", outfit_name, ++index);
std::ofstream o(saved_outfit_path.get_file(str + ".json").get_path());
o << std::setw(4) << j << std::endl;
});
ImGui::SameLine();
@ -240,7 +237,7 @@ namespace big
std::stringstream ss(item.key());
int id = 0;
ss >> id;
int draw_id = item.value()["draw_id"];
int draw_id = item.value()["drawable_id"];
int texture_id = item.value()["texture_id"];
PED::SET_PED_COMPONENT_VARIATION(self::ped, id, draw_id, texture_id, PED::GET_PED_PALETTE_VARIATION(self::ped, id));
}
@ -250,7 +247,7 @@ namespace big
std::stringstream ss(item.key());
int id = 0;
ss >> id;
int draw_id = item.value()["draw_id"];
int draw_id = item.value()["drawable_id"];
int texture_id = item.value()["texture_id"];
if (draw_id == -1)
PED::CLEAR_PED_PROP(self::ped, id, 1);

View File

@ -115,7 +115,7 @@ namespace big
for (auto& item : components)
{
ImGui::SetNextItemWidth(60);
ImGui::InputInt(std::format("{} [0,{}]", item.label, item.drawable_id_max).c_str(), outfit::get_component_drawable_id_address(slot, item.id), ImGuiInputTextFlags_None);
ImGui::InputInt(std::format("{} [0,{}]", item.label, item.drawable_id_max).c_str(), outfit::get_component_drawable_id_address(slot, item.id), 0);
}
ImGui::EndGroup();
@ -125,7 +125,7 @@ namespace big
for (auto& item : components)
{
ImGui::SetNextItemWidth(60);
ImGui::InputInt(std::format("{} {} [0,{}]", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), outfit::get_component_texture_id_address(slot, item.id), ImGuiInputTextFlags_None);
ImGui::InputInt(std::format("{} {} [0,{}]", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), outfit::get_component_texture_id_address(slot, item.id), 0);
}
ImGui::EndGroup();
@ -135,7 +135,7 @@ namespace big
for (auto& item : props)
{
ImGui::SetNextItemWidth(60);
ImGui::InputInt(std::format("{} [0,{}]", item.label, item.drawable_id_max).c_str(), outfit::get_prop_drawable_id_address(slot, item.id), ImGuiInputTextFlags_None);
ImGui::InputInt(std::format("{} [0,{}]", item.label, item.drawable_id_max).c_str(), outfit::get_prop_drawable_id_address(slot, item.id), 0);
}
ImGui::EndGroup();
@ -145,7 +145,7 @@ namespace big
for (auto& item : props)
{
ImGui::SetNextItemWidth(60);
ImGui::InputInt(std::format("{} {} [0,{}]", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), outfit::get_prop_texture_id_address(slot, item.id), ImGuiInputTextFlags_None);
ImGui::InputInt(std::format("{} {} [0,{}]", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), outfit::get_prop_texture_id_address(slot, item.id), 0);
}
ImGui::EndGroup();
}