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