beetle psx_完全使用C#和.NET模拟PlayStation 1(PSX)

beetle psx

beetle psx

I was reading an older post in an emulator forum where someone was asking for a Playstation 1 (PSX) emulator written in C#, and the replies went on and on about how C# and .NET are not suited for emulation, C# is far too slow, negativity, blah blah.

我在模拟器论坛上读了一篇较旧的文章,有人在问用C#编写的Playstation 1(PSX)模拟器,而有关C#和.NET如何不适合进行模拟的答复不断,C#太慢了,消极的,等等等等。

Of course, that's silly. Good C# can run at near-native speed given all the work happening in the runtime/JITter, etc.

当然,这很愚蠢。 考虑到运行时/ JITter等中发生的所有工作,好的C#可以以接近本机的速度运行。

I then stumbled on this very early version of a PSX Emulator in C#. Now, if you were to theoretically have a Playtation SCPH1001.BIN BIOS and then physically owned a Playstation (as I do) and then created a BIN file from your physical copy of Crash Bandicoot, you could happily run it as you can see in the screenshot below.

然后,我偶然发现了C#PSX Emulator的早期版本。 现在,如果您理论上拥有Playtation SCPH100​​1.BIN BIOS,然后物理上拥有一个Playstation(如我所述),然后从您的Crash Bandicoot物理副本中创建了一个BIN文件,则可以像在下面的屏幕截图。

Crash Bandicoot on a C#-based PSX Emulator

This project is very early days, as the author points out, but I was able to Git Clone and directly open the code in Visual Studio 2019 Community (which is free) and run it immediately. Note that as of the time of this blog post, the BIOS location *and* BIN files are hardcoded in the CD.cs and BUS.cs files. I named the BIN file "somegame.bin."

正如作者指出的那样,该项目还处于初期阶段,但是我能够使用Git Clone并直接在Visual Studio 2019社区(免费)中打开代码并立即运行它。 请注意,截至撰写本博客之时,BIOS位置*和* BIN文件已硬编码在CD.cs和BUS.cs文件中。 我将BIN文件命名为“ somegame.bin”。

PSX Emualtor in C# inside Visual Studio

A funny note, since the code is unbounded as it currently sits, while I get about 30fps in Debug mode, in Release mode the ProjectPSX Emulator runs at over 120fps on my system, emulating a PlayStation 1 at over 220% of the usual CPU speed!

有趣的是,由于代码在当前位置是不受限制的,因此在调试模式下我的速度约为30fps,而在发布模式下,ProjectPSX Emulator在系统上的运行速度超过120fps,在模拟PlayStation 1时的正常CPU速度为220%以上!

Just to make sure there's no confusion, and to support the author I want to repeat this question and answer here:

为了确保没有混淆,并且为了支持作者,我想在这里重复这个问题并回答:

我可以使用这个模拟器玩吗? (Can i use this emulator to play?)

"Yes you can, but you shouldn't. There are a lot of other more capable emulators out there. This is a work in progress personal project with the aim to learn about emulators and hardware implementation. It can and will break during emulation as there are a lot of unimplemented hardware features."

“是的,您可以,但是您不应该。还有许多其他更强大的仿真器。这是一个正在进行的个人项目,旨在学习仿真器和硬件实现。在仿真过程中,它可能并且会崩溃,因为有很多未实现的硬件功能。”

This is a great codebase to learn from and read - maybe even support with your own Issues and PRs if the author is willing, but as they point out, it's neither complete nor ready for consumption.

这是一个很好的学习和阅读的代码库-如果作者愿意,甚至可以提供自己的Issues和PRs,但正如他们指出的那样,它既不完整也不准备使用。

Again, from the author who has other interesting emulators you can read:

同样,从拥有其他有趣模拟器的作者那里您可以阅读:

I started doing a Java Chip8 and a C# Intel 8080 CPU (used on the classic arcade Space Invaders). Some later i did Nintendo Gameboy. I wanted to keep forward to do some 3D so i ended with the PSX as it had a good library of games...

我开始制作Java Chip8和C# Intel 8080 CPU (用于经典的Arcade Space Invaders)。 后来我做任天堂Gameboy 。 我想继续做一些3D,所以我选择了PSX,因为它有一个很好的游戏库...

Very cool stuff! Reading emulator code is a great way to not only learn about a specific language but also to learn 'the full stack.' We often hear Full Stack in the context of a complete distributed web application, but for many the stack goes down to the metal. This emulator literally boots up from the real BIOS of a Playstation and emulates the MIPS R3000A, a BUS to connect components, the CPU, the CD-ROM, and display.

很酷的东西! 读取仿真器代码是一种很好的方式,不仅可以学习特定的语言,而且可以学习“全栈”。 在一个完整的分布式Web应用程序的上下文中,我们经常听到Full Stack,但是对于许多堆栈而言,却取决于具体情况。 该仿真器实际上是从Playstation的真实BIOS启动的,并且仿真MIPS R3000A,用于连接组件,CPU,CD-ROM和显示器的总线。

An emulator has to lie at every step so that when an instruction is reached it can make everyone involved truly believe they are really running on a Playstation. If it does its job, no one suspects! That's why it's so interesting.

仿真器必须摆在每一步,以便在收到指令时可以使每个参与人员真正相信他们确实在Playstation上运行。 如果它能完成任务,没有人会怀疑! 这就是为什么它是如此有趣的原因。

You can also press TAB to see the VRAM visualized as well as textures and color lookup tables which is super interesting!

您还可以按TAB键查看可视化的VRAM以及纹理和颜色查找表,这非常有趣!

Visualizing VRAM

One day, some day, there will be no physical hardware in existence for some of these old/classic consoles. Even today, lots of people play games for NES and SNES on a Nintendo Switch and may never see or touch the original hardware. It's important to support emulation development and sites like archive.org with Donations to make sure that history is preserved!

有一天,某些旧的/经典的控制台将不存在物理硬件。 即使在今天,仍然有很多人在Nintendo Switch上玩NES和SNES的游戏,可能永远看不到或触摸原始硬件。 重要的是要通过捐赠来支持仿真开发和诸如archive.org之类的网站,以确保保留历史记录!

NOTE: It's also worth pointing out that it took me about 15 minutes to port this from .NET Framework 4.7.2 to .NET Core 3.0. More on this, perhaps, in another post. I'll also do a benchmark and see if it's faster.

注意:还值得指出的是,我花了大约15分钟才能将其从.NET Framework 4.7.2移植到.NET Core 3.0。 也许更多在另一篇文章中。 我还将做一个基准测试,看看它是否更快。

I encourage you to go give a Github Star to ProjectPSX and enjoy reading this interesting bit of code. You can also read about the PSX Hardware written by Martin Korth for a trove of knowledge.

我鼓励您去给Github Star给ProjectPSX并喜欢阅读这段有趣的代码。 您还可以阅读有关Martin Korth编写的PSX硬件的知识,以获取大量知识

Sponsor: Develop Xamarin applications without difficulty with the latest JetBrains Rider: Xcode integration, JetBrains Xamarin SDK, and manage the required SDKs for Android development, all right from the IDE. Get it today

赞助商:使用最新的JetBrains Rider:Xcode集成,JetBrains Xamarin SDK轻松开发Xamarin应用程序,并直接从IDE管理Android开发所需的SDK。 立即获取

翻译自: https://www.hanselman.com/blog/emulating-a-playstation-1-psx-entirely-with-c-and-net

beetle psx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值