mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-27 09:53:39 +00:00
Merge pull request #149 from MatthewBeshay/issue/51-phase-1-portable-win32-cleanup
Draft: remove Win32 types from portable code
This commit is contained in:
commit
44ade1f2b2
|
|
@ -326,16 +326,16 @@ void C_4JInput::SetJoypadSensitivity(int, float){}
|
|||
void C_4JInput::SetJoypadStickAxisMap(int, unsigned int, unsigned int){}
|
||||
void C_4JInput::SetJoypadStickTriggerMap(int, unsigned int, unsigned int){}
|
||||
void C_4JInput::SetKeyRepeatRate(float, float){}
|
||||
void C_4JInput::SetDebugSequence(const char*, int(*)(LPVOID), LPVOID){}
|
||||
void C_4JInput::SetDebugSequence(const char*, int(*)(void *), void *){}
|
||||
FLOAT C_4JInput::GetIdleSeconds(int){ return 0.f; }
|
||||
bool C_4JInput::IsPadConnected(int iPad){ return iPad == 0; }
|
||||
|
||||
// Silly check, we check if we have a keyboard.
|
||||
EKeyboardResult C_4JInput::RequestKeyboard(LPCWSTR, LPCWSTR, DWORD, UINT,
|
||||
int(*)(LPVOID, const bool), LPVOID, C_4JInput::EKeyboardMode)
|
||||
EKeyboardResult C_4JInput::RequestKeyboard(const wchar_t *, const wchar_t *, int, unsigned int,
|
||||
int(*)(void *, const bool), void *, C_4JInput::EKeyboardMode)
|
||||
{ return EKeyboard_Cancelled; }
|
||||
|
||||
void C_4JInput::GetText(uint16_t *s){ if (s) s[0] = 0; }
|
||||
bool C_4JInput::VerifyStrings(WCHAR**, int, int(*)(LPVOID, STRING_VERIFY_RESPONSE*), LPVOID){ return true; }
|
||||
void C_4JInput::CancelQueuedVerifyStrings(int(*)(LPVOID, STRING_VERIFY_RESPONSE*), LPVOID){}
|
||||
void C_4JInput::CancelAllVerifyInProgress(){}
|
||||
bool C_4JInput::VerifyStrings(wchar_t **, int, int(*)(void *, STRING_VERIFY_RESPONSE *), void *){ return true; }
|
||||
void C_4JInput::CancelQueuedVerifyStrings(int(*)(void *, STRING_VERIFY_RESPONSE *), void *){}
|
||||
void C_4JInput::CancelAllVerifyInProgress(){}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public:
|
|||
void SetJoypadStickAxisMap(int iPad,unsigned int uiFrom, unsigned int uiTo);
|
||||
void SetJoypadStickTriggerMap(int iPad,unsigned int uiFrom, unsigned int uiTo);
|
||||
void SetKeyRepeatRate(float fRepeatDelaySecs,float fRepeatRateSecs);
|
||||
void SetDebugSequence( const char *chSequenceA,int( *Func)(LPVOID),LPVOID lpParam );
|
||||
void SetDebugSequence( const char *chSequenceA,int( *Func)(void *),void *lpParam );
|
||||
FLOAT GetIdleSeconds(int iPad);
|
||||
bool IsPadConnected(int iPad);
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ public:
|
|||
|
||||
// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=NULL);
|
||||
// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=NULL);
|
||||
EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode);
|
||||
EKeyboardResult RequestKeyboard(const wchar_t *Title, const wchar_t *Text, int iPad, unsigned int uiMaxChars, int( *Func)(void *,const bool), void *lpParam, C_4JInput::EKeyboardMode eMode);
|
||||
void GetText(uint16_t *UTF16String);
|
||||
|
||||
// Online check strings against offensive list - TCR 92
|
||||
|
|
@ -128,8 +128,8 @@ public:
|
|||
// Exemption It is not required to use the Xbox LIVE service to verify real-time text communication. An example of real-time text communication is in-game text chat.
|
||||
//
|
||||
// Intent Protect players from inappropriate language.
|
||||
bool VerifyStrings(WCHAR **pwStringA,int iStringC,int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam);
|
||||
void CancelQueuedVerifyStrings(int( *Func)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam);
|
||||
bool VerifyStrings(wchar_t **pwStringA,int iStringC,int( *Func)(void *,STRING_VERIFY_RESPONSE *),void *lpParam);
|
||||
void CancelQueuedVerifyStrings(int( *Func)(void *,STRING_VERIFY_RESPONSE *),void *lpParam);
|
||||
void CancelAllVerifyInProgress(void);
|
||||
|
||||
//bool InputDetected(DWORD dwUserIndex,WCHAR *pwchInput);
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@ void C_4JProfile::SetLockedProfile(int iProf) {}
|
|||
bool C_4JProfile::IsSignedIn(int iQuadrant) { return iQuadrant == 0; }
|
||||
bool C_4JProfile::IsSignedInLive(int iProf) { return false; }
|
||||
bool C_4JProfile::IsGuest(int iQuadrant) { return false; }
|
||||
UINT C_4JProfile::RequestSignInUI(bool bFromInvite, bool bLocalGame, bool bNoGuestsAllowed, bool bMultiplayerSignIn, bool bAddUser, int(*Func)(LPVOID, const bool, const int iPad), LPVOID lpParam, int iQuadrant) { return 0; }
|
||||
UINT C_4JProfile::DisplayOfflineProfile(int(*Func)(LPVOID, const bool, const int iPad), LPVOID lpParam, int iQuadrant) { return 0; }
|
||||
UINT C_4JProfile::RequestConvertOfflineToGuestUI(int(*Func)(LPVOID, const bool, const int iPad), LPVOID lpParam, int iQuadrant) { return 0; }
|
||||
UINT C_4JProfile::RequestSignInUI(bool bFromInvite, bool bLocalGame, bool bNoGuestsAllowed, bool bMultiplayerSignIn, bool bAddUser, int(*Func)(void *, const bool, const int iPad), void *lpParam, int iQuadrant) { return 0; }
|
||||
UINT C_4JProfile::DisplayOfflineProfile(int(*Func)(void *, const bool, const int iPad), void *lpParam, int iQuadrant) { return 0; }
|
||||
UINT C_4JProfile::RequestConvertOfflineToGuestUI(int(*Func)(void *, const bool, const int iPad), void *lpParam, int iQuadrant) { return 0; }
|
||||
void C_4JProfile::SetPrimaryPlayerChanged(bool bVal) {}
|
||||
bool C_4JProfile::QuerySigninStatus(void) { return true; }
|
||||
void C_4JProfile::GetXUID(int iPad, PlayerUID *pXuid, bool bOnlineXuid) { if (pXuid) *pXuid = 0; }
|
||||
BOOL C_4JProfile::AreXUIDSEqual(PlayerUID xuid1, PlayerUID xuid2) { return xuid1 == xuid2; }
|
||||
BOOL C_4JProfile::XUIDIsGuest(PlayerUID xuid) { return FALSE; }
|
||||
bool C_4JProfile::AreXUIDSEqual(PlayerUID xuid1, PlayerUID xuid2) { return xuid1 == xuid2; }
|
||||
bool C_4JProfile::XUIDIsGuest(PlayerUID xuid) { return false; }
|
||||
bool C_4JProfile::AllowedToPlayMultiplayer(int iProf) { return true; }
|
||||
bool C_4JProfile::GetChatAndContentRestrictions(int iPad, bool *pbChatRestricted, bool *pbContentRestricted, int *piAge) {
|
||||
if (pbChatRestricted) *pbChatRestricted = false;
|
||||
|
|
@ -38,13 +38,13 @@ bool C_4JProfile::GetChatAndContentRestrictions(int iPad, bool *pbChatRestricted
|
|||
return true;
|
||||
}
|
||||
void C_4JProfile::StartTrialGame() {}
|
||||
void C_4JProfile::AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, BOOL *allAllowed, BOOL *friendsAllowed) {
|
||||
if (allAllowed) *allAllowed = TRUE;
|
||||
if (friendsAllowed) *friendsAllowed = TRUE;
|
||||
void C_4JProfile::AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, bool *allAllowed, bool *friendsAllowed) {
|
||||
if (allAllowed) *allAllowed = true;
|
||||
if (friendsAllowed) *friendsAllowed = true;
|
||||
}
|
||||
BOOL C_4JProfile::CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly, PPlayerUID pXuids, DWORD dwXuidCount) { return TRUE; }
|
||||
bool C_4JProfile::CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly, PPlayerUID pXuids, unsigned int xuidCount) { return true; }
|
||||
void C_4JProfile::ShowProfileCard(int iPad, PlayerUID targetUid) {}
|
||||
bool C_4JProfile::GetProfileAvatar(int iPad, int(*Func)(LPVOID lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes), LPVOID lpParam) { return false; }
|
||||
bool C_4JProfile::GetProfileAvatar(int iPad, int(*Func)(void *lpParam, std::uint8_t *thumbnailData, unsigned int thumbnailBytes), void *lpParam) { return false; }
|
||||
void C_4JProfile::CancelProfileAvatarRequest() {}
|
||||
int C_4JProfile::GetPrimaryPad() { return 0; }
|
||||
void C_4JProfile::SetPrimaryPad(int iPad) {}
|
||||
|
|
@ -53,15 +53,15 @@ static char s_gamertag[64] = "Player";
|
|||
char* C_4JProfile::GetGamertag(int iPad) { return s_gamertag; }
|
||||
std::wstring C_4JProfile::GetDisplayName(int iPad) { return L"Player"; }
|
||||
bool C_4JProfile::IsFullVersion() { return true; }
|
||||
void C_4JProfile::SetSignInChangeCallback(void(*Func)(LPVOID, bool, unsigned int), LPVOID lpParam) {}
|
||||
void C_4JProfile::SetNotificationsCallback(void(*Func)(LPVOID, DWORD, unsigned int), LPVOID lpParam) {}
|
||||
void C_4JProfile::SetSignInChangeCallback(void(*Func)(void *, bool, unsigned int), void *lpParam) {}
|
||||
void C_4JProfile::SetNotificationsCallback(void(*Func)(void *, std::uint32_t, unsigned int), void *lpParam) {}
|
||||
bool C_4JProfile::RegionIsNorthAmerica(void) { return true; }
|
||||
bool C_4JProfile::LocaleIsUSorCanada(void) { return true; }
|
||||
HRESULT C_4JProfile::GetLiveConnectionStatus() { return S_OK; }
|
||||
bool C_4JProfile::IsSystemUIDisplayed() { return false; }
|
||||
void C_4JProfile::SetProfileReadErrorCallback(void(*Func)(LPVOID), LPVOID lpParam) {}
|
||||
int C_4JProfile::SetDefaultOptionsCallback(int(*Func)(LPVOID, PROFILESETTINGS *, const int iPad), LPVOID lpParam) { return 0; }
|
||||
int C_4JProfile::SetOldProfileVersionCallback(int(*Func)(LPVOID, unsigned char *, const unsigned short, const int), LPVOID lpParam) { return 0; }
|
||||
void C_4JProfile::SetProfileReadErrorCallback(void(*Func)(void *), void *lpParam) {}
|
||||
int C_4JProfile::SetDefaultOptionsCallback(int(*Func)(void *, PROFILESETTINGS *, const int iPad), void *lpParam) { return 0; }
|
||||
int C_4JProfile::SetOldProfileVersionCallback(int(*Func)(void *, unsigned char *, const unsigned short, const int), void *lpParam) { return 0; }
|
||||
|
||||
static C_4JProfile::PROFILESETTINGS s_defaultSettings = {};
|
||||
C_4JProfile::PROFILESETTINGS* C_4JProfile::GetDashboardProfileSettings(int iPad) { return &s_defaultSettings; }
|
||||
|
|
@ -82,5 +82,5 @@ void C_4JProfile::RegisterRichPresenceContext(int iGameConfigContextID) {}
|
|||
void C_4JProfile::SetRichPresenceContextValue(int iPad, int iContextID, int iVal) {}
|
||||
void C_4JProfile::SetCurrentGameActivity(int iPad, int iNewPresence, bool bSetOthersToIdle) {}
|
||||
void C_4JProfile::DisplayFullVersionPurchase(bool bRequired, int iQuadrant, int iUpsellParam) {}
|
||||
void C_4JProfile::SetUpsellCallback(void(*Func)(LPVOID lpParam, eUpsellType type, eUpsellResponse response, int iUserData), LPVOID lpParam) {}
|
||||
void C_4JProfile::SetUpsellCallback(void(*Func)(void *lpParam, eUpsellType type, eUpsellResponse response, int iUserData), void *lpParam) {}
|
||||
void C_4JProfile::SetDebugFullOverride(bool bVal) {}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
enum eAwardType
|
||||
{
|
||||
eAwardType_Achievement = 0,
|
||||
|
|
@ -54,21 +56,21 @@ public:
|
|||
bool IsSignedIn(int iQuadrant);
|
||||
bool IsSignedInLive(int iProf);
|
||||
bool IsGuest(int iQuadrant);
|
||||
UINT RequestSignInUI(bool bFromInvite,bool bLocalGame,bool bNoGuestsAllowed,bool bMultiplayerSignIn,bool bAddUser, int( *Func)(LPVOID,const bool, const int iPad),LPVOID lpParam,int iQuadrant=XUSER_INDEX_ANY);
|
||||
UINT DisplayOfflineProfile(int( *Func)(LPVOID,const bool, const int iPad),LPVOID lpParam,int iQuadrant=XUSER_INDEX_ANY);
|
||||
UINT RequestConvertOfflineToGuestUI(int( *Func)(LPVOID,const bool, const int iPad),LPVOID lpParam,int iQuadrant=XUSER_INDEX_ANY);
|
||||
UINT RequestSignInUI(bool bFromInvite,bool bLocalGame,bool bNoGuestsAllowed,bool bMultiplayerSignIn,bool bAddUser, int( *Func)(void *,const bool, const int iPad),void *lpParam,int iQuadrant=XUSER_INDEX_ANY);
|
||||
UINT DisplayOfflineProfile(int( *Func)(void *,const bool, const int iPad),void *lpParam,int iQuadrant=XUSER_INDEX_ANY);
|
||||
UINT RequestConvertOfflineToGuestUI(int( *Func)(void *,const bool, const int iPad),void *lpParam,int iQuadrant=XUSER_INDEX_ANY);
|
||||
void SetPrimaryPlayerChanged(bool bVal);
|
||||
bool QuerySigninStatus(void);
|
||||
void GetXUID(int iPad, PlayerUID *pXuid,bool bOnlineXuid);
|
||||
BOOL AreXUIDSEqual(PlayerUID xuid1,PlayerUID xuid2);
|
||||
BOOL XUIDIsGuest(PlayerUID xuid);
|
||||
bool AreXUIDSEqual(PlayerUID xuid1,PlayerUID xuid2);
|
||||
bool XUIDIsGuest(PlayerUID xuid);
|
||||
bool AllowedToPlayMultiplayer(int iProf);
|
||||
bool GetChatAndContentRestrictions(int iPad,bool *pbChatRestricted,bool *pbContentRestricted,int *piAge);
|
||||
void StartTrialGame(); // disables saves and leaderboard, and change state to readyforgame from pregame
|
||||
void AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, BOOL *allAllowed, BOOL *friendsAllowed);
|
||||
BOOL CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly, PPlayerUID pXuids, DWORD dwXuidCount );
|
||||
void AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, bool *allAllowed, bool *friendsAllowed);
|
||||
bool CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly, PPlayerUID pXuids, unsigned int xuidCount);
|
||||
void ShowProfileCard(int iPad, PlayerUID targetUid);
|
||||
bool GetProfileAvatar(int iPad,int( *Func)(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes), LPVOID lpParam);
|
||||
bool GetProfileAvatar(int iPad,int( *Func)(void *lpParam,std::uint8_t *thumbnailData,unsigned int thumbnailBytes), void *lpParam);
|
||||
void CancelProfileAvatarRequest();
|
||||
|
||||
|
||||
|
|
@ -78,18 +80,18 @@ public:
|
|||
char* GetGamertag(int iPad);
|
||||
std::wstring GetDisplayName(int iPad);
|
||||
bool IsFullVersion();
|
||||
void SetSignInChangeCallback(void ( *Func)(LPVOID, bool, unsigned int),LPVOID lpParam);
|
||||
void SetNotificationsCallback(void ( *Func)(LPVOID, DWORD, unsigned int),LPVOID lpParam);
|
||||
void SetSignInChangeCallback(void ( *Func)(void *, bool, unsigned int),void *lpParam);
|
||||
void SetNotificationsCallback(void ( *Func)(void *, std::uint32_t, unsigned int),void *lpParam);
|
||||
bool RegionIsNorthAmerica(void);
|
||||
bool LocaleIsUSorCanada(void);
|
||||
HRESULT GetLiveConnectionStatus();
|
||||
bool IsSystemUIDisplayed();
|
||||
void SetProfileReadErrorCallback(void ( *Func)(LPVOID), LPVOID lpParam);
|
||||
void SetProfileReadErrorCallback(void ( *Func)(void *), void *lpParam);
|
||||
|
||||
|
||||
// PROFILE DATA
|
||||
int SetDefaultOptionsCallback(int( *Func)(LPVOID,PROFILESETTINGS *, const int iPad),LPVOID lpParam);
|
||||
int SetOldProfileVersionCallback(int( *Func)(LPVOID,unsigned char *, const unsigned short,const int),LPVOID lpParam);
|
||||
int SetDefaultOptionsCallback(int( *Func)(void *,PROFILESETTINGS *, const int iPad),void *lpParam);
|
||||
int SetOldProfileVersionCallback(int( *Func)(void *,unsigned char *, const unsigned short,const int),void *lpParam);
|
||||
PROFILESETTINGS * GetDashboardProfileSettings(int iPad);
|
||||
void WriteToProfile(int iQuadrant, bool bGameDefinedDataChanged=false, bool bOverride5MinuteLimitOnProfileWrites=false);
|
||||
void ForceQueuedProfileWrites(int iPad=XUSER_INDEX_ANY);
|
||||
|
|
@ -116,7 +118,7 @@ public:
|
|||
|
||||
// PURCHASE
|
||||
void DisplayFullVersionPurchase(bool bRequired, int iQuadrant, int iUpsellParam = -1);
|
||||
void SetUpsellCallback(void ( *Func)(LPVOID lpParam, eUpsellType type, eUpsellResponse response, int iUserData),LPVOID lpParam);
|
||||
void SetUpsellCallback(void ( *Func)(void *lpParam, eUpsellType type, eUpsellResponse response, int iUserData),void *lpParam);
|
||||
|
||||
// Debug
|
||||
void SetDebugFullOverride(bool bVal); // To override the license version (trail/full). Only in debug/release, not ContentPackage
|
||||
|
|
|
|||
|
|
@ -13,64 +13,64 @@ C4JStorage::C4JStorage() : m_pStringTable(nullptr) {}
|
|||
void C4JStorage::Tick(void) {}
|
||||
|
||||
C4JStorage::EMessageResult C4JStorage::RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA, UINT uiOptionC, DWORD dwPad,
|
||||
int(*Func)(LPVOID, int, const C4JStorage::EMessageResult), LPVOID lpParam, C4JStringTable *pStringTable, WCHAR *pwchFormatString, DWORD dwFocusButton) {
|
||||
int(*Func)(void *, int, const C4JStorage::EMessageResult), void *lpParam, C4JStringTable *pStringTable, WCHAR *pwchFormatString, DWORD dwFocusButton) {
|
||||
return EMessage_ResultAccept;
|
||||
}
|
||||
|
||||
C4JStorage::EMessageResult C4JStorage::GetMessageBoxResult() { return EMessage_Undefined; }
|
||||
|
||||
bool C4JStorage::SetSaveDevice(int(*Func)(LPVOID, const bool), LPVOID lpParam, bool bForceResetOfSaveDevice) { return true; }
|
||||
bool C4JStorage::SetSaveDevice(int(*Func)(void *, const bool), void *lpParam, bool bForceResetOfSaveDevice) { return true; }
|
||||
|
||||
void C4JStorage::Init(unsigned int uiSaveVersion, LPCWSTR pwchDefaultSaveName, char *pszSavePackName, int iMinimumSaveSize, int(*Func)(LPVOID, const ESavingMessage, int), LPVOID lpParam, LPCSTR szGroupID) {}
|
||||
void C4JStorage::Init(unsigned int uiSaveVersion, LPCWSTR pwchDefaultSaveName, char *pszSavePackName, int iMinimumSaveSize, int(*Func)(void *, const ESavingMessage, int), void *lpParam, LPCSTR szGroupID) {}
|
||||
void C4JStorage::ResetSaveData() {}
|
||||
void C4JStorage::SetDefaultSaveNameForKeyboardDisplay(LPCWSTR pwchDefaultSaveName) {}
|
||||
void C4JStorage::SetSaveTitle(LPCWSTR pwchDefaultSaveName) {}
|
||||
bool C4JStorage::GetSaveUniqueNumber(INT *piVal) { if (piVal) *piVal = 0; return true; }
|
||||
bool C4JStorage::GetSaveUniqueFilename(char *pszName) { if (pszName) pszName[0] = '\0'; return true; }
|
||||
void C4JStorage::SetSaveUniqueFilename(char *szFilename) {}
|
||||
void C4JStorage::SetState(ESaveGameControlState eControlState, int(*Func)(LPVOID, const bool), LPVOID lpParam) {}
|
||||
void C4JStorage::SetState(ESaveGameControlState eControlState, int(*Func)(void *, const bool), void *lpParam) {}
|
||||
void C4JStorage::SetSaveDisabled(bool bDisable) {}
|
||||
bool C4JStorage::GetSaveDisabled(void) { return false; }
|
||||
unsigned int C4JStorage::GetSaveSize() { return 0; }
|
||||
void C4JStorage::GetSaveData(void *pvData, unsigned int *puiBytes) { if (puiBytes) *puiBytes = 0; }
|
||||
PVOID C4JStorage::AllocateSaveData(unsigned int uiBytes) { return malloc(uiBytes); }
|
||||
void C4JStorage::SetSaveImages(PBYTE pbThumbnail, DWORD dwThumbnailBytes, PBYTE pbImage, DWORD dwImageBytes, PBYTE pbTextData, DWORD dwTextDataBytes) {}
|
||||
C4JStorage::ESaveGameState C4JStorage::SaveSaveData(int(*Func)(LPVOID, const bool), LPVOID lpParam) { return ESaveGame_Idle; }
|
||||
void C4JStorage::CopySaveDataToNewSave(PBYTE pbThumbnail, DWORD cbThumbnail, WCHAR *wchNewName, int(*Func)(LPVOID lpParam, bool), LPVOID lpParam) {}
|
||||
C4JStorage::ESaveGameState C4JStorage::SaveSaveData(int(*Func)(void *, const bool), void *lpParam) { return ESaveGame_Idle; }
|
||||
void C4JStorage::CopySaveDataToNewSave(PBYTE pbThumbnail, DWORD cbThumbnail, WCHAR *wchNewName, int(*Func)(void *lpParam, bool), void *lpParam) {}
|
||||
void C4JStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected) {}
|
||||
bool C4JStorage::GetSaveDeviceSelected(unsigned int iPad) { return true; }
|
||||
C4JStorage::ESaveGameState C4JStorage::DoesSaveExist(bool *pbExists) { if (pbExists) *pbExists = false; return ESaveGame_Idle; }
|
||||
bool C4JStorage::EnoughSpaceForAMinSaveGame() { return true; }
|
||||
void C4JStorage::SetSaveMessageVPosition(float fY) {}
|
||||
C4JStorage::ESaveGameState C4JStorage::GetSavesInfo(int iPad, int(*Func)(LPVOID lpParam, SAVE_DETAILS *pSaveDetails, const bool), LPVOID lpParam, char *pszSavePackName) { return ESaveGame_Idle; }
|
||||
C4JStorage::ESaveGameState C4JStorage::GetSavesInfo(int iPad, int(*Func)(void *lpParam, SAVE_DETAILS *pSaveDetails, const bool), void *lpParam, char *pszSavePackName) { return ESaveGame_Idle; }
|
||||
PSAVE_DETAILS C4JStorage::ReturnSavesInfo() { return nullptr; }
|
||||
void C4JStorage::ClearSavesInfo() {}
|
||||
C4JStorage::ESaveGameState C4JStorage::LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes), LPVOID lpParam) { return ESaveGame_Idle; }
|
||||
C4JStorage::ESaveGameState C4JStorage::LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo, int(*Func)(void *lpParam, std::uint8_t *thumbnailData, unsigned int thumbnailBytes), void *lpParam) { return ESaveGame_Idle; }
|
||||
void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, XCONTENT_DATA &xContentData) { memset(&xContentData, 0, sizeof(xContentData)); }
|
||||
void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, PBYTE *ppbImageData, DWORD *pdwImageBytes) { if (ppbImageData) *ppbImageData = nullptr; if (pdwImageBytes) *pdwImageBytes = 0; }
|
||||
C4JStorage::ESaveGameState C4JStorage::LoadSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool, const bool), LPVOID lpParam) { return ESaveGame_Idle; }
|
||||
C4JStorage::ESaveGameState C4JStorage::DeleteSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool), LPVOID lpParam) { return ESaveGame_Idle; }
|
||||
void C4JStorage::RegisterMarketplaceCountsCallback(int(*Func)(LPVOID lpParam, C4JStorage::DLC_TMS_DETAILS *, int), LPVOID lpParam) {}
|
||||
C4JStorage::ESaveGameState C4JStorage::LoadSaveData(PSAVE_INFO pSaveInfo, int(*Func)(void *lpParam, const bool, const bool), void *lpParam) { return ESaveGame_Idle; }
|
||||
C4JStorage::ESaveGameState C4JStorage::DeleteSaveData(PSAVE_INFO pSaveInfo, int(*Func)(void *lpParam, const bool), void *lpParam) { return ESaveGame_Idle; }
|
||||
void C4JStorage::RegisterMarketplaceCountsCallback(int(*Func)(void *lpParam, C4JStorage::DLC_TMS_DETAILS *, int), void *lpParam) {}
|
||||
void C4JStorage::SetDLCPackageRoot(char *pszDLCRoot) {}
|
||||
C4JStorage::EDLCStatus C4JStorage::GetDLCOffers(int iPad, int(*Func)(LPVOID, int, DWORD, int), LPVOID lpParam, DWORD dwOfferTypesBitmask) { return EDLC_NoOffers; }
|
||||
C4JStorage::EDLCStatus C4JStorage::GetDLCOffers(int iPad, int(*Func)(void *, int, std::uint32_t, int), void *lpParam, DWORD dwOfferTypesBitmask) { return EDLC_NoOffers; }
|
||||
DWORD C4JStorage::CancelGetDLCOffers() { return 0; }
|
||||
void C4JStorage::ClearDLCOffers() {}
|
||||
XMARKETPLACE_CONTENTOFFER_INFO& C4JStorage::GetOffer(DWORD dw) { return s_dummyOffer; }
|
||||
int C4JStorage::GetOfferCount() { return 0; }
|
||||
DWORD C4JStorage::InstallOffer(int iOfferIDC, __uint64 *ullOfferIDA, int(*Func)(LPVOID, int, int), LPVOID lpParam, bool bTrial) { return 0; }
|
||||
DWORD C4JStorage::InstallOffer(int iOfferIDC, __uint64 *ullOfferIDA, int(*Func)(void *, int, int), void *lpParam, bool bTrial) { return 0; }
|
||||
DWORD C4JStorage::GetAvailableDLCCount(int iPad) { return 0; }
|
||||
C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC(int iPad, int(*Func)(LPVOID, int, int), LPVOID lpParam) { return EDLC_NoInstalledDLC; }
|
||||
C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC(int iPad, int(*Func)(void *, int, int), void *lpParam) { return EDLC_NoInstalledDLC; }
|
||||
XCONTENT_DATA& C4JStorage::GetDLC(DWORD dw) { return s_dummyContentData; }
|
||||
DWORD C4JStorage::MountInstalledDLC(int iPad, DWORD dwDLC, int(*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive) { return 0; }
|
||||
std::uint32_t C4JStorage::MountInstalledDLC(int iPad, std::uint32_t dwDLC, int(*Func)(void *, int, std::uint32_t, std::uint32_t), void *lpParam, LPCSTR szMountDrive) { return 0; }
|
||||
DWORD C4JStorage::UnmountInstalledDLC(LPCSTR szMountDrive) { return 0; }
|
||||
void C4JStorage::GetMountedDLCFileList(const char *szMountDrive, std::vector<std::string> &fileList) { fileList.clear(); }
|
||||
std::string C4JStorage::GetMountedPath(std::string szMount) { return ""; }
|
||||
C4JStorage::ETMSStatus C4JStorage::ReadTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, C4JStorage::eTMS_FileType eFileType,
|
||||
WCHAR *pwchFilename, BYTE **ppBuffer, DWORD *pdwBufferSize, int(*Func)(LPVOID, WCHAR *, int, bool, int), LPVOID lpParam, int iAction) { return ETMSStatus_Fail; }
|
||||
WCHAR *pwchFilename, BYTE **ppBuffer, DWORD *pdwBufferSize, int(*Func)(void *, WCHAR *, int, bool, int), void *lpParam, int iAction) { return ETMSStatus_Fail; }
|
||||
bool C4JStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR *pwchFilename, BYTE *pBuffer, DWORD dwBufferSize) { return false; }
|
||||
bool C4JStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR *pwchFilename) { return false; }
|
||||
void C4JStorage::StoreTMSPathName(WCHAR *pwchName) {}
|
||||
C4JStorage::ETMSStatus C4JStorage::TMSPP_ReadFile(int iPad, C4JStorage::eGlobalStorage eStorageFacility, C4JStorage::eTMS_FILETYPEVAL eFileTypeVal, LPCSTR szFilename, int(*Func)(LPVOID, int, int, PTMSPP_FILEDATA, LPCSTR), LPVOID lpParam, int iUserData) { return ETMSStatus_Fail; }
|
||||
C4JStorage::ETMSStatus C4JStorage::TMSPP_ReadFile(int iPad, C4JStorage::eGlobalStorage eStorageFacility, C4JStorage::eTMS_FILETYPEVAL eFileTypeVal, LPCSTR szFilename, int(*Func)(void *, int, int, PTMSPP_FILEDATA, LPCSTR), void *lpParam, int iUserData) { return ETMSStatus_Fail; }
|
||||
unsigned int C4JStorage::CRC(unsigned char *buf, int len) {
|
||||
unsigned int crc = 0xFFFFFFFF;
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
//#include <xtms.h>
|
||||
|
||||
|
|
@ -242,31 +243,31 @@ public:
|
|||
|
||||
// Messages
|
||||
C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY,
|
||||
int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, C4JStringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0);
|
||||
int( *Func)(void *,int,const C4JStorage::EMessageResult)=NULL,void *lpParam=NULL, C4JStringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0);
|
||||
|
||||
|
||||
C4JStorage::EMessageResult GetMessageBoxResult();
|
||||
|
||||
// save device
|
||||
bool SetSaveDevice(int( *Func)(LPVOID,const bool),LPVOID lpParam, bool bForceResetOfSaveDevice=false);
|
||||
bool SetSaveDevice(int( *Func)(void *,const bool),void *lpParam, bool bForceResetOfSaveDevice=false);
|
||||
|
||||
// savegame
|
||||
void Init(unsigned int uiSaveVersion,LPCWSTR pwchDefaultSaveName,char *pszSavePackName,int iMinimumSaveSize,int( *Func)(LPVOID, const ESavingMessage, int),LPVOID lpParam,LPCSTR szGroupID);
|
||||
void Init(unsigned int uiSaveVersion,LPCWSTR pwchDefaultSaveName,char *pszSavePackName,int iMinimumSaveSize,int( *Func)(void *, const ESavingMessage, int),void *lpParam,LPCSTR szGroupID);
|
||||
void ResetSaveData(); // Call before a new save to clear out stored save file name
|
||||
void SetDefaultSaveNameForKeyboardDisplay(LPCWSTR pwchDefaultSaveName);
|
||||
void SetSaveTitle(LPCWSTR pwchDefaultSaveName);
|
||||
bool GetSaveUniqueNumber(INT *piVal);
|
||||
bool GetSaveUniqueFilename(char *pszName);
|
||||
void SetSaveUniqueFilename(char *szFilename);
|
||||
void SetState(ESaveGameControlState eControlState,int( *Func)(LPVOID,const bool),LPVOID lpParam);
|
||||
void SetState(ESaveGameControlState eControlState,int( *Func)(void *,const bool),void *lpParam);
|
||||
void SetSaveDisabled(bool bDisable);
|
||||
bool GetSaveDisabled(void);
|
||||
unsigned int GetSaveSize();
|
||||
void GetSaveData(void *pvData,unsigned int *puiBytes);
|
||||
PVOID AllocateSaveData(unsigned int uiBytes);
|
||||
void SetSaveImages( PBYTE pbThumbnail,DWORD dwThumbnailBytes,PBYTE pbImage,DWORD dwImageBytes, PBYTE pbTextData ,DWORD dwTextDataBytes); // Sets the thumbnail & image for the save, optionally setting the metadata in the png
|
||||
C4JStorage::ESaveGameState SaveSaveData(int( *Func)(LPVOID ,const bool),LPVOID lpParam);
|
||||
void CopySaveDataToNewSave(PBYTE pbThumbnail,DWORD cbThumbnail,WCHAR *wchNewName,int ( *Func)(LPVOID lpParam, bool), LPVOID lpParam);
|
||||
C4JStorage::ESaveGameState SaveSaveData(int( *Func)(void * ,const bool),void *lpParam);
|
||||
void CopySaveDataToNewSave(PBYTE pbThumbnail,DWORD cbThumbnail,WCHAR *wchNewName,int ( *Func)(void *lpParam, bool), void *lpParam);
|
||||
void SetSaveDeviceSelected(unsigned int uiPad,bool bSelected);
|
||||
bool GetSaveDeviceSelected(unsigned int iPad);
|
||||
C4JStorage::ESaveGameState DoesSaveExist(bool *pbExists);
|
||||
|
|
@ -274,39 +275,39 @@ public:
|
|||
|
||||
void SetSaveMessageVPosition(float fY); // The 'Saving' message will display at a default position unless changed
|
||||
// Get the info for the saves
|
||||
C4JStorage::ESaveGameState GetSavesInfo(int iPad,int ( *Func)(LPVOID lpParam,SAVE_DETAILS *pSaveDetails,const bool),LPVOID lpParam,char *pszSavePackName);
|
||||
C4JStorage::ESaveGameState GetSavesInfo(int iPad,int ( *Func)(void *lpParam,SAVE_DETAILS *pSaveDetails,const bool),void *lpParam,char *pszSavePackName);
|
||||
PSAVE_DETAILS ReturnSavesInfo();
|
||||
void ClearSavesInfo(); // Clears results
|
||||
C4JStorage::ESaveGameState LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo,int( *Func)(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes), LPVOID lpParam); // Get the thumbnail for an individual save referenced by pSaveInfo
|
||||
C4JStorage::ESaveGameState LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo,int( *Func)(void *lpParam,std::uint8_t *thumbnailData,unsigned int thumbnailBytes), void *lpParam); // Get the thumbnail for an individual save referenced by pSaveInfo
|
||||
|
||||
void GetSaveCacheFileInfo(DWORD dwFile,XCONTENT_DATA &xContentData);
|
||||
void GetSaveCacheFileInfo(DWORD dwFile, PBYTE *ppbImageData, DWORD *pdwImageBytes);
|
||||
|
||||
// Load the save. Need to call GetSaveData once the callback is called
|
||||
C4JStorage::ESaveGameState LoadSaveData(PSAVE_INFO pSaveInfo,int( *Func)(LPVOID lpParam,const bool, const bool), LPVOID lpParam);
|
||||
C4JStorage::ESaveGameState DeleteSaveData(PSAVE_INFO pSaveInfo,int( *Func)(LPVOID lpParam,const bool), LPVOID lpParam);
|
||||
C4JStorage::ESaveGameState LoadSaveData(PSAVE_INFO pSaveInfo,int( *Func)(void *lpParam,const bool, const bool), void *lpParam);
|
||||
C4JStorage::ESaveGameState DeleteSaveData(PSAVE_INFO pSaveInfo,int( *Func)(void *lpParam,const bool), void *lpParam);
|
||||
|
||||
// DLC
|
||||
void RegisterMarketplaceCountsCallback(int ( *Func)(LPVOID lpParam, C4JStorage::DLC_TMS_DETAILS *, int), LPVOID lpParam );
|
||||
void RegisterMarketplaceCountsCallback(int ( *Func)(void *lpParam, C4JStorage::DLC_TMS_DETAILS *, int), void *lpParam );
|
||||
void SetDLCPackageRoot(char *pszDLCRoot);
|
||||
C4JStorage::EDLCStatus GetDLCOffers(int iPad,int( *Func)(LPVOID, int, DWORD, int),LPVOID lpParam, DWORD dwOfferTypesBitmask=XMARKETPLACE_OFFERING_TYPE_CONTENT);
|
||||
C4JStorage::EDLCStatus GetDLCOffers(int iPad,int( *Func)(void *, int, std::uint32_t, int),void *lpParam, DWORD dwOfferTypesBitmask=XMARKETPLACE_OFFERING_TYPE_CONTENT);
|
||||
DWORD CancelGetDLCOffers();
|
||||
void ClearDLCOffers();
|
||||
XMARKETPLACE_CONTENTOFFER_INFO& GetOffer(DWORD dw);
|
||||
int GetOfferCount();
|
||||
DWORD InstallOffer(int iOfferIDC, __uint64 *ullOfferIDA,int( *Func)(LPVOID, int, int),LPVOID lpParam, bool bTrial=false);
|
||||
DWORD InstallOffer(int iOfferIDC, __uint64 *ullOfferIDA,int( *Func)(void *, int, int),void *lpParam, bool bTrial=false);
|
||||
DWORD GetAvailableDLCCount( int iPad);
|
||||
|
||||
C4JStorage::EDLCStatus GetInstalledDLC(int iPad,int( *Func)(LPVOID, int, int),LPVOID lpParam);
|
||||
C4JStorage::EDLCStatus GetInstalledDLC(int iPad,int( *Func)(void *, int, int),void *lpParam);
|
||||
XCONTENT_DATA& GetDLC(DWORD dw);
|
||||
DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive=NULL);
|
||||
std::uint32_t MountInstalledDLC(int iPad,std::uint32_t dwDLC,int( *Func)(void *, int, std::uint32_t, std::uint32_t),void *lpParam,LPCSTR szMountDrive=NULL);
|
||||
DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL);
|
||||
void GetMountedDLCFileList(const char* szMountDrive, std::vector<std::string>& fileList);
|
||||
std::string GetMountedPath(std::string szMount);
|
||||
|
||||
// Global title storage
|
||||
C4JStorage::ETMSStatus ReadTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,C4JStorage::eTMS_FileType eFileType,
|
||||
WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int)=NULL,LPVOID lpParam=NULL, int iAction=0);
|
||||
WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(void *, WCHAR *,int, bool, int)=NULL,void *lpParam=NULL, int iAction=0);
|
||||
bool WriteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename,BYTE *pBuffer,DWORD dwBufferSize);
|
||||
bool DeleteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename);
|
||||
void StoreTMSPathName(WCHAR *pwchName=NULL);
|
||||
|
|
@ -319,7 +320,7 @@ public:
|
|||
|
||||
// C4JStorage::ETMSStatus TMSPP_WriteFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=NULL,LPVOID lpParam=NULL, int iUserData=0);
|
||||
// C4JStorage::ETMSStatus TMSPP_GetUserQuotaInfo(int iPad,TMSCLIENT_CALLBACK Func,LPVOID lpParam, int iUserData=0);
|
||||
C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)=NULL,LPVOID lpParam=NULL, int iUserData=0);
|
||||
C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(void *,int,int,PTMSPP_FILEDATA, LPCSTR)=NULL,void *lpParam=NULL, int iUserData=0);
|
||||
// C4JStorage::ETMSStatus TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,CHAR *pchFilePath,int( *Func)(LPVOID,int,int,PTMSPP_FILE_LIST)=NULL,LPVOID lpParam=NULL, int iUserData=0);
|
||||
// C4JStorage::ETMSStatus TMSPP_DeleteFile(int iPad,LPCSTR szFilePath,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,int( *Func)(LPVOID,int,int),LPVOID lpParam=NULL, int iUserData=0);
|
||||
// bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const std::wstring &Filename);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include "../../Minecraft.World/Headers/net.minecraft.world.item.h"
|
||||
|
||||
#include "../Platform/Common/Leaderboards/LeaderboardManager.h"
|
||||
#include <cstring>
|
||||
|
||||
Stat** StatsCounter::LARGE_STATS[] = {
|
||||
&Stats::walkOneM,
|
||||
|
|
@ -142,9 +143,9 @@ void StatsCounter::parse(void* data)
|
|||
assert( stats.size() == 0 );
|
||||
|
||||
//Pointer to current position in stat array
|
||||
PBYTE pbData=(PBYTE)data;
|
||||
pbData+=sizeof(GAME_SETTINGS);
|
||||
unsigned short* statData = (unsigned short*)pbData;//data + (STAT_DATA_OFFSET/sizeof(unsigned short));
|
||||
std::uint8_t* pbData = reinterpret_cast<std::uint8_t*>(data);
|
||||
pbData += sizeof(GAME_SETTINGS);
|
||||
std::uint8_t* statData = pbData;
|
||||
|
||||
//Value being read
|
||||
StatContainer newVal;
|
||||
|
|
@ -157,19 +158,22 @@ void StatsCounter::parse(void* data)
|
|||
{
|
||||
if( !isLargeStat(*iter) )
|
||||
{
|
||||
if( statData[0] != 0 || statData[1] != 0 || statData[2] != 0 || statData[3] != 0 )
|
||||
std::uint16_t difficultyStats[eDifficulty_Max] = {};
|
||||
std::memcpy(difficultyStats, statData, sizeof(difficultyStats));
|
||||
if( difficultyStats[0] != 0 || difficultyStats[1] != 0 || difficultyStats[2] != 0 || difficultyStats[3] != 0 )
|
||||
{
|
||||
newVal.stats[0] = statData[0];
|
||||
newVal.stats[1] = statData[1];
|
||||
newVal.stats[2] = statData[2];
|
||||
newVal.stats[3] = statData[3];
|
||||
newVal.stats[0] = difficultyStats[0];
|
||||
newVal.stats[1] = difficultyStats[1];
|
||||
newVal.stats[2] = difficultyStats[2];
|
||||
newVal.stats[3] = difficultyStats[3];
|
||||
stats.insert( std::make_pair(*iter, newVal) );
|
||||
}
|
||||
statData += 4;
|
||||
statData += sizeof(difficultyStats);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int* largeStatData = (unsigned int*)statData;
|
||||
std::uint32_t largeStatData[eDifficulty_Max] = {};
|
||||
std::memcpy(largeStatData, statData, sizeof(largeStatData));
|
||||
if( largeStatData[0] != 0 || largeStatData[1] != 0 || largeStatData[2] != 0 || largeStatData[3] != 0 )
|
||||
{
|
||||
newVal.stats[0] = largeStatData[0];
|
||||
|
|
@ -178,21 +182,22 @@ void StatsCounter::parse(void* data)
|
|||
newVal.stats[3] = largeStatData[3];
|
||||
stats.insert( std::make_pair(*iter, newVal) );
|
||||
}
|
||||
largeStatData += 4;
|
||||
statData = (unsigned short*)largeStatData;
|
||||
statData += sizeof(largeStatData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( statData[0] != 0 )
|
||||
std::uint16_t achievementValue = 0;
|
||||
std::memcpy(&achievementValue, statData, sizeof(achievementValue));
|
||||
if( achievementValue != 0 )
|
||||
{
|
||||
newVal.stats[0] = statData[0];
|
||||
newVal.stats[0] = achievementValue;
|
||||
newVal.stats[1] = 0;
|
||||
newVal.stats[2] = 0;
|
||||
newVal.stats[3] = 0;
|
||||
stats.insert( std::make_pair(*iter, newVal) );
|
||||
}
|
||||
++statData;
|
||||
statData += sizeof(achievementValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -215,15 +220,14 @@ void StatsCounter::save(int player, bool force)
|
|||
|
||||
//Retrieve the data pointer from the profile
|
||||
#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ )
|
||||
PBYTE pbData = (PBYTE)StorageManager.GetGameDefinedProfileData(player);
|
||||
std::uint8_t* pbData = reinterpret_cast<std::uint8_t*>(StorageManager.GetGameDefinedProfileData(player));
|
||||
#else
|
||||
PBYTE pbData = (PBYTE)ProfileManager.GetGameDefinedProfileData(player);
|
||||
std::uint8_t* pbData = reinterpret_cast<std::uint8_t*>(ProfileManager.GetGameDefinedProfileData(player));
|
||||
#endif
|
||||
pbData+=sizeof(GAME_SETTINGS);
|
||||
pbData += sizeof(GAME_SETTINGS);
|
||||
|
||||
//Pointer to current position in stat array
|
||||
//unsigned short* statData = (unsigned short*)data + (STAT_DATA_OFFSET/sizeof(unsigned short));
|
||||
unsigned short* statData = (unsigned short*)pbData;
|
||||
std::uint8_t* statData = pbData;
|
||||
|
||||
//Reset all the data to 0 (we're going to replace it with the map data)
|
||||
memset(statData, 0, CConsoleMinecraftApp::GAME_DEFINED_PROFILE_DATA_BYTES-sizeof(GAME_SETTINGS));
|
||||
|
|
@ -239,18 +243,20 @@ void StatsCounter::save(int player, bool force)
|
|||
{
|
||||
if( !isLargeStat(*iter) )
|
||||
{
|
||||
std::uint16_t difficultyStats[eDifficulty_Max] = {};
|
||||
if( val != stats.end() )
|
||||
{
|
||||
statData[0] = val->second.stats[0];
|
||||
statData[1] = val->second.stats[1];
|
||||
statData[2] = val->second.stats[2];
|
||||
statData[3] = val->second.stats[3];
|
||||
difficultyStats[0] = static_cast<std::uint16_t>(val->second.stats[0]);
|
||||
difficultyStats[1] = static_cast<std::uint16_t>(val->second.stats[1]);
|
||||
difficultyStats[2] = static_cast<std::uint16_t>(val->second.stats[2]);
|
||||
difficultyStats[3] = static_cast<std::uint16_t>(val->second.stats[3]);
|
||||
}
|
||||
statData += 4;
|
||||
std::memcpy(statData, difficultyStats, sizeof(difficultyStats));
|
||||
statData += sizeof(difficultyStats);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int* largeStatData = (unsigned int*)statData;
|
||||
std::uint32_t largeStatData[eDifficulty_Max] = {};
|
||||
if( val != stats.end() )
|
||||
{
|
||||
largeStatData[0] = val->second.stats[0];
|
||||
|
|
@ -258,17 +264,19 @@ void StatsCounter::save(int player, bool force)
|
|||
largeStatData[2] = val->second.stats[2];
|
||||
largeStatData[3] = val->second.stats[3];
|
||||
}
|
||||
largeStatData += 4;
|
||||
statData = (unsigned short*)largeStatData;
|
||||
std::memcpy(statData, largeStatData, sizeof(largeStatData));
|
||||
statData += sizeof(largeStatData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::uint16_t achievementValue = 0;
|
||||
if( val != stats.end() )
|
||||
{
|
||||
statData[0] = val->second.stats[0];
|
||||
achievementValue = static_cast<std::uint16_t>(val->second.stats[0]);
|
||||
}
|
||||
++statData;
|
||||
std::memcpy(statData, &achievementValue, sizeof(achievementValue));
|
||||
statData += sizeof(achievementValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -283,7 +291,7 @@ void StatsCounter::save(int player, bool force)
|
|||
}
|
||||
|
||||
#ifdef _XBOX
|
||||
void StatsCounter::setLeaderboardProperty(XUSER_PROPERTY* prop, DWORD id, unsigned int value)
|
||||
void StatsCounter::setLeaderboardProperty(XUSER_PROPERTY* prop, std::uint32_t id, unsigned int value)
|
||||
{
|
||||
app.DebugPrintf("Setting property id: %d to value %d\n", id, value);
|
||||
prop->dwPropertyId = id;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <cstdint>
|
||||
class Stat;
|
||||
class Achievement;
|
||||
class StatsSyncher;
|
||||
|
|
@ -95,7 +96,7 @@ private:
|
|||
void dumpStatsToTTY();
|
||||
|
||||
#ifdef _XBOX
|
||||
static void setLeaderboardProperty(XUSER_PROPERTY* prop, DWORD id, unsigned int value);
|
||||
static void setLeaderboardProperty(XUSER_PROPERTY* prop, std::uint32_t id, unsigned int value);
|
||||
static void setLeaderboardRating(XUSER_PROPERTY* prop, LONGLONG value);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1415,7 +1415,7 @@ void Minecraft::run_middle()
|
|||
}
|
||||
else
|
||||
{
|
||||
UINT uiIDA[1] = { IDS_OK };
|
||||
unsigned int uiIDA[1] = { IDS_OK };
|
||||
ui.RequestMessageBox( IDS_CANTJOIN_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA, 1, i, NULL, NULL, app.GetStringTable() );
|
||||
}
|
||||
}
|
||||
|
|
@ -1610,14 +1610,14 @@ void Minecraft::run_middle()
|
|||
// Check if PSN is unavailable because of age restriction
|
||||
if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION)
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_OK;
|
||||
ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, i, NULL, NULL, app.GetStringTable());
|
||||
}
|
||||
else if (ProfileManager.IsSignedIn(i) && !ProfileManager.IsSignedInLive(i))
|
||||
{
|
||||
// You're not signed in to PSN!
|
||||
UINT uiIDA[2];
|
||||
unsigned int uiIDA[2];
|
||||
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
|
||||
uiIDA[1] = IDS_CANCEL;
|
||||
ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, i,&Minecraft::MustSignInReturnedPSN, this, app.GetStringTable(), NULL, 0, false);
|
||||
|
|
@ -1625,7 +1625,7 @@ void Minecraft::run_middle()
|
|||
else
|
||||
#endif
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, i, NULL, NULL, app.GetStringTable());
|
||||
}
|
||||
|
|
@ -3894,7 +3894,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, std::shar
|
|||
// The level renderer needs to have it's stored level set to NULL so that it doesn't break next time we set one
|
||||
if (levelRenderer != NULL)
|
||||
{
|
||||
for(DWORD p = 0; p < XUSER_MAX_COUNT; ++p)
|
||||
for(unsigned int p = 0; p < XUSER_MAX_COUNT; ++p)
|
||||
{
|
||||
levelRenderer->setLevel(p, NULL);
|
||||
}
|
||||
|
|
@ -4225,7 +4225,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId)
|
|||
}
|
||||
|
||||
// Set the animation override if the skin has one
|
||||
DWORD dwSkinID=app.getSkinIdFromPath(player->customTextureUrl);
|
||||
std::uint32_t dwSkinID = app.getSkinIdFromPath(player->customTextureUrl);
|
||||
if(GET_IS_DLC_SKIN_FROM_BITMASK(dwSkinID))
|
||||
{
|
||||
player->setAnimOverrideBitmask(player->getSkinAnimOverrideBitmask(dwSkinID));
|
||||
|
|
@ -4703,7 +4703,7 @@ void Minecraft::playerLeftTutorial(int iPad)
|
|||
|
||||
// 4J Stu -This telemetry event means something different on XboxOne, so we don't call it for simple state changes like this
|
||||
#ifndef _XBOX_ONE
|
||||
for(DWORD idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if(localplayers[idx] != NULL)
|
||||
{
|
||||
|
|
@ -4715,7 +4715,7 @@ void Minecraft::playerLeftTutorial(int iPad)
|
|||
}
|
||||
|
||||
#ifdef _DURANGO
|
||||
void Minecraft::inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasPrivileges, int iPad)
|
||||
void Minecraft::inGameSignInCheckAllPrivilegesCallback(void *lpParam, bool hasPrivileges, int iPad)
|
||||
{
|
||||
Minecraft* pClass = (Minecraft*)lpParam;
|
||||
|
||||
|
|
@ -4727,7 +4727,7 @@ void Minecraft::inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasP
|
|||
{
|
||||
if( !g_NetworkManager.SessionHasSpace() )
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0]=IDS_OK;
|
||||
ui.RequestMessageBox(IDS_MULTIPLAYER_FULL_TITLE, IDS_MULTIPLAYER_FULL_TEXT, uiIDA, 1);
|
||||
ProfileManager.RemoveGamepadFromGame(iPad);
|
||||
|
|
@ -4784,7 +4784,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad)
|
|||
#endif
|
||||
if( !g_NetworkManager.SessionHasSpace() )
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0]=IDS_OK;
|
||||
ui.RequestMessageBox(IDS_MULTIPLAYER_FULL_TITLE, IDS_MULTIPLAYER_FULL_TEXT, uiIDA, 1);
|
||||
#ifdef _DURANGO
|
||||
|
|
@ -4828,7 +4828,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad)
|
|||
// 4J Stu - Don't allow converting to guests as we don't allow any guest sign-in while in the game
|
||||
// Fix for #66516 - TCR #124: MPS Guest Support ; #001: BAS Game Stability: TU8: The game crashes when second Guest signs-in on console which takes part in Xbox LIVE multiplayer session.
|
||||
//ProfileManager.RequestConvertOfflineToGuestUI( &Minecraft::InGame_SignInReturned, pMinecraftClass,iPad);
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,iPad,NULL,NULL, app.GetStringTable());
|
||||
#ifdef _DURANGO
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ public:
|
|||
static __int64 currentTimeMillis();
|
||||
|
||||
#ifdef _DURANGO
|
||||
static void inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasPrivileges, int iPad);
|
||||
static void inGameSignInCheckAllPrivilegesCallback(void *lpParam, bool hasPrivileges, int iPad);
|
||||
#endif
|
||||
static int InGame_SignInReturned(void *pParam,bool bContinue, int iPad);
|
||||
// 4J-PB
|
||||
|
|
@ -317,7 +317,7 @@ public:
|
|||
CRITICAL_SECTION m_setLevelCS;
|
||||
private:
|
||||
// A bit field that store whether a particular quadrant is in the full tutorial or not
|
||||
BYTE m_inFullTutorialBits;
|
||||
std::uint8_t m_inFullTutorialBits;
|
||||
public:
|
||||
bool isTutorial();
|
||||
void playerStartedTutorial(int iPad);
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ MinecraftServer::~MinecraftServer()
|
|||
{
|
||||
}
|
||||
|
||||
bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DWORD initSettings, bool findSeed)
|
||||
bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, std::uint32_t initSettings, bool findSeed)
|
||||
{
|
||||
// 4J - removed
|
||||
#if 0
|
||||
|
|
@ -262,7 +262,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW
|
|||
// 4J delete passed in save data now - this is only required for the tutorial which is loaded by passing data directly in rather than using the storage manager
|
||||
if( initData->saveData )
|
||||
{
|
||||
delete[] (BYTE*)initData->saveData->data;
|
||||
delete[] reinterpret_cast<std::uint8_t *>(initData->saveData->data);
|
||||
initData->saveData->data = 0;
|
||||
initData->saveData->fileSize = 0;
|
||||
}
|
||||
|
|
@ -349,7 +349,7 @@ void MinecraftServer::addPostProcessRequest(ChunkSource *chunkSource, int x, int
|
|||
|
||||
void MinecraftServer::postProcessTerminate(ProgressRenderer *mcprogress)
|
||||
{
|
||||
DWORD status = 0;
|
||||
std::uint32_t status = 0;
|
||||
|
||||
EnterCriticalSection(&server->m_postProcessCS);
|
||||
size_t postProcessItemCount = server->m_postProcessRequests.size();
|
||||
|
|
@ -426,8 +426,8 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const std::ws
|
|||
LevelGenerationOptions *levelGen = app.getLevelGenerationOptions();
|
||||
if( levelGen != NULL && levelGen->requiresBaseSave())
|
||||
{
|
||||
DWORD fileSize = 0;
|
||||
LPVOID pvSaveData = levelGen->getBaseSaveData(fileSize);
|
||||
unsigned int fileSize = 0;
|
||||
std::uint8_t *pvSaveData = levelGen->getBaseSaveData(fileSize);
|
||||
if(pvSaveData && fileSize != 0) bLevelGenBaseSave = true;
|
||||
}
|
||||
ConsoleSaveFileSplit *newFormatSave = NULL;
|
||||
|
|
@ -535,15 +535,15 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const std::ws
|
|||
ConsoleSaveFile *csf = getLevel(0)->getLevelStorage()->getSaveFile();
|
||||
if( csf->doesFileExist(filepath) )
|
||||
{
|
||||
DWORD numberOfBytesRead;
|
||||
unsigned int numberOfBytesRead;
|
||||
byteArray ba_gameRules;
|
||||
|
||||
FileEntry *fe = csf->createFile(filepath);
|
||||
|
||||
ba_gameRules.length = fe->getFileSize();
|
||||
ba_gameRules.data = new BYTE[ ba_gameRules.length ];
|
||||
ba_gameRules.data = new std::uint8_t[ ba_gameRules.length ];
|
||||
|
||||
csf->setFilePointer(fe,0,NULL,FILE_BEGIN);
|
||||
csf->setFilePointer(fe, 0, SaveFileSeekOrigin::Begin);
|
||||
csf->readFile(fe, ba_gameRules.data, ba_gameRules.length, &numberOfBytesRead);
|
||||
assert(numberOfBytesRead == ba_gameRules.length);
|
||||
|
||||
|
|
@ -809,8 +809,8 @@ void MinecraftServer::saveGameRules()
|
|||
{
|
||||
ConsoleSaveFile *csf = getLevel(0)->getLevelStorage()->getSaveFile();
|
||||
FileEntry *fe = csf->createFile(ConsoleSavePath(GAME_RULE_SAVENAME));
|
||||
csf->setFilePointer(fe, 0, NULL, FILE_BEGIN);
|
||||
DWORD length;
|
||||
csf->setFilePointer(fe, 0, SaveFileSeekOrigin::Begin);
|
||||
unsigned int length;
|
||||
csf->writeFile(fe, ba.data, ba.length, &length );
|
||||
|
||||
delete [] ba.data;
|
||||
|
|
@ -1060,7 +1060,7 @@ extern int c0a, c0b, c1a, c1b, c1c, c2a, c2b;
|
|||
void MinecraftServer::run(__int64 seed, void *lpParameter)
|
||||
{
|
||||
NetworkGameInitData *initData = NULL;
|
||||
DWORD initSettings = 0;
|
||||
std::uint32_t initSettings = 0;
|
||||
bool findSeed = false;
|
||||
if(lpParameter != NULL)
|
||||
{
|
||||
|
|
@ -1194,7 +1194,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
|
|||
|
||||
// Process delayed actions
|
||||
eXuiServerAction eAction;
|
||||
LPVOID param;
|
||||
void *param;
|
||||
for(int i=0;i<XUSER_MAX_COUNT;i++)
|
||||
{
|
||||
eAction = app.GetXuiServerAction(i);
|
||||
|
|
@ -1653,7 +1653,7 @@ void MinecraftServer::cycleSlowQueueIndex()
|
|||
|
||||
int startingIndex = s_slowQueuePlayerIndex;
|
||||
INetworkPlayer *currentPlayer = NULL;
|
||||
DWORD currentPlayerCount = 0;
|
||||
int currentPlayerCount = 0;
|
||||
do
|
||||
{
|
||||
currentPlayerCount = g_NetworkManager.GetPlayerCount();
|
||||
|
|
@ -1695,4 +1695,4 @@ bool MinecraftServer::flagEntitiesToBeRemoved(unsigned int *flags)
|
|||
}
|
||||
}
|
||||
return removedFound;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
#include "Input/ConsoleInputSource.h"
|
||||
#include "../Minecraft.World/Util/ArrayWithLength.h"
|
||||
#include "../Minecraft.World/Util/SharedConstants.h"
|
||||
|
|
@ -22,19 +24,19 @@ class CommandDispatcher;
|
|||
|
||||
typedef struct _LoadSaveDataThreadParam
|
||||
{
|
||||
LPVOID data;
|
||||
void *data;
|
||||
__int64 fileSize;
|
||||
const std::wstring saveName;
|
||||
_LoadSaveDataThreadParam(LPVOID data, __int64 filesize, const std::wstring &saveName) : data( data ), fileSize( filesize ), saveName( saveName ) {}
|
||||
_LoadSaveDataThreadParam(void *data, __int64 filesize, const std::wstring &saveName) : data( data ), fileSize( filesize ), saveName( saveName ) {}
|
||||
} LoadSaveDataThreadParam;
|
||||
|
||||
typedef struct _NetworkGameInitData
|
||||
{
|
||||
__int64 seed;
|
||||
LoadSaveDataThreadParam *saveData;
|
||||
DWORD settings;
|
||||
std::uint32_t settings;
|
||||
LevelGenerationOptions *levelGen;
|
||||
DWORD texturePackId;
|
||||
std::uint32_t texturePackId;
|
||||
bool findSeed;
|
||||
unsigned int xzSize;
|
||||
unsigned char hellScale;
|
||||
|
|
@ -115,17 +117,17 @@ private:
|
|||
public:
|
||||
// 4J Stu - This value should be incremented every time the list of players with friends-only UGC settings changes
|
||||
// It is sent with PreLoginPacket and compared when it comes back in the LoginPacket
|
||||
DWORD m_ugcPlayersVersion;
|
||||
std::uint32_t m_ugcPlayersVersion;
|
||||
|
||||
// This value is used to store the texture pack id for the currently loaded world
|
||||
DWORD m_texturePackId;
|
||||
std::uint32_t m_texturePackId;
|
||||
|
||||
public:
|
||||
MinecraftServer();
|
||||
~MinecraftServer();
|
||||
private:
|
||||
// 4J Added - LoadSaveDataThreadParam
|
||||
bool initServer(__int64 seed, NetworkGameInitData *initData, DWORD initSettings, bool findSeed);
|
||||
bool initServer(__int64 seed, NetworkGameInitData *initData, std::uint32_t initSettings, bool findSeed);
|
||||
void postProcessTerminate(ProgressRenderer *mcprogress);
|
||||
bool loadLevel(LevelStorageSource *storageSource, const std::wstring& name, __int64 levelSeed, LevelType *pLevelType, NetworkGameInitData *initData);
|
||||
void setProgress(const std::wstring& status, int progress);
|
||||
|
|
|
|||
|
|
@ -197,8 +197,8 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet)
|
|||
|
||||
if(iUserID!=-1)
|
||||
{
|
||||
BYTE *pBuffer=NULL;
|
||||
DWORD dwSize=0;
|
||||
std::uint8_t *pBuffer = NULL;
|
||||
unsigned int dwSize = 0;
|
||||
bool bRes;
|
||||
|
||||
// if there's a special skin or cloak for this player, add it in
|
||||
|
|
@ -305,7 +305,7 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet)
|
|||
//minecraft->setScreen(new ReceivingLevelScreen(this));
|
||||
minecraft->player->entityId = packet->clientVersion;
|
||||
|
||||
BYTE networkSmallId = getSocket()->getSmallId();
|
||||
std::uint8_t networkSmallId = getSocket()->getSmallId();
|
||||
app.UpdatePlayerInfo(networkSmallId, packet->m_playerIndex, packet->m_uiGamePrivileges);
|
||||
minecraft->player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges);
|
||||
|
||||
|
|
@ -375,7 +375,7 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet)
|
|||
player->setCustomCape( app.GetPlayerCapeId(m_userIndex) );
|
||||
|
||||
|
||||
BYTE networkSmallId = getSocket()->getSmallId();
|
||||
std::uint8_t networkSmallId = getSocket()->getSmallId();
|
||||
app.UpdatePlayerInfo(networkSmallId, packet->m_playerIndex, packet->m_uiGamePrivileges);
|
||||
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges);
|
||||
|
||||
|
|
@ -1172,7 +1172,7 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason,
|
|||
m_userIndex == ProfileManager.GetPrimaryPad() &&
|
||||
!MinecraftServer::saveOnExitAnswered() )
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(IDS_EXITING_GAME, IDS_GENERIC_ERROR, uiIDA, 1, ProfileManager.GetPrimaryPad(),&ClientConnection::HostDisconnectReturned,NULL, app.GetStringTable());
|
||||
}
|
||||
|
|
@ -1619,11 +1619,11 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
|
|||
fprintf(stderr, "[LOGIN-CLI] handlePreLogin entered, isHost=%d, userIdx=%d\n", (int)g_NetworkManager.IsHost(), m_userIndex);
|
||||
#if 1
|
||||
// 4J - Check that we can play with all the players already in the game who have Friends-Only UGC set
|
||||
BOOL canPlay = TRUE;
|
||||
BOOL canPlayLocal = TRUE;
|
||||
BOOL isAtLeastOneFriend = g_NetworkManager.IsHost();
|
||||
BOOL isFriendsWithHost = TRUE;
|
||||
BOOL cantPlayContentRestricted = FALSE;
|
||||
bool canPlay = true;
|
||||
bool canPlayLocal = true;
|
||||
bool isAtLeastOneFriend = g_NetworkManager.IsHost();
|
||||
bool isFriendsWithHost = true;
|
||||
bool cantPlayContentRestricted = false;
|
||||
|
||||
if(!g_NetworkManager.IsHost())
|
||||
{
|
||||
|
|
@ -1642,12 +1642,12 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
|
|||
{
|
||||
if(m_userIndex == ProfileManager.GetPrimaryPad() )
|
||||
{
|
||||
for(DWORD idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
for(std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if(ProfileManager.IsSignedIn(m_userIndex) && ProfileManager.IsGuest(idx))
|
||||
{
|
||||
canPlay = FALSE;
|
||||
isFriendsWithHost = FALSE;
|
||||
canPlay = false;
|
||||
isFriendsWithHost = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1659,13 +1659,12 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
|
|||
if( playerXuid != INVALID_XUID )
|
||||
{
|
||||
// Is this user friends with the host player?
|
||||
BOOL result;
|
||||
DWORD error;
|
||||
error = XUserAreUsersFriends(idx,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL);
|
||||
if(error == ERROR_SUCCESS && result != TRUE)
|
||||
int result = 0;
|
||||
const unsigned int error = XUserAreUsersFriends(idx,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL);
|
||||
if(error == ERROR_SUCCESS && result == 0)
|
||||
{
|
||||
canPlay = FALSE;
|
||||
isFriendsWithHost = FALSE;
|
||||
canPlay = false;
|
||||
isFriendsWithHost = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1676,8 +1675,8 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
|
|||
{
|
||||
if(ProfileManager.IsSignedIn(m_userIndex) && ProfileManager.IsGuest(m_userIndex))
|
||||
{
|
||||
canPlay = FALSE;
|
||||
isFriendsWithHost = FALSE;
|
||||
canPlay = false;
|
||||
isFriendsWithHost = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1689,13 +1688,12 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
|
|||
if( playerXuid != INVALID_XUID )
|
||||
{
|
||||
// Is this user friends with the host player?
|
||||
BOOL result;
|
||||
DWORD error;
|
||||
error = XUserAreUsersFriends(m_userIndex,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL);
|
||||
if(error == ERROR_SUCCESS && result != TRUE)
|
||||
int result = 0;
|
||||
const unsigned int error = XUserAreUsersFriends(m_userIndex,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL);
|
||||
if(error == ERROR_SUCCESS && result == 0)
|
||||
{
|
||||
canPlay = FALSE;
|
||||
isFriendsWithHost = FALSE;
|
||||
canPlay = false;
|
||||
isFriendsWithHost = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1704,10 +1702,10 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
|
|||
|
||||
if( canPlay )
|
||||
{
|
||||
for(DWORD i = 0; i < packet->m_dwPlayerCount; ++i)
|
||||
for(std::uint8_t i = 0; i < packet->m_dwPlayerCount; ++i)
|
||||
{
|
||||
bool localPlayer = false;
|
||||
for(DWORD idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
for(std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if( ProfileManager.IsSignedInLive(idx) )
|
||||
{
|
||||
|
|
@ -1735,16 +1733,15 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
|
|||
|
||||
// 4J Stu - Everyone joining needs to have at least one friend in the game
|
||||
// Local players are implied friends
|
||||
if( isAtLeastOneFriend != TRUE )
|
||||
if(!isAtLeastOneFriend)
|
||||
{
|
||||
BOOL result;
|
||||
DWORD error;
|
||||
for(DWORD idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
int result = 0;
|
||||
for(std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if( ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) )
|
||||
{
|
||||
error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL);
|
||||
if(error == ERROR_SUCCESS && result == TRUE) isAtLeastOneFriend = TRUE;
|
||||
const unsigned int error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL);
|
||||
if(error == ERROR_SUCCESS && result != 0) isAtLeastOneFriend = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1765,14 +1762,13 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
|
|||
bool thisQuadrantOnly = true;
|
||||
if( m_userIndex == ProfileManager.GetPrimaryPad() ) thisQuadrantOnly = false;
|
||||
|
||||
BOOL result;
|
||||
DWORD error;
|
||||
for(DWORD idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
int result = 0;
|
||||
for(std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if( (!thisQuadrantOnly || m_userIndex == idx) && ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) )
|
||||
{
|
||||
error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL);
|
||||
if(error == ERROR_SUCCESS) canPlay &= result;
|
||||
const unsigned int error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL);
|
||||
if(error == ERROR_SUCCESS) canPlay &= (result != 0);
|
||||
}
|
||||
if(!canPlay) break;
|
||||
}
|
||||
|
|
@ -1783,10 +1779,10 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
|
|||
}
|
||||
#else
|
||||
// TODO - handle this kind of things for non-360 platforms
|
||||
canPlay = TRUE;
|
||||
canPlayLocal = TRUE;
|
||||
isAtLeastOneFriend = TRUE;
|
||||
cantPlayContentRestricted= FALSE;
|
||||
canPlay = true;
|
||||
canPlayLocal = true;
|
||||
isAtLeastOneFriend = true;
|
||||
cantPlayContentRestricted= false;
|
||||
|
||||
#if ( defined __PS3__ || defined __ORBIS__ || defined __PSVITA__)
|
||||
|
||||
|
|
@ -1987,7 +1983,7 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
|
|||
else if(cantPlayContentRestricted) reason = DisconnectPacket::eDisconnect_ContentRestricted_Single_Local;
|
||||
|
||||
app.DebugPrintf("Exiting player %d on handling Pre-Login packet due UGC privileges: %d\n", m_userIndex, reason);
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
if(!isFriendsWithHost) ui.RequestMessageBox( IDS_CANTJOIN_TITLE, IDS_NOTALLOWED_FRIENDSOFFRIENDS, uiIDA,1,m_userIndex,NULL,NULL, app.GetStringTable());
|
||||
else ui.RequestMessageBox( IDS_CANTJOIN_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL, uiIDA,1,m_userIndex,NULL,NULL, app.GetStringTable());
|
||||
|
|
@ -2056,11 +2052,12 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
|
|||
// All other players we use their offline XUID so that they can play the game offline
|
||||
ProfileManager.GetXUID(m_userIndex,&offlineXUID,false);
|
||||
}
|
||||
BOOL allAllowed, friendsAllowed;
|
||||
bool allAllowed = false;
|
||||
bool friendsAllowed = false;
|
||||
ProfileManager.AllowedPlayerCreatedContent(m_userIndex,true,&allAllowed,&friendsAllowed);
|
||||
fprintf(stderr, "[LOGIN] Sending LoginPacket: user=%ls netVer=%d userIdx=%d isHost=%d\n",
|
||||
minecraft->user->name.c_str(), SharedConstants::NETWORK_PROTOCOL_VERSION, m_userIndex, (int)g_NetworkManager.IsHost());
|
||||
send( std::shared_ptr<LoginPacket>( new LoginPacket(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (allAllowed!=TRUE && friendsAllowed==TRUE),
|
||||
send( std::shared_ptr<LoginPacket>( new LoginPacket(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (!allAllowed && friendsAllowed),
|
||||
packet->m_ugcPlayersVersion, app.GetPlayerSkinId(m_userIndex), app.GetPlayerCapeId(m_userIndex), ProfileManager.IsGuest( m_userIndex ))));
|
||||
fprintf(stderr, "[LOGIN] LoginPacket sent successfully\n");
|
||||
|
||||
|
|
@ -2235,14 +2232,14 @@ void ClientConnection::handleTexture(std::shared_ptr<TexturePacket> packet)
|
|||
// Server side also needs to store a list of those clients waiting to get a texture the server doesn't have yet
|
||||
// so that it can send it out to them when it comes in
|
||||
|
||||
if(packet->dwBytes==0)
|
||||
if(packet->dataBytes==0)
|
||||
{
|
||||
// Request for texture
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"Client received request for custom texture %ls\n",packet->textureName.c_str());
|
||||
#endif
|
||||
PBYTE pbData=NULL;
|
||||
DWORD dwBytes=0;
|
||||
std::uint8_t *pbData=NULL;
|
||||
unsigned int dwBytes=0;
|
||||
app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes);
|
||||
|
||||
if(dwBytes!=0)
|
||||
|
|
@ -2256,7 +2253,7 @@ void ClientConnection::handleTexture(std::shared_ptr<TexturePacket> packet)
|
|||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"Client received custom texture %ls\n",packet->textureName.c_str());
|
||||
#endif
|
||||
app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dwBytes);
|
||||
app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dataBytes);
|
||||
Minecraft::GetInstance()->handleClientTextureReceived(packet->textureName);
|
||||
}
|
||||
}
|
||||
|
|
@ -2273,8 +2270,8 @@ void ClientConnection::handleTextureAndGeometry(std::shared_ptr<TextureAndGeomet
|
|||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"Client received request for custom texture and geometry %ls\n",packet->textureName.c_str());
|
||||
#endif
|
||||
PBYTE pbData=NULL;
|
||||
DWORD dwBytes=0;
|
||||
std::uint8_t *pbData=NULL;
|
||||
unsigned int dwBytes=0;
|
||||
app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes);
|
||||
DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(packet->textureName);
|
||||
|
||||
|
|
@ -2883,7 +2880,7 @@ void ClientConnection::handleGameEvent(std::shared_ptr<GameEventPacket> gameEven
|
|||
}
|
||||
else if (event == GameEventPacket::WIN_GAME)
|
||||
{
|
||||
ui.SetWinUserIndex( (BYTE)gameEventPacket->param );
|
||||
ui.SetWinUserIndex(static_cast<unsigned int>(gameEventPacket->param));
|
||||
|
||||
#ifdef _XBOX
|
||||
|
||||
|
|
@ -3243,7 +3240,7 @@ void ClientConnection::handleUpdateProgress(std::shared_ptr<UpdateProgressPacket
|
|||
|
||||
void ClientConnection::handleUpdateGameRuleProgressPacket(std::shared_ptr<UpdateGameRuleProgressPacket> packet)
|
||||
{
|
||||
LPCWSTR string = app.GetGameRulesString(packet->m_messageId);
|
||||
const wchar_t *string = app.GetGameRulesString(packet->m_messageId);
|
||||
if(string != NULL)
|
||||
{
|
||||
std::wstring message(string);
|
||||
|
|
@ -3291,7 +3288,7 @@ int ClientConnection::HostDisconnectReturned(void *pParam,int iPad,C4JStorage::E
|
|||
// we need to ask if they are sure they want to overwrite the existing game
|
||||
if(bSaveExists && StorageManager.GetSaveDisabled())
|
||||
{
|
||||
UINT uiIDA[2];
|
||||
unsigned int uiIDA[2];
|
||||
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
||||
uiIDA[1]=IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,NULL, app.GetStringTable());
|
||||
|
|
@ -3306,7 +3303,7 @@ int ClientConnection::HostDisconnectReturned(void *pParam,int iPad,C4JStorage::E
|
|||
// we need to ask if they are sure they want to overwrite the existing game
|
||||
if(bSaveExists)
|
||||
{
|
||||
UINT uiIDA[2];
|
||||
unsigned int uiIDA[2];
|
||||
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
||||
uiIDA[1]=IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,NULL, app.GetStringTable());
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public:
|
|||
Socket *getSocket() { return connection->getSocket(); } // 4J Added
|
||||
|
||||
private:
|
||||
DWORD m_userIndex; // 4J Added
|
||||
int m_userIndex; // 4J Added
|
||||
public:
|
||||
SavedDataStorage *savedDataStorage;
|
||||
ClientConnection(Minecraft *minecraft, const std::wstring& ip, int port);
|
||||
|
|
@ -137,4 +137,4 @@ public:
|
|||
virtual void handleXZ(std::shared_ptr<XZPacket> packet);
|
||||
|
||||
void displayPrivilegeChanges(std::shared_ptr<MultiplayerLocalPlayer> player, unsigned int oldPrivileges);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include "../Platform/stdafx.h"
|
||||
#include <cstdint>
|
||||
#include "PendingConnection.h"
|
||||
#include "PlayerConnection.h"
|
||||
#include "ServerConnection.h"
|
||||
|
|
@ -94,9 +95,9 @@ void PendingConnection::sendPreLoginResponse()
|
|||
{
|
||||
// 4J Stu - Calculate the players with UGC privileges set
|
||||
PlayerUID *ugcXuids = new PlayerUID[MINECRAFT_NET_MAX_PLAYERS];
|
||||
DWORD ugcXuidCount = 0;
|
||||
DWORD hostIndex = 0;
|
||||
BYTE ugcFriendsOnlyBits = 0;
|
||||
std::uint8_t ugcXuidCount = 0;
|
||||
std::uint8_t hostIndex = 0;
|
||||
std::uint8_t ugcFriendsOnlyBits = 0;
|
||||
char szUniqueMapName[14];
|
||||
|
||||
StorageManager.GetSaveUniqueFilename(szUniqueMapName);
|
||||
|
|
@ -267,4 +268,4 @@ std::wstring PendingConnection::getName()
|
|||
bool PendingConnection::isServerPacketListener()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -796,14 +796,14 @@ void PlayerConnection::handleTexture(std::shared_ptr<TexturePacket> packet)
|
|||
{
|
||||
// Both PlayerConnection and ClientConnection should handle this mostly the same way
|
||||
|
||||
if(packet->dwBytes==0)
|
||||
if(packet->dataBytes==0)
|
||||
{
|
||||
// Request for texture
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"Server received request for custom texture %ls\n",packet->textureName.c_str());
|
||||
#endif
|
||||
PBYTE pbData=NULL;
|
||||
DWORD dwBytes=0;
|
||||
std::uint8_t *pbData=NULL;
|
||||
unsigned int dwBytes=0;
|
||||
app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes);
|
||||
|
||||
if(dwBytes!=0)
|
||||
|
|
@ -821,7 +821,7 @@ void PlayerConnection::handleTexture(std::shared_ptr<TexturePacket> packet)
|
|||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"Server received custom texture %ls\n",packet->textureName.c_str());
|
||||
#endif
|
||||
app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dwBytes);
|
||||
app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dataBytes);
|
||||
server->connection->handleTextureReceived(packet->textureName);
|
||||
}
|
||||
}
|
||||
|
|
@ -836,8 +836,8 @@ void PlayerConnection::handleTextureAndGeometry(std::shared_ptr<TextureAndGeomet
|
|||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"Server received request for custom texture %ls\n",packet->textureName.c_str());
|
||||
#endif
|
||||
PBYTE pbData=NULL;
|
||||
DWORD dwTextureBytes=0;
|
||||
std::uint8_t *pbData=NULL;
|
||||
unsigned int dwTextureBytes=0;
|
||||
app.GetMemFileDetails(packet->textureName,&pbData,&dwTextureBytes);
|
||||
DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(packet->textureName);
|
||||
|
||||
|
|
@ -900,8 +900,8 @@ void PlayerConnection::handleTextureReceived(const std::wstring &textureName)
|
|||
AUTO_VAR(it, find( m_texturesRequested.begin(), m_texturesRequested.end(), textureName ));
|
||||
if( it != m_texturesRequested.end() )
|
||||
{
|
||||
PBYTE pbData=NULL;
|
||||
DWORD dwBytes=0;
|
||||
std::uint8_t *pbData=NULL;
|
||||
unsigned int dwBytes=0;
|
||||
app.GetMemFileDetails(textureName,&pbData,&dwBytes);
|
||||
|
||||
if(dwBytes!=0)
|
||||
|
|
@ -918,8 +918,8 @@ void PlayerConnection::handleTextureAndGeometryReceived(const std::wstring &text
|
|||
AUTO_VAR(it, find( m_texturesRequested.begin(), m_texturesRequested.end(), textureName ));
|
||||
if( it != m_texturesRequested.end() )
|
||||
{
|
||||
PBYTE pbData=NULL;
|
||||
DWORD dwTextureBytes=0;
|
||||
std::uint8_t *pbData=NULL;
|
||||
unsigned int dwTextureBytes=0;
|
||||
app.GetMemFileDetails(textureName,&pbData,&dwTextureBytes);
|
||||
DLCSkinFile *pDLCSkinFile=app.m_dlcManager.getSkinFile(textureName);
|
||||
|
||||
|
|
@ -932,7 +932,7 @@ void PlayerConnection::handleTextureAndGeometryReceived(const std::wstring &text
|
|||
else
|
||||
{
|
||||
// get the data from the app
|
||||
DWORD dwSkinID = app.getSkinIdFromPath(textureName);
|
||||
std::uint32_t dwSkinID = app.getSkinIdFromPath(textureName);
|
||||
std::vector<SKIN_BOX *> *pvSkinBoxes = app.GetAdditionalSkinBoxes(dwSkinID);
|
||||
unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(dwSkinID);
|
||||
|
||||
|
|
@ -1205,7 +1205,7 @@ void PlayerConnection::handleSetCreativeModeSlot(std::shared_ptr<SetCreativeMode
|
|||
// 4J-PB - for Xbox maps, we'll centre them on the origin of the world, since we can fit the whole world in our map
|
||||
data->x = centreXC;
|
||||
data->z = centreZC;
|
||||
data->dimension = (uint8_t) player->level->dimension->id;
|
||||
data->dimension = (std::uint8_t) player->level->dimension->id;
|
||||
data->setDirty();
|
||||
}
|
||||
|
||||
|
|
@ -1714,4 +1714,4 @@ bool PlayerConnection::isGuest()
|
|||
}
|
||||
return isGuest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include "../Platform/stdafx.h"
|
||||
#include <cstdint>
|
||||
#include "PlayerList.h"
|
||||
#include "PlayerChunkMap.h"
|
||||
#include "../MinecraftServer.h"
|
||||
|
|
@ -105,7 +106,7 @@ void PlayerList::placeNewPlayer(Connection *connection, std::shared_ptr<ServerPl
|
|||
|
||||
ServerLevel *level = server->getLevel(player->dimension);
|
||||
|
||||
DWORD playerIndex = 0;
|
||||
std::uint8_t playerIndex = 0;
|
||||
{
|
||||
bool usedIndexes[MINECRAFT_NET_MAX_PLAYERS];
|
||||
ZeroMemory( &usedIndexes, MINECRAFT_NET_MAX_PLAYERS * sizeof(bool) );
|
||||
|
|
@ -210,8 +211,8 @@ void PlayerList::placeNewPlayer(Connection *connection, std::shared_ptr<ServerPl
|
|||
addPlayerToReceiving( player );
|
||||
|
||||
playerConnection->send( std::shared_ptr<LoginPacket>( new LoginPacket(L"", player->entityId, level->getLevelData()->getGenerator(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(),
|
||||
(uint8_t) level->dimension->id, (uint8_t) level->getMaxBuildHeight(), (uint8_t) getMaxPlayers(),
|
||||
level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), (BYTE)playerIndex, level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(),
|
||||
(std::uint8_t) level->dimension->id, (std::uint8_t) level->getMaxBuildHeight(), (std::uint8_t) getMaxPlayers(),
|
||||
level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), playerIndex, level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(),
|
||||
level->getLevelData()->getXZSize(), level->getLevelData()->getHellScale() ) ) );
|
||||
playerConnection->send( std::shared_ptr<SetSpawnPositionPacket>( new SetSpawnPositionPacket(spawnPos->x, spawnPos->y, spawnPos->z) ) );
|
||||
playerConnection->send( std::shared_ptr<PlayerAbilitiesPacket>( new PlayerAbilitiesPacket(&player->abilities)) );
|
||||
|
|
@ -535,7 +536,7 @@ std::shared_ptr<ServerPlayer> PlayerList::respawn(std::shared_ptr<ServerPlayer>
|
|||
serverPlayer->dimension = targetDimension;
|
||||
|
||||
EDefaultSkins skin = serverPlayer->getPlayerDefaultSkin();
|
||||
DWORD playerIndex = serverPlayer->getPlayerIndex();
|
||||
std::uint8_t playerIndex = serverPlayer->getPlayerIndex();
|
||||
|
||||
PlayerUID playerXuid = serverPlayer->getXuid();
|
||||
PlayerUID playerOnlineXuid = serverPlayer->getOnlineXuid();
|
||||
|
|
@ -846,7 +847,7 @@ void PlayerList::tick()
|
|||
EnterCriticalSection(&m_closePlayersCS);
|
||||
while(!m_smallIdsToClose.empty())
|
||||
{
|
||||
BYTE smallId = m_smallIdsToClose.front();
|
||||
std::uint8_t smallId = m_smallIdsToClose.front();
|
||||
m_smallIdsToClose.pop_front();
|
||||
|
||||
std::shared_ptr<ServerPlayer> player = nullptr;
|
||||
|
|
@ -872,7 +873,7 @@ void PlayerList::tick()
|
|||
EnterCriticalSection(&m_kickPlayersCS);
|
||||
while(!m_smallIdsToKick.empty())
|
||||
{
|
||||
BYTE smallId = m_smallIdsToKick.front();
|
||||
std::uint8_t smallId = m_smallIdsToKick.front();
|
||||
m_smallIdsToKick.pop_front();
|
||||
INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId(smallId);
|
||||
if( selectedPlayer != NULL )
|
||||
|
|
@ -1415,14 +1416,14 @@ bool PlayerList::canReceiveAllPackets(std::shared_ptr<ServerPlayer> player)
|
|||
return false;
|
||||
}
|
||||
|
||||
void PlayerList::kickPlayerByShortId(BYTE networkSmallId)
|
||||
void PlayerList::kickPlayerByShortId(std::uint8_t networkSmallId)
|
||||
{
|
||||
EnterCriticalSection(&m_kickPlayersCS);
|
||||
m_smallIdsToKick.push_back(networkSmallId);
|
||||
LeaveCriticalSection(&m_kickPlayersCS);
|
||||
}
|
||||
|
||||
void PlayerList::closePlayerConnectionBySmallId(BYTE networkSmallId)
|
||||
void PlayerList::closePlayerConnectionBySmallId(std::uint8_t networkSmallId)
|
||||
{
|
||||
EnterCriticalSection(&m_closePlayersCS);
|
||||
m_smallIdsToClose.push_back(networkSmallId);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <deque>
|
||||
#include "../../Minecraft.World/Util/ArrayWithLength.h"
|
||||
|
||||
|
|
@ -30,9 +31,9 @@ private:
|
|||
|
||||
// 4J Added
|
||||
std::vector<PlayerUID> m_bannedXuids;
|
||||
std::deque<BYTE> m_smallIdsToKick;
|
||||
std::deque<std::uint8_t> m_smallIdsToKick;
|
||||
CRITICAL_SECTION m_kickPlayersCS;
|
||||
std::deque<BYTE> m_smallIdsToClose;
|
||||
std::deque<std::uint8_t> m_smallIdsToClose;
|
||||
CRITICAL_SECTION m_closePlayersCS;
|
||||
/* 4J - removed
|
||||
Set<String> bans = new HashSet<String>();
|
||||
|
|
@ -119,8 +120,8 @@ public:
|
|||
void setAllowCheatsForAllPlayers(bool allowCommands);
|
||||
|
||||
// 4J Added
|
||||
void kickPlayerByShortId(BYTE networkSmallId);
|
||||
void closePlayerConnectionBySmallId(BYTE networkSmallId);
|
||||
void kickPlayerByShortId(std::uint8_t networkSmallId);
|
||||
void closePlayerConnectionBySmallId(std::uint8_t networkSmallId);
|
||||
bool isXuidBanned(PlayerUID xuid);
|
||||
// AP added for Vita so the range can be increased once the level starts
|
||||
void setViewDistance(int newViewDistance);
|
||||
|
|
|
|||
|
|
@ -664,7 +664,6 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener)
|
|||
C4JThread::Event *wakeEvent[3]; // This sets off the threads that are waiting to continue
|
||||
C4JThread::Event *notificationEvent[3]; // These are signalled by the threads to let us know they are complete
|
||||
C4JThread *saveThreads[3];
|
||||
DWORD threadId[3];
|
||||
SaveThreadData threadData[3];
|
||||
ZeroMemory(&threadData[0], sizeof(SaveThreadData));
|
||||
ZeroMemory(&threadData[1], sizeof(SaveThreadData));
|
||||
|
|
@ -687,7 +686,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener)
|
|||
}
|
||||
|
||||
LevelChunk *chunk = NULL;
|
||||
uint8_t workingThreads;
|
||||
std::uint8_t workingThreads;
|
||||
bool chunkSet = false;
|
||||
|
||||
// Created a roughly sorted list to match the order that the files were created in McRegionChunkStorage::McRegionChunkStorage.
|
||||
|
|
@ -739,7 +738,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener)
|
|||
{
|
||||
char threadName[256];
|
||||
sprintf(threadName,"Save thread %d\n",j);
|
||||
SetThreadName(threadId[j], threadName);
|
||||
SetThreadName(0, threadName);
|
||||
|
||||
//saveThreads[j] = CreateThread(NULL,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]);
|
||||
saveThreads[j] = new C4JThread(runSaveThreadProc,(void *)&threadData[j],threadName);
|
||||
|
|
@ -912,9 +911,9 @@ TilePos *ServerChunkCache::findNearestMapFeature(Level *level, const std::wstrin
|
|||
return source->findNearestMapFeature(level, featureName, x, y, z);
|
||||
}
|
||||
|
||||
int ServerChunkCache::runSaveThreadProc(LPVOID lpParam)
|
||||
int ServerChunkCache::runSaveThreadProc(void *lpParam)
|
||||
{
|
||||
SaveThreadData *params = (SaveThreadData *)lpParam;
|
||||
SaveThreadData *params = static_cast<SaveThreadData *>(lpParam);
|
||||
|
||||
if(params->useSharedThreadStorage)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -97,5 +97,5 @@ private:
|
|||
} SaveThreadData;
|
||||
|
||||
public:
|
||||
static int runSaveThreadProc(LPVOID lpParam);
|
||||
static int runSaveThreadProc(void *lpParam);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,28 +1,30 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
wchar_t *wchFilename;
|
||||
eFileExtensionType eEXT;
|
||||
eTMSFileType eTMSType;
|
||||
PBYTE pbData;
|
||||
UINT uiSize;
|
||||
std::uint8_t *pbData;
|
||||
unsigned int uiSize;
|
||||
int iConfig; // used for texture pack data files
|
||||
}
|
||||
TMS_FILE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PBYTE pbData;
|
||||
DWORD dwBytes;
|
||||
BYTE ucRefCount;
|
||||
std::uint8_t *pbData;
|
||||
unsigned int dwBytes;
|
||||
std::uint8_t ucRefCount;
|
||||
}
|
||||
MEMDATA,*PMEMDATA;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD dwNotification;
|
||||
UINT uiParam;
|
||||
unsigned int dwNotification;
|
||||
unsigned int uiParam;
|
||||
}
|
||||
NOTIFICATION,*PNOTIFICATION;
|
||||
|
||||
|
|
@ -60,7 +62,7 @@ typedef struct
|
|||
// adding new flags for interim TU to 1.6.6
|
||||
|
||||
// A value that encodes the skin that the player has set as their default
|
||||
DWORD dwSelectedSkin;
|
||||
std::uint32_t dwSelectedSkin;
|
||||
|
||||
// In-Menu sensitivity
|
||||
unsigned char ucMenuSensitivity;
|
||||
|
|
@ -90,7 +92,7 @@ typedef struct
|
|||
unsigned int uiSpecialTutorialBitmask;
|
||||
|
||||
// A value that encodes the cape that the player has set
|
||||
DWORD dwSelectedCape;
|
||||
std::uint32_t dwSelectedCape;
|
||||
|
||||
unsigned int uiFavoriteSkinA[MAX_FAVORITE_SKINS];
|
||||
unsigned char ucCurrentFavoriteSkinPos;
|
||||
|
|
@ -142,7 +144,7 @@ XuiActionParam;
|
|||
typedef struct
|
||||
{
|
||||
int iSortValue;
|
||||
UINT uiStringID;
|
||||
int uiStringID;
|
||||
}
|
||||
TIPSTRUCT;
|
||||
|
||||
|
|
@ -168,8 +170,8 @@ typedef struct
|
|||
std::wstring wsDisplayName;
|
||||
|
||||
// add a store for the local DLC image
|
||||
PBYTE pbImageData;
|
||||
DWORD dwImageBytes;
|
||||
std::uint8_t *pbImageData;
|
||||
unsigned int dwImageBytes;
|
||||
#else
|
||||
ULONGLONG ullOfferID_Full;
|
||||
ULONGLONG ullOfferID_Trial;
|
||||
|
|
@ -194,14 +196,14 @@ FEATURE_DATA;
|
|||
// banned list
|
||||
typedef struct
|
||||
{
|
||||
BYTE *pBannedList;
|
||||
DWORD dwBytes;
|
||||
std::uint8_t *pBannedList;
|
||||
unsigned int dwBytes;
|
||||
}
|
||||
BANNEDLIST;
|
||||
|
||||
typedef struct _DLCRequest
|
||||
{
|
||||
DWORD dwType;
|
||||
std::uint32_t dwType;
|
||||
eDLCContentState eState;
|
||||
}
|
||||
DLCRequest;
|
||||
|
|
@ -214,13 +216,13 @@ typedef struct _TMSPPRequest
|
|||
C4JStorage::eTMS_FILETYPEVAL eFileTypeVal;
|
||||
//char szFilename[MAX_TMSFILENAME_SIZE];
|
||||
#ifdef _XBOX_ONE
|
||||
int( *CallbackFunc)(LPVOID,int,int,LPVOID, WCHAR *);
|
||||
int( *CallbackFunc)(void *,int,int,void *, WCHAR *);
|
||||
#else
|
||||
int( *CallbackFunc)(LPVOID,int,int,C4JStorage::PTMSPP_FILEDATA, LPCSTR szFilename);
|
||||
int( *CallbackFunc)(void *,int,int,C4JStorage::PTMSPP_FILEDATA, LPCSTR szFilename);
|
||||
#endif
|
||||
WCHAR wchFilename[MAX_TMSFILENAME_SIZE];
|
||||
|
||||
LPVOID lpCallbackParam;
|
||||
void *lpCallbackParam;
|
||||
}
|
||||
TMSPPRequest;
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ private:
|
|||
int m_MusicType;
|
||||
AUDIO_INFO m_StreamingAudioInfo;
|
||||
std::wstring m_CDMusic;
|
||||
BOOL m_bSystemMusicPlaying;
|
||||
bool m_bSystemMusicPlaying;
|
||||
float m_MasterMusicVolume;
|
||||
float m_MasterEffectsVolume;
|
||||
|
||||
|
|
|
|||
|
|
@ -314,20 +314,20 @@ void ColourTable::staticCtor()
|
|||
}
|
||||
}
|
||||
|
||||
ColourTable::ColourTable(PBYTE pbData, DWORD dwLength)
|
||||
ColourTable::ColourTable(std::uint8_t *pbData, std::uint32_t dataLength)
|
||||
{
|
||||
loadColoursFromData(pbData, dwLength);
|
||||
loadColoursFromData(pbData, dataLength);
|
||||
}
|
||||
|
||||
ColourTable::ColourTable(ColourTable *defaultColours, PBYTE pbData, DWORD dwLength)
|
||||
ColourTable::ColourTable(ColourTable *defaultColours, std::uint8_t *pbData, std::uint32_t dataLength)
|
||||
{
|
||||
// 4J Stu - Default the colours that of the table passed in
|
||||
XMemCpy( (void *)m_colourValues, (void *)defaultColours->m_colourValues, sizeof(int) * eMinecraftColour_COUNT);
|
||||
loadColoursFromData(pbData, dwLength);
|
||||
loadColoursFromData(pbData, dataLength);
|
||||
}
|
||||
void ColourTable::loadColoursFromData(PBYTE pbData, DWORD dwLength)
|
||||
void ColourTable::loadColoursFromData(std::uint8_t *pbData, std::uint32_t dataLength)
|
||||
{
|
||||
byteArray src(pbData, dwLength);
|
||||
byteArray src(pbData, dataLength);
|
||||
|
||||
ByteArrayInputStream bais(src);
|
||||
DataInputStream dis(&bais);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
class ColourTable
|
||||
{
|
||||
|
|
@ -11,13 +12,13 @@ private:
|
|||
public:
|
||||
static void staticCtor();
|
||||
|
||||
ColourTable(PBYTE pbData, DWORD dwLength);
|
||||
ColourTable(ColourTable *defaultColours, PBYTE pbData, DWORD dwLength);
|
||||
ColourTable(std::uint8_t *pbData, std::uint32_t dataLength);
|
||||
ColourTable(ColourTable *defaultColours, std::uint8_t *pbData, std::uint32_t dataLength);
|
||||
|
||||
unsigned int getColour(eMinecraftColour id);
|
||||
unsigned int getColor(eMinecraftColour id) { return getColour(id); }
|
||||
|
||||
void loadColoursFromData(PBYTE pbData, DWORD dwLength);
|
||||
void loadColoursFromData(std::uint8_t *pbData, std::uint32_t dataLength);
|
||||
void setColour(const std::wstring &colourName, int value);
|
||||
void setColour(const std::wstring &colourName, const std::wstring &value);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
//using namespace std;
|
||||
|
||||
#include "Audio/Consoles_SoundEngine.h"
|
||||
|
|
@ -28,8 +30,8 @@
|
|||
|
||||
typedef struct _JoinFromInviteData
|
||||
{
|
||||
DWORD dwUserIndex; // dwUserIndex
|
||||
DWORD dwLocalUsersMask; // dwUserMask
|
||||
std::uint32_t dwUserIndex; // dwUserIndex
|
||||
std::uint32_t dwLocalUsersMask; // dwUserMask
|
||||
const INVITE_INFO *pInviteInfo; // pInviteInfo
|
||||
}
|
||||
JoinFromInviteData;
|
||||
|
|
@ -124,7 +126,7 @@ public:
|
|||
|
||||
bool IsAppPaused();
|
||||
void SetAppPaused(bool val);
|
||||
static int DisplaySavingMessage(LPVOID pParam,const C4JStorage::ESavingMessage eMsg, int iPad);
|
||||
static int DisplaySavingMessage(void *pParam,const C4JStorage::ESavingMessage eMsg, int iPad);
|
||||
bool GetGameStarted() {return m_bGameStarted;}
|
||||
void SetGameStarted(bool bVal) { if(bVal) DebugPrintf("SetGameStarted - true\n"); else DebugPrintf("SetGameStarted - false\n"); m_bGameStarted = bVal; m_bIsAppPaused = !bVal;}
|
||||
int GetLocalPlayerCount(void);
|
||||
|
|
@ -146,7 +148,7 @@ public:
|
|||
|
||||
void SetSpecialTutorialCompletionFlag(int iPad, int index);
|
||||
|
||||
static LPCWSTR GetString(int iID);
|
||||
static const wchar_t * GetString(int iID);
|
||||
|
||||
eGameMode GetGameMode() { return m_eGameMode;}
|
||||
void SetGameMode(eGameMode eMode) { m_eGameMode=eMode;}
|
||||
|
|
@ -154,12 +156,12 @@ public:
|
|||
eXuiAction GetGlobalXuiAction() {return m_eGlobalXuiAction;}
|
||||
void SetGlobalXuiAction(eXuiAction action) {m_eGlobalXuiAction=action;}
|
||||
eXuiAction GetXuiAction(int iPad) {return m_eXuiAction[iPad];}
|
||||
void SetAction(int iPad, eXuiAction action, LPVOID param = NULL);
|
||||
void SetAction(int iPad, eXuiAction action, void *param = nullptr);
|
||||
void SetTMSAction(int iPad, eTMSAction action) {m_eTMSAction[iPad]=action; }
|
||||
eTMSAction GetTMSAction(int iPad) {return m_eTMSAction[iPad];}
|
||||
eXuiServerAction GetXuiServerAction(int iPad) {return m_eXuiServerAction[iPad];}
|
||||
LPVOID GetXuiServerActionParam(int iPad) {return m_eXuiServerActionParam[iPad];}
|
||||
void SetXuiServerAction(int iPad, eXuiServerAction action, LPVOID param = NULL) {m_eXuiServerAction[iPad]=action; m_eXuiServerActionParam[iPad] = param;}
|
||||
void * GetXuiServerActionParam(int iPad) {return m_eXuiServerActionParam[iPad];}
|
||||
void SetXuiServerAction(int iPad, eXuiServerAction action, void *param = nullptr) {m_eXuiServerAction[iPad]=action; m_eXuiServerActionParam[iPad] = param;}
|
||||
eXuiServerAction GetGlobalXuiServerAction() {return m_eGlobalXuiServerAction;}
|
||||
void SetGlobalXuiServerAction(eXuiServerAction action) {m_eGlobalXuiServerAction=action;}
|
||||
|
||||
|
|
@ -174,7 +176,7 @@ public:
|
|||
|
||||
|
||||
// 4J Stu - Added so that we can call this when a confirmation box is selected
|
||||
static void SetActionConfirmed(LPVOID param);
|
||||
static void SetActionConfirmed(void *param);
|
||||
void HandleXuiActions(void);
|
||||
|
||||
// 4J Stu - Functions used for Minecon and other promo work
|
||||
|
|
@ -206,23 +208,23 @@ public:
|
|||
//void GetPreviewImage(int iPad,XSOCIAL_PREVIEWIMAGE *preview);
|
||||
|
||||
void InitGameSettings();
|
||||
static int OldProfileVersionCallback(LPVOID pParam,unsigned char *pucData, const unsigned short usVersion, const int iPad);
|
||||
static int OldProfileVersionCallback(void *pParam,unsigned char *pucData, const unsigned short usVersion, const int iPad);
|
||||
|
||||
#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ )
|
||||
static int DefaultOptionsCallback(LPVOID pParam,C4JStorage::PROFILESETTINGS *pSettings, const int iPad);
|
||||
static int DefaultOptionsCallback(void *pParam,C4JStorage::PROFILESETTINGS *pSettings, const int iPad);
|
||||
int SetDefaultOptions(C4JStorage::PROFILESETTINGS *pSettings,const int iPad,bool bWriteProfile=true);
|
||||
#ifdef __ORBIS__
|
||||
static int OptionsDataCallback(LPVOID pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus,int iBlocksRequired);
|
||||
static int OptionsDataCallback(void *pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus,int iBlocksRequired);
|
||||
int GetOptionsBlocksRequired(int iPad);
|
||||
#else
|
||||
static int OptionsDataCallback(LPVOID pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus);
|
||||
static int OptionsDataCallback(void *pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus);
|
||||
#endif
|
||||
|
||||
C4JStorage::eOptionsCallback GetOptionsCallbackStatus(int iPad);
|
||||
|
||||
void SetOptionsCallbackStatus(int iPad, C4JStorage::eOptionsCallback eStatus);
|
||||
#else
|
||||
static int DefaultOptionsCallback(LPVOID pParam,C_4JProfile::PROFILESETTINGS *pSettings, const int iPad);
|
||||
static int DefaultOptionsCallback(void *pParam,C_4JProfile::PROFILESETTINGS *pSettings, const int iPad);
|
||||
int SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,const int iPad);
|
||||
#endif
|
||||
virtual void SetRichPresenceContext(int iPad, int contextId) = 0;
|
||||
|
|
@ -232,9 +234,9 @@ public:
|
|||
unsigned char GetGameSettings(int iPad,eGameSetting eVal);
|
||||
unsigned char GetGameSettings(eGameSetting eVal); // for the primary pad
|
||||
void SetPlayerSkin(int iPad,const std::wstring &name);
|
||||
void SetPlayerSkin(int iPad,DWORD dwSkinId);
|
||||
void SetPlayerSkin(int iPad,std::uint32_t dwSkinId);
|
||||
void SetPlayerCape(int iPad,const std::wstring &name);
|
||||
void SetPlayerCape(int iPad,DWORD dwCapeId);
|
||||
void SetPlayerCape(int iPad,std::uint32_t dwCapeId);
|
||||
void SetPlayerFavoriteSkin(int iPad, int iIndex,unsigned int uiSkinID);
|
||||
unsigned int GetPlayerFavoriteSkin(int iPad,int iIndex);
|
||||
unsigned char GetPlayerFavoriteSkinsPos(int iPad);
|
||||
|
|
@ -259,10 +261,10 @@ public:
|
|||
|
||||
public:
|
||||
std::wstring GetPlayerSkinName(int iPad);
|
||||
DWORD GetPlayerSkinId(int iPad);
|
||||
std::uint32_t GetPlayerSkinId(int iPad);
|
||||
std::wstring GetPlayerCapeName(int iPad);
|
||||
DWORD GetPlayerCapeId(int iPad);
|
||||
DWORD GetAdditionalModelParts(int iPad);
|
||||
std::uint32_t GetPlayerCapeId(int iPad);
|
||||
std::uint32_t GetAdditionalModelParts(int iPad);
|
||||
void CheckGameSettingsChanged(bool bOverride5MinuteTimer=false, int iPad=XUSER_INDEX_ANY);
|
||||
void ApplyGameSettingsChanged(int iPad);
|
||||
void ClearGameSettingsChangedFlag(int iPad);
|
||||
|
|
@ -275,7 +277,7 @@ public:
|
|||
bool IsLocalMultiplayerAvailable();
|
||||
|
||||
// for sign in change monitoring
|
||||
static void SignInChangeCallback(LPVOID pParam, bool bVal, unsigned int uiSignInData);
|
||||
static void SignInChangeCallback(void *pParam, bool bVal, unsigned int uiSignInData);
|
||||
static void ClearSignInChangeUsersMask();
|
||||
static int SignoutExitWorldThreadProc( void* lpParameter );
|
||||
static int PrimaryPlayerSignedOutReturned(void *pParam, int iPad, const C4JStorage::EMessageResult);
|
||||
|
|
@ -286,14 +288,14 @@ public:
|
|||
virtual void FatalLoadError();
|
||||
|
||||
// Notifications from the game listener to be passed to the qnet listener
|
||||
static void NotificationsCallback(LPVOID pParam,DWORD dwNotification, unsigned int uiParam);
|
||||
static void NotificationsCallback(void *pParam,std::uint32_t dwNotification, unsigned int uiParam);
|
||||
|
||||
// for the ethernet being disconnected
|
||||
static void LiveLinkChangeCallback(LPVOID pParam,BOOL bConnected);
|
||||
static void LiveLinkChangeCallback(void *pParam,BOOL bConnected);
|
||||
bool GetLiveLinkRequired() {return m_bLiveLinkRequired;}
|
||||
void SetLiveLinkRequired(bool required) {m_bLiveLinkRequired=required;}
|
||||
|
||||
static void UpsellReturnedCallback(LPVOID pParam, eUpsellType type, eUpsellResponse result, int iUserData);
|
||||
static void UpsellReturnedCallback(void *pParam, eUpsellType type, eUpsellResponse result, int iUserData);
|
||||
|
||||
#if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__
|
||||
static int NowDisplayFullVersionPurchase(void *pParam, bool bContinue, int iPad);
|
||||
|
|
@ -309,21 +311,21 @@ public:
|
|||
bool DebugSettingsOn() { return false;}
|
||||
#endif
|
||||
void SetDebugSequence(const char *pchSeq);
|
||||
static int DebugInputCallback(LPVOID pParam);
|
||||
static int DebugInputCallback(void *pParam);
|
||||
//bool UploadFileToGlobalStorage(int iQuadrant, C4JStorage::eGlobalStorage eStorageFacility, std::wstring *wsFile );
|
||||
|
||||
// Installed DLC
|
||||
bool StartInstallDLCProcess(int iPad);
|
||||
static int DLCInstalledCallback(LPVOID pParam,int iOfferC,int iPad);
|
||||
static int DLCInstalledCallback(void *pParam,int iOfferC,int iPad);
|
||||
void HandleDLCLicenseChange();
|
||||
static int DLCMountedCallback(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask);
|
||||
static int DLCMountedCallback(void *pParam,int iPad,std::uint32_t dwErr,std::uint32_t dwLicenceMask);
|
||||
void MountNextDLC(int iPad);
|
||||
//static int DLCReadCallback(LPVOID pParam,C4JStorage::DLC_FILE_DETAILS *pDLCData);
|
||||
void HandleDLC(DLCPack *pack);
|
||||
bool DLCInstallPending() {return m_bDLCInstallPending;}
|
||||
bool DLCInstallProcessCompleted() {return m_bDLCInstallProcessCompleted;}
|
||||
void ClearDLCInstalled() { m_bDLCInstallProcessCompleted=false;}
|
||||
static int MarketplaceCountsCallback(LPVOID pParam,C4JStorage::DLC_TMS_DETAILS *,int iPad);
|
||||
static int MarketplaceCountsCallback(void *pParam,C4JStorage::DLC_TMS_DETAILS *,int iPad);
|
||||
|
||||
bool AlreadySeenCreditText(const std::wstring &wstemp);
|
||||
|
||||
|
|
@ -339,16 +341,16 @@ public:
|
|||
bool isXuidNotch(PlayerUID xuid);
|
||||
bool isXuidDeadmau5(PlayerUID xuid);
|
||||
|
||||
void AddMemoryTextureFile(const std::wstring &wName, PBYTE pbData, DWORD dwBytes);
|
||||
void AddMemoryTextureFile(const std::wstring &wName, std::uint8_t *pbData, unsigned int dwBytes);
|
||||
void RemoveMemoryTextureFile(const std::wstring &wName);
|
||||
void GetMemFileDetails(const std::wstring &wName,PBYTE *ppbData,DWORD *pdwBytes);
|
||||
void GetMemFileDetails(const std::wstring &wName, std::uint8_t **ppbData, unsigned int *pdwBytes);
|
||||
bool IsFileInMemoryTextures(const std::wstring &wName);
|
||||
|
||||
// Texture Pack Data files (icon, banner, comparison shot & text)
|
||||
void AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes);
|
||||
void AddMemoryTPDFile(int iConfig, std::uint8_t *pbData, unsigned int dwBytes);
|
||||
void RemoveMemoryTPDFile(int iConfig);
|
||||
bool IsFileInTPD(int iConfig);
|
||||
void GetTPD(int iConfig,PBYTE *ppbData,DWORD *pdwBytes);
|
||||
void GetTPD(int iConfig, std::uint8_t **ppbData, unsigned int *pdwBytes);
|
||||
int GetTPDSize() {return m_MEM_TPD.size();}
|
||||
#ifndef __PS3__
|
||||
int GetTPConfigVal(WCHAR *pwchDataFile);
|
||||
|
|
@ -359,17 +361,17 @@ public:
|
|||
|
||||
// invites
|
||||
//void ProcessInvite(JoinFromInviteData *pJoinData);
|
||||
void ProcessInvite(DWORD dwUserIndex, DWORD dwLocalUsersMask, const INVITE_INFO * pInviteInfo);
|
||||
void ProcessInvite(std::uint32_t dwUserIndex, std::uint32_t dwLocalUsersMask, const INVITE_INFO * pInviteInfo);
|
||||
|
||||
// Add credits for DLC installed
|
||||
void AddCreditText(LPCWSTR lpStr);
|
||||
void AddCreditText(const wchar_t *lpStr);
|
||||
|
||||
private:
|
||||
PlayerUID m_xuidNotch;
|
||||
#ifdef _DURANGO
|
||||
std::unordered_map<PlayerUID, PBYTE, PlayerUID::Hash> m_GTS_Files;
|
||||
std::unordered_map<PlayerUID, std::uint8_t *, PlayerUID::Hash> m_GTS_Files;
|
||||
#else
|
||||
std::unordered_map<PlayerUID, PBYTE> m_GTS_Files;
|
||||
std::unordered_map<PlayerUID, std::uint8_t *> m_GTS_Files;
|
||||
#endif
|
||||
|
||||
// for storing memory textures - player skin
|
||||
|
|
@ -383,8 +385,8 @@ private:
|
|||
|
||||
public:
|
||||
// launch data
|
||||
BYTE* m_pLaunchData;
|
||||
DWORD m_dwLaunchDataSize;
|
||||
std::uint8_t *m_pLaunchData;
|
||||
unsigned int m_dwLaunchDataSize;
|
||||
|
||||
public:
|
||||
// BAN LIST
|
||||
|
|
@ -503,10 +505,10 @@ private:
|
|||
// we'll action these at the end of the game loop
|
||||
eXuiAction m_eXuiAction[XUSER_MAX_COUNT];
|
||||
eTMSAction m_eTMSAction[XUSER_MAX_COUNT];
|
||||
LPVOID m_eXuiActionParam[XUSER_MAX_COUNT];
|
||||
void *m_eXuiActionParam[XUSER_MAX_COUNT];
|
||||
eXuiAction m_eGlobalXuiAction;
|
||||
eXuiServerAction m_eXuiServerAction[XUSER_MAX_COUNT];
|
||||
LPVOID m_eXuiServerActionParam[XUSER_MAX_COUNT];
|
||||
void *m_eXuiServerActionParam[XUSER_MAX_COUNT];
|
||||
eXuiServerAction m_eGlobalXuiServerAction;
|
||||
|
||||
bool m_bLiveLinkRequired;
|
||||
|
|
@ -547,7 +549,7 @@ protected:
|
|||
static Random *TipRandom;
|
||||
public:
|
||||
void InitialiseTips();
|
||||
UINT GetNextTip();
|
||||
int GetNextTip();
|
||||
int GetHTMLColour(eMinecraftColour colour);
|
||||
int GetHTMLColor(eMinecraftColour colour) { return GetHTMLColour(colour); }
|
||||
int GetHTMLFontSize(EHTMLFontSize size);
|
||||
|
|
@ -560,11 +562,11 @@ public:
|
|||
void UpdateTrialPausedTimer() { mfTrialPausedTime+= m_Time.fElapsedTime;}
|
||||
|
||||
static int RemoteSaveThreadProc( void* lpParameter );
|
||||
static void ExitGameFromRemoteSave( LPVOID lpParameter );
|
||||
static void ExitGameFromRemoteSave( void *lpParameter );
|
||||
static int ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
private:
|
||||
UINT m_TipIDA[MAX_TIPS_GAMETIP+MAX_TIPS_TRIVIATIP];
|
||||
UINT m_uiCurrentTip;
|
||||
int m_TipIDA[MAX_TIPS_GAMETIP+MAX_TIPS_TRIVIATIP];
|
||||
unsigned int m_uiCurrentTip;
|
||||
static int TipsSortFunction(const void* a, const void* b);
|
||||
|
||||
// XML
|
||||
|
|
@ -608,9 +610,9 @@ public:
|
|||
|
||||
// images for save thumbnail/social post
|
||||
virtual void CaptureSaveThumbnail() =0;
|
||||
virtual void GetSaveThumbnail(PBYTE*,DWORD*)=0;
|
||||
virtual void GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize)=0;
|
||||
virtual void ReleaseSaveThumbnail()=0;
|
||||
virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize)=0;
|
||||
virtual void GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize)=0;
|
||||
|
||||
virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false)=0;
|
||||
|
||||
|
|
@ -703,8 +705,8 @@ public:
|
|||
bool CanRecordStatsAndAchievements();
|
||||
|
||||
// World seed from png image
|
||||
void GetImageTextData(PBYTE pbImageData, DWORD dwImageBytes,unsigned char *pszSeed,unsigned int &uiHostOptions,bool &bHostOptionsRead,DWORD &uiTexturePack);
|
||||
unsigned int CreateImageTextData(PBYTE bTextMetadata, __int64 seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId);
|
||||
void GetImageTextData(std::uint8_t *imageData, unsigned int imageBytes, unsigned char *seedText, unsigned int &uiHostOptions, bool &bHostOptionsRead, std::uint32_t &uiTexturePack);
|
||||
unsigned int CreateImageTextData(std::uint8_t *textMetadata, __int64 seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId);
|
||||
|
||||
// Game rules
|
||||
GameRuleManager m_gameRules;
|
||||
|
|
@ -717,16 +719,16 @@ public:
|
|||
void setLevelGenerationOptions(LevelGenerationOptions *levelGen);
|
||||
LevelRuleset *getGameRuleDefinitions() { return m_gameRules.getGameRuleDefinitions(); }
|
||||
LevelGenerationOptions *getLevelGenerationOptions() { return m_gameRules.getLevelGenerationOptions(); }
|
||||
LPCWSTR GetGameRulesString(const std::wstring &key);
|
||||
const wchar_t *GetGameRulesString(const std::wstring &key);
|
||||
|
||||
private:
|
||||
BYTE m_playerColours[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's
|
||||
std::uint8_t m_playerColours[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's
|
||||
unsigned int m_playerGamePrivileges[MINECRAFT_NET_MAX_PLAYERS];
|
||||
|
||||
public:
|
||||
void UpdatePlayerInfo(BYTE networkSmallId, SHORT playerColourIndex, unsigned int playerGamePrivileges);
|
||||
short GetPlayerColour(BYTE networkSmallId);
|
||||
unsigned int GetPlayerPrivileges(BYTE networkSmallId);
|
||||
void UpdatePlayerInfo(std::uint8_t networkSmallId, SHORT playerColourIndex, unsigned int playerGamePrivileges);
|
||||
short GetPlayerColour(std::uint8_t networkSmallId);
|
||||
unsigned int GetPlayerPrivileges(std::uint8_t networkSmallId);
|
||||
|
||||
std::wstring getEntityName(eINSTANCEOF type);
|
||||
|
||||
|
|
@ -735,9 +737,9 @@ public:
|
|||
unsigned int AddDLCRequest(eDLCMarketplaceType eContentType, bool bPromote=false);
|
||||
bool RetrieveNextDLCContent();
|
||||
bool CheckTMSDLCCanStop();
|
||||
static int DLCOffersReturned(void *pParam, int iOfferC, DWORD dwType, int iPad);
|
||||
DWORD GetDLCContentType(eDLCContentType eType) { return m_dwContentTypeA[eType];}
|
||||
eDLCContentType Find_eDLCContentType(DWORD dwType);
|
||||
static int DLCOffersReturned(void *pParam, int iOfferC, std::uint32_t dwType, int iPad);
|
||||
std::uint32_t GetDLCContentType(eDLCContentType eType) { return m_dwContentTypeA[eType];}
|
||||
eDLCContentType Find_eDLCContentType(std::uint32_t dwType);
|
||||
int GetDLCOffersCount() { return m_iDLCOfferC;}
|
||||
bool DLCContentRetrieved(eDLCMarketplaceType eType);
|
||||
void TickDLCOffersRetrieved();
|
||||
|
|
@ -757,10 +759,10 @@ public:
|
|||
#else
|
||||
|
||||
#ifdef _XBOX_ONE
|
||||
static int TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,LPVOID, WCHAR *wchFilename);
|
||||
static int TMSPPFileReturned(void *pParam,int iPad,int iUserData,void *, WCHAR *wchFilename);
|
||||
std::unordered_map<std::wstring,DLC_INFO * > *GetDLCInfo();
|
||||
#else
|
||||
static int TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JStorage::PTMSPP_FILEDATA pFileData, LPCSTR szFilename);
|
||||
static int TMSPPFileReturned(void *pParam,int iPad,int iUserData,C4JStorage::PTMSPP_FILEDATA pFileData, LPCSTR szFilename);
|
||||
#endif
|
||||
DLC_INFO *GetDLCInfoTrialOffer(int iIndex);
|
||||
DLC_INFO *GetDLCInfoFullOffer(int iIndex);
|
||||
|
|
@ -790,7 +792,7 @@ private:
|
|||
//Request current_download;
|
||||
std::vector<DLCRequest *> m_DLCDownloadQueue;
|
||||
std::vector<TMSPPRequest *> m_TMSPPDownloadQueue;
|
||||
static DWORD m_dwContentTypeA[e_Marketplace_MAX];
|
||||
static std::uint32_t m_dwContentTypeA[e_Marketplace_MAX];
|
||||
int m_iDLCOfferC;
|
||||
bool m_bAllDLCContentRetrieved;
|
||||
bool m_bAllTMSContentRetrieved;
|
||||
|
|
@ -802,29 +804,29 @@ private:
|
|||
CRITICAL_SECTION csAnimOverrideBitmask;
|
||||
bool m_bCorruptSaveDeleted;
|
||||
|
||||
DWORD m_dwAdditionalModelParts[XUSER_MAX_COUNT];
|
||||
std::uint32_t m_dwAdditionalModelParts[XUSER_MAX_COUNT];
|
||||
|
||||
BYTE *m_pBannedListFileBuffer;
|
||||
DWORD m_dwBannedListFileSize;
|
||||
std::uint8_t *m_pBannedListFileBuffer;
|
||||
unsigned int m_dwBannedListFileSize;
|
||||
|
||||
public:
|
||||
DWORD m_dwDLCFileSize;
|
||||
BYTE *m_pDLCFileBuffer;
|
||||
unsigned int m_dwDLCFileSize;
|
||||
std::uint8_t *m_pDLCFileBuffer;
|
||||
|
||||
// static int CallbackReadXuidsFileFromTMS(LPVOID lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction);
|
||||
// static int CallbackDLCFileFromTMS(LPVOID lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction);
|
||||
// static int CallbackBannedListFileFromTMS(LPVOID lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction);
|
||||
|
||||
// Storing additional model parts per skin texture
|
||||
void SetAdditionalSkinBoxes(DWORD dwSkinID, SKIN_BOX *SkinBoxA, DWORD dwSkinBoxC);
|
||||
std::vector<ModelPart *> * SetAdditionalSkinBoxes(DWORD dwSkinID, std::vector<SKIN_BOX *> *pvSkinBoxA);
|
||||
std::vector<ModelPart *> *GetAdditionalModelParts(DWORD dwSkinID);
|
||||
std::vector<SKIN_BOX *> *GetAdditionalSkinBoxes(DWORD dwSkinID);
|
||||
void SetAnimOverrideBitmask(DWORD dwSkinID,unsigned int uiAnimOverrideBitmask);
|
||||
unsigned int GetAnimOverrideBitmask(DWORD dwSkinID);
|
||||
void SetAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX *SkinBoxA, unsigned int dwSkinBoxC);
|
||||
std::vector<ModelPart *> * SetAdditionalSkinBoxes(std::uint32_t dwSkinID, std::vector<SKIN_BOX *> *pvSkinBoxA);
|
||||
std::vector<ModelPart *> *GetAdditionalModelParts(std::uint32_t dwSkinID);
|
||||
std::vector<SKIN_BOX *> *GetAdditionalSkinBoxes(std::uint32_t dwSkinID);
|
||||
void SetAnimOverrideBitmask(std::uint32_t dwSkinID,unsigned int uiAnimOverrideBitmask);
|
||||
unsigned int GetAnimOverrideBitmask(std::uint32_t dwSkinID);
|
||||
|
||||
static DWORD getSkinIdFromPath(const std::wstring &skin);
|
||||
static std::wstring getSkinPathFromId(DWORD skinId);
|
||||
static std::uint32_t getSkinIdFromPath(const std::wstring &skin);
|
||||
static std::wstring getSkinPathFromId(std::uint32_t skinId);
|
||||
|
||||
virtual int LoadLocalTMSFile(WCHAR *wchTMSFile)=0;
|
||||
virtual int LoadLocalTMSFile(WCHAR *wchTMSFile, eFileExtensionType eExt)=0;
|
||||
|
|
@ -839,24 +841,24 @@ public:
|
|||
void SetBanListRead(int iPad,bool bVal) { m_bRead_BannedListA[iPad]=bVal;}
|
||||
void ClearBanList(int iPad) { BannedListA[iPad].pBannedList=NULL;BannedListA[iPad].dwBytes=0;}
|
||||
|
||||
DWORD GetRequiredTexturePackID() {return m_dwRequiredTexturePackID;}
|
||||
void SetRequiredTexturePackID(DWORD dwID) {m_dwRequiredTexturePackID=dwID;}
|
||||
std::uint32_t GetRequiredTexturePackID() { return m_dwRequiredTexturePackID; }
|
||||
void SetRequiredTexturePackID(std::uint32_t texturePackId) { m_dwRequiredTexturePackID = texturePackId; }
|
||||
|
||||
virtual void GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD dwBytes,PBYTE *ppbData,DWORD *pdwBytes ) {*ppbData = NULL; *pdwBytes = 0;}
|
||||
virtual void GetFileFromTPD(eTPDFileType eType, std::uint8_t *pbData, unsigned int dwBytes, std::uint8_t **ppbData, unsigned int *pdwBytes ) {*ppbData = NULL; *pdwBytes = 0;}
|
||||
|
||||
//XTITLE_DEPLOYMENT_TYPE getDeploymentType() { return m_titleDeploymentType; }
|
||||
|
||||
private:
|
||||
// vector of additional skin model parts, indexed by the skin texture id
|
||||
std::unordered_map<DWORD, std::vector<ModelPart *> *> m_AdditionalModelParts;
|
||||
std::unordered_map<DWORD, std::vector<SKIN_BOX *> *> m_AdditionalSkinBoxes;
|
||||
std::unordered_map<DWORD, unsigned int> m_AnimOverrides;
|
||||
std::unordered_map<std::uint32_t, std::vector<ModelPart *> *> m_AdditionalModelParts;
|
||||
std::unordered_map<std::uint32_t, std::vector<SKIN_BOX *> *> m_AdditionalSkinBoxes;
|
||||
std::unordered_map<std::uint32_t, unsigned int> m_AnimOverrides;
|
||||
|
||||
|
||||
bool m_bResetNether;
|
||||
DWORD m_dwRequiredTexturePackID;
|
||||
std::uint32_t m_dwRequiredTexturePackID;
|
||||
#ifdef _XBOX_ONE
|
||||
std::vector <PBYTE> m_vTMSPPData;
|
||||
std::vector<std::uint8_t *> m_vTMSPPData;
|
||||
#endif
|
||||
|
||||
#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__)
|
||||
|
|
@ -873,18 +875,18 @@ public:
|
|||
|
||||
void LocaleAndLanguageInit();
|
||||
void getLocale(std::vector<std::wstring> &vecWstrLocales);
|
||||
DWORD get_eMCLang(WCHAR *pwchLocale);
|
||||
DWORD get_xcLang(WCHAR *pwchLocale);
|
||||
int get_eMCLang(WCHAR *pwchLocale);
|
||||
int get_xcLang(WCHAR *pwchLocale);
|
||||
|
||||
void SetTickTMSDLCFiles(bool bVal);
|
||||
|
||||
std::wstring getFilePath(DWORD packId, std::wstring filename, bool bAddDataFolder);
|
||||
std::wstring getFilePath(std::uint32_t packId, std::wstring filename, bool bAddDataFolder);
|
||||
|
||||
private:
|
||||
std::unordered_map<int, std::wstring>m_localeA;
|
||||
std::unordered_map<std::wstring, int>m_eMCLangA;
|
||||
std::unordered_map<std::wstring, int>m_xcLangA;
|
||||
std::wstring getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder);
|
||||
std::wstring getRootPath(std::uint32_t packId, bool allowOverride, bool bAddDataFolder);
|
||||
public:
|
||||
|
||||
#ifdef _XBOX
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#include "../../Minecraft.World/Platform/stdafx.h"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include "DLCManager.h"
|
||||
#include "DLCAudioFile.h"
|
||||
#if defined _XBOX || defined _WINDOWS64
|
||||
|
|
@ -6,23 +9,81 @@
|
|||
#include "../../Minecraft.Client/Platform/Xbox/XML/xmlFilesCallback.h"
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr std::size_t AUDIO_DLC_WCHAR_BIN_SIZE = 2;
|
||||
|
||||
#if WCHAR_MAX > 0xFFFF
|
||||
static std::wstring ReadAudioDlcWString(const void *data)
|
||||
{
|
||||
const std::uint16_t *chars = static_cast<const std::uint16_t *>(data);
|
||||
const std::uint16_t *end = chars;
|
||||
while(*end != 0)
|
||||
{
|
||||
++end;
|
||||
}
|
||||
|
||||
std::wstring out(static_cast<std::size_t>(end - chars), 0);
|
||||
for(std::size_t i = 0; i < out.size(); ++i)
|
||||
{
|
||||
out[i] = static_cast<wchar_t>(chars[i]);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
#else
|
||||
static std::wstring ReadAudioDlcWString(const void *data)
|
||||
{
|
||||
return std::wstring(static_cast<const wchar_t *>(data));
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
T ReadAudioDlcValue(const std::uint8_t *data, unsigned int offset = 0)
|
||||
{
|
||||
T value;
|
||||
std::memcpy(&value, data + offset, sizeof(value));
|
||||
return value;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void ReadAudioDlcStruct(T *out, const std::uint8_t *data, unsigned int offset = 0)
|
||||
{
|
||||
std::memcpy(out, data + offset, sizeof(*out));
|
||||
}
|
||||
|
||||
inline unsigned int AudioParamAdvance(unsigned int wcharCount)
|
||||
{
|
||||
return static_cast<unsigned int>(sizeof(C4JStorage::DLC_FILE_PARAM) + wcharCount * AUDIO_DLC_WCHAR_BIN_SIZE);
|
||||
}
|
||||
|
||||
inline unsigned int AudioDetailAdvance(unsigned int wcharCount)
|
||||
{
|
||||
return static_cast<unsigned int>(sizeof(C4JStorage::DLC_FILE_DETAILS) + wcharCount * AUDIO_DLC_WCHAR_BIN_SIZE);
|
||||
}
|
||||
|
||||
inline std::wstring ReadAudioParamString(const std::uint8_t *data, unsigned int offset)
|
||||
{
|
||||
return ReadAudioDlcWString(data + offset + offsetof(C4JStorage::DLC_FILE_PARAM, wchData));
|
||||
}
|
||||
}
|
||||
|
||||
DLCAudioFile::DLCAudioFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_Audio,path)
|
||||
{
|
||||
m_pbData = NULL;
|
||||
m_dwBytes = 0;
|
||||
m_dataBytes = 0;
|
||||
}
|
||||
|
||||
void DLCAudioFile::addData(PBYTE pbData, DWORD dwBytes)
|
||||
void DLCAudioFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes)
|
||||
{
|
||||
m_pbData = pbData;
|
||||
m_dwBytes = dwBytes;
|
||||
m_dataBytes = dataBytes;
|
||||
|
||||
processDLCDataFile(pbData,dwBytes);
|
||||
processDLCDataFile(pbData,dataBytes);
|
||||
}
|
||||
|
||||
PBYTE DLCAudioFile::getData(DWORD &dwBytes)
|
||||
std::uint8_t *DLCAudioFile::getData(std::uint32_t &dataBytes)
|
||||
{
|
||||
dwBytes = m_dwBytes;
|
||||
dataBytes = m_dataBytes;
|
||||
return m_pbData;
|
||||
}
|
||||
|
||||
|
|
@ -36,7 +97,7 @@ DLCAudioFile::EAudioParameterType DLCAudioFile::getParameterType(const std::wstr
|
|||
{
|
||||
EAudioParameterType type = e_AudioParamType_Invalid;
|
||||
|
||||
for(DWORD i = 0; i < e_AudioParamType_Max; ++i)
|
||||
for(int i = 0; i < e_AudioParamType_Max; ++i)
|
||||
{
|
||||
if(paramName.compare(wchTypeNamesA[i]) == 0)
|
||||
{
|
||||
|
|
@ -120,7 +181,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons
|
|||
}
|
||||
}
|
||||
|
||||
bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
|
||||
bool DLCAudioFile::processDLCDataFile(std::uint8_t *pbData, std::uint32_t dataLength)
|
||||
{
|
||||
std::unordered_map<int, EAudioParameterType> parameterMapping;
|
||||
unsigned int uiCurrentByte=0;
|
||||
|
|
@ -128,7 +189,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
|
|||
// File format defined in the AudioPacker
|
||||
// File format: Version 1
|
||||
|
||||
unsigned int uiVersion=*(unsigned int *)pbData;
|
||||
unsigned int uiVersion = ReadAudioDlcValue<unsigned int>(pbData, uiCurrentByte);
|
||||
uiCurrentByte+=sizeof(int);
|
||||
|
||||
if(uiVersion < CURRENT_AUDIO_VERSION_NUM)
|
||||
|
|
@ -138,60 +199,62 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
|
|||
return false;
|
||||
}
|
||||
|
||||
unsigned int uiParameterTypeCount=*(unsigned int *)&pbData[uiCurrentByte];
|
||||
unsigned int uiParameterTypeCount = ReadAudioDlcValue<unsigned int>(pbData, uiCurrentByte);
|
||||
uiCurrentByte+=sizeof(int);
|
||||
C4JStorage::DLC_FILE_PARAM *pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte];
|
||||
C4JStorage::DLC_FILE_PARAM paramBuf;
|
||||
ReadAudioDlcStruct(¶mBuf, pbData, uiCurrentByte);
|
||||
|
||||
for(unsigned int i=0;i<uiParameterTypeCount;i++)
|
||||
{
|
||||
// Map DLC strings to application strings, then store the DLC index mapping to application index
|
||||
std::wstring parameterName((WCHAR *)pParams->wchData);
|
||||
std::wstring parameterName = ReadAudioParamString(pbData, uiCurrentByte);
|
||||
EAudioParameterType type = getParameterType(parameterName);
|
||||
if( type != e_AudioParamType_Invalid )
|
||||
{
|
||||
parameterMapping[pParams->dwType] = type;
|
||||
parameterMapping[paramBuf.dwType] = type;
|
||||
}
|
||||
uiCurrentByte+= sizeof(C4JStorage::DLC_FILE_PARAM)+(pParams->dwWchCount*sizeof(WCHAR));
|
||||
pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte];
|
||||
uiCurrentByte += AudioParamAdvance(paramBuf.dwWchCount);
|
||||
ReadAudioDlcStruct(¶mBuf, pbData, uiCurrentByte);
|
||||
}
|
||||
unsigned int uiFileCount=*(unsigned int *)&pbData[uiCurrentByte];
|
||||
unsigned int uiFileCount = ReadAudioDlcValue<unsigned int>(pbData, uiCurrentByte);
|
||||
uiCurrentByte+=sizeof(int);
|
||||
C4JStorage::DLC_FILE_DETAILS *pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte];
|
||||
C4JStorage::DLC_FILE_DETAILS fileBuf;
|
||||
ReadAudioDlcStruct(&fileBuf, pbData, uiCurrentByte);
|
||||
|
||||
DWORD dwTemp=uiCurrentByte;
|
||||
unsigned int tempByteOffset = uiCurrentByte;
|
||||
for(unsigned int i=0;i<uiFileCount;i++)
|
||||
{
|
||||
dwTemp+=sizeof(C4JStorage::DLC_FILE_DETAILS)+pFile->dwWchCount*sizeof(WCHAR);
|
||||
pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[dwTemp];
|
||||
tempByteOffset += AudioDetailAdvance(fileBuf.dwWchCount);
|
||||
ReadAudioDlcStruct(&fileBuf, pbData, tempByteOffset);
|
||||
}
|
||||
PBYTE pbTemp=((PBYTE )pFile);
|
||||
pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte];
|
||||
std::uint8_t *pbTemp = &pbData[tempByteOffset];
|
||||
ReadAudioDlcStruct(&fileBuf, pbData, uiCurrentByte);
|
||||
|
||||
for(unsigned int i=0;i<uiFileCount;i++)
|
||||
{
|
||||
EAudioType type = (EAudioType)pFile->dwType;
|
||||
EAudioType type = (EAudioType)fileBuf.dwType;
|
||||
// Params
|
||||
unsigned int uiParameterCount=*(unsigned int *)pbTemp;
|
||||
unsigned int uiParameterCount = ReadAudioDlcValue<unsigned int>(pbTemp);
|
||||
pbTemp+=sizeof(int);
|
||||
pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp;
|
||||
ReadAudioDlcStruct(¶mBuf, pbTemp);
|
||||
for(unsigned int j=0;j<uiParameterCount;j++)
|
||||
{
|
||||
//EAudioParameterType paramType = e_AudioParamType_Invalid;
|
||||
|
||||
AUTO_VAR(it, parameterMapping.find( pParams->dwType ));
|
||||
AUTO_VAR(it, parameterMapping.find(paramBuf.dwType));
|
||||
|
||||
if(it != parameterMapping.end() )
|
||||
{
|
||||
addParameter(type,(EAudioParameterType)pParams->dwType,(WCHAR *)pParams->wchData);
|
||||
addParameter(type, (EAudioParameterType)paramBuf.dwType, ReadAudioParamString(pbTemp, 0));
|
||||
}
|
||||
pbTemp+=sizeof(C4JStorage::DLC_FILE_PARAM)+(sizeof(WCHAR)*pParams->dwWchCount);
|
||||
pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp;
|
||||
pbTemp += AudioParamAdvance(paramBuf.dwWchCount);
|
||||
ReadAudioDlcStruct(¶mBuf, pbTemp);
|
||||
}
|
||||
// Move the pointer to the start of the next files data;
|
||||
pbTemp+=pFile->uiFileSize;
|
||||
uiCurrentByte+=sizeof(C4JStorage::DLC_FILE_DETAILS)+pFile->dwWchCount*sizeof(WCHAR);
|
||||
pbTemp += fileBuf.uiFileSize;
|
||||
uiCurrentByte += AudioDetailAdvance(fileBuf.dwWchCount);
|
||||
|
||||
pFile=(C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte];
|
||||
ReadAudioDlcStruct(&fileBuf, pbData, uiCurrentByte);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -213,4 +276,4 @@ std::wstring &DLCAudioFile::GetSoundName(int iIndex)
|
|||
iWorldType++;
|
||||
}
|
||||
return m_parameters[iWorldType].at(iIndex);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,18 +32,18 @@ public:
|
|||
|
||||
DLCAudioFile(const std::wstring &path);
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
virtual PBYTE getData(DWORD &dwBytes);
|
||||
virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes);
|
||||
virtual std::uint8_t *getData(std::uint32_t &dataBytes);
|
||||
|
||||
bool processDLCDataFile(PBYTE pbData, DWORD dwLength);
|
||||
bool processDLCDataFile(std::uint8_t *pbData, std::uint32_t dataLength);
|
||||
int GetCountofType(DLCAudioFile::EAudioType ptype);
|
||||
std::wstring &GetSoundName(int iIndex);
|
||||
|
||||
private:
|
||||
using DLCFile::addParameter;
|
||||
|
||||
PBYTE m_pbData;
|
||||
DWORD m_dwBytes;
|
||||
std::uint8_t *m_pbData;
|
||||
std::uint32_t m_dataBytes;
|
||||
static const int CURRENT_AUDIO_VERSION_NUM=1;
|
||||
//std::unordered_map<int, std::wstring> m_parameters;
|
||||
std::vector<std::wstring> m_parameters[e_AudioType_Max];
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ DLCCapeFile::DLCCapeFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCTy
|
|||
{
|
||||
}
|
||||
|
||||
void DLCCapeFile::addData(PBYTE pbData, DWORD dwBytes)
|
||||
void DLCCapeFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes)
|
||||
{
|
||||
app.AddMemoryTextureFile(m_path,pbData,dwBytes);
|
||||
}
|
||||
app.AddMemoryTextureFile(m_path,pbData,dataBytes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ class DLCCapeFile : public DLCFile
|
|||
public:
|
||||
DLCCapeFile(const std::wstring &path);
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
};
|
||||
virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ DLCColourTableFile::~DLCColourTableFile()
|
|||
}
|
||||
}
|
||||
|
||||
void DLCColourTableFile::addData(PBYTE pbData, DWORD dwBytes)
|
||||
void DLCColourTableFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes)
|
||||
{
|
||||
ColourTable *defaultColourTable = Minecraft::GetInstance()->skins->getDefault()->getColourTable();
|
||||
m_colourTable = new ColourTable(defaultColourTable, pbData, dwBytes);
|
||||
}
|
||||
m_colourTable = new ColourTable(defaultColourTable, pbData, dataBytes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public:
|
|||
DLCColourTableFile(const std::wstring &path);
|
||||
~DLCColourTableFile();
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes);
|
||||
|
||||
ColourTable *getColourTable() { return m_colourTable; }
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,4 +23,4 @@ DLCFile::DLCFile(DLCManager::EDLCType type, const std::wstring &path)
|
|||
{
|
||||
m_dwSkinId=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <cstdint>
|
||||
#include "DLCManager.h"
|
||||
|
||||
class DLCFile
|
||||
|
|
@ -6,7 +7,7 @@ class DLCFile
|
|||
protected:
|
||||
DLCManager::EDLCType m_type;
|
||||
std::wstring m_path;
|
||||
DWORD m_dwSkinId;
|
||||
std::uint32_t m_dwSkinId;
|
||||
|
||||
public:
|
||||
DLCFile(DLCManager::EDLCType type, const std::wstring &path);
|
||||
|
|
@ -14,12 +15,12 @@ public:
|
|||
|
||||
DLCManager::EDLCType getType() { return m_type; }
|
||||
std::wstring getPath() { return m_path; }
|
||||
DWORD getSkinID() { return m_dwSkinId; }
|
||||
std::uint32_t getSkinID() { return m_dwSkinId; }
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes) {}
|
||||
virtual PBYTE getData(DWORD &dwBytes) { dwBytes = 0; return NULL; }
|
||||
virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes) {}
|
||||
virtual std::uint8_t *getData(std::uint32_t &dataBytes) { dataBytes = 0; return NULL; }
|
||||
virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) {}
|
||||
|
||||
virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; }
|
||||
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type) { return false;}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,17 +5,17 @@
|
|||
DLCGameRulesFile::DLCGameRulesFile(const std::wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRules,path)
|
||||
{
|
||||
m_pbData = NULL;
|
||||
m_dwBytes = 0;
|
||||
m_dataBytes = 0;
|
||||
}
|
||||
|
||||
void DLCGameRulesFile::addData(PBYTE pbData, DWORD dwBytes)
|
||||
void DLCGameRulesFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes)
|
||||
{
|
||||
m_pbData = pbData;
|
||||
m_dwBytes = dwBytes;
|
||||
m_dataBytes = dataBytes;
|
||||
}
|
||||
|
||||
PBYTE DLCGameRulesFile::getData(DWORD &dwBytes)
|
||||
std::uint8_t *DLCGameRulesFile::getData(std::uint32_t &dataBytes)
|
||||
{
|
||||
dwBytes = m_dwBytes;
|
||||
dataBytes = m_dataBytes;
|
||||
return m_pbData;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
class DLCGameRulesFile : public DLCGameRules
|
||||
{
|
||||
private:
|
||||
PBYTE m_pbData;
|
||||
DWORD m_dwBytes;
|
||||
std::uint8_t *m_pbData;
|
||||
std::uint32_t m_dataBytes;
|
||||
|
||||
public:
|
||||
DLCGameRulesFile(const std::wstring &path);
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
virtual PBYTE getData(DWORD &dwBytes);
|
||||
};
|
||||
virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes);
|
||||
virtual std::uint8_t *getData(std::uint32_t &dataBytes);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRulesHeader,path)
|
||||
{
|
||||
m_pbData = NULL;
|
||||
m_dwBytes = 0;
|
||||
m_dataBytes = 0;
|
||||
|
||||
m_hasData = false;
|
||||
|
||||
|
|
@ -21,14 +21,14 @@ DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring &path) : DLCGameRules(
|
|||
lgo = NULL;
|
||||
}
|
||||
|
||||
void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes)
|
||||
void DLCGameRulesHeader::addData(std::uint8_t *pbData, std::uint32_t dataBytes)
|
||||
{
|
||||
m_pbData = pbData;
|
||||
m_dwBytes = dwBytes;
|
||||
m_dataBytes = dataBytes;
|
||||
|
||||
|
||||
#if 0
|
||||
byteArray data(m_pbData, m_dwBytes);
|
||||
byteArray data(m_pbData, m_dataBytes);
|
||||
ByteArrayInputStream bais(data);
|
||||
DataInputStream dis(&bais);
|
||||
|
||||
|
|
@ -73,13 +73,13 @@ void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes)
|
|||
#endif
|
||||
}
|
||||
|
||||
PBYTE DLCGameRulesHeader::getData(DWORD &dwBytes)
|
||||
std::uint8_t *DLCGameRulesHeader::getData(std::uint32_t &dataBytes)
|
||||
{
|
||||
dwBytes = m_dwBytes;
|
||||
dataBytes = m_dataBytes;
|
||||
return m_pbData;
|
||||
}
|
||||
|
||||
void DLCGameRulesHeader::setGrfData(PBYTE fData, DWORD fSize, StringTable *st)
|
||||
void DLCGameRulesHeader::setGrfData(std::uint8_t *fData, std::uint32_t dataSize, StringTable *st)
|
||||
{
|
||||
if (!m_hasData)
|
||||
{
|
||||
|
|
@ -87,6 +87,6 @@ void DLCGameRulesHeader::setGrfData(PBYTE fData, DWORD fSize, StringTable *st)
|
|||
|
||||
//app.m_gameRules.loadGameRules(lgo, fData, fSize);
|
||||
|
||||
app.m_gameRules.readRuleFile(lgo, fData, fSize, st);
|
||||
app.m_gameRules.readRuleFile(lgo, fData, dataSize, st);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,21 +8,21 @@ class DLCGameRulesHeader : public DLCGameRules, public JustGrSource
|
|||
private:
|
||||
|
||||
// GR-Header
|
||||
PBYTE m_pbData;
|
||||
DWORD m_dwBytes;
|
||||
std::uint8_t *m_pbData;
|
||||
std::uint32_t m_dataBytes;
|
||||
|
||||
bool m_hasData;
|
||||
|
||||
public:
|
||||
virtual bool requiresTexturePack() {return m_bRequiresTexturePack;}
|
||||
virtual UINT getRequiredTexturePackId() {return m_requiredTexturePackId;}
|
||||
virtual std::uint32_t getRequiredTexturePackId() {return m_requiredTexturePackId;}
|
||||
virtual std::wstring getDefaultSaveName() {return m_defaultSaveName;}
|
||||
virtual LPCWSTR getWorldName() {return m_worldName.c_str();}
|
||||
virtual LPCWSTR getDisplayName() {return m_displayName.c_str();}
|
||||
virtual const wchar_t *getWorldName() {return m_worldName.c_str();}
|
||||
virtual const wchar_t *getDisplayName() {return m_displayName.c_str();}
|
||||
virtual std::wstring getGrfPath() {return L"GameRules.grf";}
|
||||
|
||||
virtual void setRequiresTexturePack(bool x) {m_bRequiresTexturePack = x;}
|
||||
virtual void setRequiredTexturePackId(UINT x) {m_requiredTexturePackId = x;}
|
||||
virtual void setRequiredTexturePackId(std::uint32_t x) {m_requiredTexturePackId = x;}
|
||||
virtual void setDefaultSaveName(const std::wstring &x) {m_defaultSaveName = x;}
|
||||
virtual void setWorldName(const std::wstring & x) {m_worldName = x;}
|
||||
virtual void setDisplayName(const std::wstring & x) {m_displayName = x;}
|
||||
|
|
@ -33,10 +33,10 @@ public:
|
|||
public:
|
||||
DLCGameRulesHeader(const std::wstring &path);
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
virtual PBYTE getData(DWORD &dwBytes);
|
||||
virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes);
|
||||
virtual std::uint8_t *getData(std::uint32_t &dataBytes);
|
||||
|
||||
void setGrfData(PBYTE fData, DWORD fSize, StringTable *);
|
||||
void setGrfData(std::uint8_t *fData, std::uint32_t dataSize, StringTable *);
|
||||
|
||||
virtual bool ready() { return m_hasData; }
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ DLCLocalisationFile::DLCLocalisationFile(const std::wstring &path) : DLCFile(DLC
|
|||
m_strings = NULL;
|
||||
}
|
||||
|
||||
void DLCLocalisationFile::addData(PBYTE pbData, DWORD dwBytes)
|
||||
void DLCLocalisationFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes)
|
||||
{
|
||||
m_strings = new StringTable(pbData, dwBytes);
|
||||
}
|
||||
m_strings = new StringTable(pbData, dataBytes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ private:
|
|||
|
||||
public:
|
||||
DLCLocalisationFile(const std::wstring &path);
|
||||
DLCLocalisationFile(PBYTE pbData, DWORD dwBytes); // when we load in a texture pack details file from TMS++
|
||||
DLCLocalisationFile(std::uint8_t *pbData, std::uint32_t dataBytes); // when we load in a texture pack details file from TMS++
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes);
|
||||
|
||||
StringTable *getStringTable() { return m_strings; }
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,12 +4,17 @@
|
|||
#include "DLCPack.h"
|
||||
#include "DLCFile.h"
|
||||
#include "../../Minecraft.World/Util/StringHelpers.h"
|
||||
#include "../../Minecraft.World/Util/PortableFileIO.h"
|
||||
#include "../../Minecraft.Client/Minecraft.h"
|
||||
#include "../../Minecraft.Client/Textures/Packs/TexturePackRepository.h"
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
// 4jcraft, this is the size of wchar_t on disk
|
||||
// the DLC was created on windows, with wchar_t beeing 2 bytes and UTF-16
|
||||
static const size_t DLC_WCHAR_BIN_SIZE = 2;
|
||||
static const std::size_t DLC_WCHAR_BIN_SIZE = 2;
|
||||
|
||||
#if WCHAR_MAX > 0xFFFF
|
||||
// than sizeof(WCHAR) != DLC_WCHAR_BIN_SIZE
|
||||
|
|
@ -18,22 +23,22 @@ static_assert( sizeof(wchar_t) == 4, "wchar_t is not 4bytes but larger than 2byt
|
|||
|
||||
static inline std::wstring dlc_read_wstring(const void *data)
|
||||
{
|
||||
const uint16_t* p = (const uint16_t *)data;
|
||||
const std::uint16_t* p = static_cast<const std::uint16_t *>(data);
|
||||
// find the end (nullterminated)
|
||||
const uint16_t* end = p;
|
||||
const std::uint16_t* end = p;
|
||||
while(*end) {
|
||||
++end;
|
||||
++end;
|
||||
}
|
||||
|
||||
size_t len = end - p;
|
||||
std::size_t len = static_cast<std::size_t>(end - p);
|
||||
|
||||
// allocate wstring with length len
|
||||
// it will be nullterminated internally, do not worry.
|
||||
std::wstring out(len, 0);
|
||||
|
||||
// and copy them into thje string
|
||||
for(size_t i = 0; i < len; ++i) {
|
||||
out[i] = (wchar_t) p[i];
|
||||
for(std::size_t i = 0; i < len; ++i) {
|
||||
out[i] = static_cast<wchar_t>(p[i]);
|
||||
}
|
||||
|
||||
return out;
|
||||
|
|
@ -51,6 +56,91 @@ static_assert( sizeof(wchar_t) == 2, "How did we get here? wide char smaller tha
|
|||
#define DLC_PARAM_ADV(n) (sizeof(C4JStorage::DLC_FILE_PARAM) + (n) * DLC_WCHAR_BIN_SIZE)
|
||||
#define DLC_DETAIL_ADV(n) (sizeof(C4JStorage::DLC_FILE_DETAILS) + (n) * DLC_WCHAR_BIN_SIZE)
|
||||
|
||||
namespace
|
||||
{
|
||||
template <typename T>
|
||||
T ReadDlcValue(const std::uint8_t *data, unsigned int offset = 0)
|
||||
{
|
||||
T value;
|
||||
std::memcpy(&value, data + offset, sizeof(value));
|
||||
return value;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void ReadDlcStruct(T *out, const std::uint8_t *data, unsigned int offset = 0)
|
||||
{
|
||||
std::memcpy(out, data + offset, sizeof(*out));
|
||||
}
|
||||
|
||||
std::wstring getMountedDlcReadPath(const std::string &path)
|
||||
{
|
||||
std::wstring readPath = convStringToWstring(path);
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
const std::string mountedPath = StorageManager.GetMountedPath(path.c_str());
|
||||
if(!mountedPath.empty())
|
||||
{
|
||||
readPath = convStringToWstring(mountedPath);
|
||||
}
|
||||
#elif defined(_DURANGO)
|
||||
const std::wstring mountedPath = StorageManager.GetMountedPath(readPath.c_str());
|
||||
if(!mountedPath.empty())
|
||||
{
|
||||
readPath = mountedPath;
|
||||
}
|
||||
#endif
|
||||
|
||||
return readPath;
|
||||
}
|
||||
|
||||
bool readOwnedDlcFile(const std::string &path, std::uint8_t **ppData, unsigned int *pBytesRead)
|
||||
{
|
||||
*ppData = NULL;
|
||||
*pBytesRead = 0;
|
||||
|
||||
const std::wstring readPath = getMountedDlcReadPath(path);
|
||||
std::FILE *file = PortableFileIO::OpenBinaryFileForRead(readPath);
|
||||
if(file == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!PortableFileIO::Seek(file, 0, SEEK_END))
|
||||
{
|
||||
std::fclose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
const __int64 endPosition = PortableFileIO::Tell(file);
|
||||
if(endPosition <= 0 || endPosition > std::numeric_limits<unsigned int>::max())
|
||||
{
|
||||
std::fclose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
const unsigned int fileSize = static_cast<unsigned int>(endPosition);
|
||||
if(!PortableFileIO::Seek(file, 0, SEEK_SET))
|
||||
{
|
||||
std::fclose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::uint8_t *data = new std::uint8_t[fileSize];
|
||||
const std::size_t bytesRead = std::fread(data, 1, fileSize, file);
|
||||
const bool failed = std::ferror(file) != 0 || bytesRead != fileSize;
|
||||
std::fclose(file);
|
||||
if(failed)
|
||||
{
|
||||
delete[] data;
|
||||
return false;
|
||||
}
|
||||
|
||||
*ppData = data;
|
||||
*pBytesRead = static_cast<unsigned int>(bytesRead);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
const WCHAR *DLCManager::wchTypeNamesA[]=
|
||||
{
|
||||
L"DISPLAYNAME",
|
||||
|
|
@ -87,7 +177,7 @@ DLCManager::EDLCParameterType DLCManager::getParameterType(const std::wstring &p
|
|||
{
|
||||
EDLCParameterType type = e_DLCParamType_Invalid;
|
||||
|
||||
for(DWORD i = 0; i < e_DLCParamType_Max; ++i)
|
||||
for(unsigned int i = 0; i < e_DLCParamType_Max; ++i)
|
||||
{
|
||||
if(paramName.compare(wchTypeNamesA[i]) == 0)
|
||||
{
|
||||
|
|
@ -99,9 +189,9 @@ DLCManager::EDLCParameterType DLCManager::getParameterType(const std::wstring &p
|
|||
return type;
|
||||
}
|
||||
|
||||
DWORD DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/)
|
||||
unsigned int DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/)
|
||||
{
|
||||
DWORD packCount = 0;
|
||||
unsigned int packCount = 0;
|
||||
if( type != e_DLCType_All )
|
||||
{
|
||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
||||
|
|
@ -115,7 +205,7 @@ DWORD DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/)
|
|||
}
|
||||
else
|
||||
{
|
||||
packCount = (DWORD)m_packs.size();
|
||||
packCount = static_cast<unsigned int>(m_packs.size());
|
||||
}
|
||||
return packCount;
|
||||
}
|
||||
|
|
@ -175,12 +265,12 @@ DLCPack *DLCManager::getPackFromProductID(const std::wstring &productID)
|
|||
}
|
||||
#endif
|
||||
|
||||
DLCPack *DLCManager::getPack(DWORD index, EDLCType type /*= e_DLCType_All*/)
|
||||
DLCPack *DLCManager::getPack(unsigned int index, EDLCType type /*= e_DLCType_All*/)
|
||||
{
|
||||
DLCPack *pack = NULL;
|
||||
if( type != e_DLCType_All )
|
||||
{
|
||||
DWORD currentIndex = 0;
|
||||
unsigned int currentIndex = 0;
|
||||
DLCPack *currentPack = NULL;
|
||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
||||
{
|
||||
|
|
@ -209,9 +299,9 @@ DLCPack *DLCManager::getPack(DWORD index, EDLCType type /*= e_DLCType_All*/)
|
|||
return pack;
|
||||
}
|
||||
|
||||
DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_DLCType_All*/)
|
||||
unsigned int DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_DLCType_All*/)
|
||||
{
|
||||
DWORD foundIndex = 0;
|
||||
unsigned int foundIndex = 0;
|
||||
found = false;
|
||||
if(pack == NULL)
|
||||
{
|
||||
|
|
@ -221,7 +311,7 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D
|
|||
}
|
||||
if( type != e_DLCType_All )
|
||||
{
|
||||
DWORD index = 0;
|
||||
unsigned int index = 0;
|
||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
||||
{
|
||||
DLCPack *thisPack = *it;
|
||||
|
|
@ -239,7 +329,7 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D
|
|||
}
|
||||
else
|
||||
{
|
||||
DWORD index = 0;
|
||||
unsigned int index = 0;
|
||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
||||
{
|
||||
DLCPack *thisPack = *it;
|
||||
|
|
@ -255,11 +345,11 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D
|
|||
return foundIndex;
|
||||
}
|
||||
|
||||
DWORD DLCManager::getPackIndexContainingSkin(const std::wstring &path, bool &found)
|
||||
unsigned int DLCManager::getPackIndexContainingSkin(const std::wstring &path, bool &found)
|
||||
{
|
||||
DWORD foundIndex = 0;
|
||||
unsigned int foundIndex = 0;
|
||||
found = false;
|
||||
DWORD index = 0;
|
||||
unsigned int index = 0;
|
||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
||||
{
|
||||
DLCPack *pack = *it;
|
||||
|
|
@ -310,9 +400,9 @@ DLCSkinFile *DLCManager::getSkinFile(const std::wstring &path)
|
|||
return foundSkinfile;
|
||||
}
|
||||
|
||||
DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
|
||||
unsigned int DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
|
||||
{
|
||||
DWORD corruptDLCCount = m_dwUnnamedCorruptDLCCount;
|
||||
unsigned int corruptDLCCount = m_dwUnnamedCorruptDLCCount;
|
||||
DLCPack *pack = NULL;
|
||||
DLCPack *firstCorruptPack = NULL;
|
||||
|
||||
|
|
@ -329,7 +419,7 @@ DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
|
|||
// gotta fix this someday
|
||||
if(corruptDLCCount > 0 && showMessage)
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
if(corruptDLCCount == 1 && firstCorruptPack != NULL)
|
||||
{
|
||||
|
|
@ -351,13 +441,13 @@ DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
|
|||
return corruptDLCCount;
|
||||
}
|
||||
|
||||
bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const std::wstring &path, DLCPack *pack, bool fromArchive)
|
||||
bool DLCManager::readDLCDataFile(unsigned int &dwFilesProcessed, const std::wstring &path, DLCPack *pack, bool fromArchive)
|
||||
{
|
||||
return readDLCDataFile( dwFilesProcessed, wstringtofilename(path), pack, fromArchive);
|
||||
}
|
||||
|
||||
|
||||
bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const std::string &path, DLCPack *pack, bool fromArchive)
|
||||
bool DLCManager::readDLCDataFile(unsigned int &dwFilesProcessed, const std::string &path, DLCPack *pack, bool fromArchive)
|
||||
{
|
||||
std::wstring wPath = convStringToWstring(path);
|
||||
if (fromArchive && app.getArchiveFileSize(wPath) >= 0)
|
||||
|
|
@ -367,49 +457,19 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const std::string &pat
|
|||
}
|
||||
else if (fromArchive) return false;
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
std::string finalPath = StorageManager.GetMountedPath(path.c_str());
|
||||
if(finalPath.size() == 0) finalPath = path;
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#elif defined(_DURANGO)
|
||||
std::wstring finalPath = StorageManager.GetMountedPath(wPath.c_str());
|
||||
if(finalPath.size() == 0) finalPath = wPath;
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#else
|
||||
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#endif
|
||||
if( file == INVALID_HANDLE_VALUE )
|
||||
unsigned int bytesRead = 0;
|
||||
std::uint8_t *pbData = NULL;
|
||||
if(!readOwnedDlcFile(path, &pbData, &bytesRead))
|
||||
{
|
||||
DWORD error = GetLastError();
|
||||
app.DebugPrintf("Failed to open DLC data file with error code %d (%x)\n", error, error);
|
||||
if( dwFilesProcessed == 0 ) removePack(pack);
|
||||
assert(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(file,NULL);
|
||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||
BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL);
|
||||
if(bSuccess==FALSE)
|
||||
{
|
||||
// need to treat the file as corrupt, and flag it, so can't call fatal error
|
||||
//app.FatalLoadError();
|
||||
}
|
||||
else
|
||||
{
|
||||
CloseHandle(file);
|
||||
}
|
||||
if(bSuccess==FALSE)
|
||||
{
|
||||
// Corrupt or some other error. In any case treat as corrupt
|
||||
app.DebugPrintf("Failed to read %s from DLC content package\n", path.c_str());
|
||||
pack->SetIsCorrupt( true );
|
||||
app.DebugPrintf("Failed to open DLC data file %s\n", path.c_str());
|
||||
pack->SetIsCorrupt(true);
|
||||
SetNeedsCorruptCheck(true);
|
||||
return false;
|
||||
}
|
||||
return processDLCDataFile(dwFilesProcessed, pbData, bytesRead, pack);
|
||||
}
|
||||
|
||||
bool DLCManager::processDLCDataFile(unsigned int &dwFilesProcessed, std::uint8_t *pbData, unsigned int dwLength, DLCPack *pack)
|
||||
// a bunch of makros to reduce memcpy and offset boilerplate
|
||||
#define DLC_READ_UINT(out, buf, off) memcpy((out), (buf) + (off), sizeof(unsigned int))
|
||||
|
||||
|
|
@ -421,8 +481,6 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const std::string &pat
|
|||
#define DLC_PARAM_WSTR(buf, off) DLC_WSTRING((buf) + (off) + offsetof(C4JStorage::DLC_FILE_PARAM, wchData))
|
||||
|
||||
#define DLC_DETAIL_WSTR(buf, off) DLC_WSTRING((buf) + (off) + offsetof(C4JStorage::DLC_FILE_DETAILS, wchFile))
|
||||
|
||||
bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
||||
{
|
||||
std::unordered_map<int, DLCManager::EDLCParameterType> parameterMapping;
|
||||
unsigned int uiCurrentByte=0;
|
||||
|
|
@ -438,16 +496,16 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
|||
// // unsigned long, p = number of parameters
|
||||
// // p * DLC_FILE_PARAM describing each parameter for this file
|
||||
// // ulFileSize bytes of data blob of the file added
|
||||
|
||||
|
||||
// 4jcraft, some parts of this code changed, specifically:
|
||||
// instead of casting a goddamn raw byte pointer and dereferencing it
|
||||
// use memcpy, and access WSTRING with propper offset
|
||||
// (scince bufferoffset after advancing by variable string length is not
|
||||
// use memcpy, and access WSTRING with propper offset
|
||||
// (scince bufferoffset after advancing by variable string length is not
|
||||
// guaranteed to be properly aligned, so casting to a scalar/struct is UB)
|
||||
|
||||
|
||||
// those casts coult be dangerous on e.g. ARM, because it doesnt handle
|
||||
// missaligned loads, like x86/x64, so it would crash
|
||||
|
||||
|
||||
// WHO TF USES HUNGARIAN NOTATION
|
||||
|
||||
unsigned int uiVersion;
|
||||
|
|
@ -490,13 +548,13 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
|||
C4JStorage::DLC_FILE_DETAILS fileBuf;
|
||||
DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte);
|
||||
|
||||
DWORD dwTemp=uiCurrentByte;
|
||||
unsigned int dwTemp=uiCurrentByte;
|
||||
for(unsigned int i=0;i<uiFileCount;i++)
|
||||
{
|
||||
dwTemp+=DLC_DETAIL_ADV(fileBuf.dwWchCount);
|
||||
DLC_READ_DETAIL(&fileBuf, pbData, dwTemp);
|
||||
}
|
||||
PBYTE pbTemp = &pbData[dwTemp];//+ sizeof(C4JStorage::DLC_FILE_DETAILS)*ulFileCount;
|
||||
std::uint8_t *pbTemp = &pbData[dwTemp];//+ sizeof(C4JStorage::DLC_FILE_DETAILS)*ulFileCount;
|
||||
DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte);
|
||||
|
||||
for(unsigned int i=0;i<uiFileCount;i++)
|
||||
|
|
@ -546,8 +604,8 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
|||
|
||||
if(dlcTexturePack != NULL)
|
||||
{
|
||||
DWORD texturePackFilesProcessed = 0;
|
||||
bool validPack = processDLCDataFile(texturePackFilesProcessed,pbTemp,fileBuf.uiFileSize,dlcTexturePack);
|
||||
unsigned int texturePackFilesProcessed = 0;
|
||||
bool validPack = processDLCDataFile(texturePackFilesProcessed, pbTemp, fileBuf.uiFileSize, dlcTexturePack);
|
||||
pack->SetDataPointer(NULL); // If it's a child pack, it doesn't own the data
|
||||
if(!validPack || texturePackFilesProcessed == 0)
|
||||
{
|
||||
|
|
@ -603,56 +661,25 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
|||
return true;
|
||||
}
|
||||
|
||||
DWORD DLCManager::retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack)
|
||||
std::uint32_t DLCManager::retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack)
|
||||
{
|
||||
DWORD packId = 0;
|
||||
std::wstring wPath = convStringToWstring(path);
|
||||
std::uint32_t packId = 0;
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
std::string finalPath = StorageManager.GetMountedPath(path.c_str());
|
||||
if(finalPath.size() == 0) finalPath = path;
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#elif defined(_DURANGO)
|
||||
std::wstring finalPath = StorageManager.GetMountedPath(wPath.c_str());
|
||||
if(finalPath.size() == 0) finalPath = wPath;
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#else
|
||||
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#endif
|
||||
if( file == INVALID_HANDLE_VALUE )
|
||||
unsigned int bytesRead = 0;
|
||||
std::uint8_t *pbData = NULL;
|
||||
if(!readOwnedDlcFile(path, &pbData, &bytesRead))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD bytesRead;
|
||||
DWORD dwFileSize = GetFileSize(file,NULL);
|
||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||
BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL);
|
||||
if(bSuccess==FALSE)
|
||||
{
|
||||
// need to treat the file as corrupt, and flag it, so can't call fatal error
|
||||
//app.FatalLoadError();
|
||||
}
|
||||
else
|
||||
{
|
||||
CloseHandle(file);
|
||||
}
|
||||
if(bSuccess==FALSE)
|
||||
{
|
||||
// Corrupt or some other error. In any case treat as corrupt
|
||||
app.DebugPrintf("Failed to read %s from DLC content package\n", path.c_str());
|
||||
delete [] pbData;
|
||||
return 0;
|
||||
}
|
||||
packId=retrievePackID(pbData, bytesRead, pack);
|
||||
delete [] pbData;
|
||||
|
||||
return packId;
|
||||
}
|
||||
|
||||
DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
||||
std::uint32_t DLCManager::retrievePackID(std::uint8_t *pbData, unsigned int dwLength, DLCPack *pack)
|
||||
{
|
||||
DWORD packId=0;
|
||||
std::uint32_t packId=0;
|
||||
bool bPackIDSet=false;
|
||||
std::unordered_map<int, DLCManager::EDLCParameterType> parameterMapping;
|
||||
unsigned int uiCurrentByte=0;
|
||||
|
|
@ -668,7 +695,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
|||
// // unsigned long, p = number of parameters
|
||||
// // p * DLC_FILE_PARAM describing each parameter for this file
|
||||
// // ulFileSize bytes of data blob of the file added
|
||||
unsigned int uiVersion=*(unsigned int *)pbData;
|
||||
unsigned int uiVersion = ReadDlcValue<unsigned int>(pbData, uiCurrentByte);
|
||||
uiCurrentByte+=sizeof(int);
|
||||
|
||||
if(uiVersion < CURRENT_DLC_VERSION_NUM)
|
||||
|
|
@ -677,46 +704,48 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
|||
return 0;
|
||||
}
|
||||
pack->SetDataPointer(pbData);
|
||||
unsigned int uiParameterCount=*(unsigned int *)&pbData[uiCurrentByte];
|
||||
unsigned int uiParameterCount = ReadDlcValue<unsigned int>(pbData, uiCurrentByte);
|
||||
uiCurrentByte+=sizeof(int);
|
||||
C4JStorage::DLC_FILE_PARAM *pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte];
|
||||
C4JStorage::DLC_FILE_PARAM paramBuf;
|
||||
ReadDlcStruct(¶mBuf, pbData, uiCurrentByte);
|
||||
for(unsigned int i=0;i<uiParameterCount;i++)
|
||||
{
|
||||
// Map DLC strings to application strings, then store the DLC index mapping to application index
|
||||
std::wstring parameterName = DLC_WSTRING(pParams->wchData);
|
||||
std::wstring parameterName = DLC_PARAM_WSTR(pbData, uiCurrentByte);
|
||||
DLCManager::EDLCParameterType type = DLCManager::getParameterType(parameterName);
|
||||
if( type != DLCManager::e_DLCParamType_Invalid )
|
||||
{
|
||||
parameterMapping[pParams->dwType] = type;
|
||||
parameterMapping[paramBuf.dwType] = type;
|
||||
}
|
||||
uiCurrentByte+= DLC_PARAM_ADV(pParams->dwWchCount);
|
||||
pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte];
|
||||
uiCurrentByte += DLC_PARAM_ADV(paramBuf.dwWchCount);
|
||||
ReadDlcStruct(¶mBuf, pbData, uiCurrentByte);
|
||||
}
|
||||
|
||||
unsigned int uiFileCount=*(unsigned int *)&pbData[uiCurrentByte];
|
||||
unsigned int uiFileCount = ReadDlcValue<unsigned int>(pbData, uiCurrentByte);
|
||||
uiCurrentByte+=sizeof(int);
|
||||
C4JStorage::DLC_FILE_DETAILS *pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte];
|
||||
C4JStorage::DLC_FILE_DETAILS fileBuf;
|
||||
ReadDlcStruct(&fileBuf, pbData, uiCurrentByte);
|
||||
|
||||
DWORD dwTemp=uiCurrentByte;
|
||||
unsigned int dwTemp=uiCurrentByte;
|
||||
for(unsigned int i=0;i<uiFileCount;i++)
|
||||
{
|
||||
dwTemp+=DLC_DETAIL_ADV(pFile->dwWchCount);
|
||||
pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[dwTemp];
|
||||
dwTemp += DLC_DETAIL_ADV(fileBuf.dwWchCount);
|
||||
ReadDlcStruct(&fileBuf, pbData, dwTemp);
|
||||
}
|
||||
PBYTE pbTemp=((PBYTE )pFile);
|
||||
pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte];
|
||||
std::uint8_t *pbTemp = &pbData[dwTemp];
|
||||
ReadDlcStruct(&fileBuf, pbData, uiCurrentByte);
|
||||
|
||||
for(unsigned int i=0;i<uiFileCount;i++)
|
||||
{
|
||||
DLCManager::EDLCType type = (DLCManager::EDLCType)pFile->dwType;
|
||||
DLCManager::EDLCType type = (DLCManager::EDLCType)fileBuf.dwType;
|
||||
|
||||
// Params
|
||||
uiParameterCount=*(unsigned int *)pbTemp;
|
||||
uiParameterCount = ReadDlcValue<unsigned int>(pbTemp);
|
||||
pbTemp+=sizeof(int);
|
||||
pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp;
|
||||
ReadDlcStruct(¶mBuf, pbTemp);
|
||||
for(unsigned int j=0;j<uiParameterCount;j++)
|
||||
{
|
||||
AUTO_VAR(it, parameterMapping.find( pParams->dwType ));
|
||||
AUTO_VAR(it, parameterMapping.find(paramBuf.dwType));
|
||||
|
||||
if(it != parameterMapping.end() )
|
||||
{
|
||||
|
|
@ -724,7 +753,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
|||
{
|
||||
if(it->second==e_DLCParamType_PackId)
|
||||
{
|
||||
std::wstring wsTemp = DLC_WSTRING(pParams->wchData);
|
||||
std::wstring wsTemp = DLC_PARAM_WSTR(pbTemp, 0);
|
||||
std::wstringstream ss;
|
||||
// 4J Stu - numbered using decimal to make it easier for artists/people to number manually
|
||||
ss << std::dec << wsTemp.c_str();
|
||||
|
|
@ -734,16 +763,16 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
|||
}
|
||||
}
|
||||
}
|
||||
pbTemp+=DLC_PARAM_ADV(pParams->dwWchCount);
|
||||
pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp;
|
||||
pbTemp += DLC_PARAM_ADV(paramBuf.dwWchCount);
|
||||
ReadDlcStruct(¶mBuf, pbTemp);
|
||||
}
|
||||
|
||||
if(bPackIDSet) break;
|
||||
// Move the pointer to the start of the next files data;
|
||||
pbTemp+=pFile->uiFileSize;
|
||||
uiCurrentByte+=DLC_DETAIL_ADV(pFile->dwWchCount);
|
||||
pbTemp += fileBuf.uiFileSize;
|
||||
uiCurrentByte += DLC_DETAIL_ADV(fileBuf.dwWchCount);
|
||||
|
||||
pFile=(C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte];
|
||||
ReadDlcStruct(&fileBuf, pbData, uiCurrentByte);
|
||||
}
|
||||
|
||||
parameterMapping.clear();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
//using namespace std;
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
class DLCPack;
|
||||
class DLCSkinFile;
|
||||
|
|
@ -54,14 +55,14 @@ private:
|
|||
std::vector<DLCPack *> m_packs;
|
||||
//bool m_bNeedsUpdated;
|
||||
bool m_bNeedsCorruptCheck;
|
||||
DWORD m_dwUnnamedCorruptDLCCount;
|
||||
unsigned int m_dwUnnamedCorruptDLCCount;
|
||||
public:
|
||||
DLCManager();
|
||||
~DLCManager();
|
||||
|
||||
static EDLCParameterType getParameterType(const std::wstring ¶mName);
|
||||
|
||||
DWORD getPackCount(EDLCType type = e_DLCType_All);
|
||||
unsigned int getPackCount(EDLCType type = e_DLCType_All);
|
||||
|
||||
//bool NeedsUpdated() { return m_bNeedsUpdated; }
|
||||
//void SetNeedsUpdated(bool val) { m_bNeedsUpdated = val; }
|
||||
|
|
@ -79,21 +80,21 @@ public:
|
|||
#ifdef _XBOX_ONE
|
||||
DLCPack *DLCManager::getPackFromProductID(const std::wstring &productID);
|
||||
#endif
|
||||
DLCPack *getPack(DWORD index, EDLCType type = e_DLCType_All);
|
||||
DWORD getPackIndex(DLCPack *pack, bool &found, EDLCType type = e_DLCType_All);
|
||||
DLCPack *getPack(unsigned int index, EDLCType type = e_DLCType_All);
|
||||
unsigned int getPackIndex(DLCPack *pack, bool &found, EDLCType type = e_DLCType_All);
|
||||
DLCSkinFile *getSkinFile(const std::wstring &path); // Will hunt all packs of type skin to find the right skinfile
|
||||
|
||||
DLCPack *getPackContainingSkin(const std::wstring &path);
|
||||
DWORD getPackIndexContainingSkin(const std::wstring &path, bool &found);
|
||||
unsigned int getPackIndexContainingSkin(const std::wstring &path, bool &found);
|
||||
|
||||
DWORD checkForCorruptDLCAndAlert(bool showMessage = true);
|
||||
unsigned int checkForCorruptDLCAndAlert(bool showMessage = true);
|
||||
|
||||
bool readDLCDataFile(DWORD &dwFilesProcessed, const std::wstring &path, DLCPack *pack, bool fromArchive = false);
|
||||
bool readDLCDataFile(DWORD &dwFilesProcessed, const std::string &path, DLCPack *pack, bool fromArchive = false);
|
||||
DWORD retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack);
|
||||
bool readDLCDataFile(unsigned int &dwFilesProcessed, const std::wstring &path, DLCPack *pack, bool fromArchive = false);
|
||||
bool readDLCDataFile(unsigned int &dwFilesProcessed, const std::string &path, DLCPack *pack, bool fromArchive = false);
|
||||
std::uint32_t retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack);
|
||||
|
||||
private:
|
||||
bool processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD dwLength, DLCPack *pack);
|
||||
bool processDLCDataFile(unsigned int &dwFilesProcessed, std::uint8_t *pbData, unsigned int dwLength, DLCPack *pack);
|
||||
|
||||
DWORD retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack);
|
||||
std::uint32_t retrievePackID(std::uint8_t *pbData, unsigned int dwLength, DLCPack *pack);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#include "DLCColourTableFile.h"
|
||||
#include "../../Minecraft.World/Util/StringHelpers.h"
|
||||
|
||||
DLCPack::DLCPack(const std::wstring &name,DWORD dwLicenseMask)
|
||||
DLCPack::DLCPack(const std::wstring &name,std::uint32_t dwLicenseMask)
|
||||
{
|
||||
m_dataPath = L"";
|
||||
m_packName = name;
|
||||
|
|
@ -35,7 +35,7 @@ DLCPack::DLCPack(const std::wstring &name,DWORD dwLicenseMask)
|
|||
}
|
||||
|
||||
#ifdef _XBOX_ONE
|
||||
DLCPack::DLCPack(const std::wstring &name,const std::wstring &productID,DWORD dwLicenseMask)
|
||||
DLCPack::DLCPack(const std::wstring &name,const std::wstring &productID,std::uint32_t dwLicenseMask)
|
||||
{
|
||||
m_dataPath = L"";
|
||||
m_packName = name;
|
||||
|
|
@ -81,7 +81,7 @@ DLCPack::~DLCPack()
|
|||
}
|
||||
}
|
||||
|
||||
DWORD DLCPack::GetDLCMountIndex()
|
||||
int DLCPack::GetDLCMountIndex()
|
||||
{
|
||||
if(m_parentPack != NULL)
|
||||
{
|
||||
|
|
@ -101,9 +101,9 @@ XCONTENTDEVICEID DLCPack::GetDLCDeviceID()
|
|||
|
||||
void DLCPack::addChildPack(DLCPack *childPack)
|
||||
{
|
||||
int packId = childPack->GetPackId();
|
||||
const std::uint32_t packId = childPack->GetPackId();
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
if(packId < 0 || packId > 15)
|
||||
if(packId > 15)
|
||||
{
|
||||
__debugbreak();
|
||||
}
|
||||
|
|
@ -125,7 +125,7 @@ void DLCPack::addParameter(DLCManager::EDLCParameterType type, const std::wstrin
|
|||
{
|
||||
case DLCManager::e_DLCParamType_PackId:
|
||||
{
|
||||
DWORD packId = 0;
|
||||
std::uint32_t packId = 0;
|
||||
|
||||
std::wstringstream ss;
|
||||
// 4J Stu - numbered using decimal to make it easier for artists/people to number manually
|
||||
|
|
@ -137,7 +137,7 @@ void DLCPack::addParameter(DLCManager::EDLCParameterType type, const std::wstrin
|
|||
break;
|
||||
case DLCManager::e_DLCParamType_PackVersion:
|
||||
{
|
||||
DWORD version = 0;
|
||||
std::uint32_t version = 0;
|
||||
|
||||
std::wstringstream ss;
|
||||
// 4J Stu - numbered using decimal to make it easier for artists/people to number manually
|
||||
|
|
@ -278,7 +278,7 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const std::wstring
|
|||
return hasFile;
|
||||
}
|
||||
|
||||
DLCFile *DLCPack::getFile(DLCManager::EDLCType type, DWORD index)
|
||||
DLCFile *DLCPack::getFile(DLCManager::EDLCType type, unsigned int index)
|
||||
{
|
||||
DLCFile *file = NULL;
|
||||
if(type == DLCManager::e_DLCType_All)
|
||||
|
|
@ -333,9 +333,9 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const std::wstring &path)
|
|||
return file;
|
||||
}
|
||||
|
||||
DWORD DLCPack::getDLCItemsCount(DLCManager::EDLCType type /*= DLCManager::e_DLCType_All*/)
|
||||
unsigned int DLCPack::getDLCItemsCount(DLCManager::EDLCType type /*= DLCManager::e_DLCType_All*/)
|
||||
{
|
||||
DWORD count = 0;
|
||||
unsigned int count = 0;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
|
|
@ -346,13 +346,13 @@ DWORD DLCPack::getDLCItemsCount(DLCManager::EDLCType type /*= DLCManager::e_DLCT
|
|||
}
|
||||
break;
|
||||
default:
|
||||
count = (DWORD)m_files[(int)type].size();
|
||||
count = static_cast<unsigned int>(m_files[(int)type].size());
|
||||
break;
|
||||
};
|
||||
return count;
|
||||
};
|
||||
|
||||
DWORD DLCPack::getFileIndexAt(DLCManager::EDLCType type, const std::wstring &path, bool &found)
|
||||
unsigned int DLCPack::getFileIndexAt(DLCManager::EDLCType type, const std::wstring &path, bool &found)
|
||||
{
|
||||
if(type == DLCManager::e_DLCType_All)
|
||||
{
|
||||
|
|
@ -363,9 +363,9 @@ DWORD DLCPack::getFileIndexAt(DLCManager::EDLCType type, const std::wstring &pat
|
|||
return 0;
|
||||
}
|
||||
|
||||
DWORD foundIndex = 0;
|
||||
unsigned int foundIndex = 0;
|
||||
found = false;
|
||||
DWORD index = 0;
|
||||
unsigned int index = 0;
|
||||
for(AUTO_VAR(it, m_files[type].begin()); it != m_files[type].end(); ++it)
|
||||
{
|
||||
if(path.compare((*it)->getPath()) == 0)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
//using namespace std;
|
||||
#include <cstdint>
|
||||
#include "DLCManager.h"
|
||||
|
||||
class DLCFile;
|
||||
|
|
@ -16,7 +17,7 @@ private:
|
|||
|
||||
std::wstring m_packName;
|
||||
std::wstring m_dataPath;
|
||||
DWORD m_dwLicenseMask;
|
||||
std::uint32_t m_dwLicenseMask;
|
||||
int m_dlcMountIndex;
|
||||
XCONTENTDEVICEID m_dlcDeviceID;
|
||||
#ifdef _XBOX_ONE
|
||||
|
|
@ -25,36 +26,36 @@ private:
|
|||
ULONGLONG m_ullFullOfferId;
|
||||
#endif
|
||||
bool m_isCorrupt;
|
||||
DWORD m_packId;
|
||||
DWORD m_packVersion;
|
||||
std::uint32_t m_packId;
|
||||
std::uint32_t m_packVersion;
|
||||
|
||||
PBYTE m_data; // This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children.
|
||||
std::uint8_t *m_data; // This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children.
|
||||
public:
|
||||
|
||||
DLCPack(const std::wstring &name,DWORD dwLicenseMask);
|
||||
DLCPack(const std::wstring &name,std::uint32_t dwLicenseMask);
|
||||
#ifdef _XBOX_ONE
|
||||
DLCPack(const std::wstring &name,const std::wstring &productID,DWORD dwLicenseMask);
|
||||
DLCPack(const std::wstring &name,const std::wstring &productID,std::uint32_t dwLicenseMask);
|
||||
#endif
|
||||
~DLCPack();
|
||||
|
||||
std::wstring getFullDataPath() { return m_dataPath; }
|
||||
|
||||
void SetDataPointer(PBYTE pbData) { m_data = pbData; }
|
||||
void SetDataPointer(std::uint8_t *pbData) { m_data = pbData; }
|
||||
|
||||
bool IsCorrupt() { return m_isCorrupt; }
|
||||
void SetIsCorrupt(bool val) { m_isCorrupt = val; }
|
||||
|
||||
void SetPackId(DWORD id) { m_packId = id; }
|
||||
DWORD GetPackId() { return m_packId; }
|
||||
void SetPackId(std::uint32_t id) { m_packId = id; }
|
||||
std::uint32_t GetPackId() { return m_packId; }
|
||||
|
||||
void SetPackVersion(DWORD version) { m_packVersion = version; }
|
||||
DWORD GetPackVersion() { return m_packVersion; }
|
||||
void SetPackVersion(std::uint32_t version) { m_packVersion = version; }
|
||||
std::uint32_t GetPackVersion() { return m_packVersion; }
|
||||
|
||||
DLCPack * GetParentPack() { return m_parentPack; }
|
||||
DWORD GetParentPackId() { return m_parentPack->m_packId; }
|
||||
std::uint32_t GetParentPackId() { return m_parentPack->m_packId; }
|
||||
|
||||
void SetDLCMountIndex(DWORD id) { m_dlcMountIndex = id; }
|
||||
DWORD GetDLCMountIndex();
|
||||
void SetDLCMountIndex(int id) { m_dlcMountIndex = id; }
|
||||
int GetDLCMountIndex();
|
||||
void SetDLCDeviceID(XCONTENTDEVICEID deviceId) { m_dlcDeviceID = deviceId; }
|
||||
XCONTENTDEVICEID GetDLCDeviceID();
|
||||
|
||||
|
|
@ -64,8 +65,8 @@ public:
|
|||
void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value);
|
||||
bool getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned int ¶m);
|
||||
|
||||
void updateLicenseMask( DWORD dwLicenseMask ) { m_dwLicenseMask = dwLicenseMask; }
|
||||
DWORD getLicenseMask( ) { return m_dwLicenseMask; }
|
||||
void updateLicenseMask(std::uint32_t dwLicenseMask) { m_dwLicenseMask = dwLicenseMask; }
|
||||
std::uint32_t getLicenseMask() { return m_dwLicenseMask; }
|
||||
|
||||
std::wstring getName() { return m_packName; }
|
||||
#ifdef _XBOX_ONE
|
||||
|
|
@ -75,18 +76,18 @@ public:
|
|||
#endif
|
||||
|
||||
DLCFile *addFile(DLCManager::EDLCType type, const std::wstring &path);
|
||||
DLCFile *getFile(DLCManager::EDLCType type, DWORD index);
|
||||
DLCFile *getFile(DLCManager::EDLCType type, unsigned int index);
|
||||
DLCFile *getFile(DLCManager::EDLCType type, const std::wstring &path);
|
||||
|
||||
DWORD getDLCItemsCount(DLCManager::EDLCType type = DLCManager::e_DLCType_All);
|
||||
DWORD getFileIndexAt(DLCManager::EDLCType type, const std::wstring &path, bool &found);
|
||||
unsigned int getDLCItemsCount(DLCManager::EDLCType type = DLCManager::e_DLCType_All);
|
||||
unsigned int getFileIndexAt(DLCManager::EDLCType type, const std::wstring &path, bool &found);
|
||||
bool doesPackContainFile(DLCManager::EDLCType type, const std::wstring &path);
|
||||
DWORD GetPackID() {return m_packId;}
|
||||
std::uint32_t GetPackID() {return m_packId;}
|
||||
|
||||
DWORD getSkinCount() { return getDLCItemsCount(DLCManager::e_DLCType_Skin); }
|
||||
DWORD getSkinIndexAt(const std::wstring &path, bool &found) { return getFileIndexAt(DLCManager::e_DLCType_Skin, path, found); }
|
||||
unsigned int getSkinCount() { return getDLCItemsCount(DLCManager::e_DLCType_Skin); }
|
||||
unsigned int getSkinIndexAt(const std::wstring &path, bool &found) { return getFileIndexAt(DLCManager::e_DLCType_Skin, path, found); }
|
||||
DLCSkinFile *getSkinFile(const std::wstring &path) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, path); }
|
||||
DLCSkinFile *getSkinFile(DWORD index) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, index); }
|
||||
DLCSkinFile *getSkinFile(unsigned int index) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, index); }
|
||||
bool doesPackContainSkin(const std::wstring &path) { return doesPackContainFile(DLCManager::e_DLCType_Skin, path); }
|
||||
|
||||
bool hasPurchasedFile(DLCManager::EDLCType type, const std::wstring &path);
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ DLCSkinFile::DLCSkinFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCTy
|
|||
m_uiAnimOverrideBitmask=0L;
|
||||
}
|
||||
|
||||
void DLCSkinFile::addData(PBYTE pbData, DWORD dwBytes)
|
||||
void DLCSkinFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes)
|
||||
{
|
||||
app.AddMemoryTextureFile(m_path,pbData,dwBytes);
|
||||
app.AddMemoryTextureFile(m_path,pbData,dataBytes);
|
||||
}
|
||||
|
||||
void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const std::wstring &value)
|
||||
|
|
@ -157,7 +157,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const std::ws
|
|||
case DLCManager::e_DLCParamType_Anim:
|
||||
// 4J Stu - The Xbox version used swscanf_s which isn't available in GCC.
|
||||
swscanf(value.c_str(), L"%X", &m_uiAnimOverrideBitmask);
|
||||
DWORD skinId = app.getSkinIdFromPath(m_path);
|
||||
std::uint32_t skinId = app.getSkinIdFromPath(m_path);
|
||||
app.SetAnimOverrideBitmask(skinId, m_uiAnimOverrideBitmask);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public:
|
|||
|
||||
DLCSkinFile(const std::wstring &path);
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes);
|
||||
virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value);
|
||||
|
||||
virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type);
|
||||
|
|
|
|||
|
|
@ -8,19 +8,19 @@ DLCTextureFile::DLCTextureFile(const std::wstring &path) : DLCFile(DLCManager::e
|
|||
m_animString = L"";
|
||||
|
||||
m_pbData = NULL;
|
||||
m_dwBytes = 0;
|
||||
m_dataBytes = 0;
|
||||
}
|
||||
|
||||
void DLCTextureFile::addData(PBYTE pbData, DWORD dwBytes)
|
||||
void DLCTextureFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes)
|
||||
{
|
||||
//app.AddMemoryTextureFile(m_path,pbData,dwBytes);
|
||||
m_pbData = pbData;
|
||||
m_dwBytes = dwBytes;
|
||||
m_dataBytes = dataBytes;
|
||||
}
|
||||
|
||||
PBYTE DLCTextureFile::getData(DWORD &dwBytes)
|
||||
std::uint8_t *DLCTextureFile::getData(std::uint32_t &dataBytes)
|
||||
{
|
||||
dwBytes = m_dwBytes;
|
||||
dataBytes = m_dataBytes;
|
||||
return m_pbData;
|
||||
}
|
||||
|
||||
|
|
@ -56,4 +56,4 @@ bool DLCTextureFile::getParameterAsBool(DLCManager::EDLCParameterType type)
|
|||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,17 +8,17 @@ private:
|
|||
bool m_bIsAnim;
|
||||
std::wstring m_animString;
|
||||
|
||||
PBYTE m_pbData;
|
||||
DWORD m_dwBytes;
|
||||
std::uint8_t *m_pbData;
|
||||
std::uint32_t m_dataBytes;
|
||||
|
||||
public:
|
||||
DLCTextureFile(const std::wstring &path);
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
virtual PBYTE getData(DWORD &dwBytes);
|
||||
virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes);
|
||||
virtual std::uint8_t *getData(std::uint32_t &dataBytes);
|
||||
|
||||
virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value);
|
||||
|
||||
virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type);
|
||||
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
DLCUIDataFile::DLCUIDataFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_UIData,path)
|
||||
{
|
||||
m_pbData = NULL;
|
||||
m_dwBytes = 0;
|
||||
m_dataBytes = 0;
|
||||
m_canDeleteData = false;
|
||||
}
|
||||
|
||||
|
|
@ -18,15 +18,15 @@ DLCUIDataFile::~DLCUIDataFile()
|
|||
}
|
||||
}
|
||||
|
||||
void DLCUIDataFile::addData(PBYTE pbData, DWORD dwBytes,bool canDeleteData)
|
||||
void DLCUIDataFile::addData(std::uint8_t *pbData, std::uint32_t dataBytes,bool canDeleteData)
|
||||
{
|
||||
m_pbData = pbData;
|
||||
m_dwBytes = dwBytes;
|
||||
m_dataBytes = dataBytes;
|
||||
m_canDeleteData = canDeleteData;
|
||||
}
|
||||
|
||||
PBYTE DLCUIDataFile::getData(DWORD &dwBytes)
|
||||
std::uint8_t *DLCUIDataFile::getData(std::uint32_t &dataBytes)
|
||||
{
|
||||
dwBytes = m_dwBytes;
|
||||
dataBytes = m_dataBytes;
|
||||
return m_pbData;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
class DLCUIDataFile : public DLCFile
|
||||
{
|
||||
private:
|
||||
PBYTE m_pbData;
|
||||
DWORD m_dwBytes;
|
||||
std::uint8_t *m_pbData;
|
||||
std::uint32_t m_dataBytes;
|
||||
bool m_canDeleteData;
|
||||
|
||||
public:
|
||||
|
|
@ -15,6 +15,6 @@ public:
|
|||
using DLCFile::addData;
|
||||
using DLCFile::addParameter;
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes,bool canDeleteData = false);
|
||||
virtual PBYTE getData(DWORD &dwBytes);
|
||||
virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes,bool canDeleteData = false);
|
||||
virtual std::uint8_t *getData(std::uint32_t &dataBytes);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ AddEnchantmentRuleDefinition::AddEnchantmentRuleDefinition()
|
|||
m_enchantmentId = m_enchantmentLevel = 0;
|
||||
}
|
||||
|
||||
void AddEnchantmentRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes)
|
||||
void AddEnchantmentRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes)
|
||||
{
|
||||
GameRuleDefinition::writeAttributes(dos, numAttributes + 2);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public:
|
|||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_AddEnchantment; }
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *, UINT numAttrs);
|
||||
virtual void writeAttributes(DataOutputStream *, unsigned int numAttrs);
|
||||
|
||||
virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ AddItemRuleDefinition::AddItemRuleDefinition()
|
|||
m_slot = -1;
|
||||
}
|
||||
|
||||
void AddItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
void AddItemRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttrs)
|
||||
{
|
||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ private:
|
|||
public:
|
||||
AddItemRuleDefinition();
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *, UINT numAttributes);
|
||||
virtual void writeAttributes(DataOutputStream *, unsigned int numAttributes);
|
||||
virtual void getChildren(std::vector<GameRuleDefinition *> *children);
|
||||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_AddItem; }
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ ApplySchematicRuleDefinition::~ApplySchematicRuleDefinition()
|
|||
delete m_location;
|
||||
}
|
||||
|
||||
void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttrs)
|
||||
{
|
||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_ApplySchematic; }
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs);
|
||||
virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs);
|
||||
virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
|
||||
|
||||
void processSchematic(AABB *chunkBox, LevelChunk *chunk);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ BiomeOverride::BiomeOverride()
|
|||
m_biomeId = 0;
|
||||
}
|
||||
|
||||
void BiomeOverride::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
void BiomeOverride::writeAttributes(DataOutputStream *dos, unsigned int numAttrs)
|
||||
{
|
||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 3);
|
||||
|
||||
|
|
@ -52,8 +52,8 @@ bool BiomeOverride::isBiome(int id)
|
|||
return m_biomeId == id;
|
||||
}
|
||||
|
||||
void BiomeOverride::getTileValues(BYTE &tile, BYTE &topTile)
|
||||
void BiomeOverride::getTileValues(std::uint8_t &tile, std::uint8_t &topTile)
|
||||
{
|
||||
if(m_tile != 0) tile = (BYTE)m_tile;
|
||||
if(m_topTile != 0) topTile = (BYTE)m_topTile;
|
||||
}
|
||||
if(m_tile != 0) tile = m_tile;
|
||||
if(m_topTile != 0) topTile = m_topTile;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
class BiomeOverride : public GameRuleDefinition
|
||||
{
|
||||
private:
|
||||
BYTE m_topTile;
|
||||
BYTE m_tile;
|
||||
std::uint8_t m_topTile;
|
||||
std::uint8_t m_tile;
|
||||
int m_biomeId;
|
||||
|
||||
public:
|
||||
|
|
@ -15,9 +15,9 @@ public:
|
|||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_BiomeOverride; }
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs);
|
||||
virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs);
|
||||
virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
|
||||
|
||||
bool isBiome(int id);
|
||||
void getTileValues(BYTE &tile, BYTE &topTile);
|
||||
};
|
||||
void getTileValues(std::uint8_t &tile, std::uint8_t &topTile);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ CollectItemRuleDefinition::~CollectItemRuleDefinition()
|
|||
{
|
||||
}
|
||||
|
||||
void CollectItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes)
|
||||
void CollectItemRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes)
|
||||
{
|
||||
GameRuleDefinition::writeAttributes(dos, numAttributes + 3);
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public:
|
|||
|
||||
ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_CollectItemRule; }
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *, UINT numAttributes);
|
||||
virtual void writeAttributes(DataOutputStream *, unsigned int numAttributes);
|
||||
virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
|
||||
|
||||
virtual int getGoal();
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRu
|
|||
return rule;
|
||||
}
|
||||
|
||||
void ConsoleGenerateStructure::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
void ConsoleGenerateStructure::writeAttributes(DataOutputStream *dos, unsigned int numAttrs)
|
||||
{
|
||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public:
|
|||
virtual void getChildren(std::vector<GameRuleDefinition *> *children);
|
||||
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs);
|
||||
virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs);
|
||||
virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
|
||||
|
||||
// StructurePiece
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ void ConsoleSchematicFile::save(DataOutputStream *dos)
|
|||
dos->writeInt(m_ySize);
|
||||
dos->writeInt(m_zSize);
|
||||
|
||||
byteArray ba(new BYTE[ m_data.length ], m_data.length);
|
||||
byteArray ba(new std::uint8_t[ m_data.length ], m_data.length);
|
||||
Compression::getCompression()->CompressLZXRLE( ba.data, &ba.length,
|
||||
m_data.data, m_data.length);
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ void GameRuleDefinition::write(DataOutputStream *dos)
|
|||
(*it)->write(dos);
|
||||
}
|
||||
|
||||
void GameRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes)
|
||||
void GameRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes)
|
||||
{
|
||||
dos->writeInt(numAttributes + 3);
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
virtual void write(DataOutputStream *);
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes);
|
||||
virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes);
|
||||
virtual void getChildren(std::vector<GameRuleDefinition *> *);
|
||||
|
||||
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
|
|||
for(int i = 0; i < gameRulesCount; ++i)
|
||||
{
|
||||
DLCGameRulesHeader *dlcHeader = (DLCGameRulesHeader *)pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i);
|
||||
DWORD dSize;
|
||||
std::uint32_t dSize;
|
||||
uint8_t *dData = dlcHeader->getData(dSize);
|
||||
|
||||
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions();
|
||||
|
|
@ -125,7 +125,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
|
|||
{
|
||||
DLCGameRulesFile *dlcFile = (DLCGameRulesFile *)pack->getFile(DLCManager::e_DLCType_GameRules, i);
|
||||
|
||||
DWORD dSize;
|
||||
std::uint32_t dSize;
|
||||
uint8_t *dData = dlcFile->getData(dSize);
|
||||
|
||||
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions();
|
||||
|
|
@ -142,7 +142,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
|
|||
}
|
||||
}
|
||||
|
||||
LevelGenerationOptions *GameRuleManager::loadGameRules(uint8_t *dIn, UINT dSize)
|
||||
LevelGenerationOptions *GameRuleManager::loadGameRules(uint8_t *dIn, unsigned int dSize)
|
||||
{
|
||||
LevelGenerationOptions *lgo = new LevelGenerationOptions();
|
||||
lgo->setGrSource( new JustGrSource() );
|
||||
|
|
@ -153,7 +153,7 @@ LevelGenerationOptions *GameRuleManager::loadGameRules(uint8_t *dIn, UINT dSize)
|
|||
}
|
||||
|
||||
// 4J-JEV: Reverse of saveGameRules.
|
||||
void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize)
|
||||
void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, unsigned int dSize)
|
||||
{
|
||||
app.DebugPrintf("GameRuleManager::LoadingGameRules:\n");
|
||||
|
||||
|
|
@ -170,11 +170,11 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, U
|
|||
|
||||
for (int i = 0; i < 8; i++) dis.readByte();
|
||||
|
||||
BYTE compression_type = dis.readByte();
|
||||
std::uint8_t compression_type = dis.readByte();
|
||||
|
||||
app.DebugPrintf("\tcompressionType=%d.\n", compression_type);
|
||||
|
||||
UINT compr_len, decomp_len;
|
||||
unsigned int compr_len, decomp_len;
|
||||
compr_len = dis.readInt();
|
||||
decomp_len = dis.readInt();
|
||||
|
||||
|
|
@ -183,8 +183,8 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, U
|
|||
|
||||
// Decompress File Body
|
||||
|
||||
byteArray content(new BYTE[decomp_len], decomp_len),
|
||||
compr_content(new BYTE[compr_len], compr_len);
|
||||
byteArray content(new std::uint8_t[decomp_len], decomp_len),
|
||||
compr_content(new std::uint8_t[compr_len], compr_len);
|
||||
dis.read(compr_content);
|
||||
|
||||
Compression::getCompression()->SetDecompressionType( (Compression::ECompressionTypes)compression_type );
|
||||
|
|
@ -203,14 +203,14 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, U
|
|||
// Read StringTable.
|
||||
byteArray bStringTable;
|
||||
bStringTable.length = dis2.readInt();
|
||||
bStringTable.data = new BYTE[ bStringTable.length ];
|
||||
bStringTable.data = new std::uint8_t[ bStringTable.length ];
|
||||
dis2.read(bStringTable);
|
||||
StringTable *strings = new StringTable(bStringTable.data, bStringTable.length);
|
||||
|
||||
// Read RuleFile.
|
||||
byteArray bRuleFile;
|
||||
bRuleFile.length = content.length - bStringTable.length;
|
||||
bRuleFile.data = new BYTE[ bRuleFile.length ];
|
||||
bRuleFile.data = new std::uint8_t[ bRuleFile.length ];
|
||||
dis2.read(bRuleFile);
|
||||
|
||||
// 4J-JEV: I don't believe that the path-name is ever used.
|
||||
|
|
@ -240,7 +240,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, U
|
|||
}
|
||||
|
||||
// 4J-JEV: Reverse of loadGameRules.
|
||||
void GameRuleManager::saveGameRules(uint8_t **dOut, UINT *dSize)
|
||||
void GameRuleManager::saveGameRules(uint8_t **dOut, unsigned int *dSize)
|
||||
{
|
||||
if (m_currentGameRuleDefinitions == NULL &&
|
||||
m_currentLevelGenerationOptions == NULL)
|
||||
|
|
@ -264,7 +264,7 @@ void GameRuleManager::saveGameRules(uint8_t **dOut, UINT *dSize)
|
|||
|
||||
// Write 8 bytes of empty space in case we need them later.
|
||||
// Mainly useful for the ones we save embedded in game saves.
|
||||
for (UINT i = 0; i < 8; i++)
|
||||
for (unsigned int i = 0; i < 8; i++)
|
||||
dos.writeByte(0x0);
|
||||
|
||||
dos.writeByte(APPROPRIATE_COMPRESSION_TYPE); // m_compressionType
|
||||
|
|
@ -306,7 +306,7 @@ void GameRuleManager::saveGameRules(uint8_t **dOut, UINT *dSize)
|
|||
}
|
||||
|
||||
// Compress compr_dos and write to dos.
|
||||
byteArray compr_ba(new BYTE[ compr_baos.buf.length ], compr_baos.buf.length);
|
||||
byteArray compr_ba(new std::uint8_t[ compr_baos.buf.length ], compr_baos.buf.length);
|
||||
Compression::getCompression()->CompressLZXRLE( compr_ba.data, &compr_ba.length,
|
||||
compr_baos.buf.data, compr_baos.buf.length );
|
||||
|
||||
|
|
@ -373,15 +373,15 @@ void GameRuleManager::writeRuleFile(DataOutputStream *dos)
|
|||
m_currentGameRuleDefinitions->write(dos);
|
||||
}
|
||||
|
||||
bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize, StringTable *strings) //(DLCGameRulesFile *dlcFile, StringTable *strings)
|
||||
bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, unsigned int dSize, StringTable *strings) //(DLCGameRulesFile *dlcFile, StringTable *strings)
|
||||
{
|
||||
bool levelGenAdded = false;
|
||||
bool gameRulesAdded = false;
|
||||
LevelGenerationOptions *levelGenerator = lgo;//new LevelGenerationOptions();
|
||||
LevelRuleset *gameRules = new LevelRuleset();
|
||||
|
||||
//DWORD dwLen = 0;
|
||||
//PBYTE pbData = dlcFile->getData(dwLen);
|
||||
//std::uint32_t dataLength = 0;
|
||||
//std::uint8_t *data = dlcFile->getData(dataLength);
|
||||
//byteArray data(pbData,dwLen);
|
||||
|
||||
byteArray data(dIn, dSize);
|
||||
|
|
@ -469,15 +469,15 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI
|
|||
}
|
||||
|
||||
// string lookup.
|
||||
UINT numStrings = contentDis->readInt();
|
||||
unsigned int numStrings = contentDis->readInt();
|
||||
std::vector<std::wstring> tagsAndAtts;
|
||||
for (UINT i = 0; i < numStrings; i++)
|
||||
for (unsigned int i = 0; i < numStrings; i++)
|
||||
tagsAndAtts.push_back( contentDis->readUTF() );
|
||||
|
||||
std::unordered_map<int, ConsoleGameRules::EGameRuleType> tagIdMap;
|
||||
for(int type = (int)ConsoleGameRules::eGameRuleType_Root; type < (int)ConsoleGameRules::eGameRuleType_Count; ++type)
|
||||
{
|
||||
for(UINT i = 0; i < numStrings; ++i)
|
||||
for(unsigned int i = 0; i < numStrings; ++i)
|
||||
{
|
||||
if(tagsAndAtts[i].compare(wchTagNameA[type]) == 0)
|
||||
{
|
||||
|
|
@ -492,7 +492,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI
|
|||
std::unordered_map<int, ConsoleGameRules::EGameRuleAttr> attrIdMap;
|
||||
for(int attr = (int)ConsoleGameRules::eGameRuleAttr_descriptionName; attr < (int)ConsoleGameRules::eGameRuleAttr_Count; ++attr)
|
||||
{
|
||||
for (UINT i = 0; i < numStrings; i++)
|
||||
for (unsigned int i = 0; i < numStrings; i++)
|
||||
{
|
||||
if (tagsAndAtts[i].compare(wchAttrNameA[attr]) == 0)
|
||||
{
|
||||
|
|
@ -503,8 +503,8 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI
|
|||
}*/
|
||||
|
||||
// subfile
|
||||
UINT numFiles = contentDis->readInt();
|
||||
for (UINT i = 0; i < numFiles; i++)
|
||||
unsigned int numFiles = contentDis->readInt();
|
||||
for (unsigned int i = 0; i < numFiles; i++)
|
||||
{
|
||||
std::wstring sFilename = contentDis->readUTF();
|
||||
int length = contentDis->readInt();
|
||||
|
|
@ -519,8 +519,8 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI
|
|||
LEVEL_GEN_ID lgoID = LEVEL_GEN_ID_NULL;
|
||||
|
||||
// xml objects
|
||||
UINT numObjects = contentDis->readInt();
|
||||
for(UINT i = 0; i < numObjects; ++i)
|
||||
unsigned int numObjects = contentDis->readInt();
|
||||
for(unsigned int i = 0; i < numObjects; ++i)
|
||||
{
|
||||
int tagId = contentDis->readInt();
|
||||
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
|
||||
|
|
@ -584,7 +584,7 @@ LevelGenerationOptions *GameRuleManager::readHeader(DLCGameRulesHeader *grh)
|
|||
void GameRuleManager::readAttributes(DataInputStream *dis, std::vector<std::wstring> *tagsAndAtts, GameRuleDefinition *rule)
|
||||
{
|
||||
int numAttrs = dis->readInt();
|
||||
for (UINT att = 0; att < numAttrs; ++att)
|
||||
for (unsigned int att = 0; att < static_cast<unsigned int>(numAttrs); ++att)
|
||||
{
|
||||
int attID = dis->readInt();
|
||||
std::wstring value = dis->readUTF();
|
||||
|
|
@ -596,7 +596,7 @@ void GameRuleManager::readAttributes(DataInputStream *dis, std::vector<std::wstr
|
|||
void GameRuleManager::readChildren(DataInputStream *dis, std::vector<std::wstring> *tagsAndAtts, std::unordered_map<int, ConsoleGameRules::EGameRuleType> *tagIdMap, GameRuleDefinition *rule)
|
||||
{
|
||||
int numChildren = dis->readInt();
|
||||
for(UINT child = 0; child < numChildren; ++child)
|
||||
for(unsigned int child = 0; child < static_cast<unsigned int>(numChildren); ++child)
|
||||
{
|
||||
int tagId = dis->readInt();
|
||||
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
|
||||
|
|
@ -663,7 +663,7 @@ void GameRuleManager::loadDefaultGameRules()
|
|||
if(app.getArchiveFileSize(fpTutorial) >= 0)
|
||||
{
|
||||
DLCPack *pack = new DLCPack(L"",0xffffffff);
|
||||
DWORD dwFilesProcessed = 0;
|
||||
unsigned int dwFilesProcessed = 0;
|
||||
if ( app.m_dlcManager.readDLCDataFile(dwFilesProcessed,fpTutorial,pack,true) )
|
||||
{
|
||||
app.m_dlcManager.addPack(pack);
|
||||
|
|
@ -720,7 +720,7 @@ bool GameRuleManager::loadGameRulesPack(File *path)
|
|||
if(path->exists())
|
||||
{
|
||||
DLCPack *pack = new DLCPack(L"",0xffffffff);
|
||||
DWORD dwFilesProcessed = 0;
|
||||
unsigned int dwFilesProcessed = 0;
|
||||
if( app.m_dlcManager.readDLCDataFile(dwFilesProcessed, path->getPath(),pack))
|
||||
{
|
||||
app.m_dlcManager.addPack(pack);
|
||||
|
|
@ -749,7 +749,7 @@ void GameRuleManager::setLevelGenerationOptions(LevelGenerationOptions *levelGen
|
|||
m_currentLevelGenerationOptions->reset_start();
|
||||
}
|
||||
|
||||
LPCWSTR GameRuleManager::GetGameRulesString(const std::wstring &key)
|
||||
const wchar_t *GameRuleManager::GetGameRulesString(const std::wstring &key)
|
||||
{
|
||||
if(m_currentGameRuleDefinitions != NULL && !key.empty() )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@ public:
|
|||
|
||||
void loadGameRules(DLCPack *);
|
||||
|
||||
LevelGenerationOptions *loadGameRules(uint8_t *dIn, UINT dSize);
|
||||
void loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize);
|
||||
LevelGenerationOptions *loadGameRules(uint8_t *dIn, unsigned int dSize);
|
||||
void loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, unsigned int dSize);
|
||||
|
||||
void saveGameRules(uint8_t **dOut, UINT *dSize);
|
||||
void saveGameRules(uint8_t **dOut, unsigned int *dSize);
|
||||
|
||||
private:
|
||||
LevelGenerationOptions *readHeader(DLCGameRulesHeader *grh);
|
||||
|
|
@ -51,7 +51,7 @@ private:
|
|||
void writeRuleFile(DataOutputStream *dos);
|
||||
|
||||
public:
|
||||
bool readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize, StringTable *strings); //(DLCGameRulesFile *dlcFile, StringTable *strings);
|
||||
bool readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, unsigned int dSize, StringTable *strings); //(DLCGameRulesFile *dlcFile, StringTable *strings);
|
||||
|
||||
private:
|
||||
void readAttributes(DataInputStream *dis, std::vector<std::wstring> *tagsAndAtts, GameRuleDefinition *rule);
|
||||
|
|
@ -72,7 +72,7 @@ public:
|
|||
void setLevelGenerationOptions(LevelGenerationOptions *levelGen);
|
||||
LevelRuleset *getGameRuleDefinitions() { return m_currentGameRuleDefinitions; }
|
||||
LevelGenerationOptions *getLevelGenerationOptions() { return m_currentLevelGenerationOptions; }
|
||||
LPCWSTR GetGameRulesString(const std::wstring &key);
|
||||
const wchar_t *GetGameRulesString(const std::wstring &key);
|
||||
|
||||
// 4J-JEV:
|
||||
// Properly cleans-up and unloads the current set of gameRules.
|
||||
|
|
|
|||
|
|
@ -23,16 +23,16 @@ JustGrSource::JustGrSource()
|
|||
}
|
||||
|
||||
bool JustGrSource::requiresTexturePack() {return m_bRequiresTexturePack;}
|
||||
UINT JustGrSource::getRequiredTexturePackId() {return m_requiredTexturePackId;}
|
||||
std::uint32_t JustGrSource::getRequiredTexturePackId() {return m_requiredTexturePackId;}
|
||||
std::wstring JustGrSource::getDefaultSaveName() {return m_defaultSaveName;}
|
||||
LPCWSTR JustGrSource::getWorldName() {return m_worldName.c_str();}
|
||||
LPCWSTR JustGrSource::getDisplayName() {return m_displayName.c_str();}
|
||||
const wchar_t *JustGrSource::getWorldName() {return m_worldName.c_str();}
|
||||
const wchar_t *JustGrSource::getDisplayName() {return m_displayName.c_str();}
|
||||
std::wstring JustGrSource::getGrfPath() {return m_grfPath;}
|
||||
bool JustGrSource::requiresBaseSave() { return m_bRequiresBaseSave; };
|
||||
std::wstring JustGrSource::getBaseSavePath() { return m_baseSavePath; };
|
||||
|
||||
void JustGrSource::setRequiresTexturePack(bool x) {m_bRequiresTexturePack = x;}
|
||||
void JustGrSource::setRequiredTexturePackId(UINT x) {m_requiredTexturePackId = x;}
|
||||
void JustGrSource::setRequiredTexturePackId(std::uint32_t x) {m_requiredTexturePackId = x;}
|
||||
void JustGrSource::setDefaultSaveName(const std::wstring &x) {m_defaultSaveName = x;}
|
||||
void JustGrSource::setWorldName(const std::wstring &x) {m_worldName = x;}
|
||||
void JustGrSource::setDisplayName(const std::wstring &x) {m_displayName = x;}
|
||||
|
|
@ -55,7 +55,7 @@ LevelGenerationOptions::LevelGenerationOptions()
|
|||
m_bRequiresGameRules = false;
|
||||
|
||||
m_pbBaseSaveData = NULL;
|
||||
m_dwBaseSaveSize = 0;
|
||||
m_baseSaveSize = 0;
|
||||
}
|
||||
|
||||
LevelGenerationOptions::~LevelGenerationOptions()
|
||||
|
|
@ -90,7 +90,7 @@ LevelGenerationOptions::~LevelGenerationOptions()
|
|||
|
||||
ConsoleGameRules::EGameRuleType LevelGenerationOptions::getActionType() { return ConsoleGameRules::eGameRuleType_LevelGenerationOptions; }
|
||||
|
||||
void LevelGenerationOptions::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
void LevelGenerationOptions::writeAttributes(DataOutputStream *dos, unsigned int numAttrs)
|
||||
{
|
||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
||||
|
||||
|
|
@ -332,7 +332,7 @@ void LevelGenerationOptions::clearSchematics()
|
|||
m_schematics.clear();
|
||||
}
|
||||
|
||||
ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const std::wstring &filename, PBYTE pbData, DWORD dwLen)
|
||||
ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const std::wstring &filename, std::uint8_t *pbData, unsigned int dataLength)
|
||||
{
|
||||
// If we have already loaded this, just return
|
||||
AUTO_VAR(it, m_schematics.find(filename));
|
||||
|
|
@ -346,7 +346,7 @@ ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const std::wstri
|
|||
}
|
||||
|
||||
ConsoleSchematicFile *schematic = NULL;
|
||||
byteArray data(pbData,dwLen);
|
||||
byteArray data(pbData, dataLength);
|
||||
ByteArrayInputStream bais(data);
|
||||
DataInputStream dis(&bais);
|
||||
schematic = new ConsoleSchematicFile();
|
||||
|
|
@ -389,7 +389,7 @@ void LevelGenerationOptions::loadStringTable(StringTable *table)
|
|||
m_stringTable = table;
|
||||
}
|
||||
|
||||
LPCWSTR LevelGenerationOptions::getString(const std::wstring &key)
|
||||
const wchar_t *LevelGenerationOptions::getString(const std::wstring &key)
|
||||
{
|
||||
if(m_stringTable == NULL)
|
||||
{
|
||||
|
|
@ -401,7 +401,7 @@ LPCWSTR LevelGenerationOptions::getString(const std::wstring &key)
|
|||
}
|
||||
}
|
||||
|
||||
void LevelGenerationOptions::getBiomeOverride(int biomeId, BYTE &tile, BYTE &topTile)
|
||||
void LevelGenerationOptions::getBiomeOverride(int biomeId, std::uint8_t &tile, std::uint8_t &topTile)
|
||||
{
|
||||
for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it)
|
||||
{
|
||||
|
|
@ -478,10 +478,10 @@ bool LevelGenerationOptions::isFromSave() { return getSrc() == eSrc_fromSave; }
|
|||
bool LevelGenerationOptions::isFromDLC() { return getSrc() == eSrc_fromDLC; }
|
||||
|
||||
bool LevelGenerationOptions::requiresTexturePack() { return info()->requiresTexturePack(); }
|
||||
UINT LevelGenerationOptions::getRequiredTexturePackId() { return info()->getRequiredTexturePackId(); }
|
||||
std::uint32_t LevelGenerationOptions::getRequiredTexturePackId() { return info()->getRequiredTexturePackId(); }
|
||||
std::wstring LevelGenerationOptions::getDefaultSaveName() { return info()->getDefaultSaveName(); }
|
||||
LPCWSTR LevelGenerationOptions::getWorldName() { return info()->getWorldName(); }
|
||||
LPCWSTR LevelGenerationOptions::getDisplayName() { return info()->getDisplayName(); }
|
||||
const wchar_t *LevelGenerationOptions::getWorldName() { return info()->getWorldName(); }
|
||||
const wchar_t *LevelGenerationOptions::getDisplayName() { return info()->getDisplayName(); }
|
||||
std::wstring LevelGenerationOptions::getGrfPath() { return info()->getGrfPath(); }
|
||||
bool LevelGenerationOptions::requiresBaseSave() { return info()->requiresBaseSave(); }
|
||||
std::wstring LevelGenerationOptions::getBaseSavePath() { return info()->getBaseSavePath(); }
|
||||
|
|
@ -489,7 +489,7 @@ std::wstring LevelGenerationOptions::getBaseSavePath() { return info()->getBaseS
|
|||
void LevelGenerationOptions::setGrSource(GrSource *grs) { m_pSrc = grs; }
|
||||
|
||||
void LevelGenerationOptions::setRequiresTexturePack(bool x) { info()->setRequiresTexturePack(x); }
|
||||
void LevelGenerationOptions::setRequiredTexturePackId(UINT x) { info()->setRequiredTexturePackId(x); }
|
||||
void LevelGenerationOptions::setRequiredTexturePackId(std::uint32_t x) { info()->setRequiredTexturePackId(x); }
|
||||
void LevelGenerationOptions::setDefaultSaveName(const std::wstring &x) { info()->setDefaultSaveName(x); }
|
||||
void LevelGenerationOptions::setWorldName(const std::wstring &x) { info()->setWorldName(x); }
|
||||
void LevelGenerationOptions::setDisplayName(const std::wstring &x) { info()->setDisplayName(x); }
|
||||
|
|
@ -498,10 +498,10 @@ void LevelGenerationOptions::setBaseSavePath(const std::wstring &x) { info()->se
|
|||
|
||||
bool LevelGenerationOptions::ready() { return info()->ready(); }
|
||||
|
||||
void LevelGenerationOptions::setBaseSaveData(PBYTE pbData, DWORD dwSize) { m_pbBaseSaveData = pbData; m_dwBaseSaveSize = dwSize; }
|
||||
PBYTE LevelGenerationOptions::getBaseSaveData(DWORD &size) { size = m_dwBaseSaveSize; return m_pbBaseSaveData; }
|
||||
bool LevelGenerationOptions::hasBaseSaveData() { return m_dwBaseSaveSize > 0 && m_pbBaseSaveData != NULL; }
|
||||
void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete m_pbBaseSaveData; m_pbBaseSaveData = NULL; m_dwBaseSaveSize = 0; }
|
||||
void LevelGenerationOptions::setBaseSaveData(std::uint8_t *pbData, unsigned int dataSize) { m_pbBaseSaveData = pbData; m_baseSaveSize = dataSize; }
|
||||
std::uint8_t *LevelGenerationOptions::getBaseSaveData(unsigned int &size) { size = m_baseSaveSize; return m_pbBaseSaveData; }
|
||||
bool LevelGenerationOptions::hasBaseSaveData() { return m_baseSaveSize > 0 && m_pbBaseSaveData != NULL; }
|
||||
void LevelGenerationOptions::deleteBaseSaveData() { delete[] m_pbBaseSaveData; m_pbBaseSaveData = NULL; m_baseSaveSize = 0; }
|
||||
|
||||
bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; }
|
||||
void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; }
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
// #pragma message("LevelGenerationOptions.h ")
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "GameRuleDefinition.h"
|
||||
#include "../../Minecraft.World/WorldGen/Features/StructureFeature.h"
|
||||
|
||||
|
|
@ -24,16 +26,16 @@ public:
|
|||
|
||||
virtual ~GrSource(){}
|
||||
virtual bool requiresTexturePack()=0;
|
||||
virtual UINT getRequiredTexturePackId()=0;
|
||||
virtual std::uint32_t getRequiredTexturePackId()=0;
|
||||
virtual std::wstring getDefaultSaveName()=0;
|
||||
virtual LPCWSTR getWorldName()=0;
|
||||
virtual LPCWSTR getDisplayName()=0;
|
||||
virtual const wchar_t *getWorldName()=0;
|
||||
virtual const wchar_t *getDisplayName()=0;
|
||||
virtual std::wstring getGrfPath()=0;
|
||||
virtual bool requiresBaseSave() = 0;
|
||||
virtual std::wstring getBaseSavePath() = 0;
|
||||
|
||||
virtual void setRequiresTexturePack(bool)=0;
|
||||
virtual void setRequiredTexturePackId(UINT)=0;
|
||||
virtual void setRequiredTexturePackId(std::uint32_t)=0;
|
||||
virtual void setDefaultSaveName(const std::wstring &)=0;
|
||||
virtual void setWorldName(const std::wstring &)=0;
|
||||
virtual void setDisplayName(const std::wstring &)=0;
|
||||
|
|
@ -42,7 +44,7 @@ public:
|
|||
|
||||
virtual bool ready()=0;
|
||||
|
||||
//virtual void getGrfData(PBYTE &pData, DWORD &pSize)=0;
|
||||
//virtual void getGrfData(std::uint8_t *&pData, unsigned int &pSize)=0;
|
||||
};
|
||||
|
||||
class JustGrSource : public GrSource
|
||||
|
|
@ -52,23 +54,23 @@ protected:
|
|||
std::wstring m_displayName;
|
||||
std::wstring m_defaultSaveName;
|
||||
bool m_bRequiresTexturePack;
|
||||
int m_requiredTexturePackId;
|
||||
std::uint32_t m_requiredTexturePackId;
|
||||
std::wstring m_grfPath;
|
||||
std::wstring m_baseSavePath;
|
||||
bool m_bRequiresBaseSave;
|
||||
|
||||
public:
|
||||
virtual bool requiresTexturePack();
|
||||
virtual UINT getRequiredTexturePackId();
|
||||
virtual std::uint32_t getRequiredTexturePackId();
|
||||
virtual std::wstring getDefaultSaveName();
|
||||
virtual LPCWSTR getWorldName();
|
||||
virtual LPCWSTR getDisplayName();
|
||||
virtual const wchar_t *getWorldName();
|
||||
virtual const wchar_t *getDisplayName();
|
||||
virtual std::wstring getGrfPath();
|
||||
virtual bool requiresBaseSave();
|
||||
virtual std::wstring getBaseSavePath();
|
||||
|
||||
virtual void setRequiresTexturePack(bool x);
|
||||
virtual void setRequiredTexturePackId(UINT x);
|
||||
virtual void setRequiredTexturePackId(std::uint32_t x);
|
||||
virtual void setDefaultSaveName(const std::wstring &x);
|
||||
virtual void setWorldName(const std::wstring &x);
|
||||
virtual void setDisplayName(const std::wstring &x);
|
||||
|
|
@ -104,8 +106,8 @@ private:
|
|||
|
||||
bool m_hasLoadedData;
|
||||
|
||||
PBYTE m_pbBaseSaveData;
|
||||
DWORD m_dwBaseSaveSize;
|
||||
std::uint8_t *m_pbBaseSaveData;
|
||||
unsigned int m_baseSaveSize;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -117,10 +119,10 @@ public:
|
|||
bool isFromDLC();
|
||||
|
||||
bool requiresTexturePack();
|
||||
UINT getRequiredTexturePackId();
|
||||
std::uint32_t getRequiredTexturePackId();
|
||||
std::wstring getDefaultSaveName();
|
||||
LPCWSTR getWorldName();
|
||||
LPCWSTR getDisplayName();
|
||||
const wchar_t *getWorldName();
|
||||
const wchar_t *getDisplayName();
|
||||
std::wstring getGrfPath();
|
||||
bool requiresBaseSave();
|
||||
std::wstring getBaseSavePath();
|
||||
|
|
@ -128,7 +130,7 @@ public:
|
|||
void setGrSource(GrSource *grs);
|
||||
|
||||
void setRequiresTexturePack(bool x);
|
||||
void setRequiredTexturePackId(UINT x);
|
||||
void setRequiredTexturePackId(std::uint32_t x);
|
||||
void setDefaultSaveName(const std::wstring &x);
|
||||
void setWorldName(const std::wstring &x);
|
||||
void setDisplayName(const std::wstring &x);
|
||||
|
|
@ -137,8 +139,8 @@ public:
|
|||
|
||||
bool ready();
|
||||
|
||||
void setBaseSaveData(PBYTE pbData, DWORD dwSize);
|
||||
PBYTE getBaseSaveData(DWORD &size);
|
||||
void setBaseSaveData(std::uint8_t *pbData, unsigned int dataSize);
|
||||
std::uint8_t *getBaseSaveData(unsigned int &size);
|
||||
bool hasBaseSaveData();
|
||||
void deleteBaseSaveData();
|
||||
|
||||
|
|
@ -169,7 +171,7 @@ public:
|
|||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType();
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes);
|
||||
virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes);
|
||||
virtual void getChildren(std::vector<GameRuleDefinition *> *children);
|
||||
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
|
||||
virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
|
||||
|
|
@ -187,7 +189,7 @@ private:
|
|||
void clearSchematics();
|
||||
|
||||
public:
|
||||
ConsoleSchematicFile *loadSchematicFile(const std::wstring &filename, PBYTE pbData, DWORD dwLen);
|
||||
ConsoleSchematicFile *loadSchematicFile(const std::wstring &filename, std::uint8_t *pbData, unsigned int dataLength);
|
||||
|
||||
public:
|
||||
ConsoleSchematicFile *getSchematicFile(const std::wstring &filename);
|
||||
|
|
@ -197,11 +199,11 @@ public:
|
|||
void setRequiredGameRules(LevelRuleset *rules);
|
||||
LevelRuleset *getRequiredGameRules();
|
||||
|
||||
void getBiomeOverride(int biomeId, BYTE &tile, BYTE &topTile);
|
||||
void getBiomeOverride(int biomeId, std::uint8_t &tile, std::uint8_t &topTile);
|
||||
bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature);
|
||||
|
||||
void loadStringTable(StringTable *table);
|
||||
LPCWSTR getString(const std::wstring &key);
|
||||
const wchar_t *getString(const std::wstring &key);
|
||||
|
||||
std::unordered_map<std::wstring, ConsoleSchematicFile *> *getUnfinishedSchematicFiles();
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ LevelRules::LevelRules()
|
|||
{
|
||||
}
|
||||
|
||||
void LevelRules::addLevelRule(const std::wstring &displayName, PBYTE pbData, DWORD dwLen)
|
||||
void LevelRules::addLevelRule(const std::wstring &displayName, std::uint8_t *pbData, unsigned int dataLength)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -17,4 +17,4 @@ void LevelRules::addLevelRule(const std::wstring &displayName, LevelRuleset *roo
|
|||
void LevelRules::removeLevelRule(LevelRuleset *removing)
|
||||
{
|
||||
// TODO ?
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ class LevelRules
|
|||
public:
|
||||
LevelRules();
|
||||
|
||||
void addLevelRule(const std::wstring &displayName, PBYTE pbData, DWORD dwLen);
|
||||
void addLevelRule(const std::wstring &displayName, std::uint8_t *pbData, unsigned int dataLength);
|
||||
void addLevelRule(const std::wstring &displayName, LevelRuleset *rootRule);
|
||||
|
||||
void removeLevelRule(LevelRuleset *removing);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ void LevelRuleset::loadStringTable(StringTable *table)
|
|||
m_stringTable = table;
|
||||
}
|
||||
|
||||
LPCWSTR LevelRuleset::getString(const std::wstring &key)
|
||||
const wchar_t *LevelRuleset::getString(const std::wstring &key)
|
||||
{
|
||||
if(m_stringTable == NULL)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ public:
|
|||
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_LevelRules; }
|
||||
|
||||
void loadStringTable(StringTable *table);
|
||||
LPCWSTR getString(const std::wstring &key);
|
||||
const wchar_t *getString(const std::wstring &key);
|
||||
|
||||
AABB *getNamedArea(const std::wstring &areaName);
|
||||
|
||||
StringTable *getStringTable() { return m_stringTable; }
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ NamedAreaRuleDefinition::~NamedAreaRuleDefinition()
|
|||
delete m_area;
|
||||
}
|
||||
|
||||
void NamedAreaRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes)
|
||||
void NamedAreaRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes)
|
||||
{
|
||||
GameRuleDefinition::writeAttributes(dos, numAttributes + 7);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public:
|
|||
NamedAreaRuleDefinition();
|
||||
~NamedAreaRuleDefinition();
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes);
|
||||
virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes);
|
||||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_NamedArea; }
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ StartFeature::StartFeature()
|
|||
m_feature = StructureFeature::eFeature_Temples;
|
||||
}
|
||||
|
||||
void StartFeature::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
void StartFeature::writeAttributes(DataOutputStream *dos, unsigned int numAttrs)
|
||||
{
|
||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 3);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public:
|
|||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_StartFeature; }
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs);
|
||||
virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs);
|
||||
virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
|
||||
|
||||
bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ UpdatePlayerRuleDefinition::~UpdatePlayerRuleDefinition()
|
|||
}
|
||||
}
|
||||
|
||||
void UpdatePlayerRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes)
|
||||
void UpdatePlayerRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes)
|
||||
{
|
||||
int attrCount = 3;
|
||||
if(m_bUpdateHealth) ++attrCount;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public:
|
|||
virtual void getChildren(std::vector<GameRuleDefinition *> *children);
|
||||
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes);
|
||||
virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes);
|
||||
virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
|
||||
|
||||
virtual void postProcessPlayer(std::shared_ptr<Player> player);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ UseTileRuleDefinition::UseTileRuleDefinition()
|
|||
m_useCoords = false;
|
||||
}
|
||||
|
||||
void UseTileRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes)
|
||||
void UseTileRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes)
|
||||
{
|
||||
GameRuleDefinition::writeAttributes(dos, numAttributes + 5);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public:
|
|||
|
||||
ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_UseTileRule; }
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes);
|
||||
virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes);
|
||||
virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
|
||||
|
||||
virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ XboxStructureActionGenerateBox::XboxStructureActionGenerateBox()
|
|||
m_skipAir = false;
|
||||
}
|
||||
|
||||
void XboxStructureActionGenerateBox::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
void XboxStructureActionGenerateBox::writeAttributes(DataOutputStream *dos, unsigned int numAttrs)
|
||||
{
|
||||
ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 9);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public:
|
|||
virtual int getEndY() { return m_y1; }
|
||||
virtual int getEndZ() { return m_z1; }
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs);
|
||||
virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs);
|
||||
virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
|
||||
|
||||
bool generateBoxInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ XboxStructureActionPlaceBlock::XboxStructureActionPlaceBlock()
|
|||
m_x = m_y = m_z = m_tile = m_data = 0;
|
||||
}
|
||||
|
||||
void XboxStructureActionPlaceBlock::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
void XboxStructureActionPlaceBlock::writeAttributes(DataOutputStream *dos, unsigned int numAttrs)
|
||||
{
|
||||
ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 5);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public:
|
|||
virtual int getEndY() { return m_y; }
|
||||
virtual int getEndZ() { return m_z; }
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs);
|
||||
virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs);
|
||||
virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
|
||||
|
||||
bool placeBlockInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ XboxStructureActionPlaceContainer::~XboxStructureActionPlaceContainer()
|
|||
}
|
||||
|
||||
// 4J-JEV: Super class handles attr-facing fine.
|
||||
//void XboxStructureActionPlaceContainer::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
//void XboxStructureActionPlaceContainer::writeAttributes(DataOutputStream *dos, unsigned int numAttrs)
|
||||
|
||||
|
||||
void XboxStructureActionPlaceContainer::getChildren(std::vector<GameRuleDefinition *> *children)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public:
|
|||
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
|
||||
|
||||
// 4J-JEV: Super class handles attr-facing fine.
|
||||
//virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes);
|
||||
//virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttributes);
|
||||
|
||||
virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ XboxStructureActionPlaceSpawner::~XboxStructureActionPlaceSpawner()
|
|||
{
|
||||
}
|
||||
|
||||
void XboxStructureActionPlaceSpawner::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
void XboxStructureActionPlaceSpawner::writeAttributes(DataOutputStream *dos, unsigned int numAttrs)
|
||||
{
|
||||
XboxStructureActionPlaceBlock::writeAttributes(dos, numAttrs + 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public:
|
|||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_PlaceSpawner; }
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs);
|
||||
virtual void writeAttributes(DataOutputStream *dos, unsigned int numAttrs);
|
||||
virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
|
||||
|
||||
bool placeSpawnerInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
// 3 bit user index
|
||||
// 5 bits alpha
|
||||
// 1 bit decoration
|
||||
|
|
@ -35,8 +37,8 @@
|
|||
#define MAKE_SKIN_BITMASK(bDlcSkin, dwSkinId) ( (bDlcSkin?0x80000000:0) | (dwSkinId & 0x7FFFFFFF) )
|
||||
#define IS_SKIN_ID_IN_RANGE(dwSkinId) (dwSkinId <= 0x7FFFFFFF)
|
||||
|
||||
#define GET_DLC_SKIN_ID_FROM_BITMASK(uiBitmask) (((DWORD)uiBitmask)&0x7FFFFFFF)
|
||||
#define GET_UGC_SKIN_ID_FROM_BITMASK(uiBitmask) (((DWORD)uiBitmask)&0x7FFFFFE0)
|
||||
#define GET_DEFAULT_SKIN_ID_FROM_BITMASK(uiBitmask) (((DWORD)uiBitmask)&0x0000001F)
|
||||
#define GET_IS_DLC_SKIN_FROM_BITMASK(uiBitmask) ((((DWORD)uiBitmask)&0x80000000)?true:false)
|
||||
#define GET_DLC_SKIN_ID_FROM_BITMASK(uiBitmask) (static_cast<std::uint32_t>(uiBitmask) & 0x7FFFFFFF)
|
||||
#define GET_UGC_SKIN_ID_FROM_BITMASK(uiBitmask) (static_cast<std::uint32_t>(uiBitmask) & 0x7FFFFFE0)
|
||||
#define GET_DEFAULT_SKIN_ID_FROM_BITMASK(uiBitmask) (static_cast<std::uint32_t>(uiBitmask) & 0x0000001F)
|
||||
#define GET_IS_DLC_SKIN_FROM_BITMASK(uiBitmask) ((static_cast<std::uint32_t>(uiBitmask) & 0x80000000) ? true : false)
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ void CGameNetworkManager::DoWork()
|
|||
#endif
|
||||
}
|
||||
|
||||
bool CGameNetworkManager::_RunNetworkGame(LPVOID lpParameter)
|
||||
bool CGameNetworkManager::_RunNetworkGame(void *lpParameter)
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
|
|
@ -184,7 +184,7 @@ bool CGameNetworkManager::_RunNetworkGame(LPVOID lpParameter)
|
|||
return success;
|
||||
}
|
||||
|
||||
bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParameter)
|
||||
bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, void *lpParameter)
|
||||
{
|
||||
#ifdef _DURANGO
|
||||
ProfileManager.SetDeferredSignoutEnabled(true);
|
||||
|
|
@ -645,7 +645,7 @@ bool CGameNetworkManager::GetGameSessionInfo(int iPad, SessionID sessionId,Frien
|
|||
return s_pPlatformNetworkManager->GetGameSessionInfo( iPad, sessionId, foundSession );
|
||||
}
|
||||
|
||||
void CGameNetworkManager::SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam )
|
||||
void CGameNetworkManager::SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam )
|
||||
{
|
||||
s_pPlatformNetworkManager->SetSessionsUpdatedCallback( SessionsUpdatedCallback, pSearchParam );
|
||||
}
|
||||
|
|
@ -681,7 +681,7 @@ CGameNetworkManager::eJoinGameResult CGameNetworkManager::JoinGame(FriendSession
|
|||
return (eJoinGameResult)(s_pPlatformNetworkManager->JoinGame( searchResult, localUsersMask, primaryUserIndex ));
|
||||
}
|
||||
|
||||
void CGameNetworkManager::CancelJoinGame(LPVOID lpParam)
|
||||
void CGameNetworkManager::CancelJoinGame(void *lpParam)
|
||||
{
|
||||
#ifdef _XBOX_ONE
|
||||
s_pPlatformNetworkManager->CancelJoinGame();
|
||||
|
|
@ -705,7 +705,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
|
|||
int npAvailability = ProfileManager.getNPAvailability(iPad);
|
||||
if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION)
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_OK;
|
||||
ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable());
|
||||
|
||||
|
|
@ -749,7 +749,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
|
|||
}
|
||||
else if(noPrivileges)
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
|
||||
}
|
||||
|
|
@ -924,7 +924,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam )
|
|||
}
|
||||
else
|
||||
{
|
||||
UINT uiIDA[2];
|
||||
unsigned int uiIDA[2];
|
||||
uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT;
|
||||
uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE;
|
||||
ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CGameNetworkManager::MustSignInReturned_0,lpParam, app.GetStringTable());
|
||||
|
|
@ -1060,7 +1060,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
MinecraftServer *pServer = MinecraftServer::getInstance();
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
if( g_NetworkManager.m_bLastDisconnectWasLostRoomOnly )
|
||||
{
|
||||
|
|
@ -1084,7 +1084,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
#elif defined(_XBOX_ONE)
|
||||
if( g_NetworkManager.m_bFullSessionMessageOnNextSessionChange )
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME, IDS_IN_PARTY_SESSION_FULL, uiIDA,1,ProfileManager.GetPrimaryPad());
|
||||
pMinecraft->progressRenderer->progressStartNoAbort( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME );
|
||||
|
|
@ -1583,7 +1583,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION)
|
||||
{
|
||||
// 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive if the npAvailability isn't SCE_OK
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0]=IDS_OK;
|
||||
ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPadNotSignedInLive, NULL, NULL, app.GetStringTable());
|
||||
}
|
||||
|
|
@ -1592,14 +1592,14 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
// Signed in to PSN but not connected (no internet access)
|
||||
assert(!ProfileManager.isConnectedToPSN(iPadNotSignedInLive));
|
||||
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_OK;
|
||||
ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPadNotSignedInLive, NULL, NULL, app.GetStringTable());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not signed in to PSN
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
|
||||
ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, iPadNotSignedInLive, &CGameNetworkManager::MustSignInReturned_1, (void *)pInviteInfo, app.GetStringTable(), NULL, 0, false);
|
||||
}
|
||||
|
|
@ -1633,14 +1633,14 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
// if (ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad()))
|
||||
// {
|
||||
// // Signed in to PSN but not connected (no internet access)
|
||||
// UINT uiIDA[1];
|
||||
// unsigned int uiIDA[1];
|
||||
// uiIDA[0] = IDS_OK;
|
||||
// ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL, app.GetStringTable());
|
||||
// }
|
||||
// else
|
||||
{
|
||||
// Not signed in to PSN
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
|
||||
ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &CGameNetworkManager::MustSignInReturned_1, (void *)pInviteInfo, app.GetStringTable(), NULL, 0, false);
|
||||
}
|
||||
|
|
@ -1672,8 +1672,8 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
// Check if user-created content is allowed, as we cannot play multiplayer if it's not
|
||||
bool noUGC = false;
|
||||
bool bContentRestricted=false;
|
||||
BOOL pccAllowed = TRUE;
|
||||
BOOL pccFriendsAllowed = TRUE;
|
||||
bool pccAllowed = true;
|
||||
bool pccFriendsAllowed = true;
|
||||
#if defined(__PS3__) || defined(__PSVITA__)
|
||||
ProfileManager.GetChatAndContentRestrictions(userIndex,false,&noUGC,&bContentRestricted,NULL);
|
||||
#else
|
||||
|
|
@ -1684,7 +1684,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
#if defined(_XBOX) || defined(__PS3__)
|
||||
if(joiningUsers > 1 && !RenderManager.IsHiDef() && userIndex != ProfileManager.GetPrimaryPad())
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
|
||||
// 4J-PB - it's possible there is no primary pad here, when accepting an invite from the dashboard
|
||||
|
|
@ -1711,7 +1711,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
#endif
|
||||
else if(noPrivileges)
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
|
||||
// 4J-PB - it's possible there is no primary pad here, when accepting an invite from the dashboard
|
||||
|
|
@ -1740,7 +1740,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
}
|
||||
else
|
||||
{
|
||||
UINT uiIDA[2];
|
||||
unsigned int uiIDA[2];
|
||||
uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT;
|
||||
uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE;
|
||||
ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CGameNetworkManager::MustSignInReturned_1,(void *)pInviteInfo, app.GetStringTable());
|
||||
|
|
@ -1806,7 +1806,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I
|
|||
|
||||
if(noPrivileges)
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
|
||||
}
|
||||
|
|
@ -1840,11 +1840,11 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I
|
|||
{
|
||||
// the FromInvite will make the lib decide how many panes to display based on connected pads/signed in players
|
||||
#ifdef _XBOX
|
||||
ProfileManager.RequestSignInUI(true, false, false, false, false,&CGameNetworkManager::JoinFromInvite_SignInReturned, (LPVOID)pInviteInfo,userIndex);
|
||||
ProfileManager.RequestSignInUI(true, false, false, false, false,&CGameNetworkManager::JoinFromInvite_SignInReturned, (void *)pInviteInfo,userIndex);
|
||||
#else
|
||||
SignInInfo info;
|
||||
info.Func = &CGameNetworkManager::JoinFromInvite_SignInReturned;
|
||||
info.lpParam = (LPVOID)pInviteInfo;
|
||||
info.lpParam = (void *)pInviteInfo;
|
||||
info.requireOnline = true;
|
||||
app.DebugPrintf("Using fullscreen layer\n");
|
||||
ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_QuadrantSignin,&info,eUILayer_Alert,eUIGroup_Fullscreen);
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ public:
|
|||
void Initialise();
|
||||
void Terminate();
|
||||
void DoWork();
|
||||
bool _RunNetworkGame(LPVOID lpParameter);
|
||||
bool StartNetworkGame(Minecraft *minecraft, LPVOID lpParameter);
|
||||
bool _RunNetworkGame(void *lpParameter);
|
||||
bool StartNetworkGame(Minecraft *minecraft, void *lpParameter);
|
||||
int CorrectErrorIDS(int IDS);
|
||||
|
||||
// Player management
|
||||
|
|
@ -98,7 +98,7 @@ public:
|
|||
bool SessionHasSpace(unsigned int spaceRequired = 1);
|
||||
std::vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly);
|
||||
bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession);
|
||||
void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam );
|
||||
void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam );
|
||||
void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam );
|
||||
void ForceFriendsSessionRefresh();
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ public:
|
|||
|
||||
bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo);
|
||||
eJoinGameResult JoinGame(FriendSessionInfo *searchResult, int localUsersMask);
|
||||
static void CancelJoinGame(LPVOID lpParam); // Not part of the shared interface
|
||||
static void CancelJoinGame(void *lpParam); // Not part of the shared interface
|
||||
bool LeaveGame(bool bMigrateHost);
|
||||
static int JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad);
|
||||
void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL);
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ private:
|
|||
public:
|
||||
virtual std::vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly) = 0;
|
||||
virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession) = 0;
|
||||
virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ) = 0;
|
||||
virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam ) = 0;
|
||||
virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ) = 0;
|
||||
virtual void ForceFriendsSessionRefresh() = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -134,8 +134,8 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa
|
|||
m_bSearchPending = false;
|
||||
|
||||
m_bIsOfflineGame = false;
|
||||
m_pSearchParam = NULL;
|
||||
m_SessionsUpdatedCallback = NULL;
|
||||
m_pSearchParam = nullptr;
|
||||
m_SessionsUpdatedCallback = nullptr;
|
||||
|
||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||
{
|
||||
|
|
@ -534,7 +534,7 @@ bool CPlatformNetworkManagerStub::GetGameSessionInfo(int iPad, SessionID session
|
|||
return false;
|
||||
}
|
||||
|
||||
void CPlatformNetworkManagerStub::SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam )
|
||||
void CPlatformNetworkManagerStub::SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam )
|
||||
{
|
||||
m_SessionsUpdatedCallback = SessionsUpdatedCallback; m_pSearchParam = pSearchParam;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,8 +134,8 @@ private:
|
|||
int m_lastSearchPad;
|
||||
bool m_bSearchResultsReady;
|
||||
bool m_bSearchPending;
|
||||
LPVOID m_pSearchParam;
|
||||
void (*m_SessionsUpdatedCallback)(LPVOID pParam);
|
||||
void *m_pSearchParam;
|
||||
void (*m_SessionsUpdatedCallback)(void *pParam);
|
||||
|
||||
C4JThread* m_SearchingThread;
|
||||
|
||||
|
|
@ -157,7 +157,7 @@ private:
|
|||
public:
|
||||
virtual std::vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly);
|
||||
virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession);
|
||||
virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam );
|
||||
virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam );
|
||||
virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam );
|
||||
virtual void ForceFriendsSessionRefresh();
|
||||
|
||||
|
|
|
|||
|
|
@ -416,8 +416,8 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa
|
|||
m_bSearchPending = false;
|
||||
|
||||
m_bIsOfflineGame = false;
|
||||
m_pSearchParam = NULL;
|
||||
m_SessionsUpdatedCallback = NULL;
|
||||
m_pSearchParam = nullptr;
|
||||
m_SessionsUpdatedCallback = nullptr;
|
||||
|
||||
m_searchResultsCount = 0;
|
||||
m_pSearchResults = NULL;
|
||||
|
|
@ -1254,7 +1254,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session
|
|||
#endif
|
||||
}
|
||||
|
||||
void CPlatformNetworkManagerSony::SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam )
|
||||
void CPlatformNetworkManagerSony::SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam )
|
||||
{
|
||||
m_SessionsUpdatedCallback = SessionsUpdatedCallback; m_pSearchParam = pSearchParam;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,8 +149,8 @@ private:
|
|||
|
||||
int m_lastSearchPad;
|
||||
bool m_bSearchPending;
|
||||
LPVOID m_pSearchParam;
|
||||
void (*m_SessionsUpdatedCallback)(LPVOID pParam);
|
||||
void *m_pSearchParam;
|
||||
void (*m_SessionsUpdatedCallback)(void *pParam);
|
||||
|
||||
C4JThread* m_SearchingThread;
|
||||
|
||||
|
|
@ -168,7 +168,7 @@ private:
|
|||
public:
|
||||
virtual std::vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly);
|
||||
virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession);
|
||||
virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam );
|
||||
virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(void *pParam), void *pSearchParam );
|
||||
virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam );
|
||||
virtual void ForceFriendsSessionRefresh();
|
||||
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ bool SonyRemoteStorage::setData( PSAVE_INFO info, CallbackFunc cb, LPVOID lpPara
|
|||
return true;
|
||||
}
|
||||
|
||||
int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes)
|
||||
int SonyRemoteStorage::LoadSaveDataThumbnailReturned(void *lpParam,std::uint8_t *thumbnailData,unsigned int thumbnailBytes)
|
||||
{
|
||||
SonyRemoteStorage *pClass= (SonyRemoteStorage *)lpParam;
|
||||
|
||||
|
|
@ -250,10 +250,10 @@ int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThum
|
|||
|
||||
app.DebugPrintf("Received data for a thumbnail\n");
|
||||
|
||||
if(pbThumbnail && dwThumbnailBytes)
|
||||
if(thumbnailData && thumbnailBytes)
|
||||
{
|
||||
pClass->m_thumbnailData = pbThumbnail;
|
||||
pClass->m_thumbnailDataSize = dwThumbnailBytes;
|
||||
pClass->m_thumbnailData = thumbnailData;
|
||||
pClass->m_thumbnailDataSize = thumbnailBytes;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "sceRemoteStorage/header/sceRemoteStorage.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class SonyRemoteStorage
|
||||
{
|
||||
public:
|
||||
|
|
@ -94,7 +96,7 @@ public:
|
|||
|
||||
|
||||
bool setData( PSAVE_INFO info, CallbackFunc cb, LPVOID lpParam );
|
||||
static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes);
|
||||
static int LoadSaveDataThumbnailReturned(void *lpParam,std::uint8_t *thumbnailData,unsigned int thumbnailBytes);
|
||||
static int setDataThread(void* lpParam);
|
||||
|
||||
SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {}
|
||||
|
|
@ -107,7 +109,7 @@ protected:
|
|||
int m_dataProgress;
|
||||
char *m_pchServiceID;
|
||||
|
||||
PBYTE m_thumbnailData;
|
||||
std::uint8_t *m_thumbnailData;
|
||||
unsigned int m_thumbnailDataSize;
|
||||
C4JThread* m_SetDataThread;
|
||||
PSAVE_INFO m_setDataSaveInfo;
|
||||
|
|
|
|||
|
|
@ -1637,7 +1637,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message)
|
|||
bool hintsOn = m_isFullTutorial || (app.GetGameSettings(m_iPad,eGameSetting_Hints) && app.GetGameSettings(m_iPad,eGameSetting_DisplayHUD));
|
||||
|
||||
bool messageShown = false;
|
||||
DWORD time = GetTickCount();
|
||||
std::uint32_t time = GetTickCount();
|
||||
if(message != NULL && (message->m_forceDisplay || hintsOn) &&
|
||||
(!message->m_delay ||
|
||||
(
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue