it builds kinda, but .loc file is fucked and missing asset copying
replaced miles sound system replaced .arc format with a folder
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
#define _SEKRIT
|
||||
#include "..\..\Durango\Miles\include\mss.h"
|
||||
#elif defined _WINDOWS64
|
||||
#include "..\..\windows64\Miles\include\mss.h"
|
||||
#else // PS4
|
||||
// 4J Stu - Temp define to get Miles to link, can likely be removed when we get a new version of Miles
|
||||
#define _SEKRIT2
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,9 +2,17 @@
|
||||
class Mob;
|
||||
class Options;
|
||||
using namespace std;
|
||||
#include "..\..\Minecraft.World\SoundTypes.h"
|
||||
#include "../../Minecraft.World/SoundTypes.h"
|
||||
|
||||
enum eMUSICFILES
|
||||
#include "miniaudio.h"
|
||||
|
||||
constexpr float SFX_3D_MIN_DISTANCE = 1.0f;
|
||||
constexpr float SFX_3D_MAX_DISTANCE = 16.0f;
|
||||
constexpr float SFX_3D_ROLLOFF = 0.5f;
|
||||
constexpr float SFX_VOLUME_MULTIPLIER = 1.5f;
|
||||
constexpr float SFX_MAX_GAIN = 1.5f;
|
||||
|
||||
enum eMusicFiles
|
||||
{
|
||||
eStream_Overworld_Calm1 = 0,
|
||||
eStream_Overworld_Calm2,
|
||||
@@ -15,7 +23,6 @@ enum eMUSICFILES
|
||||
eStream_Overworld_hal4,
|
||||
eStream_Overworld_nuance1,
|
||||
eStream_Overworld_nuance2,
|
||||
#ifndef _XBOX
|
||||
// Add the new music tracks
|
||||
eStream_Overworld_Creative1,
|
||||
eStream_Overworld_Creative2,
|
||||
@@ -27,7 +34,6 @@ enum eMUSICFILES
|
||||
eStream_Overworld_Menu2,
|
||||
eStream_Overworld_Menu3,
|
||||
eStream_Overworld_Menu4,
|
||||
#endif
|
||||
eStream_Overworld_piano1,
|
||||
eStream_Overworld_piano2,
|
||||
eStream_Overworld_piano3, // <-- make piano3 the last overworld one
|
||||
@@ -39,6 +45,7 @@ enum eMUSICFILES
|
||||
// The End
|
||||
eStream_end_dragon,
|
||||
eStream_end_end,
|
||||
// Music Discs
|
||||
eStream_CD_1,
|
||||
eStream_CD_2,
|
||||
eStream_CD_3,
|
||||
@@ -54,17 +61,21 @@ enum eMUSICFILES
|
||||
eStream_Max,
|
||||
};
|
||||
|
||||
enum eMUSICTYPE
|
||||
enum eMusicType
|
||||
{
|
||||
eMusicType_None,
|
||||
eMusicType_Game,
|
||||
eMusicType_CD,
|
||||
eMusicType_Nether = 0,
|
||||
// ???
|
||||
eMusicType_Menu = 2,
|
||||
// ???
|
||||
eMusicType_End = 4,
|
||||
eMusicType_Creative = 5,
|
||||
eMusicType_Overworld = 7,
|
||||
};
|
||||
|
||||
|
||||
enum MUSIC_STREAMSTATE
|
||||
enum eMusicStreamState
|
||||
{
|
||||
eMusicStreamState_Idle=0,
|
||||
eMusicStreamState_Idle = 0,
|
||||
eMusicStreamState_Stop,
|
||||
eMusicStreamState_Stopping,
|
||||
eMusicStreamState_Opening,
|
||||
@@ -76,43 +87,59 @@ enum MUSIC_STREAMSTATE
|
||||
|
||||
typedef struct
|
||||
{
|
||||
F32 x,y,z,volume,pitch;
|
||||
#ifndef _WINDOWS64
|
||||
F32 x, y, z, volume, pitch;
|
||||
#else
|
||||
float x, y, z, volume, pitch;
|
||||
#endif
|
||||
int iSound;
|
||||
bool bIs3D;
|
||||
bool bUseSoundsPitchVal;
|
||||
bool bIs3D;
|
||||
bool bUseSoundsPitchVal;
|
||||
#ifdef _DEBUG
|
||||
char chName[64];
|
||||
#endif
|
||||
}
|
||||
AUDIO_INFO;
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
struct MiniAudioSound
|
||||
{
|
||||
ma_sound sound;
|
||||
AUDIO_INFO info;
|
||||
bool active;
|
||||
};
|
||||
|
||||
extern std::vector<MiniAudioSound*> m_activeSounds;
|
||||
#endif
|
||||
|
||||
class SoundEngine : public ConsoleSoundEngine
|
||||
{
|
||||
static const int MAX_SAME_SOUNDS_PLAYING = 8; // 4J added
|
||||
public:
|
||||
SoundEngine();
|
||||
virtual void destroy();
|
||||
void destroy() override;
|
||||
#ifdef _DEBUG
|
||||
void GetSoundName(char *szSoundName,int iSound);
|
||||
void GetSoundName(char* szSoundName, int iSound);
|
||||
#endif
|
||||
virtual void play(int iSound, float x, float y, float z, float volume, float pitch);
|
||||
virtual void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true);
|
||||
virtual void playUI(int iSound, float volume, float pitch);
|
||||
virtual void playMusicTick();
|
||||
virtual void updateMusicVolume(float fVal);
|
||||
virtual void updateSystemMusicPlaying(bool isPlaying);
|
||||
virtual void updateSoundEffectVolume(float fVal);
|
||||
virtual void init(Options *);
|
||||
virtual void tick(shared_ptr<Mob> *players, float a); // 4J - updated to take array of local players rather than single one
|
||||
virtual void add(const wstring& name, File *file);
|
||||
virtual void addMusic(const wstring& name, File *file);
|
||||
virtual void addStreaming(const wstring& name, File *file);
|
||||
virtual char *ConvertSoundPathToName(const wstring& name, bool bConvertSpaces=false);
|
||||
void play(int iSound, float x, float y, float z, float volume, float pitch) override;
|
||||
void playStreaming(const wstring& name, float x, float y, float z, float volume, float pitch, bool bMusicDelay = true) override;
|
||||
void playUI(int iSound, float volume, float pitch) override;
|
||||
void playMusicTick() override;
|
||||
void updateMusicVolume(float fVal) override;
|
||||
void updateSystemMusicPlaying(bool isPlaying) override;
|
||||
void updateSoundEffectVolume(float fVal) override;
|
||||
void init(Options*) override;
|
||||
void tick(shared_ptr<Mob>* players, float a) override; // 4J - updated to take array of local players rather than single one
|
||||
void add(const wstring& name, File* file) override;
|
||||
void addMusic(const wstring& name, File* file) override;
|
||||
void addStreaming(const wstring& name, File* file) override;
|
||||
char* ConvertSoundPathToName(const wstring& name, bool bConvertSpaces = false) override;
|
||||
bool isStreamingWavebankReady(); // 4J Added
|
||||
int getMusicID(int iDomain);
|
||||
int getMusicID(eMusicType iDomain);
|
||||
int getMusicID(const wstring& name);
|
||||
void SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int iNetherMin, int iNetherMax, int iEndMin, int iEndMax, int iCD1);
|
||||
void updateMiles(); // AP added so Vita can update all the Miles functions during the mixer callback
|
||||
void SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int iNetherMin, int iNetherMax, int iEndMin, int iEndMax, int iCreativeMin, int iCreativeMax, int iMenuMin, int iMenuMax, int iCD1);
|
||||
void updateMiniAudio();
|
||||
inline void getGameModeMusicID(Minecraft* pMinecraft, unsigned int i);
|
||||
void playMusicUpdate();
|
||||
|
||||
private:
|
||||
@@ -121,48 +148,56 @@ private:
|
||||
#ifdef __PS3__
|
||||
int initAudioHardware(int iMinSpeakers);
|
||||
#else
|
||||
int initAudioHardware(int iMinSpeakers) { return iMinSpeakers;}
|
||||
int initAudioHardware(int iMinSpeakers) override
|
||||
{
|
||||
return iMinSpeakers;
|
||||
}
|
||||
#endif
|
||||
|
||||
int GetRandomishTrack(int iStart,int iEnd);
|
||||
|
||||
HMSOUNDBANK m_hBank;
|
||||
HDIGDRIVER m_hDriver;
|
||||
HSTREAM m_hStream;
|
||||
int GetRandomishTrack(int iStart, int iEnd);
|
||||
|
||||
MiniAudioSound* m_elytraLoopingSound = nullptr;
|
||||
|
||||
|
||||
ma_engine m_engine;
|
||||
ma_engine_config m_engineConfig;
|
||||
ma_sound m_musicStream;
|
||||
bool m_musicStreamActive;
|
||||
|
||||
static char m_szSoundPath[];
|
||||
static char m_szMusicPath[];
|
||||
static char m_szRedistName[];
|
||||
static char *m_szStreamFileA[eStream_Max];
|
||||
static const char* m_szStreamFileA[eStream_Max];
|
||||
|
||||
AUDIO_LISTENER m_ListenerA[MAX_LOCAL_PLAYERS];
|
||||
int m_validListenerCount;
|
||||
|
||||
|
||||
Random *random;
|
||||
Random* random;
|
||||
int m_musicID;
|
||||
int m_iMusicDelay;
|
||||
int m_StreamState;
|
||||
int m_MusicType;
|
||||
AUDIO_INFO m_StreamingAudioInfo;
|
||||
wstring m_CDMusic;
|
||||
BOOL m_bSystemMusicPlaying;
|
||||
float m_MasterMusicVolume;
|
||||
float m_MasterEffectsVolume;
|
||||
|
||||
C4JThread *m_openStreamThread;
|
||||
static int OpenStreamThreadProc( void* lpParameter );
|
||||
C4JThread* m_openStreamThread;
|
||||
static int OpenStreamThreadProc(void* lpParameter);
|
||||
char m_szStreamName[255];
|
||||
int CurrentSoundsPlaying[eSoundType_MAX+eSFX_MAX];
|
||||
int CurrentSoundsPlaying[eSoundType_MAX + eSFX_MAX];
|
||||
|
||||
// streaming music files - will be different for mash-up packs
|
||||
int m_iStream_Overworld_Min,m_iStream_Overworld_Max;
|
||||
int m_iStream_Nether_Min,m_iStream_Nether_Max;
|
||||
int m_iStream_End_Min,m_iStream_End_Max;
|
||||
int m_iStream_Overworld_Min, m_iStream_Overworld_Max;
|
||||
int m_iStream_Nether_Min, m_iStream_Nether_Max;
|
||||
int m_iStream_End_Min, m_iStream_End_Max;
|
||||
int m_iStream_Creative_Min, m_iStream_Creative_Max;
|
||||
int m_iStream_Menu_Min, m_iStream_Menu_Max;
|
||||
int m_iStream_CD_1;
|
||||
bool *m_bHeardTrackA;
|
||||
bool* m_bHeardTrackA;
|
||||
|
||||
#ifdef __ORBIS__
|
||||
int32_t m_hBGMAudio;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
97230
Minecraft.Client/Common/Audio/miniaudio.h
Normal file
97230
Minecraft.Client/Common/Audio/miniaudio.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -48,6 +48,7 @@
|
||||
#include "..\StringTable.h"
|
||||
#ifndef _XBOX
|
||||
#include "..\ArchiveFile.h"
|
||||
#include "..\FolderFile.h"
|
||||
#endif
|
||||
#include "..\Minecraft.h"
|
||||
#ifdef _XBOX
|
||||
@@ -3464,9 +3465,11 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||
// need to stop the streaming audio - by playing streaming audio from the default texture pack now
|
||||
// reset the streaming sounds back to the normal ones
|
||||
#ifndef _XBOX
|
||||
pMinecraft->soundEngine->SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3,
|
||||
eStream_Nether1,eStream_Nether4,
|
||||
eStream_end_dragon,eStream_end_end,
|
||||
pMinecraft->soundEngine->SetStreamingSounds(eStream_Overworld_Calm1, eStream_Overworld_piano3,
|
||||
eStream_Nether1, eStream_Nether4,
|
||||
eStream_end_dragon, eStream_end_end,
|
||||
eStream_Overworld_Creative1, eStream_Overworld_Creative6,
|
||||
eStream_Overworld_Menu1, eStream_Overworld_Menu4,
|
||||
eStream_CD_1);
|
||||
#endif
|
||||
pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1);
|
||||
@@ -4083,61 +4086,12 @@ void CMinecraftApp::loadMediaArchive()
|
||||
{
|
||||
wstring mediapath = L"";
|
||||
|
||||
#ifdef __PS3__
|
||||
mediapath = L"Common\\Media\\MediaPS3.arc";
|
||||
#elif _WINDOWS64
|
||||
mediapath = L"Common\\Media\\MediaWindows64.arc";
|
||||
#elif __ORBIS__
|
||||
mediapath = L"Common\\Media\\MediaOrbis.arc";
|
||||
#elif _DURANGO
|
||||
mediapath = L"Common\\Media\\MediaDurango.arc";
|
||||
#elif __PSVITA__
|
||||
mediapath = L"Common\\Media\\MediaPSVita.arc";
|
||||
#endif
|
||||
mediapath = L"Common\\Media";
|
||||
|
||||
if (!mediapath.empty())
|
||||
{
|
||||
m_mediaArchive = new ArchiveFile( File(mediapath) );
|
||||
m_mediaArchive = new FolderFile(mediapath);
|
||||
}
|
||||
#if 0
|
||||
string path = "Common\\media.arc";
|
||||
HANDLE hFile = CreateFile( path.c_str(),
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_SEQUENTIAL_SCAN,
|
||||
NULL );
|
||||
|
||||
if( hFile != INVALID_HANDLE_VALUE )
|
||||
{
|
||||
File fileHelper(convStringToWstring(path));
|
||||
DWORD dwFileSize = fileHelper.length();
|
||||
|
||||
// Initialize memory.
|
||||
PBYTE m_fBody = new BYTE[ dwFileSize ];
|
||||
ZeroMemory(m_fBody, dwFileSize);
|
||||
|
||||
DWORD m_fSize = 0;
|
||||
BOOL hr = ReadFile( hFile,
|
||||
m_fBody,
|
||||
dwFileSize,
|
||||
&m_fSize,
|
||||
NULL );
|
||||
|
||||
assert( m_fSize == dwFileSize );
|
||||
|
||||
CloseHandle( hFile );
|
||||
|
||||
m_mediaArchive = new ArchiveFile(m_fBody, m_fSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( false );
|
||||
// AHHHHHHHHHHHH
|
||||
m_mediaArchive = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void CMinecraftApp::loadStringTable()
|
||||
|
||||
@@ -22,6 +22,7 @@ using namespace std;
|
||||
#include "..\Common\GameRules\GameRuleManager.h"
|
||||
#include "..\SkinBox.h"
|
||||
#include "..\ArchiveFile.h"
|
||||
#include "..\FolderFile.h"
|
||||
|
||||
typedef struct _JoinFromInviteData
|
||||
{
|
||||
@@ -415,7 +416,7 @@ public:
|
||||
void loadStringTable();
|
||||
|
||||
protected:
|
||||
ArchiveFile *m_mediaArchive;
|
||||
FolderFile *m_mediaArchive;
|
||||
StringTable *m_stringTable;
|
||||
|
||||
public:
|
||||
|
||||
@@ -16,6 +16,14 @@ public:
|
||||
e_AudioType_Nether,
|
||||
e_AudioType_End,
|
||||
|
||||
// @3UR: thanks https://github.com/LCERD/PCK-Studio/blob/500fc74395ce99fe20cbd7598999bfab3b606745/PckStudio.Core/FileFormats/PckAudioFile.cs#L25
|
||||
e_AudioType_Creative,
|
||||
e_AudioType_Menu,
|
||||
e_AudioType_Battle,
|
||||
e_AudioType_Tumble,
|
||||
e_AudioType_Glide,
|
||||
e_AudioType_BuildOff,
|
||||
|
||||
e_AudioType_Max,
|
||||
};
|
||||
enum EAudioParameterType
|
||||
|
||||
BIN
Minecraft.Client/Common/Media/platformskin.swf
Normal file
BIN
Minecraft.Client/Common/Media/platformskin.swf
Normal file
Binary file not shown.
BIN
Minecraft.Client/Common/Media/platformskinHD.swf
Normal file
BIN
Minecraft.Client/Common/Media/platformskinHD.swf
Normal file
Binary file not shown.
@@ -457,7 +457,7 @@ void UIController::loadSkins()
|
||||
// Every platform has one of these, so nothing shared
|
||||
if(m_fScreenHeight==1080.0f)
|
||||
{
|
||||
m_iggyLibraries[eLibrary_Platform] = loadSkin(platformSkinPath, L"platformskinHD.swf");
|
||||
m_iggyLibraries[eLibrary_Platform] = loadSkin(L"platformskinHD.swf", L"platformskinHD.swf");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1554,9 +1554,11 @@ void UIController::NavigateToHomeMenu()
|
||||
{
|
||||
// need to stop the streaming audio - by playing streaming audio from the default texture pack now
|
||||
// reset the streaming sounds back to the normal ones
|
||||
pMinecraft->soundEngine->SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3,
|
||||
eStream_Nether1,eStream_Nether4,
|
||||
eStream_end_dragon,eStream_end_end,
|
||||
pMinecraft->soundEngine->SetStreamingSounds(eStream_Overworld_Calm1, eStream_Overworld_piano3,
|
||||
eStream_Nether1, eStream_Nether4,
|
||||
eStream_end_dragon, eStream_end_end,
|
||||
eStream_Overworld_Creative1, eStream_Overworld_Creative6,
|
||||
eStream_Overworld_Menu1, eStream_Overworld_Menu4,
|
||||
eStream_CD_1);
|
||||
pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1);
|
||||
|
||||
|
||||
@@ -467,23 +467,50 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen
|
||||
}
|
||||
#else
|
||||
//DLCPack *pack = texturePack->m_dlcInfoPack->GetParentPack();
|
||||
if(pack->getDLCItemsCount(DLCManager::e_DLCType_Audio)>0)
|
||||
if (pack->getDLCItemsCount(DLCManager::e_DLCType_Audio) > 0)
|
||||
{
|
||||
DLCAudioFile *dlcFile = (DLCAudioFile *) pack->getFile(DLCManager::e_DLCType_Audio, 0);
|
||||
DLCAudioFile* dlcFile = static_cast<DLCAudioFile*>(pack->getFile(DLCManager::e_DLCType_Audio, 0));
|
||||
texturePack->setHasAudio(true);
|
||||
// init the streaming sound ids for this texture pack
|
||||
int iOverworldStart, iNetherStart, iEndStart;
|
||||
int iOverworldC, iNetherC, iEndC;
|
||||
int iOverworldC = dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Overworld);
|
||||
int iNetherC = dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Nether);
|
||||
int iEndStart = iOverworldC + iNetherC;
|
||||
int iEndC = dlcFile->GetCountofType(DLCAudioFile::e_AudioType_End);
|
||||
int iAfterEnd = iOverworldC + iNetherC + iEndC;
|
||||
int iCreativeC = dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Creative);
|
||||
|
||||
iOverworldStart=0;
|
||||
iOverworldC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Overworld);
|
||||
iNetherStart=iOverworldC;
|
||||
iNetherC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Nether);
|
||||
iEndStart=iOverworldC+iNetherC;
|
||||
iEndC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_End);
|
||||
int iCreativeStart, iCreativeRange;
|
||||
if (iCreativeC)
|
||||
{
|
||||
iCreativeStart = iAfterEnd;
|
||||
iCreativeRange = iCreativeC;
|
||||
iAfterEnd += iCreativeC;
|
||||
}
|
||||
else
|
||||
{
|
||||
iCreativeStart = 0;
|
||||
iCreativeRange = iOverworldC;
|
||||
}
|
||||
|
||||
Minecraft::GetInstance()->soundEngine->SetStreamingSounds(iOverworldStart,iOverworldStart+iOverworldC,
|
||||
iNetherStart,iNetherStart+iNetherC,iEndStart,iEndStart+iEndC,iEndStart+iEndC); // push the CD start to after
|
||||
int iMenuC = dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Menu);
|
||||
int iMenuStart, iMenuRange;
|
||||
if (iMenuC)
|
||||
{
|
||||
iMenuStart = iAfterEnd;
|
||||
iMenuRange = iMenuC;
|
||||
iAfterEnd += iMenuC;
|
||||
}
|
||||
else
|
||||
{
|
||||
iMenuStart = 0;
|
||||
iMenuRange = iOverworldC;
|
||||
}
|
||||
|
||||
Minecraft::GetInstance()->soundEngine->SetStreamingSounds(0, iOverworldC - 1,
|
||||
iOverworldC, iOverworldC + iNetherC - 1,
|
||||
iEndStart, iEndStart + iEndC - 1,
|
||||
iCreativeStart, iCreativeStart + iCreativeRange - 1,
|
||||
iMenuStart, iMenuStart + iMenuRange - 1, iAfterEnd);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
193
Minecraft.Client/FolderFile.cpp
Normal file
193
Minecraft.Client/FolderFile.cpp
Normal file
@@ -0,0 +1,193 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "../Minecraft.World/StringHelpers.h"
|
||||
#include "../Minecraft.World/compression.h"
|
||||
|
||||
#include "FolderFile.h"
|
||||
|
||||
void FolderFile::_buildFileIndex()
|
||||
{
|
||||
_buildFileIndexRecursive(m_folderPath, L"");
|
||||
}
|
||||
|
||||
void FolderFile::_buildFileIndexRecursive(const wstring& currentPath, const wstring& relativePath)
|
||||
{
|
||||
wstring searchPath = currentPath + L"\\*";
|
||||
WIN32_FIND_DATAW findData;
|
||||
HANDLE hFind = FindFirstFileW(searchPath.c_str(), &findData);
|
||||
|
||||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
app.DebugPrintf("Failed to open folder: %ls\n", m_folderPath.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (wcscmp(findData.cFileName, L".") == 0 || wcscmp(findData.cFileName, L"..") == 0)
|
||||
continue;
|
||||
|
||||
wstring filename = findData.cFileName;
|
||||
wstring fullRelativePath = relativePath.empty() ? filename : relativePath + L"\\" + filename;
|
||||
wstring fullPath = currentPath + L"\\" + filename;
|
||||
|
||||
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
_buildFileIndexRecursive(fullPath, fullRelativePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_filePaths[fullRelativePath] = fullPath;
|
||||
}
|
||||
} while (FindNextFileW(hFind, &findData));
|
||||
|
||||
FindClose(hFind);
|
||||
|
||||
app.DebugPrintf("Indexed %d files from folder\n", (int)m_filePaths.size());
|
||||
}
|
||||
|
||||
FolderFile::FolderFile(wstring folderPath)
|
||||
{
|
||||
m_folderPath = folderPath;
|
||||
app.DebugPrintf("Loading folder file...\n");
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
char buf[256];
|
||||
wcstombs(buf, folderPath.c_str(), 256);
|
||||
app.DebugPrintf("folder path - %s\n", buf);
|
||||
#endif
|
||||
|
||||
// Check if folder exists
|
||||
DWORD attrib = GetFileAttributesW(folderPath.c_str());
|
||||
if (attrib == INVALID_FILE_ATTRIBUTES || !(attrib & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
app.DebugPrintf("Failed to load folder - directory doesn't exist!\n");
|
||||
app.FatalLoadError();
|
||||
}
|
||||
|
||||
_buildFileIndex();
|
||||
app.DebugPrintf("Finished loading folder file\n");
|
||||
}
|
||||
|
||||
FolderFile::~FolderFile()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
vector<wstring>* FolderFile::getFileList()
|
||||
{
|
||||
vector<wstring>* out = new vector<wstring>();
|
||||
|
||||
for (const auto& it : m_filePaths)
|
||||
{
|
||||
out->push_back(it.first);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
bool FolderFile::hasFile(const wstring& filename)
|
||||
{
|
||||
return m_filePaths.find(filename) != m_filePaths.end();
|
||||
}
|
||||
|
||||
int FolderFile::getFileSize(const wstring& filename)
|
||||
{
|
||||
auto it = m_filePaths.find(filename);
|
||||
if (it == m_filePaths.end())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
WIN32_FILE_ATTRIBUTE_DATA fileData;
|
||||
if (GetFileAttributesExW(it->second.c_str(), GetFileExInfoStandard, &fileData))
|
||||
{
|
||||
return (int)fileData.nFileSizeLow;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
byteArray FolderFile::getFile(const wstring& filename)
|
||||
{
|
||||
byteArray out;
|
||||
auto it = m_filePaths.find(filename);
|
||||
|
||||
if (it == m_filePaths.end())
|
||||
{
|
||||
app.DebugPrintf("Couldn't find file in folder\n");
|
||||
app.DebugPrintf("Failed to find file '%ls' in folder\n", filename.c_str());
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
__debugbreak();
|
||||
#endif
|
||||
app.FatalLoadError();
|
||||
return out;
|
||||
}
|
||||
|
||||
HANDLE hFile = CreateFileW(
|
||||
it->second.c_str(),
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ,
|
||||
nullptr,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
nullptr
|
||||
);
|
||||
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
app.DebugPrintf("Failed to open file: %ls\n", it->second.c_str());
|
||||
app.FatalLoadError();
|
||||
return out;
|
||||
}
|
||||
|
||||
DWORD fileSize = GetFileSize(hFile, nullptr);
|
||||
if (fileSize == INVALID_FILE_SIZE)
|
||||
{
|
||||
app.DebugPrintf("Failed to get file size: %ls\n", it->second.c_str());
|
||||
CloseHandle(hFile);
|
||||
app.FatalLoadError();
|
||||
return out;
|
||||
}
|
||||
|
||||
PBYTE pData = new BYTE[fileSize];
|
||||
DWORD bytesRead = 0;
|
||||
|
||||
BOOL success = ReadFile(hFile, pData, fileSize, &bytesRead, nullptr);
|
||||
CloseHandle(hFile);
|
||||
|
||||
if (!success || bytesRead != fileSize)
|
||||
{
|
||||
app.DebugPrintf("Failed to read file: %ls\n", it->second.c_str());
|
||||
delete[] pData;
|
||||
app.FatalLoadError();
|
||||
return out;
|
||||
}
|
||||
|
||||
out = byteArray(pData, fileSize);
|
||||
|
||||
// Compressed filenames are preceeded with an asterisk.
|
||||
if (filename[0] == L'*' && out.data != nullptr)
|
||||
{
|
||||
/* 4J-JEV:
|
||||
* If a compressed file is accessed before compression object is
|
||||
* initialized it will crash here (Compression::getCompression).
|
||||
*/
|
||||
///4 279 553 556
|
||||
|
||||
ByteArrayInputStream bais(out);
|
||||
DataInputStream dis(&bais);
|
||||
unsigned int decompressedSize = dis.readInt();
|
||||
dis.close();
|
||||
|
||||
PBYTE uncompressedBuffer = new BYTE[decompressedSize];
|
||||
Compression::getCompression()->Decompress(uncompressedBuffer, &decompressedSize, out.data + 4, out.length - 4);
|
||||
|
||||
delete[] out.data;
|
||||
|
||||
out.data = uncompressedBuffer;
|
||||
out.length = decompressedSize;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
28
Minecraft.Client/FolderFile.h
Normal file
28
Minecraft.Client/FolderFile.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <windows.h>
|
||||
|
||||
#include "../Minecraft.World/ArrayWithLength.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class FolderFile
|
||||
{
|
||||
private:
|
||||
wstring m_folderPath;
|
||||
unordered_map<wstring, wstring> m_filePaths; // filename -> full path
|
||||
|
||||
void _buildFileIndex();
|
||||
void _buildFileIndexRecursive(const wstring& currentPath, const wstring& relativePath);
|
||||
|
||||
public:
|
||||
FolderFile(wstring folderPath);
|
||||
~FolderFile();
|
||||
|
||||
vector<wstring>* getFileList();
|
||||
bool hasFile(const wstring& filename);
|
||||
int getFileSize(const wstring& filename);
|
||||
byteArray getFile(const wstring& filename);
|
||||
};
|
||||
@@ -1296,7 +1296,7 @@ if not exist "$(TargetDir)\savedata" mkdir "$(TargetDir)\savedata"</Command>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile>
|
||||
<AdditionalDependencies>d3d11.lib;..\Minecraft.World\x64_Debug\Minecraft.World.lib;%(AdditionalDependencies);XInput9_1_0.lib;..\Minecraft.Client\Windows64\Miles\Lib\mss64.lib</AdditionalDependencies>
|
||||
<AdditionalDependencies>d3d11.lib;..\Minecraft.World\x64_Debug\Minecraft.World.lib;%(AdditionalDependencies);XInput9_1_0.lib</AdditionalDependencies>
|
||||
<ShowProgress>NotSet</ShowProgress>
|
||||
<SuppressStartupBanner>false</SuppressStartupBanner>
|
||||
<ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>
|
||||
@@ -3201,6 +3201,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
||||
<ClInclude Include="Common\App_enums.h" />
|
||||
<ClInclude Include="Common\App_structs.h" />
|
||||
<ClInclude Include="Common\Audio\Consoles_SoundEngine.h" />
|
||||
<ClInclude Include="Common\Audio\miniaudio.h" />
|
||||
<ClInclude Include="Common\Audio\SoundEngine.h" />
|
||||
<ClInclude Include="Common\BuildVer.h" />
|
||||
<ClInclude Include="Common\Colours\ColourTable.h" />
|
||||
@@ -5776,6 +5777,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
||||
<ClInclude Include="FireballRenderer.h" />
|
||||
<ClInclude Include="FishingHookRenderer.h" />
|
||||
<ClInclude Include="FlameParticle.h" />
|
||||
<ClInclude Include="FolderFile.h" />
|
||||
<ClInclude Include="FolderTexturePack.h" />
|
||||
<ClInclude Include="Font.h" />
|
||||
<ClInclude Include="FootstepParticle.h" />
|
||||
@@ -6515,40 +6517,6 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ORBIS'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|ORBIS'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Windows64\Miles\include\mss.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Durango'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Durango'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|Durango'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ORBIS'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|ORBIS'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ORBIS'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|PSVita'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|PS3'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|PS3'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|PSVita'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|PSVita'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Xbox 360'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|Xbox 360'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Windows64\Miles\include\rrcore.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Durango'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Durango'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|Durango'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ORBIS'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|ORBIS'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ORBIS'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|PSVita'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|PS3'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|PS3'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|PSVita'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|PSVita'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Xbox 360'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|Xbox 360'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Windows64\Minecraft_Macros.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage|Durango'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='CONTENTPACKAGE_SYMBOLS|Durango'">true</ExcludedFromBuild>
|
||||
@@ -14844,6 +14812,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
||||
<ClCompile Include="FireballRenderer.cpp" />
|
||||
<ClCompile Include="FishingHookRenderer.cpp" />
|
||||
<ClCompile Include="FlameParticle.cpp" />
|
||||
<ClCompile Include="FolderFile.cpp" />
|
||||
<ClCompile Include="FolderTexturePack.cpp" />
|
||||
<ClCompile Include="Font.cpp" />
|
||||
<ClCompile Include="FootstepParticle.cpp" />
|
||||
@@ -19550,23 +19519,6 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Xbox 360'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|Xbox 360'">true</ExcludedFromBuild>
|
||||
</Library>
|
||||
<Library Include="Windows64\Miles\lib\mss64.lib">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Durango'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Durango'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|Durango'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ORBIS'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|ORBIS'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ORBIS'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|PSVita'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|PS3'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|PS3'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|PSVita'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|PSVita'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Xbox 360'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|Xbox 360'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">true</ExcludedFromBuild>
|
||||
</Library>
|
||||
<Library Include="Xbox\4JLibs\libs\4J_Input.lib">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='CONTENTPACKAGE_SYMBOLS|x64'">true</ExcludedFromBuild>
|
||||
|
||||
@@ -2190,12 +2190,6 @@
|
||||
<ClInclude Include="VillagerGolemRenderer.h">
|
||||
<Filter>net\minecraft\client\renderer\entity</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Windows64\Miles\include\mss.h">
|
||||
<Filter>Windows64\Miles Sound System\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Windows64\Miles\include\rrcore.h">
|
||||
<Filter>Windows64\Miles Sound System\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Common\Audio\Consoles_SoundEngine.h">
|
||||
<Filter>Common\Source Files\Audio</Filter>
|
||||
</ClInclude>
|
||||
@@ -2772,6 +2766,12 @@
|
||||
<ClInclude Include="Common\UI\UIScene_Keyboard.h">
|
||||
<Filter>Common\Source Files\UI\Scenes</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FolderFile.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Common\Audio\miniaudio.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
@@ -4469,6 +4469,9 @@
|
||||
<ClCompile Include="crt_compat.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FolderFile.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Library Include="Xbox\4JLibs\libs\4J_Render_d.lib">
|
||||
@@ -4516,9 +4519,6 @@
|
||||
<Library Include="Windows64\4JLibs\libs\4J_Input_d.lib">
|
||||
<Filter>Windows64\4JLibs\libs</Filter>
|
||||
</Library>
|
||||
<Library Include="Windows64\Miles\lib\mss64.lib">
|
||||
<Filter>Windows64\Miles Sound System\lib</Filter>
|
||||
</Library>
|
||||
<Library Include="Windows64\Iggy\lib\iggy_w64.lib">
|
||||
<Filter>Windows64\Iggy\lib</Filter>
|
||||
</Library>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,36 +0,0 @@
|
||||
// This is the null header file used to remove Telemetry calls.
|
||||
|
||||
#define TMERR_DISABLED 1
|
||||
|
||||
#define tmTick(...)
|
||||
#define tmPause(...)
|
||||
#define tmEnter(...)
|
||||
#define tmLeave(...)
|
||||
#define tmThreadName(...) TMERR_DISABLED
|
||||
#define tmMutexName(...) TMERR_DISABLED
|
||||
#define tmTryLock(...) TMERR_DISABLED
|
||||
#define tmEndTryLock(...)
|
||||
#define tmSetMutexState(...)
|
||||
#define tmAlloc(...)
|
||||
#define tmRealloc(...)
|
||||
#define tmFree(...)
|
||||
#define tmPlot(...)
|
||||
#define tmBlob(...) TMERR_DISABLED
|
||||
#define tmBlobEx(...) TMERR_DISABLED
|
||||
#define tmMessage(...)
|
||||
#define tmEmitAccumulationZones(...) TMERR_DISABLED
|
||||
#define tmEnterAccumulationZone(...) TMERR_DISABLED
|
||||
#define tmLeaveAccumulationZone(...) TMERR_DISABLED
|
||||
#define tmZone(...)
|
||||
#define tmSetLockState(...)
|
||||
#define tmLockName(...)
|
||||
#define tmSendCallStack(...)
|
||||
#define tmAllocEx(...)
|
||||
|
||||
#define NTELEMETRY 1
|
||||
|
||||
#define TM_CONTEXT_LITE(val) ((char*)(val))
|
||||
#define TM_CONTEXT_FULL(val) ((char*)(val))
|
||||
|
||||
typedef char *HTELEMETRY;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -40,7 +40,6 @@
|
||||
#include "..\Minecraft.Client\TexturePackRepository.h"
|
||||
#include "..\Minecraft.Client\DLCTexturePack.h"
|
||||
#include "..\Minecraft.Client\Common\DLC\DLCPack.h"
|
||||
#include "..\Minecraft.Client\PS3\PS3Extras\ShutdownManager.h"
|
||||
|
||||
|
||||
DWORD Level::tlsIdx = TlsAlloc();
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>true</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user