Commit graph

244 commits

Author SHA1 Message Date
Lioncash ed64d15060 disk_archive: Remove unused total_entries_in_directory member from DiskDirectory
Also converts initializer list assignments to in-class initializers
where relevant.
2018-03-31 00:52:47 -04:00
Weiyi Wang 1c4b230346
Merge pull request #3604 from lioncash/ptr
archive_systemsavedata: Remove pointer cast from GetSystemSaveDataPath()
2018-03-29 11:52:36 +03:00
Lioncash 26b1aec3c1 archive_systemsavedata: Remove pointer cast from GetSystemSaveDataPath()
These kinds of casts invoke undefined behavior due to alignment rules.

Use memcpy instead which always does the right thing.
2018-03-28 22:17:26 -04:00
Lioncash 3af976e41e ncch_container: Get rid of pointer casts in LZSS_GetDecompressedSize() and LZSS_Decompress()
These kinds of casts invoke undefined behavior, due to both the aliasing
rule, and from an alignment point-of-view. Use the way that's guaranteed
to always work instead.
2018-03-28 19:55:49 -04:00
James Rowe f61141e86a Update the entire application to use the new clang format style 2018-03-09 10:54:43 -07:00
James Rowe f3234db5e2
Merge pull request #3440 from B3n30/file_read_delay
File_Sys: Add a size dependent delay for each file read
2018-03-04 21:32:50 -07:00
James Rowe 739f8e5367 Fix clang format 2018-03-04 20:59:42 -07:00
B3n30 d8ac3a3435 Fix include 2018-02-24 14:46:42 +01:00
B3n30 06a7676ed1 Add DelayGenerator for all file backends 2018-02-24 14:15:57 +01:00
B3n30 58b16c5459 File_Sys: Add a size dependend delay for each file read 2018-02-24 14:15:57 +01:00
wwylele 71fac7bd72 FS: convert to service framework 2018-02-15 23:02:09 +02:00
Sebastian Valle 4fd28e715e
Merge pull request #3252 from Subv/fs_user
HLE/FS: Converted some functions to use IPCHelpers
2017-12-15 15:40:36 -05:00
Sebastian Valle 542f14d3c5
Merge pull request #3249 from Subv/logo
NCCH: Load the "logo" file from the specified offset if it's present instead of the ExeFS.
2017-12-14 18:30:19 -05:00
Subv 90fdc8dcbf FS: Make LowPathType a strongly typed enum. 2017-12-12 17:48:00 -05:00
Lioncash c31f932afe common/core: Silence initialization order warnings 2017-12-10 19:50:45 -05:00
Merry 25afbe5707
Merge pull request #3254 from lioncash/fs
file_sys: std::move data argumnets in the constructor where applicable
2017-12-09 23:35:08 +00:00
Lioncash 11705857cd file_sys: std::move the vector in NCCHFile's constructor
Avoids making unnecessary copies of the source vector's data.
2017-12-09 14:33:09 -05:00
Lioncash 370d77f13a file_sys: std::move std::shared_ptr instances in constructors where applicable
By default, a regular copy requires an atomic increment and decrement. A
move avoids this from occurring, which makes sense when the constructor
is taking the shared_ptr by value.
2017-12-09 14:33:04 -05:00
Subv 8e9b55e939 NCCH: Load the "logo" file from the specified offset if it's present instead of the ExeFS.
This is "new" behavior as of firmware 5.0.0-11, older titles have the logo offset and size set to 0, indicating that the logo is stored in the ExeFS.
2017-12-09 12:17:02 -05:00
Subv b54e278eeb FS/ExtData: Use the ExtSaveDataArchivePath structure instead of reinterpret_cast. 2017-12-09 00:17:43 -05:00
Subv 37cb18358b HLE/FS: Always use 0x48000 as the high dword when opening the SharedExtData archive
The FS module overrides whatever value was in the saveid high dword with 0x48000 when trying to open the archive.

This fixes the problem where the Home Menu would create a few SharedExtData archives with 0x48000 as the saveid high, but then try to open them with 0 as the high value and fail.
2017-12-09 00:16:51 -05:00
Sebastian Valle dc5d7a802f
Merge pull request #3120 from shinyquagsire23/ncch-container-offsets
file_sys/ncch_container: Expose ncch_offset during instantiation and in OpenFile
2017-11-28 11:48:46 -05:00
shinyquagsire23 c0eb233bf1 file_sys/title_metadata: Fix encrypted bitmask 2017-11-20 20:45:06 -07:00
shinyquagsire23 549f11a40e file_sys/ncch_container: Expose ncch_offset during instantiation and in OpenFile 2017-11-15 17:43:15 -07:00
Sebastian Valle 67df3c2c38
Merge pull request #3092 from BreadFish64/patch-1
Get Rid of Redundant ! in CIA loading code.
2017-11-08 14:38:20 -05:00
James Rowe ddee442ff8
Merge pull request #3093 from Subv/missing_includes
Added missing headers to CMakeLists.txt and fixed includes.
2017-11-07 20:09:19 -07:00
Subv 5e9d76337d Build: Added missing <array> includes to title_metadata.h and cia_container.h 2017-11-07 22:06:34 -05:00
BreadFish64 e2cac1d7db
Get Rid of Redundant ! 2017-11-07 19:31:55 -06:00
shinyquagsire23 ac2ee3035a file_sys/cia_container: Fix warnings 2017-11-06 21:35:00 -07:00
shinyquagsire23 714206e4ce Service/FS: Mark FileBackend's Write as non-const 2017-11-05 13:26:29 -07:00
shinyquagsire23 ca2b6c6c8e file_sys/errors: Add ERROR_INSUFFICIENT_SPACE 2017-11-05 13:26:29 -07:00
shinyquagsire23 ce806dcdf6 file_sys/title_metadata: Allow loading from both files, FileBackends, and data 2017-11-05 13:26:29 -07:00
shinyquagsire23 b3e87d01fb file_sys: Add CIA Container 2017-11-05 13:26:25 -07:00
wwylele 2bcbd565b8 Add missing header for PRIU64 2017-10-27 18:52:50 +03:00
shinyquagsire23 1ac5137655 file_sys/archive_ncch: Use AM to get title content path, add ExeFS support and support for additional content indexes 2017-10-18 21:19:40 -06:00
shinyquagsire23 8b448dc277 file_sys/title_metadata: extend accessible content chunk data 2017-10-06 11:28:29 -06:00
shinyquagsire23 4887d18591 file_sys, loader: add support for reading TMDs to determine app paths 2017-10-01 10:54:02 -06:00
shinyquagsire23 8e10c9bb2e file_sys: add class for Title Metadata (TMD) 2017-10-01 10:53:45 -06:00
shinyquagsire23 e21f2348e7 file_sys/ncch_container: add RomFS, ExeFS override to allow for backward compatibility with existing .romfs system archive dumps 2017-10-01 10:53:18 -06:00
shinyquagsire23 c93e5ecfe6 file_sys/archive_ncch: use NCCHContainer instead of loading .romfs files 2017-10-01 10:53:04 -06:00
Subv 774e7deae8 HLE/Archives: Allow multiple loaded applications to access their SelfNCCH archive independently.
The loaders now register each loaded ROM with the SelfNCCH factory, which keeps the data around for the duration of the emulation session.

When opening the SelfNCCH archive, the factory queries the current program's programid and uses that as a key to the map that contains the NCCHData structure (RomFS, Icon, Banner, etc).

3dsx files do not have a programid and will use a default of 0 for this value, thus, only 1 3dsx file with RomFS is loadable at the same time.
2017-09-25 09:45:02 -05:00
Max Thomas c91ccbd0ba Loader/NCCH: Add support for loading application updates (#2927)
* loader/ncch: split NCCH parsing into its own file

* loader/ncch: add support for loading update NCCHs from the SD card

* loader/ncch: fix formatting

* file_sys/ncch_container: Return a value for OpenFile

* loader/ncch: cleanup, always instantiate overlay_ncch to base_ncch

* file_sys/ncch_container: better encryption checks, allow non-app NCCHs to load properly and for the existence of NCCH structures to be checked

* file_sys/ncch_container: pass filepath as a const reference
2017-09-25 08:17:38 +02:00
Subv 65f19b51c4 Warnings: Add UNREACHABLE macros to switches that contemplate all possible values. 2017-08-21 08:34:28 -05:00
James 941a722ff1 Handle invalid filenames when renaming files/directories 2017-07-31 17:11:53 +10:00
TheKoopaKingdom f008b22e3b Addressed Bunnei's review comments, and made some other tweaks:
- Deleted GetStatus() because it wasn't used anywhere outside of Core::System.
 - Fixed design flaw where the message bar status could be set despite the game being stopped.
2017-06-02 18:40:39 -04:00
TheKoopaKingdom 59de38b965 Switched to the ERROR_NOT_FOUND constant from errors.h. 2017-06-02 18:40:39 -04:00
TheKoopaKingdom cea19fd659 Moved whitelist checks from FS_User to the Archive_NCCH handler. 2017-06-02 18:40:27 -04:00
TheKoopaKingdom 37bec598ea Made some changes from review comments:
- Made LoadKernelSystemMode return a pair consisting of a system mode and a result code (Could use review).
- Deleted ErrorOpenGL error code in favor of just having ErrorVideoCore.
- Made dialog messages more clear.
- Compared archive ID in fs_user.cpp to ArchiveIdCode::NCCH as opposed to hex magic.
- Cleaned up some other stuff.
2017-06-02 18:28:14 -04:00
Yuri Kunde Schlesner 92be29adba FileSys: Move all result description to errors.h 2017-05-24 21:06:00 -07:00
wwylele 047a1586fe file_sys: lower log level for setting host path 2017-03-08 17:47:24 +02:00
Mat M 0cb52ee74a Doxygen: Amend minor issues (#2593)
Corrects a few issues with regards to Doxygen documentation, for example:

- Incorrect parameter referencing.
- Missing @param tags.
- Typos in @param tags.

and a few minor other issues.
2017-02-26 17:58:51 -08:00
wwylele 20544977da loader: use self NCCH archive 2017-02-13 13:57:38 +02:00
wwylele a0df747325 file_sys: add Self NCCH archive 2017-02-13 13:57:38 +02:00
Kloen f352a741d3 core: fix savedata_archive.cpp warnings about unhandled enumeration values on OSX 2017-01-29 21:50:25 +01:00
Kloen c4f9cd3559 core: fix archive_sdmc.cpp warnings about unhandled enumeration value on OSX 2017-01-29 21:49:36 +01:00
Kloen f14a53abd0 core: fix archive_extsavedata.cpp warning on OSX 2017-01-29 21:48:40 +01:00
bunnei 5ac5cbeab7 Address clang-format issues. 2016-12-21 23:48:14 -05:00
bunnei 4fc8b8229e core: Remove HLE module, consolidate code & various cleanups. 2016-12-21 23:48:13 -05:00
MerryMage 40b0ea1086 archive_source_sd_savedata: Add static method to get a specific save data path 2016-12-15 09:59:41 +00:00
Lioncash 5e9f1ec096 file_sys: Make a few single-argument constructors explicit
Prevents implicit conversions.
2016-12-07 17:26:56 -05:00
wwylele 589b642790 FileSys: Implement OtherSaveData 2016-11-29 23:50:00 +02:00
wwylele 5af117e00c FileSys: abstract SD save data archive source 2016-11-29 23:50:00 +02:00
wwylele d7d6975af0 FileSys: rename SaveDataCheck archive to NCCH archive
According to the observation from game and 3dbrew "Used for accessing general NCCH data"
2016-11-19 18:55:35 +02:00
wwylele f775a3781b FileSys: remove unused DiskArchive
All "subclasses" of DiskArchive are splitted out. This class is useless
2016-11-19 18:55:34 +02:00
wwylele 0647f86649 FileSys: w->rw permission lift only happens in SDMC archive 2016-11-19 18:55:34 +02:00
wwylele 0987783699 FileSys: add SDMCWriteOnlyArchive 2016-11-19 18:55:34 +02:00
wwylele 93aa14e345 FileSys: add SDMCArchive
Now DiskArchive only serves for SDMC, then it should be just a "SDMCArchive"
2016-11-19 18:24:37 +02:00
wwylele a879984c06 FileSys: add ExtSaveDataArchive
ExtSaveData is more similar to SaveData, so let it be a subclass of SaveData
2016-11-19 18:24:37 +02:00
wwylele 7166fdc490 FileSys: add SaveDataArchive
The error checking of SaveDataArchive is completely different from DiskArchive, so it has to be a new class instead of a subclass of DiskArchive.
2016-11-19 17:17:19 +02:00
wwylele 9a0405858a FileSys: remove Open from FileBackend
Same as directory, file shouldn't expose Open either.
2016-11-19 17:17:19 +02:00
wwylele 0e754875d1 FileSys: remove Open from DirectoryBackend
Open should not be an interface exposed by Directory because it is the Archive thats implement the methed to open the directory. The service API of 3DS also implies this - Open is not a function of directory service, but is of FS main service
2016-11-19 17:17:19 +02:00
wwylele 75ee2f8c67 FileSys: add PathParser 2016-11-19 17:17:19 +02:00
wwylele 4dd8a831bd FileSys: make Archive interfaces return error code
and make the mode parameter a reference since it is a BitField union
2016-11-01 18:30:32 +02:00
wwylele 96b0e9476b fs: implement DeleteDirectoryRecursively 2016-10-02 11:29:16 +08:00
Yuri Kunde Schlesner 84fbbe2629 Use negative priorities to avoid special-casing the self-include 2016-09-21 00:15:56 -07:00
Emmanuel Gil Peyrot ebdae19fd2 Remove empty newlines in #include blocks.
This makes clang-format useful on those.

Also add a bunch of forgotten transitive includes, which otherwise
prevented compilation.
2016-09-21 11:15:47 +09:00
Yuri Kunde Schlesner 396a8d91a4 Manually tweak source formatting and then re-run clang-format 2016-09-18 21:14:25 -07:00
Emmanuel Gil Peyrot dc8479928c Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
MerryMage 2be17a0c6e FileSys/Path: Replace Memory::GetPointer with Memory::ReadBlock 2016-05-21 11:14:03 -05:00
Mathew Maidment aa6380e5bc Merge pull request #1643 from MerryMage/make_unique
Common: Remove Common::make_unique, use std::make_unique
2016-04-05 20:10:11 -04:00
MerryMage a06dcfeb61 Common: Remove Common::make_unique, use std::make_unique 2016-04-05 13:31:17 +01:00
Lioncash f6ad3e42f0 archive_extsavedata: Fix member initialization order
shared appears in the initializer list before mount_point
2016-03-21 02:09:12 -04:00
Subv f707026ac5 HLE/FS: Change the error code returned when an ExtSaveData archive is not found.
This allows Fire Emblem to boot again.
2016-03-20 14:52:50 -05:00
Subv 3aa42627a3 HLE/FS: Corrected some style concerns. 2016-03-20 14:52:26 -05:00
Subv d26c6b3212 HLE/FS: Implemented GetFormatInfo
Format information is currently only implemented for the ExtSaveData, SharedExtSaveData and SaveData archives, the information is stored in a file alongside the root folder of the archive.
2016-03-20 14:30:01 -05:00
Subv 95b34f8081 HLE/FS: Return the proper error codes when opening files. 2016-03-20 14:28:22 -05:00
Subv 96f0e32f83 HLE/FS: Return the proper error codes on file Read/Write operations.
These operations are limited by the open flags specified while opening the file.
2016-03-20 14:28:17 -05:00
Subv 09b0564c75 HLE/FS: Corrected the error codes for DeleteFile 2016-03-20 14:28:14 -05:00
Subv b350f192bb HLE/FS: Corrected the error codes for CreateFile 2016-03-20 14:28:10 -05:00
Subv 381a5c053f HLE/FS: FS::CreateFile takes an u64 for the file size. 2016-03-20 14:28:08 -05:00
bunnei cddb9bd2aa Merge pull request #1297 from Subv/saves
DiskDirectory: Initialize the directory member with valid info.
2016-03-01 17:16:05 -05:00
Lioncash 3ed5ecd67a archive_backend: Remove unnecessary const from return types
This doesn't return by reference so const isn't really necessary
2016-01-25 00:14:53 -05:00
Subv 922b31ebbd DiskDirectory: Initialize the directory member with valid info. 2016-01-16 09:30:29 -05:00
archshift 5dfd2dba70 Implement FS_User::GetFreeBytes 2015-10-27 23:33:59 -07:00
Lioncash a97d9613a7 ivfc_archive: Fix a printf specifier 2015-09-30 08:19:42 -04:00
Lioncash d7bfda3e26 disk_archive: Remove unimplemented constructor declarations 2015-09-09 23:49:03 -04:00
Subv ce6a65cec9 Services/FS: Correctly tell the guest app whether a file was correctly opened or not.
Closes #1067
2015-08-28 22:01:03 -05:00
Yuri Kunde Schlesner a1f08788d9 Archive: Correct a few incorrect types in function signatures
Buffer lengths should be size_t, and file offsets should be u64.
2015-07-13 21:10:12 -03:00
Yuri Kunde Schlesner 2d7299a86f Loader: Remove unnecessary pointer indirection to IOFile 2015-07-13 20:00:56 -03:00
condut c385b7767d FS: Stream RomFS from file instead of loading all of it to memory 2015-07-13 19:57:12 -03:00