Loader : Fix typos and avoid Microsoft compiler specific types

This commit is contained in:
PatrickvL 2019-02-12 15:06:16 +01:00 committed by RadWolfie
parent affc999d70
commit c4f9821c6a
5 changed files with 15 additions and 8 deletions

View File

@ -26,6 +26,8 @@
// ******************************************************************
#pragma once
#include <cstdint> // 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 <SDKDDKVer.h>
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
@ -49,9 +51,9 @@ const int PAGE_SIZE = KB(4);
static_cast<size_t>(!(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
};

View File

@ -25,12 +25,14 @@
// *
// ******************************************************************
#include <cstdint> // 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;

View File

@ -33,7 +33,7 @@
#include <memory.h>
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,

View File

@ -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;

View File

@ -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;