the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 756 lines 33 kB view raw
1#include "stdafx.h" 2#ifndef __PS3__ 3//#include <compressapi.h> 4#endif // __PS3__ 5 6#ifdef __PS3__ 7#include "PS3\Sentient\SentientManager.h" 8#include "StatsCounter.h" 9#include "PS3\Social\SocialManager.h" 10#include <libsn.h> 11#include <libsntuner.h> 12#elif defined _DURANGO 13#include "Durango\Sentient\SentientManager.h" 14#include "StatsCounter.h" 15#include "Durango\Social\SocialManager.h" 16#include "Durango\Sentient\DynamicConfigurations.h" 17#include "Durango\DurangoExtras\xcompress.h" 18#elif defined _WINDOWS64 19#include "Windows64\Sentient\SentientManager.h" 20#include "StatsCounter.h" 21#include "Windows64\Social\SocialManager.h" 22#include "Windows64\Sentient\DynamicConfigurations.h" 23#include "Windows64\Network\WinsockNetLayer.h" 24#elif defined __PSVITA__ 25#include "PSVita\Sentient\SentientManager.h" 26#include "StatsCounter.h" 27#include "PSVita\Social\SocialManager.h" 28#include "PSVita\Sentient\DynamicConfigurations.h" 29#include <libperf.h> 30#else 31#include "Orbis\Sentient\SentientManager.h" 32#include "StatsCounter.h" 33#include "Orbis\Social\SocialManager.h" 34#include "Orbis\Sentient\DynamicConfigurations.h" 35#include <perf.h> 36#endif 37 38#if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) 39#ifdef _WINDOWS64 40//C4JStorage StorageManager; 41C_4JProfile ProfileManager; 42#endif 43#endif // __PS3__ 44CSentientManager SentientManager; 45CXuiStringTable StringTable; 46 47#ifndef _XBOX_ONE 48ATG::XMLParser::XMLParser() {} 49ATG::XMLParser::~XMLParser() {} 50HRESULT ATG::XMLParser::ParseXMLBuffer(CONST CHAR* strBuffer, UINT uBufferSize) { return S_OK; } 51VOID ATG::XMLParser::RegisterSAXCallbackInterface(ISAXCallback* pISAXCallback) {} 52#endif 53 54bool CSocialManager::IsTitleAllowedToPostAnything() { return false; } 55bool CSocialManager::AreAllUsersAllowedToPostImages() { return false; } 56bool CSocialManager::IsTitleAllowedToPostImages() { return false; } 57 58bool CSocialManager::PostLinkToSocialNetwork(ESocialNetwork eSocialNetwork, DWORD dwUserIndex, bool bUsingKinect) { return false; } 59bool CSocialManager::PostImageToSocialNetwork(ESocialNetwork eSocialNetwork, DWORD dwUserIndex, bool bUsingKinect) { return false; } 60CSocialManager* CSocialManager::Instance() { return NULL; } 61void CSocialManager::SetSocialPostText(LPCWSTR Title, LPCWSTR Caption, LPCWSTR Desc) {}; 62 63DWORD XShowPartyUI(DWORD dwUserIndex) { return 0; } 64DWORD XShowFriendsUI(DWORD dwUserIndex) { return 0; } 65HRESULT XPartyGetUserList(XPARTY_USER_LIST* pUserList) { return S_OK; } 66DWORD XContentGetThumbnail(DWORD dwUserIndex, const XCONTENT_DATA* pContentData, PBYTE pbThumbnail, PDWORD pcbThumbnail, PXOVERLAPPED* pOverlapped) { return 0; } 67void XShowAchievementsUI(int i) {} 68DWORD XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE Mode) { return 0; } 69 70#ifndef _DURANGO 71void PIXAddNamedCounter(int a, char* b, ...) {} 72//#define PS3_USE_PIX_EVENTS 73//#define PS4_USE_PIX_EVENTS 74void PIXBeginNamedEvent(int a, char* b, ...) 75{ 76#ifdef PS4_USE_PIX_EVENTS 77 char buf[512]; 78 va_list args; 79 va_start(args, b); 80 vsprintf(buf, b, args); 81 sceRazorCpuPushMarker(buf, 0xffffffff, SCE_RAZOR_MARKER_ENABLE_HUD); 82 83#endif 84#ifdef PS3_USE_PIX_EVENTS 85 char buf[256]; 86 wchar_t wbuf[256]; 87 va_list args; 88 va_start(args, b); 89 vsprintf(buf, b, args); 90 snPushMarker(buf); 91 92 // mbstowcs(wbuf,buf,256); 93 // RenderManager.BeginEvent(wbuf); 94 va_end(args); 95#endif 96} 97#if 0//__PSVITA__ 98if (PixDepth < 64) 99{ 100 char buf[512]; 101 va_list args; 102 va_start(args, b); 103 vsprintf(buf, b, args); 104 sceRazorCpuPushMarkerWithHud(buf, 0xffffffff, SCE_RAZOR_MARKER_ENABLE_HUD); 105} 106PixDepth += 1; 107#endif 108 109 110void PIXEndNamedEvent() 111{ 112#ifdef PS4_USE_PIX_EVENTS 113 sceRazorCpuPopMarker(); 114#endif 115#ifdef PS3_USE_PIX_EVENTS 116 snPopMarker(); 117 // RenderManager.EndEvent(); 118#endif 119#if 0//__PSVITA__ 120 if (PixDepth <= 64) 121 { 122 sceRazorCpuPopMarker(); 123 } 124 PixDepth -= 1; 125#endif 126} 127void PIXSetMarkerDeprecated(int a, char* b, ...) {} 128#else 129// 4J Stu - Removed this implementation in favour of a macro that will convert our string format 130// conversion at compile time rather than at runtime 131//void PIXBeginNamedEvent(int a, char *b, ...) 132//{ 133// char buf[256]; 134// wchar_t wbuf[256]; 135// va_list args; 136// va_start(args,b); 137// vsprintf(buf,b,args); 138// 139// mbstowcs(wbuf,buf,256); 140// PIXBeginEvent(a,wbuf); 141//} 142// 143//void PIXEndNamedEvent() 144//{ 145// PIXEndEvent(); 146//} 147// 148//void PIXSetMarkerDeprecated(int a, char *b, ...) 149//{ 150// char buf[256]; 151// wchar_t wbuf[256]; 152// va_list args; 153// va_start(args,b); 154// vsprintf(buf,b,args); 155// 156// mbstowcs(wbuf,buf,256); 157// PIXSetMarker(a, wbuf); 158//} 159#endif 160 161// void *D3DXBUFFER::GetBufferPointer() { return NULL; } 162// int D3DXBUFFER::GetBufferSize() { return 0; } 163// void D3DXBUFFER::Release() {} 164 165// #ifdef _DURANGO 166// void GetLocalTime(SYSTEMTIME *time) {} 167// #endif 168 169 170bool IsEqualXUID(PlayerUID a, PlayerUID b) 171{ 172#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) || defined(_DURANGO) 173 return (a == b); 174#else 175 return false; 176#endif 177} 178 179void XMemCpy(void* a, const void* b, size_t s) { memcpy(a, b, s); } 180void XMemSet(void* a, int t, size_t s) { memset(a, t, s); } 181void XMemSet128(void* a, int t, size_t s) { memset(a, t, s); } 182void* XPhysicalAlloc(SIZE_T a, ULONG_PTR b, ULONG_PTR c, DWORD d) { return malloc(a); } 183void XPhysicalFree(void* a) { free(a); } 184 185D3DXVECTOR3::D3DXVECTOR3() {} 186D3DXVECTOR3::D3DXVECTOR3(float x, float y, float z) : x(x), y(y), z(z) {} 187D3DXVECTOR3& D3DXVECTOR3::operator += (CONST D3DXVECTOR3 & add) { x += add.x; y += add.y; z += add.z; return *this; } 188 189BYTE IQNetPlayer::GetSmallId() { return m_smallId; } 190void IQNetPlayer::SendData(IQNetPlayer * player, const void* pvData, DWORD dwDataSize, DWORD dwFlags) 191{ 192 if (WinsockNetLayer::IsActive()) 193 { 194 WinsockNetLayer::SendToSmallId(player->m_smallId, pvData, dwDataSize); 195 } 196} 197bool IQNetPlayer::IsSameSystem(IQNetPlayer * player) { return (this == player) || (!m_isRemote && !player->m_isRemote); } 198DWORD IQNetPlayer::GetSendQueueSize(IQNetPlayer * player, DWORD dwFlags) { return 0; } 199DWORD IQNetPlayer::GetCurrentRtt() { return 0; } 200bool IQNetPlayer::IsHost() { return m_isHostPlayer; } 201bool IQNetPlayer::IsGuest() { return false; } 202bool IQNetPlayer::IsLocal() { return true; } 203PlayerUID IQNetPlayer::GetXuid() { return (PlayerUID)(0xe000d45248242f2e + m_smallId); } // todo: restore to INVALID_XUID once saves support this 204extern wstring g_playerName; 205LPCWSTR IQNetPlayer::GetGamertag() { return g_playerName.empty() ? L"Windows" : g_playerName.c_str(); } 206int IQNetPlayer::GetSessionIndex() { return 0; } 207bool IQNetPlayer::IsTalking() { return false; } 208bool IQNetPlayer::IsMutedByLocalUser(DWORD dwUserIndex) { return false; } 209bool IQNetPlayer::HasVoice() { return false; } 210bool IQNetPlayer::HasCamera() { return false; } 211int IQNetPlayer::GetUserIndex() { return this - &IQNet::m_player[0]; } 212void IQNetPlayer::SetCustomDataValue(ULONG_PTR ulpCustomDataValue) { 213 m_customData = ulpCustomDataValue; 214} 215ULONG_PTR IQNetPlayer::GetCustomDataValue() { 216 return m_customData; 217} 218 219IQNetPlayer IQNet::m_player[MINECRAFT_NET_MAX_PLAYERS]; 220DWORD IQNet::s_playerCount = 1; 221bool IQNet::s_isHosting = true; 222 223QNET_STATE _iQNetStubState = QNET_STATE_IDLE; 224 225void Win64_SetupRemoteQNetPlayer(IQNetPlayer * player, BYTE smallId, bool isHost, bool isLocal) 226{ 227 player->m_smallId = smallId; 228 player->m_isRemote = !isLocal; 229 player->m_isHostPlayer = isHost; 230 swprintf_s(player->m_gamertag, 32, L"Player%d", smallId); 231 if (smallId >= IQNet::s_playerCount) 232 IQNet::s_playerCount = smallId + 1; 233} 234 235HRESULT IQNet::AddLocalPlayerByUserIndex(DWORD dwUserIndex) { return S_OK; } 236IQNetPlayer* IQNet::GetHostPlayer() { return &m_player[0]; } 237IQNetPlayer* IQNet::GetLocalPlayerByUserIndex(DWORD dwUserIndex) 238{ 239 if (s_isHosting) 240 { 241 if (dwUserIndex < MINECRAFT_NET_MAX_PLAYERS && !m_player[dwUserIndex].m_isRemote) 242 return &m_player[dwUserIndex]; 243 return NULL; 244 } 245 if (dwUserIndex != 0) 246 return NULL; 247 for (DWORD i = 0; i < s_playerCount; i++) 248 { 249 if (!m_player[i].m_isRemote) 250 return &m_player[i]; 251 } 252 return NULL; 253} 254static bool Win64_IsActivePlayer(IQNetPlayer * p, DWORD index) 255{ 256 if (index == 0) return true; 257 return (p->GetCustomDataValue() != 0); 258} 259 260IQNetPlayer* IQNet::GetPlayerByIndex(DWORD dwPlayerIndex) 261{ 262 DWORD found = 0; 263 for (DWORD i = 0; i < s_playerCount; i++) 264 { 265 if (Win64_IsActivePlayer(&m_player[i], i)) 266 { 267 if (found == dwPlayerIndex) return &m_player[i]; 268 found++; 269 } 270 } 271 return &m_player[0]; 272} 273IQNetPlayer* IQNet::GetPlayerBySmallId(BYTE SmallId) 274{ 275 for (DWORD i = 0; i < s_playerCount; i++) 276 { 277 if (m_player[i].m_smallId == SmallId && Win64_IsActivePlayer(&m_player[i], i)) return &m_player[i]; 278 } 279 return NULL; 280} 281IQNetPlayer* IQNet::GetPlayerByXuid(PlayerUID xuid) 282{ 283 for (DWORD i = 0; i < s_playerCount; i++) 284 { 285 if (Win64_IsActivePlayer(&m_player[i], i) && m_player[i].GetXuid() == xuid) return &m_player[i]; 286 } 287 return &m_player[0]; 288} 289DWORD IQNet::GetPlayerCount() 290{ 291 DWORD count = 0; 292 for (DWORD i = 0; i < s_playerCount; i++) 293 { 294 if (Win64_IsActivePlayer(&m_player[i], i)) count++; 295 } 296 return count; 297} 298QNET_STATE IQNet::GetState() { return _iQNetStubState; } 299bool IQNet::IsHost() { return s_isHosting; } 300HRESULT IQNet::JoinGameFromInviteInfo(DWORD dwUserIndex, DWORD dwUserMask, const INVITE_INFO * pInviteInfo) { return S_OK; } 301void IQNet::HostGame() { _iQNetStubState = QNET_STATE_SESSION_STARTING; s_isHosting = true; } 302void IQNet::ClientJoinGame() { _iQNetStubState = QNET_STATE_SESSION_STARTING; s_isHosting = false; } 303void IQNet::EndGame() 304{ 305 _iQNetStubState = QNET_STATE_IDLE; 306 s_isHosting = false; 307 s_playerCount = 1; 308 for (int i = 1; i < MINECRAFT_NET_MAX_PLAYERS; i++) 309 { 310 m_player[i].m_smallId = 0; 311 m_player[i].m_isRemote = false; 312 m_player[i].m_isHostPlayer = false; 313 m_player[i].m_gamertag[0] = 0; 314 m_player[i].SetCustomDataValue(0); 315 } 316} 317 318DWORD MinecraftDynamicConfigurations::GetTrialTime() { return DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME; } 319 320void XSetThreadProcessor(HANDLE a, int b) {} 321// #if !(defined __PS3__) && !(defined __ORBIS__) 322// BOOL XCloseHandle(HANDLE a) { return CloseHandle(a); } 323// #endif // __PS3__ 324 325DWORD XUserGetSigninInfo( 326 DWORD dwUserIndex, 327 DWORD dwFlags, 328 PXUSER_SIGNIN_INFO pSigninInfo 329) 330{ 331 return 0; 332} 333 334LPCWSTR CXuiStringTable::Lookup(LPCWSTR szId) { return szId; } 335LPCWSTR CXuiStringTable::Lookup(UINT nIndex) { return L"String"; } 336void CXuiStringTable::Clear() {} 337HRESULT CXuiStringTable::Load(LPCWSTR szId) { return S_OK; } 338 339DWORD XUserAreUsersFriends(DWORD dwUserIndex, PPlayerUID pXuids, DWORD dwXuidCount, PBOOL pfResult, void* pOverlapped) { return 0; } 340 341#if defined __ORBIS__ || defined __PS3__ || defined _XBOX_ONE 342#else 343HRESULT XMemDecompress( 344 XMEMDECOMPRESSION_CONTEXT Context, 345 VOID * pDestination, 346 SIZE_T * pDestSize, 347 CONST VOID * pSource, 348 SIZE_T SrcSize 349) 350{ 351 memcpy(pDestination, pSource, SrcSize); 352 *pDestSize = SrcSize; 353 return S_OK; 354 355 /* 356 DECOMPRESSOR_HANDLE Decompressor = (DECOMPRESSOR_HANDLE)Context; 357 if( Decompress( 358 Decompressor, // Decompressor handle 359 (void *)pSource, // Compressed data 360 SrcSize, // Compressed data size 361 pDestination, // Decompressed buffer 362 *pDestSize, // Decompressed buffer size 363 pDestSize) ) // Decompressed data size 364 { 365 return S_OK; 366 } 367 else 368 */ 369 { 370 return E_FAIL; 371 } 372} 373 374HRESULT XMemCompress( 375 XMEMCOMPRESSION_CONTEXT Context, 376 VOID * pDestination, 377 SIZE_T * pDestSize, 378 CONST VOID * pSource, 379 SIZE_T SrcSize 380) 381{ 382 memcpy(pDestination, pSource, SrcSize); 383 *pDestSize = SrcSize; 384 return S_OK; 385 386 /* 387 COMPRESSOR_HANDLE Compressor = (COMPRESSOR_HANDLE)Context; 388 if( Compress( 389 Compressor, // Compressor Handle 390 (void *)pSource, // Input buffer, Uncompressed data 391 SrcSize, // Uncompressed data size 392 pDestination, // Compressed Buffer 393 *pDestSize, // Compressed Buffer size 394 pDestSize) ) // Compressed Data size 395 { 396 return S_OK; 397 } 398 else 399 */ 400 { 401 return E_FAIL; 402 } 403} 404 405HRESULT XMemCreateCompressionContext( 406 XMEMCODEC_TYPE CodecType, 407 CONST VOID * pCodecParams, 408 DWORD Flags, 409 XMEMCOMPRESSION_CONTEXT * pContext 410) 411{ 412 /* 413 COMPRESSOR_HANDLE Compressor = NULL; 414 415 HRESULT hr = CreateCompressor( 416 COMPRESS_ALGORITHM_XPRESS_HUFF, // Compression Algorithm 417 NULL, // Optional allocation routine 418 &Compressor); // Handle 419 420 pContext = (XMEMDECOMPRESSION_CONTEXT *)Compressor; 421 return hr; 422 */ 423 return 0; 424} 425 426HRESULT XMemCreateDecompressionContext( 427 XMEMCODEC_TYPE CodecType, 428 CONST VOID * pCodecParams, 429 DWORD Flags, 430 XMEMDECOMPRESSION_CONTEXT * pContext 431) 432{ 433 /* 434 DECOMPRESSOR_HANDLE Decompressor = NULL; 435 436 HRESULT hr = CreateDecompressor( 437 COMPRESS_ALGORITHM_XPRESS_HUFF, // Compression Algorithm 438 NULL, // Optional allocation routine 439 &Decompressor); // Handle 440 441 pContext = (XMEMDECOMPRESSION_CONTEXT *)Decompressor; 442 return hr; 443 */ 444 return 0; 445} 446 447void XMemDestroyCompressionContext(XMEMCOMPRESSION_CONTEXT Context) 448{ 449 // COMPRESSOR_HANDLE Compressor = (COMPRESSOR_HANDLE)Context; 450 // CloseCompressor(Compressor); 451} 452 453void XMemDestroyDecompressionContext(XMEMDECOMPRESSION_CONTEXT Context) 454{ 455 // DECOMPRESSOR_HANDLE Decompressor = (DECOMPRESSOR_HANDLE)Context; 456 // CloseDecompressor(Decompressor); 457} 458#endif 459 460//#ifndef __PS3__ 461#if !(defined _DURANGO || defined __PS3__ || defined __ORBIS__ || defined __PSVITA__) 462DWORD XGetLanguage() { return 1; } 463DWORD XGetLocale() { return 0; } 464DWORD XEnableGuestSignin(BOOL fEnable) { return 0; } 465#endif 466 467 468 469/////////////////////////////////////////////// Profile library 470#ifdef _WINDOWS64 471static void* profileData[4]; 472static bool s_bProfileIsFullVersion; 473void C_4JProfile::Initialise(DWORD dwTitleID, 474 DWORD dwOfferID, 475 unsigned short usProfileVersion, 476 UINT uiProfileValuesC, 477 UINT uiProfileSettingsC, 478 DWORD * pdwProfileSettingsA, 479 int iGameDefinedDataSizeX4, 480 unsigned int* puiGameDefinedDataChangedBitmask) 481{ 482 for (int i = 0; i < 4; i++) 483 { 484 profileData[i] = new byte[iGameDefinedDataSizeX4 / 4]; 485 ZeroMemory(profileData[i], sizeof(byte) * iGameDefinedDataSizeX4 / 4); 486 487 // Set some sane initial values! 488 GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)profileData[i]; 489 pGameSettings->ucMenuSensitivity = 100; //eGameSetting_Sensitivity_InMenu 490 pGameSettings->ucInterfaceOpacity = 80; //eGameSetting_Sensitivity_InMenu 491 pGameSettings->usBitmaskValues |= 0x0200; //eGameSetting_DisplaySplitscreenGamertags - on 492 pGameSettings->usBitmaskValues |= 0x0400; //eGameSetting_Hints - on 493 pGameSettings->usBitmaskValues |= 0x1000; //eGameSetting_Autosave - 2 494 pGameSettings->usBitmaskValues |= 0x8000; //eGameSetting_Tooltips - on 495 pGameSettings->uiBitmaskValues = 0L; // reset 496 pGameSettings->uiBitmaskValues |= GAMESETTING_CLOUDS; //eGameSetting_Clouds - on 497 pGameSettings->uiBitmaskValues |= GAMESETTING_ONLINE; //eGameSetting_GameSetting_Online - on 498 pGameSettings->uiBitmaskValues |= GAMESETTING_FRIENDSOFFRIENDS; //eGameSetting_GameSetting_FriendsOfFriends - on 499 pGameSettings->uiBitmaskValues |= GAMESETTING_DISPLAYUPDATEMSG; //eGameSetting_DisplayUpdateMessage (counter) 500 pGameSettings->uiBitmaskValues &= ~GAMESETTING_BEDROCKFOG; //eGameSetting_BedrockFog - off 501 pGameSettings->uiBitmaskValues |= GAMESETTING_DISPLAYHUD; //eGameSetting_DisplayHUD - on 502 pGameSettings->uiBitmaskValues |= GAMESETTING_DISPLAYHAND; //eGameSetting_DisplayHand - on 503 pGameSettings->uiBitmaskValues |= GAMESETTING_CUSTOMSKINANIM; //eGameSetting_CustomSkinAnim - on 504 pGameSettings->uiBitmaskValues |= GAMESETTING_DEATHMESSAGES; //eGameSetting_DeathMessages - on 505 pGameSettings->uiBitmaskValues |= (GAMESETTING_UISIZE & 0x00000800); // uisize 2 506 pGameSettings->uiBitmaskValues |= (GAMESETTING_UISIZE_SPLITSCREEN & 0x00004000); // splitscreen ui size 3 507 pGameSettings->uiBitmaskValues |= GAMESETTING_ANIMATEDCHARACTER; //eGameSetting_AnimatedCharacter - on 508 509 // TU12 510 // favorite skins added, but only set in TU12 - set to FFs 511 for (int i = 0; i < MAX_FAVORITE_SKINS; i++) 512 { 513 pGameSettings->uiFavoriteSkinA[i] = 0xFFFFFFFF; 514 } 515 pGameSettings->ucCurrentFavoriteSkinPos = 0; 516 // Added a bitmask in TU13 to enable/disable display of the Mash-up pack worlds in the saves list 517 pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; 518 519 // PS3DEC13 520 pGameSettings->uiBitmaskValues &= ~GAMESETTING_PS3EULAREAD; //eGameSetting_PS3_EULA_Read - off 521 522 // PS3 1.05 - added Greek 523 pGameSettings->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; // use the system language 524 525 // PS Vita - network mode added 526 pGameSettings->uiBitmaskValues &= ~GAMESETTING_PSVITANETWORKMODEADHOC; //eGameSetting_PSVita_NetworkModeAdhoc - off 527 528 529 // Tutorials for most menus, and a few other things 530 pGameSettings->ucTutorialCompletion[0] = 0xFF; 531 pGameSettings->ucTutorialCompletion[1] = 0xFF; 532 pGameSettings->ucTutorialCompletion[2] = 0xF; 533 534 // Has gone halfway through the tutorial 535 pGameSettings->ucTutorialCompletion[28] |= 1 << 0; 536 } 537} 538void C_4JProfile::SetTrialTextStringTable(CXuiStringTable * pStringTable, int iAccept, int iReject) {} 539void C_4JProfile::SetTrialAwardText(eAwardType AwardType, int iTitle, int iText) {} 540int C_4JProfile::GetLockedProfile() { return 0; } 541void C_4JProfile::SetLockedProfile(int iProf) {} 542bool C_4JProfile::IsSignedIn(int iQuadrant) { return (iQuadrant == 0); } 543bool C_4JProfile::IsSignedInLive(int iProf) { return true; } 544bool C_4JProfile::IsGuest(int iQuadrant) { return false; } 545UINT 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; } 546UINT C_4JProfile::DisplayOfflineProfile(int(*Func)(LPVOID, const bool, const int iPad), LPVOID lpParam, int iQuadrant) { return 0; } 547UINT C_4JProfile::RequestConvertOfflineToGuestUI(int(*Func)(LPVOID, const bool, const int iPad), LPVOID lpParam, int iQuadrant) { return 0; } 548void C_4JProfile::SetPrimaryPlayerChanged(bool bVal) {} 549bool C_4JProfile::QuerySigninStatus(void) { return true; } 550void C_4JProfile::GetXUID(int iPad, PlayerUID * pXuid, bool bOnlineXuid) 551{ 552#ifdef _WINDOWS64 553 if (iPad != 0) 554 { 555 *pXuid = INVALID_XUID; 556 return; 557 } 558 if (IQNet::s_isHosting) 559 *pXuid = 0xe000d45248242f2e; 560 else 561 *pXuid = 0xe000d45248242f2e + WinsockNetLayer::GetLocalSmallId(); 562#else 563 * pXuid = 0xe000d45248242f2e + iPad; 564#endif 565} 566BOOL C_4JProfile::AreXUIDSEqual(PlayerUID xuid1, PlayerUID xuid2) { return xuid1 == xuid2; } 567BOOL C_4JProfile::XUIDIsGuest(PlayerUID xuid) { return false; } 568bool C_4JProfile::AllowedToPlayMultiplayer(int iProf) { return true; } 569 570#if defined(__ORBIS__) 571bool C_4JProfile::GetChatAndContentRestrictions(int iPad, bool thisQuadrantOnly, bool* pbChatRestricted, bool* pbContentRestricted, int* piAge) 572{ 573 if (pbChatRestricted) *pbChatRestricted = false; 574 if (pbContentRestricted) *pbContentRestricted = false; 575 if (piAge) *piAge = 100; 576 return true; 577} 578#endif 579 580void C_4JProfile::StartTrialGame() {} 581void C_4JProfile::AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, BOOL * allAllowed, BOOL * friendsAllowed) {} 582BOOL C_4JProfile::CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly, PPlayerUID pXuids, DWORD dwXuidCount) { return true; } 583bool C_4JProfile::GetProfileAvatar(int iPad, int(*Func)(LPVOID lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes), LPVOID lpParam) { return false; } 584void C_4JProfile::CancelProfileAvatarRequest() {} 585int C_4JProfile::GetPrimaryPad() { return 0; } 586void C_4JProfile::SetPrimaryPad(int iPad) {} 587#ifdef _DURANGO 588char fakeGamerTag[32] = "PlayerName"; 589void SetFakeGamertag(char* name) { strcpy_s(fakeGamerTag, name); } 590char* C_4JProfile::GetGamertag(int iPad) { return fakeGamerTag; } 591#else 592char* C_4JProfile::GetGamertag(int iPad) { extern char g_Win64Username[17]; return g_Win64Username; } 593wstring C_4JProfile::GetDisplayName(int iPad) { extern wchar_t g_Win64UsernameW[17]; return g_Win64UsernameW; } 594#endif 595bool C_4JProfile::IsFullVersion() { return s_bProfileIsFullVersion; } 596void C_4JProfile::SetSignInChangeCallback(void (*Func)(LPVOID, bool, unsigned int), LPVOID lpParam) {} 597void C_4JProfile::SetNotificationsCallback(void (*Func)(LPVOID, DWORD, unsigned int), LPVOID lpParam) {} 598bool C_4JProfile::RegionIsNorthAmerica(void) { return false; } 599bool C_4JProfile::LocaleIsUSorCanada(void) { return false; } 600HRESULT C_4JProfile::GetLiveConnectionStatus() { return S_OK; } 601bool C_4JProfile::IsSystemUIDisplayed() { return false; } 602void C_4JProfile::SetProfileReadErrorCallback(void (*Func)(LPVOID), LPVOID lpParam) {} 603int(*defaultOptionsCallback)(LPVOID, C_4JProfile::PROFILESETTINGS*, const int iPad) = NULL; 604LPVOID lpProfileParam = NULL; 605int C_4JProfile::SetDefaultOptionsCallback(int(*Func)(LPVOID, PROFILESETTINGS*, const int iPad), LPVOID lpParam) 606{ 607 defaultOptionsCallback = Func; 608 lpProfileParam = lpParam; 609 return 0; 610} 611int C_4JProfile::SetOldProfileVersionCallback(int(*Func)(LPVOID, unsigned char*, const unsigned short, const int), LPVOID lpParam) { return 0; } 612 613// To store the dashboard preferences for controller flipped, etc. 614C_4JProfile::PROFILESETTINGS ProfileSettingsA[XUSER_MAX_COUNT]; 615 616C_4JProfile::PROFILESETTINGS* C_4JProfile::GetDashboardProfileSettings(int iPad) { return &ProfileSettingsA[iPad]; } 617void C_4JProfile::WriteToProfile(int iQuadrant, bool bGameDefinedDataChanged, bool bOverride5MinuteLimitOnProfileWrites) {} 618void C_4JProfile::ForceQueuedProfileWrites(int iPad) {} 619void* C_4JProfile::GetGameDefinedProfileData(int iQuadrant) 620{ 621 // 4J Stu - Don't reset the options when we call this!! 622 //defaultOptionsCallback(lpProfileParam, (C_4JProfile::PROFILESETTINGS *)profileData[iQuadrant], iQuadrant); 623 //pApp->SetDefaultOptions(pSettings,iPad); 624 625 return profileData[iQuadrant]; 626} 627void C_4JProfile::ResetProfileProcessState() {} 628void C_4JProfile::Tick(void) {} 629void C_4JProfile::RegisterAward(int iAwardNumber, int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected, 630 CXuiStringTable * pStringTable, int iTitleStr, int iTextStr, int iAcceptStr, char* pszThemeName, unsigned int ulThemeSize) { 631} 632int C_4JProfile::GetAwardId(int iAwardNumber) { return 0; } 633eAwardType C_4JProfile::GetAwardType(int iAwardNumber) { return eAwardType_Achievement; } 634bool C_4JProfile::CanBeAwarded(int iQuadrant, int iAwardNumber) { return false; } 635void C_4JProfile::Award(int iQuadrant, int iAwardNumber, bool bForce) {} 636bool C_4JProfile::IsAwardsFlagSet(int iQuadrant, int iAward) { return false; } 637void C_4JProfile::RichPresenceInit(int iPresenceCount, int iContextCount) {} 638void C_4JProfile::RegisterRichPresenceContext(int iGameConfigContextID) {} 639void C_4JProfile::SetRichPresenceContextValue(int iPad, int iContextID, int iVal) {} 640void C_4JProfile::SetCurrentGameActivity(int iPad, int iNewPresence, bool bSetOthersToIdle) {} 641void C_4JProfile::DisplayFullVersionPurchase(bool bRequired, int iQuadrant, int iUpsellParam) {} 642void C_4JProfile::SetUpsellCallback(void (*Func)(LPVOID lpParam, eUpsellType type, eUpsellResponse response, int iUserData), LPVOID lpParam) {} 643void C_4JProfile::SetDebugFullOverride(bool bVal) { s_bProfileIsFullVersion = bVal; } 644void C_4JProfile::ShowProfileCard(int iPad, PlayerUID targetUid) {} 645 646/////////////////////////////////////////////// Storage library 647//#ifdef _WINDOWS64 648#if 0 649C4JStorage::C4JStorage() {} 650void C4JStorage::Tick() {} 651C4JStorage::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) { return C4JStorage::EMessage_Undefined; } 652C4JStorage::EMessageResult C4JStorage::GetMessageBoxResult() { return C4JStorage::EMessage_Undefined; } 653bool C4JStorage::SetSaveDevice(int(*Func)(LPVOID, const bool), LPVOID lpParam, bool bForceResetOfSaveDevice) { return true; } 654void C4JStorage::Init(LPCWSTR pwchDefaultSaveName, char* pszSavePackName, int iMinimumSaveSize, int(*Func)(LPVOID, const ESavingMessage, int), LPVOID lpParam) {} 655void C4JStorage::ResetSaveData() {} 656void C4JStorage::SetDefaultSaveNameForKeyboardDisplay(LPCWSTR pwchDefaultSaveName) {} 657void C4JStorage::SetSaveTitle(LPCWSTR pwchDefaultSaveName) {} 658LPCWSTR C4JStorage::GetSaveTitle() { return L""; } 659bool C4JStorage::GetSaveUniqueNumber(INT * piVal) { return true; } 660bool C4JStorage::GetSaveUniqueFilename(char* pszName) { return true; } 661void C4JStorage::SetSaveUniqueFilename(char* szFilename) {} 662void C4JStorage::SetState(ESaveGameControlState eControlState, int(*Func)(LPVOID, const bool), LPVOID lpParam) {} 663void C4JStorage::SetSaveDisabled(bool bDisable) {} 664bool C4JStorage::GetSaveDisabled(void) { return false; } 665unsigned int C4JStorage::GetSaveSize() { return 0; } 666void C4JStorage::GetSaveData(void* pvData, unsigned int* pulBytes) {} 667PVOID C4JStorage::AllocateSaveData(unsigned int ulBytes) { return new char[ulBytes]; } 668void C4JStorage::SaveSaveData(unsigned int ulBytes, PBYTE pbThumbnail, DWORD cbThumbnail, PBYTE pbTextData, DWORD dwTextLen) {} 669void C4JStorage::CopySaveDataToNewSave(PBYTE pbThumbnail, DWORD cbThumbnail, WCHAR * wchNewName, int (*Func)(LPVOID lpParam, bool), LPVOID lpParam) {} 670void C4JStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected) {} 671bool C4JStorage::GetSaveDeviceSelected(unsigned int iPad) { return true; } 672C4JStorage::ELoadGameStatus C4JStorage::DoesSaveExist(bool* pbExists) { return C4JStorage::ELoadGame_Idle; } 673bool C4JStorage::EnoughSpaceForAMinSaveGame() { return true; } 674void C4JStorage::SetSaveMessageVPosition(float fY) {} 675//C4JStorage::ESGIStatus C4JStorage::GetSavesInfo(int iPad,bool ( *Func)(LPVOID, int, CACHEINFOSTRUCT *, int, HRESULT),LPVOID lpParam,char *pszSavePackName) { return C4JStorage::ESGIStatus_Idle; } 676C4JStorage::ESaveGameState C4JStorage::GetSavesInfo(int iPad, int (*Func)(LPVOID lpParam, SAVE_DETAILS * pSaveDetails, const bool), LPVOID lpParam, char* pszSavePackName) { return C4JStorage::ESaveGame_Idle; } 677 678void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, XCONTENT_DATA & xContentData) {} 679void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, PBYTE * ppbImageData, DWORD * pdwImageBytes) {} 680C4JStorage::ESaveGameState C4JStorage::LoadSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool, const bool), LPVOID lpParam) { return C4JStorage::ESaveGame_Idle; } 681C4JStorage::EDeleteGameStatus C4JStorage::DeleteSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool), LPVOID lpParam) { return C4JStorage::EDeleteGame_Idle; } 682PSAVE_DETAILS C4JStorage::ReturnSavesInfo() { return NULL; } 683 684void C4JStorage::RegisterMarketplaceCountsCallback(int (*Func)(LPVOID lpParam, C4JStorage::DLC_TMS_DETAILS*, int), LPVOID lpParam) {} 685void C4JStorage::SetDLCPackageRoot(char* pszDLCRoot) {} 686C4JStorage::EDLCStatus C4JStorage::GetDLCOffers(int iPad, int(*Func)(LPVOID, int, DWORD, int), LPVOID lpParam, DWORD dwOfferTypesBitmaskT) { return C4JStorage::EDLC_Idle; } 687DWORD C4JStorage::CancelGetDLCOffers() { return 0; } 688void C4JStorage::ClearDLCOffers() {} 689XMARKETPLACE_CONTENTOFFER_INFO& C4JStorage::GetOffer(DWORD dw) { static XMARKETPLACE_CONTENTOFFER_INFO retval = { 0 }; return retval; } 690int C4JStorage::GetOfferCount() { return 0; } 691DWORD C4JStorage::InstallOffer(int iOfferIDC, ULONGLONG * ullOfferIDA, int(*Func)(LPVOID, int, int), LPVOID lpParam, bool bTrial) { return 0; } 692DWORD C4JStorage::GetAvailableDLCCount(int iPad) { return 0; } 693XCONTENT_DATA& C4JStorage::GetDLC(DWORD dw) { static XCONTENT_DATA retval = { 0 }; return retval; } 694C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC(int iPad, int(*Func)(LPVOID, int, int), LPVOID lpParam) { return C4JStorage::EDLC_Idle; } 695DWORD C4JStorage::MountInstalledDLC(int iPad, DWORD dwDLC, int(*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive) { return 0; } 696DWORD C4JStorage::UnmountInstalledDLC(LPCSTR szMountDrive) { return 0; } 697C4JStorage::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 C4JStorage::ETMSStatus_Idle; } 698bool C4JStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR * pwchFilename, BYTE * pBuffer, DWORD dwBufferSize) { return true; } 699bool C4JStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR * pwchFilename) { return true; } 700void C4JStorage::StoreTMSPathName(WCHAR * pwchName) {} 701unsigned int C4JStorage::CRC(unsigned char* buf, int len) { return 0; } 702 703struct PTMSPP_FILEDATA; 704C4JStorage::ETMSStatus C4JStorage::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*/) { return C4JStorage::ETMSStatus_Idle; } 705#endif // _WINDOWS64 706 707#endif // __PS3__ 708 709/////////////////////////////////////////////////////// Sentient manager 710 711HRESULT CSentientManager::Init() { return S_OK; } 712HRESULT CSentientManager::Tick() { return S_OK; } 713HRESULT CSentientManager::Flush() { return S_OK; } 714BOOL CSentientManager::RecordPlayerSessionStart(DWORD dwUserId) { return true; } 715BOOL CSentientManager::RecordPlayerSessionExit(DWORD dwUserId, int exitStatus) { return true; } 716BOOL CSentientManager::RecordHeartBeat(DWORD dwUserId) { return true; } 717BOOL CSentientManager::RecordLevelStart(DWORD dwUserId, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, DWORD numberOfLocalPlayers, DWORD numberOfOnlinePlayers) { return true; } 718BOOL CSentientManager::RecordLevelExit(DWORD dwUserId, ESen_LevelExitStatus levelExitStatus) { return true; } 719BOOL CSentientManager::RecordLevelSaveOrCheckpoint(DWORD dwUserId, INT saveOrCheckPointID, INT saveSizeInBytes) { return true; } 720BOOL CSentientManager::RecordLevelResume(DWORD dwUserId, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, DWORD numberOfLocalPlayers, DWORD numberOfOnlinePlayers, INT saveOrCheckPointID) { return true; } 721BOOL CSentientManager::RecordPauseOrInactive(DWORD dwUserId) { return true; } 722BOOL CSentientManager::RecordUnpauseOrActive(DWORD dwUserId) { return true; } 723BOOL CSentientManager::RecordMenuShown(DWORD dwUserId, INT menuID, INT optionalMenuSubID) { return true; } 724BOOL CSentientManager::RecordAchievementUnlocked(DWORD dwUserId, INT achievementID, INT achievementGamerscore) { return true; } 725BOOL CSentientManager::RecordMediaShareUpload(DWORD dwUserId, ESen_MediaDestination mediaDestination, ESen_MediaType mediaType) { return true; } 726BOOL CSentientManager::RecordUpsellPresented(DWORD dwUserId, ESen_UpsellID upsellId, INT marketplaceOfferID) { return true; } 727BOOL CSentientManager::RecordUpsellResponded(DWORD dwUserId, ESen_UpsellID upsellId, INT marketplaceOfferID, ESen_UpsellOutcome upsellOutcome) { return true; } 728BOOL CSentientManager::RecordPlayerDiedOrFailed(DWORD dwUserId, INT lowResMapX, INT lowResMapY, INT lowResMapZ, INT mapID, INT playerWeaponID, INT enemyWeaponID, ETelemetryChallenges enemyTypeID) { return true; } 729BOOL CSentientManager::RecordEnemyKilledOrOvercome(DWORD dwUserId, INT lowResMapX, INT lowResMapY, INT lowResMapZ, INT mapID, INT playerWeaponID, INT enemyWeaponID, ETelemetryChallenges enemyTypeID) { return true; } 730BOOL CSentientManager::RecordSkinChanged(DWORD dwUserId, DWORD dwSkinId) { return true; } 731BOOL CSentientManager::RecordBanLevel(DWORD dwUserId) { return true; } 732BOOL CSentientManager::RecordUnBanLevel(DWORD dwUserId) { return true; } 733INT CSentientManager::GetMultiplayerInstanceID() { return 0; } 734INT CSentientManager::GenerateMultiplayerInstanceId() { return 0; } 735void CSentientManager::SetMultiplayerInstanceId(INT value) {} 736 737//////////////////////////////////////////////////////// Stats counter 738 739/* 740StatsCounter::StatsCounter() {} 741void StatsCounter::award(Stat *stat, unsigned int difficulty, unsigned int count) {} 742bool StatsCounter::hasTaken(Achievement *ach) { return true; } 743bool StatsCounter::canTake(Achievement *ach) { return true; } 744unsigned int StatsCounter::getValue(Stat *stat, unsigned int difficulty) { return 0; } 745unsigned int StatsCounter::getTotalValue(Stat *stat) { return 0; } 746void StatsCounter::tick(int player) {} 747void StatsCounter::parse(void* data) {} 748void StatsCounter::clear() {} 749void StatsCounter::save(int player, bool force) {} 750void StatsCounter::flushLeaderboards() {} 751void StatsCounter::saveLeaderboards() {} 752void StatsCounter::setupStatBoards() {} 753#ifdef _DEBUG 754void StatsCounter::WipeLeaderboards() {} 755#endif 756*/