mirror of
https://github.com/PabloMK7/citra.git
synced 2025-10-11 20:10:03 +00:00
kernel: Update to use atmosphere macros and correct Result (#7242)
* kernel: Switch to atmosphere style macros * code: Rename ResultCode to Result * code: Result constants are lower case * Address review comments * core: Remove CASCADE_CODE * R_TRY replaces completely * core: Run clang format
This commit is contained in:
parent
811303ea54
commit
5a7f615da1
132 changed files with 2807 additions and 2995 deletions
|
@ -76,11 +76,11 @@ void Module::Interface::Open(Kernel::HLERequestContext& ctx) {
|
|||
if (dir_result.Failed()) {
|
||||
if (open_mode.create) {
|
||||
cecd->cecd_system_save_data_archive->CreateDirectory(path);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
LOG_DEBUG(Service_CECD, "Failed to open directory: {}", path.AsString());
|
||||
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC,
|
||||
ErrorSummary::NotFound, ErrorLevel::Status));
|
||||
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
}
|
||||
rb.Push<u32>(0); // Zero entries
|
||||
} else {
|
||||
|
@ -93,7 +93,7 @@ void Module::Interface::Open(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
LOG_DEBUG(Service_CECD, "Number of entries found: {}", entry_count);
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(entry_count); // Entry count
|
||||
directory->Close();
|
||||
}
|
||||
|
@ -103,12 +103,12 @@ void Module::Interface::Open(Kernel::HLERequestContext& ctx) {
|
|||
auto file_result = cecd->cecd_system_save_data_archive->OpenFile(path, mode);
|
||||
if (file_result.Failed()) {
|
||||
LOG_DEBUG(Service_CECD, "Failed to open file: {}", path.AsString());
|
||||
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
rb.Push<u32>(0); // No file size
|
||||
} else {
|
||||
session_data->file = std::move(file_result).Unwrap();
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(static_cast<u32>(session_data->file->GetSize())); // Return file size
|
||||
}
|
||||
|
||||
|
@ -151,8 +151,8 @@ void Module::Interface::Read(Kernel::HLERequestContext& ctx) {
|
|||
case CecDataPathType::MboxDir:
|
||||
case CecDataPathType::InboxDir:
|
||||
case CecDataPathType::OutboxDir:
|
||||
rb.Push(ResultCode(ErrorDescription::NotAuthorized, ErrorModule::CEC,
|
||||
ErrorSummary::NotFound, ErrorLevel::Status));
|
||||
rb.Push(Result(ErrorDescription::NotAuthorized, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
rb.Push<u32>(0); // No bytes read
|
||||
break;
|
||||
default: // If not directory, then it is a file
|
||||
|
@ -163,7 +163,7 @@ void Module::Interface::Read(Kernel::HLERequestContext& ctx) {
|
|||
write_buffer.Write(buffer.data(), 0, write_buffer_size);
|
||||
session_data->file->Close();
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(bytes_read);
|
||||
}
|
||||
rb.PushMappedBuffer(write_buffer);
|
||||
|
@ -225,11 +225,11 @@ void Module::Interface::ReadMessage(Kernel::HLERequestContext& ctx) {
|
|||
msg_header.sender_id, msg_header.sender_id2, msg_header.send_count,
|
||||
msg_header.forward_count, msg_header.user_data);
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(bytes_read);
|
||||
} else {
|
||||
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
rb.Push<u32>(0); // zero bytes read
|
||||
}
|
||||
rb.PushMappedBuffer(message_id_buffer);
|
||||
|
@ -317,11 +317,11 @@ void Module::Interface::ReadMessageWithHMAC(Kernel::HLERequestContext& ctx) {
|
|||
else
|
||||
LOG_DEBUG(Service_CECD, "Verification failed");
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(bytes_read);
|
||||
} else {
|
||||
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
rb.Push<u32>(0); // zero bytes read
|
||||
}
|
||||
|
||||
|
@ -356,8 +356,8 @@ void Module::Interface::Write(Kernel::HLERequestContext& ctx) {
|
|||
case CecDataPathType::MboxDir:
|
||||
case CecDataPathType::InboxDir:
|
||||
case CecDataPathType::OutboxDir:
|
||||
rb.Push(ResultCode(ErrorDescription::NotAuthorized, ErrorModule::CEC,
|
||||
ErrorSummary::NotFound, ErrorLevel::Status));
|
||||
rb.Push(Result(ErrorDescription::NotAuthorized, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
break;
|
||||
default: // If not directory, then it is a file
|
||||
std::vector<u8> buffer(read_buffer_size);
|
||||
|
@ -376,7 +376,7 @@ void Module::Interface::Write(Kernel::HLERequestContext& ctx) {
|
|||
session_data->file->Write(0, buffer.size(), true, buffer.data()).Unwrap());
|
||||
session_data->file->Close();
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
rb.PushMappedBuffer(read_buffer);
|
||||
|
||||
|
@ -438,10 +438,10 @@ void Module::Interface::WriteMessage(Kernel::HLERequestContext& ctx) {
|
|||
static_cast<u32>(message->Write(0, buffer_size, true, buffer.data()).Unwrap());
|
||||
message->Close();
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
}
|
||||
|
||||
rb.PushMappedBuffer(read_buffer);
|
||||
|
@ -525,10 +525,10 @@ void Module::Interface::WriteMessageWithHMAC(Kernel::HLERequestContext& ctx) {
|
|||
static_cast<u32>(message->Write(0, buffer_size, true, buffer.data()).Unwrap());
|
||||
message->Close();
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
}
|
||||
|
||||
rb.PushMappedBuffer(read_buffer);
|
||||
|
@ -613,7 +613,7 @@ void Module::Interface::SetData(Kernel::HLERequestContext& ctx) {
|
|||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(read_buffer);
|
||||
|
||||
LOG_DEBUG(Service_CECD, "called, ncch_program_id={:#010x}, buffer_size={:#x}, option={:#x}",
|
||||
|
@ -651,7 +651,7 @@ void Module::Interface::ReadData(Kernel::HLERequestContext& ctx) {
|
|||
dest_buffer.Write(buffer.data(), 0,
|
||||
std::min(static_cast<size_t>(dest_buffer_size), buffer.size()));
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(param_buffer);
|
||||
rb.PushMappedBuffer(dest_buffer);
|
||||
|
||||
|
@ -665,7 +665,7 @@ void Module::Interface::Start(Kernel::HLERequestContext& ctx) {
|
|||
const CecCommand command = rp.PopEnum<CecCommand>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_CECD, "(STUBBED) called, command={}", cecd->GetCecCommandAsString(command));
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ void Module::Interface::Stop(Kernel::HLERequestContext& ctx) {
|
|||
const CecCommand command = rp.PopEnum<CecCommand>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_CECD, "(STUBBED) called, command={}", cecd->GetCecCommandAsString(command));
|
||||
}
|
||||
|
@ -687,7 +687,7 @@ void Module::Interface::GetCecInfoBuffer(Kernel::HLERequestContext& ctx) {
|
|||
auto& buffer = rp.PopMappedBuffer();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
LOG_DEBUG(Service_CECD, "called, buffer_size={}, possible_info_type={}", buffer_size,
|
||||
|
@ -698,7 +698,7 @@ void Module::Interface::GetCecdState(Kernel::HLERequestContext& ctx) {
|
|||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushEnum(CecdState::NdmStatusIdle);
|
||||
|
||||
LOG_WARNING(Service_CECD, "(STUBBED) called");
|
||||
|
@ -708,7 +708,7 @@ void Module::Interface::GetCecInfoEventHandle(Kernel::HLERequestContext& ctx) {
|
|||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects(cecd->cecinfo_event);
|
||||
|
||||
LOG_WARNING(Service_CECD, "(STUBBED) called");
|
||||
|
@ -718,7 +718,7 @@ void Module::Interface::GetChangeStateEventHandle(Kernel::HLERequestContext& ctx
|
|||
IPC::RequestParser rp(ctx);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects(cecd->change_state_event);
|
||||
|
||||
LOG_WARNING(Service_CECD, "(STUBBED) called");
|
||||
|
@ -745,8 +745,8 @@ void Module::Interface::OpenAndWrite(Kernel::HLERequestContext& ctx) {
|
|||
case CecDataPathType::MboxDir:
|
||||
case CecDataPathType::InboxDir:
|
||||
case CecDataPathType::OutboxDir:
|
||||
rb.Push(ResultCode(ErrorDescription::NotAuthorized, ErrorModule::CEC,
|
||||
ErrorSummary::NotFound, ErrorLevel::Status));
|
||||
rb.Push(Result(ErrorDescription::NotAuthorized, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
break;
|
||||
default: // If not directory, then it is a file
|
||||
auto file_result = cecd->cecd_system_save_data_archive->OpenFile(path, mode);
|
||||
|
@ -768,10 +768,10 @@ void Module::Interface::OpenAndWrite(Kernel::HLERequestContext& ctx) {
|
|||
static_cast<u32>(file->Write(0, buffer.size(), true, buffer.data()).Unwrap());
|
||||
file->Close();
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
}
|
||||
}
|
||||
rb.PushMappedBuffer(read_buffer);
|
||||
|
@ -804,8 +804,8 @@ void Module::Interface::OpenAndRead(Kernel::HLERequestContext& ctx) {
|
|||
case CecDataPathType::MboxDir:
|
||||
case CecDataPathType::InboxDir:
|
||||
case CecDataPathType::OutboxDir:
|
||||
rb.Push(ResultCode(ErrorDescription::NotAuthorized, ErrorModule::CEC,
|
||||
ErrorSummary::NotFound, ErrorLevel::Status));
|
||||
rb.Push(Result(ErrorDescription::NotAuthorized, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
rb.Push<u32>(0); // No entries read
|
||||
break;
|
||||
default: // If not directory, then it is a file
|
||||
|
@ -819,11 +819,11 @@ void Module::Interface::OpenAndRead(Kernel::HLERequestContext& ctx) {
|
|||
write_buffer.Write(buffer.data(), 0, buffer_size);
|
||||
file->Close();
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(bytes_read);
|
||||
} else {
|
||||
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
rb.Push(Result(ErrorDescription::NoData, ErrorModule::CEC, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status));
|
||||
rb.Push<u32>(0); // No bytes read
|
||||
}
|
||||
}
|
||||
|
@ -842,7 +842,7 @@ void Module::Interface::GetCecInfoEventHandleSys(Kernel::HLERequestContext& ctx)
|
|||
rp.PopPID();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects(cecd->cecinfosys_event);
|
||||
|
||||
LOG_WARNING(Service_CECD, "(STUBBED) called");
|
||||
|
@ -1404,7 +1404,7 @@ Module::Module(Core::System& system) : system(system) {
|
|||
auto archive_result = systemsavedata_factory.Open(archive_path, 0);
|
||||
|
||||
// If the archive didn't exist, create the files inside
|
||||
if (archive_result.Code() != FileSys::ERROR_NOT_FOUND) {
|
||||
if (archive_result.Code() != FileSys::ResultNotFound) {
|
||||
ASSERT_MSG(archive_result.Succeeded(), "Could not open the CECD SystemSaveData archive!");
|
||||
cecd_system_save_data_archive = std::move(archive_result).Unwrap();
|
||||
} else {
|
||||
|
|
|
@ -500,7 +500,7 @@ public:
|
|||
* Inputs:
|
||||
* 0: Header Code[0x000E0000]
|
||||
* Outputs:
|
||||
* 1: ResultCode
|
||||
* 1: Result
|
||||
* 2: CecdState
|
||||
*/
|
||||
void GetCecdState(Kernel::HLERequestContext& ctx);
|
||||
|
@ -510,7 +510,7 @@ public:
|
|||
* Inputs:
|
||||
* 0: Header Code[0x000F0000]
|
||||
* Outputs:
|
||||
* 1: ResultCode
|
||||
* 1: Result
|
||||
* 3: Event Handle
|
||||
*/
|
||||
void GetCecInfoEventHandle(Kernel::HLERequestContext& ctx);
|
||||
|
@ -520,7 +520,7 @@ public:
|
|||
* Inputs:
|
||||
* 0: Header Code[0x00100000]
|
||||
* Outputs:
|
||||
* 1: ResultCode
|
||||
* 1: Result
|
||||
* 3: Event Handle
|
||||
*/
|
||||
void GetChangeStateEventHandle(Kernel::HLERequestContext& ctx);
|
||||
|
@ -593,7 +593,7 @@ public:
|
|||
* Inputs:
|
||||
* 0: Header Code[0x40020002]
|
||||
* Outputs:
|
||||
* 1: ResultCode
|
||||
* 1: Result
|
||||
* 3: Event Handle
|
||||
*/
|
||||
void GetCecInfoEventHandleSys(Kernel::HLERequestContext& ctx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue