Commit graph

45 commits

Author SHA1 Message Date
Weiyi Wang
28513c5177 ResultCode: use default copy assignment
Our definition of the copy assignment is equivalent to the default one, but prevents the type being trivially copyable
2018-11-12 13:59:34 -05:00
Yuri Kunde Schlesner
723dc644fa ResultVal: Remove MoveFrom()
Replace it with std::move(result_val).Unwrap(), or Foo().Unwrap() in
case you already have an rvalue.
2017-06-18 19:03:15 -07:00
Yuri Kunde Schlesner
4cb47b0278 ResultVal: Add an rvalue overload of Unwrap() 2017-06-18 18:49:46 -07:00
Yuri Kunde Schlesner
7e5dd46cf4 ResultVal: Add more convenience utils for creating and cascading results 2017-06-06 00:51:57 -07:00
Yuri Kunde Schlesner
2cdb40d709 Kernel: Centralize error definitions in errors.h 2017-05-24 21:06:00 -07:00
Yuri Kunde Schlesner
743d18f0e4 GSP_GPU: Move error codes from result.h to local file 2017-05-24 21:06:00 -07:00
Yuri Kunde Schlesner
92be29adba FileSys: Move all result description to errors.h 2017-05-24 21:06:00 -07:00
Yuri Kunde Schlesner
3b1f0fea31 result: Make error description a generic integer
It is now known that result code description vary depending on the
module, and so they're best defined on a per-module basis. To support
this, allow passing in an arbitrary integer instead of limiting to the
ones in the ErrorDescription enum. These will be gradually migrated to
their individual users, but a few will be kept as "common" codes shared
by all modules.
2017-05-24 21:05:59 -07:00
Yuri Kunde Schlesner
a75145a2c6 Make BitField and ResultCode constexpr-initializable 2017-05-24 21:05:59 -07:00
Subv
ddfabf3133 Kernel: Use a Session object to keep track of the status of a Client/Server session pair.
Reduce the associated port's connection count when a ServerSession is destroyed.
2017-05-15 11:22:15 -05:00
wwylele
a0df747325 file_sys: add Self NCCH archive 2017-02-13 13:57:38 +02:00
Yuri Kunde Schlesner
905fc92ce1 Merge pull request #2249 from Subv/sessions_v3
Kernel/IPC: Use Ports and Sessions as the fundamental building block of Inter Process Communication.
2016-12-14 20:35:33 -08:00
Subv
c93c5a72bb Return an error code when connecting to a saturated port.
The error code was taken from the 3DS kernel.
2016-12-05 13:59:57 -05:00
wwylele
589b642790 FileSys: Implement OtherSaveData 2016-11-29 23:50:00 +02:00
wwylele
0987783699 FileSys: add SDMCWriteOnlyArchive 2016-11-19 18:55:34 +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
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
JamePeng
f87bb8ba0a Fix the errorcode of archive handle 2016-07-05 00:39:09 +08:00
wwylele
e023a4cfd0 Result: fix and update ErrorModule 2016-06-30 11:26:53 +03:00
mailwl
07cc781163 gsp::gpu: Reset g_thread_id in UnregisterInterruptRelayQueue 2016-06-01 09:40:15 +03:00
Subv
0fb6d2a247 Kernel: Implemented shared memory permissions. 2016-05-12 20:01:26 -05:00
Emmanuel Gil Peyrot
691a42fe98 VideoCore: Run include-what-you-use and fix most includes. 2016-04-30 17:02:41 +01:00
MerryMage
2929b67c5f DSP_DSP: Add return IPC headers 2016-04-27 06:35:08 +01:00
purpasmart96
abe5c6efec GSP: Return proper error codes for register writes 2016-03-30 18:31:49 -07: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
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
b350f192bb HLE/FS: Corrected the error codes for CreateFile 2016-03-20 14:28:10 -05:00
Yuri Kunde Schlesner
6dd05e610a core: Use unrestricted union to hold storage of ResultVal value 2016-03-05 00:13:20 -08:00
MerryMage
6c71858c5c BitField: Make trivially copyable and remove assignment operator 2016-02-12 19:51:16 +00:00
Subv
d90d5a0ee6 HLE/SVC: Implement UnmapMemoryBlock.
This implementation will need to be (almost completely) changed when we implement multiprocess support.
2016-01-14 11:29:19 -05:00
Emmanuel Gil Peyrot
596b7c4f63 Common: Cleanup key_map includes. 2015-06-28 00:36:54 +01:00
Yuri Kunde Schlesner
e1fbac3ca1 Common: Remove common.h 2015-05-07 15:45:22 -03:00
Lioncash
99ff8bbb0c result: Make comparison operators take references
It's unnecessary to make copies for simple comparisons like this.
2015-02-27 21:16:21 -05:00
archshift
3c48697ea3 Convert a few C stdlib asserts to Citra's own asserts 2015-02-18 21:52:36 -08:00
archshift
ef24e72b26 Asserts: break/crash program, fit to style guide; log.h->assert.h
Involves making asserts use printf instead of the log functions (log functions are asynchronous and, as such, the log won't be printed in time)
As such, the log type argument was removed (printf obviously can't use it, and it's made obsolete by the file and line printing)

Also removed some GEKKO cruft.
2015-02-10 18:30:31 -08:00
Subv
ca1a87ef7d ResultVal: Fixed compilation when reassigning a ResultVal. 2015-02-10 13:43:44 -02:00
Yuri Kunde Schlesner
09ae6e1fa3 Remove result.h InvalidHandle
It was only being used in two places, where it was replaced by a local
constant.
2015-01-30 11:49:45 -02:00
Yuri Kunde Schlesner
afc416c607 Additions to ResultVal to make it more convenient to use. 2015-01-30 11:47:02 -02:00
archshift
228843c43e Logging: Log all called service functions (under trace). Compile out all trace logs under release for performance. 2015-01-10 14:32:10 -08:00
purpasmart96
ebfd831ccb License change 2014-12-20 21:20:24 -08: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
c2588403c0 HLE: Revamp error handling throrough the HLE code
All service calls in the CTR OS return result codes indicating the
success or failure of the call. Previous to this commit, Citra's HLE
emulation of services and the kernel universally either ignored errors
or returned dummy -1 error codes.

This commit makes an initial effort to provide an infrastructure for
error reporting and propagation which can be use going forward to make
HLE calls accurately return errors as the original system. A few parts
of the code have been updated to use the new system where applicable.

One part of this effort is the definition of the `ResultCode` type,
which provides facilities for constructing and parsing error codes in
the structured format used by the CTR.

The `ResultVal` type builds on `ResultCode` by providing a container for
values returned by function that can report errors. It enforces that
correct error checking will be done on function returns by preventing
the use of the return value if the function returned an error code.

Currently this change is mostly internal since errors are still
suppressed on the ARM<->HLE border, as a temporary compatibility hack.
As functionality is implemented and tested this hack can be eventually
removed.
2014-11-24 17:08:36 -02:00