mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
nuke memory tracking
This commit is contained in:
parent
e00c95e7ab
commit
f9e89c2be6
|
|
@ -327,14 +327,12 @@ void Socket::SocketOutputStreamLocal::write(const std::vector<uint8_t>& b, unsig
|
||||||
if (m_streamOpen != true) {
|
if (m_streamOpen != true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// MemSect(12);
|
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(s_hostQueueLock[m_queueIdx]);
|
std::lock_guard<std::mutex> lock(s_hostQueueLock[m_queueIdx]);
|
||||||
for (unsigned int i = 0; i < length; i++) {
|
for (unsigned int i = 0; i < length; i++) {
|
||||||
s_hostQueue[m_queueIdx].push(b[offset + i]);
|
s_hostQueue[m_queueIdx].push(b[offset + i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Socket::SocketOutputStreamLocal::close() {
|
void Socket::SocketOutputStreamLocal::close() {
|
||||||
|
|
|
||||||
|
|
@ -341,9 +341,7 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer* renderer, double x,
|
||||||
|
|
||||||
if (ws > 1) ws = 1;
|
if (ws > 1) ws = 1;
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
bindTexture(m_customTextureUrl, m_backupTexture);
|
bindTexture(m_customTextureUrl, m_backupTexture);
|
||||||
MemSect(0);
|
|
||||||
glEnable(GL_ALPHA_TEST);
|
glEnable(GL_ALPHA_TEST);
|
||||||
|
|
||||||
// model->prepareMobModel(mob, wp, ws, a);
|
// model->prepareMobModel(mob, wp, ws, a);
|
||||||
|
|
@ -458,9 +456,7 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer* renderer, double x,
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
// renderName(mob, x, y, z);
|
// renderName(mob, x, y, z);
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
// Reset the model values to stop the changes we made here affecting
|
// Reset the model values to stop the changes we made here affecting
|
||||||
// anything in game (like the player hand render)
|
// anything in game (like the player hand render)
|
||||||
|
|
|
||||||
|
|
@ -140,4 +140,3 @@ using namespace DirectX;
|
||||||
#define OutputDebugStringW BREAKTHECOMPILE
|
#define OutputDebugStringW BREAKTHECOMPILE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void MemSect(int sect);
|
|
||||||
|
|
|
||||||
|
|
@ -405,16 +405,6 @@ void DefineActions(void) {
|
||||||
_360_JOY_BUTTON_DPAD_DOWN);
|
_360_JOY_BUTTON_DPAD_DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// #define MEMORY_TRACKING
|
|
||||||
|
|
||||||
#if defined(MEMORY_TRACKING)
|
|
||||||
void ResetMem();
|
|
||||||
void DumpMem();
|
|
||||||
void MemPixStuff();
|
|
||||||
#else
|
|
||||||
void MemSect(int sect) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(__linux__)
|
#if !defined(__linux__)
|
||||||
HINSTANCE g_hInst = nullptr;
|
HINSTANCE g_hInst = nullptr;
|
||||||
HWND g_hWnd = nullptr;
|
HWND g_hWnd = nullptr;
|
||||||
|
|
@ -690,14 +680,6 @@ int main(int argc, const char* argv[]) {
|
||||||
|
|
||||||
static bool bTrialTimerDisplayed = true;
|
static bool bTrialTimerDisplayed = true;
|
||||||
|
|
||||||
#if defined(MEMORY_TRACKING)
|
|
||||||
ResetMem();
|
|
||||||
MEMORYSTATUS memStat;
|
|
||||||
GlobalMemoryStatus(&memStat);
|
|
||||||
printf("RESETMEM start: Avail. phys %d\n",
|
|
||||||
memStat.dwAvailPhys / (1024 * 1024));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RenderManager.Initialise();
|
RenderManager.Initialise();
|
||||||
|
|
||||||
// Read the file containing the product codes
|
// Read the file containing the product codes
|
||||||
|
|
@ -797,9 +779,7 @@ int main(int argc, const char* argv[]) {
|
||||||
|
|
||||||
// Tick sentient.
|
// Tick sentient.
|
||||||
PIXBeginNamedEvent(0, "Sentient tick");
|
PIXBeginNamedEvent(0, "Sentient tick");
|
||||||
MemSect(37);
|
|
||||||
// SentientManager.Tick();
|
// SentientManager.Tick();
|
||||||
MemSect(0);
|
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Network manager do work #1");
|
PIXBeginNamedEvent(0, "Network manager do work #1");
|
||||||
|
|
@ -823,9 +803,7 @@ int main(int argc, const char* argv[]) {
|
||||||
g_NetworkManager.GetPlayerCount() == 1 &&
|
g_NetworkManager.GetPlayerCount() == 1 &&
|
||||||
ui.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad()));
|
ui.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad()));
|
||||||
} else {
|
} else {
|
||||||
MemSect(28);
|
|
||||||
pMinecraft->soundEngine->tick(nullptr, 0.0f);
|
pMinecraft->soundEngine->tick(nullptr, 0.0f);
|
||||||
MemSect(0);
|
|
||||||
pMinecraft->textures->tick(true, false);
|
pMinecraft->textures->tick(true, false);
|
||||||
if (app.GetReallyChangingSessionType()) {
|
if (app.GetReallyChangingSessionType()) {
|
||||||
pMinecraft
|
pMinecraft
|
||||||
|
|
@ -842,31 +820,6 @@ int main(int argc, const char* argv[]) {
|
||||||
g_NetworkManager.Initialise();
|
g_NetworkManager.Initialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MEMORY_TRACKING)
|
|
||||||
static bool bResetMemTrack = false;
|
|
||||||
static bool bDumpMemTrack = false;
|
|
||||||
|
|
||||||
MemPixStuff();
|
|
||||||
|
|
||||||
if (bResetMemTrack) {
|
|
||||||
ResetMem();
|
|
||||||
MEMORYSTATUS memStat;
|
|
||||||
GlobalMemoryStatus(&memStat);
|
|
||||||
printf("RESETMEM: Avail. phys %d\n",
|
|
||||||
memStat.dwAvailPhys / (1024 * 1024));
|
|
||||||
bResetMemTrack = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bDumpMemTrack) {
|
|
||||||
DumpMem();
|
|
||||||
bDumpMemTrack = false;
|
|
||||||
MEMORYSTATUS memStat;
|
|
||||||
GlobalMemoryStatus(&memStat);
|
|
||||||
printf("DUMPMEM: Avail. phys %d\n",
|
|
||||||
memStat.dwAvailPhys / (1024 * 1024));
|
|
||||||
printf("Renderer used: %d\n", RenderManager.CBuffSize(-1));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ui.tick();
|
ui.tick();
|
||||||
ui.render();
|
ui.render();
|
||||||
|
|
||||||
|
|
@ -1031,172 +984,3 @@ void FreeRichPresenceStrings() {
|
||||||
}
|
}
|
||||||
vRichPresenceStrings.clear();
|
vRichPresenceStrings.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 // #ifdef MEMORY_TRACKING
|
|
||||||
|
|
||||||
int totalAllocGen = 0;
|
|
||||||
std::unordered_map<int, int> allocCounts;
|
|
||||||
bool trackEnable = false;
|
|
||||||
bool trackStarted = false;
|
|
||||||
volatile size_t sizeCheckMin = 1160;
|
|
||||||
volatile size_t sizeCheckMax = 1160;
|
|
||||||
volatile int sectCheck = 48;
|
|
||||||
std::mutex memCS;
|
|
||||||
uint32_t tlsIdx;
|
|
||||||
|
|
||||||
void* XMemAlloc(size_t dwSize, uint32_t dwAllocAttributes) {
|
|
||||||
if (!trackStarted) {
|
|
||||||
void* p = XMemAllocDefault(dwSize, dwAllocAttributes);
|
|
||||||
size_t realSize = XMemSizeDefault(p, dwAllocAttributes);
|
|
||||||
totalAllocGen += realSize;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
void* p;
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(memCS);
|
|
||||||
|
|
||||||
p = XMemAllocDefault(dwSize + 16, dwAllocAttributes);
|
|
||||||
size_t realSize = XMemSizeDefault(p, dwAllocAttributes) - 16;
|
|
||||||
|
|
||||||
if (trackEnable) {
|
|
||||||
int sect = ((int)TlsGetValue(tlsIdx)) & 0x3f;
|
|
||||||
*(((unsigned char*)p) + realSize) = sect;
|
|
||||||
|
|
||||||
if ((realSize >= sizeCheckMin) && (realSize <= sizeCheckMax) &&
|
|
||||||
((sect == sectCheck) || (sectCheck == -1))) {
|
|
||||||
app.DebugPrintf("Found one\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p) {
|
|
||||||
totalAllocGen += realSize;
|
|
||||||
trackEnable = false;
|
|
||||||
int key = (sect << 26) | realSize;
|
|
||||||
int oldCount = allocCounts[key];
|
|
||||||
allocCounts[key] = oldCount + 1;
|
|
||||||
|
|
||||||
trackEnable = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
void* operator new(size_t size) {
|
|
||||||
return (unsigned char*)XMemAlloc(
|
|
||||||
size, MAKE_XALLOC_ATTRIBUTES(
|
|
||||||
0, false, true, false, 0, XALLOC_PHYSICAL_ALIGNMENT_DEFAULT,
|
|
||||||
XALLOC_MEMPROTECT_READWRITE, false, XALLOC_MEMTYPE_HEAP));
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator delete(void* p) {
|
|
||||||
XMemFree(p, MAKE_XALLOC_ATTRIBUTES(
|
|
||||||
0, false, true, false, 0, XALLOC_PHYSICAL_ALIGNMENT_DEFAULT,
|
|
||||||
XALLOC_MEMPROTECT_READWRITE, false, XALLOC_MEMTYPE_HEAP));
|
|
||||||
}
|
|
||||||
|
|
||||||
void WINAPI XMemFree(void* pAddress, uint32_t dwAllocAttributes) {
|
|
||||||
bool special = false;
|
|
||||||
if (dwAllocAttributes == 0) {
|
|
||||||
dwAllocAttributes = MAKE_XALLOC_ATTRIBUTES(
|
|
||||||
0, false, true, false, 0, XALLOC_PHYSICAL_ALIGNMENT_DEFAULT,
|
|
||||||
XALLOC_MEMPROTECT_READWRITE, false, XALLOC_MEMTYPE_HEAP);
|
|
||||||
special = true;
|
|
||||||
}
|
|
||||||
if (!trackStarted) {
|
|
||||||
size_t realSize = XMemSizeDefault(pAddress, dwAllocAttributes);
|
|
||||||
XMemFreeDefault(pAddress, dwAllocAttributes);
|
|
||||||
totalAllocGen -= realSize;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(memCS);
|
|
||||||
if (pAddress) {
|
|
||||||
size_t realSize = XMemSizeDefault(pAddress, dwAllocAttributes) - 16;
|
|
||||||
|
|
||||||
if (trackEnable) {
|
|
||||||
int sect = *(((unsigned char*)pAddress) + realSize);
|
|
||||||
totalAllocGen -= realSize;
|
|
||||||
trackEnable = false;
|
|
||||||
int key = (sect << 26) | realSize;
|
|
||||||
int oldCount = allocCounts[key];
|
|
||||||
allocCounts[key] = oldCount - 1;
|
|
||||||
trackEnable = true;
|
|
||||||
}
|
|
||||||
XMemFreeDefault(pAddress, dwAllocAttributes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t WINAPI XMemSize(void* pAddress, uint32_t dwAllocAttributes) {
|
|
||||||
if (trackStarted) {
|
|
||||||
return XMemSizeDefault(pAddress, dwAllocAttributes) - 16;
|
|
||||||
} else {
|
|
||||||
return XMemSizeDefault(pAddress, dwAllocAttributes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DumpMem() {
|
|
||||||
int totalLeak = 0;
|
|
||||||
for (auto it = allocCounts.begin(); it != allocCounts.end(); it++) {
|
|
||||||
if (it->second > 0) {
|
|
||||||
app.DebugPrintf("%d %d %d %d\n", (it->first >> 26) & 0x3f,
|
|
||||||
it->first & 0x03ffffff, it->second,
|
|
||||||
(it->first & 0x03ffffff) * it->second);
|
|
||||||
totalLeak += (it->first & 0x03ffffff) * it->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
app.DebugPrintf("Total %d\n", totalLeak);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ResetMem() {
|
|
||||||
if (!trackStarted) {
|
|
||||||
trackEnable = true;
|
|
||||||
trackStarted = true;
|
|
||||||
totalAllocGen = 0;
|
|
||||||
tlsIdx = TlsAlloc();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(memCS);
|
|
||||||
trackEnable = false;
|
|
||||||
allocCounts.clear();
|
|
||||||
trackEnable = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemSect(int section) {
|
|
||||||
unsigned int value = (unsigned int)TlsGetValue(tlsIdx);
|
|
||||||
if (section == 0) // pop
|
|
||||||
{
|
|
||||||
value = (value >> 6) & 0x03ffffff;
|
|
||||||
} else {
|
|
||||||
value = (value << 6) | section;
|
|
||||||
}
|
|
||||||
TlsSetValue(tlsIdx, (void*)value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemPixStuff() {
|
|
||||||
const int MAX_SECT = 46;
|
|
||||||
|
|
||||||
int totals[MAX_SECT] = {0};
|
|
||||||
|
|
||||||
for (auto it = allocCounts.begin(); it != allocCounts.end(); it++) {
|
|
||||||
if (it->second > 0) {
|
|
||||||
int sect = (it->first >> 26) & 0x3f;
|
|
||||||
int bytes = it->first & 0x03ffffff;
|
|
||||||
totals[sect] += bytes * it->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int allSectsTotal = 0;
|
|
||||||
for (int i = 0; i < MAX_SECT; i++) {
|
|
||||||
allSectsTotal += totals[i];
|
|
||||||
PIXAddNamedCounter(((float)totals[i]) / 1024.0f, "MemSect%d", i);
|
|
||||||
}
|
|
||||||
|
|
||||||
PIXAddNamedCounter(((float)allSectsTotal) / (4096.0f),
|
|
||||||
"MemSect total pages");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
|
|
@ -376,16 +376,6 @@ void DefineActions(void) {
|
||||||
_360_JOY_BUTTON_DPAD_DOWN);
|
_360_JOY_BUTTON_DPAD_DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// #define MEMORY_TRACKING
|
|
||||||
|
|
||||||
#if defined(MEMORY_TRACKING)
|
|
||||||
void ResetMem();
|
|
||||||
void DumpMem();
|
|
||||||
void MemPixStuff();
|
|
||||||
#else
|
|
||||||
void MemSect(int sect) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
HINSTANCE g_hInst = nullptr;
|
HINSTANCE g_hInst = nullptr;
|
||||||
HWND g_hWnd = nullptr;
|
HWND g_hWnd = nullptr;
|
||||||
D3D_DRIVER_TYPE g_driverType = D3D_DRIVER_TYPE_NULL;
|
D3D_DRIVER_TYPE g_driverType = D3D_DRIVER_TYPE_NULL;
|
||||||
|
|
@ -717,14 +707,6 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||||
|
|
||||||
static bool bTrialTimerDisplayed = true;
|
static bool bTrialTimerDisplayed = true;
|
||||||
|
|
||||||
#if defined(MEMORY_TRACKING)
|
|
||||||
ResetMem();
|
|
||||||
MEMORYSTATUS memStat;
|
|
||||||
GlobalMemoryStatus(&memStat);
|
|
||||||
printf("RESETMEM start: Avail. phys %d\n",
|
|
||||||
memStat.dwAvailPhys / (1024 * 1024));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
app.loadMediaArchive();
|
app.loadMediaArchive();
|
||||||
|
|
||||||
RenderManager.Initialise(g_pd3dDevice, g_pSwapChain);
|
RenderManager.Initialise(g_pd3dDevice, g_pSwapChain);
|
||||||
|
|
@ -828,9 +810,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||||
|
|
||||||
// Tick sentient.
|
// Tick sentient.
|
||||||
PIXBeginNamedEvent(0, "Sentient tick");
|
PIXBeginNamedEvent(0, "Sentient tick");
|
||||||
MemSect(37);
|
|
||||||
// SentientManager.Tick();
|
// SentientManager.Tick();
|
||||||
MemSect(0);
|
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Network manager do work #1");
|
PIXBeginNamedEvent(0, "Network manager do work #1");
|
||||||
|
|
@ -846,9 +826,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||||
g_NetworkManager.GetPlayerCount() == 1 &&
|
g_NetworkManager.GetPlayerCount() == 1 &&
|
||||||
ui.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad()));
|
ui.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad()));
|
||||||
} else {
|
} else {
|
||||||
MemSect(28);
|
|
||||||
pMinecraft->soundEngine->tick(nullptr, 0.0f);
|
pMinecraft->soundEngine->tick(nullptr, 0.0f);
|
||||||
MemSect(0);
|
|
||||||
pMinecraft->textures->tick(true, false);
|
pMinecraft->textures->tick(true, false);
|
||||||
if (app.GetReallyChangingSessionType()) {
|
if (app.GetReallyChangingSessionType()) {
|
||||||
pMinecraft
|
pMinecraft
|
||||||
|
|
@ -860,31 +838,6 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||||
|
|
||||||
pMinecraft->soundEngine->playMusicTick();
|
pMinecraft->soundEngine->playMusicTick();
|
||||||
|
|
||||||
#if defined(MEMORY_TRACKING)
|
|
||||||
static bool bResetMemTrack = false;
|
|
||||||
static bool bDumpMemTrack = false;
|
|
||||||
|
|
||||||
MemPixStuff();
|
|
||||||
|
|
||||||
if (bResetMemTrack) {
|
|
||||||
ResetMem();
|
|
||||||
MEMORYSTATUS memStat;
|
|
||||||
GlobalMemoryStatus(&memStat);
|
|
||||||
printf("RESETMEM: Avail. phys %d\n",
|
|
||||||
memStat.dwAvailPhys / (1024 * 1024));
|
|
||||||
bResetMemTrack = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bDumpMemTrack) {
|
|
||||||
DumpMem();
|
|
||||||
bDumpMemTrack = false;
|
|
||||||
MEMORYSTATUS memStat;
|
|
||||||
GlobalMemoryStatus(&memStat);
|
|
||||||
printf("DUMPMEM: Avail. phys %d\n",
|
|
||||||
memStat.dwAvailPhys / (1024 * 1024));
|
|
||||||
printf("Renderer used: %d\n", RenderManager.CBuffSize(-1));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ui.tick();
|
ui.tick();
|
||||||
ui.render();
|
ui.render();
|
||||||
// Present the frame.
|
// Present the frame.
|
||||||
|
|
@ -921,172 +874,3 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||||
// app.Uninit();
|
// app.Uninit();
|
||||||
g_pd3dDevice->Release();
|
g_pd3dDevice->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MEMORY_TRACKING)
|
|
||||||
|
|
||||||
int totalAllocGen = 0;
|
|
||||||
std::unordered_map<int, int> allocCounts;
|
|
||||||
bool trackEnable = false;
|
|
||||||
bool trackStarted = false;
|
|
||||||
volatile size_t sizeCheckMin = 1160;
|
|
||||||
volatile size_t sizeCheckMax = 1160;
|
|
||||||
volatile int sectCheck = 48;
|
|
||||||
std::mutex memCS;
|
|
||||||
uint32_t tlsIdx;
|
|
||||||
|
|
||||||
void* XMemAlloc(size_t dwSize, uint32_t dwAllocAttributes) {
|
|
||||||
if (!trackStarted) {
|
|
||||||
void* p = XMemAllocDefault(dwSize, dwAllocAttributes);
|
|
||||||
size_t realSize = XMemSizeDefault(p, dwAllocAttributes);
|
|
||||||
totalAllocGen += realSize;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
void* p;
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(memCS);
|
|
||||||
|
|
||||||
p = XMemAllocDefault(dwSize + 16, dwAllocAttributes);
|
|
||||||
size_t realSize = XMemSizeDefault(p, dwAllocAttributes) - 16;
|
|
||||||
|
|
||||||
if (trackEnable) {
|
|
||||||
int sect = ((int)TlsGetValue(tlsIdx)) & 0x3f;
|
|
||||||
*(((unsigned char*)p) + realSize) = sect;
|
|
||||||
|
|
||||||
if ((realSize >= sizeCheckMin) && (realSize <= sizeCheckMax) &&
|
|
||||||
((sect == sectCheck) || (sectCheck == -1))) {
|
|
||||||
app.DebugPrintf("Found one\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p) {
|
|
||||||
totalAllocGen += realSize;
|
|
||||||
trackEnable = false;
|
|
||||||
int key = (sect << 26) | realSize;
|
|
||||||
int oldCount = allocCounts[key];
|
|
||||||
allocCounts[key] = oldCount + 1;
|
|
||||||
|
|
||||||
trackEnable = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
void* operator new(size_t size) {
|
|
||||||
return (unsigned char*)XMemAlloc(
|
|
||||||
size, MAKE_XALLOC_ATTRIBUTES(
|
|
||||||
0, false, true, false, 0, XALLOC_PHYSICAL_ALIGNMENT_DEFAULT,
|
|
||||||
XALLOC_MEMPROTECT_READWRITE, false, XALLOC_MEMTYPE_HEAP));
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator delete(void* p) {
|
|
||||||
XMemFree(p, MAKE_XALLOC_ATTRIBUTES(
|
|
||||||
0, false, true, false, 0, XALLOC_PHYSICAL_ALIGNMENT_DEFAULT,
|
|
||||||
XALLOC_MEMPROTECT_READWRITE, false, XALLOC_MEMTYPE_HEAP));
|
|
||||||
}
|
|
||||||
|
|
||||||
void WINAPI XMemFree(void* pAddress, uint32_t dwAllocAttributes) {
|
|
||||||
bool special = false;
|
|
||||||
if (dwAllocAttributes == 0) {
|
|
||||||
dwAllocAttributes = MAKE_XALLOC_ATTRIBUTES(
|
|
||||||
0, false, true, false, 0, XALLOC_PHYSICAL_ALIGNMENT_DEFAULT,
|
|
||||||
XALLOC_MEMPROTECT_READWRITE, false, XALLOC_MEMTYPE_HEAP);
|
|
||||||
special = true;
|
|
||||||
}
|
|
||||||
if (!trackStarted) {
|
|
||||||
size_t realSize = XMemSizeDefault(pAddress, dwAllocAttributes);
|
|
||||||
XMemFreeDefault(pAddress, dwAllocAttributes);
|
|
||||||
totalAllocGen -= realSize;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(memCS);
|
|
||||||
if (pAddress) {
|
|
||||||
size_t realSize = XMemSizeDefault(pAddress, dwAllocAttributes) - 16;
|
|
||||||
|
|
||||||
if (trackEnable) {
|
|
||||||
int sect = *(((unsigned char*)pAddress) + realSize);
|
|
||||||
totalAllocGen -= realSize;
|
|
||||||
trackEnable = false;
|
|
||||||
int key = (sect << 26) | realSize;
|
|
||||||
int oldCount = allocCounts[key];
|
|
||||||
allocCounts[key] = oldCount - 1;
|
|
||||||
trackEnable = true;
|
|
||||||
}
|
|
||||||
XMemFreeDefault(pAddress, dwAllocAttributes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t WINAPI XMemSize(void* pAddress, uint32_t dwAllocAttributes) {
|
|
||||||
if (trackStarted) {
|
|
||||||
return XMemSizeDefault(pAddress, dwAllocAttributes) - 16;
|
|
||||||
} else {
|
|
||||||
return XMemSizeDefault(pAddress, dwAllocAttributes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DumpMem() {
|
|
||||||
int totalLeak = 0;
|
|
||||||
for (auto it = allocCounts.begin(); it != allocCounts.end(); it++) {
|
|
||||||
if (it->second > 0) {
|
|
||||||
app.DebugPrintf("%d %d %d %d\n", (it->first >> 26) & 0x3f,
|
|
||||||
it->first & 0x03ffffff, it->second,
|
|
||||||
(it->first & 0x03ffffff) * it->second);
|
|
||||||
totalLeak += (it->first & 0x03ffffff) * it->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
app.DebugPrintf("Total %d\n", totalLeak);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ResetMem() {
|
|
||||||
if (!trackStarted) {
|
|
||||||
trackEnable = true;
|
|
||||||
trackStarted = true;
|
|
||||||
totalAllocGen = 0;
|
|
||||||
tlsIdx = TlsAlloc();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(memCS);
|
|
||||||
trackEnable = false;
|
|
||||||
allocCounts.clear();
|
|
||||||
trackEnable = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemSect(int section) {
|
|
||||||
unsigned int value = (unsigned int)TlsGetValue(tlsIdx);
|
|
||||||
if (section == 0) // pop
|
|
||||||
{
|
|
||||||
value = (value >> 6) & 0x03ffffff;
|
|
||||||
} else {
|
|
||||||
value = (value << 6) | section;
|
|
||||||
}
|
|
||||||
TlsSetValue(tlsIdx, (void*)value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemPixStuff() {
|
|
||||||
const int MAX_SECT = 46;
|
|
||||||
|
|
||||||
int totals[MAX_SECT] = {0};
|
|
||||||
|
|
||||||
for (auto it = allocCounts.begin(); it != allocCounts.end(); it++) {
|
|
||||||
if (it->second > 0) {
|
|
||||||
int sect = (it->first >> 26) & 0x3f;
|
|
||||||
int bytes = it->first & 0x03ffffff;
|
|
||||||
totals[sect] += bytes * it->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int allSectsTotal = 0;
|
|
||||||
for (int i = 0; i < MAX_SECT; i++) {
|
|
||||||
allSectsTotal += totals[i];
|
|
||||||
PIXAddNamedCounter(((float)totals[i]) / 1024.0f, "MemSect%d", i);
|
|
||||||
}
|
|
||||||
|
|
||||||
PIXAddNamedCounter(((float)allSectsTotal) / (4096.0f),
|
|
||||||
"MemSect total pages");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
|
|
@ -282,9 +282,7 @@ void Minecraft::init() {
|
||||||
// Keyboard::create();
|
// Keyboard::create();
|
||||||
Mouse::create();
|
Mouse::create();
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
checkGlError(L"Pre startup");
|
checkGlError(L"Pre startup");
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
// width = Display.getDisplayMode().getWidth();
|
// width = Display.getDisplayMode().getWidth();
|
||||||
// height = Display.getDisplayMode().getHeight();
|
// height = Display.getDisplayMode().getHeight();
|
||||||
|
|
@ -301,9 +299,7 @@ void Minecraft::init() {
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
MemSect(31);
|
|
||||||
checkGlError(L"Startup");
|
checkGlError(L"Startup");
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
// openGLCapabilities = new OpenGLCapabilities(); // 4J - removed
|
// openGLCapabilities = new OpenGLCapabilities(); // 4J - removed
|
||||||
|
|
||||||
|
|
@ -323,9 +319,7 @@ void Minecraft::init() {
|
||||||
// } catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
checkGlError(L"Post startup");
|
checkGlError(L"Post startup");
|
||||||
MemSect(0);
|
|
||||||
gui = new Gui(this);
|
gui = new Gui(this);
|
||||||
|
|
||||||
if (connectToIp != L"") // 4J - was nullptr comparison
|
if (connectToIp != L"") // 4J - was nullptr comparison
|
||||||
|
|
@ -1560,9 +1554,7 @@ void Minecraft::run_middle() {
|
||||||
// // 4J added
|
// // 4J added
|
||||||
}
|
}
|
||||||
// int64_t tickDuraction = System::nanoTime() - beforeTickTime;
|
// int64_t tickDuraction = System::nanoTime() - beforeTickTime;
|
||||||
MemSect(31);
|
|
||||||
checkGlError(L"Pre render");
|
checkGlError(L"Pre render");
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
TileRenderer::fancy = options->fancyGraphics;
|
TileRenderer::fancy = options->fancyGraphics;
|
||||||
|
|
||||||
|
|
@ -1719,9 +1711,7 @@ void Minecraft::run_middle() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
MemSect(31);
|
|
||||||
checkGlError(L"Post render");
|
checkGlError(L"Post render");
|
||||||
MemSect(0);
|
|
||||||
frames++;
|
frames++;
|
||||||
// pause = !isClientSide() && screen != nullptr &&
|
// pause = !isClientSide() && screen != nullptr &&
|
||||||
// screen->isPauseScreen();
|
// screen->isPauseScreen();
|
||||||
|
|
@ -1735,11 +1725,9 @@ void Minecraft::run_middle() {
|
||||||
|
|
||||||
#if !defined(_CONTENT_PACKAGE)
|
#if !defined(_CONTENT_PACKAGE)
|
||||||
while (System::nanoTime() >= lastTime + 1000000000) {
|
while (System::nanoTime() >= lastTime + 1000000000) {
|
||||||
MemSect(31);
|
|
||||||
fpsString = _toString<int>(frames) + L" fps, " +
|
fpsString = _toString<int>(frames) + L" fps, " +
|
||||||
_toString<int>(Chunk::updates) +
|
_toString<int>(Chunk::updates) +
|
||||||
L" chunk updates";
|
L" chunk updates";
|
||||||
MemSect(0);
|
|
||||||
Chunk::updates = 0;
|
Chunk::updates = 0;
|
||||||
lastTime += 1000000000;
|
lastTime += 1000000000;
|
||||||
frames = 0;
|
frames = 0;
|
||||||
|
|
@ -1978,10 +1966,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
|
||||||
// soundEngine.playMusicTick();
|
// soundEngine.playMusicTick();
|
||||||
|
|
||||||
if (!pause && level != nullptr) gameMode->tick();
|
if (!pause && level != nullptr) gameMode->tick();
|
||||||
MemSect(31);
|
|
||||||
glBindTexture(GL_TEXTURE_2D,
|
glBindTexture(GL_TEXTURE_2D,
|
||||||
textures->loadTexture(TN_TERRAIN)); // L"/terrain.png"));
|
textures->loadTexture(TN_TERRAIN)); // L"/terrain.png"));
|
||||||
MemSect(0);
|
|
||||||
if (bFirst) {
|
if (bFirst) {
|
||||||
PIXBeginNamedEvent(0, "Texture tick");
|
PIXBeginNamedEvent(0, "Texture tick");
|
||||||
if (!pause) textures->tick(bUpdateTextures);
|
if (!pause) textures->tick(bUpdateTextures);
|
||||||
|
|
|
||||||
|
|
@ -342,10 +342,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
||||||
// the crosshair
|
// the crosshair
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
if (bDisplayGui) {
|
if (bDisplayGui) {
|
||||||
MemSect(31);
|
|
||||||
minecraft->textures->bindTexture(
|
minecraft->textures->bindTexture(
|
||||||
&GUI_GUI_LOCATION); // 4J was L"/gui/gui.png"
|
&GUI_GUI_LOCATION); // 4J was L"/gui/gui.png"
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
std::shared_ptr<Inventory> inventory = minecraft->player->inventory;
|
std::shared_ptr<Inventory> inventory = minecraft->player->inventory;
|
||||||
if (bTwoPlayerSplitscreen) {
|
if (bTwoPlayerSplitscreen) {
|
||||||
|
|
@ -380,10 +378,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
||||||
0, 22, 24, 22);
|
0, 22, 24, 22);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
minecraft->textures->bindTexture(
|
minecraft->textures->bindTexture(
|
||||||
&GUI_ICONS_LOCATION); // L"/gui/icons.png"));
|
&GUI_ICONS_LOCATION); // L"/gui/icons.png"));
|
||||||
MemSect(0);
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
RenderManager.StateSetBlendFactor(0xffffff |
|
RenderManager.StateSetBlendFactor(0xffffff |
|
||||||
(((unsigned int)fVal) << 24));
|
(((unsigned int)fVal) << 24));
|
||||||
|
|
@ -923,7 +919,6 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
#if !defined(_FINAL_BUILD)
|
#if !defined(_FINAL_BUILD)
|
||||||
MemSect(31);
|
|
||||||
if (minecraft->options->renderDebug) {
|
if (minecraft->options->renderDebug) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
if (Minecraft::warezTime > 0) glTranslatef(0, 32, 0);
|
if (Minecraft::warezTime > 0) glTranslatef(0, 32, 0);
|
||||||
|
|
@ -1032,7 +1027,6 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lastTickA = a;
|
lastTickA = a;
|
||||||
|
|
@ -1191,9 +1185,7 @@ void Gui::renderPumpkin(int w, int h) {
|
||||||
glColor4f(1, 1, 1, 1);
|
glColor4f(1, 1, 1, 1);
|
||||||
glDisable(GL_ALPHA_TEST);
|
glDisable(GL_ALPHA_TEST);
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
minecraft->textures->bindTexture(&PUMPKIN_BLUR_LOCATION);
|
minecraft->textures->bindTexture(&PUMPKIN_BLUR_LOCATION);
|
||||||
MemSect(0);
|
|
||||||
Tesselator* t = Tesselator::getInstance();
|
Tesselator* t = Tesselator::getInstance();
|
||||||
t->begin();
|
t->begin();
|
||||||
t->vertexUV((float)(0), (float)(h), (float)(-90), (float)(0), (float)(1));
|
t->vertexUV((float)(0), (float)(h), (float)(-90), (float)(0), (float)(1));
|
||||||
|
|
@ -1250,10 +1242,8 @@ void Gui::renderTp(float br, int w, int h) {
|
||||||
glDepthMask(false);
|
glDepthMask(false);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glColor4f(1, 1, 1, br);
|
glColor4f(1, 1, 1, br);
|
||||||
MemSect(31);
|
|
||||||
minecraft->textures->bindTexture(
|
minecraft->textures->bindTexture(
|
||||||
&TextureAtlas::LOCATION_BLOCKS); // L"/terrain.png"));
|
&TextureAtlas::LOCATION_BLOCKS); // L"/terrain.png"));
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
Icon* slot = Tile::portalTile->getTexture(Facing::UP);
|
Icon* slot = Tile::portalTile->getTexture(Facing::UP);
|
||||||
float u0 = slot->getU0();
|
float u0 = slot->getU0();
|
||||||
|
|
|
||||||
|
|
@ -197,10 +197,8 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet) {
|
||||||
minecraft->gameMode =
|
minecraft->gameMode =
|
||||||
new TrialMode(ProfileManager.GetPrimaryPad(), minecraft, this);
|
new TrialMode(ProfileManager.GetPrimaryPad(), minecraft, this);
|
||||||
} else {
|
} else {
|
||||||
MemSect(13);
|
|
||||||
minecraft->gameMode = new ConsoleGameMode(
|
minecraft->gameMode = new ConsoleGameMode(
|
||||||
ProfileManager.GetPrimaryPad(), minecraft, this);
|
ProfileManager.GetPrimaryPad(), minecraft, this);
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Level* dimensionLevel = minecraft->getLevel(packet->dimension);
|
Level* dimensionLevel = minecraft->getLevel(packet->dimension);
|
||||||
|
|
|
||||||
|
|
@ -701,9 +701,7 @@ void MultiPlayerLevel::animateTickDoWork() {
|
||||||
// be based on the current player.
|
// be based on the current player.
|
||||||
Minecraft::GetInstance()->animateTickLevel = this;
|
Minecraft::GetInstance()->animateTickLevel = this;
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
Random* animateRandom = new Random();
|
Random* animateRandom = new Random();
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
for (int i = 0; i < ticksPerChunk; i++) {
|
for (int i = 0; i < ticksPerChunk; i++) {
|
||||||
for (auto it = chunksToAnimate.begin(); it != chunksToAnimate.end();
|
for (auto it = chunksToAnimate.begin(); it != chunksToAnimate.end();
|
||||||
|
|
|
||||||
|
|
@ -110,14 +110,12 @@ void ParticleEngine::render(std::shared_ptr<Entity> player, float a, int list) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
if (tt == MISC_TEXTURE || tt == DRAGON_BREATH_TEXTURE)
|
if (tt == MISC_TEXTURE || tt == DRAGON_BREATH_TEXTURE)
|
||||||
textures->bindTexture(&PARTICLES_LOCATION);
|
textures->bindTexture(&PARTICLES_LOCATION);
|
||||||
if (tt == TERRAIN_TEXTURE)
|
if (tt == TERRAIN_TEXTURE)
|
||||||
textures->bindTexture(&TextureAtlas::LOCATION_BLOCKS);
|
textures->bindTexture(&TextureAtlas::LOCATION_BLOCKS);
|
||||||
if (tt == ITEM_TEXTURE)
|
if (tt == ITEM_TEXTURE)
|
||||||
textures->bindTexture(&TextureAtlas::LOCATION_ITEMS);
|
textures->bindTexture(&TextureAtlas::LOCATION_ITEMS);
|
||||||
MemSect(0);
|
|
||||||
Tesselator* t = Tesselator::getInstance();
|
Tesselator* t = Tesselator::getInstance();
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, 1);
|
glColor4f(1.0f, 1.0f, 1.0f, 1);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -463,9 +463,7 @@ void Chunk::rebuild() {
|
||||||
if (!started) {
|
if (!started) {
|
||||||
started = true;
|
started = true;
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
glNewList(lists + currentLayer, GL_COMPILE);
|
glNewList(lists + currentLayer, GL_COMPILE);
|
||||||
MemSect(0);
|
|
||||||
glDepthMask(true); // 4J added
|
glDepthMask(true); // 4J added
|
||||||
t->useCompactVertices(true); // 4J added
|
t->useCompactVertices(true); // 4J added
|
||||||
t->begin();
|
t->begin();
|
||||||
|
|
|
||||||
|
|
@ -253,9 +253,7 @@ void GameRenderer::pick(float a) {
|
||||||
|
|
||||||
double range = mc->gameMode->getPickRange();
|
double range = mc->gameMode->getPickRange();
|
||||||
delete mc->hitResult;
|
delete mc->hitResult;
|
||||||
MemSect(31);
|
|
||||||
mc->hitResult = mc->cameraTargetPlayer->pick(range, a);
|
mc->hitResult = mc->cameraTargetPlayer->pick(range, a);
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
// 4J - added - stop blocks right at the edge of the world from being
|
// 4J - added - stop blocks right at the edge of the world from being
|
||||||
// pickable so we shouldn't be able to directly destroy or create anything
|
// pickable so we shouldn't be able to directly destroy or create anything
|
||||||
|
|
@ -1253,11 +1251,9 @@ void GameRenderer::renderLevel(float a, int64_t until) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Culling");
|
PIXBeginNamedEvent(0, "Culling");
|
||||||
MemSect(31);
|
|
||||||
// Culler *frustum = new FrustumCuller();
|
// Culler *frustum = new FrustumCuller();
|
||||||
FrustumCuller frustObj;
|
FrustumCuller frustObj;
|
||||||
Culler* frustum = &frustObj;
|
Culler* frustum = &frustObj;
|
||||||
MemSect(0);
|
|
||||||
frustum->prepare(xOff, yOff, zOff);
|
frustum->prepare(xOff, yOff, zOff);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -1300,10 +1296,8 @@ void GameRenderer::renderLevel(float a, int64_t until) {
|
||||||
|
|
||||||
setupFog(0, a);
|
setupFog(0, a);
|
||||||
glEnable(GL_FOG);
|
glEnable(GL_FOG);
|
||||||
MemSect(31);
|
|
||||||
mc->textures->bindTexture(
|
mc->textures->bindTexture(
|
||||||
&TextureAtlas::LOCATION_BLOCKS); // 4J was L"/terrain.png"
|
&TextureAtlas::LOCATION_BLOCKS); // 4J was L"/terrain.png"
|
||||||
MemSect(0);
|
|
||||||
Lighting::turnOff();
|
Lighting::turnOff();
|
||||||
PIXBeginNamedEvent(0, "Level render");
|
PIXBeginNamedEvent(0, "Level render");
|
||||||
levelRenderer->render(cameraEntity, 0, a, updateChunks);
|
levelRenderer->render(cameraEntity, 0, a, updateChunks);
|
||||||
|
|
@ -1372,10 +1366,8 @@ void GameRenderer::renderLevel(float a, int64_t until) {
|
||||||
setupFog(0, a);
|
setupFog(0, a);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
MemSect(31);
|
|
||||||
mc->textures->bindTexture(
|
mc->textures->bindTexture(
|
||||||
&TextureAtlas::LOCATION_BLOCKS); // 4J was L"/terrain.png"
|
&TextureAtlas::LOCATION_BLOCKS); // 4J was L"/terrain.png"
|
||||||
MemSect(0);
|
|
||||||
// 4J - have changed this fancy rendering option to work with our
|
// 4J - have changed this fancy rendering option to work with our
|
||||||
// command buffers. The original used to use frame buffer flags to
|
// command buffers. The original used to use frame buffer flags to
|
||||||
// disable writing to colour when doing the z-only pass, but that value
|
// disable writing to colour when doing the z-only pass, but that value
|
||||||
|
|
@ -1573,7 +1565,6 @@ void GameRenderer::tickRain() {
|
||||||
|
|
||||||
if (rainPosSamples > 0 && random->nextInt(3) < rainSoundTime++) {
|
if (rainPosSamples > 0 && random->nextInt(3) < rainSoundTime++) {
|
||||||
rainSoundTime = 0;
|
rainSoundTime = 0;
|
||||||
MemSect(24);
|
|
||||||
if (rainPosY > player->y + 1 &&
|
if (rainPosY > player->y + 1 &&
|
||||||
level->getTopRainBlock(Mth::floor(player->x),
|
level->getTopRainBlock(Mth::floor(player->x),
|
||||||
Mth::floor(player->z)) >
|
Mth::floor(player->z)) >
|
||||||
|
|
@ -1586,7 +1577,6 @@ void GameRenderer::tickRain() {
|
||||||
eSoundType_AMBIENT_WEATHER_RAIN, 0.2f,
|
eSoundType_AMBIENT_WEATHER_RAIN, 0.2f,
|
||||||
1.0f);
|
1.0f);
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1629,10 +1619,8 @@ void GameRenderer::renderSnowAndRain(float a) {
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glAlphaFunc(GL_GREATER, 0.01f);
|
glAlphaFunc(GL_GREATER, 0.01f);
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
mc->textures->bindTexture(
|
mc->textures->bindTexture(
|
||||||
&SNOW_LOCATION); // 4J was L"/environment/snow.png"
|
&SNOW_LOCATION); // 4J was L"/environment/snow.png"
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
double xo = player->xOld + (player->x - player->xOld) * a;
|
double xo = player->xOld + (player->x - player->xOld) * a;
|
||||||
double yo = player->yOld + (player->y - player->yOld) * a;
|
double yo = player->yOld + (player->y - player->yOld) * a;
|
||||||
|
|
|
||||||
|
|
@ -244,10 +244,8 @@ void ItemInHandRenderer::renderItem(std::shared_ptr<LivingEntity> mob,
|
||||||
Tile* tile = Tile::tiles[item->id];
|
Tile* tile = Tile::tiles[item->id];
|
||||||
if (item->getIconType() == Icon::TYPE_TERRAIN && tile != nullptr &&
|
if (item->getIconType() == Icon::TYPE_TERRAIN && tile != nullptr &&
|
||||||
TileRenderer::canRender(tile->getRenderShape())) {
|
TileRenderer::canRender(tile->getRenderShape())) {
|
||||||
MemSect(31);
|
|
||||||
minecraft->textures->bindTexture(
|
minecraft->textures->bindTexture(
|
||||||
minecraft->textures->getTextureLocation(Icon::TYPE_TERRAIN));
|
minecraft->textures->getTextureLocation(Icon::TYPE_TERRAIN));
|
||||||
MemSect(0);
|
|
||||||
tileRenderer->renderTile(
|
tileRenderer->renderTile(
|
||||||
Tile::tiles[item->id], item->getAuxValue(),
|
Tile::tiles[item->id], item->getAuxValue(),
|
||||||
SharedConstants::TEXTURE_LIGHTING
|
SharedConstants::TEXTURE_LIGHTING
|
||||||
|
|
@ -255,11 +253,9 @@ void ItemInHandRenderer::renderItem(std::shared_ptr<LivingEntity> mob,
|
||||||
: mob->getBrightness(
|
: mob->getBrightness(
|
||||||
1)); // 4J - change brought forward from 1.8.2
|
1)); // 4J - change brought forward from 1.8.2
|
||||||
} else {
|
} else {
|
||||||
MemSect(31);
|
|
||||||
Icon* icon = mob->getItemInHandIcon(item, layer);
|
Icon* icon = mob->getItemInHandIcon(item, layer);
|
||||||
if (icon == nullptr) {
|
if (icon == nullptr) {
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
MemSect(0);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -267,7 +263,6 @@ void ItemInHandRenderer::renderItem(std::shared_ptr<LivingEntity> mob,
|
||||||
minecraft->textures->bindTexture(
|
minecraft->textures->bindTexture(
|
||||||
minecraft->textures->getTextureLocation(item->getIconType()));
|
minecraft->textures->getTextureLocation(item->getIconType()));
|
||||||
|
|
||||||
MemSect(0);
|
|
||||||
Tesselator* t = Tesselator::getInstance();
|
Tesselator* t = Tesselator::getInstance();
|
||||||
|
|
||||||
// Consider forcing the mipmap LOD level to use, if this is to be
|
// Consider forcing the mipmap LOD level to use, if this is to be
|
||||||
|
|
@ -555,10 +550,8 @@ void ItemInHandRenderer::render(float a) {
|
||||||
float s = 2 / 128.0f;
|
float s = 2 / 128.0f;
|
||||||
glScalef(s, s, s);
|
glScalef(s, s, s);
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
minecraft->textures->bindTexture(
|
minecraft->textures->bindTexture(
|
||||||
&MAP_BACKGROUND_LOCATION); // 4J was L"/misc/mapbg.png"
|
&MAP_BACKGROUND_LOCATION); // 4J was L"/misc/mapbg.png"
|
||||||
MemSect(0);
|
|
||||||
Tesselator* t = Tesselator::getInstance();
|
Tesselator* t = Tesselator::getInstance();
|
||||||
|
|
||||||
// glNormal3f(0, 0, -1); // 4J - changed to use tesselator
|
// glNormal3f(0, 0, -1); // 4J - changed to use tesselator
|
||||||
|
|
@ -725,11 +718,9 @@ void ItemInHandRenderer::render(float a) {
|
||||||
// minecraft->textures->loadHttpTexture(minecraft->player->customTextureUrl,
|
// minecraft->textures->loadHttpTexture(minecraft->player->customTextureUrl,
|
||||||
// minecraft->player->getTexture()));
|
// minecraft->player->getTexture()));
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, minecraft->textures->loadMemTexture(
|
glBindTexture(GL_TEXTURE_2D, minecraft->textures->loadMemTexture(
|
||||||
minecraft->player->customTextureUrl,
|
minecraft->player->customTextureUrl,
|
||||||
minecraft->player->getTexture()));
|
minecraft->player->getTexture()));
|
||||||
MemSect(0);
|
|
||||||
minecraft->textures->clearLastBoundId();
|
minecraft->textures->clearLastBoundId();
|
||||||
glTranslatef(-1.0f, +3.6f, +3.5f);
|
glTranslatef(-1.0f, +3.6f, +3.5f);
|
||||||
glRotatef(120, 0, 0, 1);
|
glRotatef(120, 0, 0, 1);
|
||||||
|
|
@ -743,7 +734,6 @@ void ItemInHandRenderer::render(float a) {
|
||||||
PlayerRenderer* playerRenderer = (PlayerRenderer*)er;
|
PlayerRenderer* playerRenderer = (PlayerRenderer*)er;
|
||||||
float ss = 1;
|
float ss = 1;
|
||||||
glScalef(ss, ss, ss);
|
glScalef(ss, ss, ss);
|
||||||
MemSect(31);
|
|
||||||
// Can't turn off the hand if the player is holding a map
|
// Can't turn off the hand if the player is holding a map
|
||||||
std::shared_ptr<ItemInstance> itemInstance =
|
std::shared_ptr<ItemInstance> itemInstance =
|
||||||
player->inventory->getSelected();
|
player->inventory->getSelected();
|
||||||
|
|
@ -753,7 +743,6 @@ void ItemInHandRenderer::render(float a) {
|
||||||
eGameSetting_DisplayHand) != 0) {
|
eGameSetting_DisplayHand) != 0) {
|
||||||
playerRenderer->renderHand();
|
playerRenderer->renderHand();
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -798,10 +787,8 @@ void ItemInHandRenderer::renderScreenEffect(float a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minecraft->player->isUnderLiquid(Material::water)) {
|
if (minecraft->player->isUnderLiquid(Material::water)) {
|
||||||
MemSect(31);
|
|
||||||
minecraft->textures->bindTexture(
|
minecraft->textures->bindTexture(
|
||||||
&UNDERWATER_LOCATION); // 4J was L"/misc/water.png"
|
&UNDERWATER_LOCATION); // 4J was L"/misc/water.png"
|
||||||
MemSect(0);
|
|
||||||
renderWater(a);
|
renderWater(a);
|
||||||
}
|
}
|
||||||
glEnable(GL_ALPHA_TEST);
|
glEnable(GL_ALPHA_TEST);
|
||||||
|
|
|
||||||
|
|
@ -989,9 +989,7 @@ void LevelRenderer::renderSky(float alpha) {
|
||||||
glRotatef(level[playerIndex]->getTimeOfDay(alpha) * 360, 1, 0, 0);
|
glRotatef(level[playerIndex]->getTimeOfDay(alpha) * 360, 1, 0, 0);
|
||||||
float ss = 30;
|
float ss = 30;
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
textures->bindTexture(&SUN_LOCATION);
|
textures->bindTexture(&SUN_LOCATION);
|
||||||
MemSect(0);
|
|
||||||
t->begin();
|
t->begin();
|
||||||
t->vertexUV((float)(-ss), (float)(100), (float)(-ss), (float)(0),
|
t->vertexUV((float)(-ss), (float)(100), (float)(-ss), (float)(0),
|
||||||
(float)(0));
|
(float)(0));
|
||||||
|
|
@ -1441,10 +1439,8 @@ void LevelRenderer::renderAdvancedClouds(float alpha) {
|
||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
textures->bindTexture(
|
textures->bindTexture(
|
||||||
&CLOUDS_LOCATION); // 4J was L"/environment/clouds.png"
|
&CLOUDS_LOCATION); // 4J was L"/environment/clouds.png"
|
||||||
MemSect(0);
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -662,7 +662,6 @@ void Textures::loadTexture(BufferedImage* img, int id, bool blur, bool clamp) {
|
||||||
// printf("Textures::loadTexture BufferedImage with blur and clamp
|
// printf("Textures::loadTexture BufferedImage with blur and clamp
|
||||||
//%d\n",id);
|
//%d\n",id);
|
||||||
int iMipLevels = 1;
|
int iMipLevels = 1;
|
||||||
MemSect(33);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, id);
|
glBindTexture(GL_TEXTURE_2D, id);
|
||||||
|
|
||||||
if (MIPMAP) {
|
if (MIPMAP) {
|
||||||
|
|
@ -802,7 +801,6 @@ void Textures::loadTexture(BufferedImage* img, int id, bool blur, bool clamp) {
|
||||||
* GL_RGBA, GL_UNSIGNED_BYTE, pixels); } else { }
|
* GL_RGBA, GL_UNSIGNED_BYTE, pixels); } else { }
|
||||||
*/
|
*/
|
||||||
delete pixels; // 4J - now creating this dynamically
|
delete pixels; // 4J - now creating this dynamically
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> Textures::anaglyph(std::vector<int>& rawPixels) {
|
std::vector<int> Textures::anaglyph(std::vector<int>& rawPixels) {
|
||||||
|
|
@ -1122,7 +1120,6 @@ void Textures::tick(
|
||||||
bool updateTextures,
|
bool updateTextures,
|
||||||
bool tickDynamics) // 4J added updateTextures parameter & tickDynamics
|
bool tickDynamics) // 4J added updateTextures parameter & tickDynamics
|
||||||
{
|
{
|
||||||
MemSect(22);
|
|
||||||
if (tickDynamics) {
|
if (tickDynamics) {
|
||||||
// 4J - added - if we aren't updating the final renderer textures, just
|
// 4J - added - if we aren't updating the final renderer textures, just
|
||||||
// tick each of the dynamic textures instead. This is used so that in
|
// tick each of the dynamic textures instead. This is used so that in
|
||||||
|
|
@ -1130,7 +1127,6 @@ void Textures::tick(
|
||||||
// that we don't lock the renderer textures twice needlessly and force
|
// that we don't lock the renderer textures twice needlessly and force
|
||||||
// the CPU to sync with the GPU.
|
// the CPU to sync with the GPU.
|
||||||
if (!updateTextures) {
|
if (!updateTextures) {
|
||||||
MemSect(0);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1159,7 +1155,6 @@ void Textures::tick(
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Textures::reloadAll() {
|
void Textures::reloadAll() {
|
||||||
|
|
@ -1208,7 +1203,6 @@ BufferedImage* Textures::readImage(
|
||||||
TEXTURE_NAME texId, const std::wstring& name) // 4J was InputStream *in
|
TEXTURE_NAME texId, const std::wstring& name) // 4J was InputStream *in
|
||||||
{
|
{
|
||||||
BufferedImage* img = nullptr;
|
BufferedImage* img = nullptr;
|
||||||
MemSect(32);
|
|
||||||
// is this image one of the Title Update ones?
|
// is this image one of the Title Update ones?
|
||||||
bool isTu = IsTUImage(texId, name);
|
bool isTu = IsTUImage(texId, name);
|
||||||
std::wstring drive = L"";
|
std::wstring drive = L"";
|
||||||
|
|
@ -1239,7 +1233,6 @@ BufferedImage* Textures::readImage(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MemSect(0);
|
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,9 +82,7 @@ void EntityRenderer::renderFlame(std::shared_ptr<Entity> e, double x, double y,
|
||||||
|
|
||||||
float s = e->bbWidth * 1.4f;
|
float s = e->bbWidth * 1.4f;
|
||||||
glScalef(s, s, s);
|
glScalef(s, s, s);
|
||||||
MemSect(31);
|
|
||||||
bindTexture(&TextureAtlas::LOCATION_BLOCKS);
|
bindTexture(&TextureAtlas::LOCATION_BLOCKS);
|
||||||
MemSect(0);
|
|
||||||
Tesselator* t = Tesselator::getInstance();
|
Tesselator* t = Tesselator::getInstance();
|
||||||
|
|
||||||
float r = 0.5f;
|
float r = 0.5f;
|
||||||
|
|
@ -142,9 +140,7 @@ void EntityRenderer::renderShadow(std::shared_ptr<Entity> e, double x, double y,
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
entityRenderDispatcher->textures->bindTexture(&SHADOW_LOCATION);
|
entityRenderDispatcher->textures->bindTexture(&SHADOW_LOCATION);
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
Level* level = getLevel();
|
Level* level = getLevel();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,7 @@ void FireballRenderer::render(std::shared_ptr<Entity> _fireball, double x,
|
||||||
glScalef(s / 1.0f, s / 1.0f, s / 1.0f);
|
glScalef(s / 1.0f, s / 1.0f, s / 1.0f);
|
||||||
Icon* icon = Item::fireball->getIcon(
|
Icon* icon = Item::fireball->getIcon(
|
||||||
fireball->GetType() == eTYPE_DRAGON_FIREBALL ? 1 : 0); // 14 + 2 * 16;
|
fireball->GetType() == eTYPE_DRAGON_FIREBALL ? 1 : 0); // 14 + 2 * 16;
|
||||||
MemSect(31);
|
|
||||||
bindTexture(fireball);
|
bindTexture(fireball);
|
||||||
MemSect(0);
|
|
||||||
Tesselator* t = Tesselator::getInstance();
|
Tesselator* t = Tesselator::getInstance();
|
||||||
|
|
||||||
float u0 = icon->getU0();
|
float u0 = icon->getU0();
|
||||||
|
|
@ -68,9 +66,7 @@ void FireballRenderer::renderFlame(std::shared_ptr<Entity> e, double x,
|
||||||
|
|
||||||
float s = e->bbWidth * 1.4f;
|
float s = e->bbWidth * 1.4f;
|
||||||
glScalef(s, s, s);
|
glScalef(s, s, s);
|
||||||
MemSect(31);
|
|
||||||
bindTexture(&TextureAtlas::LOCATION_BLOCKS);
|
bindTexture(&TextureAtlas::LOCATION_BLOCKS);
|
||||||
MemSect(0);
|
|
||||||
Tesselator* t = Tesselator::getInstance();
|
Tesselator* t = Tesselator::getInstance();
|
||||||
|
|
||||||
float r = 1.0f;
|
float r = 1.0f;
|
||||||
|
|
|
||||||
|
|
@ -342,9 +342,7 @@ void ItemRenderer::renderGuiItem(Font* font, Textures* textures,
|
||||||
if (item->getIconType() == Icon::TYPE_TERRAIN &&
|
if (item->getIconType() == Icon::TYPE_TERRAIN &&
|
||||||
TileRenderer::canRender(Tile::tiles[itemId]->getRenderShape())) {
|
TileRenderer::canRender(Tile::tiles[itemId]->getRenderShape())) {
|
||||||
PIXBeginNamedEvent(0, "3D gui item render %d\n", itemId);
|
PIXBeginNamedEvent(0, "3D gui item render %d\n", itemId);
|
||||||
MemSect(31);
|
|
||||||
textures->bindTexture(&TextureAtlas::LOCATION_BLOCKS);
|
textures->bindTexture(&TextureAtlas::LOCATION_BLOCKS);
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
Tile* tile = Tile::tiles[itemId];
|
Tile* tile = Tile::tiles[itemId];
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
@ -397,7 +395,6 @@ void ItemRenderer::renderGuiItem(Font* font, Textures* textures,
|
||||||
} else {
|
} else {
|
||||||
PIXBeginNamedEvent(0, "2D gui item render %d\n", itemIcon);
|
PIXBeginNamedEvent(0, "2D gui item render %d\n", itemIcon);
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
MemSect(31);
|
|
||||||
if (item->getIconType() == Icon::TYPE_TERRAIN) {
|
if (item->getIconType() == Icon::TYPE_TERRAIN) {
|
||||||
textures->bindTexture(
|
textures->bindTexture(
|
||||||
&TextureAtlas::LOCATION_BLOCKS); // L"/terrain.png"));
|
&TextureAtlas::LOCATION_BLOCKS); // L"/terrain.png"));
|
||||||
|
|
@ -405,7 +402,6 @@ void ItemRenderer::renderGuiItem(Font* font, Textures* textures,
|
||||||
textures->bindTexture(
|
textures->bindTexture(
|
||||||
&TextureAtlas::LOCATION_ITEMS); // L"/gui/items.png"));
|
&TextureAtlas::LOCATION_ITEMS); // L"/gui/items.png"));
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
if (itemIcon == nullptr) {
|
if (itemIcon == nullptr) {
|
||||||
itemIcon = textures->getMissingIcon(item->getIconType());
|
itemIcon = textures->getMissingIcon(item->getIconType());
|
||||||
|
|
@ -583,7 +579,6 @@ void ItemRenderer::renderGuiItemDecorations(Font* font, Textures* textures,
|
||||||
|
|
||||||
if (item->count > 1 || !countText.empty() ||
|
if (item->count > 1 || !countText.empty() ||
|
||||||
item->GetForceNumberDisplay()) {
|
item->GetForceNumberDisplay()) {
|
||||||
MemSect(31);
|
|
||||||
std::wstring amount = countText;
|
std::wstring amount = countText;
|
||||||
if (amount.empty()) {
|
if (amount.empty()) {
|
||||||
int count = item->count;
|
int count = item->count;
|
||||||
|
|
@ -593,7 +588,6 @@ void ItemRenderer::renderGuiItemDecorations(Font* font, Textures* textures,
|
||||||
amount = _toString<int>(item->count);
|
amount = _toString<int>(item->count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
font->drawShadow(amount, x + 19 - 2 - font->width(amount), y + 6 + 3,
|
font->drawShadow(amount, x + 19 - 2 - font->width(amount), y + 6 + 3,
|
||||||
|
|
|
||||||
|
|
@ -219,9 +219,7 @@ void LivingEntityRenderer::render(std::shared_ptr<Entity> _mob, double x,
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
renderName(mob, x, y, z);
|
renderName(mob, x, y, z);
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LivingEntityRenderer::renderModel(std::shared_ptr<LivingEntity> mob,
|
void LivingEntityRenderer::renderModel(std::shared_ptr<LivingEntity> mob,
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,7 @@ int PigRenderer::prepareArmor(std::shared_ptr<LivingEntity> _pig, int layer,
|
||||||
std::shared_ptr<Pig> pig = std::dynamic_pointer_cast<Pig>(_pig);
|
std::shared_ptr<Pig> pig = std::dynamic_pointer_cast<Pig>(_pig);
|
||||||
|
|
||||||
if (layer == 0 && pig->hasSaddle()) {
|
if (layer == 0 && pig->hasSaddle()) {
|
||||||
MemSect(31);
|
|
||||||
bindTexture(&SADDLE_LOCATION);
|
bindTexture(&SADDLE_LOCATION);
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,7 @@ int SheepRenderer::prepareArmor(std::shared_ptr<LivingEntity> _sheep, int layer,
|
||||||
->player)) // 4J-JEV: Todo, merge with java fix (for invisible
|
->player)) // 4J-JEV: Todo, merge with java fix (for invisible
|
||||||
// sheep armour) in '1.7.5'.
|
// sheep armour) in '1.7.5'.
|
||||||
{
|
{
|
||||||
MemSect(31);
|
|
||||||
bindTexture(&SHEEP_FUR_LOCATION);
|
bindTexture(&SHEEP_FUR_LOCATION);
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
if (sheep->hasCustomName() &&
|
if (sheep->hasCustomName() &&
|
||||||
sheep->getCustomName().compare(L"jeb_") == 0) {
|
sheep->getCustomName().compare(L"jeb_") == 0) {
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,7 @@ int SpiderRenderer::prepareArmor(std::shared_ptr<LivingEntity> _spider,
|
||||||
std::shared_ptr<Spider> spider = std::dynamic_pointer_cast<Spider>(_spider);
|
std::shared_ptr<Spider> spider = std::dynamic_pointer_cast<Spider>(_spider);
|
||||||
|
|
||||||
if (layer != 0) return -1;
|
if (layer != 0) return -1;
|
||||||
MemSect(31);
|
|
||||||
bindTexture(&SPIDER_EYES_LOCATION);
|
bindTexture(&SPIDER_EYES_LOCATION);
|
||||||
MemSect(0);
|
|
||||||
// 4J - changes brought forward from 1.8.2
|
// 4J - changes brought forward from 1.8.2
|
||||||
float br = 1.0f; // was (1-spider->getBrightness(1))*0.5f;
|
float br = 1.0f; // was (1-spider->getBrightness(1))*0.5f;
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,6 @@ void PreStitchedTextureMap::stitch() {
|
||||||
int minFilter = Texture::TFLT_NEAREST;
|
int minFilter = Texture::TFLT_NEAREST;
|
||||||
int magFilter = Texture::TFLT_NEAREST;
|
int magFilter = Texture::TFLT_NEAREST;
|
||||||
|
|
||||||
MemSect(32);
|
|
||||||
std::wstring drive = L"";
|
std::wstring drive = L"";
|
||||||
|
|
||||||
// 4J-PB - need to check for BD patched files
|
// 4J-PB - need to check for BD patched files
|
||||||
|
|
@ -104,7 +103,6 @@ void PreStitchedTextureMap::stitch() {
|
||||||
// //ImageIO::read(texturePack->getResource(L"/" + filename));
|
// //ImageIO::read(texturePack->getResource(L"/" + filename));
|
||||||
BufferedImage* image =
|
BufferedImage* image =
|
||||||
texturePack->getImageResource(filename, false, true, drive);
|
texturePack->getImageResource(filename, false, true, drive);
|
||||||
MemSect(0);
|
|
||||||
int height = image->getHeight();
|
int height = image->getHeight();
|
||||||
int width = image->getWidth();
|
int width = image->getWidth();
|
||||||
|
|
||||||
|
|
@ -130,13 +128,11 @@ void PreStitchedTextureMap::stitch() {
|
||||||
preStitched->init(stitchResult, nullptr, x, y, width, height, false);
|
preStitched->init(stitchResult, nullptr, x, y, width, height, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemSect(52);
|
|
||||||
for (auto it = texturesByName.begin(); it != texturesByName.end(); ++it) {
|
for (auto it = texturesByName.begin(); it != texturesByName.end(); ++it) {
|
||||||
StitchedTexture* preStitched = (StitchedTexture*)(it->second);
|
StitchedTexture* preStitched = (StitchedTexture*)(it->second);
|
||||||
|
|
||||||
makeTextureAnimated(texturePack, preStitched);
|
makeTextureAnimated(texturePack, preStitched);
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
// missingPosition = (StitchedTexture
|
// missingPosition = (StitchedTexture
|
||||||
// *)texturesByName.find(NAME_MISSING_TEXTURE)->second;
|
// *)texturesByName.find(NAME_MISSING_TEXTURE)->second;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -381,9 +381,7 @@ void Texture::transferFromImage(BufferedImage* image) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MemSect(51);
|
|
||||||
data[0] = ByteBuffer::allocateDirect(tempBytes.size());
|
data[0] = ByteBuffer::allocateDirect(tempBytes.size());
|
||||||
MemSect(0);
|
|
||||||
data[0]->clear();
|
data[0]->clear();
|
||||||
data[0]->put(tempBytes);
|
data[0]->put(tempBytes);
|
||||||
data[0]->limit(tempBytes.size());
|
data[0]->limit(tempBytes.size());
|
||||||
|
|
@ -465,9 +463,7 @@ void Texture::transferFromImage(BufferedImage* image) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MemSect(51);
|
|
||||||
data[level] = ByteBuffer::allocateDirect(tempBytes.size());
|
data[level] = ByteBuffer::allocateDirect(tempBytes.size());
|
||||||
MemSect(0);
|
|
||||||
data[level]->clear();
|
data[level]->clear();
|
||||||
data[level]->put(tempBytes);
|
data[level]->put(tempBytes);
|
||||||
data[level]->limit(tempBytes.size());
|
data[level]->limit(tempBytes.size());
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,6 @@ std::vector<Texture*>* TextureManager::createTextures(
|
||||||
int minFilter = Texture::TFLT_NEAREST;
|
int minFilter = Texture::TFLT_NEAREST;
|
||||||
int magFilter = Texture::TFLT_NEAREST;
|
int magFilter = Texture::TFLT_NEAREST;
|
||||||
|
|
||||||
MemSect(32);
|
|
||||||
std::wstring drive = L"";
|
std::wstring drive = L"";
|
||||||
|
|
||||||
if (texturePack->hasFile(L"res/" + filename, false)) {
|
if (texturePack->hasFile(L"res/" + filename, false)) {
|
||||||
|
|
@ -99,7 +98,6 @@ std::vector<Texture*>* TextureManager::createTextures(
|
||||||
|
|
||||||
BufferedImage* image =
|
BufferedImage* image =
|
||||||
texturePack->getImageResource(filename, false, true, drive);
|
texturePack->getImageResource(filename, false, true, drive);
|
||||||
MemSect(0);
|
|
||||||
int height = image->getHeight();
|
int height = image->getHeight();
|
||||||
int width = image->getWidth();
|
int width = image->getWidth();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -245,9 +245,7 @@ void PlayerList::placeNewPlayer(Connection* connection,
|
||||||
broadcastAll(std::shared_ptr<ChatPacket>(
|
broadcastAll(std::shared_ptr<ChatPacket>(
|
||||||
new ChatPacket(player->name, ChatPacket::e_ChatPlayerJoinedGame)));
|
new ChatPacket(player->name, ChatPacket::e_ChatPlayerJoinedGame)));
|
||||||
|
|
||||||
MemSect(14);
|
|
||||||
add(player);
|
add(player);
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
player->doTick(
|
player->doTick(
|
||||||
true, true,
|
true, true,
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,7 @@ bool Settings::getBoolean(const std::wstring& key, bool defaultValue) {
|
||||||
properties[key] = _toString<bool>(defaultValue);
|
properties[key] = _toString<bool>(defaultValue);
|
||||||
saveProperties();
|
saveProperties();
|
||||||
}
|
}
|
||||||
MemSect(35);
|
|
||||||
bool retval = _fromString<bool>(properties[key]);
|
bool retval = _fromString<bool>(properties[key]);
|
||||||
MemSect(0);
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -315,18 +315,14 @@ void ServerLevel::tick() {
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Tick tiles");
|
PIXBeginNamedEvent(0, "Tick tiles");
|
||||||
MemSect(18);
|
|
||||||
tickTiles();
|
tickTiles();
|
||||||
MemSect(0);
|
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
|
|
||||||
chunkMap->tick();
|
chunkMap->tick();
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Tick villages");
|
PIXBeginNamedEvent(0, "Tick villages");
|
||||||
// MemSect(18);
|
|
||||||
villages->tick();
|
villages->tick();
|
||||||
villageSiege->tick();
|
villageSiege->tick();
|
||||||
// MemSect(0);
|
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Tick portal forcer");
|
PIXBeginNamedEvent(0, "Tick portal forcer");
|
||||||
|
|
@ -577,7 +573,6 @@ void ServerLevel::addToTickNextTick(int x, int y, int z, int tileId,
|
||||||
|
|
||||||
void ServerLevel::addToTickNextTick(int x, int y, int z, int tileId,
|
void ServerLevel::addToTickNextTick(int x, int y, int z, int tileId,
|
||||||
int tickDelay, int priorityTilt) {
|
int tickDelay, int priorityTilt) {
|
||||||
MemSect(27);
|
|
||||||
TickNextTickData td = TickNextTickData(x, y, z, tileId);
|
TickNextTickData td = TickNextTickData(x, y, z, tileId);
|
||||||
int r = 0;
|
int r = 0;
|
||||||
if (getInstaTick() && tileId > 0) {
|
if (getInstaTick() && tileId > 0) {
|
||||||
|
|
@ -590,7 +585,6 @@ void ServerLevel::addToTickNextTick(int x, int y, int z, int tileId,
|
||||||
Tile::tiles[id]->tick(this, td.x, td.y, td.z, random);
|
Tile::tiles[id]->tick(this, td.x, td.y, td.z, random);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
tickDelay = 1;
|
tickDelay = 1;
|
||||||
|
|
@ -610,7 +604,6 @@ void ServerLevel::addToTickNextTick(int x, int y, int z, int tileId,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerLevel::forceAddTileTick(int x, int y, int z, int tileId,
|
void ServerLevel::forceAddTileTick(int x, int y, int z, int tileId,
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,7 @@ void ServerLevelListener::addParticle(ePARTICLE_TYPE name, double x, double y,
|
||||||
void ServerLevelListener::allChanged() {}
|
void ServerLevelListener::allChanged() {}
|
||||||
|
|
||||||
void ServerLevelListener::entityAdded(std::shared_ptr<Entity> entity) {
|
void ServerLevelListener::entityAdded(std::shared_ptr<Entity> entity) {
|
||||||
MemSect(10);
|
|
||||||
level->getTracker()->addEntity(entity);
|
level->getTracker()->addEntity(entity);
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerLevelListener::entityRemoved(std::shared_ptr<Entity> entity) {
|
void ServerLevelListener::entityRemoved(std::shared_ptr<Entity> entity) {
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,6 @@
|
||||||
#define OutputDebugStringW BREAKTHECOMPILE
|
#define OutputDebugStringW BREAKTHECOMPILE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void MemSect(int sect);
|
|
||||||
|
|
||||||
#ifdef _WINDOWS64
|
#ifdef _WINDOWS64
|
||||||
#include "Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Profile.h"
|
#include "Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Profile.h"
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,6 @@ void Connection::setListener(PacketListener* packetListener) {
|
||||||
void Connection::send(std::shared_ptr<Packet> packet) {
|
void Connection::send(std::shared_ptr<Packet> packet) {
|
||||||
if (quitting) return;
|
if (quitting) return;
|
||||||
|
|
||||||
MemSect(15);
|
|
||||||
// 4J Jev, synchronized (&writeLock)
|
// 4J Jev, synchronized (&writeLock)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(writeLock);
|
std::lock_guard<std::mutex> lock(writeLock);
|
||||||
|
|
@ -156,7 +155,6 @@ void Connection::send(std::shared_ptr<Packet> packet) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J Jev, end synchronized.
|
// 4J Jev, end synchronized.
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::queueSend(std::shared_ptr<Packet> packet) {
|
void Connection::queueSend(std::shared_ptr<Packet> packet) {
|
||||||
|
|
@ -549,7 +547,6 @@ int Connection::runRead(void* lpParam) {
|
||||||
|
|
||||||
// try {
|
// try {
|
||||||
|
|
||||||
MemSect(19);
|
|
||||||
while (
|
while (
|
||||||
con->running && !con->quitting &&
|
con->running && !con->quitting &&
|
||||||
ShutdownManager::ShouldRun(ShutdownManager::eConnectionReadThreads)) {
|
ShutdownManager::ShouldRun(ShutdownManager::eConnectionReadThreads)) {
|
||||||
|
|
@ -561,7 +558,6 @@ int Connection::runRead(void* lpParam) {
|
||||||
// whether we should do that as well
|
// whether we should do that as well
|
||||||
con->m_hWakeReadThread->waitForSignal(100L);
|
con->m_hWakeReadThread->waitForSignal(100L);
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
/* 4J JEV, removed try/catch
|
/* 4J JEV, removed try/catch
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|
|
||||||
|
|
@ -78,9 +78,7 @@ void AddMobPacket::read(DataInputStream* dis) // throws IOException
|
||||||
xd = dis->readShort();
|
xd = dis->readShort();
|
||||||
yd = dis->readShort();
|
yd = dis->readShort();
|
||||||
zd = dis->readShort();
|
zd = dis->readShort();
|
||||||
MemSect(1);
|
|
||||||
unpack = SynchedEntityData::unpack(dis);
|
unpack = SynchedEntityData::unpack(dis);
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddMobPacket::write(DataOutputStream* dos) // throws IOException
|
void AddMobPacket::write(DataOutputStream* dos) // throws IOException
|
||||||
|
|
|
||||||
|
|
@ -85,9 +85,7 @@ void AddPlayerPacket::read(DataInputStream* dis) // throws IOException
|
||||||
m_capeId = *(uint32_t*)&capeId;
|
m_capeId = *(uint32_t*)&capeId;
|
||||||
int32_t privileges = dis->readInt();
|
int32_t privileges = dis->readInt();
|
||||||
m_uiGamePrivileges = *(unsigned int*)&privileges;
|
m_uiGamePrivileges = *(unsigned int*)&privileges;
|
||||||
MemSect(1);
|
|
||||||
unpack = SynchedEntityData::unpack(dis);
|
unpack = SynchedEntityData::unpack(dis);
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddPlayerPacket::write(DataOutputStream* dos) // throws IOException
|
void AddPlayerPacket::write(DataOutputStream* dos) // throws IOException
|
||||||
|
|
|
||||||
|
|
@ -56,9 +56,7 @@ BlockRegionUpdatePacket::BlockRegionUpdatePacket(int x, int y, int z, int xs,
|
||||||
rawBuffer = lc->getReorderedBlocksAndData(x & 0xF, y, z & 0xF, xs,
|
rawBuffer = lc->getReorderedBlocksAndData(x & 0xF, y, z & 0xF, xs,
|
||||||
this->ys, zs);
|
this->ys, zs);
|
||||||
} else {
|
} else {
|
||||||
MemSect(50);
|
|
||||||
rawBuffer = level->getBlocksAndData(x, y, z, xs, ys, zs, false);
|
rawBuffer = level->getBlocksAndData(x, y, z, xs, ys, zs, false);
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rawBuffer.size() == 0) {
|
if (rawBuffer.size() == 0) {
|
||||||
|
|
|
||||||
|
|
@ -99,9 +99,7 @@ void LivingEntity::_init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
LivingEntity::LivingEntity(Level* level) : Entity(level) {
|
LivingEntity::LivingEntity(Level* level) : Entity(level) {
|
||||||
MemSect(56);
|
|
||||||
_init();
|
_init();
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
// 4J Stu - This will not call the correct derived function, so moving to
|
// 4J Stu - This will not call the correct derived function, so moving to
|
||||||
// each derived class
|
// each derived class
|
||||||
|
|
@ -775,7 +773,6 @@ bool LivingEntity::hurt(DamageSource* source, float dmg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
if (getHealth() <= 0) {
|
if (getHealth() <= 0) {
|
||||||
if (sound)
|
if (sound)
|
||||||
playSound(getDeathSound(), getSoundVolume(), getVoicePitch());
|
playSound(getDeathSound(), getSoundVolume(), getVoicePitch());
|
||||||
|
|
@ -783,7 +780,6 @@ bool LivingEntity::hurt(DamageSource* source, float dmg) {
|
||||||
} else {
|
} else {
|
||||||
if (sound) playSound(getHurtSound(), getSoundVolume(), getVoicePitch());
|
if (sound) playSound(getHurtSound(), getSoundVolume(), getVoicePitch());
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -930,10 +926,8 @@ void LivingEntity::causeFallDamage(float distance) {
|
||||||
Mth::floor(z));
|
Mth::floor(z));
|
||||||
if (t > 0) {
|
if (t > 0) {
|
||||||
const Tile::SoundType* soundType = Tile::tiles[t]->soundType;
|
const Tile::SoundType* soundType = Tile::tiles[t]->soundType;
|
||||||
MemSect(31);
|
|
||||||
playSound(soundType->getStepSound(), soundType->getVolume() * 0.5f,
|
playSound(soundType->getStepSound(), soundType->getVolume() * 0.5f,
|
||||||
soundType->getPitch() * 0.75f);
|
soundType->getPitch() * 0.75f);
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1080,7 +1074,6 @@ void LivingEntity::handleEntityEvent(uint8_t id) {
|
||||||
hurtTime = hurtDuration = 10;
|
hurtTime = hurtDuration = 10;
|
||||||
hurtDir = 0;
|
hurtDir = 0;
|
||||||
|
|
||||||
MemSect(31);
|
|
||||||
// 4J-PB -added because villagers have no sounds
|
// 4J-PB -added because villagers have no sounds
|
||||||
int iHurtSound = getHurtSound();
|
int iHurtSound = getHurtSound();
|
||||||
if (iHurtSound != -1) {
|
if (iHurtSound != -1) {
|
||||||
|
|
@ -1088,10 +1081,8 @@ void LivingEntity::handleEntityEvent(uint8_t id) {
|
||||||
iHurtSound, getSoundVolume(),
|
iHurtSound, getSoundVolume(),
|
||||||
(random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f);
|
(random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f);
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
hurt(DamageSource::genericSource, 0);
|
hurt(DamageSource::genericSource, 0);
|
||||||
} else if (id == EntityEvent::DEATH) {
|
} else if (id == EntityEvent::DEATH) {
|
||||||
MemSect(31);
|
|
||||||
// 4J-PB -added because villagers have no sounds
|
// 4J-PB -added because villagers have no sounds
|
||||||
int iDeathSound = getDeathSound();
|
int iDeathSound = getDeathSound();
|
||||||
if (iDeathSound != -1) {
|
if (iDeathSound != -1) {
|
||||||
|
|
@ -1099,7 +1090,6 @@ void LivingEntity::handleEntityEvent(uint8_t id) {
|
||||||
iDeathSound, getSoundVolume(),
|
iDeathSound, getSoundVolume(),
|
||||||
(random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f);
|
(random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f);
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
setHealth(0);
|
setHealth(0);
|
||||||
die(DamageSource::genericSource);
|
die(DamageSource::genericSource);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1539,7 +1529,6 @@ void LivingEntity::aiStep() {
|
||||||
yya = 0;
|
yya = 0;
|
||||||
yRotA = 0;
|
yRotA = 0;
|
||||||
} else {
|
} else {
|
||||||
MemSect(25);
|
|
||||||
if (isEffectiveAi()) {
|
if (isEffectiveAi()) {
|
||||||
if (useNewAi()) {
|
if (useNewAi()) {
|
||||||
newServerAiStep();
|
newServerAiStep();
|
||||||
|
|
@ -1548,7 +1537,6 @@ void LivingEntity::aiStep() {
|
||||||
yHeadRot = yRot;
|
yHeadRot = yRot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jumping) {
|
if (jumping) {
|
||||||
|
|
|
||||||
|
|
@ -59,15 +59,11 @@ void Mob::_init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Mob::Mob(Level* level) : LivingEntity(level) {
|
Mob::Mob(Level* level) : LivingEntity(level) {
|
||||||
MemSect(57);
|
|
||||||
_init();
|
_init();
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
MemSect(58);
|
|
||||||
// 4J Stu - We call this again in the derived classes, but need to do it
|
// 4J Stu - We call this again in the derived classes, but need to do it
|
||||||
// here for some internal members
|
// here for some internal members
|
||||||
registerAttributes();
|
registerAttributes();
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
lookControl = new LookControl(this);
|
lookControl = new LookControl(this);
|
||||||
moveControl = new MoveControl(this);
|
moveControl = new MoveControl(this);
|
||||||
|
|
@ -133,12 +129,10 @@ void Mob::defineSynchedData() {
|
||||||
int Mob::getAmbientSoundInterval() { return 20 * 4; }
|
int Mob::getAmbientSoundInterval() { return 20 * 4; }
|
||||||
|
|
||||||
void Mob::playAmbientSound() {
|
void Mob::playAmbientSound() {
|
||||||
MemSect(31);
|
|
||||||
int ambient = getAmbientSound();
|
int ambient = getAmbientSound();
|
||||||
if (ambient != -1) {
|
if (ambient != -1) {
|
||||||
playSound(ambient, getSoundVolume(), getVoicePitch());
|
playSound(ambient, getSoundVolume(), getVoicePitch());
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mob::baseTick() {
|
void Mob::baseTick() {
|
||||||
|
|
@ -406,7 +400,6 @@ void Mob::checkDespawn() {
|
||||||
|
|
||||||
void Mob::newServerAiStep() {
|
void Mob::newServerAiStep() {
|
||||||
PIXBeginNamedEvent(0, "Tick target selector for %d", GetType());
|
PIXBeginNamedEvent(0, "Tick target selector for %d", GetType());
|
||||||
MemSect(51);
|
|
||||||
noActionTime++;
|
noActionTime++;
|
||||||
PIXBeginNamedEvent(0, "Check despawn");
|
PIXBeginNamedEvent(0, "Check despawn");
|
||||||
checkDespawn();
|
checkDespawn();
|
||||||
|
|
@ -442,7 +435,6 @@ void Mob::newServerAiStep() {
|
||||||
PIXBeginNamedEvent(0, "Consider extra wandering");
|
PIXBeginNamedEvent(0, "Consider extra wandering");
|
||||||
considerForExtraWandering(isDespawnProtected());
|
considerForExtraWandering(isDespawnProtected());
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
MemSect(0);
|
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,68 +12,56 @@ SynchedEntityData::SynchedEntityData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynchedEntityData::define(int id, int value) {
|
void SynchedEntityData::define(int id, int value) {
|
||||||
MemSect(17);
|
|
||||||
checkId(id);
|
checkId(id);
|
||||||
int type = TYPE_INT;
|
int type = TYPE_INT;
|
||||||
std::shared_ptr<DataItem> dataItem =
|
std::shared_ptr<DataItem> dataItem =
|
||||||
std::shared_ptr<DataItem>(new DataItem(type, id, value));
|
std::shared_ptr<DataItem>(new DataItem(type, id, value));
|
||||||
itemsById[id] = dataItem;
|
itemsById[id] = dataItem;
|
||||||
MemSect(0);
|
|
||||||
m_isEmpty = false;
|
m_isEmpty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynchedEntityData::define(int id, uint8_t value) {
|
void SynchedEntityData::define(int id, uint8_t value) {
|
||||||
MemSect(17);
|
|
||||||
checkId(id);
|
checkId(id);
|
||||||
int type = TYPE_BYTE;
|
int type = TYPE_BYTE;
|
||||||
std::shared_ptr<DataItem> dataItem =
|
std::shared_ptr<DataItem> dataItem =
|
||||||
std::shared_ptr<DataItem>(new DataItem(type, id, value));
|
std::shared_ptr<DataItem>(new DataItem(type, id, value));
|
||||||
itemsById[id] = dataItem;
|
itemsById[id] = dataItem;
|
||||||
MemSect(0);
|
|
||||||
m_isEmpty = false;
|
m_isEmpty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynchedEntityData::define(int id, short value) {
|
void SynchedEntityData::define(int id, short value) {
|
||||||
MemSect(17);
|
|
||||||
checkId(id);
|
checkId(id);
|
||||||
int type = TYPE_SHORT;
|
int type = TYPE_SHORT;
|
||||||
std::shared_ptr<DataItem> dataItem =
|
std::shared_ptr<DataItem> dataItem =
|
||||||
std::shared_ptr<DataItem>(new DataItem(type, id, value));
|
std::shared_ptr<DataItem>(new DataItem(type, id, value));
|
||||||
itemsById[id] = dataItem;
|
itemsById[id] = dataItem;
|
||||||
MemSect(0);
|
|
||||||
m_isEmpty = false;
|
m_isEmpty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynchedEntityData::define(int id, float value) {
|
void SynchedEntityData::define(int id, float value) {
|
||||||
MemSect(17);
|
|
||||||
checkId(id);
|
checkId(id);
|
||||||
int type = TYPE_FLOAT;
|
int type = TYPE_FLOAT;
|
||||||
std::shared_ptr<DataItem> dataItem =
|
std::shared_ptr<DataItem> dataItem =
|
||||||
std::shared_ptr<DataItem>(new DataItem(type, id, value));
|
std::shared_ptr<DataItem>(new DataItem(type, id, value));
|
||||||
itemsById[id] = dataItem;
|
itemsById[id] = dataItem;
|
||||||
MemSect(0);
|
|
||||||
m_isEmpty = false;
|
m_isEmpty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynchedEntityData::define(int id, const std::wstring& value) {
|
void SynchedEntityData::define(int id, const std::wstring& value) {
|
||||||
MemSect(17);
|
|
||||||
checkId(id);
|
checkId(id);
|
||||||
int type = TYPE_STRING;
|
int type = TYPE_STRING;
|
||||||
std::shared_ptr<DataItem> dataItem =
|
std::shared_ptr<DataItem> dataItem =
|
||||||
std::shared_ptr<DataItem>(new DataItem(type, id, value));
|
std::shared_ptr<DataItem>(new DataItem(type, id, value));
|
||||||
itemsById[id] = dataItem;
|
itemsById[id] = dataItem;
|
||||||
MemSect(0);
|
|
||||||
m_isEmpty = false;
|
m_isEmpty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynchedEntityData::defineNULL(int id, void* pVal) {
|
void SynchedEntityData::defineNULL(int id, void* pVal) {
|
||||||
MemSect(17);
|
|
||||||
checkId(id);
|
checkId(id);
|
||||||
int type = TYPE_ITEMINSTANCE;
|
int type = TYPE_ITEMINSTANCE;
|
||||||
std::shared_ptr<DataItem> dataItem = std::shared_ptr<DataItem>(
|
std::shared_ptr<DataItem> dataItem = std::shared_ptr<DataItem>(
|
||||||
new DataItem(type, id, std::shared_ptr<ItemInstance>()));
|
new DataItem(type, id, std::shared_ptr<ItemInstance>()));
|
||||||
itemsById[id] = dataItem;
|
itemsById[id] = dataItem;
|
||||||
MemSect(0);
|
|
||||||
m_isEmpty = false;
|
m_isEmpty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,9 +66,7 @@ Path* PathNavigation::createPath(double x, double y, double z) {
|
||||||
|
|
||||||
bool PathNavigation::moveTo(double x, double y, double z,
|
bool PathNavigation::moveTo(double x, double y, double z,
|
||||||
double speedModifier) {
|
double speedModifier) {
|
||||||
MemSect(52);
|
|
||||||
Path* newPath = createPath(Mth::floor(x), (int)y, Mth::floor(z));
|
Path* newPath = createPath(Mth::floor(x), (int)y, Mth::floor(z));
|
||||||
MemSect(0);
|
|
||||||
// No need to delete newPath here as this will be copied into the member
|
// No need to delete newPath here as this will be copied into the member
|
||||||
// variable path and the class can assume responsibility for it
|
// variable path and the class can assume responsibility for it
|
||||||
return moveTo(newPath, speedModifier);
|
return moveTo(newPath, speedModifier);
|
||||||
|
|
@ -82,9 +80,7 @@ Path* PathNavigation::createPath(std::shared_ptr<Entity> target) {
|
||||||
|
|
||||||
bool PathNavigation::moveTo(std::shared_ptr<Entity> target,
|
bool PathNavigation::moveTo(std::shared_ptr<Entity> target,
|
||||||
double speedModifier) {
|
double speedModifier) {
|
||||||
MemSect(53);
|
|
||||||
Path* newPath = createPath(target);
|
Path* newPath = createPath(target);
|
||||||
MemSect(0);
|
|
||||||
// No need to delete newPath here as this will be copied into the member
|
// No need to delete newPath here as this will be copied into the member
|
||||||
// variable path and the class can assume responsibility for it
|
// variable path and the class can assume responsibility for it
|
||||||
if (newPath != nullptr)
|
if (newPath != nullptr)
|
||||||
|
|
|
||||||
|
|
@ -82,10 +82,8 @@ void ItemEntity::tick() {
|
||||||
yd = 0.2f;
|
yd = 0.2f;
|
||||||
xd = (random->nextFloat() - random->nextFloat()) * 0.2f;
|
xd = (random->nextFloat() - random->nextFloat()) * 0.2f;
|
||||||
zd = (random->nextFloat() - random->nextFloat()) * 0.2f;
|
zd = (random->nextFloat() - random->nextFloat()) * 0.2f;
|
||||||
MemSect(31);
|
|
||||||
playSound(eSoundType_RANDOM_FIZZ, 0.4f,
|
playSound(eSoundType_RANDOM_FIZZ, 0.4f,
|
||||||
2.0f + random->nextFloat() * 0.4f);
|
2.0f + random->nextFloat() * 0.4f);
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!level->isClientSide) {
|
if (!level->isClientSide) {
|
||||||
|
|
|
||||||
|
|
@ -115,9 +115,7 @@ Player::Player(Level* level, const std::wstring& name) : LivingEntity(level) {
|
||||||
this->name = name;
|
this->name = name;
|
||||||
|
|
||||||
_init();
|
_init();
|
||||||
MemSect(11);
|
|
||||||
inventoryMenu = new InventoryMenu(inventory, !level->isClientSide, this);
|
inventoryMenu = new InventoryMenu(inventory, !level->isClientSide, this);
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
containerMenu = inventoryMenu;
|
containerMenu = inventoryMenu;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,6 @@ void Fireball::tick() {
|
||||||
flightTime++;
|
flightTime++;
|
||||||
}
|
}
|
||||||
|
|
||||||
MemSect(41);
|
|
||||||
Vec3 from(x, y, z);
|
Vec3 from(x, y, z);
|
||||||
Vec3 to(x + xd, y + yd, z + zd);
|
Vec3 to(x + xd, y + yd, z + zd);
|
||||||
HitResult* res = level->clip(&from, &to);
|
HitResult* res = level->clip(&from, &to);
|
||||||
|
|
@ -204,7 +203,6 @@ void Fireball::tick() {
|
||||||
delete res;
|
delete res;
|
||||||
res = new HitResult(hitEntity);
|
res = new HitResult(hitEntity);
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
if (res != nullptr) {
|
if (res != nullptr) {
|
||||||
onHit(res);
|
onHit(res);
|
||||||
|
|
|
||||||
|
|
@ -69,10 +69,8 @@ void InventoryMenu::slotsChanged() // 4J used to take a shared_ptr<Container>
|
||||||
// but wasn't using it, so removed to
|
// but wasn't using it, so removed to
|
||||||
// simplify things
|
// simplify things
|
||||||
{
|
{
|
||||||
MemSect(23);
|
|
||||||
resultSlots->setItem(
|
resultSlots->setItem(
|
||||||
0, Recipes::getInstance()->getItemFor(craftSlots, owner->level));
|
0, Recipes::getInstance()->getItemFor(craftSlots, owner->level));
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InventoryMenu::removed(std::shared_ptr<Player> player) {
|
void InventoryMenu::removed(std::shared_ptr<Player> player) {
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,8 @@ std::shared_ptr<MapItemSavedData> MapItem::getSavedData(short idNum,
|
||||||
|
|
||||||
std::shared_ptr<MapItemSavedData> MapItem::getSavedData(
|
std::shared_ptr<MapItemSavedData> MapItem::getSavedData(
|
||||||
std::shared_ptr<ItemInstance> itemInstance, Level* level) {
|
std::shared_ptr<ItemInstance> itemInstance, Level* level) {
|
||||||
MemSect(31);
|
|
||||||
std::wstring id =
|
std::wstring id =
|
||||||
std::wstring(L"map_") + _toString(itemInstance->getAuxValue());
|
std::wstring(L"map_") + _toString(itemInstance->getAuxValue());
|
||||||
MemSect(0);
|
|
||||||
std::shared_ptr<MapItemSavedData> mapItemSavedData =
|
std::shared_ptr<MapItemSavedData> mapItemSavedData =
|
||||||
std::dynamic_pointer_cast<MapItemSavedData>(
|
std::dynamic_pointer_cast<MapItemSavedData>(
|
||||||
level->getSavedData(typeid(MapItemSavedData), id));
|
level->getSavedData(typeid(MapItemSavedData), id));
|
||||||
|
|
|
||||||
|
|
@ -1611,18 +1611,12 @@ bool Level::addEntity(std::shared_ptr<Entity> e) {
|
||||||
|
|
||||||
updateSleepingPlayerList();
|
updateSleepingPlayerList();
|
||||||
}
|
}
|
||||||
MemSect(42);
|
|
||||||
getChunk(xc, zc)->addEntity(e);
|
getChunk(xc, zc)->addEntity(e);
|
||||||
MemSect(0);
|
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lock(m_entitiesCS);
|
std::lock_guard<std::recursive_mutex> lock(m_entitiesCS);
|
||||||
MemSect(43);
|
|
||||||
entities.push_back(e);
|
entities.push_back(e);
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
MemSect(44);
|
|
||||||
entityAdded(e);
|
entityAdded(e);
|
||||||
MemSect(0);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -2305,9 +2299,7 @@ void Level::tick(std::shared_ptr<Entity> e, bool actual) {
|
||||||
|
|
||||||
if (hasChunk(xcn, zcn)) {
|
if (hasChunk(xcn, zcn)) {
|
||||||
e->inChunk = true;
|
e->inChunk = true;
|
||||||
MemSect(39);
|
|
||||||
getChunk(xcn, zcn)->addEntity(e);
|
getChunk(xcn, zcn)->addEntity(e);
|
||||||
MemSect(0);
|
|
||||||
} else {
|
} else {
|
||||||
e->inChunk = false;
|
e->inChunk = false;
|
||||||
// e.remove();
|
// e.remove();
|
||||||
|
|
@ -3372,7 +3364,6 @@ std::vector<std::shared_ptr<Entity> >* Level::getEntities(
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Entity> >* Level::getEntities(
|
std::vector<std::shared_ptr<Entity> >* Level::getEntities(
|
||||||
std::shared_ptr<Entity> except, AABB* bb, const EntitySelector* selector) {
|
std::shared_ptr<Entity> except, AABB* bb, const EntitySelector* selector) {
|
||||||
MemSect(40);
|
|
||||||
es.clear();
|
es.clear();
|
||||||
int xc0 = Mth::floor((bb->x0 - 2) / 16);
|
int xc0 = Mth::floor((bb->x0 - 2) / 16);
|
||||||
int xc1 = Mth::floor((bb->x1 + 2) / 16);
|
int xc1 = Mth::floor((bb->x1 + 2) / 16);
|
||||||
|
|
@ -3385,7 +3376,6 @@ std::vector<std::shared_ptr<Entity> >* Level::getEntities(
|
||||||
getChunk(xc, zc)->getEntities(except, bb, es, selector);
|
getChunk(xc, zc)->getEntities(except, bb, es, selector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
return &es;
|
return &es;
|
||||||
}
|
}
|
||||||
|
|
@ -3694,7 +3684,6 @@ std::shared_ptr<Player> Level::getNearestPlayer(std::shared_ptr<Entity> source,
|
||||||
std::shared_ptr<Player> Level::getNearestPlayer(double x, double y, double z,
|
std::shared_ptr<Player> Level::getNearestPlayer(double x, double y, double z,
|
||||||
double maxDist,
|
double maxDist,
|
||||||
double maxYDist /*= -1*/) {
|
double maxYDist /*= -1*/) {
|
||||||
MemSect(21);
|
|
||||||
double best = -1;
|
double best = -1;
|
||||||
std::shared_ptr<Player> result = nullptr;
|
std::shared_ptr<Player> result = nullptr;
|
||||||
auto itEnd = players.end();
|
auto itEnd = players.end();
|
||||||
|
|
@ -3712,7 +3701,6 @@ std::shared_ptr<Player> Level::getNearestPlayer(double x, double y, double z,
|
||||||
result = p;
|
result = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ const int MobSpawner::tick(ServerLevel* level, bool spawnEnemies,
|
||||||
if (!spawnEnemies && !spawnFriendlies && !spawnPersistent) {
|
if (!spawnEnemies && !spawnFriendlies && !spawnPersistent) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
MemSect(20);
|
|
||||||
chunksToPoll.clear();
|
chunksToPoll.clear();
|
||||||
|
|
||||||
// 4J - rewritten to add chunks interleaved by player, and to add them from
|
// 4J - rewritten to add chunks interleaved by player, and to add them from
|
||||||
|
|
@ -103,11 +102,8 @@ const int MobSpawner::tick(ServerLevel* level, bool spawnEnemies,
|
||||||
}
|
}
|
||||||
delete[] xx;
|
delete[] xx;
|
||||||
delete[] zz;
|
delete[] zz;
|
||||||
MemSect(0);
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
MemSect(31);
|
|
||||||
Pos* spawnPos = level->getSharedSpawnPos();
|
Pos* spawnPos = level->getSharedSpawnPos();
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < MobCategory::values.size(); i++) {
|
for (unsigned int i = 0; i < MobCategory::values.size(); i++) {
|
||||||
MobCategory* mobCategory = MobCategory::values[i];
|
MobCategory* mobCategory = MobCategory::values[i];
|
||||||
|
|
@ -210,13 +206,11 @@ const int MobSpawner::tick(ServerLevel* level, bool spawnEnemies,
|
||||||
// 4J - removed try/catch
|
// 4J - removed try/catch
|
||||||
// try
|
// try
|
||||||
// {
|
// {
|
||||||
MemSect(29);
|
|
||||||
// mob =
|
// mob =
|
||||||
// type.mobClass.getConstructor(Level.class).newInstance(level);
|
// type.mobClass.getConstructor(Level.class).newInstance(level);
|
||||||
mob = std::dynamic_pointer_cast<Mob>(
|
mob = std::dynamic_pointer_cast<Mob>(
|
||||||
EntityIO::newByEnumType(currentMobType->mobClass,
|
EntityIO::newByEnumType(currentMobType->mobClass,
|
||||||
level));
|
level));
|
||||||
MemSect(0);
|
|
||||||
// }
|
// }
|
||||||
// catch
|
// catch
|
||||||
//(exception e)
|
//(exception e)
|
||||||
|
|
|
||||||
|
|
@ -83,11 +83,9 @@ BiomeCache::Block* BiomeCache::getBlockAt(int x, int z) {
|
||||||
auto it = cached.find(slot);
|
auto it = cached.find(slot);
|
||||||
Block* block = nullptr;
|
Block* block = nullptr;
|
||||||
if (it == cached.end()) {
|
if (it == cached.end()) {
|
||||||
MemSect(48);
|
|
||||||
block = new Block(x, z, this);
|
block = new Block(x, z, this);
|
||||||
cached[slot] = block;
|
cached[slot] = block;
|
||||||
all.push_back(block);
|
all.push_back(block);
|
||||||
MemSect(0);
|
|
||||||
} else {
|
} else {
|
||||||
block = it->second;
|
block = it->second;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -138,9 +138,7 @@ void BiomeDecorator::decorate() {
|
||||||
int x = xo + random->nextInt(16) + 8;
|
int x = xo + random->nextInt(16) + 8;
|
||||||
int y = random->nextInt(Level::genDepth);
|
int y = random->nextInt(Level::genDepth);
|
||||||
int z = zo + random->nextInt(16) + 8;
|
int z = zo + random->nextInt(16) + 8;
|
||||||
MemSect(50);
|
|
||||||
Feature* grassFeature = biome->getGrassFeature(random);
|
Feature* grassFeature = biome->getGrassFeature(random);
|
||||||
MemSect(0);
|
|
||||||
grassFeature->place(level, random, x, y, z);
|
grassFeature->place(level, random, x, y, z);
|
||||||
delete grassFeature;
|
delete grassFeature;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -317,7 +317,6 @@ TilePos* BiomeSource::findBiome(int x, int z, int r,
|
||||||
|
|
||||||
int w = x1 - x0 + 1;
|
int w = x1 - x0 + 1;
|
||||||
int h = z1 - z0 + 1;
|
int h = z1 - z0 + 1;
|
||||||
MemSect(50);
|
|
||||||
std::vector<int> biomes = layer->getArea(x0, z0, w, h);
|
std::vector<int> biomes = layer->getArea(x0, z0, w, h);
|
||||||
TilePos* res = nullptr;
|
TilePos* res = nullptr;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
@ -333,7 +332,6 @@ TilePos* BiomeSource::findBiome(int x, int z, int r,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,9 +69,7 @@ void FixedBiomeSource::getDownfallBlock(std::vector<double>& downfalls, int x, i
|
||||||
// arrays output if pointers are passed in (_temperatures, _downfalls)
|
// arrays output if pointers are passed in (_temperatures, _downfalls)
|
||||||
void FixedBiomeSource::getBiomeBlock(std::vector<Biome*>& biomes, int x, int z, int w,
|
void FixedBiomeSource::getBiomeBlock(std::vector<Biome*>& biomes, int x, int z, int w,
|
||||||
int h, bool useCache) const {
|
int h, bool useCache) const {
|
||||||
MemSect(36);
|
|
||||||
biomes = std::vector<Biome*>(w * h);
|
biomes = std::vector<Biome*>(w * h);
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
Arrays::fill(biomes, 0, w * h, biome);
|
Arrays::fill(biomes, 0, w * h, biome);
|
||||||
}
|
}
|
||||||
|
|
@ -80,9 +78,7 @@ void FixedBiomeSource::getBiomeBlock(std::vector<Biome*>& biomes, int x, int z,
|
||||||
// arrays output if pointers are passed in (_temperatures, _downfalls)
|
// arrays output if pointers are passed in (_temperatures, _downfalls)
|
||||||
void FixedBiomeSource::getBiomeIndexBlock(std::vector<uint8_t>& biomeIndices, int x, int z,
|
void FixedBiomeSource::getBiomeIndexBlock(std::vector<uint8_t>& biomeIndices, int x, int z,
|
||||||
int w, int h, bool useCache) const {
|
int w, int h, bool useCache) const {
|
||||||
MemSect(36);
|
|
||||||
biomeIndices = std::vector<uint8_t>(w * h);
|
biomeIndices = std::vector<uint8_t>(w * h);
|
||||||
MemSect(0);
|
|
||||||
int biomeIndex = biome->id;
|
int biomeIndex = biome->id;
|
||||||
Arrays::fill(biomeIndices, 0, w * h, biomeIndex);
|
Arrays::fill(biomeIndices, 0, w * h, biomeIndex);
|
||||||
}
|
}
|
||||||
|
|
@ -92,9 +88,7 @@ void FixedBiomeSource::getBiomeIndexBlock(std::vector<uint8_t>& biomeIndices, in
|
||||||
// arrays output if pointers are passed in (_temperatures, _downfalls)
|
// arrays output if pointers are passed in (_temperatures, _downfalls)
|
||||||
void FixedBiomeSource::getRawBiomeBlock(std::vector<Biome*>& biomes, int x, int z, int w,
|
void FixedBiomeSource::getRawBiomeBlock(std::vector<Biome*>& biomes, int x, int z, int w,
|
||||||
int h) const {
|
int h) const {
|
||||||
MemSect(36);
|
|
||||||
biomes = std::vector<Biome*>(w * h);
|
biomes = std::vector<Biome*>(w * h);
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
Arrays::fill(biomes, 0, w * h, biome);
|
Arrays::fill(biomes, 0, w * h, biome);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@ void LevelChunk::init(Level* level, int x, int z) {
|
||||||
this->level = level;
|
this->level = level;
|
||||||
this->x = x;
|
this->x = x;
|
||||||
this->z = z;
|
this->z = z;
|
||||||
MemSect(1);
|
|
||||||
heightmap = std::vector<uint8_t>(16 * 16);
|
heightmap = std::vector<uint8_t>(16 * 16);
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lock(m_csEntities);
|
std::lock_guard<std::recursive_mutex> lock(m_csEntities);
|
||||||
|
|
@ -66,7 +65,6 @@ void LevelChunk::init(Level* level, int x, int z) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
lowestHeightmap = 256;
|
lowestHeightmap = 256;
|
||||||
inhabitedTime = 0;
|
inhabitedTime = 0;
|
||||||
|
|
@ -251,7 +249,6 @@ void LevelChunk::stopSharingTilesAndData() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MemSect(47);
|
|
||||||
|
|
||||||
// Changed to used compressed storage - these CTORs make deep copies of
|
// Changed to used compressed storage - these CTORs make deep copies of
|
||||||
// the storage passed as a parameter
|
// the storage passed as a parameter
|
||||||
|
|
@ -281,7 +278,6 @@ void LevelChunk::stopSharingTilesAndData() {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sharingTilesAndData = false;
|
sharingTilesAndData = false;
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -1176,9 +1172,7 @@ void LevelChunk::removeEntity(std::shared_ptr<Entity> e, int yc) {
|
||||||
entityBlocks[yc]->erase(it);
|
entityBlocks[yc]->erase(it);
|
||||||
// 4J - we don't want storage creeping up here as thinkgs move round
|
// 4J - we don't want storage creeping up here as thinkgs move round
|
||||||
// the world accumulating up spare space
|
// the world accumulating up spare space
|
||||||
MemSect(31);
|
|
||||||
entityBlocks[yc]->shrink_to_fit();
|
entityBlocks[yc]->shrink_to_fit();
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,19 +96,15 @@ LevelChunk* McRegionChunkStorage::load(Level* level, int x, int z) {
|
||||||
if (m_saveFile->getOriginalSaveVersion() >=
|
if (m_saveFile->getOriginalSaveVersion() >=
|
||||||
SAVE_FILE_VERSION_COMPRESSED_CHUNK_STORAGE) {
|
SAVE_FILE_VERSION_COMPRESSED_CHUNK_STORAGE) {
|
||||||
if (regionChunkInputStream != nullptr) {
|
if (regionChunkInputStream != nullptr) {
|
||||||
MemSect(9);
|
|
||||||
levelChunk = OldChunkStorage::load(level, regionChunkInputStream);
|
levelChunk = OldChunkStorage::load(level, regionChunkInputStream);
|
||||||
loadEntities(level, levelChunk);
|
loadEntities(level, levelChunk);
|
||||||
MemSect(0);
|
|
||||||
regionChunkInputStream->deleteChildStream();
|
regionChunkInputStream->deleteChildStream();
|
||||||
delete regionChunkInputStream;
|
delete regionChunkInputStream;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CompoundTag* chunkData;
|
CompoundTag* chunkData;
|
||||||
if (regionChunkInputStream != nullptr) {
|
if (regionChunkInputStream != nullptr) {
|
||||||
MemSect(8);
|
|
||||||
chunkData = NbtIo::read((DataInput*)regionChunkInputStream);
|
chunkData = NbtIo::read((DataInput*)regionChunkInputStream);
|
||||||
MemSect(0);
|
|
||||||
} else {
|
} else {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
@ -134,10 +130,8 @@ LevelChunk* McRegionChunkStorage::load(Level* level, int x, int z) {
|
||||||
delete chunkData;
|
delete chunkData;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
MemSect(9);
|
|
||||||
levelChunk =
|
levelChunk =
|
||||||
OldChunkStorage::load(level, chunkData->getCompound(L"Level"));
|
OldChunkStorage::load(level, chunkData->getCompound(L"Level"));
|
||||||
MemSect(0);
|
|
||||||
if (!levelChunk->isAt(x, z)) {
|
if (!levelChunk->isAt(x, z)) {
|
||||||
char buf[256];
|
char buf[256];
|
||||||
sprintf(buf,
|
sprintf(buf,
|
||||||
|
|
@ -153,9 +147,7 @@ LevelChunk* McRegionChunkStorage::load(Level* level, int x, int z) {
|
||||||
// can never reload from it
|
// can never reload from it
|
||||||
// chunkData->putInt(L"xPos", x);
|
// chunkData->putInt(L"xPos", x);
|
||||||
// chunkData->putInt(L"zPos", z);
|
// chunkData->putInt(L"zPos", z);
|
||||||
// MemSect(10);
|
|
||||||
// levelChunk = OldChunkStorage::load(level,
|
// levelChunk = OldChunkStorage::load(level,
|
||||||
// chunkData->getCompound(L"Level")); MemSect(0);
|
|
||||||
}
|
}
|
||||||
#if defined(SPLIT_SAVES)
|
#if defined(SPLIT_SAVES)
|
||||||
loadEntities(level, levelChunk);
|
loadEntities(level, levelChunk);
|
||||||
|
|
@ -184,7 +176,6 @@ void McRegionChunkStorage::save(Level* level, LevelChunk* levelChunk) {
|
||||||
// running saves on multiple threads these sections have a lot of
|
// running saves on multiple threads these sections have a lot of
|
||||||
// contention. Better to let each thread have its turn at a higher level of
|
// contention. Better to let each thread have its turn at a higher level of
|
||||||
// granularity.
|
// granularity.
|
||||||
MemSect(30);
|
|
||||||
PIXBeginNamedEvent(0, "Getting output stream\n");
|
PIXBeginNamedEvent(0, "Getting output stream\n");
|
||||||
DataOutputStream* output = RegionFileCache::getChunkDataOutputStream(
|
DataOutputStream* output = RegionFileCache::getChunkDataOutputStream(
|
||||||
m_saveFile, m_prefix, levelChunk->x, levelChunk->z);
|
m_saveFile, m_prefix, levelChunk->x, levelChunk->z);
|
||||||
|
|
@ -232,7 +223,6 @@ void McRegionChunkStorage::save(Level* level, LevelChunk* levelChunk) {
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
LevelData* levelInfo = level->getLevelData();
|
LevelData* levelInfo = level->getLevelData();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -231,10 +231,8 @@ DataInputStream* RegionFile::getChunkDataInputStream(
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
MemSect(50);
|
|
||||||
std::uint8_t* data = new std::uint8_t[length];
|
std::uint8_t* data = new std::uint8_t[length];
|
||||||
std::uint8_t* decomp = new std::uint8_t[decompLength];
|
std::uint8_t* decomp = new std::uint8_t[decompLength];
|
||||||
MemSect(0);
|
|
||||||
readDecompLength = decompLength;
|
readDecompLength = decompLength;
|
||||||
m_saveFile->readFile(fileEntry, data, length, &numberOfBytesRead);
|
m_saveFile->readFile(fileEntry, data, length, &numberOfBytesRead);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ RegionFile* RegionFileCache::_getRegionFile(
|
||||||
|
|
||||||
// File file(regionDir, wstring(L"r.") + _toString(chunkX>>5) + L"." +
|
// File file(regionDir, wstring(L"r.") + _toString(chunkX>>5) + L"." +
|
||||||
// _toString(chunkZ>>5) + L".mcr" );
|
// _toString(chunkZ>>5) + L".mcr" );
|
||||||
MemSect(31);
|
|
||||||
File file;
|
File file;
|
||||||
if (useSplitSaves(saveFile->getSavePlatform())) {
|
if (useSplitSaves(saveFile->getSavePlatform())) {
|
||||||
file = File(prefix + std::wstring(L"r.") + _toString(chunkX >> 4) +
|
file = File(prefix + std::wstring(L"r.") + _toString(chunkX >> 4) +
|
||||||
|
|
@ -36,7 +35,6 @@ RegionFile* RegionFileCache::_getRegionFile(
|
||||||
file = File(prefix + std::wstring(L"r.") + _toString(chunkX >> 5) +
|
file = File(prefix + std::wstring(L"r.") + _toString(chunkX >> 5) +
|
||||||
L"." + _toString(chunkZ >> 5) + L".mcr");
|
L"." + _toString(chunkZ >> 5) + L".mcr");
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
RegionFile* ref = nullptr;
|
RegionFile* ref = nullptr;
|
||||||
auto it = cache.find(file);
|
auto it = cache.find(file);
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,7 @@ void CanyonFeature::addTunnel(int64_t seed, int xOffs, int zOffs,
|
||||||
std::vector<uint8_t>& blocks, double xCave, double yCave,
|
std::vector<uint8_t>& blocks, double xCave, double yCave,
|
||||||
double zCave, float thickness, float yRot,
|
double zCave, float thickness, float yRot,
|
||||||
float xRot, int step, int dist, double yScale) {
|
float xRot, int step, int dist, double yScale) {
|
||||||
MemSect(49);
|
|
||||||
Random* random = new Random(seed);
|
Random* random = new Random(seed);
|
||||||
MemSect(0);
|
|
||||||
double xMid = xOffs * 16 + 8;
|
double xMid = xOffs * 16 + 8;
|
||||||
double zMid = zOffs * 16 + 8;
|
double zMid = zOffs * 16 + 8;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,9 +92,7 @@ StructurePiece* MineShaftPieces::generateAndAddPiece(
|
||||||
StructurePiece* newPiece = createRandomShaftPiece(
|
StructurePiece* newPiece = createRandomShaftPiece(
|
||||||
pieces, random, footX, footY, footZ, direction, depth + 1);
|
pieces, random, footX, footY, footZ, direction, depth + 1);
|
||||||
if (newPiece != nullptr) {
|
if (newPiece != nullptr) {
|
||||||
MemSect(50);
|
|
||||||
pieces->push_back(newPiece);
|
pieces->push_back(newPiece);
|
||||||
MemSect(0);
|
|
||||||
newPiece->addChildren(startPiece, pieces, random);
|
newPiece->addChildren(startPiece, pieces, random);
|
||||||
}
|
}
|
||||||
return newPiece;
|
return newPiece;
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,11 @@ PerlinNoise::PerlinNoise(int levels) {
|
||||||
PerlinNoise::PerlinNoise(Random* random, int levels) { init(random, levels); }
|
PerlinNoise::PerlinNoise(Random* random, int levels) { init(random, levels); }
|
||||||
|
|
||||||
void PerlinNoise::init(Random* random, int levels) {
|
void PerlinNoise::init(Random* random, int levels) {
|
||||||
MemSect(2);
|
|
||||||
this->levels = levels;
|
this->levels = levels;
|
||||||
noiseLevels = new ImprovedNoise*[levels];
|
noiseLevels = new ImprovedNoise*[levels];
|
||||||
for (int i = 0; i < levels; i++) {
|
for (int i = 0; i < levels; i++) {
|
||||||
noiseLevels[i] = new ImprovedNoise(random);
|
noiseLevels[i] = new ImprovedNoise(random);
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PerlinNoise::~PerlinNoise() {
|
PerlinNoise::~PerlinNoise() {
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,11 @@ PerlinSimplexNoise::PerlinSimplexNoise(Random* random, int levels) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerlinSimplexNoise::init(Random* random, int levels) {
|
void PerlinSimplexNoise::init(Random* random, int levels) {
|
||||||
MemSect(3);
|
|
||||||
this->levels = levels;
|
this->levels = levels;
|
||||||
noiseLevels = new SimplexNoise*[levels];
|
noiseLevels = new SimplexNoise*[levels];
|
||||||
for (int i = 0; i < levels; i++) {
|
for (int i = 0; i < levels; i++) {
|
||||||
noiseLevels[i] = new SimplexNoise(random);
|
noiseLevels[i] = new SimplexNoise(random);
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PerlinSimplexNoise::~PerlinSimplexNoise() {
|
PerlinSimplexNoise::~PerlinSimplexNoise() {
|
||||||
|
|
|
||||||
|
|
@ -190,9 +190,7 @@ Node* PathFinder::getNode(Entity* entity, int x, int y, int z, Node* size,
|
||||||
Node* node;
|
Node* node;
|
||||||
auto it = nodes.find(i);
|
auto it = nodes.find(i);
|
||||||
if (it == nodes.end()) {
|
if (it == nodes.end()) {
|
||||||
MemSect(54);
|
|
||||||
node = new Node(x, y, z);
|
node = new Node(x, y, z);
|
||||||
MemSect(0);
|
|
||||||
nodes.insert(std::unordered_map<int, Node*>::value_type(i, node));
|
nodes.insert(std::unordered_map<int, Node*>::value_type(i, node));
|
||||||
} else {
|
} else {
|
||||||
node = (*it).second;
|
node = (*it).second;
|
||||||
|
|
|
||||||
|
|
@ -414,12 +414,10 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr<Player> player,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MemSect(45);
|
|
||||||
decorations.push_back(new MapDecoration(
|
decorations.push_back(new MapDecoration(
|
||||||
imgIndex, x, y, rot, decorationPlayer->entityId,
|
imgIndex, x, y, rot, decorationPlayer->entityId,
|
||||||
(decorationPlayer == hp->player ||
|
(decorationPlayer == hp->player ||
|
||||||
decorationPlayer->canShowOnMaps())));
|
decorationPlayer->canShowOnMaps())));
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,9 +93,7 @@ ChunkStorage* McRegionLevelStorage::createChunkStorage(Dimension* dimension) {
|
||||||
void McRegionLevelStorage::saveLevelData(
|
void McRegionLevelStorage::saveLevelData(
|
||||||
LevelData* levelData, std::vector<std::shared_ptr<Player> >* players) {
|
LevelData* levelData, std::vector<std::shared_ptr<Player> >* players) {
|
||||||
levelData->setVersion(MCREGION_VERSION_ID);
|
levelData->setVersion(MCREGION_VERSION_ID);
|
||||||
MemSect(38);
|
|
||||||
DirectoryLevelStorage::saveLevelData(levelData, players);
|
DirectoryLevelStorage::saveLevelData(levelData, players);
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void McRegionLevelStorage::closeAll() { RegionFileCache::clear(); }
|
void McRegionLevelStorage::closeAll() { RegionFileCache::clear(); }
|
||||||
|
|
@ -41,7 +41,6 @@ void BaseRailTile::Rail::updateConnections(int direction) {
|
||||||
delete connections[i];
|
delete connections[i];
|
||||||
}
|
}
|
||||||
connections.clear();
|
connections.clear();
|
||||||
MemSect(50);
|
|
||||||
if (direction == DIR_FLAT_Z) {
|
if (direction == DIR_FLAT_Z) {
|
||||||
connections.push_back(new TilePos(x, y, z - 1));
|
connections.push_back(new TilePos(x, y, z - 1));
|
||||||
connections.push_back(new TilePos(x, y, z + 1));
|
connections.push_back(new TilePos(x, y, z + 1));
|
||||||
|
|
@ -73,7 +72,6 @@ void BaseRailTile::Rail::updateConnections(int direction) {
|
||||||
connections.push_back(new TilePos(x + 1, y, z));
|
connections.push_back(new TilePos(x + 1, y, z));
|
||||||
connections.push_back(new TilePos(x, y, z - 1));
|
connections.push_back(new TilePos(x, y, z - 1));
|
||||||
}
|
}
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,9 +85,7 @@ void BaseRailTile::Rail::removeSoftConnections() {
|
||||||
i--;
|
i--;
|
||||||
} else {
|
} else {
|
||||||
delete connections[i];
|
delete connections[i];
|
||||||
MemSect(50);
|
|
||||||
connections[i] = new TilePos(rail->x, rail->y, rail->z);
|
connections[i] = new TilePos(rail->x, rail->y, rail->z);
|
||||||
MemSect(0);
|
|
||||||
}
|
}
|
||||||
delete rail;
|
delete rail;
|
||||||
}
|
}
|
||||||
|
|
@ -169,9 +165,7 @@ bool BaseRailTile::Rail::canConnectTo(Rail* rail) {
|
||||||
|
|
||||||
void BaseRailTile::Rail::connectTo(Rail* rail) {
|
void BaseRailTile::Rail::connectTo(Rail* rail) {
|
||||||
if (m_bValidRail) {
|
if (m_bValidRail) {
|
||||||
MemSect(50);
|
|
||||||
connections.push_back(new TilePos(rail->x, rail->y, rail->z));
|
connections.push_back(new TilePos(rail->x, rail->y, rail->z));
|
||||||
MemSect(0);
|
|
||||||
|
|
||||||
bool n = hasConnection(x, y, z - 1);
|
bool n = hasConnection(x, y, z - 1);
|
||||||
bool s = hasConnection(x, y, z + 1);
|
bool s = hasConnection(x, y, z + 1);
|
||||||
|
|
|
||||||
|
|
@ -317,10 +317,8 @@ std::shared_ptr<Container> ChestTile::getContainer(Level* level, int x, int y,
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<TileEntity> ChestTile::newTileEntity(Level* level) {
|
std::shared_ptr<TileEntity> ChestTile::newTileEntity(Level* level) {
|
||||||
MemSect(50);
|
|
||||||
std::shared_ptr<TileEntity> retval =
|
std::shared_ptr<TileEntity> retval =
|
||||||
std::shared_ptr<TileEntity>(new ChestTileEntity());
|
std::shared_ptr<TileEntity>(new ChestTileEntity());
|
||||||
MemSect(0);
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -352,12 +352,10 @@ void LiquidTile::updateLiquid(Level* level, int x, int y, int z) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiquidTile::fizz(Level* level, int x, int y, int z) {
|
void LiquidTile::fizz(Level* level, int x, int y, int z) {
|
||||||
MemSect(31);
|
|
||||||
level->playSound(
|
level->playSound(
|
||||||
x + 0.5f, y + 0.5f, z + 0.5f, eSoundType_RANDOM_FIZZ, 0.5f,
|
x + 0.5f, y + 0.5f, z + 0.5f, eSoundType_RANDOM_FIZZ, 0.5f,
|
||||||
2.6f +
|
2.6f +
|
||||||
(level->random->nextFloat() - level->random->nextFloat()) * 0.8f);
|
(level->random->nextFloat() - level->random->nextFloat()) * 0.8f);
|
||||||
MemSect(0);
|
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
level->addParticle(eParticleType_largesmoke, x + Math::random(),
|
level->addParticle(eParticleType_largesmoke, x + Math::random(),
|
||||||
y + 1.2, z + Math::random(), 0, 0, 0);
|
y + 1.2, z + Math::random(), 0, 0, 0);
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,11 @@
|
||||||
#include "nbt/NbtIo.h"
|
#include "nbt/NbtIo.h"
|
||||||
|
|
||||||
CompoundTag* NbtIo::readCompressed(InputStream* in) {
|
CompoundTag* NbtIo::readCompressed(InputStream* in) {
|
||||||
// MemSect(26);
|
|
||||||
// 4J - this was using a try/finally block
|
// 4J - this was using a try/finally block
|
||||||
DataInputStream dis =
|
DataInputStream dis =
|
||||||
DataInputStream(in); // 4J - was new GZIPInputStream as well
|
DataInputStream(in); // 4J - was new GZIPInputStream as well
|
||||||
CompoundTag* ret = NbtIo::read((DataInput*)&dis);
|
CompoundTag* ret = NbtIo::read((DataInput*)&dis);
|
||||||
dis.close();
|
dis.close();
|
||||||
// MemSect(0);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue