feat(windows64): 4JLibs durango parity / switch to wide

This commit is contained in:
2026-08-30 16:41:59 -04:00
parent 4c50659091
commit baabec77f7
10 changed files with 73 additions and 56 deletions
+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>
+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
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
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
+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);
}
+31 -32
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;
}
@@ -81,34 +81,34 @@ C4JStorage::EDLCStatus CDLC::GetInstalledDLC(int iPad, int (*Func)(LPVOID, int,
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
+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__