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:
@@ -6,7 +6,6 @@
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\TexturePackRepository.h"
|
||||
#include "Common/UI/UI.h"
|
||||
|
||||
const WCHAR *DLCManager::wchTypeNamesA[]=
|
||||
{
|
||||
@@ -48,7 +47,7 @@ DLCManager::EDLCParameterType DLCManager::getParameterType(const wstring ¶mN
|
||||
{
|
||||
if(paramName.compare(wchTypeNamesA[i]) == 0)
|
||||
{
|
||||
type = static_cast<EDLCParameterType>(i);
|
||||
type = (EDLCParameterType)i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -71,7 +70,7 @@ DWORD DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/)
|
||||
}
|
||||
else
|
||||
{
|
||||
packCount = static_cast<DWORD>(m_packs.size());
|
||||
packCount = (DWORD)m_packs.size();
|
||||
}
|
||||
return packCount;
|
||||
}
|
||||
@@ -83,7 +82,7 @@ void DLCManager::addPack(DLCPack *pack)
|
||||
|
||||
void DLCManager::removePack(DLCPack *pack)
|
||||
{
|
||||
if(pack != nullptr)
|
||||
if(pack != NULL)
|
||||
{
|
||||
auto it = find(m_packs.begin(), m_packs.end(), pack);
|
||||
if(it != m_packs.end() ) m_packs.erase(it);
|
||||
@@ -113,7 +112,7 @@ void DLCManager::LanguageChanged(void)
|
||||
|
||||
DLCPack *DLCManager::getPack(const wstring &name)
|
||||
{
|
||||
DLCPack *pack = nullptr;
|
||||
DLCPack *pack = NULL;
|
||||
//DWORD currentIndex = 0;
|
||||
for( DLCPack * currentPack : m_packs )
|
||||
{
|
||||
@@ -131,7 +130,7 @@ DLCPack *DLCManager::getPack(const wstring &name)
|
||||
#ifdef _XBOX_ONE
|
||||
DLCPack *DLCManager::getPackFromProductID(const wstring &productID)
|
||||
{
|
||||
DLCPack *pack = nullptr;
|
||||
DLCPack *pack = NULL;
|
||||
for( DLCPack *currentPack : m_packs )
|
||||
{
|
||||
wstring wsName=currentPack->getPurchaseOfferId();
|
||||
@@ -148,7 +147,7 @@ DLCPack *DLCManager::getPackFromProductID(const wstring &productID)
|
||||
|
||||
DLCPack *DLCManager::getPack(DWORD index, EDLCType type /*= e_DLCType_All*/)
|
||||
{
|
||||
DLCPack *pack = nullptr;
|
||||
DLCPack *pack = NULL;
|
||||
if( type != e_DLCType_All )
|
||||
{
|
||||
DWORD currentIndex = 0;
|
||||
@@ -182,9 +181,9 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D
|
||||
{
|
||||
DWORD foundIndex = 0;
|
||||
found = false;
|
||||
if(pack == nullptr)
|
||||
if(pack == NULL)
|
||||
{
|
||||
app.DebugPrintf("DLCManager: Attempting to find the index for a nullptr pack\n");
|
||||
app.DebugPrintf("DLCManager: Attempting to find the index for a NULL pack\n");
|
||||
//__debugbreak();
|
||||
return foundIndex;
|
||||
}
|
||||
@@ -245,7 +244,7 @@ DWORD DLCManager::getPackIndexContainingSkin(const wstring &path, bool &found)
|
||||
|
||||
DLCPack *DLCManager::getPackContainingSkin(const wstring &path)
|
||||
{
|
||||
DLCPack *foundPack = nullptr;
|
||||
DLCPack *foundPack = NULL;
|
||||
for( DLCPack *pack : m_packs )
|
||||
{
|
||||
if(pack->getDLCItemsCount(e_DLCType_Skin)>0)
|
||||
@@ -262,11 +261,11 @@ DLCPack *DLCManager::getPackContainingSkin(const wstring &path)
|
||||
|
||||
DLCSkinFile *DLCManager::getSkinFile(const wstring &path)
|
||||
{
|
||||
DLCSkinFile *foundSkinfile = nullptr;
|
||||
DLCSkinFile *foundSkinfile = NULL;
|
||||
for( DLCPack *pack : m_packs )
|
||||
{
|
||||
foundSkinfile=pack->getSkinFile(path);
|
||||
if(foundSkinfile!=nullptr)
|
||||
if(foundSkinfile!=NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -277,14 +276,14 @@ DLCSkinFile *DLCManager::getSkinFile(const wstring &path)
|
||||
DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
|
||||
{
|
||||
DWORD corruptDLCCount = m_dwUnnamedCorruptDLCCount;
|
||||
DLCPack *firstCorruptPack = nullptr;
|
||||
DLCPack *firstCorruptPack = NULL;
|
||||
|
||||
for( DLCPack *pack : m_packs )
|
||||
{
|
||||
if( pack->IsCorrupt() )
|
||||
{
|
||||
++corruptDLCCount;
|
||||
if(firstCorruptPack == nullptr) firstCorruptPack = pack;
|
||||
if(firstCorruptPack == NULL) firstCorruptPack = pack;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,13 +291,13 @@ DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
if(corruptDLCCount == 1 && firstCorruptPack != nullptr)
|
||||
if(corruptDLCCount == 1 && firstCorruptPack != NULL)
|
||||
{
|
||||
// pass in the pack format string
|
||||
WCHAR wchFormat[132];
|
||||
swprintf(wchFormat, 132, L"%ls\n\n%%ls", firstCorruptPack->getName().c_str());
|
||||
|
||||
C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr,wchFormat);
|
||||
C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL,wchFormat);
|
||||
|
||||
}
|
||||
else
|
||||
@@ -331,13 +330,13 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL
|
||||
#ifdef _WINDOWS64
|
||||
string finalPath = StorageManager.GetMountedPath(path.c_str());
|
||||
if(finalPath.size() == 0) finalPath = path;
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#elif defined(_DURANGO)
|
||||
wstring finalPath = StorageManager.GetMountedPath(wPath.c_str());
|
||||
if(finalPath.size() == 0) finalPath = wPath;
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#else
|
||||
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#endif
|
||||
if( file == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
@@ -348,9 +347,9 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr);
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(file,NULL);
|
||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||
BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr);
|
||||
BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL);
|
||||
if(bSuccess==FALSE)
|
||||
{
|
||||
// need to treat the file as corrupt, and flag it, so can't call fatal error
|
||||
@@ -373,7 +372,7 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL
|
||||
|
||||
bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
||||
{
|
||||
unordered_map<int, EDLCParameterType> parameterMapping;
|
||||
unordered_map<int, DLCManager::EDLCParameterType> parameterMapping;
|
||||
unsigned int uiCurrentByte=0;
|
||||
|
||||
// File format defined in the DLC_Creator
|
||||
@@ -392,7 +391,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||
|
||||
if(uiVersion < CURRENT_DLC_VERSION_NUM)
|
||||
{
|
||||
if(pbData!=nullptr) delete [] pbData;
|
||||
if(pbData!=NULL) delete [] pbData;
|
||||
app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion);
|
||||
return false;
|
||||
}
|
||||
@@ -404,9 +403,9 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||
for(unsigned int i=0;i<uiParameterCount;i++)
|
||||
{
|
||||
// Map DLC strings to application strings, then store the DLC index mapping to application index
|
||||
wstring parameterName(static_cast<WCHAR *>(pParams->wchData));
|
||||
EDLCParameterType type = getParameterType(parameterName);
|
||||
if( type != e_DLCParamType_Invalid )
|
||||
wstring parameterName((WCHAR *)pParams->wchData);
|
||||
DLCManager::EDLCParameterType type = DLCManager::getParameterType(parameterName);
|
||||
if( type != DLCManager::e_DLCParamType_Invalid )
|
||||
{
|
||||
parameterMapping[pParams->dwType] = type;
|
||||
}
|
||||
@@ -430,10 +429,10 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||
|
||||
for(unsigned int i=0;i<uiFileCount;i++)
|
||||
{
|
||||
EDLCType type = static_cast<EDLCType>(pFile->dwType);
|
||||
DLCManager::EDLCType type = (DLCManager::EDLCType)pFile->dwType;
|
||||
|
||||
DLCFile *dlcFile = nullptr;
|
||||
DLCPack *dlcTexturePack = nullptr;
|
||||
DLCFile *dlcFile = NULL;
|
||||
DLCPack *dlcTexturePack = NULL;
|
||||
|
||||
if(type == e_DLCType_TexturePack)
|
||||
{
|
||||
@@ -462,8 +461,8 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||
}
|
||||
else
|
||||
{
|
||||
if(dlcFile != nullptr) dlcFile->addParameter(it->second,(WCHAR *)pParams->wchData);
|
||||
else if(dlcTexturePack != nullptr) dlcTexturePack->addParameter(it->second, (WCHAR *)pParams->wchData);
|
||||
if(dlcFile != NULL) dlcFile->addParameter(it->second,(WCHAR *)pParams->wchData);
|
||||
else if(dlcTexturePack != NULL) dlcTexturePack->addParameter(it->second, (WCHAR *)pParams->wchData);
|
||||
}
|
||||
}
|
||||
pbTemp+=sizeof(C4JStorage::DLC_FILE_PARAM)+(sizeof(WCHAR)*pParams->dwWchCount);
|
||||
@@ -471,28 +470,28 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||
}
|
||||
//pbTemp+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM);
|
||||
|
||||
if(dlcTexturePack != nullptr)
|
||||
if(dlcTexturePack != NULL)
|
||||
{
|
||||
DWORD texturePackFilesProcessed = 0;
|
||||
bool validPack = processDLCDataFile(texturePackFilesProcessed,pbTemp,pFile->uiFileSize,dlcTexturePack);
|
||||
pack->SetDataPointer(nullptr); // If it's a child pack, it doesn't own the data
|
||||
pack->SetDataPointer(NULL); // If it's a child pack, it doesn't own the data
|
||||
if(!validPack || texturePackFilesProcessed == 0)
|
||||
{
|
||||
delete dlcTexturePack;
|
||||
dlcTexturePack = nullptr;
|
||||
dlcTexturePack = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
pack->addChildPack(dlcTexturePack);
|
||||
|
||||
if(dlcTexturePack->getDLCItemsCount(e_DLCType_Texture) > 0)
|
||||
if(dlcTexturePack->getDLCItemsCount(DLCManager::e_DLCType_Texture) > 0)
|
||||
{
|
||||
Minecraft::GetInstance()->skins->addTexturePackFromDLC(dlcTexturePack, dlcTexturePack->GetPackId() );
|
||||
}
|
||||
}
|
||||
++dwFilesProcessed;
|
||||
}
|
||||
else if(dlcFile != nullptr)
|
||||
else if(dlcFile != NULL)
|
||||
{
|
||||
// Data
|
||||
dlcFile->addData(pbTemp,pFile->uiFileSize);
|
||||
@@ -500,7 +499,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||
// TODO - 4J Stu Remove the need for this vSkinNames vector, or manage it differently
|
||||
switch(pFile->dwType)
|
||||
{
|
||||
case e_DLCType_Skin:
|
||||
case DLCManager::e_DLCType_Skin:
|
||||
app.vSkinNames.push_back((WCHAR *)pFile->wchFile);
|
||||
break;
|
||||
}
|
||||
@@ -515,13 +514,13 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||
pFile=(C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte];
|
||||
}
|
||||
|
||||
if( pack->getDLCItemsCount(e_DLCType_GameRules) > 0
|
||||
|| pack->getDLCItemsCount(e_DLCType_GameRulesHeader) > 0)
|
||||
if( pack->getDLCItemsCount(DLCManager::e_DLCType_GameRules) > 0
|
||||
|| pack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader) > 0)
|
||||
{
|
||||
app.m_gameRules.loadGameRules(pack);
|
||||
}
|
||||
|
||||
if(pack->getDLCItemsCount(e_DLCType_Audio) > 0)
|
||||
if(pack->getDLCItemsCount(DLCManager::e_DLCType_Audio) > 0)
|
||||
{
|
||||
//app.m_Audio.loadAudioDetails(pack);
|
||||
}
|
||||
@@ -538,22 +537,22 @@ DWORD DLCManager::retrievePackIDFromDLCDataFile(const string &path, DLCPack *pac
|
||||
#ifdef _WINDOWS64
|
||||
string finalPath = StorageManager.GetMountedPath(path.c_str());
|
||||
if(finalPath.size() == 0) finalPath = path;
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#elif defined(_DURANGO)
|
||||
wstring finalPath = StorageManager.GetMountedPath(wPath.c_str());
|
||||
if(finalPath.size() == 0) finalPath = wPath;
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#else
|
||||
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#endif
|
||||
if( file == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr);
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(file,NULL);
|
||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||
BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr);
|
||||
BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL);
|
||||
if(bSuccess==FALSE)
|
||||
{
|
||||
// need to treat the file as corrupt, and flag it, so can't call fatal error
|
||||
@@ -580,7 +579,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
||||
{
|
||||
DWORD packId=0;
|
||||
bool bPackIDSet=false;
|
||||
unordered_map<int, EDLCParameterType> parameterMapping;
|
||||
unordered_map<int, DLCManager::EDLCParameterType> parameterMapping;
|
||||
unsigned int uiCurrentByte=0;
|
||||
|
||||
// File format defined in the DLC_Creator
|
||||
@@ -609,9 +608,9 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
||||
for(unsigned int i=0;i<uiParameterCount;i++)
|
||||
{
|
||||
// Map DLC strings to application strings, then store the DLC index mapping to application index
|
||||
wstring parameterName(static_cast<WCHAR *>(pParams->wchData));
|
||||
EDLCParameterType type = getParameterType(parameterName);
|
||||
if( type != e_DLCParamType_Invalid )
|
||||
wstring parameterName((WCHAR *)pParams->wchData);
|
||||
DLCManager::EDLCParameterType type = DLCManager::getParameterType(parameterName);
|
||||
if( type != DLCManager::e_DLCParamType_Invalid )
|
||||
{
|
||||
parameterMapping[pParams->dwType] = type;
|
||||
}
|
||||
@@ -634,7 +633,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
||||
|
||||
for(unsigned int i=0;i<uiFileCount;i++)
|
||||
{
|
||||
EDLCType type = static_cast<EDLCType>(pFile->dwType);
|
||||
DLCManager::EDLCType type = (DLCManager::EDLCType)pFile->dwType;
|
||||
|
||||
// Params
|
||||
uiParameterCount=*(unsigned int *)pbTemp;
|
||||
@@ -650,7 +649,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
||||
{
|
||||
if(it->second==e_DLCParamType_PackId)
|
||||
{
|
||||
wstring wsTemp=static_cast<WCHAR *>(pParams->wchData);
|
||||
wstring wsTemp=(WCHAR *)pParams->wchData;
|
||||
std::wstringstream ss;
|
||||
// 4J Stu - numbered using decimal to make it easier for artists/people to number manually
|
||||
ss << std::dec << wsTemp.c_str();
|
||||
|
||||
Reference in New Issue
Block a user