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

@@ -8,7 +8,7 @@
DLCAudioFile::DLCAudioFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_Audio,path)
{
m_pbData = nullptr;
m_pbData = NULL;
m_dwBytes = 0;
}
@@ -40,7 +40,7 @@ DLCAudioFile::EAudioParameterType DLCAudioFile::getParameterType(const wstring &
{
if(paramName.compare(wchTypeNamesA[i]) == 0)
{
type = static_cast<EAudioParameterType>(i);
type = (EAudioParameterType)i;
break;
}
}
@@ -87,7 +87,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons
{
i++;
}
size_t iLast=creditValue.find_last_of(L" ", i);
int iLast=(int)creditValue.find_last_of(L" ",i);
switch(XGetLanguage())
{
case XC_LANGUAGE_JAPANESE:
@@ -96,7 +96,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons
iLast = maximumChars;
break;
default:
iLast=creditValue.find_last_of(L" ", i);
iLast=(int)creditValue.find_last_of(L" ",i);
break;
}
@@ -133,7 +133,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
if(uiVersion < CURRENT_AUDIO_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;
}
@@ -145,7 +145,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
for(unsigned int i=0;i<uiParameterTypeCount;i++)
{
// Map DLC strings to application strings, then store the DLC index mapping to application index
wstring parameterName(static_cast<WCHAR *>(pParams->wchData));
wstring parameterName((WCHAR *)pParams->wchData);
EAudioParameterType type = getParameterType(parameterName);
if( type != e_AudioParamType_Invalid )
{
@@ -169,7 +169,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
for(unsigned int i=0;i<uiFileCount;i++)
{
EAudioType type = static_cast<EAudioType>(pFile->dwType);
EAudioType type = (EAudioType)pFile->dwType;
// Params
unsigned int uiParameterCount=*(unsigned int *)pbTemp;
pbTemp+=sizeof(int);
@@ -182,7 +182,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
if(it != parameterMapping.end() )
{
addParameter(type,static_cast<EAudioParameterType>(pParams->dwType),(WCHAR *)pParams->wchData);
addParameter(type,(EAudioParameterType)pParams->dwType,(WCHAR *)pParams->wchData);
}
pbTemp+=sizeof(C4JStorage::DLC_FILE_PARAM)+(sizeof(WCHAR)*pParams->dwWchCount);
pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp;
@@ -198,7 +198,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
return true;
}
int DLCAudioFile::GetCountofType(EAudioType eType)
int DLCAudioFile::GetCountofType(DLCAudioFile::EAudioType eType)
{
return m_parameters[eType].size();
}

View File

@@ -32,11 +32,11 @@ public:
DLCAudioFile(const wstring &path);
void addData(PBYTE pbData, DWORD dwBytes) override;
PBYTE getData(DWORD &dwBytes) override;
virtual void addData(PBYTE pbData, DWORD dwBytes);
virtual PBYTE getData(DWORD &dwBytes);
bool processDLCDataFile(PBYTE pbData, DWORD dwLength);
int GetCountofType(EAudioType ptype);
int GetCountofType(DLCAudioFile::EAudioType ptype);
wstring &GetSoundName(int iIndex);
private:
@@ -49,6 +49,6 @@ private:
vector<wstring> m_parameters[e_AudioType_Max];
// use the EAudioType to order these
void addParameter(EAudioType type, EAudioParameterType ptype, const wstring &value);
EAudioParameterType getParameterType(const wstring &paramName);
void addParameter(DLCAudioFile::EAudioType type, DLCAudioFile::EAudioParameterType ptype, const wstring &value);
DLCAudioFile::EAudioParameterType getParameterType(const wstring &paramName);
};

View File

@@ -6,5 +6,5 @@ class DLCCapeFile : public DLCFile
public:
DLCCapeFile(const wstring &path);
void addData(PBYTE pbData, DWORD dwBytes) override;
virtual void addData(PBYTE pbData, DWORD dwBytes);
};

View File

@@ -7,12 +7,12 @@
DLCColourTableFile::DLCColourTableFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_ColourTable,path)
{
m_colourTable = nullptr;
m_colourTable = NULL;
}
DLCColourTableFile::~DLCColourTableFile()
{
if(m_colourTable != nullptr)
if(m_colourTable != NULL)
{
app.DebugPrintf("Deleting DLCColourTableFile data\n");
delete m_colourTable;

View File

@@ -10,9 +10,9 @@ private:
public:
DLCColourTableFile(const wstring &path);
~DLCColourTableFile() override;
~DLCColourTableFile();
void addData(PBYTE pbData, DWORD dwBytes) override;
virtual void addData(PBYTE pbData, DWORD dwBytes);
ColourTable *getColourTable() const { return m_colourTable; }
ColourTable *getColourTable() { return m_colourTable; }
};

View File

@@ -12,12 +12,12 @@ public:
DLCFile(DLCManager::EDLCType type, const wstring &path);
virtual ~DLCFile() {}
DLCManager::EDLCType getType() const { return m_type; }
DLCManager::EDLCType getType() { return m_type; }
wstring getPath() { return m_path; }
DWORD getSkinID() const { return m_dwSkinId; }
DWORD getSkinID() { return m_dwSkinId; }
virtual void addData(PBYTE pbData, DWORD dwBytes) {}
virtual PBYTE getData(DWORD &dwBytes) { dwBytes = 0; return nullptr; }
virtual PBYTE getData(DWORD &dwBytes) { dwBytes = 0; return NULL; }
virtual void addParameter(DLCManager::EDLCParameterType type, const wstring &value) {}
virtual wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; }

View File

@@ -4,7 +4,7 @@
DLCGameRulesFile::DLCGameRulesFile(const wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRules,path)
{
m_pbData = nullptr;
m_pbData = NULL;
m_dwBytes = 0;
}

View File

@@ -10,6 +10,6 @@ private:
public:
DLCGameRulesFile(const wstring &path);
void addData(PBYTE pbData, DWORD dwBytes) override;
PBYTE getData(DWORD &dwBytes) override;
virtual void addData(PBYTE pbData, DWORD dwBytes);
virtual PBYTE getData(DWORD &dwBytes);
};

View File

@@ -11,14 +11,14 @@
DLCGameRulesHeader::DLCGameRulesHeader(const wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRulesHeader,path)
{
m_pbData = nullptr;
m_pbData = NULL;
m_dwBytes = 0;
m_hasData = false;
m_grfPath = path.substr(0, path.length() - 4) + L".grf";
lgo = nullptr;
lgo = NULL;
}
void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes)

View File

@@ -14,52 +14,29 @@ private:
bool m_hasData;
public:
bool requiresTexturePack() override
{return m_bRequiresTexturePack;}
virtual bool requiresTexturePack() {return m_bRequiresTexturePack;}
virtual UINT getRequiredTexturePackId() {return m_requiredTexturePackId;}
virtual wstring getDefaultSaveName() {return m_defaultSaveName;}
virtual LPCWSTR getWorldName() {return m_worldName.c_str();}
virtual LPCWSTR getDisplayName() {return m_displayName.c_str();}
virtual wstring getGrfPath() {return L"GameRules.grf";}
UINT getRequiredTexturePackId() override
{return m_requiredTexturePackId;}
wstring getDefaultSaveName() override
{return m_defaultSaveName;}
LPCWSTR getWorldName() override
{return m_worldName.c_str();}
LPCWSTR getDisplayName() override
{return m_displayName.c_str();}
wstring getGrfPath() override
{return L"GameRules.grf";}
void setRequiresTexturePack(bool x) override
{m_bRequiresTexturePack = x;}
void setRequiredTexturePackId(UINT x) override
{m_requiredTexturePackId = x;}
void setDefaultSaveName(const wstring &x) override
{m_defaultSaveName = x;}
void setWorldName(const wstring & x) override
{m_worldName = x;}
void setDisplayName(const wstring & x) override
{m_displayName = x;}
void setGrfPath(const wstring & x) override
{m_grfPath = x;}
virtual void setRequiresTexturePack(bool x) {m_bRequiresTexturePack = x;}
virtual void setRequiredTexturePackId(UINT x) {m_requiredTexturePackId = x;}
virtual void setDefaultSaveName(const wstring &x) {m_defaultSaveName = x;}
virtual void setWorldName(const wstring & x) {m_worldName = x;}
virtual void setDisplayName(const wstring & x) {m_displayName = x;}
virtual void setGrfPath(const wstring & x) {m_grfPath = x;}
LevelGenerationOptions *lgo;
public:
DLCGameRulesHeader(const wstring &path);
void addData(PBYTE pbData, DWORD dwBytes) override;
PBYTE getData(DWORD &dwBytes) override;
virtual void addData(PBYTE pbData, DWORD dwBytes);
virtual PBYTE getData(DWORD &dwBytes);
void setGrfData(PBYTE fData, DWORD fSize, StringTable *);
bool ready() override
{ return m_hasData; }
virtual bool ready() { return m_hasData; }
};

View File

@@ -5,7 +5,7 @@
DLCLocalisationFile::DLCLocalisationFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_LocalisationData,path)
{
m_strings = nullptr;
m_strings = NULL;
}
void DLCLocalisationFile::addData(PBYTE pbData, DWORD dwBytes)

View File

@@ -12,7 +12,7 @@ public:
DLCLocalisationFile(const wstring &path);
DLCLocalisationFile(PBYTE pbData, DWORD dwBytes); // when we load in a texture pack details file from TMS++
void addData(PBYTE pbData, DWORD dwBytes) override;
virtual void addData(PBYTE pbData, DWORD dwBytes);
StringTable *getStringTable() { return m_strings; }
};

View File

@@ -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 &paramN
{
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();

View File

@@ -24,14 +24,14 @@ DLCPack::DLCPack(const wstring &name,DWORD dwLicenseMask)
m_isCorrupt = false;
m_packId = 0;
m_packVersion = 0;
m_parentPack = nullptr;
m_parentPack = NULL;
m_dlcMountIndex = -1;
#ifdef _XBOX
m_dlcDeviceID = XCONTENTDEVICE_ANY;
#endif
// This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children.
m_data = nullptr;
m_data = NULL;
}
#ifdef _XBOX_ONE
@@ -44,11 +44,11 @@ DLCPack::DLCPack(const wstring &name,const wstring &productID,DWORD dwLicenseMas
m_isCorrupt = false;
m_packId = 0;
m_packVersion = 0;
m_parentPack = nullptr;
m_parentPack = NULL;
m_dlcMountIndex = -1;
// This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children.
m_data = nullptr;
m_data = NULL;
}
#endif
@@ -76,7 +76,7 @@ DLCPack::~DLCPack()
wprintf(L"Deleting data for DLC pack %ls\n", m_packName.c_str());
#endif
// For the same reason, don't delete data pointer for any child pack as it just points to a region within the parent pack that has already been freed
if( m_parentPack == nullptr )
if( m_parentPack == NULL )
{
delete [] m_data;
}
@@ -85,7 +85,7 @@ DLCPack::~DLCPack()
DWORD DLCPack::GetDLCMountIndex()
{
if(m_parentPack != nullptr)
if(m_parentPack != NULL)
{
return m_parentPack->GetDLCMountIndex();
}
@@ -94,7 +94,7 @@ DWORD DLCPack::GetDLCMountIndex()
XCONTENTDEVICEID DLCPack::GetDLCDeviceID()
{
if(m_parentPack != nullptr )
if(m_parentPack != NULL )
{
return m_parentPack->GetDLCDeviceID();
}
@@ -156,7 +156,7 @@ void DLCPack::addParameter(DLCManager::EDLCParameterType type, const wstring &va
m_dataPath = value;
break;
default:
m_parameters[static_cast<int>(type)] = value;
m_parameters[(int)type] = value;
break;
}
}
@@ -187,7 +187,7 @@ bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned in
DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path)
{
DLCFile *newFile = nullptr;
DLCFile *newFile = NULL;
switch(type)
{
@@ -243,7 +243,7 @@ DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path)
break;
};
if( newFile != nullptr )
if( newFile != NULL )
{
m_files[newFile->getType()].push_back(newFile);
}
@@ -252,7 +252,7 @@ DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path)
}
// MGH - added this comp func, as the embedded func in find_if was confusing the PS3 compiler
static const wstring *g_pathCmpString = nullptr;
static const wstring *g_pathCmpString = NULL;
static bool pathCmp(DLCFile *val)
{
return (g_pathCmpString->compare(val->getPath()) == 0);
@@ -263,7 +263,7 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const wstring &path
bool hasFile = false;
if(type == DLCManager::e_DLCType_All)
{
for(DLCManager::EDLCType currentType = static_cast<DLCManager::EDLCType>(0); currentType < DLCManager::e_DLCType_Max; currentType = static_cast<DLCManager::EDLCType>(currentType + 1))
for(DLCManager::EDLCType currentType = (DLCManager::EDLCType)0; currentType < DLCManager::e_DLCType_Max; currentType = (DLCManager::EDLCType)(currentType + 1))
{
hasFile = doesPackContainFile(currentType,path);
if(hasFile) break;
@@ -284,13 +284,13 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const wstring &path
DLCFile *DLCPack::getFile(DLCManager::EDLCType type, DWORD index)
{
DLCFile *file = nullptr;
DLCFile *file = NULL;
if(type == DLCManager::e_DLCType_All)
{
for(DLCManager::EDLCType currentType = static_cast<DLCManager::EDLCType>(0); currentType < DLCManager::e_DLCType_Max; currentType = static_cast<DLCManager::EDLCType>(currentType + 1))
for(DLCManager::EDLCType currentType = (DLCManager::EDLCType)0; currentType < DLCManager::e_DLCType_Max; currentType = (DLCManager::EDLCType)(currentType + 1))
{
file = getFile(currentType,index);
if(file != nullptr) break;
if(file != NULL) break;
}
}
else
@@ -306,13 +306,13 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, DWORD index)
DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path)
{
DLCFile *file = nullptr;
DLCFile *file = NULL;
if(type == DLCManager::e_DLCType_All)
{
for(DLCManager::EDLCType currentType = static_cast<DLCManager::EDLCType>(0); currentType < DLCManager::e_DLCType_Max; currentType = static_cast<DLCManager::EDLCType>(currentType + 1))
for(DLCManager::EDLCType currentType = (DLCManager::EDLCType)0; currentType < DLCManager::e_DLCType_Max; currentType = (DLCManager::EDLCType)(currentType + 1))
{
file = getFile(currentType,path);
if(file != nullptr) break;
if(file != NULL) break;
}
}
else
@@ -323,7 +323,7 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path)
if(it == m_files[type].end())
{
// Not found
file = nullptr;
file = NULL;
}
else
{
@@ -346,11 +346,11 @@ DWORD DLCPack::getDLCItemsCount(DLCManager::EDLCType type /*= DLCManager::e_DLCT
case DLCManager::e_DLCType_All:
for(int i = 0; i < DLCManager::e_DLCType_Max; ++i)
{
count += getDLCItemsCount(static_cast<DLCManager::EDLCType>(i));
count += getDLCItemsCount((DLCManager::EDLCType)i);
}
break;
default:
count = static_cast<DWORD>(m_files[(int)type].size());
count = (DWORD)m_files[(int)type].size();
break;
};
return count;
@@ -420,12 +420,12 @@ void DLCPack::UpdateLanguage()
{
// find the language file
DLCManager::e_DLCType_LocalisationData;
DLCFile *file = nullptr;
DLCFile *file = NULL;
if(m_files[DLCManager::e_DLCType_LocalisationData].size() > 0)
{
file = m_files[DLCManager::e_DLCType_LocalisationData][0];
DLCLocalisationFile *localisationFile = static_cast<DLCLocalisationFile *>(getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc"));
DLCLocalisationFile *localisationFile = (DLCLocalisationFile *)getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc");
StringTable *strTable = localisationFile->getStringTable();
strTable->ReloadStringTable();
}

View File

@@ -87,8 +87,8 @@ public:
DWORD getSkinCount() { return getDLCItemsCount(DLCManager::e_DLCType_Skin); }
DWORD getSkinIndexAt(const wstring &path, bool &found) { return getFileIndexAt(DLCManager::e_DLCType_Skin, path, found); }
DLCSkinFile *getSkinFile(const wstring &path) { return static_cast<DLCSkinFile *>(getFile(DLCManager::e_DLCType_Skin, path)); }
DLCSkinFile *getSkinFile(DWORD index) { return static_cast<DLCSkinFile *>(getFile(DLCManager::e_DLCType_Skin, index)); }
DLCSkinFile *getSkinFile(const wstring &path) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, path); }
DLCSkinFile *getSkinFile(DWORD index) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, index); }
bool doesPackContainSkin(const wstring &path) { return doesPackContainFile(DLCManager::e_DLCType_Skin, path); }
bool hasPurchasedFile(DLCManager::EDLCType type, const wstring &path);

View File

@@ -79,7 +79,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring
{
i++;
}
size_t iLast=creditValue.find_last_of(L" ", i);
int iLast=(int)creditValue.find_last_of(L" ",i);
switch(XGetLanguage())
{
case XC_LANGUAGE_JAPANESE:
@@ -88,7 +88,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring
iLast = maximumChars;
break;
default:
iLast=creditValue.find_last_of(L" ", i);
iLast=(int)creditValue.find_last_of(L" ",i);
break;
}
@@ -178,7 +178,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring
int DLCSkinFile::getAdditionalBoxesCount()
{
return static_cast<int>(m_AdditionalBoxes.size());
return (int)m_AdditionalBoxes.size();
}
vector<SKIN_BOX *> *DLCSkinFile::getAdditionalBoxes()
{

View File

@@ -17,11 +17,11 @@ public:
DLCSkinFile(const wstring &path);
void addData(PBYTE pbData, DWORD dwBytes) override;
void addParameter(DLCManager::EDLCParameterType type, const wstring &value) override;
virtual void addData(PBYTE pbData, DWORD dwBytes);
virtual void addParameter(DLCManager::EDLCParameterType type, const wstring &value);
wstring getParameterAsString(DLCManager::EDLCParameterType type) override;
bool getParameterAsBool(DLCManager::EDLCParameterType type) override;
virtual wstring getParameterAsString(DLCManager::EDLCParameterType type);
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type);
vector<SKIN_BOX *> *getAdditionalBoxes();
int getAdditionalBoxesCount();
unsigned int getAnimOverrideBitmask() { return m_uiAnimOverrideBitmask;}

View File

@@ -7,7 +7,7 @@ DLCTextureFile::DLCTextureFile(const wstring &path) : DLCFile(DLCManager::e_DLCT
m_bIsAnim = false;
m_animString = L"";
m_pbData = nullptr;
m_pbData = NULL;
m_dwBytes = 0;
}

View File

@@ -14,11 +14,11 @@ private:
public:
DLCTextureFile(const wstring &path);
void addData(PBYTE pbData, DWORD dwBytes) override;
PBYTE getData(DWORD &dwBytes) override;
virtual void addData(PBYTE pbData, DWORD dwBytes);
virtual PBYTE getData(DWORD &dwBytes);
void addParameter(DLCManager::EDLCParameterType type, const wstring &value) override;
virtual void addParameter(DLCManager::EDLCParameterType type, const wstring &value);
wstring getParameterAsString(DLCManager::EDLCParameterType type) override;
bool getParameterAsBool(DLCManager::EDLCParameterType type) override;
virtual wstring getParameterAsString(DLCManager::EDLCParameterType type);
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type);
};

View File

@@ -4,14 +4,14 @@
DLCUIDataFile::DLCUIDataFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_UIData,path)
{
m_pbData = nullptr;
m_pbData = NULL;
m_dwBytes = 0;
m_canDeleteData = false;
}
DLCUIDataFile::~DLCUIDataFile()
{
if(m_canDeleteData && m_pbData != nullptr)
if(m_canDeleteData && m_pbData != NULL)
{
app.DebugPrintf("Deleting DLCUIDataFile data\n");
delete [] m_pbData;

View File

@@ -10,11 +10,11 @@ private:
public:
DLCUIDataFile(const wstring &path);
~DLCUIDataFile() override;
~DLCUIDataFile();
using DLCFile::addData;
using DLCFile::addParameter;
virtual void addData(PBYTE pbData, DWORD dwBytes,bool canDeleteData = false);
PBYTE getData(DWORD &dwBytes) override;
virtual PBYTE getData(DWORD &dwBytes);
};