refactor: nuke all widestrings and widechars everywhere

This commit is contained in:
Tropical
2026-04-07 23:23:31 -05:00
parent f1f1d116b3
commit 2912e9ae2e
1323 changed files with 23207 additions and 23399 deletions
+4 -4
View File
@@ -87,16 +87,16 @@ void setThreadNamePlatform([[maybe_unused]] std::uint32_t threadId,
if (threadId == static_cast<std::uint32_t>(-1) ||
threadId == ::GetCurrentThreadId()) {
using SetThreadDescriptionFn = int32_t(WINAPI*)(void*, PCWSTR);
const HMODULE kernel = ::GetModuleHandleW(L"Kernel32.dll");
const HMODULE kernel = ::GetModuleHandleW("Kernel32.dll");
if (kernel) {
const auto fn = reinterpret_cast<SetThreadDescriptionFn>(
::GetProcAddress(kernel, "SetThreadDescription"));
if (fn) {
wchar_t wide[64];
const auto n = std::mbstowcs(
char wide[64];
const auto n = std::strncpy(
wide, name, (sizeof(wide) / sizeof(wide[0])) - 1);
if (n != static_cast<std::size_t>(-1)) {
wide[n] = L'\0';
wide[n] = '\0';
(void)fn(::GetCurrentThread(), wide);
return;
}
+1 -1
View File
@@ -137,7 +137,7 @@ public:
PlayerUID m_uid;
unsigned long m_rank;
std::wstring m_name;
std::string m_name;
unsigned long m_totalScore;
unsigned short m_statsSize;
unsigned long m_statsData[STATSDATA_MAX];
+2 -2
View File
@@ -115,8 +115,8 @@ public:
int index) = 0;
// Stats
[[nodiscard]] virtual std::wstring GatherStats() = 0;
[[nodiscard]] virtual std::wstring GatherRTTStats() = 0;
[[nodiscard]] virtual std::string GatherStats() = 0;
[[nodiscard]] virtual std::string GatherRTTStats() = 0;
// Session internals
virtual void SetSessionTexturePackParentId(int id) = 0;
+5 -5
View File
@@ -21,7 +21,7 @@ public:
virtual void playUI(int iSound, float volume, float pitch) = 0;
// Streaming / music
virtual void playStreaming(const std::wstring& name, float x, float y,
virtual void playStreaming(const std::string& name, float x, float y,
float z, float volume, float pitch,
bool bMusicDelay = true) = 0;
virtual void playMusicTick() = 0;
@@ -30,9 +30,9 @@ public:
virtual void updateSoundEffectVolume(float fVal) = 0;
// Asset registration
virtual void add(const std::wstring& name, File* file) = 0;
virtual void addMusic(const std::wstring& name, File* file) = 0;
virtual void addStreaming(const std::wstring& name, File* file) = 0;
virtual char* ConvertSoundPathToName(const std::wstring& name,
virtual void add(const std::string& name, File* file) = 0;
virtual void addMusic(const std::string& name, File* file) = 0;
virtual void addStreaming(const std::string& name, File* file) = 0;
virtual char* ConvertSoundPathToName(const std::string& name,
bool bConvertSpaces = false) = 0;
};
+1 -1
View File
@@ -70,7 +70,7 @@ public:
// HUD
virtual void DisplayGamertag(unsigned int iPad, bool show) = 0;
virtual void SetSelectedItem(unsigned int iPad,
const std::wstring& name) = 0;
const std::string& name) = 0;
virtual void UpdateSelectedItemPos(unsigned int iPad) = 0;
// Events
+1 -1
View File
@@ -72,7 +72,7 @@ public:
bool IsGuest();
bool IsLocal();
PlayerUID GetXuid();
const wchar_t* GetGamertag();
const char* GetGamertag();
int GetSessionIndex();
bool IsTalking();
bool IsMutedByLocalUser(uint32_t dwUserIndex);
+4 -4
View File
@@ -74,7 +74,7 @@ using XCONTENTDEVICEID = int;
struct XCONTENT_DATA {
XCONTENTDEVICEID DeviceID;
std::uint32_t dwContentType;
wchar_t szDisplayName[XCONTENT_MAX_DISPLAYNAME_LENGTH];
char szDisplayName[XCONTENT_MAX_DISPLAYNAME_LENGTH];
char szFileName[XCONTENT_MAX_FILENAME_LENGTH];
};
using PXCONTENT_DATA = XCONTENT_DATA*;
@@ -85,7 +85,7 @@ struct XMARKETPLACE_CONTENTOFFER_INFO {
std::uint64_t qwOfferID;
std::uint64_t qwPreviewOfferID;
std::uint32_t dwOfferNameLength;
wchar_t* wszOfferName;
char* wszOfferName;
std::uint32_t dwOfferType;
std::uint8_t contentId[XMARKETPLACE_CONTENT_ID_LEN];
bool fIsUnrestrictedLicense;
@@ -93,12 +93,12 @@ struct XMARKETPLACE_CONTENTOFFER_INFO {
std::uint32_t dwTitleID;
std::uint32_t dwContentCategory;
std::uint32_t dwTitleNameLength;
wchar_t* wszTitleName;
char* wszTitleName;
bool fUserHasPurchased;
std::uint32_t dwPackageSize;
std::uint32_t dwInstallSize;
std::uint32_t dwSellTextLength;
wchar_t* wszSellText;
char* wszSellText;
std::uint32_t dwAssetID;
std::uint32_t dwPurchaseQuantity;
std::uint32_t dwPointsPrice;
+3 -3
View File
@@ -50,10 +50,10 @@ bool IsEqualXUID(PlayerUID a, PlayerUID b);
// XUI string table
class CXuiStringTable {
public:
const wchar_t* Lookup(const wchar_t* szId);
const wchar_t* Lookup(uint32_t nIndex);
const char* Lookup(const char* szId);
const char* Lookup(uint32_t nIndex);
void Clear();
int32_t Load(const wchar_t* szId);
int32_t Load(const char* szId);
};
// User sign-in
+3 -3
View File
@@ -80,8 +80,8 @@ public:
[[nodiscard]] virtual int GetScrollDelta() = 0;
// Keyboard
virtual EKeyboardResult RequestKeyboard(const wchar_t* Title,
const wchar_t* Text, int iPad,
virtual EKeyboardResult RequestKeyboard(const char* Title,
const char* Text, int iPad,
unsigned int uiMaxChars,
std::function<int(bool)> callback,
EKeyboardMode eMode) = 0;
@@ -89,7 +89,7 @@ public:
// String verification (TCR 92)
virtual bool VerifyStrings(
wchar_t** pwStringA, int iStringC,
char** pwStringA, int iStringC,
std::function<int(STRING_VERIFY_RESPONSE*)> callback) = 0;
virtual void CancelQueuedVerifyStrings(
std::function<int(STRING_VERIFY_RESPONSE*)> callback) = 0;
+2 -2
View File
@@ -645,7 +645,7 @@ void SDL2Input::SetDebugSequence(const char*, std::function<int()>) {}
float SDL2Input::GetIdleSeconds(int) { return 0.f; }
bool SDL2Input::IsPadConnected(int iPad) { return iPad == 0; }
EKeyboardResult SDL2Input::RequestKeyboard(const wchar_t*, const wchar_t*, int,
EKeyboardResult SDL2Input::RequestKeyboard(const char*, const char*, int,
unsigned int,
std::function<int(bool)> callback,
SDL2Input::EKeyboardMode) {
@@ -660,7 +660,7 @@ bool SDL2Input::GetMenuDisplayed(int iPad) {
return false;
}
const char* SDL2Input::GetText() { return s_textInputBuf.c_str(); }
bool SDL2Input::VerifyStrings(wchar_t**, int,
bool SDL2Input::VerifyStrings(char**, int,
std::function<int(STRING_VERIFY_RESPONSE*)>) {
return true;
}
+3 -3
View File
@@ -50,7 +50,7 @@ public:
// Legacy keyboard request overloads with integer string-table ids used to
// live here. The remaining public API keeps the direct text/callback form.
EKeyboardResult RequestKeyboard(const wchar_t* Title, const wchar_t* Text,
EKeyboardResult RequestKeyboard(const char* Title, const char* Text,
int iPad, unsigned int uiMaxChars,
std::function<int(bool)> callback,
SDL2Input::EKeyboardMode eMode);
@@ -80,7 +80,7 @@ public:
// communication is in-game text chat.
//
// Intent Protect players from inappropriate language.
bool VerifyStrings(wchar_t** pwStringA, int iStringC,
bool VerifyStrings(char** pwStringA, int iStringC,
std::function<int(STRING_VERIFY_RESPONSE*)> callback);
void CancelQueuedVerifyStrings(
std::function<int(STRING_VERIFY_RESPONSE*)> callback);
@@ -93,5 +93,5 @@ public:
int GetPrimaryPad();
void SetPrimaryPad(int iPad);
// bool InputDetected(int userIndex, wchar_t* inputText);
// bool InputDetected(int userIndex, char* inputText);
};
+1 -1
View File
@@ -61,7 +61,7 @@ public:
[[nodiscard]] virtual int GetPrimaryPad() = 0;
virtual void SetPrimaryPad(int iPad) = 0;
[[nodiscard]] virtual char* GetGamertag(int iPad) = 0;
[[nodiscard]] virtual std::wstring GetDisplayName(int iPad) = 0;
[[nodiscard]] virtual std::string GetDisplayName(int iPad) = 0;
virtual void SetSignInChangeCallback(
std::function<void(bool, unsigned int)> callback) = 0;
virtual void SetNotificationsCallback(
@@ -51,7 +51,7 @@ static_assert(sizeof(ProfileGameSettings) == 204,
void* s_profileData[XUSER_MAX_COUNT] = {};
IPlatformProfile::PROFILESETTINGS s_dashboardSettings[XUSER_MAX_COUNT] = {};
char s_gamertags[XUSER_MAX_COUNT][16] = {};
std::wstring s_displayNames[XUSER_MAX_COUNT];
std::string s_displayNames[XUSER_MAX_COUNT];
int s_lockedProfile = 0;
std::function<int(IPlatformProfile::PROFILESETTINGS*, int)>
s_defaultOptionsCallback;
@@ -65,7 +65,7 @@ void ensureFakeIdentity(int iPad) {
std::snprintf(s_gamertags[iPad], sizeof(s_gamertags[iPad]), "Player%d",
iPad + 1);
s_displayNames[iPad] = std::wstring(L"Player") + std::to_wstring(iPad + 1);
s_displayNames[iPad] = std::string("Player") + std::to_string(iPad + 1);
}
void initialiseDefaultGameSettings(ProfileGameSettings* gameSettings) {
@@ -157,7 +157,7 @@ char* StubProfile::GetGamertag(int iPad) {
return s_gamertags[p];
}
std::wstring StubProfile::GetDisplayName(int iPad) {
std::string StubProfile::GetDisplayName(int iPad) {
const int p = isValidPad(iPad) ? iPad : 0;
ensureFakeIdentity(p);
return s_displayNames[p];
+1 -1
View File
@@ -33,7 +33,7 @@ public:
bool GetChatAndContentRestrictions(int iPad, bool* pbChatRestricted,
bool* pbContentRestricted, int* piAge);
char* GetGamertag(int iPad);
std::wstring GetDisplayName(int iPad);
std::string GetDisplayName(int iPad);
int SetDefaultOptionsCallback(
std::function<int(PROFILESETTINGS*, int)> callback);
PROFILESETTINGS* GetDashboardProfileSettings(int iPad);
@@ -203,6 +203,6 @@ public:
XSOCIAL_PREVIEWIMAGE* previewOut) = 0;
// Events
virtual void BeginEvent(const wchar_t* eventName) = 0;
virtual void BeginEvent(const char* eventName) = 0;
virtual void EndEvent() = 0;
};
+1 -1
View File
@@ -139,7 +139,7 @@ public:
void StateSetActiveTexture(int tex);
// Event tracking
void BeginEvent(const wchar_t* eventName);
void BeginEvent(const char* eventName);
void EndEvent();
// PLM event handling
@@ -34,7 +34,7 @@ void GLRenderer::BeginConditionalSurvey(int) {}
void GLRenderer::EndConditionalSurvey() {}
void GLRenderer::BeginConditionalRendering(int) {}
void GLRenderer::EndConditionalRendering() {}
void GLRenderer::BeginEvent(const wchar_t*) {}
void GLRenderer::BeginEvent(const char*) {}
void GLRenderer::EndEvent() {}
void GLRenderer::Tick() {}
+12 -12
View File
@@ -140,14 +140,14 @@ public:
unsigned int uiFileSize;
std::uint32_t dwType;
std::uint32_t dwWchCount;
wchar_t wchFile[1];
char wchFile[1];
};
using PDLC_FILE_DETAILS = DLC_FILE_DETAILS*;
struct DLC_FILE_PARAM {
std::uint32_t dwType;
std::uint32_t dwWchCount;
wchar_t wchData[1];
char wchData[1];
};
using PDLC_FILE_PARAM = DLC_FILE_PARAM*;
@@ -156,7 +156,7 @@ public:
// Lifecycle
virtual void Tick() = 0;
virtual void Init(unsigned int uiSaveVersion,
const wchar_t* pwchDefaultSaveName, char* pszSavePackName,
const char* pwchDefaultSaveName, char* pszSavePackName,
int iMinimumSaveSize,
std::function<int(const ESavingMessage, int)> callback,
const char* szGroupID) = 0;
@@ -168,7 +168,7 @@ public:
unsigned int uiOptionC, unsigned int pad = XUSER_INDEX_ANY,
std::function<int(int, const EMessageResult)> callback = nullptr,
C4JStringTable* pStringTable = nullptr,
wchar_t* pwchFormatString = nullptr, unsigned int focusButton = 0) = 0;
char* pwchFormatString = nullptr, unsigned int focusButton = 0) = 0;
virtual EMessageResult GetMessageBoxResult() = 0;
// Save device
@@ -179,8 +179,8 @@ public:
// Save game
virtual void SetDefaultSaveNameForKeyboardDisplay(
const wchar_t* pwchDefaultSaveName) = 0;
virtual void SetSaveTitle(const wchar_t* pwchDefaultSaveName) = 0;
const char* pwchDefaultSaveName) = 0;
virtual void SetSaveTitle(const char* pwchDefaultSaveName) = 0;
virtual bool GetSaveUniqueNumber(int* piVal) = 0;
virtual bool GetSaveUniqueFilename(char* pszName) = 0;
virtual void SetSaveUniqueFilename(char* szFilename) = 0;
@@ -200,7 +200,7 @@ public:
std::function<int(const bool)> callback) = 0;
virtual void CopySaveDataToNewSave(
std::uint8_t* pbThumbnail, unsigned int cbThumbnail,
wchar_t* wchNewName, std::function<int(bool)> callback) = 0;
char* wchNewName, std::function<int(bool)> callback) = 0;
virtual ESaveGameState DoesSaveExist(bool* pbExists) = 0;
virtual bool EnoughSpaceForAMinSaveGame() = 0;
virtual void SetSaveMessageVPosition(float fY) = 0;
@@ -260,16 +260,16 @@ public:
// Title storage
virtual ETMSStatus ReadTMSFile(
int iQuadrant, eGlobalStorage eStorageFacility, eTMS_FileType eFileType,
wchar_t* pwchFilename, std::uint8_t** ppBuffer,
char* pwchFilename, std::uint8_t** ppBuffer,
unsigned int* pBufferSize,
std::function<int(wchar_t*, int, bool, int)> callback = nullptr,
std::function<int(char*, int, bool, int)> callback = nullptr,
int iAction = 0) = 0;
virtual bool WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility,
wchar_t* pwchFilename, std::uint8_t* pBuffer,
char* pwchFilename, std::uint8_t* pBuffer,
unsigned int bufferSize) = 0;
virtual bool DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility,
wchar_t* pwchFilename) = 0;
virtual void StoreTMSPathName(wchar_t* pwchName = nullptr) = 0;
char* pwchFilename) = 0;
virtual void StoreTMSPathName(char* pwchName = nullptr) = 0;
virtual ETMSStatus TMSPP_ReadFile(
int iPad, eGlobalStorage eStorageFacility,
eTMS_FILETYPEVAL eFileTypeVal, const char* szFilename,
+10 -10
View File
@@ -20,7 +20,7 @@ StubStorage::EMessageResult StubStorage::RequestMessageBox(
unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA,
unsigned int uiOptionC, unsigned int pad,
std::function<int(int, const StubStorage::EMessageResult)> callback,
C4JStringTable* pStringTable, wchar_t* pwchFormatString,
C4JStringTable* pStringTable, char* pwchFormatString,
unsigned int focusButton) {
return EMessage_ResultAccept;
}
@@ -35,14 +35,14 @@ bool StubStorage::SetSaveDevice(std::function<int(const bool)> callback,
}
void StubStorage::Init(unsigned int uiSaveVersion,
const wchar_t* pwchDefaultSaveName, char* pszSavePackName,
const char* pwchDefaultSaveName, char* pszSavePackName,
int iMinimumSaveSize,
std::function<int(const ESavingMessage, int)> callback,
const char* szGroupID) {}
void StubStorage::ResetSaveData() {}
void StubStorage::SetDefaultSaveNameForKeyboardDisplay(
const wchar_t* pwchDefaultSaveName) {}
void StubStorage::SetSaveTitle(const wchar_t* pwchDefaultSaveName) {}
const char* pwchDefaultSaveName) {}
void StubStorage::SetSaveTitle(const char* pwchDefaultSaveName) {}
bool StubStorage::GetSaveUniqueNumber(int* piVal) {
if (piVal) *piVal = 0;
return true;
@@ -74,7 +74,7 @@ StubStorage::ESaveGameState StubStorage::SaveSaveData(
}
void StubStorage::CopySaveDataToNewSave(std::uint8_t* pbThumbnail,
unsigned int cbThumbnail,
wchar_t* wchNewName,
char* wchNewName,
std::function<int(bool)> callback) {}
void StubStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected) {}
bool StubStorage::GetSaveDeviceSelected(unsigned int iPad) { return true; }
@@ -165,21 +165,21 @@ void StubStorage::GetMountedDLCFileList(const char* szMountDrive,
std::string StubStorage::GetMountedPath(std::string szMount) { return ""; }
StubStorage::ETMSStatus StubStorage::ReadTMSFile(
int iQuadrant, eGlobalStorage eStorageFacility,
StubStorage::eTMS_FileType eFileType, wchar_t* pwchFilename,
StubStorage::eTMS_FileType eFileType, char* pwchFilename,
std::uint8_t** ppBuffer, unsigned int* pBufferSize,
std::function<int(wchar_t*, int, bool, int)> callback, int iAction) {
std::function<int(char*, int, bool, int)> callback, int iAction) {
return ETMSStatus_Fail;
}
bool StubStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility,
wchar_t* pwchFilename, std::uint8_t* pBuffer,
char* pwchFilename, std::uint8_t* pBuffer,
unsigned int bufferSize) {
return false;
}
bool StubStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility,
wchar_t* pwchFilename) {
char* pwchFilename) {
return false;
}
void StubStorage::StoreTMSPathName(wchar_t* pwchName) {}
void StubStorage::StoreTMSPathName(char* pwchName) {}
StubStorage::ETMSStatus StubStorage::TMSPP_ReadFile(
int iPad, StubStorage::eGlobalStorage eStorageFacility,
StubStorage::eTMS_FILETYPEVAL eFileTypeVal, const char* szFilename,
+11 -11
View File
@@ -18,7 +18,7 @@ typedef std::vector<PXCONTENT_DATA> XContentDataArray;
class StubStorage : public IPlatformStorage {
public:
struct CACHEINFOSTRUCT {
wchar_t wchDisplayName[XCONTENT_MAX_DISPLAYNAME_LENGTH];
char wchDisplayName[XCONTENT_MAX_DISPLAYNAME_LENGTH];
char szFileName[XCONTENT_MAX_FILENAME_LENGTH];
std::uint32_t dwImageOffset;
std::uint32_t dwImageBytes;
@@ -72,7 +72,7 @@ public:
std::function<int(int, const StubStorage::EMessageResult)> callback =
nullptr,
C4JStringTable* pStringTable = nullptr,
wchar_t* pwchFormatString = nullptr, unsigned int focusButton = 0);
char* pwchFormatString = nullptr, unsigned int focusButton = 0);
StubStorage::EMessageResult GetMessageBoxResult();
@@ -81,15 +81,15 @@ public:
bool bForceResetOfSaveDevice = false);
// savegame
void Init(unsigned int uiSaveVersion, const wchar_t* pwchDefaultSaveName,
void Init(unsigned int uiSaveVersion, const char* pwchDefaultSaveName,
char* pszSavePackName, int iMinimumSaveSize,
std::function<int(const ESavingMessage, int)> callback,
const char* szGroupID);
void ResetSaveData(); // Call before a new save to clear out stored save
// file name
void SetDefaultSaveNameForKeyboardDisplay(
const wchar_t* pwchDefaultSaveName);
void SetSaveTitle(const wchar_t* pwchDefaultSaveName);
const char* pwchDefaultSaveName);
void SetSaveTitle(const char* pwchDefaultSaveName);
bool GetSaveUniqueNumber(int* piVal);
bool GetSaveUniqueFilename(char* pszName);
void SetSaveUniqueFilename(char* szFilename);
@@ -110,7 +110,7 @@ public:
StubStorage::ESaveGameState SaveSaveData(
std::function<int(const bool)> callback);
void CopySaveDataToNewSave(std::uint8_t* pbThumbnail,
unsigned int cbThumbnail, wchar_t* wchNewName,
unsigned int cbThumbnail, char* wchNewName,
std::function<int(bool)> callback);
void SetSaveDeviceSelected(unsigned int uiPad, bool bSelected);
bool GetSaveDeviceSelected(unsigned int iPad);
@@ -179,16 +179,16 @@ public:
// Global title storage
StubStorage::ETMSStatus ReadTMSFile(
int iQuadrant, eGlobalStorage eStorageFacility,
StubStorage::eTMS_FileType eFileType, wchar_t* pwchFilename,
StubStorage::eTMS_FileType eFileType, char* pwchFilename,
std::uint8_t** ppBuffer, unsigned int* pBufferSize,
std::function<int(wchar_t*, int, bool, int)> callback = nullptr,
std::function<int(char*, int, bool, int)> callback = nullptr,
int iAction = 0);
bool WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility,
wchar_t* pwchFilename, std::uint8_t* pBuffer,
char* pwchFilename, std::uint8_t* pBuffer,
unsigned int bufferSize);
bool DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility,
wchar_t* pwchFilename);
void StoreTMSPathName(wchar_t* pwchName = nullptr);
char* pwchFilename);
void StoreTMSPathName(char* pwchName = nullptr);
// TMS++
#ifdef _XBOX
+2 -2
View File
@@ -223,7 +223,7 @@ class ZipFile {
public:
ZipFile(File* file) {}
InputStream* getInputStream(ZipEntry* entry) { return nullptr; }
ZipEntry* getEntry(const std::wstring& name) { return nullptr; }
ZipEntry* getEntry(const std::string& name) { return nullptr; }
void close() {}
};
@@ -237,7 +237,7 @@ public:
static void create() {}
static void destroy() {}
static bool isKeyDown(int) { return false; }
static std::wstring getKeyName(int) { return L"KEYNAME"; }
static std::string getKeyName(int) { return "KEYNAME"; }
static void enableRepeatEvents(bool) {}
static const int KEY_A = 0;
static const int KEY_B = 1;