Live data from Hacker News

Experimental Nintendo Switch Emulator written in C#

github.com

141–150 of 172 posts

Re: Experimental Nintendo Switch Emulator written in C#

#141
post #26
post #4

Impressive! Is this the first modern console emulator written in a GCed language, or even a language other than C++?

I worked on Jpcsp a long time ago, PSP emulator in Java. It was the first emulator to manage to run a large amount of games. We had some crazy devs on it who even wrote a MIPS to Java bytecode JIT. It worked great... sometimes. We ended up running into lots of JIT issues as some patterns were unusual and not always properly handled by hotspot. Fun times!

Would graalvm give a speed boost?

Re: Experimental Nintendo Switch Emulator written in C#

#142
post #30

Why wouldn't one create and emulator for this using QEMU? Couldn't that be possible? Doesn't a bunch of hardware faking have to be rebuilt in C# that QEMU already does (well¿)? Or is it too hard to introduce custom hardware/firmware (like this audio stuff) into QEMU?

There is one emulator currently that does do that, the "XQEMU" emulator for the original Xbox https://xqemu.com/

It's in its infant stages at the moment according to the "Emulation General" wiki and focuses heavily on "accuracy" over performance

Other emulators such as CXBX-Reloaded have made larger strides, currently emulating roughly 10% of the software library

It's also worth stating, while the Xbox seems like an "easy" target, being based on an ia-32 (Pentium III) PC with an Nvidia GeForce chip (somewhere between a Geforce 2 and 3 at the time) it is an absolutely monstrous beast with minimal documentation about its hardware and numerous "gotchas"

It also has a very small library of 'exclusive' content which detracts from gaining many developers

Re: Experimental Nintendo Switch Emulator written in C#

#143
post #134

Earlier quoted context omitted.

It sucks, doesn’t it? Developers deserve to get paid, but I’m glad I didn’t have to wait a decade to see Breath of the Wild in 4K. I wish there was an easier way to run legitimately purchased cartridges. I don’t know how many people ever did it, but PCSX2, for instance, has always been able to run PS2 discs right off a standard PC optical drive. If buying games can be made easier than piracy, lots of people will prob…

> If buying games can be made easier than piracy, lots of people will probably do that. But if piracy is way easier, then that’s what 99.9% of users will do. Apart from folks who have no way to perform online transactions and would have to physically visit a shop to pay using cash, piracy hasn’t been “way easier” than buying games in more than a decade. Everybody has online shops now. On the Switch, you can even buy…

Sorry, I meant for emulators specifically. Buying a cartridge and ripping off the rom is much harder than just downloading an illegal copy. So 99.9% of games played in emulators are pirated copies.

It would be great if it was more like PCSX2. Not that I have any idea at all how you’d do that.

Re: Experimental Nintendo Switch Emulator written in C#

#144
post #99
post #78

Earlier quoted context omitted.

> if it's running on an ARM processor does it just run the instructions directly? You can't just run random instructions like that. That code is compiled with the assumption that there's the Switch's OS and hardware underneath, which means it will do all kinds of things, like calling directly into the kernel and assuming a particular address space layout, that would crash it under a different OS. ARM has hardware vir…

I think it does beg the question though, of whether it might be possible to dump the Switch OS and firmware and run it on some alternative ARM hardware (with some modifications for redirecting weird custom chips). IIRC the Switch is running an overclocked Tegra (X1?) IANAL, but in the US at least, I think every person would need to buy their own Switch and dump the software themselves for it to be even remotely legal…

I attempted this a while ago, running the Switch OS (Horizon/NX) on a Jetson TX1. It's definitely possible, *but* it requires modifications to the OS services, otherwise you'll just fry the Jetson (that was a lesson learned the hard way...). The pinmuxing between the two devices is different, so you'd need to modify that at least. And then you'd probably need some more modifications to get joycons to work (how do you sync them without a rail), etc...

The kernel however runs absolutely fine with zero modifications required. HorizonOS is a microkernel, and all the components are fairly well separated. To make it work on a jetson, you'd only have to replace a handful of services to make it work.

> IANAL, but in the US at least, I think every person would need to buy their own Switch and dump the software themselves for it to be even remotely legal.

Honestly, I'm pretty sure it'd violate the DMCA DRM protections in the US (you'd have to dump some crypto keys and provide them to an EL3 reimplementation, like Exosphere, to run anything below the kernel).

Re: Experimental Nintendo Switch Emulator written in C#

#145

Earlier quoted context omitted.

C++ interop?

C++ interop is not supported in modern .NET out of the box, but wasn't too hard to implement as a library: https://github.com/Const-me/ComLightInterop

C++/CLI works perfectly fine on Windows, it was a major milestone for .NET Core 3.0.

And then there is WinRT/COM as well.

Re: Experimental Nintendo Switch Emulator written in C#

#146
post #4

Impressive! Is this the first modern console emulator written in a GCed language, or even a language other than C++?

The problems with GC'd languages are very exaggerated. I'm not surprised at all that this is performant in C#.

.NET 5 further improves upon an already very capable GC:

https://devblogs.microsoft.com/dotnet/performance-improvemen...

Most notably:

> When running with the “Server GC”, a thread per core is involved in collections, and as threads finish their allotted portions of the marking work, they’re now able to “steal” undone work from other threads in order to help the overall collection complete more quickly.

Re: Experimental Nintendo Switch Emulator written in C#

#147
post #70
post #67

Earlier quoted context omitted.

Your argument was, literally, that piracy decreases sales. But all of the evidence points toward piracy increasing game sales. Therefore, the indie dev in your example would make more money. I'm not saying that piracy is good or bad; I really don't care. I'm simply stating that your argument was wrong.

That was quite literally not my argument. I gave an example in which piracy decreases sales, to respond to an a priori defense of piracy. Edit: There is a world of difference between debating a point on deontological ethical grounds and consequential ethical grounds. My point is not about what the consequences are, it's about the fact that a specific a priori ethical defense of piracy like that ddevault gives can't b…

No, you gave a fully theoretical thought experiment, that attempts to play with emotions (oh no, not just an employee that can't be paid, but an intern, a poor student that cannot feed his family after, because that... wait non that's not what interns do) and tried to spin it as an ethical argument.

Re: Experimental Nintendo Switch Emulator written in C#

#148

This emulator currently has the most complete guest audio renderer implementations, as they just finished a project of doing an in depth reversing of that portion of the firmware. [0] Getting it to work with the host os(windows usually) can have minor issues with output in rare circumstances, or when a game is still not running the proper speed, but they've ironed out the major ones. ----------------------- This is m…

Awe inspiring. 10 months of work and 250 changed files! Respect!

Re: Experimental Nintendo Switch Emulator written in C#

#149

Earlier quoted context omitted.

If people who wouldn’t have bought a Switch end up playing those games on PC who has lost out here?

It's ignorant at best to argue that this is only going to be used by those who wouldn't have purchased a Switch. Once something is free then a lot of people won't spend hundreds of dollars on it.

I really don’t think the group of emulator pirates who would have bought the console and games if they had not been able to pirate is a particularly large group. How many sales are you thinking are lost to this 1%?

Re: Experimental Nintendo Switch Emulator written in C#

#150
post #30

Why wouldn't one create and emulator for this using QEMU? Couldn't that be possible? Doesn't a bunch of hardware faking have to be rebuilt in C# that QEMU already does (well¿)? Or is it too hard to introduce custom hardware/firmware (like this audio stuff) into QEMU?

There is one emulator currently that does do that, the "XQEMU" emulator for the original Xbox https://xqemu.com/ It's in its infant stages at the moment according to the "Emulation General" wiki and focuses heavily on "accuracy" over performance Other emulators such as CXBX-Reloaded have made larger strides, currently emulating roughly 10% of the software library It's also worth stating, while the Xbox seems like an…

Your information on xqemu is dated. xqemu was forked to xemu a while back. Development of xemu is very active now: many games are now playable with accurate graphics and sound with performance up to native framerates. Improvements to speed and accuracy are coming in on a regular basis. xqemu is basically dead, with its discord shut down and the main developer off the project. Now is a good time play around with xbox emulation if it is of interest to you.

https://xemu.app/

https://github.com/mborgerson/xemu/commits/master

Post reply on HN