mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-06-08 19:12:17 +00:00
Probably for TU30
This commit is contained in:
@@ -264,10 +264,6 @@ void DLCTexturePack::loadData()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
wstring DLCTexturePack::getFilePath(DWORD packId, wstring filename, bool bAddDataFolder)
|
||||
{
|
||||
return app.getFilePath(packId,filename,bAddDataFolder);
|
||||
@@ -277,6 +273,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen
|
||||
{
|
||||
DLCTexturePack *texturePack = static_cast<DLCTexturePack *>(pParam);
|
||||
texturePack->m_bLoadingData = false;
|
||||
|
||||
if(dwErr!=ERROR_SUCCESS)
|
||||
{
|
||||
// corrupt DLC
|
||||
@@ -288,6 +285,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen
|
||||
texturePack->m_dlcDataPack = new DLCPack(texturePack->m_dlcInfoPack->getName(), dwLicenceMask);
|
||||
texturePack->setHasAudio(false);
|
||||
DWORD dwFilesProcessed = 0;
|
||||
|
||||
// Load the DLC textures
|
||||
wstring dataFilePath = texturePack->m_dlcInfoPack->getFullDataPath();
|
||||
if(!dataFilePath.empty())
|
||||
@@ -301,41 +299,9 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen
|
||||
// Load the UI data
|
||||
if(texturePack->m_dlcDataPack != nullptr)
|
||||
{
|
||||
#ifdef _XBOX
|
||||
File xzpPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"TexturePack.xzp") ) );
|
||||
|
||||
if(xzpPath.exists())
|
||||
{
|
||||
const char *pchFilename=wstringtofilename(xzpPath.getPath());
|
||||
HANDLE fileHandle = CreateFile(
|
||||
pchFilename, // file name
|
||||
GENERIC_READ, // access mode
|
||||
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
||||
nullptr, // Unused
|
||||
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
|
||||
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||
nullptr // Unsupported
|
||||
);
|
||||
|
||||
if( fileHandle != INVALID_HANDLE_VALUE )
|
||||
{
|
||||
DWORD dwFileSize = xzpPath.length();
|
||||
DWORD bytesRead;
|
||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||
BOOL success = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr);
|
||||
CloseHandle(fileHandle);
|
||||
if(success)
|
||||
{
|
||||
DLCUIDataFile *uiDLCFile = (DLCUIDataFile *)texturePack->m_dlcDataPack->addFile(DLCManager::e_DLCType_UIData,L"TexturePack.xzp");
|
||||
uiDLCFile->addData(pbData,bytesRead,true);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
File archivePath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"media.arc") ) );
|
||||
if(archivePath.exists()) texturePack->m_archiveFile = new ArchiveFile(archivePath);
|
||||
#endif
|
||||
if(archivePath.exists())
|
||||
texturePack->m_archiveFile = new ArchiveFile(archivePath);
|
||||
|
||||
/**
|
||||
4J-JEV:
|
||||
@@ -386,10 +352,10 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen
|
||||
DWORD bytesRead;
|
||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr);
|
||||
|
||||
if(bSuccess==FALSE)
|
||||
{
|
||||
app.FatalLoadError();
|
||||
}
|
||||
|
||||
CloseHandle(fileHandle);
|
||||
|
||||
// 4J-PB - is it possible that we can get here after a read fail and it's not an error?
|
||||
@@ -431,16 +397,15 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen
|
||||
nullptr // Unsupported
|
||||
);
|
||||
#endif
|
||||
|
||||
if( fileHandle != INVALID_HANDLE_VALUE )
|
||||
{
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,nullptr);
|
||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr);
|
||||
|
||||
if(bSuccess==FALSE)
|
||||
{
|
||||
app.FatalLoadError();
|
||||
}
|
||||
|
||||
CloseHandle(fileHandle);
|
||||
|
||||
// 4J-PB - is it possible that we can get here after a read fail and it's not an error?
|
||||
@@ -449,104 +414,76 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// any audio data?
|
||||
#ifdef _XBOX
|
||||
File audioXSBPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"MashUp.xsb") ) );
|
||||
File audioXWBPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"MashUp.xwb") ) );
|
||||
|
||||
if(audioXSBPath.exists() && audioXWBPath.exists())
|
||||
{
|
||||
|
||||
texturePack->setHasAudio(true);
|
||||
const char *pchXWBFilename=wstringtofilename(audioXWBPath.getPath());
|
||||
Minecraft::GetInstance()->soundEngine->CreateStreamingWavebank(pchXWBFilename,&texturePack->m_pStreamedWaveBank);
|
||||
const char *pchXSBFilename=wstringtofilename(audioXSBPath.getPath());
|
||||
Minecraft::GetInstance()->soundEngine->CreateSoundbank(pchXSBFilename,&texturePack->m_pSoundBank);
|
||||
|
||||
}
|
||||
#else
|
||||
//DLCPack *pack = texturePack->m_dlcInfoPack->GetParentPack();
|
||||
if(pack->getDLCItemsCount(DLCManager::e_DLCType_Audio)>0)
|
||||
if(pack->getDLCItemsCount(DLCManager::e_DLCType_Audio) > 0)
|
||||
{
|
||||
DLCAudioFile *dlcFile = static_cast<DLCAudioFile *>(pack->getFile(DLCManager::e_DLCType_Audio, 0));
|
||||
texturePack->setHasAudio(true);
|
||||
// init the streaming sound ids for this texture pack
|
||||
int iOverworldC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Overworld);
|
||||
int iNetherC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Nether);
|
||||
int iEndStart=iOverworldC+iNetherC;
|
||||
int iEndC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_End);
|
||||
int iAfterEnd=iOverworldC+iNetherC+iEndC;
|
||||
int iCreativeC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Creative);
|
||||
|
||||
// init the streaming sound ids for this texture pack
|
||||
int iOverworldC = dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Overworld);
|
||||
int iNetherC = dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Nether);
|
||||
int iEndC = dlcFile->GetCountofType(DLCAudioFile::e_AudioType_End);
|
||||
int iCreativeC = dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Creative);
|
||||
int iMenuC = dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Menu);
|
||||
int iBattleC = dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Battle);
|
||||
|
||||
int iEndStart = iOverworldC + iNetherC;
|
||||
int iAfterEnd = iEndStart + iEndC;
|
||||
int iCreativeStart, iCreativeRange;
|
||||
int iMenuStart, iMenuRange;
|
||||
|
||||
if(iCreativeC)
|
||||
{
|
||||
iCreativeStart=iAfterEnd;
|
||||
iCreativeRange=iCreativeC;
|
||||
iAfterEnd+=iCreativeC;
|
||||
iCreativeStart = iAfterEnd;
|
||||
iAfterEnd += iCreativeC;
|
||||
}
|
||||
else
|
||||
{
|
||||
iCreativeStart=0;
|
||||
iCreativeRange=iOverworldC;
|
||||
}
|
||||
iCreativeStart = 0;
|
||||
|
||||
int iMenuC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Menu);
|
||||
int iMenuStart, iMenuRange;
|
||||
if(iMenuC)
|
||||
{
|
||||
iMenuStart=iAfterEnd;
|
||||
iMenuRange=iMenuC;
|
||||
iAfterEnd+=iMenuC;
|
||||
iMenuStart = iAfterEnd;
|
||||
iAfterEnd += iMenuC;
|
||||
}
|
||||
else
|
||||
{
|
||||
iMenuStart=0;
|
||||
iMenuRange=iOverworldC;
|
||||
}
|
||||
iMenuStart = 0;
|
||||
|
||||
int iBattleC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Battle);
|
||||
if(iBattleC)
|
||||
{
|
||||
Minecraft::GetInstance()->soundEngine->SetStreamingSounds(
|
||||
0,iOverworldC-1,
|
||||
iOverworldC,iOverworldC+iNetherC-1,
|
||||
iEndStart,iEndStart+iEndC-1,
|
||||
iCreativeStart,iCreativeStart+iCreativeRange-1,
|
||||
iMenuStart,iMenuStart+iMenuRange-1,
|
||||
iAfterEnd,iAfterEnd+iBattleC-1,
|
||||
iAfterEnd+iBattleC);
|
||||
0, iOverworldC -1,
|
||||
iOverworldC, iOverworldC + iNetherC -1,
|
||||
iEndStart, iEndStart + iEndC -1,
|
||||
iCreativeStart, iCreativeStart + iCreativeC -1,
|
||||
iMenuStart, iMenuStart + iMenuRange -1,
|
||||
iAfterEnd, iAfterEnd + iBattleC -1,
|
||||
iAfterEnd + iBattleC);
|
||||
}
|
||||
else
|
||||
{
|
||||
Minecraft::GetInstance()->soundEngine->SetStreamingSounds(
|
||||
0,iOverworldC-1,
|
||||
iOverworldC,iOverworldC+iNetherC-1,
|
||||
iEndStart,iEndStart+iEndC-1,
|
||||
iCreativeStart,iCreativeStart+iCreativeRange-1,
|
||||
iMenuStart,iMenuStart+iMenuRange-1,
|
||||
0,iOverworldC-1,
|
||||
0, iOverworldC -1,
|
||||
iOverworldC, iOverworldC + iNetherC -1,
|
||||
iEndStart, iEndStart + iEndC -1,
|
||||
iCreativeStart, iCreativeStart + iCreativeC -1,
|
||||
iMenuStart, iMenuStart + iMenuC -1,
|
||||
0, iOverworldC -1,
|
||||
iAfterEnd);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
texturePack->loadColourTable();
|
||||
}
|
||||
|
||||
// 4J-PB - we need to leave the texture pack mounted if it contained streaming audio
|
||||
if(texturePack->hasAudio()==false)
|
||||
{
|
||||
#ifdef _XBOX
|
||||
StorageManager.UnmountInstalledDLC("TPACK");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
texturePack->m_bHasLoadedData = true;
|
||||
if (app.getLevelGenerationOptions()) app.getLevelGenerationOptions()->setLoadedData();
|
||||
|
||||
if (app.getLevelGenerationOptions())
|
||||
app.getLevelGenerationOptions()->setLoadedData();
|
||||
|
||||
app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_ReloadTexturePack);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user