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
+11 -11
View File
@@ -47,11 +47,11 @@ void BufferedImage::ByteFlip4(unsigned int &data)
// Loads a bitmap into a buffered image - only currently supports the 2 types of 32-bit image that we've made so far
// and determines which of these is which by the compression method. Compression method 3 is a 32-bit image with only
// 24-bits used (ie no alpha channel) whereas method 0 is a full 32-bit image with a valid alpha channel.
BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=false*/, bool bTitleUpdateTexture /*=false*/, const wstring &drive /*=L""*/)
BufferedImage::BufferedImage(const std::wstring& File, bool filenameHasExtension /*=false*/, bool bTitleUpdateTexture /*=false*/, const std::wstring &drive /*=L""*/)
{
HRESULT hr;
wstring wDrive;
wstring filePath;
std::wstring wDrive;
std::wstring filePath;
filePath = File;
wDrive = drive;
@@ -87,7 +87,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f
pchUsrDir=getUsrDirPath();
}
wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
if(bTitleUpdateTexture)
{
@@ -102,7 +102,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f
/*char *pchUsrDir=getUsrDirPath();
wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
if(bTitleUpdateTexture)
{
@@ -145,8 +145,8 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f
for( int l = 0; l < 10; l++ )
{
wstring name;
wstring mipMapPath = L"";
std::wstring name;
std::wstring mipMapPath = L"";
if( l != 0 )
{
mipMapPath = L"MipMapLevel" + _toString<int>(l+1);
@@ -189,10 +189,10 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f
}
}
BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenameHasExtension /*= false*/ )
BufferedImage::BufferedImage(DLCPack *dlcPack, const std::wstring& File, bool filenameHasExtension /*= false*/ )
{
HRESULT hr;
wstring filePath = File;
std::wstring filePath = File;
BYTE *pbData = NULL;
DWORD dwBytes = 0;
@@ -203,8 +203,8 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam
for( int l = 0; l < 10; l++ )
{
wstring name;
wstring mipMapPath = L"";
std::wstring name;
std::wstring mipMapPath = L"";
if( l != 0 )
{
mipMapPath = L"MipMapLevel" + _toString<int>(l+1);
+2 -2
View File
@@ -15,8 +15,8 @@ public:
static const int TYPE_INT_ARGB = 0;
static const int TYPE_INT_RGB = 1;
BufferedImage(int width,int height,int type);
BufferedImage(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L""); // 4J added
BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenameHasExtension = false ); // 4J Added
BufferedImage(const std::wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const std::wstring &drive =L""); // 4J added
BufferedImage(DLCPack *dlcPack, const std::wstring& File, bool filenameHasExtension = false ); // 4J Added
BufferedImage(BYTE *pbData, DWORD dwBytes); // 4J added
~BufferedImage();
+1 -1
View File
@@ -1,7 +1,7 @@
#include "../Build/stdafx.h"
#include "HttpTexture.h"
HttpTexture::HttpTexture(const wstring& _url, HttpTextureProcessor *processor)
HttpTexture::HttpTexture(const std::wstring& _url, HttpTextureProcessor *processor)
{
// 4J - added
count = 1;
+1 -1
View File
@@ -10,5 +10,5 @@ public:
int id;
bool isLoaded;
HttpTexture(const wstring& _url, HttpTextureProcessor *processor);
HttpTexture(const std::wstring& _url, HttpTextureProcessor *processor);
};
+1 -1
View File
@@ -1,7 +1,7 @@
#include "../Build/stdafx.h"
#include "MemTexture.h"
MemTexture::MemTexture(const wstring& _url, PBYTE pbData,DWORD dwBytes, MemTextureProcessor *processor)
MemTexture::MemTexture(const std::wstring& _url, PBYTE pbData,DWORD dwBytes, MemTextureProcessor *processor)
{
// 4J - added
count = 1;
+1 -1
View File
@@ -12,6 +12,6 @@ public:
int ticksSinceLastUse;
static const int UNUSED_TICKS_TO_FREE = 20;
MemTexture(const wstring& _name, PBYTE pbData, DWORD dwBytes, MemTextureProcessor *processor);
MemTexture(const std::wstring& _name, PBYTE pbData, DWORD dwBytes, MemTextureProcessor *processor);
~MemTexture();
};
@@ -4,7 +4,7 @@
#include "../../../Minecraft.World/IO/Streams/InputOutputStream.h"
#include "../../../Minecraft.World/Util/StringHelpers.h"
AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const wstring &name, TexturePack *fallback) : id(id), name(name)
AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const std::wstring &name, TexturePack *fallback) : id(id), name(name)
{
// 4J init
textureId = -1;
@@ -25,7 +25,7 @@ AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const wstring &na
//loadDescription();
}
wstring AbstractTexturePack::trim(wstring line)
std::wstring AbstractTexturePack::trim(std::wstring line)
{
if (!line.empty() && line.length() > 34)
{
@@ -101,7 +101,7 @@ void AbstractTexturePack::loadName()
{
}
InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFallback) //throws IOException
InputStream *AbstractTexturePack::getResource(const std::wstring &name, bool allowFallback) //throws IOException
{
app.DebugPrintf("texture - %ls\n",name.c_str());
InputStream *is = getResourceImplementation(name);
@@ -114,7 +114,7 @@ InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFal
}
// 4J Currently removed due to override in TexturePack class
//InputStream *AbstractTexturePack::getResource(const wstring &name) //throws IOException
//InputStream *AbstractTexturePack::getResource(const std::wstring &name) //throws IOException
//{
// return getResource(name, true);
//}
@@ -145,7 +145,7 @@ void AbstractTexturePack::load(Textures *textures)
}
}
bool AbstractTexturePack::hasFile(const wstring &name, bool allowFallback)
bool AbstractTexturePack::hasFile(const std::wstring &name, bool allowFallback)
{
bool hasFile = this->hasFile(name);
@@ -157,34 +157,34 @@ DWORD AbstractTexturePack::getId()
return id;
}
wstring AbstractTexturePack::getName()
std::wstring AbstractTexturePack::getName()
{
return texname;
}
wstring AbstractTexturePack::getWorldName()
std::wstring AbstractTexturePack::getWorldName()
{
return m_wsWorldName;
}
wstring AbstractTexturePack::getDesc1()
std::wstring AbstractTexturePack::getDesc1()
{
return desc1;
}
wstring AbstractTexturePack::getDesc2()
std::wstring AbstractTexturePack::getDesc2()
{
return desc2;
}
wstring AbstractTexturePack::getAnimationString(const wstring &textureName, const wstring &path, bool allowFallback)
std::wstring AbstractTexturePack::getAnimationString(const std::wstring &textureName, const std::wstring &path, bool allowFallback)
{
return getAnimationString(textureName, path);
}
wstring AbstractTexturePack::getAnimationString(const wstring &textureName, const wstring &path)
std::wstring AbstractTexturePack::getAnimationString(const std::wstring &textureName, const std::wstring &path)
{
wstring animationDefinitionFile = textureName + L".txt";
std::wstring animationDefinitionFile = textureName + L".txt";
bool requiresFallback = !hasFile(L"\\" + textureName + L".png", false);
@@ -197,9 +197,9 @@ wstring AbstractTexturePack::getAnimationString(const wstring &textureName, cons
InputStreamReader isr(fileStream);
BufferedReader br(&isr);
wstring result = L"";
std::wstring result = L"";
wstring line = br.readLine();
std::wstring line = br.readLine();
while (!line.empty())
{
line = trimString(line);
@@ -215,7 +215,7 @@ wstring AbstractTexturePack::getAnimationString(const wstring &textureName, cons
return result;
}
BufferedImage *AbstractTexturePack::getImageResource(const wstring& File, bool filenameHasExtension /*= false*/, bool bTitleUpdateTexture /*=false*/, const wstring &drive /*=L""*/)
BufferedImage *AbstractTexturePack::getImageResource(const std::wstring& File, bool filenameHasExtension /*= false*/, bool bTitleUpdateTexture /*=false*/, const std::wstring &drive /*=L""*/)
{
const char *pchTexture=wstringtofilename(File);
app.DebugPrintf("AbstractTexturePack::getImageResource - %s, drive is %s\n",pchTexture, wstringtofilename(drive));
@@ -361,7 +361,7 @@ void AbstractTexturePack::unloadUI()
// Do nothing
}
wstring AbstractTexturePack::getXuiRootPath()
std::wstring AbstractTexturePack::getXuiRootPath()
{
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
@@ -9,15 +9,15 @@ class AbstractTexturePack : public TexturePack
{
private:
const DWORD id;
const wstring name;
const std::wstring name;
protected:
File *file;
wstring texname;
wstring m_wsWorldName;
std::wstring texname;
std::wstring m_wsWorldName;
wstring desc1;
wstring desc2;
std::wstring desc1;
std::wstring desc2;
PBYTE m_iconData;
DWORD m_iconSize;
@@ -36,10 +36,10 @@ private:
int textureId;
protected:
AbstractTexturePack(DWORD id, File *file, const wstring &name, TexturePack *fallback);
AbstractTexturePack(DWORD id, File *file, const std::wstring &name, TexturePack *fallback);
private:
static wstring trim(wstring line);
static std::wstring trim(std::wstring line);
protected:
virtual void loadIcon();
@@ -48,29 +48,29 @@ protected:
virtual void loadName();
public:
virtual InputStream *getResource(const wstring &name, bool allowFallback); //throws IOException
virtual InputStream *getResource(const std::wstring &name, bool allowFallback); //throws IOException
// 4J Removed do to current override in TexturePack class
//virtual InputStream *getResource(const wstring &name); //throws IOException
//virtual InputStream *getResource(const std::wstring &name); //throws IOException
virtual DLCPack * getDLCPack() =0;
protected:
virtual InputStream *getResourceImplementation(const wstring &name) = 0; // throws IOException;
virtual InputStream *getResourceImplementation(const std::wstring &name) = 0; // throws IOException;
public:
virtual void unload(Textures *textures);
virtual void load(Textures *textures);
virtual bool hasFile(const wstring &name, bool allowFallback);
virtual bool hasFile(const wstring &name) = 0;
virtual bool hasFile(const std::wstring &name, bool allowFallback);
virtual bool hasFile(const std::wstring &name) = 0;
virtual DWORD getId();
virtual wstring getName();
virtual wstring getDesc1();
virtual wstring getDesc2();
virtual wstring getWorldName();
virtual std::wstring getName();
virtual std::wstring getDesc1();
virtual std::wstring getDesc2();
virtual std::wstring getWorldName();
virtual wstring getAnimationString(const wstring &textureName, const wstring &path, bool allowFallback);
virtual std::wstring getAnimationString(const std::wstring &textureName, const std::wstring &path, bool allowFallback);
protected:
virtual wstring getAnimationString(const wstring &textureName, const wstring &path);
virtual std::wstring getAnimationString(const std::wstring &textureName, const std::wstring &path);
void loadDefaultUI();
void loadDefaultColourTable();
void loadDefaultHTMLColourTable();
@@ -79,11 +79,11 @@ protected:
#endif
public:
virtual BufferedImage *getImageResource(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L"");
virtual BufferedImage *getImageResource(const std::wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const std::wstring &drive =L"");
virtual void loadColourTable();
virtual void loadUI();
virtual void unloadUI();
virtual wstring getXuiRootPath();
virtual std::wstring getXuiRootPath();
virtual PBYTE getPackIcon(DWORD &dwImageBytes);
virtual PBYTE getPackComparison(DWORD &dwImageBytes);
virtual unsigned int getDLCParentPackId();
@@ -101,7 +101,7 @@ void DLCTexturePack::loadDescription()
}
}
wstring DLCTexturePack::getResource(const wstring& name)
std::wstring DLCTexturePack::getResource(const std::wstring& name)
{
// 4J Stu - We should never call this function
#ifndef __CONTENT_PACKAGE
@@ -110,7 +110,7 @@ wstring DLCTexturePack::getResource(const wstring& name)
return L"";
}
InputStream *DLCTexturePack::getResourceImplementation(const wstring &name) //throws IOException
InputStream *DLCTexturePack::getResourceImplementation(const std::wstring &name) //throws IOException
{
// 4J Stu - We should never call this function
#ifndef _CONTENT_PACKAGE
@@ -120,7 +120,7 @@ InputStream *DLCTexturePack::getResourceImplementation(const wstring &name) //th
return NULL; //resource;
}
bool DLCTexturePack::hasFile(const wstring &name)
bool DLCTexturePack::hasFile(const std::wstring &name)
{
bool hasFile = false;
if(m_dlcDataPack != NULL) hasFile = m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_Texture, name);
@@ -132,16 +132,16 @@ bool DLCTexturePack::isTerrainUpdateCompatible()
return true;
}
wstring DLCTexturePack::getPath(bool bTitleUpdateTexture /*= false*/)
std::wstring DLCTexturePack::getPath(bool bTitleUpdateTexture /*= false*/)
{
return L"";
}
wstring DLCTexturePack::getAnimationString(const wstring &textureName, const wstring &path)
std::wstring DLCTexturePack::getAnimationString(const std::wstring &textureName, const std::wstring &path)
{
wstring result = L"";
std::wstring result = L"";
wstring fullpath = L"res/" + path + textureName + L".png";
std::wstring fullpath = L"res/" + path + textureName + L".png";
if(hasFile(fullpath))
{
result = m_dlcDataPack->getFile(DLCManager::e_DLCType_Texture, fullpath)->getParameterAsString(DLCManager::e_DLCParamType_Anim);
@@ -150,7 +150,7 @@ wstring DLCTexturePack::getAnimationString(const wstring &textureName, const wst
return result;
}
BufferedImage *DLCTexturePack::getImageResource(const wstring& File, bool filenameHasExtension /*= false*/, bool bTitleUpdateTexture /*=false*/, const wstring &drive /*=L""*/)
BufferedImage *DLCTexturePack::getImageResource(const std::wstring& File, bool filenameHasExtension /*= false*/, bool bTitleUpdateTexture /*=false*/, const std::wstring &drive /*=L""*/)
{
if(m_dlcDataPack) return new BufferedImage(m_dlcDataPack, L"/" + File, filenameHasExtension);
else return fallback->getImageResource(File, filenameHasExtension, bTitleUpdateTexture, drive);
@@ -267,7 +267,7 @@ void DLCTexturePack::loadData()
wstring DLCTexturePack::getFilePath(DWORD packId, wstring filename, bool bAddDataFolder)
std::wstring DLCTexturePack::getFilePath(DWORD packId, std::wstring filename, bool bAddDataFolder)
{
return app.getFilePath(packId,filename,bAddDataFolder);
}
@@ -288,7 +288,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen
texturePack->setHasAudio(false);
DWORD dwFilesProcessed = 0;
// Load the DLC textures
wstring dataFilePath = texturePack->m_dlcInfoPack->getFullDataPath();
std::wstring dataFilePath = texturePack->m_dlcInfoPack->getFullDataPath();
if(!dataFilePath.empty())
{
if(!app.m_dlcManager.readDLCDataFile(dwFilesProcessed, getFilePath(texturePack->m_dlcInfoPack->GetPackID(), dataFilePath),texturePack->m_dlcDataPack))
@@ -301,7 +301,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen
if(texturePack->m_dlcDataPack != NULL)
{
#ifdef _XBOX
File xzpPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"TexturePack.xzp") ) );
File xzpPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), std::wstring(L"TexturePack.xzp") ) );
if(xzpPath.exists())
{
@@ -332,7 +332,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen
}
}
#else
File archivePath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"media.arc") ) );
File archivePath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), std::wstring(L"media.arc") ) );
if(archivePath.exists()) texturePack->m_archiveFile = new ArchiveFile(archivePath);
#endif
@@ -355,7 +355,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen
if (grf.exists())
{
#if defined(_UNICODE) && !defined(__linux__)
wstring path = grf.getPath();
std::wstring path = grf.getPath();
const WCHAR *pchFilename=path.c_str();
HANDLE fileHandle = CreateFile(
pchFilename, // file name
@@ -407,7 +407,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen
if (grf.exists())
{
#if defined(_UNICODE) && !defined(__linux__)
wstring path = grf.getPath();
std::wstring path = grf.getPath();
const WCHAR *pchFilename=path.c_str();
HANDLE fileHandle = CreateFile(
pchFilename, // file name
@@ -452,8 +452,8 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen
// any audio data?
#ifdef _XBOX
File audioXSBPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"MashUp.xsb") ) );
File audioXWBPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"MashUp.xwb") ) );
File audioXSBPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), std::wstring(L"MashUp.xsb") ) );
File audioXWBPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), std::wstring(L"MashUp.xwb") ) );
if(audioXSBPath.exists() && audioXWBPath.exists())
{
@@ -584,9 +584,9 @@ void DLCTexturePack::unloadUI()
bUILoaded = false;
}
wstring DLCTexturePack::getXuiRootPath()
std::wstring DLCTexturePack::getXuiRootPath()
{
wstring path = L"";
std::wstring path = L"";
if(m_dlcDataPack != NULL && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"))
{
DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp");
@@ -25,7 +25,7 @@ public:
DLCTexturePack(DWORD id, DLCPack *pack, TexturePack *fallback);
~DLCTexturePack();
virtual wstring getResource(const wstring& name);
virtual std::wstring getResource(const std::wstring& name);
virtual DLCPack * getDLCPack();
// Added for sound banks with MashUp packs
#ifdef _XBOX
@@ -38,31 +38,31 @@ protected:
void loadComparison();
void loadName();
void loadDescription();
InputStream *getResourceImplementation(const wstring &name); //throws IOException
InputStream *getResourceImplementation(const std::wstring &name); //throws IOException
public:
//@Override
bool hasFile(const wstring &name);
bool hasFile(const std::wstring &name);
bool isTerrainUpdateCompatible();
// 4J Added
virtual wstring getPath(bool bTitleUpdateTexture = false);
virtual wstring getAnimationString(const wstring &textureName, const wstring &path);
virtual BufferedImage *getImageResource(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L"");
virtual std::wstring getPath(bool bTitleUpdateTexture = false);
virtual std::wstring getAnimationString(const std::wstring &textureName, const std::wstring &path);
virtual BufferedImage *getImageResource(const std::wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const std::wstring &drive =L"");
virtual void loadColourTable();
virtual bool hasData() { return m_bHasLoadedData; }
virtual bool isLoadingData() { return m_bLoadingData; }
private:
static wstring getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder);
static wstring getFilePath(DWORD packId, wstring filename, bool bAddDataFolder=true);
static std::wstring getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder);
static std::wstring getFilePath(DWORD packId, std::wstring filename, bool bAddDataFolder=true);
public:
static int packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask);
virtual void loadData();
virtual void loadUI();
virtual void unloadUI();
virtual wstring getXuiRootPath();
virtual std::wstring getXuiRootPath();
virtual ArchiveFile *getArchiveFile() { return m_archiveFile; }
virtual unsigned int getDLCParentPackId();
@@ -45,7 +45,7 @@ void DefaultTexturePack::loadName()
texname = L"Minecraft";
}
bool DefaultTexturePack::hasFile(const wstring &name)
bool DefaultTexturePack::hasFile(const std::wstring &name)
{
// return DefaultTexturePack::class->getResourceAsStream(name) != null;
return true;
@@ -56,9 +56,9 @@ bool DefaultTexturePack::isTerrainUpdateCompatible()
return true;
}
InputStream *DefaultTexturePack::getResourceImplementation(const wstring &name)// throws FileNotFoundException
InputStream *DefaultTexturePack::getResourceImplementation(const std::wstring &name)// throws FileNotFoundException
{
wstring wDrive = L"";
std::wstring wDrive = L"";
// Make the content package point to to the UPDATE: drive is needed
#ifdef _XBOX
#ifdef _TU_BUILD
@@ -84,14 +84,14 @@ InputStream *DefaultTexturePack::getResourceImplementation(const wstring &name)/
}
wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
wDrive = wstr + L"\\Common\\res\\TitleUpdate\\res";
#elif __PSVITA__
/*
char *pchUsrDir=getUsrDirPath();
wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
wDrive = wstr + L"Common\\res\\TitleUpdate\\res";
*/
@@ -15,14 +15,14 @@ protected:
public:
//@Override
bool hasFile(const wstring &name);
bool hasFile(const std::wstring &name);
bool isTerrainUpdateCompatible();
wstring getDesc1() {return app.GetString(IDS_DEFAULT_TEXTUREPACK);}
std::wstring getDesc1() {return app.GetString(IDS_DEFAULT_TEXTUREPACK);}
protected:
//@Override
InputStream *getResourceImplementation(const wstring &name); // throws FileNotFoundException
InputStream *getResourceImplementation(const std::wstring &name); // throws FileNotFoundException
public:
virtual bool hasData() { return true; }
@@ -24,7 +24,7 @@ void FileTexturePack::unload(Textures *textures)
#endif
}
InputStream *FileTexturePack::getResourceImplementation(const wstring &name) //throws IOException
InputStream *FileTexturePack::getResourceImplementation(const std::wstring &name) //throws IOException
{
#if 0
loadZipFile();
@@ -39,7 +39,7 @@ InputStream *FileTexturePack::getResourceImplementation(const wstring &name) //t
return NULL;
}
bool FileTexturePack::hasFile(const wstring &name)
bool FileTexturePack::hasFile(const std::wstring &name)
{
#if 0
try {
@@ -18,11 +18,11 @@ public:
void unload(Textures *textures);
protected:
InputStream *getResourceImplementation(const wstring &name); //throws IOException
InputStream *getResourceImplementation(const std::wstring &name); //throws IOException
public:
//@Override
bool hasFile(const wstring &name);
bool hasFile(const std::wstring &name);
private:
void loadZipFile(); //throws IOException
@@ -1,7 +1,7 @@
#include "../../Build/stdafx.h"
#include "FolderTexturePack.h"
FolderTexturePack::FolderTexturePack(DWORD id, const wstring &name, File *folder, TexturePack *fallback) : AbstractTexturePack(id, folder, name, fallback)
FolderTexturePack::FolderTexturePack(DWORD id, const std::wstring &name, File *folder, TexturePack *fallback) : AbstractTexturePack(id, folder, name, fallback)
{
// 4J Stu - These calls need to be in the most derived version of the class
loadIcon();
@@ -11,7 +11,7 @@ FolderTexturePack::FolderTexturePack(DWORD id, const wstring &name, File *folder
bUILoaded = false;
}
InputStream *FolderTexturePack::getResourceImplementation(const wstring &name) //throws IOException
InputStream *FolderTexturePack::getResourceImplementation(const std::wstring &name) //throws IOException
{
#if 0
final File file = new File(this.file, name.substring(1));
@@ -22,7 +22,7 @@ InputStream *FolderTexturePack::getResourceImplementation(const wstring &name) /
return new BufferedInputStream(new FileInputStream(file));
#endif
wstring wDrive = L"";
std::wstring wDrive = L"";
// Make the content package point to to the UPDATE: drive is needed
#ifdef _XBOX
wDrive=L"GAME:\\DummyTexturePack\\res";
@@ -40,7 +40,7 @@ InputStream *FolderTexturePack::getResourceImplementation(const wstring &name) /
return resource;
}
bool FolderTexturePack::hasFile(const wstring &name)
bool FolderTexturePack::hasFile(const std::wstring &name)
{
File file = File( getPath() + name);
return file.exists() && file.isFile();
@@ -58,9 +58,9 @@ bool FolderTexturePack::isTerrainUpdateCompatible()
return true;
}
wstring FolderTexturePack::getPath(bool bTitleUpdateTexture /*= false*/)
std::wstring FolderTexturePack::getPath(bool bTitleUpdateTexture /*= false*/)
{
wstring wDrive;
std::wstring wDrive;
#ifdef _XBOX
wDrive=L"GAME:\\" + file->getPath() + L"\\";
#else
@@ -8,19 +8,19 @@ private:
bool bUILoaded;
public:
FolderTexturePack(DWORD id, const wstring &name, File *folder, TexturePack *fallback);
FolderTexturePack(DWORD id, const std::wstring &name, File *folder, TexturePack *fallback);
protected:
//@Override
InputStream *getResourceImplementation(const wstring &name); //throws IOException
InputStream *getResourceImplementation(const std::wstring &name); //throws IOException
public:
//@Override
bool hasFile(const wstring &name);
bool hasFile(const std::wstring &name);
bool isTerrainUpdateCompatible();
// 4J Added
virtual wstring getPath(bool bTitleUpdateTexture = false);
virtual std::wstring getPath(bool bTitleUpdateTexture = false);
virtual void loadUI();
virtual void unloadUI();
};
@@ -1,9 +1,9 @@
#include "../../Build/stdafx.h"
#include "TexturePack.h"
wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/)
std::wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/)
{
wstring wDrive;
std::wstring wDrive;
#ifdef _XBOX
if(bTitleUpdateTexture)
{
@@ -27,7 +27,7 @@ wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/)
char *pchUsrDir=getUsrDirPath();
wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
if(bTitleUpdateTexture)
{
@@ -42,7 +42,7 @@ wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/)
#elif __PSVITA__
char *pchUsrDir="";//getUsrDirPath();
wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
if(bTitleUpdateTexture)
{
+11 -11
View File
@@ -19,16 +19,16 @@ public:
virtual void loadData() {}
virtual void unload(Textures *textures) = 0;
virtual void load(Textures *textures) = 0;
virtual InputStream *getResource(const wstring &name, bool allowFallback) = 0;// throws IOException;
//virtual InputStream *getResource(const wstring &name) = 0;// throws IOException;
virtual InputStream *getResource(const std::wstring &name, bool allowFallback) = 0;// throws IOException;
//virtual InputStream *getResource(const std::wstring &name) = 0;// throws IOException;
virtual DWORD getId() = 0;
virtual wstring getName() = 0;
virtual wstring getDesc1() = 0;
virtual wstring getDesc2() = 0;
virtual bool hasFile(const wstring &name, bool allowFallback) = 0;
virtual std::wstring getName() = 0;
virtual std::wstring getDesc1() = 0;
virtual std::wstring getDesc2() = 0;
virtual bool hasFile(const std::wstring &name, bool allowFallback) = 0;
virtual bool isTerrainUpdateCompatible() = 0;
virtual wstring getResource(const wstring& name) // 4J - changed to just return a name rather than an input stream
virtual std::wstring getResource(const std::wstring& name) // 4J - changed to just return a name rather than an input stream
{
/* 4J - TODO
return TexturePack.class.getResourceAsStream(name);
@@ -39,13 +39,13 @@ public:
// 4J Added
virtual wstring getPath(bool bTitleUpdateTexture = false);
virtual wstring getAnimationString(const wstring &textureName, const wstring &path, bool allowFallback) = 0;
virtual BufferedImage *getImageResource(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L"") = 0;
virtual std::wstring getPath(bool bTitleUpdateTexture = false);
virtual std::wstring getAnimationString(const std::wstring &textureName, const std::wstring &path, bool allowFallback) = 0;
virtual BufferedImage *getImageResource(const std::wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const std::wstring &drive =L"") = 0;
virtual void loadColourTable() = 0;
virtual void loadUI() = 0;
virtual void unloadUI() = 0;
virtual wstring getXuiRootPath() = 0;
virtual std::wstring getXuiRootPath() = 0;
virtual PBYTE getPackIcon(DWORD &dwImageBytes) = 0;
virtual PBYTE getPackComparison(DWORD &dwImageBytes) = 0;
virtual unsigned int getDLCParentPackId() = 0;
@@ -105,7 +105,7 @@ bool TexturePackRepository::selectSkin(TexturePack *skin)
return true;
}
void TexturePackRepository::selectWebSkin(const wstring &url)
void TexturePackRepository::selectWebSkin(const std::wstring &url)
{
app.DebugPrintf("TexturePackRepository::selectWebSkin is not implemented\n");
#if 0
@@ -117,7 +117,7 @@ void TexturePackRepository::selectWebSkin(const wstring &url)
#endif
}
void TexturePackRepository::downloadWebSkin(const wstring &url, File file)
void TexturePackRepository::downloadWebSkin(const std::wstring &url, File file)
{
app.DebugPrintf("TexturePackRepository::selectWebSkin is not implemented\n");
#if 0
@@ -219,7 +219,7 @@ void TexturePackRepository::updateList()
#endif
}
wstring TexturePackRepository::getIdOrNull(File file)
std::wstring TexturePackRepository::getIdOrNull(File file)
{
app.DebugPrintf("TexturePackRepository::getIdOrNull is not implemented\n");
#if 0
@@ -291,14 +291,14 @@ bool TexturePackRepository::canUseWebSkin()
return false;
}
vector< pair<DWORD,wstring> > *TexturePackRepository::getTexturePackIdNames()
vector< pair<DWORD,std::wstring> > *TexturePackRepository::getTexturePackIdNames()
{
vector< pair<DWORD,wstring> > *packList = new vector< pair<DWORD,wstring> >();
vector< pair<DWORD,std::wstring> > *packList = new vector< pair<DWORD,std::wstring> >();
for(AUTO_VAR(it,texturePacks->begin()); it != texturePacks->end(); ++it)
{
TexturePack *pack = *it;
packList->push_back( pair<DWORD,wstring>(pack->getId(),pack->getName()) );
packList->push_back( pair<DWORD,std::wstring>(pack->getId(),pack->getName()) );
}
return packList;
}
@@ -37,10 +37,10 @@ private:
public:
bool selectSkin(TexturePack *skin);
void selectWebSkin(const wstring &url);
void selectWebSkin(const std::wstring &url);
private:
void downloadWebSkin(const wstring &url, File file);
void downloadWebSkin(const std::wstring &url, File file);
public:
bool isUsingWebSkin();
@@ -48,7 +48,7 @@ public:
void updateList();
private:
wstring getIdOrNull(File file);
std::wstring getIdOrNull(File file);
vector<File> getWorkDirContents();
public:
@@ -60,7 +60,7 @@ public:
bool isUsingDefaultSkin() { return selected == DEFAULT_TEXTURE_PACK; } // 4J Added
TexturePack *getDefault() { return DEFAULT_TEXTURE_PACK; } // 4J Added
vector< pair<DWORD,wstring> > *getTexturePackIdNames();
vector< pair<DWORD,std::wstring> > *getTexturePackIdNames();
bool selectTexturePackById(DWORD id); // 4J Added
TexturePack *getTexturePackById(DWORD id); // 4J Added
@@ -19,9 +19,9 @@
#include "../CompassTexture.h"
#include "../ClockTexture.h"
const wstring PreStitchedTextureMap::NAME_MISSING_TEXTURE = L"missingno";
const std::wstring PreStitchedTextureMap::NAME_MISSING_TEXTURE = L"missingno";
PreStitchedTextureMap::PreStitchedTextureMap(int type, const wstring &name, const wstring &path, BufferedImage *missingTexture, bool mipmap) : iconType(type), name(name), path(path), extension(L".png")
PreStitchedTextureMap::PreStitchedTextureMap(int type, const std::wstring &name, const std::wstring &path, BufferedImage *missingTexture, bool mipmap) : iconType(type), name(name), path(path), extension(L".png")
{
this->missingTexture = missingTexture;
@@ -77,7 +77,7 @@ void PreStitchedTextureMap::stitch()
animatedTextures.clear();
// Create the final image
wstring filename = name + extension;
std::wstring filename = name + extension;
TexturePack *texturePack = Minecraft::GetInstance()->skins->getSelected();
//try {
@@ -87,7 +87,7 @@ void PreStitchedTextureMap::stitch()
int magFilter = Texture::TFLT_NEAREST;
MemSect(32);
wstring drive = L"";
std::wstring drive = L"";
if(texturePack->hasFile(L"res/" + filename,false))
{
drive = texturePack->getPath(true);
@@ -129,8 +129,8 @@ void PreStitchedTextureMap::stitch()
MemSect(52);
for(AUTO_VAR(it, texturesToAnimate.begin()); it != texturesToAnimate.end(); ++it)
{
wstring textureName = it->first;
wstring textureFileName = it->second;
std::wstring textureName = it->first;
std::wstring textureFileName = it->second;
StitchedTexture *preStitched = (StitchedTexture *)texturesByName[textureName];
@@ -140,7 +140,7 @@ void PreStitchedTextureMap::stitch()
continue;
}
wstring filename = path + textureFileName + extension;
std::wstring filename = path + textureFileName + extension;
// TODO: [EB] Put the frames into a proper object, not this inside out hack
vector<Texture *> *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap);
@@ -164,7 +164,7 @@ void PreStitchedTextureMap::stitch()
{
animatedTextures.push_back(preStitched);
wstring animString = texturePack->getAnimationString(textureFileName, path, true);
std::wstring animString = texturePack->getAnimationString(textureFileName, path, true);
preStitched->loadAnimationFrames(animString);
}
@@ -216,7 +216,7 @@ void PreStitchedTextureMap::stitch()
#endif
}
StitchedTexture *PreStitchedTextureMap::getTexture(const wstring &name)
StitchedTexture *PreStitchedTextureMap::getTexture(const std::wstring &name)
{
#ifndef _CONTENT_PACKAGE
app.DebugPrintf("Not implemented!\n");
@@ -246,7 +246,7 @@ Texture *PreStitchedTextureMap::getStitchedTexture()
}
// 4J Stu - register is a reserved keyword in C++
Icon *PreStitchedTextureMap::registerIcon(const wstring &name)
Icon *PreStitchedTextureMap::registerIcon(const std::wstring &name)
{
Icon *result = NULL;
if (name.empty())
@@ -363,11 +363,11 @@ void PreStitchedTextureMap::loadUVs()
texturesByName.insert(stringIconMap::value_type(L"compassP1",new SimpleIcon(L"compassP1",slotSize*8,slotSize*14,slotSize*(8+1),slotSize*(14+1))));
texturesByName.insert(stringIconMap::value_type(L"compassP2",new SimpleIcon(L"compassP2",slotSize*9,slotSize*14,slotSize*(9+1),slotSize*(14+1))));
texturesByName.insert(stringIconMap::value_type(L"compassP3",new SimpleIcon(L"compassP3",slotSize*10,slotSize*14,slotSize*(10+1),slotSize*(14+1))));
texturesToAnimate.push_back(pair<wstring, wstring>(L"compass",L"compass"));
texturesToAnimate.push_back(pair<wstring, wstring>(L"compassP0",L"compass"));
texturesToAnimate.push_back(pair<wstring, wstring>(L"compassP1",L"compass"));
texturesToAnimate.push_back(pair<wstring, wstring>(L"compassP2",L"compass"));
texturesToAnimate.push_back(pair<wstring, wstring>(L"compassP3",L"compass"));
texturesToAnimate.push_back(pair<std::wstring, std::wstring>(L"compass",L"compass"));
texturesToAnimate.push_back(pair<std::wstring, std::wstring>(L"compassP0",L"compass"));
texturesToAnimate.push_back(pair<std::wstring, std::wstring>(L"compassP1",L"compass"));
texturesToAnimate.push_back(pair<std::wstring, std::wstring>(L"compassP2",L"compass"));
texturesToAnimate.push_back(pair<std::wstring, std::wstring>(L"compassP3",L"compass"));
texturesByName.insert(stringIconMap::value_type(L"diamond",new SimpleIcon(L"diamond",slotSize*7,slotSize*3,slotSize*(7+1),slotSize*(3+1))));
texturesByName.insert(stringIconMap::value_type(L"redstone",new SimpleIcon(L"redstone",slotSize*8,slotSize*3,slotSize*(8+1),slotSize*(3+1))));
texturesByName.insert(stringIconMap::value_type(L"clay",new SimpleIcon(L"clay",slotSize*9,slotSize*3,slotSize*(9+1),slotSize*(3+1))));
@@ -388,11 +388,11 @@ void PreStitchedTextureMap::loadUVs()
texturesByName.insert(stringIconMap::value_type(L"clockP1",new SimpleIcon(L"clockP1",slotSize*12,slotSize*14,slotSize*(12+1),slotSize*(14+1))));
texturesByName.insert(stringIconMap::value_type(L"clockP2",new SimpleIcon(L"clockP2",slotSize*13,slotSize*14,slotSize*(13+1),slotSize*(14+1))));
texturesByName.insert(stringIconMap::value_type(L"clockP3",new SimpleIcon(L"clockP3",slotSize*14,slotSize*14,slotSize*(14+1),slotSize*(14+1))));
texturesToAnimate.push_back(pair<wstring, wstring>(L"clock",L"clock"));
texturesToAnimate.push_back(pair<wstring, wstring>(L"clockP0",L"clock"));
texturesToAnimate.push_back(pair<wstring, wstring>(L"clockP1",L"clock"));
texturesToAnimate.push_back(pair<wstring, wstring>(L"clockP2",L"clock"));
texturesToAnimate.push_back(pair<wstring, wstring>(L"clockP3",L"clock"));
texturesToAnimate.push_back(pair<std::wstring, std::wstring>(L"clock",L"clock"));
texturesToAnimate.push_back(pair<std::wstring, std::wstring>(L"clockP0",L"clock"));
texturesToAnimate.push_back(pair<std::wstring, std::wstring>(L"clockP1",L"clock"));
texturesToAnimate.push_back(pair<std::wstring, std::wstring>(L"clockP2",L"clock"));
texturesToAnimate.push_back(pair<std::wstring, std::wstring>(L"clockP3",L"clock"));
texturesByName.insert(stringIconMap::value_type(L"bowl",new SimpleIcon(L"bowl",slotSize*7,slotSize*4,slotSize*(7+1),slotSize*(4+1))));
texturesByName.insert(stringIconMap::value_type(L"mushroomStew",new SimpleIcon(L"mushroomStew",slotSize*8,slotSize*4,slotSize*(8+1),slotSize*(4+1))));
texturesByName.insert(stringIconMap::value_type(L"yellowDust",new SimpleIcon(L"yellowDust",slotSize*9,slotSize*4,slotSize*(9+1),slotSize*(4+1))));
@@ -607,7 +607,7 @@ void PreStitchedTextureMap::loadUVs()
texturesByName.insert(stringIconMap::value_type(L"rose",new SimpleIcon(L"rose",slotSize*12,slotSize*0,slotSize*(12+1),slotSize*(0+1))));
texturesByName.insert(stringIconMap::value_type(L"flower",new SimpleIcon(L"flower",slotSize*13,slotSize*0,slotSize*(13+1),slotSize*(0+1))));
texturesByName.insert(stringIconMap::value_type(L"portal",new SimpleIcon(L"portal",slotSize*14,slotSize*0,slotSize*(14+1),slotSize*(0+1))));
texturesToAnimate.push_back(pair<wstring, wstring>(L"portal",L"portal"));
texturesToAnimate.push_back(pair<std::wstring, std::wstring>(L"portal",L"portal"));
texturesByName.insert(stringIconMap::value_type(L"sapling",new SimpleIcon(L"sapling",slotSize*15,slotSize*0,slotSize*(15+1),slotSize*(0+1))));
texturesByName.insert(stringIconMap::value_type(L"stonebrick",new SimpleIcon(L"stonebrick",slotSize*0,slotSize*1,slotSize*(0+1),slotSize*(1+1))));
texturesByName.insert(stringIconMap::value_type(L"bedrock",new SimpleIcon(L"bedrock",slotSize*1,slotSize*1,slotSize*(1+1),slotSize*(1+1))));
@@ -625,7 +625,7 @@ void PreStitchedTextureMap::loadUVs()
texturesByName.insert(stringIconMap::value_type(L"mushroom_brown",new SimpleIcon(L"mushroom_brown",slotSize*13,slotSize*1,slotSize*(13+1),slotSize*(1+1))));
texturesByName.insert(stringIconMap::value_type(L"sapling_jungle",new SimpleIcon(L"sapling_jungle",slotSize*14,slotSize*1,slotSize*(14+1),slotSize*(1+1))));
texturesByName.insert(stringIconMap::value_type(L"fire_0",new SimpleIcon(L"fire_0",slotSize*15,slotSize*1,slotSize*(15+1),slotSize*(1+1))));
texturesToAnimate.push_back(pair<wstring, wstring>(L"fire_0",L"fire_0"));
texturesToAnimate.push_back(pair<std::wstring, std::wstring>(L"fire_0",L"fire_0"));
texturesByName.insert(stringIconMap::value_type(L"oreGold",new SimpleIcon(L"oreGold",slotSize*0,slotSize*2,slotSize*(0+1),slotSize*(2+1))));
texturesByName.insert(stringIconMap::value_type(L"oreIron",new SimpleIcon(L"oreIron",slotSize*1,slotSize*2,slotSize*(1+1),slotSize*(2+1))));
texturesByName.insert(stringIconMap::value_type(L"oreCoal",new SimpleIcon(L"oreCoal",slotSize*2,slotSize*2,slotSize*(2+1),slotSize*(2+1))));
@@ -642,7 +642,7 @@ void PreStitchedTextureMap::loadUVs()
texturesByName.insert(stringIconMap::value_type(L"furnace_side",new SimpleIcon(L"furnace_side",slotSize*13,slotSize*2,slotSize*(13+1),slotSize*(2+1))));
texturesByName.insert(stringIconMap::value_type(L"dispenser_front",new SimpleIcon(L"dispenser_front",slotSize*14,slotSize*2,slotSize*(14+1),slotSize*(2+1))));
texturesByName.insert(stringIconMap::value_type(L"fire_1",new SimpleIcon(L"fire_1",slotSize*15,slotSize*1,slotSize*(15+1),slotSize*(1+1))));
texturesToAnimate.push_back(pair<wstring, wstring>(L"fire_1",L"fire_1"));
texturesToAnimate.push_back(pair<std::wstring, std::wstring>(L"fire_1",L"fire_1"));
texturesByName.insert(stringIconMap::value_type(L"sponge",new SimpleIcon(L"sponge",slotSize*0,slotSize*3,slotSize*(0+1),slotSize*(3+1))));
texturesByName.insert(stringIconMap::value_type(L"glass",new SimpleIcon(L"glass",slotSize*1,slotSize*3,slotSize*(1+1),slotSize*(3+1))));
texturesByName.insert(stringIconMap::value_type(L"oreDiamond",new SimpleIcon(L"oreDiamond",slotSize*2,slotSize*3,slotSize*(2+1),slotSize*(3+1))));
@@ -803,9 +803,9 @@ void PreStitchedTextureMap::loadUVs()
texturesByName.insert(stringIconMap::value_type(L"potatoes_2",new SimpleIcon(L"potatoes_2",slotSize*10,slotSize*12,slotSize*(10+1),slotSize*(12+1))));
texturesByName.insert(stringIconMap::value_type(L"potatoes_3",new SimpleIcon(L"potatoes_3",slotSize*12,slotSize*12,slotSize*(12+1),slotSize*(12+1))));
texturesByName.insert(stringIconMap::value_type(L"water",new SimpleIcon(L"water",slotSize*13,slotSize*12,slotSize*(13+1),slotSize*(12+1))));
texturesToAnimate.push_back(pair<wstring, wstring>(L"water",L"water"));
texturesToAnimate.push_back(pair<std::wstring, std::wstring>(L"water",L"water"));
texturesByName.insert(stringIconMap::value_type(L"water_flow",new SimpleIcon(L"water_flow",slotSize*14,slotSize*12,slotSize*(14+2),slotSize*(12+2))));
texturesToAnimate.push_back(pair<wstring, wstring>(L"water_flow",L"water_flow"));
texturesToAnimate.push_back(pair<std::wstring, std::wstring>(L"water_flow",L"water_flow"));
texturesByName.insert(stringIconMap::value_type(L"sandstone_bottom",new SimpleIcon(L"sandstone_bottom",slotSize*0,slotSize*13,slotSize*(0+1),slotSize*(13+1))));
texturesByName.insert(stringIconMap::value_type(L"cloth_9",new SimpleIcon(L"cloth_9",slotSize*1,slotSize*13,slotSize*(1+1),slotSize*(13+1))));
texturesByName.insert(stringIconMap::value_type(L"cloth_1",new SimpleIcon(L"cloth_1",slotSize*2,slotSize*13,slotSize*(2+1),slotSize*(13+1))));
@@ -834,9 +834,9 @@ void PreStitchedTextureMap::loadUVs()
texturesByName.insert(stringIconMap::value_type(L"quartzblock_side",new SimpleIcon(L"quartzblock_side",slotSize*11,slotSize*14,slotSize*(11+1),slotSize*(14+1))));
texturesByName.insert(stringIconMap::value_type(L"hopper_inside",new SimpleIcon(L"hopper_inside",slotSize*12,slotSize*14,slotSize*(12+1),slotSize*(14+1))));
texturesByName.insert(stringIconMap::value_type(L"lava",new SimpleIcon(L"lava",slotSize*13,slotSize*14,slotSize*(13+1),slotSize*(14+1))));
texturesToAnimate.push_back(pair<wstring, wstring>(L"lava",L"lava"));
texturesToAnimate.push_back(pair<std::wstring, std::wstring>(L"lava",L"lava"));
texturesByName.insert(stringIconMap::value_type(L"lava_flow",new SimpleIcon(L"lava_flow",slotSize*14,slotSize*14,slotSize*(14+2),slotSize*(14+2))));
texturesToAnimate.push_back(pair<wstring, wstring>(L"lava_flow",L"lava_flow"));
texturesToAnimate.push_back(pair<std::wstring, std::wstring>(L"lava_flow",L"lava_flow"));
texturesByName.insert(stringIconMap::value_type(L"destroy_0",new SimpleIcon(L"destroy_0",slotSize*0,slotSize*15,slotSize*(0+1),slotSize*(15+1))));
texturesByName.insert(stringIconMap::value_type(L"destroy_1",new SimpleIcon(L"destroy_1",slotSize*1,slotSize*15,slotSize*(1+1),slotSize*(15+1))));
texturesByName.insert(stringIconMap::value_type(L"destroy_2",new SimpleIcon(L"destroy_2",slotSize*2,slotSize*15,slotSize*(2+1),slotSize*(15+1))));
@@ -12,37 +12,37 @@ class BufferedImage;
class PreStitchedTextureMap : public IconRegister
{
public:
static const wstring NAME_MISSING_TEXTURE;
static const std::wstring NAME_MISSING_TEXTURE;
private:
const int iconType;
const wstring name;
const wstring path;
const wstring extension;
const std::wstring name;
const std::wstring path;
const std::wstring extension;
bool m_mipMap;
typedef std::unordered_map<wstring, Icon *> stringIconMap;
typedef std::unordered_map<std::wstring, Icon *> stringIconMap;
stringIconMap texturesByName; // = new HashMap<String, StitchedTexture>();
BufferedImage *missingTexture; // = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB);
StitchedTexture *missingPosition;
Texture *stitchResult;
vector<StitchedTexture *> animatedTextures; // = new ArrayList<StitchedTexture>();
vector<pair<wstring, wstring> > texturesToAnimate;
vector<pair<std::wstring, std::wstring> > texturesToAnimate;
void loadUVs();
public:
PreStitchedTextureMap(int type, const wstring &name, const wstring &path, BufferedImage *missingTexture, bool mipMap = false);
PreStitchedTextureMap(int type, const std::wstring &name, const std::wstring &path, BufferedImage *missingTexture, bool mipMap = false);
void stitch();
StitchedTexture *getTexture(const wstring &name);
StitchedTexture *getTexture(const std::wstring &name);
void cycleAnimationFrames();
Texture *getStitchedTexture();
// 4J Stu - register is a reserved keyword in C++
Icon *registerIcon(const wstring &name);
Icon *registerIcon(const std::wstring &name);
int getIconType();
Icon *getMissingIcon();
@@ -150,7 +150,7 @@ void StitchSlot::collectAssignments(vector<StitchSlot *> *result)
}
//@Override
wstring StitchSlot::toString()
std::wstring StitchSlot::toString()
{
return L"Slot{originX=" + _toString(originX) + L", originY=" + _toString(originY) + L", width=" + _toString(width) + L", height=" + _toString(height) + L", texture=" + _toString(textureHolder) + L", subSlots=" + _toString(subSlots) + L'}';
}
@@ -24,5 +24,5 @@ public:
void collectAssignments(vector<StitchSlot *> *result);
//@Override
wstring toString();
std::wstring toString();
};
@@ -6,7 +6,7 @@
#include "StitchedTexture.h"
#include "../TextureManager.h"
StitchedTexture *StitchedTexture::create(const wstring &name)
StitchedTexture *StitchedTexture::create(const std::wstring &name)
{
// TODO: Generalize?
if (name.compare(L"clock") == 0)
@@ -23,7 +23,7 @@ StitchedTexture *StitchedTexture::create(const wstring &name)
}
}
StitchedTexture::StitchedTexture(const wstring &name) : name(name)
StitchedTexture::StitchedTexture(const std::wstring &name) : name(name)
{
// 4J Initialisers
source = NULL;
@@ -170,7 +170,7 @@ float StitchedTexture::getV(double offset, bool adjust/*=false*/) const
return getV0(adjust) + (diff * ((float) offset / SharedConstants::WORLD_RESOLUTION));
}
wstring StitchedTexture::getName() const
std::wstring StitchedTexture::getName() const
{
return name;
}
@@ -256,7 +256,7 @@ void StitchedTexture::loadAnimationFrames(BufferedReader *bufferedReader)
intPairVector *results = new intPairVector();
//try {
wstring line = bufferedReader->readLine();
std::wstring line = bufferedReader->readLine();
while (!line.empty())
{
line = trimString(line);
@@ -266,7 +266,7 @@ void StitchedTexture::loadAnimationFrames(BufferedReader *bufferedReader)
//for (String token : tokens)
for(AUTO_VAR(it, tokens.begin()); it != tokens.end(); ++it)
{
wstring token = *it;
std::wstring token = *it;
int multiPos = token.find_first_of('*');
if (multiPos > 0)
{
@@ -297,7 +297,7 @@ void StitchedTexture::loadAnimationFrames(BufferedReader *bufferedReader)
}
}
void StitchedTexture::loadAnimationFrames(const wstring &string)
void StitchedTexture::loadAnimationFrames(const std::wstring &string)
{
if(frameOverride != NULL)
{
@@ -313,7 +313,7 @@ void StitchedTexture::loadAnimationFrames(const wstring &string)
//for (String token : tokens)
for(AUTO_VAR(it, tokens.begin()); it != tokens.end(); ++it)
{
wstring token = trimString(*it);
std::wstring token = trimString(*it);
int multiPos = token.find_first_of('*');
if (multiPos > 0)
{
@@ -7,7 +7,7 @@ class Texture;
class StitchedTexture : public Icon
{
private:
const wstring name;
const std::wstring name;
protected:
Texture *source;
@@ -41,11 +41,11 @@ protected:
int subFrame;
public:
static StitchedTexture *create(const wstring &name);
static StitchedTexture *create(const std::wstring &name);
~StitchedTexture();
protected:
StitchedTexture(const wstring &name);
StitchedTexture(const std::wstring &name);
public:
void initUVs(float U0, float V0, float U1, float V1);
@@ -61,7 +61,7 @@ public:
float getV0(bool adjust = false) const;
float getV1(bool adjust = false) const;
float getV(double offset, bool adjust = false) const;
wstring getName() const;
std::wstring getName() const;
virtual int getSourceWidth() const;
virtual int getSourceHeight() const;
virtual void cycleFrames();
@@ -80,7 +80,7 @@ public:
* @param bufferedReader
*/
void loadAnimationFrames(BufferedReader *bufferedReader);
void loadAnimationFrames(const wstring &string); // 4J Added
void loadAnimationFrames(const std::wstring &string); // 4J Added
int getFlags() const ; // 4J added
void setFlags(int flags); // 4J added
@@ -6,7 +6,7 @@
#include "StitchedTexture.h"
#include "Stitcher.h"
void Stitcher::_init(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale)
void Stitcher::_init(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale)
{
this->name = name;
this->maxWidth = maxWidth;
@@ -20,12 +20,12 @@ void Stitcher::_init(const wstring &name, int maxWidth, int maxHeight, bool forc
stitchedTexture = NULL;
}
Stitcher::Stitcher(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo)
Stitcher::Stitcher(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo)
{
_init(name, maxWidth, maxHeight, forcePowerOfTwo, 0);
}
Stitcher::Stitcher(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale)
Stitcher::Stitcher(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale)
{
_init(name, maxWidth, maxHeight, forcePowerOfTwo, forcedScale);
}
@@ -28,13 +28,13 @@ private:
Texture *stitchedTexture;
wstring name;
std::wstring name;
void _init(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale);
void _init(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale);
public:
Stitcher(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo);
Stitcher(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale);
Stitcher(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo);
Stitcher(const std::wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale);
int getWidth();
int getHeight();
@@ -15,9 +15,9 @@
#include "../Packs/TexturePackRepository.h"
#include "TextureMap.h"
const wstring TextureMap::NAME_MISSING_TEXTURE = L"missingno";
const std::wstring TextureMap::NAME_MISSING_TEXTURE = L"missingno";
TextureMap::TextureMap(int type, const wstring &name, const wstring &path, BufferedImage *missingTexture, bool mipmap) : iconType(type), name(name), path(path), extension(L".png")
TextureMap::TextureMap(int type, const std::wstring &name, const std::wstring &path, BufferedImage *missingTexture, bool mipmap) : iconType(type), name(name), path(path), extension(L".png")
{
this->missingTexture = missingTexture;
@@ -82,9 +82,9 @@ void TextureMap::stitch()
//for (final String name : texturesToRegister.keySet())
for(AUTO_VAR(it, texturesToRegister.begin()); it != texturesToRegister.end(); ++it)
{
wstring name = it->first;
std::wstring name = it->first;
wstring filename = path + name + extension;
std::wstring filename = path + name + extension;
// TODO: [EB] Put the frames into a proper object, not this inside out hack
vector<Texture *> *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap);
@@ -121,7 +121,7 @@ void TextureMap::stitch()
TextureHolder *textureHolder = slot->getHolder();
Texture *texture = textureHolder->getTexture();
wstring textureName = texture->getName();
std::wstring textureName = texture->getName();
vector<Texture *> *frames = textures.find(textureHolder)->second;
@@ -155,7 +155,7 @@ void TextureMap::stitch()
{
animatedTextures.push_back(stored);
wstring animationDefinitionFile = textureName + L".txt";
std::wstring animationDefinitionFile = textureName + L".txt";
TexturePack *texturePack = Minecraft::GetInstance()->skins->getSelected();
bool requiresFallback = !texturePack->hasFile(L"\\" + textureName + L".png", false);
@@ -189,7 +189,7 @@ void TextureMap::stitch()
stitchResult->updateOnGPU();
}
StitchedTexture *TextureMap::getTexture(const wstring &name)
StitchedTexture *TextureMap::getTexture(const std::wstring &name)
{
StitchedTexture *result = texturesByName.find(name)->second;
if (result == NULL) result = missingPosition;
@@ -212,7 +212,7 @@ Texture *TextureMap::getStitchedTexture()
}
// 4J Stu - register is a reserved keyword in C++
Icon *TextureMap::registerIcon(const wstring &name)
Icon *TextureMap::registerIcon(const std::wstring &name)
{
if (name.empty())
{
@@ -10,18 +10,18 @@ class BufferedImage;
class TextureMap : public IconRegister
{
public:
static const wstring NAME_MISSING_TEXTURE;
static const std::wstring NAME_MISSING_TEXTURE;
private:
const int iconType;
const wstring name;
const wstring path;
const wstring extension;
const std::wstring name;
const std::wstring path;
const std::wstring extension;
bool m_mipMap;
typedef std::unordered_map<wstring, StitchedTexture *> stringStitchedTextureMap;
typedef std::unordered_map<std::wstring, StitchedTexture *> stringStitchedTextureMap;
stringStitchedTextureMap texturesByName; // = new HashMap<String, StitchedTexture>();
BufferedImage *missingTexture; // = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB);
StitchedTexture *missingPosition;
@@ -31,15 +31,15 @@ private:
stringStitchedTextureMap texturesToRegister; // = new HashMap<String, StitchedTexture>();
public:
TextureMap(int type, const wstring &name, const wstring &path, BufferedImage *missingTexture, bool mipMap = false);
TextureMap(int type, const std::wstring &name, const std::wstring &path, BufferedImage *missingTexture, bool mipMap = false);
void stitch();
StitchedTexture *getTexture(const wstring &name);
StitchedTexture *getTexture(const std::wstring &name);
void cycleAnimationFrames();
Texture *getStitchedTexture();
// 4J Stu - register is a reserved keyword in C++
Icon *registerIcon(const wstring &name);
Icon *registerIcon(const std::wstring &name);
int getIconType();
Icon *getMissingIcon();
+8 -8
View File
@@ -15,12 +15,12 @@ C4JSpursJobQueue::Port* g_texBlitJobQueuePort;
#define MAX_MIP_LEVELS 5
Texture::Texture(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap)
Texture::Texture(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap)
{
_init(name, mode, width, height, depth, wrapMode, format, minFilter, magFilter, mipMap);
}
void Texture::_init(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap)
void Texture::_init(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap)
{
#ifdef __PS3__
if(g_texBlitJobQueuePort == NULL)
@@ -101,7 +101,7 @@ void Texture::_init(const wstring &name, int mode, int width, int height, int de
managerId = TextureManager::getInstance()->createTextureID();
}
void Texture::_init(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap)
void Texture::_init(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap)
{
_init(name, mode, width, height, depth, wrapMode, format, minFilter, magFilter, mipMap);
if (image == NULL)
@@ -178,12 +178,12 @@ void Texture::_init(const wstring &name, int mode, int width, int height, int de
}
}
Texture::Texture(const wstring &name, int mode, int width, int height, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap)
Texture::Texture(const std::wstring &name, int mode, int width, int height, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap)
{
_init(name, mode, width, height, 1, wrapMode, format, minFilter, magFilter, image, mipMap);
}
Texture::Texture(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap)
Texture::Texture(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap)
{
_init(name, mode, width, height, depth, wrapMode, format, minFilter, magFilter, image, mipMap);
}
@@ -242,7 +242,7 @@ void Texture::fill(const Rect2i *rect, int color)
}
}
void Texture::writeAsBMP(const wstring &name)
void Texture::writeAsBMP(const std::wstring &name)
{
// 4J Don't need
#if 0
@@ -329,7 +329,7 @@ void Texture::writeAsBMP(const wstring &name)
#endif
}
void Texture::writeAsPNG(const wstring &filename)
void Texture::writeAsPNG(const std::wstring &filename)
{
// 4J Don't need
#if 0
@@ -769,7 +769,7 @@ int Texture::getHeight()
return height;
}
wstring Texture::getName()
std::wstring Texture::getName()
{
return name;
}
+9 -9
View File
@@ -48,7 +48,7 @@ private:
int magFilter;
int wrapMode;
bool mipmapped;
wstring name;
std::wstring name;
Rect2i *rect;
@@ -67,19 +67,19 @@ public:
~Texture();
private:
Texture(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap = true);
Texture(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap = true);
void _init(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap);
void _init(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap);
void _init(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap);
void _init(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap);
public:
Texture(const wstring &name, int mode, int width, int height, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap = true);
Texture(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap = true);
Texture(const std::wstring &name, int mode, int width, int height, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap = true);
Texture(const std::wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap = true);
const Rect2i *getRect();
void fill(const Rect2i *rect, int color);
void writeAsBMP(const wstring &name);
void writeAsPNG(const wstring &filename);
void writeAsBMP(const std::wstring &name);
void writeAsPNG(const std::wstring &filename);
void blit(int x, int y, Texture *source);
void blit(int x, int y, Texture *source, bool rotated);
void transferFromBuffer(intArray buffer);
@@ -88,7 +88,7 @@ public:
int getGlId();
int getWidth();
int getHeight();
wstring getName();
std::wstring getName();
void setImmediateUpdate(bool immediateUpdate);
void bind(int mipMapIndex);
void updateOnGPU();
+1 -1
View File
@@ -56,7 +56,7 @@ void TextureHolder::setForcedScale(int targetSize)
}
//@Override
wstring TextureHolder::toString()
std::wstring TextureHolder::toString()
{
return L"TextureHolder{width=" + _toString(width) + L", height=" + _toString(height) + L'}';
}
+1 -1
View File
@@ -26,7 +26,7 @@ private:
public:
void setForcedScale(int targetSize);
//@Override
wstring toString();
std::wstring toString();
int compareTo(const TextureHolder *other) const;
};
+13 -13
View File
@@ -29,7 +29,7 @@ int TextureManager::createTextureID()
return nextID++;
}
Texture *TextureManager::getTexture(const wstring &name)
Texture *TextureManager::getTexture(const std::wstring &name)
{
if (stringToIDMap.find(name) != stringToIDMap.end())
{
@@ -39,7 +39,7 @@ Texture *TextureManager::getTexture(const wstring &name)
return NULL;
}
void TextureManager::registerName(const wstring &name, Texture *texture)
void TextureManager::registerName(const std::wstring &name, Texture *texture)
{
stringToIDMap.insert( stringIntMap::value_type( name, texture->getManagerId() ) );
@@ -64,7 +64,7 @@ void TextureManager::registerTexture(Texture *texture)
idToTextureMap.insert( intTextureMap::value_type( texture->getManagerId(), texture ) );
}
void TextureManager::unregisterTexture(const wstring &name, Texture *texture)
void TextureManager::unregisterTexture(const std::wstring &name, Texture *texture)
{
AUTO_VAR(it, idToTextureMap.find(texture->getManagerId()));
if(it != idToTextureMap.end()) idToTextureMap.erase(it);
@@ -73,14 +73,14 @@ void TextureManager::unregisterTexture(const wstring &name, Texture *texture)
if(it2 != stringToIDMap.end()) stringToIDMap.erase(it2);
}
Stitcher *TextureManager::createStitcher(const wstring &name)
Stitcher *TextureManager::createStitcher(const std::wstring &name)
{
int maxTextureSize = Minecraft::maxSupportedTextureSize();
return new Stitcher(name, maxTextureSize, maxTextureSize, true);
}
vector<Texture *> *TextureManager::createTextures(const wstring &filename, bool mipmap)
vector<Texture *> *TextureManager::createTextures(const std::wstring &filename, bool mipmap)
{
vector<Texture *> *result = new vector<Texture *>();
TexturePack *texturePack = Minecraft::GetInstance()->skins->getSelected();
@@ -92,7 +92,7 @@ vector<Texture *> *TextureManager::createTextures(const wstring &filename, bool
int magFilter = Texture::TFLT_NEAREST;
MemSect(32);
wstring drive = L"";
std::wstring drive = L"";
if(texturePack->hasFile(L"res/" + filename,false))
@@ -106,7 +106,7 @@ vector<Texture *> *TextureManager::createTextures(const wstring &filename, bool
{
const char *pchTextureName=wstringtofilename(filename);
char *pchUsrDir = app.GetBDUsrDirPath(pchTextureName);
wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
drive= wstr + L"\\Common\\res\\TitleUpdate\\";
}
else
@@ -123,7 +123,7 @@ vector<Texture *> *TextureManager::createTextures(const wstring &filename, bool
int height = image->getHeight();
int width = image->getWidth();
wstring texName = getTextureNameFromPath(filename);
std::wstring texName = getTextureNameFromPath(filename);
if (isAnimation(filename, texturePack))
{
@@ -168,27 +168,27 @@ vector<Texture *> *TextureManager::createTextures(const wstring &filename, bool
return result;
}
wstring TextureManager::getTextureNameFromPath(const wstring &filename)
std::wstring TextureManager::getTextureNameFromPath(const std::wstring &filename)
{
File file(filename);
return file.getName().substr(0, file.getName().find_last_of(L'.'));
}
bool TextureManager::isAnimation(const wstring &filename, TexturePack *texturePack)
bool TextureManager::isAnimation(const std::wstring &filename, TexturePack *texturePack)
{
wstring dataFileName = L"/" + filename.substr(0, filename.find_last_of(L'.')) + L".txt";
std::wstring dataFileName = L"/" + filename.substr(0, filename.find_last_of(L'.')) + L".txt";
bool hasOriginalImage = texturePack->hasFile(L"/" + filename, false);
return Minecraft::GetInstance()->skins->getSelected()->hasFile(dataFileName, !hasOriginalImage);
}
Texture *TextureManager::createTexture(const wstring &name, int mode, int width, int height, int wrap, int format, int minFilter, int magFilter, bool mipmap, BufferedImage *image)
Texture *TextureManager::createTexture(const std::wstring &name, int mode, int width, int height, int wrap, int format, int minFilter, int magFilter, bool mipmap, BufferedImage *image)
{
Texture *newTex = new Texture(name, mode, width, height, wrap, format, minFilter, magFilter, image, mipmap);
registerTexture(newTex);
return newTex;
}
Texture *TextureManager::createTexture(const wstring &name, int mode, int width, int height, int format, bool mipmap)
Texture *TextureManager::createTexture(const std::wstring &name, int mode, int width, int height, int format, bool mipmap)
{
// 4J Stu - Don't clamp as it causes issues with how we signal non-mipmmapped textures to the pixel shader
//return createTexture(name, mode, width, height, Texture::WM_CLAMP, format, Texture::TFLT_NEAREST, Texture::TFLT_NEAREST, mipmap, NULL);
+10 -10
View File
@@ -10,7 +10,7 @@ private:
static TextureManager *instance;
int nextID;
typedef std::unordered_map<wstring, int> stringIntMap;
typedef std::unordered_map<std::wstring, int> stringIntMap;
typedef std::unordered_map<int, Texture *> intTextureMap;
intTextureMap idToTextureMap;
stringIntMap stringToIDMap;
@@ -24,18 +24,18 @@ private:
public:
int createTextureID();
Texture *getTexture(const wstring &name);
void registerName(const wstring &name, Texture *texture);
Texture *getTexture(const std::wstring &name);
void registerName(const std::wstring &name, Texture *texture);
void registerTexture(Texture *texture);
void unregisterTexture(const wstring &name, Texture *texture);
Stitcher *createStitcher(const wstring &name);
vector<Texture *> *createTextures(const wstring &filename, bool mipmap); // 4J added mipmap param
void unregisterTexture(const std::wstring &name, Texture *texture);
Stitcher *createStitcher(const std::wstring &name);
vector<Texture *> *createTextures(const std::wstring &filename, bool mipmap); // 4J added mipmap param
private:
wstring getTextureNameFromPath(const wstring &filename);
bool isAnimation(const wstring &filename, TexturePack *texturePack);
std::wstring getTextureNameFromPath(const std::wstring &filename);
bool isAnimation(const std::wstring &filename, TexturePack *texturePack);
public:
Texture *createTexture(const wstring &name, int mode, int width, int height, int wrap, int format, int minFilter, int magFilter, bool mipmap, BufferedImage *image);
Texture *createTexture(const wstring &name, int mode, int width, int height, int format, bool mipmap); // 4J Added mipmap param
Texture *createTexture(const std::wstring &name, int mode, int width, int height, int wrap, int format, int minFilter, int magFilter, bool mipmap, BufferedImage *image);
Texture *createTexture(const std::wstring &name, int mode, int width, int height, int format, bool mipmap); // 4J Added mipmap param
};
+31 -31
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)
+21 -21
View File
@@ -208,14 +208,14 @@ private:
static const wchar_t *preLoaded[TN_COUNT];
static int preLoadedIdx[TN_COUNT];
std::unordered_map<wstring, int> idMap;
std::unordered_map<wstring, intArray> pixelsMap;
std::unordered_map<std::wstring, int> idMap;
std::unordered_map<std::wstring, intArray> pixelsMap;
std::unordered_map<int, BufferedImage *> loadedImages;
//IntBuffer *pixels; // 4J - removed so we don't have a permanent buffer kicking round using up 1MB
std::unordered_map<wstring, HttpTexture *> httpTextures;
std::unordered_map<std::wstring, HttpTexture *> httpTextures;
// 4J-PB - Added for GTS textures
std::unordered_map<wstring,MemTexture *> memTextures;
std::unordered_map<std::wstring,MemTexture *> memTextures;
Options *options;
private:
@@ -232,14 +232,14 @@ private:
void loadIndexedTextures(); // 4J Added
public:
intArray loadTexturePixels(TEXTURE_NAME texId, const wstring& resourceName);
intArray loadTexturePixels(TEXTURE_NAME texId, const std::wstring& resourceName);
private:
intArray loadTexturePixels(BufferedImage *img);
intArray loadTexturePixels(BufferedImage *img, intArray pixels);
void setTextureFormat(const wstring& resourceName); // 4J added
void setTextureFormat(const std::wstring& resourceName); // 4J added
public:
void bindTexture(const wstring &resourceName);
void bindTexture(const std::wstring &resourceName);
void bindTexture(int resourceId); // 4J Added
// 4J Made public for use in XUI controls
@@ -249,7 +249,7 @@ public:
void clearLastBoundId();
private:
int loadTexture(TEXTURE_NAME texId, const wstring& resourceName);
int loadTexture(TEXTURE_NAME texId, const std::wstring& resourceName);
public:
int loadTexture(int idx); // 4J added
int getTexture(BufferedImage *img, C4JRender::eTextureFormat format = C4JRender::TEXTURE_FORMAT_RxGyBzAw, bool mipmap = true);
@@ -262,26 +262,26 @@ public:
void replaceTextureDirect(intArray rawPixels, int w, int h, int id); // 4J added as optimisation
void replaceTextureDirect(shortArray rawPixels, int w, int h, int id); // 4J added as optimisation
void releaseTexture(int id);
int loadHttpTexture(const wstring& url, const wstring& backup);
int loadHttpTexture(const wstring& url, int backup); // 4J added
bool hasHttpTexture(const wstring &url);
HttpTexture *addHttpTexture(const wstring& url, HttpTextureProcessor *processor);
void removeHttpTexture(const wstring& url);
int loadHttpTexture(const std::wstring& url, const std::wstring& backup);
int loadHttpTexture(const std::wstring& url, int backup); // 4J added
bool hasHttpTexture(const std::wstring &url);
HttpTexture *addHttpTexture(const std::wstring& url, HttpTextureProcessor *processor);
void removeHttpTexture(const std::wstring& url);
// 4J-PB - for the GTS textures
int loadMemTexture(const wstring& url, const wstring& backup);
int loadMemTexture(const wstring& url, int backup);
MemTexture * addMemTexture(const wstring& url, MemTextureProcessor *processor);
//MemTexture * getMemTexture(const wstring& url, MemTextureProcessor *processor);
void removeMemTexture(const wstring& url);
int loadMemTexture(const std::wstring& url, const std::wstring& backup);
int loadMemTexture(const std::wstring& url, int backup);
MemTexture * addMemTexture(const std::wstring& url, MemTextureProcessor *processor);
//MemTexture * getMemTexture(const std::wstring& url, MemTextureProcessor *processor);
void removeMemTexture(const std::wstring& url);
void tick(bool updateTextures, bool tickDynamics = true); // 4J added updateTextures parameter & tickDynamics
public:
void reloadAll();
void stitch();
Icon *getMissingIcon(int type);
BufferedImage *readImage(TEXTURE_NAME texId, const wstring& name); // Moved this to public for Font.cpp access
BufferedImage *readImage(TEXTURE_NAME texId, const std::wstring& name); // Moved this to public for Font.cpp access
// check list of title update textures to see if we need to use the UPDATE: drive
static bool IsTUImage(TEXTURE_NAME texId, const wstring& name);
static bool IsOriginalImage(TEXTURE_NAME texId, const wstring& name);
static bool IsTUImage(TEXTURE_NAME texId, const std::wstring& name);
static bool IsOriginalImage(TEXTURE_NAME texId, const std::wstring& name);
};