mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Cleaned up the code a bit; reverting amos fix for dedi; added instead separate dedi checkbox; added manual ip connect functionality in server browser; cleaned up the ui a bit
This commit is contained in:
parent
0e2eab438e
commit
bac0e5eb8a
@ -26,3 +26,4 @@ inline std::string OriginUID = "1010417302770";
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
|
void RunConsoleCommand(std::string command);
|
||||||
|
@ -21,8 +21,8 @@ void InstallOpcodes() /* .TEXT */
|
|||||||
// JNE --> JMP | Prevent connect command from crashing by invalid call to UI function
|
// JNE --> JMP | Prevent connect command from crashing by invalid call to UI function
|
||||||
WriteProcessMemory(GameProcess, LPVOID(dst004 + 0x1D6), "\xEB\x27", 2, NULL);
|
WriteProcessMemory(GameProcess, LPVOID(dst004 + 0x1D6), "\xEB\x27", 2, NULL);
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// JNE --> JMP | Prevent connect localhost from being executed after listen server init
|
// JNE --> JMP | Prevent connect localhost from being executed after listen server init ----- TEMPORARILY DISABLED
|
||||||
WriteProcessMemory(GameProcess, LPVOID(dst005 + 0x637), "\xE9\xC1\x00\x00\x00", 5, NULL);
|
//WriteProcessMemory(GameProcess, LPVOID(dst005 + 0x637), "\xE9\xC1\x00\x00\x00", 5, NULL);
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// JA --> JMP | Disable server-side verification for duplicate accounts on the server
|
// JA --> JMP | Disable server-side verification for duplicate accounts on the server
|
||||||
WriteProcessMemory(GameProcess, LPVOID(dst006 + 0x284), "\x90\x90", 2, NULL);
|
WriteProcessMemory(GameProcess, LPVOID(dst006 + 0x284), "\x90\x90", 2, NULL);
|
||||||
|
@ -452,6 +452,7 @@ public:
|
|||||||
ServerListing* SelectedServer;
|
ServerListing* SelectedServer;
|
||||||
|
|
||||||
char FilterBuffer[256] = { 0 };
|
char FilterBuffer[256] = { 0 };
|
||||||
|
char ServerConnStringBuffer[256] = { 0 };
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
// Settings //
|
// Settings //
|
||||||
@ -465,6 +466,7 @@ public:
|
|||||||
std::vector<std::string> MapsList;
|
std::vector<std::string> MapsList;
|
||||||
std::string* SelectedMap = nullptr;
|
std::string* SelectedMap = nullptr;
|
||||||
char ServerNameBuffer[64] = { 0 };
|
char ServerNameBuffer[64] = { 0 };
|
||||||
|
bool StartAsDedi;
|
||||||
|
|
||||||
enum class ESection : UINT8 {
|
enum class ESection : UINT8 {
|
||||||
ServerBrowser,
|
ServerBrowser,
|
||||||
@ -477,7 +479,9 @@ public:
|
|||||||
memset(FilterBuffer, 0, sizeof(FilterBuffer));
|
memset(FilterBuffer, 0, sizeof(FilterBuffer));
|
||||||
memset(MatchmakingServerStringBuffer, 0, sizeof(MatchmakingServerStringBuffer));
|
memset(MatchmakingServerStringBuffer, 0, sizeof(MatchmakingServerStringBuffer));
|
||||||
memset(ServerNameBuffer, 0, sizeof(ServerNameBuffer));
|
memset(ServerNameBuffer, 0, sizeof(ServerNameBuffer));
|
||||||
|
memset(ServerConnStringBuffer, 0, sizeof(ServerConnStringBuffer));
|
||||||
|
|
||||||
|
strcpy_s(ServerConnStringBuffer, "localhost");
|
||||||
|
|
||||||
strcpy_s(MatchmakingServerStringBuffer, "localhost");
|
strcpy_s(MatchmakingServerStringBuffer, "localhost");
|
||||||
|
|
||||||
@ -493,7 +497,7 @@ public:
|
|||||||
MapsList.push_back(filename);
|
MapsList.push_back(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SelectedMap = &MapsList[0];
|
||||||
|
|
||||||
//RefreshServerList();
|
//RefreshServerList();
|
||||||
|
|
||||||
@ -540,14 +544,15 @@ public:
|
|||||||
|
|
||||||
void ServerBrowserSection()
|
void ServerBrowserSection()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
ImGui::BeginGroup();
|
||||||
ImGui::InputText("Filter", FilterBuffer, IM_ARRAYSIZE(FilterBuffer), 0);
|
ImGui::InputText("Filter", FilterBuffer, IM_ARRAYSIZE(FilterBuffer), 0);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Spacing();
|
if (ImGui::Button("Refresh List", ImVec2(ImGui::GetWindowSize().x * (2.f/6.f), 19)))
|
||||||
ImGui::SameLine();
|
|
||||||
if (ImGui::Button("Refresh List"))
|
|
||||||
{
|
{
|
||||||
RefreshServerList();
|
RefreshServerList();
|
||||||
}
|
}
|
||||||
|
ImGui::EndGroup();
|
||||||
|
|
||||||
ImGui::BeginChild("ServerListChild", { 0, 780 }, false, ImGuiWindowFlags_HorizontalScrollbar);
|
ImGui::BeginChild("ServerListChild", { 0, 780 }, false, ImGuiWindowFlags_HorizontalScrollbar);
|
||||||
|
|
||||||
@ -586,35 +591,63 @@ public:
|
|||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
|
|
||||||
ImGui::Spacing();
|
ImGui::Separator();
|
||||||
ImGui::Button("Connect to the server", ImVec2(ImGui::GetWindowSize().x, 32));
|
ImGui::InputText("##ServerBrowser_ServerConnString", ServerConnStringBuffer, IM_ARRAYSIZE(ServerConnStringBuffer));
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Connect to the server", ImVec2(ImGui::GetWindowSize().x * (1.f / 3.f), 19)))
|
||||||
|
{
|
||||||
|
std::stringstream cmd;
|
||||||
|
cmd << "connect " << ServerConnStringBuffer;
|
||||||
|
RunConsoleCommand(cmd.str().c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HostServerSection()
|
void HostServerSection()
|
||||||
{
|
{
|
||||||
ImGui::InputText("ServerName##ServerHost_ServerName", ServerNameBuffer, IM_ARRAYSIZE(ServerNameBuffer));
|
ImGui::InputText("Server Name##ServerHost_ServerName", ServerNameBuffer, IM_ARRAYSIZE(ServerNameBuffer));
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
ImGui::BeginListBox("Map##ServerHost_MapListBox");
|
if (ImGui::BeginCombo("Map##ServerHost_MapListBox", SelectedMap->c_str()))
|
||||||
for(auto& item : MapsList)
|
|
||||||
{
|
{
|
||||||
if (ImGui::Selectable(item.c_str(), &item == SelectedMap))
|
for (auto& item : MapsList)
|
||||||
{
|
{
|
||||||
SelectedMap = &item;
|
if (ImGui::Selectable(item.c_str(), &item == SelectedMap))
|
||||||
|
{
|
||||||
|
SelectedMap = &item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
}
|
}
|
||||||
ImGui::EndListBox();
|
ImGui::Spacing();
|
||||||
if (ImGui::Button("Host The Server", ImVec2(ImGui::GetWindowSize().x, 32)))
|
|
||||||
|
ImGui::Checkbox("Start as dedicated server (HACK)##ServerHost_DediCheckbox", &StartAsDedi);
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
if (ImGui::Button("Start The Server##ServerHost_StartServerButton", ImVec2(ImGui::GetWindowSize().x, 32)))
|
||||||
{
|
{
|
||||||
std::stringstream cmd;
|
std::stringstream cmd;
|
||||||
cmd << "map " << SelectedMap->c_str();
|
cmd << "map " << SelectedMap->c_str();
|
||||||
static CGameConsole console;
|
RunConsoleCommand(cmd.str());
|
||||||
console.ProcessCommand(cmd.str().c_str());
|
if (StartAsDedi)
|
||||||
|
{
|
||||||
|
ToggleDevCommands();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (ImGui::Button("Stop The Server", ImVec2(ImGui::GetWindowSize().x, 32)))
|
if (StartAsDedi)
|
||||||
{
|
{
|
||||||
static CGameConsole console;
|
if (ImGui::Button("Reload Scripts##ServerHost_ReloadServerButton", ImVec2(ImGui::GetWindowSize().x, 32)))
|
||||||
console.ProcessCommand("disconnect");
|
{
|
||||||
|
RunConsoleCommand("reparse_weapons");
|
||||||
|
RunConsoleCommand("reload");
|
||||||
|
}
|
||||||
|
if (ImGui::Button("Stop The Server##ServerHost_StopServerButton", ImVec2(ImGui::GetWindowSize().x, 32)))
|
||||||
|
{
|
||||||
|
RunConsoleCommand("disconnect");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsSection()
|
void SettingsSection()
|
||||||
@ -708,3 +741,10 @@ void ShowGameConsole(bool* p_open)
|
|||||||
console.DrawConsole("Console", p_open);
|
console.DrawConsole("Console", p_open);
|
||||||
browser.DrawCompanion("Companion", p_open);
|
browser.DrawCompanion("Companion", p_open);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RunConsoleCommand(std::string command)
|
||||||
|
{
|
||||||
|
static CGameConsole console;
|
||||||
|
console.ProcessCommand(command.c_str());
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user