As this is a base class with virtuals, there needs to be an out-of-line
function definition to prevent the vtable of the class being placed within
every translation unit it's used in (i.e. every JIT implementation).
Getting and setting configuration from the base config layer are common
and repetitive tasks. This commit adds some simpler to use functions to
make the new system easier to work with.
Config::Get and Config::Set are intended to make switching from
SConfig a bit less painful. They always operate on the main system.
Example usage:
// before
auto base_layer = Config::GetLayer(Config::LayerType::Base);
auto core = base_layer->GetOrCreateSection(Config::System::Main, "Core");
u8 language;
core->Get("Language", &language, 0);
SetData("IPL.LNG", language);
// now
auto base_layer = Config::GetLayer(Config::LayerType::Base);
auto core = base_layer->GetOrCreateSection(Config::System::Main, "Core");
SetData("IPL.LNG", core->Get<u8>("Language", 0));
// or simply
SetData("IPL.LNG", Config::Get<u8>("Core", "Language", 0));
It is kind of silly to connect all of the configured Wii remotes (from
the user config; NOT netplay assigned remotes), then connect/disconnect
additional Wii remotes *after* the core has booted.
(The bWii check has been removed, because it's actually unneeded;
m_wiimote_map is always usable regardless of bWii. And we can't get
info about the currently running game without booting the core with our
current config system…)
This should fix Netplay trying to connect all configured Wii remotes.
Fixes a logic bug I introduced as part of #4942. We were not
handling the "read past EOF" case correctly, which caused
requested_read_length to underflow in some cases.
Also fixes a comparison (though this is unlikely to change anything).
Instead, the JitInterface namespace functions should be used instead. This
gets rid of all usages of the JIT global from the wxWidgets UI code.
The null check isn't needed as the JIT core would already need to be
initialized in order to be within a paused state. The null check is just a
remnant from 2011 that existed before the check for a paused state was
added.
This changes the read request handler to work just like IOS:
* To make things clearer, we now return early from error conditions,
instead of having nested ifs.
* IOS does an additional check on the requested read length, and
substracts the current seek position from it, if the read would
cause IOS to read past the EOF (not sure what the purpose of this
check is, but IOS does it, so we should too).
* The most significant one: IOS does *not* return the requested read
length, or update the file seek position with it. Instead, it uses
the *actual* read length.
As a result of simply doing what IOS does, this fixes _Mushroom Men_.
The game creates a save file, reads 2560 bytes from it, then
immediately writes 16384 bytes to it. With IOS, the first read does not
change the seek position at all, so the save data is written at
offset 0, not 2560. With Dolphin, the read erroneously set the
seek position to 2560, which caused the data to be written at
the wrong location.
Behavior confirmed by comparing IPC replies with IOS LLE and by looking
at the FS module in IOS.
What we actually care about is whether it's a GCZ file,
not whether it's compressed. (This commit doesn't change
the behavior, since the beginning of CompressSelection
discards items that aren't BlobType::GCZ or BlobType::PLAIN.)
- There's no clear definition of what it means for a GC/Wii game
to be compressed. GC games in GCZ are obviously compressed,
but what about formats like WBFS and CISO that just discard data?
- Hardcoded colors might have bad contrast with the used theme.
- It feels Windows XP to me.
YYCJ is one of the last titles to be completely broken in Dolphin.
It would hang right after the Wii remote screen. Looking at the
game's debug messages reveals that it was failing to find some of
its files.
IOS LLE booted the game just fine, which confirmed that it was an issue
with IOS HLE.
By comparing the ioctlv requests and responses with IOS, it turns out
that one of the very first ES replies was different between IOS HLE and
IOS: there was a mismatch for the content fd returned by ES.
Changing the initial content FD to what IOS returns fixes the issue.
IOS
000000: 00 00 00 08 00 00 00 00 00 00 00 07 00 00 00 09 ................
000010: 00 00 00 01 00 00 00 00 01 38 66 f0 00 00 00 20 .........8f....
000020: 00 00 00 00 00 00 00 00 00 00 00 00 81 36 d3 18 .............6..
000030: 81 36 d3 18 00 00 ff ff ff ff ff ff ff ff ff ff .6..............
Dolphin
000000: 00 00 00 08 06 00 00 00 00 00 00 07 00 00 00 09 ................
000010: 00 00 00 01 00 00 00 00 01 38 66 f0 00 00 00 20 .........8f....
000020: 00 00 00 00 00 00 00 00 00 00 00 00 81 36 d3 18 .............6..
000030: 81 36 d3 18 00 00 ff ff ff ff ff ff ff ff ff ff .6..............
So where did 0x6000000 come from?
4bd5674 changed "Wiimote" to "Wii Remote" in the GUI
(intentionally) but also did the same change for two INI
keys (seemingly unintentional, breaks backwards compatibility,
and is inconsistent with the INI's filename). This commit
reverts the INI keys but not the GUI strings.
This commit uses the same approach as cbd539e used for GameCube
sticks (but I made sure to avoid the bug that 56531a0 fixed).
Given a std::map can't have duplicate keys, iterating over the map
explicitly isn't necessary, and find() can just be used instead.
Also, instead of manually calling push_back() for every entry to
be added, the range constructor of std::vector can be used instead to add
the whole range all at once.
We (the Microsoft C++ team) use the dolphin project as part of our "Real world code" tests.
I noticed a few issues in windows specific code when building dolphin with the MSVC compiler
in its conformance mode (/permissive-). For more information on /permissive- see our blog
https://blogs.msdn.microsoft.com/vcblog/2016/11/16/permissive-switch/.
These changes are to address 3 different types of issues:
1) Use of qualified names in member declarations
struct A {
void A::f() { } // error C4596: illegal qualified name in member declaration
// remove redundant 'A::' to fix
};
2) Binding a non-const reference to a temporary
struct S{};
// If arg is in 'in' parameter, then it should be made const.
void func(S& arg){}
int main() {
//error C2664: 'void func(S &)': cannot convert argument 1 from 'S' to 'S &'
//note: A non-const reference may only be bound to an lvalue
func( S() );
//Work around this by creating a local, and using it to call the function
S s;
func( s );
}
3) Add missing #include <intrin.h>
Because of the workaround you are using in the code you will need to include
this. This is because of changes in the libraries and not /permissive-
This adds memory values for IOS11, 20, 30, 50, 51, 52, 60 and 70.
Unfortunately, IOS40 (in its working version) is not present on NUS, so
constants for that one are still missing.
This is something I removed by mistake. It didn't break anything in
most titles, but the Mii Channel *requires* write requests to
/dev/usb/kbd to succeed before exiting, so this commit readds the stub.
The latest version has tons of security fixes (which is expected for a
library such as mbedtls).
Updating also allows getting rid of a few deprecation warnings.
Turns out it is completely unneeded and it actually works better
*without* it.
Just try launching the system menu from the HBC; in current master, it
will disconnect the remote and not connect it automatically again. With
this change, it will.
The recent IOS initialization changes caused the Bluetooth device to
no longer exist before "starting" IOS (as it should be…), which meant
that Core could not activate Wii remotes during the boot process
anymore.
But that is actually completely useless, because we can just have the
emulated Bluetooth code itself activate Wii remotes as appropriate,
at the right moment.
wxWidgets headers don't play well with some of the macros defined in
Windows headers and perform their own magic to fix things, as long as
they're included entirely either before or after any Windows headers.
This file can cause a conflict in other DolphinWX files because NetPlay
headers directly include ENet headers, which leak Windows header macros.
To fix this, explicitly tell wxWidgets here that it needs to re-clean
macros.
We can return early from invalid conditions, which allows getting rid
of quite a few levels of indentation.
And let's not duplicate the new_position > file_size check.
ControllerEmu::Control instances have a unique_ptr<ControlReference>
member, which is passed either an InputReference or OutputReference.
Without this virtual destructor, deleting a derived class through a
pointer to the base class is undefined behavior.
This prevents Dolphin from writing to /sys/uid.sys (on the host; root
partition) when installing a WAD before starting emulation, because
the session root is not initialized at that moment.
Incidentally, this also gets rid of a singleton.
instruction tables
Previously, all of the internals that handled how the instruction tables
are initialized were exposed externally. However, this can all be made
private to each CPU backend.
If each backend has an Init() function, then this is where the instruction
tables should be initialized, it shouldn't be the responsibility of
external code to ensure internal validity.
This allows for getting rid of all the table initialization shenanigans
within JitInterface and PPCTables.
ControllerEmu, the class, is essentially acting like a namespace for
ControlGroup. This makes it impossible to forward declare any of the
internals. It also globs a bunch of classes together which is kind of a
pain to manage.
This splits ControlGroup and the classes it contains into their own source
files and situates them all within a namespace, which gets them out of
global scope.
Since this allows forward declarations for the once-internal classes, it
now requires significantly less files to be rebuilt if anything is changed
in the ControllerEmu portion of code.
It does not split out the settings classes yet, however, as it
would be preferable to make a settings base class that all settings derive
from, but this would be a functional change -- this commit only intends to
move around existing code. Extracting the settings class will be done in
another commit.
Several of the things done while performing a scan are logically their own
behavior (e.g. loading a titles file, checking if an entry should be added, etc).
The three parameter AnalogStick constructor takes an internal name, a
display name, and a default radius argument. The delegated constructor is
the one that calls the ControlGroup constructor, setting the group type,
so passing the group type here is a logic bug.
The only reason this appeared to work despite this bug is because
GROUP_TYPE_STICK has a value of 1, and the default radius value used for
attachment sticks is 1.0.
This implements MIOS's PPC bootstrapping functionality, which enables
users to start a GameCube game from the Wii System Menu.
Because we aren't doing Starlet LLE (and don't have a boot1), we can
just jump to MIOS when the emulated software does an ES_LAUNCH or uses
ioctlv 0x25 to launch BC.
Note that the process is more complex on a real Wii and goes through
several more steps before getting to MIOS:
* The System Menu detects a GameCube disc and launches BC (1-100)
instead of the game. [Dolphin does this too.]
* BC, which is reportedly very similar to boot1, lowers the Hollywood
clock speed to the Flipper's and then launches boot2.
* boot2 sees the lowered clock speed and launches MIOS (1-101) instead
of the System Menu.
MIOS runs instead of IOS in GC mode and has an embedded GC IPL (which
is the code actually responsible for loading the disc game) and a PPC
bootstrap code. To get things working properly, we simply need to load
both to memory, then jump to the bootstrap code at 0x3400.
Obviously, because of the way this works, a real MIOS is required.
It held a raw pointer to a IOS::HLE::Device::BluetoothEmu that is not
guaranteed to exist (and of course, nothing checked that it wasn't
nullptr), but what is more, it's totally unnecessary because we have
IOS::HLE::GetDeviceByName().
Since we cannot always inform the host that Wii remotes are
disconnected from ES, that is now done in BluetoothEmu's destructor.
Unless IOS failed at ES_Launch, it doesn't appear to write anything
back to the request after a launch, because the request is never
actually replied to in the normal way.
So let's just drop the writes to make things less confusing.
This ioctlv is used to launch BC. Not sure if that's useful,
since only the system menu is known to launch BC and it does that
through a regular ES_LAUNCH; but let's implement it anyway.
(Implementation based on IOS59.)
Some minor changes to make things slightly less confusing:
* Reinit doesn't actually init anything. It just adds static devices to
the map, so let's give it an actually descriptive name. And let's not
expose it in the header when it should not be.
* Reset's parameter name was changed from "force" -- which totally does
not describe what it does -- to "clear_devices".
* Add a reload function which handles the reload process properly
(reset all devices, set up memory values, re-add devices) and
without publicly exposing implementation details.
Shouldn't make any difference in practice because
both IsRecordingInput and IsNetPlayRunning should
be false if a temporary NAND isn't being set up,
but doing it this way is cleaner regardless.
Splits DVD reads up into smaller chunks so that data is available
before the final interrupt is triggered. This better simulates the DMA
that happens on a real device, which some games will take advantage of -
by either playing back data as it is loading or by using data that is
going to be overwritten shortly by an outstanding read.
Better separation of concerns. Relegates `ControllerInterface` to
enumerating input controls, and the new `ControlReference` deals with
combining inputs and configuration expression parsing.
ControllerEmu is a massive class with a lot of nested public classes.
The only reason these are nested is because the outer class acts as a
namespace. There's no reason to keep these classes nested just for that.
Keeping these classes nested makes it impossible to forward declare them, which leads to quite a few includes in other headers, making compilation take
longer.
This moves the source files to their own directory so classes can be
separated as necessary to their own source files, and be namespaced under the
ControllerEmu namespace.
To use it, with a modern LLVM (3.9+), set your CMAKE_PREFIX_PATH
to point to the LLVM install folder or to a LLVM build folder.
We're linking ALL of LLVM libs since I don't really know which ones we need.
LTO will take care of sliming the binary size...
The second output vector should not be written to for
IOCTLV_NCD_READCONFIG. If it is, the system menu will never attempt
to open /dev/net/wd/command and request a Wi-Fi scan.
Symbols map may not only end with a \n, but they may also end with \r\n and only the \n would get removed. This is the case with the Super Mario Sunshine map file which resulted in a weird looking symbols list and thus made it harder to scroll through it. This removes the \r after the \n has been removed if it's present.
Using the AVCodecContext contained in AVStream for muxing is officially
discouraged[1] and AVStream::codec was deprecated in favor of
AVStream::codecpar in libavformat 57.33.100 / 57.5.0.
1: [FFmpeg-cvslog] lavf: replace AVStream.codec with AVStream.codecpar: https://ffmpeg.org/pipermail/ffmpeg-cvslog/2016-April/099152.html
Any functions left exposed are used elsewhere through the main_window
global. May as well prevent any more functions from being used in that
manner where possible.
Utilizes the event system (which is what should have been done here
initially), in order to prevent coupling between two different window frames.
This also makes booting games more versatile using the UI event system,
as the event can just act as a carrier for the filename, making directly
calling boot functions unnecessary. All that's needed is for the event to
propagate to the frame.
Since files from Data/Sys are collected and added to a built macOS .app
bundle using GLOB, any new files won't get picked up until the next time
CMake is run. Tell CMake it should re-run itself every time the directory
is touched.
This prevents panic alerts from showing up three times when starting
Wii emulation whenever libusb could not be initialized. The user has
already seen a warning at startup -- no need to warn them 3 more times.
The built-in `configure_file` command correctly handles the case where
none of the variables change and scmrev.h doesn't need to be rebuilt.
This saves a full re-link of Dolphin any time CMake is re-run.
The usbdk backend is the only libusb backend that has official support
for isochronous transfers (which are required for Wii Speak,
microphones and cameras). And it's actively developed and maintained.
This reimplements the USB HID v4 IOS device using the new common
USB code (to reuse more code and allow emulated HIDs to be added
more easily in the future).
The main difference is that HIDs now have to be whitelisted, like
every other USB device for OH0 and VEN.
libusb on Windows is limited to only a single context. Trying to open
more than one can cause device enumerations to fail randomly.
libusb is thread-safe and we don't use the manual polling support (with
`poll()`) so this should be safe.
The Host class will be used by the OH0, VEN and HID implementations
as the base class for the IOS HLE device. It handles scanning devices,
detecting device changes and everything that will be needed for OH0,
VEN and HID to be implemented, while mostly abstracting libusb away.
The Device class is for actual USB devices. This commit adds a
LibusbDevice which interacts with a real USB device and enables
USB passthrough.
The NullAudio backend is guaranteed to be compiled in, so no reason
to check it.
In addition to that, if it wasn't valid, it wouldn't work as a fallback
in InitSoundStream as there are uses to g_sound_stream later.
Keeps associated data together. It also eliminates the possibility of out
parameters not being initialized properly. For example, consider the
following example:
-- some FramebufferManager implementation --
void FBMgrImpl::GetTargetSize(u32* width, u32* height) override
{
// Do nothing
}
-- somewhere else where the function is used --
u32 width, height;
framebuffer_manager_instance->GetTargetSize(&width, &height);
if (texture_width != width) <-- Uninitialized variable usage
{
...
}
It makes it much more obvious to spot any initialization issues, because
it requires something to be returned, as opposed to allowing an
implementation to just not do anything.
Movie basically just wants to get the title ID of
the initally booted game, so let's set the title ID in
ConfigManager at boot like we do with the regular game ID.
Aside from being cleaner, this should make the approach to
title IDs compatible with booting non-disc software (WADs).
This is unnecessary now that IOS::HLE is responsible for writing the
values to memory; removing the writes also prevents the IOS minor
version from being mangled (by the write to 0x3142).
Instead of using install() commands, we use the MACOSX_PACKAGE_LOCATION
property, which will allow the files to be identified and updated individually
by the build system without having to remove the entire folder and copy it
each time.
deploy-mac.py is now idempotent and should be working properly, so we'll
call it all the time from now on.
On macOS, we want them copied in the bundle directly, otherwise we will
install them later in the system folder.
Obviously not working for Windows, but that's not any different from before!
Forward declaring functions from a completely different header inside a cpp
file can lead to linker errors. Forward declaring also doesn't really
provide any benefit within cpp files unless it's to bring an internally
linked function within the same file into scope.
Hopefully will fix the crash in vkDestroyInstance on the NV Shield TV,
and likely reduce boot times slightly for drivers that take a while
to create instances.
Makes it more self-documenting which stack is being loaded or stored to,
as C, D, and magic numbers are extremely vague. It also enforces a
strongly-typed API instead of accepting arbitrary integral values.
It also adds the two other missing stack register names -- loop address
and loop counter.
This fixes a crash when trying to open the advanced input config dialog on the wiimote extensions. The device_cbox wasn't initialised and it should have been with the wiimote one.
These quite clearly have a dependency on the emitter itself, so these
should be a part of the emitter itself.
The template function can be modified to just simply take functions as a
parameter.
This function is exceptionally large. Everything within a switch like this
also makes it quite error prone. Separating the functions out makes it
easier to change a certain request implementation as well as improving
code locality.
This fixes savestates when using Bluetooth passthrough by keeping track
of pending transfer commands and discarding them on state load, so that
the emulated software receives a reply to IOS requests as expected.
With this change, savestates in BT passthrough should work as long as
no Wiimote is connected when creating the savestate and when
restoring it. Yes, I know this is an important limitation -- but
that is probably the best we can do, and it's still better than
completely broken savestates.
This fixes a regression from 5.0-1556, but I don't know why
the regression occurred or why this fixes it. (Many games
failed to fully boot - I tried Metroid Prime and Twilight
Princess (both GC), and they never got to the title screen.)
Compilers are very picky and don't use PCH when they have been compiled
with different flags. I even got some ICE in MSVC, so removing them for now.
Modules are the solution.
TryReadInstruction doesn't validate the address it resolves, that
can result in Memory::GetPointer failing and returning nullptr
which then leads to a nullptr dereference and a crash.
Created PowerPC::HostIsInstructionRAMAddress which works the same
way as PowerPC::HostIsRAMAddress for the IBAT.
This is useful to know which IOS version is required by a title without
having to look at the TMD manually.
The IOS version row will only appear if there is a TMD, of course.
File paths passed to it would have been implicitly converted to std::strings
prior to this function being reached, so it gets rid of some string churn.
It also makes it safer since nullptr can't be passed in.
Drops prefixed underscores from parameters
The C++14 standard states in section 2.10 subsection 3.2:
"Each identifier that begins with an underscore is reserved to the
implementation for use as a name in the global namespace."
It's highly unlikely an implementation will ever use '_inst' as a global
identifier, however it's better to just amend the names and alleviate
the concern altogether.
Some structures will be reused and shared between several IOS USB
device implementations. This prepares for the upcoming USB PR.
I've also removed GetPointer calls in the trivial case (BT passthrough)
Hides the opcode tables that the interpreter and JIT interface with to
execute instructions.
This does not, however, hide the read-only tables that the assembler and
disassembler use.
If we don't check for Core::IsRunning(), event types such as
iosNotifyResetButton may actually be nullptr, or some random invalid
pointer (after an emulation start then shutdown) and be used when the
user triggers a reset, which causes random crashes.
Makes it more obvious which data is going into the savestate.
It also allows PowerPCState and InstructionCache to potentially
contain members that don't necessarily need to be saved to the save state.
It also gets rid of any potential padding data being put into the save
state.
IPC_HLE is actually IOS HLE. The actual IPC emulation is not in
IPC_HLE, but in HW/WII_IPC.cpp. So calling IPC_HLE IOS is more
accurate. (If IOS LLE gets ever implemented, it'll likely be at
a lower level -- Starlet LLE.)
This also totally gets rid of the IPC_HLE prefix in file names, and
moves some source files to their own subdirectories to make the file
hierarchy cleaner.
We're going to get ~14 additional source files with the USB PR,
and this is really needed to keep things from becoming a total pain.
Hiding and not implementing the copy constructor is a pre-C++11 thing.
It should also be noted that a copy constructor, as defined by the
language, contains a const qualifier on its parameter, so this wouldn't
have prevented copies from being performed.
Now that everything has been changed to use the new structs, the old
methods and structs can be removed.
And while I was changing the base device class, I also moved the
"unsupported command" code to a separate function. It was pretty silly
to copy the same 3 lines for ~5 commands.
This adds well-defined structs that are responsible for parsing
resource requests, instead of duplicating the logic and offsets all
over IOS HLE. Command handler functions are now passed parsed requests
instead of a command address.
This may not seem like a very important change, but it removes the
need to remember all of the struct offsets or copy/paste existing
struct request variables. It also prevents nasty bugs which have
occurred in the past, such as parsing an ioctl as if it were an ioctlv
(that's way too easy to do if you pass command addresses directly);
or writing something to 0x0, which can easily happen by mistake with
a close handler that can be called with invalid command addresses.
Bonus changes:
- The return code is not an obscure Memory::Write_U32 anymore, but an
explicit, more obvious SetReturnValue() call. (Which correctly takes
a s32 instead of a u32, since return codes are signed.)
- Open handlers are now only responsible for returning an IOS ret code,
and Close handlers don't return anything and don't have to worry
about checking whether the request is a real one anymore.
- DumpAsync was moved to the ioctlv request struct, because it did
not really make sense to make it part of the IOS device and it only
works for ioctlvs.
All current usages have been removed; they will be readded in a
later commit.
As of this commit, nothing uses the structs yet. Usages will be
migrated progressively.
Hiding and not implementing the copy constructor is a pre-C++11 thing.
It should also be noted that a copy constructor, as defined by the language,
contains a const qualifier on its parameter, so this wouldn't have
prevented copies from being performed.
It also follows that if the copy constructor is deleted, then copy
assignment should also be forbidden.
wxChoice controls don't display any titles.
By the way, why is the file called DebuggerPanel.cpp
even though it implements the Video debug panel specifically?
The current implementations do many things wrong but work well enough to
run the Dragon Quest X installer until the very end. The game itself
crashes when being launched from its System Menu channel unfortunately
so it is hard to verify whether the install properly worked or not.
There are plenty of "TODO(wfs)" sprinkled around this codebase with
things that are knowingly done wrong. The most important one right now
is that content extraction is done by buffering everything into memory
instead of properly streaming the data to disk (and processing
asynchronously), which causes freezes. It is likely to not cause any
practical issues since only the installer and the updater should use
this anyway.
Without this, attempts to savestate std::set will fail with an error
about dropping the const qualifier.
<Lioncash> leoetlino: I'll try to break it down: So, when you do a
ranged-for on a container, it's essentially syntactic sugar over begin
and end iterators. std::set is an associative container where the key
type is the same as the value type, and so it's required that all
iterator functions return constant iterators. If this wasn't a
requirement, it would allow changing the ordering of elements from
outside of the set's API (this is bad).
This attempts to make some bit arithmetic more self-documenting and also
make it easier during review to identify potential off-by-one errors by
making it possible to just specify which bits are being extracted.
Functions both support the case where bits being extracted can vary and
fixed bit extraction. In the case the bits are fixed, compile-time asserts
are present to prevent accidental API usage at compile-time.
e.g. Instead of shifting and masking to get bits 10 to 15,
Common::ExtractBits<10, 15>(value) can just be done instead.
There are several things wrong with this implementation. The first being
that since we still don't have a proper ticket/tmd handling library, we
hardcode offsets once again to fetch TMD fields. The second being that
we don't stream data to the disk and we buffer everything in memory. The
third being that we don't properly fetch the content index for
decryption, which is prone to breaking.
But hey, it works well enough to install the DQX channel!
This library implements basic parsing support for some of the IOS ES
formats we need to extract data from. Currently only implements TMD
functions, but some ticket handling functions from DiscIO should likely
be moved here in the future.
These two functions load either a signed ticket or a raw ticket from the
emulated NAND.
The ticket signature skip is refactored out of the ticket writing in
order to be usable by the raw ticket reading function.
Refactor the existing DiscIO::AddTicket to not require the caller to
pass the requested title ID. We do not have the title ID in the ES case,
and it needs to be extracted from the ticket. Since this is always a
safe operation to do (title ID is always in the ticket), the
implementation is made default.
This constant isn't particularly helpful, mainly because it's not
applicable to all DSP instructions. Some instructions don't have encoding
space for registers, and not all instructions that do encode registers
have one at the first five bits.
This change also has the benefit of removing all includes to the
interpreter within the JIT code, which keeps them fully separate from one
another. Changes to the interpreter header won't require some of the JIT
code to be rebuilt.
Dolphin is able to generate one with all correct default settings, so
we don't need to ship with a pre-generated SYSCONF and worry about
syncing default settings.
Additionally, this commit changes SysConf to work with session SYSCONFs
so that Dolphin is able to generate a default one even for Movie/TAS.
Which SYSCONF needs to be touched is explicitly specified to avoid
confusion about which file SysConf is managing.
(Another notable change is that the Wii root functions are moved into
Core to prevent Common from depending on Core.)
Reset():
We only need to close IOS devices which were opened, and we can do that
simply by iterating over s_fdmap and closing any opened device.
With this change, s_device_map can be cleared at once.
SetDefaultContentFile():
We can just use s_es_handles which is guaranteed to contain three valid
ES devices. Gets rid of a downcast.
Since the Open command won't ever return with the stub, there's no way
we will get a Close/IOCtl/IOCtlV for it, so we don't have to
implement it at all.
is_hardware is an obscure name (what does hardware mean?) and it forces
us to assume that anything that !is_hardware is a FileIO device. This
assumption prevents properly restoring OH0 child devices (which will be
implemented in the USB PR), so this commit replaces the is_hardware
bool with a device type.
Confirmed by a hardware test and a quick diassembly of /dev/es.
I'm not aware of anything that opens several ES handles, but
technically, this fixes a small inaccuracy in IOS HLE.
For IOCTL_STM_EVENTHOOK, IOS checks if there is already an event hook
to prevent overriding an existing event hook message with a new one,
without first releasing it.
Currently, the country is always overridden depending on the Wii
language setting. This makes it impossible to change the country
independently from the language, unlike on a Wii, since a language
will always be associated to an unique country (which is hardcoded
in Dolphin's codebase).
This behaviour was added in c881262 and changed in PR 4319 to happen
every time emulation is started. It doesn't seem to be needed anymore,
as a quick testing shows that a Japanese system menu is able to load
in Japanese even with the region set to France, or anything other than
Japan in fact. So what this commit changes is drop this code.
Fixes issue 9884.
Removes #defines which have been unused for years and cleans up
naming.
This also changes IPC_REP_ASYNC to simply IPC_REPLY because it turns
out it's actually not specific to async replies, but used for all
command replies.
- Use an enum instead of defines.
- Only use the FS_ prefix for return codes which are actually related
to FS stuff, not for everything.
- Remove duplicated error codes and clean up the names.
Size is internally stored as a size_t, so having an int parameter
would cause implicit sign-conversion from a signed value to an
unsigned value to occur.
This removes Open() and Close() functions from devices whenever they
did nothing more than the base class (setting m_Active, returning a
default reply).
Also, since IOS close commands practically always return FS_SUCCESS,
writing the return code is moved to HandleCommand() in WII_IPC_HLE,
which has two benefits: it's not duplicated all over the place
(so people will not forget it) and it gets rid of having to check
the force parameter, since HandleCommand() is always called for
real IOS commands, so command_address is guaranteed to be valid.
It looks like at some point Dolphin device IDs coincided with IOS file
descriptors, but this is not the case anymore, so keeping those
WriteReturnCode(GetDeviceID()) in every single IOS HLE device,
as if the device ID was used as IOS fd, is both unnecessary
and confusing.
Jan 04 22:55:01 <leoetlino> fwiw, it looks like there are new warnings in the RegCache code
Jan 04 22:55:04 <leoetlino> Source/Core/Core/PowerPC/Jit64/FPURegCache.cpp:13:33: warning: declaration shadows a variable in the global namespace [-Wshadow]
Jan 04 22:56:19 <@Lioncash> yeah, the jit global should have a g_ prefix.
This fixes shadowing warnings and adds the g_ prefix to a global.
Other settings options are nouns rather than verbs so this change makes the configuration option consistent with others. Also makes the menu option label the same as the windows title.
The constructor shouldn't be used as a dumping ground for all UI-related
initialization. Doing so makes it somewhat more difficult to reason about
how certain UI elements get created. It also puts unrelated identifiers in
the same scope.
This separates the UI creation out so code relevant to each component
is self-contained.
We don't really have to keep track of device opens/closes manually,
since we can already check that by calling IsOpened() on the device.
This also replaces some loops with for range loops.
Certain parts of the standard library try to determine whether or not a
transfer operation should either be a copy or a move. The prevalent notion
of move constructors/assignment operators is that they should not throw,
they simply move an already existing resource somewhere else.
This is typically done with 'std::move_if_noexcept'. Like the name says,
if a type's move constructor is noexcept, then the functions retrieves an
r-value reference (for move semantics), or an l-value (for copy semantics)
if it is not noexcept.
As IOFile deletes the copy constructor and copy assignment operators,
using IOFile with certain parts of the standard library can fail in
unexcepted ways (especially when used with various container
implementations). This prevents that.
'operator void*' is basically a pre-C++11-ism that was used, as C++03
only had the notion of implicit type-conversion operators, but not explicit type
conversion operators (allowing implicit conversion of a file handle to
bool can go downhill pretty quickly).
ExecuteCommand was becoming pretty confusing with unused variables
for some commands, confusing names (device ID != IOS file descriptor),
duplicated checks, not keeping the indentation level low, and having
tons of things into a single function.
This commit gives more correct names to variables, deduplicates the
device checking code, and splits ExecuteCommand so that it's
easier to read.
It's worth noting that some device checks have been forgotten in the
past, which has caused a bug (which was recently fixed in 288e75f6).
GCMemcard is only used outside of the core and has
no real reason to use the core's RTC. GetEmulatedTime
isn't designed to be called when the core isn't running.
Should fix https://bugs.dolphin-emu.org/issues/9871
From what I can tell, the emulated GPU places (0,0) at the lower left of
the image, and we were generating texture coordinates so that (0,0) was
at the upper-left in the expansion geometry shader, causing textures
used by point sprites to be flipped vertically.
Fixes the upside-down A button in Mario Golf.
Since in this case we're setting it based on the state at record start
time, not when a register is loaded, UseMemory would not be called, so
this could potentially wipe out texture memory that was valid.
This should ensure that when playing with loop enabled, the first frame is
in the same state each time. There is potentially still issues when the
start frame is set to something other than zero, but I'm not sure how we
could work around this without capturing the entire state on each frame.
Doing it from the add dialogs instead would prevent the call to these dialogs outside of a breakpointWindow which would be necessary for hotkeys binding.
Instead of needing different switch cases for
converting countries to regions in multiple places,
we now only need a single country-to-region switch case
(in DiscIO/Enums.cpp), and we get a nice Region type.
This also makes it a strongly-typed enum.
Considering that the flushing mode is a trait/behavior for the register
cache, it doesn't really make sense to have the enum separate from it.
This also has the benefit of removing constants from global scope.