From 4323be7c3c04688760af246125637d32d84977fd Mon Sep 17 00:00:00 2001 From: Margen67 Date: Mon, 13 May 2019 18:30:11 -0700 Subject: [PATCH] Updated Cxbx Reloaded overview (markdown) --- Cxbx-Reloaded-overview.md | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/Cxbx-Reloaded-overview.md b/Cxbx-Reloaded-overview.md index b1074a9..50174fb 100644 --- a/Cxbx-Reloaded-overview.md +++ b/Cxbx-Reloaded-overview.md @@ -1,14 +1,14 @@ -Here some technical details on how Cxbx-Reloaded works. +Here's some technical details on how Cxbx-Reloaded works. # Executable launch modes Cxbx-Reloaded is a single executable which operates in two different modes: 1. If launched normally (without any command-line arguments), it will show a user-interface then wait for user inputs. - * However, if drag and drop an xbe file on top of executable. It will automatic run xbe file. + * However, if you drag and drop an xbe file on top of the executable, it will automatic run said xbe file. 2. To emulate Xbox software, Cxbx-Reloaded relaunches itself (with the path to the Xbox executable to run on the command-line). The emulated Xbox screen is then put over the user-interface. At the end of emulation, the second instance terminates and the user-interface reappears. - * If want to start standalone emulation. Then the following argument should be input `> cxbx.exe /load "path to xbe"` via command prompt. + * If you want to start standalone emulation, than the following argument should be input `cxbx.exe /load "path to xbe"` via command prompt. If another process launches Cxbx-Reloaded (for instance, a user starts a shortcut via Windows Explorer) with a command-line argument, there's no parent process, so when emulation ends in this scenario, the Cxbx-Reloaded process terminates entirely. @@ -22,26 +22,26 @@ Cxbx-Reloaded currently runs on 64-bit Windows 7 and up. ## CPU 'emulation' Cxbx-Reloaded emulates the Xbox using direct code execution. -This means most of the CPU instructions the Xbox would execute, are executed directly on the host machine, without any modification or interpretation. +This means most of the CPU instructions the Xbox would execute are executed directly on the host machine without any modification or interpretation. _This restricts running Cxbx-Reloaded to CPU's that are compatible with the Xbox Pentium 3 Coppermine CPU!_ The advantage of this approach is that Cxbx doesn't need to emulate the CPU at all, and offers native, 'faster-than-real-hardware' emulation speeds. Admittedly, executing Xbox code as-is does bring with it a few complexities: -* some opcodes are prohibited to be executed in user-mode on Windows +* Some opcodes are prohibited to be executed in user-mode on Windows * IN/OUT opcodes must be emulated * CPU-specific opcodes (like CPUID) still need to be emulated -* the FS segment layout differs between Xbox and Windows -* mapping physical to virtual addresses (using the MMU) isn't allowed +* The FS segment layout differs between Xbox and Windows +* Mapping physical to virtual addresses using the MMU isn't allowed (More on this later, under _[Hardware accesses](#hardware-accesses)_ and _[Contiguous memory](#contiguous-memory)_.) ## Xbox Kernel (BIOS) Cxbx-Reloaded contains it's own implementation of the Xbox kernel, which means there's no need to acquire a dump from your Xbox. -In it's current form, the Cxbx-Reloaded kernel forwards many of the 378 kernel API's towards the host Windows kernel API's. +In it's current form, the Cxbx-Reloaded kernel forwards many of the 378 kernel APIs towards the host Windows kernel APIs. -__This restricts running Cxbx-Reloaded to operating systems that contain the Win32 API's, so far Windows only!__ +__This restricts running Cxbx-Reloaded to operating systems that contain the Win32 APIs, so far Windows only!__ Because many of the kernel API's are just forwards, some aspects of the Xbox kernel are not emulated well enough. @@ -71,7 +71,7 @@ APU and JIT LLE are disabled due to being unimplemented. For now, Cxbx-Reloaded only reliably supports HLE and LLE GPU. ## Emulating Xbox memory layout -Cxbx-Reloaded emulates the Xbox memory layout using a trick that allows so-called 'fast path' memory access, by mimicking the memory layout of the Xbox on the host OS. +Cxbx-Reloaded emulates the Xbox memory layout using a trick that allows 'fast path' memory access by mimicking the memory layout of the Xbox on the host OS. This involves the following steps: @@ -87,20 +87,18 @@ The downside to this is that the Cxbx-Reloaded is quite big (more than 67 MiB cu Since Cxbx-Reloaded launches itself a second time for actual emulation, memory-requirements on the host are doubled to at least 256 MiB of memory. -Expect swapping when the host has less than 1 GiB of physical memory installed. - ## Hardware accesses Most Xbox hardware is mapped from 0xF0000000 to 0xFFFFFFFF. -Cxbx-Reloaded reserves this memory-region using so-called 'guard-pages' which guarantees this memory range isn't used for anything else, and causes so-called access violations (or more accurately, guard-page exceptions). +Cxbx-Reloaded reserves this memory-region using so-called 'guard-pages' which guarantees this memory range isn't used for anything else, and causes so-called access violations,or more accurately, guard-page exceptions. -When Cxbx-Reloaded emulates an Xbox instruction that accesses a hardware component (reading or writing to one of the MMIO memory-addresses), this access is trapped using a so-called 'exception handler'. +When Cxbx-Reloaded emulates an Xbox instruction that accesses a hardware component (reading or writing to one of the MMIO memory-addresses), this access is trapped using an 'exception handler'. This allows us to capture and emulate hardware accesses that aren't present on the host. When Cxbx-Reloaded operates entirely in HLE mode which is the current default, most if not all hardware accesses are prevented entirely. -So normally, this is mostly a moot point, and you won't see slow-down in emulation because of this. +Normally, this is mostly a moot point, and you won't see slow-down in emulation because of this. However, when it happens, exception handling is slow, as it incurs a context-switch (storing and restoring the entire state of a thread) and has to figure out which address needs which handling. @@ -133,11 +131,11 @@ Xbox renders using the Nvidia NV2A GPU. Most software written for the Xbox was developed with some version of the official "Xbox Development Kit" (XDK for short), which offered Direct3D 8 like features. -Therefore, Cxbx-Reloaded uses Direct3D 8.1 as its rendering API, although it's planned to port to Direct3D 9 (for HLE) and OpenGL (for LLE). +Therefore, Cxbx-Reloaded uses Direct3D 9 as its rendering API. Vulkan is currently not under consideration. -Some features the NV2A offered are unavailable on Direct3D 8 or even 9, so for those Cxbx-Reloaded tries to convert it to be host-compatible. +Some features the NV2A offered are unavailable on Direct3D 8 and 9; For those Cxbx-Reloaded tries to convert it to be host-compatible. For example, some texture-formats like P8, R8B8 and others are not available on host Direct3D, and are thus converted into ARGB, the most widely supported texture format.