Implement SaveData::GetFreeBytes and BOSS GetTaskStatus

This commit is contained in:
wheremyfoodat 2023-08-13 14:53:04 +03:00
parent 6552f2998c
commit 5f5ead6f55
3 changed files with 20 additions and 5 deletions

View file

@ -5,7 +5,7 @@ class SaveDataArchive : public ArchiveBase {
public:
SaveDataArchive(Memory& mem) : ArchiveBase(mem) {}
u64 getFreeBytes() override { Helpers::panic("SaveData::GetFreeBytes unimplemented"); return 0; }
u64 getFreeBytes() override { return 32_MB; }
std::string name() override { return "SaveData"; }
HorizonResult createDirectory(const FSPath& path) override;

View file

@ -17,7 +17,8 @@ class BOSSService {
void getOptoutFlag(u32 messagePointer);
void getStorageEntryInfo(u32 messagePointer); // Unknown what this is, name taken from Citra
void getTaskIdList(u32 messagePointer);
void getTaskInfo(u32 messagePOinter);
void getTaskInfo(u32 messagePointer);
void getTaskStatus(u32 messagePointer);
void getTaskStorageInfo(u32 messagePointer);
void receiveProperty(u32 messagePointer);
void registerStorageEntry(u32 messagePointer);

View file

@ -12,9 +12,10 @@ namespace BOSSCommands {
GetNsDataIdList = 0x00100102,
ReceiveProperty = 0x00160082,
CancelTask = 0x001E0042,
GetTaskStatus = 0x00200082,
GetTaskInfo = 0x00250082,
RegisterStorageEntry = 0x002F0140,
GetStorageEntryInfo = 0x00300000
GetStorageEntryInfo = 0x00300000,
};
}
@ -31,6 +32,7 @@ void BOSSService::handleSyncRequest(u32 messagePointer) {
case BOSSCommands::GetStorageEntryInfo: getStorageEntryInfo(messagePointer); break;
case BOSSCommands::GetTaskIdList: getTaskIdList(messagePointer); break;
case BOSSCommands::GetTaskInfo: getTaskInfo(messagePointer); break;
case BOSSCommands::GetTaskStatus: getTaskStatus(messagePointer); break;
case BOSSCommands::GetTaskStorageInfo: getTaskStorageInfo(messagePointer); break;
case BOSSCommands::InitializeSession: initializeSession(messagePointer); break;
case BOSSCommands::ReceiveProperty: receiveProperty(messagePointer); break;
@ -48,17 +50,29 @@ void BOSSService::initializeSession(u32 messagePointer) {
}
void BOSSService::getOptoutFlag(u32 messagePointer) {
log("BOSS::getOptoutFlag\n");
log("BOSS::GetOptoutFlag\n");
mem.write32(messagePointer, IPC::responseHeader(0xA, 2, 0));
mem.write32(messagePointer + 4, Result::Success);
mem.write8(messagePointer + 8, optoutFlag);
}
void BOSSService::getTaskStatus(u32 messagePointer) {
const u32 taskIDBufferSize = mem.read32(messagePointer + 4);
const u32 taskIDDataPointer = mem.read32(messagePointer + 16);
log("BOSS::GetTaskStatus (task buffer size: %08X, task data pointer: %08X) (stubbed)\n", taskIDBufferSize, taskIDDataPointer);
mem.write32(messagePointer, IPC::responseHeader(0x20, 2, 2));
mem.write32(messagePointer + 4, Result::Success);
mem.write8(messagePointer + 8, 0); // TODO: What is this?
}
void BOSSService::getTaskStorageInfo(u32 messagePointer) {
log("BOSS::GetTaskStorageInfo (stubbed)\n");
mem.write32(messagePointer, IPC::responseHeader(0x4, 2, 0));
mem.write32(messagePointer + 4, Result::Success);
mem.write32(messagePointer + 8, 0); // Seems to be unknown what this is?
mem.write32(messagePointer + 8, 0); // TaskStatus: Report the task finished successfully
mem.write32(messagePointer + 12, 0); // Same
mem.write32(messagePointer + 16, 5); // TODO: Figure out what this should be
}
void BOSSService::getTaskIdList(u32 messagePointer) {