the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at master 217 lines 6.7 kB view raw
1#pragma once 2 3#include "..\..\Common\Network\Sony\SonyCommerce.h" 4#include "..\..\Common\Network\Sony\SonyRemoteStorage.h" 5 6#define PRODUCT_CODE_SIZE 9 7#define SAVEFOLDERPREFIX_SIZE 10 8#define COMMERCE_CATEGORY_SIZE 19 9#define UPGRADE_KEY_SIZE 59 10#define SKU_POSTFIX_SIZE 4 11 12enum EProductSKU 13{ 14 e_sku_SCEE, 15 e_sku_SCEA, 16 e_sku_SCEJ 17}; 18 19typedef struct 20{ 21 char chProductCode[PRODUCT_CODE_SIZE+1]; 22 char chDiscProductCode[PRODUCT_CODE_SIZE+1]; 23 char chSaveFolderPrefix[SAVEFOLDERPREFIX_SIZE+1]; 24 char chDiscSaveFolderPrefix[SAVEFOLDERPREFIX_SIZE+1]; 25 char chCommerceCategory[COMMERCE_CATEGORY_SIZE+1]; 26 char chTexturePackID[SCE_NP_COMMERCE2_CATEGORY_ID_LEN+1]; 27 char chUpgradeKey[UPGRADE_KEY_SIZE+1]; 28 char chSkuPostfix[SKU_POSTFIX_SIZE+1]; 29 EProductSKU eProductSKU; 30} 31PRODUCTCODES; 32 33enum e_SONYDLCType 34{ 35 eSONYDLCType_SkinPack=0, 36 eSONYDLCType_TexturePack, 37 eSONYDLCType_MashUpPack, 38 eSONYDLCType_All 39} 40; 41 42typedef struct 43{ 44 char chDLCKeyname[16]; 45 //char chDLCTitle[64]; 46 e_SONYDLCType eDLCType; 47 int iFirstSkin; 48 int iConfig; // used for texture pack data files 49} 50SONYDLC; 51 52 53class CConsoleMinecraftApp : public CMinecraftApp 54{ 55 // screenshot for social post, and thumbnail for save 56 ImageFileBuffer m_ThumbnailBuffer; 57 ImageFileBuffer m_SaveImageBuffer; 58 ImageFileBuffer m_ScreenshotBuffer; 59public: 60 CConsoleMinecraftApp(); 61 62 virtual void SetRichPresenceContext(int iPad, int contextId); 63 64 //C4JStorage::eOptionsCallback GetOptionsCallbackStatus(int iPad); 65 66 virtual void StoreLaunchData(); 67 virtual void ExitGame(); 68 virtual void FatalLoadError(); 69 70 virtual void CaptureSaveThumbnail(); 71 virtual void GetSaveThumbnail(PBYTE*,DWORD*) {}; // NOT USED 72 virtual void GetSaveThumbnail(PBYTE*,DWORD*,PBYTE*,DWORD*); 73 virtual void ReleaseSaveThumbnail(); 74 virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize); 75 76 // BANNED LEVEL LIST 77 virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false) {} 78 79 80 virtual int LoadLocalTMSFile(WCHAR *wchTMSFile); 81 virtual int LoadLocalTMSFile(WCHAR *wchTMSFile, eFileExtensionType eExt); 82 83 virtual void FreeLocalTMSFiles(eTMSFileType eType); 84 virtual int GetLocalTMSFileIndex(WCHAR *wchTMSFile,bool bFilenameIncludesExtension,eFileExtensionType eEXT=eFileExtensionType_PNG); 85 86 // CHAT/UGC restriction - MOVED TO THE PROFILE LIB - ProfileManager.GetChatAndContentRestrictions 87 88// void SetVoiceChatAndUGCRestricted(bool bRestricted); 89// bool GetVoiceChatAndUGCRestricted(void); 90 91 StringTable *GetStringTable() { return NULL;} 92 93 // original code 94 virtual void TemporaryCreateGameStart(); 95 96 BOOL ReadProductCodes(); 97 char *GetProductCode(); 98 char *GetDiscProductCode(); 99 char *GetSaveFolderPrefix(); 100 char *GetCommerceCategory(); 101 char *GetTexturePacksCategoryID(); 102 char *GetUpgradeKey(); 103 EProductSKU GetProductSKU(); 104 bool IsJapaneseSKU(); 105 bool IsEuropeanSKU(); 106 bool IsAmericanSKU(); 107 //char *GetSKUPostfix(); 108 SONYDLC *GetSONYDLCInfo(char *pchTitle); 109 110 int GetiFirstSkinFromName(char *pchName); 111 int GetiConfigFromName(char *pchName); 112 eDLCContentType GetDLCTypeFromName(char *pchDLCName); 113 bool GetTrialFromName(char *pchDLCName); 114 115 // PS3 COMMERCE 116 enum eUI_DLC_State 117 { 118 eCommerce_State_Offline, 119 eCommerce_State_Online, 120 eCommerce_State_Error, 121 eCommerce_State_Init, 122 eCommerce_State_Init_Pending, 123 eCommerce_State_GetCategories, 124 eCommerce_State_GetCategories_Pending, 125 eCommerce_State_GetProductList, 126 eCommerce_State_GetProductList_Pending, 127 eCommerce_State_AddProductInfoDetailed, 128 eCommerce_State_AddProductInfoDetailed_Pending, 129 eCommerce_State_RegisterDLC, 130 eCommerce_State_Checkout, 131 eCommerce_State_Checkout_WaitingForSession, 132 eCommerce_State_Checkout_SessionStarted, 133 eCommerce_State_Checkout_Pending, 134 eCommerce_State_DownloadAlreadyPurchased, 135 eCommerce_State_DownloadAlreadyPurchased_WaitingForSession, 136 eCommerce_State_DownloadAlreadyPurchased_SessionStarted, 137 eCommerce_State_DownloadAlreadyPurchased_Pending, 138 eCommerce_State_UpgradeTrial, 139 eCommerce_State_UpgradeTrial_WaitingForSession, 140 eCommerce_State_UpgradeTrial_SessionStarted, 141 eCommerce_State_UpgradeTrial_Pending, 142 }; 143 144 void CommerceInit(); 145 void CommerceTick(); 146 bool GetCommerceCategoriesRetrieved(); 147 bool GetCommerceProductListRetrieved(); 148 bool GetCommerceProductListInfoRetrieved(); 149 int GetCommerceState(); 150 SonyCommerce* GetCommerce() { return m_pCommerce; } 151 SonyCommerce::CategoryInfo *GetCategoryInfo(); 152 std::vector<SonyCommerce::ProductInfo>* GetProductList(int iIndex); // default to fail if the additional details are not retrieved 153 SonyCommerce::ProductInfoDetailed *GetProductInfoDetailed(); 154 void ClearCommerceDetails(); // wipe out details on a PSN sign out 155 void Checkout(char *pchSkuID); 156 void DownloadAlreadyPurchased(char *pchSkuID); 157 bool UpgradeTrial(); 158 bool DLCAlreadyPurchased(char *pchTitle); 159 char *GetSkuIDFromProductList(); 160 void GetDLCSkuIDFromProductList(char *,char *); 161 162 static void CommerceInitCallback(LPVOID lpParam,int err); 163 static void CommerceGetCategoriesCallback(LPVOID lpParam,int err); 164 static void CommerceGetProductListCallback(LPVOID lpParam,int err); 165// static void CommerceGetDetailedProductInfoCallback(LPVOID lpParam,int err); 166 static void CommerceAddDetailedProductInfoCallback(LPVOID lpParam,int err); 167 static void CommerceCheckoutCallback(LPVOID lpParam,int err); 168 169 static void CheckoutSessionStartedCallback(LPVOID lpParam,int err); 170 static void DownloadAlreadyPurchasedSessionStartedCallback(LPVOID lpParam,int err); 171 static void UpgradeTrialSessionStartedCallback(LPVOID lpParam,int err); 172 173 void SetDiscPatchUsrDir(char *chPatchDir); 174 char *GetDiscPatchUsrDir(); 175 bool GetBootedFromDiscPatch(); 176 void SetBootedFromDiscPatch(); 177 bool IsFileInPatchList(LPCSTR lpFileName); 178 char * GetBDUsrDirPath(const char *pchFilename); 179 180 SonyRemoteStorage* getRemoteStorage() { return m_pRemoteStorage; } 181 182 bool CheckForEmptyStore(int iPad); 183 184private: 185 186 bool m_bCommerceCategoriesRetrieved; 187 bool m_bCommerceInitialised; 188 bool m_bCommerceProductListRetrieved; 189 bool m_bProductListAdditionalDetailsRetrieved; 190 char m_pchSkuID[48]; 191 192 int m_eCommerce_State; 193 int m_ProductListRetrievedC; 194 int m_ProductListAdditionalDetailsC; 195 int m_ProductListCategoriesC; 196 int m_iCurrentCategory; 197 int m_iCurrentProduct; 198 199 SonyCommerce *m_pCommerce; 200 SonyCommerce::CategoryInfo m_CategoryInfo; 201 std::vector<SonyCommerce::ProductInfo>* m_ProductListA; 202// SonyCommerce::ProductInfoDetailed m_ProductInfoDetailed; 203 204 PRODUCTCODES ProductCodes; 205 unordered_map<wstring, SONYDLC *> m_SONYDLCMap; 206 207 208 bool m_bVoiceChatAndUGCRestricted; 209 210 bool m_bBootedFromDiscPatch; 211 char m_usrdirPathBDPatch[128]; 212 SonyRemoteStorage* m_pRemoteStorage; 213 214}; 215 216extern CConsoleMinecraftApp app; 217