Commit graph

23123 commits

Author SHA1 Message Date
Léo Lam
5a74343d06 IOS/ES: Add logging for title context changes 2017-03-02 20:29:01 +01:00
Léo Lam
c191fe5348 IOS/ES: Update running game info on title change
This allows Dolphin to stay up-to-date about what title is currently
running, which fixes savestates, screenshots, etc. after an ES_Launch.

Same limitation as with MIOS: currently, GameINIs are not reloaded,
because it's a pain with the current config system. It'll happen
when the new config system is done, and this commit makes it much
easier to do!
2017-03-02 20:29:00 +01:00
Léo Lam
9c18eea812 IOS/ES: Mark members shared between instances as static
Some members are shared between ES instances, and they are just global
variables in IOS.

This is more efficient than getting the installed titles or setting the
current active title tons of times for no reason.
2017-03-02 20:29:00 +01:00
Léo Lam
4d776ffa8f IOS/ES: Keep track of the active title properly
This changes ES to keep track of the active title properly,
just like IOS:

* It is NOT changed on resource manager open/close.
* It is reset on IOS reload.
* It is changed by ES_DIVerify and ES_Launch.

IOS stores the active title in a structure like this:

    struct ESTitleContext
    {
      Ticket* ticket;
      TMD* tmd;
      u32 active;
    };

With this commit, we also do keep the Ticket and TMD around. This
makes some of the DI ioctlvs (which return data about the current
active title) trivial to implement in the future.

This fixes the System Menu not being able to see update partitions
and also allows us to change Dolphin's active game info in the future.
2017-03-02 20:28:01 +01:00
Mat M
78e7f4aae3 Merge pull request #4984 from leoetlino/content-fixes
IOS/ES: Title import fixes + hack removals (fix for System Menu disc updates)
2017-03-02 14:17:29 -05:00
Stenzek
3390e6f258 Merge pull request #4993 from ligfx/fixsonicadventure2
OGL SetBlendMode: always set blend equation and func
2017-03-02 21:30:10 +10:00
Markus Wick
7982ba120f Merge pull request #4995 from lioncash/normalize
CMakeLists: Normalize whitespace
2017-03-02 11:51:06 +01:00
Markus Wick
521a777ade Merge pull request #4961 from aldelaro5/fast-memchecks
Make memory breakpoint faster
2017-03-02 11:13:18 +01:00
aldelaro5
9ad6c8f334 Make memory breakpoint faster
Currently, slowmem is used at any time that memory breakpoints are in use.  This commit makes it so that whenever the DBAT gets updated, if the address is overllaping any memchecks, it forces the use of slowmem.  This allows to keep fastmem for any other cases and noticably increases performance when using memory breakpoints.
2017-03-02 04:46:27 -05:00
Lioncash
ee61bd6f2e CMakeLists: Normalize whitespace
Normalizes tabs to spaces to follow our codebase's indentation style.
2017-03-01 14:53:23 -05:00
Anthony
0b1ebc8d63 Merge pull request #4997 from lioncash/contrib
Contributing.md: Update C++11 mention to C++14
2017-03-01 10:29:31 -08:00
Lioncash
8b094081a0 Contributing.md: Update C++11 mention to C++14 2017-03-01 13:22:49 -05:00
Anthony
78f6f6108e Merge pull request #4996 from lioncash/contrib
Contributing.md: Add missing table of contents sections
2017-03-01 10:10:03 -08:00
Lioncash
b7bf1dc558 Contributing.md: Add missing table of contents sections 2017-03-01 11:39:08 -05:00
Léo Lam
ac27aff9c8 Add ES::Content::IsShared to avoid hardcoding 0x8000 2017-03-01 17:36:07 +01:00
Léo Lam
3bd34008c9 IOS/ES: Fix GetTMDView when title doesn't exist
This fixes ES_GetTMDView and ES_GetTMDViewSize to return -106
(FS_ENOENT) if the title does not exist (and more specifically when no
TMD exists in the NAND). This allows installed (or not installed) IOSes
to be detected properly.
2017-03-01 17:36:07 +01:00
Léo Lam
90aaefaef7 IOS/ES: Drop 'fake IOS titles' hack
It prevents system updates from working properly, because we always
returned that the latest version of every single IOS was installed.
2017-03-01 17:36:07 +01:00
Léo Lam
e5d9bcaf43 IOS/ES: Edit uid.sys on AddTitleStart
This allows channels to be registered and installed properly.
(And it is what IOS does.)
2017-03-01 17:36:07 +01:00
Léo Lam
1e3f8c1a1d IOS/ES: Add sanity checks to AddTitleFinish 2017-03-01 17:36:06 +01:00
Léo Lam
9263cb1996 IOS/ES: Handle adding shared contents properly 2017-03-01 17:34:59 +01:00
Mat M
8364a0002f Merge pull request #4956 from leoetlino/es-checks
ES: Replace useless asserts with proper checks
2017-03-01 11:30:25 -05:00
Anthony
8dc96fce4d Merge pull request #4776 from lioncash/dspemitter
DSPEmitter: Convert a C array to a std::array
2017-03-01 08:11:26 -08:00
Léo Lam
24e35f96fa ES: Replace useless asserts with proper checks
It makes absolutely no sense to have asserts for what is obviously an
error condition. And they should definitely not cause Dolphin to crash
because it assumes that everything is valid, and Dolphin should not
report those to the user either, as it is very obviously a bug in the
emulated software and there is nothing the user (or we) can do.

This commit replaces all of the request asserts with proper checks
and adds missing checks for some ioctlvs. We still do not check sizes
yet; this will be done later.
2017-03-01 16:05:33 +01:00
Michael Maltese
db1d826ac3 OGL SetBlendMode: always set blend equation and func
Before #4581, an invocation of `SetBlendMode` could invoke
`glBlendEquationSeparate` and `glBlendFuncSeparate` even when it was
setting `glDisable(GL_BLEND)`. I couldn't figure out how to map the old
behavior over to the new BlendingState code, so I changed it to always
call the two blend functions.

Fixes https://bugs.dolphin-emu.org/issues/10120 : "Sonic Adventure 2
Battle: graphics crash when loading first Dark level".
2017-03-01 00:49:14 -08:00
Jules Blok
83bd74aef0 Merge pull request #4974 from gamemasterplc/master
Widescreen Hack improvement
2017-03-01 02:17:33 +01:00
Anthony
30f0ebf95e Merge pull request #4990 from dolphin-emu/test
Workaround for merging Fog's ffmpeg update
2017-02-28 11:21:04 -08:00
Anthony
a57e233184 Merge pull request #4989 from RisingFog/ffmpeg_win_3.2.4
Ffmpeg win 3.2.4
2017-02-28 10:52:12 -08:00
aldelaro5
52fe05af6b Make memory breakpoint faster
Currently, slowmem is used at any time that memory breakpoints are in use.  This commit makes it so that whenever the DBAT gets updated, if the address is overllaping any memchecks, it forces the use of slowmem.  This allows to keep fastmem for any other cases and noticably increases performance when using memory breakpoints.
2017-02-28 13:02:04 -05:00
Anthony
f4ccc11b73 Merge pull request #4988 from leoetlino/tikview
ESFormats: Fix calculation of the ticket start offset
2017-02-28 09:57:04 -08:00
Markus Wick
0a8b5b79ef Merge pull request #4985 from lioncash/enum-class
ExpressionParser: Convert parse state enum into an enum class
2017-02-28 18:48:45 +01:00
Markus Wick
bd89c7b2c4 Merge pull request #4986 from lioncash/namespace
PixelEngine: Move enum constants into the PixelEngine namespace
2017-02-28 18:46:45 +01:00
Léo Lam
e9f23fbc92 ESFormats: Fix calculation of the ticket start offset
The signature part doesn't seem to appear more than once in a signed
ticket, so we should always add that offset regardless of the
ticket number.
2017-02-28 18:42:06 +01:00
Chris Burgener
9b1165acf6 Update Windows ffmpeg to 3.2.4 2017-02-28 12:29:45 -05:00
Anthony
fcc05c0b0e Merge pull request #4983 from degasus/jitcache
JitCache: Fix two block invalidation issues.
2017-02-28 09:20:24 -08:00
Lioncash
5ed55ffb34 PixelEngine: Move enum constants into the PixelEngine namespace
Gets some identifier names out of the global namespace.
2017-02-28 07:01:50 -05:00
Lioncash
d104e5e916 ExpressionParser: Convert parse state enum into an enum class 2017-02-28 05:07:21 -05:00
Anthony
e375c96693 Merge pull request #4982 from leoetlino/copy
ESFormats: Fix GetRawTicketView
2017-02-27 17:08:27 -08:00
Markus Wick
deb228f134 Merge pull request #4774 from degasus/speedhack
PatchEngine: Apply speedhack per PC, not only per block entry.
2017-02-27 23:51:12 +01:00
degasus
ffa61fcf57 JitCache: Also unlink exits of the current block.
We might still be in the current block. This is fine, but the next one might also be invalidated later on. But we may never also call the next one.
2017-02-27 23:50:16 +01:00
degasus
c1ddc2678e JitCache: Fix removing of blocks. 2017-02-27 23:50:16 +01:00
Anthony
1d69e23be0 Merge pull request #4962 from leoetlino/es-fixes
IOS/ES: Implement the Export ioctlvs + minor fixes (fix the System Menu's SD channel feature)
2017-02-27 13:03:37 -08:00
Léo Lam
6edcba4af8 Bump the savestate version (for ES changes) 2017-02-27 21:26:30 +01:00
Léo Lam
6f79f741d5 IOS/ES: Check that m_addtitle_tmd is valid before use 2017-02-27 21:26:29 +01:00
Léo Lam
95aa48d086 IOS/ES: Implement AddTMD 2017-02-27 21:26:29 +01:00
Léo Lam
6327a29847 IOS/ES: Implement ES_Export* ioctlvs
This should allow channels to be copied to the SD properly.
2017-02-27 21:26:28 +01:00
Léo Lam
345d252ef3 IOS/ES: Deduplicate fields for opened content entries
Now that we have a proper Content structure for contents,
let's just use it instead of duplicating the fields.
2017-02-27 21:25:47 +01:00
Léo Lam
4e462d44f9 ESFormats: Fix GetRawTicketView
The vector was not constructed with the proper size, which results in a
buffer overflow as we were using memcpy.

This commit fixes that mistake and also uses a safer way of copying the
ticket view data (std::vector::insert instead of memcpy).
2017-02-27 21:19:05 +01:00
Anthony
c4137c2880 Merge pull request #4965 from leoetlino/delete-everything
IOS/ES: Implement DeleteTitle
2017-02-27 12:18:47 -08:00
Anthony
7ac95c2673 Merge pull request #4906 from leoetlino/es-launch
IOS: Handle ES_Launch more accurately
2017-02-27 11:51:43 -08:00
Léo Lam
fff4634a1c IOS: Handle ES_Launch more accurately
This commit fixes ES_Launch to work mostly the same as the real IOS
(except temporary, internal files such as /sys/launch.sys and title
handling; the latter will be handled in a future PR).

First of all, this adds two IOS functions, which correspond to two
IOS syscalls: 0x41 (boot_ppc) and 0x42 (boot_ios).

boot_ios() writes the new version to 0x3140, loads the new kernel,
which then proceeds to reinit IPC and load modules as part of its
boot process. Note that this doesn't include writing to any of the
other constants in the 0x3100 region.
In Dolphin, this is implemented by changing the active IOS
version variable, writing to 0x3140 and resetting all devices. This
has exactly the same effect as the real syscall.

The other syscall, boot_ppc(), writes code to the EXI boot buffer,
pokes all constants to memory before bootstrapping the PPC with a
binary from the NAND.
We skip the low level stuff and just load the DOL to memory (and set
the PPC's PC to 0x3400), which is essentially what IOS does.

The other change is mostly related to how ES_Launch is handled.

With a real IOS, if the launched title type is 00000001 (system) and
the title is not 1-2 (System Menu), ES calls boot_ios().

Otherwise, ES handles the launch as a PPC title. It reads the TMD
to determine the required IOS version. If it is the same, boot_ppc()
is called directly. If not, ES saves the title to launch to the NAND
before launching the new IOS. After the new IOS has finished booting,
it will notice the flag and then launch the requested title.

What this commit does is really just implement this logic into IOS HLE.
The result is a fix for a regression introduced by SetupMemory,
where reloading an IOS would have overwritten some OS constants.
This fixes booting games from the disc channel.
2017-02-27 20:44:30 +01:00