Commit graph

456 commits

Author SHA1 Message Date
bunnei fd9da4232b
Merge pull request #850 from DarkLordZach/icon-meta
Add Icons and Metadata Support
2018-08-08 12:27:19 -04:00
Zach Hilman 91cfe70301 loader: Add icon and title support to XCI 2018-08-06 23:13:42 -04:00
Zach Hilman 5927cf0e17 Use const where applicable 2018-08-06 23:06:33 -04:00
Zach Hilman 9e88f03e75 Avoid parsing RomFS to directory in NCA 2018-08-06 23:06:33 -04:00
Zach Hilman 2cc962e171 content_archive: Add support for titlekey cryptography 2018-08-04 14:57:21 -04:00
bunnei 2b06301dbf
Merge pull request #849 from DarkLordZach/xci
XCI and Encrypted NCA Support
2018-08-04 14:33:11 -04:00
Lioncash 42a4c6b79e vfs_vector: Remove unused variable in FindAndRemoveVectorElement()
This wasn't being used for anything, so it can be removed.
2018-08-02 11:40:24 -04:00
Lioncash cec9e9b811 vfs_vector: Avoid unnecessary copies where applicable
The lambda elements should be taken by const reference here, and we can
move the virtual directory passed to ReplaceFileWithSubdirectory()
2018-08-02 11:37:39 -04:00
Zach Hilman 13cdf1f159 Add missing parameter to files.push_back() 2018-08-01 00:16:54 -04:00
Zach Hilman 187d8e215f Use more descriptive error codes and messages 2018-08-01 00:16:54 -04:00
Zach Hilman a9c921a41d Use ErrorEncrypted where applicable and fix no keys crash 2018-08-01 00:16:54 -04:00
Zach Hilman 03149d3e4a Add missing includes and use const where applicable 2018-08-01 00:16:54 -04:00
Zach Hilman 239a3113e4 Make XCI comply to review and style guidelines 2018-08-01 00:16:54 -04:00
Zach Hilman 22342487e8 Extract mbedtls to cpp file 2018-08-01 00:16:54 -04:00
Zach Hilman df5b75694f Remove files that are not used 2018-08-01 00:16:54 -04:00
Lioncash 57c4d7aa00 partition_filesystem: Remove dynamic_cast in PrintDebugInfo()
We shouldn't be upcasting our file instances. Given a
PartitionFilesystem is currently designed to accept any arbitrary
VfsFile instances, casting to a more specific type than that is just bad
design, and shows an interface design issue.
2018-07-29 06:16:59 -04:00
Zach Hilman 906d785c73 RomFS Extraction 2018-07-27 18:14:03 -04:00
bunnei bc5b65a1b0
Merge pull request #785 from lioncash/fs
partition_filesystem: Use std::move where applicable
2018-07-23 20:36:59 -07:00
Zach Hilman 59cb258409 VFS Regression and Accuracy Fixes (#776)
* Regression and Mode Fixes

* Review Fixes

* string_view correction

* Add operator& for FileSys::Mode

* Return std::string from SanitizePath

* Farming Simulator Fix

* Use != With mode operator&
2018-07-23 19:40:35 -07:00
Lioncash db48ebb9c9 partition_filesystem: Use std::move where applicable
Avoids copying a std::string instance and avoids unnecessary atomic
reference count incrementing and decrementing.
2018-07-23 20:27:11 -04:00
Zach Hilman e8f641a52d NRO Assets and NACP file format
Cleanup

Review fixes
2018-07-23 12:34:26 -04:00
Lioncash 0081252d31 vfs: Correct file_p variable usage within InterpretAsDirectory()
ReplaceFileWithSubdirectory() takes a VirtualFile and a VirtualDir, but
it was being passed a string as one of its arguments. The only reason
this never caused issues is because this template isn't instantiated
anywhere yet.

This corrects an issue before it occurs.
2018-07-22 03:22:28 -04:00
Lioncash 398444e676 file_util, vfs: Use std::string_view where applicable
Avoids unnecessary construction of std::string instances where
applicable.
2018-07-22 03:22:21 -04:00
Lioncash 0ba7fe4ab1 file_util: Use a u64 to represent number of entries
This avoids a truncating cast on size. I doubt we'd ever traverse a
directory this large, however we also shouldn't truncate sizes away.
2018-07-21 22:42:08 -04:00
bunnei 0f20fa5a1e
Merge pull request #754 from lioncash/part
partition_filesystem, vfs_real: Minor changes
2018-07-21 11:38:52 -07:00
bunnei 89cc8c1617
Merge pull request #755 from lioncash/ctor
file_sys/errors: Remove redundant object constructor calls
2018-07-21 10:53:53 -07:00
Lioncash 459e158340 file_sys/errors: Remove redundant object constructor calls
Given we're already constructing the error code, we don't need to call
the constructor inside of it.
2018-07-20 22:37:54 -04:00
Lioncash b46c0ed1fa vfs_real: Remove redundant copying of std::vector instances in GetFiles() and GetSubdirectories()
We already return by value, so we don't explicitly need to make the
copy.
2018-07-20 22:30:22 -04:00
Lioncash ec71915ede partition_filesystem, vfs_real: Add missing standard includes 2018-07-20 22:28:35 -04:00
Lioncash d36e327ba6 partition_filesystem, vfs_real: Use std::move in ReplaceFileWithSubdirectory() where applicable
Avoids unnecessary atomic increment and decrement operations.
2018-07-20 22:23:58 -04:00
Lioncash 2b91386e15 partition_filesystem, vfs_real: Use std::distance() instead of subtraction
This is a little bit more self-documenting on what is being done here.
2018-07-20 22:19:17 -04:00
Lioncash 3e0727df1b vfs_offset: Simplify TrimToFit()
We can simply use std::clamp() here, instead of using an equivalent
with std::max() and std::min().
2018-07-20 22:04:37 -04:00
Lioncash 894b0de0f2 vfs: Make WriteBytes() overload taking a std::vector pass the std::vector by const reference
Given the data is intended to be directly written, there's no need to
take the std::vector by value and copy the data.
2018-07-20 21:51:30 -04:00
Lioncash dd09439fee vfs: Use variable template variants of std::is_trivially_copyable
Provides the same behavior, but with less writing
2018-07-20 21:47:19 -04:00
Lioncash 05231d8b08 vfs: Amend constness on pointers in WriteBytes() and WriteArrays() member functions to be const qualified
These functions don't modify the data being pointed to, so these can be
pointers to const data
2018-07-20 21:40:15 -04:00
bunnei ffbd51e207
Merge pull request #737 from lioncash/move
filesys/loader: std::move VirtualFile instances in constructors where applicable
2018-07-20 09:21:15 -07:00
Lioncash 0e9d58e82a vfs_offset: std::move file and name parameters of OffsetVfsFile
Avoids potentially unnecessary atomic reference count incrementing and
decrementing, as well as string copying.
2018-07-20 00:04:54 -04:00
Lioncash bbd6429ecb partition_filesystem: Return pfs_dirs member variable within GetSubdirectories()
This should be returned here, otherwise pfs_dirs is effectively only
ever added to, but never read.
2018-07-19 21:08:50 -04:00
bunnei f1d7486eac
Merge pull request #703 from lioncash/const
savedata_factory: Make SaveDataDescriptor's DebugInfo() function a const member function
2018-07-19 08:46:15 -07:00
bunnei b0334af05b
Merge pull request #702 from lioncash/initialize
partition_filesystem: Ensure all class members of PartitionFilesystem are initialized
2018-07-19 08:45:54 -07:00
bunnei 1bf7ae79c8
Merge pull request #701 from lioncash/moving
content_archive: Minor changes
2018-07-19 08:41:42 -07:00
Lioncash 88ba94e8a2 savedata_factory: Make SaveDataDescriptor's DebugInfo() function a const member function
This function doesn't alter class state.
2018-07-18 23:50:07 -04:00
Lioncash 9abc5763b6 partition_filesystem: Ensure all class members of PartitionFilesystem are initialized
Previously is_hfs and pfs_header members wouldn't be initialized in the
constructor, as they were stored in locals instead. This would result in
things like GetName() and PrintDebugInfo() behaving incorrectly.

While we're at it, initialize the members to deterministic values as
well, in case loading ever fails.
2018-07-18 23:45:22 -04:00
Lioncash 4790bb907d content_archive: Make IsDirectoryExeFS() take a shared_ptr as a const reference
There's no need to take this by value when it's possible to avoid
unnecessary copies entirely like this.
2018-07-18 23:19:28 -04:00
Lioncash 87a9bb392b content_archive: Add missing standard includes 2018-07-18 23:18:59 -04:00
Lioncash 0b566f43a1 content_archive: std::move VirtualFile in NCA's constructor
Gets rid of unnecessary atomic reference count incrementing and
decrementing.
2018-07-18 23:13:25 -04:00
Lioncash 5e626c774f vfs: Deduplicate accumulation code in VfsDirectory's GetSize()
We can just use a generic lambda to avoid writing the same thing twice.
2018-07-18 23:03:27 -04:00
Zach Hilman 29aff8d5ab Virtual Filesystem 2: Electric Boogaloo (#676)
* Virtual Filesystem

* Fix delete bug and documentate

* Review fixes + other stuff

* Fix puyo regression
2018-07-18 18:07:11 -07:00
Zach Hilman 69bfe075b5 General Filesystem and Save Data Fixes (#670) 2018-07-17 12:42:15 -07:00
Subv 7e5e4f8d7a FileSys: Append the requested path to the filesystem base path in DeleteFile.
We were trying to delete things in the current directory instead of the actual filesystem directory. This may fix some savedata issues in some games.
2018-07-14 10:57:22 -05:00
bunnei 7230ceb584
Merge pull request #559 from Subv/mount_savedata
Services/FS: Return the correct error code when trying to mount a nonexistent savedata.
2018-07-11 20:21:52 -07:00
bunnei eb6cbfdbd8 savedata_factory: Always create a save directory for games. 2018-07-08 17:05:13 -04:00
bunnei 913896cbd9 Revert "Virtual Filesystem (#597)"
This reverts commit 77c684c114.
2018-07-07 20:24:51 -07:00
Zach Hilman 77c684c114 Virtual Filesystem (#597)
* Add VfsFile and VfsDirectory classes

* Finish abstract Vfs classes

* Implement RealVfsFile (computer fs backend)

* Finish RealVfsFile and RealVfsDirectory

* Finished OffsetVfsFile

* More changes

* Fix import paths

* Major refactor

* Remove double const

* Use experimental/filesystem or filesystem depending on compiler

* Port partition_filesystem

* More changes

* More Overhaul

* FSP_SRV fixes

* Fixes and testing

* Try to get filesystem to compile

* Filesystem on linux

* Remove std::filesystem and document/test

* Compile fixes

* Missing include

* Bug fixes

* Fixes

* Rename v_file and v_dir

* clang-format fix

* Rename NGLOG_* to LOG_*

* Most review changes

* Fix TODO

* Guess 'main' to be Directory by filename
2018-07-06 10:51:32 -04:00
James Rowe 0d46f0df12 Update clang format 2018-07-02 21:45:47 -04:00
James Rowe 638956aa81 Rename logging macro back to LOG_* 2018-07-02 21:45:47 -04:00
Zach Hilman 63f26d5c40 Add support for decrypted NCA files (#567)
* Start to add NCA support in loader

* More nca stuff

* More changes to nca.cpp

* Now identifies decrypted NCA cont.

* Game list fixes and more structs and stuff

* More updates to Nca class

* Now reads ExeFs (i think)

* ACTUALLY LOADS EXEFS!

* RomFS loads and games execute

* Cleanup and Finalize

* plumbing, cleanup and testing

* fix some things that i didnt think of before

* Preliminary Review Changes

* Review changes for bunnei and subv
2018-06-21 11:16:23 -04:00
Subv a3d82ef5d9 Build: Fixed some MSVC warnings in various parts of the code. 2018-06-20 11:39:10 -05:00
Subv 5f57a70a7d Services/FS: Return the correct error code when trying to mount a nonexistent savedata. 2018-06-18 19:26:01 -05:00
Lioncash 7c9644646f
general: Make formatting of logged hex values more straightforward
This makes the formatting expectations more obvious (e.g. any zero padding specified
is padding that's entirely dedicated to the value being printed, not any pretty-printing
that also gets tacked on).
2018-05-02 09:49:36 -04:00
Lioncash 3f78a61f09
file-sys: convert a StringFromFormat call into fmt::format in GetFullPath()
Lessens the amount to read and gets rid of the PRIX64 macro, allowing us to use a single string
for the whole path, making it easier to read.
2018-04-25 12:35:37 -04:00
Lioncash 5aafc83cc9
file-sys: Move logging macros over to the new fmt-capable ones 2018-04-25 12:35:33 -04:00
mailwl a0179e5ca5 Service/FS: implement IFileSystem::RenameFile 2018-04-24 10:56:05 +03:00
Lioncash 80982748c8 disk_filesystem: Remove unused total_entries_in_directory member from Disk_Directory 2018-04-19 21:28:56 -04:00
Lioncash e61a4dd485 disk_filesystem: Remove redundant initializer in Disk_Directory's constructor 2018-04-19 21:28:07 -04:00
Lioncash b05f8ea5b5 disk_filesystem: Make constructors explicit where applicable 2018-04-19 21:27:43 -04:00
shinyquagsire23 de580ccdd5 file_sys: Use NGLOG 2018-04-17 09:55:29 -06:00
shinyquagsire23 83aa38b239 file_sys: tweaks 2018-04-16 06:51:59 -06:00
shinyquagsire23 c03795300a file_sys: Add HFS/PFS helper component 2018-04-16 04:36:25 -06:00
bunnei bddad50dd4 fsp_srv: Implement DeleteFile.
- Used by Binding of Isaac.
2018-04-15 13:15:18 -04:00
bunnei 88582b84a5 fsp_srv: Implement GetSize and SetSize. 2018-03-31 16:06:45 -04:00
Subv 4c06d55a81 FS: Move the file open mode calculation to a separate function. 2018-03-23 14:27:07 -05:00
Subv eff3f60b73 FS: Implemented IFileSystem::CreateDirectory. 2018-03-21 09:55:59 -05:00
Subv 6d90d99d12 FS: Implement DiskFileSystem's OpenDirectory interface. 2018-03-19 23:00:37 -05:00
Subv e1d7b9fc2c FS: Implement DiskFileSystem::GetEntryType for existing files/directories. 2018-03-19 22:59:38 -05:00
Subv a9ba2c2000 FS: Updated the Directory Entry structure to match the Switch. 2018-03-19 22:58:55 -05:00
Subv fc44261dd1 FS: Support the file Append open mode. 2018-03-19 22:57:34 -05:00
Subv c4ca802b9d FS: Added an SDMC archive factory and registered it to the SDMC archive on startup. 2018-03-19 21:17:15 -05:00
bunnei 7d6653268f core: Move process creation out of global state. 2018-03-14 18:42:19 -04:00
Subv 84e1c0a430 FS: Use the correct error code when trying to open files that don't exist. 2018-03-04 14:34:48 -05:00
Subv 0eefe6e4d1 FS: Make EnsureSaveData create the savedata folder when called for the first time. 2018-03-04 14:30:07 -05:00
Subv 3209cff530 SaveData: Use the current titleid when opening the savedata archive. 2018-03-01 19:03:54 -05:00
Subv d140c8ecf7 Filesystem: Added a SaveData Factory and associated Disk_FileSystem. 2018-03-01 19:03:52 -05:00
shinyquagsire23 e29710818f file_sys: Style tweaks
Asdf
2018-02-25 16:34:29 -07:00
shinyquagsire23 2b28fd7809 file_sys: Add support for parsing NPDM files 2018-02-25 07:02:39 -07:00
bunnei 5035d18baa file_sys: Clang format fixes. 2018-01-21 15:51:45 -05:00
bunnei 00851a5ef4 file_sys: Cleanup to better match Switch file system constructs.
file_sys: Add factory class for RomFS file system.
2018-01-21 15:39:26 -05:00
bunnei 1c06c918af file_sys: Remove disk_archive, savedata_archive, and title_metadata. 2018-01-21 15:39:23 -05:00
bunnei 7988f02489 archive_backend: Minor changes to match Switch IFileSystem. 2018-01-21 15:39:20 -05:00
bunnei 2f71a32363 file_sys: Repurpose 3DS IVFC code for Switch ROMFS. 2018-01-21 15:39:18 -05:00
James Rowe 096be16636 Format: Run the new clang format on everything 2018-01-20 16:45:11 -07:00
N00byKing 66388f7576
Update title_metadata.h 2018-01-17 18:20:52 +01:00
bunnei 8e51c61dbc core: Gut out cryptop, since it doesn't compile with C++17. 2018-01-12 19:36:41 -05:00
bunnei 34571f4d2e hle: Use Switch formatted result codes. 2017-10-31 19:26:11 -04:00
bunnei 746c2a3ae7 core: Refactor MakeMagic usage and remove dead code. 2017-10-15 00:11:38 -04:00
bunnei 72b03025ac Remove lots more 3DS-specific code. 2017-10-12 21:21:49 -04:00
bunnei b1d5db1cf6 Merge remote-tracking branch 'upstream/master' into nx
# Conflicts:
#	src/core/CMakeLists.txt
#	src/core/arm/dynarmic/arm_dynarmic.cpp
#	src/core/arm/dyncom/arm_dyncom.cpp
#	src/core/hle/kernel/process.cpp
#	src/core/hle/kernel/thread.cpp
#	src/core/hle/kernel/thread.h
#	src/core/hle/kernel/vm_manager.cpp
#	src/core/loader/3dsx.cpp
#	src/core/loader/elf.cpp
#	src/core/loader/ncch.cpp
#	src/core/memory.cpp
#	src/core/memory.h
#	src/core/memory_setup.h
2017-10-09 23:56:20 -04: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
bunnei 8c92435ded nso: Refactor and allocate .bss section. 2017-09-30 14:33:58 -04: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
Yuri Kunde Schlesner 5c5cf2f8e0 Core: Properly configure address space when loading a binary
The code now properly configures the process image to match the loaded
binary segments (code, rodata, data) instead of just blindly allocating
a large chunk of dummy memory.
2015-07-11 23:54:42 -03:00
Emmanuel Gil Peyrot e5fcabdd69 Core: Cleanup file_sys includes. 2015-06-28 00:36:54 +01:00
Emmanuel Gil Peyrot 45c4781544 CitraQt: Cleanup includes. 2015-06-28 00:36:54 +01:00
Emmanuel Gil Peyrot 2d044a67c9 Common: Cleanup memory and misc includes. 2015-06-28 00:36:54 +01:00
Emmanuel Gil Peyrot 8cf9eb7f43 Common: Fix FileUtil includes, and everything relying on those. 2015-06-28 00:36:53 +01:00
Subv 66c1db7288 ExtSavedata: Save the icon passed to CreateExtSaveData to the correct folder.
Organize the ExtSaveData folders as they are stored in the console.
2015-06-01 21:48:19 -05:00
Emmanuel Gil Peyrot b1503b2020 Remove every trailing whitespace from the project (but externals). 2015-05-29 21:59:29 +01:00
Yuri Kunde Schlesner 7ada357b2d Memmap: Re-organize memory function in two files
memory.cpp/h contains definitions related to acessing memory and
configuring the address space
mem_map.cpp/h contains higher-level definitions related to configuring
the address space accoording to the kernel and allocating memory.
2015-05-15 00:04:38 -03:00
Yuri Kunde Schlesner a5eba2f984 Kernel: Remove g_program_id
This has been obsoleted by the field in Process.
2015-05-08 22:11:03 -03:00
Yuri Kunde Schlesner e1fbac3ca1 Common: Remove common.h 2015-05-07 15:45:22 -03:00
Yuri Kunde Schlesner c0eaa662d4 Clean-up includes 2015-05-06 23:45:06 -03:00
Yuri Kunde Schlesner b89f644cfe FileSys: De-inline Path members 2015-05-06 23:45:06 -03:00
Yuri Kunde Schlesner 6f89d25f90 FileSys: Clean-up includes, de-inline destructors 2015-05-06 23:45:06 -03:00
Emmanuel Gil Peyrot bdcf28e3bc Headers: Add some forgotten overrides, thanks clang! 2015-04-14 21:18:25 +02:00
Subv 1d61cd4460 Services/FS: Implemented DeleteExtSaveData, CreateSystemSaveData and DeleteSystemSaveData
Also fixed a bug with CreateExtSaveData that made it unable to create ExtSaveData archives in the SDMC directory.
2015-03-14 12:00:01 -05:00
Subv 9db5c9b6dc Archives: Properly implemented the SystemSaveData archive.
Ported to the new factory pattern we have for archives.
2015-02-25 19:37:10 -05:00
Yuri Kunde Schlesner 3f1a3952d7 FS: Allow multiple instances of the same archive type to be open at once 2015-02-10 13:43:44 -02:00
Subv c2e9990149 Services: Stubbed more services.
Implemented FSUser::CreateExtSaveData
2015-01-24 15:44:40 -05:00
bunnei 088863c921 Merge pull request #376 from Subv/arc_reorder
Archives: Change the folder layout of some archives.
2015-01-06 20:13:56 -05:00
Subv 8fbe5d2dca Archives/Exdata: Don't set concrete_mount_point in the ctor 2015-01-06 16:12:25 -05:00
Subv 5244ac0e9c Archives: Addressed some comments 2015-01-06 15:02:30 -05:00
Subv 123a76c9c8 SaveDataCheck: Fixed a typo 2015-01-05 16:40:36 -05:00
Subv 90dffe3fc1 Archives: Make SYSTEM_ID and SDCARD_ID strings 2015-01-04 09:10:27 -05:00
Subv 71a063f45c Archives: Changed the way paths are built for the archives.
Each archive now takes a mount point of either NAND or SDMC, and builds its own directory structure there, trying to simulate an HLE-friendly hardware layout
2015-01-03 20:46:05 -05:00
Subv cfd7b219f6 SaveDataCheck: Move the files to nand/title
under /nand/title/high/low/content/00000000.app.romfs
2015-01-03 19:01:46 -05:00
Yuri Kunde Schlesner 930e13cb2c FileSys: Fix crash bug in DiskFile exposed by #400 2015-01-03 18:28:37 -02:00
Yuri Kunde Schlesner 19b2e739c5 FileSys: Fix a few memory leaks 2015-01-03 17:16:16 -02:00
Subv 3bc9f5509b Archives: Change the folder layout of some archives.
This is to better represent the hardware layout, they are still aren't quite accurate, but this better and will help a bit when implementing the other archives like NAND-RO and NAND-RW
2015-01-02 21:55:13 -05:00
Subv 22cfa55302 IVFCArchive: Use a critical log to notify of invalid operations. 2015-01-02 21:39:31 -05:00
Subv 0d03fdec71 SaveDataCheck: Remove unneeded constructor from a class 2015-01-02 21:28:46 -05:00
Subv 2f9a2d410d Archives: Added some documentation to IVFCArchive 2015-01-02 21:13:55 -05:00
Subv aade417b14 Archives: Reduced duplicate code in RomFS and SaveCheck.
Fixed a few warnings and cleaned up the code
2015-01-02 21:13:54 -05:00
Subv 13efbdc201 SaveDataCheck: Preliminary work in this archive.
This allows Steel Diver to boot further, some files are needed.

This is still not ready and needs a big cleanup, this will possibly be delayed until the way we handle archives is fixed (with factory classes instead of ahead-of-time creation of archives)
2015-01-02 21:13:53 -05:00
Subv 2c89d4d5cd Archives: Implemented ExtSaveData and SharedExtSaveData
They will be stored in /extsavedata/SDMC and /extsavedata/NAND respectively.
Also redirect some APT_A functions to their APT_U equivalents.
Implemented the gamecoin.dat file in SharedExtSaveData in the PTM module.
Implemented formatting the savegame.
Retake a previous savegame if it exists instead of reporting them as not formatted every time a game is loaded.
2014-12-29 22:29:55 -05:00
Emmanuel Gil Peyrot bbe0bf1332 FileSys: Clean up according to the coding style, and remove redundant namespaced names. 2014-12-24 01:49:48 +00:00
Subv 6115f013a9 CFG: Create a new subfolder cfg inside service to handle cfg
Moved most of the shared CFG code there, implemented a few CFG:I functions
2014-12-21 16:41:06 -05:00
Subv a1b9b80a55 Style: Addressed some comments 2014-12-21 16:39:20 -05:00
Subv 4cd21b43c1 CFG: Refactored how the config file works.
It is now kept in memory as per 3dbrew, all updates happen on memory, then they can be saved using UpdateConfigNANDSavegame.
2014-12-21 16:38:59 -05:00
Subv fa3d72ab3e CFG: Implemented the GetConfigInfoBlk2 function.
Added a "config" file to the CFG process service (CFG:U), and added a few default blocks to it.

Implemented GetSystemModel and GetModelNintendo2DS
2014-12-21 16:38:54 -05:00
bunnei 0de6a08d75 Merge pull request #291 from purpasmart96/license
License change
2014-12-21 16:05:44 -05:00
bunnei 572ce043c2 Merge pull request #271 from archshift/createf
Added CreateFile to the FS_USER service
2014-12-21 01:45:00 -05:00
archshift 0625dd09ea Added CreateFile to the FS_USER service
Tested with hwtests.
2014-12-21 02:21:49 -03:00
purpasmart96 ebfd831ccb License change 2014-12-20 21:20:24 -08:00
bunnei 2b0d7a1d29 Merge pull request #315 from chinhodado/master
Clean up some warnings
2014-12-20 11:59:18 -05:00
Chin e795692614 Clean up some warnings 2014-12-20 10:03:36 -05:00
Yuri Kunde Schlesner 82528ba7df Common: Add a clone of std::make_unique 2014-12-20 03:45:02 -02:00
Subv f9472eda0a SystemSaveData: Added a TODO to move it to the NAND.
Maybe sometime when we actually implement that
2014-12-18 16:58:42 -05:00
Subv bec527fa24 SaveData: Implemented the SystemSaveData archive.
It will be stored in the /syssavedata folder. This archive is user by various Services and possibly games via the FS:U service.
2014-12-17 23:44:32 -05:00
Subv ea9ce0fba7 Filesystem/Archives: Implemented the SaveData archive
The savedata for each game is stored in /savedata/<ProgramID> for NCCH files. ELF files and 3DSX files use the folder 0 because they have no ID information

Got rid of the code duplication in File and Directory

Files that deal with the host machine's file system now live in DiskFile, similarly for directories and DiskDirectory and archives with DiskArchive.

FS_U: Use the correct error code when a file wasn't found
2014-12-17 19:21:38 -05:00
Yuri Kunde Schlesner 83e6e4ffec FS.Archive: Clean up treatment of archives and their handles
- Refactor FS::Archive internals to make Archive creation and lifetime
  management clearer.
- Remove the "Archive as a File" hack.
- Implement 64-bit Archive handles.
2014-12-16 01:08:44 -02:00
Yuri Kunde Schlesner 0931a42af0 Service.FS: Rename FileSys::File to FileBackend 2014-12-16 01:08:43 -02:00
Yuri Kunde Schlesner d51afab0bc Service.FS: Rename FileSys::Directory to DirectoryBackend 2014-12-16 01:08:43 -02:00
Yuri Kunde Schlesner 82fe821e87 Service.FS: Rename FileSys::Archive to ArchiveBackend 2014-12-16 01:08:42 -02:00
Yuri Kunde Schlesner f6153679b0 Service.FS: Do archive registration using IdCode instead of name 2014-12-16 01:08:42 -02:00
Yuri Kunde Schlesner 0600e2d8b5 Convert old logging calls to new logging macros 2014-12-13 02:08:02 -02:00
bunnei 1f4953e1bb Merge pull request #264 from Subv/files
Kernel/File: Fixed file read/write hwtests
2014-12-08 18:05:03 -05:00
Subv 1d1078fd8b Kernel/File: Fixed file read/write hwtests
The 3DS allows the user to read from files opened with the Write access modifier, even if he did not specify the Read access modifier.

Open the files in binary mode so that we can prevent CR/LF problems in Windows, where a line-end is replaced by these two bytes instead of just 0xA, this was causing problems with the GetSize test
2014-12-08 17:45:17 -05:00
archshift 20d2ed0950 Make OpenDirectory fail if the directory doesn't exist
This is in line with what the hardware itself does.

It does this by splitting the initial directory opening into Directory.Open(), which will return false if a stat fails.
Then, Archive::OpenDirectory will return nullptr, and archive.cpp will return an error code .
2014-12-07 14:47:14 -08:00
bunnei 5056329a80 Merge pull request #222 from archshift/renamexyz
Implemented RenameFile and RenameDirectory in FS:USER
2014-12-04 22:07:47 -05:00
archshift 139a4d91d9 Updated archive.cpp functions for proper error handling 2014-12-03 22:50:44 -08:00
vaguilar 223e76d51d Fixed formatting and switch statement warnings 2014-11-27 02:59:14 -08:00
archshift e5ff01c2cd Implemented RenameDirectory in FS:USER 2014-11-24 15:09:12 -08:00
archshift 45afc15aa6 Implemented RenameFile in FS:USER 2014-11-24 15:09:11 -08:00
bunnei ef1b16a7eb Merge pull request #191 from archshift/deletexyz
Added DeleteFile and DeleteDirectory functions to FS:USER and the archives.
2014-11-23 20:02:23 -05:00
archshift 8aeadbd95a Added DeleteFile and DeleteDirectory functions to FS:USER and the archives. 2014-11-23 00:33:43 -08:00
Emmanuel Gil Peyrot f5d38649c7 Remove trailing spaces in every file but the ones imported from SkyEye, AOSP or generated 2014-11-19 09:03:07 +00:00
Tony Wasserka d218a547fa Merge pull request #209 from lioncash/warn
directory_sdmc: Fix a signed/unsigned mismatch comparison
2014-11-18 16:54:56 +01:00
Lioncash 548c49dfe9 directory_sdmc: Fix a signed/unsigned mismatch comparison 2014-11-18 08:51:03 -05:00
Lioncash 1a8f466217 Remove extraneous semicolons 2014-11-18 08:27:16 -05:00
bunnei a3107a6b57 FileSys: Updated backend code to use FileSys::Path instead of string for paths. 2014-11-17 21:49:24 -05:00
bunnei c04a04189a FileSys: Added DebugStr method to Path class. 2014-11-17 18:42:37 -05:00
archshift 1f7c4ab7f6 Use std::u16string for conversion between UTF-8 and UTF-16, FS:USER functions 2014-11-12 19:30:17 -08:00
archshift 04c90c395d Added CreateDirectory function to service/fs.cpp, and in Archive. 2014-11-02 10:48:28 -08:00
Sean 9a012ff007 Fix some warnings 2014-10-29 20:26:15 -04:00
archshift a59f57d504 Use config files to store whether SDMC is enabled or not
Before, it used to use whether the directory actually existed. As a result, .citra-emu/sdmc was never auto-created (something quite confusing to me until I read through the logs).
2014-10-22 15:24:25 -07:00
Emmanuel Gil Peyrot fbd72fd6bf Common: Add a helper function to generate a 8.3 filename from a long one.
Core: Fix the SDMC Directory implementation to make blargSnes work.
2014-10-06 19:58:43 +02:00
Emmanuel Gil Peyrot 19c2a96ab0 FileSys: Add static asserts for the Directory struct, and fix its fields position. 2014-10-06 19:58:43 +02:00
Emmanuel Gil Peyrot 0be5c03176 FileSys: split the constructor into an Open method, in order to notify the opener something went wrong.
Kernel: Return an invalid handle to OpenFile when it failed to open.
2014-10-06 19:58:42 +02:00
Emmanuel Gil Peyrot 23c2fbfc7a FileSys/Kernel: Implement SetSize service call for File objects. 2014-10-06 19:58:37 +02:00
Emmanuel Gil Peyrot d34673990b FileSys: Add forgotten docstrings. 2014-10-06 19:54:50 +02:00
Lioncash ca2f0de08a Fix warnings in core and common 2014-09-28 11:44:14 -04:00
Emmanuel Gil Peyrot c14e5713f5 Core: Add a method to obtain a Directory from an Archive. 2014-09-17 14:35:46 +00:00
Emmanuel Gil Peyrot 33b0d1081e Core: Add a Directory object, with both a stub and a passthrough implementations. 2014-09-17 14:35:46 +00:00
Emmanuel Gil Peyrot e73caaefe5 Core: Add a passthrough backend for the filesystem, exposed as SDMC. 2014-09-17 14:35:45 +00:00
Emmanuel Gil Peyrot 9251f7e2f8 Core: Add a new File class, obtainable from an Archive, and a stub implementation. 2014-09-17 14:35:45 +00:00
archshift 4c4a01bf41 Added FS functions to Archive and Archive_RomFS 2014-08-22 15:45:10 -07:00
bunnei 1099d83455 Marked AppLoader_ELF, AppLoader_NCCH, and Archive_RomFS virtual functions as "override". 2014-07-04 20:37:50 -04:00
bunnei 2d734bb6c5 Marked AppLoader_ELF, AppLoader_NCCH, and Archive_RomFS classes as "final" 2014-07-04 20:37:49 -04:00