aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Extrax64Stubs.cpp
diff options
context:
space:
mode:
authorSlenderman <ssimulpong@outlook.com>2026-03-03 11:58:22 -0500
committerGitHub <noreply@github.com>2026-03-03 23:58:22 +0700
commit515f91cad8e0625334954acd4024c6bfefcc89e8 (patch)
tree5245636194a1fce9ad559f7e9bdfd86be167b104 /Minecraft.Client/Extrax64Stubs.cpp
parent5c91c2608690872aabba4f62d5ceb02c934f5f32 (diff)
Fix player save data issue & multiple username implementations (#257)
* fix saving issue & multiple username implementations * Update README.md Updated the method for overriding in-game username from '-name' to 'username.txt'. * remove unused include i forgot to get rid of while testing
Diffstat (limited to 'Minecraft.Client/Extrax64Stubs.cpp')
-rw-r--r--Minecraft.Client/Extrax64Stubs.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/Minecraft.Client/Extrax64Stubs.cpp b/Minecraft.Client/Extrax64Stubs.cpp
index 3a86cbea..22ad578f 100644
--- a/Minecraft.Client/Extrax64Stubs.cpp
+++ b/Minecraft.Client/Extrax64Stubs.cpp
@@ -589,8 +589,21 @@ char fakeGamerTag[32] = "PlayerName";
void SetFakeGamertag(char* name) { strcpy_s(fakeGamerTag, name); }
char* C_4JProfile::GetGamertag(int iPad) { return fakeGamerTag; }
#else
-char* C_4JProfile::GetGamertag(int iPad) { extern char g_Win64Username[17]; return g_Win64Username; }
-wstring C_4JProfile::GetDisplayName(int iPad) { extern wchar_t g_Win64UsernameW[17]; return g_Win64UsernameW; }
+#include <windows.h>
+
+const char* C_4JProfile::GetGamertag(int iPad)
+{
+ static std::string narrowName;
+ const wchar_t* wideName = g_playerName.c_str();
+
+ int sizeNeeded = WideCharToMultiByte(CP_UTF8, 0, wideName, -1, nullptr, 0, nullptr, nullptr);
+
+ narrowName.resize(sizeNeeded);
+ WideCharToMultiByte(CP_UTF8, 0, wideName, -1, &narrowName[0], sizeNeeded, nullptr, nullptr);
+
+ return narrowName.c_str();
+}
+wstring C_4JProfile::GetDisplayName(int iPad) { return g_playerName; }
#endif
bool C_4JProfile::IsFullVersion() { return s_bProfileIsFullVersion; }
void C_4JProfile::SetSignInChangeCallback(void (*Func)(LPVOID, bool, unsigned int), LPVOID lpParam) {}