Commit graph

107 commits

Author SHA1 Message Date
bunnei
ddfdeea3af
Merge pull request #2667 from DarkLordZach/profile-editor
acc: Implement IProfileEditor interface and 'Store'/'StoreWithImage' commands
2019-09-14 00:46:18 -04:00
Zach Hilman
471b2a4211 acc_su: Implement GetProfileEditor (205)
Takes a UUID of a user and provides and interface that allows RW access to user data/settings.
2019-07-03 07:57:41 -05:00
Zach Hilman
812fb30821 acc: Implement IProfileEditor-specific commands 'Store' and 'StoreWithImage'
Verified with IDA
2019-07-03 07:57:03 -05:00
Zach Hilman
02560d6482 profile_manager: Add setter for ProfileBase and ProfileData
Needed by IProfileEditor 'Store' and 'StoreWithImage'
2019-07-03 07:56:28 -05:00
Zach Hilman
39f6d57c34 acc: Add IProfileCommon for IProfile and IProfileEditor
Since 2/3 of the commands are shared, this is likely how its done on HW.
2019-07-03 07:55:54 -05:00
David Marcec
fd6549be73 Addressed issues 2019-06-28 15:19:51 +10:00
David Marcec
0b03e8a98f Implemented InitializeApplicationInfo & InitializeApplicationInfoRestricted
InitializeApplicationInfoRestricted will need further implementation as it's checking for other user requirements about the game. As we're emulating, we're assuming the user owns the game so we skip these checks currently, implementation will need to be added further on
2019-06-27 16:44:42 +10:00
Lioncash
82cd87f6c2 service/acc: Silence truncation warnings
The sanitizing function ensures that the returned type is always the
correct type. This eliminates warnings without extra casts.
2019-06-21 10:04:31 -04:00
David Marcec
6ca20ad7ba Addressed issues 2019-06-17 08:17:26 +10:00
David Marcec
5fb6781c61 Cleanup 2019-06-16 20:18:35 +10:00
David Marcec
335127af69 Impl'd IsUserAccountSwitchLocked, SetAudioOutVolume, GetAudioOutVolume & Partial impl of GetAccumulatedSuspendedTickChangedEvent
IPC-100 was changed to InitializeApplicationInfoOld instead of InitializeApplicationInfo. IPC-150 makes an indentical call to IPC-100 however does extra processing. They should not have the same name as it's quite confusing to debug.
2019-06-16 19:06:33 +10:00
Zach Hilman
11f2f0f45c constants: Extract backup JPEG used by account services 2019-06-07 17:46:57 -04:00
Zach Hilman
f0db2e3ef3 mii_manager: Cleanup and optimization 2019-04-25 08:07:57 -04:00
Zach Hilman
ca5638a142 common: Extract UUID to its own class
Since the Mii database uses UUIDs very similar to the Accounts database, it makes no sense to not share code between them.
2019-04-25 08:07:57 -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
bunnei
1e49a85106
Merge pull request #1801 from ogniK5377/log-before-execute
Changed logging to be "Log before execution", Added more error logging, all services/svc should now log on some level
2018-11-29 00:58:46 -05:00
Zach Hilman
dac0c33fd2 profile_manager: Save and load ProfileData from disk
The ProfileData is a 0x80-sized structure that stores various pieces of miscellaneous data for the account.
2018-11-26 17:11:12 -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
bunnei
c6c74248fe
Merge pull request #1697 from lioncash/acc
acc/profile_manager: Minor cleanup-related changes
2018-11-14 19:02:25 -08:00
Lioncash
cd47af8af0 service/acc: Correct error case within TrySelectUserWithoutInteraction()
empty() in this case will always return false, since the returned
container is a std::array. Instead, check if all given users are invalid
before returning the error code.
2018-11-14 17:43:23 -05:00
Lioncash
9761936e02 profile_manager: Replace iterative loop with a ranged-for loop in ParseUserSaveFile() 2018-11-14 17:13:17 -05:00
Lioncash
1af13e0802 profile_manager: Move UUID Format function definitions into the cpp file
Avoids relying on fmt always being indirectly included.
2018-11-14 17:08:59 -05:00
David Marcec
ad45d68871 fixed spelling error 2018-11-07 12:04:43 +11:00
David Marcec
49cb4fa37b Added missing log 2018-11-07 11:46:04 +11:00
David Marcec
92fcc6d15a Implement acc:TrySelectUserWithoutInteraction
Needed for Shantae - Half-Genie Hero - Ultimate Edition!
2018-11-07 11:45:01 +11:00
bunnei
1069eced84
Merge pull request #1615 from lioncash/input
configure_system: Contrain profile usernames to 32 characters
2018-11-01 19:10:26 -04:00
Lioncash
a6830e61b8 configure_system: Contrain profile usernames to 32 characters
Previously, we would let a user enter an unbounded name and then
silently truncate away characters that went over the 32-character limit.
This is kind of bad from the UX point of view, because we're essentially
not doing what the user intended in certain scenarios.

Instead, we clamp it to 32 characters and make that visually apparent in
the dialog box to provide a name for a user.
2018-10-31 02:05:00 -04:00
Frederic L
7a5eda5914 global: Use std::optional instead of boost::optional (#1578)
* get rid of boost::optional

* Remove optional references

* Use std::reference_wrapper for optional references

* Fix clang format

* Fix clang format part 2

* Adressed feedback

* Fix clang format and MacOS build
2018-10-30 00:03:25 -04:00
bunnei
0634aee267
Merge pull request #1576 from lioncash/acc-warn
service/acc: Silence compiler truncation warnings
2018-10-25 12:22:10 -04:00
Lioncash
1e3b139cd7 service/acc: Move fallback image to file scope
This is just flat data, so it doesn't really need to be in the function
itself. This also allows deduplicating the constant for the backup size
in GetImageSize().
2018-10-24 18:22:24 -04:00
Lioncash
6f00628564 service/acc: Silence compiler warnings
Silences compiler warnings related to truncation. This also introduces a
small helper function to perform the clamping of the image size.
2018-10-24 18:22:24 -04:00
Lioncash
3ec90dc6ef service/acc: Early return in failure case in LoadImage()
Allows unindenting the other branch's code.
2018-10-24 18:22:20 -04:00
Lioncash
4a31f99a02 profile_manager: Use std::optional instead of boost::optional
Now that we can actually use std::optional on macOS, we don't need to
continue using boost::optional here.
2018-10-24 11:06:52 -04:00
Zach Hilman
bfad41b0c1 profile_manager: Create save data if it doesn't exist on use 2018-10-23 19:31:28 -04:00
Zach Hilman
45f2a2fe29 acc: Fix account UUID duplication error 2018-10-23 19:31:28 -04:00
Zach Hilman
e408bbceed configure_system: Clear selection after user delete 2018-10-23 19:31:28 -04:00
Zach Hilman
702622b8f1 profile_manager: Load user icons, names, and UUIDs from system save 2018-10-23 19:31:28 -04:00
Zach Hilman
19c5cf9c63 acc: Load user images from config dir 2018-10-23 19:31:28 -04:00
Zach Hilman
aeffd4b436 profile_manager: Load users from emulator settings 2018-10-23 19:31:28 -04:00
David Marcec
cbc7ad8f6d Fixed GetAccountId stub, Added error code for OpenDirectory and added ActivateNpadWithRevision
With these, `Nintendo Entertainment System - Nintendo Switch Online` loads
2018-09-19 23:25:00 +10:00
bunnei
b33ce787b7
Merge pull request #1348 from ogniK5377/GetImageSize
Implemented IProfile::GetImageSize
2018-09-18 22:15:18 -04:00
Philippe Babin
9155c8daeb Invalid default value of username in yuzu_cmd (#1334)
* Fix bug where default username value for yuzu_cmd create an userprofile with uninitialize data as username

* Fix format

* Apply code review changes

* Remove nullptr check
2018-09-18 19:58:28 -04:00
David Marcec
528e5cee67 Implemented GetImageSize 2018-09-19 00:16:52 +10:00
fearlessTobi
63c2e32e20 Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
Lioncash
a0e51d8b98 service: Use nested namespace specifiers where applicable
There were a few places where nested namespace specifiers weren't being
used where they could be within the service code. This amends that to
make the namespacing a tiny bit more compact.
2018-09-13 15:52:55 -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
Lioncash
609cb04f3f acc: Replace profile_manager include with a forward declaration
This is only used in a shared_ptr, so we can forward declare it.
2018-08-20 19:48:57 -04:00
Lioncash
eb88fedc5d acc: Simplify WriteBuffer call within LoadImage()
We have an overload of WriteBuffer that accepts containers that satisfy
the ContiguousContainer concept, which std::array does, so we only need
to pass in the array itself.
2018-08-20 19:48:57 -04:00
Lioncash
f5b132676f acc: Correct IProfile's constructor initializer list order
Arranges them in the order the members would be initialized
2018-08-20 19:48:57 -04:00
Lioncash
0fcdf37917 acc: Remove unused DEFAULT_USER_ID
This is no longer used, so it can be removed.
2018-08-20 19:48:57 -04:00