the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "FolderTexturePack.h"
3
4FolderTexturePack::FolderTexturePack(DWORD id, const wstring &name, File *folder, TexturePack *fallback) : AbstractTexturePack(id, folder, name, fallback)
5{
6 // 4J Stu - These calls need to be in the most derived version of the class
7 loadIcon();
8 loadName();
9 loadDescription();
10
11 bUILoaded = false;
12}
13
14InputStream *FolderTexturePack::getResourceImplementation(const wstring &name) //throws IOException
15{
16#if 0
17 final File file = new File(this.file, name.substring(1));
18 if (!file.exists()) {
19 throw new FileNotFoundException(name);
20 }
21
22 return new BufferedInputStream(new FileInputStream(file));
23#endif
24
25 wstring wDrive = L"";
26 // Make the content package point to to the UPDATE: drive is needed
27#ifdef _XBOX
28 wDrive=L"GAME:\\DummyTexturePack\\res";
29#else
30 wDrive = L"Common\\DummyTexturePack\\res";
31#endif
32 InputStream *resource = InputStream::getResourceAsStream(wDrive + name);
33 //InputStream *stream = DefaultTexturePack::class->getResourceAsStream(name);
34 //if (stream == NULL)
35 //{
36 // throw new FileNotFoundException(name);
37 //}
38
39 //return stream;
40 return resource;
41}
42
43bool FolderTexturePack::hasFile(const wstring &name)
44{
45 File file = File( getPath() + name);
46 return file.exists() && file.isFile();
47 //return true;
48}
49
50bool FolderTexturePack::isTerrainUpdateCompatible()
51{
52#if 0
53 final File dir = new File(this.file, "textures/");
54 final boolean hasTexturesFolder = dir.exists() && dir.isDirectory();
55 final boolean hasOldFiles = hasFile("terrain.png") || hasFile("gui/items.png");
56 return hasTexturesFolder || !hasOldFiles;
57#endif
58 return true;
59}
60
61wstring FolderTexturePack::getPath(bool bTitleUpdateTexture /*= false*/,const char *pchBDPatchFilename)
62{
63 wstring wDrive;
64#ifdef _XBOX
65 wDrive=L"GAME:\\" + file->getPath() + L"\\";
66#else
67 wDrive=L"Common\\" + file->getPath() + L"\\";
68#endif
69 return wDrive;
70}
71
72void FolderTexturePack::loadUI()
73{
74#ifdef _XBOX
75 //"file://" + Drive + PathToXZP + "#" + PathInsideXZP
76
77 //L"file://game:/ui.xzp#skin_default.xur"
78
79 // Load new skin
80 if(hasFile(L"TexturePack.xzp"))
81 {
82 const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
83 WCHAR szResourceLocator[ LOCATOR_SIZE ];
84
85 swprintf(szResourceLocator, LOCATOR_SIZE,L"file://%lsTexturePack.xzp#skin_Minecraft.xur",getPath().c_str());
86
87 XuiFreeVisuals(L"");
88 app.LoadSkin(szResourceLocator,NULL);//L"TexturePack");
89 bUILoaded = true;
90 //CXuiSceneBase::GetInstance()->SetVisualPrefix(L"TexturePack");
91 }
92
93 AbstractTexturePack::loadUI();
94#endif
95}
96
97void FolderTexturePack::unloadUI()
98{
99#ifdef _XBOX
100 // Unload skin
101 if(bUILoaded)
102 {
103 XuiFreeVisuals(L"TexturePack");
104 XuiFreeVisuals(L"");
105 CXuiSceneBase::GetInstance()->SetVisualPrefix(L"");
106 CXuiSceneBase::GetInstance()->SkinChanged(CXuiSceneBase::GetInstance()->m_hObj);
107 }
108 AbstractTexturePack::unloadUI();
109#endif
110}