service: Mark variables as [[maybe_unused]] where applicable (#5318)

Quite a few service functions are stubbed but still pop all their
arguments, which can lead to unused variable warnings.

We can mark the unused arguments with [[maybe_unused]] to silence these
warnings until a full implementation of these functions are made.
This commit is contained in:
Mat M 2020-05-04 06:22:33 -04:00 committed by GitHub
parent 6e48149ee1
commit e9819b61a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 103 additions and 102 deletions

View file

@ -103,7 +103,7 @@ void Module::Interface::GetWifiStatus(Kernel::HLERequestContext& ctx) {
void Module::Interface::GetInfraPriority(Kernel::HLERequestContext& ctx) { void Module::Interface::GetInfraPriority(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x27, 0, 2); IPC::RequestParser rp(ctx, 0x27, 0, 2);
const std::vector<u8>& ac_config = rp.PopStaticBuffer(); [[maybe_unused]] const std::vector<u8>& ac_config = rp.PopStaticBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);

View file

@ -1093,7 +1093,7 @@ void Module::Interface::BeginImportProgramTemporarily(Kernel::HLERequestContext&
void Module::Interface::EndImportProgram(Kernel::HLERequestContext& ctx) { void Module::Interface::EndImportProgram(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x0405, 0, 2); // 0x04050002 IPC::RequestParser rp(ctx, 0x0405, 0, 2); // 0x04050002
auto cia = rp.PopObject<Kernel::ClientSession>(); [[maybe_unused]] const auto cia = rp.PopObject<Kernel::ClientSession>();
am->ScanForAllTitles(); am->ScanForAllTitles();
@ -1104,7 +1104,7 @@ void Module::Interface::EndImportProgram(Kernel::HLERequestContext& ctx) {
void Module::Interface::EndImportProgramWithoutCommit(Kernel::HLERequestContext& ctx) { void Module::Interface::EndImportProgramWithoutCommit(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x0406, 0, 2); // 0x04060002 IPC::RequestParser rp(ctx, 0x0406, 0, 2); // 0x04060002
auto cia = rp.PopObject<Kernel::ClientSession>(); [[maybe_unused]] const auto cia = rp.PopObject<Kernel::ClientSession>();
// Note: This function is basically a no-op for us since we don't use title.db or ticket.db // Note: This function is basically a no-op for us since we don't use title.db or ticket.db
// files to keep track of installed titles. // files to keep track of installed titles.
@ -1117,10 +1117,10 @@ void Module::Interface::EndImportProgramWithoutCommit(Kernel::HLERequestContext&
void Module::Interface::CommitImportPrograms(Kernel::HLERequestContext& ctx) { void Module::Interface::CommitImportPrograms(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x0407, 3, 2); // 0x040700C2 IPC::RequestParser rp(ctx, 0x0407, 3, 2); // 0x040700C2
auto media_type = static_cast<Service::FS::MediaType>(rp.Pop<u8>()); [[maybe_unused]] const auto media_type = static_cast<FS::MediaType>(rp.Pop<u8>());
u32 title_count = rp.Pop<u32>(); [[maybe_unused]] const u32 title_count = rp.Pop<u32>();
u8 database = rp.Pop<u8>(); [[maybe_unused]] const u8 database = rp.Pop<u8>();
auto buffer = rp.PopMappedBuffer(); const auto buffer = rp.PopMappedBuffer();
// Note: This function is basically a no-op for us since we don't use title.db or ticket.db // Note: This function is basically a no-op for us since we don't use title.db or ticket.db
// files to keep track of installed titles. // files to keep track of installed titles.
@ -1204,7 +1204,7 @@ ResultVal<std::unique_ptr<AMFileWrapper>> GetFileFromSession(
void Module::Interface::GetProgramInfoFromCia(Kernel::HLERequestContext& ctx) { void Module::Interface::GetProgramInfoFromCia(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x0408, 1, 2); // 0x04080042 IPC::RequestParser rp(ctx, 0x0408, 1, 2); // 0x04080042
auto media_type = static_cast<Service::FS::MediaType>(rp.Pop<u8>()); [[maybe_unused]] const auto media_type = static_cast<FS::MediaType>(rp.Pop<u8>());
auto cia = rp.PopObject<Kernel::ClientSession>(); auto cia = rp.PopObject<Kernel::ClientSession>();
auto file_res = GetFileFromSession(cia); auto file_res = GetFileFromSession(cia);
@ -1360,7 +1360,7 @@ void Module::Interface::GetCoreVersionFromCia(Kernel::HLERequestContext& ctx) {
void Module::Interface::GetRequiredSizeFromCia(Kernel::HLERequestContext& ctx) { void Module::Interface::GetRequiredSizeFromCia(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x040D, 1, 2); // 0x040D0042 IPC::RequestParser rp(ctx, 0x040D, 1, 2); // 0x040D0042
auto media_type = static_cast<Service::FS::MediaType>(rp.Pop<u8>()); [[maybe_unused]] const auto media_type = static_cast<FS::MediaType>(rp.Pop<u8>());
auto cia = rp.PopObject<Kernel::ClientSession>(); auto cia = rp.PopObject<Kernel::ClientSession>();
auto file_res = GetFileFromSession(cia); auto file_res = GetFileFromSession(cia);

View file

@ -449,11 +449,11 @@ void Module::APTInterface::PrepareToDoApplicationJump(Kernel::HLERequestContext&
void Module::APTInterface::DoApplicationJump(Kernel::HLERequestContext& ctx) { void Module::APTInterface::DoApplicationJump(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x32, 2, 4); // 0x00320084 IPC::RequestParser rp(ctx, 0x32, 2, 4); // 0x00320084
u32 param_size = rp.Pop<u32>(); const auto param_size = rp.Pop<u32>();
u32 hmac_size = rp.Pop<u32>(); const auto hmac_size = rp.Pop<u32>();
auto param = rp.PopStaticBuffer(); [[maybe_unused]] const auto param = rp.PopStaticBuffer();
auto hmac = rp.PopStaticBuffer(); [[maybe_unused]] const auto hmac = rp.PopStaticBuffer();
LOG_WARNING(Service_APT, "(STUBBED) called param_size={:08X}, hmac_size={:08X}", param_size, LOG_WARNING(Service_APT, "(STUBBED) called param_size={:08X}, hmac_size={:08X}", param_size,
hmac_size); hmac_size);
@ -502,11 +502,11 @@ void Module::APTInterface::PrepareToStartApplication(Kernel::HLERequestContext&
void Module::APTInterface::StartApplication(Kernel::HLERequestContext& ctx) { void Module::APTInterface::StartApplication(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x1B, 3, 4); // 0x001B00C4 IPC::RequestParser rp(ctx, 0x1B, 3, 4); // 0x001B00C4
u32 buffer1_size = rp.Pop<u32>(); const auto buffer1_size = rp.Pop<u32>();
u32 buffer2_size = rp.Pop<u32>(); const auto buffer2_size = rp.Pop<u32>();
u32 flag = rp.Pop<u32>(); const auto flag = rp.Pop<u32>();
std::vector<u8> buffer1 = rp.PopStaticBuffer(); [[maybe_unused]] const std::vector<u8> buffer1 = rp.PopStaticBuffer();
std::vector<u8> buffer2 = rp.PopStaticBuffer(); [[maybe_unused]] const std::vector<u8> buffer2 = rp.PopStaticBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); // No error rb.Push(RESULT_SUCCESS); // No error
@ -520,10 +520,10 @@ void Module::APTInterface::AppletUtility(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x4B, 3, 2); // 0x004B00C2 IPC::RequestParser rp(ctx, 0x4B, 3, 2); // 0x004B00C2
// These are from 3dbrew - I'm not really sure what they're used for. // These are from 3dbrew - I'm not really sure what they're used for.
u32 utility_command = rp.Pop<u32>(); const auto utility_command = rp.Pop<u32>();
u32 input_size = rp.Pop<u32>(); const auto input_size = rp.Pop<u32>();
u32 output_size = rp.Pop<u32>(); const auto output_size = rp.Pop<u32>();
std::vector<u8> input = rp.PopStaticBuffer(); [[maybe_unused]] const std::vector<u8> input = rp.PopStaticBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); // No error rb.Push(RESULT_SUCCESS); // No error
@ -611,21 +611,21 @@ void Module::APTInterface::StartLibraryApplet(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x1E, 2, 4); // 0x1E0084 IPC::RequestParser rp(ctx, 0x1E, 2, 4); // 0x1E0084
AppletId applet_id = rp.PopEnum<AppletId>(); AppletId applet_id = rp.PopEnum<AppletId>();
std::size_t buffer_size = rp.Pop<u32>(); [[maybe_unused]] const std::size_t buffer_size = rp.Pop<u32>();
std::shared_ptr<Kernel::Object> object = rp.PopGenericObject(); std::shared_ptr<Kernel::Object> object = rp.PopGenericObject();
std::vector<u8> buffer = rp.PopStaticBuffer(); const std::vector<u8> buffer = rp.PopStaticBuffer();
LOG_DEBUG(Service_APT, "called, applet_id={:08X}", static_cast<u32>(applet_id)); LOG_DEBUG(Service_APT, "called, applet_id={:08X}", static_cast<u32>(applet_id));
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(apt->applet_manager->StartLibraryApplet(applet_id, object, buffer)); rb.Push(apt->applet_manager->StartLibraryApplet(applet_id, std::move(object), buffer));
} }
void Module::APTInterface::CloseApplication(Kernel::HLERequestContext& ctx) { void Module::APTInterface::CloseApplication(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x27, 1, 4); IPC::RequestParser rp(ctx, 0x27, 1, 4);
u32 parameters_size = rp.Pop<u32>(); [[maybe_unused]] const u32 parameters_size = rp.Pop<u32>();
std::shared_ptr<Kernel::Object> object = rp.PopGenericObject(); [[maybe_unused]] const std::shared_ptr<Kernel::Object> object = rp.PopGenericObject();
std::vector<u8> buffer = rp.PopStaticBuffer(); [[maybe_unused]] const std::vector<u8> buffer = rp.PopStaticBuffer();
LOG_DEBUG(Service_APT, "called"); LOG_DEBUG(Service_APT, "called");

View file

@ -58,7 +58,7 @@ void Module::Interface::GetStorageInfo(Kernel::HLERequestContext& ctx) {
void Module::Interface::RegisterPrivateRootCa(Kernel::HLERequestContext& ctx) { void Module::Interface::RegisterPrivateRootCa(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x05, 1, 2); IPC::RequestParser rp(ctx, 0x05, 1, 2);
const u32 size = rp.Pop<u32>(); [[maybe_unused]] const u32 size = rp.Pop<u32>();
auto& buffer = rp.PopMappedBuffer(); auto& buffer = rp.PopMappedBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
@ -96,7 +96,7 @@ void Module::Interface::GetNewArrivalFlag(Kernel::HLERequestContext& ctx) {
void Module::Interface::RegisterNewArrivalEvent(Kernel::HLERequestContext& ctx) { void Module::Interface::RegisterNewArrivalEvent(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x08, 0, 2); IPC::RequestParser rp(ctx, 0x08, 0, 2);
const auto event = rp.PopObject<Kernel::Event>(); [[maybe_unused]] const auto event = rp.PopObject<Kernel::Event>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -282,7 +282,7 @@ void Module::Interface::SendProperty(Kernel::HLERequestContext& ctx) {
void Module::Interface::SendPropertyHandle(Kernel::HLERequestContext& ctx) { void Module::Interface::SendPropertyHandle(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x15, 1, 2); IPC::RequestParser rp(ctx, 0x15, 1, 2);
const u16 property_id = rp.Pop<u16>(); const u16 property_id = rp.Pop<u16>();
const std::shared_ptr<Kernel::Object> object = rp.PopGenericObject(); [[maybe_unused]] const std::shared_ptr<Kernel::Object> object = rp.PopGenericObject();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);

View file

@ -371,7 +371,7 @@ void Module::Interface::Write(Kernel::HLERequestContext& ctx) {
buffer); buffer);
} }
const u32 bytes_written = static_cast<u32>( [[maybe_unused]] const u32 bytes_written = static_cast<u32>(
session_data->file->Write(0, buffer.size(), true, buffer.data()).Unwrap()); session_data->file->Write(0, buffer.size(), true, buffer.data()).Unwrap());
session_data->file->Close(); session_data->file->Close();
@ -433,7 +433,7 @@ void Module::Interface::WriteMessage(Kernel::HLERequestContext& ctx) {
msg_header.sender_id, msg_header.sender_id2, msg_header.send_count, msg_header.sender_id, msg_header.sender_id2, msg_header.send_count,
msg_header.forward_count, msg_header.user_data); msg_header.forward_count, msg_header.user_data);
const u32 bytes_written = [[maybe_unused]] const u32 bytes_written =
static_cast<u32>(message->Write(0, buffer_size, true, buffer.data()).Unwrap()); static_cast<u32>(message->Write(0, buffer_size, true, buffer.data()).Unwrap());
message->Close(); message->Close();
@ -520,7 +520,7 @@ void Module::Interface::WriteMessageWithHMAC(Kernel::HLERequestContext& ctx) {
hmac.CalculateDigest(hmac_digest.data(), message_body.data(), msg_header.body_size); hmac.CalculateDigest(hmac_digest.data(), message_body.data(), msg_header.body_size);
std::memcpy(buffer.data() + hmac_offset, hmac_digest.data(), hmac_size); std::memcpy(buffer.data() + hmac_offset, hmac_digest.data(), hmac_size);
const u32 bytes_written = [[maybe_unused]] const u32 bytes_written =
static_cast<u32>(message->Write(0, buffer_size, true, buffer.data()).Unwrap()); static_cast<u32>(message->Write(0, buffer_size, true, buffer.data()).Unwrap());
message->Close(); message->Close();
@ -763,7 +763,7 @@ void Module::Interface::OpenAndWrite(Kernel::HLERequestContext& ctx) {
cecd->CheckAndUpdateFile(path_type, ncch_program_id, buffer); cecd->CheckAndUpdateFile(path_type, ncch_program_id, buffer);
} }
const u32 bytes_written = [[maybe_unused]] const u32 bytes_written =
static_cast<u32>(file->Write(0, buffer.size(), true, buffer.data()).Unwrap()); static_cast<u32>(file->Write(0, buffer.size(), true, buffer.data()).Unwrap());
file->Close(); file->Close();

View file

@ -41,7 +41,7 @@ void Module::serialize(Archive& ar, const unsigned int) {
SERIALIZE_IMPL(Module) SERIALIZE_IMPL(Module)
/// The maximum number of block entries that can exist in the config file /// The maximum number of block entries that can exist in the config file
static const u32 CONFIG_FILE_MAX_BLOCK_ENTRIES = 1479; constexpr u32 CONFIG_FILE_MAX_BLOCK_ENTRIES = 1479;
namespace { namespace {
@ -104,23 +104,23 @@ struct ConsoleCountryInfo {
static_assert(sizeof(ConsoleCountryInfo) == 4, "ConsoleCountryInfo must be exactly 4 bytes"); static_assert(sizeof(ConsoleCountryInfo) == 4, "ConsoleCountryInfo must be exactly 4 bytes");
} // namespace } // namespace
static const EULAVersion MAX_EULA_VERSION = {0x7F, 0x7F}; constexpr EULAVersion MAX_EULA_VERSION{0x7F, 0x7F};
static const ConsoleModelInfo CONSOLE_MODEL_OLD = {NINTENDO_3DS_XL, {0, 0, 0}}; constexpr ConsoleModelInfo CONSOLE_MODEL_OLD{NINTENDO_3DS_XL, {0, 0, 0}};
static const ConsoleModelInfo CONSOLE_MODEL_NEW = {NEW_NINTENDO_3DS_XL, {0, 0, 0}}; constexpr ConsoleModelInfo CONSOLE_MODEL_NEW{NEW_NINTENDO_3DS_XL, {0, 0, 0}};
static const u8 CONSOLE_LANGUAGE = LANGUAGE_EN; constexpr u8 CONSOLE_LANGUAGE = LANGUAGE_EN;
static const UsernameBlock CONSOLE_USERNAME_BLOCK = {u"CITRA", 0, 0}; constexpr UsernameBlock CONSOLE_USERNAME_BLOCK{u"CITRA", 0, 0};
static const BirthdayBlock PROFILE_BIRTHDAY = {3, 25}; // March 25th, 2014 constexpr BirthdayBlock PROFILE_BIRTHDAY{3, 25}; // March 25th, 2014
static const u8 SOUND_OUTPUT_MODE = SOUND_SURROUND; constexpr u8 SOUND_OUTPUT_MODE = SOUND_SURROUND;
static const u8 UNITED_STATES_COUNTRY_ID = 49; constexpr u8 UNITED_STATES_COUNTRY_ID = 49;
/// TODO(Subv): Find what the other bytes are /// TODO(Subv): Find what the other bytes are
static const ConsoleCountryInfo COUNTRY_INFO = {{0, 0, 0}, UNITED_STATES_COUNTRY_ID}; constexpr ConsoleCountryInfo COUNTRY_INFO{{0, 0, 0}, UNITED_STATES_COUNTRY_ID};
/** /**
* TODO(Subv): Find out what this actually is, these values fix some NaN uniforms in some games, * TODO(Subv): Find out what this actually is, these values fix some NaN uniforms in some games,
* for example Nintendo Zone * for example Nintendo Zone
* Thanks Normmatt for providing this information * Thanks Normmatt for providing this information
*/ */
static const std::array<float, 8> STEREO_CAMERA_SETTINGS = { constexpr std::array<float, 8> STEREO_CAMERA_SETTINGS = {
62.0f, 289.0f, 76.80000305175781f, 46.08000183105469f, 62.0f, 289.0f, 76.80000305175781f, 46.08000183105469f,
10.0f, 5.0f, 55.58000183105469f, 21.56999969482422f, 10.0f, 5.0f, 55.58000183105469f, 21.56999969482422f,
}; };

View file

@ -220,15 +220,15 @@ void FS_USER::CreateFile(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x808, 8, 2); IPC::RequestParser rp(ctx, 0x808, 8, 2);
rp.Skip(1, false); // TransactionId rp.Skip(1, false); // TransactionId
ArchiveHandle archive_handle = rp.PopRaw<ArchiveHandle>(); const auto archive_handle = rp.PopRaw<ArchiveHandle>();
auto filename_type = rp.PopEnum<FileSys::LowPathType>(); const auto filename_type = rp.PopEnum<FileSys::LowPathType>();
u32 filename_size = rp.Pop<u32>(); const auto filename_size = rp.Pop<u32>();
u32 attributes = rp.Pop<u32>(); const auto attributes = rp.Pop<u32>();
u64 file_size = rp.Pop<u64>(); const auto file_size = rp.Pop<u64>();
std::vector<u8> filename = rp.PopStaticBuffer(); std::vector<u8> filename = rp.PopStaticBuffer();
ASSERT(filename.size() == filename_size); ASSERT(filename.size() == filename_size);
FileSys::Path file_path(filename_type, filename); const FileSys::Path file_path(filename_type, std::move(filename));
LOG_DEBUG(Service_FS, "type={} attributes={} size={:x} data={}", LOG_DEBUG(Service_FS, "type={} attributes={} size={:x} data={}",
static_cast<u32>(filename_type), attributes, file_size, file_path.DebugStr()); static_cast<u32>(filename_type), attributes, file_size, file_path.DebugStr());
@ -240,13 +240,13 @@ void FS_USER::CreateFile(Kernel::HLERequestContext& ctx) {
void FS_USER::CreateDirectory(Kernel::HLERequestContext& ctx) { void FS_USER::CreateDirectory(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x809, 6, 2); IPC::RequestParser rp(ctx, 0x809, 6, 2);
rp.Skip(1, false); // TransactionId rp.Skip(1, false); // TransactionId
ArchiveHandle archive_handle = rp.PopRaw<ArchiveHandle>(); const auto archive_handle = rp.PopRaw<ArchiveHandle>();
auto dirname_type = rp.PopEnum<FileSys::LowPathType>(); const auto dirname_type = rp.PopEnum<FileSys::LowPathType>();
u32 dirname_size = rp.Pop<u32>(); const auto dirname_size = rp.Pop<u32>();
u32 attributes = rp.Pop<u32>(); [[maybe_unused]] const auto attributes = rp.Pop<u32>();
std::vector<u8> dirname = rp.PopStaticBuffer(); std::vector<u8> dirname = rp.PopStaticBuffer();
ASSERT(dirname.size() == dirname_size); ASSERT(dirname.size() == dirname_size);
FileSys::Path dir_path(dirname_type, dirname); const FileSys::Path dir_path(dirname_type, std::move(dirname));
LOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast<u32>(dirname_type), dirname_size, LOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast<u32>(dirname_type), dirname_size,
dir_path.DebugStr()); dir_path.DebugStr());
@ -366,18 +366,18 @@ void FS_USER::FormatSaveData(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_FS, "(STUBBED)"); LOG_WARNING(Service_FS, "(STUBBED)");
IPC::RequestParser rp(ctx, 0x84C, 9, 2); IPC::RequestParser rp(ctx, 0x84C, 9, 2);
auto archive_id = rp.PopEnum<FS::ArchiveIdCode>(); const auto archive_id = rp.PopEnum<ArchiveIdCode>();
auto archivename_type = rp.PopEnum<FileSys::LowPathType>(); const auto archivename_type = rp.PopEnum<FileSys::LowPathType>();
u32 archivename_size = rp.Pop<u32>(); const auto archivename_size = rp.Pop<u32>();
u32 block_size = rp.Pop<u32>(); const auto block_size = rp.Pop<u32>();
u32 number_directories = rp.Pop<u32>(); const auto number_directories = rp.Pop<u32>();
u32 number_files = rp.Pop<u32>(); const auto number_files = rp.Pop<u32>();
u32 directory_buckets = rp.Pop<u32>(); [[maybe_unused]] const auto directory_buckets = rp.Pop<u32>();
u32 file_buckets = rp.Pop<u32>(); [[maybe_unused]] const auto file_buckets = rp.Pop<u32>();
bool duplicate_data = rp.Pop<bool>(); const bool duplicate_data = rp.Pop<bool>();
std::vector<u8> archivename = rp.PopStaticBuffer(); std::vector<u8> archivename = rp.PopStaticBuffer();
ASSERT(archivename.size() == archivename_size); ASSERT(archivename.size() == archivename_size);
FileSys::Path archive_path(archivename_type, archivename); const FileSys::Path archive_path(archivename_type, std::move(archivename));
LOG_DEBUG(Service_FS, "archive_path={}", archive_path.DebugStr()); LOG_DEBUG(Service_FS, "archive_path={}", archive_path.DebugStr());
@ -409,12 +409,12 @@ void FS_USER::FormatSaveData(Kernel::HLERequestContext& ctx) {
void FS_USER::FormatThisUserSaveData(Kernel::HLERequestContext& ctx) { void FS_USER::FormatThisUserSaveData(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x80F, 6, 0); IPC::RequestParser rp(ctx, 0x80F, 6, 0);
u32 block_size = rp.Pop<u32>(); const auto block_size = rp.Pop<u32>();
u32 number_directories = rp.Pop<u32>(); const auto number_directories = rp.Pop<u32>();
u32 number_files = rp.Pop<u32>(); const auto number_files = rp.Pop<u32>();
u32 directory_buckets = rp.Pop<u32>(); [[maybe_unused]] const auto directory_buckets = rp.Pop<u32>();
u32 file_buckets = rp.Pop<u32>(); [[maybe_unused]] const auto file_buckets = rp.Pop<u32>();
bool duplicate_data = rp.Pop<bool>(); const auto duplicate_data = rp.Pop<bool>();
FileSys::ArchiveFormatInfo format_info; FileSys::ArchiveFormatInfo format_info;
format_info.duplicate_data = duplicate_data; format_info.duplicate_data = duplicate_data;

View file

@ -421,7 +421,7 @@ void HTTP_C::CloseContext(Kernel::HLERequestContext& ctx) {
void HTTP_C::AddRequestHeader(Kernel::HLERequestContext& ctx) { void HTTP_C::AddRequestHeader(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x11, 3, 4); IPC::RequestParser rp(ctx, 0x11, 3, 4);
const u32 context_handle = rp.Pop<u32>(); const u32 context_handle = rp.Pop<u32>();
const u32 name_size = rp.Pop<u32>(); [[maybe_unused]] const u32 name_size = rp.Pop<u32>();
const u32 value_size = rp.Pop<u32>(); const u32 value_size = rp.Pop<u32>();
const std::vector<u8> name_buffer = rp.PopStaticBuffer(); const std::vector<u8> name_buffer = rp.PopStaticBuffer();
Kernel::MappedBuffer& value_buffer = rp.PopMappedBuffer(); Kernel::MappedBuffer& value_buffer = rp.PopMappedBuffer();
@ -497,7 +497,7 @@ void HTTP_C::AddRequestHeader(Kernel::HLERequestContext& ctx) {
void HTTP_C::AddPostDataAscii(Kernel::HLERequestContext& ctx) { void HTTP_C::AddPostDataAscii(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x12, 3, 4); IPC::RequestParser rp(ctx, 0x12, 3, 4);
const u32 context_handle = rp.Pop<u32>(); const u32 context_handle = rp.Pop<u32>();
const u32 name_size = rp.Pop<u32>(); [[maybe_unused]] const u32 name_size = rp.Pop<u32>();
const u32 value_size = rp.Pop<u32>(); const u32 value_size = rp.Pop<u32>();
const std::vector<u8> name_buffer = rp.PopStaticBuffer(); const std::vector<u8> name_buffer = rp.PopStaticBuffer();
Kernel::MappedBuffer& value_buffer = rp.PopMappedBuffer(); Kernel::MappedBuffer& value_buffer = rp.PopMappedBuffer();

View file

@ -1219,8 +1219,8 @@ void NWM_UDS::ConnectToNetwork(Kernel::HLERequestContext& ctx, u16 command_id,
void NWM_UDS::ConnectToNetwork(Kernel::HLERequestContext& ctx) { void NWM_UDS::ConnectToNetwork(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x1E, 2, 4); IPC::RequestParser rp(ctx, 0x1E, 2, 4);
u8 connection_type = rp.Pop<u8>(); const auto connection_type = rp.Pop<u8>();
u32 passphrase_size = rp.Pop<u32>(); [[maybe_unused]] const auto passphrase_size = rp.Pop<u32>();
const std::vector<u8> network_info_buffer = rp.PopStaticBuffer(); const std::vector<u8> network_info_buffer = rp.PopStaticBuffer();
ASSERT(network_info_buffer.size() == sizeof(NetworkInfo)); ASSERT(network_info_buffer.size() == sizeof(NetworkInfo));
@ -1240,8 +1240,8 @@ void NWM_UDS::ConnectToNetworkDeprecated(Kernel::HLERequestContext& ctx) {
// info // info
const auto network_info_buffer = rp.PopRaw<std::array<u8, 0x3C>>(); const auto network_info_buffer = rp.PopRaw<std::array<u8, 0x3C>>();
u8 connection_type = rp.Pop<u8>(); const auto connection_type = rp.Pop<u8>();
u32 passphrase_size = rp.Pop<u32>(); [[maybe_unused]] const auto passphrase_size = rp.Pop<u32>();
std::vector<u8> passphrase = rp.PopStaticBuffer(); std::vector<u8> passphrase = rp.PopStaticBuffer();

View file

@ -42,8 +42,8 @@ constexpr std::array<u8, 10> KeyTypes{{
void PS_PS::EncryptDecryptAes(Kernel::HLERequestContext& ctx) { void PS_PS::EncryptDecryptAes(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x4, 8, 4); IPC::RequestParser rp(ctx, 0x4, 8, 4);
u32 src_size = rp.Pop<u32>(); auto src_size = rp.Pop<u32>();
u32 dest_size = rp.Pop<u32>(); [[maybe_unused]] const auto dest_size = rp.Pop<u32>();
using CryptoPP::AES; using CryptoPP::AES;
std::array<u8, AES::BLOCKSIZE> iv; std::array<u8, AES::BLOCKSIZE> iv;

View file

@ -50,17 +50,17 @@ constexpr int MAX_PENDING_NOTIFICATIONS = 16;
void SRV::RegisterClient(Kernel::HLERequestContext& ctx) { void SRV::RegisterClient(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x1, 0, 2); IPC::RequestParser rp(ctx, 0x1, 0, 2);
u32 pid_descriptor = rp.Pop<u32>(); const auto pid_descriptor = rp.Pop<u32>();
if (pid_descriptor != IPC::CallingPidDesc()) { if (pid_descriptor != IPC::CallingPidDesc()) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(IPC::ERR_INVALID_BUFFER_DESCRIPTOR); rb.Push(IPC::ERR_INVALID_BUFFER_DESCRIPTOR);
return; return;
} }
u32 caller_pid = rp.Pop<u32>(); const auto caller_pid = rp.Pop<u32>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
LOG_WARNING(Service_SRV, "(STUBBED) called"); LOG_WARNING(Service_SRV, "(STUBBED) called. Caller PID={}", caller_pid);
} }
/** /**

View file

@ -504,8 +504,8 @@ void SOC_U::Accept(Kernel::HLERequestContext& ctx) {
// preventing graceful shutdown when closing the emulator, this can be fixed by always // preventing graceful shutdown when closing the emulator, this can be fixed by always
// performing nonblocking operations and spinlock until the data is available // performing nonblocking operations and spinlock until the data is available
IPC::RequestParser rp(ctx, 0x04, 2, 2); IPC::RequestParser rp(ctx, 0x04, 2, 2);
u32 socket_handle = rp.Pop<u32>(); const auto socket_handle = rp.Pop<u32>();
socklen_t max_addr_len = static_cast<socklen_t>(rp.Pop<u32>()); [[maybe_unused]] const auto max_addr_len = static_cast<socklen_t>(rp.Pop<u32>());
rp.PopPID(); rp.PopPID();
sockaddr addr; sockaddr addr;
socklen_t addr_len = sizeof(addr); socklen_t addr_len = sizeof(addr);
@ -724,8 +724,8 @@ void SOC_U::Poll(Kernel::HLERequestContext& ctx) {
void SOC_U::GetSockName(Kernel::HLERequestContext& ctx) { void SOC_U::GetSockName(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x17, 2, 2); IPC::RequestParser rp(ctx, 0x17, 2, 2);
u32 socket_handle = rp.Pop<u32>(); const auto socket_handle = rp.Pop<u32>();
u32 max_addr_len = rp.Pop<u32>(); [[maybe_unused]] const auto max_addr_len = rp.Pop<u32>();
rp.PopPID(); rp.PopPID();
sockaddr dest_addr; sockaddr dest_addr;
@ -761,25 +761,26 @@ void SOC_U::Shutdown(Kernel::HLERequestContext& ctx) {
void SOC_U::GetPeerName(Kernel::HLERequestContext& ctx) { void SOC_U::GetPeerName(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x18, 2, 2); IPC::RequestParser rp(ctx, 0x18, 2, 2);
u32 socket_handle = rp.Pop<u32>(); const auto socket_handle = rp.Pop<u32>();
u32 max_addr_len = rp.Pop<u32>(); [[maybe_unused]] const auto max_addr_len = rp.Pop<u32>();
rp.PopPID(); rp.PopPID();
sockaddr dest_addr; sockaddr dest_addr;
socklen_t dest_addr_len = sizeof(dest_addr); socklen_t dest_addr_len = sizeof(dest_addr);
int ret = ::getpeername(socket_handle, &dest_addr, &dest_addr_len); const int ret = ::getpeername(socket_handle, &dest_addr, &dest_addr_len);
CTRSockAddr ctr_dest_addr = CTRSockAddr::FromPlatform(dest_addr); CTRSockAddr ctr_dest_addr = CTRSockAddr::FromPlatform(dest_addr);
std::vector<u8> dest_addr_buff(sizeof(ctr_dest_addr)); std::vector<u8> dest_addr_buff(sizeof(ctr_dest_addr));
std::memcpy(dest_addr_buff.data(), &ctr_dest_addr, sizeof(ctr_dest_addr)); std::memcpy(dest_addr_buff.data(), &ctr_dest_addr, sizeof(ctr_dest_addr));
int result = 0; int result = 0;
if (ret != 0) if (ret != 0) {
ret = TranslateError(GET_ERRNO); result = TranslateError(GET_ERRNO);
}
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(ret); rb.Push(result);
rb.PushStaticBuffer(std::move(dest_addr_buff), 0); rb.PushStaticBuffer(std::move(dest_addr_buff), 0);
} }
@ -788,8 +789,8 @@ void SOC_U::Connect(Kernel::HLERequestContext& ctx) {
// preventing graceful shutdown when closing the emulator, this can be fixed by always // preventing graceful shutdown when closing the emulator, this can be fixed by always
// performing nonblocking operations and spinlock until the data is available // performing nonblocking operations and spinlock until the data is available
IPC::RequestParser rp(ctx, 0x06, 2, 4); IPC::RequestParser rp(ctx, 0x06, 2, 4);
u32 socket_handle = rp.Pop<u32>(); const auto socket_handle = rp.Pop<u32>();
u32 input_addr_len = rp.Pop<u32>(); [[maybe_unused]] const auto input_addr_len = rp.Pop<u32>();
rp.PopPID(); rp.PopPID();
auto input_addr_buf = rp.PopStaticBuffer(); auto input_addr_buf = rp.PopStaticBuffer();
@ -809,7 +810,7 @@ void SOC_U::Connect(Kernel::HLERequestContext& ctx) {
void SOC_U::InitializeSockets(Kernel::HLERequestContext& ctx) { void SOC_U::InitializeSockets(Kernel::HLERequestContext& ctx) {
// TODO(Subv): Implement // TODO(Subv): Implement
IPC::RequestParser rp(ctx, 0x01, 1, 4); IPC::RequestParser rp(ctx, 0x01, 1, 4);
u32 memory_block_size = rp.Pop<u32>(); [[maybe_unused]] const auto memory_block_size = rp.Pop<u32>();
rp.PopPID(); rp.PopPID();
rp.PopObject<Kernel::SharedMemory>(); rp.PopObject<Kernel::SharedMemory>();
@ -861,12 +862,12 @@ void SOC_U::GetSockOpt(Kernel::HLERequestContext& ctx) {
void SOC_U::SetSockOpt(Kernel::HLERequestContext& ctx) { void SOC_U::SetSockOpt(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x12, 4, 4); IPC::RequestParser rp(ctx, 0x12, 4, 4);
u32 socket_handle = rp.Pop<u32>(); const auto socket_handle = rp.Pop<u32>();
u32 level = rp.Pop<u32>(); const auto level = rp.Pop<u32>();
s32 optname = rp.Pop<s32>(); const auto optname = rp.Pop<s32>();
socklen_t optlen = static_cast<socklen_t>(rp.Pop<u32>()); [[maybe_unused]] const auto optlen = static_cast<socklen_t>(rp.Pop<u32>());
rp.PopPID(); rp.PopPID();
auto optval = rp.PopStaticBuffer(); const auto optval = rp.PopStaticBuffer();
s32 err = 0; s32 err = 0;