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

View File

@@ -252,11 +252,11 @@ void Textures::loadIndexedTextures()
// 4J - added - preload a set of commonly used textures that can then be referenced directly be an enumerated type rather by string
for( int i = 0; i < TN_COUNT - 2; i++ )
{
preLoadedIdx[i] = loadTexture((TEXTURE_NAME)i, wstring(preLoaded[i]) + L".png");
preLoadedIdx[i] = loadTexture((TEXTURE_NAME)i, std::wstring(preLoaded[i]) + L".png");
}
}
intArray Textures::loadTexturePixels(TEXTURE_NAME texId, const wstring& resourceName)
intArray Textures::loadTexturePixels(TEXTURE_NAME texId, const std::wstring& resourceName)
{
TexturePack *skin = skins->getSelected();
@@ -270,7 +270,7 @@ intArray Textures::loadTexturePixels(TEXTURE_NAME texId, const wstring& resource
// 4J - removed try/catch
// try {
intArray res;
//wstring in = skin->getResource(resourceName);
//std::wstring in = skin->getResource(resourceName);
if (false)// 4J - removed - was ( in == NULL)
{
res = loadTexturePixels(missingNo);
@@ -335,7 +335,7 @@ int Textures::loadTexture(int idx)
// 4J added - textures default to standard 32-bit RGBA format, but where we can, use an 8-bit format. There's 3 different varieties of these currently
// in the renderer that map the single 8-bit channel to RGBA differently.
void Textures::setTextureFormat(const wstring& resourceName)
void Textures::setTextureFormat(const std::wstring& resourceName)
{
// 4J Stu - These texture formats are not currently in the render header
#ifdef _XBOX
@@ -366,7 +366,7 @@ void Textures::setTextureFormat(const wstring& resourceName)
}
}
void Textures::bindTexture(const wstring &resourceName)
void Textures::bindTexture(const std::wstring &resourceName)
{
bind(loadTexture(TN_COUNT,resourceName));
}
@@ -392,7 +392,7 @@ void Textures::clearLastBoundId()
lastBoundId = -1;
}
int Textures::loadTexture(TEXTURE_NAME texId, const wstring& resourceName)
int Textures::loadTexture(TEXTURE_NAME texId, const std::wstring& resourceName)
{
// char buf[256];
// wcstombs(buf, resourceName.c_str(), 256);
@@ -417,7 +417,7 @@ int Textures::loadTexture(TEXTURE_NAME texId, const wstring& resourceName)
if (inMap) return id;
}
wstring pathName = resourceName;
std::wstring pathName = resourceName;
// 4J - added special cases to avoid mipmapping on clouds & shadows
if( (resourceName == L"environment/clouds.png") ||
@@ -437,7 +437,7 @@ int Textures::loadTexture(TEXTURE_NAME texId, const wstring& resourceName)
int id = MemoryTracker::genTextures();
wstring prefix = L"%blur%";
std::wstring prefix = L"%blur%";
bool blur = resourceName.substr(0, prefix.size()).compare(prefix) == 0; //resourceName.startsWith("%blur%");
if (blur) pathName = resourceName.substr(6);
@@ -445,7 +445,7 @@ int Textures::loadTexture(TEXTURE_NAME texId, const wstring& resourceName)
bool clamp = resourceName.substr(0, prefix.size()).compare(prefix) == 0; //resourceName.startsWith("%clamp%");
if (clamp) pathName = resourceName.substr(7);
//wstring in = skins->getSelected()->getResource(pathName);
//std::wstring in = skins->getSelected()->getResource(pathName);
if (false ) // 4J - removed was ( in == NULL)
{
loadTexture(missingNo, id, blur, clamp);
@@ -831,7 +831,7 @@ void Textures::releaseTexture(int id)
glDeleteTextures(id);
}
int Textures::loadHttpTexture(const wstring& url, const wstring& backup)
int Textures::loadHttpTexture(const std::wstring& url, const std::wstring& backup)
{
HttpTexture *texture = httpTextures[url];
if (texture != NULL)
@@ -857,7 +857,7 @@ int Textures::loadHttpTexture(const wstring& url, const wstring& backup)
return texture->id;
}
int Textures::loadHttpTexture(const wstring& url, int backup)
int Textures::loadHttpTexture(const std::wstring& url, int backup)
{
HttpTexture *texture = httpTextures[url];
if (texture != NULL)
@@ -882,12 +882,12 @@ int Textures::loadHttpTexture(const wstring& url, int backup)
return texture->id;
}
bool Textures::hasHttpTexture(const wstring &url)
bool Textures::hasHttpTexture(const std::wstring &url)
{
return httpTextures.find(url) != httpTextures.end();
}
HttpTexture *Textures::addHttpTexture(const wstring& url, HttpTextureProcessor *processor)
HttpTexture *Textures::addHttpTexture(const std::wstring& url, HttpTextureProcessor *processor)
{
HttpTexture *texture = httpTextures[url];
if (texture == NULL)
@@ -901,7 +901,7 @@ HttpTexture *Textures::addHttpTexture(const wstring& url, HttpTextureProcessor *
return texture;
}
void Textures::removeHttpTexture(const wstring& url)
void Textures::removeHttpTexture(const std::wstring& url)
{
HttpTexture *texture = httpTextures[url];
if (texture != NULL)
@@ -916,7 +916,7 @@ void Textures::removeHttpTexture(const wstring& url)
}
// 4J-PB - adding for texture in memory (from global title storage)
int Textures::loadMemTexture(const wstring& url, const wstring& backup)
int Textures::loadMemTexture(const std::wstring& url, const std::wstring& backup)
{
MemTexture *texture = NULL;
AUTO_VAR(it, memTextures.find(url) );
@@ -960,7 +960,7 @@ int Textures::loadMemTexture(const wstring& url, const wstring& backup)
return texture->id;
}
int Textures::loadMemTexture(const wstring& url, int backup)
int Textures::loadMemTexture(const std::wstring& url, int backup)
{
MemTexture *texture = NULL;
AUTO_VAR(it, memTextures.find(url) );
@@ -1003,7 +1003,7 @@ int Textures::loadMemTexture(const wstring& url, int backup)
return texture->id;
}
MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *processor)
MemTexture *Textures::addMemTexture(const std::wstring& name,MemTextureProcessor *processor)
{
MemTexture *texture = NULL;
AUTO_VAR(it, memTextures.find(name) );
@@ -1039,7 +1039,7 @@ MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *pro
return texture;
}
// MemTexture *Textures::getMemTexture(const wstring& url, MemTextureProcessor *processor)
// MemTexture *Textures::getMemTexture(const std::wstring& url, MemTextureProcessor *processor)
// {
// MemTexture *texture = memTextures[url];
// if (texture != NULL)
@@ -1049,7 +1049,7 @@ MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *pro
// return texture;
// }
void Textures::removeMemTexture(const wstring& url)
void Textures::removeMemTexture(const std::wstring& url)
{
MemTexture *texture = NULL;
AUTO_VAR(it, memTextures.find(url) );
@@ -1146,27 +1146,27 @@ void Textures::reloadAll()
}
AUTO_VAR(itEndHT, httpTextures.end());
for(std::unordered_map<wstring, HttpTexture *>::iterator it = httpTextures.begin(); it != itEndHT; it++ )
for(std::unordered_map<std::wstring, HttpTexture *>::iterator it = httpTextures.begin(); it != itEndHT; it++ )
{
it->second->isLoaded = false;
}
AUTO_VAR(itEndMT, memTextures.end());
for(std::unordered_map<wstring, MemTexture *>::iterator it = memTextures.begin(); it != itEndMT; it++ )
for(std::unordered_map<std::wstring, MemTexture *>::iterator it = memTextures.begin(); it != itEndMT; it++ )
{
it->second->isLoaded = false;
}
AUTO_VAR(itEndIM, idMap.end());
for( std::unordered_map<wstring, int>::iterator it = idMap.begin(); it != itEndIM; it++ )
for( std::unordered_map<std::wstring, int>::iterator it = idMap.begin(); it != itEndIM; it++ )
{
wstring name = it->first;
std::wstring name = it->first;
int id = idMap[name];
BufferedImage *image;
wstring prefix = L"%blur%";
std::wstring prefix = L"%blur%";
bool blur = name.substr(0, prefix.size()).compare(prefix) == 0; //name.startsWith("%blur%");
if (blur) name = name.substr(6);
@@ -1180,9 +1180,9 @@ void Textures::reloadAll()
delete image;
}
AUTO_VAR(itEndPM, pixelsMap.end());
for( std::unordered_map<wstring, intArray>::iterator it = pixelsMap.begin(); it != itEndPM; it++ )
for( std::unordered_map<std::wstring, intArray>::iterator it = pixelsMap.begin(); it != itEndPM; it++ )
{
wstring name = it->first;
std::wstring name = it->first;
BufferedImage *image = readImage(skin->getResource(name));
loadTexturePixels(image, pixelsMap[name]);
@@ -1213,13 +1213,13 @@ Icon *Textures::getMissingIcon(int type)
}
}
BufferedImage *Textures::readImage(TEXTURE_NAME texId, const wstring& name) // 4J was InputStream *in
BufferedImage *Textures::readImage(TEXTURE_NAME texId, const std::wstring& name) // 4J was InputStream *in
{
BufferedImage *img=NULL;
MemSect(32);
// is this image one of the Title Update ones?
bool isTu = IsTUImage(texId, name);
wstring drive = L"";
std::wstring drive = L"";
if(!skins->isUsingDefaultSkin() && skins->getSelected()->hasFile(L"res/" + name,false))
{
@@ -1233,7 +1233,7 @@ BufferedImage *Textures::readImage(TEXTURE_NAME texId, const wstring& name) // 4
if(app.GetBootedFromDiscPatch() && app.IsFileInPatchList(pchName))
{
char *pchUsrDir = app.GetBDUsrDirPath(pchName);
wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
if(isTu)
{
@@ -1334,7 +1334,7 @@ const wchar_t *TUImagePaths[] =
NULL
};
bool Textures::IsTUImage(TEXTURE_NAME texId, const wstring& name)
bool Textures::IsTUImage(TEXTURE_NAME texId, const std::wstring& name)
{
int i = 0;
if(texId < TN_COUNT)
@@ -1383,7 +1383,7 @@ wchar_t *OriginalImagesPaths[] =
NULL
};
bool Textures::IsOriginalImage(TEXTURE_NAME texId, const wstring& name)
bool Textures::IsOriginalImage(TEXTURE_NAME texId, const std::wstring& name)
{
int i = 0;
if(texId < TN_COUNT)