Shared implementation of VerifyBaseAddr()
This commit is contained in:
parent
3be54d4569
commit
cd62ac9cc1
|
@ -263,6 +263,7 @@ file (GLOB CXBXR_SOURCE_EMU
|
||||||
"${CXBXR_KRNL_CPP}"
|
"${CXBXR_KRNL_CPP}"
|
||||||
"${CXBXR_ROOT_DIR}/HighPerformanceGraphicsEnabler.c"
|
"${CXBXR_ROOT_DIR}/HighPerformanceGraphicsEnabler.c"
|
||||||
"${CXBXR_ROOT_DIR}/src/common/AddressRanges.cpp"
|
"${CXBXR_ROOT_DIR}/src/common/AddressRanges.cpp"
|
||||||
|
"${CXBXR_ROOT_DIR}/src/common/VerifyAddressRanges.cpp"
|
||||||
"${CXBXR_ROOT_DIR}/src/common/util/gloffscreen/glextensions.cpp"
|
"${CXBXR_ROOT_DIR}/src/common/util/gloffscreen/glextensions.cpp"
|
||||||
"${CXBXR_ROOT_DIR}/src/common/util/gloffscreen/gloffscreen_common.cpp"
|
"${CXBXR_ROOT_DIR}/src/common/util/gloffscreen/gloffscreen_common.cpp"
|
||||||
"${CXBXR_ROOT_DIR}/src/common/util/gloffscreen/gloffscreen_wgl.cpp"
|
"${CXBXR_ROOT_DIR}/src/common/util/gloffscreen/gloffscreen_wgl.cpp"
|
||||||
|
|
|
@ -35,6 +35,15 @@
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
|
|
||||||
#include "AddressRanges.h"
|
#include "AddressRanges.h"
|
||||||
|
#include "core\kernel\init\CxbxKrnl.h" // For CXBX_BASE_ADDR
|
||||||
|
|
||||||
|
bool VerifyBaseAddr()
|
||||||
|
{
|
||||||
|
/*! CXBX_BASE_ADDR is defined as 0x00010000, which is the base address of
|
||||||
|
the CxbxLoader.exe host executable.
|
||||||
|
Set in CxbxLoader.exe Project options, Linker, Advanced, Base Address */
|
||||||
|
return ((UINT_PTR)GetModuleHandle(nullptr) == CXBX_BASE_ADDR);
|
||||||
|
}
|
||||||
|
|
||||||
// This array keeps track of which ranges have successfully been reserved.
|
// This array keeps track of which ranges have successfully been reserved.
|
||||||
struct {
|
struct {
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
extern bool VerifyBaseAddr();
|
||||||
|
|
||||||
// TODO : extern ReservedRanges[];
|
// TODO : extern ReservedRanges[];
|
||||||
extern int ReservedRangeCount;
|
extern int ReservedRangeCount;
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,7 @@
|
||||||
// CxbxEmulator.cpp : Defines the exported functions for the DLL application.
|
// CxbxEmulator.cpp : Defines the exported functions for the DLL application.
|
||||||
|
|
||||||
#include "Cxbx.h" // For FUNC_EXPORTS
|
#include "Cxbx.h" // For FUNC_EXPORTS
|
||||||
#include "VerifyAddressRanges.h"
|
#include "VerifyAddressRanges.h" // For VerifyBaseAddr() and VerifyAddressRanges()
|
||||||
#include "core\kernel\init\CxbxKrnl.h" // For CXBX_BASE_ADDR
|
|
||||||
//#include "CxbxKrnl/Emu.h"
|
//#include "CxbxKrnl/Emu.h"
|
||||||
#include "EmuShared.h"
|
#include "EmuShared.h"
|
||||||
//#include <commctrl.h>
|
//#include <commctrl.h>
|
||||||
|
@ -132,10 +131,7 @@ DWORD WINAPI Emulate(int system)
|
||||||
FUNC_EXPORTS
|
FUNC_EXPORTS
|
||||||
|
|
||||||
/*! Verify our host executable, CxbxLoader.exe, is loaded to base address 0x00010000 */
|
/*! Verify our host executable, CxbxLoader.exe, is loaded to base address 0x00010000 */
|
||||||
if ((UINT_PTR)GetModuleHandle(nullptr) != CXBX_BASE_ADDR) {
|
if (!VerifyBaseAddr()) {
|
||||||
/*! CXBX_BASE_ADDR is defined as 0x00010000, which is the base address of
|
|
||||||
the CxbxLoader.exe host executable.
|
|
||||||
Set in CxbxLoader.exe Project options, Linker, Advanced, Base Address */
|
|
||||||
MessageBox(NULL, "CxbxLoader.exe was not loaded to base address 0x00010000 (which is a requirement for Xbox emulation)", "Cxbx-Reloaded", MB_OK);
|
MessageBox(NULL, "CxbxLoader.exe was not loaded to base address 0x00010000 (which is a requirement for Xbox emulation)", "Cxbx-Reloaded", MB_OK);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "WndMain.h"
|
#include "WndMain.h"
|
||||||
|
|
||||||
#include "AddressRanges.h" // For VerifyWow64()
|
#include "AddressRanges.h" // For VerifyWow64()
|
||||||
|
#include "VerifyAddressRanges.h" // For VerifyBaseAddr()
|
||||||
#include "core\kernel\init\CxbxKrnl.h"
|
#include "core\kernel\init\CxbxKrnl.h"
|
||||||
#include "core\kernel\support\Emu.h"
|
#include "core\kernel\support\Emu.h"
|
||||||
#include "EmuShared.h"
|
#include "EmuShared.h"
|
||||||
|
@ -52,18 +53,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CXBX_LOADER
|
|
||||||
/*! verify Cxbx.exe is loaded to base address 0x00010000 */
|
/*! verify Cxbx.exe is loaded to base address 0x00010000 */
|
||||||
if ((UINT_PTR)GetModuleHandle(nullptr) != CXBX_BASE_ADDR)
|
if (!VerifyBaseAddr()) {
|
||||||
{
|
|
||||||
/*! CXBX_BASE_ADDR is defined as 0x00010000, which is the base address of
|
|
||||||
the Cxbx.exe host executable.
|
|
||||||
Set in Cxbx Project options, Linker, Advanced, Base Address */
|
|
||||||
MessageBox(NULL, "Cxbx.exe is not loaded to base address 0x00010000 (which is a requirement for Xbox emulation)", "Cxbx-Reloaded",
|
MessageBox(NULL, "Cxbx.exe is not loaded to base address 0x00010000 (which is a requirement for Xbox emulation)", "Cxbx-Reloaded",
|
||||||
MB_OK | MB_ICONERROR);
|
MB_OK | MB_ICONERROR);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool bRet, bKernel;
|
bool bRet, bKernel;
|
||||||
HWND hWnd = nullptr;
|
HWND hWnd = nullptr;
|
||||||
|
|
Loading…
Reference in New Issue