Compare commits

21 Commits
Author SHA1 Message Date
qloak 7ca3958dce merge cafeberry/kbm (keep ported KBM input) 2026-09-14 18:25:30 -07:00
qloak 6195bd193d fix: pad 0 signed in when keyboard focused (KBM without gamepad) 2026-09-14 17:54:37 -07:00
qloak 1ba5902026 fix: default return for GetControllerType 2026-09-14 16:25:32 -07:00
qloak d0db40a3ee add kbm support 2026-09-14 15:46:56 -07:00
str1k3r f2d81a0bc6 feat: username.txt support 2026-09-10 22:05:36 -04:00
str1k3r a6895e1fda feat: GetScreenSize 2026-09-10 17:53:23 -04:00
str1k3r 54a04f9214 fix: compilation 2026-09-07 16:05:42 -04:00
str1k3r 4f97d02e41 fix: vsyncstate updating even if new and old states are same 2026-09-07 14:11:13 -04:00
str1k3r bd2bafe8ae feat: more profile stuff 2026-09-07 14:10:31 -04:00
str1k3r 0a87b227d3 feat: non fully stubbed profile lib 2026-09-07 02:15:30 -04:00
str1k3r e1fd02765a refactor: make controller types enum 2026-09-05 09:13:37 -04:00
str1k3r 758549ceca chore: cleanup the getcontrollertype stuff 2026-09-02 18:58:45 -04:00
str1k3r 0917179043 feat(windows64): SelectBackSwapped 2026-08-30 22:06:52 -04:00
str1k3r e00f0215cc fix: i forgot to make this wide too 2026-08-30 17:05:07 -04:00
str1k3r baabec77f7 feat(windows64): 4JLibs durango parity / switch to wide 2026-08-30 16:41:59 -04:00
str1k3r 4c50659091 fix: something idfk im tired dude 2026-08-25 21:50:26 -04:00
str1k3r fdc89a23ea fix: HighDef check? & add setres thing 2026-08-25 21:22:37 -04:00
str1k3r e2f5f4c545 feat: working widescreen and HighDef checks 2026-08-25 19:07:51 -04:00
str1k3r 2c2c7b8075 chore: add windows 10 sdk warning 2026-08-23 17:40:30 -04:00
str1k3r d767a810e8 feat:: vsync stuff 2026-08-23 17:14:36 -04:00
str1k3r 3df111d9a3 feat: settings 2026-08-19 23:01:00 -04:00
34 changed files with 646 additions and 267 deletions

No files matched your search

+3 -2
View File
@@ -239,9 +239,9 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<IntrinsicFunctions>false</IntrinsicFunctions>
<PreprocessorDefinitions>_WINDOWS64;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>../Headers/Windows64;../Headers;$(ProjectDir);$(ProjectDir)Windows64\vendor\SDL\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -249,6 +249,7 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<CompileAs>CompileAsCpp</CompileAs>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
+3 -3
View File
@@ -293,9 +293,6 @@
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Windows64\4J_Input.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Windows64\INP_ForceFeedback.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -314,5 +311,8 @@
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Windows64\4J_Input.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
+35 -13
View File
@@ -129,6 +129,16 @@ bool C_4JInput::IsPadConnected(int iPad)
return InternalInputManager.IsPadConnected(iPad);
}
void C_4JInput::SetSelectBackSwapped(bool swapped)
{
InternalInputManager.SetSelectBackSwapped(swapped);
}
bool C_4JInput::IsSelectBackSwapped()
{
return InternalInputManager.IsSelectBackSwapped();
}
bool C_4JInput::IsPadActive(int iPad)
{
return InternalInputManager.IsPadActive(iPad);
@@ -254,11 +264,26 @@ bool C_4JInput::HasChar() const
return InternalKeyboard.HasChar();
}
int C_4JInput::GetCharCount() const
{
return InternalKeyboard.GetCharCount();
}
wchar_t C_4JInput::GetChar(int index) const
{
return InternalKeyboard.GetChar(index);
}
int C_4JInput::GetClipboardText(wchar_t *outText, int outCapacity) const
{
return InternalKeyboard.GetClipboardText(outText, outCapacity);
}
bool C_4JInput::SetClipboardText(const wchar_t *text) const
{
return InternalKeyboard.SetClipboardText(text);
}
void C_4JInput::OnMouseMove(int x, int y)
{
InternalKeyboard.OnMouseMove(x, y);
@@ -319,6 +344,11 @@ bool C_4JInput::IsMouseCaptured() const
return InternalKeyboard.IsMouseCaptured();
}
bool C_4JInput::IsWindowFocused() const
{
return InternalKeyboard.IsWindowFocused();
}
void C_4JInput::SetMousePos(int x, int y)
{
InternalKeyboard.SetMousePos(x, y);
@@ -345,21 +375,13 @@ void C_4JInput::GetText(uint16_t *UTF16String)
InternalKeyboard.GetText(UTF16String);
}
const char* C_4JInput::PollControllerType(int ipad) {
const char* GamepadType = InternalInputManager.GetGamepadType(ipad);
if (!GamepadType)
return "UNKNOWN";
if (strcmp(GamepadType, "SWITCH_PRO") == 0 ||
strcmp(GamepadType, "JOYCON_PAIR") == 0 ||
strcmp(GamepadType, "JOYCON_L") == 0 ||
strcmp(GamepadType, "JOYCON_R") == 0)
EControllerType C_4JInput::GetControllerType(int iPad)
{
if(InternalInputManager.IsPadConnected(iPad))
{
return "SWITCH";
return InternalInputManager.GetControllerType(iPad); //strk13r - mrow mrow mrow mrowwwwwwwwwww, i am silly kitty
}
return GamepadType; // str1k3r - if not one of the switch types, return the type itself
return EControllerType_Default;
}
bool C_4JInput::VerifyStrings(WCHAR **pwStringA, int iStringC, int (*Func)(LPVOID, STRING_VERIFY_RESPONSE *), LPVOID lpParam)
+49
View File
@@ -103,6 +103,55 @@ void CKeyboard::OnChar(wchar_t ch)
}
}
int CKeyboard::GetClipboardText(wchar_t *outText, int outCapacity) const
{
if (!outText || outCapacity <= 0)
return 0;
outText[0] = 0;
if (!OpenClipboard(g_hWnd))
return 0;
int copied = 0;
HANDLE h = GetClipboardData(CF_UNICODETEXT);
if (h)
{
const wchar_t *src = (const wchar_t *)GlobalLock(h);
if (src)
{
while (src[copied] && copied + 1 < outCapacity)
{
outText[copied] = src[copied];
++copied;
}
outText[copied] = 0;
GlobalUnlock(h);
}
}
CloseClipboard();
return copied;
}
bool CKeyboard::SetClipboardText(const wchar_t *text) const
{
if (!text)
return false;
size_t len = wcslen(text);
if (!OpenClipboard(g_hWnd))
return false;
EmptyClipboard();
bool ok = false;
HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(wchar_t));
if (h)
{
memcpy(GlobalLock(h), text, (len + 1) * sizeof(wchar_t));
GlobalUnlock(h);
ok = (SetClipboardData(CF_UNICODETEXT, h) != NULL);
if (!ok)
GlobalFree(h);
}
CloseClipboard();
return ok;
}
bool CKeyboard::IsKeyDown(int vkCode) const
{
if (vkCode >= 0 && vkCode < MAX_KEYS)
+4
View File
@@ -84,9 +84,13 @@ public:
int GetCharCount() const { return m_charCount; }
wchar_t GetChar(int index) const { return (index >= 0 && index < m_charCount) ? m_charBuffer[index] : 0; }
int GetClipboardText(wchar_t *outText, int outCapacity) const;
bool SetClipboardText(const wchar_t *text) const;
void SetMouseCaptured(bool captured);
void SetWindowFocused(bool focused);
bool IsMouseCaptured() const { return m_mouseCaptured; }
bool IsWindowFocused() const { return m_windowFocused; }
void SetMousePos(int x, int y) { m_mouseX = x; m_mouseY = y; }
+15 -7
View File
@@ -27,6 +27,8 @@ SOFTWARE.
CInput InternalInputManager;
bool m_SelectBackSwapped = false;
CInput::CInput()
{
m_uiSigninJoypadMask = 0;
@@ -311,14 +313,10 @@ unsigned int CInput::GetGameJoypadMaps(unsigned char ucMap, unsigned char ucActi
return m_JoypadMap[ucMap][ucAction];
}
const char* CInput::GetGamepadType(int iPad)
//str1k3r - renamed to match the Orbis Input lib, why did i rename it cause tism
EControllerType CInput::GetControllerType(int iPad)
{
if (!m_Joypads[iPad].m_pGamepad)
{
return "UNKNOWN";
}
return GamepadTypeName(SDL_GetGamepadType(m_Joypads[iPad].m_pGamepad));
return GetControllerName(SDL_GetGamepadType(m_Joypads[iPad].m_pGamepad)); // str1k3r - magic we return it :shocked:
}
void CInput::SetJoypadMapVal(int iPad, unsigned char ucMap)
@@ -404,6 +402,16 @@ bool CInput::IsPadConnected(int iPad)
return m_Joypads[iPad].m_bIsConnected;
}
void CInput::SetSelectBackSwapped(bool swapped)
{
m_SelectBackSwapped = swapped;
}
bool CInput::IsSelectBackSwapped()
{
return m_SelectBackSwapped;
}
bool CInput::IsPadActive(int iPad)
{
return m_Joypads[iPad].m_bControllerActive;
+24 -21
View File
@@ -31,26 +31,6 @@ SOFTWARE.
class CInput
{
private:
const char* GamepadTypeName(SDL_GamepadType type)
{
switch (type)
{
case SDL_GAMEPAD_TYPE_UNKNOWN: return "UNKNOWN";
case SDL_GAMEPAD_TYPE_GAMECUBE: return "GAMECUBE";
case SDL_GAMEPAD_TYPE_STANDARD: return "STANDARD";
case SDL_GAMEPAD_TYPE_XBOX360: return "XBOX360";
case SDL_GAMEPAD_TYPE_XBOXONE: return "XBOXONE";
case SDL_GAMEPAD_TYPE_PS3: return "PS3";
case SDL_GAMEPAD_TYPE_PS4: return "PS4";
case SDL_GAMEPAD_TYPE_PS5: return "PS5";
case SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO: return "SWITCH_PRO";
case SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT: return "JOYCON_L";
case SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT: return "JOYCON_R";
case SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR: return "JOYCON_PAIR";
default: return "UNKNOWN";
}
}
public:
struct JOYPAD
{
@@ -122,7 +102,7 @@ public:
void SetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction, unsigned int uiActionVal);
unsigned int GetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction);
const char* GetGamepadType(int iPad);
EControllerType GetControllerType(int iPad);
void SetJoypadMapVal(int iPad, unsigned char ucMap);
unsigned char GetJoypadMapVal(int iPad);
@@ -131,6 +111,8 @@ public:
void SetJoypadStickTriggerMap(int iPad, unsigned int uiFrom, unsigned int uiTo);
bool IsPadConnected(int iPad);
void SetSelectBackSwapped(bool swapped);
bool IsSelectBackSwapped();
bool IsPadActive(int iPad);
void SetSigninJoypadMask(unsigned int mask);
unsigned int GetValue(int iPad, unsigned char ucAction, bool bRepeat = false);
@@ -207,6 +189,27 @@ public:
LPVOID m_pDebugSequenceParam;
unsigned int m_iTouchInputButton[MAX_JOYPADS];
private:
EControllerType GetControllerName(SDL_GamepadType type)
{
switch (type)
{
case SDL_GAMEPAD_TYPE_XBOX360: return EControllerType_Xbox360;
case SDL_GAMEPAD_TYPE_XBOXONE: return EControllerType_XboxOne;
case SDL_GAMEPAD_TYPE_PS3: return EControllerType_PS3;
case SDL_GAMEPAD_TYPE_PS4: return EControllerType_PS4;
case SDL_GAMEPAD_TYPE_PS5: return EControllerType_PS5;
case SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO:
case SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT:
case SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT:
case SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR: return EControllerType_Switch;
case SDL_GAMEPAD_TYPE_GAMECUBE: return EControllerType_Gamecube;
case SDL_GAMEPAD_TYPE_STANDARD:
case SDL_GAMEPAD_TYPE_UNKNOWN:
default: return EControllerType_Default;
}
}
};
// Singleton
+4
View File
@@ -1,13 +1,17 @@
#ifndef PCH_H
#define PCH_H
#ifdef _WIN64
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <cstdint>
#include <assert.h>
#include <Xinput.h>
#endif
#ifndef _XBOX
#include "extraX64.h"
#endif
#endif //PCH_H
+4 -3
View File
@@ -121,7 +121,7 @@
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>../Headers/Windows64;../Headers;$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
@@ -153,15 +153,16 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<IntrinsicFunctions>false</IntrinsicFunctions>
<PreprocessorDefinitions>_WINDOWS64;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>../Headers/Windows64;../Headers;$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
+89 -25
View File
@@ -1,28 +1,92 @@
/*
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 "PRO_Main.h"
C_4JProfile ProfileManager;
int C_4JProfile::GetLockedProfile()
{
return InternalProfileManager.GetLockedProfile();
}
void C_4JProfile::SetLockedProfile(int iProf)
{
InternalProfileManager.SetLockedProfile(iProf);
}
bool C_4JProfile::IsSignedIn(int iQuadrant)
{
return InternalProfileManager.m_Sys.IsSignedIn(iQuadrant);
}
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::LoadGamertag()
{
InternalProfileManager.m_Sys.LoadGamertag();
}
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
}
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)
{
InternalProfileManager.m_Sys.SetDebugFullOverride(bVal);
}
+42 -19
View File
@@ -1,23 +1,46 @@
/*
MIT License
#include "PRO_Data.h"
#include "4J_Profile.h"
Copyright (c) 2026 Patoke
//C_4JProfile::PROFILESETTINGS * CProfileData::GetDashboardProfileSettings(int iPad)
//{
// ; //str1k3r - stubbed out for now
//}
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 CProfileData::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 CProfileData::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);
}
}
+7 -22
View File
@@ -1,24 +1,9 @@
#pragma once
/*
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.
*/
class CProfileData
{
public:
// SETTINGS
void LoadSettings(void* gs, size_t gsSize);
void SaveSettings(void* gs, size_t gsSize);
};
+10 -20
View File
@@ -1,23 +1,13 @@
/*
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:
int CProfile::GetLockedProfile()
{
return 0;
}
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.
*/
void CProfile::SetLockedProfile(int iProf)
{
;
}
+12 -19
View File
@@ -1,24 +1,17 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
#include "PRO_Sys.h"
#include "PRO_Data.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:
int GetLockedProfile();
void SetLockedProfile(int iProf);
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
CSys m_Sys;
CProfileData m_ProfileData;
};
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;
+122 -19
View File
@@ -1,23 +1,126 @@
/*
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)
{
if (InputManager.IsPadConnected(iQuadrant))
return true;
//str1k3r - since we dont sign in like consoles just check if the pad is connected
//kbm - pad 0 also counts as signed in when the keyboard is available
return iQuadrant == 0 && InputManager.IsWindowFocused();
}
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)
{
if (InputManager.IsPadConnected(iProf))
return true;
return iProf == 0 && InputManager.IsWindowFocused();
}
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.
*/
//str1k3r - set every pad that isnt pad 0 as a guest
bool CSys::IsGuest(int iQuadrant)
{
if(iQuadrant == 0)
{
return false;
}
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)
{
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[16];
_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;
}
+25 -19
View File
@@ -1,24 +1,30 @@
#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 LoadGamertag();
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);
};
+4
View File
@@ -1,13 +1,17 @@
#ifndef PCH_H
#define PCH_H
#ifdef _WIN64
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <cstdint>
#include <assert.h>
#include <Xinput.h>
#endif
#ifndef _XBOX
#include "extraX64.h"
#endif
#endif //PCH_H
+3 -2
View File
@@ -187,9 +187,9 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<IntrinsicFunctions>false</IntrinsicFunctions>
<PreprocessorDefinitions>_WINDOWS64;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>../Headers/Windows64;../Headers;$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -197,6 +197,7 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<CompileAs>CompileAsCpp</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
+42
View File
@@ -28,6 +28,9 @@ SOFTWARE.
C4JRender RenderManager;
//str1k3r - set VSync to true by default
bool C4JRender::m_VSyncState = true;
void C4JRender::Tick()
{
InternalRenderManager.CBuffTick();
@@ -38,6 +41,40 @@ void C4JRender::UpdateGamma(unsigned short usGamma)
InternalRenderManager.UpdateGamma(usGamma);
}
void C4JRender::SetVSync(bool vs)
{
if(vs != m_VSyncState)
m_VSyncState = vs;
}
int C4JRender::GetVSync()
{
return m_VSyncState ? 1 : 0;
}
//str1k3r - gonna be useful one day, kinda made this then didnt have to use it :sob:
EScreenSize C4JRender::GetScreenSize()
{
int width = InternalRenderManager.kScreenWidth;
if(width >= 1920)
{
return EScreenSize_1080P;
}
else if(width >= 1280 && width > 960)
{
return EScreenSize_720P;
}
else if(width >= 960 && width > 640)
{
return EScreenSize_544P;
}
else
{
return EScreenSize_480P;
}
}
void C4JRender::MatrixMode(int type)
{
InternalRenderManager.MatrixMode(type);
@@ -133,6 +170,11 @@ void C4JRender::SetClearColour(const float colourRGBA[4])
InternalRenderManager.SetClearColour(colourRGBA);
}
void C4JRender::setResolution(int ScreenWidth, int ScreenHeight)
{
InternalRenderManager.setResolution(ScreenWidth, ScreenHeight);
}
bool C4JRender::IsWidescreen()
{
return InternalRenderManager.IsWidescreen();
+7
View File
@@ -49,12 +49,18 @@ SOFTWARE.
#define NUM_COMMAND_HANDLES 0x800000
#define MAX_COMMAND_BUFFERS 16000
extern int kScreenWidth;
extern int kScreenHeight;
class Renderer
{
public:
struct Context;
struct CommandBuffer;
int kScreenHeight;
int kScreenWidth;
void UpdateGamma(unsigned short usGamma);
void MatrixMode(int type);
void MatrixSetIdentity();
@@ -75,6 +81,7 @@ public:
void Present();
void Clear(int flags, D3D11_RECT *pRect);
void SetClearColour(const float colourRGBA[4]);
void setResolution(int ScreenWidth, int ScreenHeight);
bool IsWidescreen();
bool IsHiDef();
void CaptureThumbnail(ImageFileBuffer *pngOut);
+25 -13
View File
@@ -54,9 +54,9 @@ D3D11_PRIMITIVE_TOPOLOGY Renderer::g_topologies[C4JRender::PRIMITIVE_TYPE_COUNT]
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, D3D11_PRIMITIVE_TOPOLOGY_LINELIST, D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP,
};
int kScreenWidth = 1920;
int kScreenHeight = 1080;
static const unsigned int kVertexBufferSize = 0x100000;
static const unsigned int kScreenGrabWidth = 1920;
static const unsigned int kScreenGrabHeight = 1080;
static const unsigned int kThumbnailSize = 64;
static const unsigned int g_vertexStrides[C4JRender::VERTEX_TYPE_COUNT] = { 32, 16, 32, 32 };
@@ -854,14 +854,27 @@ ID3D11DeviceContext *Renderer::InitialiseContext(bool fromPresent)
return deviceContext;
}
//str1k3r - yo fuck you 4J and your hardcoded ass game
void Renderer::setResolution(int ScreenWidth, int ScreenHeight)
{
if(kScreenHeight != ScreenHeight || kScreenWidth != ScreenWidth)
{
kScreenHeight = ScreenHeight;
kScreenWidth = ScreenWidth;
}
}
bool Renderer::IsHiDef()
{
return true;
return (kScreenHeight >= 720 && kScreenWidth >= 1280);
}
bool Renderer::IsWidescreen()
{
return true;
if (kScreenHeight == 0) return false;
float aspectRatio = static_cast<float>(kScreenWidth) / kScreenHeight;
return (aspectRatio >= 1.56f);
}
void Renderer::Present()
@@ -872,7 +885,7 @@ void Renderer::Present()
{
PROFILER_SCOPE("Renderer::Present", "ScreenGrab", MP_MAGENTA);
unsigned char *linearData = new unsigned char[kScreenGrabWidth * kScreenGrabHeight * 4];
unsigned char *linearData = new unsigned char[kScreenWidth * kScreenHeight * 4];
ID3D11Resource *backBufferResource = NULL;
ID3D11Texture2D *backBuffer = NULL;
@@ -898,13 +911,13 @@ void Renderer::Present()
m_pDeviceContext->Map(stagingTexture, 0, D3D11_MAP_READ_WRITE, 0, &mapped);
const unsigned char* src = reinterpret_cast<const unsigned char*>(mapped.pData);
for (UINT y = 0; y < kScreenGrabHeight; ++y)
for (UINT y = 0; y < kScreenHeight; ++y)
{
unsigned char *dstRow = linearData + y * kScreenGrabWidth * 4;
unsigned char *dstRow = linearData + y * kScreenWidth * 4;
const unsigned char *srcRow = src + y * mapped.RowPitch;
std::memcpy(dstRow, srcRow, kScreenGrabWidth * 4);
std::memcpy(dstRow, srcRow, kScreenWidth * 4);
for (UINT x = 0; x < kScreenGrabWidth; ++x)
for (UINT x = 0; x < kScreenWidth; ++x)
dstRow[x * 4 + 3] = 0xFF;
}
@@ -926,8 +939,8 @@ void Renderer::Present()
UTCSysTime.wSecond);
D3DXIMAGE_INFO info;
info.Width = kScreenGrabWidth;
info.Height = kScreenGrabHeight;
info.Width = kScreenWidth;
info.Height = kScreenHeight;
SaveTextureData(fileName, &info, reinterpret_cast<int*>(linearData));
delete[] linearData;
@@ -935,7 +948,7 @@ void Renderer::Present()
m_bShouldScreenGrabNextFrame = false;
}
m_pSwapChain->Present(1, 0);
m_pSwapChain->Present(C4JRender::GetVSync(), 0);
++presentCount;
}
@@ -1046,4 +1059,3 @@ Renderer::Context &Renderer::getContext()
{
return *reinterpret_cast<Renderer::Context*>(TlsGetValue(Renderer::tlsIdx));
}
+4
View File
@@ -1,6 +1,7 @@
#ifndef PCH_H
#define PCH_H
#ifdef _WIN64
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
@@ -11,7 +12,10 @@
#include <d3d11.h>
#include <d3d11_1.h>
#include <DirectXMath.h>
#endif
#ifndef _XBOX
#include "extraX64.h"
#endif
#endif //PCH_H
+3 -2
View File
@@ -149,15 +149,16 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<IntrinsicFunctions>false</IntrinsicFunctions>
<PreprocessorDefinitions>_WINDOWS64;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>../Headers/Windows64;../Headers;$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
+5 -5
View File
@@ -218,7 +218,7 @@ void C4JStorage::RegisterMarketplaceCountsCallback(int (*Func)(LPVOID lpParam, C
;
}
void C4JStorage::SetDLCPackageRoot(char *pszDLCRoot)
void C4JStorage::SetDLCPackageRoot(wchar_t *pszDLCRoot)
{
InternalStorageManager.m_DLC.SetPackageRoot(pszDLCRoot);
}
@@ -268,22 +268,22 @@ XCONTENT_DATA &C4JStorage::GetDLC(DWORD dw)
return InternalStorageManager.m_DLC.GetDLC(dw);
}
DWORD C4JStorage::MountInstalledDLC(int iPad, DWORD dwDLC, int (*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive)
DWORD C4JStorage::MountInstalledDLC(int iPad, DWORD dwDLC, int (*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCWSTR szMountDrive)
{
return InternalStorageManager.m_DLC.MountInstalledDLC(iPad, dwDLC, Func, lpParam, szMountDrive);
}
DWORD C4JStorage::UnmountInstalledDLC(LPCSTR szMountDrive)
DWORD C4JStorage::UnmountInstalledDLC(LPCWSTR szMountDrive)
{
return InternalStorageManager.m_DLC.UnmountInstalledDLC(szMountDrive);
}
void C4JStorage::GetMountedDLCFileList(const char *szMountDrive, std::vector<std::string> &fileList)
void C4JStorage::GetMountedDLCFileList(const char *szMountDrive, std::vector<std::wstring> &fileList)
{
InternalStorageManager.m_DLC.GetMountedDLCFileList(szMountDrive, fileList);
}
std::string C4JStorage::GetMountedPath(std::string szMount)
std::wstring C4JStorage::GetMountedPath(std::wstring szMount)
{
return InternalStorageManager.m_DLC.GetMountedPath(szMount);
}
+32 -33
View File
@@ -63,10 +63,10 @@ C4JStorage::EDLCStatus CDLC::GetInstalledDLC(int iPad, int (*Func)(LPVOID, int,
m_iHasNewInstalledDLCs = true;
bool ret = false;
DWORD atts = GetFileAttributesA("Windows64Media/DLC");
DWORD atts = GetFileAttributesW(L"Windows64Media/DLC");
if (atts == -1)
{
atts = GetFileAttributesA("Windows64/DLC");
atts = GetFileAttributesW(L"Windows64/DLC");
ret = true;
}
@@ -77,38 +77,38 @@ C4JStorage::EDLCStatus CDLC::GetInstalledDLC(int iPad, int (*Func)(LPVOID, int,
return C4JStorage::EDLC_Error;
}
_WIN32_FIND_DATAA hFind;
_WIN32_FIND_DATAW hFind;
HANDLE hFindFile;
if (ret)
{
hFindFile = FindFirstFileA("Windows64/DLC/*", &hFind);
hFindFile = FindFirstFileW(L"Windows64/DLC/*", &hFind);
}
else
{
hFindFile = FindFirstFileA("Windows64Media/DLC/*", &hFind);
hFindFile = FindFirstFileW(L"Windows64Media/DLC/*", &hFind);
}
if (hFindFile != (HANDLE)-1LL)
if (hFindFile != INVALID_HANDLE_VALUE)
{
do
{
atts = hFind.dwFileAttributes;
bool isArt = hFind.dwFileAttributes != -1 && (hFind.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
if (isArt && hFind.cFileName[0] != '.')
if (isArt && hFind.cFileName[0] != L'.')
{
XCONTENT_DATA data;
if (ret)
{
sprintf(data.szFileName, "Windows64/DLC/%s", hFind.cFileName);
swprintf_s(data.szFileName, _countof(data.szFileName), L"Windows64/DLC/%s", hFind.cFileName);
}
else
{
sprintf(data.szFileName, "Windows64Media/DLC/%s", hFind.cFileName);
swprintf_s(data.szFileName, _countof(data.szFileName), L"Windows64Media/DLC/%s", hFind.cFileName);
}
swprintf(data.szDisplayName, 256, L"%S", hFind.cFileName);
swprintf_s(data.szDisplayName, 256, L"%s", hFind.cFileName);
int displayNameLen = wcslen(data.szDisplayName);
data.DeviceID = 0;
@@ -116,14 +116,14 @@ C4JStorage::EDLCStatus CDLC::GetInstalledDLC(int iPad, int (*Func)(LPVOID, int,
AddInstalled(&data);
}
} while (FindNextFileA(hFindFile, &hFind));
} while (FindNextFileW(hFindFile, &hFind));
FindClose(hFindFile);
}
return C4JStorage::EDLC_Idle;
}
DWORD CDLC::MountInstalledDLC(int iPad, DWORD dwDLC, int (*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive)
DWORD CDLC::MountInstalledDLC(int iPad, DWORD dwDLC, int (*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCWSTR szMountDrive)
{
this->m_pMountedDLCFunc = Func;
this->m_pMountedDLCParam = lpParam;
@@ -139,7 +139,7 @@ DWORD CDLC::MountInstalledDLC(int iPad, DWORD dwDLC, int (*Func)(LPVOID, int, DW
this->m_uiCurrentMappedDLC = dwDLC;
char *dlcdirPath = m_vInstalledDLCs[m_uiCurrentMappedDLC].szFileName;
wchar_t *dlcdirPath = m_vInstalledDLCs[m_uiCurrentMappedDLC].szFileName;
m_vDLCDriveMappings.push_back(DriveMapping(dlcdirPath, m_szMountPath));
m_iHasNewMountedDLCs = true;
@@ -147,9 +147,9 @@ DWORD CDLC::MountInstalledDLC(int iPad, DWORD dwDLC, int (*Func)(LPVOID, int, DW
return 997;
}
DWORD CDLC::UnmountInstalledDLC(LPCSTR szMountDrive)
DWORD CDLC::UnmountInstalledDLC(LPCWSTR szMountDrive)
{
LPCSTR szDrive = nullptr;
LPCWSTR szDrive = nullptr;
if (szMountDrive)
{
@@ -172,49 +172,48 @@ DWORD CDLC::UnmountInstalledDLC(LPCSTR szMountDrive)
return 0;
}
void CDLC::GetMountedDLCFileList(const char *szMountDrive, std::vector<std::string> &fileList)
void CDLC::GetMountedDLCFileList(const char *szMountDrive, std::vector<std::wstring> &fileList)
{
char *dlcdirPath = new char[256];
sprintf(dlcdirPath, "%s/*", m_vInstalledDLCs[m_uiCurrentMappedDLC].szFileName);
wchar_t dlcdirPath[256];
swprintf_s(dlcdirPath, 256, L"%s/*", m_vInstalledDLCs[m_uiCurrentMappedDLC].szFileName);
_WIN32_FIND_DATAA atts;
HANDLE hFind = FindFirstFileA(dlcdirPath, &atts);
if (hFind != (HANDLE)-1LL)
_WIN32_FIND_DATAW atts;
HANDLE hFind = FindFirstFileW(dlcdirPath, &atts);
if (hFind != INVALID_HANDLE_VALUE)
{
do
{
if (atts.dwFileAttributes == -1 || (atts.dwFileAttributes & 0x10) != 0x10)
{
char dir[256];
sprintf(dir, "%s/%s", m_vInstalledDLCs[m_uiCurrentMappedDLC].szFileName, atts.cFileName);
wchar_t dir[256];
swprintf_s(dir, _countof(dir), L"%s/%s", m_vInstalledDLCs[m_uiCurrentMappedDLC].szFileName, atts.cFileName);
fileList.push_back(dir);
}
} while (FindNextFileA(hFind, &atts));
} while (FindNextFileW(hFind, &atts));
FindClose(hFind);
}
delete[] dlcdirPath;
}
std::string CDLC::GetMountedPath(std::string szMount)
std::wstring CDLC::GetMountedPath(std::wstring szMount)
{
for (int ch = 0; ch < szMount.size(); ++ch)
{
if (szMount[ch] == '/' || szMount[ch] == '\\')
{
return "";
return L"";
}
if (szMount[ch] == ':')
{
std::string driveName = szMount.substr(0, ch);
std::wstring driveName = szMount.substr(0, ch);
for (int i = 0; i < m_vDLCDriveMappings.size(); i++)
{
if (m_vDLCDriveMappings[i].m_szMountPath == driveName)
{
std::string newPath = m_vDLCDriveMappings[i].m_szDirectoryPath;
std::wstring newPath = m_vDLCDriveMappings[i].m_szDirectoryPath;
newPath.append(szMount.substr(ch + 1, -1));
newPath.append(szMount.substr(ch + 1));
return newPath;
}
@@ -223,7 +222,7 @@ std::string CDLC::GetMountedPath(std::string szMount)
}
}
return "";
return L"";
}
void CDLC::SetDLCProductCode(const char *szProductCode)
@@ -241,9 +240,9 @@ int CDLC::GetAvailableDLCCount(int iPad)
return 0;
}
void CDLC::SetPackageRoot(char *pszDLCRoot)
void CDLC::SetPackageRoot(wchar_t *pszDLCRoot)
{
strcpy(this->m_szPackageRoot, pszDLCRoot);
wcscpy(this->m_szPackageRoot, pszDLCRoot);
}
void CDLC::Tick(void)
+10 -10
View File
@@ -30,13 +30,13 @@ class CDLC
public:
struct DriveMapping
{
DriveMapping(std::string szDirectoryPath, std::string szMountPath) : m_szDirectoryPath(szDirectoryPath), m_szMountPath(szMountPath)
DriveMapping(std::wstring szDirectoryPath, std::wstring szMountPath) : m_szDirectoryPath(szDirectoryPath), m_szMountPath(szMountPath)
{
;
}
std::string m_szMountPath;
std::string m_szDirectoryPath;
std::wstring m_szMountPath;
std::wstring m_szDirectoryPath;
};
XCONTENT_DATA &GetDLC(DWORD dw);
@@ -46,15 +46,15 @@ public:
DWORD dwOfferTypesBitmask = XMARKETPLACE_OFFERING_TYPE_CONTENT);
void ClearOffers();
C4JStorage::EDLCStatus GetInstalledDLC(int iPad, int (*Func)(LPVOID, int, int), LPVOID lpParam);
DWORD MountInstalledDLC(int iPad, DWORD dwDLC, int (*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive = NULL);
DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL);
void GetMountedDLCFileList(const char *szMountDrive, std::vector<std::string> &fileList);
std::string GetMountedPath(std::string szMount);
DWORD MountInstalledDLC(int iPad, DWORD dwDLC, int (*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCWSTR szMountDrive = NULL);
DWORD UnmountInstalledDLC(LPCWSTR szMountDrive = NULL);
void GetMountedDLCFileList(const char *szMountDrive, std::vector<std::wstring> &fileList);
std::wstring GetMountedPath(std::wstring szMount);
void SetDLCProductCode(const char *szProductCode);
void SetProductUpgradeKey(const char *szProductCode);
int GetAvailableDLCCount(int iPad);
void SetPackageRoot(char *pszDLCRoot);
void SetPackageRoot(wchar_t *pszDLCRoot);
void Tick(void);
void AddInstalled(XCONTENT_DATA *data);
@@ -70,10 +70,10 @@ public:
DWORD m_iHasNewMountedDLCs;
int (*m_pMountedDLCFunc)(LPVOID, int, DWORD, DWORD);
LPVOID m_pMountedDLCParam;
std::string m_szMountPath;
std::wstring m_szMountPath;
DWORD m_uiCurrentMappedDLC;
DWORD m_dwLicenseMask;
char m_szPackageRoot[40];
wchar_t m_szPackageRoot[40];
DWORD dwordC0;
std::vector<DriveMapping> m_vDLCDriveMappings;
char m_szDLCProductCode[16];
+6
View File
@@ -1,6 +1,7 @@
#ifndef PCH_H
#define PCH_H
#ifdef _WIN64
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
@@ -8,6 +9,11 @@
#include <assert.h>
#include <Xinput.h>
#include <cwchar>
#endif
#ifndef _XBOX
#include "extraX64.h"
#endif
#endif //PCH_H
+4 -3
View File
@@ -96,7 +96,7 @@
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>../Headers;$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -126,14 +126,15 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<IntrinsicFunctions>false</IntrinsicFunctions>
<PreprocessorDefinitions>_WINDOWS64;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>../Headers;$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
+20 -1
View File
@@ -82,6 +82,18 @@ enum EMSgBoxType
EMSgBoxType_OK,
};
enum EControllerType
{
EControllerType_Default,
EControllerType_Xbox360,
EControllerType_XboxOne,
EControllerType_PS3,
EControllerType_PS4,
EControllerType_PS5,
EControllerType_Switch,
EControllerType_Gamecube
};
class C_4JInput
{
public:
@@ -120,6 +132,9 @@ public:
void SetDebugSequence( const char *chSequenceA,int( *Func)(LPVOID),LPVOID lpParam );
FLOAT GetIdleSeconds(int iPad);
bool IsPadConnected(int iPad);
void SetSelectBackSwapped(bool swapped);
bool IsSelectBackSwapped();
bool IsPadActive(int iPad);
bool IsCircleCrossSwapped();
// In-Game values which may have been remapped due to Southpaw, swap triggers, etc
@@ -169,9 +184,13 @@ public:
int GetCharCount() const;
wchar_t GetChar(int index) const;
int GetClipboardText(wchar_t *outText, int outCapacity) const;
bool SetClipboardText(const wchar_t *text) const;
void SetMouseCaptured(bool captured);
void SetWindowFocused(bool focused);
bool IsMouseCaptured() const;
bool IsWindowFocused() const;
void SetMousePos(int x, int y);
@@ -182,7 +201,7 @@ public:
EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode);
void DestroyKeyboard();
void GetText(uint16_t *UTF16String);
const char* PollControllerType(int ipad);
EControllerType GetControllerType(int ipad);
void SetLostInputControlCallback(void( *Func)(LPVOID, bool),LPVOID lpParam);
+6
View File
@@ -75,6 +75,8 @@ public:
// SYS
int GetPrimaryPad();
void SetPrimaryPad(int iPad);
void LoadGamertag();
void SetFakeGamerTag(char *name);
char* GetGamertag(int iPad);
wstring GetDisplayName(int iPad);
bool IsFullVersion();
@@ -97,6 +99,10 @@ public:
void ResetProfileProcessState(); // after a sign out from the primary player, call this
void Tick( void );
// SETTINGS
void LoadSettings(void* gs, size_t gsSize);
void SaveSettings(void* gs, size_t gsSize);
// ACHIEVEMENTS & AWARDS
void RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected=false,
+18
View File
@@ -51,12 +51,29 @@ typedef struct _XSOCIAL_PREVIEWIMAGE
// D3DFORMAT Format;
} XSOCIAL_PREVIEWIMAGE, *PXSOCIAL_PREVIEWIMAGE;
//str1k3r - EScreenSize is a windows64 exclusive thingy
enum EScreenSize
{
EScreenSize_1080P,
EScreenSize_720P,
EScreenSize_544P, //str1k3r - vita screen size
EScreenSize_480P
};
class C4JRender
{
public:
void Tick();
void UpdateGamma(unsigned short usGamma);
// VSync
static bool m_VSyncState;
static void SetVSync(bool vs);
static int GetVSync();
// Screen Size
EScreenSize GetScreenSize();
// Matrix stack
void MatrixMode(int type);
void MatrixSetIdentity();
@@ -79,6 +96,7 @@ public:
void Present();
void Clear(int flags, D3D11_RECT *pRect = NULL);
void SetClearColour(const float colourRGBA[4]);
void setResolution(int ScreenWidth, int ScreenHeight);
bool IsWidescreen();
bool IsHiDef();
void CaptureThumbnail(ImageFileBuffer *pngOut);
+5 -5
View File
@@ -285,7 +285,7 @@ public:
// DLC
void RegisterMarketplaceCountsCallback(int (*Func)(LPVOID lpParam, C4JStorage::DLC_TMS_DETAILS*, int), LPVOID lpParam);
void SetDLCPackageRoot(char* pszDLCRoot);
void SetDLCPackageRoot(wchar_t* pszDLCRoot);
C4JStorage::EDLCStatus GetDLCOffers(int iPad, int(*Func)(LPVOID, int, DWORD, int), LPVOID lpParam, DWORD dwOfferTypesBitmask = XMARKETPLACE_OFFERING_TYPE_CONTENT);
DWORD CancelGetDLCOffers();
void ClearDLCOffers();
@@ -296,10 +296,10 @@ public:
C4JStorage::EDLCStatus GetInstalledDLC(int iPad, int(*Func)(LPVOID, int, int), LPVOID lpParam);
XCONTENT_DATA& GetDLC(DWORD dw);
DWORD MountInstalledDLC(int iPad, DWORD dwDLC, int(*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive = NULL);
DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL);
void GetMountedDLCFileList(const char* szMountDrive, std::vector<std::string>& fileList);
std::string GetMountedPath(std::string szMount);
DWORD MountInstalledDLC(int iPad, DWORD dwDLC, int(*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCWSTR szMountDrive = NULL);
DWORD UnmountInstalledDLC(LPCWSTR szMountDrive = NULL);
void GetMountedDLCFileList(const char* szMountDrive, std::vector<std::wstring>& fileList);
std::wstring GetMountedPath(std::wstring szMount);
// Global title storage
C4JStorage::ETMSStatus ReadTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, C4JStorage::eTMS_FileType eFileType,
+1 -1
View File
@@ -354,7 +354,7 @@ typedef struct _XCONTENT_DATA
XCONTENTDEVICEID DeviceID;
DWORD dwContentType;
WCHAR szDisplayName[XCONTENT_MAX_DISPLAYNAME_LENGTH];
CHAR szFileName[XCONTENT_MAX_FILENAME_LENGTH];
WCHAR szFileName[XCONTENT_MAX_FILENAME_LENGTH];
} XCONTENT_DATA, *PXCONTENT_DATA;
#endif //__PS3__
+3
View File
@@ -1,5 +1,8 @@
# 4JLibs-VS2012
## WARNING
This needs the [Windows 10 SDK](https://learn.microsoft.com/en-us/windows/apps/windows-sdk/downloads#windows-10) to build `4J_Render`.
## Implementation
For implementation details, please look at the [IMPLEMENTATION_GUIDE.md](.gitea/IMPLEMENTATION_GUIDE.md) file