diff options
| author | daoge <3523206925@qq.com> | 2026-03-03 03:04:10 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-03 03:04:10 +0800 |
| commit | b3feddfef372618c8a9d7a0abcaf18cfad866c18 (patch) | |
| tree | 267761c3bb39241ba5c347bfbe2254d06686e287 /Minecraft.Client/Common/Leaderboards/SonyLeaderboardManager.h | |
| parent | 84c31a2331f7a0ec85b9d438992e244f60e5020f (diff) | |
feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict
* feat: TU19 (Dec 2014) Features & Content (#32)
* December 2014 files
* Working release build
* Fix compilation issues
* Add sound to Windows64Media
* Add DLC content and force Tutorial DLC
* Revert "Add DLC content and force Tutorial DLC"
This reverts commit 97a43994725008e35fceb984d5549df9c8cea470.
* Disable broken light packing
* Disable breakpoint during DLC texture map load
Allows DLC loading but the DLC textures are still broken
* Fix post build not working
* ...
* fix vs2022 build
* fix cmake build
---------
Co-authored-by: Loki <lokirautio@gmail.com>
Diffstat (limited to 'Minecraft.Client/Common/Leaderboards/SonyLeaderboardManager.h')
| -rw-r--r-- | Minecraft.Client/Common/Leaderboards/SonyLeaderboardManager.h | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/Minecraft.Client/Common/Leaderboards/SonyLeaderboardManager.h b/Minecraft.Client/Common/Leaderboards/SonyLeaderboardManager.h new file mode 100644 index 00000000..3b2c26c5 --- /dev/null +++ b/Minecraft.Client/Common/Leaderboards/SonyLeaderboardManager.h @@ -0,0 +1,133 @@ +#pragma once + +#include "Common\Leaderboards\LeaderboardManager.h" + +#ifdef __PS3__ +typedef CellRtcTick SonyRtcTick; +#else +typedef SceRtcTick SonyRtcTick; +#endif + +class SonyLeaderboardManager : public LeaderboardManager +{ +protected: + enum EStatsState + { + eStatsState_Idle, + eStatsState_Getting, + eStatsState_Failed, + eStatsState_Ready, + eStatsState_Canceled, + eStatsState_Max + }; + +public: + SonyLeaderboardManager(); + virtual ~SonyLeaderboardManager(); + +protected: + unsigned short m_openSessions; + + C4JThread *m_threadScoreboard; + bool m_running; + + int m_titleContext; + int32_t m_requestId; + + //SceNpId m_myNpId; + + static int scoreboardThreadEntry(LPVOID lpParam); + void scoreboardThreadInternal(); + + virtual bool getScoreByIds(); + virtual bool getScoreByRange(); + + virtual bool setScore(); + + queue<RegisterScore> m_views; + + CRITICAL_SECTION m_csViewsLock; + + EStatsState m_eStatsState; //State of the stats read + // EFilterMode m_eFilterMode; + + ReadScore *m_scores; + unsigned int m_maxRank; + //SceNpScoreRankData *m_stats; + +public: + virtual void Tick(); + + //Open a session + virtual bool OpenSession(); + + //Close a session + virtual void CloseSession(); + + //Delete a session + virtual void DeleteSession(); + + //Write the given stats + //This is called synchronously and will not free any memory allocated for views when it is done + + virtual bool WriteStats(unsigned int viewCount, ViewIn views); + + virtual bool ReadStats_Friends(LeaderboardReadListener *callback, int difficulty, EStatsType type, PlayerUID myUID, unsigned int startIndex, unsigned int readCount); + virtual bool ReadStats_MyScore(LeaderboardReadListener *callback, int difficulty, EStatsType type, PlayerUID myUID, unsigned int readCount); + virtual bool ReadStats_TopRank(LeaderboardReadListener *callback, int difficulty, EStatsType type, unsigned int startIndex, unsigned int readCount); + + //Perform a flush of the stats + virtual void FlushStats(); + + //Cancel the current operation + virtual void CancelOperation(); + + //Is the leaderboard manager idle. + virtual bool isIdle(); + +protected: + int getBoardId(int difficulty, EStatsType); + + SceNpScorePlayerRankData *addPadding(unsigned int num, SceNpScoreRankData *rankData); + + void convertToOutput(unsigned int &num, ReadScore *out, SceNpScorePlayerRankData *rankData, SceNpScoreComment *comm); + + void toBinary(void *out, SceNpScoreComment *in); + void fromBinary(SceNpScoreComment **out, void *in); + + void toBase32(SceNpScoreComment *out, void *in); + void fromBase32(void *out, SceNpScoreComment *in); + + void toSymbols(char *); + void fromSymbols(char *); + + bool test_string(string); + + void initReadScoreStruct(ReadScore &out, SceNpScoreRankData &); + void fillReadScoreStruct(ReadScore &out, SceNpScoreComment &comment); + + static bool SortByRank(const ReadScore &lhs, const ReadScore &rhs); + + +protected: + // 4J-JEV: Interface differences: + + // Sce NP score library function redirects. + virtual HRESULT initialiseScoreUtility() { return ERROR_SUCCESS; } + virtual bool scoreUtilityAlreadyInitialised(HRESULT hr) { return false; } + + virtual HRESULT createTitleContext(const SceNpId &npId) = 0; + virtual HRESULT destroyTitleContext(int titleContext) = 0; + + virtual HRESULT createTransactionContext(int titleContext) = 0; + virtual HRESULT abortTransactionContext(int transactionContext) = 0; + virtual HRESULT destroyTransactionContext(int transactionContext) = 0; + + virtual HRESULT fillByIdsQuery(const SceNpId &myNpId, SceNpId* &npIds, uint32_t &len); + +#if (defined __ORBIS__) || (defined __PSVITA__) + virtual HRESULT getFriendsList(sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::FriendsList> &friendsList) = 0; +#endif + + virtual char * getComment(SceNpScoreComment *comment) = 0; +}; |
