the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 131 lines 3.4 kB view raw
1#include "stdafx.h" 2#include "DefaultTexturePack.h" 3#include "Textures.h" 4#include "..\Minecraft.World\StringHelpers.h" 5 6 7DefaultTexturePack::DefaultTexturePack() : AbstractTexturePack(0, NULL, L"Minecraft", NULL) 8{ 9 // 4J Stu - These calls need to be in the most derived version of the class 10 loadIcon(); 11 loadName(); // 4J-PB - added so the PS3 can have localised texture names' 12 loadDescription(); 13 loadColourTable(); 14} 15 16void DefaultTexturePack::loadIcon() 17{ 18#ifdef _XBOX 19 // 4J Stu - Temporary only 20 const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string 21 WCHAR szResourceLocator[ LOCATOR_SIZE ]; 22 23 const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); 24 swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/TexturePackIcon.png"); 25 26 UINT size = 0; 27 HRESULT hr = XuiResourceLoadAllNoLoc(szResourceLocator, &m_iconData, &size); 28 m_iconSize = size; 29#else 30 if(app.hasArchiveFile(L"Graphics\\TexturePackIcon.png")) 31 { 32 byteArray ba = app.getArchiveFile(L"Graphics\\TexturePackIcon.png"); 33 m_iconData = ba.data; 34 m_iconSize = ba.length; 35 } 36#endif 37} 38 39void DefaultTexturePack::loadDescription() 40{ 41 desc1 = L"LOCALISE ME: The default look of Minecraft"; 42} 43void DefaultTexturePack::loadName() 44{ 45 texname = L"Minecraft"; 46} 47 48bool DefaultTexturePack::hasFile(const wstring &name) 49{ 50// return DefaultTexturePack::class->getResourceAsStream(name) != null; 51 return true; 52} 53 54bool DefaultTexturePack::isTerrainUpdateCompatible() 55{ 56 return true; 57} 58 59InputStream *DefaultTexturePack::getResourceImplementation(const wstring &name)// throws FileNotFoundException 60{ 61 wstring wDrive = L""; 62 // Make the content package point to to the UPDATE: drive is needed 63#ifdef _XBOX 64 #ifdef _TU_BUILD 65 wDrive=L"UPDATE:\\res"; 66 #else 67 68 wDrive=L"GAME:\\res\\TitleUpdate\\res"; 69 #endif 70#elif __PS3__ 71 72 char *pchUsrDir; 73 if(app.GetBootedFromDiscPatch()) 74 { 75 const char *pchTextureName=wstringtofilename(name); 76 pchUsrDir = app.GetBDUsrDirPath(pchTextureName); 77 app.DebugPrintf("DefaultTexturePack::getResourceImplementation - texture %s - Drive - %s\n",pchTextureName,pchUsrDir); 78 } 79 else 80 { 81 const char *pchTextureName=wstringtofilename(name); 82 pchUsrDir=getUsrDirPath(); 83 app.DebugPrintf("DefaultTexturePack::getResourceImplementation - texture %s - Drive - %s\n",pchTextureName,pchUsrDir); 84 } 85 86 87 wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); 88 89 wDrive = wstr + L"\\Common\\res\\TitleUpdate\\res"; 90#elif __PSVITA__ 91 92 /* 93 char *pchUsrDir=getUsrDirPath(); 94 wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); 95 96 wDrive = wstr + L"Common\\res\\TitleUpdate\\res"; 97 */ 98 wDrive = L"Common\\res\\TitleUpdate\\res"; 99#else 100 wDrive = L"Common\\res\\TitleUpdate\\res"; 101 102#endif 103 InputStream *resource = InputStream::getResourceAsStream(wDrive + name); 104 //InputStream *stream = DefaultTexturePack::class->getResourceAsStream(name); 105 //if (stream == NULL) 106 //{ 107 // throw new FileNotFoundException(name); 108 //} 109 110 //return stream; 111 return resource; 112} 113 114void DefaultTexturePack::loadUI() 115{ 116 loadDefaultUI(); 117 118 AbstractTexturePack::loadUI(); 119} 120 121void DefaultTexturePack::unloadUI() 122{ 123#ifdef _XBOX 124 // Unload skin 125 XuiFreeVisuals(L"TexturePack"); 126 XuiFreeVisuals(L""); 127 CXuiSceneBase::GetInstance()->SetVisualPrefix(L""); 128 CXuiSceneBase::GetInstance()->SkinChanged(CXuiSceneBase::GetInstance()->m_hObj); 129#endif 130 AbstractTexturePack::unloadUI(); 131}