PowerPC: Convert CPUCore enum into an enum class

Makes the enum values strongly-typed and prevents the identifiers from
polluting the PowerPC namespace. This also cleans up the parameters of
some functions where we were accepting an ambiguous int type and
expecting the correct values to be passed in.

Now those parameters accept a PowerPC::CPUCore type only, making it
immediately obvious which values should be passed in. It also turns out
we were storing these core types into other structures as plain ints,
which have also been corrected.

As this type is used directly with the configuration code, we need to
provide our own overloaded insertion (<<) and extraction (>>) operators
in order to make it compatible with it. These are fairly trivial to
implement, so there's no issue here.

A minor adjustment to TryParse() was required, as our generic function
was doing the following:

N tmp = 0;

which is problematic, as custom types may not be able to have that
assignment performed (e.g. strongly-typed enums), so we change this to:

N tmp;

which is sufficient, as the value is attempted to be initialized
immediately under that statement.
This commit is contained in:
Lioncash 2018-06-15 08:11:18 -04:00
parent 58606702f7
commit 6f473b96d0
27 changed files with 147 additions and 76 deletions

View file

@ -371,7 +371,7 @@ wxMenu* MainMenuBar::CreateJITMenu() const
_("This is necessary to get break points"
" and stepping to work as explained in the Developer Documentation. But it can be very"
" slow, perhaps slower than 1 fps."));
interpreter->Check(config_instance.iCPUCore == PowerPC::CORE_INTERPRETER);
interpreter->Check(config_instance.cpu_core == PowerPC::CPUCore::Interpreter);
jit_menu->AppendSeparator();
jit_menu->AppendCheckItem(IDM_JIT_NO_BLOCK_LINKING, _("&JIT Block Linking Off"),