Skip to content

Commit

Permalink
add missing ipcs in ns IReadOnlyApplicationControlDataInterface mitm
Browse files Browse the repository at this point in the history
  • Loading branch information
p-sam committed Oct 15, 2024
1 parent c523c18 commit a55efd3
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
40 changes: 39 additions & 1 deletion src/ns_srvget_mitm_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ ams::Result NsROAppControlDataService::GetAppControlData(u8 flag, u64 tid, const
.buffers = {{buffer.GetPointer(), buffer.GetSize()}},
);

FILE_LOG_IPC_CLASS("(%u, 0x%016lx, buf[0x%lx]) // %x[0x%lx]", flag, tid, buffer.GetSize(), rc, out_size.GetValue());
FILE_LOG_IPC_CLASS("(%u, 0x%016lx, buf[0x%lx]) // %x[0x%lx]", flag, tid, buffer.GetSize(), rc, out_size.GetValue());

if(R_SUCCEEDED(rc) && FileUtils::WaitInitialized()) {
_ProcessControlData(tid, buffer.GetPointer(), buffer.GetSize(), out_size.GetPointer());
Expand All @@ -128,3 +128,41 @@ ams::Result NsROAppControlDataService::ConvertLanguageCodeToAppLanguage(u64 lang
FILE_LOG_IPC_CLASS("(0x%016lx); // %x[0x%02x]", langcode, rc, out_langentry.GetValue());
return rc;
}

ams::Result NsROAppControlDataService::SelectApplicationDesiredLanguage() {
Result rc = serviceDispatch(this->srv.get(), NsROAppControlDataInterfaceCmdId::SelectApplicationDesiredLanguage);
FILE_LOG_IPC_CLASS("(); // %x", rc);
return rc;
}

ams::Result NsROAppControlDataService::Unk1(u8 flag, u64 tid, const ams::sf::OutBuffer &buffer, ams::sf::Out<u64> out_size) {
const struct {
u8 flag;
u64 tid;
} in = {flag, tid};

Result rc = serviceDispatchInOut(this->srv.get(), NsROAppControlDataInterfaceCmdId::Unk1, in, *out_size.GetPointer(),
.buffer_attrs = {SfBufferAttr_HipcMapAlias | SfBufferAttr_Out},
.buffers = {{buffer.GetPointer(), buffer.GetSize()}},
);

FILE_LOG_IPC_CLASS("(%u, 0x%016lx, buf[0x%lx]) // %x[0x%lx]", flag, tid, buffer.GetSize(), rc, out_size.GetValue());

return rc;
}

ams::Result NsROAppControlDataService::Unk2(u8 flag, u64 tid, const ams::sf::OutBuffer &buffer, ams::sf::Out<u64> out_size) {
const struct {
u8 flag;
u64 tid;
} in = {flag, tid};

Result rc = serviceDispatchInOut(this->srv.get(), NsROAppControlDataInterfaceCmdId::Unk2, in, *out_size.GetPointer(),
.buffer_attrs = {SfBufferAttr_HipcMapAlias | SfBufferAttr_Out},
.buffers = {{buffer.GetPointer(), buffer.GetSize()}},
);

FILE_LOG_IPC_CLASS("(%u, 0x%016lx, buf[0x%lx]) // %x[0x%lx]", flag, tid, buffer.GetSize(), rc, out_size.GetValue());

return rc;
}
8 changes: 7 additions & 1 deletion src/ns_srvget_mitm_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ enum NsROAppControlDataInterfaceCmdId : u32 {
GetAppDesiredLanguage = 1,
ConvertAppLanguageToLanguageCode = 2,
ConvertLanguageCodeToAppLanguage = 3,
SelectApplicationDesiredLanguage = 4,
Unk1 = 5,
Unk2 = 6,
};

#define NS_RO_APP_CONTROL_DATA_INTERFACE_INFO(C, H) \
AMS_SF_METHOD_INFO_F(C, H, NsROAppControlDataInterfaceCmdId, GetAppControlData, (u8 flag, u64 tid, const ams::sf::OutBuffer &buffer, ams::sf::Out<u64> out_count), (flag, tid, buffer, out_count)) \
AMS_SF_METHOD_INFO_F(C, H, NsROAppControlDataInterfaceCmdId, GetAppDesiredLanguage, (u32 bitmask, ams::sf::Out<u8> out_langentry), (bitmask, out_langentry)) \
AMS_SF_METHOD_INFO_F(C, H, NsROAppControlDataInterfaceCmdId, ConvertAppLanguageToLanguageCode, (u8 langentry, ams::sf::Out<u64> langcode), (langentry, langcode)) \
AMS_SF_METHOD_INFO_F(C, H, NsROAppControlDataInterfaceCmdId, ConvertLanguageCodeToAppLanguage, (u64 langcode, ams::sf::Out<u8> langentry), (langcode, langentry))
AMS_SF_METHOD_INFO_F(C, H, NsROAppControlDataInterfaceCmdId, ConvertLanguageCodeToAppLanguage, (u64 langcode, ams::sf::Out<u8> langentry), (langcode, langentry)) \
AMS_SF_METHOD_INFO_F(C, H, NsROAppControlDataInterfaceCmdId, SelectApplicationDesiredLanguage, (), ()) \
AMS_SF_METHOD_INFO_F(C, H, NsROAppControlDataInterfaceCmdId, Unk1, (u8 flag, u64 tid, const ams::sf::OutBuffer &buffer, ams::sf::Out<u64> out_count), (flag, tid, buffer, out_count)) \
AMS_SF_METHOD_INFO_F(C, H, NsROAppControlDataInterfaceCmdId, Unk2, (u8 flag, u64 tid, const ams::sf::OutBuffer &buffer, ams::sf::Out<u64> out_count), (flag, tid, buffer, out_count))

AMS_SF_DEFINE_INTERFACE_F(NsROAppControlDataInterface, NS_RO_APP_CONTROL_DATA_INTERFACE_INFO);

Expand Down

0 comments on commit a55efd3

Please sign in to comment.