From bbdbfaf34e48a9c3ff03c27abafe7aca6dbfd19c Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 18 Aug 2020 18:41:51 -0700 Subject: [PATCH] Vita: Port socket shim --- include/mgba-util/socket.h | 16 ++++++++++++++++ src/platform/qt/Window.cpp | 5 +---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/mgba-util/socket.h b/include/mgba-util/socket.h index aecbe9959..377d53a2e 100644 --- a/include/mgba-util/socket.h +++ b/include/mgba-util/socket.h @@ -64,6 +64,10 @@ extern u32* SOCUBuffer; #ifdef __SWITCH__ #include #endif +#ifdef PSP2 +#include +#include +#endif static inline void SocketSubsystemInit() { #ifdef _WIN32 @@ -78,6 +82,10 @@ static inline void SocketSubsystemInit() { socketInitializeDefault(); #elif defined(GEKKO) net_init(); +#elif defined(PSP2) + static uint8_t netMem[1024*1024]; + sceSysmoduleLoadModule(SCE_SYSMODULE_NET); + sceNetInit(&(SceNetInitParam) { netMem, sizeof(netMem) }); #endif } @@ -92,6 +100,9 @@ static inline void SocketSubsystemDeinit() { socketExit(); #elif defined(GEKKO) net_deinit(); +#elif defined(PSP2) + sceNetTerm(); + sceSysmoduleUnloadModule(SCE_SYSMODULE_NET); #endif } @@ -249,6 +260,11 @@ static inline Socket SocketListen(Socket socket, int queueLength) { #ifdef GEKKO return net_listen(socket, queueLength); #else +#ifdef PSP2 + if (queueLength <= 0) { + queueLength = 1; + } +#endif return listen(socket, queueLength); #endif } diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index 25f7b7bfb..906847640 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -1425,12 +1425,9 @@ void Window::setupMenu(QMenuBar* menubar) { ConfigOption* mute = m_config->addOption("mute"); mute->addBoolean(tr("Mute"), &m_actions, "av"); mute->connect([this](const QVariant& value) { - if (value.toInt()) { - m_config->setOption("fastForwardMute", true); - } + m_config->setOption("fastForwardMute", static_cast(value.toInt())); reloadConfig(); }, this); - m_config->updateOption("mute"); m_actions.addMenu(tr("FPS target"),"target", "av"); ConfigOption* fpsTargetOption = m_config->addOption("fpsTarget");