diff options
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 22 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.cpp | 13 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.h | 7 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/fsp_srv.cpp | 14 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/fsp_srv.h | 1 |
5 files changed, 55 insertions, 2 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index d3a674cf6..d9f003ed4 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -2,12 +2,15 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <cinttypes> | ||
| 6 | #include "core/file_sys/filesystem.h" | ||
| 5 | #include "core/hle/ipc_helpers.h" | 7 | #include "core/hle/ipc_helpers.h" |
| 6 | #include "core/hle/kernel/event.h" | 8 | #include "core/hle/kernel/event.h" |
| 7 | #include "core/hle/service/am/am.h" | 9 | #include "core/hle/service/am/am.h" |
| 8 | #include "core/hle/service/am/applet_ae.h" | 10 | #include "core/hle/service/am/applet_ae.h" |
| 9 | #include "core/hle/service/am/applet_oe.h" | 11 | #include "core/hle/service/am/applet_oe.h" |
| 10 | #include "core/hle/service/apm/apm.h" | 12 | #include "core/hle/service/apm/apm.h" |
| 13 | #include "core/hle/service/filesystem/filesystem.h" | ||
| 11 | #include "core/hle/service/nvflinger/nvflinger.h" | 14 | #include "core/hle/service/nvflinger/nvflinger.h" |
| 12 | 15 | ||
| 13 | namespace Service { | 16 | namespace Service { |
| @@ -416,9 +419,24 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { | |||
| 416 | } | 419 | } |
| 417 | 420 | ||
| 418 | void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) { | 421 | void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) { |
| 419 | LOG_WARNING(Service, "(STUBBED) called"); | 422 | IPC::RequestParser rp{ctx}; |
| 423 | u128 uid = rp.PopRaw<u128>(); | ||
| 424 | |||
| 425 | LOG_WARNING(Service, "(STUBBED) called uid = %016" PRIX64 "%016" PRIX64, uid[1], uid[0]); | ||
| 426 | |||
| 420 | IPC::ResponseBuilder rb{ctx, 4}; | 427 | IPC::ResponseBuilder rb{ctx, 4}; |
| 421 | rb.Push(RESULT_SUCCESS); | 428 | |
| 429 | FileSys::Path unused; | ||
| 430 | auto savedata = FileSystem::OpenFileSystem(FileSystem::Type::SaveData, unused); | ||
| 431 | if (savedata.Failed()) { | ||
| 432 | // Create the save data and return an error indicating that the operation was performed. | ||
| 433 | FileSystem::FormatFileSystem(FileSystem::Type::SaveData); | ||
| 434 | // TODO(Subv): Find out the correct error code for this. | ||
| 435 | rb.Push(ResultCode(ErrorModule::FS, 40)); | ||
| 436 | } else { | ||
| 437 | rb.Push(RESULT_SUCCESS); | ||
| 438 | } | ||
| 439 | |||
| 422 | rb.Push<u64>(0); | 440 | rb.Push<u64>(0); |
| 423 | } | 441 | } |
| 424 | 442 | ||
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index 32752aea5..ef05955b9 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp | |||
| @@ -43,6 +43,19 @@ ResultVal<std::unique_ptr<FileSys::FileSystemBackend>> OpenFileSystem(Type type, | |||
| 43 | return itr->second->Open(path); | 43 | return itr->second->Open(path); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | ResultCode FormatFileSystem(Type type) { | ||
| 47 | LOG_TRACE(Service_FS, "Formatting FileSystem with type=%d", type); | ||
| 48 | |||
| 49 | auto itr = filesystem_map.find(type); | ||
| 50 | if (itr == filesystem_map.end()) { | ||
| 51 | // TODO(bunnei): Find a better error code for this | ||
| 52 | return ResultCode(-1); | ||
| 53 | } | ||
| 54 | |||
| 55 | FileSys::Path unused; | ||
| 56 | return itr->second->Format(unused); | ||
| 57 | } | ||
| 58 | |||
| 46 | void RegisterFileSystems() { | 59 | void RegisterFileSystems() { |
| 47 | filesystem_map.clear(); | 60 | filesystem_map.clear(); |
| 48 | 61 | ||
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h index 80f318676..8d30e94a1 100644 --- a/src/core/hle/service/filesystem/filesystem.h +++ b/src/core/hle/service/filesystem/filesystem.h | |||
| @@ -44,6 +44,13 @@ ResultCode RegisterFileSystem(std::unique_ptr<FileSys::FileSystemFactory>&& fact | |||
| 44 | ResultVal<std::unique_ptr<FileSys::FileSystemBackend>> OpenFileSystem(Type type, | 44 | ResultVal<std::unique_ptr<FileSys::FileSystemBackend>> OpenFileSystem(Type type, |
| 45 | FileSys::Path& path); | 45 | FileSys::Path& path); |
| 46 | 46 | ||
| 47 | /** | ||
| 48 | * Formats a file system | ||
| 49 | * @param type Type of the file system to format | ||
| 50 | * @return ResultCode of the operation | ||
| 51 | */ | ||
| 52 | ResultCode FormatFileSystem(Type type); | ||
| 53 | |||
| 47 | /// Registers all Filesystem services with the specified service manager. | 54 | /// Registers all Filesystem services with the specified service manager. |
| 48 | void InstallInterfaces(SM::ServiceManager& service_manager); | 55 | void InstallInterfaces(SM::ServiceManager& service_manager); |
| 49 | 56 | ||
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 3ac5a96cb..97b3fa290 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp | |||
| @@ -245,6 +245,7 @@ FSP_SRV::FSP_SRV() : ServiceFramework("fsp-srv") { | |||
| 245 | static const FunctionInfo functions[] = { | 245 | static const FunctionInfo functions[] = { |
| 246 | {1, &FSP_SRV::Initalize, "Initalize"}, | 246 | {1, &FSP_SRV::Initalize, "Initalize"}, |
| 247 | {18, &FSP_SRV::MountSdCard, "MountSdCard"}, | 247 | {18, &FSP_SRV::MountSdCard, "MountSdCard"}, |
| 248 | {22, &FSP_SRV::CreateSaveData, "CreateSaveData"}, | ||
| 248 | {51, &FSP_SRV::MountSaveData, "MountSaveData"}, | 249 | {51, &FSP_SRV::MountSaveData, "MountSaveData"}, |
| 249 | {200, &FSP_SRV::OpenDataStorageByCurrentProcess, "OpenDataStorageByCurrentProcess"}, | 250 | {200, &FSP_SRV::OpenDataStorageByCurrentProcess, "OpenDataStorageByCurrentProcess"}, |
| 250 | {202, nullptr, "OpenDataStorageByDataId"}, | 251 | {202, nullptr, "OpenDataStorageByDataId"}, |
| @@ -279,6 +280,19 @@ void FSP_SRV::MountSdCard(Kernel::HLERequestContext& ctx) { | |||
| 279 | rb.Push(RESULT_SUCCESS); | 280 | rb.Push(RESULT_SUCCESS); |
| 280 | } | 281 | } |
| 281 | 282 | ||
| 283 | void FSP_SRV::CreateSaveData(Kernel::HLERequestContext& ctx) { | ||
| 284 | IPC::RequestParser rp{ctx}; | ||
| 285 | |||
| 286 | auto save_struct = rp.PopRaw<std::array<u8, 0x40>>(); | ||
| 287 | auto save_create_struct = rp.PopRaw<std::array<u8, 0x40>>(); | ||
| 288 | u128 uid = rp.PopRaw<u128>(); | ||
| 289 | |||
| 290 | LOG_WARNING(Service_FS, "(STUBBED) called uid = %016" PRIX64 "%016" PRIX64, uid[1], uid[0]); | ||
| 291 | |||
| 292 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 293 | rb.Push(RESULT_SUCCESS); | ||
| 294 | } | ||
| 295 | |||
| 282 | void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) { | 296 | void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) { |
| 283 | LOG_WARNING(Service_FS, "(STUBBED) called"); | 297 | LOG_WARNING(Service_FS, "(STUBBED) called"); |
| 284 | 298 | ||
diff --git a/src/core/hle/service/filesystem/fsp_srv.h b/src/core/hle/service/filesystem/fsp_srv.h index f19b2f2c4..e15ba4375 100644 --- a/src/core/hle/service/filesystem/fsp_srv.h +++ b/src/core/hle/service/filesystem/fsp_srv.h | |||
| @@ -24,6 +24,7 @@ private: | |||
| 24 | 24 | ||
| 25 | void Initalize(Kernel::HLERequestContext& ctx); | 25 | void Initalize(Kernel::HLERequestContext& ctx); |
| 26 | void MountSdCard(Kernel::HLERequestContext& ctx); | 26 | void MountSdCard(Kernel::HLERequestContext& ctx); |
| 27 | void CreateSaveData(Kernel::HLERequestContext& ctx); | ||
| 27 | void MountSaveData(Kernel::HLERequestContext& ctx); | 28 | void MountSaveData(Kernel::HLERequestContext& ctx); |
| 28 | void GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx); | 29 | void GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx); |
| 29 | void OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx); | 30 | void OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx); |