-
Notifications
You must be signed in to change notification settings - Fork 68
Add Hardware ID support on Licenses #766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,6 +50,7 @@ struct XBLicense { | |
| struct BBLicense { | ||
| std::string username; | ||
| std::string password; | ||
| std::string hardware_id; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. std::optional<uint64_t> would make more sense here. We could serialize it as an integer or null in JSON.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I originally tried to serialize it as a uint64_t, but either I screwed something up or it was a serialization issue that it ended up being as signed in the json file and when read back, it was doing it wrong, that's why I went for a string. I'll change it to the std::optional<uint64_t>, though.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The negative value in the JSON file should still work as long as its 64-bit representation matches the unsigned value that was originally serialized. If that feels a bit weird (as it probably would to me, to be honest), you could also change all the places where hardware_id is used to le_int64_t/be_int64_t/int64_t for consistency. The treatment of hardware ID as a 64-bit integer is nonstandard anyway with regard to vanilla PSO, so it's not important that the value is unsigned. |
||
|
|
||
| static std::shared_ptr<BBLicense> from_json(const phosg::JSON& json); | ||
| phosg::JSON json() const; | ||
|
|
@@ -173,6 +174,10 @@ public: | |
| public: | ||
| incorrect_access_key() : invalid_argument("incorrect access key") {} | ||
| }; | ||
| class incorrect_hardware_id : public std::invalid_argument { | ||
| public: | ||
| incorrect_hardware_id() : invalid_argument("mismatched hardware id") {} | ||
| }; | ||
| class missing_account : public std::invalid_argument { | ||
| public: | ||
| missing_account() : invalid_argument("missing account") {} | ||
|
|
@@ -223,7 +228,8 @@ public: | |
| std::shared_ptr<Login> from_xb_credentials( | ||
| const std::string& gamertag, uint64_t user_id, uint64_t account_id, bool allow_create); | ||
| std::shared_ptr<Login> from_bb_credentials( | ||
| const std::string& username, const std::string* password, bool allow_create); | ||
| const std::string& username, const std::string* password, const uint64_t* hardware_id, bool allow_create, | ||
| bool bind_hardware_id); | ||
|
|
||
| std::shared_ptr<Account> create_temporary_account_for_shared_account( | ||
| std::shared_ptr<const Account> src_a, const std::string& variation_data) const; | ||
|
|
@@ -245,7 +251,7 @@ protected: | |
| std::shared_ptr<Login> from_dc_nte_credentials_locked( | ||
| const std::string& serial_number, const std::string& access_key); | ||
| std::shared_ptr<Login> from_dc_credentials_locked( | ||
| uint32_t serial_number, const std::string& access_key, const std::string& character_name); | ||
| uint32_t serial_number, const std::string& access_key, const std::string& character_name); | ||
| std::shared_ptr<Login> from_pc_credentials_locked( | ||
| uint32_t serial_number, const std::string& access_key, const std::string& character_name); | ||
| std::shared_ptr<Login> from_gc_credentials_locked( | ||
|
|
@@ -254,5 +260,6 @@ protected: | |
| const std::string* password, | ||
| const std::string& character_name); | ||
| std::shared_ptr<Login> from_xb_credentials_locked(uint64_t user_id); | ||
| std::shared_ptr<Login> from_bb_credentials_locked(const std::string& username, const std::string* password); | ||
| std::shared_ptr<Login> from_bb_credentials_locked( | ||
| const std::string& username, const std::string* password, const uint64_t* hardware_id, bool bind_hardware_id); | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be cleaner to not have
bool bind_hardware_id, and if thehardware_idpointer is null, it means the hardware ID shouldn't be checked or bound. Then the callsite inon_93_BBwould just pass null here ifs->bind_hardware_ids_on_loginis false.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember exactly why I did it that way, I think it was to make it work with other usages like $bbsave (I think it was that one), I'll change it to be that way, though.