Commit graph

41 commits

Author SHA1 Message Date
Lioncash
1a954b2a59 service: Eliminate usages of the global system instance
Completely removes all usages of the global system instance within the
services code by passing in the using system instance to the services.
2020-11-26 20:03:11 -05:00
Lioncash
6f8a06bac5 patch_manager: Remove usages of the global system instance
With this, only 19 usages of the global system instance remain within
the core library.

We're almost there.
2020-11-18 09:36:48 -05:00
Lioncash
da7be67daf ipc_helpers: Remove usage of the global system instance
Resolves numerous deprecation warnings throughout the codebase due to
inclusion of this header. Now building core should be significantly less
noisy (and also relying on less global state).

This also uncovered quite a few modules that were relying on indirect
includes, which have also been fixed.
2020-11-08 15:58:11 -05:00
VolcaEM
b5d54619cc
aoc: Update function table (#4170)
* aoc: Update function table

* Remove comments
2020-06-26 20:31:44 -04:00
bunnei
50c7539108
Merge pull request #3094 from lioncash/tables
service: Update function tables
2019-11-24 20:30:58 -05:00
Lioncash
e21b6ff79d service: Update function tables
Keeps the function tables up to date.

Updated based off information from Switchbrew.
2019-11-12 10:32:56 -05:00
Lioncash
f11b87ebf1 service: Resolve sign conversion errors
These are fairly trivial to resolve and most of the changes entail
using RESULT_UNKNOWN over ResultCode(-1).
2019-11-12 07:55:39 -05:00
bunnei
b0ab803ce8 kernel: events: Remove ResetType::Automatic.
- This does not actually seem to exist in the real kernel - games reset these automatically.

# Conflicts:
#	src/core/hle/service/am/applets/applets.cpp
#	src/core/hle/service/filesystem/fsp_srv.cpp
2019-11-03 04:22:45 -05:00
David Marcec
bd1c4ec9a0 Rebase 2019-09-22 16:41:34 +10:00
David Marcec
7da8e3f812 Deglobalize System: Aoc 2019-09-22 16:30:17 +10:00
Lioncash
3e7d37301a service/aoc: Avoid allocating and discarding data
Previously, the code was accumulating data into a std::vector and then
tossing all of it away if a setting was disabled.

Instead, we can just check if it's disabled and do no work at all if
possible. If it's enabled, then we can append to the vector and
allocate.

Unlikely to impact usage much, but it is slightly less sloppy with
resources.
2019-05-23 00:26:21 -04:00
Lioncash
d0e200a894 service/aoc: Remove unnecessary includes
Removes two header dependencies related to file handling that aren't
actually used within the source file.
2019-05-22 23:26:12 -04:00
Lioncash
819d229e76 service/aoc: Pop all passed values where applicable
A few of the aoc service stubs/implementations weren't fully popping all
of the parameters passed to them. This ensures that all parameters are
popped and, at minimum, logged out.
2019-05-22 23:24:27 -04:00
Lioncash
a47aaa7f1b core/kernel/object: Rename ResetType enum members
Renames the members to more accurately indicate what they signify.
"OneShot" and "Sticky" are kind of ambiguous identifiers for the reset
types, and can be kind of misleading. Automatic and Manual communicate
the kind of reset type in a clearer manner. Either the event is
automatically reset, or it isn't and must be manually cleared.

The "OneShot" and "Sticky" terminology is just a hold-over from Citra
where the kernel had a third type of event reset type known as "Pulse".
Given the Switch kernel only has two forms of event reset types, we
don't need to keep the old terminology around anymore.
2019-05-18 15:52:51 -04:00
Lioncash
ca96dc4676 service: Update service function tables
Updates function tables based off information from SwitchBrew.
2019-04-11 02:47:00 -04:00
Zach Hilman
60f39060c6 core: Port current uses of RegisteredCache to ContentProvider 2019-03-26 22:05:37 -04:00
Zach Hilman
51483d83bb aoc_u: Obey disabled add-ons list when listing DLC 2018-12-03 17:21:25 -05:00
bunnei
f6b22d9251
Merge pull request #1835 from lioncash/cache-global
filesystem: De-globalize registered_cache_union
2018-12-03 17:11:26 -05:00
Lioncash
db4523f1ec filesystem: De-globalize registered_cache_union
We can just return a new instance of this when it's requested. This only
ever holds pointers to the existing registed caches, so it's not a large
object. Plus, this also gets rid of the need to keep around a separate
member function just to properly clear out the union.

Gets rid of one of five globals in the filesystem code.
2018-12-01 23:43:23 -05:00
Zach Hilman
a342bcc9b1 kernel/event: Reference ReadableEvent from WritableEvent 2018-11-29 08:48:40 -05:00
Zach Hilman
ff610103b5 core: Port all current usages of Event to Readable/WritableEvent 2018-11-29 08:45:41 -05:00
David Marcec
a2cc3b10bb Changed logging to be "Log before execution", Added more error logging, all services should now log on some level 2018-11-26 17:06:13 +11:00
Lioncash
a3d1ede25f
aoc_u: Make use of previously-unused CheckAOCTitleIDMatchesBase() function
We can just call the function instead of duplicating the code here. This
also prevents an unused function warning.

We also don't need to take the lambda capture by reference. It's just a
u64 value, so by value is fine here.
2018-10-24 00:13:08 -04:00
Zach Hilman
7e0d2fc994 aoc_u: Stub GetAddOnContentListChangedEvent
This event signals the game when new DLC is purchased from the eShop while the game is running. Since, for the forseeable future, yuzu will not have this ability, it seems safe to stub with a dummy event that will never fire. This is needed to boot Sonic Mania Plus (update v1.04).
2018-10-19 21:21:37 -04:00
Zach Hilman
5737441374 aoc: Read DLC base title ID from RegisteredCache
Falls back to title ID + 0x1000, which is what HOS does.
2018-10-14 18:58:14 -04:00
Zach Hilman
7e2096db8a aoc: Return size in ListAddOnContent 2018-10-13 22:52:54 -04:00
David Marcec
fa3f3cd07f Fixed assertion due to CountAddOnContent
Word count should be 3 since we're pushing a result code and a u32.

Also fixed up compiler warnings due to casting
2018-10-08 00:25:46 +11:00
Zach Hilman
9aaf1c0df8 aoc_u: Fix edge case with DLC that causes breaks
In some games (Splatoon 2 and Splatoon 2 Splatfest World Premiere, notably), pass offset=0 and count=2047 into the ListAddOnContent method which should return all DLCs for the current title. The (presumably) intended behavior is to successfully return a empty array but because of a < v. <= in an if statement, a failure error code was returned causing these games to svcBreak. This fixes that if statement.
2018-10-02 21:56:32 -04:00
Zach Hilman
f72046099a aoc_u: Extract AccumulateAOCTitleIDs to separate function 2018-09-30 21:07:22 -04:00
Zach Hilman
7d86a008e2 aoc_u: Implement GetAddOnContentBaseId
Command #5
2018-09-30 21:01:35 -04:00
Zach Hilman
62225ae050 aoc_u: Implement Count, List and Prepare AddOnContent
Commands #2, #3, and #7
2018-09-30 21:01:35 -04:00
Lioncash
6ac955a0b4 hle/service: Default constructors and destructors in the cpp file where applicable
When a destructor isn't defaulted into a cpp file, it can cause the use
of forward declarations to seemingly fail to compile for non-obvious
reasons. It also allows inlining of the construction/destruction logic
all over the place where a constructor or destructor is invoked, which
can lead to code bloat. This isn't so much a worry here, given the
services won't be created and destroyed frequently.

The cause of the above mentioned non-obvious errors can be demonstrated
as follows:

------- Demonstrative example, if you know how the described error happens, skip forwards -------

Assume we have the following in the header, which we'll call "thing.h":

\#include <memory>

// Forward declaration. For example purposes, assume the definition
// of Object is in some header named "object.h"
class Object;

class Thing {
public:
    // assume no constructors or destructors are specified here,
    // or the constructors/destructors are defined as:
    //
    // Thing() = default;
    // ~Thing() = default;
    //

    // ... Some interface member functions would be defined here

private:
    std::shared_ptr<Object> obj;
};

If this header is included in a cpp file, (which we'll call "main.cpp"),
this will result in a compilation error, because even though no
destructor is specified, the destructor will still need to be generated by
the compiler because std::shared_ptr's destructor is *not* trivial (in
other words, it does something other than nothing), as std::shared_ptr's
destructor needs to do two things:

1. Decrement the shared reference count of the object being pointed to,
   and if the reference count decrements to zero,

2. Free the Object instance's memory (aka deallocate the memory it's
   pointing to).

And so the compiler generates the code for the destructor doing this inside main.cpp.

Now, keep in mind, the Object forward declaration is not a complete type. All it
does is tell the compiler "a type named Object exists" and allows us to
use the name in certain situations to avoid a header dependency. So the
compiler needs to generate destruction code for Object, but the compiler
doesn't know *how* to destruct it. A forward declaration doesn't tell
the compiler anything about Object's constructor or destructor. So, the
compiler will issue an error in this case because it's undefined
behavior to try and deallocate (or construct) an incomplete type and
std::shared_ptr and std::unique_ptr make sure this isn't the case
internally.

Now, if we had defaulted the destructor in "thing.cpp", where we also
include "object.h", this would never be an issue, as the destructor
would only have its code generated in one place, and it would be in a
place where the full class definition of Object would be visible to the
compiler.

---------------------- End example ----------------------------

Given these service classes are more than certainly going to change in
the future, this defaults the constructors and destructors into the
relevant cpp files to make the construction and destruction of all of
the services consistent and unlikely to run into cases where forward
declarations are indirectly causing compilation errors. It also has the
plus of avoiding the need to rebuild several services if destruction
logic changes, since it would only be necessary to recompile the single
cpp file.
2018-09-10 23:55:31 -04:00
James Rowe
638956aa81 Rename logging macro back to LOG_* 2018-07-02 21:45:47 -04:00
Lioncash
e74dbfc572
aoc: Move logging macros over to new fmt-compatible ones 2018-04-24 10:14:52 -04:00
Lioncash
ccca5e7c28 service: Use nested namespace specifiers where applicable
Tidies up namespace declarations
2018-04-19 22:20:28 -04:00
Hexagon12
c79c9755b4
Updated AOC with more service names. 2018-04-10 18:42:28 +03:00
mailwl
e4f94ee30b Stub more functions 2018-02-22 17:28:15 +03:00
mailwl
46931a9566 Service/AOC: stub ListAddOnContent function 2018-02-20 10:30:12 +03:00
bunnei
1247c53786 yuzu: Update license text to be consistent across project. 2018-01-13 16:22:39 -05:00
bunnei
b67cbb8d92 ap, aoc_u: Minor cleanup. 2017-12-28 23:45:44 -05:00
bunnei
d5995fd30f service: Add empty interface for aoc:u. 2017-12-28 15:24:05 -05:00