make BB proxy's Save Files option generate .psochar files

This commit is contained in:
Martin Michelsen
2025-03-18 20:54:20 -07:00
parent 02c3d35d78
commit 52d019a321
2 changed files with 8 additions and 5 deletions
+6 -3
View File
@@ -836,10 +836,13 @@ static HandlerResult C_B3(shared_ptr<ProxyServer::LinkedSession> ses, uint16_t,
}
}
static HandlerResult S_B_E7(shared_ptr<ProxyServer::LinkedSession> ses, uint16_t, uint32_t, string& data) {
static HandlerResult S_B_E7(shared_ptr<ProxyServer::LinkedSession> ses, uint16_t command, uint32_t flag, string& data) {
if (ses->config.check_flag(Client::Flag::PROXY_SAVE_FILES)) {
string output_filename = phosg::string_printf("player.%" PRId64 ".bin", phosg::now());
phosg::save_file(output_filename, data);
string output_filename = phosg::string_printf("player.%" PRId64 ".psochar", phosg::now());
auto f = phosg::fopen_unique(output_filename, "wb");
PSOCommandHeaderBB header = {data.size() + sizeof(PSOCommandHeaderBB), command, flag};
phosg::fwritex(f.get(), &header, sizeof(header));
phosg::fwritex(f.get(), data);
ses->log.info("Wrote player data to file %s", output_filename.c_str());
}
return HandlerResult::Type::FORWARD;