support more BB save slots; add client patch
This commit is contained in:
+6
-6
@@ -672,14 +672,14 @@ string Client::system_filename() const {
|
||||
return phosg::string_printf("system/players/system_%s.psosys", this->login->bb_license->username.c_str());
|
||||
}
|
||||
|
||||
string Client::character_filename(const std::string& bb_username, int8_t index) {
|
||||
string Client::character_filename(const std::string& bb_username, ssize_t index) {
|
||||
if (bb_username.empty()) {
|
||||
throw logic_error("non-BB players do not have character data");
|
||||
}
|
||||
if (index < 0) {
|
||||
throw logic_error("character index is not set");
|
||||
}
|
||||
return phosg::string_printf("system/players/player_%s_%hhd.psochar", bb_username.c_str(), index);
|
||||
return phosg::string_printf("system/players/player_%s_%zd.psochar", bb_username.c_str(), index);
|
||||
}
|
||||
|
||||
string Client::backup_character_filename(uint32_t account_id, size_t index, bool is_ep3) {
|
||||
@@ -687,7 +687,7 @@ string Client::backup_character_filename(uint32_t account_id, size_t index, bool
|
||||
account_id, index, is_ep3 ? "pso3char" : "psochar");
|
||||
}
|
||||
|
||||
string Client::character_filename(int8_t index) const {
|
||||
string Client::character_filename(ssize_t index) const {
|
||||
if (this->version() != Version::BB_V4) {
|
||||
throw logic_error("non-BB players do not have character data");
|
||||
}
|
||||
@@ -738,9 +738,9 @@ string Client::legacy_player_filename() const {
|
||||
throw logic_error("character index is not set");
|
||||
}
|
||||
return phosg::string_printf(
|
||||
"system/players/player_%s_%hhd.nsc",
|
||||
"system/players/player_%s_%zd.nsc",
|
||||
this->login->bb_license->username.c_str(),
|
||||
static_cast<int8_t>(this->bb_character_index + 1));
|
||||
static_cast<ssize_t>(this->bb_character_index + 1));
|
||||
}
|
||||
|
||||
void Client::create_character_file(
|
||||
@@ -1088,7 +1088,7 @@ bool Client::use_shared_bank() {
|
||||
}
|
||||
}
|
||||
|
||||
void Client::use_character_bank(int8_t index) {
|
||||
void Client::use_character_bank(ssize_t index) {
|
||||
this->use_default_bank();
|
||||
if (index != this->bb_character_index) {
|
||||
auto files_manager = this->require_server_state()->player_files_manager;
|
||||
|
||||
+5
-5
@@ -252,7 +252,7 @@ public:
|
||||
uint32_t telepipe_lobby_id;
|
||||
TelepipeState telepipe_state;
|
||||
std::shared_ptr<Episode3::PlayerConfig> ep3_config; // Null for non-Ep3
|
||||
int8_t bb_character_index;
|
||||
ssize_t bb_character_index; // -1 = not set
|
||||
ItemData bb_identify_result;
|
||||
std::array<std::vector<ItemData>, 3> bb_shop_contents;
|
||||
|
||||
@@ -361,9 +361,9 @@ public:
|
||||
std::shared_ptr<const LevelTable> level_table);
|
||||
|
||||
std::string system_filename() const;
|
||||
static std::string character_filename(const std::string& bb_username, int8_t index);
|
||||
static std::string character_filename(const std::string& bb_username, ssize_t index);
|
||||
static std::string backup_character_filename(uint32_t account_id, size_t index, bool is_ep3);
|
||||
std::string character_filename(int8_t index = -1) const;
|
||||
std::string character_filename(ssize_t index = -1) const;
|
||||
std::string guild_card_filename() const;
|
||||
std::string shared_bank_filename() const;
|
||||
|
||||
@@ -391,7 +391,7 @@ public:
|
||||
const PlayerBank200& current_bank() const;
|
||||
std::shared_ptr<PSOBBCharacterFile> current_bank_character();
|
||||
bool use_shared_bank(); // Returns true if the bank exists; false if it was created
|
||||
void use_character_bank(int8_t bb_character_index);
|
||||
void use_character_bank(ssize_t bb_character_index);
|
||||
void use_default_bank();
|
||||
|
||||
void print_inventory(FILE* stream) const;
|
||||
@@ -407,7 +407,7 @@ private:
|
||||
std::shared_ptr<PSOBBGuildCardFile> guild_card_data;
|
||||
std::shared_ptr<PlayerBank200> external_bank;
|
||||
std::shared_ptr<PSOBBCharacterFile> external_bank_character;
|
||||
int8_t external_bank_character_index;
|
||||
ssize_t external_bank_character_index;
|
||||
uint64_t last_play_time_update;
|
||||
|
||||
void save_and_clear_external_bank();
|
||||
|
||||
@@ -3112,7 +3112,7 @@ check_struct_size(S_TournamentGameDetails_Ep3_E3, 0x73C);
|
||||
|
||||
struct C_PlayerPreviewRequest_BB_E3 {
|
||||
le_int32_t character_index = 0;
|
||||
le_uint32_t unused = 0;
|
||||
le_uint32_t unknown_a1 = 0;
|
||||
} __packed_ws__(C_PlayerPreviewRequest_BB_E3, 0x08);
|
||||
|
||||
// E4: CARD lobby battle table state (Episode 3)
|
||||
@@ -3319,7 +3319,7 @@ struct C_GuildCardChecksum_01E8 {
|
||||
// 02E8 (S->C): Accept/decline guild card file checksum
|
||||
// If needs_update is nonzero, the client will request the guild card file by
|
||||
// sending an 03E8 command. If needs_update is zero, the client will skip
|
||||
// downloading the guild card file and send a 04EB command (requesting the
|
||||
// downloading the guild card file and send an 04EB command (requesting the
|
||||
// stream file) instead.
|
||||
|
||||
struct S_GuildCardChecksumResponse_BB_02E8 {
|
||||
@@ -3643,7 +3643,7 @@ struct S_StreamFileChunk_BB_02EB {
|
||||
struct C_LeaveCharacterSelect_BB_00EC {
|
||||
// Reason codes:
|
||||
// 0 = canceled
|
||||
// 1 = recreate character
|
||||
// 1 = create or recreate character
|
||||
// 2 = dressing room
|
||||
le_uint32_t reason = 0;
|
||||
} __packed_ws__(C_LeaveCharacterSelect_BB_00EC, 4);
|
||||
|
||||
+1
-1
@@ -739,7 +739,7 @@ void send_stream_file_chunk_bb(shared_ptr<Client> c, uint32_t chunk_index) {
|
||||
}
|
||||
|
||||
void send_approve_player_choice_bb(shared_ptr<Client> c) {
|
||||
S_ApprovePlayerChoice_BB_00E4 cmd = {c->bb_character_index, 1};
|
||||
S_ApprovePlayerChoice_BB_00E4 cmd = {static_cast<int8_t>(c->bb_character_index), 1};
|
||||
send_command_t(c, 0x00E4, 0x00000000, cmd);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user