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:
Tropical 2026-03-13 11:58:09 -05:00 committed by GitHub
commit 44ade1f2b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
342 changed files with 4062 additions and 3336 deletions

View file

@ -326,16 +326,16 @@ void C_4JInput::SetJoypadSensitivity(int, float){}
void C_4JInput::SetJoypadStickAxisMap(int, unsigned int, unsigned int){} void C_4JInput::SetJoypadStickAxisMap(int, unsigned int, unsigned int){}
void C_4JInput::SetJoypadStickTriggerMap(int, unsigned int, unsigned int){} void C_4JInput::SetJoypadStickTriggerMap(int, unsigned int, unsigned int){}
void C_4JInput::SetKeyRepeatRate(float, float){} 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; } FLOAT C_4JInput::GetIdleSeconds(int){ return 0.f; }
bool C_4JInput::IsPadConnected(int iPad){ return iPad == 0; } bool C_4JInput::IsPadConnected(int iPad){ return iPad == 0; }
// Silly check, we check if we have a keyboard. // Silly check, we check if we have a keyboard.
EKeyboardResult C_4JInput::RequestKeyboard(LPCWSTR, LPCWSTR, DWORD, UINT, EKeyboardResult C_4JInput::RequestKeyboard(const wchar_t *, const wchar_t *, int, unsigned int,
int(*)(LPVOID, const bool), LPVOID, C_4JInput::EKeyboardMode) int(*)(void *, const bool), void *, C_4JInput::EKeyboardMode)
{ return EKeyboard_Cancelled; } { return EKeyboard_Cancelled; }
void C_4JInput::GetText(uint16_t *s){ if (s) s[0] = 0; } 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; } bool C_4JInput::VerifyStrings(wchar_t **, int, int(*)(void *, STRING_VERIFY_RESPONSE *), void *){ return true; }
void C_4JInput::CancelQueuedVerifyStrings(int(*)(LPVOID, STRING_VERIFY_RESPONSE*), LPVOID){} void C_4JInput::CancelQueuedVerifyStrings(int(*)(void *, STRING_VERIFY_RESPONSE *), void *){}
void C_4JInput::CancelAllVerifyInProgress(){} void C_4JInput::CancelAllVerifyInProgress(){}

View file

@ -93,7 +93,7 @@ public:
void SetJoypadStickAxisMap(int iPad,unsigned int uiFrom, unsigned int uiTo); void SetJoypadStickAxisMap(int iPad,unsigned int uiFrom, unsigned int uiTo);
void SetJoypadStickTriggerMap(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 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); FLOAT GetIdleSeconds(int iPad);
bool IsPadConnected(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, 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(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); void GetText(uint16_t *UTF16String);
// Online check strings against offensive list - TCR 92 // 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. // 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. // Intent Protect players from inappropriate language.
bool VerifyStrings(WCHAR **pwStringA,int iStringC,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)(LPVOID,STRING_VERIFY_RESPONSE *),LPVOID lpParam); void CancelQueuedVerifyStrings(int( *Func)(void *,STRING_VERIFY_RESPONSE *),void *lpParam);
void CancelAllVerifyInProgress(void); void CancelAllVerifyInProgress(void);
//bool InputDetected(DWORD dwUserIndex,WCHAR *pwchInput); //bool InputDetected(DWORD dwUserIndex,WCHAR *pwchInput);

View file

@ -22,14 +22,14 @@ void C_4JProfile::SetLockedProfile(int iProf) {}
bool C_4JProfile::IsSignedIn(int iQuadrant) { return iQuadrant == 0; } bool C_4JProfile::IsSignedIn(int iQuadrant) { return iQuadrant == 0; }
bool C_4JProfile::IsSignedInLive(int iProf) { return false; } bool C_4JProfile::IsSignedInLive(int iProf) { return false; }
bool C_4JProfile::IsGuest(int iQuadrant) { 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::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)(LPVOID, const bool, const int iPad), LPVOID 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)(LPVOID, const bool, const int iPad), LPVOID 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) {} void C_4JProfile::SetPrimaryPlayerChanged(bool bVal) {}
bool C_4JProfile::QuerySigninStatus(void) { return true; } bool C_4JProfile::QuerySigninStatus(void) { return true; }
void C_4JProfile::GetXUID(int iPad, PlayerUID *pXuid, bool bOnlineXuid) { if (pXuid) *pXuid = 0; } 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::AreXUIDSEqual(PlayerUID xuid1, PlayerUID xuid2) { return xuid1 == xuid2; }
BOOL C_4JProfile::XUIDIsGuest(PlayerUID xuid) { return FALSE; } bool C_4JProfile::XUIDIsGuest(PlayerUID xuid) { return false; }
bool C_4JProfile::AllowedToPlayMultiplayer(int iProf) { return true; } bool C_4JProfile::AllowedToPlayMultiplayer(int iProf) { return true; }
bool C_4JProfile::GetChatAndContentRestrictions(int iPad, bool *pbChatRestricted, bool *pbContentRestricted, int *piAge) { bool C_4JProfile::GetChatAndContentRestrictions(int iPad, bool *pbChatRestricted, bool *pbContentRestricted, int *piAge) {
if (pbChatRestricted) *pbChatRestricted = false; if (pbChatRestricted) *pbChatRestricted = false;
@ -38,13 +38,13 @@ bool C_4JProfile::GetChatAndContentRestrictions(int iPad, bool *pbChatRestricted
return true; return true;
} }
void C_4JProfile::StartTrialGame() {} void C_4JProfile::StartTrialGame() {}
void C_4JProfile::AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, BOOL *allAllowed, BOOL *friendsAllowed) { void C_4JProfile::AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, bool *allAllowed, bool *friendsAllowed) {
if (allAllowed) *allAllowed = TRUE; if (allAllowed) *allAllowed = true;
if (friendsAllowed) *friendsAllowed = 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) {} 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() {} void C_4JProfile::CancelProfileAvatarRequest() {}
int C_4JProfile::GetPrimaryPad() { return 0; } int C_4JProfile::GetPrimaryPad() { return 0; }
void C_4JProfile::SetPrimaryPad(int iPad) {} 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; } char* C_4JProfile::GetGamertag(int iPad) { return s_gamertag; }
std::wstring C_4JProfile::GetDisplayName(int iPad) { return L"Player"; } std::wstring C_4JProfile::GetDisplayName(int iPad) { return L"Player"; }
bool C_4JProfile::IsFullVersion() { return true; } bool C_4JProfile::IsFullVersion() { return true; }
void C_4JProfile::SetSignInChangeCallback(void(*Func)(LPVOID, bool, unsigned int), LPVOID lpParam) {} void C_4JProfile::SetSignInChangeCallback(void(*Func)(void *, bool, unsigned int), void *lpParam) {}
void C_4JProfile::SetNotificationsCallback(void(*Func)(LPVOID, DWORD, unsigned int), LPVOID 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::RegionIsNorthAmerica(void) { return true; }
bool C_4JProfile::LocaleIsUSorCanada(void) { return true; } bool C_4JProfile::LocaleIsUSorCanada(void) { return true; }
HRESULT C_4JProfile::GetLiveConnectionStatus() { return S_OK; } HRESULT C_4JProfile::GetLiveConnectionStatus() { return S_OK; }
bool C_4JProfile::IsSystemUIDisplayed() { return false; } bool C_4JProfile::IsSystemUIDisplayed() { return false; }
void C_4JProfile::SetProfileReadErrorCallback(void(*Func)(LPVOID), LPVOID lpParam) {} void C_4JProfile::SetProfileReadErrorCallback(void(*Func)(void *), void *lpParam) {}
int C_4JProfile::SetDefaultOptionsCallback(int(*Func)(LPVOID, PROFILESETTINGS *, const int iPad), LPVOID lpParam) { return 0; } int C_4JProfile::SetDefaultOptionsCallback(int(*Func)(void *, PROFILESETTINGS *, const int iPad), void *lpParam) { return 0; }
int C_4JProfile::SetOldProfileVersionCallback(int(*Func)(LPVOID, unsigned char *, const unsigned short, const int), LPVOID 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 = {}; static C_4JProfile::PROFILESETTINGS s_defaultSettings = {};
C_4JProfile::PROFILESETTINGS* C_4JProfile::GetDashboardProfileSettings(int iPad) { return &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::SetRichPresenceContextValue(int iPad, int iContextID, int iVal) {}
void C_4JProfile::SetCurrentGameActivity(int iPad, int iNewPresence, bool bSetOthersToIdle) {} void C_4JProfile::SetCurrentGameActivity(int iPad, int iNewPresence, bool bSetOthersToIdle) {}
void C_4JProfile::DisplayFullVersionPurchase(bool bRequired, int iQuadrant, int iUpsellParam) {} 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) {} void C_4JProfile::SetDebugFullOverride(bool bVal) {}

View file

@ -1,5 +1,7 @@
#pragma once #pragma once
#include <cstdint>
enum eAwardType enum eAwardType
{ {
eAwardType_Achievement = 0, eAwardType_Achievement = 0,
@ -54,21 +56,21 @@ public:
bool IsSignedIn(int iQuadrant); bool IsSignedIn(int iQuadrant);
bool IsSignedInLive(int iProf); bool IsSignedInLive(int iProf);
bool IsGuest(int iQuadrant); 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 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)(LPVOID,const bool, const int iPad),LPVOID 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)(LPVOID,const bool, const int iPad),LPVOID 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); void SetPrimaryPlayerChanged(bool bVal);
bool QuerySigninStatus(void); bool QuerySigninStatus(void);
void GetXUID(int iPad, PlayerUID *pXuid,bool bOnlineXuid); void GetXUID(int iPad, PlayerUID *pXuid,bool bOnlineXuid);
BOOL AreXUIDSEqual(PlayerUID xuid1,PlayerUID xuid2); bool AreXUIDSEqual(PlayerUID xuid1,PlayerUID xuid2);
BOOL XUIDIsGuest(PlayerUID xuid); bool XUIDIsGuest(PlayerUID xuid);
bool AllowedToPlayMultiplayer(int iProf); bool AllowedToPlayMultiplayer(int iProf);
bool GetChatAndContentRestrictions(int iPad,bool *pbChatRestricted,bool *pbContentRestricted,int *piAge); bool GetChatAndContentRestrictions(int iPad,bool *pbChatRestricted,bool *pbContentRestricted,int *piAge);
void StartTrialGame(); // disables saves and leaderboard, and change state to readyforgame from pregame void StartTrialGame(); // disables saves and leaderboard, and change state to readyforgame from pregame
void AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, BOOL *allAllowed, BOOL *friendsAllowed); void AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, bool *allAllowed, bool *friendsAllowed);
BOOL CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly, PPlayerUID pXuids, DWORD dwXuidCount ); bool CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly, PPlayerUID pXuids, unsigned int xuidCount);
void ShowProfileCard(int iPad, PlayerUID targetUid); 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(); void CancelProfileAvatarRequest();
@ -78,18 +80,18 @@ public:
char* GetGamertag(int iPad); char* GetGamertag(int iPad);
std::wstring GetDisplayName(int iPad); std::wstring GetDisplayName(int iPad);
bool IsFullVersion(); bool IsFullVersion();
void SetSignInChangeCallback(void ( *Func)(LPVOID, bool, unsigned int),LPVOID lpParam); void SetSignInChangeCallback(void ( *Func)(void *, bool, unsigned int),void *lpParam);
void SetNotificationsCallback(void ( *Func)(LPVOID, DWORD, unsigned int),LPVOID lpParam); void SetNotificationsCallback(void ( *Func)(void *, std::uint32_t, unsigned int),void *lpParam);
bool RegionIsNorthAmerica(void); bool RegionIsNorthAmerica(void);
bool LocaleIsUSorCanada(void); bool LocaleIsUSorCanada(void);
HRESULT GetLiveConnectionStatus(); HRESULT GetLiveConnectionStatus();
bool IsSystemUIDisplayed(); bool IsSystemUIDisplayed();
void SetProfileReadErrorCallback(void ( *Func)(LPVOID), LPVOID lpParam); void SetProfileReadErrorCallback(void ( *Func)(void *), void *lpParam);
// PROFILE DATA // PROFILE DATA
int SetDefaultOptionsCallback(int( *Func)(LPVOID,PROFILESETTINGS *, const int iPad),LPVOID lpParam); int SetDefaultOptionsCallback(int( *Func)(void *,PROFILESETTINGS *, const int iPad),void *lpParam);
int SetOldProfileVersionCallback(int( *Func)(LPVOID,unsigned char *, const unsigned short,const int),LPVOID lpParam); int SetOldProfileVersionCallback(int( *Func)(void *,unsigned char *, const unsigned short,const int),void *lpParam);
PROFILESETTINGS * GetDashboardProfileSettings(int iPad); PROFILESETTINGS * GetDashboardProfileSettings(int iPad);
void WriteToProfile(int iQuadrant, bool bGameDefinedDataChanged=false, bool bOverride5MinuteLimitOnProfileWrites=false); void WriteToProfile(int iQuadrant, bool bGameDefinedDataChanged=false, bool bOverride5MinuteLimitOnProfileWrites=false);
void ForceQueuedProfileWrites(int iPad=XUSER_INDEX_ANY); void ForceQueuedProfileWrites(int iPad=XUSER_INDEX_ANY);
@ -116,7 +118,7 @@ public:
// PURCHASE // PURCHASE
void DisplayFullVersionPurchase(bool bRequired, int iQuadrant, int iUpsellParam = -1); 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 // Debug
void SetDebugFullOverride(bool bVal); // To override the license version (trail/full). Only in debug/release, not ContentPackage void SetDebugFullOverride(bool bVal); // To override the license version (trail/full). Only in debug/release, not ContentPackage

View file

@ -13,64 +13,64 @@ C4JStorage::C4JStorage() : m_pStringTable(nullptr) {}
void C4JStorage::Tick(void) {} void C4JStorage::Tick(void) {}
C4JStorage::EMessageResult C4JStorage::RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA, UINT uiOptionC, DWORD dwPad, 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; return EMessage_ResultAccept;
} }
C4JStorage::EMessageResult C4JStorage::GetMessageBoxResult() { return EMessage_Undefined; } 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::ResetSaveData() {}
void C4JStorage::SetDefaultSaveNameForKeyboardDisplay(LPCWSTR pwchDefaultSaveName) {} void C4JStorage::SetDefaultSaveNameForKeyboardDisplay(LPCWSTR pwchDefaultSaveName) {}
void C4JStorage::SetSaveTitle(LPCWSTR pwchDefaultSaveName) {} void C4JStorage::SetSaveTitle(LPCWSTR pwchDefaultSaveName) {}
bool C4JStorage::GetSaveUniqueNumber(INT *piVal) { if (piVal) *piVal = 0; return true; } bool C4JStorage::GetSaveUniqueNumber(INT *piVal) { if (piVal) *piVal = 0; return true; }
bool C4JStorage::GetSaveUniqueFilename(char *pszName) { if (pszName) pszName[0] = '\0'; return true; } bool C4JStorage::GetSaveUniqueFilename(char *pszName) { if (pszName) pszName[0] = '\0'; return true; }
void C4JStorage::SetSaveUniqueFilename(char *szFilename) {} 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) {} void C4JStorage::SetSaveDisabled(bool bDisable) {}
bool C4JStorage::GetSaveDisabled(void) { return false; } bool C4JStorage::GetSaveDisabled(void) { return false; }
unsigned int C4JStorage::GetSaveSize() { return 0; } unsigned int C4JStorage::GetSaveSize() { return 0; }
void C4JStorage::GetSaveData(void *pvData, unsigned int *puiBytes) { if (puiBytes) *puiBytes = 0; } void C4JStorage::GetSaveData(void *pvData, unsigned int *puiBytes) { if (puiBytes) *puiBytes = 0; }
PVOID C4JStorage::AllocateSaveData(unsigned int uiBytes) { return malloc(uiBytes); } PVOID C4JStorage::AllocateSaveData(unsigned int uiBytes) { return malloc(uiBytes); }
void C4JStorage::SetSaveImages(PBYTE pbThumbnail, DWORD dwThumbnailBytes, PBYTE pbImage, DWORD dwImageBytes, PBYTE pbTextData, DWORD dwTextDataBytes) {} 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; } 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)(LPVOID lpParam, bool), LPVOID lpParam) {} void C4JStorage::CopySaveDataToNewSave(PBYTE pbThumbnail, DWORD cbThumbnail, WCHAR *wchNewName, int(*Func)(void *lpParam, bool), void *lpParam) {}
void C4JStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected) {} void C4JStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected) {}
bool C4JStorage::GetSaveDeviceSelected(unsigned int iPad) { return true; } bool C4JStorage::GetSaveDeviceSelected(unsigned int iPad) { return true; }
C4JStorage::ESaveGameState C4JStorage::DoesSaveExist(bool *pbExists) { if (pbExists) *pbExists = false; return ESaveGame_Idle; } C4JStorage::ESaveGameState C4JStorage::DoesSaveExist(bool *pbExists) { if (pbExists) *pbExists = false; return ESaveGame_Idle; }
bool C4JStorage::EnoughSpaceForAMinSaveGame() { return true; } bool C4JStorage::EnoughSpaceForAMinSaveGame() { return true; }
void C4JStorage::SetSaveMessageVPosition(float fY) {} 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; } PSAVE_DETAILS C4JStorage::ReturnSavesInfo() { return nullptr; }
void C4JStorage::ClearSavesInfo() {} 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, 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; } 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::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)(LPVOID lpParam, const bool), LPVOID 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)(LPVOID lpParam, C4JStorage::DLC_TMS_DETAILS *, int), LPVOID lpParam) {} void C4JStorage::RegisterMarketplaceCountsCallback(int(*Func)(void *lpParam, C4JStorage::DLC_TMS_DETAILS *, int), void *lpParam) {}
void C4JStorage::SetDLCPackageRoot(char *pszDLCRoot) {} 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; } DWORD C4JStorage::CancelGetDLCOffers() { return 0; }
void C4JStorage::ClearDLCOffers() {} void C4JStorage::ClearDLCOffers() {}
XMARKETPLACE_CONTENTOFFER_INFO& C4JStorage::GetOffer(DWORD dw) { return s_dummyOffer; } XMARKETPLACE_CONTENTOFFER_INFO& C4JStorage::GetOffer(DWORD dw) { return s_dummyOffer; }
int C4JStorage::GetOfferCount() { return 0; } 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; } 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; } 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; } DWORD C4JStorage::UnmountInstalledDLC(LPCSTR szMountDrive) { return 0; }
void C4JStorage::GetMountedDLCFileList(const char *szMountDrive, std::vector<std::string> &fileList) { fileList.clear(); } void C4JStorage::GetMountedDLCFileList(const char *szMountDrive, std::vector<std::string> &fileList) { fileList.clear(); }
std::string C4JStorage::GetMountedPath(std::string szMount) { return ""; } std::string C4JStorage::GetMountedPath(std::string szMount) { return ""; }
C4JStorage::ETMSStatus C4JStorage::ReadTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, C4JStorage::eTMS_FileType eFileType, 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::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR *pwchFilename, BYTE *pBuffer, DWORD dwBufferSize) { return false; }
bool C4JStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR *pwchFilename) { return false; } bool C4JStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR *pwchFilename) { return false; }
void C4JStorage::StoreTMSPathName(WCHAR *pwchName) {} 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 C4JStorage::CRC(unsigned char *buf, int len) {
unsigned int crc = 0xFFFFFFFF; unsigned int crc = 0xFFFFFFFF;
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {

View file

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <cstdint>
#include <vector> #include <vector>
//#include <xtms.h> //#include <xtms.h>
@ -242,31 +243,31 @@ public:
// Messages // Messages
C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, 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(); C4JStorage::EMessageResult GetMessageBoxResult();
// save device // 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 // 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 ResetSaveData(); // Call before a new save to clear out stored save file name
void SetDefaultSaveNameForKeyboardDisplay(LPCWSTR pwchDefaultSaveName); void SetDefaultSaveNameForKeyboardDisplay(LPCWSTR pwchDefaultSaveName);
void SetSaveTitle(LPCWSTR pwchDefaultSaveName); void SetSaveTitle(LPCWSTR pwchDefaultSaveName);
bool GetSaveUniqueNumber(INT *piVal); bool GetSaveUniqueNumber(INT *piVal);
bool GetSaveUniqueFilename(char *pszName); bool GetSaveUniqueFilename(char *pszName);
void SetSaveUniqueFilename(char *szFilename); 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); void SetSaveDisabled(bool bDisable);
bool GetSaveDisabled(void); bool GetSaveDisabled(void);
unsigned int GetSaveSize(); unsigned int GetSaveSize();
void GetSaveData(void *pvData,unsigned int *puiBytes); void GetSaveData(void *pvData,unsigned int *puiBytes);
PVOID AllocateSaveData(unsigned int uiBytes); 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 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); C4JStorage::ESaveGameState SaveSaveData(int( *Func)(void * ,const bool),void *lpParam);
void CopySaveDataToNewSave(PBYTE pbThumbnail,DWORD cbThumbnail,WCHAR *wchNewName,int ( *Func)(LPVOID lpParam, bool), LPVOID lpParam); void CopySaveDataToNewSave(PBYTE pbThumbnail,DWORD cbThumbnail,WCHAR *wchNewName,int ( *Func)(void *lpParam, bool), void *lpParam);
void SetSaveDeviceSelected(unsigned int uiPad,bool bSelected); void SetSaveDeviceSelected(unsigned int uiPad,bool bSelected);
bool GetSaveDeviceSelected(unsigned int iPad); bool GetSaveDeviceSelected(unsigned int iPad);
C4JStorage::ESaveGameState DoesSaveExist(bool *pbExists); 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 void SetSaveMessageVPosition(float fY); // The 'Saving' message will display at a default position unless changed
// Get the info for the saves // 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(); PSAVE_DETAILS ReturnSavesInfo();
void ClearSavesInfo(); // Clears results 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,XCONTENT_DATA &xContentData);
void GetSaveCacheFileInfo(DWORD dwFile, PBYTE *ppbImageData, DWORD *pdwImageBytes); void GetSaveCacheFileInfo(DWORD dwFile, PBYTE *ppbImageData, DWORD *pdwImageBytes);
// Load the save. Need to call GetSaveData once the callback is called // 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 LoadSaveData(PSAVE_INFO pSaveInfo,int( *Func)(void *lpParam,const bool, const bool), void *lpParam);
C4JStorage::ESaveGameState DeleteSaveData(PSAVE_INFO pSaveInfo,int( *Func)(LPVOID lpParam,const bool), LPVOID lpParam); C4JStorage::ESaveGameState DeleteSaveData(PSAVE_INFO pSaveInfo,int( *Func)(void *lpParam,const bool), void *lpParam);
// DLC // 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); 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(); DWORD CancelGetDLCOffers();
void ClearDLCOffers(); void ClearDLCOffers();
XMARKETPLACE_CONTENTOFFER_INFO& GetOffer(DWORD dw); XMARKETPLACE_CONTENTOFFER_INFO& GetOffer(DWORD dw);
int GetOfferCount(); 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); 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); 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); DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL);
void GetMountedDLCFileList(const char* szMountDrive, std::vector<std::string>& fileList); void GetMountedDLCFileList(const char* szMountDrive, std::vector<std::string>& fileList);
std::string GetMountedPath(std::string szMount); std::string GetMountedPath(std::string szMount);
// Global title storage // Global title storage
C4JStorage::ETMSStatus ReadTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,C4JStorage::eTMS_FileType eFileType, 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 WriteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename,BYTE *pBuffer,DWORD dwBufferSize);
bool DeleteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename); bool DeleteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename);
void StoreTMSPathName(WCHAR *pwchName=NULL); 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_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_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_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); // 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); // bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const std::wstring &Filename);

View file

@ -10,6 +10,7 @@
#include "../../Minecraft.World/Headers/net.minecraft.world.item.h" #include "../../Minecraft.World/Headers/net.minecraft.world.item.h"
#include "../Platform/Common/Leaderboards/LeaderboardManager.h" #include "../Platform/Common/Leaderboards/LeaderboardManager.h"
#include <cstring>
Stat** StatsCounter::LARGE_STATS[] = { Stat** StatsCounter::LARGE_STATS[] = {
&Stats::walkOneM, &Stats::walkOneM,
@ -142,9 +143,9 @@ void StatsCounter::parse(void* data)
assert( stats.size() == 0 ); assert( stats.size() == 0 );
//Pointer to current position in stat array //Pointer to current position in stat array
PBYTE pbData=(PBYTE)data; std::uint8_t* pbData = reinterpret_cast<std::uint8_t*>(data);
pbData+=sizeof(GAME_SETTINGS); pbData += sizeof(GAME_SETTINGS);
unsigned short* statData = (unsigned short*)pbData;//data + (STAT_DATA_OFFSET/sizeof(unsigned short)); std::uint8_t* statData = pbData;
//Value being read //Value being read
StatContainer newVal; StatContainer newVal;
@ -157,19 +158,22 @@ void StatsCounter::parse(void* data)
{ {
if( !isLargeStat(*iter) ) 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[0] = difficultyStats[0];
newVal.stats[1] = statData[1]; newVal.stats[1] = difficultyStats[1];
newVal.stats[2] = statData[2]; newVal.stats[2] = difficultyStats[2];
newVal.stats[3] = statData[3]; newVal.stats[3] = difficultyStats[3];
stats.insert( std::make_pair(*iter, newVal) ); stats.insert( std::make_pair(*iter, newVal) );
} }
statData += 4; statData += sizeof(difficultyStats);
} }
else 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 ) if( largeStatData[0] != 0 || largeStatData[1] != 0 || largeStatData[2] != 0 || largeStatData[3] != 0 )
{ {
newVal.stats[0] = largeStatData[0]; newVal.stats[0] = largeStatData[0];
@ -178,21 +182,22 @@ void StatsCounter::parse(void* data)
newVal.stats[3] = largeStatData[3]; newVal.stats[3] = largeStatData[3];
stats.insert( std::make_pair(*iter, newVal) ); stats.insert( std::make_pair(*iter, newVal) );
} }
largeStatData += 4; statData += sizeof(largeStatData);
statData = (unsigned short*)largeStatData;
} }
} }
else 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[1] = 0;
newVal.stats[2] = 0; newVal.stats[2] = 0;
newVal.stats[3] = 0; newVal.stats[3] = 0;
stats.insert( std::make_pair(*iter, newVal) ); 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 //Retrieve the data pointer from the profile
#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ ) #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 #else
PBYTE pbData = (PBYTE)ProfileManager.GetGameDefinedProfileData(player); std::uint8_t* pbData = reinterpret_cast<std::uint8_t*>(ProfileManager.GetGameDefinedProfileData(player));
#endif #endif
pbData+=sizeof(GAME_SETTINGS); pbData += sizeof(GAME_SETTINGS);
//Pointer to current position in stat array //Pointer to current position in stat array
//unsigned short* statData = (unsigned short*)data + (STAT_DATA_OFFSET/sizeof(unsigned short)); std::uint8_t* statData = pbData;
unsigned short* statData = (unsigned short*)pbData;
//Reset all the data to 0 (we're going to replace it with the map data) //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)); 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) ) if( !isLargeStat(*iter) )
{ {
std::uint16_t difficultyStats[eDifficulty_Max] = {};
if( val != stats.end() ) if( val != stats.end() )
{ {
statData[0] = val->second.stats[0]; difficultyStats[0] = static_cast<std::uint16_t>(val->second.stats[0]);
statData[1] = val->second.stats[1]; difficultyStats[1] = static_cast<std::uint16_t>(val->second.stats[1]);
statData[2] = val->second.stats[2]; difficultyStats[2] = static_cast<std::uint16_t>(val->second.stats[2]);
statData[3] = val->second.stats[3]; difficultyStats[3] = static_cast<std::uint16_t>(val->second.stats[3]);
} }
statData += 4; std::memcpy(statData, difficultyStats, sizeof(difficultyStats));
statData += sizeof(difficultyStats);
} }
else else
{ {
unsigned int* largeStatData = (unsigned int*)statData; std::uint32_t largeStatData[eDifficulty_Max] = {};
if( val != stats.end() ) if( val != stats.end() )
{ {
largeStatData[0] = val->second.stats[0]; largeStatData[0] = val->second.stats[0];
@ -258,17 +264,19 @@ void StatsCounter::save(int player, bool force)
largeStatData[2] = val->second.stats[2]; largeStatData[2] = val->second.stats[2];
largeStatData[3] = val->second.stats[3]; largeStatData[3] = val->second.stats[3];
} }
largeStatData += 4; std::memcpy(statData, largeStatData, sizeof(largeStatData));
statData = (unsigned short*)largeStatData; statData += sizeof(largeStatData);
} }
} }
else else
{ {
std::uint16_t achievementValue = 0;
if( val != stats.end() ) 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 #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); app.DebugPrintf("Setting property id: %d to value %d\n", id, value);
prop->dwPropertyId = id; prop->dwPropertyId = id;

View file

@ -1,4 +1,5 @@
#pragma once #pragma once
#include <cstdint>
class Stat; class Stat;
class Achievement; class Achievement;
class StatsSyncher; class StatsSyncher;
@ -95,7 +96,7 @@ private:
void dumpStatsToTTY(); void dumpStatsToTTY();
#ifdef _XBOX #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); static void setLeaderboardRating(XUSER_PROPERTY* prop, LONGLONG value);
#endif #endif

View file

@ -1415,7 +1415,7 @@ void Minecraft::run_middle()
} }
else 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() ); 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 // Check if PSN is unavailable because of age restriction
if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION)
{ {
UINT uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0] = IDS_OK; uiIDA[0] = IDS_OK;
ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, i, NULL, NULL, app.GetStringTable()); ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, i, NULL, NULL, app.GetStringTable());
} }
else if (ProfileManager.IsSignedIn(i) && !ProfileManager.IsSignedInLive(i)) else if (ProfileManager.IsSignedIn(i) && !ProfileManager.IsSignedInLive(i))
{ {
// You're not signed in to PSN! // You're not signed in to PSN!
UINT uiIDA[2]; unsigned int uiIDA[2];
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
uiIDA[1] = IDS_CANCEL; 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); 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 else
#endif #endif
{ {
UINT uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK; 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()); 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 // 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) 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); 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 // 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)) if(GET_IS_DLC_SKIN_FROM_BITMASK(dwSkinID))
{ {
player->setAnimOverrideBitmask(player->getSkinAnimOverrideBitmask(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 // 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 #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) if(localplayers[idx] != NULL)
{ {
@ -4715,7 +4715,7 @@ void Minecraft::playerLeftTutorial(int iPad)
} }
#ifdef _DURANGO #ifdef _DURANGO
void Minecraft::inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasPrivileges, int iPad) void Minecraft::inGameSignInCheckAllPrivilegesCallback(void *lpParam, bool hasPrivileges, int iPad)
{ {
Minecraft* pClass = (Minecraft*)lpParam; Minecraft* pClass = (Minecraft*)lpParam;
@ -4727,7 +4727,7 @@ void Minecraft::inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasP
{ {
if( !g_NetworkManager.SessionHasSpace() ) if( !g_NetworkManager.SessionHasSpace() )
{ {
UINT uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0]=IDS_OK; uiIDA[0]=IDS_OK;
ui.RequestMessageBox(IDS_MULTIPLAYER_FULL_TITLE, IDS_MULTIPLAYER_FULL_TEXT, uiIDA, 1); ui.RequestMessageBox(IDS_MULTIPLAYER_FULL_TITLE, IDS_MULTIPLAYER_FULL_TEXT, uiIDA, 1);
ProfileManager.RemoveGamepadFromGame(iPad); ProfileManager.RemoveGamepadFromGame(iPad);
@ -4784,7 +4784,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad)
#endif #endif
if( !g_NetworkManager.SessionHasSpace() ) if( !g_NetworkManager.SessionHasSpace() )
{ {
UINT uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0]=IDS_OK; uiIDA[0]=IDS_OK;
ui.RequestMessageBox(IDS_MULTIPLAYER_FULL_TITLE, IDS_MULTIPLAYER_FULL_TEXT, uiIDA, 1); ui.RequestMessageBox(IDS_MULTIPLAYER_FULL_TITLE, IDS_MULTIPLAYER_FULL_TEXT, uiIDA, 1);
#ifdef _DURANGO #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 // 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. // 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); //ProfileManager.RequestConvertOfflineToGuestUI( &Minecraft::InGame_SignInReturned, pMinecraftClass,iPad);
UINT uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK; 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()); ui.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,iPad,NULL,NULL, app.GetStringTable());
#ifdef _DURANGO #ifdef _DURANGO

View file

@ -305,7 +305,7 @@ public:
static __int64 currentTimeMillis(); static __int64 currentTimeMillis();
#ifdef _DURANGO #ifdef _DURANGO
static void inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasPrivileges, int iPad); static void inGameSignInCheckAllPrivilegesCallback(void *lpParam, bool hasPrivileges, int iPad);
#endif #endif
static int InGame_SignInReturned(void *pParam,bool bContinue, int iPad); static int InGame_SignInReturned(void *pParam,bool bContinue, int iPad);
// 4J-PB // 4J-PB
@ -317,7 +317,7 @@ public:
CRITICAL_SECTION m_setLevelCS; CRITICAL_SECTION m_setLevelCS;
private: private:
// A bit field that store whether a particular quadrant is in the full tutorial or not // 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: public:
bool isTutorial(); bool isTutorial();
void playerStartedTutorial(int iPad); void playerStartedTutorial(int iPad);

View file

@ -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 // 4J - removed
#if 0 #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 // 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 ) if( initData->saveData )
{ {
delete[] (BYTE*)initData->saveData->data; delete[] reinterpret_cast<std::uint8_t *>(initData->saveData->data);
initData->saveData->data = 0; initData->saveData->data = 0;
initData->saveData->fileSize = 0; initData->saveData->fileSize = 0;
} }
@ -349,7 +349,7 @@ void MinecraftServer::addPostProcessRequest(ChunkSource *chunkSource, int x, int
void MinecraftServer::postProcessTerminate(ProgressRenderer *mcprogress) void MinecraftServer::postProcessTerminate(ProgressRenderer *mcprogress)
{ {
DWORD status = 0; std::uint32_t status = 0;
EnterCriticalSection(&server->m_postProcessCS); EnterCriticalSection(&server->m_postProcessCS);
size_t postProcessItemCount = server->m_postProcessRequests.size(); size_t postProcessItemCount = server->m_postProcessRequests.size();
@ -426,8 +426,8 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const std::ws
LevelGenerationOptions *levelGen = app.getLevelGenerationOptions(); LevelGenerationOptions *levelGen = app.getLevelGenerationOptions();
if( levelGen != NULL && levelGen->requiresBaseSave()) if( levelGen != NULL && levelGen->requiresBaseSave())
{ {
DWORD fileSize = 0; unsigned int fileSize = 0;
LPVOID pvSaveData = levelGen->getBaseSaveData(fileSize); std::uint8_t *pvSaveData = levelGen->getBaseSaveData(fileSize);
if(pvSaveData && fileSize != 0) bLevelGenBaseSave = true; if(pvSaveData && fileSize != 0) bLevelGenBaseSave = true;
} }
ConsoleSaveFileSplit *newFormatSave = NULL; ConsoleSaveFileSplit *newFormatSave = NULL;
@ -535,15 +535,15 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const std::ws
ConsoleSaveFile *csf = getLevel(0)->getLevelStorage()->getSaveFile(); ConsoleSaveFile *csf = getLevel(0)->getLevelStorage()->getSaveFile();
if( csf->doesFileExist(filepath) ) if( csf->doesFileExist(filepath) )
{ {
DWORD numberOfBytesRead; unsigned int numberOfBytesRead;
byteArray ba_gameRules; byteArray ba_gameRules;
FileEntry *fe = csf->createFile(filepath); FileEntry *fe = csf->createFile(filepath);
ba_gameRules.length = fe->getFileSize(); 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); csf->readFile(fe, ba_gameRules.data, ba_gameRules.length, &numberOfBytesRead);
assert(numberOfBytesRead == ba_gameRules.length); assert(numberOfBytesRead == ba_gameRules.length);
@ -809,8 +809,8 @@ void MinecraftServer::saveGameRules()
{ {
ConsoleSaveFile *csf = getLevel(0)->getLevelStorage()->getSaveFile(); ConsoleSaveFile *csf = getLevel(0)->getLevelStorage()->getSaveFile();
FileEntry *fe = csf->createFile(ConsoleSavePath(GAME_RULE_SAVENAME)); FileEntry *fe = csf->createFile(ConsoleSavePath(GAME_RULE_SAVENAME));
csf->setFilePointer(fe, 0, NULL, FILE_BEGIN); csf->setFilePointer(fe, 0, SaveFileSeekOrigin::Begin);
DWORD length; unsigned int length;
csf->writeFile(fe, ba.data, ba.length, &length ); csf->writeFile(fe, ba.data, ba.length, &length );
delete [] ba.data; delete [] ba.data;
@ -1060,7 +1060,7 @@ extern int c0a, c0b, c1a, c1b, c1c, c2a, c2b;
void MinecraftServer::run(__int64 seed, void *lpParameter) void MinecraftServer::run(__int64 seed, void *lpParameter)
{ {
NetworkGameInitData *initData = NULL; NetworkGameInitData *initData = NULL;
DWORD initSettings = 0; std::uint32_t initSettings = 0;
bool findSeed = false; bool findSeed = false;
if(lpParameter != NULL) if(lpParameter != NULL)
{ {
@ -1194,7 +1194,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
// Process delayed actions // Process delayed actions
eXuiServerAction eAction; eXuiServerAction eAction;
LPVOID param; void *param;
for(int i=0;i<XUSER_MAX_COUNT;i++) for(int i=0;i<XUSER_MAX_COUNT;i++)
{ {
eAction = app.GetXuiServerAction(i); eAction = app.GetXuiServerAction(i);
@ -1653,7 +1653,7 @@ void MinecraftServer::cycleSlowQueueIndex()
int startingIndex = s_slowQueuePlayerIndex; int startingIndex = s_slowQueuePlayerIndex;
INetworkPlayer *currentPlayer = NULL; INetworkPlayer *currentPlayer = NULL;
DWORD currentPlayerCount = 0; int currentPlayerCount = 0;
do do
{ {
currentPlayerCount = g_NetworkManager.GetPlayerCount(); currentPlayerCount = g_NetworkManager.GetPlayerCount();
@ -1695,4 +1695,4 @@ bool MinecraftServer::flagEntitiesToBeRemoved(unsigned int *flags)
} }
} }
return removedFound; return removedFound;
} }

View file

@ -1,4 +1,6 @@
#pragma once #pragma once
#include <cstdint>
#include "Input/ConsoleInputSource.h" #include "Input/ConsoleInputSource.h"
#include "../Minecraft.World/Util/ArrayWithLength.h" #include "../Minecraft.World/Util/ArrayWithLength.h"
#include "../Minecraft.World/Util/SharedConstants.h" #include "../Minecraft.World/Util/SharedConstants.h"
@ -22,19 +24,19 @@ class CommandDispatcher;
typedef struct _LoadSaveDataThreadParam typedef struct _LoadSaveDataThreadParam
{ {
LPVOID data; void *data;
__int64 fileSize; __int64 fileSize;
const std::wstring saveName; 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; } LoadSaveDataThreadParam;
typedef struct _NetworkGameInitData typedef struct _NetworkGameInitData
{ {
__int64 seed; __int64 seed;
LoadSaveDataThreadParam *saveData; LoadSaveDataThreadParam *saveData;
DWORD settings; std::uint32_t settings;
LevelGenerationOptions *levelGen; LevelGenerationOptions *levelGen;
DWORD texturePackId; std::uint32_t texturePackId;
bool findSeed; bool findSeed;
unsigned int xzSize; unsigned int xzSize;
unsigned char hellScale; unsigned char hellScale;
@ -115,17 +117,17 @@ private:
public: public:
// 4J Stu - This value should be incremented every time the list of players with friends-only UGC settings changes // 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 // 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 // This value is used to store the texture pack id for the currently loaded world
DWORD m_texturePackId; std::uint32_t m_texturePackId;
public: public:
MinecraftServer(); MinecraftServer();
~MinecraftServer(); ~MinecraftServer();
private: private:
// 4J Added - LoadSaveDataThreadParam // 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); void postProcessTerminate(ProgressRenderer *mcprogress);
bool loadLevel(LevelStorageSource *storageSource, const std::wstring& name, __int64 levelSeed, LevelType *pLevelType, NetworkGameInitData *initData); bool loadLevel(LevelStorageSource *storageSource, const std::wstring& name, __int64 levelSeed, LevelType *pLevelType, NetworkGameInitData *initData);
void setProgress(const std::wstring& status, int progress); void setProgress(const std::wstring& status, int progress);

View file

@ -197,8 +197,8 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet)
if(iUserID!=-1) if(iUserID!=-1)
{ {
BYTE *pBuffer=NULL; std::uint8_t *pBuffer = NULL;
DWORD dwSize=0; unsigned int dwSize = 0;
bool bRes; bool bRes;
// if there's a special skin or cloak for this player, add it in // 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->setScreen(new ReceivingLevelScreen(this));
minecraft->player->entityId = packet->clientVersion; minecraft->player->entityId = packet->clientVersion;
BYTE networkSmallId = getSocket()->getSmallId(); std::uint8_t networkSmallId = getSocket()->getSmallId();
app.UpdatePlayerInfo(networkSmallId, packet->m_playerIndex, packet->m_uiGamePrivileges); app.UpdatePlayerInfo(networkSmallId, packet->m_playerIndex, packet->m_uiGamePrivileges);
minecraft->player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, 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) ); 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); app.UpdatePlayerInfo(networkSmallId, packet->m_playerIndex, packet->m_uiGamePrivileges);
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, 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() && m_userIndex == ProfileManager.GetPrimaryPad() &&
!MinecraftServer::saveOnExitAnswered() ) !MinecraftServer::saveOnExitAnswered() )
{ {
UINT uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK; uiIDA[0]=IDS_CONFIRM_OK;
ui.RequestMessageBox(IDS_EXITING_GAME, IDS_GENERIC_ERROR, uiIDA, 1, ProfileManager.GetPrimaryPad(),&ClientConnection::HostDisconnectReturned,NULL, app.GetStringTable()); 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); fprintf(stderr, "[LOGIN-CLI] handlePreLogin entered, isHost=%d, userIdx=%d\n", (int)g_NetworkManager.IsHost(), m_userIndex);
#if 1 #if 1
// 4J - Check that we can play with all the players already in the game who have Friends-Only UGC set // 4J - Check that we can play with all the players already in the game who have Friends-Only UGC set
BOOL canPlay = TRUE; bool canPlay = true;
BOOL canPlayLocal = TRUE; bool canPlayLocal = true;
BOOL isAtLeastOneFriend = g_NetworkManager.IsHost(); bool isAtLeastOneFriend = g_NetworkManager.IsHost();
BOOL isFriendsWithHost = TRUE; bool isFriendsWithHost = true;
BOOL cantPlayContentRestricted = FALSE; bool cantPlayContentRestricted = false;
if(!g_NetworkManager.IsHost()) if(!g_NetworkManager.IsHost())
{ {
@ -1642,12 +1642,12 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
{ {
if(m_userIndex == ProfileManager.GetPrimaryPad() ) 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)) if(ProfileManager.IsSignedIn(m_userIndex) && ProfileManager.IsGuest(idx))
{ {
canPlay = FALSE; canPlay = false;
isFriendsWithHost = FALSE; isFriendsWithHost = false;
} }
else else
{ {
@ -1659,13 +1659,12 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
if( playerXuid != INVALID_XUID ) if( playerXuid != INVALID_XUID )
{ {
// Is this user friends with the host player? // Is this user friends with the host player?
BOOL result; int result = 0;
DWORD error; const unsigned int error = XUserAreUsersFriends(idx,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL);
error = XUserAreUsersFriends(idx,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL); if(error == ERROR_SUCCESS && result == 0)
if(error == ERROR_SUCCESS && result != TRUE)
{ {
canPlay = FALSE; canPlay = false;
isFriendsWithHost = FALSE; isFriendsWithHost = false;
} }
} }
} }
@ -1676,8 +1675,8 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
{ {
if(ProfileManager.IsSignedIn(m_userIndex) && ProfileManager.IsGuest(m_userIndex)) if(ProfileManager.IsSignedIn(m_userIndex) && ProfileManager.IsGuest(m_userIndex))
{ {
canPlay = FALSE; canPlay = false;
isFriendsWithHost = FALSE; isFriendsWithHost = false;
} }
else else
{ {
@ -1689,13 +1688,12 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
if( playerXuid != INVALID_XUID ) if( playerXuid != INVALID_XUID )
{ {
// Is this user friends with the host player? // Is this user friends with the host player?
BOOL result; int result = 0;
DWORD error; const unsigned int error = XUserAreUsersFriends(m_userIndex,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL);
error = XUserAreUsersFriends(m_userIndex,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL); if(error == ERROR_SUCCESS && result == 0)
if(error == ERROR_SUCCESS && result != TRUE)
{ {
canPlay = FALSE; canPlay = false;
isFriendsWithHost = FALSE; isFriendsWithHost = false;
} }
} }
} }
@ -1704,10 +1702,10 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
if( canPlay ) 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; 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) ) 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 // 4J Stu - Everyone joining needs to have at least one friend in the game
// Local players are implied friends // Local players are implied friends
if( isAtLeastOneFriend != TRUE ) if(!isAtLeastOneFriend)
{ {
BOOL result; int result = 0;
DWORD error; for(std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx)
for(DWORD idx = 0; idx < XUSER_MAX_COUNT; ++idx)
{ {
if( ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) ) if( ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) )
{ {
error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL); const unsigned int error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL);
if(error == ERROR_SUCCESS && result == TRUE) isAtLeastOneFriend = TRUE; if(error == ERROR_SUCCESS && result != 0) isAtLeastOneFriend = true;
} }
} }
} }
@ -1765,14 +1762,13 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
bool thisQuadrantOnly = true; bool thisQuadrantOnly = true;
if( m_userIndex == ProfileManager.GetPrimaryPad() ) thisQuadrantOnly = false; if( m_userIndex == ProfileManager.GetPrimaryPad() ) thisQuadrantOnly = false;
BOOL result; int result = 0;
DWORD error; for(std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx)
for(DWORD idx = 0; idx < XUSER_MAX_COUNT; ++idx)
{ {
if( (!thisQuadrantOnly || m_userIndex == idx) && ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) ) if( (!thisQuadrantOnly || m_userIndex == idx) && ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) )
{ {
error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL); const unsigned int error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL);
if(error == ERROR_SUCCESS) canPlay &= result; if(error == ERROR_SUCCESS) canPlay &= (result != 0);
} }
if(!canPlay) break; if(!canPlay) break;
} }
@ -1783,10 +1779,10 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet)
} }
#else #else
// TODO - handle this kind of things for non-360 platforms // TODO - handle this kind of things for non-360 platforms
canPlay = TRUE; canPlay = true;
canPlayLocal = TRUE; canPlayLocal = true;
isAtLeastOneFriend = TRUE; isAtLeastOneFriend = true;
cantPlayContentRestricted= FALSE; cantPlayContentRestricted= false;
#if ( defined __PS3__ || defined __ORBIS__ || defined __PSVITA__) #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; 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); 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; uiIDA[0]=IDS_CONFIRM_OK;
if(!isFriendsWithHost) ui.RequestMessageBox( IDS_CANTJOIN_TITLE, IDS_NOTALLOWED_FRIENDSOFFRIENDS, uiIDA,1,m_userIndex,NULL,NULL, app.GetStringTable()); 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()); 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 // All other players we use their offline XUID so that they can play the game offline
ProfileManager.GetXUID(m_userIndex,&offlineXUID,false); ProfileManager.GetXUID(m_userIndex,&offlineXUID,false);
} }
BOOL allAllowed, friendsAllowed; bool allAllowed = false;
bool friendsAllowed = false;
ProfileManager.AllowedPlayerCreatedContent(m_userIndex,true,&allAllowed,&friendsAllowed); ProfileManager.AllowedPlayerCreatedContent(m_userIndex,true,&allAllowed,&friendsAllowed);
fprintf(stderr, "[LOGIN] Sending LoginPacket: user=%ls netVer=%d userIdx=%d isHost=%d\n", 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()); 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 )))); packet->m_ugcPlayersVersion, app.GetPlayerSkinId(m_userIndex), app.GetPlayerCapeId(m_userIndex), ProfileManager.IsGuest( m_userIndex ))));
fprintf(stderr, "[LOGIN] LoginPacket sent successfully\n"); 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 // 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 // so that it can send it out to them when it comes in
if(packet->dwBytes==0) if(packet->dataBytes==0)
{ {
// Request for texture // Request for texture
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
wprintf(L"Client received request for custom texture %ls\n",packet->textureName.c_str()); wprintf(L"Client received request for custom texture %ls\n",packet->textureName.c_str());
#endif #endif
PBYTE pbData=NULL; std::uint8_t *pbData=NULL;
DWORD dwBytes=0; unsigned int dwBytes=0;
app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes); app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes);
if(dwBytes!=0) if(dwBytes!=0)
@ -2256,7 +2253,7 @@ void ClientConnection::handleTexture(std::shared_ptr<TexturePacket> packet)
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
wprintf(L"Client received custom texture %ls\n",packet->textureName.c_str()); wprintf(L"Client received custom texture %ls\n",packet->textureName.c_str());
#endif #endif
app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dwBytes); app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dataBytes);
Minecraft::GetInstance()->handleClientTextureReceived(packet->textureName); Minecraft::GetInstance()->handleClientTextureReceived(packet->textureName);
} }
} }
@ -2273,8 +2270,8 @@ void ClientConnection::handleTextureAndGeometry(std::shared_ptr<TextureAndGeomet
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
wprintf(L"Client received request for custom texture and geometry %ls\n",packet->textureName.c_str()); wprintf(L"Client received request for custom texture and geometry %ls\n",packet->textureName.c_str());
#endif #endif
PBYTE pbData=NULL; std::uint8_t *pbData=NULL;
DWORD dwBytes=0; unsigned int dwBytes=0;
app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes); app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes);
DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(packet->textureName); 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) else if (event == GameEventPacket::WIN_GAME)
{ {
ui.SetWinUserIndex( (BYTE)gameEventPacket->param ); ui.SetWinUserIndex(static_cast<unsigned int>(gameEventPacket->param));
#ifdef _XBOX #ifdef _XBOX
@ -3243,7 +3240,7 @@ void ClientConnection::handleUpdateProgress(std::shared_ptr<UpdateProgressPacket
void ClientConnection::handleUpdateGameRuleProgressPacket(std::shared_ptr<UpdateGameRuleProgressPacket> packet) 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) if(string != NULL)
{ {
std::wstring message(string); 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 // we need to ask if they are sure they want to overwrite the existing game
if(bSaveExists && StorageManager.GetSaveDisabled()) if(bSaveExists && StorageManager.GetSaveDisabled())
{ {
UINT uiIDA[2]; unsigned int uiIDA[2];
uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[0]=IDS_CONFIRM_CANCEL;
uiIDA[1]=IDS_CONFIRM_OK; uiIDA[1]=IDS_CONFIRM_OK;
ui.RequestMessageBox(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,NULL, app.GetStringTable()); 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 // we need to ask if they are sure they want to overwrite the existing game
if(bSaveExists) if(bSaveExists)
{ {
UINT uiIDA[2]; unsigned int uiIDA[2];
uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[0]=IDS_CONFIRM_CANCEL;
uiIDA[1]=IDS_CONFIRM_OK; uiIDA[1]=IDS_CONFIRM_OK;
ui.RequestMessageBox(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,NULL, app.GetStringTable()); ui.RequestMessageBox(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,NULL, app.GetStringTable());

View file

@ -41,7 +41,7 @@ public:
Socket *getSocket() { return connection->getSocket(); } // 4J Added Socket *getSocket() { return connection->getSocket(); } // 4J Added
private: private:
DWORD m_userIndex; // 4J Added int m_userIndex; // 4J Added
public: public:
SavedDataStorage *savedDataStorage; SavedDataStorage *savedDataStorage;
ClientConnection(Minecraft *minecraft, const std::wstring& ip, int port); ClientConnection(Minecraft *minecraft, const std::wstring& ip, int port);
@ -137,4 +137,4 @@ public:
virtual void handleXZ(std::shared_ptr<XZPacket> packet); virtual void handleXZ(std::shared_ptr<XZPacket> packet);
void displayPrivilegeChanges(std::shared_ptr<MultiplayerLocalPlayer> player, unsigned int oldPrivileges); void displayPrivilegeChanges(std::shared_ptr<MultiplayerLocalPlayer> player, unsigned int oldPrivileges);
}; };

View file

@ -1,4 +1,5 @@
#include "../Platform/stdafx.h" #include "../Platform/stdafx.h"
#include <cstdint>
#include "PendingConnection.h" #include "PendingConnection.h"
#include "PlayerConnection.h" #include "PlayerConnection.h"
#include "ServerConnection.h" #include "ServerConnection.h"
@ -94,9 +95,9 @@ void PendingConnection::sendPreLoginResponse()
{ {
// 4J Stu - Calculate the players with UGC privileges set // 4J Stu - Calculate the players with UGC privileges set
PlayerUID *ugcXuids = new PlayerUID[MINECRAFT_NET_MAX_PLAYERS]; PlayerUID *ugcXuids = new PlayerUID[MINECRAFT_NET_MAX_PLAYERS];
DWORD ugcXuidCount = 0; std::uint8_t ugcXuidCount = 0;
DWORD hostIndex = 0; std::uint8_t hostIndex = 0;
BYTE ugcFriendsOnlyBits = 0; std::uint8_t ugcFriendsOnlyBits = 0;
char szUniqueMapName[14]; char szUniqueMapName[14];
StorageManager.GetSaveUniqueFilename(szUniqueMapName); StorageManager.GetSaveUniqueFilename(szUniqueMapName);
@ -267,4 +268,4 @@ std::wstring PendingConnection::getName()
bool PendingConnection::isServerPacketListener() bool PendingConnection::isServerPacketListener()
{ {
return true; return true;
} }

View file

@ -796,14 +796,14 @@ void PlayerConnection::handleTexture(std::shared_ptr<TexturePacket> packet)
{ {
// Both PlayerConnection and ClientConnection should handle this mostly the same way // Both PlayerConnection and ClientConnection should handle this mostly the same way
if(packet->dwBytes==0) if(packet->dataBytes==0)
{ {
// Request for texture // Request for texture
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
wprintf(L"Server received request for custom texture %ls\n",packet->textureName.c_str()); wprintf(L"Server received request for custom texture %ls\n",packet->textureName.c_str());
#endif #endif
PBYTE pbData=NULL; std::uint8_t *pbData=NULL;
DWORD dwBytes=0; unsigned int dwBytes=0;
app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes); app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes);
if(dwBytes!=0) if(dwBytes!=0)
@ -821,7 +821,7 @@ void PlayerConnection::handleTexture(std::shared_ptr<TexturePacket> packet)
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
wprintf(L"Server received custom texture %ls\n",packet->textureName.c_str()); wprintf(L"Server received custom texture %ls\n",packet->textureName.c_str());
#endif #endif
app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dwBytes); app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dataBytes);
server->connection->handleTextureReceived(packet->textureName); server->connection->handleTextureReceived(packet->textureName);
} }
} }
@ -836,8 +836,8 @@ void PlayerConnection::handleTextureAndGeometry(std::shared_ptr<TextureAndGeomet
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
wprintf(L"Server received request for custom texture %ls\n",packet->textureName.c_str()); wprintf(L"Server received request for custom texture %ls\n",packet->textureName.c_str());
#endif #endif
PBYTE pbData=NULL; std::uint8_t *pbData=NULL;
DWORD dwTextureBytes=0; unsigned int dwTextureBytes=0;
app.GetMemFileDetails(packet->textureName,&pbData,&dwTextureBytes); app.GetMemFileDetails(packet->textureName,&pbData,&dwTextureBytes);
DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(packet->textureName); 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 )); AUTO_VAR(it, find( m_texturesRequested.begin(), m_texturesRequested.end(), textureName ));
if( it != m_texturesRequested.end() ) if( it != m_texturesRequested.end() )
{ {
PBYTE pbData=NULL; std::uint8_t *pbData=NULL;
DWORD dwBytes=0; unsigned int dwBytes=0;
app.GetMemFileDetails(textureName,&pbData,&dwBytes); app.GetMemFileDetails(textureName,&pbData,&dwBytes);
if(dwBytes!=0) 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 )); AUTO_VAR(it, find( m_texturesRequested.begin(), m_texturesRequested.end(), textureName ));
if( it != m_texturesRequested.end() ) if( it != m_texturesRequested.end() )
{ {
PBYTE pbData=NULL; std::uint8_t *pbData=NULL;
DWORD dwTextureBytes=0; unsigned int dwTextureBytes=0;
app.GetMemFileDetails(textureName,&pbData,&dwTextureBytes); app.GetMemFileDetails(textureName,&pbData,&dwTextureBytes);
DLCSkinFile *pDLCSkinFile=app.m_dlcManager.getSkinFile(textureName); DLCSkinFile *pDLCSkinFile=app.m_dlcManager.getSkinFile(textureName);
@ -932,7 +932,7 @@ void PlayerConnection::handleTextureAndGeometryReceived(const std::wstring &text
else else
{ {
// get the data from the app // 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); std::vector<SKIN_BOX *> *pvSkinBoxes = app.GetAdditionalSkinBoxes(dwSkinID);
unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(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 // 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->x = centreXC;
data->z = centreZC; data->z = centreZC;
data->dimension = (uint8_t) player->level->dimension->id; data->dimension = (std::uint8_t) player->level->dimension->id;
data->setDirty(); data->setDirty();
} }
@ -1714,4 +1714,4 @@ bool PlayerConnection::isGuest()
} }
return isGuest; return isGuest;
} }
} }

View file

@ -1,4 +1,5 @@
#include "../Platform/stdafx.h" #include "../Platform/stdafx.h"
#include <cstdint>
#include "PlayerList.h" #include "PlayerList.h"
#include "PlayerChunkMap.h" #include "PlayerChunkMap.h"
#include "../MinecraftServer.h" #include "../MinecraftServer.h"
@ -105,7 +106,7 @@ void PlayerList::placeNewPlayer(Connection *connection, std::shared_ptr<ServerPl
ServerLevel *level = server->getLevel(player->dimension); ServerLevel *level = server->getLevel(player->dimension);
DWORD playerIndex = 0; std::uint8_t playerIndex = 0;
{ {
bool usedIndexes[MINECRAFT_NET_MAX_PLAYERS]; bool usedIndexes[MINECRAFT_NET_MAX_PLAYERS];
ZeroMemory( &usedIndexes, MINECRAFT_NET_MAX_PLAYERS * sizeof(bool) ); ZeroMemory( &usedIndexes, MINECRAFT_NET_MAX_PLAYERS * sizeof(bool) );
@ -210,8 +211,8 @@ void PlayerList::placeNewPlayer(Connection *connection, std::shared_ptr<ServerPl
addPlayerToReceiving( player ); addPlayerToReceiving( player );
playerConnection->send( std::shared_ptr<LoginPacket>( new LoginPacket(L"", player->entityId, level->getLevelData()->getGenerator(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(), 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(), (std::uint8_t) level->dimension->id, (std::uint8_t) level->getMaxBuildHeight(), (std::uint8_t) getMaxPlayers(),
level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), (BYTE)playerIndex, level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(), level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), playerIndex, level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(),
level->getLevelData()->getXZSize(), level->getLevelData()->getHellScale() ) ) ); 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<SetSpawnPositionPacket>( new SetSpawnPositionPacket(spawnPos->x, spawnPos->y, spawnPos->z) ) );
playerConnection->send( std::shared_ptr<PlayerAbilitiesPacket>( new PlayerAbilitiesPacket(&player->abilities)) ); 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; serverPlayer->dimension = targetDimension;
EDefaultSkins skin = serverPlayer->getPlayerDefaultSkin(); EDefaultSkins skin = serverPlayer->getPlayerDefaultSkin();
DWORD playerIndex = serverPlayer->getPlayerIndex(); std::uint8_t playerIndex = serverPlayer->getPlayerIndex();
PlayerUID playerXuid = serverPlayer->getXuid(); PlayerUID playerXuid = serverPlayer->getXuid();
PlayerUID playerOnlineXuid = serverPlayer->getOnlineXuid(); PlayerUID playerOnlineXuid = serverPlayer->getOnlineXuid();
@ -846,7 +847,7 @@ void PlayerList::tick()
EnterCriticalSection(&m_closePlayersCS); EnterCriticalSection(&m_closePlayersCS);
while(!m_smallIdsToClose.empty()) while(!m_smallIdsToClose.empty())
{ {
BYTE smallId = m_smallIdsToClose.front(); std::uint8_t smallId = m_smallIdsToClose.front();
m_smallIdsToClose.pop_front(); m_smallIdsToClose.pop_front();
std::shared_ptr<ServerPlayer> player = nullptr; std::shared_ptr<ServerPlayer> player = nullptr;
@ -872,7 +873,7 @@ void PlayerList::tick()
EnterCriticalSection(&m_kickPlayersCS); EnterCriticalSection(&m_kickPlayersCS);
while(!m_smallIdsToKick.empty()) while(!m_smallIdsToKick.empty())
{ {
BYTE smallId = m_smallIdsToKick.front(); std::uint8_t smallId = m_smallIdsToKick.front();
m_smallIdsToKick.pop_front(); m_smallIdsToKick.pop_front();
INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId(smallId); INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId(smallId);
if( selectedPlayer != NULL ) if( selectedPlayer != NULL )
@ -1415,14 +1416,14 @@ bool PlayerList::canReceiveAllPackets(std::shared_ptr<ServerPlayer> player)
return false; return false;
} }
void PlayerList::kickPlayerByShortId(BYTE networkSmallId) void PlayerList::kickPlayerByShortId(std::uint8_t networkSmallId)
{ {
EnterCriticalSection(&m_kickPlayersCS); EnterCriticalSection(&m_kickPlayersCS);
m_smallIdsToKick.push_back(networkSmallId); m_smallIdsToKick.push_back(networkSmallId);
LeaveCriticalSection(&m_kickPlayersCS); LeaveCriticalSection(&m_kickPlayersCS);
} }
void PlayerList::closePlayerConnectionBySmallId(BYTE networkSmallId) void PlayerList::closePlayerConnectionBySmallId(std::uint8_t networkSmallId)
{ {
EnterCriticalSection(&m_closePlayersCS); EnterCriticalSection(&m_closePlayersCS);
m_smallIdsToClose.push_back(networkSmallId); m_smallIdsToClose.push_back(networkSmallId);

View file

@ -1,4 +1,5 @@
#pragma once #pragma once
#include <cstdint>
#include <deque> #include <deque>
#include "../../Minecraft.World/Util/ArrayWithLength.h" #include "../../Minecraft.World/Util/ArrayWithLength.h"
@ -30,9 +31,9 @@ private:
// 4J Added // 4J Added
std::vector<PlayerUID> m_bannedXuids; std::vector<PlayerUID> m_bannedXuids;
std::deque<BYTE> m_smallIdsToKick; std::deque<std::uint8_t> m_smallIdsToKick;
CRITICAL_SECTION m_kickPlayersCS; CRITICAL_SECTION m_kickPlayersCS;
std::deque<BYTE> m_smallIdsToClose; std::deque<std::uint8_t> m_smallIdsToClose;
CRITICAL_SECTION m_closePlayersCS; CRITICAL_SECTION m_closePlayersCS;
/* 4J - removed /* 4J - removed
Set<String> bans = new HashSet<String>(); Set<String> bans = new HashSet<String>();
@ -119,8 +120,8 @@ public:
void setAllowCheatsForAllPlayers(bool allowCommands); void setAllowCheatsForAllPlayers(bool allowCommands);
// 4J Added // 4J Added
void kickPlayerByShortId(BYTE networkSmallId); void kickPlayerByShortId(std::uint8_t networkSmallId);
void closePlayerConnectionBySmallId(BYTE networkSmallId); void closePlayerConnectionBySmallId(std::uint8_t networkSmallId);
bool isXuidBanned(PlayerUID xuid); bool isXuidBanned(PlayerUID xuid);
// AP added for Vita so the range can be increased once the level starts // AP added for Vita so the range can be increased once the level starts
void setViewDistance(int newViewDistance); void setViewDistance(int newViewDistance);

View file

@ -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 *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::Event *notificationEvent[3]; // These are signalled by the threads to let us know they are complete
C4JThread *saveThreads[3]; C4JThread *saveThreads[3];
DWORD threadId[3];
SaveThreadData threadData[3]; SaveThreadData threadData[3];
ZeroMemory(&threadData[0], sizeof(SaveThreadData)); ZeroMemory(&threadData[0], sizeof(SaveThreadData));
ZeroMemory(&threadData[1], sizeof(SaveThreadData)); ZeroMemory(&threadData[1], sizeof(SaveThreadData));
@ -687,7 +686,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener)
} }
LevelChunk *chunk = NULL; LevelChunk *chunk = NULL;
uint8_t workingThreads; std::uint8_t workingThreads;
bool chunkSet = false; bool chunkSet = false;
// Created a roughly sorted list to match the order that the files were created in McRegionChunkStorage::McRegionChunkStorage. // 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]; char threadName[256];
sprintf(threadName,"Save thread %d\n",j); 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] = CreateThread(NULL,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]);
saveThreads[j] = new C4JThread(runSaveThreadProc,(void *)&threadData[j],threadName); 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); 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) if(params->useSharedThreadStorage)
{ {

View file

@ -97,5 +97,5 @@ private:
} SaveThreadData; } SaveThreadData;
public: public:
static int runSaveThreadProc(LPVOID lpParam); static int runSaveThreadProc(void *lpParam);
}; };

View file

@ -1,28 +1,30 @@
#pragma once #pragma once
#include <cstdint>
typedef struct typedef struct
{ {
wchar_t *wchFilename; wchar_t *wchFilename;
eFileExtensionType eEXT; eFileExtensionType eEXT;
eTMSFileType eTMSType; eTMSFileType eTMSType;
PBYTE pbData; std::uint8_t *pbData;
UINT uiSize; unsigned int uiSize;
int iConfig; // used for texture pack data files int iConfig; // used for texture pack data files
} }
TMS_FILE; TMS_FILE;
typedef struct typedef struct
{ {
PBYTE pbData; std::uint8_t *pbData;
DWORD dwBytes; unsigned int dwBytes;
BYTE ucRefCount; std::uint8_t ucRefCount;
} }
MEMDATA,*PMEMDATA; MEMDATA,*PMEMDATA;
typedef struct typedef struct
{ {
DWORD dwNotification; unsigned int dwNotification;
UINT uiParam; unsigned int uiParam;
} }
NOTIFICATION,*PNOTIFICATION; NOTIFICATION,*PNOTIFICATION;
@ -60,7 +62,7 @@ typedef struct
// adding new flags for interim TU to 1.6.6 // adding new flags for interim TU to 1.6.6
// A value that encodes the skin that the player has set as their default // A value that encodes the skin that the player has set as their default
DWORD dwSelectedSkin; std::uint32_t dwSelectedSkin;
// In-Menu sensitivity // In-Menu sensitivity
unsigned char ucMenuSensitivity; unsigned char ucMenuSensitivity;
@ -90,7 +92,7 @@ typedef struct
unsigned int uiSpecialTutorialBitmask; unsigned int uiSpecialTutorialBitmask;
// A value that encodes the cape that the player has set // A value that encodes the cape that the player has set
DWORD dwSelectedCape; std::uint32_t dwSelectedCape;
unsigned int uiFavoriteSkinA[MAX_FAVORITE_SKINS]; unsigned int uiFavoriteSkinA[MAX_FAVORITE_SKINS];
unsigned char ucCurrentFavoriteSkinPos; unsigned char ucCurrentFavoriteSkinPos;
@ -142,7 +144,7 @@ XuiActionParam;
typedef struct typedef struct
{ {
int iSortValue; int iSortValue;
UINT uiStringID; int uiStringID;
} }
TIPSTRUCT; TIPSTRUCT;
@ -168,8 +170,8 @@ typedef struct
std::wstring wsDisplayName; std::wstring wsDisplayName;
// add a store for the local DLC image // add a store for the local DLC image
PBYTE pbImageData; std::uint8_t *pbImageData;
DWORD dwImageBytes; unsigned int dwImageBytes;
#else #else
ULONGLONG ullOfferID_Full; ULONGLONG ullOfferID_Full;
ULONGLONG ullOfferID_Trial; ULONGLONG ullOfferID_Trial;
@ -194,14 +196,14 @@ FEATURE_DATA;
// banned list // banned list
typedef struct typedef struct
{ {
BYTE *pBannedList; std::uint8_t *pBannedList;
DWORD dwBytes; unsigned int dwBytes;
} }
BANNEDLIST; BANNEDLIST;
typedef struct _DLCRequest typedef struct _DLCRequest
{ {
DWORD dwType; std::uint32_t dwType;
eDLCContentState eState; eDLCContentState eState;
} }
DLCRequest; DLCRequest;
@ -214,13 +216,13 @@ typedef struct _TMSPPRequest
C4JStorage::eTMS_FILETYPEVAL eFileTypeVal; C4JStorage::eTMS_FILETYPEVAL eFileTypeVal;
//char szFilename[MAX_TMSFILENAME_SIZE]; //char szFilename[MAX_TMSFILENAME_SIZE];
#ifdef _XBOX_ONE #ifdef _XBOX_ONE
int( *CallbackFunc)(LPVOID,int,int,LPVOID, WCHAR *); int( *CallbackFunc)(void *,int,int,void *, WCHAR *);
#else #else
int( *CallbackFunc)(LPVOID,int,int,C4JStorage::PTMSPP_FILEDATA, LPCSTR szFilename); int( *CallbackFunc)(void *,int,int,C4JStorage::PTMSPP_FILEDATA, LPCSTR szFilename);
#endif #endif
WCHAR wchFilename[MAX_TMSFILENAME_SIZE]; WCHAR wchFilename[MAX_TMSFILENAME_SIZE];
LPVOID lpCallbackParam; void *lpCallbackParam;
} }
TMSPPRequest; TMSPPRequest;

View file

@ -146,7 +146,7 @@ private:
int m_MusicType; int m_MusicType;
AUDIO_INFO m_StreamingAudioInfo; AUDIO_INFO m_StreamingAudioInfo;
std::wstring m_CDMusic; std::wstring m_CDMusic;
BOOL m_bSystemMusicPlaying; bool m_bSystemMusicPlaying;
float m_MasterMusicVolume; float m_MasterMusicVolume;
float m_MasterEffectsVolume; float m_MasterEffectsVolume;

View file

@ -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 // 4J Stu - Default the colours that of the table passed in
XMemCpy( (void *)m_colourValues, (void *)defaultColours->m_colourValues, sizeof(int) * eMinecraftColour_COUNT); 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); ByteArrayInputStream bais(src);
DataInputStream dis(&bais); DataInputStream dis(&bais);

View file

@ -1,4 +1,5 @@
#pragma once #pragma once
#include <cstdint>
class ColourTable class ColourTable
{ {
@ -11,13 +12,13 @@ private:
public: public:
static void staticCtor(); static void staticCtor();
ColourTable(PBYTE pbData, DWORD dwLength); ColourTable(std::uint8_t *pbData, std::uint32_t dataLength);
ColourTable(ColourTable *defaultColours, PBYTE pbData, DWORD dwLength); ColourTable(ColourTable *defaultColours, std::uint8_t *pbData, std::uint32_t dataLength);
unsigned int getColour(eMinecraftColour id); unsigned int getColour(eMinecraftColour id);
unsigned int getColor(eMinecraftColour id) { return getColour(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, int value);
void setColour(const std::wstring &colourName, const std::wstring &value); void setColour(const std::wstring &colourName, const std::wstring &value);
}; };

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,7 @@
#pragma once #pragma once
#include <cstdint>
//using namespace std; //using namespace std;
#include "Audio/Consoles_SoundEngine.h" #include "Audio/Consoles_SoundEngine.h"
@ -28,8 +30,8 @@
typedef struct _JoinFromInviteData typedef struct _JoinFromInviteData
{ {
DWORD dwUserIndex; // dwUserIndex std::uint32_t dwUserIndex; // dwUserIndex
DWORD dwLocalUsersMask; // dwUserMask std::uint32_t dwLocalUsersMask; // dwUserMask
const INVITE_INFO *pInviteInfo; // pInviteInfo const INVITE_INFO *pInviteInfo; // pInviteInfo
} }
JoinFromInviteData; JoinFromInviteData;
@ -124,7 +126,7 @@ public:
bool IsAppPaused(); bool IsAppPaused();
void SetAppPaused(bool val); 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;} 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;} void SetGameStarted(bool bVal) { if(bVal) DebugPrintf("SetGameStarted - true\n"); else DebugPrintf("SetGameStarted - false\n"); m_bGameStarted = bVal; m_bIsAppPaused = !bVal;}
int GetLocalPlayerCount(void); int GetLocalPlayerCount(void);
@ -146,7 +148,7 @@ public:
void SetSpecialTutorialCompletionFlag(int iPad, int index); void SetSpecialTutorialCompletionFlag(int iPad, int index);
static LPCWSTR GetString(int iID); static const wchar_t * GetString(int iID);
eGameMode GetGameMode() { return m_eGameMode;} eGameMode GetGameMode() { return m_eGameMode;}
void SetGameMode(eGameMode eMode) { m_eGameMode=eMode;} void SetGameMode(eGameMode eMode) { m_eGameMode=eMode;}
@ -154,12 +156,12 @@ public:
eXuiAction GetGlobalXuiAction() {return m_eGlobalXuiAction;} eXuiAction GetGlobalXuiAction() {return m_eGlobalXuiAction;}
void SetGlobalXuiAction(eXuiAction action) {m_eGlobalXuiAction=action;} void SetGlobalXuiAction(eXuiAction action) {m_eGlobalXuiAction=action;}
eXuiAction GetXuiAction(int iPad) {return m_eXuiAction[iPad];} 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; } void SetTMSAction(int iPad, eTMSAction action) {m_eTMSAction[iPad]=action; }
eTMSAction GetTMSAction(int iPad) {return m_eTMSAction[iPad];} eTMSAction GetTMSAction(int iPad) {return m_eTMSAction[iPad];}
eXuiServerAction GetXuiServerAction(int iPad) {return m_eXuiServerAction[iPad];} eXuiServerAction GetXuiServerAction(int iPad) {return m_eXuiServerAction[iPad];}
LPVOID GetXuiServerActionParam(int iPad) {return m_eXuiServerActionParam[iPad];} void * 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 SetXuiServerAction(int iPad, eXuiServerAction action, void *param = nullptr) {m_eXuiServerAction[iPad]=action; m_eXuiServerActionParam[iPad] = param;}
eXuiServerAction GetGlobalXuiServerAction() {return m_eGlobalXuiServerAction;} eXuiServerAction GetGlobalXuiServerAction() {return m_eGlobalXuiServerAction;}
void SetGlobalXuiServerAction(eXuiServerAction action) {m_eGlobalXuiServerAction=action;} 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 // 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); void HandleXuiActions(void);
// 4J Stu - Functions used for Minecon and other promo work // 4J Stu - Functions used for Minecon and other promo work
@ -206,23 +208,23 @@ public:
//void GetPreviewImage(int iPad,XSOCIAL_PREVIEWIMAGE *preview); //void GetPreviewImage(int iPad,XSOCIAL_PREVIEWIMAGE *preview);
void InitGameSettings(); 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__ ) #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); int SetDefaultOptions(C4JStorage::PROFILESETTINGS *pSettings,const int iPad,bool bWriteProfile=true);
#ifdef __ORBIS__ #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); int GetOptionsBlocksRequired(int iPad);
#else #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 #endif
C4JStorage::eOptionsCallback GetOptionsCallbackStatus(int iPad); C4JStorage::eOptionsCallback GetOptionsCallbackStatus(int iPad);
void SetOptionsCallbackStatus(int iPad, C4JStorage::eOptionsCallback eStatus); void SetOptionsCallbackStatus(int iPad, C4JStorage::eOptionsCallback eStatus);
#else #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); int SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,const int iPad);
#endif #endif
virtual void SetRichPresenceContext(int iPad, int contextId) = 0; virtual void SetRichPresenceContext(int iPad, int contextId) = 0;
@ -232,9 +234,9 @@ public:
unsigned char GetGameSettings(int iPad,eGameSetting eVal); unsigned char GetGameSettings(int iPad,eGameSetting eVal);
unsigned char GetGameSettings(eGameSetting eVal); // for the primary pad unsigned char GetGameSettings(eGameSetting eVal); // for the primary pad
void SetPlayerSkin(int iPad,const std::wstring &name); 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,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); void SetPlayerFavoriteSkin(int iPad, int iIndex,unsigned int uiSkinID);
unsigned int GetPlayerFavoriteSkin(int iPad,int iIndex); unsigned int GetPlayerFavoriteSkin(int iPad,int iIndex);
unsigned char GetPlayerFavoriteSkinsPos(int iPad); unsigned char GetPlayerFavoriteSkinsPos(int iPad);
@ -259,10 +261,10 @@ public:
public: public:
std::wstring GetPlayerSkinName(int iPad); std::wstring GetPlayerSkinName(int iPad);
DWORD GetPlayerSkinId(int iPad); std::uint32_t GetPlayerSkinId(int iPad);
std::wstring GetPlayerCapeName(int iPad); std::wstring GetPlayerCapeName(int iPad);
DWORD GetPlayerCapeId(int iPad); std::uint32_t GetPlayerCapeId(int iPad);
DWORD GetAdditionalModelParts(int iPad); std::uint32_t GetAdditionalModelParts(int iPad);
void CheckGameSettingsChanged(bool bOverride5MinuteTimer=false, int iPad=XUSER_INDEX_ANY); void CheckGameSettingsChanged(bool bOverride5MinuteTimer=false, int iPad=XUSER_INDEX_ANY);
void ApplyGameSettingsChanged(int iPad); void ApplyGameSettingsChanged(int iPad);
void ClearGameSettingsChangedFlag(int iPad); void ClearGameSettingsChangedFlag(int iPad);
@ -275,7 +277,7 @@ public:
bool IsLocalMultiplayerAvailable(); bool IsLocalMultiplayerAvailable();
// for sign in change monitoring // 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 void ClearSignInChangeUsersMask();
static int SignoutExitWorldThreadProc( void* lpParameter ); static int SignoutExitWorldThreadProc( void* lpParameter );
static int PrimaryPlayerSignedOutReturned(void *pParam, int iPad, const C4JStorage::EMessageResult); static int PrimaryPlayerSignedOutReturned(void *pParam, int iPad, const C4JStorage::EMessageResult);
@ -286,14 +288,14 @@ public:
virtual void FatalLoadError(); virtual void FatalLoadError();
// Notifications from the game listener to be passed to the qnet listener // 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 // for the ethernet being disconnected
static void LiveLinkChangeCallback(LPVOID pParam,BOOL bConnected); static void LiveLinkChangeCallback(void *pParam,BOOL bConnected);
bool GetLiveLinkRequired() {return m_bLiveLinkRequired;} bool GetLiveLinkRequired() {return m_bLiveLinkRequired;}
void SetLiveLinkRequired(bool required) {m_bLiveLinkRequired=required;} 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__ #if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__
static int NowDisplayFullVersionPurchase(void *pParam, bool bContinue, int iPad); static int NowDisplayFullVersionPurchase(void *pParam, bool bContinue, int iPad);
@ -309,21 +311,21 @@ public:
bool DebugSettingsOn() { return false;} bool DebugSettingsOn() { return false;}
#endif #endif
void SetDebugSequence(const char *pchSeq); 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 ); //bool UploadFileToGlobalStorage(int iQuadrant, C4JStorage::eGlobalStorage eStorageFacility, std::wstring *wsFile );
// Installed DLC // Installed DLC
bool StartInstallDLCProcess(int iPad); bool StartInstallDLCProcess(int iPad);
static int DLCInstalledCallback(LPVOID pParam,int iOfferC,int iPad); static int DLCInstalledCallback(void *pParam,int iOfferC,int iPad);
void HandleDLCLicenseChange(); 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); void MountNextDLC(int iPad);
//static int DLCReadCallback(LPVOID pParam,C4JStorage::DLC_FILE_DETAILS *pDLCData); //static int DLCReadCallback(LPVOID pParam,C4JStorage::DLC_FILE_DETAILS *pDLCData);
void HandleDLC(DLCPack *pack); void HandleDLC(DLCPack *pack);
bool DLCInstallPending() {return m_bDLCInstallPending;} bool DLCInstallPending() {return m_bDLCInstallPending;}
bool DLCInstallProcessCompleted() {return m_bDLCInstallProcessCompleted;} bool DLCInstallProcessCompleted() {return m_bDLCInstallProcessCompleted;}
void ClearDLCInstalled() { m_bDLCInstallProcessCompleted=false;} 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); bool AlreadySeenCreditText(const std::wstring &wstemp);
@ -339,16 +341,16 @@ public:
bool isXuidNotch(PlayerUID xuid); bool isXuidNotch(PlayerUID xuid);
bool isXuidDeadmau5(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 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); bool IsFileInMemoryTextures(const std::wstring &wName);
// Texture Pack Data files (icon, banner, comparison shot & text) // 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); void RemoveMemoryTPDFile(int iConfig);
bool IsFileInTPD(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();} int GetTPDSize() {return m_MEM_TPD.size();}
#ifndef __PS3__ #ifndef __PS3__
int GetTPConfigVal(WCHAR *pwchDataFile); int GetTPConfigVal(WCHAR *pwchDataFile);
@ -359,17 +361,17 @@ public:
// invites // invites
//void ProcessInvite(JoinFromInviteData *pJoinData); //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 // Add credits for DLC installed
void AddCreditText(LPCWSTR lpStr); void AddCreditText(const wchar_t *lpStr);
private: private:
PlayerUID m_xuidNotch; PlayerUID m_xuidNotch;
#ifdef _DURANGO #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 #else
std::unordered_map<PlayerUID, PBYTE> m_GTS_Files; std::unordered_map<PlayerUID, std::uint8_t *> m_GTS_Files;
#endif #endif
// for storing memory textures - player skin // for storing memory textures - player skin
@ -383,8 +385,8 @@ private:
public: public:
// launch data // launch data
BYTE* m_pLaunchData; std::uint8_t *m_pLaunchData;
DWORD m_dwLaunchDataSize; unsigned int m_dwLaunchDataSize;
public: public:
// BAN LIST // BAN LIST
@ -503,10 +505,10 @@ private:
// we'll action these at the end of the game loop // we'll action these at the end of the game loop
eXuiAction m_eXuiAction[XUSER_MAX_COUNT]; eXuiAction m_eXuiAction[XUSER_MAX_COUNT];
eTMSAction m_eTMSAction[XUSER_MAX_COUNT]; eTMSAction m_eTMSAction[XUSER_MAX_COUNT];
LPVOID m_eXuiActionParam[XUSER_MAX_COUNT]; void *m_eXuiActionParam[XUSER_MAX_COUNT];
eXuiAction m_eGlobalXuiAction; eXuiAction m_eGlobalXuiAction;
eXuiServerAction m_eXuiServerAction[XUSER_MAX_COUNT]; eXuiServerAction m_eXuiServerAction[XUSER_MAX_COUNT];
LPVOID m_eXuiServerActionParam[XUSER_MAX_COUNT]; void *m_eXuiServerActionParam[XUSER_MAX_COUNT];
eXuiServerAction m_eGlobalXuiServerAction; eXuiServerAction m_eGlobalXuiServerAction;
bool m_bLiveLinkRequired; bool m_bLiveLinkRequired;
@ -547,7 +549,7 @@ protected:
static Random *TipRandom; static Random *TipRandom;
public: public:
void InitialiseTips(); void InitialiseTips();
UINT GetNextTip(); int GetNextTip();
int GetHTMLColour(eMinecraftColour colour); int GetHTMLColour(eMinecraftColour colour);
int GetHTMLColor(eMinecraftColour colour) { return GetHTMLColour(colour); } int GetHTMLColor(eMinecraftColour colour) { return GetHTMLColour(colour); }
int GetHTMLFontSize(EHTMLFontSize size); int GetHTMLFontSize(EHTMLFontSize size);
@ -560,11 +562,11 @@ public:
void UpdateTrialPausedTimer() { mfTrialPausedTime+= m_Time.fElapsedTime;} void UpdateTrialPausedTimer() { mfTrialPausedTime+= m_Time.fElapsedTime;}
static int RemoteSaveThreadProc( void* lpParameter ); 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); static int ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
private: private:
UINT m_TipIDA[MAX_TIPS_GAMETIP+MAX_TIPS_TRIVIATIP]; int m_TipIDA[MAX_TIPS_GAMETIP+MAX_TIPS_TRIVIATIP];
UINT m_uiCurrentTip; unsigned int m_uiCurrentTip;
static int TipsSortFunction(const void* a, const void* b); static int TipsSortFunction(const void* a, const void* b);
// XML // XML
@ -608,9 +610,9 @@ public:
// images for save thumbnail/social post // images for save thumbnail/social post
virtual void CaptureSaveThumbnail() =0; 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 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; virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false)=0;
@ -703,8 +705,8 @@ public:
bool CanRecordStatsAndAchievements(); bool CanRecordStatsAndAchievements();
// World seed from png image // World seed from png image
void GetImageTextData(PBYTE pbImageData, DWORD dwImageBytes,unsigned char *pszSeed,unsigned int &uiHostOptions,bool &bHostOptionsRead,DWORD &uiTexturePack); void GetImageTextData(std::uint8_t *imageData, unsigned int imageBytes, unsigned char *seedText, unsigned int &uiHostOptions, bool &bHostOptionsRead, std::uint32_t &uiTexturePack);
unsigned int CreateImageTextData(PBYTE bTextMetadata, __int64 seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId); unsigned int CreateImageTextData(std::uint8_t *textMetadata, __int64 seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId);
// Game rules // Game rules
GameRuleManager m_gameRules; GameRuleManager m_gameRules;
@ -717,16 +719,16 @@ public:
void setLevelGenerationOptions(LevelGenerationOptions *levelGen); void setLevelGenerationOptions(LevelGenerationOptions *levelGen);
LevelRuleset *getGameRuleDefinitions() { return m_gameRules.getGameRuleDefinitions(); } LevelRuleset *getGameRuleDefinitions() { return m_gameRules.getGameRuleDefinitions(); }
LevelGenerationOptions *getLevelGenerationOptions() { return m_gameRules.getLevelGenerationOptions(); } LevelGenerationOptions *getLevelGenerationOptions() { return m_gameRules.getLevelGenerationOptions(); }
LPCWSTR GetGameRulesString(const std::wstring &key); const wchar_t *GetGameRulesString(const std::wstring &key);
private: 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]; unsigned int m_playerGamePrivileges[MINECRAFT_NET_MAX_PLAYERS];
public: public:
void UpdatePlayerInfo(BYTE networkSmallId, SHORT playerColourIndex, unsigned int playerGamePrivileges); void UpdatePlayerInfo(std::uint8_t networkSmallId, SHORT playerColourIndex, unsigned int playerGamePrivileges);
short GetPlayerColour(BYTE networkSmallId); short GetPlayerColour(std::uint8_t networkSmallId);
unsigned int GetPlayerPrivileges(BYTE networkSmallId); unsigned int GetPlayerPrivileges(std::uint8_t networkSmallId);
std::wstring getEntityName(eINSTANCEOF type); std::wstring getEntityName(eINSTANCEOF type);
@ -735,9 +737,9 @@ public:
unsigned int AddDLCRequest(eDLCMarketplaceType eContentType, bool bPromote=false); unsigned int AddDLCRequest(eDLCMarketplaceType eContentType, bool bPromote=false);
bool RetrieveNextDLCContent(); bool RetrieveNextDLCContent();
bool CheckTMSDLCCanStop(); bool CheckTMSDLCCanStop();
static int DLCOffersReturned(void *pParam, int iOfferC, DWORD dwType, int iPad); static int DLCOffersReturned(void *pParam, int iOfferC, std::uint32_t dwType, int iPad);
DWORD GetDLCContentType(eDLCContentType eType) { return m_dwContentTypeA[eType];} std::uint32_t GetDLCContentType(eDLCContentType eType) { return m_dwContentTypeA[eType];}
eDLCContentType Find_eDLCContentType(DWORD dwType); eDLCContentType Find_eDLCContentType(std::uint32_t dwType);
int GetDLCOffersCount() { return m_iDLCOfferC;} int GetDLCOffersCount() { return m_iDLCOfferC;}
bool DLCContentRetrieved(eDLCMarketplaceType eType); bool DLCContentRetrieved(eDLCMarketplaceType eType);
void TickDLCOffersRetrieved(); void TickDLCOffersRetrieved();
@ -757,10 +759,10 @@ public:
#else #else
#ifdef _XBOX_ONE #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(); std::unordered_map<std::wstring,DLC_INFO * > *GetDLCInfo();
#else #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 #endif
DLC_INFO *GetDLCInfoTrialOffer(int iIndex); DLC_INFO *GetDLCInfoTrialOffer(int iIndex);
DLC_INFO *GetDLCInfoFullOffer(int iIndex); DLC_INFO *GetDLCInfoFullOffer(int iIndex);
@ -790,7 +792,7 @@ private:
//Request current_download; //Request current_download;
std::vector<DLCRequest *> m_DLCDownloadQueue; std::vector<DLCRequest *> m_DLCDownloadQueue;
std::vector<TMSPPRequest *> m_TMSPPDownloadQueue; std::vector<TMSPPRequest *> m_TMSPPDownloadQueue;
static DWORD m_dwContentTypeA[e_Marketplace_MAX]; static std::uint32_t m_dwContentTypeA[e_Marketplace_MAX];
int m_iDLCOfferC; int m_iDLCOfferC;
bool m_bAllDLCContentRetrieved; bool m_bAllDLCContentRetrieved;
bool m_bAllTMSContentRetrieved; bool m_bAllTMSContentRetrieved;
@ -802,29 +804,29 @@ private:
CRITICAL_SECTION csAnimOverrideBitmask; CRITICAL_SECTION csAnimOverrideBitmask;
bool m_bCorruptSaveDeleted; bool m_bCorruptSaveDeleted;
DWORD m_dwAdditionalModelParts[XUSER_MAX_COUNT]; std::uint32_t m_dwAdditionalModelParts[XUSER_MAX_COUNT];
BYTE *m_pBannedListFileBuffer; std::uint8_t *m_pBannedListFileBuffer;
DWORD m_dwBannedListFileSize; unsigned int m_dwBannedListFileSize;
public: public:
DWORD m_dwDLCFileSize; unsigned int m_dwDLCFileSize;
BYTE *m_pDLCFileBuffer; std::uint8_t *m_pDLCFileBuffer;
// static int CallbackReadXuidsFileFromTMS(LPVOID lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction); // 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 CallbackDLCFileFromTMS(LPVOID lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction);
// static int CallbackBannedListFileFromTMS(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 // Storing additional model parts per skin texture
void SetAdditionalSkinBoxes(DWORD dwSkinID, SKIN_BOX *SkinBoxA, DWORD dwSkinBoxC); void SetAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX *SkinBoxA, unsigned int dwSkinBoxC);
std::vector<ModelPart *> * SetAdditionalSkinBoxes(DWORD dwSkinID, std::vector<SKIN_BOX *> *pvSkinBoxA); std::vector<ModelPart *> * SetAdditionalSkinBoxes(std::uint32_t dwSkinID, std::vector<SKIN_BOX *> *pvSkinBoxA);
std::vector<ModelPart *> *GetAdditionalModelParts(DWORD dwSkinID); std::vector<ModelPart *> *GetAdditionalModelParts(std::uint32_t dwSkinID);
std::vector<SKIN_BOX *> *GetAdditionalSkinBoxes(DWORD dwSkinID); std::vector<SKIN_BOX *> *GetAdditionalSkinBoxes(std::uint32_t dwSkinID);
void SetAnimOverrideBitmask(DWORD dwSkinID,unsigned int uiAnimOverrideBitmask); void SetAnimOverrideBitmask(std::uint32_t dwSkinID,unsigned int uiAnimOverrideBitmask);
unsigned int GetAnimOverrideBitmask(DWORD dwSkinID); unsigned int GetAnimOverrideBitmask(std::uint32_t dwSkinID);
static DWORD getSkinIdFromPath(const std::wstring &skin); static std::uint32_t getSkinIdFromPath(const std::wstring &skin);
static std::wstring getSkinPathFromId(DWORD skinId); static std::wstring getSkinPathFromId(std::uint32_t skinId);
virtual int LoadLocalTMSFile(WCHAR *wchTMSFile)=0; virtual int LoadLocalTMSFile(WCHAR *wchTMSFile)=0;
virtual int LoadLocalTMSFile(WCHAR *wchTMSFile, eFileExtensionType eExt)=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 SetBanListRead(int iPad,bool bVal) { m_bRead_BannedListA[iPad]=bVal;}
void ClearBanList(int iPad) { BannedListA[iPad].pBannedList=NULL;BannedListA[iPad].dwBytes=0;} void ClearBanList(int iPad) { BannedListA[iPad].pBannedList=NULL;BannedListA[iPad].dwBytes=0;}
DWORD GetRequiredTexturePackID() {return m_dwRequiredTexturePackID;} std::uint32_t GetRequiredTexturePackID() { return m_dwRequiredTexturePackID; }
void SetRequiredTexturePackID(DWORD dwID) {m_dwRequiredTexturePackID=dwID;} 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; } //XTITLE_DEPLOYMENT_TYPE getDeploymentType() { return m_titleDeploymentType; }
private: private:
// vector of additional skin model parts, indexed by the skin texture id // vector of additional skin model parts, indexed by the skin texture id
std::unordered_map<DWORD, std::vector<ModelPart *> *> m_AdditionalModelParts; std::unordered_map<std::uint32_t, std::vector<ModelPart *> *> m_AdditionalModelParts;
std::unordered_map<DWORD, std::vector<SKIN_BOX *> *> m_AdditionalSkinBoxes; std::unordered_map<std::uint32_t, std::vector<SKIN_BOX *> *> m_AdditionalSkinBoxes;
std::unordered_map<DWORD, unsigned int> m_AnimOverrides; std::unordered_map<std::uint32_t, unsigned int> m_AnimOverrides;
bool m_bResetNether; bool m_bResetNether;
DWORD m_dwRequiredTexturePackID; std::uint32_t m_dwRequiredTexturePackID;
#ifdef _XBOX_ONE #ifdef _XBOX_ONE
std::vector <PBYTE> m_vTMSPPData; std::vector<std::uint8_t *> m_vTMSPPData;
#endif #endif
#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__)
@ -873,18 +875,18 @@ public:
void LocaleAndLanguageInit(); void LocaleAndLanguageInit();
void getLocale(std::vector<std::wstring> &vecWstrLocales); void getLocale(std::vector<std::wstring> &vecWstrLocales);
DWORD get_eMCLang(WCHAR *pwchLocale); int get_eMCLang(WCHAR *pwchLocale);
DWORD get_xcLang(WCHAR *pwchLocale); int get_xcLang(WCHAR *pwchLocale);
void SetTickTMSDLCFiles(bool bVal); 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: private:
std::unordered_map<int, std::wstring>m_localeA; std::unordered_map<int, std::wstring>m_localeA;
std::unordered_map<std::wstring, int>m_eMCLangA; std::unordered_map<std::wstring, int>m_eMCLangA;
std::unordered_map<std::wstring, int>m_xcLangA; 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: public:
#ifdef _XBOX #ifdef _XBOX

View file

@ -1,4 +1,7 @@
#include "../../Minecraft.World/Platform/stdafx.h" #include "../../Minecraft.World/Platform/stdafx.h"
#include <cstddef>
#include <cstdint>
#include <cstring>
#include "DLCManager.h" #include "DLCManager.h"
#include "DLCAudioFile.h" #include "DLCAudioFile.h"
#if defined _XBOX || defined _WINDOWS64 #if defined _XBOX || defined _WINDOWS64
@ -6,23 +9,81 @@
#include "../../Minecraft.Client/Platform/Xbox/XML/xmlFilesCallback.h" #include "../../Minecraft.Client/Platform/Xbox/XML/xmlFilesCallback.h"
#endif #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) DLCAudioFile::DLCAudioFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_Audio,path)
{ {
m_pbData = NULL; 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_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; return m_pbData;
} }
@ -36,7 +97,7 @@ DLCAudioFile::EAudioParameterType DLCAudioFile::getParameterType(const std::wstr
{ {
EAudioParameterType type = e_AudioParamType_Invalid; 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) 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; std::unordered_map<int, EAudioParameterType> parameterMapping;
unsigned int uiCurrentByte=0; unsigned int uiCurrentByte=0;
@ -128,7 +189,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
// File format defined in the AudioPacker // File format defined in the AudioPacker
// File format: Version 1 // File format: Version 1
unsigned int uiVersion=*(unsigned int *)pbData; unsigned int uiVersion = ReadAudioDlcValue<unsigned int>(pbData, uiCurrentByte);
uiCurrentByte+=sizeof(int); uiCurrentByte+=sizeof(int);
if(uiVersion < CURRENT_AUDIO_VERSION_NUM) if(uiVersion < CURRENT_AUDIO_VERSION_NUM)
@ -138,60 +199,62 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
return false; return false;
} }
unsigned int uiParameterTypeCount=*(unsigned int *)&pbData[uiCurrentByte]; unsigned int uiParameterTypeCount = ReadAudioDlcValue<unsigned int>(pbData, uiCurrentByte);
uiCurrentByte+=sizeof(int); uiCurrentByte+=sizeof(int);
C4JStorage::DLC_FILE_PARAM *pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte]; C4JStorage::DLC_FILE_PARAM paramBuf;
ReadAudioDlcStruct(&paramBuf, pbData, uiCurrentByte);
for(unsigned int i=0;i<uiParameterTypeCount;i++) for(unsigned int i=0;i<uiParameterTypeCount;i++)
{ {
// Map DLC strings to application strings, then store the DLC index mapping to application index // 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); EAudioParameterType type = getParameterType(parameterName);
if( type != e_AudioParamType_Invalid ) if( type != e_AudioParamType_Invalid )
{ {
parameterMapping[pParams->dwType] = type; parameterMapping[paramBuf.dwType] = type;
} }
uiCurrentByte+= sizeof(C4JStorage::DLC_FILE_PARAM)+(pParams->dwWchCount*sizeof(WCHAR)); uiCurrentByte += AudioParamAdvance(paramBuf.dwWchCount);
pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte]; ReadAudioDlcStruct(&paramBuf, pbData, uiCurrentByte);
} }
unsigned int uiFileCount=*(unsigned int *)&pbData[uiCurrentByte]; unsigned int uiFileCount = ReadAudioDlcValue<unsigned int>(pbData, uiCurrentByte);
uiCurrentByte+=sizeof(int); 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++) for(unsigned int i=0;i<uiFileCount;i++)
{ {
dwTemp+=sizeof(C4JStorage::DLC_FILE_DETAILS)+pFile->dwWchCount*sizeof(WCHAR); tempByteOffset += AudioDetailAdvance(fileBuf.dwWchCount);
pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[dwTemp]; ReadAudioDlcStruct(&fileBuf, pbData, tempByteOffset);
} }
PBYTE pbTemp=((PBYTE )pFile); std::uint8_t *pbTemp = &pbData[tempByteOffset];
pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; ReadAudioDlcStruct(&fileBuf, pbData, uiCurrentByte);
for(unsigned int i=0;i<uiFileCount;i++) for(unsigned int i=0;i<uiFileCount;i++)
{ {
EAudioType type = (EAudioType)pFile->dwType; EAudioType type = (EAudioType)fileBuf.dwType;
// Params // Params
unsigned int uiParameterCount=*(unsigned int *)pbTemp; unsigned int uiParameterCount = ReadAudioDlcValue<unsigned int>(pbTemp);
pbTemp+=sizeof(int); pbTemp+=sizeof(int);
pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp; ReadAudioDlcStruct(&paramBuf, pbTemp);
for(unsigned int j=0;j<uiParameterCount;j++) for(unsigned int j=0;j<uiParameterCount;j++)
{ {
//EAudioParameterType paramType = e_AudioParamType_Invalid; //EAudioParameterType paramType = e_AudioParamType_Invalid;
AUTO_VAR(it, parameterMapping.find( pParams->dwType )); AUTO_VAR(it, parameterMapping.find(paramBuf.dwType));
if(it != parameterMapping.end() ) 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); pbTemp += AudioParamAdvance(paramBuf.dwWchCount);
pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp; ReadAudioDlcStruct(&paramBuf, pbTemp);
} }
// Move the pointer to the start of the next files data; // Move the pointer to the start of the next files data;
pbTemp+=pFile->uiFileSize; pbTemp += fileBuf.uiFileSize;
uiCurrentByte+=sizeof(C4JStorage::DLC_FILE_DETAILS)+pFile->dwWchCount*sizeof(WCHAR); 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++; iWorldType++;
} }
return m_parameters[iWorldType].at(iIndex); return m_parameters[iWorldType].at(iIndex);
} }

View file

@ -32,18 +32,18 @@ public:
DLCAudioFile(const std::wstring &path); DLCAudioFile(const std::wstring &path);
virtual void addData(PBYTE pbData, DWORD dwBytes); virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes);
virtual PBYTE getData(DWORD &dwBytes); 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); int GetCountofType(DLCAudioFile::EAudioType ptype);
std::wstring &GetSoundName(int iIndex); std::wstring &GetSoundName(int iIndex);
private: private:
using DLCFile::addParameter; using DLCFile::addParameter;
PBYTE m_pbData; std::uint8_t *m_pbData;
DWORD m_dwBytes; std::uint32_t m_dataBytes;
static const int CURRENT_AUDIO_VERSION_NUM=1; static const int CURRENT_AUDIO_VERSION_NUM=1;
//std::unordered_map<int, std::wstring> m_parameters; //std::unordered_map<int, std::wstring> m_parameters;
std::vector<std::wstring> m_parameters[e_AudioType_Max]; std::vector<std::wstring> m_parameters[e_AudioType_Max];

View file

@ -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);
} }

View file

@ -6,5 +6,5 @@ class DLCCapeFile : public DLCFile
public: public:
DLCCapeFile(const std::wstring &path); DLCCapeFile(const std::wstring &path);
virtual void addData(PBYTE pbData, DWORD dwBytes); virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes);
}; };

View file

@ -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(); ColourTable *defaultColourTable = Minecraft::GetInstance()->skins->getDefault()->getColourTable();
m_colourTable = new ColourTable(defaultColourTable, pbData, dwBytes); m_colourTable = new ColourTable(defaultColourTable, pbData, dataBytes);
} }

View file

@ -12,7 +12,7 @@ public:
DLCColourTableFile(const std::wstring &path); DLCColourTableFile(const std::wstring &path);
~DLCColourTableFile(); ~DLCColourTableFile();
virtual void addData(PBYTE pbData, DWORD dwBytes); virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes);
ColourTable *getColourTable() { return m_colourTable; } ColourTable *getColourTable() { return m_colourTable; }
}; };

View file

@ -23,4 +23,4 @@ DLCFile::DLCFile(DLCManager::EDLCType type, const std::wstring &path)
{ {
m_dwSkinId=0; m_dwSkinId=0;
} }
} }

View file

@ -1,4 +1,5 @@
#pragma once #pragma once
#include <cstdint>
#include "DLCManager.h" #include "DLCManager.h"
class DLCFile class DLCFile
@ -6,7 +7,7 @@ class DLCFile
protected: protected:
DLCManager::EDLCType m_type; DLCManager::EDLCType m_type;
std::wstring m_path; std::wstring m_path;
DWORD m_dwSkinId; std::uint32_t m_dwSkinId;
public: public:
DLCFile(DLCManager::EDLCType type, const std::wstring &path); DLCFile(DLCManager::EDLCType type, const std::wstring &path);
@ -14,12 +15,12 @@ public:
DLCManager::EDLCType getType() { return m_type; } DLCManager::EDLCType getType() { return m_type; }
std::wstring getPath() { return m_path; } 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 void addData(std::uint8_t *pbData, std::uint32_t dataBytes) {}
virtual PBYTE getData(DWORD &dwBytes) { dwBytes = 0; return NULL; } virtual std::uint8_t *getData(std::uint32_t &dataBytes) { dataBytes = 0; return NULL; }
virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) {} virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value) {}
virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; } virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; }
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type) { return false;} virtual bool getParameterAsBool(DLCManager::EDLCParameterType type) { return false;}
}; };

View file

@ -5,17 +5,17 @@
DLCGameRulesFile::DLCGameRulesFile(const std::wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRules,path) DLCGameRulesFile::DLCGameRulesFile(const std::wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRules,path)
{ {
m_pbData = NULL; 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_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; return m_pbData;
} }

View file

@ -4,12 +4,12 @@
class DLCGameRulesFile : public DLCGameRules class DLCGameRulesFile : public DLCGameRules
{ {
private: private:
PBYTE m_pbData; std::uint8_t *m_pbData;
DWORD m_dwBytes; std::uint32_t m_dataBytes;
public: public:
DLCGameRulesFile(const std::wstring &path); DLCGameRulesFile(const std::wstring &path);
virtual void addData(PBYTE pbData, DWORD dwBytes); virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes);
virtual PBYTE getData(DWORD &dwBytes); virtual std::uint8_t *getData(std::uint32_t &dataBytes);
}; };

View file

@ -12,7 +12,7 @@
DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRulesHeader,path) DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRulesHeader,path)
{ {
m_pbData = NULL; m_pbData = NULL;
m_dwBytes = 0; m_dataBytes = 0;
m_hasData = false; m_hasData = false;
@ -21,14 +21,14 @@ DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring &path) : DLCGameRules(
lgo = NULL; lgo = NULL;
} }
void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes) void DLCGameRulesHeader::addData(std::uint8_t *pbData, std::uint32_t dataBytes)
{ {
m_pbData = pbData; m_pbData = pbData;
m_dwBytes = dwBytes; m_dataBytes = dataBytes;
#if 0 #if 0
byteArray data(m_pbData, m_dwBytes); byteArray data(m_pbData, m_dataBytes);
ByteArrayInputStream bais(data); ByteArrayInputStream bais(data);
DataInputStream dis(&bais); DataInputStream dis(&bais);
@ -73,13 +73,13 @@ void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes)
#endif #endif
} }
PBYTE DLCGameRulesHeader::getData(DWORD &dwBytes) std::uint8_t *DLCGameRulesHeader::getData(std::uint32_t &dataBytes)
{ {
dwBytes = m_dwBytes; dataBytes = m_dataBytes;
return m_pbData; 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) 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.loadGameRules(lgo, fData, fSize);
app.m_gameRules.readRuleFile(lgo, fData, fSize, st); app.m_gameRules.readRuleFile(lgo, fData, dataSize, st);
} }
} }

View file

@ -8,21 +8,21 @@ class DLCGameRulesHeader : public DLCGameRules, public JustGrSource
private: private:
// GR-Header // GR-Header
PBYTE m_pbData; std::uint8_t *m_pbData;
DWORD m_dwBytes; std::uint32_t m_dataBytes;
bool m_hasData; bool m_hasData;
public: public:
virtual bool requiresTexturePack() {return m_bRequiresTexturePack;} 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 std::wstring getDefaultSaveName() {return m_defaultSaveName;}
virtual LPCWSTR getWorldName() {return m_worldName.c_str();} virtual const wchar_t *getWorldName() {return m_worldName.c_str();}
virtual LPCWSTR getDisplayName() {return m_displayName.c_str();} virtual const wchar_t *getDisplayName() {return m_displayName.c_str();}
virtual std::wstring getGrfPath() {return L"GameRules.grf";} virtual std::wstring getGrfPath() {return L"GameRules.grf";}
virtual void setRequiresTexturePack(bool x) {m_bRequiresTexturePack = x;} 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 setDefaultSaveName(const std::wstring &x) {m_defaultSaveName = x;}
virtual void setWorldName(const std::wstring & x) {m_worldName = x;} virtual void setWorldName(const std::wstring & x) {m_worldName = x;}
virtual void setDisplayName(const std::wstring & x) {m_displayName = x;} virtual void setDisplayName(const std::wstring & x) {m_displayName = x;}
@ -33,10 +33,10 @@ public:
public: public:
DLCGameRulesHeader(const std::wstring &path); DLCGameRulesHeader(const std::wstring &path);
virtual void addData(PBYTE pbData, DWORD dwBytes); virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes);
virtual PBYTE getData(DWORD &dwBytes); 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; } virtual bool ready() { return m_hasData; }
}; };

View file

@ -8,7 +8,7 @@ DLCLocalisationFile::DLCLocalisationFile(const std::wstring &path) : DLCFile(DLC
m_strings = NULL; 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);
} }

View file

@ -10,9 +10,9 @@ private:
public: public:
DLCLocalisationFile(const std::wstring &path); 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; } StringTable *getStringTable() { return m_strings; }
}; };

View file

@ -4,12 +4,17 @@
#include "DLCPack.h" #include "DLCPack.h"
#include "DLCFile.h" #include "DLCFile.h"
#include "../../Minecraft.World/Util/StringHelpers.h" #include "../../Minecraft.World/Util/StringHelpers.h"
#include "../../Minecraft.World/Util/PortableFileIO.h"
#include "../../Minecraft.Client/Minecraft.h" #include "../../Minecraft.Client/Minecraft.h"
#include "../../Minecraft.Client/Textures/Packs/TexturePackRepository.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 // 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 // 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 #if WCHAR_MAX > 0xFFFF
// than sizeof(WCHAR) != DLC_WCHAR_BIN_SIZE // 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) 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) // find the end (nullterminated)
const uint16_t* end = p; const std::uint16_t* end = p;
while(*end) { 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 // allocate wstring with length len
// it will be nullterminated internally, do not worry. // it will be nullterminated internally, do not worry.
std::wstring out(len, 0); std::wstring out(len, 0);
// and copy them into thje string // and copy them into thje string
for(size_t i = 0; i < len; ++i) { for(std::size_t i = 0; i < len; ++i) {
out[i] = (wchar_t) p[i]; out[i] = static_cast<wchar_t>(p[i]);
} }
return out; 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_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) #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[]= const WCHAR *DLCManager::wchTypeNamesA[]=
{ {
L"DISPLAYNAME", L"DISPLAYNAME",
@ -87,7 +177,7 @@ DLCManager::EDLCParameterType DLCManager::getParameterType(const std::wstring &p
{ {
EDLCParameterType type = e_DLCParamType_Invalid; 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) if(paramName.compare(wchTypeNamesA[i]) == 0)
{ {
@ -99,9 +189,9 @@ DLCManager::EDLCParameterType DLCManager::getParameterType(const std::wstring &p
return type; 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 ) if( type != e_DLCType_All )
{ {
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) 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 else
{ {
packCount = (DWORD)m_packs.size(); packCount = static_cast<unsigned int>(m_packs.size());
} }
return packCount; return packCount;
} }
@ -175,12 +265,12 @@ DLCPack *DLCManager::getPackFromProductID(const std::wstring &productID)
} }
#endif #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; DLCPack *pack = NULL;
if( type != e_DLCType_All ) if( type != e_DLCType_All )
{ {
DWORD currentIndex = 0; unsigned int currentIndex = 0;
DLCPack *currentPack = NULL; DLCPack *currentPack = NULL;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) 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; 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; found = false;
if(pack == NULL) if(pack == NULL)
{ {
@ -221,7 +311,7 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D
} }
if( type != e_DLCType_All ) if( type != e_DLCType_All )
{ {
DWORD index = 0; unsigned int index = 0;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
{ {
DLCPack *thisPack = *it; DLCPack *thisPack = *it;
@ -239,7 +329,7 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D
} }
else else
{ {
DWORD index = 0; unsigned int index = 0;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
{ {
DLCPack *thisPack = *it; DLCPack *thisPack = *it;
@ -255,11 +345,11 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D
return foundIndex; 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; found = false;
DWORD index = 0; unsigned int index = 0;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
{ {
DLCPack *pack = *it; DLCPack *pack = *it;
@ -310,9 +400,9 @@ DLCSkinFile *DLCManager::getSkinFile(const std::wstring &path)
return foundSkinfile; 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 *pack = NULL;
DLCPack *firstCorruptPack = NULL; DLCPack *firstCorruptPack = NULL;
@ -329,7 +419,7 @@ DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
// gotta fix this someday // gotta fix this someday
if(corruptDLCCount > 0 && showMessage) if(corruptDLCCount > 0 && showMessage)
{ {
UINT uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK; uiIDA[0]=IDS_CONFIRM_OK;
if(corruptDLCCount == 1 && firstCorruptPack != NULL) if(corruptDLCCount == 1 && firstCorruptPack != NULL)
{ {
@ -351,13 +441,13 @@ DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
return corruptDLCCount; 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); 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); std::wstring wPath = convStringToWstring(path);
if (fromArchive && app.getArchiveFileSize(wPath) >= 0) if (fromArchive && app.getArchiveFileSize(wPath) >= 0)
@ -367,49 +457,19 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const std::string &pat
} }
else if (fromArchive) return false; else if (fromArchive) return false;
#ifdef _WINDOWS64 unsigned int bytesRead = 0;
std::string finalPath = StorageManager.GetMountedPath(path.c_str()); std::uint8_t *pbData = NULL;
if(finalPath.size() == 0) finalPath = path; if(!readOwnedDlcFile(path, &pbData, &bytesRead))
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 )
{ {
DWORD error = GetLastError(); app.DebugPrintf("Failed to open DLC data file %s\n", path.c_str());
app.DebugPrintf("Failed to open DLC data file with error code %d (%x)\n", error, error); pack->SetIsCorrupt(true);
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 );
SetNeedsCorruptCheck(true); SetNeedsCorruptCheck(true);
return false; return false;
} }
return processDLCDataFile(dwFilesProcessed, pbData, bytesRead, pack); 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 // a bunch of makros to reduce memcpy and offset boilerplate
#define DLC_READ_UINT(out, buf, off) memcpy((out), (buf) + (off), sizeof(unsigned int)) #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_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)) #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; std::unordered_map<int, DLCManager::EDLCParameterType> parameterMapping;
unsigned int uiCurrentByte=0; unsigned int uiCurrentByte=0;
@ -438,16 +496,16 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
// // unsigned long, p = number of parameters // // unsigned long, p = number of parameters
// // p * DLC_FILE_PARAM describing each parameter for this file // // p * DLC_FILE_PARAM describing each parameter for this file
// // ulFileSize bytes of data blob of the file added // // ulFileSize bytes of data blob of the file added
// 4jcraft, some parts of this code changed, specifically: // 4jcraft, some parts of this code changed, specifically:
// instead of casting a goddamn raw byte pointer and dereferencing it // instead of casting a goddamn raw byte pointer and dereferencing it
// use memcpy, and access WSTRING with propper offset // use memcpy, and access WSTRING with propper offset
// (scince bufferoffset after advancing by variable string length is not // (scince bufferoffset after advancing by variable string length is not
// guaranteed to be properly aligned, so casting to a scalar/struct is UB) // 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 // those casts coult be dangerous on e.g. ARM, because it doesnt handle
// missaligned loads, like x86/x64, so it would crash // missaligned loads, like x86/x64, so it would crash
// WHO TF USES HUNGARIAN NOTATION // WHO TF USES HUNGARIAN NOTATION
unsigned int uiVersion; unsigned int uiVersion;
@ -490,13 +548,13 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
C4JStorage::DLC_FILE_DETAILS fileBuf; C4JStorage::DLC_FILE_DETAILS fileBuf;
DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte); DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte);
DWORD dwTemp=uiCurrentByte; unsigned int dwTemp=uiCurrentByte;
for(unsigned int i=0;i<uiFileCount;i++) for(unsigned int i=0;i<uiFileCount;i++)
{ {
dwTemp+=DLC_DETAIL_ADV(fileBuf.dwWchCount); dwTemp+=DLC_DETAIL_ADV(fileBuf.dwWchCount);
DLC_READ_DETAIL(&fileBuf, pbData, dwTemp); 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); DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte);
for(unsigned int i=0;i<uiFileCount;i++) for(unsigned int i=0;i<uiFileCount;i++)
@ -546,8 +604,8 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
if(dlcTexturePack != NULL) if(dlcTexturePack != NULL)
{ {
DWORD texturePackFilesProcessed = 0; unsigned int texturePackFilesProcessed = 0;
bool validPack = processDLCDataFile(texturePackFilesProcessed,pbTemp,fileBuf.uiFileSize,dlcTexturePack); bool validPack = processDLCDataFile(texturePackFilesProcessed, pbTemp, fileBuf.uiFileSize, dlcTexturePack);
pack->SetDataPointer(NULL); // If it's a child pack, it doesn't own the data pack->SetDataPointer(NULL); // If it's a child pack, it doesn't own the data
if(!validPack || texturePackFilesProcessed == 0) if(!validPack || texturePackFilesProcessed == 0)
{ {
@ -603,56 +661,25 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
return true; 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::uint32_t packId = 0;
std::wstring wPath = convStringToWstring(path);
#ifdef _WINDOWS64 unsigned int bytesRead = 0;
std::string finalPath = StorageManager.GetMountedPath(path.c_str()); std::uint8_t *pbData = NULL;
if(finalPath.size() == 0) finalPath = path; if(!readOwnedDlcFile(path, &pbData, &bytesRead))
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 )
{ {
return 0; 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); packId=retrievePackID(pbData, bytesRead, pack);
delete [] pbData; delete [] pbData;
return packId; 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; bool bPackIDSet=false;
std::unordered_map<int, DLCManager::EDLCParameterType> parameterMapping; std::unordered_map<int, DLCManager::EDLCParameterType> parameterMapping;
unsigned int uiCurrentByte=0; unsigned int uiCurrentByte=0;
@ -668,7 +695,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
// // unsigned long, p = number of parameters // // unsigned long, p = number of parameters
// // p * DLC_FILE_PARAM describing each parameter for this file // // p * DLC_FILE_PARAM describing each parameter for this file
// // ulFileSize bytes of data blob of the file added // // 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); uiCurrentByte+=sizeof(int);
if(uiVersion < CURRENT_DLC_VERSION_NUM) if(uiVersion < CURRENT_DLC_VERSION_NUM)
@ -677,46 +704,48 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
return 0; return 0;
} }
pack->SetDataPointer(pbData); pack->SetDataPointer(pbData);
unsigned int uiParameterCount=*(unsigned int *)&pbData[uiCurrentByte]; unsigned int uiParameterCount = ReadDlcValue<unsigned int>(pbData, uiCurrentByte);
uiCurrentByte+=sizeof(int); uiCurrentByte+=sizeof(int);
C4JStorage::DLC_FILE_PARAM *pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte]; C4JStorage::DLC_FILE_PARAM paramBuf;
ReadDlcStruct(&paramBuf, pbData, uiCurrentByte);
for(unsigned int i=0;i<uiParameterCount;i++) for(unsigned int i=0;i<uiParameterCount;i++)
{ {
// Map DLC strings to application strings, then store the DLC index mapping to application index // 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); DLCManager::EDLCParameterType type = DLCManager::getParameterType(parameterName);
if( type != DLCManager::e_DLCParamType_Invalid ) if( type != DLCManager::e_DLCParamType_Invalid )
{ {
parameterMapping[pParams->dwType] = type; parameterMapping[paramBuf.dwType] = type;
} }
uiCurrentByte+= DLC_PARAM_ADV(pParams->dwWchCount); uiCurrentByte += DLC_PARAM_ADV(paramBuf.dwWchCount);
pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte]; ReadDlcStruct(&paramBuf, pbData, uiCurrentByte);
} }
unsigned int uiFileCount=*(unsigned int *)&pbData[uiCurrentByte]; unsigned int uiFileCount = ReadDlcValue<unsigned int>(pbData, uiCurrentByte);
uiCurrentByte+=sizeof(int); 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++) for(unsigned int i=0;i<uiFileCount;i++)
{ {
dwTemp+=DLC_DETAIL_ADV(pFile->dwWchCount); dwTemp += DLC_DETAIL_ADV(fileBuf.dwWchCount);
pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[dwTemp]; ReadDlcStruct(&fileBuf, pbData, dwTemp);
} }
PBYTE pbTemp=((PBYTE )pFile); std::uint8_t *pbTemp = &pbData[dwTemp];
pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; ReadDlcStruct(&fileBuf, pbData, uiCurrentByte);
for(unsigned int i=0;i<uiFileCount;i++) for(unsigned int i=0;i<uiFileCount;i++)
{ {
DLCManager::EDLCType type = (DLCManager::EDLCType)pFile->dwType; DLCManager::EDLCType type = (DLCManager::EDLCType)fileBuf.dwType;
// Params // Params
uiParameterCount=*(unsigned int *)pbTemp; uiParameterCount = ReadDlcValue<unsigned int>(pbTemp);
pbTemp+=sizeof(int); pbTemp+=sizeof(int);
pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp; ReadDlcStruct(&paramBuf, pbTemp);
for(unsigned int j=0;j<uiParameterCount;j++) 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() ) if(it != parameterMapping.end() )
{ {
@ -724,7 +753,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
{ {
if(it->second==e_DLCParamType_PackId) if(it->second==e_DLCParamType_PackId)
{ {
std::wstring wsTemp = DLC_WSTRING(pParams->wchData); std::wstring wsTemp = DLC_PARAM_WSTR(pbTemp, 0);
std::wstringstream ss; std::wstringstream ss;
// 4J Stu - numbered using decimal to make it easier for artists/people to number manually // 4J Stu - numbered using decimal to make it easier for artists/people to number manually
ss << std::dec << wsTemp.c_str(); 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); pbTemp += DLC_PARAM_ADV(paramBuf.dwWchCount);
pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp; ReadDlcStruct(&paramBuf, pbTemp);
} }
if(bPackIDSet) break; if(bPackIDSet) break;
// Move the pointer to the start of the next files data; // Move the pointer to the start of the next files data;
pbTemp+=pFile->uiFileSize; pbTemp += fileBuf.uiFileSize;
uiCurrentByte+=DLC_DETAIL_ADV(pFile->dwWchCount); uiCurrentByte += DLC_DETAIL_ADV(fileBuf.dwWchCount);
pFile=(C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; ReadDlcStruct(&fileBuf, pbData, uiCurrentByte);
} }
parameterMapping.clear(); parameterMapping.clear();

View file

@ -1,5 +1,6 @@
#pragma once #pragma once
//using namespace std; //using namespace std;
#include <cstdint>
#include <vector> #include <vector>
class DLCPack; class DLCPack;
class DLCSkinFile; class DLCSkinFile;
@ -54,14 +55,14 @@ private:
std::vector<DLCPack *> m_packs; std::vector<DLCPack *> m_packs;
//bool m_bNeedsUpdated; //bool m_bNeedsUpdated;
bool m_bNeedsCorruptCheck; bool m_bNeedsCorruptCheck;
DWORD m_dwUnnamedCorruptDLCCount; unsigned int m_dwUnnamedCorruptDLCCount;
public: public:
DLCManager(); DLCManager();
~DLCManager(); ~DLCManager();
static EDLCParameterType getParameterType(const std::wstring &paramName); static EDLCParameterType getParameterType(const std::wstring &paramName);
DWORD getPackCount(EDLCType type = e_DLCType_All); unsigned int getPackCount(EDLCType type = e_DLCType_All);
//bool NeedsUpdated() { return m_bNeedsUpdated; } //bool NeedsUpdated() { return m_bNeedsUpdated; }
//void SetNeedsUpdated(bool val) { m_bNeedsUpdated = val; } //void SetNeedsUpdated(bool val) { m_bNeedsUpdated = val; }
@ -79,21 +80,21 @@ public:
#ifdef _XBOX_ONE #ifdef _XBOX_ONE
DLCPack *DLCManager::getPackFromProductID(const std::wstring &productID); DLCPack *DLCManager::getPackFromProductID(const std::wstring &productID);
#endif #endif
DLCPack *getPack(DWORD index, EDLCType type = e_DLCType_All); DLCPack *getPack(unsigned int index, EDLCType type = e_DLCType_All);
DWORD getPackIndex(DLCPack *pack, bool &found, 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 DLCSkinFile *getSkinFile(const std::wstring &path); // Will hunt all packs of type skin to find the right skinfile
DLCPack *getPackContainingSkin(const std::wstring &path); 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(unsigned int &dwFilesProcessed, const std::wstring &path, DLCPack *pack, bool fromArchive = false);
bool readDLCDataFile(DWORD &dwFilesProcessed, const std::string &path, DLCPack *pack, bool fromArchive = false); bool readDLCDataFile(unsigned int &dwFilesProcessed, const std::string &path, DLCPack *pack, bool fromArchive = false);
DWORD retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack); std::uint32_t retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack);
private: 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);
}; };

View file

@ -11,7 +11,7 @@
#include "DLCColourTableFile.h" #include "DLCColourTableFile.h"
#include "../../Minecraft.World/Util/StringHelpers.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_dataPath = L"";
m_packName = name; m_packName = name;
@ -35,7 +35,7 @@ DLCPack::DLCPack(const std::wstring &name,DWORD dwLicenseMask)
} }
#ifdef _XBOX_ONE #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_dataPath = L"";
m_packName = name; m_packName = name;
@ -81,7 +81,7 @@ DLCPack::~DLCPack()
} }
} }
DWORD DLCPack::GetDLCMountIndex() int DLCPack::GetDLCMountIndex()
{ {
if(m_parentPack != NULL) if(m_parentPack != NULL)
{ {
@ -101,9 +101,9 @@ XCONTENTDEVICEID DLCPack::GetDLCDeviceID()
void DLCPack::addChildPack(DLCPack *childPack) void DLCPack::addChildPack(DLCPack *childPack)
{ {
int packId = childPack->GetPackId(); const std::uint32_t packId = childPack->GetPackId();
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
if(packId < 0 || packId > 15) if(packId > 15)
{ {
__debugbreak(); __debugbreak();
} }
@ -125,7 +125,7 @@ void DLCPack::addParameter(DLCManager::EDLCParameterType type, const std::wstrin
{ {
case DLCManager::e_DLCParamType_PackId: case DLCManager::e_DLCParamType_PackId:
{ {
DWORD packId = 0; std::uint32_t packId = 0;
std::wstringstream ss; std::wstringstream ss;
// 4J Stu - numbered using decimal to make it easier for artists/people to number manually // 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; break;
case DLCManager::e_DLCParamType_PackVersion: case DLCManager::e_DLCParamType_PackVersion:
{ {
DWORD version = 0; std::uint32_t version = 0;
std::wstringstream ss; std::wstringstream ss;
// 4J Stu - numbered using decimal to make it easier for artists/people to number manually // 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; return hasFile;
} }
DLCFile *DLCPack::getFile(DLCManager::EDLCType type, DWORD index) DLCFile *DLCPack::getFile(DLCManager::EDLCType type, unsigned int index)
{ {
DLCFile *file = NULL; DLCFile *file = NULL;
if(type == DLCManager::e_DLCType_All) if(type == DLCManager::e_DLCType_All)
@ -333,9 +333,9 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const std::wstring &path)
return file; 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) switch(type)
{ {
@ -346,13 +346,13 @@ DWORD DLCPack::getDLCItemsCount(DLCManager::EDLCType type /*= DLCManager::e_DLCT
} }
break; break;
default: default:
count = (DWORD)m_files[(int)type].size(); count = static_cast<unsigned int>(m_files[(int)type].size());
break; break;
}; };
return count; 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) if(type == DLCManager::e_DLCType_All)
{ {
@ -363,9 +363,9 @@ DWORD DLCPack::getFileIndexAt(DLCManager::EDLCType type, const std::wstring &pat
return 0; return 0;
} }
DWORD foundIndex = 0; unsigned int foundIndex = 0;
found = false; found = false;
DWORD index = 0; unsigned int index = 0;
for(AUTO_VAR(it, m_files[type].begin()); it != m_files[type].end(); ++it) for(AUTO_VAR(it, m_files[type].begin()); it != m_files[type].end(); ++it)
{ {
if(path.compare((*it)->getPath()) == 0) if(path.compare((*it)->getPath()) == 0)

View file

@ -1,5 +1,6 @@
#pragma once #pragma once
//using namespace std; //using namespace std;
#include <cstdint>
#include "DLCManager.h" #include "DLCManager.h"
class DLCFile; class DLCFile;
@ -16,7 +17,7 @@ private:
std::wstring m_packName; std::wstring m_packName;
std::wstring m_dataPath; std::wstring m_dataPath;
DWORD m_dwLicenseMask; std::uint32_t m_dwLicenseMask;
int m_dlcMountIndex; int m_dlcMountIndex;
XCONTENTDEVICEID m_dlcDeviceID; XCONTENTDEVICEID m_dlcDeviceID;
#ifdef _XBOX_ONE #ifdef _XBOX_ONE
@ -25,36 +26,36 @@ private:
ULONGLONG m_ullFullOfferId; ULONGLONG m_ullFullOfferId;
#endif #endif
bool m_isCorrupt; bool m_isCorrupt;
DWORD m_packId; std::uint32_t m_packId;
DWORD m_packVersion; 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: public:
DLCPack(const std::wstring &name,DWORD dwLicenseMask); DLCPack(const std::wstring &name,std::uint32_t dwLicenseMask);
#ifdef _XBOX_ONE #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 #endif
~DLCPack(); ~DLCPack();
std::wstring getFullDataPath() { return m_dataPath; } 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; } bool IsCorrupt() { return m_isCorrupt; }
void SetIsCorrupt(bool val) { m_isCorrupt = val; } void SetIsCorrupt(bool val) { m_isCorrupt = val; }
void SetPackId(DWORD id) { m_packId = id; } void SetPackId(std::uint32_t id) { m_packId = id; }
DWORD GetPackId() { return m_packId; } std::uint32_t GetPackId() { return m_packId; }
void SetPackVersion(DWORD version) { m_packVersion = version; } void SetPackVersion(std::uint32_t version) { m_packVersion = version; }
DWORD GetPackVersion() { return m_packVersion; } std::uint32_t GetPackVersion() { return m_packVersion; }
DLCPack * GetParentPack() { return m_parentPack; } 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; } void SetDLCMountIndex(int id) { m_dlcMountIndex = id; }
DWORD GetDLCMountIndex(); int GetDLCMountIndex();
void SetDLCDeviceID(XCONTENTDEVICEID deviceId) { m_dlcDeviceID = deviceId; } void SetDLCDeviceID(XCONTENTDEVICEID deviceId) { m_dlcDeviceID = deviceId; }
XCONTENTDEVICEID GetDLCDeviceID(); XCONTENTDEVICEID GetDLCDeviceID();
@ -64,8 +65,8 @@ public:
void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value); void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value);
bool getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned int &param); bool getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned int &param);
void updateLicenseMask( DWORD dwLicenseMask ) { m_dwLicenseMask = dwLicenseMask; } void updateLicenseMask(std::uint32_t dwLicenseMask) { m_dwLicenseMask = dwLicenseMask; }
DWORD getLicenseMask( ) { return m_dwLicenseMask; } std::uint32_t getLicenseMask() { return m_dwLicenseMask; }
std::wstring getName() { return m_packName; } std::wstring getName() { return m_packName; }
#ifdef _XBOX_ONE #ifdef _XBOX_ONE
@ -75,18 +76,18 @@ public:
#endif #endif
DLCFile *addFile(DLCManager::EDLCType type, const std::wstring &path); 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); DLCFile *getFile(DLCManager::EDLCType type, const std::wstring &path);
DWORD getDLCItemsCount(DLCManager::EDLCType type = DLCManager::e_DLCType_All); unsigned int getDLCItemsCount(DLCManager::EDLCType type = DLCManager::e_DLCType_All);
DWORD getFileIndexAt(DLCManager::EDLCType type, const std::wstring &path, bool &found); unsigned int getFileIndexAt(DLCManager::EDLCType type, const std::wstring &path, bool &found);
bool doesPackContainFile(DLCManager::EDLCType type, const std::wstring &path); 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); } unsigned int 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 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(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 doesPackContainSkin(const std::wstring &path) { return doesPackContainFile(DLCManager::e_DLCType_Skin, path); }
bool hasPurchasedFile(DLCManager::EDLCType type, const std::wstring &path); bool hasPurchasedFile(DLCManager::EDLCType type, const std::wstring &path);

View file

@ -16,9 +16,9 @@ DLCSkinFile::DLCSkinFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCTy
m_uiAnimOverrideBitmask=0L; 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) 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: case DLCManager::e_DLCParamType_Anim:
// 4J Stu - The Xbox version used swscanf_s which isn't available in GCC. // 4J Stu - The Xbox version used swscanf_s which isn't available in GCC.
swscanf(value.c_str(), L"%X", &m_uiAnimOverrideBitmask); 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); app.SetAnimOverrideBitmask(skinId, m_uiAnimOverrideBitmask);
break; break;
} }

View file

@ -17,7 +17,7 @@ public:
DLCSkinFile(const std::wstring &path); 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 void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value);
virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type); virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type);

View file

@ -8,19 +8,19 @@ DLCTextureFile::DLCTextureFile(const std::wstring &path) : DLCFile(DLCManager::e
m_animString = L""; m_animString = L"";
m_pbData = NULL; 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); //app.AddMemoryTextureFile(m_path,pbData,dwBytes);
m_pbData = pbData; 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; return m_pbData;
} }
@ -56,4 +56,4 @@ bool DLCTextureFile::getParameterAsBool(DLCManager::EDLCParameterType type)
default: default:
return false; return false;
} }
} }

View file

@ -8,17 +8,17 @@ private:
bool m_bIsAnim; bool m_bIsAnim;
std::wstring m_animString; std::wstring m_animString;
PBYTE m_pbData; std::uint8_t *m_pbData;
DWORD m_dwBytes; std::uint32_t m_dataBytes;
public: public:
DLCTextureFile(const std::wstring &path); DLCTextureFile(const std::wstring &path);
virtual void addData(PBYTE pbData, DWORD dwBytes); virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes);
virtual PBYTE getData(DWORD &dwBytes); virtual std::uint8_t *getData(std::uint32_t &dataBytes);
virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value); virtual void addParameter(DLCManager::EDLCParameterType type, const std::wstring &value);
virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type); virtual std::wstring getParameterAsString(DLCManager::EDLCParameterType type);
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type); virtual bool getParameterAsBool(DLCManager::EDLCParameterType type);
}; };

View file

@ -5,7 +5,7 @@
DLCUIDataFile::DLCUIDataFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_UIData,path) DLCUIDataFile::DLCUIDataFile(const std::wstring &path) : DLCFile(DLCManager::e_DLCType_UIData,path)
{ {
m_pbData = NULL; m_pbData = NULL;
m_dwBytes = 0; m_dataBytes = 0;
m_canDeleteData = false; 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_pbData = pbData;
m_dwBytes = dwBytes; m_dataBytes = dataBytes;
m_canDeleteData = canDeleteData; 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; return m_pbData;
} }

View file

@ -4,8 +4,8 @@
class DLCUIDataFile : public DLCFile class DLCUIDataFile : public DLCFile
{ {
private: private:
PBYTE m_pbData; std::uint8_t *m_pbData;
DWORD m_dwBytes; std::uint32_t m_dataBytes;
bool m_canDeleteData; bool m_canDeleteData;
public: public:
@ -15,6 +15,6 @@ public:
using DLCFile::addData; using DLCFile::addData;
using DLCFile::addParameter; using DLCFile::addParameter;
virtual void addData(PBYTE pbData, DWORD dwBytes,bool canDeleteData = false); virtual void addData(std::uint8_t *pbData, std::uint32_t dataBytes,bool canDeleteData = false);
virtual PBYTE getData(DWORD &dwBytes); virtual std::uint8_t *getData(std::uint32_t &dataBytes);
}; };

View file

@ -9,7 +9,7 @@ AddEnchantmentRuleDefinition::AddEnchantmentRuleDefinition()
m_enchantmentId = m_enchantmentLevel = 0; 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); GameRuleDefinition::writeAttributes(dos, numAttributes + 2);

View file

@ -15,7 +15,7 @@ public:
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_AddEnchantment; } 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); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);

View file

@ -12,7 +12,7 @@ AddItemRuleDefinition::AddItemRuleDefinition()
m_slot = -1; m_slot = -1;
} }
void AddItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttrs) void AddItemRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttrs)
{ {
GameRuleDefinition::writeAttributes(dos, numAttrs + 5); GameRuleDefinition::writeAttributes(dos, numAttrs + 5);

View file

@ -18,7 +18,7 @@ private:
public: public:
AddItemRuleDefinition(); AddItemRuleDefinition();
virtual void writeAttributes(DataOutputStream *, UINT numAttributes); virtual void writeAttributes(DataOutputStream *, unsigned int numAttributes);
virtual void getChildren(std::vector<GameRuleDefinition *> *children); virtual void getChildren(std::vector<GameRuleDefinition *> *children);
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_AddItem; } virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_AddItem; }

View file

@ -30,7 +30,7 @@ ApplySchematicRuleDefinition::~ApplySchematicRuleDefinition()
delete m_location; delete m_location;
} }
void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttrs) void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttrs)
{ {
GameRuleDefinition::writeAttributes(dos, numAttrs + 5); GameRuleDefinition::writeAttributes(dos, numAttrs + 5);

View file

@ -30,7 +30,7 @@ public:
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_ApplySchematic; } 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); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
void processSchematic(AABB *chunkBox, LevelChunk *chunk); void processSchematic(AABB *chunkBox, LevelChunk *chunk);

View file

@ -9,7 +9,7 @@ BiomeOverride::BiomeOverride()
m_biomeId = 0; m_biomeId = 0;
} }
void BiomeOverride::writeAttributes(DataOutputStream *dos, UINT numAttrs) void BiomeOverride::writeAttributes(DataOutputStream *dos, unsigned int numAttrs)
{ {
GameRuleDefinition::writeAttributes(dos, numAttrs + 3); GameRuleDefinition::writeAttributes(dos, numAttrs + 3);
@ -52,8 +52,8 @@ bool BiomeOverride::isBiome(int id)
return m_biomeId == 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_tile != 0) tile = m_tile;
if(m_topTile != 0) topTile = (BYTE)m_topTile; if(m_topTile != 0) topTile = m_topTile;
} }

View file

@ -6,8 +6,8 @@
class BiomeOverride : public GameRuleDefinition class BiomeOverride : public GameRuleDefinition
{ {
private: private:
BYTE m_topTile; std::uint8_t m_topTile;
BYTE m_tile; std::uint8_t m_tile;
int m_biomeId; int m_biomeId;
public: public:
@ -15,9 +15,9 @@ public:
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_BiomeOverride; } 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); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
bool isBiome(int id); bool isBiome(int id);
void getTileValues(BYTE &tile, BYTE &topTile); void getTileValues(std::uint8_t &tile, std::uint8_t &topTile);
}; };

View file

@ -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); GameRuleDefinition::writeAttributes(dos, numAttributes + 3);

View file

@ -20,7 +20,7 @@ public:
ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_CollectItemRule; } 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 void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
virtual int getGoal(); virtual int getGoal();

View file

@ -55,7 +55,7 @@ GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRu
return rule; return rule;
} }
void ConsoleGenerateStructure::writeAttributes(DataOutputStream *dos, UINT numAttrs) void ConsoleGenerateStructure::writeAttributes(DataOutputStream *dos, unsigned int numAttrs)
{ {
GameRuleDefinition::writeAttributes(dos, numAttrs + 5); GameRuleDefinition::writeAttributes(dos, numAttrs + 5);

View file

@ -23,7 +23,7 @@ public:
virtual void getChildren(std::vector<GameRuleDefinition *> *children); virtual void getChildren(std::vector<GameRuleDefinition *> *children);
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); 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); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
// StructurePiece // StructurePiece

View file

@ -37,7 +37,7 @@ void ConsoleSchematicFile::save(DataOutputStream *dos)
dos->writeInt(m_ySize); dos->writeInt(m_ySize);
dos->writeInt(m_zSize); 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, Compression::getCompression()->CompressLZXRLE( ba.data, &ba.length,
m_data.data, m_data.length); m_data.data, m_data.length);

View file

@ -29,7 +29,7 @@ void GameRuleDefinition::write(DataOutputStream *dos)
(*it)->write(dos); (*it)->write(dos);
} }
void GameRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes) void GameRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes)
{ {
dos->writeInt(numAttributes + 3); dos->writeInt(numAttributes + 3);

View file

@ -35,7 +35,7 @@ public:
virtual void write(DataOutputStream *); 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 void getChildren(std::vector<GameRuleDefinition *> *);
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);

View file

@ -103,7 +103,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
for(int i = 0; i < gameRulesCount; ++i) for(int i = 0; i < gameRulesCount; ++i)
{ {
DLCGameRulesHeader *dlcHeader = (DLCGameRulesHeader *)pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i); DLCGameRulesHeader *dlcHeader = (DLCGameRulesHeader *)pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i);
DWORD dSize; std::uint32_t dSize;
uint8_t *dData = dlcHeader->getData(dSize); uint8_t *dData = dlcHeader->getData(dSize);
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions(); LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions();
@ -125,7 +125,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
{ {
DLCGameRulesFile *dlcFile = (DLCGameRulesFile *)pack->getFile(DLCManager::e_DLCType_GameRules, i); DLCGameRulesFile *dlcFile = (DLCGameRulesFile *)pack->getFile(DLCManager::e_DLCType_GameRules, i);
DWORD dSize; std::uint32_t dSize;
uint8_t *dData = dlcFile->getData(dSize); uint8_t *dData = dlcFile->getData(dSize);
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions(); 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(); LevelGenerationOptions *lgo = new LevelGenerationOptions();
lgo->setGrSource( new JustGrSource() ); lgo->setGrSource( new JustGrSource() );
@ -153,7 +153,7 @@ LevelGenerationOptions *GameRuleManager::loadGameRules(uint8_t *dIn, UINT dSize)
} }
// 4J-JEV: Reverse of saveGameRules. // 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"); 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(); 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); app.DebugPrintf("\tcompressionType=%d.\n", compression_type);
UINT compr_len, decomp_len; unsigned int compr_len, decomp_len;
compr_len = dis.readInt(); compr_len = dis.readInt();
decomp_len = dis.readInt(); decomp_len = dis.readInt();
@ -183,8 +183,8 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, U
// Decompress File Body // Decompress File Body
byteArray content(new BYTE[decomp_len], decomp_len), byteArray content(new std::uint8_t[decomp_len], decomp_len),
compr_content(new BYTE[compr_len], compr_len); compr_content(new std::uint8_t[compr_len], compr_len);
dis.read(compr_content); dis.read(compr_content);
Compression::getCompression()->SetDecompressionType( (Compression::ECompressionTypes)compression_type ); Compression::getCompression()->SetDecompressionType( (Compression::ECompressionTypes)compression_type );
@ -203,14 +203,14 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, U
// Read StringTable. // Read StringTable.
byteArray bStringTable; byteArray bStringTable;
bStringTable.length = dis2.readInt(); bStringTable.length = dis2.readInt();
bStringTable.data = new BYTE[ bStringTable.length ]; bStringTable.data = new std::uint8_t[ bStringTable.length ];
dis2.read(bStringTable); dis2.read(bStringTable);
StringTable *strings = new StringTable(bStringTable.data, bStringTable.length); StringTable *strings = new StringTable(bStringTable.data, bStringTable.length);
// Read RuleFile. // Read RuleFile.
byteArray bRuleFile; byteArray bRuleFile;
bRuleFile.length = content.length - bStringTable.length; bRuleFile.length = content.length - bStringTable.length;
bRuleFile.data = new BYTE[ bRuleFile.length ]; bRuleFile.data = new std::uint8_t[ bRuleFile.length ];
dis2.read(bRuleFile); dis2.read(bRuleFile);
// 4J-JEV: I don't believe that the path-name is ever used. // 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. // 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 && if (m_currentGameRuleDefinitions == NULL &&
m_currentLevelGenerationOptions == 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. // Write 8 bytes of empty space in case we need them later.
// Mainly useful for the ones we save embedded in game saves. // 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(0x0);
dos.writeByte(APPROPRIATE_COMPRESSION_TYPE); // m_compressionType 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. // 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, Compression::getCompression()->CompressLZXRLE( compr_ba.data, &compr_ba.length,
compr_baos.buf.data, compr_baos.buf.length ); compr_baos.buf.data, compr_baos.buf.length );
@ -373,15 +373,15 @@ void GameRuleManager::writeRuleFile(DataOutputStream *dos)
m_currentGameRuleDefinitions->write(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 levelGenAdded = false;
bool gameRulesAdded = false; bool gameRulesAdded = false;
LevelGenerationOptions *levelGenerator = lgo;//new LevelGenerationOptions(); LevelGenerationOptions *levelGenerator = lgo;//new LevelGenerationOptions();
LevelRuleset *gameRules = new LevelRuleset(); LevelRuleset *gameRules = new LevelRuleset();
//DWORD dwLen = 0; //std::uint32_t dataLength = 0;
//PBYTE pbData = dlcFile->getData(dwLen); //std::uint8_t *data = dlcFile->getData(dataLength);
//byteArray data(pbData,dwLen); //byteArray data(pbData,dwLen);
byteArray data(dIn, dSize); byteArray data(dIn, dSize);
@ -469,15 +469,15 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI
} }
// string lookup. // string lookup.
UINT numStrings = contentDis->readInt(); unsigned int numStrings = contentDis->readInt();
std::vector<std::wstring> tagsAndAtts; 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() ); tagsAndAtts.push_back( contentDis->readUTF() );
std::unordered_map<int, ConsoleGameRules::EGameRuleType> tagIdMap; std::unordered_map<int, ConsoleGameRules::EGameRuleType> tagIdMap;
for(int type = (int)ConsoleGameRules::eGameRuleType_Root; type < (int)ConsoleGameRules::eGameRuleType_Count; ++type) 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) 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; std::unordered_map<int, ConsoleGameRules::EGameRuleAttr> attrIdMap;
for(int attr = (int)ConsoleGameRules::eGameRuleAttr_descriptionName; attr < (int)ConsoleGameRules::eGameRuleAttr_Count; ++attr) 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) if (tagsAndAtts[i].compare(wchAttrNameA[attr]) == 0)
{ {
@ -503,8 +503,8 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI
}*/ }*/
// subfile // subfile
UINT numFiles = contentDis->readInt(); unsigned int numFiles = contentDis->readInt();
for (UINT i = 0; i < numFiles; i++) for (unsigned int i = 0; i < numFiles; i++)
{ {
std::wstring sFilename = contentDis->readUTF(); std::wstring sFilename = contentDis->readUTF();
int length = contentDis->readInt(); 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; LEVEL_GEN_ID lgoID = LEVEL_GEN_ID_NULL;
// xml objects // xml objects
UINT numObjects = contentDis->readInt(); unsigned int numObjects = contentDis->readInt();
for(UINT i = 0; i < numObjects; ++i) for(unsigned int i = 0; i < numObjects; ++i)
{ {
int tagId = contentDis->readInt(); int tagId = contentDis->readInt();
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid; 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) void GameRuleManager::readAttributes(DataInputStream *dis, std::vector<std::wstring> *tagsAndAtts, GameRuleDefinition *rule)
{ {
int numAttrs = dis->readInt(); 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(); int attID = dis->readInt();
std::wstring value = dis->readUTF(); 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) void GameRuleManager::readChildren(DataInputStream *dis, std::vector<std::wstring> *tagsAndAtts, std::unordered_map<int, ConsoleGameRules::EGameRuleType> *tagIdMap, GameRuleDefinition *rule)
{ {
int numChildren = dis->readInt(); 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(); int tagId = dis->readInt();
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid; ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
@ -663,7 +663,7 @@ void GameRuleManager::loadDefaultGameRules()
if(app.getArchiveFileSize(fpTutorial) >= 0) if(app.getArchiveFileSize(fpTutorial) >= 0)
{ {
DLCPack *pack = new DLCPack(L"",0xffffffff); DLCPack *pack = new DLCPack(L"",0xffffffff);
DWORD dwFilesProcessed = 0; unsigned int dwFilesProcessed = 0;
if ( app.m_dlcManager.readDLCDataFile(dwFilesProcessed,fpTutorial,pack,true) ) if ( app.m_dlcManager.readDLCDataFile(dwFilesProcessed,fpTutorial,pack,true) )
{ {
app.m_dlcManager.addPack(pack); app.m_dlcManager.addPack(pack);
@ -720,7 +720,7 @@ bool GameRuleManager::loadGameRulesPack(File *path)
if(path->exists()) if(path->exists())
{ {
DLCPack *pack = new DLCPack(L"",0xffffffff); DLCPack *pack = new DLCPack(L"",0xffffffff);
DWORD dwFilesProcessed = 0; unsigned int dwFilesProcessed = 0;
if( app.m_dlcManager.readDLCDataFile(dwFilesProcessed, path->getPath(),pack)) if( app.m_dlcManager.readDLCDataFile(dwFilesProcessed, path->getPath(),pack))
{ {
app.m_dlcManager.addPack(pack); app.m_dlcManager.addPack(pack);
@ -749,7 +749,7 @@ void GameRuleManager::setLevelGenerationOptions(LevelGenerationOptions *levelGen
m_currentLevelGenerationOptions->reset_start(); 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() ) if(m_currentGameRuleDefinitions != NULL && !key.empty() )
{ {

View file

@ -40,10 +40,10 @@ public:
void loadGameRules(DLCPack *); void loadGameRules(DLCPack *);
LevelGenerationOptions *loadGameRules(uint8_t *dIn, UINT dSize); LevelGenerationOptions *loadGameRules(uint8_t *dIn, unsigned int dSize);
void loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, UINT 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: private:
LevelGenerationOptions *readHeader(DLCGameRulesHeader *grh); LevelGenerationOptions *readHeader(DLCGameRulesHeader *grh);
@ -51,7 +51,7 @@ private:
void writeRuleFile(DataOutputStream *dos); void writeRuleFile(DataOutputStream *dos);
public: 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: private:
void readAttributes(DataInputStream *dis, std::vector<std::wstring> *tagsAndAtts, GameRuleDefinition *rule); void readAttributes(DataInputStream *dis, std::vector<std::wstring> *tagsAndAtts, GameRuleDefinition *rule);
@ -72,7 +72,7 @@ public:
void setLevelGenerationOptions(LevelGenerationOptions *levelGen); void setLevelGenerationOptions(LevelGenerationOptions *levelGen);
LevelRuleset *getGameRuleDefinitions() { return m_currentGameRuleDefinitions; } LevelRuleset *getGameRuleDefinitions() { return m_currentGameRuleDefinitions; }
LevelGenerationOptions *getLevelGenerationOptions() { return m_currentLevelGenerationOptions; } LevelGenerationOptions *getLevelGenerationOptions() { return m_currentLevelGenerationOptions; }
LPCWSTR GetGameRulesString(const std::wstring &key); const wchar_t *GetGameRulesString(const std::wstring &key);
// 4J-JEV: // 4J-JEV:
// Properly cleans-up and unloads the current set of gameRules. // Properly cleans-up and unloads the current set of gameRules.

View file

@ -23,16 +23,16 @@ JustGrSource::JustGrSource()
} }
bool JustGrSource::requiresTexturePack() {return m_bRequiresTexturePack;} 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;} std::wstring JustGrSource::getDefaultSaveName() {return m_defaultSaveName;}
LPCWSTR JustGrSource::getWorldName() {return m_worldName.c_str();} const wchar_t *JustGrSource::getWorldName() {return m_worldName.c_str();}
LPCWSTR JustGrSource::getDisplayName() {return m_displayName.c_str();} const wchar_t *JustGrSource::getDisplayName() {return m_displayName.c_str();}
std::wstring JustGrSource::getGrfPath() {return m_grfPath;} std::wstring JustGrSource::getGrfPath() {return m_grfPath;}
bool JustGrSource::requiresBaseSave() { return m_bRequiresBaseSave; }; bool JustGrSource::requiresBaseSave() { return m_bRequiresBaseSave; };
std::wstring JustGrSource::getBaseSavePath() { return m_baseSavePath; }; std::wstring JustGrSource::getBaseSavePath() { return m_baseSavePath; };
void JustGrSource::setRequiresTexturePack(bool x) {m_bRequiresTexturePack = x;} 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::setDefaultSaveName(const std::wstring &x) {m_defaultSaveName = x;}
void JustGrSource::setWorldName(const std::wstring &x) {m_worldName = x;} void JustGrSource::setWorldName(const std::wstring &x) {m_worldName = x;}
void JustGrSource::setDisplayName(const std::wstring &x) {m_displayName = x;} void JustGrSource::setDisplayName(const std::wstring &x) {m_displayName = x;}
@ -55,7 +55,7 @@ LevelGenerationOptions::LevelGenerationOptions()
m_bRequiresGameRules = false; m_bRequiresGameRules = false;
m_pbBaseSaveData = NULL; m_pbBaseSaveData = NULL;
m_dwBaseSaveSize = 0; m_baseSaveSize = 0;
} }
LevelGenerationOptions::~LevelGenerationOptions() LevelGenerationOptions::~LevelGenerationOptions()
@ -90,7 +90,7 @@ LevelGenerationOptions::~LevelGenerationOptions()
ConsoleGameRules::EGameRuleType LevelGenerationOptions::getActionType() { return ConsoleGameRules::eGameRuleType_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); GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
@ -332,7 +332,7 @@ void LevelGenerationOptions::clearSchematics()
m_schematics.clear(); 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 // If we have already loaded this, just return
AUTO_VAR(it, m_schematics.find(filename)); AUTO_VAR(it, m_schematics.find(filename));
@ -346,7 +346,7 @@ ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const std::wstri
} }
ConsoleSchematicFile *schematic = NULL; ConsoleSchematicFile *schematic = NULL;
byteArray data(pbData,dwLen); byteArray data(pbData, dataLength);
ByteArrayInputStream bais(data); ByteArrayInputStream bais(data);
DataInputStream dis(&bais); DataInputStream dis(&bais);
schematic = new ConsoleSchematicFile(); schematic = new ConsoleSchematicFile();
@ -389,7 +389,7 @@ void LevelGenerationOptions::loadStringTable(StringTable *table)
m_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) 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) 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::isFromDLC() { return getSrc() == eSrc_fromDLC; }
bool LevelGenerationOptions::requiresTexturePack() { return info()->requiresTexturePack(); } 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(); } std::wstring LevelGenerationOptions::getDefaultSaveName() { return info()->getDefaultSaveName(); }
LPCWSTR LevelGenerationOptions::getWorldName() { return info()->getWorldName(); } const wchar_t *LevelGenerationOptions::getWorldName() { return info()->getWorldName(); }
LPCWSTR LevelGenerationOptions::getDisplayName() { return info()->getDisplayName(); } const wchar_t *LevelGenerationOptions::getDisplayName() { return info()->getDisplayName(); }
std::wstring LevelGenerationOptions::getGrfPath() { return info()->getGrfPath(); } std::wstring LevelGenerationOptions::getGrfPath() { return info()->getGrfPath(); }
bool LevelGenerationOptions::requiresBaseSave() { return info()->requiresBaseSave(); } bool LevelGenerationOptions::requiresBaseSave() { return info()->requiresBaseSave(); }
std::wstring LevelGenerationOptions::getBaseSavePath() { return info()->getBaseSavePath(); } 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::setGrSource(GrSource *grs) { m_pSrc = grs; }
void LevelGenerationOptions::setRequiresTexturePack(bool x) { info()->setRequiresTexturePack(x); } 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::setDefaultSaveName(const std::wstring &x) { info()->setDefaultSaveName(x); }
void LevelGenerationOptions::setWorldName(const std::wstring &x) { info()->setWorldName(x); } void LevelGenerationOptions::setWorldName(const std::wstring &x) { info()->setWorldName(x); }
void LevelGenerationOptions::setDisplayName(const std::wstring &x) { info()->setDisplayName(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(); } bool LevelGenerationOptions::ready() { return info()->ready(); }
void LevelGenerationOptions::setBaseSaveData(PBYTE pbData, DWORD dwSize) { m_pbBaseSaveData = pbData; m_dwBaseSaveSize = dwSize; } void LevelGenerationOptions::setBaseSaveData(std::uint8_t *pbData, unsigned int dataSize) { m_pbBaseSaveData = pbData; m_baseSaveSize = dataSize; }
PBYTE LevelGenerationOptions::getBaseSaveData(DWORD &size) { size = m_dwBaseSaveSize; return m_pbBaseSaveData; } std::uint8_t *LevelGenerationOptions::getBaseSaveData(unsigned int &size) { size = m_baseSaveSize; return m_pbBaseSaveData; }
bool LevelGenerationOptions::hasBaseSaveData() { return m_dwBaseSaveSize > 0 && m_pbBaseSaveData != NULL; } bool LevelGenerationOptions::hasBaseSaveData() { return m_baseSaveSize > 0 && m_pbBaseSaveData != NULL; }
void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete m_pbBaseSaveData; m_pbBaseSaveData = NULL; m_dwBaseSaveSize = 0; } void LevelGenerationOptions::deleteBaseSaveData() { delete[] m_pbBaseSaveData; m_pbBaseSaveData = NULL; m_baseSaveSize = 0; }
bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; } bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; }
void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; } void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; }

View file

@ -3,6 +3,8 @@
// #pragma message("LevelGenerationOptions.h ") // #pragma message("LevelGenerationOptions.h ")
#include <cstdint>
#include "GameRuleDefinition.h" #include "GameRuleDefinition.h"
#include "../../Minecraft.World/WorldGen/Features/StructureFeature.h" #include "../../Minecraft.World/WorldGen/Features/StructureFeature.h"
@ -24,16 +26,16 @@ public:
virtual ~GrSource(){} virtual ~GrSource(){}
virtual bool requiresTexturePack()=0; virtual bool requiresTexturePack()=0;
virtual UINT getRequiredTexturePackId()=0; virtual std::uint32_t getRequiredTexturePackId()=0;
virtual std::wstring getDefaultSaveName()=0; virtual std::wstring getDefaultSaveName()=0;
virtual LPCWSTR getWorldName()=0; virtual const wchar_t *getWorldName()=0;
virtual LPCWSTR getDisplayName()=0; virtual const wchar_t *getDisplayName()=0;
virtual std::wstring getGrfPath()=0; virtual std::wstring getGrfPath()=0;
virtual bool requiresBaseSave() = 0; virtual bool requiresBaseSave() = 0;
virtual std::wstring getBaseSavePath() = 0; virtual std::wstring getBaseSavePath() = 0;
virtual void setRequiresTexturePack(bool)=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 setDefaultSaveName(const std::wstring &)=0;
virtual void setWorldName(const std::wstring &)=0; virtual void setWorldName(const std::wstring &)=0;
virtual void setDisplayName(const std::wstring &)=0; virtual void setDisplayName(const std::wstring &)=0;
@ -42,7 +44,7 @@ public:
virtual bool ready()=0; 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 class JustGrSource : public GrSource
@ -52,23 +54,23 @@ protected:
std::wstring m_displayName; std::wstring m_displayName;
std::wstring m_defaultSaveName; std::wstring m_defaultSaveName;
bool m_bRequiresTexturePack; bool m_bRequiresTexturePack;
int m_requiredTexturePackId; std::uint32_t m_requiredTexturePackId;
std::wstring m_grfPath; std::wstring m_grfPath;
std::wstring m_baseSavePath; std::wstring m_baseSavePath;
bool m_bRequiresBaseSave; bool m_bRequiresBaseSave;
public: public:
virtual bool requiresTexturePack(); virtual bool requiresTexturePack();
virtual UINT getRequiredTexturePackId(); virtual std::uint32_t getRequiredTexturePackId();
virtual std::wstring getDefaultSaveName(); virtual std::wstring getDefaultSaveName();
virtual LPCWSTR getWorldName(); virtual const wchar_t *getWorldName();
virtual LPCWSTR getDisplayName(); virtual const wchar_t *getDisplayName();
virtual std::wstring getGrfPath(); virtual std::wstring getGrfPath();
virtual bool requiresBaseSave(); virtual bool requiresBaseSave();
virtual std::wstring getBaseSavePath(); virtual std::wstring getBaseSavePath();
virtual void setRequiresTexturePack(bool x); 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 setDefaultSaveName(const std::wstring &x);
virtual void setWorldName(const std::wstring &x); virtual void setWorldName(const std::wstring &x);
virtual void setDisplayName(const std::wstring &x); virtual void setDisplayName(const std::wstring &x);
@ -104,8 +106,8 @@ private:
bool m_hasLoadedData; bool m_hasLoadedData;
PBYTE m_pbBaseSaveData; std::uint8_t *m_pbBaseSaveData;
DWORD m_dwBaseSaveSize; unsigned int m_baseSaveSize;
public: public:
@ -117,10 +119,10 @@ public:
bool isFromDLC(); bool isFromDLC();
bool requiresTexturePack(); bool requiresTexturePack();
UINT getRequiredTexturePackId(); std::uint32_t getRequiredTexturePackId();
std::wstring getDefaultSaveName(); std::wstring getDefaultSaveName();
LPCWSTR getWorldName(); const wchar_t *getWorldName();
LPCWSTR getDisplayName(); const wchar_t *getDisplayName();
std::wstring getGrfPath(); std::wstring getGrfPath();
bool requiresBaseSave(); bool requiresBaseSave();
std::wstring getBaseSavePath(); std::wstring getBaseSavePath();
@ -128,7 +130,7 @@ public:
void setGrSource(GrSource *grs); void setGrSource(GrSource *grs);
void setRequiresTexturePack(bool x); void setRequiresTexturePack(bool x);
void setRequiredTexturePackId(UINT x); void setRequiredTexturePackId(std::uint32_t x);
void setDefaultSaveName(const std::wstring &x); void setDefaultSaveName(const std::wstring &x);
void setWorldName(const std::wstring &x); void setWorldName(const std::wstring &x);
void setDisplayName(const std::wstring &x); void setDisplayName(const std::wstring &x);
@ -137,8 +139,8 @@ public:
bool ready(); bool ready();
void setBaseSaveData(PBYTE pbData, DWORD dwSize); void setBaseSaveData(std::uint8_t *pbData, unsigned int dataSize);
PBYTE getBaseSaveData(DWORD &size); std::uint8_t *getBaseSaveData(unsigned int &size);
bool hasBaseSaveData(); bool hasBaseSaveData();
void deleteBaseSaveData(); void deleteBaseSaveData();
@ -169,7 +171,7 @@ public:
virtual ConsoleGameRules::EGameRuleType getActionType(); 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 void getChildren(std::vector<GameRuleDefinition *> *children);
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
@ -187,7 +189,7 @@ private:
void clearSchematics(); void clearSchematics();
public: 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: public:
ConsoleSchematicFile *getSchematicFile(const std::wstring &filename); ConsoleSchematicFile *getSchematicFile(const std::wstring &filename);
@ -197,11 +199,11 @@ public:
void setRequiredGameRules(LevelRuleset *rules); void setRequiredGameRules(LevelRuleset *rules);
LevelRuleset *getRequiredGameRules(); 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); bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature);
void loadStringTable(StringTable *table); 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(); std::unordered_map<std::wstring, ConsoleSchematicFile *> *getUnfinishedSchematicFiles();

View file

@ -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) void LevelRules::removeLevelRule(LevelRuleset *removing)
{ {
// TODO ? // TODO ?
} }

View file

@ -7,8 +7,8 @@ class LevelRules
public: public:
LevelRules(); 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 addLevelRule(const std::wstring &displayName, LevelRuleset *rootRule);
void removeLevelRule(LevelRuleset *removing); void removeLevelRule(LevelRuleset *removing);
}; };

View file

@ -44,7 +44,7 @@ void LevelRuleset::loadStringTable(StringTable *table)
m_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) if(m_stringTable == NULL)
{ {

View file

@ -19,9 +19,9 @@ public:
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_LevelRules; } virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_LevelRules; }
void loadStringTable(StringTable *table); void loadStringTable(StringTable *table);
LPCWSTR getString(const std::wstring &key); const wchar_t *getString(const std::wstring &key);
AABB *getNamedArea(const std::wstring &areaName); AABB *getNamedArea(const std::wstring &areaName);
StringTable *getStringTable() { return m_stringTable; } StringTable *getStringTable() { return m_stringTable; }
}; };

View file

@ -14,7 +14,7 @@ NamedAreaRuleDefinition::~NamedAreaRuleDefinition()
delete m_area; delete m_area;
} }
void NamedAreaRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes) void NamedAreaRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes)
{ {
GameRuleDefinition::writeAttributes(dos, numAttributes + 7); GameRuleDefinition::writeAttributes(dos, numAttributes + 7);

View file

@ -12,7 +12,7 @@ public:
NamedAreaRuleDefinition(); NamedAreaRuleDefinition();
~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; } virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_NamedArea; }

View file

@ -9,7 +9,7 @@ StartFeature::StartFeature()
m_feature = StructureFeature::eFeature_Temples; 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); GameRuleDefinition::writeAttributes(dos, numAttrs + 3);

View file

@ -15,7 +15,7 @@ public:
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_StartFeature; } 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); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature); bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature);

View file

@ -24,7 +24,7 @@ UpdatePlayerRuleDefinition::~UpdatePlayerRuleDefinition()
} }
} }
void UpdatePlayerRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes) void UpdatePlayerRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes)
{ {
int attrCount = 3; int attrCount = 3;
if(m_bUpdateHealth) ++attrCount; if(m_bUpdateHealth) ++attrCount;

View file

@ -26,7 +26,7 @@ public:
virtual void getChildren(std::vector<GameRuleDefinition *> *children); virtual void getChildren(std::vector<GameRuleDefinition *> *children);
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); 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 addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
virtual void postProcessPlayer(std::shared_ptr<Player> player); virtual void postProcessPlayer(std::shared_ptr<Player> player);

View file

@ -8,7 +8,7 @@ UseTileRuleDefinition::UseTileRuleDefinition()
m_useCoords = false; m_useCoords = false;
} }
void UseTileRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes) void UseTileRuleDefinition::writeAttributes(DataOutputStream *dos, unsigned int numAttributes)
{ {
GameRuleDefinition::writeAttributes(dos, numAttributes + 5); GameRuleDefinition::writeAttributes(dos, numAttributes + 5);

View file

@ -17,7 +17,7 @@ public:
ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_UseTileRule; } 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 void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z); virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z);

View file

@ -9,7 +9,7 @@ XboxStructureActionGenerateBox::XboxStructureActionGenerateBox()
m_skipAir = false; m_skipAir = false;
} }
void XboxStructureActionGenerateBox::writeAttributes(DataOutputStream *dos, UINT numAttrs) void XboxStructureActionGenerateBox::writeAttributes(DataOutputStream *dos, unsigned int numAttrs)
{ {
ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 9); ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 9);

View file

@ -19,7 +19,7 @@ public:
virtual int getEndY() { return m_y1; } virtual int getEndY() { return m_y1; }
virtual int getEndZ() { return m_z1; } 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); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
bool generateBoxInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB); bool generateBoxInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB);

View file

@ -8,7 +8,7 @@ XboxStructureActionPlaceBlock::XboxStructureActionPlaceBlock()
m_x = m_y = m_z = m_tile = m_data = 0; 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); ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 5);

View file

@ -18,7 +18,7 @@ public:
virtual int getEndY() { return m_y; } virtual int getEndY() { return m_y; }
virtual int getEndZ() { return m_z; } 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); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
bool placeBlockInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB); bool placeBlockInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB);

View file

@ -21,7 +21,7 @@ XboxStructureActionPlaceContainer::~XboxStructureActionPlaceContainer()
} }
// 4J-JEV: Super class handles attr-facing fine. // 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) void XboxStructureActionPlaceContainer::getChildren(std::vector<GameRuleDefinition *> *children)

View file

@ -21,7 +21,7 @@ public:
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
// 4J-JEV: Super class handles attr-facing fine. // 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); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);

View file

@ -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); XboxStructureActionPlaceBlock::writeAttributes(dos, numAttrs + 1);

View file

@ -17,7 +17,7 @@ public:
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_PlaceSpawner; } 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); virtual void addAttribute(const std::wstring &attributeName, const std::wstring &attributeValue);
bool placeSpawnerInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB); bool placeSpawnerInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB);

View file

@ -1,6 +1,8 @@
#pragma once #pragma once
#include <cstdint>
// 3 bit user index // 3 bit user index
// 5 bits alpha // 5 bits alpha
// 1 bit decoration // 1 bit decoration
@ -35,8 +37,8 @@
#define MAKE_SKIN_BITMASK(bDlcSkin, dwSkinId) ( (bDlcSkin?0x80000000:0) | (dwSkinId & 0x7FFFFFFF) ) #define MAKE_SKIN_BITMASK(bDlcSkin, dwSkinId) ( (bDlcSkin?0x80000000:0) | (dwSkinId & 0x7FFFFFFF) )
#define IS_SKIN_ID_IN_RANGE(dwSkinId) (dwSkinId <= 0x7FFFFFFF) #define IS_SKIN_ID_IN_RANGE(dwSkinId) (dwSkinId <= 0x7FFFFFFF)
#define GET_DLC_SKIN_ID_FROM_BITMASK(uiBitmask) (((DWORD)uiBitmask)&0x7FFFFFFF) #define GET_DLC_SKIN_ID_FROM_BITMASK(uiBitmask) (static_cast<std::uint32_t>(uiBitmask) & 0x7FFFFFFF)
#define GET_UGC_SKIN_ID_FROM_BITMASK(uiBitmask) (((DWORD)uiBitmask)&0x7FFFFFE0) #define GET_UGC_SKIN_ID_FROM_BITMASK(uiBitmask) (static_cast<std::uint32_t>(uiBitmask) & 0x7FFFFFE0)
#define GET_DEFAULT_SKIN_ID_FROM_BITMASK(uiBitmask) (((DWORD)uiBitmask)&0x0000001F) #define GET_DEFAULT_SKIN_ID_FROM_BITMASK(uiBitmask) (static_cast<std::uint32_t>(uiBitmask) & 0x0000001F)
#define GET_IS_DLC_SKIN_FROM_BITMASK(uiBitmask) ((((DWORD)uiBitmask)&0x80000000)?true:false) #define GET_IS_DLC_SKIN_FROM_BITMASK(uiBitmask) ((static_cast<std::uint32_t>(uiBitmask) & 0x80000000) ? true : false)

View file

@ -146,7 +146,7 @@ void CGameNetworkManager::DoWork()
#endif #endif
} }
bool CGameNetworkManager::_RunNetworkGame(LPVOID lpParameter) bool CGameNetworkManager::_RunNetworkGame(void *lpParameter)
{ {
bool success = true; bool success = true;
@ -184,7 +184,7 @@ bool CGameNetworkManager::_RunNetworkGame(LPVOID lpParameter)
return success; return success;
} }
bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParameter) bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, void *lpParameter)
{ {
#ifdef _DURANGO #ifdef _DURANGO
ProfileManager.SetDeferredSignoutEnabled(true); ProfileManager.SetDeferredSignoutEnabled(true);
@ -645,7 +645,7 @@ bool CGameNetworkManager::GetGameSessionInfo(int iPad, SessionID sessionId,Frien
return s_pPlatformNetworkManager->GetGameSessionInfo( iPad, sessionId, foundSession ); 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 ); s_pPlatformNetworkManager->SetSessionsUpdatedCallback( SessionsUpdatedCallback, pSearchParam );
} }
@ -681,7 +681,7 @@ CGameNetworkManager::eJoinGameResult CGameNetworkManager::JoinGame(FriendSession
return (eJoinGameResult)(s_pPlatformNetworkManager->JoinGame( searchResult, localUsersMask, primaryUserIndex )); return (eJoinGameResult)(s_pPlatformNetworkManager->JoinGame( searchResult, localUsersMask, primaryUserIndex ));
} }
void CGameNetworkManager::CancelJoinGame(LPVOID lpParam) void CGameNetworkManager::CancelJoinGame(void *lpParam)
{ {
#ifdef _XBOX_ONE #ifdef _XBOX_ONE
s_pPlatformNetworkManager->CancelJoinGame(); s_pPlatformNetworkManager->CancelJoinGame();
@ -705,7 +705,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
int npAvailability = ProfileManager.getNPAvailability(iPad); int npAvailability = ProfileManager.getNPAvailability(iPad);
if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION)
{ {
UINT uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0] = IDS_OK; uiIDA[0] = IDS_OK;
ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable()); 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) else if(noPrivileges)
{ {
UINT uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK; 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()); 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 else
{ {
UINT uiIDA[2]; unsigned int uiIDA[2];
uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT;
uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; 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()); 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(); MinecraftServer *pServer = MinecraftServer::getInstance();
#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__ #if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
UINT uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK; uiIDA[0]=IDS_CONFIRM_OK;
if( g_NetworkManager.m_bLastDisconnectWasLostRoomOnly ) if( g_NetworkManager.m_bLastDisconnectWasLostRoomOnly )
{ {
@ -1084,7 +1084,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
#elif defined(_XBOX_ONE) #elif defined(_XBOX_ONE)
if( g_NetworkManager.m_bFullSessionMessageOnNextSessionChange ) if( g_NetworkManager.m_bFullSessionMessageOnNextSessionChange )
{ {
UINT uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK; 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()); 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 ); 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) 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 // 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; uiIDA[0]=IDS_OK;
ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPadNotSignedInLive, NULL, NULL, app.GetStringTable()); 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) // Signed in to PSN but not connected (no internet access)
assert(!ProfileManager.isConnectedToPSN(iPadNotSignedInLive)); assert(!ProfileManager.isConnectedToPSN(iPadNotSignedInLive));
UINT uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0] = IDS_OK; uiIDA[0] = IDS_OK;
ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPadNotSignedInLive, NULL, NULL, app.GetStringTable()); ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPadNotSignedInLive, NULL, NULL, app.GetStringTable());
} }
else else
{ {
// Not signed in to PSN // Not signed in to PSN
UINT uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; 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); 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())) // if (ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad()))
// { // {
// // Signed in to PSN but not connected (no internet access) // // Signed in to PSN but not connected (no internet access)
// UINT uiIDA[1]; // unsigned int uiIDA[1];
// uiIDA[0] = IDS_OK; // uiIDA[0] = IDS_OK;
// ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL, app.GetStringTable()); // ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL, app.GetStringTable());
// } // }
// else // else
{ {
// Not signed in to PSN // Not signed in to PSN
UINT uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; 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); 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 // Check if user-created content is allowed, as we cannot play multiplayer if it's not
bool noUGC = false; bool noUGC = false;
bool bContentRestricted=false; bool bContentRestricted=false;
BOOL pccAllowed = TRUE; bool pccAllowed = true;
BOOL pccFriendsAllowed = TRUE; bool pccFriendsAllowed = true;
#if defined(__PS3__) || defined(__PSVITA__) #if defined(__PS3__) || defined(__PSVITA__)
ProfileManager.GetChatAndContentRestrictions(userIndex,false,&noUGC,&bContentRestricted,NULL); ProfileManager.GetChatAndContentRestrictions(userIndex,false,&noUGC,&bContentRestricted,NULL);
#else #else
@ -1684,7 +1684,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
#if defined(_XBOX) || defined(__PS3__) #if defined(_XBOX) || defined(__PS3__)
if(joiningUsers > 1 && !RenderManager.IsHiDef() && userIndex != ProfileManager.GetPrimaryPad()) if(joiningUsers > 1 && !RenderManager.IsHiDef() && userIndex != ProfileManager.GetPrimaryPad())
{ {
UINT uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK; uiIDA[0]=IDS_CONFIRM_OK;
// 4J-PB - it's possible there is no primary pad here, when accepting an invite from the dashboard // 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 #endif
else if(noPrivileges) else if(noPrivileges)
{ {
UINT uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK; uiIDA[0]=IDS_CONFIRM_OK;
// 4J-PB - it's possible there is no primary pad here, when accepting an invite from the dashboard // 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 else
{ {
UINT uiIDA[2]; unsigned int uiIDA[2];
uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT;
uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; 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()); 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) if(noPrivileges)
{ {
UINT uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK; 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()); 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 // the FromInvite will make the lib decide how many panes to display based on connected pads/signed in players
#ifdef _XBOX #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 #else
SignInInfo info; SignInInfo info;
info.Func = &CGameNetworkManager::JoinFromInvite_SignInReturned; info.Func = &CGameNetworkManager::JoinFromInvite_SignInReturned;
info.lpParam = (LPVOID)pInviteInfo; info.lpParam = (void *)pInviteInfo;
info.requireOnline = true; info.requireOnline = true;
app.DebugPrintf("Using fullscreen layer\n"); app.DebugPrintf("Using fullscreen layer\n");
ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_QuadrantSignin,&info,eUILayer_Alert,eUIGroup_Fullscreen); ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_QuadrantSignin,&info,eUILayer_Alert,eUIGroup_Fullscreen);

View file

@ -54,8 +54,8 @@ public:
void Initialise(); void Initialise();
void Terminate(); void Terminate();
void DoWork(); void DoWork();
bool _RunNetworkGame(LPVOID lpParameter); bool _RunNetworkGame(void *lpParameter);
bool StartNetworkGame(Minecraft *minecraft, LPVOID lpParameter); bool StartNetworkGame(Minecraft *minecraft, void *lpParameter);
int CorrectErrorIDS(int IDS); int CorrectErrorIDS(int IDS);
// Player management // Player management
@ -98,7 +98,7 @@ public:
bool SessionHasSpace(unsigned int spaceRequired = 1); bool SessionHasSpace(unsigned int spaceRequired = 1);
std::vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly); std::vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly);
bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession); 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 GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam );
void ForceFriendsSessionRefresh(); void ForceFriendsSessionRefresh();
@ -106,7 +106,7 @@ public:
bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo); bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo);
eJoinGameResult JoinGame(FriendSessionInfo *searchResult, int localUsersMask); 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); bool LeaveGame(bool bMigrateHost);
static int JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad); static int JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad);
void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL);

View file

@ -114,7 +114,7 @@ private:
public: public:
virtual std::vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly) = 0; virtual std::vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly) = 0;
virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession) = 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 GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ) = 0;
virtual void ForceFriendsSessionRefresh() = 0; virtual void ForceFriendsSessionRefresh() = 0;

View file

@ -134,8 +134,8 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa
m_bSearchPending = false; m_bSearchPending = false;
m_bIsOfflineGame = false; m_bIsOfflineGame = false;
m_pSearchParam = NULL; m_pSearchParam = nullptr;
m_SessionsUpdatedCallback = NULL; m_SessionsUpdatedCallback = nullptr;
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
{ {
@ -534,7 +534,7 @@ bool CPlatformNetworkManagerStub::GetGameSessionInfo(int iPad, SessionID session
return false; 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; m_SessionsUpdatedCallback = SessionsUpdatedCallback; m_pSearchParam = pSearchParam;
} }

View file

@ -134,8 +134,8 @@ private:
int m_lastSearchPad; int m_lastSearchPad;
bool m_bSearchResultsReady; bool m_bSearchResultsReady;
bool m_bSearchPending; bool m_bSearchPending;
LPVOID m_pSearchParam; void *m_pSearchParam;
void (*m_SessionsUpdatedCallback)(LPVOID pParam); void (*m_SessionsUpdatedCallback)(void *pParam);
C4JThread* m_SearchingThread; C4JThread* m_SearchingThread;
@ -157,7 +157,7 @@ private:
public: public:
virtual std::vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly); virtual std::vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly);
virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession); 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 GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam );
virtual void ForceFriendsSessionRefresh(); virtual void ForceFriendsSessionRefresh();

View file

@ -416,8 +416,8 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa
m_bSearchPending = false; m_bSearchPending = false;
m_bIsOfflineGame = false; m_bIsOfflineGame = false;
m_pSearchParam = NULL; m_pSearchParam = nullptr;
m_SessionsUpdatedCallback = NULL; m_SessionsUpdatedCallback = nullptr;
m_searchResultsCount = 0; m_searchResultsCount = 0;
m_pSearchResults = NULL; m_pSearchResults = NULL;
@ -1254,7 +1254,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session
#endif #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; m_SessionsUpdatedCallback = SessionsUpdatedCallback; m_pSearchParam = pSearchParam;
} }

View file

@ -149,8 +149,8 @@ private:
int m_lastSearchPad; int m_lastSearchPad;
bool m_bSearchPending; bool m_bSearchPending;
LPVOID m_pSearchParam; void *m_pSearchParam;
void (*m_SessionsUpdatedCallback)(LPVOID pParam); void (*m_SessionsUpdatedCallback)(void *pParam);
C4JThread* m_SearchingThread; C4JThread* m_SearchingThread;
@ -168,7 +168,7 @@ private:
public: public:
virtual std::vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly); virtual std::vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly);
virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession); 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 GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam );
virtual void ForceFriendsSessionRefresh(); virtual void ForceFriendsSessionRefresh();

View file

@ -238,7 +238,7 @@ bool SonyRemoteStorage::setData( PSAVE_INFO info, CallbackFunc cb, LPVOID lpPara
return true; 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; SonyRemoteStorage *pClass= (SonyRemoteStorage *)lpParam;
@ -250,10 +250,10 @@ int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThum
app.DebugPrintf("Received data for a thumbnail\n"); app.DebugPrintf("Received data for a thumbnail\n");
if(pbThumbnail && dwThumbnailBytes) if(thumbnailData && thumbnailBytes)
{ {
pClass->m_thumbnailData = pbThumbnail; pClass->m_thumbnailData = thumbnailData;
pClass->m_thumbnailDataSize = dwThumbnailBytes; pClass->m_thumbnailDataSize = thumbnailBytes;
} }
else else
{ {

View file

@ -3,6 +3,8 @@
#include "sceRemoteStorage/header/sceRemoteStorage.h" #include "sceRemoteStorage/header/sceRemoteStorage.h"
#include <cstdint>
class SonyRemoteStorage class SonyRemoteStorage
{ {
public: public:
@ -94,7 +96,7 @@ public:
bool setData( PSAVE_INFO info, CallbackFunc cb, LPVOID lpParam ); 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); static int setDataThread(void* lpParam);
SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {} SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {}
@ -107,7 +109,7 @@ protected:
int m_dataProgress; int m_dataProgress;
char *m_pchServiceID; char *m_pchServiceID;
PBYTE m_thumbnailData; std::uint8_t *m_thumbnailData;
unsigned int m_thumbnailDataSize; unsigned int m_thumbnailDataSize;
C4JThread* m_SetDataThread; C4JThread* m_SetDataThread;
PSAVE_INFO m_setDataSaveInfo; PSAVE_INFO m_setDataSaveInfo;

View file

@ -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 hintsOn = m_isFullTutorial || (app.GetGameSettings(m_iPad,eGameSetting_Hints) && app.GetGameSettings(m_iPad,eGameSetting_DisplayHUD));
bool messageShown = false; bool messageShown = false;
DWORD time = GetTickCount(); std::uint32_t time = GetTickCount();
if(message != NULL && (message->m_forceDisplay || hintsOn) && if(message != NULL && (message->m_forceDisplay || hintsOn) &&
(!message->m_delay || (!message->m_delay ||
( (

Some files were not shown because too many files have changed in this diff Show more