feat(Network): Region Switcher (#580)

This commit is contained in:
Aure7138 2022-11-12 07:13:01 +08:00 committed by GitHub
parent 6c65b534ec
commit 65493fc5cb
4 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,21 @@
#pragma once
namespace big
{
struct RegionType {
uint32_t id;
const char name[22];
};
const RegionType regions[] = {
{ 0, "CIS" },
{ 1, "Africa" },
{ 2, "East" },
{ 3, "Europe" },
{ 4, "China" },
{ 5, "Australia" },
{ 6, "West" },
{ 7, "Japan" },
{ 8, "Unknown" },
};
}

View File

@ -14,6 +14,11 @@ namespace big
m_resolution_y = ptr.add(4).rip().as<int*>();
});
main_batch.add("RC", "40 32 ED 83 25", [this](memory::handle ptr)
{
m_region_code = ptr.add(5).rip().add(1).as<uint32_t*>();
});
// Max Wanted Level
main_batch.add("MWL", "8B 43 6C 89 05", [this](memory::handle ptr)
{

View File

@ -45,6 +45,8 @@ namespace big
int* m_resolution_x;
int* m_resolution_y;
uint32_t* m_region_code;
memory::byte_patch* m_max_wanted_level;
memory::byte_patch* m_max_wanted_level_2;

View File

@ -1,6 +1,7 @@
#include "views/view.hpp"
#include "fiber_pool.hpp"
#include "util/session.hpp"
#include "core/data/region_codes.hpp"
namespace big
{
@ -25,6 +26,19 @@ namespace big
}
ImGui::EndListBox();
}
components::sub_title("Region Switcher");
if (ImGui::ListBoxHeader("###region_switch"))
{
for (const auto& region_type : regions)
{
components::selectable(region_type.name, *g_pointers->m_region_code == region_type.id, [&region_type]
{
*g_pointers->m_region_code = region_type.id;
});
}
ImGui::EndListBox();
}
components::sub_title("Chat");
ImGui::Checkbox("Disable Filter", &g->session.disable_chat_filter);