diff --git a/src/common/AddressRanges.h b/src/common/AddressRanges.h index e1eb4b55d..297b9f65d 100644 --- a/src/common/AddressRanges.h +++ b/src/common/AddressRanges.h @@ -26,6 +26,8 @@ // ****************************************************************** #pragma once +#include // For uint32_t + #ifndef CXBXR_EMU_EXPORTS // Only trim Windows symbols in cxbxr-ldr.exe, not in cxbxr-emu.dll (TODO : What about cxbxr.exe and cxbx.exe?) #include #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers @@ -49,9 +51,9 @@ const int PAGE_SIZE = KB(4); static_cast(!(sizeof(a) % sizeof(*(a))))) const struct { - unsigned __int32 Start; + uint32_t Start; #ifdef DEBUG - unsigned __int32 End; // TODO : Add validation that this End corresponds to specified Size + uint32_t End; // TODO : Add validation that this End corresponds to specified Size #endif int Size; DWORD InitialMemoryProtection; // Memory page protection, for use by VirtualAlloc @@ -61,7 +63,7 @@ const struct { #define PROT_XRW PAGE_EXECUTE_READWRITE #define PROT_NAC PAGE_NOACCESS - unsigned int RangeFlags; + int RangeFlags; // Range flags (used for system selection and optional marker) #define MAY_FAIL (1 << 0) // Optional (may fail address range reservation) #define SYSTEM_XBOX (1 << 1) @@ -102,8 +104,11 @@ const struct { RANGE_ENTRY(0xFF400000, 0xFF7FFFFF, MB( 4), PROT_NAC, SYSTEM_ALL , "DeviceFlash_b (Flash mirror 2)"), RANGE_ENTRY(0xFF800000, 0xFFBFFFFF, MB( 4), PROT_NAC, SYSTEM_ALL , "DeviceFlash_c (Flash mirror 3)"), RANGE_ENTRY(0xFFC00000, 0xFFFFFFFF, MB( 4), PROT_NAC, SYSTEM_ALL | MAY_FAIL, "DeviceFlash_d (Flash mirror 4) Optional (will probably fail reservation, which is acceptable - the 3 other mirrors work just fine"), + /* This region is only relevant if we were running the original Xbox boot sequence (including MCPX), + so it's completely redundant to use it: By the time the Kernel has started execution, this region is disabled + and cannot be re-enabled. Xbox software (and the kernel) have no access to this region whatsoever once 2BL has completed. RANGE_ENTRY(0xFFFFFE00, 0xFFFFFFFF, 512 , PROT_NAC, SYSTEM_RETAIL | MAY_FAIL, "DeviceMCPX (not Chihiro, Xbox - if enabled) Optional (can safely be ignored)"), - + */ #undef RANGE_ENTRY }; diff --git a/src/common/ReserveAddressRanges.cpp b/src/common/ReserveAddressRanges.cpp index 46c7ef442..2f3a8a38a 100644 --- a/src/common/ReserveAddressRanges.cpp +++ b/src/common/ReserveAddressRanges.cpp @@ -25,12 +25,14 @@ // * // ****************************************************************** +#include // For uint32_t + #include "AddressRanges.h" // Reserve an address range up to the extend of what the host allows. bool ReserveMemoryRange(int index) { - unsigned __int32 Start = XboxAddressRanges[index].Start; + uint32_t Start = XboxAddressRanges[index].Start; int Size = XboxAddressRanges[index].Size; bool HadAnyFailure = false; diff --git a/src/common/win32/EmuShared.h b/src/common/win32/EmuShared.h index eee4429d1..508617110 100644 --- a/src/common/win32/EmuShared.h +++ b/src/common/win32/EmuShared.h @@ -33,7 +33,7 @@ #include -extern HMODULE hActiveModule; // Equals EXE Module handle in (GUI) Cxbx.exe, equals DLL Module handle in Cxbx-Reloaded.dll +extern HMODULE hActiveModule; // Equals EXE Module handle in (GUI) Cxbx.exe / cxbxr.exe, equals DLL Module handle in cxbxr-emu.dll typedef enum _XBOX_LED_COLOUR: unsigned char { XBOX_LED_COLOUR_OFF, diff --git a/src/gui/WinMain.cpp b/src/gui/WinMain.cpp index a51bd45be..42cfcebfd 100644 --- a/src/gui/WinMain.cpp +++ b/src/gui/WinMain.cpp @@ -46,7 +46,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine hActiveModule = hInstance; // == GetModuleHandle(NULL); // Points to GUI (Cxbx.exe) ImageBase // First detect if we are running on WoW64, if not, prevent Cxbx-Reloaded from starting - // Cxbx-Relaoded needs access to high memory, only exposed to WoW64. + // Cxbx-Reloaded needs access to high memory, only exposed to WoW64. if (!VerifyWow64()) { CxbxShowError("Cxbx-Reloaded can only run under WoW64\nThis means either a 64-bit version of Windows or Wine with a 64-bit prefix"); return EXIT_FAILURE; diff --git a/src/loader/cxbxr-ldr.cpp b/src/loader/cxbxr-ldr.cpp index 8a40fdd05..9c9ba5906 100644 --- a/src/loader/cxbxr-ldr.cpp +++ b/src/loader/cxbxr-ldr.cpp @@ -107,7 +107,7 @@ DWORD CALLBACK rawMain() (void)virtual_memory_placeholder; // prevent optimization removing this data // First detect if we are running on WoW64, if not, prevent Cxbx-Reloaded from starting - // Cxbx-Relaoded needs access to high memory, only exposed to WoW64. + // Cxbx-Reloaded needs access to high memory, only exposed to WoW64. if (!VerifyWow64()) { OutputMessage("Cxbx-Reloaded can only run under WoW64\nThis means either a 64-bit version of Windows or Wine with a 64-bit prefix\n"); return ERROR_BAD_ENVIRONMENT;