update save file structs and encode/decode pathways
This commit is contained in:
+4
-4
@@ -431,14 +431,14 @@ void ItemData::decode_for_version(Version from_version) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ItemData::encode_for_version(Version to_version, shared_ptr<const ItemParameterTable> item_parameter_table) {
|
void ItemData::encode_for_version(Version to_version, shared_ptr<const ItemParameterTable> item_parameter_table) {
|
||||||
bool should_encode_v2_data = (is_v1(to_version) || is_v2(to_version)) && (to_version != Version::GC_NTE) && !this->has_encoded_v2_data();
|
bool should_encode_v2_data = item_parameter_table &&
|
||||||
|
(is_v1(to_version) || is_v2(to_version)) &&
|
||||||
|
(to_version != Version::GC_NTE) &&
|
||||||
|
!this->has_encoded_v2_data();
|
||||||
|
|
||||||
switch (this->data1[0]) {
|
switch (this->data1[0]) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
if (should_encode_v2_data && (this->data1[1] > 0x26)) {
|
if (should_encode_v2_data && (this->data1[1] > 0x26)) {
|
||||||
if (!item_parameter_table) {
|
|
||||||
throw logic_error("item parameter table is required to encode v2 data");
|
|
||||||
}
|
|
||||||
if (this->data1[1] < 0x89) {
|
if (this->data1[1] < 0x89) {
|
||||||
this->data1[5] = this->data1[1];
|
this->data1[5] = this->data1[1];
|
||||||
this->data1[1] = item_parameter_table->get_weapon_v1_replacement(this->data1[1]);
|
this->data1[1] = item_parameter_table->get_weapon_v1_replacement(this->data1[1]);
|
||||||
|
|||||||
@@ -288,7 +288,6 @@ struct PlayerInventoryT {
|
|||||||
}
|
}
|
||||||
|
|
||||||
operator PlayerInventoryT<!IsBigEndian>() const {
|
operator PlayerInventoryT<!IsBigEndian>() const {
|
||||||
|
|
||||||
PlayerInventoryT<!IsBigEndian> ret;
|
PlayerInventoryT<!IsBigEndian> ret;
|
||||||
ret.num_items = this->num_items;
|
ret.num_items = this->num_items;
|
||||||
ret.hp_from_materials = this->hp_from_materials;
|
ret.hp_from_materials = this->hp_from_materials;
|
||||||
|
|||||||
@@ -608,6 +608,8 @@ PSODCV2CharacterFile PSOBBCharacterFile::to_dc_v2() const {
|
|||||||
|
|
||||||
PSODCV2CharacterFile ret;
|
PSODCV2CharacterFile ret;
|
||||||
ret.inventory = this->inventory;
|
ret.inventory = this->inventory;
|
||||||
|
// We don't need to do the v1-compatible encoding (hence it is OK to pass
|
||||||
|
// nullptr here) but we do need to encode mag stats in the v2 format
|
||||||
ret.inventory.encode_for_client(Version::DC_V2, nullptr);
|
ret.inventory.encode_for_client(Version::DC_V2, nullptr);
|
||||||
ret.disp = this->disp.to_dcpcv3<false>(language, language);
|
ret.disp = this->disp.to_dcpcv3<false>(language, language);
|
||||||
ret.disp.visual.enforce_lobby_join_limits_for_version(Version::DC_V2);
|
ret.disp.visual.enforce_lobby_join_limits_for_version(Version::DC_V2);
|
||||||
|
|||||||
+11
-11
@@ -494,8 +494,8 @@ struct PSOGCEp3CharacterFile {
|
|||||||
// This structure is internally split into two by the game. The offsets here
|
// This structure is internally split into two by the game. The offsets here
|
||||||
// are relative to the start of this structure (first column), and relative
|
// are relative to the start of this structure (first column), and relative
|
||||||
// to the start of the second internal structure (second column).
|
// to the start of the second internal structure (second column).
|
||||||
/* 0000:---- */ PlayerInventory inventory;
|
/* 0000:---- */ PlayerInventoryBE inventory;
|
||||||
/* 034C:---- */ PlayerDispDataDCPCV3 disp;
|
/* 034C:---- */ PlayerDispDataDCPCV3BE disp;
|
||||||
/* 041C:0000 */ be_uint32_t flags = 0;
|
/* 041C:0000 */ be_uint32_t flags = 0;
|
||||||
/* 0420:0004 */ be_uint32_t creation_timestamp = 0;
|
/* 0420:0004 */ be_uint32_t creation_timestamp = 0;
|
||||||
/* 0424:0008 */ be_uint32_t signature = 0xA204B064;
|
/* 0424:0008 */ be_uint32_t signature = 0xA204B064;
|
||||||
@@ -540,15 +540,15 @@ struct PSOGCEp3CharacterFile {
|
|||||||
// by the B7 command sent by the server instead.
|
// by the B7 command sent by the server instead.
|
||||||
/* 19420 */ be_uint64_t bgm_test_songs_unlocked = 0;
|
/* 19420 */ be_uint64_t bgm_test_songs_unlocked = 0;
|
||||||
/* 19428 */ be_uint32_t save_count = 1;
|
/* 19428 */ be_uint32_t save_count = 1;
|
||||||
// This is an array of 999 bits, represented here as 128 bytes (the last bit
|
// This is an array of 999 bits, represented here as 128 bytes (the last 25
|
||||||
// is never used). Each bit corresponds to a card ID with the bit's index; if
|
// bits are not used). Each bit corresponds to a card ID with the bit's index;
|
||||||
// the bit is set, then during offline play, the card's rank is replaced with
|
// if the bit is set, then during offline play, the card's rank is replaced
|
||||||
// D2 if its original rank is S, SS, E, or D2, or with D1 if the original rank
|
// with D2 if its original rank is S, SS, E, or D2, or with D1 if the original
|
||||||
// is any other value. Upon receiving a B8 command (server card definitions),
|
// rank is any other value. Upon receiving a B8 command (server card
|
||||||
// the game clears this array, and sets all bits whose corresponding cards
|
// definitions), the game clears this array, and sets all bits whose
|
||||||
// from the server have the D1 or D2 ranks. This could have been used by Sega
|
// corresponding cards from the server have the D1 or D2 ranks. This could
|
||||||
// to prevent broken cards from being used offline, but there's no indication
|
// have been used by Sega to prevent broken cards from being used offline, but
|
||||||
// that they ever used this functionality.
|
// there's no indication that they ever used this functionality.
|
||||||
/* 1942C */ parray<uint8_t, 0x80> card_rank_override_flags;
|
/* 1942C */ parray<uint8_t, 0x80> card_rank_override_flags;
|
||||||
/* 194AC */ be_uint32_t round2_seed = 0;
|
/* 194AC */ be_uint32_t round2_seed = 0;
|
||||||
/* 194B0 */
|
/* 194B0 */
|
||||||
|
|||||||
Reference in New Issue
Block a user