Save creator jobs and bug fixes (#713)
* feat(Session): Session info serialization * feat(Creator): Save and load jobs to file * fix(Creator): Actually load the job * fix(Creator): Try to fix loading * fix(ScriptFunction): Fix memory corruption due to low stack size * fix(Creator): Fix "No translation." * fix(NativeHooks): Fix softlock when loading Cayo Perico * chore(Toxic): Remove net time test for now
This commit is contained in:
@ -8,6 +8,7 @@
|
||||
#include "util/toxic.hpp"
|
||||
#include "core/data/apartment_names.hpp"
|
||||
#include "core/data/warehouse_names.hpp"
|
||||
#include <network/Network.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
@ -20,6 +21,22 @@ namespace big
|
||||
session::join_by_rockstar_id(rid);
|
||||
});
|
||||
|
||||
static char base64[500]{};
|
||||
ImGui::InputText("Session Info", base64, sizeof(base64));
|
||||
components::button("Join Session Info", []
|
||||
{
|
||||
rage::rlSessionInfo info;
|
||||
g_pointers->m_decode_session_info(&info, base64, nullptr);
|
||||
session::join_session(info);
|
||||
});
|
||||
ImGui::SameLine();
|
||||
components::button("Copy Current Session Info", []
|
||||
{
|
||||
char buf[0x100];
|
||||
g_pointers->m_encode_session_info(>a_util::get_network()->m_game_session.m_rline_session.m_session_info, buf, 0x7D, nullptr);
|
||||
ImGui::SetClipboardText(buf);
|
||||
});
|
||||
|
||||
components::sub_title("Session Switcher");
|
||||
if (ImGui::ListBoxHeader("###session_switch"))
|
||||
{
|
||||
@ -163,6 +180,14 @@ namespace big
|
||||
ImGui::SameLine();
|
||||
components::button("Remove All Weapons", [] { g_player_service->iterate([](auto& plyr) { toxic::remove_all_weapons(plyr.second); }); });
|
||||
|
||||
components::button("CEO Kick", [] {
|
||||
g_player_service->iterate([](auto& plyr)
|
||||
{
|
||||
if (*scr_globals::gpbd_fm_3.at(plyr.second->id(), scr_globals::size::gpbd_fm_3).at(10).as<int*>() != -1)
|
||||
toxic::ceo_kick(plyr.second);
|
||||
});
|
||||
});
|
||||
|
||||
components::small_text("Teleports");
|
||||
|
||||
if (ImGui::BeginCombo("##apartment", apartment_names[g->session.send_to_apartment_idx]))
|
||||
@ -262,10 +287,10 @@ namespace big
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginGroup();
|
||||
components::button("One-On-One Deathmatch", [] { scripts::start_launcher_script(187); });
|
||||
components::button("One-On-One Deathmatch", [] { scripts::start_launcher_script(197); });
|
||||
components::button("Impromptu Race", [] { scripts::start_launcher_script(16); });
|
||||
components::button("Flight School", [] { scripts::start_launcher_script(186); });
|
||||
components::button("Golf", [] { scripts::start_launcher_script(183); });
|
||||
components::button("Flight School", [] { scripts::start_launcher_script(196); });
|
||||
components::button("Golf", [] { scripts::start_launcher_script(193); });
|
||||
components::button("Tutorial", [] { scripts::start_launcher_script(20); });
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("Only works on joining players");
|
||||
@ -274,11 +299,11 @@ namespace big
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginGroup();
|
||||
components::button("Gunslinger", [] { scripts::start_launcher_script(201); });
|
||||
components::button("Space Monkey", [] { scripts::start_launcher_script(206); });
|
||||
components::button("Wizard", [] { scripts::start_launcher_script(202); });
|
||||
components::button("QUB3D", [] { scripts::start_launcher_script(207); });
|
||||
components::button("Camhedz", [] { scripts::start_launcher_script(208); });
|
||||
components::button("Gunslinger", [] { scripts::start_launcher_script(211); });
|
||||
components::button("Space Monkey", [] { scripts::start_launcher_script(216); });
|
||||
components::button("Wizard", [] { scripts::start_launcher_script(212); });
|
||||
components::button("QUB3D", [] { scripts::start_launcher_script(217); });
|
||||
components::button("Camhedz", [] { scripts::start_launcher_script(218); });
|
||||
ImGui::EndGroup();
|
||||
|
||||
ImGui::Checkbox("Disable Pedestrians", &g->session.disable_peds);
|
||||
|
@ -16,6 +16,7 @@ namespace big
|
||||
{
|
||||
static char name_buf[32];
|
||||
static char search[64];
|
||||
static char session_info[255];
|
||||
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
|
||||
@ -31,6 +32,7 @@ namespace big
|
||||
if (components::selectable(std::to_string(g_matchmaking_service->get_found_sessions()[i].info.m_session_token), i == selected_session_idx))
|
||||
{
|
||||
selected_session_idx = i;
|
||||
g_pointers->m_encode_session_info(&g_matchmaking_service->get_found_sessions()[i].info, session_info, 0x7D, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -57,12 +59,17 @@ namespace big
|
||||
auto& data = session.info.m_net_player_data;
|
||||
ImGui::Text("Host Rockstar ID: %d", data.m_gamer_handle.m_rockstar_id);
|
||||
|
||||
components::button("Copy Session Info", []
|
||||
{
|
||||
ImGui::SetClipboardText(session_info);
|
||||
});
|
||||
ImGui::SameLine();
|
||||
components::button("Join", [session]
|
||||
{
|
||||
if (SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) != 0 ||
|
||||
STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS())
|
||||
{
|
||||
g_notification_service->push_error("RID Joiner", "Player switch in progress, wait a bit.");
|
||||
g_notification_service->push_error("Join Session", "Player switch in progress, wait a bit.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -15,12 +15,13 @@ namespace big
|
||||
toxic::kill_player(g_player_service->get_selected(), g_player_service->get_self());
|
||||
});
|
||||
|
||||
components::button("CEO Kick", [] { toxic::ceo_kick(g_player_service->get_selected()); });
|
||||
|
||||
components::button("Kick From Vehicle", [] { toxic::kick_player_from_vehicle(g_player_service->get_selected()); });
|
||||
ImGui::SameLine();
|
||||
components::button("Ragdoll Player", [] { toxic::ragdoll_player(g_player_service->get_selected()); });
|
||||
|
||||
components::button("Kick From Interior", [] { toxic::kick_player_from_interior(g_player_service->get_selected()); });
|
||||
ImGui::SameLine();
|
||||
components::button("Turn Into Beast", [] { toxic::turn_player_into_beast(g_player_service->get_selected()); });
|
||||
|
||||
static int wanted_level;
|
||||
|
@ -214,14 +214,6 @@ namespace big
|
||||
|
||||
ImGui::EndGroup();
|
||||
|
||||
components::sub_title("Launch Creator");
|
||||
ImGui::BeginGroup();
|
||||
components::button("Race", [] { scripts::start_creator_script(RAGE_JOAAT("fm_race_creator")); }); ImGui::SameLine();
|
||||
components::button("Capture", [] { scripts::start_creator_script(RAGE_JOAAT("fm_capture_creator")); }); ImGui::SameLine();
|
||||
components::button("Deathmatch", [] { scripts::start_creator_script(RAGE_JOAAT("fm_deathmatch_creator")); }); ImGui::SameLine();
|
||||
components::button("LTS", [] { scripts::start_creator_script(RAGE_JOAAT("fm_lts_creator")); });
|
||||
ImGui::EndGroup();
|
||||
|
||||
g->self.proof_mask = 0;
|
||||
if (g->self.god_mode)
|
||||
{
|
||||
|
@ -46,6 +46,7 @@ namespace big
|
||||
static void weapons();
|
||||
static void context_menu();
|
||||
static void gta_data();
|
||||
static void creator();
|
||||
|
||||
static void player_info();
|
||||
static void player_troll();
|
||||
|
85
src/views/world/view_creator.cpp
Normal file
85
src/views/world/view_creator.cpp
Normal file
@ -0,0 +1,85 @@
|
||||
#include "fiber_pool.hpp"
|
||||
#include "script.hpp"
|
||||
#include "views/view.hpp"
|
||||
#include "services/creator_storage/creator_storage_service.hpp"
|
||||
#include "util/scripts.hpp"
|
||||
|
||||
static bool cached_creator_files = false;
|
||||
static std::vector<std::string> creator_files;
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::creator()
|
||||
{
|
||||
static std::string selected_creator_file = "";
|
||||
if (!cached_creator_files)
|
||||
{
|
||||
creator_files = creator_storage_service::list_files();
|
||||
cached_creator_files = true;
|
||||
}
|
||||
|
||||
ImGui::PushItemWidth(250);
|
||||
components::sub_title("Saved Jobs");
|
||||
|
||||
if (ImGui::ListBoxHeader("##empty", ImVec2(200, 200)))
|
||||
{
|
||||
for (const auto& pair : creator_files)
|
||||
{
|
||||
if (ImGui::Selectable(pair.c_str(), selected_creator_file == pair))
|
||||
selected_creator_file = pair;
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginGroup();
|
||||
|
||||
if (!selected_creator_file.empty())
|
||||
{
|
||||
components::button("Save To File", []
|
||||
{
|
||||
creator_storage_service::save_file(selected_creator_file);
|
||||
});
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
components::button("Load From File", []
|
||||
{
|
||||
creator_storage_service::load_file(selected_creator_file);
|
||||
});
|
||||
}
|
||||
|
||||
static char job_file_name_input[50]{};
|
||||
|
||||
ImGui::PushItemWidth(250);
|
||||
components::input_text_with_hint(
|
||||
"Job Name",
|
||||
"Ex: My Cool Job",
|
||||
job_file_name_input, IM_ARRAYSIZE(job_file_name_input));
|
||||
|
||||
components::button("Create Job File", []
|
||||
{
|
||||
cached_creator_files = false;
|
||||
creator_storage_service::create_file(std::string(job_file_name_input) + ".json");
|
||||
});
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
components::button("Refresh", []
|
||||
{
|
||||
cached_creator_files = false;
|
||||
});
|
||||
|
||||
ImGui::EndGroup();
|
||||
|
||||
components::sub_title("Launch Creator");
|
||||
ImGui::BeginGroup();
|
||||
components::button("Race", [] { scripts::start_creator_script(RAGE_JOAAT("fm_race_creator")); }); ImGui::SameLine();
|
||||
components::button("Capture", [] { scripts::start_creator_script(RAGE_JOAAT("fm_capture_creator")); }); ImGui::SameLine();
|
||||
components::button("Deathmatch", [] { scripts::start_creator_script(RAGE_JOAAT("fm_deathmatch_creator")); }); ImGui::SameLine();
|
||||
components::button("LTS", [] { scripts::start_creator_script(RAGE_JOAAT("fm_lts_creator")); });
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user