mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-05-24 04:16:28 +00:00
chore: format Minecraft.Client
This commit is contained in:
@@ -6,71 +6,73 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
AbstractTexturePack::AbstractTexturePack(std::uint32_t id, File *file, const std::wstring &name, TexturePack *fallback) : id(id), name(name)
|
||||
{
|
||||
// 4J init
|
||||
textureId = -1;
|
||||
m_colourTable = NULL;
|
||||
AbstractTexturePack::AbstractTexturePack(std::uint32_t id, File* file,
|
||||
const std::wstring& name,
|
||||
TexturePack* fallback)
|
||||
: id(id), name(name) {
|
||||
// 4J init
|
||||
textureId = -1;
|
||||
m_colourTable = NULL;
|
||||
|
||||
this->file = file;
|
||||
this->fallback = fallback;
|
||||
|
||||
this->file = file;
|
||||
this->fallback = fallback;
|
||||
m_iconData = NULL;
|
||||
m_iconSize = 0;
|
||||
|
||||
m_iconData = NULL;
|
||||
m_iconSize = 0;
|
||||
m_comparisonData = NULL;
|
||||
m_comparisonSize = 0;
|
||||
|
||||
m_comparisonData = NULL;
|
||||
m_comparisonSize = 0;
|
||||
|
||||
// 4J Stu - These calls need to be in the most derived version of the class
|
||||
//loadIcon();
|
||||
//loadDescription();
|
||||
// 4J Stu - These calls need to be in the most derived version of the class
|
||||
// loadIcon();
|
||||
// loadDescription();
|
||||
}
|
||||
|
||||
std::wstring AbstractTexturePack::trim(std::wstring line)
|
||||
{
|
||||
if (!line.empty() && line.length() > 34)
|
||||
{
|
||||
line = line.substr(0, 34);
|
||||
}
|
||||
return line;
|
||||
std::wstring AbstractTexturePack::trim(std::wstring line) {
|
||||
if (!line.empty() && line.length() > 34) {
|
||||
line = line.substr(0, 34);
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
void AbstractTexturePack::loadIcon()
|
||||
{
|
||||
void AbstractTexturePack::loadIcon() {
|
||||
#ifdef _XBOX
|
||||
// 4J Stu - Temporary only
|
||||
constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
// 4J Stu - Temporary only
|
||||
constexpr int LOCATOR_SIZE =
|
||||
256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[LOCATOR_SIZE];
|
||||
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/TexturePackIcon.png");
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",
|
||||
c_ModuleHandle, L"media", L"media/Graphics/TexturePackIcon.png");
|
||||
|
||||
unsigned int size = 0;
|
||||
HRESULT hr = XuiResourceLoadAllNoLoc(szResourceLocator, &m_iconData, &size);
|
||||
m_iconSize = static_cast<std::uint32_t>(size);
|
||||
unsigned int size = 0;
|
||||
HRESULT hr = XuiResourceLoadAllNoLoc(szResourceLocator, &m_iconData, &size);
|
||||
m_iconSize = static_cast<std::uint32_t>(size);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AbstractTexturePack::loadComparison()
|
||||
{
|
||||
void AbstractTexturePack::loadComparison() {
|
||||
#ifdef _XBOX
|
||||
// 4J Stu - Temporary only
|
||||
constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
// 4J Stu - Temporary only
|
||||
constexpr int LOCATOR_SIZE =
|
||||
256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[LOCATOR_SIZE];
|
||||
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/DefaultPack_Comparison.png");
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",
|
||||
c_ModuleHandle, L"media",
|
||||
L"media/Graphics/DefaultPack_Comparison.png");
|
||||
|
||||
unsigned int size = 0;
|
||||
HRESULT hr = XuiResourceLoadAllNoLoc(szResourceLocator, &m_comparisonData, &size);
|
||||
m_comparisonSize = static_cast<std::uint32_t>(size);
|
||||
unsigned int size = 0;
|
||||
HRESULT hr =
|
||||
XuiResourceLoadAllNoLoc(szResourceLocator, &m_comparisonData, &size);
|
||||
m_comparisonSize = static_cast<std::uint32_t>(size);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AbstractTexturePack::loadDescription()
|
||||
{
|
||||
// 4J Unused currently
|
||||
void AbstractTexturePack::loadDescription() {
|
||||
// 4J Unused currently
|
||||
#if 0
|
||||
InputStream *inputStream = NULL;
|
||||
BufferedReader *br = NULL;
|
||||
@@ -99,311 +101,286 @@ void AbstractTexturePack::loadDescription()
|
||||
#endif
|
||||
}
|
||||
|
||||
void AbstractTexturePack::loadName()
|
||||
{
|
||||
}
|
||||
void AbstractTexturePack::loadName() {}
|
||||
|
||||
InputStream *AbstractTexturePack::getResource(const std::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);
|
||||
if (is == NULL && fallback != NULL && allowFallback)
|
||||
{
|
||||
is = fallback->getResource(name, true);
|
||||
}
|
||||
app.DebugPrintf("texture - %ls\n", name.c_str());
|
||||
InputStream* is = getResourceImplementation(name);
|
||||
if (is == NULL && fallback != NULL && allowFallback) {
|
||||
is = fallback->getResource(name, true);
|
||||
}
|
||||
|
||||
return is;
|
||||
return is;
|
||||
}
|
||||
|
||||
// 4J Currently removed due to override in TexturePack class
|
||||
//InputStream *AbstractTexturePack::getResource(const std::wstring &name) //throws IOException
|
||||
// InputStream *AbstractTexturePack::getResource(const std::wstring &name)
|
||||
// //throws IOException
|
||||
//{
|
||||
// return getResource(name, true);
|
||||
//}
|
||||
|
||||
void AbstractTexturePack::unload(Textures *textures)
|
||||
{
|
||||
if (iconImage != NULL && textureId != -1)
|
||||
{
|
||||
textures->releaseTexture(textureId);
|
||||
}
|
||||
void AbstractTexturePack::unload(Textures* textures) {
|
||||
if (iconImage != NULL && textureId != -1) {
|
||||
textures->releaseTexture(textureId);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractTexturePack::load(Textures *textures)
|
||||
{
|
||||
if (iconImage != NULL)
|
||||
{
|
||||
if (textureId == -1)
|
||||
{
|
||||
textureId = textures->getTexture(iconImage);
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, textureId);
|
||||
textures->clearLastBoundId();
|
||||
}
|
||||
else
|
||||
{
|
||||
// 4J Stu - Don't do this
|
||||
//textures->bindTexture(L"/gui/unknown_pack.png");
|
||||
}
|
||||
void AbstractTexturePack::load(Textures* textures) {
|
||||
if (iconImage != NULL) {
|
||||
if (textureId == -1) {
|
||||
textureId = textures->getTexture(iconImage);
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, textureId);
|
||||
textures->clearLastBoundId();
|
||||
} else {
|
||||
// 4J Stu - Don't do this
|
||||
// textures->bindTexture(L"/gui/unknown_pack.png");
|
||||
}
|
||||
}
|
||||
|
||||
bool AbstractTexturePack::hasFile(const std::wstring &name, bool allowFallback)
|
||||
{
|
||||
bool hasFile = this->hasFile(name);
|
||||
bool AbstractTexturePack::hasFile(const std::wstring& name,
|
||||
bool allowFallback) {
|
||||
bool hasFile = this->hasFile(name);
|
||||
|
||||
return !hasFile && (allowFallback && fallback != NULL) ? fallback->hasFile(name, allowFallback) : hasFile;
|
||||
return !hasFile && (allowFallback && fallback != NULL)
|
||||
? fallback->hasFile(name, allowFallback)
|
||||
: hasFile;
|
||||
}
|
||||
|
||||
std::uint32_t AbstractTexturePack::getId()
|
||||
{
|
||||
return id;
|
||||
std::uint32_t AbstractTexturePack::getId() { return id; }
|
||||
|
||||
std::wstring AbstractTexturePack::getName() { return texname; }
|
||||
|
||||
std::wstring AbstractTexturePack::getWorldName() { return m_wsWorldName; }
|
||||
|
||||
std::wstring AbstractTexturePack::getDesc1() { return desc1; }
|
||||
|
||||
std::wstring AbstractTexturePack::getDesc2() { return desc2; }
|
||||
|
||||
std::wstring AbstractTexturePack::getAnimationString(
|
||||
const std::wstring& textureName, const std::wstring& path,
|
||||
bool allowFallback) {
|
||||
return getAnimationString(textureName, path);
|
||||
}
|
||||
|
||||
std::wstring AbstractTexturePack::getName()
|
||||
{
|
||||
return texname;
|
||||
}
|
||||
std::wstring AbstractTexturePack::getAnimationString(
|
||||
const std::wstring& textureName, const std::wstring& path) {
|
||||
std::wstring animationDefinitionFile = textureName + L".txt";
|
||||
|
||||
std::wstring AbstractTexturePack::getWorldName()
|
||||
{
|
||||
return m_wsWorldName;
|
||||
}
|
||||
bool requiresFallback = !hasFile(L"\\" + textureName + L".png", false);
|
||||
|
||||
std::wstring AbstractTexturePack::getDesc1()
|
||||
{
|
||||
return desc1;
|
||||
}
|
||||
InputStream* fileStream =
|
||||
getResource(L"\\" + path + animationDefinitionFile, requiresFallback);
|
||||
|
||||
std::wstring AbstractTexturePack::getDesc2()
|
||||
{
|
||||
return desc2;
|
||||
}
|
||||
|
||||
std::wstring AbstractTexturePack::getAnimationString(const std::wstring &textureName, const std::wstring &path, bool allowFallback)
|
||||
{
|
||||
return getAnimationString(textureName, path);
|
||||
}
|
||||
|
||||
std::wstring AbstractTexturePack::getAnimationString(const std::wstring &textureName, const std::wstring &path)
|
||||
{
|
||||
std::wstring animationDefinitionFile = textureName + L".txt";
|
||||
|
||||
bool requiresFallback = !hasFile(L"\\" + textureName + L".png", false);
|
||||
|
||||
InputStream *fileStream = getResource(L"\\" + path + animationDefinitionFile, requiresFallback);
|
||||
|
||||
//Minecraft::getInstance()->getLogger().info("Found animation info for: " + animationDefinitionFile);
|
||||
// Minecraft::getInstance()->getLogger().info("Found animation info for: " +
|
||||
// animationDefinitionFile);
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"Found animation info for: %ls\n", animationDefinitionFile.c_str() );
|
||||
wprintf(L"Found animation info for: %ls\n",
|
||||
animationDefinitionFile.c_str());
|
||||
#endif
|
||||
InputStreamReader isr(fileStream);
|
||||
BufferedReader br(&isr);
|
||||
|
||||
std::wstring result = L"";
|
||||
InputStreamReader isr(fileStream);
|
||||
BufferedReader br(&isr);
|
||||
|
||||
std::wstring line = br.readLine();
|
||||
while (!line.empty())
|
||||
{
|
||||
line = trimString(line);
|
||||
if (line.length() > 0)
|
||||
{
|
||||
result.append(L",");
|
||||
result.append(line);
|
||||
}
|
||||
line = br.readLine();
|
||||
}
|
||||
delete fileStream;
|
||||
std::wstring result = L"";
|
||||
|
||||
return result;
|
||||
std::wstring line = br.readLine();
|
||||
while (!line.empty()) {
|
||||
line = trimString(line);
|
||||
if (line.length() > 0) {
|
||||
result.append(L",");
|
||||
result.append(line);
|
||||
}
|
||||
line = br.readLine();
|
||||
}
|
||||
delete fileStream;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
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));
|
||||
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));
|
||||
|
||||
return new BufferedImage(TexturePack::getResource(L"/" + File),filenameHasExtension,bTitleUpdateTexture,drive);
|
||||
return new BufferedImage(TexturePack::getResource(L"/" + File),
|
||||
filenameHasExtension, bTitleUpdateTexture, drive);
|
||||
}
|
||||
|
||||
void AbstractTexturePack::loadDefaultUI()
|
||||
{
|
||||
void AbstractTexturePack::loadDefaultUI() {
|
||||
#ifdef _XBOX
|
||||
// load from the .xzp file
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
// load from the .xzp file
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
|
||||
// Load new skin
|
||||
constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
// Load new skin
|
||||
constexpr int LOCATOR_SIZE =
|
||||
256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[LOCATOR_SIZE];
|
||||
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/skin_Minecraft.xur");
|
||||
|
||||
XuiFreeVisuals(L"");
|
||||
app.LoadSkin(szResourceLocator,NULL);//L"TexturePack");
|
||||
//CXuiSceneBase::GetInstance()->SetVisualPrefix(L"TexturePack");
|
||||
CXuiSceneBase::GetInstance()->SkinChanged(CXuiSceneBase::GetInstance()->m_hObj);
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",
|
||||
c_ModuleHandle, L"media", L"media/skin_Minecraft.xur");
|
||||
|
||||
XuiFreeVisuals(L"");
|
||||
app.LoadSkin(szResourceLocator, NULL); // L"TexturePack");
|
||||
// CXuiSceneBase::GetInstance()->SetVisualPrefix(L"TexturePack");
|
||||
CXuiSceneBase::GetInstance()->SkinChanged(
|
||||
CXuiSceneBase::GetInstance()->m_hObj);
|
||||
#else
|
||||
ui.ReloadSkin();
|
||||
ui.ReloadSkin();
|
||||
#endif
|
||||
}
|
||||
|
||||
void AbstractTexturePack::loadColourTable()
|
||||
{
|
||||
loadDefaultColourTable();
|
||||
loadDefaultHTMLColourTable();
|
||||
void AbstractTexturePack::loadColourTable() {
|
||||
loadDefaultColourTable();
|
||||
loadDefaultHTMLColourTable();
|
||||
}
|
||||
|
||||
void AbstractTexturePack::loadDefaultColourTable()
|
||||
{
|
||||
// Load the file
|
||||
File coloursFile(AbstractTexturePack::getPath(true).append(L"res/colours.col"));
|
||||
void AbstractTexturePack::loadDefaultColourTable() {
|
||||
// Load the file
|
||||
File coloursFile(
|
||||
AbstractTexturePack::getPath(true).append(L"res/colours.col"));
|
||||
|
||||
if(coloursFile.exists())
|
||||
{
|
||||
const __int64 colourTableLength = coloursFile.length();
|
||||
if(colourTableLength < 0 || colourTableLength > static_cast<__int64>(std::numeric_limits<unsigned int>::max()))
|
||||
{
|
||||
app.DebugPrintf("Failed to load the default colours table\n");
|
||||
app.FatalLoadError();
|
||||
return;
|
||||
}
|
||||
if (coloursFile.exists()) {
|
||||
const __int64 colourTableLength = coloursFile.length();
|
||||
if (colourTableLength < 0 ||
|
||||
colourTableLength > static_cast<__int64>(
|
||||
std::numeric_limits<unsigned int>::max())) {
|
||||
app.DebugPrintf("Failed to load the default colours table\n");
|
||||
app.FatalLoadError();
|
||||
return;
|
||||
}
|
||||
|
||||
const unsigned int dataLength = static_cast<unsigned int>(colourTableLength);
|
||||
byteArray data(dataLength);
|
||||
const unsigned int dataLength =
|
||||
static_cast<unsigned int>(colourTableLength);
|
||||
byteArray data(dataLength);
|
||||
|
||||
FileInputStream fis(coloursFile);
|
||||
fis.read(data,0,dataLength);
|
||||
fis.close();
|
||||
if(m_colourTable != NULL) delete m_colourTable;
|
||||
m_colourTable = new ColourTable(data.data, dataLength);
|
||||
FileInputStream fis(coloursFile);
|
||||
fis.read(data, 0, dataLength);
|
||||
fis.close();
|
||||
if (m_colourTable != NULL) delete m_colourTable;
|
||||
m_colourTable = new ColourTable(data.data, dataLength);
|
||||
|
||||
delete [] data.data;
|
||||
}
|
||||
else
|
||||
{
|
||||
app.DebugPrintf("Failed to load the default colours table\n");
|
||||
app.FatalLoadError();
|
||||
}
|
||||
delete[] data.data;
|
||||
} else {
|
||||
app.DebugPrintf("Failed to load the default colours table\n");
|
||||
app.FatalLoadError();
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractTexturePack::loadDefaultHTMLColourTable()
|
||||
{
|
||||
void AbstractTexturePack::loadDefaultHTMLColourTable() {
|
||||
#ifdef _XBOX
|
||||
// load from the .xzp file
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
// load from the .xzp file
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
|
||||
constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
constexpr int LOCATOR_SIZE =
|
||||
256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[LOCATOR_SIZE];
|
||||
|
||||
// Try and load the HTMLColours.col based off the common XML first, before the deprecated xuiscene_colourtable
|
||||
wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/HTMLColours.col");
|
||||
std::uint8_t *data;
|
||||
unsigned int dataLength;
|
||||
if(XuiResourceLoadAll(szResourceLocator, &data, &dataLength) == S_OK)
|
||||
{
|
||||
m_colourTable->loadColoursFromData(data,dataLength);
|
||||
// Try and load the HTMLColours.col based off the common XML first, before
|
||||
// the deprecated xuiscene_colourtable
|
||||
wsprintfW(szResourceLocator, L"section://%X,%s#%s", c_ModuleHandle,
|
||||
L"media", L"media/HTMLColours.col");
|
||||
std::uint8_t* data;
|
||||
unsigned int dataLength;
|
||||
if (XuiResourceLoadAll(szResourceLocator, &data, &dataLength) == S_OK) {
|
||||
m_colourTable->loadColoursFromData(data, dataLength);
|
||||
|
||||
XuiFree(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/");
|
||||
HXUIOBJ hScene;
|
||||
HRESULT hr = XuiSceneCreate(szResourceLocator,L"xuiscene_colourtable.xur", NULL, &hScene);
|
||||
XuiFree(data);
|
||||
} else {
|
||||
wsprintfW(szResourceLocator, L"section://%X,%s#%s", c_ModuleHandle,
|
||||
L"media", L"media/");
|
||||
HXUIOBJ hScene;
|
||||
HRESULT hr = XuiSceneCreate(szResourceLocator,
|
||||
L"xuiscene_colourtable.xur", NULL, &hScene);
|
||||
|
||||
if(HRESULT_SUCCEEDED(hr))
|
||||
{
|
||||
loadHTMLColourTableFromXuiScene(hScene);
|
||||
}
|
||||
}
|
||||
if (HRESULT_SUCCEEDED(hr)) {
|
||||
loadHTMLColourTableFromXuiScene(hScene);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(app.hasArchiveFile(L"HTMLColours.col"))
|
||||
{
|
||||
byteArray textColours = app.getArchiveFile(L"HTMLColours.col");
|
||||
m_colourTable->loadColoursFromData(textColours.data,textColours.length);
|
||||
if (app.hasArchiveFile(L"HTMLColours.col")) {
|
||||
byteArray textColours = app.getArchiveFile(L"HTMLColours.col");
|
||||
m_colourTable->loadColoursFromData(textColours.data,
|
||||
textColours.length);
|
||||
|
||||
delete [] textColours.data;
|
||||
}
|
||||
delete[] textColours.data;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _XBOX
|
||||
void AbstractTexturePack::loadHTMLColourTableFromXuiScene(HXUIOBJ hObj)
|
||||
{
|
||||
HXUIOBJ child;
|
||||
HRESULT hr = XuiElementGetFirstChild(hObj, &child);
|
||||
void AbstractTexturePack::loadHTMLColourTableFromXuiScene(HXUIOBJ hObj) {
|
||||
HXUIOBJ child;
|
||||
HRESULT hr = XuiElementGetFirstChild(hObj, &child);
|
||||
|
||||
while(HRESULT_SUCCEEDED(hr) && child != NULL)
|
||||
{
|
||||
LPCWSTR childName;
|
||||
XuiElementGetId(child,&childName);
|
||||
m_colourTable->setColour(childName,XuiTextElementGetText(child));
|
||||
while (HRESULT_SUCCEEDED(hr) && child != NULL) {
|
||||
LPCWSTR childName;
|
||||
XuiElementGetId(child, &childName);
|
||||
m_colourTable->setColour(childName, XuiTextElementGetText(child));
|
||||
|
||||
//eMinecraftTextColours colourIndex = eTextColor_NONE;
|
||||
//for(int i = 0; i < (int)eTextColor_MAX; i++)
|
||||
//{
|
||||
// if(wcscmp(HTMLColourTableElements[i],childName)==0)
|
||||
// {
|
||||
// colourIndex = (eMinecraftTextColours)i;
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
// eMinecraftTextColours colourIndex = eTextColor_NONE;
|
||||
// for(int i = 0; i < (int)eTextColor_MAX; i++)
|
||||
//{
|
||||
// if(wcscmp(HTMLColourTableElements[i],childName)==0)
|
||||
// {
|
||||
// colourIndex = (eMinecraftTextColours)i;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
//LPCWSTR stringValue = XuiTextElementGetText(child);
|
||||
// LPCWSTR stringValue = XuiTextElementGetText(child);
|
||||
|
||||
//m_htmlColourTable[colourIndex] = XuiTextElementGetText(child);
|
||||
// m_htmlColourTable[colourIndex] = XuiTextElementGetText(child);
|
||||
|
||||
hr = XuiElementGetNext(child, &child);
|
||||
}
|
||||
hr = XuiElementGetNext(child, &child);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void AbstractTexturePack::loadUI()
|
||||
{
|
||||
loadColourTable();
|
||||
|
||||
void AbstractTexturePack::loadUI() {
|
||||
loadColourTable();
|
||||
|
||||
#ifdef _XBOX
|
||||
CXuiSceneBase::GetInstance()->SkinChanged(CXuiSceneBase::GetInstance()->m_hObj);
|
||||
CXuiSceneBase::GetInstance()->SkinChanged(
|
||||
CXuiSceneBase::GetInstance()->m_hObj);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AbstractTexturePack::unloadUI()
|
||||
{
|
||||
// Do nothing
|
||||
void AbstractTexturePack::unloadUI() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
std::wstring AbstractTexturePack::getXuiRootPath()
|
||||
{
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
std::wstring AbstractTexturePack::getXuiRootPath() {
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
|
||||
// Load new skin
|
||||
constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
// Load new skin
|
||||
constexpr int LOCATOR_SIZE =
|
||||
256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[LOCATOR_SIZE];
|
||||
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/");
|
||||
return szResourceLocator;
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",
|
||||
c_ModuleHandle, L"media", L"media/");
|
||||
return szResourceLocator;
|
||||
}
|
||||
|
||||
std::uint8_t *AbstractTexturePack::getPackIcon(std::uint32_t &imageBytes)
|
||||
{
|
||||
if(m_iconSize == 0 || m_iconData == NULL) loadIcon();
|
||||
imageBytes = m_iconSize;
|
||||
return m_iconData;
|
||||
std::uint8_t* AbstractTexturePack::getPackIcon(std::uint32_t& imageBytes) {
|
||||
if (m_iconSize == 0 || m_iconData == NULL) loadIcon();
|
||||
imageBytes = m_iconSize;
|
||||
return m_iconData;
|
||||
}
|
||||
|
||||
std::uint8_t *AbstractTexturePack::getPackComparison(std::uint32_t &imageBytes)
|
||||
{
|
||||
if(m_comparisonSize == 0 || m_comparisonData == NULL) loadComparison();
|
||||
std::uint8_t* AbstractTexturePack::getPackComparison(
|
||||
std::uint32_t& imageBytes) {
|
||||
if (m_comparisonSize == 0 || m_comparisonData == NULL) loadComparison();
|
||||
|
||||
imageBytes = m_comparisonSize;
|
||||
return m_comparisonData;
|
||||
imageBytes = m_comparisonSize;
|
||||
return m_comparisonData;
|
||||
}
|
||||
|
||||
unsigned int AbstractTexturePack::getDLCParentPackId()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
unsigned int AbstractTexturePack::getDLCParentPackId() { return 0; }
|
||||
|
||||
unsigned char AbstractTexturePack::getDLCSubPackId()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
unsigned char AbstractTexturePack::getDLCSubPackId() { return 0; }
|
||||
|
||||
Reference in New Issue
Block a user