mirror of https://git.citron-emu.org/citron/emu
socket: Implement missing errno values and improve network error handling
Add support for missing errno values needed by TOTK: - Add BUSY (16) for "Device or resource busy" errors - Add NOTSOCK (88) for "Socket operation on non-socket" errors Improvements: - Update TranslateNativeError on both Windows and Unix to handle new error codes - Change socket error logging for NOTSOCK from WARNING to DEBUG level - Fix formatting in Unix errno translation code - Update shader storage buffer tracking range to accommodate TOTK buffers - Add hex format to storage buffer logging for easier comparison with bias range - Change storage buffer tracking log level from WARNING to DEBUG These changes help prevent error messages in games that use network features not fully implemented in the emulator yet. Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
parent
5f962dd1c6
commit
48eed78d1a
|
@ -1,4 +1,5 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
@ -17,9 +18,11 @@ enum class Errno : u32 {
|
|||
BADF = 9,
|
||||
AGAIN = 11,
|
||||
NOMEM = 12,
|
||||
BUSY = 16,
|
||||
INVAL = 22,
|
||||
MFILE = 24,
|
||||
PIPE = 32,
|
||||
NOTSOCK = 88,
|
||||
MSGSIZE = 90,
|
||||
CONNABORTED = 103,
|
||||
CONNRESET = 104,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <utility>
|
||||
|
@ -39,6 +40,10 @@ Errno Translate(Network::Errno value) {
|
|||
return Errno::INPROGRESS;
|
||||
case Network::Errno::NOMEM:
|
||||
return Errno::NOMEM;
|
||||
case Network::Errno::BUSY:
|
||||
return Errno::BUSY;
|
||||
case Network::Errno::NOTSOCK:
|
||||
return Errno::NOTSOCK;
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Unimplemented errno={}", value);
|
||||
return Errno::SUCCESS;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -156,6 +157,10 @@ Errno TranslateNativeError(int e, CallType call_type = CallType::Other) {
|
|||
return Errno::TIMEDOUT;
|
||||
case WSAEINPROGRESS:
|
||||
return Errno::INPROGRESS;
|
||||
case WSAENOTSOCK:
|
||||
return Errno::NOTSOCK;
|
||||
case WSAEBUSY:
|
||||
return Errno::BUSY;
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Unimplemented errno={}", e);
|
||||
return Errno::OTHER;
|
||||
|
@ -273,14 +278,14 @@ Errno TranslateNativeError(int e, CallType call_type = CallType::Other) {
|
|||
return Errno::MFILE;
|
||||
case EPIPE:
|
||||
return Errno::PIPE;
|
||||
case ECONNABORTED:
|
||||
return Errno::CONNABORTED;
|
||||
case ENOTCONN:
|
||||
return Errno::NOTCONN;
|
||||
case EAGAIN:
|
||||
return Errno::AGAIN;
|
||||
case ECONNREFUSED:
|
||||
return Errno::CONNREFUSED;
|
||||
case ECONNABORTED:
|
||||
return Errno::CONNABORTED;
|
||||
case ECONNRESET:
|
||||
return Errno::CONNRESET;
|
||||
case EHOSTUNREACH:
|
||||
|
@ -295,8 +300,14 @@ Errno TranslateNativeError(int e, CallType call_type = CallType::Other) {
|
|||
return Errno::TIMEDOUT;
|
||||
case EINPROGRESS:
|
||||
return Errno::INPROGRESS;
|
||||
case ENOMEM:
|
||||
return Errno::NOMEM;
|
||||
case EBUSY:
|
||||
return Errno::BUSY;
|
||||
case ENOTSOCK:
|
||||
return Errno::NOTSOCK;
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Unimplemented errno={} ({})", e, strerror(e));
|
||||
UNIMPLEMENTED_MSG("Unimplemented errno={}", e);
|
||||
return Errno::OTHER;
|
||||
}
|
||||
}
|
||||
|
@ -315,6 +326,14 @@ Errno GetAndLogLastError(CallType call_type = CallType::Other) {
|
|||
LOG_DEBUG(Network, "Socket operation error: {}", Common::NativeErrorToString(e));
|
||||
return err;
|
||||
}
|
||||
|
||||
if (err == Errno::NOTSOCK) {
|
||||
// This is a common error when network functionality is not fully implemented
|
||||
LOG_DEBUG(Network, "Socket operation error: An operation was attempted on something that is not a socket. "
|
||||
"This may indicate the game is using network features not fully supported. ");
|
||||
return err;
|
||||
}
|
||||
|
||||
LOG_ERROR(Network, "Socket operation error: {}", Common::NativeErrorToString(e));
|
||||
return err;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
@ -47,6 +48,8 @@ enum class Errno {
|
|||
INPROGRESS,
|
||||
OTHER,
|
||||
NOMEM,
|
||||
BUSY,
|
||||
NOTSOCK,
|
||||
};
|
||||
|
||||
enum class GetAddrInfoError {
|
||||
|
|
|
@ -381,7 +381,7 @@ void CollectStorageBuffers(IR::Block& block, IR::Inst& inst, StorageInfo& info)
|
|||
static constexpr Bias nvn_bias{
|
||||
.index = 0,
|
||||
.offset_begin = 0x100, // Expanded from 0x110 to catch more potential storage buffers
|
||||
.offset_end = 0x800, // Expanded from 0x610 to include a wider range
|
||||
.offset_end = 0x1000, // Substantially expanded to include all TOTK storage buffers
|
||||
.alignment = 32, // Increased from 16 to optimize memory access patterns
|
||||
};
|
||||
// Track the low address of the instruction
|
||||
|
@ -402,7 +402,7 @@ void CollectStorageBuffers(IR::Block& block, IR::Inst& inst, StorageInfo& info)
|
|||
LOG_WARNING(Shader, "Storage buffer failed to track, using global memory fallbacks");
|
||||
return;
|
||||
}
|
||||
LOG_WARNING(Shader, "Storage buffer tracked without bias, index {} offset {}",
|
||||
LOG_DEBUG(Shader, "Storage buffer tracked without bias, index {} offset 0x{:X}",
|
||||
storage_buffer->index, storage_buffer->offset);
|
||||
}
|
||||
// Collect storage buffer and the instruction
|
||||
|
|
Loading…
Reference in New Issue