split XB quest file header struct
This commit is contained in:
@@ -1015,7 +1015,7 @@ struct S_OpenFile_DC_44_A6 {
|
|||||||
le_uint32_t file_size = 0;
|
le_uint32_t file_size = 0;
|
||||||
} __packed__;
|
} __packed__;
|
||||||
|
|
||||||
struct S_OpenFile_PC_V3_44_A6 {
|
struct S_OpenFile_PC_GC_44_A6 {
|
||||||
ptext<char, 0x22> name; // Should begin with "PSO/"
|
ptext<char, 0x22> name; // Should begin with "PSO/"
|
||||||
le_uint16_t type = 0;
|
le_uint16_t type = 0;
|
||||||
ptext<char, 0x10> filename;
|
ptext<char, 0x10> filename;
|
||||||
@@ -1025,7 +1025,7 @@ struct S_OpenFile_PC_V3_44_A6 {
|
|||||||
// Curiously, PSO XB expects an extra 0x18 bytes at the end of this command, but
|
// Curiously, PSO XB expects an extra 0x18 bytes at the end of this command, but
|
||||||
// those extra bytes are unused, and the client does not fail if they're
|
// those extra bytes are unused, and the client does not fail if they're
|
||||||
// omitted.
|
// omitted.
|
||||||
struct S_OpenFile_XB_44_A6 : S_OpenFile_PC_V3_44_A6 {
|
struct S_OpenFile_XB_44_A6 : S_OpenFile_PC_GC_44_A6 {
|
||||||
parray<uint8_t, 0x18> unused2;
|
parray<uint8_t, 0x18> unused2;
|
||||||
} __packed__;
|
} __packed__;
|
||||||
|
|
||||||
|
|||||||
@@ -1155,7 +1155,8 @@ static HandlerResult S_44_A6(shared_ptr<ServerState>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
constexpr on_command_t S_D_44_A6 = &S_44_A6<S_OpenFile_DC_44_A6>;
|
constexpr on_command_t S_D_44_A6 = &S_44_A6<S_OpenFile_DC_44_A6>;
|
||||||
constexpr on_command_t S_PGX_44_A6 = &S_44_A6<S_OpenFile_PC_V3_44_A6>;
|
constexpr on_command_t S_PG_44_A6 = &S_44_A6<S_OpenFile_PC_GC_44_A6>;
|
||||||
|
constexpr on_command_t S_X_44_A6 = &S_44_A6<S_OpenFile_XB_44_A6>;
|
||||||
constexpr on_command_t S_B_44_A6 = &S_44_A6<S_OpenFile_BB_44_A6>;
|
constexpr on_command_t S_B_44_A6 = &S_44_A6<S_OpenFile_BB_44_A6>;
|
||||||
|
|
||||||
static HandlerResult S_13_A7(shared_ptr<ServerState>,
|
static HandlerResult S_13_A7(shared_ptr<ServerState>,
|
||||||
@@ -1811,7 +1812,7 @@ static on_command_t handlers[0x100][6][2] = {
|
|||||||
/* 41 */ {{S_invalid, nullptr}, {S_DGX_41, nullptr}, {S_P_41, nullptr}, {S_DGX_41, nullptr}, {S_DGX_41, nullptr}, {S_B_41, nullptr}},
|
/* 41 */ {{S_invalid, nullptr}, {S_DGX_41, nullptr}, {S_P_41, nullptr}, {S_DGX_41, nullptr}, {S_DGX_41, nullptr}, {S_B_41, nullptr}},
|
||||||
/* 42 */ {{S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}},
|
/* 42 */ {{S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}},
|
||||||
/* 43 */ {{S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}},
|
/* 43 */ {{S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}},
|
||||||
/* 44 */ {{S_invalid, nullptr}, {S_D_44_A6, nullptr}, {S_PGX_44_A6, nullptr}, {S_PGX_44_A6, nullptr}, {S_PGX_44_A6, nullptr}, {S_B_44_A6, nullptr}},
|
/* 44 */ {{S_invalid, nullptr}, {S_D_44_A6, nullptr}, {S_PG_44_A6, nullptr}, {S_PG_44_A6, nullptr}, {S_X_44_A6, nullptr}, {S_B_44_A6, nullptr}},
|
||||||
/* 45 */ {{S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}},
|
/* 45 */ {{S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}},
|
||||||
/* 46 */ {{S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}},
|
/* 46 */ {{S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}},
|
||||||
/* 47 */ {{S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}},
|
/* 47 */ {{S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}},
|
||||||
@@ -1912,7 +1913,7 @@ static on_command_t handlers[0x100][6][2] = {
|
|||||||
/* A3 */ {{S_invalid, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}},
|
/* A3 */ {{S_invalid, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}},
|
||||||
/* A4 */ {{S_invalid, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}},
|
/* A4 */ {{S_invalid, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}},
|
||||||
/* A5 */ {{S_invalid, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}},
|
/* A5 */ {{S_invalid, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr}},
|
||||||
/* A6 */ {{S_invalid, nullptr}, {S_D_44_A6, nullptr}, {S_PGX_44_A6, nullptr}, {S_PGX_44_A6, nullptr}, {S_PGX_44_A6, nullptr}, {S_B_44_A6, nullptr}},
|
/* A6 */ {{S_invalid, nullptr}, {S_D_44_A6, nullptr}, {S_PG_44_A6, nullptr}, {S_PG_44_A6, nullptr}, {S_X_44_A6, nullptr}, {S_B_44_A6, nullptr}},
|
||||||
/* A7 */ {{S_invalid, nullptr}, {S_13_A7, nullptr}, {S_13_A7, nullptr}, {S_13_A7, nullptr}, {S_13_A7, nullptr}, {S_13_A7, nullptr}},
|
/* A7 */ {{S_invalid, nullptr}, {S_13_A7, nullptr}, {S_13_A7, nullptr}, {S_13_A7, nullptr}, {S_13_A7, nullptr}, {S_13_A7, nullptr}},
|
||||||
/* A8 */ {{S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}},
|
/* A8 */ {{S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}},
|
||||||
/* A9 */ {{S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}},
|
/* A9 */ {{S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}, {S_invalid, nullptr}},
|
||||||
|
|||||||
+18
-10
@@ -779,9 +779,11 @@ pair<string, string> Quest::decode_qst_file(const string& filename) {
|
|||||||
if (signature == 0x58004400 || signature == 0x5800A600) {
|
if (signature == 0x58004400 || signature == 0x5800A600) {
|
||||||
return decode_qst_t<PSOCommandHeaderBB, S_OpenFile_BB_44_A6>(f.get());
|
return decode_qst_t<PSOCommandHeaderBB, S_OpenFile_BB_44_A6>(f.get());
|
||||||
} else if ((signature & 0xFFFFFF00) == 0x3C004400 || (signature & 0xFFFFFF00) == 0x3C00A600) {
|
} else if ((signature & 0xFFFFFF00) == 0x3C004400 || (signature & 0xFFFFFF00) == 0x3C00A600) {
|
||||||
return decode_qst_t<PSOCommandHeaderPC, S_OpenFile_PC_V3_44_A6>(f.get());
|
return decode_qst_t<PSOCommandHeaderPC, S_OpenFile_PC_GC_44_A6>(f.get());
|
||||||
} else if ((signature & 0xFF00FFFF) == 0x44003C00 || (signature & 0xFF00FFFF) == 0xA6003C00) {
|
} else if ((signature & 0xFF00FFFF) == 0x44003C00 || (signature & 0xFF00FFFF) == 0xA6003C00) {
|
||||||
return decode_qst_t<PSOCommandHeaderDCV3, S_OpenFile_PC_V3_44_A6>(f.get());
|
return decode_qst_t<PSOCommandHeaderDCV3, S_OpenFile_PC_GC_44_A6>(f.get());
|
||||||
|
} else if ((signature & 0xFF00FFFF) == 0x44005400 || (signature & 0xFF00FFFF) == 0xA6005400) {
|
||||||
|
return decode_qst_t<PSOCommandHeaderDCV3, S_OpenFile_XB_44_A6>(f.get());
|
||||||
} else {
|
} else {
|
||||||
throw runtime_error("invalid qst file format");
|
throw runtime_error("invalid qst file format");
|
||||||
}
|
}
|
||||||
@@ -800,8 +802,7 @@ void add_command_header(
|
|||||||
template <typename HeaderT, typename CmdT>
|
template <typename HeaderT, typename CmdT>
|
||||||
void add_open_file_command(StringWriter& w, const Quest& q, bool is_bin) {
|
void add_open_file_command(StringWriter& w, const Quest& q, bool is_bin) {
|
||||||
add_command_header<HeaderT>(
|
add_command_header<HeaderT>(
|
||||||
w, q.is_dlq_encoded ? 0xA6 : 0x44, q.internal_id,
|
w, q.is_dlq_encoded ? 0xA6 : 0x44, q.internal_id, sizeof(CmdT));
|
||||||
sizeof(S_OpenFile_DC_44_A6));
|
|
||||||
CmdT cmd;
|
CmdT cmd;
|
||||||
cmd.name = "PSO/" + encode_sjis(q.name);
|
cmd.name = "PSO/" + encode_sjis(q.name);
|
||||||
cmd.filename = q.file_basename + (is_bin ? ".bin" : ".dat");
|
cmd.filename = q.file_basename + (is_bin ? ".bin" : ".dat");
|
||||||
@@ -850,8 +851,8 @@ string Quest::export_qst() const {
|
|||||||
w, this->file_basename + ".dat", *this->dat_contents(), this->is_dlq_encoded);
|
w, this->file_basename + ".dat", *this->dat_contents(), this->is_dlq_encoded);
|
||||||
break;
|
break;
|
||||||
case QuestScriptVersion::PC_V2:
|
case QuestScriptVersion::PC_V2:
|
||||||
add_open_file_command<PSOCommandHeaderPC, S_OpenFile_PC_V3_44_A6>(w, *this, true);
|
add_open_file_command<PSOCommandHeaderPC, S_OpenFile_PC_GC_44_A6>(w, *this, true);
|
||||||
add_open_file_command<PSOCommandHeaderPC, S_OpenFile_PC_V3_44_A6>(w, *this, false);
|
add_open_file_command<PSOCommandHeaderPC, S_OpenFile_PC_GC_44_A6>(w, *this, false);
|
||||||
add_write_file_commands<PSOCommandHeaderPC>(
|
add_write_file_commands<PSOCommandHeaderPC>(
|
||||||
w, this->file_basename + ".bin", *this->bin_contents(), this->is_dlq_encoded);
|
w, this->file_basename + ".bin", *this->bin_contents(), this->is_dlq_encoded);
|
||||||
add_write_file_commands<PSOCommandHeaderPC>(
|
add_write_file_commands<PSOCommandHeaderPC>(
|
||||||
@@ -859,19 +860,26 @@ string Quest::export_qst() const {
|
|||||||
break;
|
break;
|
||||||
case QuestScriptVersion::GC_NTE:
|
case QuestScriptVersion::GC_NTE:
|
||||||
case QuestScriptVersion::GC_V3:
|
case QuestScriptVersion::GC_V3:
|
||||||
case QuestScriptVersion::XB_V3:
|
add_open_file_command<PSOCommandHeaderDCV3, S_OpenFile_PC_GC_44_A6>(w, *this, true);
|
||||||
add_open_file_command<PSOCommandHeaderDCV3, S_OpenFile_PC_V3_44_A6>(w, *this, true);
|
add_open_file_command<PSOCommandHeaderDCV3, S_OpenFile_PC_GC_44_A6>(w, *this, false);
|
||||||
add_open_file_command<PSOCommandHeaderDCV3, S_OpenFile_PC_V3_44_A6>(w, *this, false);
|
|
||||||
add_write_file_commands<PSOCommandHeaderDCV3>(
|
add_write_file_commands<PSOCommandHeaderDCV3>(
|
||||||
w, this->file_basename + ".bin", *this->bin_contents(), this->is_dlq_encoded);
|
w, this->file_basename + ".bin", *this->bin_contents(), this->is_dlq_encoded);
|
||||||
add_write_file_commands<PSOCommandHeaderDCV3>(
|
add_write_file_commands<PSOCommandHeaderDCV3>(
|
||||||
w, this->file_basename + ".dat", *this->dat_contents(), this->is_dlq_encoded);
|
w, this->file_basename + ".dat", *this->dat_contents(), this->is_dlq_encoded);
|
||||||
break;
|
break;
|
||||||
case QuestScriptVersion::GC_EP3:
|
case QuestScriptVersion::GC_EP3:
|
||||||
add_open_file_command<PSOCommandHeaderDCV3, S_OpenFile_PC_V3_44_A6>(w, *this, true);
|
add_open_file_command<PSOCommandHeaderDCV3, S_OpenFile_PC_GC_44_A6>(w, *this, true);
|
||||||
add_write_file_commands<PSOCommandHeaderDCV3>(
|
add_write_file_commands<PSOCommandHeaderDCV3>(
|
||||||
w, this->file_basename + ".bin", *this->bin_contents(), this->is_dlq_encoded);
|
w, this->file_basename + ".bin", *this->bin_contents(), this->is_dlq_encoded);
|
||||||
break;
|
break;
|
||||||
|
case QuestScriptVersion::XB_V3:
|
||||||
|
add_open_file_command<PSOCommandHeaderDCV3, S_OpenFile_XB_44_A6>(w, *this, true);
|
||||||
|
add_open_file_command<PSOCommandHeaderDCV3, S_OpenFile_XB_44_A6>(w, *this, false);
|
||||||
|
add_write_file_commands<PSOCommandHeaderDCV3>(
|
||||||
|
w, this->file_basename + ".bin", *this->bin_contents(), this->is_dlq_encoded);
|
||||||
|
add_write_file_commands<PSOCommandHeaderDCV3>(
|
||||||
|
w, this->file_basename + ".dat", *this->dat_contents(), this->is_dlq_encoded);
|
||||||
|
break;
|
||||||
case QuestScriptVersion::BB_V4:
|
case QuestScriptVersion::BB_V4:
|
||||||
add_open_file_command<PSOCommandHeaderBB, S_OpenFile_BB_44_A6>(w, *this, true);
|
add_open_file_command<PSOCommandHeaderBB, S_OpenFile_BB_44_A6>(w, *this, true);
|
||||||
add_open_file_command<PSOCommandHeaderBB, S_OpenFile_BB_44_A6>(w, *this, false);
|
add_open_file_command<PSOCommandHeaderBB, S_OpenFile_BB_44_A6>(w, *this, false);
|
||||||
|
|||||||
+5
-2
@@ -303,7 +303,7 @@ void send_quest_buffer_overflow(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const string filename = "m999999p_e.bin";
|
static const string filename = "m999999p_e.bin";
|
||||||
send_quest_open_file_t<S_OpenFile_PC_V3_44_A6>(
|
send_quest_open_file_t<S_OpenFile_PC_GC_44_A6>(
|
||||||
c, "BufferOverflow", filename, 0x18, QuestFileType::EPISODE_3);
|
c, "BufferOverflow", filename, 0x18, QuestFileType::EPISODE_3);
|
||||||
|
|
||||||
S_WriteFile_13_A7 cmd;
|
S_WriteFile_13_A7 cmd;
|
||||||
@@ -2698,8 +2698,11 @@ void send_open_quest_file(shared_ptr<Client> c, const string& quest_name,
|
|||||||
break;
|
break;
|
||||||
case GameVersion::PC:
|
case GameVersion::PC:
|
||||||
case GameVersion::GC:
|
case GameVersion::GC:
|
||||||
|
send_quest_open_file_t<S_OpenFile_PC_GC_44_A6>(
|
||||||
|
c, quest_name, basename, contents->size(), type);
|
||||||
|
break;
|
||||||
case GameVersion::XB:
|
case GameVersion::XB:
|
||||||
send_quest_open_file_t<S_OpenFile_PC_V3_44_A6>(
|
send_quest_open_file_t<S_OpenFile_XB_44_A6>(
|
||||||
c, quest_name, basename, contents->size(), type);
|
c, quest_name, basename, contents->size(), type);
|
||||||
break;
|
break;
|
||||||
case GameVersion::BB:
|
case GameVersion::BB:
|
||||||
|
|||||||
Reference in New Issue
Block a user