- coef: Explicitly set 23 different values that are used by GBA UCode,
and tweaked overall parameters to more closely match those 23 values.
- irom: Moved a few functions to their proper places, updated BootUCode
to configure DMA transfers using AX registers as well as IX registers
(the GBA UCode uses this to do two sequential transfers in one call),
and added partial functions used by GBA UCode.
All functions were reverse-engineered solely based off of observed
effects on the virtual machine: register states before-and-after, dmem
interactions, and DMA transfers. The specific coefficients were observed
being read from dmem, and must be exactly those values to function
properly. I have no knowledge of how the official ROM implements these
functions, or how it is implemented overall.
Tested with The Legend of Zelda: Four Swords Adventures, Final Fantasy
Crystal Chronicles, and Billy Hatcher and the Giant Egg (to download
ChuChu Rocket!).
`P_REG1C` had the same value as `P_ACCL`, so was causing spurious errors
when used with ACCM registers. Gcdsptool (which calls this `P_ACCLM`)
gives it the value `P_REG | 0x1c10` instead, and handles errors in the
same block as other REG## enums.
This makes the interface slightly cleaner and a bit more consistent
with the other getters. Still not fully the same, since the others
don't really handle failures with std::optional; but at least the
value is returned by value now, as opposed to having the function
take a pointer to a u64.
This gets rid of some assumptions that non-DiscIO code was making about
volume types. It's better to encapsulate as many of the volume type
differences as possible in DiscIO.
Made possible by PR #2353.
This is more reliable, as this guarantees subsystems will be
shut down in the same order they were initialised (if they were
initialised). It also allows us to stop keeping track of what needs to
be shut down manually and just return in case of errors.
This should prevent the emulator from getting totally stuck when
the boot process does fail.
This makes it hard to support different boot params for different boot
types. We should not be making the assumption that Dolphin will
always be booting directly from a file (and in particular, only
using a string).
It's incompatible with future changes that will allow Dolphin to boot
a NAND title properly from well, the NAND, as opposed to booting from
WADs. (And no, treating the title TMD as a "bootable" path doesn't
count. Especially when that approach won't work with NAND images
or IOS LLE.)
And it's confusing to expose this functionality from the UI. It's
pretty bad for UX to change the play button's behaviour depending on
whether the user has launched something before, configured a default
file to boot, added a directory to their game paths.
This commit moves the write function to where it should be (IOS),
especially when ES::ImportTicket() is the only place to use it.
Prevents misusing the ticket import function, and removes one unsafe
direct write to the NAND that does not go through IOS.
This also fixes the destination path: the session root is the one which
should be used for determining the ticket path, not the configured one.
The whole NANDContentLoader stuff is truly awful and will be removed
as soon as possible.
For now, this fixes a bug that was exposed by std::optional::operator*.
std::optional makes a few things a bit neater and less error prone.
However, we still cannot use C++17 (unfortunately), so this commit
adds an implementation of std::optional that we can use right now.
Based on https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/lib/gtl/optional.h
which seems to be fairly similar to C++17's <optional> and standards
compliant. It's one of the few implementations that handle propagating
type traits like copy constructibility, just like libc++/libstdc++.
`MainWindow` initializes a number of input interfaces but never shuts
them down. This was causing a crash-after-exit on macOS where the
ControllerInterface backend stores a `std::thread` object in a static
variable and only stops it when ControllerInterface::Shutdown is called.
FormLayout is not intended for this sort of dialog:
> QFormLayout is a convenience layout class that lays out its children
> in a two-column form. The left column consists of labels and the right
> column consists of "field" widgets (line editors, spin boxes, etc.).
pSysMem is of the type const void* -- because of this, it makes the
original delete[] call undefined behavior, as deleting a void pointer is
undefined behavior.
Also punning types into existence, like what was done for the stereo
image header is undefined behavior as well. The proper way to do this is
to either manually add all individual bytes manually, or memcpy the
struct into memory.
As we want to deallocate the memory before returning, and because
pSysMem is a const void*, we keep a unique_ptr to the data and just pass
pSysMem a raw pointer to the data.
Use @Orphis's FindFFmpeg module from ppsspp:
2149d3db7f
From that commit:
> This new module should be able to handle both libraries in the regular
> paths and fallback to pkg-config.
> It is also able to find dynamic libraries, not just static libraries.
> It will generate imported targets with the name FFmpeg::<lib> that you
> can use in your scripts.
gcc complains that the printf %x formatting instruction expects an
'unsigned int' but we pass a 'size_t'. We add the 'z' length formatting
specifier used for 'size_t'
This adds the WARNPC directive from xkas/asar to complement the existing ORG
directive. A common useful idiom is "WARNPC 0xXXXX\nORG 0xXXXX," which only
seeks forward and raises an error if you've already written to that part
of the file.
Fixes https://bugs.dolphin-emu.org/issues/10265 (Star Wars: The Clone
Wars hangs on loading screen with DSP-HLE and JIT Recompiler).
The Clone Wars hangs upon initial boot if this interrupt happens too
quickly after submitting a command list. When played in DSP-LLE, the
interrupt lags by about 160,000 cycles, though any value greater than or
equal to 814 will work. In other games, the lag can be as small as 50,000
cycles (in Metroid Prime) and as large as 718,092 cycles (in Tales of
Symphonia!).
All credit to @hthh, who put in a heroic(!) amount of detective work and
discovered that The Clone Wars tracks a "AXCommandListCycles" variable
which matches the aforementioned 160,000 cycles. It's initialized to ~2500
cycles for a minimal, empty command list, so that should be a safe number
for pretty much anything a game does (*crosses fingers*).
These settings are already loaded and saved to the SYSCONF. The INI
load/saves are redundant and do not work anyway because they are
overwritten by SYSCONF.
This file is pretty small now that it doesn't handle Wii
partitions anymore, so let's move its contents to Volume.cpp.
This is also more consistent with how blob creation works.
This happened to work without any problems because the only way for a
file system to be invalid was to not have the right GC/Wii magic word
in the unencrypted area, and a volume could not be created without
having the right GC/Wii magic word there. Now that file systems read
the magic word from a partition instead, a fix is needed.
I replaced m_OffsetShift with m_Wii in bb93336 to support
the decrypt parameter for read functions. Doing that is no
longer necessary, so m_offset_shift is now used like before.
By removing mutable state in VolumeWiiCrypted, this change makes
partition-related code simpler. It also gets rid of other ugly things,
like ISOProperties's "over 9000" loop that creates a list of
partitions by trying possible combinations, and DiscScrubber's
volume swapping that recreates the entire volume when it needs to
change partition.
- Makes DSP-LLE code checksums the same as those from DSP-HLE. I'm
assuming DSP-HLE was doing it correctly, since there are numerous
references to these pre-endian-swapped checksums (including in
DSPHost.cpp itself).
- Fixes disassembly when dumping code from DSP-LLE, which was using the
wrong endianness and giving totally bogus output.
- Reveals error messages of the format, "Bah! ReadAnnotatedAssembly
couldn't find the file ../../docs/DSP/DSP_UC_AX_07F88145.txt," which
seems to be intended behavior that was previously hidden.
This change centralizes all of the path handling and file writing logic
in DumpDSPCode. DSP-HLE also gains the feature of DSP-LLE to
automatically disassemble dumped code and write it to an accompanying
text file.
With the relocation of DumpDSPCode to DSPCodeUtils, the only remaining
function in DSPLLETools is DumpCWCode. This function 1) is not used
anywhere (not even in DSPTool), 2) doesn't seem to really do anything,
and 3) has a single comment saying "TODO make this useful :p"
This is something that should be the responsibility of the frontend
booting the game. Making this part of the host 'interface' inherently
requires frontends to leak internal details (much like the other
UI-related functions in the interface).
This also decouples more behavior from the debugger and the
initialization process in the wx frontend. This also eliminates several
usages of the parent menubar in the debugger code window.
VolumeDirectory doesn't support necessities like TMDs,
so thanks to 5.0-2172 (18968ab), EmulatedBS2_Wii crashes
when the inserted disc is a VolumeDirectory.
This commit fixes that.
This commit makes our DOL booting code very similar to our
ELF booting code. One exception is that the DOL booting
code still always calls SetupBAT. (Note that EmulatedBS2_GC
calls SetupBAT even if no disc is inserted.) I'm not sure
if there's a point to the difference, but I thought I'd
better avoid changing it so that I don't break anything.
For thread safety reasons, the currently inserted volume must
only be accessed by the DVD thread (or by the CPU thread if it
calls DVDThread::WaitUntilIdle() first). After this commit,
only DVDThread.cpp can access the volume, which prevents code in
other files from accessing the volume in a non-threadsafe way.
Direct access to the WAD bytes is required to read contents with proper
padding data (since they can sometimes end up being outside of the
data app section). Allowing the whole buffer to be accessed directly
would be error prone, so this commit adds GetContent() to WiiWAD
for getting raw content data by index.
These cannot be booted, so it is bad UX to show them in the UI as if
they were regular titles, and yet have different behaviour for them.
And technically, there is no reason to allow them to be used to boot
in the first place.
Another reason they should not be shown is that Dolphin fails
spectacularly with WADs that have a valid boot content index, but are
not PPC titles (e.g. IOS WADs). The only reliable way to avoid this
is to check for the title type and only show channels, just like
the Wii System Menu.
Mistakenly used the wrong TMD to clean up the import.
The original TMD is the one that is supposed to be used when
cancelling an import, but I forgot it's in the /import directory after
starting an import.
This exposes all ES title management ioctlvs to avoid duplicating IOS
code everywhere and to make it easier to reuse (since this way it's
not unnecessarily tied to the PPC IPC mechanism anymore) and unit test.
Some functions were also renamed for consistency with the other names,
*and* with official names.
It's better to just let the calling code provide a volume
object instead of needing one SetVolume for each way of
creating a volume. This simplifies InsertDiscCallback and
is needed for the following commits.
Just like DeleteTitle, Using CNANDContentManager is overkill,
inefficient and useless. And it results in a few failures in
situations where a delete should just always work.
But here it gets bonus points, because it manages to actually use
the TMD for deleting contents, when IOS does none of that and just
deletes files ending with .app in the title content directory. :)
This enables constructing an IOS instance that is not tied to emulation
and that can be simply used for internal purposes (ES, FS).
NAND root initialisation was moved to IOS since we cannot rely on HW
doing that for us anymore, and technically the NAND is entirely managed
by IOS anyway.