feat(windows64): 4JLibs durango parity / switch to wide
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user