fspsrv: Implement DisableAutoSaveDataCreation (#6355)
- Used by Mii Edit
This commit is contained in:
parent
4ea171fa5e
commit
c4c256f56a
|
@ -105,7 +105,7 @@ ResultVal<VirtualDir> SaveDataFactory::Open(SaveDataSpaceId space,
|
||||||
|
|
||||||
auto out = dir->GetDirectoryRelative(save_directory);
|
auto out = dir->GetDirectoryRelative(save_directory);
|
||||||
|
|
||||||
if (out == nullptr && ShouldSaveDataBeAutomaticallyCreated(space, meta)) {
|
if (out == nullptr && (ShouldSaveDataBeAutomaticallyCreated(space, meta) && auto_create)) {
|
||||||
return Create(space, meta);
|
return Create(space, meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,4 +199,8 @@ void SaveDataFactory::WriteSaveDataSize(SaveDataType type, u64 title_id, u128 us
|
||||||
size_file->WriteObject(new_value);
|
size_file->WriteObject(new_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SaveDataFactory::SetAutoCreate(bool state) {
|
||||||
|
auto_create = state;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace FileSys
|
} // namespace FileSys
|
||||||
|
|
|
@ -104,9 +104,12 @@ public:
|
||||||
void WriteSaveDataSize(SaveDataType type, u64 title_id, u128 user_id,
|
void WriteSaveDataSize(SaveDataType type, u64 title_id, u128 user_id,
|
||||||
SaveDataSize new_value) const;
|
SaveDataSize new_value) const;
|
||||||
|
|
||||||
|
void SetAutoCreate(bool state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VirtualDir dir;
|
VirtualDir dir;
|
||||||
Core::System& system;
|
Core::System& system;
|
||||||
|
bool auto_create{true};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace FileSys
|
} // namespace FileSys
|
||||||
|
|
|
@ -721,6 +721,10 @@ FileSys::VirtualDir FileSystemController::GetBCATDirectory(u64 title_id) const {
|
||||||
return bis_factory->GetBCATDirectory(title_id);
|
return bis_factory->GetBCATDirectory(title_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileSystemController::SetAutoSaveDataCreation(bool enable) {
|
||||||
|
save_data_factory->SetAutoCreate(enable);
|
||||||
|
}
|
||||||
|
|
||||||
void FileSystemController::CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite) {
|
void FileSystemController::CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite) {
|
||||||
if (overwrite) {
|
if (overwrite) {
|
||||||
bis_factory = nullptr;
|
bis_factory = nullptr;
|
||||||
|
|
|
@ -120,6 +120,8 @@ public:
|
||||||
|
|
||||||
FileSys::VirtualDir GetBCATDirectory(u64 title_id) const;
|
FileSys::VirtualDir GetBCATDirectory(u64 title_id) const;
|
||||||
|
|
||||||
|
void SetAutoSaveDataCreation(bool enable);
|
||||||
|
|
||||||
// Creates the SaveData, SDMC, and BIS Factories. Should be called once and before any function
|
// Creates the SaveData, SDMC, and BIS Factories. Should be called once and before any function
|
||||||
// above is called.
|
// above is called.
|
||||||
void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite = true);
|
void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite = true);
|
||||||
|
|
|
@ -764,7 +764,7 @@ FSP_SRV::FSP_SRV(Core::System& system_)
|
||||||
{1000, nullptr, "SetBisRootForHost"},
|
{1000, nullptr, "SetBisRootForHost"},
|
||||||
{1001, nullptr, "SetSaveDataSize"},
|
{1001, nullptr, "SetSaveDataSize"},
|
||||||
{1002, nullptr, "SetSaveDataRootPath"},
|
{1002, nullptr, "SetSaveDataRootPath"},
|
||||||
{1003, nullptr, "DisableAutoSaveDataCreation"},
|
{1003, &FSP_SRV::DisableAutoSaveDataCreation, "DisableAutoSaveDataCreation"},
|
||||||
{1004, &FSP_SRV::SetGlobalAccessLogMode, "SetGlobalAccessLogMode"},
|
{1004, &FSP_SRV::SetGlobalAccessLogMode, "SetGlobalAccessLogMode"},
|
||||||
{1005, &FSP_SRV::GetGlobalAccessLogMode, "GetGlobalAccessLogMode"},
|
{1005, &FSP_SRV::GetGlobalAccessLogMode, "GetGlobalAccessLogMode"},
|
||||||
{1006, &FSP_SRV::OutputAccessLogToSdCard, "OutputAccessLogToSdCard"},
|
{1006, &FSP_SRV::OutputAccessLogToSdCard, "OutputAccessLogToSdCard"},
|
||||||
|
@ -1030,6 +1030,15 @@ void FSP_SRV::OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx) {
|
||||||
rb.PushIpcInterface<IStorage>(std::move(storage));
|
rb.PushIpcInterface<IStorage>(std::move(storage));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FSP_SRV::DisableAutoSaveDataCreation(Kernel::HLERequestContext& ctx) {
|
||||||
|
LOG_DEBUG(Service_FS, "called");
|
||||||
|
|
||||||
|
fsc.SetAutoSaveDataCreation(false);
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
void FSP_SRV::SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {
|
void FSP_SRV::SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
log_mode = rp.PopEnum<LogMode>();
|
log_mode = rp.PopEnum<LogMode>();
|
||||||
|
|
|
@ -50,6 +50,7 @@ private:
|
||||||
void OpenDataStorageByDataId(Kernel::HLERequestContext& ctx);
|
void OpenDataStorageByDataId(Kernel::HLERequestContext& ctx);
|
||||||
void OpenPatchDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx);
|
void OpenPatchDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx);
|
||||||
void OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx);
|
void OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx);
|
||||||
|
void DisableAutoSaveDataCreation(Kernel::HLERequestContext& ctx);
|
||||||
void SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx);
|
void SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx);
|
||||||
void GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx);
|
void GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx);
|
||||||
void OutputAccessLogToSdCard(Kernel::HLERequestContext& ctx);
|
void OutputAccessLogToSdCard(Kernel::HLERequestContext& ctx);
|
||||||
|
|
Loading…
Reference in New Issue