refactor: unglob std::wstring

This commit is contained in:
Tropical
2026-03-06 11:50:22 -06:00
parent 41db813a6d
commit cdc08700e4
581 changed files with 2156 additions and 2154 deletions
@@ -88,7 +88,7 @@ public:
int GetPrimaryPad();
void SetPrimaryPad(int iPad);
char* GetGamertag(int iPad);
wstring GetDisplayName(int iPad);
std::wstring GetDisplayName(int iPad);
bool IsFullVersion();
void SetFullVersion(bool bFull);
void SetSignInChangeCallback(void ( *Func)(LPVOID, bool, unsigned int),LPVOID lpParam);
@@ -405,7 +405,7 @@ public:
void SetDLCProductCode(const char* szProductCode);
void SetProductUpgradeKey(const char* szKey);
bool CheckForTrialUpgradeKey(void( *Func)(LPVOID, bool),LPVOID lpParam);
void SetDLCInfoMap(std::unordered_map<wstring, SONYDLC *>* pSONYDLCMap);
void SetDLCInfoMap(std::unordered_map<std::wstring, SONYDLC *>* pSONYDLCMap);
};
extern C4JStorage StorageManager;
@@ -1005,8 +1005,8 @@ void OrbisLeaderboardManager::initReadScoreStruct(ReadScore &out, SceNpScoreRank
out.m_uid.setOnlineID( rankData.npId.handle, true );
out.m_rank = rankData.rank;
// Convert to wstring and copy name.
wstring wstrName = convStringToWstring( string(rankData.npId.handle.data) ).c_str();
// Convert to std::wstring and copy name.
std::wstring wstrName = convStringToWstring( string(rankData.npId.handle.data) ).c_str();
//memcpy(&out.m_name, wstrName.c_str(), XUSER_NAME_SIZE);
out.m_name=wstrName;
}
@@ -99,7 +99,7 @@ bool CConsoleMinecraftApp::IsAmericanSKU()
SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfo(char *pchTitle)
{
wstring wstrTemp=convStringToWstring(pchTitle);
std::wstring wstrTemp=convStringToWstring(pchTitle);
AUTO_VAR(it, m_SONYDLCMap.find(wstrTemp));
if(it == m_SONYDLCMap.end())
@@ -191,7 +191,7 @@ BOOL CConsoleMinecraftApp::ReadProductCodes()
// push this into a vector
wstring wstrTemp=convStringToWstring(chDLCTitle);
std::wstring wstrTemp=convStringToWstring(chDLCTitle);
m_SONYDLCMap[wstrTemp]=pDLCInfo;
}
CloseHandle(file);
@@ -288,7 +288,7 @@ int CConsoleMinecraftApp::GetLocalTMSFileIndex(WCHAR *wchTMSFile,bool bFilenameI
int CConsoleMinecraftApp::LoadLocalDLCImages()
{
// 4J-PB - Any local graphic files for the Minecraft Store?
std::unordered_map<wstring, SONYDLC *>*pDLCInfoA=app.GetSonyDLCMap();
std::unordered_map<std::wstring, SONYDLC *>*pDLCInfoA=app.GetSonyDLCMap();
for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ )
{
SONYDLC * pDLCInfo=(*it).second;
@@ -301,7 +301,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImages()
void CConsoleMinecraftApp::FreeLocalDLCImages()
{
// 4J-PB - Any local graphic files for the Minecraft Store?
std::unordered_map<wstring, SONYDLC *>*pDLCInfoA=app.GetSonyDLCMap();
std::unordered_map<std::wstring, SONYDLC *>*pDLCInfoA=app.GetSonyDLCMap();
for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ )
{
SONYDLC * pDLCInfo=(*it).second;
@@ -394,7 +394,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart()
////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameCreate::CreateGame
app.ClearTerrainFeaturePosition();
wstring wWorldName = L"TestWorld";
std::wstring wWorldName = L"TestWorld";
StorageManager.ResetSaveData();
StorageManager.SetSaveTitle(wWorldName.c_str());
+2 -2
View File
@@ -161,7 +161,7 @@ public:
bool DLCAlreadyPurchased(char *pchTitle);
char *GetSkuIDFromProductList();
void GetDLCSkuIDFromProductList(char *,char *);
std::unordered_map<wstring, SONYDLC *>* GetSonyDLCMap() { return &m_SONYDLCMap; }
std::unordered_map<std::wstring, SONYDLC *>* GetSonyDLCMap() { return &m_SONYDLCMap; }
static void CommerceInitCallback(LPVOID lpParam,int err);
static void CommerceGetCategoriesCallback(LPVOID lpParam,int err);
static void CommerceGetProductListCallback(LPVOID lpParam,int err);
@@ -210,7 +210,7 @@ private:
// SonyCommerce::ProductInfoDetailed m_ProductInfoDetailed;
PRODUCTCODES ProductCodes;
std::unordered_map<wstring, SONYDLC *> m_SONYDLCMap;
std::unordered_map<std::wstring, SONYDLC *> m_SONYDLCMap;
bool m_bVoiceChatAndUGCRestricted;
@@ -757,7 +757,7 @@ int StartMinecraftThreadProc( void* lpParameter )
AABB::UseDefaultThreadStorage();
Tesselator::CreateNewThreadStorage(1024*1024);
RenderManager.InitialiseContext();
Minecraft::start(wstring(),wstring());
Minecraft::start(std::wstring(),std::wstring());
delete Tesselator::getInstance();
return 0;
}
@@ -1462,8 +1462,8 @@ int main(int argc, const char *argv[] )
vector<uint8_t *> vRichPresenceStrings;
// convert wstring to UTF-8 string
std::string wstring_to_utf8 (const std::wstring& str)
// convert std::wstring to UTF-8 string
std::string std::wstring_to_utf8 (const std::wstring& str)
{
std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
return myconv.to_bytes(str);
@@ -1475,7 +1475,7 @@ uint8_t *mallocAndCreateUTF8ArrayFromString(int iID)
LPCWSTR wchString=app.GetString(iID);
std::wstring srcString = wchString;
std::string dstString = wstring_to_utf8(srcString);
std::string dstString = std::wstring_to_utf8(srcString);
int dst_len = dstString.size()+1;
uint8_t *strUtf8=(uint8_t *)malloc(dst_len);
@@ -41,7 +41,7 @@ PlayerUID::PlayerUID(SceUserServiceUserId userID, SceNpOnlineId& onlineID, bool
setOnlineID(onlineID, bSignedInPSN);
}
PlayerUID::PlayerUID(wstring fromString)
PlayerUID::PlayerUID(std::wstring fromString)
{
// create for the format P_5e7ff8372ea9_00000004_Mark_4J
@@ -53,14 +53,14 @@ PlayerUID::PlayerUID(wstring fromString)
// parse the mac address next
for(int i=0;i<6;i++)
{
wstring macDigit = fromString.substr(2+(i*2),2);
std::wstring macDigit = fromString.substr(2+(i*2),2);
m_macAddress[i] = _fromHEXString<int>(macDigit);
}
int userIdLen = 0;
// parse the userID
wstring userIDDigits = L"";
std::wstring userIDDigits = L"";
while(fromString.at(15 + userIdLen) != L'_')
{
@@ -71,7 +71,7 @@ PlayerUID::PlayerUID(wstring fromString)
m_userID = _fromString<int>(userIDDigits);
// finally, the onlineID, if there is one
wstring onlineID = fromString.substr(15 + userIdLen + 1);
std::wstring onlineID = fromString.substr(15 + userIdLen + 1);
if(onlineID.size() > 0)
{
wcstombs(m_onlineID, onlineID.c_str(), 16);