summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/CMakeLists.txt2
-rw-r--r--src/core/arm/interpreter/armemu.cpp31
-rw-r--r--src/core/file_sys/archive_savedata.h3
-rw-r--r--src/core/file_sys/archive_systemsavedata.cpp33
-rw-r--r--src/core/file_sys/archive_systemsavedata.h33
-rw-r--r--src/core/hle/service/fs/archive.cpp9
6 files changed, 98 insertions, 13 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index f71232c1a..3381524e3 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -20,6 +20,7 @@ set(SRCS
20 file_sys/archive_romfs.cpp 20 file_sys/archive_romfs.cpp
21 file_sys/archive_savedata.cpp 21 file_sys/archive_savedata.cpp
22 file_sys/archive_sdmc.cpp 22 file_sys/archive_sdmc.cpp
23 file_sys/archive_systemsavedata.cpp
23 file_sys/disk_archive.cpp 24 file_sys/disk_archive.cpp
24 file_sys/file_romfs.cpp 25 file_sys/file_romfs.cpp
25 file_sys/directory_romfs.cpp 26 file_sys/directory_romfs.cpp
@@ -101,6 +102,7 @@ set(HEADERS
101 file_sys/archive_romfs.h 102 file_sys/archive_romfs.h
102 file_sys/archive_savedata.h 103 file_sys/archive_savedata.h
103 file_sys/archive_sdmc.h 104 file_sys/archive_sdmc.h
105 file_sys/archive_systemsavedata.h
104 file_sys/disk_archive.h 106 file_sys/disk_archive.h
105 file_sys/file_backend.h 107 file_sys/file_backend.h
106 file_sys/file_romfs.h 108 file_sys/file_romfs.h
diff --git a/src/core/arm/interpreter/armemu.cpp b/src/core/arm/interpreter/armemu.cpp
index f4452f356..07d205755 100644
--- a/src/core/arm/interpreter/armemu.cpp
+++ b/src/core/arm/interpreter/armemu.cpp
@@ -6217,18 +6217,27 @@ L_stm_s_takeabort:
6217 //ichfly 6217 //ichfly
6218 //USAT16 6218 //USAT16
6219 { 6219 {
6220 u8 tar = BITS(12, 15); 6220 const u8 rd_idx = BITS(12, 15);
6221 u8 src = BITS(0, 3); 6221 const u8 rn_idx = BITS(0, 3);
6222 u8 val = BITS(16, 19); 6222 const u8 num_bits = BITS(16, 19);
6223 s16 a1 = (state->Reg[src]); 6223 const s16 max = 0xFFFF >> (16 - num_bits);
6224 s16 a2 = (state->Reg[src] >> 0x10); 6224 s16 rn_lo = (state->Reg[rn_idx]);
6225 s16 max = 0xFFFF >> (16 - val); 6225 s16 rn_hi = (state->Reg[rn_idx] >> 16);
6226 if (max < a1) a1 = max; 6226
6227 if (max < a2) a2 = max; 6227 if (max < rn_lo)
6228 u32 temp2 = ((u32)(a2)) << 0x10; 6228 rn_lo = max;
6229 state->Reg[tar] = (a1 & 0xFFFF) | (temp2); 6229 else if (rn_lo < 0)
6230 rn_lo = 0;
6231
6232 if (max < rn_hi)
6233 rn_hi = max;
6234 else if (rn_hi < 0)
6235 rn_hi = 0;
6236
6237 state->Reg[rd_idx] = (rn_lo & 0xFFFF) | ((rn_hi << 16) & 0xFFFF);
6238 return 1;
6230 } 6239 }
6231 return 1; 6240
6232 default: 6241 default:
6233 break; 6242 break;
6234 } 6243 }
diff --git a/src/core/file_sys/archive_savedata.h b/src/core/file_sys/archive_savedata.h
index b3e561130..d394ad37e 100644
--- a/src/core/file_sys/archive_savedata.h
+++ b/src/core/file_sys/archive_savedata.h
@@ -21,8 +21,7 @@ public:
21 21
22 /** 22 /**
23 * Initialize the archive. 23 * Initialize the archive.
24 * @return CreateSaveDataResult AlreadyExists if the SaveData folder already exists, 24 * @return true if it initialized successfully
25 * Success if it was created properly and Failure if there was any error
26 */ 25 */
27 bool Initialize(); 26 bool Initialize();
28 27
diff --git a/src/core/file_sys/archive_systemsavedata.cpp b/src/core/file_sys/archive_systemsavedata.cpp
new file mode 100644
index 000000000..dc2c23b41
--- /dev/null
+++ b/src/core/file_sys/archive_systemsavedata.cpp
@@ -0,0 +1,33 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+
3// Refer to the license.txt file included.
4
5#include <sys/stat.h>
6
7#include "common/common_types.h"
8#include "common/file_util.h"
9
10#include "core/file_sys/archive_systemsavedata.h"
11#include "core/file_sys/disk_archive.h"
12#include "core/settings.h"
13
14////////////////////////////////////////////////////////////////////////////////////////////////////
15// FileSys namespace
16
17namespace FileSys {
18
19Archive_SystemSaveData::Archive_SystemSaveData(const std::string& mount_point)
20 : DiskArchive(mount_point) {
21 LOG_INFO(Service_FS, "Directory %s set as SystemSaveData.", this->mount_point.c_str());
22}
23
24bool Archive_SystemSaveData::Initialize() {
25 if (!FileUtil::CreateFullPath(mount_point)) {
26 LOG_ERROR(Service_FS, "Unable to create SystemSaveData path.");
27 return false;
28 }
29
30 return true;
31}
32
33} // namespace FileSys
diff --git a/src/core/file_sys/archive_systemsavedata.h b/src/core/file_sys/archive_systemsavedata.h
new file mode 100644
index 000000000..360ed1e13
--- /dev/null
+++ b/src/core/file_sys/archive_systemsavedata.h
@@ -0,0 +1,33 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "common/common_types.h"
8
9#include "core/file_sys/disk_archive.h"
10#include "core/loader/loader.h"
11
12////////////////////////////////////////////////////////////////////////////////////////////////////
13// FileSys namespace
14
15namespace FileSys {
16
17/// File system interface to the SystemSaveData archive
18/// TODO(Subv): This archive should point to a location in the NAND,
19/// specifically nand:/data/<ID0>/sysdata/<SaveID-Low>/<SaveID-High>
20class Archive_SystemSaveData final : public DiskArchive {
21public:
22 Archive_SystemSaveData(const std::string& mount_point);
23
24 /**
25 * Initialize the archive.
26 * @return true if it initialized successfully
27 */
28 bool Initialize();
29
30 std::string GetName() const override { return "SystemSaveData"; }
31};
32
33} // namespace FileSys
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 9c3834733..d06f955d4 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -419,6 +419,15 @@ void ArchiveInit() {
419 CreateArchive(std::move(sdmc_archive), ArchiveIdCode::SDMC); 419 CreateArchive(std::move(sdmc_archive), ArchiveIdCode::SDMC);
420 else 420 else
421 LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str()); 421 LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str());
422
423 std::string systemsavedata_directory = FileUtil::GetUserPath(D_SYSSAVEDATA_IDX);
424 auto systemsavedata_archive = std::make_unique<FileSys::Archive_SDMC>(systemsavedata_directory);
425 if (systemsavedata_archive->Initialize()) {
426 CreateArchive(std::move(sdmc_archive), ArchiveIdCode::SystemSaveData);
427 } else {
428 LOG_ERROR(Service_FS, "Can't instantiate SystemSaveData archive with path %s",
429 systemsavedata_directory.c_str());
430 }
422} 431}
423 432
424/// Shutdown archives 433/// Shutdown archives