feat: add gated CH5 quiver support and unified regression runner

This commit is contained in:
shen
2026-10-22 17:41:47 -07:00
parent 60ed66692e
commit 3784137b4f
39 changed files with 1617 additions and 23 deletions
+32
View File
@@ -2,6 +2,7 @@
// the original locale packs are made: every file COMPRESS (LZO), index LZO + TEA encrypted.
//
// eterpack_pack <db path without extension> <source dir> <pack prefix, e.g. locale/zh/>
// eterpack_pack --read-client <client dir> <registered entry> <new output file>
//
// Pack names are <prefix><path relative to the source dir>, lowercased with '/' (inlineConvertPackFilename).
// An existing <db>.eix/.epk is replaced. The result is reopened read-only and every file read back
@@ -30,6 +31,37 @@ static std::vector<char> read_file(const fs::path& path)
int main(int argc, char** argv)
{
// PORT: resolve data through the actual runtime Index/key-fallback path.
// Pack-only reads prevent a loose file in the shell cwd from masking a pack.
if (argc > 1 && std::strcmp(argv[1], "--read-client") == 0)
{
if (argc != 5)
{
std::fprintf(stderr, "usage: %s --read-client <client> <entry> <new output>\n", argv[0]);
return 2;
}
PackSingletons();
const auto folder = fs::absolute(fs::path(argv[2]) / "pack");
if (!fs::is_regular_file(folder / "Index") || !PackInitialize(folder.string().c_str()))
return 1;
CMappedFile mapped;
LPCVOID data = nullptr;
if (!CEterPackManager::Instance().GetFromPack(mapped, argv[3], &data))
{
std::fprintf(stderr, "registered entry unavailable: %s\n", argv[3]);
return 1;
}
// Exclusive creation: a read-only probe must never overwrite user data.
FILE* output = std::fopen(argv[4], "wbx");
if (!output)
return 1;
const bool written = std::fwrite(data, 1, mapped.Size(), output) == mapped.Size();
const bool closed = std::fclose(output) == 0;
if (!written || !closed)
return 1;
std::printf("read registered entry %s: %u bytes\n", argv[3], unsigned(mapped.Size()));
return 0;
}
if (argc != 4)
{
std::fprintf(stderr, "usage: %s <db> <source dir> <pack prefix>\n", argv[0]);
+14 -1
View File
@@ -942,7 +942,13 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
return c.Send(chat)&&c.Send(cmd.c_str(),cmd.size()+1);
};
const std::string r=std::to_string(request);
if(kind=="cap") {if(!reply("MTF1 cap "+r+" 1 63 1700000000"))return Fail(name+": feature cap");}
if(kind=="cap") {if(!reply("MTF1 cap "+r+" 1 "+(std::getenv("MT_TEST_QUIVER")?"2111":"63")+" 1700000000"))return Fail(name+": feature cap");}
else if(kind=="quiver" && std::getenv("MT_TEST_QUIVER")) {
if(!reply("MTF1 begin "+r+" quiver 0 0 0 0 1700000000") || !reply("MTF1 end "+r+" 0"))return Fail(name+": quiver ack");
std::uint8_t state[6]={219,0,0,0,0,9};std::uint32_t vid=kMainVID;
std::memcpy(state+1,&vid,4);
if(!c.Send(state,sizeof(state)))return Fail(name+": quiver state");
}
else if(kind=="calendar") {
if(!reply("MTF1 begin "+r+" calendar 1 0 2 0 1700000000") ||
!reply("MTF1 event "+r+" 0 1 1 1700000000 1700003600 0 0 1") ||
@@ -976,6 +982,13 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
if(!reply("MTF1 end "+r+" "+std::to_string(sent)))return Fail(name+": feature end");
}
}
else if (std::getenv("MT_TEST_QUIVER") && text.rfind("/quiver_test ",0)==0) {
unsigned type=0;
if(sscanf(text.c_str()+13,"%u",&type)!=1 || (type!=0 && type!=6 && type!=9))return Fail(name+": invalid test quiver");
std::uint8_t state[6]={219,0,0,0,0,std::uint8_t(type)};std::uint32_t vid=kMainVID;
std::memcpy(state+1,&vid,4);
if(!c.Send(state,sizeof(state)))return Fail(name+": test quiver state");
}
else if (text == "/server_bonuses") {
const std::string cmd = "ServerBonuses 200 200 200 200 200 0 200 0";
GCChatHead chat = {HDR_GC_CHAT, static_cast<std::uint16_t>(sizeof(GCChatHead) + cmd.size() + 1), 5, 0, 1};
+15
View File
@@ -445,6 +445,21 @@ int main(int argc, char** argv)
CHECK(py("import net\nassert net.IsConnect(), 'disconnected in the game phase'"));
// Focused batch-pickup regression avoids unrelated legacy economy wire fixtures.
if (server && std::getenv("MT_TEST_QUIVER")) {
auto type=[] {auto* actor=CPythonCharacterManager::Instance().GetInstancePtr(FakeLoginServer::kMainVID);return actor?int(actor->GetArrowType()):-1;};
CHECK(pump_until(8,[&] {return type()==9 || failed();}));
CHECK(type()==9 && !failed());
for (int expected:{6,0,9}) {
CHECK(py("net.SendChatPacket('/quiver_test "+std::to_string(expected)+"')"));
CHECK(pump_until(5,[&] {return type()==expected || failed();}));
CHECK(type()==expected && !failed());
}
CHECK(py("import app\napp.Exit()"));
pump_until(2,[] {return !PythonBoot::IsAppLooping();});
PythonBoot::Stop();
std::printf("quiver negotiated packet fixture: %s\n",g_failures?"FAILED":"PASS");
return g_failures?1:0;
}
if (server && std::getenv("MT_TEST_AUTOHUNT_BATCH")) {
CHECK(CPythonPlayer::Instance().NEW_GetMainActorPtr());
CHECK(CPythonCharacterManager::Instance().GetInstancePtr(FakeLoginServer::kMobVID));