Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Kernel WaitSynchronization1 HLE, properly report CirclePadPro as not connected #345

Merged
merged 2 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/kernel/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void Kernel::svcSignalEvent() {
// Result WaitSynchronization1(Handle handle, s64 timeout_nanoseconds)
void Kernel::waitSynchronization1() {
const Handle handle = regs[0];
const s64 ns = s64(u64(regs[1]) | (u64(regs[2]) << 32));
const s64 ns = s64(u64(regs[2]) | (u64(regs[3]) << 32));
logSVC("WaitSynchronization1(handle = %X, ns = %lld)\n", handle, ns);

const auto object = getObject(handle);
Expand Down
11 changes: 8 additions & 3 deletions src/core/services/ir_user.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,14 @@ void IRUserService::requireConnection(u32 messagePointer) {
u32 sharedMemAddress = sharedMemory.value().addr;

if (deviceID == u8(DeviceID::CirclePadPro)) {
mem.write8(sharedMemAddress + offsetof(SharedMemoryStatus, connectionStatus), 2); // Citra uses 2 here but only 1 works??
mem.write8(sharedMemAddress + offsetof(SharedMemoryStatus, connectionRole), 2);
mem.write8(sharedMemAddress + offsetof(SharedMemoryStatus, isConnected), 1);
// Note: We temporarily pretend we don't have a CirclePad Pro. This code must change when we emulate it or N3DS C-stick
constexpr u8 status = 1; // Not connected. Any value other than 2 is considered not connected.
constexpr u8 role = 0;
constexpr u8 connected = 0;

mem.write8(sharedMemAddress + offsetof(SharedMemoryStatus, connectionStatus), status);
mem.write8(sharedMemAddress + offsetof(SharedMemoryStatus, connectionRole), role);
mem.write8(sharedMemAddress + offsetof(SharedMemoryStatus, isConnected), connected);

connectedDevice = true;
if (connectionStatusEvent.has_value()) {
Expand Down
Loading