Revert "Project modernization (#630)"

This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.

This reverts commit a9be52c41a.
This commit is contained in:
Loki Rautio
2026-03-07 21:12:22 -06:00
parent a9be52c41a
commit 087b7e7abf
1373 changed files with 19449 additions and 19903 deletions

View File

@@ -3,22 +3,21 @@
#include "AbstractTexturePack.h"
#include "..\Minecraft.World\InputOutputStream.h"
#include "..\Minecraft.World\StringHelpers.h"
#include "Common/UI/UI.h"
AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const wstring &name, TexturePack *fallback) : id(id), name(name)
{
// 4J init
textureId = -1;
m_colourTable = nullptr;
m_colourTable = NULL;
this->file = file;
this->fallback = fallback;
m_iconData = nullptr;
m_iconData = NULL;
m_iconSize = 0;
m_comparisonData = nullptr;
m_comparisonData = NULL;
m_comparisonSize = 0;
// 4J Stu - These calls need to be in the most derived version of the class
@@ -42,7 +41,7 @@ void AbstractTexturePack::loadIcon()
const DWORD 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(nullptr);
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");
UINT size = 0;
@@ -58,7 +57,7 @@ void AbstractTexturePack::loadComparison()
const DWORD 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(nullptr);
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");
UINT size = 0;
@@ -71,8 +70,8 @@ void AbstractTexturePack::loadDescription()
{
// 4J Unused currently
#if 0
InputStream *inputStream = nullptr;
BufferedReader *br = nullptr;
InputStream *inputStream = NULL;
BufferedReader *br = NULL;
//try {
inputStream = getResourceImplementation(L"/pack.txt");
br = new BufferedReader(new InputStreamReader(inputStream));
@@ -82,12 +81,12 @@ void AbstractTexturePack::loadDescription()
//} finally {
// TODO [EB]: use IOUtils.closeSilently()
// try {
if (br != nullptr)
if (br != NULL)
{
br->close();
delete br;
}
if (inputStream != nullptr)
if (inputStream != NULL)
{
inputStream->close();
delete inputStream;
@@ -106,7 +105,7 @@ InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFal
{
app.DebugPrintf("texture - %ls\n",name.c_str());
InputStream *is = getResourceImplementation(name);
if (is == nullptr && fallback != nullptr && allowFallback)
if (is == NULL && fallback != NULL && allowFallback)
{
is = fallback->getResource(name, true);
}
@@ -122,7 +121,7 @@ InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFal
void AbstractTexturePack::unload(Textures *textures)
{
if (iconImage != nullptr && textureId != -1)
if (iconImage != NULL && textureId != -1)
{
textures->releaseTexture(textureId);
}
@@ -130,7 +129,7 @@ void AbstractTexturePack::unload(Textures *textures)
void AbstractTexturePack::load(Textures *textures)
{
if (iconImage != nullptr)
if (iconImage != NULL)
{
if (textureId == -1)
{
@@ -150,7 +149,7 @@ bool AbstractTexturePack::hasFile(const wstring &name, bool allowFallback)
{
bool hasFile = this->hasFile(name);
return !hasFile && (allowFallback && fallback != nullptr) ? fallback->hasFile(name, allowFallback) : hasFile;
return !hasFile && (allowFallback && fallback != NULL) ? fallback->hasFile(name, allowFallback) : hasFile;
}
DWORD AbstractTexturePack::getId()
@@ -232,7 +231,7 @@ void AbstractTexturePack::loadDefaultUI()
{
#ifdef _XBOX
// load from the .xzp file
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
// Load new skin
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
@@ -241,7 +240,7 @@ void AbstractTexturePack::loadDefaultUI()
swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/skin_Minecraft.xur");
XuiFreeVisuals(L"");
app.LoadSkin(szResourceLocator,nullptr);//L"TexturePack");
app.LoadSkin(szResourceLocator,NULL);//L"TexturePack");
//CXuiSceneBase::GetInstance()->SetVisualPrefix(L"TexturePack");
CXuiSceneBase::GetInstance()->SkinChanged(CXuiSceneBase::GetInstance()->m_hObj);
#else
@@ -260,7 +259,7 @@ void AbstractTexturePack::loadDefaultColourTable()
// Load the file
#ifdef __PS3__
// need to check if it's a BD build, so pass in the name
File coloursFile(AbstractTexturePack::getPath(true,app.GetBootedFromDiscPatch()?"colours.col":nullptr).append(L"res/colours.col"));
File coloursFile(AbstractTexturePack::getPath(true,app.GetBootedFromDiscPatch()?"colours.col":NULL).append(L"res/colours.col"));
#else
File coloursFile(AbstractTexturePack::getPath(true).append(L"res/colours.col"));
@@ -270,12 +269,12 @@ void AbstractTexturePack::loadDefaultColourTable()
if(coloursFile.exists())
{
DWORD dwLength = coloursFile.length();
byteArray data(static_cast<unsigned int>(dwLength));
byteArray data(dwLength);
FileInputStream fis(coloursFile);
fis.read(data,0,dwLength);
fis.close();
if(m_colourTable != nullptr) delete m_colourTable;
if(m_colourTable != NULL) delete m_colourTable;
m_colourTable = new ColourTable(data.data, dwLength);
delete [] data.data;
@@ -291,7 +290,7 @@ void AbstractTexturePack::loadDefaultHTMLColourTable()
{
#ifdef _XBOX
// load from the .xzp file
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
WCHAR szResourceLocator[ LOCATOR_SIZE ];
@@ -310,7 +309,7 @@ void AbstractTexturePack::loadDefaultHTMLColourTable()
{
wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/");
HXUIOBJ hScene;
HRESULT hr = XuiSceneCreate(szResourceLocator,L"xuiscene_colourtable.xur", nullptr, &hScene);
HRESULT hr = XuiSceneCreate(szResourceLocator,L"xuiscene_colourtable.xur", NULL, &hScene);
if(HRESULT_SUCCEEDED(hr))
{
@@ -334,7 +333,7 @@ void AbstractTexturePack::loadHTMLColourTableFromXuiScene(HXUIOBJ hObj)
HXUIOBJ child;
HRESULT hr = XuiElementGetFirstChild(hObj, &child);
while(HRESULT_SUCCEEDED(hr) && child != nullptr)
while(HRESULT_SUCCEEDED(hr) && child != NULL)
{
LPCWSTR childName;
XuiElementGetId(child,&childName);
@@ -375,7 +374,7 @@ void AbstractTexturePack::unloadUI()
wstring AbstractTexturePack::getXuiRootPath()
{
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
// Load new skin
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
@@ -387,14 +386,14 @@ wstring AbstractTexturePack::getXuiRootPath()
PBYTE AbstractTexturePack::getPackIcon(DWORD &dwImageBytes)
{
if(m_iconSize == 0 || m_iconData == nullptr) loadIcon();
if(m_iconSize == 0 || m_iconData == NULL) loadIcon();
dwImageBytes = m_iconSize;
return m_iconData;
}
PBYTE AbstractTexturePack::getPackComparison(DWORD &dwImageBytes)
{
if(m_comparisonSize == 0 || m_comparisonData == nullptr) loadComparison();
if(m_comparisonSize == 0 || m_comparisonData == NULL) loadComparison();
dwImageBytes = m_comparisonSize;
return m_comparisonData;