mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-06-06 05:33:29 +02:00
Fix game crashing if DLC has XMLVERSION paramater (#1285)
* Fix game crashing if DLC has XMLVERSION paramater * Better implementation of XMLVersion check * Forgot to add type name to the list * Removed extra newline
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
const WCHAR *DLCManager::wchTypeNamesA[]=
|
const WCHAR *DLCManager::wchTypeNamesA[]=
|
||||||
{
|
{
|
||||||
|
L"XMLVERSION",
|
||||||
L"DISPLAYNAME",
|
L"DISPLAYNAME",
|
||||||
L"THEMENAME",
|
L"THEMENAME",
|
||||||
L"FREE",
|
L"FREE",
|
||||||
@@ -405,6 +406,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
|||||||
unsigned int uiParameterCount=readUInt32(&pbData[uiCurrentByte], bSwapEndian);
|
unsigned int uiParameterCount=readUInt32(&pbData[uiCurrentByte], bSwapEndian);
|
||||||
uiCurrentByte+=sizeof(int);
|
uiCurrentByte+=sizeof(int);
|
||||||
C4JStorage::DLC_FILE_PARAM *pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte];
|
C4JStorage::DLC_FILE_PARAM *pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte];
|
||||||
|
bool bXMLVersion = false;
|
||||||
//DWORD dwwchCount=0;
|
//DWORD dwwchCount=0;
|
||||||
for(unsigned int i=0;i<uiParameterCount;i++)
|
for(unsigned int i=0;i<uiParameterCount;i++)
|
||||||
{
|
{
|
||||||
@@ -421,11 +423,22 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
|||||||
if( type != e_DLCParamType_Invalid )
|
if( type != e_DLCParamType_Invalid )
|
||||||
{
|
{
|
||||||
parameterMapping[pParams->dwType] = type;
|
parameterMapping[pParams->dwType] = type;
|
||||||
|
|
||||||
|
if (type == e_DLCParamType_XMLVersion)
|
||||||
|
{
|
||||||
|
bXMLVersion = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
uiCurrentByte+= sizeof(C4JStorage::DLC_FILE_PARAM)+(pParams->dwWchCount*sizeof(WCHAR));
|
uiCurrentByte+= sizeof(C4JStorage::DLC_FILE_PARAM)+(pParams->dwWchCount*sizeof(WCHAR));
|
||||||
pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte];
|
pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte];
|
||||||
}
|
}
|
||||||
//ulCurrentByte+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM);
|
//ulCurrentByte+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM);
|
||||||
|
|
||||||
|
if (bXMLVersion)
|
||||||
|
{
|
||||||
|
uiCurrentByte += sizeof(int);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int uiFileCount=readUInt32(&pbData[uiCurrentByte], bSwapEndian);
|
unsigned int uiFileCount=readUInt32(&pbData[uiCurrentByte], bSwapEndian);
|
||||||
uiCurrentByte+=sizeof(int);
|
uiCurrentByte+=sizeof(int);
|
||||||
C4JStorage::DLC_FILE_DETAILS *pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte];
|
C4JStorage::DLC_FILE_DETAILS *pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte];
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ public:
|
|||||||
{
|
{
|
||||||
e_DLCParamType_Invalid = -1,
|
e_DLCParamType_Invalid = -1,
|
||||||
|
|
||||||
e_DLCParamType_DisplayName = 0,
|
e_DLCParamType_XMLVersion = 0,
|
||||||
|
e_DLCParamType_DisplayName,
|
||||||
e_DLCParamType_ThemeName,
|
e_DLCParamType_ThemeName,
|
||||||
e_DLCParamType_Free, // identify free skins
|
e_DLCParamType_Free, // identify free skins
|
||||||
e_DLCParamType_Credit, // legal credits for DLC
|
e_DLCParamType_Credit, // legal credits for DLC
|
||||||
|
|||||||
Reference in New Issue
Block a user