Homebrew WIP Experimental Switch emulator in C#

sarkwalvein

There's hope for a Xenosaga port.
Member
Joined
Jun 29, 2007
Messages
8,506
Trophies
2
Age
41
Location
Niedersachsen
XP
11,218
Country
Germany
Or you can just use the NET Core SDK and compile that way ;3
Actually, that is a right straight answer, no need to ";3".
Why would anyone download all other bells and whistles? It's not like they're going to edit or anything else.
A total whopping of 126MB........
 
  • Like
Reactions: Dr.Hacknik

Joom

 ❤❤❤
Member
Joined
Jan 8, 2016
Messages
6,067
Trophies
1
Location
US
Website
mogbox.net
XP
6,076
Country
United States
Am I the only one that has a problem with the hype behind this? It'll never become a viable emulation solution due to it translating translations. The effort is admirable, but it won't ever become more than a proof-of-concept due to the limitations and overhead of .NET. The front-end can be in C#, sure, but the backend written in C# is going to be horribly crippled.
 

sarkwalvein

There's hope for a Xenosaga port.
Member
Joined
Jun 29, 2007
Messages
8,506
Trophies
2
Age
41
Location
Niedersachsen
XP
11,218
Country
Germany
I don't really understand the hype. It is naive to expect this to turn into a full-speed commercial games emulator.
That said, this could turn into a nice pc-based debugging tool for developing switch homebrew.
 

Daeken

Well-Known Member
Newcomer
Joined
Aug 20, 2017
Messages
45
Trophies
0
Age
36
XP
576
Country
United States
Am I the only one that has a problem with the hype behind this? It'll never become a viable emulation solution due to it translating translations. The effort is admirable, but it won't ever become more than a proof-of-concept due to the limitations and overhead of .NET. The front-end can be in C#, sure, but the backend written in C# is going to be horribly crippled.

This is ... just woefully misinformed, for a number of reasons. A few of them:
  • .NET carries overhead, certainly. However, the overhead when in unsafe code (directly accessing pointers) can be unbelievably low.
  • Translation overhead is going to be higher than an emulator written in C++ -- no doubt -- but 1) this doesn't actually matter (see the next reason), and 2) this can be offset by the ease of development of new optimizations, gaining massive performance benefits in the emitted code.
  • Switch games cannot self-modify or generate code at runtime. This means that though your first translation can be expensive, you can 100% cache everything. You can, in effect, statically recompile games; build up information on basic blocks and then precompile everything. This completely negates any translation overhead.
  • A three-phase emulator brings down the cost of hitting previously unknown code:
    • Interpret first. This has low performance but very, very low latency. Great for getting through unlikely paths quickly.
    • Naive translation, instruction-for-instruction. This has higher performance and carries higher latency (primarily on the .NET JIT side), but ultimately generates poor code.
    • Function/block-level translation. By essentially decompiling machine code to high-level code, culling out dead/pointless code (unnecessary flag assignments, bounds checks where we can guarantee known-good values, etc), and eliminating the use of guest stack (translating to actual locals), you are able to achieve very, very high performance, at the expense of very slow translation (read: high latency).
  • And finally, because desktops have so many cores, it's possible to do all of this speculatively in the background, translating code before it's ever hit in many cases.
At the end of the day, the performance ceiling of this is identical to the performance ceiling of other emulators. What differs is orders of magnitude less work being required to get there.

I developed the first-ever dynarec'd emulator on .NET back in 2008 and have been waiting for someone to apply these techniques to a suitable target. This is that target.
 

guily6669

GbaTemp is my Drug
Member
Joined
Jun 3, 2013
Messages
2,324
Trophies
1
Age
34
Location
Doomed Island
XP
2,083
Country
United States
I hate Mac's...

Anyway have you tried using the CPU speed hack cheats just to see if it does anything on the performance?

Also can you use Nvidia cuda cores acceleration for C#???

that looks like a god damn lot of work and lot of conversions until it gets to machine code, what's your PC specs????


Ps: if it gets to a point where a crappy laptop could run all switch games I wouldn't even bother buying the switch :). I have a 11.6 inch I7 3rd gen laptop with GT650M which is pretty small
Can anyone plz answer to my questions quoted above or it's just too stupid???
 

sarkwalvein

There's hope for a Xenosaga port.
Member
Joined
Jun 29, 2007
Messages
8,506
Trophies
2
Age
41
Location
Niedersachsen
XP
11,218
Country
Germany
I guess I am "anyone", so here it goes...
I hate Mac's...
Ok. I don't.
Anyway have you tried using the CPU speed hack cheats just to see if it does anything on the performance?
Nope, I haven't.
Also can you use Nvidia cuda cores acceleration for C#???
I have no Nvidia hardware, so no, I can't.
that looks like a god damn lot of work and lot of conversions until it gets to machine code, what's your PC specs????
Oh, which PC?... I guess I could look at the specs of the one I am using right now, let me see,
core i5 - 5200, 8GB RAM, Intel IGP.... It's a toaster, what a PoS.
Ps: if it gets to a point where a crappy laptop could run all switch games I wouldn't even bother buying the switch :). I have a 11.6 inch I7 3rd gen laptop with GT650M which is pretty small
Quite convinced it won't happen.
 
Last edited by sarkwalvein,

BullyWiiPlaza

Nintendo Hacking <3
Member
Joined
Aug 2, 2014
Messages
1,932
Trophies
0
XP
2,467
Country
Germany
Agreed, this is overrated. Why exactly are people thinking this will magically perform better than other emulators? It does not and will not. You can't beat C++ performance, especially not with C# native compilations. At best you can get equal. Regardless, from a development perspective this is cool because C# is a lot nicer to develop with then C++. For the user this means very little besides that maybe it won't crash as often or at all.
 
  • Like
Reactions: Yandere-chan

Yandere-chan

The One and Only
Member
Joined
Nov 11, 2016
Messages
393
Trophies
0
Location
Hidden in your NAND
XP
570
Country
United States
Agreed, this is overrated. Why exactly are people thinking this will magically perform better than other emulators? It does not and will not. You can't beat C++ performance, especially not with C# native compilations. At best you can get equal. Regardless, from a development perspective this is cool because C# is a lot nicer to develop with then C++. For the user this means very little besides that maybe it won't crash as often or at all.
good point, btw nice seeing you here matey, ;)
 

Dr.Hacknik

Ashley | Developer | Trans
Member
Joined
Mar 26, 2014
Messages
1,773
Trophies
1
Age
24
Location
inside your fridge
Website
dochacknik.keybase.pub
XP
2,219
Country
United States
Can someone please share a built copy?
Check the build section of the site.
https://zoltx23.github.io/ryujinx-emu/

Agreed, this is overrated. Why exactly are people thinking this will magically perform better than other emulators? It does not and will not. You can't beat C++ performance, especially not with C# native compilations. At best you can get equal. Regardless, from a development perspective this is cool because C# is a lot nicer to develop with then C++. For the user this means very little besides that maybe it won't crash as often or at all.
And you are very wrong. Please check out the latest build from the "direct_memory" branch. I wonder if you have ever even tried the latest commit, or C# emulating for that matter.
 
Last edited by Dr.Hacknik,
  • Like
Reactions: Subtle Demise

BullyWiiPlaza

Nintendo Hacking <3
Member
Joined
Aug 2, 2014
Messages
1,932
Trophies
0
XP
2,467
Country
Germany
And you are very wrong. Please check out the latest build from the "direct_memory" branch. I wonder if you have ever even tried the latest commit, or C# emulating for that matter.
I didn't try the latest commit but it's only logical but sure, a quick build test on one small homebrew totally undeniably proves natively compiled C# to be way faster than C++ even though C++ is the gold standard for optimized machine code but C# just trashes those decades of C++ compiler development in a few years with ease. /s
 

GerbilSoft

Well-Known Member
Member
Joined
Mar 8, 2012
Messages
2,395
Trophies
2
Age
34
XP
4,249
Country
United States
Agreed, this is overrated. Why exactly are people thinking this will magically perform better than other emulators? It does not and will not. You can't beat C++ performance, especially not with C# native compilations.
That's very interesting. I distinctly remember you complaining that C++ can only be used for shitty command line Linux programs.
 
Last edited by GerbilSoft,

sarkwalvein

There's hope for a Xenosaga port.
Member
Joined
Jun 29, 2007
Messages
8,506
Trophies
2
Age
41
Location
Niedersachsen
XP
11,218
Country
Germany
That's very interesting. I distinctly remember you complaining that C++ can only be used for shitty command line Linux programs.
LOL.
With such a good memory, sure the "better to be king of your silence than slave of your words" quote takes a strong meaning.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    LeoTCK @ LeoTCK: butthurt aren't ya? can't stand the truth