implement toggle loader project in GUI

This commit is contained in:
RadWolfie 2019-10-13 13:01:54 -05:00
parent 380d93c03e
commit 7fca148bc6
12 changed files with 38 additions and 23 deletions

View File

@ -61,6 +61,7 @@ endif()
add_compile_definitions(
NOMINMAX
CXBXR_EMU
CXBXR_EMU_EXPORTS
)

View File

@ -25,6 +25,7 @@
#ifndef RESERVEDMEMORY_H
#define RESERVEDMEMORY_H
#ifndef CXBXR_EMU
#if defined(__cplusplus)
extern "C"
{
@ -49,5 +50,6 @@ unsigned char virtual_memory_placeholder[VM_PLACEHOLDER_SIZE]; // = { OPCODE_NOP
#if defined(__cplusplus)
}
#endif
#endif
#endif // RESERVEDMEMORY_H

View File

@ -89,6 +89,7 @@ static struct {
const char* AllowAdminPrivilege = "AllowAdminPrivilege";
const char* LoggedModules = "LoggedModules";
const char* LogLevel = "LogLevel";
const char* LoaderExperiment = "LoaderExperiment";
} sect_core_keys;
static const char* section_video = "video";
@ -350,6 +351,8 @@ bool Settings::LoadConfig()
index++;
}
m_core.loaderExperiment = m_si.GetBoolValue(section_core, sect_core_keys.LoaderExperiment, /*Default=*/false);
// ==== Core End ============
// ==== Hack Begin ==========
@ -525,6 +528,8 @@ bool Settings::Save(std::string file_path)
m_si.SetValue(section_core, sect_core_keys.LoggedModules, stream.str().c_str(), nullptr, false);
}
m_si.SetBoolValue(section_core, sect_core_keys.LoaderExperiment, m_core.loaderExperiment, nullptr, true);
// ==== Core End ============
// ==== Video Begin =========

View File

@ -97,7 +97,7 @@ public:
bool allowAdminPrivilege;
unsigned int LoggedModules[NUM_INTEGERS_LOG];
int LogLevel = 1;
bool Reserved2 = 0;
bool loaderExperiment;
bool Reserved3 = 0;
bool Reserved4 = 0;
int Reserved99[10] = { 0 };

View File

@ -191,7 +191,7 @@ class EmuShared : public Mutex
// ******************************************************************
void GetDebuggingFlag(bool *value) { Lock(); *value = m_bDebugging; Unlock(); }
void SetDebuggingFlag(const bool *value) { Lock(); m_bDebugging = *value; Unlock(); }
#ifndef CXBX_LOADER
#ifndef CXBX_LOADER // Temporary usage for cxbx.exe's emu
// ******************************************************************
// * Previous Memory Layout value Accessors
// ******************************************************************
@ -271,7 +271,7 @@ class EmuShared : public Mutex
bool m_bDebugging;
bool m_bReady_status;
bool m_bEmulating_status;
#ifndef CXBX_LOADER
#ifndef CXBX_LOADER // Temporary usage for cxbx.exe's emu
int m_PreviousMmLayout;
int m_Reserved7[3];
#else

View File

@ -938,7 +938,7 @@ void CxbxKrnlEmulate(uint32_t blocks_reserved[384])
return; // TODO : Halt(0);
}
#ifndef CXBX_LOADER
#ifndef CXBXR_EMU
// verify virtual_memory_placeholder is located at 0x00011000
if ((UINT_PTR)(&(virtual_memory_placeholder[0])) != (XBE_IMAGE_BASE + CXBX_BASE_OF_CODE))
{
@ -1095,7 +1095,7 @@ void CxbxKrnlEmulate(uint32_t blocks_reserved[384])
}
#endif
#ifndef CXBX_LOADER
#ifndef CXBXR_EMU
// Initialize the memory manager
uint32_t SystemDevBlocksReserved[384] = { 0 };
g_VMManager.Initialize(0, BootFlags, SystemDevBlocksReserved);

View File

@ -150,7 +150,7 @@ extern "C" {
// fit in 51 MB. If we ever encounter an even larger XBE, this
// value will have to be increased likewise (maybe up to 64 MB
// for XBOX_MEMORY_SIZE or even 128 MB for CHIHIRO_MEMORY_SIZE).
#ifdef CXBX_LOADER
#ifdef CXBXR_EMU
#define XBE_MAX_VA (128 * ONE_MB)
#else
#define XBE_MAX_VA (64 * ONE_MB)

View File

@ -41,7 +41,7 @@
#include "core\kernel\exports\EmuKrnl.h" // For InitializeListHead(), etc.
#include <assert.h>
// Temporary usage for need ReserveAddressRanges func with cxbx.exe's emulation.
#ifndef CXBX_LOADER
#ifndef CXBXR_EMU
#include "common/ReserveAddressRanges.h"
#endif
@ -60,7 +60,7 @@ bool VirtualMemoryArea::CanBeMergedWith(const VirtualMemoryArea& next) const
void VMManager::Initialize(int SystemType, int BootFlags, uint32_t blocks_reserved[384])
{
#ifndef CXBX_LOADER
#ifndef CXBXR_EMU
if ((BootFlags & BOOT_QUICK_REBOOT) == 0) {
SystemType = g_bIsRetail ? SYSTEM_XBOX : g_bIsChihiro ? SYSTEM_CHIHIRO : SYSTEM_DEVKIT; // TODO: Temporary placeholder until loader is functional.
g_EmuShared->SetMmLayout(&SystemType);

View File

@ -56,7 +56,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
return EXIT_FAILURE;
}
#ifndef CXBX_LOADER
#ifndef CXBXR_EMU
/*! verify Cxbx.exe is loaded to base address 0x00010000 */
if (!VerifyBaseAddr()) {
CxbxShowError("Cxbx.exe is not loaded to base address 0x00010000 (which is a requirement for Xbox emulation)");
@ -81,16 +81,14 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
}
if (cli_config::hasKey("load")) {
#ifndef CXBX_LOADER
#ifndef CXBXR_EMU
CxbxKrnlEmulate(nullptr);
EmuShared::Cleanup();
return EXIT_SUCCESS;
#else
if (!CxbxExec(false, nullptr, false)) {
CxbxShowError("Could not launch Cxbx-R loader!");
EmuShared::Cleanup();
return EXIT_FAILURE;
}
CxbxShowError("Emulation must be launched from cxbxr-ldr.exe!");
EmuShared::Cleanup();
return EXIT_FAILURE;
#endif
}

View File

@ -1754,6 +1754,9 @@ void WndMain::RefreshMenus()
//chk_flag = (g_Settings->m_core.FlagsLLE & LLE_USB) ? MF_CHECKED : MF_UNCHECKED; // Reenable this when LLE USB actually works
//CheckMenuItem(settings_menu, ID_EMULATION_LLE_USB, chk_flag);
chk_flag = g_Settings->m_core.loaderExperiment ? MF_CHECKED : MF_UNCHECKED;
CheckMenuItem(settings_menu, ID_EXPERIMENTAL_LOADERPROJECT, chk_flag);
chk_flag = (g_Settings->m_hacks.DisablePixelShaders) ? MF_CHECKED : MF_UNCHECKED;
CheckMenuItem(settings_menu, ID_HACKS_DISABLEPIXELSHADERS, chk_flag);
@ -2268,10 +2271,10 @@ void WndMain::StartEmulation(HWND hwndParent, DebuggerState LocalDebuggerState /
char szExeFileName[MAX_PATH];
GetModuleFileName(GetModuleHandle(nullptr), szExeFileName, MAX_PATH);
#ifdef CXBX_LOADER
PathRemoveFileSpec(szExeFileName);
PathAppend(szExeFileName, "\\cxbxr-ldr.exe");
#endif
if (g_Settings->m_core.loaderExperiment) {
PathRemoveFileSpec(szExeFileName);
PathAppend(szExeFileName, "\\cxbxr-ldr.exe");
}
bool AttachLocalDebugger = (LocalDebuggerState == debuggerOn);
g_EmuShared->SetDebuggingFlag(&AttachLocalDebugger);

View File

@ -661,9 +661,13 @@ BEGIN
MENUITEM "&Rescan title Symbol Cache", ID_CACHE_CLEARHLECACHE_CURRENT,MFT_STRING,MFS_ENABLED
END
MENUITEM "", -1, MFT_SEPARATOR
POPUP "&LLE (Experimental)", 65535,MFT_STRING,MFS_ENABLED
POPUP "Experimental", 65535,MFT_STRING,MFS_ENABLED
BEGIN
MENUITEM "LLE &GPU", ID_EMULATION_LLE_GPU,MFT_STRING,MFS_GRAYED
POPUP "&LLE", 65535,MFT_STRING,MFS_ENABLED
BEGIN
MENUITEM "LLE &GPU", ID_EMULATION_LLE_GPU,MFT_STRING,MFS_GRAYED
END
MENUITEM "Loader Project", ID_EXPERIMENTAL_LOADERPROJECT,MFT_STRING,MFS_GRAYED
END
POPUP "Hacks", 65535,MFT_STRING,MFS_ENABLED
BEGIN

View File

@ -362,6 +362,8 @@
#define ID_LOG 40110
#define ID_SETTINGS_CONFIG_NETWORK 40111
#define ID_SYNC_CONFIG_INPUT 40112
#define ID_SETTINGS_EXPERIMENTAL 40113
#define ID_EXPERIMENTAL_LOADERPROJECT 40114
#define IDC_STATIC -1
// Next default values for new objects
@ -369,8 +371,8 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 136
#define _APS_NEXT_COMMAND_VALUE 40113
#define _APS_NEXT_CONTROL_VALUE 1278
#define _APS_NEXT_COMMAND_VALUE 40115
#define _APS_NEXT_CONTROL_VALUE 1304
#define _APS_NEXT_SYMED_VALUE 109
#endif
#endif