summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorZephyron <zephyron@citron-emu.org>2025-01-28 16:20:54 +1000
committerZephyron <zephyron@citron-emu.org>2025-01-28 16:20:54 +1000
commit8c630a8beaff2b1cff36f9dd1178db2995af160d (patch)
tree87581a014b4c66ec35c93b5ad0c82d3fcaed4c9f /src/core
parent2e4db14bc143fdb31db1ceadcf9db0740825e118 (diff)
network: Add NOMEM errno handling for socket operations
Implements support for ENOMEM (errno 12) across the network stack: - Added NOMEM to Network::Errno enum - Added NOMEM = 12 to sockets Errno enum - Added translation case in sockets_translate.cpp This is the first step towards addressing the 0.0 FPS bug that occurs when the system runs out of memory during socket operations. Previously, these operations would trigger an unimplemented assertion, causing the emulator to halt. Now the error will be properly propagated to the guest application.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/sockets/sockets.h1
-rw-r--r--src/core/hle/service/sockets/sockets_translate.cpp2
-rw-r--r--src/core/internal_network/network.h1
3 files changed, 4 insertions, 0 deletions
diff --git a/src/core/hle/service/sockets/sockets.h b/src/core/hle/service/sockets/sockets.h
index f3ea31bde..978796455 100644
--- a/src/core/hle/service/sockets/sockets.h
+++ b/src/core/hle/service/sockets/sockets.h
@@ -26,6 +26,7 @@ enum class Errno : u32 {
TIMEDOUT = 110,
CONNREFUSED = 111,
INPROGRESS = 115,
+ NOMEM = 12,
};
enum class GetAddrInfoError : s32 {
diff --git a/src/core/hle/service/sockets/sockets_translate.cpp b/src/core/hle/service/sockets/sockets_translate.cpp
index 21bb3e776..b9a3ba029 100644
--- a/src/core/hle/service/sockets/sockets_translate.cpp
+++ b/src/core/hle/service/sockets/sockets_translate.cpp
@@ -37,6 +37,8 @@ Errno Translate(Network::Errno value) {
return Errno::CONNRESET;
case Network::Errno::INPROGRESS:
return Errno::INPROGRESS;
+ case Network::Errno::NOMEM:
+ return Errno::NOMEM;
default:
UNIMPLEMENTED_MSG("Unimplemented errno={}", value);
return Errno::SUCCESS;
diff --git a/src/core/internal_network/network.h b/src/core/internal_network/network.h
index 2e0f68c2e..78905ca60 100644
--- a/src/core/internal_network/network.h
+++ b/src/core/internal_network/network.h
@@ -46,6 +46,7 @@ enum class Errno {
MSGSIZE,
INPROGRESS,
OTHER,
+ NOMEM,
};
enum class GetAddrInfoError {