fs.mitm: update for libstratosphere refactor
This commit is contained in:
@@ -22,13 +22,7 @@
|
||||
#include <switch.h>
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
#include "sm_mitm.h"
|
||||
|
||||
#include "mitm_server.hpp"
|
||||
#include "fsmitm_service.hpp"
|
||||
#include "fsmitm_worker.hpp"
|
||||
|
||||
#include "mitm_query_service.hpp"
|
||||
|
||||
#include "fsmitm_utils.hpp"
|
||||
|
||||
@@ -88,37 +82,34 @@ void __appExit(void) {
|
||||
smExit();
|
||||
}
|
||||
|
||||
struct FsMitmManagerOptions {
|
||||
static const size_t PointerBufferSize = 0x800;
|
||||
static const size_t MaxDomains = 0x10;
|
||||
static const size_t MaxDomainObjects = 0x4000;
|
||||
};
|
||||
|
||||
using FsMitmManager = WaitableManager<FsMitmManagerOptions>;
|
||||
|
||||
void CreateSettingsMitMServer(void *arg) {
|
||||
MultiThreadedWaitableManager *server_manager = (MultiThreadedWaitableManager *)arg;
|
||||
auto server_manager = (FsMitmManager *)arg;
|
||||
|
||||
Result rc;
|
||||
if (R_FAILED((rc = setsysInitialize()))) {
|
||||
fatalSimple(rc);
|
||||
}
|
||||
|
||||
ISession<MitMQueryService<SetSysMitMService>> *setsys_query_srv = NULL;
|
||||
MitMServer<SetSysMitMService> *setsys_srv = new MitMServer<SetSysMitMService>(&setsys_query_srv, "set:sys", 60);
|
||||
server_manager->add_waitable(setsys_srv);
|
||||
server_manager->add_waitable(setsys_query_srv);
|
||||
AddMitmServerToManager<SetSysMitmService>(server_manager, "set:sys", 5);
|
||||
|
||||
svcExitThread();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Thread worker_thread = {0};
|
||||
Thread sd_initializer_thread = {0};
|
||||
Thread hid_initializer_thread = {0};
|
||||
Thread set_mitm_setup_thread = {0};
|
||||
consoleDebugInit(debugDevice_SVC);
|
||||
|
||||
if (R_FAILED(threadCreate(&worker_thread, &FsMitMWorker::Main, NULL, 0x20000, 45, 0))) {
|
||||
/* TODO: Panic. */
|
||||
}
|
||||
if (R_FAILED(threadStart(&worker_thread))) {
|
||||
/* TODO: Panic. */
|
||||
}
|
||||
|
||||
if (R_FAILED(threadCreate(&sd_initializer_thread, &Utils::InitializeSdThreadFunc, NULL, 0x4000, 0x15, 0))) {
|
||||
/* TODO: Panic. */
|
||||
}
|
||||
@@ -134,24 +125,21 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* TODO: What's a good timeout value to use here? */
|
||||
MultiThreadedWaitableManager *server_manager = new MultiThreadedWaitableManager(5, U64_MAX, 0x20000);
|
||||
auto server_manager = new FsMitmManager(1);
|
||||
|
||||
/* Create fsp-srv mitm. */
|
||||
ISession<MitMQueryService<FsMitMService>> *fs_query_srv = NULL;
|
||||
MitMServer<FsMitMService> *fs_srv = new MitMServer<FsMitMService>(&fs_query_srv, "fsp-srv", 61);
|
||||
server_manager->add_waitable(fs_srv);
|
||||
server_manager->add_waitable(fs_query_srv);
|
||||
AddMitmServerToManager<FsMitmService>(server_manager, "fsp-srv", 61);
|
||||
|
||||
/* Create set:sys mitm server, delayed until set:sys is available. */
|
||||
if (R_FAILED(threadCreate(&set_mitm_setup_thread, &CreateSettingsMitMServer, server_manager, 0x4000, 0x15, 0))) {
|
||||
//if (R_FAILED(threadCreate(&set_mitm_setup_thread, &CreateSettingsMitMServer, server_manager, 0x4000, 0x15, 0))) {
|
||||
/* TODO: Panic. */
|
||||
}
|
||||
if (R_FAILED(threadStart(&set_mitm_setup_thread))) {
|
||||
//}
|
||||
//if (R_FAILED(threadStart(&set_mitm_setup_thread))) {
|
||||
/* TODO: Panic. */
|
||||
}
|
||||
//}
|
||||
|
||||
/* Loop forever, servicing our services. */
|
||||
server_manager->process();
|
||||
server_manager->Process();
|
||||
|
||||
delete server_manager;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user