summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/file_sys/archive_source_sd_savedata.cpp5
-rw-r--r--src/core/file_sys/archive_source_sd_savedata.h2
-rw-r--r--src/core/gdbstub/gdbstub.cpp17
-rw-r--r--src/core/hle/kernel/kernel.cpp3
-rw-r--r--src/core/loader/loader.h9
-rw-r--r--src/core/loader/ncch.cpp12
-rw-r--r--src/core/loader/ncch.h7
7 files changed, 45 insertions, 10 deletions
diff --git a/src/core/file_sys/archive_source_sd_savedata.cpp b/src/core/file_sys/archive_source_sd_savedata.cpp
index 2d8a950a3..287322d3e 100644
--- a/src/core/file_sys/archive_source_sd_savedata.cpp
+++ b/src/core/file_sys/archive_source_sd_savedata.cpp
@@ -90,4 +90,9 @@ ResultVal<ArchiveFormatInfo> ArchiveSource_SDSaveData::GetFormatInfo(u64 program
return MakeResult<ArchiveFormatInfo>(info);
}
+std::string ArchiveSource_SDSaveData::GetSaveDataPathFor(const std::string& mount_point,
+ u64 program_id) {
+ return GetSaveDataPath(GetSaveDataContainerPath(mount_point), program_id);
+}
+
} // namespace FileSys
diff --git a/src/core/file_sys/archive_source_sd_savedata.h b/src/core/file_sys/archive_source_sd_savedata.h
index b33126c31..b5fe43cc1 100644
--- a/src/core/file_sys/archive_source_sd_savedata.h
+++ b/src/core/file_sys/archive_source_sd_savedata.h
@@ -23,6 +23,8 @@ public:
ResultCode Format(u64 program_id, const FileSys::ArchiveFormatInfo& format_info);
ResultVal<ArchiveFormatInfo> GetFormatInfo(u64 program_id) const;
+ static std::string GetSaveDataPathFor(const std::string& mount_point, u64 program_id);
+
private:
std::string mount_point;
};
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp
index 1303bafc1..f96cbde64 100644
--- a/src/core/gdbstub/gdbstub.cpp
+++ b/src/core/gdbstub/gdbstub.cpp
@@ -185,11 +185,10 @@ static u8 NibbleToHex(u8 n) {
/**
* Converts input hex string characters into an array of equivalent of u8 bytes.
*
-* @param dest Pointer to buffer to store u8 bytes.
* @param src Pointer to array of output hex string characters.
* @param len Length of src array.
*/
-static u32 HexToInt(u8* src, u32 len) {
+static u32 HexToInt(const u8* src, size_t len) {
u32 output = 0;
while (len-- > 0) {
output = (output << 4) | HexCharToValue(src[0]);
@@ -205,7 +204,7 @@ static u32 HexToInt(u8* src, u32 len) {
* @param src Pointer to array of u8 bytes.
* @param len Length of src array.
*/
-static void MemToGdbHex(u8* dest, u8* src, u32 len) {
+static void MemToGdbHex(u8* dest, const u8* src, size_t len) {
while (len-- > 0) {
u8 tmp = *src++;
*dest++ = NibbleToHex(tmp >> 4);
@@ -220,7 +219,7 @@ static void MemToGdbHex(u8* dest, u8* src, u32 len) {
* @param src Pointer to array of output hex string characters.
* @param len Length of src array.
*/
-static void GdbHexToMem(u8* dest, u8* src, u32 len) {
+static void GdbHexToMem(u8* dest, const u8* src, size_t len) {
while (len-- > 0) {
*dest++ = (HexCharToValue(src[0]) << 4) | HexCharToValue(src[1]);
src += 2;
@@ -244,7 +243,7 @@ static void IntToGdbHex(u8* dest, u32 v) {
*
* @param src Pointer to hex string.
*/
-static u32 GdbHexToInt(u8* src) {
+static u32 GdbHexToInt(const u8* src) {
u32 output = 0;
for (int i = 0; i < 8; i += 2) {
@@ -268,7 +267,7 @@ static u8 ReadByte() {
}
/// Calculate the checksum of the current command buffer.
-static u8 CalculateChecksum(u8* buffer, u32 length) {
+static u8 CalculateChecksum(const u8* buffer, size_t length) {
return static_cast<u8>(std::accumulate(buffer, buffer + length, 0, std::plus<u8>()));
}
@@ -586,7 +585,7 @@ static void ReadRegisters() {
/// Modify data of register specified by gdb client.
static void WriteRegister() {
- u8* buffer_ptr = command_buffer + 3;
+ const u8* buffer_ptr = command_buffer + 3;
u32 id = HexCharToValue(command_buffer[1]);
if (command_buffer[2] != '=') {
@@ -612,7 +611,7 @@ static void WriteRegister() {
/// Modify all registers with data received from the client.
static void WriteRegisters() {
- u8* buffer_ptr = command_buffer + 1;
+ const u8* buffer_ptr = command_buffer + 1;
if (command_buffer[0] != 'G')
return SendReply("E01");
@@ -657,7 +656,7 @@ static void ReadMemory() {
SendReply("E01");
}
- u8* data = Memory::GetPointer(addr);
+ const u8* data = Memory::GetPointer(addr);
if (!data) {
return SendReply("E00");
}
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 209d35270..1db8e102f 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -35,7 +35,8 @@ void WaitObject::RemoveWaitingThread(Thread* thread) {
SharedPtr<Thread> WaitObject::GetHighestPriorityReadyThread() {
// Remove the threads that are ready or already running from our waitlist
boost::range::remove_erase_if(waiting_threads, [](const SharedPtr<Thread>& thread) {
- return thread->status == THREADSTATUS_RUNNING || thread->status == THREADSTATUS_READY;
+ return thread->status == THREADSTATUS_RUNNING || thread->status == THREADSTATUS_READY ||
+ thread->status == THREADSTATUS_DEAD;
});
// TODO(Subv): This call should be performed inside the loop below to check if an object can be
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h
index 5e3d46638..a6c2a745f 100644
--- a/src/core/loader/loader.h
+++ b/src/core/loader/loader.h
@@ -144,6 +144,15 @@ public:
}
/**
+ * Get the program id of the application
+ * @param out_program_id Reference to store program id into
+ * @return ResultStatus result of function
+ */
+ virtual ResultStatus ReadProgramId(u64& out_program_id) {
+ return ResultStatus::ErrorNotImplemented;
+ }
+
+ /**
* Get the RomFS of the application
* Since the RomFS can be huge, we return a file reference instead of copying to a buffer
* @param romfs_file The file containing the RomFS
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp
index d4be61e0e..6f2164428 100644
--- a/src/core/loader/ncch.cpp
+++ b/src/core/loader/ncch.cpp
@@ -344,6 +344,18 @@ ResultStatus AppLoader_NCCH::ReadLogo(std::vector<u8>& buffer) {
return LoadSectionExeFS("logo", buffer);
}
+ResultStatus AppLoader_NCCH::ReadProgramId(u64& out_program_id) {
+ if (!file.IsOpen())
+ return ResultStatus::Error;
+
+ ResultStatus result = LoadExeFS();
+ if (result != ResultStatus::Success)
+ return result;
+
+ out_program_id = ncch_header.program_id;
+ return ResultStatus::Success;
+}
+
ResultStatus AppLoader_NCCH::ReadRomFS(std::shared_ptr<FileUtil::IOFile>& romfs_file, u64& offset,
u64& size) {
if (!file.IsOpen())
diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h
index bcf3ae6e3..6c93d46d8 100644
--- a/src/core/loader/ncch.h
+++ b/src/core/loader/ncch.h
@@ -220,6 +220,13 @@ public:
ResultStatus ReadLogo(std::vector<u8>& buffer) override;
/**
+ * Get the program id of the application
+ * @param out_program_id Reference to store program id into
+ * @return ResultStatus result of function
+ */
+ ResultStatus ReadProgramId(u64& out_program_id) override;
+
+ /**
* Get the RomFS of the application
* @param romfs_file Reference to buffer to store data
* @param offset Offset in the file to the RomFS