mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-30 05:24:13 +01:00
boss: Add some missing result codes. (#7334)
This commit is contained in:
parent
2ce0a9e899
commit
81ee7ad893
@ -19,6 +19,14 @@
|
|||||||
|
|
||||||
namespace Service::BOSS {
|
namespace Service::BOSS {
|
||||||
|
|
||||||
|
namespace ErrCodes {
|
||||||
|
enum {
|
||||||
|
TaskNotFound = 51,
|
||||||
|
NsDataNotFound = 64,
|
||||||
|
UnknownPropertyID = 77,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
OnlineService::OnlineService(u64 program_id_, u64 extdata_id_)
|
OnlineService::OnlineService(u64 program_id_, u64 extdata_id_)
|
||||||
: program_id(program_id_), extdata_id(extdata_id_) {}
|
: program_id(program_id_), extdata_id(extdata_id_) {}
|
||||||
|
|
||||||
@ -160,9 +168,9 @@ Result OnlineService::UnregisterTask(const u32 size, Kernel::MappedBuffer& buffe
|
|||||||
std::string task_id(size, 0);
|
std::string task_id(size, 0);
|
||||||
buffer.Read(task_id.data(), 0, size);
|
buffer.Read(task_id.data(), 0, size);
|
||||||
if (task_id_list.erase(task_id) == 0) {
|
if (task_id_list.erase(task_id) == 0) {
|
||||||
LOG_WARNING(Service_BOSS, "TaskId not in list");
|
LOG_WARNING(Service_BOSS, "TaskId '{}' not in list", task_id);
|
||||||
// TODO: Proper error code.
|
return {ErrCodes::TaskNotFound, ErrorModule::BOSS, ErrorSummary::InvalidState,
|
||||||
return ResultUnknown;
|
ErrorLevel::Status};
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
@ -340,8 +348,8 @@ Result OnlineService::GetNsDataHeaderInfo(const u32 ns_data_id, const NsDataHead
|
|||||||
const auto entry = GetNsDataEntryFromId(ns_data_id);
|
const auto entry = GetNsDataEntryFromId(ns_data_id);
|
||||||
if (!entry.has_value()) {
|
if (!entry.has_value()) {
|
||||||
LOG_WARNING(Service_BOSS, "Failed to find NsData entry for ID {:#010X}", ns_data_id);
|
LOG_WARNING(Service_BOSS, "Failed to find NsData entry for ID {:#010X}", ns_data_id);
|
||||||
// TODO: Proper error code.
|
return {ErrCodes::NsDataNotFound, ErrorModule::BOSS, ErrorSummary::InvalidState,
|
||||||
return ResultUnknown;
|
ErrorLevel::Status};
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr std::array EXPECTED_NS_DATA_HEADER_INFO_SIZES = {
|
static constexpr std::array EXPECTED_NS_DATA_HEADER_INFO_SIZES = {
|
||||||
@ -404,8 +412,8 @@ ResultVal<std::size_t> OnlineService::ReadNsData(const u32 ns_data_id, const u64
|
|||||||
std::optional<NsDataEntry> entry = GetNsDataEntryFromId(ns_data_id);
|
std::optional<NsDataEntry> entry = GetNsDataEntryFromId(ns_data_id);
|
||||||
if (!entry.has_value()) {
|
if (!entry.has_value()) {
|
||||||
LOG_WARNING(Service_BOSS, "Failed to find NsData entry for ID {:#010X}", ns_data_id);
|
LOG_WARNING(Service_BOSS, "Failed to find NsData entry for ID {:#010X}", ns_data_id);
|
||||||
// TODO: Proper error code.
|
return Result(ErrCodes::NsDataNotFound, ErrorModule::BOSS, ErrorSummary::InvalidState,
|
||||||
return ResultUnknown;
|
ErrorLevel::Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry->header.payload_size < size + offset) {
|
if (entry->header.payload_size < size + offset) {
|
||||||
@ -457,8 +465,8 @@ Result OnlineService::SendProperty(const u16 id, const u32 size, Kernel::MappedB
|
|||||||
const auto property_id = static_cast<PropertyID>(id);
|
const auto property_id = static_cast<PropertyID>(id);
|
||||||
if (!current_props.properties.contains(property_id)) {
|
if (!current_props.properties.contains(property_id)) {
|
||||||
LOG_ERROR(Service_BOSS, "Unknown property with ID {:#06x} and size {}", property_id, size);
|
LOG_ERROR(Service_BOSS, "Unknown property with ID {:#06x} and size {}", property_id, size);
|
||||||
// TODO: Proper error code.
|
return Result(ErrCodes::UnknownPropertyID, ErrorModule::BOSS, ErrorSummary::Internal,
|
||||||
return ResultUnknown;
|
ErrorLevel::Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& prop = current_props.properties[property_id];
|
auto& prop = current_props.properties[property_id];
|
||||||
@ -498,8 +506,8 @@ Result OnlineService::ReceiveProperty(const u16 id, const u32 size, Kernel::Mapp
|
|||||||
const auto property_id = static_cast<PropertyID>(id);
|
const auto property_id = static_cast<PropertyID>(id);
|
||||||
if (!current_props.properties.contains(property_id)) {
|
if (!current_props.properties.contains(property_id)) {
|
||||||
LOG_ERROR(Service_BOSS, "Unknown property with ID {:#06x} and size {}", property_id, size);
|
LOG_ERROR(Service_BOSS, "Unknown property with ID {:#06x} and size {}", property_id, size);
|
||||||
// TODO: Proper error code.
|
return {ErrCodes::UnknownPropertyID, ErrorModule::BOSS, ErrorSummary::Internal,
|
||||||
return ResultUnknown;
|
ErrorLevel::Status};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto write_pod = [&]<typename T>(T& cur_prop) {
|
auto write_pod = [&]<typename T>(T& cur_prop) {
|
||||||
|
Loading…
Reference in New Issue
Block a user