mirror of
https://github.com/switchbrew/libnx.git
synced 2025-08-06 00:19:22 +02:00
Removed AppletStorage.isHandleStorage since it's not usable for storages not created by the current process. Hence, appletStorageGetSize no longer supports HandleStorage.
This commit is contained in:
parent
10826dda13
commit
41e75d0b7d
@ -72,7 +72,6 @@ struct AppletHookCookie
|
||||
typedef struct {
|
||||
Service s;
|
||||
TransferMemory tmem;
|
||||
bool isHandleStorage;
|
||||
} AppletStorage;
|
||||
|
||||
Result appletInitialize(void);
|
||||
@ -169,7 +168,7 @@ void appletStorageClose(AppletStorage *s);
|
||||
/// Closes the TransferMemory in the storage object. For TransferMemory storage created by the current process, this must be called after the LibraryApplet finishes using it (if sent to one).
|
||||
void appletStorageCloseTmem(AppletStorage *s);
|
||||
|
||||
/// Gets the size of the storage. For HandleStorage, this returns the input s64 originally from /ref appletCreateHandleStorage / \ref appletCreateHandleStorageTmem.
|
||||
/// Gets the size of the storage. This is not usable with HandleStorage, use \ref appletStorageGetHandle or \ref appletStorageMap instead for that.
|
||||
Result appletStorageGetSize(AppletStorage *s, s64 *size);
|
||||
|
||||
/**
|
||||
@ -195,7 +194,7 @@ Result appletStorageRead(AppletStorage *s, s64 offset, void* buffer, size_t size
|
||||
/**
|
||||
* @brief Gets data for a HandleStorage originally from \ref appletCreateHandleStorage input.
|
||||
* @note Only available on 2.0.0+.
|
||||
* @param out Same as \ref appletStorageGetSize.
|
||||
* @param out Output value.
|
||||
* @param handle Output handle.
|
||||
*/
|
||||
Result appletStorageGetHandle(AppletStorage *s, s64 *out, Handle *handle);
|
||||
|
@ -1395,7 +1395,6 @@ static Result _appletExitProcessAndReturn(void) {
|
||||
|
||||
Result appletCreateStorage(AppletStorage *s, s64 size) {
|
||||
memset(s, 0, sizeof(AppletStorage));
|
||||
s->isHandleStorage = false;
|
||||
|
||||
return _appletGetSessionIn64(&g_appletILibraryAppletCreator, &s->s, 10, size);
|
||||
}
|
||||
@ -1446,7 +1445,6 @@ Result appletCreateTransferMemoryStorage(AppletStorage *s, s64 size, bool writab
|
||||
Result rc=0;
|
||||
|
||||
memset(s, 0, sizeof(AppletStorage));
|
||||
s->isHandleStorage = false;
|
||||
|
||||
rc = tmemCreate(&s->tmem, size, Perm_None);
|
||||
if (R_FAILED(rc)) return rc;
|
||||
@ -1461,8 +1459,6 @@ Result appletCreateHandleStorage(AppletStorage *s, s64 inval, Handle handle) {
|
||||
if (!kernelAbove200())
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
s->isHandleStorage = true;
|
||||
|
||||
return _appletCmdInHandle64(&g_appletILibraryAppletCreator, &s->s, 12, handle, inval);
|
||||
}
|
||||
|
||||
@ -1470,7 +1466,6 @@ Result appletCreateHandleStorageTmem(AppletStorage *s, s64 size) {
|
||||
Result rc=0;
|
||||
|
||||
memset(s, 0, sizeof(AppletStorage));
|
||||
s->isHandleStorage = true;
|
||||
|
||||
rc = tmemCreate(&s->tmem, size, Perm_None);
|
||||
if (R_FAILED(rc)) return rc;
|
||||
@ -1528,19 +1523,12 @@ static Result _appletStorageAccessorRW(Service* srv, size_t ipcbufsize, s64 offs
|
||||
|
||||
Result appletStorageGetSize(AppletStorage *s, s64 *size) {
|
||||
Result rc=0;
|
||||
Service tmp_srv;//IStorageAccessor / ITransferStorageAccessor
|
||||
Service tmp_srv;//IStorageAccessor
|
||||
|
||||
if (!serviceIsActive(&s->s))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
if (!s->isHandleStorage) rc = _appletGetSession(&s->s, &tmp_srv, 0);//Open
|
||||
if (s->isHandleStorage) {
|
||||
if (!kernelAbove200())
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
rc = _appletGetSession(&s->s, &tmp_srv, 1);//OpenTransferStorage
|
||||
}
|
||||
|
||||
rc = _appletGetSession(&s->s, &tmp_srv, 0);//Open
|
||||
if (R_FAILED(rc)) return rc;
|
||||
|
||||
rc = _appletCmdNoInOut64(&tmp_srv, (u64*)size, 0);
|
||||
@ -1554,7 +1542,7 @@ static Result _appletStorageRW(AppletStorage *s, s64 offset, void* buffer, size_
|
||||
size_t ipcbufsize=0;
|
||||
Service tmp_srv;//IStorageAccessor
|
||||
|
||||
if (!serviceIsActive(&s->s) || s->isHandleStorage)
|
||||
if (!serviceIsActive(&s->s))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
rc = _appletGetSession(&s->s, &tmp_srv, 0);//Open
|
||||
@ -1618,7 +1606,7 @@ Result appletStorageGetHandle(AppletStorage *s, s64 *out, Handle *handle) {
|
||||
Result rc=0;
|
||||
Service tmp_srv;//ITransferStorageAccessor
|
||||
|
||||
if (!serviceIsActive(&s->s) || !s->isHandleStorage)
|
||||
if (!serviceIsActive(&s->s))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
if (!kernelAbove200())
|
||||
|
Loading…
Reference in New Issue
Block a user