mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-05-25 21:55:51 +00:00
chore: format Minecraft.Client
This commit is contained in:
@@ -3,129 +3,122 @@
|
||||
#include "../Textures.h"
|
||||
#include "../../../Minecraft.World/Util/StringHelpers.h"
|
||||
|
||||
|
||||
DefaultTexturePack::DefaultTexturePack() : AbstractTexturePack(0, NULL, L"Minecraft", NULL)
|
||||
{
|
||||
// 4J Stu - These calls need to be in the most derived version of the class
|
||||
loadIcon();
|
||||
loadName(); // 4J-PB - added so the PS3 can have localised texture names'
|
||||
loadDescription();
|
||||
loadColourTable();
|
||||
DefaultTexturePack::DefaultTexturePack()
|
||||
: AbstractTexturePack(0, NULL, L"Minecraft", NULL) {
|
||||
// 4J Stu - These calls need to be in the most derived version of the class
|
||||
loadIcon();
|
||||
loadName(); // 4J-PB - added so the PS3 can have localised texture names'
|
||||
loadDescription();
|
||||
loadColourTable();
|
||||
}
|
||||
|
||||
void DefaultTexturePack::loadIcon()
|
||||
{
|
||||
void DefaultTexturePack::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 = size;
|
||||
unsigned int size = 0;
|
||||
HRESULT hr = XuiResourceLoadAllNoLoc(szResourceLocator, &m_iconData, &size);
|
||||
m_iconSize = size;
|
||||
#else
|
||||
if(app.hasArchiveFile(L"Graphics\\TexturePackIcon.png"))
|
||||
{
|
||||
byteArray ba = app.getArchiveFile(L"Graphics\\TexturePackIcon.png");
|
||||
m_iconData = ba.data;
|
||||
m_iconSize = static_cast<std::uint32_t>(ba.length);
|
||||
}
|
||||
if (app.hasArchiveFile(L"Graphics\\TexturePackIcon.png")) {
|
||||
byteArray ba = app.getArchiveFile(L"Graphics\\TexturePackIcon.png");
|
||||
m_iconData = ba.data;
|
||||
m_iconSize = static_cast<std::uint32_t>(ba.length);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DefaultTexturePack::loadDescription()
|
||||
{
|
||||
desc1 = L"LOCALISE ME: The default look of Minecraft";
|
||||
void DefaultTexturePack::loadDescription() {
|
||||
desc1 = L"LOCALISE ME: The default look of Minecraft";
|
||||
}
|
||||
void DefaultTexturePack::loadName()
|
||||
{
|
||||
texname = L"Minecraft";
|
||||
void DefaultTexturePack::loadName() { texname = L"Minecraft"; }
|
||||
|
||||
bool DefaultTexturePack::hasFile(const std::wstring& name) {
|
||||
// return DefaultTexturePack::class->getResourceAsStream(name) != null;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DefaultTexturePack::hasFile(const std::wstring &name)
|
||||
{
|
||||
// return DefaultTexturePack::class->getResourceAsStream(name) != null;
|
||||
return true;
|
||||
}
|
||||
bool DefaultTexturePack::isTerrainUpdateCompatible() { return true; }
|
||||
|
||||
bool DefaultTexturePack::isTerrainUpdateCompatible()
|
||||
InputStream* DefaultTexturePack::getResourceImplementation(
|
||||
const std::wstring& name) // throws FileNotFoundException
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
InputStream *DefaultTexturePack::getResourceImplementation(const std::wstring &name)// throws FileNotFoundException
|
||||
{
|
||||
std::wstring wDrive = L"";
|
||||
// Make the content package point to to the UPDATE: drive is needed
|
||||
std::wstring wDrive = L"";
|
||||
// Make the content package point to to the UPDATE: drive is needed
|
||||
#ifdef _XBOX
|
||||
#ifdef _TU_BUILD
|
||||
wDrive=L"UPDATE:\\res";
|
||||
#else
|
||||
|
||||
wDrive=L"GAME:\\res\\TitleUpdate\\res";
|
||||
#endif
|
||||
#ifdef _TU_BUILD
|
||||
wDrive = L"UPDATE:\\res";
|
||||
#else
|
||||
|
||||
wDrive = L"GAME:\\res\\TitleUpdate\\res";
|
||||
#endif
|
||||
#elif __PS3__
|
||||
|
||||
char *pchUsrDir;
|
||||
if(app.GetBootedFromDiscPatch())
|
||||
{
|
||||
const char *pchTextureName=wstringtofilename(name);
|
||||
pchUsrDir = app.GetBDUsrDirPath(pchTextureName);
|
||||
app.DebugPrintf("DefaultTexturePack::getResourceImplementation - texture %s - Drive - %s\n",pchTextureName,pchUsrDir);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *pchTextureName=wstringtofilename(name);
|
||||
pchUsrDir=getUsrDirPath();
|
||||
app.DebugPrintf("DefaultTexturePack::getResourceImplementation - texture %s - Drive - %s\n",pchTextureName,pchUsrDir);
|
||||
}
|
||||
char* pchUsrDir;
|
||||
if (app.GetBootedFromDiscPatch()) {
|
||||
const char* pchTextureName = wstringtofilename(name);
|
||||
pchUsrDir = app.GetBDUsrDirPath(pchTextureName);
|
||||
app.DebugPrintf(
|
||||
"DefaultTexturePack::getResourceImplementation - texture %s - "
|
||||
"Drive - %s\n",
|
||||
pchTextureName, pchUsrDir);
|
||||
} else {
|
||||
const char* pchTextureName = wstringtofilename(name);
|
||||
pchUsrDir = getUsrDirPath();
|
||||
app.DebugPrintf(
|
||||
"DefaultTexturePack::getResourceImplementation - texture %s - "
|
||||
"Drive - %s\n",
|
||||
pchTextureName, pchUsrDir);
|
||||
}
|
||||
|
||||
std::wstring wstr(pchUsrDir, pchUsrDir + strlen(pchUsrDir));
|
||||
|
||||
std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
|
||||
|
||||
wDrive = wstr + L"\\Common\\res\\TitleUpdate\\res";
|
||||
wDrive = wstr + L"\\Common\\res\\TitleUpdate\\res";
|
||||
#elif __PSVITA__
|
||||
|
||||
/*
|
||||
char *pchUsrDir=getUsrDirPath();
|
||||
std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
|
||||
|
||||
wDrive = wstr + L"Common\\res\\TitleUpdate\\res";
|
||||
*/
|
||||
wDrive = L"Common\\res\\TitleUpdate\\res";
|
||||
/*
|
||||
char *pchUsrDir=getUsrDirPath();
|
||||
std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
|
||||
|
||||
wDrive = wstr + L"Common\\res\\TitleUpdate\\res";
|
||||
*/
|
||||
wDrive = L"Common\\res\\TitleUpdate\\res";
|
||||
#else
|
||||
wDrive = L"Common\\res\\TitleUpdate\\res";
|
||||
wDrive = L"Common\\res\\TitleUpdate\\res";
|
||||
|
||||
#endif
|
||||
InputStream *resource = InputStream::getResourceAsStream(wDrive + name);
|
||||
//InputStream *stream = DefaultTexturePack::class->getResourceAsStream(name);
|
||||
//if (stream == NULL)
|
||||
//{
|
||||
// throw new FileNotFoundException(name);
|
||||
//}
|
||||
InputStream* resource = InputStream::getResourceAsStream(wDrive + name);
|
||||
// InputStream *stream =
|
||||
// DefaultTexturePack::class->getResourceAsStream(name); if (stream == NULL)
|
||||
//{
|
||||
// throw new FileNotFoundException(name);
|
||||
// }
|
||||
|
||||
//return stream;
|
||||
return resource;
|
||||
// return stream;
|
||||
return resource;
|
||||
}
|
||||
|
||||
void DefaultTexturePack::loadUI()
|
||||
{
|
||||
loadDefaultUI();
|
||||
void DefaultTexturePack::loadUI() {
|
||||
loadDefaultUI();
|
||||
|
||||
AbstractTexturePack::loadUI();
|
||||
AbstractTexturePack::loadUI();
|
||||
}
|
||||
|
||||
void DefaultTexturePack::unloadUI()
|
||||
{
|
||||
void DefaultTexturePack::unloadUI() {
|
||||
#ifdef _XBOX
|
||||
// Unload skin
|
||||
XuiFreeVisuals(L"TexturePack");
|
||||
XuiFreeVisuals(L"");
|
||||
CXuiSceneBase::GetInstance()->SetVisualPrefix(L"");
|
||||
CXuiSceneBase::GetInstance()->SkinChanged(CXuiSceneBase::GetInstance()->m_hObj);
|
||||
// Unload skin
|
||||
XuiFreeVisuals(L"TexturePack");
|
||||
XuiFreeVisuals(L"");
|
||||
CXuiSceneBase::GetInstance()->SetVisualPrefix(L"");
|
||||
CXuiSceneBase::GetInstance()->SkinChanged(
|
||||
CXuiSceneBase::GetInstance()->m_hObj);
|
||||
#endif
|
||||
AbstractTexturePack::unloadUI();
|
||||
AbstractTexturePack::unloadUI();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user