the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1
2#ifndef SCE_REMOTE_STORAGE_DEFINES_H
3#define SCE_REMOTE_STORAGE_DEFINES_H
4
5#ifdef __psp2__
6#include <stddef.h>
7#include <apputil.h>
8#elif __ORBIS__
9#include <stddef.h>
10#define SceAppUtilSaveDataDataSlot int
11#elif __PS3__
12#define SceAppUtilSaveDataDataSlot int
13#endif
14
15#include <stdint.h>
16
17// Macros
18#define SCE_REMOTE_STORAGE_MAX_FILES 16
19#define SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN 64
20#define SCE_REMOTE_STORAGE_CLIENT_ID_MAX_LEN 64
21#define SCE_REMOTE_STORAGE_PLATFORM_NAME_MAX_LEN 16
22#define SCE_REMOTE_STORAGE_MD5_STRING_LENGTH 33
23#define SCE_REMOTE_STORAGE_RFC2822_LENGTH 32
24#define SCE_REMOTE_STORAGE_DATA_DESCRIPTION_MAX_LEN 256
25#define SCE_REMOTE_STORAGE_DATA_LOCATION_MAX_LEN 256
26#define SCE_REMOTE_STORAGE_PS3_SAVEDATA_SECUREFILEID_SIZE 16
27#define SCE_REMOTE_STORAGE_PS3_SAVEDATA_FILENAME_SIZE 13
28#define SCE_REMOTE_STORAGE_AUTH_CODE_MAX_LEN 128
29
30// Return values
31#define SCE_REMOTE_STORAGE_SUCCESS 0
32
33// Error codes
34#define SCE_REMOTE_STORAGE_ERROR_INVALID_ARGUMENT 0x80001001
35#define SCE_REMOTE_STORAGE_ERROR_FAILED_TO_CREATE_THREAD 0x80001002
36#define SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED 0x80001003
37#define SCE_REMOTE_STORAGE_ERROR_FAILED_TO_OPEN_WEB_BROWSER 0x80001004
38#define SCE_REMOTE_STORAGE_ERROR_PSN_ACCOUNT_NOT_LINKED 0x80001005
39#define SCE_REMOTE_STORAGE_ERROR_COULD_NOT_CREATE_SESSION 0x80001006
40#define SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE 0x80001007
41#define SCE_REMOTE_STORAGE_ERROR_SESSION_DOES_NOT_EXIST 0x80001008
42#define SCE_REMOTE_STORAGE_ERROR_REQ_ID_NOT_FOUND 0x80001009
43#define SCE_REMOTE_STORAGE_ERROR_MAX_NUMBER_FILES_REACHED 0x8000100A
44#define SCE_REMOTE_STORAGE_ERROR_NO_MORE_SYNCS 0x8000100B
45#define SCE_REMOTE_STORAGE_ERROR_ALREADY_INITIALISED 0x8000100C
46#define SCE_REMOTE_STORAGE_ERROR_INVALID_UPLOADID 0x8000100D
47#define SCE_REMOTE_STORAGE_ERROR_FAILED_TO_OPEN_FILE 0x8000100E
48#define SCE_REMOTE_STORAGE_ERROR_CLOUD_DATA_CORRUPTED 0x8000100F
49#define SCE_REMOTE_STORAGE_ERROR_INVALID_CHAR_IN_FILE_NAME 0x80001010
50#define SCE_REMOTE_STORAGE_ERROR_INVALID_JSON_RESPONSE 0x80001011
51#define SCE_REMOTE_STORAGE_ERROR_REQUEST_ABORTED 0x80001012
52#define SCE_REMOTE_STORAGE_ERROR_SERVER_ERROR 0x80002000 // Server errors can be between 0x80002064 to 0x800022BB both included
53
54
55typedef enum SceRemoteStorageDataVisibility
56{
57 PRIVATE = 0, // Only data owner can read and write data
58 PUBLIC_READ_ONLY, // Everyone can read this data. Owner can write to it
59 PUBLIC_READ_WRITE // Everyone can read and write data
60} SceRemoteStorageDataVisibility;
61
62typedef enum SceRemoteStorageEvent
63{
64 USER_ACCOUNT_LINKED = 0, // User's account has been linked with PSN
65 PSN_SIGN_IN_REQUIRED, // User's PSN sign-in through web browser is required
66 WEB_BROWSER_RESULT, // Result of sceRemoteStorageOpenWebBrowser(). Please check retCode
67 GET_DATA_RESULT, // Result of sceRemoteStorageGetData(). Please check retCode
68 GET_DATA_PROGRESS, // Progress of sceRemoteStorageGetData() completion as a percentage. Please check retCode
69 SET_DATA_RESULT, // Result of sceRemoteStorageSetData(). Please check retCode
70 SET_DATA_PROGRESS, // Progress of sceRemoteStorageSetData() completion as a percentage. Please check retCode
71 GET_STATUS_RESULT, // Result of sceRemoteStorageGetStatus(). Please check retCode
72 ERROR_OCCURRED // A generic error has occurred. Please check retCode
73} SceRemoteStorageEvent;
74
75typedef enum SceRemoteStorageEnvironment
76{
77 DEVELOPMENT = 0,
78 PRODUCTION
79}SceRemoteStorageEnvironment;
80
81typedef void (*sceRemoteStorageCallback)(const SceRemoteStorageEvent event, int32_t retCode, void * userData);
82
83typedef struct SceRemoteStorageInitParamsThread
84{
85 int32_t threadAffinity; // Thread affinity
86 int32_t threadPriority; // Priority that the thread runs out
87} SceRemoteStorageInitParamsThread;
88
89typedef struct SceRemoteStorageInitParamsPool
90{
91 void * memPoolBuffer; // Memory pool used by sceRemoteStorage library
92 size_t memPoolSize; // Size of memPoolBuffer
93} SceRemoteStorageInitParamsPool;
94
95typedef struct SceRemoteStorageInitTimeout
96{
97 uint32_t resolveMs; //Timeout for DNS resolution in milliseconds. Defaults to 30 seconds
98 uint32_t connectMs; //Timeout for first connection between client and server. Defaults to 30 seconds
99 uint32_t sendMs; //Timeout to send request to server. Defaults to 120 seconds
100 uint32_t receiveMs; //Timeout to receive information from server. Defaults to 120 seconds
101
102 SceRemoteStorageInitTimeout() : resolveMs(30 * 1000), connectMs(30 * 1000), sendMs(120 * 1000), receiveMs(120 * 1000) {}
103}SceRemoteStorageInitTimeout;
104
105typedef struct SceRemoteStorageInitParams
106{
107 sceRemoteStorageCallback callback; // Event callback
108 void * userData; // Application defined data for callback
109 int32_t httpContextId; // PS4 only: Http context ID that was returned from sceHttpInit()
110 int32_t userId; // PS4 only: Current user, see SceUserServiceUserId
111 void * psnTicket; // PS3 only: The PSN ticket used to authenticate the user
112 size_t psnTicketSize; // PS3 only: The size of the PSN ticket in bytes
113 char clientId[SCE_REMOTE_STORAGE_CLIENT_ID_MAX_LEN]; // This represents your application on PSN, used to sign PSN user in for your title
114 SceRemoteStorageInitTimeout timeout; // Timeout for network transactions
115 SceRemoteStorageInitParamsPool pool; // Memory pool parameters
116 SceRemoteStorageInitParamsThread thread; // Thread creation parameters
117 SceRemoteStorageEnvironment environment; // Only used on non-PlayStation platforms: PSN Environment used by the library
118} SceRemoteStorageInitParams;
119
120typedef struct SceRemoteStorageGetDataReqParams
121{
122 char fileName[SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN]; // Name of file on remote storage server
123 char pathLocation[SCE_REMOTE_STORAGE_DATA_LOCATION_MAX_LEN]; // File location on the HDD
124 char secureFileId[SCE_REMOTE_STORAGE_PS3_SAVEDATA_SECUREFILEID_SIZE]; // PS3 only. ID used for save data encryption
125 char ps3DataFilename[SCE_REMOTE_STORAGE_PS3_SAVEDATA_FILENAME_SIZE]; // PS3 only. Name of data file in save data
126 uint32_t ps3FileType; // PS3 only. Type of file, CELL_SAVEDATA_FILETYPE_XXX
127 SceAppUtilSaveDataDataSlot psVitaSaveDataSlot; // PS Vita only. Save data slot information
128} SceRemoteStorageGetDataReqParams;
129
130typedef struct SceRemoteStorageSetDataReqParams
131{
132 char fileName[SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN]; // Name of file on remote storage server
133 char fileDescription[SCE_REMOTE_STORAGE_DATA_DESCRIPTION_MAX_LEN]; // Description of file on remote storage server
134 char pathLocation[SCE_REMOTE_STORAGE_DATA_LOCATION_MAX_LEN]; // File location on the HDD
135 char secureFileId[SCE_REMOTE_STORAGE_PS3_SAVEDATA_SECUREFILEID_SIZE]; // PS3 only. ID used for save data encryption
136 char ps3DataFilename[SCE_REMOTE_STORAGE_PS3_SAVEDATA_FILENAME_SIZE]; // PS3 only. Name of data file in save data
137 uint32_t ps3FileType; // PS3 only. Type of file, CELL_SAVEDATA_FILETYPE_XXX
138 SceRemoteStorageDataVisibility visibility; // Visibility of data
139} SceRemoteStorageSetDataReqParams;
140
141typedef struct SceRemoteStorageData
142{
143 char fileName[SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN]; // Name of file on remote storage server
144 char fileDescription[SCE_REMOTE_STORAGE_DATA_DESCRIPTION_MAX_LEN]; // Description of file on remote storage server
145 size_t fileSize; // Size of file in bytes
146 char md5Checksum[SCE_REMOTE_STORAGE_MD5_STRING_LENGTH]; // File MD5 checksum
147 char timeStamp[SCE_REMOTE_STORAGE_RFC2822_LENGTH]; // Time that data was written on the server. Format is RFC2822
148 SceRemoteStorageDataVisibility visibility; // Visibility of data
149} SceRemoteStorageData;
150
151typedef struct SceRemoteStorageWebBrowserReqParams { } SceRemoteStorageWebBrowseReqParams;
152
153typedef struct SceRemoteStorageStatusReqParams { } SceRemoteStorageStatusReqParams;
154
155typedef struct SceRemoteStorageAbortReqParams
156{
157 uint32_t requestId; // The request Id to be aborted
158} SceRemoteStorageAbortReqParams;
159
160typedef struct SceRemoteStorageStatus
161{
162 uint32_t numFiles; // Number of files user has on remote storage server
163 SceRemoteStorageData data[SCE_REMOTE_STORAGE_MAX_FILES]; // Details about data if available. Data buffer will not be retrieved
164 uint64_t remainingSyncs; // Remaining syncs. the user has for upload/download
165} SceRemoteStorageStatus;
166
167#endif