DSPCore: Convert core type enum into an enum class

Prevents pollution of the surrounding scope and makes the values
strongly-typed.
This commit is contained in:
Lioncash 2018-06-15 07:54:21 -04:00
parent 58606702f7
commit 98af5e4c10
3 changed files with 9 additions and 9 deletions

View File

@ -170,7 +170,7 @@ bool DSPCore_Init(const DSPInitOptions& opts)
Common::WriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false);
// Initialize JIT, if necessary
if (opts.core_type == DSPInitOptions::CORE_JIT)
if (opts.core_type == DSPInitOptions::CoreType::JIT)
g_dsp_jit = std::make_unique<JIT::x64::DSPEmitter>();
g_dsp_cap.reset(opts.capture_logger);

View File

@ -329,19 +329,19 @@ struct DSPInitOptions
std::array<u16, DSP_COEF_SIZE> coef_contents;
// Core used to emulate the DSP.
// Default: CORE_JIT.
enum CoreType
// Default: JIT.
enum class CoreType
{
CORE_INTERPRETER,
CORE_JIT,
Interpreter,
JIT,
};
CoreType core_type;
CoreType core_type = CoreType::JIT;
// Optional capture logger used to log internal DSP data transfers.
// Default: dummy implementation, does nothing.
DSPCaptureLogger* capture_logger;
DSPInitOptions() : core_type(CORE_JIT), capture_logger(new DefaultDSPCaptureLogger()) {}
DSPInitOptions() : capture_logger(new DefaultDSPCaptureLogger()) {}
};
// Initializes the DSP emulator using the provided options. Takes ownership of

View File

@ -153,10 +153,10 @@ static bool FillDSPInitOptions(DSPInitOptions* opts)
if (!LoadDSPRom(opts->coef_contents.data(), coef_file, DSP_COEF_BYTE_SIZE))
return false;
opts->core_type = DSPInitOptions::CORE_INTERPRETER;
opts->core_type = DSPInitOptions::CoreType::Interpreter;
#ifdef _M_X86
if (SConfig::GetInstance().m_DSPEnableJIT)
opts->core_type = DSPInitOptions::CORE_JIT;
opts->core_type = DSPInitOptions::CoreType::JIT;
#endif
if (SConfig::GetInstance().m_DSPCaptureLog)