aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/Network/Sony/sceRemoteStorage/header
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/Common/Network/Sony/sceRemoteStorage/header
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.Client/Common/Network/Sony/sceRemoteStorage/header')
-rw-r--r--Minecraft.Client/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorage.h137
-rw-r--r--Minecraft.Client/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorageDefines.h167
2 files changed, 304 insertions, 0 deletions
diff --git a/Minecraft.Client/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorage.h b/Minecraft.Client/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorage.h
new file mode 100644
index 00000000..de70398d
--- /dev/null
+++ b/Minecraft.Client/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorage.h
@@ -0,0 +1,137 @@
+
+#ifndef SCE_REMOTE_STORAGE_H
+#define SCE_REMOTE_STORAGE_H
+
+#include "sceRemoteStorageDefines.h"
+
+/// @brief
+/// Initialises the RemoteStorage library.
+///
+/// Initialises the RemoteStorage library, creates a session on the server and starts the Thread to process requests.
+/// This method must be executed to start the RemoteStorage library or none of its functionality will be available.
+/// This method will block while it initializes its thread and will return an error if it is
+/// unable to do so. The session will be created on the thread once this is created and it won't be a blocking operation.
+///
+/// It is important to note that HTTP, SSL and NET libraries are not being initialised by the library and should be initialised outside of it.
+///
+/// @param params The structure of type <>SceRemoteStorageInitParams</c> that contains necessary information to start the library.
+///
+/// @retval SCE_REMOTE_STORAGE_SUCCESS The operation was successfully registered on the thread.
+/// @retval SCE_REMOTE_STORAGE_ERROR_INVALID_ARGUMENT At least one of the arguments passed in the input structure is not valid.
+/// @retval SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE There is no enough memory on the library to perform an allocation.
+/// @retval USER_ACCOUNT_LINKED This event will be sent to the event callback when the session is created and linked to PSN on the server
+/// @retval PSN_SIGN_IN_REQUIRED This event will be sent to the event callback when the session is created but not linked to PSN on the server.
+/// This will only happen on the PC version and requires to call <c>sceRemoteStorageOpenWebBrowser()</c> function.
+/// @retval ERROR_OCCURRED This event will be sent to the event callback when an error has occurred in the thread.
+///
+/// @note System errors may be returned. Design your code so it does expect other errors.
+int32_t sceRemoteStorageInit(const SceRemoteStorageInitParams & params);
+
+/// @brief
+/// Terminates the RemoteStorage library.
+///
+/// Terminates the RemoteStorage library and deletes the thread that process requests.
+/// This method must be executed to terminate the RemoteStorage library to prevent leaks in memory and resources.
+/// This method will abort any other pending requests and terminate the library. It won't wait for requests to finish.
+/// This method is synchronous and does not make use of the callback to inform the user of success termination. It is executed on the calling thread.
+///
+/// @retval SCE_REMOTE_STORAGE_SUCCESS The operation was successful.
+/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The RemoteStorage library was not initialised.
+///
+/// @note System errors may be returned. Design your code so it does expect other errors.
+int32_t sceRemoteStorageTerm();
+
+/// @brief
+/// Aborts a request sent to the RemoteStorage library.
+///
+/// Aborts a request being processed or pending to be processed by the RemoteStorage library.
+/// This method is synchronous and does not make use of the callback to inform the user of success termination. It is executed on the calling thread.
+///
+/// @param param A structure containing the request Id to be aborted.
+/// This request Id is provided by other functions (get/setData, getStatus and OpenWebBrowser) so they can be referenced.
+///
+/// @retval SCE_REMOTE_STORAGE_SUCCESS The operation was successful.
+/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The RemoteStorage library was not initialised.
+/// @retval SCE_REMOTE_STORAGE_ERROR_REQ_ID_NOT_FOUND The request Id sent is not found.
+///
+/// @note System errors may be returned. Design your code so it does expect other errors.
+int32_t sceRemoteStorageAbort(const SceRemoteStorageAbortReqParams & params);
+
+/// @brief
+/// Opens the default web browser to sign in to PSN on PC.
+///
+/// Opens the default web browser to sign in to PSN on PC. This function does not have any functionality on other platforms.
+/// This method does make use of the callback to inform the user of success termination. This function has priority over other functions on the thread (as getData(), getStatus()
+/// and setData()) and it will be executed as soon as the thread finishes processing a pending request.
+///
+/// @param param The structure containing extra parameters to be passed in. This structure does only exist for future expansions.
+///
+/// @retval SCE_REMOTE_STORAGE_SUCCESS The operation was successfully registered on the thread.
+/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The RemoteStorage library was not initialised.
+/// @retval SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE There is no enough memory on the library to perform an allocation.
+/// @retval ERROR_OCCURRED This event will be sent to the event callback when an error has occurred in the thread.
+///
+/// @note System errors may be returned. Design your code so it does expect other errors.
+int32_t sceRemoteStorageOpenWebBrowser(const SceRemoteStorageWebBrowserReqParams & params);
+
+/// @brief
+/// Gives details for all files of a user.
+///
+/// Gives details for all files of a user. It provides generic information (remaining bandwidth per day, HDD space per user, number of files) as well as
+/// specific file information (number of bytes, file name, file description, MD5 checksum, timestamp and file visibility). File data is not provided.
+/// This method does make use of the callback to inform the user of success termination. The SceRemoteStorageStatus pointer must be pointer a to a valid
+/// location in memory until the callback is called as the output information will be stored in such location.
+///
+/// @param params The structure containing extra parameters to be passed in. This structure does only exist for future expansions.
+/// @param status The structure where the output information will be stored. The memory location being pointed must be valid until the callback gets called.
+///
+/// @retval SCE_REMOTE_STORAGE_SUCCESS The operation was successfully registered on the thread.
+/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The RemoteStorage library was not initialised.
+/// @retval SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE There is no enough memory on the library to perform an allocation.
+/// @retval ERROR_OCCURRED This event will be sent to the event callback when an error has occurred in the thread.
+///
+/// @note System errors may be returned. Design your code so it does expect other errors.
+int32_t sceRemoteStorageGetStatus(const SceRemoteStorageStatusReqParams & params, SceRemoteStorageStatus * status);
+
+/// @brief
+/// Gets section of data from a file specified.
+///
+/// Gets section of data from a file specified. The amount of data requested can be of any size. To request this information the name of file, the number of bytes and
+/// the byte to start reading along with a buffer to store such data must be provided.
+/// Metadata information of the file, as description or visibility, will be provided only in the case the first amount of bytes for the file are requested (offset = 0).
+/// This method does make use of the callback to inform the user of success termination. The SceRemoteStorageData pointer must be a pointer to a valid
+/// location in memory until the callback is called as the output information will be stored in such location.
+///
+/// @param params The structure containing the file name to read, the start byte to start reading and the amount of bytes to read.
+/// @param status The structure where the output information will be stored. The memory location being pointed must be valid until the callback gets called.
+///
+/// @retval SCE_REMOTE_STORAGE_SUCCESS The operation was successfully registered on the thread.
+/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The RemoteStorage library was not initialised.
+/// @retval SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE There is no enough memory on the library to perform an allocation.
+/// @retval ERROR_OCCURRED This event will be sent to the event callback when an error has occurred in the thread.
+///
+/// @note System errors may be returned. Design your code so it does expect other errors.
+int32_t sceRemoteStorageGetData(const SceRemoteStorageGetDataReqParams & params, SceRemoteStorageData * data);
+
+/// @brief
+/// Sets chunk of data to a file specified.
+///
+/// Sets chunk of data to a file specified. The amount of data sent must be of, at least, 5 Megabytes per chunk excepts
+/// in the case of the last chunk of the file (or the only one if that is the case) as it can be smaller.
+/// The information provided regarding the chunk as the chunk number, total number of chunks, data buffer and its size should be provided in every call.
+/// The information provided regarding the file as its name, description and visibility should be provided in the last chunk only (this is, when
+/// chunk number = number of chunks).
+/// This method does make use of the callback to inform the user of success termination. The data attribute of the SceRemoteStorageSetDataReqParams pointer
+/// must be a pointer to a valid location in memory until the callback is called as the buffer won't be copied internally.
+///
+/// @param data The structure containing the chunk information.
+///
+/// @retval SCE_REMOTE_STORAGE_SUCCESS The operation was successfully registered on the thread.
+/// @retval SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED The RemoteStorage library was not initialised.
+/// @retval SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE There is no enough memory on the library to perform an allocation.
+/// @retval ERROR_OCCURRED This event will be sent to the event callback when an error has occurred in the thread.
+///
+/// @note System errors may be returned. Design your code so it does expect other errors.
+int32_t sceRemoteStorageSetData(const SceRemoteStorageSetDataReqParams & data);
+
+#endif \ No newline at end of file
diff --git a/Minecraft.Client/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorageDefines.h b/Minecraft.Client/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorageDefines.h
new file mode 100644
index 00000000..b3c8f5cc
--- /dev/null
+++ b/Minecraft.Client/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorageDefines.h
@@ -0,0 +1,167 @@
+
+#ifndef SCE_REMOTE_STORAGE_DEFINES_H
+#define SCE_REMOTE_STORAGE_DEFINES_H
+
+#ifdef __psp2__
+#include <stddef.h>
+#include <apputil.h>
+#elif __ORBIS__
+#include <stddef.h>
+#define SceAppUtilSaveDataDataSlot int
+#elif __PS3__
+#define SceAppUtilSaveDataDataSlot int
+#endif
+
+#include <stdint.h>
+
+// Macros
+#define SCE_REMOTE_STORAGE_MAX_FILES 16
+#define SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN 64
+#define SCE_REMOTE_STORAGE_CLIENT_ID_MAX_LEN 64
+#define SCE_REMOTE_STORAGE_PLATFORM_NAME_MAX_LEN 16
+#define SCE_REMOTE_STORAGE_MD5_STRING_LENGTH 33
+#define SCE_REMOTE_STORAGE_RFC2822_LENGTH 32
+#define SCE_REMOTE_STORAGE_DATA_DESCRIPTION_MAX_LEN 256
+#define SCE_REMOTE_STORAGE_DATA_LOCATION_MAX_LEN 256
+#define SCE_REMOTE_STORAGE_PS3_SAVEDATA_SECUREFILEID_SIZE 16
+#define SCE_REMOTE_STORAGE_PS3_SAVEDATA_FILENAME_SIZE 13
+#define SCE_REMOTE_STORAGE_AUTH_CODE_MAX_LEN 128
+
+// Return values
+#define SCE_REMOTE_STORAGE_SUCCESS 0
+
+// Error codes
+#define SCE_REMOTE_STORAGE_ERROR_INVALID_ARGUMENT 0x80001001
+#define SCE_REMOTE_STORAGE_ERROR_FAILED_TO_CREATE_THREAD 0x80001002
+#define SCE_REMOTE_STORAGE_ERROR_NOT_INITIALISED 0x80001003
+#define SCE_REMOTE_STORAGE_ERROR_FAILED_TO_OPEN_WEB_BROWSER 0x80001004
+#define SCE_REMOTE_STORAGE_ERROR_PSN_ACCOUNT_NOT_LINKED 0x80001005
+#define SCE_REMOTE_STORAGE_ERROR_COULD_NOT_CREATE_SESSION 0x80001006
+#define SCE_REMOTE_STORAGE_ERROR_FAILED_TO_ALLOCATE 0x80001007
+#define SCE_REMOTE_STORAGE_ERROR_SESSION_DOES_NOT_EXIST 0x80001008
+#define SCE_REMOTE_STORAGE_ERROR_REQ_ID_NOT_FOUND 0x80001009
+#define SCE_REMOTE_STORAGE_ERROR_MAX_NUMBER_FILES_REACHED 0x8000100A
+#define SCE_REMOTE_STORAGE_ERROR_NO_MORE_SYNCS 0x8000100B
+#define SCE_REMOTE_STORAGE_ERROR_ALREADY_INITIALISED 0x8000100C
+#define SCE_REMOTE_STORAGE_ERROR_INVALID_UPLOADID 0x8000100D
+#define SCE_REMOTE_STORAGE_ERROR_FAILED_TO_OPEN_FILE 0x8000100E
+#define SCE_REMOTE_STORAGE_ERROR_CLOUD_DATA_CORRUPTED 0x8000100F
+#define SCE_REMOTE_STORAGE_ERROR_INVALID_CHAR_IN_FILE_NAME 0x80001010
+#define SCE_REMOTE_STORAGE_ERROR_INVALID_JSON_RESPONSE 0x80001011
+#define SCE_REMOTE_STORAGE_ERROR_REQUEST_ABORTED 0x80001012
+#define SCE_REMOTE_STORAGE_ERROR_SERVER_ERROR 0x80002000 // Server errors can be between 0x80002064 to 0x800022BB both included
+
+
+typedef enum SceRemoteStorageDataVisibility
+{
+ PRIVATE = 0, // Only data owner can read and write data
+ PUBLIC_READ_ONLY, // Everyone can read this data. Owner can write to it
+ PUBLIC_READ_WRITE // Everyone can read and write data
+} SceRemoteStorageDataVisibility;
+
+typedef enum SceRemoteStorageEvent
+{
+ USER_ACCOUNT_LINKED = 0, // User's account has been linked with PSN
+ PSN_SIGN_IN_REQUIRED, // User's PSN sign-in through web browser is required
+ WEB_BROWSER_RESULT, // Result of sceRemoteStorageOpenWebBrowser(). Please check retCode
+ GET_DATA_RESULT, // Result of sceRemoteStorageGetData(). Please check retCode
+ GET_DATA_PROGRESS, // Progress of sceRemoteStorageGetData() completion as a percentage. Please check retCode
+ SET_DATA_RESULT, // Result of sceRemoteStorageSetData(). Please check retCode
+ SET_DATA_PROGRESS, // Progress of sceRemoteStorageSetData() completion as a percentage. Please check retCode
+ GET_STATUS_RESULT, // Result of sceRemoteStorageGetStatus(). Please check retCode
+ ERROR_OCCURRED // A generic error has occurred. Please check retCode
+} SceRemoteStorageEvent;
+
+typedef enum SceRemoteStorageEnvironment
+{
+ DEVELOPMENT = 0,
+ PRODUCTION
+}SceRemoteStorageEnvironment;
+
+typedef void (*sceRemoteStorageCallback)(const SceRemoteStorageEvent event, int32_t retCode, void * userData);
+
+typedef struct SceRemoteStorageInitParamsThread
+{
+ int32_t threadAffinity; // Thread affinity
+ int32_t threadPriority; // Priority that the thread runs out
+} SceRemoteStorageInitParamsThread;
+
+typedef struct SceRemoteStorageInitParamsPool
+{
+ void * memPoolBuffer; // Memory pool used by sceRemoteStorage library
+ size_t memPoolSize; // Size of memPoolBuffer
+} SceRemoteStorageInitParamsPool;
+
+typedef struct SceRemoteStorageInitTimeout
+{
+ uint32_t resolveMs; //Timeout for DNS resolution in milliseconds. Defaults to 30 seconds
+ uint32_t connectMs; //Timeout for first connection between client and server. Defaults to 30 seconds
+ uint32_t sendMs; //Timeout to send request to server. Defaults to 120 seconds
+ uint32_t receiveMs; //Timeout to receive information from server. Defaults to 120 seconds
+
+ SceRemoteStorageInitTimeout() : resolveMs(30 * 1000), connectMs(30 * 1000), sendMs(120 * 1000), receiveMs(120 * 1000) {}
+}SceRemoteStorageInitTimeout;
+
+typedef struct SceRemoteStorageInitParams
+{
+ sceRemoteStorageCallback callback; // Event callback
+ void * userData; // Application defined data for callback
+ int32_t httpContextId; // PS4 only: Http context ID that was returned from sceHttpInit()
+ int32_t userId; // PS4 only: Current user, see SceUserServiceUserId
+ void * psnTicket; // PS3 only: The PSN ticket used to authenticate the user
+ size_t psnTicketSize; // PS3 only: The size of the PSN ticket in bytes
+ char clientId[SCE_REMOTE_STORAGE_CLIENT_ID_MAX_LEN]; // This represents your application on PSN, used to sign PSN user in for your title
+ SceRemoteStorageInitTimeout timeout; // Timeout for network transactions
+ SceRemoteStorageInitParamsPool pool; // Memory pool parameters
+ SceRemoteStorageInitParamsThread thread; // Thread creation parameters
+ SceRemoteStorageEnvironment environment; // Only used on non-PlayStation platforms: PSN Environment used by the library
+} SceRemoteStorageInitParams;
+
+typedef struct SceRemoteStorageGetDataReqParams
+{
+ char fileName[SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN]; // Name of file on remote storage server
+ char pathLocation[SCE_REMOTE_STORAGE_DATA_LOCATION_MAX_LEN]; // File location on the HDD
+ char secureFileId[SCE_REMOTE_STORAGE_PS3_SAVEDATA_SECUREFILEID_SIZE]; // PS3 only. ID used for save data encryption
+ char ps3DataFilename[SCE_REMOTE_STORAGE_PS3_SAVEDATA_FILENAME_SIZE]; // PS3 only. Name of data file in save data
+ uint32_t ps3FileType; // PS3 only. Type of file, CELL_SAVEDATA_FILETYPE_XXX
+ SceAppUtilSaveDataDataSlot psVitaSaveDataSlot; // PS Vita only. Save data slot information
+} SceRemoteStorageGetDataReqParams;
+
+typedef struct SceRemoteStorageSetDataReqParams
+{
+ char fileName[SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN]; // Name of file on remote storage server
+ char fileDescription[SCE_REMOTE_STORAGE_DATA_DESCRIPTION_MAX_LEN]; // Description of file on remote storage server
+ char pathLocation[SCE_REMOTE_STORAGE_DATA_LOCATION_MAX_LEN]; // File location on the HDD
+ char secureFileId[SCE_REMOTE_STORAGE_PS3_SAVEDATA_SECUREFILEID_SIZE]; // PS3 only. ID used for save data encryption
+ char ps3DataFilename[SCE_REMOTE_STORAGE_PS3_SAVEDATA_FILENAME_SIZE]; // PS3 only. Name of data file in save data
+ uint32_t ps3FileType; // PS3 only. Type of file, CELL_SAVEDATA_FILETYPE_XXX
+ SceRemoteStorageDataVisibility visibility; // Visibility of data
+} SceRemoteStorageSetDataReqParams;
+
+typedef struct SceRemoteStorageData
+{
+ char fileName[SCE_REMOTE_STORAGE_DATA_NAME_MAX_LEN]; // Name of file on remote storage server
+ char fileDescription[SCE_REMOTE_STORAGE_DATA_DESCRIPTION_MAX_LEN]; // Description of file on remote storage server
+ size_t fileSize; // Size of file in bytes
+ char md5Checksum[SCE_REMOTE_STORAGE_MD5_STRING_LENGTH]; // File MD5 checksum
+ char timeStamp[SCE_REMOTE_STORAGE_RFC2822_LENGTH]; // Time that data was written on the server. Format is RFC2822
+ SceRemoteStorageDataVisibility visibility; // Visibility of data
+} SceRemoteStorageData;
+
+typedef struct SceRemoteStorageWebBrowserReqParams { } SceRemoteStorageWebBrowseReqParams;
+
+typedef struct SceRemoteStorageStatusReqParams { } SceRemoteStorageStatusReqParams;
+
+typedef struct SceRemoteStorageAbortReqParams
+{
+ uint32_t requestId; // The request Id to be aborted
+} SceRemoteStorageAbortReqParams;
+
+typedef struct SceRemoteStorageStatus
+{
+ uint32_t numFiles; // Number of files user has on remote storage server
+ SceRemoteStorageData data[SCE_REMOTE_STORAGE_MAX_FILES]; // Details about data if available. Data buffer will not be retrieved
+ uint64_t remainingSyncs; // Remaining syncs. the user has for upload/download
+} SceRemoteStorageStatus;
+
+#endif