mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2026-04-11 20:01:32 -06:00
Squashed commit of the following:
commitb5d616bbedAuthor: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 21:17:13 2024 +0200 Fixed wrong dummy data commit60ee7abc38Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 20:56:11 2024 +0200 Potential fix of cmd buffer header commite47d9af750Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 19:54:04 2024 +0200 Additional logging commitd5d0301702Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 19:36:55 2024 +0200 Added temp logging for debugging commita41fc80eabAuthor: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 18:59:48 2024 +0200 Fixed use of mapped buffer commitf88ebb65a3Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 18:51:48 2024 +0200 Reverted 4th value to unknown commitb1d1757eaaAuthor: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 17:26:24 2024 +0200 Updated includes commit60c453b5bbAuthor: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 17:21:11 2024 +0200 Fixed argument commitb7777a7b47Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 17:00:49 2024 +0200 Added include commit4b3ac391d8Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 16:53:56 2024 +0200 Fixed wrong arguments commit13f32bd384Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 16:33:54 2024 +0200 Fixed call return value commit826d6bed2dAuthor: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 16:32:37 2024 +0200 Changed implementation to rely on parser instead of raw commit5dea8a125bAuthor: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 16:00:35 2024 +0200 Moved kernel retrieval to argument commitbb4de89652Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 15:50:37 2024 +0200 Fixed method call commit8b9e04c541Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 15:48:58 2024 +0200 Fixed type name commit29fc438086Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 15:41:35 2024 +0200 Fixed includes commita6fe44f81fAuthor: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 15:41:29 2024 +0200 Fixed method name commit67380edbc9Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 15:41:09 2024 +0200 Fixed method call commitbabec1bb5cAuthor: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 15:34:32 2024 +0200 Fixed kernel reference commit6238f52819Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 15:30:10 2024 +0200 Fixed missing namespace commitc4a99ccbe9Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 15:29:29 2024 +0200 Fixed missing argument commit916849691bAuthor: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 15:26:39 2024 +0200 Fixed wrong mac commit7a997ea8aeAuthor: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 15:19:13 2024 +0200 Potentially fixed calling NWM_INF commit320a82bb5dAuthor: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 15:05:24 2024 +0200 Potential fix for calling NWM_UDS version commit0b0534400dAuthor: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 13:56:05 2024 +0200 Added include for NWM_UDS commitd61dfdaf2eAuthor: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 13:51:03 2024 +0200 Fixed cast to u32 and dummy value commita14e398157Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 13:50:17 2024 +0200 Added correct transition from INF to UDS commit54e4da1753Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 13:30:13 2024 +0200 Initial full ScanAPs implementation commitaeb1e224f3Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 13:18:17 2024 +0200 Fixed member reference commitc3b1beae1cAuthor: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 13:11:30 2024 +0200 Readded NWM_UDS header commit6b03ca58a2Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 12:44:40 2024 +0200 Updated include statements commit36c4adf431Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 00:58:25 2024 +0200 Potential member reference fix commit6d28737856Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 00:48:51 2024 +0200 Fixed missing void return type commit14eb312678Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Fri Aug 23 00:14:41 2024 +0200 Using correct way to call UDS service commit2acc2a35a9Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Thu Aug 22 22:39:15 2024 +0200 Updated API commitd204bfa05cAuthor: PTRCoder <pj.de.bruijne@gmail.com> Date: Thu Aug 22 22:38:49 2024 +0200 Initial NWM_INF::RecvBeaconBroadcastData implementation commit01baadf7a4Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Thu Aug 22 19:23:17 2024 +0200 Included member type commit36f416469fAuthor: PTRCoder <pj.de.bruijne@gmail.com> Date: Thu Aug 22 19:06:52 2024 +0200 Coding style fixes commit4e73a1d057Author: PTRCoder <pj.de.bruijne@gmail.com> Date: Thu Aug 22 19:02:37 2024 +0200 Starting tests
This commit is contained in:
parent
8a8552bef9
commit
4e6e3d3abe
@ -3,6 +3,7 @@
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <vector>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/logging/log.h"
|
||||
@ -18,7 +19,10 @@
|
||||
#include "core/hle/service/ac/ac.h"
|
||||
#include "core/hle/service/ac/ac_i.h"
|
||||
#include "core/hle/service/ac/ac_u.h"
|
||||
#include "core/hle/service/nwm/nwm_inf.h"
|
||||
#include "core/hle/service/soc/soc_u.h"
|
||||
#include "network/network.h"
|
||||
#include "network/room.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
SERIALIZE_EXPORT_IMPL(Service::AC::Module)
|
||||
@ -182,20 +186,69 @@ void Module::Interface::GetStatus(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
void Module::Interface::ScanAPs(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
const u32 arg1 = rp.Pop<u32>();
|
||||
LOG_WARNING(Service_AC, "val1: {}", arg1);
|
||||
const u32 arg2 = rp.Pop<u32>();
|
||||
LOG_WARNING(Service_AC, "val2: {}", arg2);
|
||||
const u32 arg3 = rp.Pop<u32>();
|
||||
LOG_WARNING(Service_AC, "val3: {}", arg3);
|
||||
const u32 arg4 = rp.Pop<u32>();
|
||||
LOG_WARNING(Service_AC, "val4: {}", arg4);
|
||||
const u32 arg5 = rp.Pop<u32>();
|
||||
LOG_WARNING(Service_AC, "val5: {}", arg5);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(ResultUnknown);
|
||||
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||
// I used 3dbrew.org for the information on the individual request inputs
|
||||
|
||||
// Arg 0 is Header code, which is ignored
|
||||
// Arg 1 is Size
|
||||
const u32 size = rp.Pop<u32>();
|
||||
LOG_WARNING(Service_AC, "Size: {}", size);
|
||||
// Arg 2 is CallingPID value (PID Header)
|
||||
// Arg 3 is PID
|
||||
const u32 pid = rp.PopPID();
|
||||
LOG_WARNING(Service_AC, "PID: {}", pid);
|
||||
// Likely time transpired between consecutive calls of this method.
|
||||
// First call has value 0 or 1. Second call has value 0xFFFF0000.
|
||||
const u32 unknown = rp.Pop<u32>();
|
||||
LOG_WARNING(Service_AC, "val4: {}", unknown);
|
||||
|
||||
std::vector<u8> buffer(size);
|
||||
|
||||
Network::MacAddress mac = Network::BroadcastMac;
|
||||
u32 mac1 = (mac[0] << 8) | (mac[1]);
|
||||
u32 mac2 = (mac[2] << 24) | (mac[3] << 16) | (mac[4] << 8) | (mac[5]);
|
||||
|
||||
std::array<u32, IPC::COMMAND_BUFFER_LENGTH + 2 * IPC::MAX_STATIC_BUFFERS> cmd_buf;
|
||||
cmd_buf[0] = 0x000603C4;
|
||||
cmd_buf[1] = size;
|
||||
cmd_buf[2] = 0; // dummy data
|
||||
cmd_buf[3] = 0; // dummy data
|
||||
cmd_buf[4] = mac1;
|
||||
cmd_buf[5] = mac2;
|
||||
cmd_buf[16] = 0;
|
||||
cmd_buf[17] = 0; // set to 0 to ignore it
|
||||
cmd_buf[18] = (size << 4) | 12; // should be considered correct for mapped buffer
|
||||
cmd_buf[19] = 0; // if i interpreted the code correctly, this value won't matter
|
||||
|
||||
LOG_WARNING(Service_AC, "Finished setting up command buffer");
|
||||
std::shared_ptr<Kernel::Thread> thread = ctx.ClientThread();
|
||||
auto current_process = thread->owner_process.lock();
|
||||
LOG_WARNING(Service_AC, "Retrieved thread and process");
|
||||
|
||||
auto context =
|
||||
std::make_shared<Kernel::HLERequestContext>(Core::System::GetInstance().Kernel(),
|
||||
ctx.Session(), thread);
|
||||
LOG_WARNING(Service_AC, "Created context");
|
||||
context->PopulateFromIncomingCommandBuffer(cmd_buf.data(), current_process);
|
||||
|
||||
LOG_WARNING(Service_AC, "Finished setting up context");
|
||||
|
||||
auto nwm_inf =
|
||||
Core::System::GetInstance().ServiceManager().GetService<Service::NWM::NWM_INF>("nwm::INF");
|
||||
LOG_WARNING(Service_AC, "Calling NWM_INF::RecvBeaconBroadcastData");
|
||||
nwm_inf->HandleSyncRequest(*context);
|
||||
LOG_WARNING(Service_AC, "Returned to AC::ScanAPs");
|
||||
// Response should be
|
||||
// 0: Header Code (ignored)
|
||||
// 1: Result Code (Success/Unknown/etc.)
|
||||
// 2: ¿Parsed? beacon data
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
IPC::RequestParser rp2(*context);
|
||||
rb.Push(rp2.Pop<u32>());
|
||||
Kernel::MappedBuffer mapped_buffer = rp2.PopMappedBuffer();
|
||||
mapped_buffer.Read(buffer.data(), 0, buffer.size());
|
||||
rb.PushStaticBuffer(buffer, 0);
|
||||
LOG_WARNING(Service_AC, "(STUBBED) called, pid={}, unknown={}", pid, unknown);
|
||||
}
|
||||
|
||||
void Module::Interface::GetInfraPriority(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
@ -2,8 +2,12 @@
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include "common/archives.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/ipc.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/service/nwm/nwm_inf.h"
|
||||
#include "core/hle/service/nwm/nwm_uds.h"
|
||||
|
||||
@ -12,9 +16,46 @@ SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_INF)
|
||||
namespace Service::NWM {
|
||||
|
||||
void NWM_INF::RecvBeaconBroadcastData(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx);
|
||||
// TODO(PTR) Update implementation to cover differences between NWM_INF and NWM_UDS
|
||||
|
||||
LOG_WARNING(Service_NWM, "Started NWM_INF::RecvBeaconBroadcastData");
|
||||
|
||||
// adding in extra context value for transition from INF to UDS
|
||||
std::array<u32, IPC::COMMAND_BUFFER_LENGTH + 2 * IPC::MAX_STATIC_BUFFERS> cmd_buf;
|
||||
cmd_buf[0] = 0x000F0404;
|
||||
int i;
|
||||
for (i = 1; i < 15; i++) {
|
||||
cmd_buf[i] = rp.Pop<u32>();
|
||||
}
|
||||
rp.Pop<u32>();
|
||||
cmd_buf[15] = 0; // dummy wlan_comm_id
|
||||
cmd_buf[16] = 0; // dummy id
|
||||
for (i = 17; i <= 20; i++) {
|
||||
cmd_buf[i] = rp.Pop<u32>();
|
||||
}
|
||||
|
||||
std::shared_ptr<Kernel::Thread> thread = ctx.ClientThread();
|
||||
auto current_process = thread->owner_process.lock();
|
||||
auto context =
|
||||
std::make_shared<Kernel::HLERequestContext>(Core::System::GetInstance().Kernel(),
|
||||
ctx.Session(), thread);
|
||||
context->PopulateFromIncomingCommandBuffer(cmd_buf.data(), current_process);
|
||||
LOG_WARNING(Service_NWM, "Finished converting context");
|
||||
|
||||
auto nwm_uds = Core::System::GetInstance().ServiceManager().GetService<Service::NWM::NWM_UDS>("nwm::UDS");
|
||||
nwm_uds->HandleSyncRequest(ctx);
|
||||
|
||||
LOG_WARNING(Service_NWM, "Calling NWM_UDS::RecvBeaconBroadcastData");
|
||||
nwm_uds->HandleSyncRequest(*context);
|
||||
LOG_WARNING(Service_NWM, "Returned to NWM_INF::RecvBeaconBroadcastData");
|
||||
|
||||
IPC::RequestParser rp2(*context);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(rp2.Pop<u32>());
|
||||
rb.PushMappedBuffer(rp2.PopMappedBuffer());
|
||||
|
||||
LOG_WARNING(Service_NWM, "Finished NWM_INF::RecvBeaconBroadcastData");
|
||||
}
|
||||
|
||||
NWM_INF::NWM_INF() : ServiceFramework("nwm::INF") {
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include "core/core_timing.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/event.h"
|
||||
#include "core/hle/kernel/handle_table.h"
|
||||
#include "core/hle/kernel/shared_memory.h"
|
||||
#include "core/hle/kernel/shared_page.h"
|
||||
#include "core/hle/result.h"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user