8 ms·
ProjectPSX – A C# coded emulator of the original Playstation
- mscasts 7y agoVery cool work, good job!
- voctor 7y agoAnd one in Java: https://github.com/kilograham/jpsx https://github.com/kilograham/jpsx
- totallynotcool 7y agoHaving a problem finding the "one line" version. Mind directly linking to it? https://github.com/kilograham/jpsx/tree/master/src https://github.com/kilograham/jpsx/tree/master/src
- penagwin 7y agoI think you miss read his comment
- strags 7y agoThis one is fascinating - especially the slides from the JavaOne presentation. It JITs heavily-used R3000 blocks into Java bytecode, which is then JITted by the Java interpreter. And he did it 14 years ago!
- rvz 7y ago> ProjectPSX dosn't use any external dependency and uses rather simplistic C# code. Very impressive. This makes it more interesting to see how the drawing code and the controls were implemented in addition to the possibility of it being cross-platform if it using .NET Core.
- deleted 7y ago[deleted]
- cosarara 7y agoIt uses System.Windows.Forms and friends. It is a Windows app.
- btown 7y agohttps://www.mono-project.com/docs/gui/winforms/ https://www.mono-project.com/docs/gui/winforms/ might allow this to be ported easily though.
- Aloha 7y agoWhile I'm a novice - Looking at this, it doesn't appear to require any porting.
- xmichael999 7y agowinforms on mono never really worked, and hasn't been updated in about 12 years https://github.com/mono/winforms https://github.com/mono/winforms
- gnud 7y agoIt has like 50 lines of code that are actually platform dependent, from what I can see. Should be straightforward to port to GTK# or Eto.Forms or something, if one had the inclination.
- sehugg 7y agoMesen (for NES) is a good example of a cross-platform C# emulator with a comprehensive debugger UI: https://www.mesen.ca/ https://www.mesen.ca/ (As long as you have Windows or Linux, that is...)
- pjmlp 7y agoGreat job! We need more such examples in managed languages.
- numlock86 7y agoThis is great. It would be almost perfect if it didn't rely on WinForms (1) and was built on .NET core from the ground up. Anyway, great project I will keep checking out. (1) instead it could be a runtime that just gives you an interface to the frame buffer somehow and it's up to the integrator to use WinForms/WPF/Qt etc.
- MrGilbert 7y agoI think SDL2-CS[0] would be an awesome candidate for a platform-independent implmentation. Gives you a ton of low-level control. [0] https://github.com/flibitijibibo/SDL2-CS https://github.com/flibitijibibo/SDL2-CS
- ygra 7y agoIt would conflict with this, though: > ProjectPSX dosn't use any external dependency and uses rather simplistic C# code. And for a learning project I think the ability to download the code and get it to run immediately without hunting for dependencies, is a very important property. More important I'd say than complicating the code to make it run everywhere.
- ocdtrekkie 7y agoA platform independent desktop UI framework really is the biggest gap in the .NET platform right now, and I think Microsoft knows it. We'll probably see something new on that front soon, I'd wager.
- ygra 7y agoI hope. But I don't hold my breath before .NET 5. 3.0 is all about getting Windows Desktop scenarios to .NET Core. Not many of the people who require those would benefit from a cross-platform framework, as neither Windows Forms nor WPF would be portable. Avalonia might have the chance of becoming a decent option, but even working for an employer that provides GUI controls for various platforms it's too early to decide to try supporting it. And then there's the problem that Desktop apps are kinda dying out ...
- gwbas1c 7y agoAs a day-to-day C# developer, I'm curious about a few things: - Do you ever find that the Garbage Collector causes noticeable pausing in the emulator? - Did you do this with 100% managed memory, or do you need to use unsafe code / real pointers? (Apologies that I didn't read the source code.)
- RobotCaleb 7y agoI haven't read the code, but you usually don't let the garbage collector get a chance to do anything with projects where it matters.
- ygra 7y agoIn fact, the techniques for C# here would be pretty much the same as for C++ or C: Don't do dynamic allocation in the hot path. And if you must, keep the lifetime short so it gets cleaned up predictably (usually in gen0). However, for an ancient platform on modern hardware I guess the per-frame budget is plentiful even for an emulator.
- AnIdiotOnTheNet 7y agoYeah, which is the problem with GC'd languages because it isn't always obvious where allocation will occur.
- testvox 7y agoIn what case isn't it obvious? C# makes it quite clear, you allocate to memory on the heap whenever you see the "new" keyword or whenever you see a new closure (because closures are of course just a poor man's objects).
- ygra 7y agoNot necessarily just those things. A foreach loop might have a heap allocation, async/await almost certainly, calling a method with a params[] parameter as well. Everything you call from the BCL might allocate, too and it's not always visible or obvious. That being said, it is still doable to avoid allocations and the standard library has become much better with not allocating unless really necessary. A lot of the newer things with Span<T> enable zero-allocation usage of certain APIs that before would have allocated.
- mastrsushi 7y agoI'd avoid a name like ProjectPSX to be more distinct from the 100 other PSX emu projects. PSX.NET or PSX# would be good.
- BluestormDNA 7y agoEy, those are real cool names. The name itself was chosen because i already had a ProjectDMG (Gameboy emulator)... I may go with PSX.net when net core 3.0 goes out...
- mastrsushi 7y agoThey may sound cool but they aren't original lol. Open source C# projects like Paint.NET often take on that convention. This might sound weird, but make sure .NET is capitalized otherwise people might mistake your project for a website.
- mattlondon 7y agoThis is great! I've often wondered how emulators are actually written - I understand the theory but it was great to see this, and the linked other emulators this person has also worked on (chip8, gameboy etc). Super nice and simple to read - e.g. cpu.cs has the thing that does the actual "MUL" and "MOV" etc op codes. Nice :-) Thanks :-)
- lightedman 7y agoNo external dependencies? So this thing includes the BIOS?
- michannne 7y agoVery, very cool. Good job! I remember tackling emulating the 6502 was a crazy learning experience, but I did that in C++, but definitely there is value in emulating something this complex in C#. Did you choose emulation because it was interesting or it just seemed to provide the best learning environment for what you were looking for? And have you ever dabbled in PSP emulation? I tried my hands years ago and still have a PSP sitting around with some homebrew I made.