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 2018 yuzu Emulator Project
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -17,9 +18,11 @@ enum class Errno : u32 {
|
||||||
BADF = 9,
|
BADF = 9,
|
||||||
AGAIN = 11,
|
AGAIN = 11,
|
||||||
NOMEM = 12,
|
NOMEM = 12,
|
||||||
|
BUSY = 16,
|
||||||
INVAL = 22,
|
INVAL = 22,
|
||||||
MFILE = 24,
|
MFILE = 24,
|
||||||
PIPE = 32,
|
PIPE = 32,
|
||||||
|
NOTSOCK = 88,
|
||||||
MSGSIZE = 90,
|
MSGSIZE = 90,
|
||||||
CONNABORTED = 103,
|
CONNABORTED = 103,
|
||||||
CONNRESET = 104,
|
CONNRESET = 104,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
@ -39,6 +40,10 @@ Errno Translate(Network::Errno value) {
|
||||||
return Errno::INPROGRESS;
|
return Errno::INPROGRESS;
|
||||||
case Network::Errno::NOMEM:
|
case Network::Errno::NOMEM:
|
||||||
return Errno::NOMEM;
|
return Errno::NOMEM;
|
||||||
|
case Network::Errno::BUSY:
|
||||||
|
return Errno::BUSY;
|
||||||
|
case Network::Errno::NOTSOCK:
|
||||||
|
return Errno::NOTSOCK;
|
||||||
default:
|
default:
|
||||||
UNIMPLEMENTED_MSG("Unimplemented errno={}", value);
|
UNIMPLEMENTED_MSG("Unimplemented errno={}", value);
|
||||||
return Errno::SUCCESS;
|
return Errno::SUCCESS;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -156,6 +157,10 @@ Errno TranslateNativeError(int e, CallType call_type = CallType::Other) {
|
||||||
return Errno::TIMEDOUT;
|
return Errno::TIMEDOUT;
|
||||||
case WSAEINPROGRESS:
|
case WSAEINPROGRESS:
|
||||||
return Errno::INPROGRESS;
|
return Errno::INPROGRESS;
|
||||||
|
case WSAENOTSOCK:
|
||||||
|
return Errno::NOTSOCK;
|
||||||
|
case WSAEBUSY:
|
||||||
|
return Errno::BUSY;
|
||||||
default:
|
default:
|
||||||
UNIMPLEMENTED_MSG("Unimplemented errno={}", e);
|
UNIMPLEMENTED_MSG("Unimplemented errno={}", e);
|
||||||
return Errno::OTHER;
|
return Errno::OTHER;
|
||||||
|
@ -273,14 +278,14 @@ Errno TranslateNativeError(int e, CallType call_type = CallType::Other) {
|
||||||
return Errno::MFILE;
|
return Errno::MFILE;
|
||||||
case EPIPE:
|
case EPIPE:
|
||||||
return Errno::PIPE;
|
return Errno::PIPE;
|
||||||
case ECONNABORTED:
|
|
||||||
return Errno::CONNABORTED;
|
|
||||||
case ENOTCONN:
|
case ENOTCONN:
|
||||||
return Errno::NOTCONN;
|
return Errno::NOTCONN;
|
||||||
case EAGAIN:
|
case EAGAIN:
|
||||||
return Errno::AGAIN;
|
return Errno::AGAIN;
|
||||||
case ECONNREFUSED:
|
case ECONNREFUSED:
|
||||||
return Errno::CONNREFUSED;
|
return Errno::CONNREFUSED;
|
||||||
|
case ECONNABORTED:
|
||||||
|
return Errno::CONNABORTED;
|
||||||
case ECONNRESET:
|
case ECONNRESET:
|
||||||
return Errno::CONNRESET;
|
return Errno::CONNRESET;
|
||||||
case EHOSTUNREACH:
|
case EHOSTUNREACH:
|
||||||
|
@ -295,8 +300,14 @@ Errno TranslateNativeError(int e, CallType call_type = CallType::Other) {
|
||||||
return Errno::TIMEDOUT;
|
return Errno::TIMEDOUT;
|
||||||
case EINPROGRESS:
|
case EINPROGRESS:
|
||||||
return Errno::INPROGRESS;
|
return Errno::INPROGRESS;
|
||||||
|
case ENOMEM:
|
||||||
|
return Errno::NOMEM;
|
||||||
|
case EBUSY:
|
||||||
|
return Errno::BUSY;
|
||||||
|
case ENOTSOCK:
|
||||||
|
return Errno::NOTSOCK;
|
||||||
default:
|
default:
|
||||||
UNIMPLEMENTED_MSG("Unimplemented errno={} ({})", e, strerror(e));
|
UNIMPLEMENTED_MSG("Unimplemented errno={}", e);
|
||||||
return Errno::OTHER;
|
return Errno::OTHER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,6 +326,14 @@ Errno GetAndLogLastError(CallType call_type = CallType::Other) {
|
||||||
LOG_DEBUG(Network, "Socket operation error: {}", Common::NativeErrorToString(e));
|
LOG_DEBUG(Network, "Socket operation error: {}", Common::NativeErrorToString(e));
|
||||||
return err;
|
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));
|
LOG_ERROR(Network, "Socket operation error: {}", Common::NativeErrorToString(e));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -47,6 +48,8 @@ enum class Errno {
|
||||||
INPROGRESS,
|
INPROGRESS,
|
||||||
OTHER,
|
OTHER,
|
||||||
NOMEM,
|
NOMEM,
|
||||||
|
BUSY,
|
||||||
|
NOTSOCK,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class GetAddrInfoError {
|
enum class GetAddrInfoError {
|
||||||
|
|
|
@ -381,7 +381,7 @@ void CollectStorageBuffers(IR::Block& block, IR::Inst& inst, StorageInfo& info)
|
||||||
static constexpr Bias nvn_bias{
|
static constexpr Bias nvn_bias{
|
||||||
.index = 0,
|
.index = 0,
|
||||||
.offset_begin = 0x100, // Expanded from 0x110 to catch more potential storage buffers
|
.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
|
.alignment = 32, // Increased from 16 to optimize memory access patterns
|
||||||
};
|
};
|
||||||
// Track the low address of the instruction
|
// Track the low address of the instruction
|
||||||
|
@ -402,8 +402,8 @@ void CollectStorageBuffers(IR::Block& block, IR::Inst& inst, StorageInfo& info)
|
||||||
LOG_WARNING(Shader, "Storage buffer failed to track, using global memory fallbacks");
|
LOG_WARNING(Shader, "Storage buffer failed to track, using global memory fallbacks");
|
||||||
return;
|
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);
|
storage_buffer->index, storage_buffer->offset);
|
||||||
}
|
}
|
||||||
// Collect storage buffer and the instruction
|
// Collect storage buffer and the instruction
|
||||||
if (IsGlobalMemoryWrite(inst)) {
|
if (IsGlobalMemoryWrite(inst)) {
|
||||||
|
|
Loading…
Reference in New Issue