» 您尚未登录:请 登录 | 注册 | 标签 | 帮助 | 小黑屋 |


发新话题
打印

[专题讨论] 模拟器硬核研究系列1:Xbox初代很难模拟

Originally Posted by blueshogun96
"Xbox is just like a PC, it's easy to emulate!"
“Xbox就像PC,很容易模拟!”

Yes, we've all heard this silly and pointless argument a million times and it usually ends in the same, and rather ignorant conclusion (or should I say assumption) that just because the Xbox is PC similar, it's hardware should be relatively easy to emulate. That's a very wrong frame of mind. How hard can it be? Very. Xbox's hardware is very complex and still poorly documented to this day. This requires some explanation.
是的,我们都听过无数次这种愚蠢的、毫无意义的争论,它通常以相同的、相当无知的结论(或者我应该说是假设)结束,即仅仅因为Xbox与PC相似,它的硬件应该相对容易模拟。那是一种非常错误的心态。有多难?非常难。Xbox的硬件非常复杂,至今仍缺乏文档记录。这需要一些解释。

1. Is a PC easy to emulate? Well, I wouldn't say so myself. Take a look at the source code from bochs. A lot of source code/work isn't it?
1.PC容易模拟吗?好的,我自己也不会这么说。看看bochs的源代码。很多源代码/工作不是吗?

2. Emulating an x86 CPU is a lot harder than it sounds. I don't know where this mindless assumption comes from. Yes, there's loads of documentation on how the x86 processor works, but that doesn't exactly make it easy. First of all, the x86 instruction set is M-A-S-S-I-V-E! There can be at least 20 different versions of one instruction (i.e. There are many different versions of the MOV instruction, as well as INC, DEC, ADD, SUB, SHR, SHL, AND, OR, XOR etc.) and it takes time to implement them all. Of course, that's not exactly difficult. The real problem is that any modern x86 processor including the Pentium III can execute multiple instructions at once. So it's not like emulating a Z80 doing one instruction at a time. The actual algorithm and how x86 does this is undocumented and still unknown. In short, the Xbox's CPU can be emulated, but not accurately.
2.模拟x86 CPU要比听起来困难得多。我不知道这种愚蠢的假设从何而来。是的,有大量关于x86处理器工作原理的文档,但这并不能让它变得简单。首先,x86指令集非常庞大!一条指令至少可以有20个不同的版本(例如有许多不同版本的MOV指令,以及INC、DEC、ADD、SUB、SHR、SHL和OR、XOR等也一样),实现它们都需要时间。当然,这并不难。真正的问题是,包括奔腾III在内的任何现代x86处理器都可以一次执行多条指令。所以这不像是模拟Z80一次只执行一条指令。实际的算法和x86是如何做到这一点是没有文档记录且仍然是未知的。简而言之,Xbox的CPU可以被模拟,但并不精确。

3. Emulating any hardware by NVIDIA is not a walk in the park! The Xbox's GPU, the NV2A is often assumed just a GeForce 3. It's not! It's similar but not identical. It has some GeForce 4 capabilities too, so it's more of a cross between an NV20 and NV25. This is by no means easy to emulate either. NVIDIA's GPUs have very large register sets and afaik not even half of them have been discovered, and a large portion of known registers have unknown purposes. There is little to no documentation on how NVIDIA GPUs work. The best thing to do is to look at similar GPUs such as RIVA, TNT, and older GeForce cards. Some registers are similar, but not identical. The best place to look for information is in open source drivers available on the net. Adding to the dificulty is that no one has ever discovered how pixel shaders work on NV2x cards, vertex shaders yes though. The Xbox GPU also has exclusive registers that are not found in other GeForce cards. Information on the NV2A's GPU registers are just now beginning to be discovered a few months ago. And yet, there's still a long way to go. The GeForce 3 series is the most mysterious of all NVIDIA GPUs (G7x and G8x aside) and the NV2A is alot worse. "But can't you just directly execute the NV2A instructions on another NVIDIA card?". No, I get alot of questions concerning this, and it is impossible. It's MMIO addresses are different and the exclusive registers must be emulated. Plus, in windows, we don't have ring 0 access anyway, so you all can scratch that idea now. Then comes the NForce 2 chipset. This is where it get easier. The NVIDIA MCPX is the control center for things such as audio, USB for input, Network adapters, PCI, AGP, etc. These things are not really that difficult to emulate IMO except for the audio.
3.模拟NVIDIA的任何硬件都不是在公园里散步!在Xbox的GPU上,NV2A通常被认为只是一个GeForce3。事实并非如此!相似但不完全相同。它也有一些GeForce 4的功能,所以它更像是NV20和NV25之间的过渡。这也绝非容易模拟。NVIDIA的GPU有非常大的寄存器集,而且据我所知甚至一半的寄存器集没有发现,同时大部分已知寄存器的用途未知。关于NVIDIA GPU如何工作的文档很少甚至没有。最好的办法是查看类似的GPU,如RIVA、TNT和旧的GeForce显卡。有些寄存器类似,但不完全相同。查找信息的最佳位置是网络上提供的开源驱动程序。更困难的是,从来没有人发现像素着色器如何在NV2x显卡上工作,顶点着色器也是。Xbox GPU还拥有其他GeForce显卡中找不到的独有寄存器。关于NV2A的GPU寄存器的信息在几个月前刚刚开始被发现。然而,还有很长的路要走。GeForce 3系列是所有NVIDIA GPU(G7x和G8x除外)中最神秘的,而NV2A则更糟糕。”但是你不能直接在另一个NVIDIA显卡上执行NV2A指令吗?”。不,我有很多关于这个的问题,这是不可能的。它的MMIO地址是不同的,且必须模拟独有寄存器。另外,在windows中,我们没有0级环访问权限,所以你们现在都可以放弃这个想法了。然后是NForce 2芯片组。这就容易了。NVIDIA MCPX是音频、USB输入、网络适配器、PCI、AGP等的控制中心。依我看来这些东西其实并不难模拟,除了音频。

4. The Audio system is rather complex. Xbox's audio consists of at least 4 DSPs, and audio codec (AC '97) and an NVIDIA SoundStorm APU. The DSPs shouldn't be a problem (just figuring out what they all are is) nor should the AC '97 but the NVIDIA SoundStorm APU is the really difficult part. So far I haven't found any information on this thing, but right now, it's relevance is low.
4.音频系统比较复杂。Xbox的音频至少由4个DSP、和音频编解码器(AC'97)和一个NVIDIA SoundStorm APU组成。DSP不应该是一个问题(只是弄清楚他们都是什么),AC '97也不是,但 NVIDIA SoundStorm APU是真正困难的部分。到目前为止,我还没有找到任何关于这东西的信息,但现在,它的重要性很低。

5. The Xbox BIOS isn't fully understood. The basic execution process of the BIOS is understood, but details on the process are at a loss. What we do know gives us hints, but before the BIOS can be emulated, we'll need a better understanding of the Xbox hardware layout because the BIOS does some unknown hardware initialization at boot time and writes to the hardware directly without using any XDK stuff. It will take some time, and effort, but I'll eventually get it working.
5.Xbox BIOS还没有完全理解。BIOS的基本执行过程是可以理解的,但是关于这个过程的细节是不清楚的。我们所知道的给了我们一些提示,但是在模拟BIOS之前,我们需要更好地了解Xbox的硬件布局,因为BIOS在引导时会进行一些未知的硬件初始化,并且不使用任何XDK的东西直接写入硬件。这将需要一些时间和努力,但我最终会让它工作的。

6. Video Encoder "Hell". Instead of using a RAMDAC for video output, the Xbox uses a Video Encoder. What makes this suck a pain? Microsoft sought the need to change the video encoder every other Xbox version (there are seven in all, 1.0 - 1.6). Why, I dunno, it's a Microsoft thing, they always tend to try to "fix" things that aren't broken >.> AFAIK, there are at least 3 different Video Encoders used: Conexant CX25871, Focus FS454, and Xcalibur. For more information in Xbox video encoders, click here. Emulating all three video encoders is only less than half the battle, the real problem is that BIOSes can be specifically tied to a specific encoder depending on it's version (don't quote me on this though). Like PS2, every Xbox model revision has a updated BIOS and has different expectations. This is a potential problem, but not exactly major.
6.视频编码器“地狱”。Xbox没有使用RAMDAC进行视频输出,而是使用视频编码器。是什么让这很痛苦?微软谋求每隔一个Xbox版本(总共有7个版本,1.0-1.6)就需要更换一次视频编码器。为什么,我不知道,这是一个微软的东西,他们总是试图“修复”没有损坏的东西。据我所知,至少有3种不同的视频编码器被使用:Conexant CX25871,Focus FS454,和Xcalibur。有关Xbox视频编码器的更多信息,请单击此处。模拟所有三个视频编码器只不过是不到一半的战斗,真正的问题是,BIOS可以根据它的版本特别绑定到特定的编码器(不要引用我的这个想法)。像PS2一样,每一个Xbox型号的修订版都有一个更新的BIOS,并有不同的预期。这是一个潜在的问题,但并不严重。

Basically, I'm trying to get this "Xbox should be easy to emulate because it's just like a PC" crap out of your heads. I'm sure that most of you will disagree with me on this, but for these reasons and more, on a low level, Xbox is harder to emulate than PS2.
基本上,我是想让这个“Xbox应该很容易模拟,因为它就像一台PC”的废话从你的脑海里消失。我相信你们中的大多数人都会不同意我的观点,但由于这些原因,在低层次上,Xbox比PS2更难模仿。

The exception to that above is that the NV2A is much better documented now, but not fully. There's an open source library for the OpenXDK called pbKit. It interfaces directly with the hardware to fully expose it's potential. This is what Microsoft should have done all along (or at least wrote a low-level OpenGL implementation).
例外的是,现在对于上文NV2A有更好的文档记录,但不完全。OpenXDK有一个名为pbKit的开源库。它直接与硬件连接,以充分暴露其潜力。这是微软一直以来应该做的(或者至少写一个低级的OpenGL实现)。


TOP

发新话题
     
官方公众号及微博