Skip to content

0.1-Experimental

Latest

Choose a tag to compare

@noobie-trex-lite noobie-trex-lite released this 13 Jul 16:58

Denzen 0.1-Experimental Release

This is the first official rather experimental release for Denzen. And I could only do these experiments because of solid foundations by upstream Azahar team and previously Citra team. Although I decided to work on this repo as a non-fork because I wanted to do my own independent experiments on this. Much of work happened locally without a remote repo hence pre-remote changes are mentioned in-detail at MODIFICATIONS.md to ensure compliance with GPL 2 license. Git history will take care of further modifications and changes.

Following are the few main commits worth noting:

  1. initial experiments done - This is where networking stack improved
  2. core: fix cross-core wake race blocking the 3DS browser
  3. core: integrate and strengthen upstream graphics, memory, service, and Windows fixes
  4. core: improve ARM11 timing and New 3DS hardware accuracy

My personal favorite commit is : core: fix cross-core wake race blocking the 3DS browser Because this is where I learned the importance to work towards more and more hardware level accuracy. Title specific hacks are fine, but hardware level accuracy is what will lead to broader benefit.

This is how it unfolded:

Curiosity hit a roadblock when 3DS web browser refused to work. I wanted to try it and see how many website's still work on this ancient browser.

But I couldn't continue this curiosity mission because it always got stuck during boot up or froze right after I entered an URL.

And during debugging this issue, I found a small bug which was causing this and fixing it ended up making Denzen more hardware accurate by fixing a CPU issue.

Denzen previously ran every emulated CPU core before processing pending thread switches.

This created a race:

  1. A thread went to sleep while waiting for work.
  2. Another CPU core completed the work and woke the thread correctly.
  3. Before the thread resumed, Denzen saved its older CPU state over the new wake-up result.

In simple terms, Denzen delivered the message:

"your work is ready"

and then accidentally replaced it with an older message saying:

"keep waiting."

The 3DS System Browser therefore lost a WebKit callback and froze after opening a URL.


Fix

Process pending thread switches after each emulated CPU core runs.

This saves a blocked thread's state before another core can wake it, ensuring that the wake-up result cannot be overwritten.

Also clear a timer's signaled state when it is cancelled, matching Kernel11 behavior, and translate Windows WSAEWOULDBLOCK to EINPROGRESS for nonblocking SOC connections.

This allows the browser to wait for a connection normally instead of treating it as an immediate failure.


And at last debug session ended up making general scheduler, timer, and socket corrections rather than browser-specific workarounds.