mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-08 15:18:26 +00:00
165 lines
7 KiB
C++
165 lines
7 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
#include "../4J.Common/4J_Compat.h"
|
|
|
|
enum eAwardType {
|
|
eAwardType_Achievement = 0,
|
|
eAwardType_GamerPic,
|
|
eAwardType_Theme,
|
|
eAwardType_AvatarItem,
|
|
};
|
|
|
|
enum eUpsellType {
|
|
eUpsellType_Custom = 0, // This is the default, and means that the upsell
|
|
// dialog was initiated in the app code
|
|
eUpsellType_Achievement,
|
|
eUpsellType_GamerPic,
|
|
eUpsellType_Theme,
|
|
eUpsellType_AvatarItem,
|
|
};
|
|
|
|
enum eUpsellResponse {
|
|
eUpsellResponse_Declined,
|
|
eUpsellResponse_Accepted_NoPurchase,
|
|
eUpsellResponse_Accepted_Purchase,
|
|
};
|
|
|
|
class C_4JProfile {
|
|
public:
|
|
struct PROFILESETTINGS {
|
|
int iYAxisInversion;
|
|
int iControllerSensitivity;
|
|
int iVibration;
|
|
bool bSwapSticks;
|
|
};
|
|
|
|
// 4 players have game defined data, puiGameDefinedDataChangedBitmask needs
|
|
// to be checked by the game side to see if there's an update needed - it'll
|
|
// have the bits set for players to be updated
|
|
void Initialise(std::uint32_t dwTitleID, std::uint32_t dwOfferID,
|
|
unsigned short usProfileVersion,
|
|
unsigned int uiProfileValuesC,
|
|
unsigned int uiProfileSettingsC,
|
|
std::uint32_t* pdwProfileSettingsA,
|
|
int iGameDefinedDataSizeX4,
|
|
unsigned int* puiGameDefinedDataChangedBitmask);
|
|
void SetTrialTextStringTable(CXuiStringTable* pStringTable, int iAccept,
|
|
int iReject);
|
|
void SetTrialAwardText(eAwardType AwardType, int iTitle,
|
|
int iText); // achievement popup in the trial game
|
|
int GetLockedProfile();
|
|
void SetLockedProfile(int iProf);
|
|
bool IsSignedIn(int iQuadrant);
|
|
bool IsSignedInLive(int iProf);
|
|
bool IsGuest(int iQuadrant);
|
|
unsigned int 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);
|
|
unsigned int DisplayOfflineProfile(int (*Func)(void*, const bool,
|
|
const int iPad),
|
|
void* lpParam,
|
|
int iQuadrant = XUSER_INDEX_ANY);
|
|
unsigned int RequestConvertOfflineToGuestUI(
|
|
int (*Func)(void*, const bool, const int iPad), void* lpParam,
|
|
int iQuadrant = XUSER_INDEX_ANY);
|
|
void SetPrimaryPlayerChanged(bool bVal);
|
|
bool QuerySigninStatus(void);
|
|
void GetXUID(int iPad, PlayerUID* pXuid, bool bOnlineXuid);
|
|
bool AreXUIDSEqual(PlayerUID xuid1, PlayerUID xuid2);
|
|
bool XUIDIsGuest(PlayerUID xuid);
|
|
bool AllowedToPlayMultiplayer(int iProf);
|
|
bool GetChatAndContentRestrictions(int iPad, bool* pbChatRestricted,
|
|
bool* pbContentRestricted, int* piAge);
|
|
void StartTrialGame(); // disables saves and leaderboard, and change state
|
|
// to readyforgame from pregame
|
|
void AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly,
|
|
bool* allAllowed, bool* friendsAllowed);
|
|
bool CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly,
|
|
PlayerUID* pXuids, unsigned int xuidCount);
|
|
void ShowProfileCard(int iPad, PlayerUID targetUid);
|
|
bool GetProfileAvatar(int iPad,
|
|
int (*Func)(void* lpParam,
|
|
std::uint8_t* thumbnailData,
|
|
unsigned int thumbnailBytes),
|
|
void* lpParam);
|
|
void CancelProfileAvatarRequest();
|
|
|
|
// SYS
|
|
int GetPrimaryPad();
|
|
void SetPrimaryPad(int iPad);
|
|
char* GetGamertag(int iPad);
|
|
std::wstring GetDisplayName(int iPad);
|
|
bool IsFullVersion();
|
|
void SetSignInChangeCallback(void (*Func)(void*, bool, unsigned int),
|
|
void* lpParam);
|
|
void SetNotificationsCallback(void (*Func)(void*, std::uint32_t,
|
|
unsigned int),
|
|
void* lpParam);
|
|
bool RegionIsNorthAmerica(void);
|
|
bool LocaleIsUSorCanada(void);
|
|
int GetLiveConnectionStatus();
|
|
bool IsSystemUIDisplayed();
|
|
void SetProfileReadErrorCallback(void (*Func)(void*), void* lpParam);
|
|
|
|
// PROFILE DATA
|
|
int SetDefaultOptionsCallback(int (*Func)(void*, PROFILESETTINGS*,
|
|
const int iPad),
|
|
void* lpParam);
|
|
int SetOldProfileVersionCallback(int (*Func)(void*, unsigned char*,
|
|
const unsigned short,
|
|
const int),
|
|
void* lpParam);
|
|
PROFILESETTINGS* GetDashboardProfileSettings(int iPad);
|
|
void WriteToProfile(int iQuadrant, bool bGameDefinedDataChanged = false,
|
|
bool bOverride5MinuteLimitOnProfileWrites = false);
|
|
void ForceQueuedProfileWrites(int iPad = XUSER_INDEX_ANY);
|
|
void* GetGameDefinedProfileData(int iQuadrant);
|
|
void ResetProfileProcessState(); // after a sign out from the primary
|
|
// player, call this
|
|
void Tick(void);
|
|
|
|
// ACHIEVEMENTS & AWARDS
|
|
|
|
void RegisterAward(int iAwardNumber, int iGamerconfigID, eAwardType eType,
|
|
bool bLeaderboardAffected = false,
|
|
CXuiStringTable* pStringTable = nullptr,
|
|
int iTitleStr = -1, int iTextStr = -1,
|
|
int iAcceptStr = -1, char* pszThemeName = nullptr,
|
|
unsigned int uiThemeSize = 0L);
|
|
int GetAwardId(int iAwardNumber);
|
|
eAwardType GetAwardType(int iAwardNumber);
|
|
bool CanBeAwarded(int iQuadrant, int iAwardNumber);
|
|
void Award(int iQuadrant, int iAwardNumber, bool bForce = false);
|
|
bool IsAwardsFlagSet(int iQuadrant, int iAward);
|
|
|
|
// RICH PRESENCE
|
|
|
|
void RichPresenceInit(int iPresenceCount, int iContextCount);
|
|
void RegisterRichPresenceContext(int iGameConfigContextID);
|
|
void SetRichPresenceContextValue(int iPad, int iContextID, int iVal);
|
|
void SetCurrentGameActivity(int iPad, int iNewPresence,
|
|
bool bSetOthersToIdle = false);
|
|
|
|
// PURCHASE
|
|
void DisplayFullVersionPurchase(bool bRequired, int iQuadrant,
|
|
int iUpsellParam = -1);
|
|
void SetUpsellCallback(void (*Func)(void* lpParam, eUpsellType type,
|
|
eUpsellResponse response,
|
|
int iUserData),
|
|
void* lpParam);
|
|
|
|
// Debug
|
|
void SetDebugFullOverride(
|
|
bool bVal); // To override the license version (trail/full). Only in
|
|
// debug/release, not ContentPackage
|
|
};
|
|
|
|
// Singleton
|
|
extern C_4JProfile ProfileManager;
|