feat: username.txt support
This commit is contained in:
1 parent
a6895e1fda
commit
f2d81a0bc6
6 files changed
+66
-4
No files matched your search
@@ -1,14 +1,14 @@
|
|||||||
#include "4J_Profile.h"
|
#include "4J_Profile.h"
|
||||||
#include "PRO_Main.h"
|
#include "PRO_Main.h"
|
||||||
|
|
||||||
void C_4JProfile::LoadSettings(void* gs, size_t gsSize)
|
int C_4JProfile::GetLockedProfile()
|
||||||
{
|
{
|
||||||
InternalProfileManager.m_ProfileData.LoadSettings(gs, gsSize);
|
return InternalProfileManager.GetLockedProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_4JProfile::SaveSettings(void* gs, size_t gsSize)
|
void C_4JProfile::SetLockedProfile(int iProf)
|
||||||
{
|
{
|
||||||
InternalProfileManager.m_ProfileData.SaveSettings(gs, gsSize);
|
InternalProfileManager.SetLockedProfile(iProf);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C_4JProfile::IsSignedIn(int iQuadrant)
|
bool C_4JProfile::IsSignedIn(int iQuadrant)
|
||||||
@@ -31,6 +31,11 @@ bool C_4JProfile::AllowedToPlayMultiplayer(int iProf)
|
|||||||
return InternalProfileManager.m_Sys.AllowedToPlayMultiplayer(iProf);
|
return InternalProfileManager.m_Sys.AllowedToPlayMultiplayer(iProf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void C_4JProfile::LoadGamertag()
|
||||||
|
{
|
||||||
|
InternalProfileManager.m_Sys.LoadGamertag();
|
||||||
|
}
|
||||||
|
|
||||||
void C_4JProfile::SetFakeGamerTag(char *name)
|
void C_4JProfile::SetFakeGamerTag(char *name)
|
||||||
{
|
{
|
||||||
InternalProfileManager.m_Sys.SetFakeGamertag(name);
|
InternalProfileManager.m_Sys.SetFakeGamertag(name);
|
||||||
@@ -71,6 +76,16 @@ bool C_4JProfile::IsSystemUIDisplayed()
|
|||||||
return 0; //str1k3r - matches durango profile lib
|
return 0; //str1k3r - matches durango profile lib
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void C_4JProfile::LoadSettings(void* gs, size_t gsSize)
|
||||||
|
{
|
||||||
|
InternalProfileManager.m_ProfileData.LoadSettings(gs, gsSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_4JProfile::SaveSettings(void* gs, size_t gsSize)
|
||||||
|
{
|
||||||
|
InternalProfileManager.m_ProfileData.SaveSettings(gs, gsSize);
|
||||||
|
}
|
||||||
|
|
||||||
void C_4JProfile::SetDebugFullOverride(bool bVal)
|
void C_4JProfile::SetDebugFullOverride(bool bVal)
|
||||||
{
|
{
|
||||||
InternalProfileManager.m_Sys.SetDebugFullOverride(bVal);
|
InternalProfileManager.m_Sys.SetDebugFullOverride(bVal);
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
#include "PRO_Main.h"
|
#include "PRO_Main.h"
|
||||||
|
|
||||||
CProfile InternalProfileManager;
|
CProfile InternalProfileManager;
|
||||||
|
|
||||||
|
int CProfile::GetLockedProfile()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProfile::SetLockedProfile(int iProf)
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
@@ -6,6 +6,9 @@
|
|||||||
class CProfile
|
class CProfile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
int GetLockedProfile();
|
||||||
|
void SetLockedProfile(int iProf);
|
||||||
|
|
||||||
CSys m_Sys;
|
CSys m_Sys;
|
||||||
CProfileData m_ProfileData;
|
CProfileData m_ProfileData;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,6 +26,38 @@ bool CSys::IsGuest(int iQuadrant)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSys::LoadGamertag()
|
||||||
|
{
|
||||||
|
wchar_t exeDir[MAX_PATH] = {};
|
||||||
|
GetModuleFileNameW(NULL, exeDir, MAX_PATH);
|
||||||
|
wchar_t *lastSlash = wcsrchr(exeDir, '\\');
|
||||||
|
if (lastSlash) *(lastSlash + 1) = '\0';
|
||||||
|
|
||||||
|
wchar_t filePath[MAX_PATH] = {};
|
||||||
|
if(wcscpy_s(filePath, _countof(filePath), exeDir) != 0 || wcsncat_s(filePath, _countof(filePath), L"username.txt", _TRUNCATE) != 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE *file = NULL;
|
||||||
|
if (_wfopen_s(&file, filePath, L"r") == 0 && file)
|
||||||
|
{
|
||||||
|
wchar_t buffer[128] = {};
|
||||||
|
if(fgetws(buffer, _countof(buffer), file))
|
||||||
|
{
|
||||||
|
size_t len = wcslen(buffer);
|
||||||
|
while (len > 0 && (buffer[len-1] == '\n' || buffer[len-1] == '\r' || buffer[len-1] == ' ')) buffer[--len] = '\0';
|
||||||
|
|
||||||
|
if (len > 0)
|
||||||
|
{
|
||||||
|
wcscpy_s(fakeGamerTagW, _countof(fakeGamerTagW), buffer);
|
||||||
|
WideCharToMultiByte(CP_UTF8, 0, fakeGamerTagW, -1, fakeGamerTag, sizeof(fakeGamerTag), nullptr, nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CSys::SetFakeGamertag(char *name)
|
void CSys::SetFakeGamertag(char *name)
|
||||||
{
|
{
|
||||||
size_t chars = 0;
|
size_t chars = 0;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ public:
|
|||||||
bool IsGuest(int iQuadrant);
|
bool IsGuest(int iQuadrant);
|
||||||
|
|
||||||
// GAMERTAG
|
// GAMERTAG
|
||||||
|
void LoadGamertag();
|
||||||
void SetFakeGamertag(char *name);
|
void SetFakeGamertag(char *name);
|
||||||
char* GetGamertag(int iPad);
|
char* GetGamertag(int iPad);
|
||||||
wstring GetDisplayName(int iPad);
|
wstring GetDisplayName(int iPad);
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ public:
|
|||||||
// SYS
|
// SYS
|
||||||
int GetPrimaryPad();
|
int GetPrimaryPad();
|
||||||
void SetPrimaryPad(int iPad);
|
void SetPrimaryPad(int iPad);
|
||||||
|
void LoadGamertag();
|
||||||
void SetFakeGamerTag(char *name);
|
void SetFakeGamerTag(char *name);
|
||||||
char* GetGamertag(int iPad);
|
char* GetGamertag(int iPad);
|
||||||
wstring GetDisplayName(int iPad);
|
wstring GetDisplayName(int iPad);
|
||||||
|
|||||||
Reference in new issue
Block a user