the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 85 lines 2.4 kB view raw
1 2 3 4#pragma once 5 6 7// Note - there are now 3 types of PlayerUID 8// (1) A full online ID - either the primary login, or a sub-signin through to PSN. This has m_onlineID set up as a normal SceNpOnlineId, with dummy[0] set to 0 9// (2) An offline ID, where there is also a primary login on the system. This has m_onlineID set up to copy the primary SceNpOnlineId, except with dummy[0] set to the controller ID of this other player 10// (3) An offline ID, where there isn't a primary PSN login on the system. This has SceNpOnlineId fully zeroed. 11 12 13class PlayerUID 14{ 15 char m_onlineID[SCE_NP_ONLINEID_MAX_LENGTH]; 16 char term; 17 bool m_bSignedIntoPSN : 1; 18 unsigned char m_quadrant : 2; 19 uint8_t m_macAddress[SCE_NET_ETHER_ADDR_LEN]; 20 SceUserServiceUserId m_userID; 21 22public: 23 24 class Hash 25 { 26 public: 27 std::size_t operator()(const PlayerUID& k) const; 28 }; 29 30 PlayerUID(); 31 PlayerUID(SceUserServiceUserId userID, SceNpOnlineId& onlineID, bool bSignedInPSN, int quadrant); 32 PlayerUID(std::wstring fromString); 33 34 bool operator==(const PlayerUID& rhs) const; 35 bool operator!=(const PlayerUID& rhs); 36 void setCurrentMacAddress(); 37 std::wstring macAddressStr() const; 38 std::wstring userIDStr() const; 39 std::wstring toString() const; 40 void setOnlineID(SceNpOnlineId& id, bool bSignedIntoPSN); 41 void setUserID(unsigned int id); 42 43 44 const char* getOnlineID() const { return m_onlineID; } 45 SceUserServiceUserId getUserID() const { return m_userID; } 46 int getQuadrant() const { return m_quadrant; } 47 bool isPrimaryUser() const; // only true if we're on the local machine and signed into the first quadrant; 48 bool isSignedIntoPSN() const { return m_bSignedIntoPSN; } 49private: 50}; 51 52namespace std 53{ 54 template <> 55 struct hash<PlayerUID> 56 { 57 size_t operator()(const PlayerUID& v) const 58 { 59 return PlayerUID::Hash()(v);///* my hash algorithm */; 60 61 } 62 }; 63} 64 65 66 67 68class GameSessionUID 69{ 70 char m_onlineID[SCE_NP_ONLINEID_MAX_LENGTH]; 71 char term; 72 bool m_bSignedIntoPSN : 1; 73 unsigned char m_quadrant : 2; 74public: 75 GameSessionUID(); 76 GameSessionUID(int nullVal); 77 78 bool operator==(const GameSessionUID& rhs) const; 79 bool operator!=(const GameSessionUID& rhs); 80 GameSessionUID& operator=(const PlayerUID& rhs); 81 82 const char* getOnlineID() const { return m_onlineID; } 83 int getQuadrant() const { return m_quadrant; } 84 bool isSignedIntoPSN() const { return m_bSignedIntoPSN; } 85};