<feed xmlns='http://www.w3.org/2005/Atom'>
<title>eglantine-cirakg/src/core/hle/service/sockets/bsd.cpp, branch nx2</title>
<subtitle>Mirror of github.com/cira0100/Eglantine-public nx2, a fork of Djihads80/Eglantine.</subtitle>
<id>https://git.cirakg.xyz/eglantine-cirakg/atom?h=nx2</id>
<link rel='self' href='https://git.cirakg.xyz/eglantine-cirakg/atom?h=nx2'/>
<link rel='alternate' type='text/html' href='https://git.cirakg.xyz/eglantine-cirakg/'/>
<updated>2026-11-03T00:39:54+00:00</updated>
<entry>
<title>network: close each bsd fd once and drop unwanted or malformed room packets</title>
<updated>2026-11-03T00:39:54+00:00</updated>
<author>
<name>cirakg</name>
<email>cirakg@cirakg.xyz</email>
</author>
<published>2026-11-03T00:39:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cirakg.xyz/eglantine-cirakg/commit/?id=4304d2704a57c22d5b3f8576b5acebc57a6a7eef'/>
<id>urn:sha1:4304d2704a57c22d5b3f8576b5acebc57a6a7eef</id>
<content type='text'>
Two threads closing the same fd both copied the descriptor and both called
Close(), so a host socket could be closed twice, and the second closesocket
could hit an unrelated socket that had reused the host fd. CloseImpl now
frees the slot under file_descriptors_mutex first and only that thread closes
the socket; the other gets EBADF.

OnProxyPacketReceived decompressed every room packet when any fd had a
socket, including native sockets and proxy sockets on other ports. Sockets
now report through AcceptsProxyPacket whether they want a packet, and only
those are collected, so an unwanted packet is not decompressed.

DecompressDataZSTD passed the frame's declared size straight to the vector
constructor, so a malformed or unsized frame from a room member threw on the
room thread. The new TryDecompressDataZSTD rejects invalid, unsized and
oversized frames, and bsd drops such packets with a warning.
DecompressDataZSTD now returns an empty vector for them instead of throwing.

Assisted-by: Claude Opus 5.5 (investigation and implementation)
</content>
</entry>
<entry>
<title>network: keep fcntl modes across MSG_DONTWAIT and decompress room packets once</title>
<updated>2026-11-03T00:15:29+00:00</updated>
<author>
<name>cirakg</name>
<email>cirakg@cirakg.xyz</email>
</author>
<published>2026-11-03T00:15:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cirakg.xyz/eglantine-cirakg/commit/?id=d6b32aac3c75a6a0c4190a8b6b2b1fbc5f3e8801'/>
<id>urn:sha1:d6b32aac3c75a6a0c4190a8b6b2b1fbc5f3e8801</id>
<content type='text'>
A receive with MSG_DONTWAIT restored the blocking mode from the descriptor copy taken
before the call. When fcntl(SETFL, O_NONBLOCK) ran during the receive, the fd kept
reporting O_NONBLOCK while its socket blocked again. Receives now switch the mode only
for MSG_DONTWAIT and read the current flags under file_descriptors_mutex at both ends,
and SETFL changes the mode and the stored flags in the same critical section.

OnProxyPacketReceived decompressed each room packet once per matching socket while
holding file_descriptors_mutex, so every bsd call waited for it. It now copies the
distinct sockets under the lock, decompresses once without it and delivers the result.

Also reject fd == MAX_FD in IsFileDescriptorValid and PollImpl, which read past the
table, and guard the ProxySocket blocking and receive timeout setters with
packets_mutex, matching their reader.

Assisted-by: Claude Opus 5.5 (investigation and implementation)
</content>
</entry>
<entry>
<title>network: keep bsd sockets alive across concurrent close and fix room gaps</title>
<updated>2026-11-02T23:46:55+00:00</updated>
<author>
<name>cirakg</name>
<email>cirakg@cirakg.xyz</email>
</author>
<published>2026-11-02T23:46:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cirakg.xyz/eglantine-cirakg/commit/?id=36d3d002e5bd75596b8cf00c1115632a5ae8976a'/>
<id>urn:sha1:36d3d002e5bd75596b8cf00c1115632a5ae8976a</id>
<content type='text'>
bsd runs on three host threads, but its calls kept a raw reference into
the shared descriptor table while they used a socket. A close() on
another thread could then destroy the socket mid-call. Waking a blocked
room recv() on close made this happen every time. Every call now works
on a copy of the descriptor taken under the table lock, poll() keeps its
sockets alive while it waits, and close() resets the slot only if it
still holds the same socket.

accept() picked a free fd before blocking and only locked the write, so
another thread could publish a socket in the same slot. It now picks
and writes the fd in one critical section after Accept() returns. dup()
now re-checks the source fd under the lock.

A duplicated fd shares its socket, so the room packet loop queued each
packet once per fd. Deliver it once per socket.

NIFM: when the selected host adapter is missing, the room still works
and IsNetworkAvailable reports it, but GetCurrentNetworkProfile returned
an empty profile. Report a wired room profile in that case, and put the
room address on the first adapter in EnumerateNetworkInterfaces.

Assisted-by: Claude Opus 5.5 (investigation and implementation)
</content>
</entry>
<entry>
<title>network: fix room socket races and share the room network check</title>
<updated>2026-11-02T23:17:34+00:00</updated>
<author>
<name>cirakg</name>
<email>cirakg@cirakg.xyz</email>
</author>
<published>2026-11-02T23:17:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cirakg.xyz/eglantine-cirakg/commit/?id=78e0a12180a71adf8dffc2c2f6697a0a0735d5ea'/>
<id>urn:sha1:78e0a12180a71adf8dffc2c2f6697a0a0735d5ea</id>
<content type='text'>
bsd:s, bsd:u and bsd:a share one file descriptor table, but each
service bound its own proxy packet callback, so every room packet was
queued three times on each socket. Bind the callback once.

The room thread walked the descriptor table without a lock while bsd
created and closed sockets, so it could reach a destroyed or not yet
created socket. Guard the table with a mutex, and publish a socket only
after it is created and initialized. Check airplane mode before an fd
is taken, so a refused socket no longer leaks its slot.

ProxySocket now initializes protocol, decompresses packets outside the
packet lock without copying the compressed data first, and keeps a read
offset for partial TCP reads instead of erasing from the front.

Add Network::GetRoomIPv4Address(), set only in the Joined and Moderator
states. NIFM uses it for network availability and for every reported
address, including EnumerateNetworkInterfaces and GetCurrentIpAddress,
so no call reports the room address while another rejects the network.

Assisted-by: Claude Opus 5.5 (investigation and implementation)
</content>
</entry>
<entry>
<title>service: placeholder handlers for known but unimplemented commands</title>
<updated>2026-11-01T17:39:36+00:00</updated>
<author>
<name>Takoroka</name>
<email>137927095+Takoroka@users.noreply.github.com</email>
</author>
<published>2026-10-31T07:02:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cirakg.xyz/eglantine-cirakg/commit/?id=a07b8a31908ef8cc56e430449f374cdf997cd4fb'/>
<id>urn:sha1:a07b8a31908ef8cc56e430449f374cdf997cd4fb</id>
<content type='text'>
Add StubReplyZeroed, StubReplyEvent and StubReplyInterface to
ServiceFrameworkBase: for Switch 2 callers they reply with zeroed data, with
zeroed data and a copy handle to an event that never fires, or with an nx2:
stub interface; other callers get the unimplemented-function path as before.
Each command is logged once.

Use them for the commands of the interfaces games open that had no handler
or a nullptr one (hid, am, audio, aoc, caps, mii, set, lm, acc, ssl, bsd and
the nx2 vi2/gsv/gpu/syncpt sessions): a command that returns an interface now
returns one, a command that returns a handle returns an event, so callers no
longer get handle 0 or object 0 back.
</content>
</entry>
<entry>
<title>bsd: handle the Switch 2 client registration command 36</title>
<updated>2026-11-01T17:35:45+00:00</updated>
<author>
<name>Takoroka</name>
<email>137927095+Takoroka@users.noreply.github.com</email>
</author>
<published>2026-10-31T07:02:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cirakg.xyz/eglantine-cirakg/commit/?id=72a8b41fd5fb3a25868eed1b05ef26f91dea92df'/>
<id>urn:sha1:72a8b41fd5fb3a25868eed1b05ef26f91dea92df</id>
<content type='text'>
Switch 2 titles register with bsd 36 (16 bytes and the pid, a bsd errno back)
instead of RegisterClient. It was nullptr, so the errno was left to the
message buffer's leftovers and Minecraft's socket layer failed later. Answer
it like RegisterClient.
</content>
</entry>
<entry>
<title>Revert "[hle] constexpr handler dispatch maps, introduce version gating (#4480)" (#4532)</title>
<updated>2026-10-15T06:45:15+00:00</updated>
<author>
<name>PavelBARABANOV</name>
<email>pavelbarabanov94@gmail.com</email>
</author>
<published>2026-10-15T06:45:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cirakg.xyz/eglantine-cirakg/commit/?id=e255c20db4111485d228c10478bda63aabcfdde5'/>
<id>urn:sha1:e255c20db4111485d228c10478bda63aabcfdde5</id>
<content type='text'>
This reverts commit 218c6705d950635bc18f8458d738a1996fb592b6.

- [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions).
- [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md).
- [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability.

-------------------

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4532
Reviewed-by: lizzie &lt;lizzie@eden-emu.dev&gt;
Reviewed-by: CamilleLaVey &lt;camillelavey99@gmail.com&gt;
Reviewed-by: Maufeat &lt;sahyno1996@gmail.com&gt;
</content>
</entry>
<entry>
<title>[hle] constexpr handler dispatch maps, introduce version gating (#4480)</title>
<updated>2026-10-13T02:38:36+00:00</updated>
<author>
<name>lizzie</name>
<email>lizzie@eden-emu.dev</email>
</author>
<published>2026-10-13T02:38:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cirakg.xyz/eglantine-cirakg/commit/?id=218c6705d950635bc18f8458d738a1996fb592b6'/>
<id>urn:sha1:218c6705d950635bc18f8458d738a1996fb592b6</id>
<content type='text'>
This PR primarily focuses on upbringing constexpr maps for handlers.

Each time an HLE object of a service is construed, it registers it's own handlers, over and over.
Regardless of whetever it needs them at the moment or not.
Additionally we don't require to keep track of different function pointers amongst each object.
This can be done by overriding the given function instead, as opposed to having a separate
hash map for every given object.

In other words: Remove handlers (and handlers_tipc) map for every instance
then read from a static defined per-class.

- [x] Migrate all HLE functions to new `frozen::map` constexpr time finder
- [ ] Measure if this approach actually makes better codegen

Optional:
- [x] Properly gate all functions (that have versions commented next to them)
- [x] Maybe store `HandlerFnP&lt;&gt;` and `const char*` separately, version gating can go in a different map as well

Information such as name can be used on debug builds, but doesn't particularly help on release as one can consult an external reference (or have an annotated IPC map)

Signed-off-by: lizzie &lt;lizzie@eden-emu.dev&gt;

- [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions).
- [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md)
- [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability.

-------------------

Co-authored-by: Maufeat &lt;sahyno1996@gmail.com&gt;
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4480
Reviewed-by: Maufeat &lt;sahyno1996@gmail.com&gt;
Reviewed-by: MaranBr &lt;maranbr@eden-emu.dev&gt;
</content>
</entry>
<entry>
<title>[video_core/buffer_cache] fix PAGE_SHIFT/BSD macro clash on Linux, *BSD (#4329)</title>
<updated>2026-08-31T19:34:01+00:00</updated>
<author>
<name>lizzie</name>
<email>lizzie@eden-emu.dev</email>
</author>
<published>2026-08-31T19:34:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cirakg.xyz/eglantine-cirakg/commit/?id=f7e5ceeacb78c96110b4da984973a4dfba77e399'/>
<id>urn:sha1:f7e5ceeacb78c96110b4da984973a4dfba77e399</id>
<content type='text'>
Signed-off-by: lizzie &lt;lizzie@eden-emu.dev&gt;

- [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions).
- [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md)
- [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability.

-------------------

PAGE_SHIFT is a macro (sys/user.h on linux, machine/params.h on FBSD), dont name stuff that
https://stackoverflow.com/questions/77611721/get-page-shift-value-in-user-space

BSD is also a macro

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4329
Reviewed-by: CamilleLaVey &lt;camillelavey99@gmail.com&gt;
Reviewed-by: MaranBr &lt;maranbr@eden-emu.dev&gt;
</content>
</entry>
<entry>
<title>[hle/service] stub missing homebrew services, fix NPad/caps crashes (#4264)</title>
<updated>2026-08-18T16:11:33+00:00</updated>
<author>
<name>lizzie</name>
<email>lizzie@eden-emu.dev</email>
</author>
<published>2026-08-18T16:11:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cirakg.xyz/eglantine-cirakg/commit/?id=a41a98028a541e8e44d6220d0b58e45017e25c85'/>
<id>urn:sha1:a41a98028a541e8e44d6220d0b58e45017e25c85</id>
<content type='text'>
Signed-off-by: lizzie &lt;lizzie@eden-emu.dev&gt;

- [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions).
- [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md)
- [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability.

-------------------

this PR adds various missing services (acc:e, acc:e:u1)
to expand homebrew compatibility
notably this also fixes NPad related crashes due to nullref

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4264
Reviewed-by: Maufeat &lt;sahyno1996@gmail.com&gt;
Reviewed-by: CamilleLaVey &lt;camillelavey99@gmail.com&gt;
</content>
</entry>
</feed>
