Commit graph

268 commits

Author SHA1 Message Date
Hamish Milne
558e710e17 Finished archives; remove pod.h 2020-02-13 17:41:26 +08:00
Hamish Milne
2bf5b46460 Basic archive backend serialization 2020-02-13 17:41:26 +08:00
Hamish Milne
2d2c7218ef Serialize CECD, CFG services 2020-02-13 17:41:25 +08:00
Léo Lam
756d231ff9 file_sys: Add support for BPS patches
The BPS format allows distributing patches that are smaller and that do
not contain copyrighted content if data is relocated
(unlike non-trivial IPS patches).

This is essential for games such as MM3D that have three barely
different code revisions. Supporting all three versions would
demand an unreasonable amount of work; with BPS patches only one
version has to be supported.
2019-12-22 10:46:47 +01:00
Léo Lam
3140086c60 file_sys: Handle patch applying failures
This changes ApplyCodePatch to return a ResultStatus, which makes it
possible to determine whether patch applying has failed. Previously,
only a boolean was returned, and false was returned when no patch
was found OR when a patch was found but applying it failed.

This also changes AppLoader_NCCH to return an error if patching fails
because the executable is likely to be left in an inconsistent state
and we should not proceed booting in that case.
2019-12-22 10:46:47 +01:00
Léo Lam
1377be9902 file_sys: Move IPS patching code into separate source file
In anticipation of a new BPS patcher.
2019-12-22 10:46:47 +01:00
Léo Lam
7318913f5a ncch_container: Fix NCCH decryption heuristic when replacing exheader
Fixes a regression from #4862, which caused the NCCH title ID checking
heuristic to be skipped whenever the exheader is replaced.

I was thinking the heuristic wouldn't be needed in that case, but it
turns out that many users still have pathological NCCHs that indicate
they are encrypted but are actually decrypted...

Now the original exheader is always read and used for the heuristic
to determine whether the NCCH is actually encrypted; only then do we
load a replacement exheader (if it exists) to avoid affecting the
heuristic.
2019-08-22 17:52:30 +08:00
Léo Lam
a2cde6e075 ncch_container: Assume override exheaders are decrypted
Require and assume that override exheaders are decrypted for
consistency with Luma's loader behaviour and to ensure consistent
behaviour regardless of whether the NCCH is marked as encrypted or not.
Currently, exheader overriding with an encrypted NCCH would cause
the title ID checking heuristic to mistakenly disable encryption,
which would then make exefs loading fail.
2019-08-07 18:41:37 +08:00
James Rowe
aef06df388
Merge pull request #4817 from leoetlino/ips-patch-later
ncch_container: Apply IPS patch after allocating .bss
2019-07-23 20:58:35 -06:00
Weiyi Wang
909d04ddea Remove unused stuff
Some unused variables are still kept in services, as they are parameters passed from the command buffer and might be used in the future
2019-07-16 20:27:03 -04:00
Léo Lam
43d1ee6fb7 ncch_container: Apply IPS patch after allocating .bss
This allows an IPS patch to edit .bss. This is useful for game patches
that need to add code, as putting things in .bss allows adding new code
*without* editing .code and thus without having to relocate everything.
2019-07-10 12:57:30 +02:00
Léo Lam
bc30412484 ncch_container: Add support for exheader replacement
This adds support for custom exheaders, which brings feature parity
with Luma3DS's code patching functionality and allows for injecting
new game code.
2019-07-06 18:01:54 +02:00
Léo Lam
70fe0d22de ncch_container: Fix code.bin replacement
Currently, having a replacement code.bin causes Citra to crash as it is
trying to load icon data from code.bin because of a typo. This commit
fixes that typo.
2019-06-30 11:48:28 +02:00
B3n30
14ed702971 FileSys: Load the ticket when the CIAContainer is loaded 2019-04-28 21:21:28 +02:00
fearlessTobi
e9bd34f7da Address remaining review comments 2019-04-07 17:00:28 +02:00
fearlessTobi
781d4b787a Address first batch of review comments 2019-04-07 15:35:32 +02:00
Weiyi Wang
21bda754b3
Merge pull request #4396 from FearlessTobi/open-delays
fs_user: Add a delay for each file open
2019-03-23 12:21:12 -04:00
Weiyi Wang
36ae10f555 archive_ncch: add open source mii archive 2019-03-09 08:19:32 -05:00
fearlessTobi
2999c8325e archive_extsavedata: add correct FileOpen delays 2019-03-06 18:53:44 +01:00
fearlessTobi
5055a6c262 Address review comments 2019-03-06 18:53:34 +01:00
fearlessTobi
fc7e6c9cc9 fs_user: Add a delay for each file open 2019-03-06 16:09:24 +01:00
Weiyi Wang
9c57b74907
Merge pull request #4618 from wwylele/fs-clean
FS: pass down program ID for archive operation (cleanup System::GetInstance part 3)
2019-03-04 12:34:54 -05:00
tgsm
39e163b7ce core: use nested namespaces 2019-02-18 20:34:18 -05:00
Weiyi Wang
a6d9baa05a FS: pass down program ID for archive operation
To eliminate System::GetInstance usage. Archive type like SelfNCCH and SaveData changes the actual reference path for different client, so archive backend interface should accept client information from the service interface. Currently we only pass the program ID as the client information.
2019-02-02 20:44:13 -05:00
Weiyi Wang
104829ae58 remove all occurance of specifying endianness inside BitField
This commit it automatically generated by command in zsh:
sed -i -- 's/BitField<\(.*\)_le>/BitField<\1>/g' **/*(D.)

BitField is now aware to endianness and default to little endian. It expects a value representation type without storage specification for its template parameter.
2019-01-28 22:09:43 -05:00
Zak Kurka
1ded48f5a3 Merge branch 'master' of github.com:citra-emu/citra into ips-patches 2018-11-15 07:11:18 -06:00
Zak Kurka
896577044d Remove ApplyIPS from the class and header 2018-11-15 07:11:06 -06:00
Weiyi Wang
5179915fb4 filesys/ncch: prevent buffer overflow on calculating SHA256 2018-11-10 22:58:32 -05:00
Weiyi Wang
5b7d21c3cd FileSys/DelayGenerator: add missing #include and virtual dtor (#4363)
* FileSys/DelayGenerator: add missing #include and virtual dtor

Added the needed include so that it won't cause error if another file includes this without including the depended files

Deleting a virtual class via base type without virtual dtor is UB, which happens inFileBackend.

* FileSys/DelayGenerator: move function definition into cpp file/n/nTo avoid generating vtable in all units that includes the header file

* filesys/delay_generator: rearrange #include
2018-10-27 12:46:03 +08:00
Weiyi Wang
f3ee5feb02
Merge pull request #4358 from wwylele/kernel-global-2
kernel: Eliminate global state in process and handle_table
2018-10-26 15:51:36 -04:00
Weiyi Wang
fa0e82b812
SeedDB: replace seek(tell, set) with seek(cur) (#4344) 2018-10-25 21:39:26 -04:00
Weiyi Wang
8fb3d8ff38 kernel/process: move current process to kernel instance
Two functional change:
QueryProcessMemory uses the process passed from handle instead current_process
Thread::Stop() uses TLS from owner_process instead of current_process
2018-10-22 21:32:34 -04:00
Zak Kurka
92f8b71137 Make ApplyIPS static and private 2018-10-21 10:42:23 -05:00
Zak Kurka
05c1816504 Stay in bounds 2018-10-21 07:48:54 -05:00
Zak Kurka
1c62bc06cf Add rle record support 2018-10-21 07:48:29 -05:00
Zak Kurka
d8284dfacc Log invalid IPS attempt 2018-10-21 07:47:27 -05:00
Zak Kurka
d0b54e9939 Check for EOF 2018-10-20 23:25:16 -05:00
Zak Kurka
2778801dc5 Updated based on review 2018-10-20 19:45:16 -05:00
Zak Kurka
2a5b56bb1d Be more intentional with check 2018-10-20 18:17:54 -05:00
Zak Kurka
bf50bb06f1 Minor style changes and use memcpy 2018-10-20 18:10:32 -05:00
Zak Kurka
2496ecbaf6 Added IPS patching 2018-10-20 13:09:05 -05:00
Ben
b01b94d843 FileSys::Ticket::Load: Return error if signature type does not match (#4339)
* FileSys::Ticket::Load: Return error if signature type does not match

* fixup! FileSys::Ticket::Load: Return error if signature type does not match
2018-10-15 11:26:35 -04:00
Weiyi Wang
9adc407112
Merge pull request #4304 from B3n30/std_optional
Replace boost::optional with std::optional where possible
2018-10-11 12:40:00 -04:00
Weiyi Wang
756a3d404a
Merge pull request #4283 from valentinvanelslande/seed-db
Implement SeedDB & Seed Crypto
2018-10-08 14:18:42 -04:00
B3n30
d37a2270d6 Replace boost::optional with std::optional where possible 2018-10-05 13:51:09 +02:00
Pengfei Zhu
87e16c80ac
Merge pull request #4229 from zhaowenlan1779/open-folder
citra_qt, core: game list "Open XXX Location" improvements
2018-10-05 00:46:43 -05:00
Weiyi Wang
eb494c574d
Merge pull request #4244 from wwylele/swap-enum
common/swap: add swap template for enum
2018-10-04 14:51:49 -04:00
Valentin Vanelslande
b067b5aa5a Implement SeedDB & Seed Crypto 2018-10-02 10:12:40 -05:00
zhupengfei
8cf1132b2e
ncch_container: choose the first id as extdata id when extended save data access is used 2018-10-02 08:15:10 +08:00
Weiyi Wang
fceec34945
Merge pull request #4278 from wwylele/cfg-ptm-direct-fs
cfg, ptm: access FS via backend directly
2018-10-01 18:32:43 -04:00