feat: non fully stubbed profile lib

This commit is contained in:
2026-09-07 02:15:30 -04:00
parent e1fd02765a
commit 0a87b227d3
6 changed files with 218 additions and 133 deletions
+61 -57
View File
@@ -1,68 +1,72 @@
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "4J_Profile.h"
#include <Windows.h>
#include <stdio.h>
C_4JProfile ProfileManager;
//str1k3r - GetSettings is basically snatched from smartCMD
void GetSettings(wchar_t *outPath, DWORD size)
{
GetModuleFileNameW(NULL, outPath, size); //str1k3r - unlike smartCMD we use wide so we can handle non english characters
wchar_t *lastSlash = wcsrchr(outPath, '\\');
if (lastSlash) *(lastSlash + 1) = '\0';
wcsncat_s(outPath, size, L"settings.dat", _TRUNCATE);
}
#include "PRO_Main.h"
void C_4JProfile::LoadSettings(void* gs, size_t gsSize)
{
if (!gs || gsSize == 0) return;
wchar_t settingsPath[MAX_PATH] = {};
GetSettings(settingsPath, MAX_PATH);
FILE *file = NULL;
if (_wfopen_s(&file, settingsPath, L"rb") == 0 && file) //str1k3r - fun fact theres a version of fopen_s but for wide :3
{
fread(gs, 1, gsSize, file);
fclose(file);
}
InternalProfileManager.LoadSettings(gs, gsSize);
}
void C_4JProfile::SaveSettings(void* gs, size_t gsSize)
{
if (!gs || gsSize == 0) return;
InternalProfileManager.SaveSettings(gs, gsSize);
}
wchar_t settingsPath[MAX_PATH] = {};
GetSettings(settingsPath, MAX_PATH);
bool C_4JProfile::IsSignedIn(int iQuadrant)
{
return InternalProfileManager.m_Sys.IsSignedIn(iQuadrant);
}
FILE *file = NULL;
if (_wfopen_s(&file, settingsPath, L"wb") == 0 && file)
{
fwrite(gs, 1, gsSize, file);
fclose(file);
}
bool C_4JProfile::IsSignedInLive(int iProf)
{
return InternalProfileManager.m_Sys.IsSignedInLive(iProf);
}
bool C_4JProfile::IsGuest(int iQuadrant)
{
return InternalProfileManager.m_Sys.IsGuest(iQuadrant);
}
bool C_4JProfile::AllowedToPlayMultiplayer(int iProf)
{
return InternalProfileManager.m_Sys.AllowedToPlayMultiplayer(iProf);
}
void C_4JProfile::SetFakeGamerTag(char *name)
{
InternalProfileManager.m_Sys.SetFakeGamertag(name);
}
char* C_4JProfile::GetGamertag(int iPad)
{
return InternalProfileManager.m_Sys.GetGamertag(iPad);
}
wstring C_4JProfile::GetDisplayName(int iPad)
{
return InternalProfileManager.m_Sys.GetDisplayName(iPad);
}
int C_4JProfile::GetPrimaryPad()
{
return InternalProfileManager.m_Sys.GetPrimaryPad();
}
void C_4JProfile::SetPrimaryPad(int iPad)
{
InternalProfileManager.m_Sys.SetPrimaryPad(iPad);
}
bool C_4JProfile::IsFullVersion()
{
return InternalProfileManager.m_Sys.IsFullVersion();
}
HRESULT C_4JProfile::GetLiveConnectionStatus()
{
return S_OK; //str1k3r - matches durango profile lib
}
bool C_4JProfile::IsSystemUIDisplayed()
{
return 0; //str1k3r - matches durango profile lib
}
+38 -19
View File
@@ -1,23 +1,42 @@
/*
MIT License
#include "PRO_Main.h"
Copyright (c) 2026 Patoke
CProfile InternalProfileManager;
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
//str1k3r - GetSettings is basically snatched from smartCMD
void GetSettings(wchar_t *outPath, DWORD size)
{
GetModuleFileNameW(NULL, outPath, size); //str1k3r - unlike smartCMD we use wide so we can handle non english characters
wchar_t *lastSlash = wcsrchr(outPath, '\\');
if (lastSlash) *(lastSlash + 1) = '\0';
wcsncat_s(outPath, size, L"settings.dat", _TRUNCATE);
}
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
void CProfile::LoadSettings(void* gs, size_t gsSize)
{
if (!gs || gsSize == 0) return;
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
wchar_t settingsPath[MAX_PATH] = {};
GetSettings(settingsPath, MAX_PATH);
FILE *file = NULL;
if (_wfopen_s(&file, settingsPath, L"rb") == 0 && file) //str1k3r - fun fact theres a version of fopen_s but for wide :3
{
fread(gs, 1, gsSize, file);
fclose(file);
}
}
void CProfile::SaveSettings(void* gs, size_t gsSize)
{
if (!gs || gsSize == 0) return;
wchar_t settingsPath[MAX_PATH] = {};
GetSettings(settingsPath, MAX_PATH);
FILE *file = NULL;
if (_wfopen_s(&file, settingsPath, L"wb") == 0 && file)
{
fwrite(gs, 1, gsSize, file);
fclose(file);
}
}
+11 -19
View File
@@ -1,24 +1,16 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
#include "PRO_Sys.h"
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
class CProfile
{
public:
// SETTINGS
void LoadSettings(void* gs, size_t gsSize);
void SaveSettings(void* gs, size_t gsSize);
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
CSys m_Sys;
};
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
// Singleton
extern CProfile InternalProfileManager;
+83 -19
View File
@@ -1,23 +1,87 @@
/*
MIT License
#include "PRO_Sys.h"
#include "4J_Input.h"
Copyright (c) 2026 Patoke
bool s_bProfileIsFullVersion = true;
char fakeGamerTag[16] = "PlayerName";
wchar_t fakeGamerTagW[16] = L"PlayerName";
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
bool CSys::IsSignedIn(int iQuadrant)
{
return InputManager.IsPadConnected(iQuadrant); //str1k3r - since we dont sign in like consoles just check if the pad is connected
}
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
bool CSys::IsSignedInLive(int iProf)
{
return InputManager.IsPadConnected(iProf);
}
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
bool CSys::IsGuest(int iQuadrant)
{
//if(iQuadrant == 0)
//{
// return false;
//}
return false;//true;
}
void CSys::SetFakeGamertag(char *name)
{
size_t chars = 0;
strcpy_s(fakeGamerTag, name);
mbstowcs_s(&chars, fakeGamerTagW, 16, name, _TRUNCATE);
}
char* CSys::GetGamertag(int iPad)
{
if(iPad == 0)
{
return fakeGamerTag;
}
static char iPadGamertag[32];
_snprintf_s(iPadGamertag, sizeof(iPadGamertag), "%s (%d)", fakeGamerTag, iPad);
return iPadGamertag;
}
wstring CSys::GetDisplayName(int iPad)
{
if(iPad == 0)
{
return fakeGamerTagW;
}
wchar_t iPadGamertagW[32];
_snwprintf_s(iPadGamertagW, _countof(iPadGamertagW), L"%s (%d)", fakeGamerTagW, iPad);
return iPadGamertagW;
}
bool CSys::AllowedToPlayMultiplayer(int iProf)
{
return InputManager.IsPadConnected(iProf);
}
int CSys::GetPrimaryPad()
{
return 0;
}
void CSys::SetPrimaryPad(int iPad)
{
; //str1k3r - stubbed out
}
bool CSys::IsFullVersion()
{
return s_bProfileIsFullVersion;
}
void CSys::SetDebugFullOverride(bool bVal)
{
s_bProfileIsFullVersion = bVal;
}
+24 -19
View File
@@ -1,24 +1,29 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
#include "4J_Profile.h"
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
class CSys
{
public:
// SIGNED IN
bool IsSignedIn(int iQuadrant);
bool IsSignedInLive(int iProf);
bool IsGuest(int iQuadrant);
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
// GAMERTAG
void SetFakeGamertag(char *name);
char* GetGamertag(int iPad);
wstring GetDisplayName(int iPad);
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
// PRIMARY PAD
int GetPrimaryPad();
void SetPrimaryPad(int iPad);
// MULTIPLAYER
bool AllowedToPlayMultiplayer(int iProf);
// VERSION
bool IsFullVersion();
void SetDebugFullOverride(bool bVal);
};
+1
View File
@@ -75,6 +75,7 @@ public:
// SYS
int GetPrimaryPad();
void SetPrimaryPad(int iPad);
void SetFakeGamerTag(char *name);
char* GetGamertag(int iPad);
wstring GetDisplayName(int iPad);
bool IsFullVersion();