use enum class for XbeType to resolve warnings
This commit is contained in:
parent
55f84cd67e
commit
897bc182f8
|
@ -816,13 +816,13 @@ XbeType Xbe::GetXbeType()
|
|||
// Detect if the XBE is for Chihiro (Untested!) :
|
||||
// This is based on https://github.com/radare/radare2/blob/master/libr/bin/p/bin_xbe.c#L45
|
||||
if ((m_Header.dwEntryAddr & 0xf0000000) == 0x40000000)
|
||||
return xtChihiro;
|
||||
return XbeType::xtChihiro;
|
||||
|
||||
// Check for Debug XBE, using high bit of the kernel thunk address :
|
||||
// (DO NOT test like https://github.com/radare/radare2/blob/master/libr/bin/p/bin_xbe.c#L49 !)
|
||||
if ((m_Header.dwKernelImageThunkAddr & 0x80000000) > 0)
|
||||
return xtDebug;
|
||||
return XbeType::xtDebug;
|
||||
|
||||
// Otherwise, the XBE is a Retail build :
|
||||
return xtRetail;
|
||||
return XbeType::xtRetail;
|
||||
}
|
||||
|
|
|
@ -48,11 +48,11 @@ const char* GetSystemTypeToStr(unsigned int system)
|
|||
|
||||
const char* GetXbeTypeToStr(XbeType xbe_type)
|
||||
{
|
||||
if (xbe_type == xtChihiro) {
|
||||
if (xbe_type == XbeType::xtChihiro) {
|
||||
return "chihiro";
|
||||
}
|
||||
|
||||
if (xbe_type == xtDebug) {
|
||||
if (xbe_type == XbeType::xtDebug) {
|
||||
return "debug";
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#pragma once
|
||||
|
||||
/*! type of Xbe */
|
||||
enum XbeType { xtRetail, xtDebug, xtChihiro };
|
||||
enum class XbeType { xtRetail, xtDebug, xtChihiro };
|
||||
|
||||
const char* GetSystemTypeToStr(unsigned int system);
|
||||
|
||||
|
|
|
@ -1000,7 +1000,7 @@ void CxbxKrnlEmulate(unsigned int reserved_systems, uint32_t blocks_reserved[384
|
|||
|
||||
// Now we can load and run the XBE :
|
||||
// MapAndRunXBE(XbePath, DCHandle);
|
||||
XbeType xbeType = xtRetail;
|
||||
XbeType xbeType = XbeType::xtRetail;
|
||||
{
|
||||
// NOTE: This is a safety to clean the file path for any malicious file path attempt.
|
||||
// Might want to move this into a utility function.
|
||||
|
@ -1063,15 +1063,15 @@ void CxbxKrnlEmulate(unsigned int reserved_systems, uint32_t blocks_reserved[384
|
|||
// If CLI has given console type, then enforce it.
|
||||
if (cli_config::hasKey(cli_config::system_chihiro)) {
|
||||
EmuLogInit(LOG_LEVEL::INFO, "Auto detect is disabled, running as chihiro.");
|
||||
xbeType = xtChihiro;
|
||||
xbeType = XbeType::xtChihiro;
|
||||
}
|
||||
else if (cli_config::hasKey(cli_config::system_devkit)) {
|
||||
EmuLogInit(LOG_LEVEL::INFO, "Auto detect is disabled, running as devkit.");
|
||||
xbeType = xtDebug;
|
||||
xbeType = XbeType::xtDebug;
|
||||
}
|
||||
else if (cli_config::hasKey(cli_config::system_retail)) {
|
||||
EmuLogInit(LOG_LEVEL::INFO, "Auto detect is disabled, running as retail.");
|
||||
xbeType = xtRetail;
|
||||
xbeType = XbeType::xtRetail;
|
||||
}
|
||||
// Otherwise, use auto detect method.
|
||||
else {
|
||||
|
@ -1083,13 +1083,13 @@ void CxbxKrnlEmulate(unsigned int reserved_systems, uint32_t blocks_reserved[384
|
|||
EmuLogInit(LOG_LEVEL::INFO, "Host's compatible system types: %2X", reserved_systems);
|
||||
unsigned int emulate_system = 0;
|
||||
// Set reserved_systems which system we will about to emulate.
|
||||
if (isSystemFlagSupport(reserved_systems, SYSTEM_CHIHIRO) && xbeType == xtChihiro) {
|
||||
if (isSystemFlagSupport(reserved_systems, SYSTEM_CHIHIRO) && xbeType == XbeType::xtChihiro) {
|
||||
emulate_system = SYSTEM_CHIHIRO;
|
||||
}
|
||||
else if (isSystemFlagSupport(reserved_systems, SYSTEM_DEVKIT) && xbeType == xtDebug) {
|
||||
else if (isSystemFlagSupport(reserved_systems, SYSTEM_DEVKIT) && xbeType == XbeType::xtDebug) {
|
||||
emulate_system = SYSTEM_DEVKIT;
|
||||
}
|
||||
else if (isSystemFlagSupport(reserved_systems, SYSTEM_XBOX) && xbeType == xtRetail) {
|
||||
else if (isSystemFlagSupport(reserved_systems, SYSTEM_XBOX) && xbeType == XbeType::xtRetail) {
|
||||
emulate_system = SYSTEM_XBOX;
|
||||
}
|
||||
// If none of system type requested to emulate isn't supported on host's end. Then enforce failure.
|
||||
|
@ -1107,9 +1107,9 @@ void CxbxKrnlEmulate(unsigned int reserved_systems, uint32_t blocks_reserved[384
|
|||
}
|
||||
|
||||
// Register if we're running an Chihiro executable or a debug xbe, otherwise it's an Xbox retail executable
|
||||
g_bIsChihiro = (xbeType == xtChihiro);
|
||||
g_bIsDebug = (xbeType == xtDebug);
|
||||
g_bIsRetail = (xbeType == xtRetail);
|
||||
g_bIsChihiro = (xbeType == XbeType::xtChihiro);
|
||||
g_bIsDebug = (xbeType == XbeType::xtDebug);
|
||||
g_bIsRetail = (xbeType == XbeType::xtRetail);
|
||||
|
||||
// Disabled: The media board rom fails to run because it REQUIRES LLE USB, which is not yet enabled.
|
||||
// Chihiro games can be ran directly for now.
|
||||
|
@ -1189,7 +1189,7 @@ void CxbxKrnlEmulate(unsigned int reserved_systems, uint32_t blocks_reserved[384
|
|||
|
||||
// Decode kernel thunk table address :
|
||||
uint32_t kt = CxbxKrnl_Xbe->m_Header.dwKernelImageThunkAddr;
|
||||
kt ^= XOR_KT_KEY[xbeType];
|
||||
kt ^= XOR_KT_KEY[to_underlying(xbeType)];
|
||||
|
||||
// Process the Kernel thunk table to map Kernel function calls to their actual address :
|
||||
MapThunkTable((uint32_t*)kt, CxbxKrnl_KernelThunkTable);
|
||||
|
@ -1206,7 +1206,7 @@ void CxbxKrnlEmulate(unsigned int reserved_systems, uint32_t blocks_reserved[384
|
|||
void* XbeTlsData = (XbeTls != nullptr) ? (void*)CxbxKrnl_Xbe->m_TLS->dwDataStartAddr : nullptr;
|
||||
// Decode Entry Point
|
||||
xbaddr EntryPoint = CxbxKrnl_Xbe->m_Header.dwEntryAddr;
|
||||
EntryPoint ^= XOR_EP_KEY[xbeType];
|
||||
EntryPoint ^= XOR_EP_KEY[to_underlying(xbeType)];
|
||||
// Launch XBE
|
||||
CxbxKrnlInit(
|
||||
XbeTlsData,
|
||||
|
|
Loading…
Reference in New Issue