the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 623 lines 20 kB view raw
1#include "stdafx.h" 2#include "Common\DLC\DLCGameRulesFile.h" 3#include "Common\DLC\DLCGameRulesHeader.h" 4#include "Common\DLC\DLCGameRules.h" 5#include "DLCTexturePack.h" 6#include "Common\DLC\DLCColourTableFile.h" 7#include "Common\DLC\DLCUIDataFile.h" 8#include "Common\DLC\DLCTextureFile.h" 9#include "Common\DLC\DLCLocalisationFile.h" 10#include "..\Minecraft.World\StringHelpers.h" 11#include "StringTable.h" 12#include "Common\DLC\DLCAudioFile.h" 13 14#if defined _XBOX || defined _WINDOWS64 15#include "Xbox\XML\ATGXmlParser.h" 16#include "Xbox\XML\xmlFilesCallback.h" 17#endif 18 19DLCTexturePack::DLCTexturePack(DWORD id, DLCPack *pack, TexturePack *fallback) : AbstractTexturePack(id, NULL, pack->getName(), fallback) 20{ 21 m_dlcInfoPack = pack; 22 m_dlcDataPack = NULL; 23 bUILoaded = false; 24 m_bLoadingData = false; 25 m_bHasLoadedData = false; 26 m_archiveFile = NULL; 27 if (app.getLevelGenerationOptions()) app.getLevelGenerationOptions()->setLoadedData(); 28 m_bUsingDefaultColourTable = true; 29 30 m_stringTable = NULL; 31 32#ifdef _XBOX 33 m_pStreamedWaveBank=NULL; 34 m_pSoundBank=NULL; 35#endif 36 37 if(m_dlcInfoPack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc")) 38 { 39 DLCLocalisationFile *localisationFile = (DLCLocalisationFile *)m_dlcInfoPack->getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc"); 40 m_stringTable = localisationFile->getStringTable(); 41 } 42 43 // 4J Stu - These calls need to be in the most derived version of the class 44 loadIcon(); 45 loadName(); 46 loadDescription(); 47 //loadDefaultHTMLColourTable(); 48} 49 50void DLCTexturePack::loadIcon() 51{ 52 if(m_dlcInfoPack->doesPackContainFile(DLCManager::e_DLCType_Texture, L"icon.png")) 53 { 54 DLCTextureFile *textureFile = (DLCTextureFile *)m_dlcInfoPack->getFile(DLCManager::e_DLCType_Texture, L"icon.png"); 55 m_iconData = textureFile->getData(m_iconSize); 56 } 57 else 58 { 59 AbstractTexturePack::loadIcon(); 60 } 61} 62 63void DLCTexturePack::loadComparison() 64{ 65 if(m_dlcInfoPack->doesPackContainFile(DLCManager::e_DLCType_Texture, L"comparison.png")) 66 { 67 DLCTextureFile *textureFile = (DLCTextureFile *)m_dlcInfoPack->getFile(DLCManager::e_DLCType_Texture, L"comparison.png"); 68 m_comparisonData = textureFile->getData(m_comparisonSize); 69 } 70} 71 72void DLCTexturePack::loadName() 73{ 74 texname = L""; 75 76 if(m_dlcInfoPack->GetPackID()&1024) 77 { 78 if(m_stringTable != NULL) 79 { 80 texname = m_stringTable->getString(L"IDS_DISPLAY_NAME"); 81 m_wsWorldName=m_stringTable->getString(L"IDS_WORLD_NAME"); 82 } 83 } 84 else 85 { 86 if(m_stringTable != NULL) 87 { 88 texname = m_stringTable->getString(L"IDS_DISPLAY_NAME"); 89 } 90 } 91 92} 93 94void DLCTexturePack::loadDescription() 95{ 96 desc1 = L""; 97 98 if(m_stringTable != NULL) 99 { 100 desc1 = m_stringTable->getString(L"IDS_TP_DESCRIPTION"); 101 } 102} 103 104wstring DLCTexturePack::getResource(const wstring& name) 105{ 106 // 4J Stu - We should never call this function 107#ifndef __CONTENT_PACKAGE 108 __debugbreak(); 109#endif 110 return L""; 111} 112 113InputStream *DLCTexturePack::getResourceImplementation(const wstring &name) //throws IOException 114{ 115 // 4J Stu - We should never call this function 116#ifndef _CONTENT_PACKAGE 117 __debugbreak(); 118 if(hasFile(name)) return NULL; 119#endif 120 return NULL; //resource; 121} 122 123bool DLCTexturePack::hasFile(const wstring &name) 124{ 125 bool hasFile = false; 126 if(m_dlcDataPack != NULL) hasFile = m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_Texture, name); 127 return hasFile; 128} 129 130bool DLCTexturePack::isTerrainUpdateCompatible() 131{ 132 return true; 133} 134 135wstring DLCTexturePack::getPath(bool bTitleUpdateTexture /*= false*/, const char *pchBDPatchFilename) 136{ 137 return L""; 138} 139 140wstring DLCTexturePack::getAnimationString(const wstring &textureName, const wstring &path) 141{ 142 wstring result = L""; 143 144 wstring fullpath = L"res/" + path + textureName + L".png"; 145 if(hasFile(fullpath)) 146 { 147 result = m_dlcDataPack->getFile(DLCManager::e_DLCType_Texture, fullpath)->getParameterAsString(DLCManager::e_DLCParamType_Anim); 148 } 149 150 return result; 151} 152 153BufferedImage *DLCTexturePack::getImageResource(const wstring& File, bool filenameHasExtension /*= false*/, bool bTitleUpdateTexture /*=false*/, const wstring &drive /*=L""*/) 154{ 155 if(m_dlcDataPack) return new BufferedImage(m_dlcDataPack, L"/" + File, filenameHasExtension); 156 else return fallback->getImageResource(File, filenameHasExtension, bTitleUpdateTexture, drive); 157} 158 159DLCPack * DLCTexturePack::getDLCPack() 160{ 161 return m_dlcDataPack; 162} 163 164void DLCTexturePack::loadColourTable() 165{ 166 // Load the game colours 167 if(m_dlcDataPack != NULL && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_ColourTable, L"colours.col")) 168 { 169 DLCColourTableFile *colourFile = (DLCColourTableFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_ColourTable, L"colours.col"); 170 m_colourTable = colourFile->getColourTable(); 171 m_bUsingDefaultColourTable = false; 172 } 173 else 174 { 175 // 4J Stu - We can delete the default colour table, but not the one from the DLCColourTableFile 176 if(!m_bUsingDefaultColourTable) m_colourTable = NULL; 177 loadDefaultColourTable(); 178 m_bUsingDefaultColourTable = true; 179 } 180 181 // Load the text colours 182#ifdef _XBOX 183 if(m_dlcDataPack != NULL && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")) 184 { 185 DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); 186 187 DWORD dwSize = 0; 188 PBYTE pbData = dataFile->getData(dwSize); 189 190 const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string 191 WCHAR szResourceLocator[ LOCATOR_SIZE ]; 192 193 // Try and load the HTMLColours.col based off the common XML first, before the deprecated xuiscene_colourtable 194 swprintf(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#HTMLColours.col",pbData, dwSize); 195 BYTE *data; 196 UINT dataLength; 197 if(XuiResourceLoadAll(szResourceLocator, &data, &dataLength) == S_OK) 198 { 199 m_colourTable->loadColoursFromData(data,dataLength); 200 201 XuiFree(data); 202 } 203 else 204 { 205 206 swprintf(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#xuiscene_colourtable.xur",pbData, dwSize); 207 HXUIOBJ hScene; 208 HRESULT hr = XuiSceneCreate(szResourceLocator,szResourceLocator, NULL, &hScene); 209 210 if(HRESULT_SUCCEEDED(hr)) 211 { 212 loadHTMLColourTableFromXuiScene(hScene); 213 } 214 else 215 { 216 loadDefaultHTMLColourTable(); 217 } 218 } 219 } 220 else 221 { 222 loadDefaultHTMLColourTable(); 223 } 224#else 225 if(app.hasArchiveFile(L"HTMLColours.col")) 226 { 227 byteArray textColours = app.getArchiveFile(L"HTMLColours.col"); 228 m_colourTable->loadColoursFromData(textColours.data,textColours.length); 229 230 delete [] textColours.data; 231 } 232#endif 233} 234 235void DLCTexturePack::loadData() 236{ 237 int mountIndex = m_dlcInfoPack->GetDLCMountIndex(); 238 239 if(mountIndex > -1) 240 { 241#ifdef _DURANGO 242 if(StorageManager.MountInstalledDLC(ProfileManager.GetPrimaryPad(),mountIndex,&DLCTexturePack::packMounted,this,L"TPACK")!=ERROR_IO_PENDING) 243#else 244 if(StorageManager.MountInstalledDLC(ProfileManager.GetPrimaryPad(),mountIndex,&DLCTexturePack::packMounted,this,"TPACK")!=ERROR_IO_PENDING) 245#endif 246 { 247 // corrupt DLC 248 m_bHasLoadedData = true; 249 if (app.getLevelGenerationOptions()) app.getLevelGenerationOptions()->setLoadedData(); 250 app.DebugPrintf("Failed to mount texture pack DLC %d for pad %d\n",mountIndex,ProfileManager.GetPrimaryPad()); 251 } 252 else 253 { 254 m_bLoadingData = true; 255 app.DebugPrintf("Attempted to mount DLC data for texture pack %d\n", mountIndex); 256 } 257 } 258 else 259 { 260 m_bHasLoadedData = true; 261 if (app.getLevelGenerationOptions()) app.getLevelGenerationOptions()->setLoadedData(); 262 app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_ReloadTexturePack); 263 } 264} 265 266 267 268 269 270wstring DLCTexturePack::getFilePath(DWORD packId, wstring filename, bool bAddDataFolder) 271{ 272 return app.getFilePath(packId,filename,bAddDataFolder); 273} 274 275int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask) 276{ 277 DLCTexturePack *texturePack = (DLCTexturePack *)pParam; 278 texturePack->m_bLoadingData = false; 279 if(dwErr!=ERROR_SUCCESS) 280 { 281 // corrupt DLC 282 app.DebugPrintf("Failed to mount DLC for pad %d: %d\n",iPad,dwErr); 283 } 284 else 285 { 286 app.DebugPrintf("Mounted DLC for texture pack, attempting to load data\n"); 287 texturePack->m_dlcDataPack = new DLCPack(texturePack->m_dlcInfoPack->getName(), dwLicenceMask); 288 texturePack->setHasAudio(false); 289 DWORD dwFilesProcessed = 0; 290 // Load the DLC textures 291 wstring dataFilePath = texturePack->m_dlcInfoPack->getFullDataPath(); 292 if(!dataFilePath.empty()) 293 { 294 if(!app.m_dlcManager.readDLCDataFile(dwFilesProcessed, getFilePath(texturePack->m_dlcInfoPack->GetPackID(), dataFilePath),texturePack->m_dlcDataPack)) 295 { 296 delete texturePack->m_dlcDataPack; 297 texturePack->m_dlcDataPack = NULL; 298 } 299 300 // Load the UI data 301 if(texturePack->m_dlcDataPack != NULL) 302 { 303#ifdef _XBOX 304 File xzpPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"TexturePack.xzp") ) ); 305 306 if(xzpPath.exists()) 307 { 308 const char *pchFilename=wstringtofilename(xzpPath.getPath()); 309 HANDLE fileHandle = CreateFile( 310 pchFilename, // file name 311 GENERIC_READ, // access mode 312 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... 313 NULL, // Unused 314 OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it 315 FILE_FLAG_SEQUENTIAL_SCAN, // file attributes 316 NULL // Unsupported 317 ); 318 319 if( fileHandle != INVALID_HANDLE_VALUE ) 320 { 321 DWORD dwFileSize = xzpPath.length(); 322 DWORD bytesRead; 323 PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; 324 BOOL success = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); 325 CloseHandle(fileHandle); 326 if(success) 327 { 328 DLCUIDataFile *uiDLCFile = (DLCUIDataFile *)texturePack->m_dlcDataPack->addFile(DLCManager::e_DLCType_UIData,L"TexturePack.xzp"); 329 uiDLCFile->addData(pbData,bytesRead,true); 330 331 } 332 } 333 } 334#else 335 File archivePath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"media.arc") ) ); 336 if(archivePath.exists()) texturePack->m_archiveFile = new ArchiveFile(archivePath); 337#endif 338 339 /** 340 4J-JEV: 341 For all the GameRuleHeader files we find 342 */ 343 DLCPack *pack = texturePack->m_dlcInfoPack->GetParentPack(); 344 LevelGenerationOptions *levelGen = app.getLevelGenerationOptions(); 345 if (levelGen != NULL && !levelGen->hasLoadedData()) 346 { 347 int gameRulesCount = pack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader); 348 for(int i = 0; i < gameRulesCount; ++i) 349 { 350 DLCGameRulesHeader *dlcFile = (DLCGameRulesHeader *) pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i); 351 352 if (!dlcFile->getGrfPath().empty()) 353 { 354 File grf( getFilePath(texturePack->m_dlcInfoPack->GetPackID(), dlcFile->getGrfPath() ) ); 355 if (grf.exists()) 356 { 357#ifdef _UNICODE 358 wstring path = grf.getPath(); 359 const WCHAR *pchFilename=path.c_str(); 360 HANDLE fileHandle = CreateFile( 361 pchFilename, // file name 362 GENERIC_READ, // access mode 363 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... 364 NULL, // Unused 365 OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it 366 FILE_FLAG_SEQUENTIAL_SCAN, // file attributes 367 NULL // Unsupported 368 ); 369#else 370 const char *pchFilename=wstringtofilename(grf.getPath()); 371 HANDLE fileHandle = CreateFile( 372 pchFilename, // file name 373 GENERIC_READ, // access mode 374 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... 375 NULL, // Unused 376 OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it 377 FILE_FLAG_SEQUENTIAL_SCAN, // file attributes 378 NULL // Unsupported 379 ); 380#endif 381 382 if( fileHandle != INVALID_HANDLE_VALUE ) 383 { 384 DWORD dwFileSize = grf.length(); 385 DWORD bytesRead; 386 PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; 387 BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); 388 if(bSuccess==FALSE) 389 { 390 app.FatalLoadError(); 391 } 392 CloseHandle(fileHandle); 393 394 // 4J-PB - is it possible that we can get here after a read fail and it's not an error? 395 dlcFile->setGrfData(pbData, dwFileSize, texturePack->m_stringTable); 396 397 delete [] pbData; 398 399 app.m_gameRules.setLevelGenerationOptions( dlcFile->lgo ); 400 } 401 } 402 } 403 } 404 if(levelGen->requiresBaseSave() && !levelGen->getBaseSavePath().empty() ) 405 { 406 File grf(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), levelGen->getBaseSavePath() )); 407 if (grf.exists()) 408 { 409#ifdef _UNICODE 410 wstring path = grf.getPath(); 411 const WCHAR *pchFilename=path.c_str(); 412 HANDLE fileHandle = CreateFile( 413 pchFilename, // file name 414 GENERIC_READ, // access mode 415 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... 416 NULL, // Unused 417 OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it 418 FILE_FLAG_SEQUENTIAL_SCAN, // file attributes 419 NULL // Unsupported 420 ); 421#else 422 const char *pchFilename=wstringtofilename(grf.getPath()); 423 HANDLE fileHandle = CreateFile( 424 pchFilename, // file name 425 GENERIC_READ, // access mode 426 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... 427 NULL, // Unused 428 OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it 429 FILE_FLAG_SEQUENTIAL_SCAN, // file attributes 430 NULL // Unsupported 431 ); 432#endif 433 434 if( fileHandle != INVALID_HANDLE_VALUE ) 435 { 436 DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,NULL); 437 PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; 438 BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); 439 if(bSuccess==FALSE) 440 { 441 app.FatalLoadError(); 442 } 443 CloseHandle(fileHandle); 444 445 // 4J-PB - is it possible that we can get here after a read fail and it's not an error? 446 levelGen->setBaseSaveData(pbData, dwFileSize); 447 } 448 } 449 } 450 } 451 452 453 // any audio data? 454#ifdef _XBOX 455 File audioXSBPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"MashUp.xsb") ) ); 456 File audioXWBPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"MashUp.xwb") ) ); 457 458 if(audioXSBPath.exists() && audioXWBPath.exists()) 459 { 460 461 texturePack->setHasAudio(true); 462 const char *pchXWBFilename=wstringtofilename(audioXWBPath.getPath()); 463 Minecraft::GetInstance()->soundEngine->CreateStreamingWavebank(pchXWBFilename,&texturePack->m_pStreamedWaveBank); 464 const char *pchXSBFilename=wstringtofilename(audioXSBPath.getPath()); 465 Minecraft::GetInstance()->soundEngine->CreateSoundbank(pchXSBFilename,&texturePack->m_pSoundBank); 466 467 } 468#else 469 //DLCPack *pack = texturePack->m_dlcInfoPack->GetParentPack(); 470 if(pack->getDLCItemsCount(DLCManager::e_DLCType_Audio)>0) 471 { 472 DLCAudioFile *dlcFile = (DLCAudioFile *) pack->getFile(DLCManager::e_DLCType_Audio, 0); 473 texturePack->setHasAudio(true); 474 // init the streaming sound ids for this texture pack 475 int iOverworldStart, iNetherStart, iEndStart; 476 int iOverworldC, iNetherC, iEndC; 477 478 iOverworldStart=0; 479 iOverworldC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Overworld); 480 iNetherStart=iOverworldC; 481 iNetherC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Nether); 482 iEndStart=iOverworldC+iNetherC; 483 iEndC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_End); 484 485 Minecraft::GetInstance()->soundEngine->SetStreamingSounds(iOverworldStart,iOverworldStart+iOverworldC-1, 486 iNetherStart,iNetherStart+iNetherC-1,iEndStart,iEndStart+iEndC-1,iEndStart+iEndC); // push the CD start to after 487 } 488#endif 489} 490 texturePack->loadColourTable(); 491 } 492 493 // 4J-PB - we need to leave the texture pack mounted if it contained streaming audio 494 if(texturePack->hasAudio()==false) 495 { 496#ifdef _XBOX 497 StorageManager.UnmountInstalledDLC("TPACK"); 498#endif 499 } 500 } 501 502 texturePack->m_bHasLoadedData = true; 503 if (app.getLevelGenerationOptions()) app.getLevelGenerationOptions()->setLoadedData(); 504 app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_ReloadTexturePack); 505 506 return 0; 507} 508 509void DLCTexturePack::loadUI() 510{ 511#ifdef _XBOX 512//Syntax: "memory://" + Address + "," + Size + "#" + File 513//L"memory://0123ABCD,21A3#skin_default.xur" 514 515 // Load new skin 516 if(m_dlcDataPack != NULL && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")) 517 { 518 DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); 519 520 DWORD dwSize = 0; 521 PBYTE pbData = dataFile->getData(dwSize); 522 523 const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string 524 WCHAR szResourceLocator[ LOCATOR_SIZE ]; 525 swprintf(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#skin_Minecraft.xur",pbData, dwSize); 526 527 XuiFreeVisuals(L""); 528 529 530 HRESULT hr = app.LoadSkin(szResourceLocator,NULL);//L"TexturePack"); 531 if(HRESULT_SUCCEEDED(hr)) 532 { 533 bUILoaded = true; 534 //CXuiSceneBase::GetInstance()->SetVisualPrefix(L"TexturePack"); 535 //CXuiSceneBase::GetInstance()->SkinChanged(CXuiSceneBase::GetInstance()->m_hObj); 536 } 537 } 538#else 539 if(m_archiveFile && m_archiveFile->hasFile(L"skin.swf")) 540 { 541 ui.ReloadSkin(); 542 bUILoaded = true; 543 } 544#endif 545 else 546 { 547 loadDefaultUI(); 548 bUILoaded = true; 549 } 550 551 AbstractTexturePack::loadUI(); 552#ifndef _XBOX 553 if(hasAudio()==false && !ui.IsReloadingSkin()) 554 { 555#ifdef _DURANGO 556 StorageManager.UnmountInstalledDLC(L"TPACK"); 557#else 558 StorageManager.UnmountInstalledDLC("TPACK"); 559#endif 560 } 561#endif 562} 563 564void DLCTexturePack::unloadUI() 565{ 566 // Unload skin 567 if(bUILoaded) 568 { 569#ifdef _XBOX 570 XuiFreeVisuals(L"TexturePack"); 571 XuiFreeVisuals(L""); 572 CXuiSceneBase::GetInstance()->SetVisualPrefix(L""); 573 CXuiSceneBase::GetInstance()->SkinChanged(CXuiSceneBase::GetInstance()->m_hObj); 574#endif 575 setHasAudio(false); 576 } 577 AbstractTexturePack::unloadUI(); 578 579 app.m_dlcManager.removePack(m_dlcDataPack); 580 m_dlcDataPack = NULL; 581 delete m_archiveFile; 582 m_bHasLoadedData = false; 583 584 bUILoaded = false; 585} 586 587wstring DLCTexturePack::getXuiRootPath() 588{ 589 wstring path = L""; 590 if(m_dlcDataPack != NULL && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")) 591 { 592 DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); 593 594 DWORD dwSize = 0; 595 PBYTE pbData = dataFile->getData(dwSize); 596 597 const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string 598 WCHAR szResourceLocator[ LOCATOR_SIZE ]; 599 swprintf(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#",pbData, dwSize); 600 path = szResourceLocator; 601 } 602 return path; 603} 604 605unsigned int DLCTexturePack::getDLCParentPackId() 606{ 607 return m_dlcInfoPack->GetParentPackId(); 608} 609 610unsigned char DLCTexturePack::getDLCSubPackId() 611{ 612 return (m_dlcInfoPack->GetPackId()>>24)&0xFF; 613} 614 615DLCPack * DLCTexturePack::getDLCInfoParentPack() 616{ 617 return m_dlcInfoPack->GetParentPack(); 618} 619 620XCONTENTDEVICEID DLCTexturePack::GetDLCDeviceID() 621{ 622 return m_dlcInfoPack->GetDLCDeviceID(); 623}