mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-06-07 20:53:11 +00:00
Use standard buffer types for TPD extraction
This commit is contained in:
parent
5f991ccd6a
commit
eb52911d25
|
|
@ -844,7 +844,7 @@ public:
|
|||
std::uint32_t GetRequiredTexturePackID() { return m_dwRequiredTexturePackID; }
|
||||
void SetRequiredTexturePackID(std::uint32_t texturePackId) { m_dwRequiredTexturePackID = texturePackId; }
|
||||
|
||||
virtual void GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD dwBytes,PBYTE *ppbData,DWORD *pdwBytes ) {*ppbData = NULL; *pdwBytes = 0;}
|
||||
virtual void GetFileFromTPD(eTPDFileType eType, std::uint8_t *pbData, unsigned int dwBytes, std::uint8_t **ppbData, unsigned int *pdwBytes ) {*ppbData = NULL; *pdwBytes = 0;}
|
||||
|
||||
//XTITLE_DEPLOYMENT_TYPE getDeploymentType() { return m_titleDeploymentType; }
|
||||
|
||||
|
|
|
|||
|
|
@ -141,9 +141,9 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index)
|
|||
// this is probably a texture pack icon added from TMS
|
||||
|
||||
unsigned int dwBytes=0;
|
||||
DWORD dwFileBytes=0;
|
||||
unsigned int dwFileBytes=0;
|
||||
std::uint8_t *pbData=NULL;
|
||||
PBYTE pbFileData=NULL;
|
||||
std::uint8_t *pbFileData=NULL;
|
||||
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO ListItem;
|
||||
// get the current index of the list, and then get the data
|
||||
|
|
@ -160,13 +160,13 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index)
|
|||
}
|
||||
|
||||
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbFileData,&dwFileBytes );
|
||||
if(dwFileBytes >= 0 && pbFileData)
|
||||
if(dwFileBytes > 0 && pbFileData)
|
||||
{
|
||||
XuiCreateTextureBrushFromMemory(pbFileData,dwFileBytes,&m_hTexturePackIconBrush);
|
||||
m_texturePackIcon->UseBrush(m_hTexturePackIconBrush);
|
||||
}
|
||||
app.GetFileFromTPD(eTPDFileType_Comparison,pbData,dwBytes,&pbFileData,&dwFileBytes );
|
||||
if(dwFileBytes >= 0 && pbFileData)
|
||||
if(dwFileBytes > 0 && pbFileData)
|
||||
{
|
||||
XuiCreateTextureBrushFromMemory(pbFileData,dwFileBytes,&m_hTexturePackComparisonBrush);
|
||||
m_texturePackComparison->UseBrush(m_hTexturePackComparisonBrush);
|
||||
|
|
|
|||
|
|
@ -717,8 +717,8 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id)
|
|||
ZeroMemory(&ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO));
|
||||
if(dwBytes > 0 && pbData)
|
||||
{
|
||||
DWORD dwImageBytes=0;
|
||||
PBYTE pbImageData=NULL;
|
||||
unsigned int dwImageBytes=0;
|
||||
std::uint8_t *pbImageData=NULL;
|
||||
|
||||
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes );
|
||||
ListInfo.fEnabled = TRUE;
|
||||
|
|
|
|||
|
|
@ -1701,7 +1701,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList()
|
|||
app.GetTPD(sessionInfo->data.texturePackParentId,&pbData,&dwBytes);
|
||||
|
||||
// is it in the tpd data ?
|
||||
DWORD tpdImageBytes = 0;
|
||||
unsigned int tpdImageBytes = 0;
|
||||
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&imageData,&tpdImageBytes );
|
||||
imageBytes = static_cast<std::uint32_t>(tpdImageBytes);
|
||||
if(imageBytes > 0 && imageData)
|
||||
|
|
|
|||
|
|
@ -790,8 +790,8 @@ HRESULT CScene_LoadGameSettings::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandle
|
|||
ZeroMemory(&ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO));
|
||||
if(dwBytes > 0 && pbData)
|
||||
{
|
||||
DWORD dwImageBytes=0;
|
||||
PBYTE pbImageData=NULL;
|
||||
unsigned int dwImageBytes=0;
|
||||
std::uint8_t *pbImageData=NULL;
|
||||
|
||||
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes );
|
||||
ListInfo.fEnabled = TRUE;
|
||||
|
|
@ -1242,9 +1242,9 @@ void CScene_LoadGameSettings::UpdateTexturePackDescription(int index)
|
|||
{
|
||||
// this is probably a texture pack icon added from TMS
|
||||
unsigned int dwBytes=0;
|
||||
DWORD dwFileBytes=0;
|
||||
unsigned int dwFileBytes=0;
|
||||
std::uint8_t *pbData=NULL;
|
||||
PBYTE pbFileData=NULL;
|
||||
std::uint8_t *pbFileData=NULL;
|
||||
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO ListItem;
|
||||
// get the current index of the list, and then get the data
|
||||
|
|
@ -1261,13 +1261,13 @@ void CScene_LoadGameSettings::UpdateTexturePackDescription(int index)
|
|||
}
|
||||
|
||||
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbFileData,&dwFileBytes );
|
||||
if(dwFileBytes >= 0 && pbFileData)
|
||||
if(dwFileBytes > 0 && pbFileData)
|
||||
{
|
||||
XuiCreateTextureBrushFromMemory(pbFileData,dwFileBytes,&m_hTexturePackIconBrush);
|
||||
m_texturePackIcon->UseBrush(m_hTexturePackIconBrush);
|
||||
}
|
||||
app.GetFileFromTPD(eTPDFileType_Comparison,pbData,dwBytes,&pbFileData,&dwFileBytes );
|
||||
if(dwFileBytes >= 0 && pbFileData)
|
||||
if(dwFileBytes > 0 && pbFileData)
|
||||
{
|
||||
XuiCreateTextureBrushFromMemory(pbFileData,dwFileBytes,&m_hTexturePackComparisonBrush);
|
||||
m_texturePackComparison->UseBrush(m_hTexturePackComparisonBrush);
|
||||
|
|
|
|||
|
|
@ -714,8 +714,8 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled
|
|||
ZeroMemory(&ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO));
|
||||
if(dwBytes > 0 && pbData)
|
||||
{
|
||||
DWORD dwImageBytes=0;
|
||||
PBYTE pbImageData=NULL;
|
||||
unsigned int dwImageBytes=0;
|
||||
std::uint8_t *pbImageData=NULL;
|
||||
|
||||
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes );
|
||||
ListInfo.fEnabled = TRUE;
|
||||
|
|
@ -1100,9 +1100,9 @@ void CScene_MultiGameCreate::UpdateTexturePackDescription(int index)
|
|||
// this is probably a texture pack icon added from TMS
|
||||
|
||||
unsigned int dwBytes=0;
|
||||
DWORD dwFileBytes=0;
|
||||
unsigned int dwFileBytes=0;
|
||||
std::uint8_t *pbData=NULL;
|
||||
PBYTE pbFileData=NULL;
|
||||
std::uint8_t *pbFileData=NULL;
|
||||
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO ListItem;
|
||||
// get the current index of the list, and then get the data
|
||||
|
|
@ -1119,13 +1119,13 @@ void CScene_MultiGameCreate::UpdateTexturePackDescription(int index)
|
|||
}
|
||||
|
||||
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbFileData,&dwFileBytes );
|
||||
if(dwFileBytes >= 0 && pbFileData)
|
||||
if(dwFileBytes > 0 && pbFileData)
|
||||
{
|
||||
XuiCreateTextureBrushFromMemory(pbFileData,dwFileBytes,&m_hTexturePackIconBrush);
|
||||
m_texturePackIcon->UseBrush(m_hTexturePackIconBrush);
|
||||
}
|
||||
app.GetFileFromTPD(eTPDFileType_Comparison,pbData,dwBytes,&pbFileData,&dwFileBytes );
|
||||
if(dwFileBytes >= 0 && pbFileData)
|
||||
if(dwFileBytes > 0 && pbFileData)
|
||||
{
|
||||
XuiCreateTextureBrushFromMemory(pbFileData,dwFileBytes,&m_hTexturePackComparisonBrush);
|
||||
m_texturePackComparison->UseBrush(m_hTexturePackComparisonBrush);
|
||||
|
|
|
|||
|
|
@ -1280,7 +1280,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList()
|
|||
app.GetTPD(sessionInfo->data.texturePackParentId,&pbData,&dwBytes);
|
||||
|
||||
// is it in the tpd data ?
|
||||
DWORD tpdImageBytes = 0;
|
||||
unsigned int tpdImageBytes = 0;
|
||||
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&imageData,&tpdImageBytes );
|
||||
imageBytes = static_cast<std::uint32_t>(tpdImageBytes);
|
||||
if(imageBytes > 0 && imageData)
|
||||
|
|
|
|||
|
|
@ -2959,9 +2959,9 @@ WCHAR CConsoleMinecraftApp::m_wchTMSXZP[] = L"file://UPDATE:/res/TMS/TMSFiles.xz
|
|||
#endif
|
||||
|
||||
|
||||
void CConsoleMinecraftApp::GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD dwBytes,PBYTE *ppbData,DWORD *pdwBytes )
|
||||
void CConsoleMinecraftApp::GetFileFromTPD(eTPDFileType eType, std::uint8_t *pbData, unsigned int dwBytes, std::uint8_t **ppbData, unsigned int *pdwBytes )
|
||||
{
|
||||
PBYTE pbPos=pbData;
|
||||
std::uint8_t *pbPos=pbData;
|
||||
// icon is the second thing in the file
|
||||
if(pbData && dwBytes>0)
|
||||
{
|
||||
|
|
@ -2973,15 +2973,15 @@ void CConsoleMinecraftApp::GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD
|
|||
if(eType==eTPDFileType_Loc)
|
||||
{
|
||||
*pdwBytes= uiDecompSize;
|
||||
*ppbData = new BYTE [uiDecompSize];
|
||||
*ppbData = new std::uint8_t[uiDecompSize];
|
||||
|
||||
Compression::getCompression()->Decompress(*ppbData,(UINT *)pdwBytes,&((unsigned int *)pbPos)[2],uiCompSize);
|
||||
Compression::getCompression()->Decompress(*ppbData, pdwBytes, &((unsigned int *)pbPos)[2], uiCompSize);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// skip over the data
|
||||
pbPos=(PBYTE)&((unsigned int *)pbPos)[2];
|
||||
pbPos=(std::uint8_t *)&((unsigned int *)pbPos)[2];
|
||||
pbPos+=uiCompSize;
|
||||
}
|
||||
|
||||
|
|
@ -2992,15 +2992,15 @@ void CConsoleMinecraftApp::GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD
|
|||
if(eType==eTPDFileType_Icon)
|
||||
{
|
||||
*pdwBytes= uiDecompSize;
|
||||
*ppbData = new BYTE [uiDecompSize];
|
||||
*ppbData = new std::uint8_t[uiDecompSize];
|
||||
|
||||
Compression::getCompression()->Decompress(*ppbData,(UINT *)pdwBytes,&((unsigned int *)pbPos)[2],uiCompSize);
|
||||
Compression::getCompression()->Decompress(*ppbData, pdwBytes, &((unsigned int *)pbPos)[2], uiCompSize);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// skip over the data
|
||||
pbPos=(PBYTE)&((unsigned int *)pbPos)[2];
|
||||
pbPos=(std::uint8_t *)&((unsigned int *)pbPos)[2];
|
||||
pbPos+=uiCompSize;
|
||||
}
|
||||
|
||||
|
|
@ -3011,9 +3011,9 @@ void CConsoleMinecraftApp::GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD
|
|||
if(eType==eTPDFileType_Comparison)
|
||||
{
|
||||
*pdwBytes= uiDecompSize;
|
||||
*ppbData = new BYTE [uiDecompSize];
|
||||
*ppbData = new std::uint8_t[uiDecompSize];
|
||||
|
||||
Compression::getCompression()->Decompress(*ppbData,(UINT *)pdwBytes,&((unsigned int *)pbPos)[2],uiCompSize);
|
||||
Compression::getCompression()->Decompress(*ppbData, pdwBytes, &((unsigned int *)pbPos)[2], uiCompSize);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ public:
|
|||
static TMS_FILE TMSFileA[TMS_COUNT];
|
||||
|
||||
|
||||
virtual void GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD dwBytes,PBYTE *ppbData,DWORD *pdwBytes );
|
||||
virtual void GetFileFromTPD(eTPDFileType eType, std::uint8_t *pbData, unsigned int dwBytes, std::uint8_t **ppbData, unsigned int *pdwBytes );
|
||||
|
||||
private:
|
||||
static WCHAR m_wchTMSXZP[];
|
||||
|
|
|
|||
Loading…
Reference in a new issue