fix some $bbchar bugs

This commit is contained in:
Martin Michelsen
2023-11-14 12:25:19 -08:00
parent e3956a0a09
commit 5c47385bee
3 changed files with 16 additions and 6 deletions
+7
View File
@@ -2885,6 +2885,11 @@ static void on_61_98(shared_ptr<Client> c, uint16_t command, uint32_t flag, stri
c->game_data.bb_username = c->pending_bb_save_username;
c->game_data.bb_character_index = c->pending_bb_save_character_index;
// Update a few fields for BB
const auto& p = c->game_data.character();
uint8_t prev_version = p->disp.visual.version;
p->disp.visual.version = 4;
bool failure = false;
try {
c->game_data.save_character_file();
@@ -2893,6 +2898,8 @@ static void on_61_98(shared_ptr<Client> c, uint16_t command, uint32_t flag, stri
failure = true;
}
p->disp.visual.version = prev_version;
if (!failure) {
send_text_message_printf(c,
"$C6BB player data saved\nas player %hhu for user\n%s",
+7 -3
View File
@@ -197,8 +197,13 @@ uint32_t PSOBBGuildCardFile::checksum() const {
return crc32(this, sizeof(*this));
}
PSOBBSystemFile::PSOBBSystemFile(uint32_t guild_card_number)
: PSOBBSystemFile() {
PSOBBSystemFile::PSOBBSystemFile()
: guild_card_number(0),
team_id(0),
team_info(0),
team_privilege_level(0),
reserved(0),
team_rewards(0) {
// This field is based on 1/1/2000, not 1/1/1970, so adjust appropriately
this->base.creation_timestamp = (now() - 946684800000000ULL) / 1000000;
for (size_t z = 0; z < PSOBBSystemFile::DEFAULT_KEY_CONFIG.size(); z++) {
@@ -207,7 +212,6 @@ PSOBBSystemFile::PSOBBSystemFile(uint32_t guild_card_number)
for (size_t z = 0; z < PSOBBSystemFile::DEFAULT_JOYSTICK_CONFIG.size(); z++) {
this->joystick_config[z] = PSOBBSystemFile::DEFAULT_JOYSTICK_CONFIG[z];
}
this->guild_card_number = guild_card_number;
}
shared_ptr<PSOBBCharacterFile> PSOBBCharacterFile::create_from_preview(
+2 -3
View File
@@ -149,8 +149,7 @@ struct PSOBBSystemFile {
static const std::array<uint8_t, 0x016C> DEFAULT_KEY_CONFIG;
static const std::array<uint8_t, 0x0038> DEFAULT_JOYSTICK_CONFIG;
PSOBBSystemFile() = default;
explicit PSOBBSystemFile(uint32_t guild_card_number);
PSOBBSystemFile();
} __attribute__((packed));
struct PSOBBCharacterFile {
@@ -174,7 +173,7 @@ struct PSOBBCharacterFile {
/* 034C */ PlayerDispDataBB disp;
/* 04DC */ le_uint32_t flags = 0;
/* 04E0 */ le_uint32_t creation_timestamp = 0;
/* 04E4 */ le_uint32_t signature = 0xA205B064;
/* 04E4 */ le_uint32_t signature = 0xC87ED5B1;
/* 04E8 */ le_uint32_t play_time_seconds = 0;
/* 04EC */ le_uint32_t option_flags = 0;
/* 04F0 */ parray<uint8_t, 4> unknown_a2;