Skip to content
Snippets Groups Projects
Commit 501e23ce authored by Lectem's avatar Lectem
Browse files

refactor APT service to use the new IPC helpers

parent 423ab5e2
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,18 @@ public: ...@@ -27,6 +27,18 @@ public:
DEBUG_ASSERT_MSG(index == TotalSize(), "Operations do not match the header (cmd 0x%x)", DEBUG_ASSERT_MSG(index == TotalSize(), "Operations do not match the header (cmd 0x%x)",
header.raw); header.raw);
} }
/**
* @brief Retrieves the address of a static buffer, used when a buffer is needed for output
* @param buffer_id The index of the static buffer
* @param data_size If non-null, will store the size of the buffer
*/
VAddr PeekStaticBuffer(u8 buffer_id, size_t* data_size = nullptr) const {
u32* static_buffer = cmdbuf + Kernel::kStaticBuffersOffset / 4 + buffer_id * 2;
if (data_size)
*data_size = StaticBufferDescInfo{static_buffer[0]}.size;
return static_buffer[1];
}
}; };
class RequestBuilder : public RequestHelperBase { class RequestBuilder : public RequestHelperBase {
......
This diff is collapsed.
...@@ -92,8 +92,7 @@ void GetSoftwareClosedFlag(Service::Interface* self) { ...@@ -92,8 +92,7 @@ void GetSoftwareClosedFlag(Service::Interface* self) {
LOG_WARNING(Service_PTM, "(STUBBED) called"); LOG_WARNING(Service_PTM, "(STUBBED) called");
} }
void CheckNew3DS(Service::Interface* self) { void CheckNew3DS(IPC::RequestBuilder& rb) {
u32* cmd_buff = Kernel::GetCommandBuffer();
const bool is_new_3ds = Settings::values.is_new_3ds; const bool is_new_3ds = Settings::values.is_new_3ds;
if (is_new_3ds) { if (is_new_3ds) {
...@@ -101,12 +100,17 @@ void CheckNew3DS(Service::Interface* self) { ...@@ -101,12 +100,17 @@ void CheckNew3DS(Service::Interface* self) {
"settings. Citra does not fully support New 3DS emulation yet!"); "settings. Citra does not fully support New 3DS emulation yet!");
} }
cmd_buff[1] = RESULT_SUCCESS.raw; rb.Push(RESULT_SUCCESS);
cmd_buff[2] = is_new_3ds ? 1 : 0; rb.Push(u32(is_new_3ds ? 1 : 0));
LOG_WARNING(Service_PTM, "(STUBBED) called isNew3DS = 0x%08x", static_cast<u32>(is_new_3ds)); LOG_WARNING(Service_PTM, "(STUBBED) called isNew3DS = 0x%08x", static_cast<u32>(is_new_3ds));
} }
void CheckNew3DS(Service::Interface* self) {
IPC::RequestBuilder rb(Kernel::GetCommandBuffer(), 0x040A0000);
CheckNew3DS(rb);
}
void Init() { void Init() {
AddService(new PTM_Gets); AddService(new PTM_Gets);
AddService(new PTM_Play); AddService(new PTM_Play);
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#pragma once #pragma once
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/ipc_helpers.h"
namespace Service { namespace Service {
...@@ -97,6 +98,7 @@ void GetSoftwareClosedFlag(Interface* self); ...@@ -97,6 +98,7 @@ void GetSoftwareClosedFlag(Interface* self);
* 2: u8 output: 0 = Old3DS, 1 = New3DS. * 2: u8 output: 0 = Old3DS, 1 = New3DS.
*/ */
void CheckNew3DS(Interface* self); void CheckNew3DS(Interface* self);
void CheckNew3DS(IPC::RequestBuilder& rb);
/// Initialize the PTM service /// Initialize the PTM service
void Init(); void Init();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment