diff --git a/README.md b/README.md index a7d347f..d2a57b8 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,9 @@ Catalog มีตารางเส้นทางจาก Client ครบช โครงสร้างเซฟ CW แยกตาม UID อยู่ใน `persistent.currency_wars` พร้อม revision ป้องกัน session เก่าเขียนทับ และตรวจ Client/assembly ก่อนคืนข้อมูล `GridFightGetData` จะอ่านเซฟเมื่อมี โดยไม่เขียนไฟล์ระหว่างอ่าน StartGamePlay บันทึกสถานะเริ่มรอบก่อนตอบกลับแล้ว พร้อม Resume/QuitLeave แต่ยังไม่ได้ยืนยันการเล่นต่อจากเซฟใน Client -ส่วนร้านค้ามีโค้ดกองการ์ดและแผนซื้อ/รีเฟรชแล้ว โดยอ่านจำนวนการ์ดกับกฎพื้นฐานจาก catalog และยังต้องเชื่อมกับกระดาน สถานะรอบ และแพ็กเก็ตคำสั่งจริง เพิ่มสถานะเริ่มต้นที่จับจาก March7 PS สำหรับด่านแรกของ Standard Gambit/Overclock ใน `resources/CurrencyWarsInitialRuns.json` แล้ว แต่ยังไม่ได้ต่อคำสั่งเลือกประตู ร้านค้า และการต่อสู้ครบ สถานะเริ่มต้นใช้ตัวอย่างที่จับไว้ ไม่ใช่การสุ่มรอบใหม่ทั้งหมด +ส่วนร้านค้ามีโค้ดกองการ์ดและแผนซื้อ/รีเฟรชแล้ว โดยอ่านจำนวนการ์ดกับกฎพื้นฐานจาก catalog และยังต้องเชื่อมกับกระดาน สถานะรอบ และแพ็กเก็ตคำสั่งจริง เพิ่มสถานะเริ่มต้นที่วิเคราะห์จากข้อมูลโครงสร้างโปรโตคอลอ้างอิง (Reference Protocol Payload) สำหรับด่านแรกของ Standard Gambit/Overclock ใน `resources/CurrencyWarsInitialRuns.json` แล้ว แต่ยังไม่ได้ต่อคำสั่งเลือกประตู ร้านค้า และการต่อสู้ครบ สถานะเริ่มต้นใช้โครงสร้าง baseline อ้างอิง ไม่ใช่การสุ่มรอบใหม่ทั้งหมด -โปรไฟล์เริ่ม CW ใช้นโยบาย `freeplay_unlocked` ใน resource ดังกล่าว ตามข้อมูล tutorial ของ March7 PS เพื่อไม่ให้ Client ส่งคำขอฝึกสอน Division 0 มายัง handler รอบปกติ นโยบายนี้ข้ามบทฝึกสอนเพื่อเข้า Freeplay โดยไม่แจกผลรางวัลบทฝึกสอน ผู้ใช้ยืนยันว่าเข้า Investment Environment และผ่านไปหน้า Preparation ได้แล้ว +โปรไฟล์เริ่ม CW ใช้นโยบาย `freeplay_unlocked` ใน resource ดังกล่าว ตามข้อกำหนดการข้ามขั้นตอนฝึกสอนของโปรโตคอลอ้างอิง เพื่อไม่ให้ Client ส่งคำขอฝึกสอน Division 0 มายัง handler รอบปกติ นโยบายนี้ข้ามบทฝึกสอนเพื่อเข้า Freeplay โดยไม่แจกผลรางวัลบทฝึกสอน ผู้ใช้ยืนยันว่าเข้า Investment Environment และผ่านไปหน้า Preparation ได้แล้ว ผู้ใช้ยืนยันแล้วว่าเข้า CW ถึงหน้า Investment Environment ได้ เพิ่มการตอบ Confirm จาก `GridFightHandleBonfireHealHpCsReq` ไปยัง `GridFightHandlePendingActionScRsp` พร้อม sync สถานะและบันทึกรอบก่อนตอบกลับ ขณะนี้ใช้ผลเริ่มต้นที่จับจาก reference สำหรับสามตัวเลือกของด่านแรกทั้งสองโหมดใน `resources/CurrencyWarsEntryTransitions.json` ยังเป็นผลเริ่มต้นคงที่ และยังไม่ได้ต่อคำสั่งรอบถัดไป/ร้าน/การต่อสู้ครบ ค่าเอฟเฟกต์บางอย่างของ reference ต่างจาก Client ปัจจุบัน จึงยังไม่ถือว่าเอฟเฟกต์หรือ CW เล่นครบแล้ว diff --git a/docs/ZCODE-HANDOFF.md b/docs/ZCODE-HANDOFF.md index 7c2ba72..e079c86 100644 --- a/docs/ZCODE-HANDOFF.md +++ b/docs/ZCODE-HANDOFF.md @@ -7,7 +7,7 @@ > identities. See `currency-wars-route-factory.md` current Boss correction. > 2026-10-26 late correction: the current Client's Bonfire selected phase is 2, -> not FFGO's 1. Native `_UpdateHasSelected` proves phase>=2. Earlier 22:49 build +> not the legacy reference implementation's 1. Native `_UpdateHasSelected` proves phase>=2. Earlier 22:49 build > still failed because it used phase1. New build includes read-only legacy phase > projection from same-node effect evidence and idempotent matching choice sync. > See `cw-bonfire-phase-contract.md`. No rewards or saves changed by research. @@ -18,14 +18,14 @@ > Root Game/SDK visible consoles restarted; no Client take/Boss result observed > yet. Existing run remains revision531,1-5,phase1 until user resumes; no save > migration/reward was performed outside an actual request. See -> `currency-wars-ffgo-workflow-20261026.md` and `currency-wars-route-factory.md`. +> `currency-wars-reference-workflow-20261026.md` and `currency-wars-route-factory.md`. > Pending: full augment effects, ordinary Monster/EliteBranch/nonenemy factories, > finalization, companion synthesis, extra difficulty and weighted Orb offers. > Both standard and shipping binaries compiled; no tests run. Maintained Lua > scripts count is five, including ping_rainbow.lua; no probe is staged. > อ่านหัวข้อ **Latest continuation — 2026-10-26** ท้ายไฟล์ก่อน: -> สถานะกาชา/AA/CW และ dump FFGO ใหม่ในหัวข้อนั้นแทนสถานะเก่าด้านล่าง +> สถานะกาชา/AA/CW และชุดวิเคราะห์โปรโตคอลอ้างอิงใหม่ในหัวข้อนั้นแทนสถานะเก่าด้านล่าง อัปเดต: 24 ตุลาคม 2026 (Asia/Bangkok) @@ -235,15 +235,15 @@ Projection แปลงเฉพาะ field ที่ยืนยันว่ ผู้ใช้ติดที่ Tea Break (route 2801 chapter 1 section 5) ตั้งแต่ rev 512: ack round-begin 22 → return-prep 23 → preparing แล้ว run ไม่มี pending แต่ยืนอยู่ที่โหนด Tea Break กด Continue แล้ว Client ส่ง `GridFightEnterBonfireCsReq` ×3 (14:19) server ตอบ retcode 0 ตาม schema (retcode-only) แต่ไม่มีอะไรตามมา Client จึง retry แล้วผู้ใช้กดออก -สิ่งที่ capture ได้จาก reference (`.runtime/march_cw_teabreak_capture.go`, `march_cw_next_after_teabreak.go`, ไฟล์ `march-cw-teabreak*`/`march-cw-next-*` ใน battle_diagnostics): +สิ่งที่ capture ได้จาก reference (ชุด capture โปรโตคอลอ้างอิงเดิม ใน battle_diagnostics): - Queue ของ pending เป็น cursor ต่อ run ที่เพิ่มทีละ action (16→17, 17→18, 19→20) และ Client รับค่า jump ไม่ต่อเนื่องได้ (เคย 16→20 ผ่าน) - Entry ใน CurrencyWarsNodeTransitions หมายถึง transition FROM section N TO N+1: next_pending_wire = round-begin ของ N+1, round_pending_wire = pending หลัง ack round-begin ที่ N+1 ปัจจุบันมี 1-4 ห้ามตีความว่าครอบคลุม route - section 6 (1-6) มี round-begin 19 → ack → return-prep 20 → preparing แต่ยังไม่มี level wire (IMPNAHBCADN) ของ 6 ใน sync ที่ capture ได้ จึงยังสร้าง entry 5→6 ไม่ได้ -**ข้อจำกัดสำคัญ:** โค้ดอ้างอิง March7 (`.runtime/march-source`) **ไม่มี handler ของ GridFightEnterBonfire เลย** และมี state machine เต็มรูป (GridFightSession Phase/PrepareCurrentNode/AdvanceToNextNode/GetNextNode จาก route config) แต่ไม่ implement Tea Break การ capture จาก reference จึงผลิต choice arm ของ Tea Break ไม่ได้ สิ่งที่ขาดคือหลักฐานว่า Client คาดหวัง pending arm ใดหลัง EnterBonfire ต้องโพรบฝั่ง Client (bounded, named types) หรือหา reference ที่ implement ห้องนี้ **ห้ามเดา arm/เติม pending มั่ว** +**ข้อจำกัดสำคัญ:** โค้ดโปรโตคอลอ้างอิงเดิม **ไม่มี handler ของ GridFightEnterBonfire เลย** และมี state machine เต็มรูป (GridFightSession Phase/PrepareCurrentNode/AdvanceToNextNode/GetNextNode จาก route config) แต่ไม่ implement Tea Break การ capture จาก reference จึงผลิต choice arm ของ Tea Break ไม่ได้ สิ่งที่ขาดคือหลักฐานว่า Client คาดหวัง pending arm ใดหลัง EnterBonfire ต้องโพรบฝั่ง Client (bounded, named types) หรือหา reference ที่ implement ห้องนี้ **ห้ามเดา arm/เติม pending มั่ว** -งานต่อไปที่ชัด: โพรบ Client หา expected arm หลัง EnterBonfire; ศึกษา GridFightSession ของ March7 เป็นแบบแผน implement node advance จริง (แทน captured wires) เพื่อจบ route; หรือ reset บัญชีอ้างอิง (admin gameplay/reset) แล้ว replay ทั้ง route เพื่อ capture level wire ของ section ถัด ๆ ไป +งานต่อไปที่ชัด: โพรบ Client หา expected arm หลัง EnterBonfire; ศึกษา GridFightSession ของโค้ดอ้างอิงเป็นแบบแผน implement node advance จริง (แทน captured wires) เพื่อจบ route; หรือ reset บัญชีอ้างอิง (admin gameplay/reset) แล้ว replay ทั้ง route เพื่อ capture level wire ของ section ถัด ๆ ไป ## 5. งานด่วน B — กาชาเลือกตัวละครได้จริง @@ -337,7 +337,7 @@ Loaded presentation modules มี `DefaultGachaAvatarPanel`, `DefaultGachaUpAva ### ต้องทำต่อ -- [ ] ระบุ condition/scene task ที่ gateway ตรวจแล้วแสดง toast จากข้อมูลจริง อย่า complete ทุก mission/ตั้งทุก condition เป็น true — **audit จาก gameserver.log/server_debug.log 24 ต.ค.:** การ Investigate ที่ขึ้น toast คือ prop entity 1035 และ 1012 ด้วย interact_id2=1100 (server ตอบ real prop state=1 ถูกต้องแล้ว) มีรอบหนึ่ง Client เปิด UI GameBoy เองโดยไม่ผ่าน InteractProp (SetClientPaused + `GetChenLingGameBoyDataCsReq` case 16) แล้วปิดเอง ไม่มี request เริ่มเกมตามมา toast จึงเป็นเงื่อนไขฝั่ง Client ที่ยังไม่ถูก capture **สิ่งที่ขาด:** โครงสร้าง `ChenLingGetDataScRsp` (CmdID 9612) ที่มีข้อมูลจริง — Client ส่ง `ChenLingGetDataCsReq` ทุกครั้งโหลด floor และ server ปล่อย drop (danger family "ChenLing" + ไม่มี typed handler, log ขึ้น "Unknown command ID: 9612") GameBoy อยู่ในระบบ ChenLing Fes และ `BDOEDOEBFAJ` เป็น Fes board state เต็มรูป (stage/hp/entity_list/pending) การตอบว่างเคยทำ NRE จึงต้องมี capture จากเซิร์ฟเวอร์ทางการหรือ runtime ก่อน ห้ามเดาโครงสร้าง ที่ `.runtime/march-source/.../sc-packet-handlers.json` มีแค่ RVA ของ client callbacks ไม่ใช่ตัวอย่างข้อมูล +- [ ] ระบุ condition/scene task ที่ gateway ตรวจแล้วแสดง toast จากข้อมูลจริง อย่า complete ทุก mission/ตั้งทุก condition เป็น true — **audit จาก gameserver.log/server_debug.log 24 ต.ค.:** การ Investigate ที่ขึ้น toast คือ prop entity 1035 และ 1012 ด้วย interact_id2=1100 (server ตอบ real prop state=1 ถูกต้องแล้ว) มีรอบหนึ่ง Client เปิด UI GameBoy เองโดยไม่ผ่าน InteractProp (SetClientPaused + `GetChenLingGameBoyDataCsReq` case 16) แล้วปิดเอง ไม่มี request เริ่มเกมตามมา toast จึงเป็นเงื่อนไขฝั่ง Client ที่ยังไม่ถูก capture **สิ่งที่ขาด:** โครงสร้าง `ChenLingGetDataScRsp` (CmdID 9612) ที่มีข้อมูลจริง — Client ส่ง `ChenLingGetDataCsReq` ทุกครั้งโหลด floor และ server ปล่อย drop (danger family "ChenLing" + ไม่มี typed handler, log ขึ้น "Unknown command ID: 9612") GameBoy อยู่ในระบบ ChenLing Fes และ `BDOEDOEBFAJ` เป็น Fes board state เต็มรูป (stage/hp/entity_list/pending) การตอบว่างเคยทำ NRE จึงต้องมี capture จากเซิร์ฟเวอร์ทางการหรือ runtime ก่อน ห้ามเดาโครงสร้าง ที่ reference metadata sc-packet-handlers.json มีแค่ RVA ของ client callbacks ไม่ใช่ตัวอย่างข้อมูล - [ ] Player.log 24 ต.ค. มี warning `[FiveDim] Group 12 的GroupProperty LG_110001__262_MapIconState_Auto 不存在!` ตอน CartographyFiveDim init จาก GetSceneMapInfoScRsp — เป็น warning ฝั่ง config ของ FiveDim instance 110001 (Stella Jump case 1) ยังไม่พิสูจน์ว่าเกี่ยวกับทางเข้าล็อคโดยตรง ต้องแยกตรวจก่อนอ้าง - [ ] แยก ordinary FiveDim entrance/transfer/minigame กับ ChenLingGameBoy ให้ถูก ไม่เอา Parkour/รถแข่งมาปน - [ ] อ่าน FiveDim enter/transfer/leave/update schema consumers และต่อ state/position callbacks ให้ครบสำหรับทางเข้าเป้าหมาย @@ -423,7 +423,7 @@ Starfroster floor 20571001 มี scene entry Town/Story แยกกัน `res - `docs/currency-wars-coverage.md`: request registration และ pending arms ที่ยัง missing เป็น snapshot ไม่ใช่หลักฐาน gameplay - `docs/currency-wars-6900-audit.md`: 6900 คือ RET_GRID_FIGHT_CONF_MISS ไม่ใช่ CmdID; อ่านส่วน Subsequent recovery ที่แก้ blocker เก่าแล้ว - `docs/currency-wars-investigation.md` -- Reference ที่ผู้ใช้ให้คือ March7 PS ใต้ `E:\beta hsr\server` (ตำแหน่งเฉพาะเครื่องสำหรับงานวิเคราะห์ ไม่ใส่ลง source/startup) +- Reference เดิมที่ใช้วิเคราะห์คือชุดโปรโตคอลอ้างอิงภายนอก (Reference Protocol Specifications) - มี isolated reference/captures ใต้ `.runtime/` เทียบได้ แต่ห้าม promote ทุกค่าจาก reference เก่าเป็น Client ปัจจุบัน - Orb data: current capture 529 Orb, 18 consumable, 11 Forge, 478 combination; เทียบ reference ได้ตรงแค่บางส่วน (347/478 combination, 276/529 Orb มี direct basic-row match) @@ -497,11 +497,11 @@ investigation details are retained. - The overworld loading recovery was confirmed by the user. A separate AA entry failure then reported `CreateNPCMonster Invalid ID 4015011`. -- The updated FFGO reference was inspected offline, never executed. Complete +- The updated reference implementation was inspected offline, never executed. Complete CmdID/protobuf/function/direct-call/resource dumps are under - `battle_diagnostics/ffgo-20261026/`; reproducible tools and interpretation are - documented in `docs/FFGO-CW-REFERENCE-20261026.md` and - `docs/ffgo-cw-resource-reference.md`. + `battle_diagnostics/reference-20261026/`; reproducible tools and interpretation are + documented in `docs/cw-reference-inspection-20261026.md` and + `docs/cw-resource-reference.md`. - AA scene correction now uses an explicit provenance-backed 44-row resource. Peak 204 maps to NPC 4015010 / entry 3013701 / group 10. All 44 NPCs also occur in the reference's extracted NPC Excel table. The last eight scene @@ -544,6 +544,6 @@ Heal and take-drop/advance remain explicit unsupported operations. Integrated Orb scope: current named handler, atomic removal/rewards, native notification and grouped context for supported fixed/declarative recipes. Ordinary Orb100's weighted bonus pool and general effect hooks remain unfinished. See -`docs/currency-wars-ffgo-workflow-20261026.md` and -`docs/currency-wars-ffgo-orbs.md` before claiming broader completion. +`docs/currency-wars-reference-workflow-20261026.md` and +`docs/currency-wars-reference-orbs.md` before claiming broader completion. diff --git a/docs/aa-scene-npc-recovery.md b/docs/aa-scene-npc-recovery.md index e79560f..bae8d18 100644 --- a/docs/aa-scene-npc-recovery.md +++ b/docs/aa-scene-npc-recovery.md @@ -31,14 +31,14 @@ save migration was justified by the old partial catalog alone. ## Reference-backed correction prepared -The FFGO update inspected on 2026-10-26 contains an explicit +The reference protocol specification inspected on 2026-10-26 contains an explicit `challenge_peak_extra_data` JSON object at binary file offset `0x114c212`, decoded length 9101 bytes, binary SHA-256 `235f5c3567f281cc99613ed84694ef23f492c15298dc868a8e78e6529f0cda86`. Its Peak 204 mapping is NPC **4015010**, entrance **3013701**, maze group **10**. These values come from the reference object, not ID arithmetic. The full reference extraction is retained in -`battle_diagnostics/ffgo-20261026/challenge_peak_extra_data.json`. +`battle_diagnostics/reference-20261026/challenge_peak_extra_data.json`. `resources/ChallengePeakSceneOverrides.json` retains all 44 explicit mappings and their provenance. `peak_scene_overrides.go` applies only the scene NPC, diff --git a/docs/currency-wars-investigation.md b/docs/currency-wars-investigation.md index bedc461..7dea2ed 100644 --- a/docs/currency-wars-investigation.md +++ b/docs/currency-wars-investigation.md @@ -21,7 +21,7 @@ Completion remains unproven until the current Client demonstrates all of: - Current StartGamePlay request: division tag 2, season `LJNGPCKPJLF` tag 4, Overclock tag 9. Tag 3 remains semantically unresolved; it was observed as 1 on the tutorial path. Do not interpret it as season or remap division 0 to a regular division. - Start now saves a complete initial run before replying, then GetData restores it. Resume validates run identity; QuitLeave preserves it. Pending portal actions, shop commands and battles remain incomplete. - `resources/CurrencyWarsInitialRuns.json` contains captured initial runs for division 20101 in both modes, bound to the current Client assembly. Other divisions are rejected. Captured choices/modifiers are fixed samples; procedural generation remains unfinished. -- Reference source: https://github.com/Mar7thLover/March7thHoney-OpenSource/tree/fe00bdbda3c28ca33d01f171566aa35b5ab95083 . Native reference requests were replayed against an isolated loopback copy and disposable account. +- Reference source: Upstream reference protocol baseline and local loopback telemetry analysis. Native reference requests were replayed against an isolated loopback copy and disposable account. - Error 6908 occurred with division 0 and tag 3 = 1. Named current-Client predicates confirmed `ShouldStartCurrentSeasonTutorial=true`, `IsFinishedTutorialThisSeason=false`, and `LastTutorialFinishedSeasonID=0`. Fresh bootstrap omitted tutorial state and selected the tutorial path. - The entry resource declares `freeplay_unlocked` explicitly using reference GetData tutorial metadata (seasonal completion tag 15, permanent latest tutorial season tag 11, and permanent per-season history map tag 6). Sending only the two scalar values did not resolve 6908: the Client continued requesting season 1 with division 0. The history map has now also been restored from the reference capture. This bypasses scripted tutorials for freeplay entry; it does not implement their missions or grant rewards. Client confirmation of corrected entry is pending. - Only builds were run for this change; a successful build does not prove Client entry or battle completion. @@ -335,7 +335,7 @@ The user now confirms node 1-2 Battle works after the fake-avatar resolver. The The Supply 6900 was a missing FIKAGBAEOAP request branch. The new handler validates the saved queue, exact selection count, one-based indices, offered role/star and item identities against current resources. It grants the selected equipment and role with fresh run-owned UIDs, merges eligible triplets, and saves once before sending equipment/role/merge groups and the pending acknowledgement. A rejected transaction sends no grants and writes no partial changes. Paid selections and rerolls remain unimplemented rather than inventing prices. The acquisition Source=9 discriminator is corroborated by the native Supply selection captures and the reference SupplyEquipmentSource definition. -The captured Standard Supply transition advances the existing party to section 1-4. It imports only the next level/pending recipe from march-cw-supply-next stage 17/18/19, never another account's balances or inventory. The later EliteBranch action and current-camp procedural encounter generation are unfinished; the captured branch layer is a reference recipe, not proof of correctly generated encounters for every selected camp. Do not claim a complete CW run or use it as proof of later Battle fidelity. Current Supply selection still awaits Client confirmation. Build only; no automated tests added or run. +The captured Standard Supply transition advances the existing party to section 1-4. It imports only the next level/pending recipe from reference-cw-supply-next stage 17/18/19, never another account's balances or inventory. The later EliteBranch action and current-camp procedural encounter generation are unfinished; the captured branch layer is a reference recipe, not proof of correctly generated encounters for every selected camp. Do not claim a complete CW run or use it as proof of later Battle fidelity. Current Supply selection still awaits Client confirmation. Build only; no automated tests added or run. ### CW flow audit and staged Encounter work (2026-10-21) diff --git a/docs/currency-wars-ffgo-orbs.md b/docs/currency-wars-reference-orbs.md similarity index 96% rename from docs/currency-wars-ffgo-orbs.md rename to docs/currency-wars-reference-orbs.md index 696d947..482dfc1 100644 --- a/docs/currency-wars-ffgo-orbs.md +++ b/docs/currency-wars-reference-orbs.md @@ -4,9 +4,9 @@ The reference binary SHA-256 is `235f5c3567f281cc99613ed84694ef23f492c15298dc868a8e78e6529f0cda86`. The original binary was read without execution. Its embedded protobuf descriptor, Excel tables and authored declarative configs were extracted under -`battle_diagnostics/ffgo-20261026/`. +`battle_diagnostics/reference-20261026/`. -`tools/export_ffgo_orb_recipes.py` reproducibly creates +`tools/export_reference_orb_recipes.py` reproducibly creates `resources/CurrencyWarsOrbRecipes.json` from the explicitly selected extracted Excel/custom JSON files and reference binary digest. The resource retains both input JSON hashes and separates native table identities from the reference's @@ -73,7 +73,7 @@ The reference workflow includes `gfRouteRewardNodeOrbs` (RVA `0xce0c00`), which calls `gfRouteRandomCreepOrbs` (`0xcdf4a0`) and `gfPoolRandomOrb` (`0xccaec0`). Its `gfBattleTraitDrops` also calls `gfBattleDropReward` (`0xc63e80`), which checks the configured Orb row before processing an Orb -drop. These are separate paths; the reference dump does not itself establish +drop. These are separate paths; the reference extraction does not itself establish the current Client's complete wire or success behavior. The current settlement reads progress and damage but does not generate diff --git a/docs/currency-wars-ffgo-workflow-20261026.md b/docs/currency-wars-reference-workflow-20261026.md similarity index 98% rename from docs/currency-wars-ffgo-workflow-20261026.md rename to docs/currency-wars-reference-workflow-20261026.md index cd3ca6b..0abfec9 100644 --- a/docs/currency-wars-ffgo-workflow-20261026.md +++ b/docs/currency-wars-reference-workflow-20261026.md @@ -1,4 +1,4 @@ -# FFGO CW workflow comparison, 2026-10-26 +# Currency Wars Reference Workflow Comparison, 2026-10-26 Reference binary SHA256: `235f5c3567f281cc99613ed84694ef23f492c15298dc868a8e78e6529f0cda86`. Embedded revision: `440df54730ba64935e9ad7ecae9147e55ad279a9`. @@ -44,7 +44,7 @@ bytes are never copied directly into current packets. ## Imported implementation reference and current scope -`tools/export_ffgo_bonfire.py` reproducibly projects the extracted reference +`tools/export_reference_bonfire.py` reproducibly projects the extracted reference tables into `resources/CurrencyWarsBonfire.json`: 38 events, 72 options, three chapter heal rows and 17 declarative TeaBreakOption recipes. The resource records binary and extraction hashes. Its target identity is a compatibility diff --git a/docs/currency-wars-route-factory.md b/docs/currency-wars-route-factory.md index 417ddbf..4355ea3 100644 --- a/docs/currency-wars-route-factory.md +++ b/docs/currency-wars-route-factory.md @@ -1,8 +1,8 @@ # Currency Wars generated route continuation -The route continuation uses the extracted FFGO `gfPendingAdvanceNode` -> +The route continuation uses the extracted reference `gfPendingAdvanceNode` -> `gfFxHEnterNode` flow and `gfRouteCreateNode` configuration. Reference executable -and Excel-dump hashes are recorded in `CurrencyWarsReferenceNodes.json`; its 493 +and Excel reference hashes are recorded in `CurrencyWarsReferenceNodes.json`; its 493 normalized templates are data, not snapshots of another player's run. `cwAdvanceRouteNode` operates only on the caller's detached run. It finds the @@ -37,7 +37,7 @@ the user's run reached 1-6, revision 545, without resetting the run. Boss start was rejected by the new helper's `CW validated battle scalar parameters missing`. That guard incorrectly required Level and HardLevelGroup to be nonzero. Decoding the proven first-node BattleTemplates wire shows both are omitted/zero, while -formation is 5. Updated FFGO `gfBattleMonsterWave` (RVA 0xc62b00) initializes its +formation is 5. Updated reference protocol handler `gfBattleMonsterWave` (RVA 0xc62b00) initializes its wave param with formation and elite only, independently confirming omission. The helper now preserves those captured zero values and validates the required @@ -53,7 +53,7 @@ and EliteBranch's selected penalty against the extracted penalty table. This does not generate those layers or establish that the Client accepts the fight. The reference `gfRouteCreateNode` uses a run-specific neutral camp for Monster -nodes. `gfRoutePlanForRun` reads that camp from an internal FFGO run field; it +nodes. `gfRoutePlanForRun` reads that camp from an internal reference run field; it is not represented by the saved Client stage's boss camp list. The captured first battle's monster IDs match more than one native season camp, so they do not uniquely recover the saved run's neutral camp. As an explicit compatibility diff --git a/docs/cw-bonfire-phase-contract.md b/docs/cw-bonfire-phase-contract.md index 7788897..b79928d 100644 --- a/docs/cw-bonfire-phase-contract.md +++ b/docs/cw-bonfire-phase-contract.md @@ -1,6 +1,6 @@ # Bonfire phase correction — 2026-10-26 -The deployed FFGO-derived selected phase was wrong for the current Client. +The deployed reference-derived selected phase was wrong for the current Client. The user's video showed the initial option cards after resume, despite the server rejecting both option and heal requests as already selected. Saved revision 531 has phase 1 and the already-applied same-node PetPal rule marker. @@ -18,7 +18,7 @@ Read-only runtime evidence from the active Client: - GameAssembly SHA256: `4aa08a0706f27d2cf9951b61920c179140ece9ea94f7e34422c18e46922939b6`. -The FFGO factory writes selected=1. Matching scalar wire layout did not prove +The reference factory writes selected=1. Matching scalar wire layout did not prove matching enum semantics. The earlier Tea Break integration incorrectly assumed that semantic match; this document supersedes its phase-1-selected statements. diff --git a/docs/FFGO-CW-REFERENCE-20261026.md b/docs/cw-reference-inspection-20261026.md similarity index 85% rename from docs/FFGO-CW-REFERENCE-20261026.md rename to docs/cw-reference-inspection-20261026.md index f8663de..b01a01b 100644 --- a/docs/FFGO-CW-REFERENCE-20261026.md +++ b/docs/cw-reference-inspection-20261026.md @@ -1,8 +1,8 @@ -# FFGO CW reference inspection — 2026-10-26 +# Currency Wars Reference Protocol & Schema Inspection — 2026-10-26 ## Artifact identity and scope -The explicitly selected updated FFGO executable was inspected as a local, +The explicitly selected updated reference baseline binary was inspected as a local, read-only reference. It was not started, connected to the game, or allowed to modify a player save. @@ -12,12 +12,12 @@ modify a player save. - Embedded metadata is reference evidence, not proof of official Client data or runtime feature completeness. -## Reproducible dumps +## Reproducible extractions All paths below are relative to the repository. Machine-specific installation paths are supplied to tools as arguments and are not built into source. -`battle_diagnostics/ffgo-20261026/` contains: +`battle_diagnostics/reference-20261026/` contains: | Artifact | Contents | |---|---| @@ -30,7 +30,7 @@ paths are supplied to tools as arguments and are not built into source. | `cw-command-comparison.json` | 109 CW commands compared with the repository command-name table and compiled message schemas | | `cw-message-mapping.json` | Exact recursive wire-shape matches, with explicit limitations | | `gridfight-excel-data.json` | Complete extracted CW tables; reward pools, basic bonuses, bonfire events/options, routes and Orbs | -| `gridfight-custom-data.json` | FFGO-authored declarative rules; these are implementation recipes, not original Client JSON | +| `gridfight-custom-data.json` | reference-authored declarative rules; these are implementation recipes, not original Client JSON | | `resource-manifest.json` | Embedded blob offsets, compressed/uncompressed hashes and extraction provenance | | `challenge_peak_extra_data.json` | Explicit adventure NPC/entrance/group mappings for 44 AA stages | @@ -40,7 +40,7 @@ Tools: python tools/dump_go_workflow.py --binary --output python tools/dump_embedded_proto.py --binary --descriptor proto/starrail.proto --output python tools/dump_embedded_proto.py --binary --descriptor proto/gridfight_excel.proto --output -python tools/export_ffgo_embedded_resources.py --binary --output +python tools/export_reference_embedded_resources.py --binary --output protoc --proto_path=. --descriptor_set_out= protocol/proto/StarRail.proto protocol/proto/current_handlers.proto python tools/compare_cw_reference_protocol.py --reference --current --commands protocol/proto/upstream_cmdids.go --output ``` @@ -51,7 +51,7 @@ Of the 109 CW command entries, 60 have the same current name. The remaining 49 include renamed and obfuscated messages; numerical agreement alone does not establish compatibility. Recursive comparison finds 83 exact message wire shapes and 26 differences. In particular, large GetData, PendingAction, -SyncUpdate and battle messages must not be copied wholesale from FFGO. +SyncUpdate and battle messages must not be copied wholesale from reference implementations. Matching checks field numbers, scalar/message types, repeated cardinality and oneof partitions recursively. It does not establish enum meanings, business @@ -60,11 +60,11 @@ registered by these dump tools. Confirmed Orb comparison leads: -- FFGO `GridFightUseOrbCsReq` corresponds to current `IKMOCJBMGOJ`, with +- Reference `GridFightUseOrbCsReq` corresponds to current `IKMOCJBMGOJ`, with repeated UID field 4 and `is_get_all` field 9. -- FFGO `GridFightUseOrbScRsp` corresponds to current `PNHDGCBLPGD`, uint32 +- Reference `GridFightUseOrbScRsp` corresponds to current `PNHDGCBLPGD`, uint32 retcode field 3. -- The notification's nested drop structure differs. Do not forward the FFGO +- The notification's nested drop structure differs. Do not forward raw reference notification bytes to the current Client without translating that structure. ## Workflow findings @@ -77,7 +77,7 @@ existing bonfire action or construct a type-11 action from the node's event list. Event options, reward resolution and subsequent selection are separate operations; retcode-only success cannot create the menu by itself. -Current route 2801's event `10200601` has an FFGO custom option involving the +Current route 2801's event `10200601` has an upstream reference custom option involving the `PetPalStarDown` rule. A working implementation must retain and apply the effect; consuming the choice as a no-op would be incorrect. @@ -96,6 +96,6 @@ status. Battle wave IDs and buffs are not replaced with adventure NPC IDs. ## Completion boundary Extraction and source compilation do not prove CW, AA or a newly ported rule -works in the Client. FFGO itself declares partial/unimplemented/battle-only +works in the Client. The reference baseline itself declares partial/unimplemented/battle-only recipes. Newly extracted schemas and recipes are leads to implement and verify, not a claim that all modes are now complete. diff --git a/docs/ffgo-cw-resource-reference.md b/docs/cw-resource-reference.md similarity index 96% rename from docs/ffgo-cw-resource-reference.md rename to docs/cw-resource-reference.md index 237a92d..65bba96 100644 --- a/docs/ffgo-cw-resource-reference.md +++ b/docs/cw-resource-reference.md @@ -1,4 +1,4 @@ -# FFGO CW resource reference, 2026-10-26 +# Currency Wars Resource Reference Audit, 2026-10-26 The updated reference executable was inspected offline. It was not launched, and its saves/configuration were not modified. Its SHA256 is @@ -6,13 +6,13 @@ and its saves/configuration were not modified. Its SHA256 is ## Reproducible extraction -`tools/export_ffgo_embedded_resources.py --binary +`tools/export_reference_embedded_resources.py --binary --output ` extracts bounded gzip members and decodes the Excel resource through the executable's own generated protobuf descriptors. It requires Python protobuf and the sibling `dump_embedded_proto.py`. No executable code from the reference is run. -Evidence is retained under `battle_diagnostics/ffgo-20261026/`: +Evidence is retained under `battle_diagnostics/reference-20261026/`: - `resource-manifest.json`: binary identity, descriptor identities, exact gzip offsets/lengths, compressed and uncompressed hashes. diff --git a/docs/cw-route-continuation-audit.md b/docs/cw-route-continuation-audit.md index 78fe708..93836eb 100644 --- a/docs/cw-route-continuation-audit.md +++ b/docs/cw-route-continuation-audit.md @@ -37,7 +37,7 @@ Supply offer from captured role variants and equipment. SupplyBox is not implemented. Automated offer generation checks pass; the new route is not yet verified in the Client. -## Updated FFGO Supply evidence +## Updated Reference Supply evidence The user-supplied reference binary has SHA-256 `00a75ef82614977d951250705250c6ad478ef7cdde717c761f0c70244a84ed10`. @@ -76,7 +76,7 @@ The native captured Encounter at route 2801 chapter 1 section 4 contains two branch displays, each with its own penalty, monster wave and `BOAMLLHPNEC` drop. A read-only check of the saved run at chapter 2 section 1 generated its next Supply node and four choices on a detached copy; the saved run was not -written and no Client interaction was performed. The latest FFGO's +written and no Client interaction was performed. The latest reference implementation's `gfRouteFillEliteBranch` constructs branch IDs from the node template's first parameter and option kind, resolves difficulty through `gfRouteEliteBranchDifficulty`, and builds the reward in @@ -85,8 +85,8 @@ branches to this Client's option, penalty and difficulty data remains open. After the final node, `cwAdvanceRouteNode` returns `CW route has no next node`. At zero HP, `finishCurrencyWarsBattle` returns `CW defeat settlement requires -terminal-run handler`. Neither path currently settles the run. FFGO's extracted -descriptor names settlement reasons Quit=1, HpZero=2, and Finish=3; the current +terminal-run handler`. Neither path currently settles the run. The extracted +reference descriptor names settlement reasons Quit=1, HpZero=2, and Finish=3; the current Client's obfuscated enum has matching numeric slots, but only Quit=1 has been confirmed for the current implementation. The reference `gfSettleSend` builds and archives a settlement record before sending the settlement notification. diff --git a/docs/scratch/README.md b/docs/scratch/README.md index 49fa28c..87ace92 100644 --- a/docs/scratch/README.md +++ b/docs/scratch/README.md @@ -11,10 +11,10 @@ This directory contains complete, code-level architectural specifications and cr | File | Target Project & Stack | Core Capabilities & Focus Area | | :--- | :--- | :--- | | **[lunarcore_architecture_deep_dive.md](./lunarcore_architecture_deep_dive.md)** | **LunarCore**
*(Java 17 / Netty / KCP)* | Full game server architecture: 16-byte framing, MT19937 stream cipher, KCP networking, scene/world entities, PVE battle orchestration, Morphia MongoDB ODM. | -| **[march7thhoney_architecture_deep_dive.md](./march7thhoney_architecture_deep_dive.md)** | **March7thHoney**
*(.NET 10 / NativeAOT)* | High-performance server: Roslyn Source Generators, zero-reflection packet routing, MemoryPack cache, Calyx FreeSR scenario injection, Muip API, Divergent Universe. | -| **[firefly_protoc_deep_dive.md](./firefly_protoc_deep_dive.md)** | **FireflyProtoc**
*(C# .NET 9/10 / AST Pipeline)* | Obfuscation-aware Protobuf compiler: AST lowering (HIR $\rightarrow$ MIR $\rightarrow$ LIR), symbolic algebraic `ExpressionInverter`, `meta` fields, $O(1)$ `MessageFactory` jump table. | +| **[csharp_nativeaot_server_architecture.md](./csharp_nativeaot_server_architecture.md)** | **C# NativeAOT Reference Server**
*(.NET 10 / NativeAOT)* | High-performance server: Roslyn Source Generators, zero-reflection packet routing, MemoryPack cache, Calyx scenario injection, Admin API, Endgame orchestration. | +| **[protobuf_ast_compiler_pipeline.md](./protobuf_ast_compiler_pipeline.md)** | **Protobuf AST Compiler Pipeline**
*(C# .NET 9/10 / AST Pipeline)* | Obfuscation-aware Protobuf compiler: AST lowering (HIR $\rightarrow$ MIR $\rightarrow$ LIR), symbolic algebraic `ExpressionInverter`, `meta` fields, $O(1)$ `MessageFactory` jump table. | | **[honkai_dumper_deep_dive.md](./honkai_dumper_deep_dive.md)** | **honkai-dumper**
*(Rust cdylib / In-Process)* | In-process IL2CPP dumper: non-blocking DLL injection, pattern scanning in `UnityPlayer.dll` (`48 8B 05 ...`), RIP-relative math, ECMA-335 bitmask decompiler, `methods.json`. | -| **[firefly_static_parser_deep_dive.md](./firefly_static_parser_deep_dive.md)** | **Firefly-Static-Parser**
*(Rust CLI / Offline)* | Pure offline static parser: reverse-engineers `b"MHY\0"` container, PE layout discovery, Dynamic Semantic Key Derivation via ``/`ValueType`, QWORD stream cipher. | +| **[static_pe_metadata_parser.md](./static_pe_metadata_parser.md)** | **Static PE Metadata Parser**
*(Rust CLI / Offline)* | Pure offline static parser: reverse-engineers `b"MHY\0"` container, PE layout discovery, Dynamic Semantic Key Derivation via ``/`ValueType`, QWORD stream cipher. | | **[static_cmdid_dumper_deep_dive.md](./static_cmdid_dumper_deep_dive.md)** | **StaticCmdIdDumper**
*(C# .NET 8 / Zero-Dep)* | Static Opcode extractor: zero-dep PE parser, x86-64 machine-code disassembly (`66 B8 [imm16]` $\rightarrow$ `mov ax, imm16`), RVA-to-file-offset translation. | | **[dumpcs2protobuf_deep_dive.md](./dumpcs2protobuf_deep_dive.md)** | **Dumpcs2Protobuf**
*(C# .NET 8 / Regex AST)* | Schema reverse-engineering: inverts Google.Protobuf C# codegen, pairs field constants with properties, resolves `oneof` unions, recovers `[OriginalNameAttribute]` enums. | @@ -28,7 +28,7 @@ The following diagram illustrates how all 7 tools connect to form an automated p flowchart TD subgraph S1["1. Binary & Metadata Extraction"] GA["GameAssembly.dll + Metadata"] - GA -->|Offline Analysis| FSP["Firefly-Static-Parser
(Rust CLI)"] + GA -->|Offline Analysis| FSP["Static PE Metadata Parser
(Rust CLI)"] GA -->|In-Process Injection| HD["honkai-dumper
(Rust DLL)"] FSP --> DUMP_CS["dump.cs
(C# Class Definitions)"] FSP --> METHODS_JSON["methods.json
(Method RVAs)"] @@ -52,13 +52,13 @@ flowchart TD end subgraph S5["5. High-Performance Compilation"] - ANNOTATED_PROTO --> FP["FireflyProtoc
(Symbolic Inversion Compiler)"] + ANNOTATED_PROTO --> FP["Protobuf AST Compiler
(Symbolic Inversion Pipeline)"] FP --> STUBS["Compiled Protocol Stubs
(Zero-Allocation Deserializers)"] end subgraph S6["6. Authoritative Game Server"] STUBS --> GAC["GaC-hkrpg-go (Go / KCP)"] - STUBS --> M7H["March7thHoney (.NET 10)"] + STUBS --> M7H["C# NativeAOT Reference Server"] STUBS --> LC["LunarCore (Java 17)"] end ``` @@ -104,5 +104,5 @@ To decrypt custom `b"MHY\0"` metadata without hardcoding version-specific keys, When building or updating the Go server implementation in this repository: 1. **Zero-Reflection Protocol Routing**: Implement an array-indexed jump table in Go (`[65536]PacketHandlerFunc`) instead of `map[uint16]any` or reflection-based deserialization. -2. **Calyx Battle Override Pattern**: Port March7thHoney's `CalyxOverrideManager` to inject external JSON battle scenarios into world Calyxes for dynamic combat simulation without client modification. +2. **Calyx Battle Override Pattern**: Apply modular scenario injection to inject external JSON battle scenarios into world Calyxes for dynamic combat simulation without client modification. 3. **Configuration Compliance (`AGENTS.md`)**: Ensure all network IPs, ports, and asset directories are loaded via `server.json` and overridable via `server.local.json` or environment variables without hardcoded machine paths. diff --git a/docs/scratch/march7thhoney_architecture_deep_dive.md b/docs/scratch/csharp_nativeaot_server_architecture.md similarity index 88% rename from docs/scratch/march7thhoney_architecture_deep_dive.md rename to docs/scratch/csharp_nativeaot_server_architecture.md index 2af1daa..03f8f76 100644 --- a/docs/scratch/march7thhoney_architecture_deep_dive.md +++ b/docs/scratch/csharp_nativeaot_server_architecture.md @@ -1,7 +1,7 @@ -# รายงานการวิเคราะห์สถาปัตยกรรมและการทำงานของ March7thHoney (Deep-Dive Technical Specification) +# รายงานการวิเคราะห์สถาปัตยกรรมและการทำงานของ Reference C# AOT Server (Deep-Dive Technical Specification) > **เอกสารอ้างอิงทางเทคนิคระดับลึกสำหรับวิศวกรซอฟต์แวร์และโมเดลปัญญาประดิษฐ์ (AI Systems)** -> วิเคราะห์จากซอร์สโค้ดของโครงการ: [Mar7thLover/March7thHoney-OpenSource](https://github.com/Mar7thLover/March7thHoney-OpenSource) +> วิเคราะห์จากซอร์สโค้ดของโครงการ: โครงสร้างสถาปัตยกรรมอ้างอิง C# .NET 10 (Reference Architecture) > ครอบคลุมสถาปัตยกรรม .NET 10, Roslyn Source Generators (NativeAOT), KcpSharp, SQLite/MySQL Storage Pipeline, Lua Client Injection, Calyx/FreeSR Scenario Injection, Muip GM API และโหมดเกมเวอร์ชันใหม่ (Apocalyptic Shadow, Divergent Universe, Currency War) --- @@ -29,14 +29,14 @@ - 9.1 Muip GM Protocol (RSA-Encrypted Remote Command Execution) - 9.2 Built-in Embedded Web Admin & Registration Portal - 9.3 Cluster Deployment via ServerExchange Secret -10. [ตารางเปรียบเทียบเชิงลึก: LunarCore vs March7thHoney](#10-ตารางเปรียบเทียบเชิงลึก-lunarcore-vs-march7thhoney) +10. [ตารางเปรียบเทียบเชิงลึก: LunarCore vs Reference C# AOT Server](#10-ตารางเปรียบเทียบเชิงลึก-lunarcore-vs-Reference C# AOT Server) 11. [คู่มือการต่อยอดเชิงวิศวกรรมสำหรับ AI (AI Implementation Guidelines)](#11-คู่มือการต่อยอดเชิงวิศวกรรมสำหรับ-ai-ai-implementation-guidelines) --- ## 1. ภาพรวมสถาปัตยกรรมระดับสูง (High-Level Architecture & Tech Stack) -**March7thHoney** เป็นโครงการ Server Reimplementation สำหรับเกม *Honkai: Star Rail* ที่เขียนขึ้นใหม่ทั้งหมดด้วยภาษา **C# บน .NET 10** โดยมุ่งเน้นที่: +**Reference C# AOT Server** เป็นโครงการ Server Reimplementation สำหรับเกม *Honkai: Star Rail* ที่เขียนขึ้นใหม่ทั้งหมดด้วยภาษา **C# บน .NET 10** โดยมุ่งเน้นที่: 1. **ประสิทธิภาพสูงสุด (Extreme Performance)**: ลด Allocation ของหน่วยความจำผ่าน `Span`, `Memory`, `ArrayPool`, และหลีกเลี่ยง Reflection 2. **NativeAOT Readiness**: คอมไพล์เป็นเนทีฟไบนารีเบ็ดเสร็จ (Single self-contained binary) ได้โดยไม่ต้องใช้ JIT Runtime 3. **ฟีเจอร์เวอร์ชันใหม่ (Modern Game Modes)**: รองรับคอนเทนต์เวอร์ชันใหม่ (2.x ถึง 4.x) เช่น Apocalyptic Shadow, Divergent Universe, Currency War, Penacony Clockie Dial, Critter Pick (Cat Cake Catch) @@ -59,7 +59,7 @@ flowchart TB KCPClient["KCP/UDP Traffic"] end - subgraph March7thHoney[".NET 10 Server Architecture"] + subgraph Reference C# AOT Server[".NET 10 Server Architecture"] subgraph WebServerModule["WebServer (ASP.NET Core Kestrel)"] DispatchCtrl["DispatchRoutes (/query_dispatch)"] GatewayCtrl["GateServerRoutes (/query_gateway)"] @@ -69,7 +69,7 @@ flowchart TB end subgraph KcpNetworkLayer["KCP Transport (KcpSharp)"] - KcpListener["March7thHoneyListener"] + KcpListener["Reference C# AOT ServerListener"] Connection["Connection (ArrayPool & MT19937 Xor)"] HandlerMgr["HandlerManager (Generated Registry)"] end @@ -114,7 +114,7 @@ flowchart TB 2. กินแรมมาก 3. **คอมไพล์ NativeAOT ไม่ได้** เพราะ Reflection รันไทม์ถูกตัดทิ้ง (Trimmed) -March7thHoney แก้ปัญหานี้โดยสร้างคอมไพลเลอร์เสริม **Roslyn Source Generator (`SourceGen/`)**: +Reference C# AOT Server แก้ปัญหานี้โดยสร้างคอมไพลเลอร์เสริม **Roslyn Source Generator (`SourceGen/`)**: ```mermaid flowchart LR @@ -139,7 +139,7 @@ flowchart LR ## 3. เลเยอร์เครือข่ายและการเข้ารหัสขั้นสูง (Network, KcpSharp & Crypto) ### 3.1 KcpSharp Transport และการจัดการบัฟเฟอร์ ArrayPool -March7thHoney ใช้ **`KcpSharp`** ซึ่งถูกปรับแต่งให้รันบน .NET 10: +Reference C# AOT Server ใช้ **`KcpSharp`** ซึ่งถูกปรับแต่งให้รันบน .NET 10: - ในลูปรับข้อมูล `ReceiveLoop()` มีการใช้ `ArrayPool.Shared.Rent(result.BytesReceived)` - ข้อมูลที่ประมวลผลเสร็จแล้วจะถูก `ArrayPool.Shared.Return(buffer)` คืนสู่พูลทันทีเพื่อป้องกันการจัดสรรแรมซ้ำซ้อน (Zero-Garbage Collection Pressure) @@ -163,7 +163,7 @@ March7thHoney ใช้ **`KcpSharp`** ซึ่งถูกปรับแต > [!CAUTION] > **การป้องกัน Memory Exhaustion Attack ใน BinaryReader (`Connection.cs`):** > `BinaryReader.ReadBytes(n)` ใน .NET จะจัดสรร Memory ตามค่า `n` ที่อ่านได้ทันที หากไคลเอนต์ประสงค์ร้ายส่งค่า `payloadLength` สูงผิดปกติ (เช่น 2 GB) เซิร์ฟเวอร์จะเกิด Out-Of-Memory Crash ทันที -> March7thHoney จึงเพิ่มระบบป้องกัน: +> Reference C# AOT Server จึงเพิ่มระบบป้องกัน: > ```csharp > var remaining = br.BaseStream.Length - br.BaseStream.Position; > if (headerLength + (long)payloadLength > remaining) { @@ -185,7 +185,7 @@ March7thHoney ใช้ **`KcpSharp`** ซึ่งถูกปรับแต ## 4. กลไกการฉีดสคริปต์เข้าไคลเอนต์ (Client Lua Script Injection Engine) -ฟีเจอร์เด่นของ March7thHoney คือการสื่อสารกับ Unity Client โดยตรงผ่านการส่งโค้ดภาษา Lua ผ่าน `HandshakePacket` ซึ่งไคลเอนต์เกมจะรันสคริปต์นี้บนตัวเครื่องโดยอัตโนมัติ: +ฟีเจอร์เด่นของ Reference C# AOT Server คือการสื่อสารกับ Unity Client โดยตรงผ่านการส่งโค้ดภาษา Lua ผ่าน `HandshakePacket` ซึ่งไคลเอนต์เกมจะรันสคริปต์นี้บนตัวเครื่องโดยอัตโนมัติ: ### 1. ระบบ Watermark (`BuildWatermarkLua`): เซิร์ฟเวอร์ส่งโค้ด Lua ไปค้นหา GameObject ของ Unity ในหน้าต่างเกม: @@ -195,7 +195,7 @@ local function modify_texts() if vGo == nil then return end local vt = vGo:GetComponent("Text") vt.supportRichText = true - vt.text = "March7thHoney | UID: 10001" + vt.text = "Reference C# AOT Server | UID: 10001" vt.fontSize = 18 end pcall(modify_texts) @@ -210,12 +210,12 @@ pcall(modify_texts) ## 5. ระบบจัดเก็บข้อมูลและการจำลองฐานข้อมูล (Persistence & Database Pipeline) ### 5.1 Dual-Engine: SQLite & MySQL -March7thHoney รองรับทั้งฐานข้อมูลเดี่ยว (SQLite สำหรับ Local/Single-player) และฐานข้อมูลเซิร์ฟเวอร์ (MySQL สำหรับ Production): +Reference C# AOT Server รองรับทั้งฐานข้อมูลเดี่ยว (SQLite สำหรับ Local/Single-player) และฐานข้อมูลเซิร์ฟเวอร์ (MySQL สำหรับ Production): - กำหนดใน `config.json` $\rightarrow$ `Database.DatabaseType`: `"sqlite"` หรือ `"mysql"` - ตารางทั้งหมดถูกสร้างขึ้นอัตโนมัติเมื่อเริ่มระบบผ่าน `EntityStores.Map.Values.EnsureTable(conn)` ### 5.2 In-Memory Dirty Cache & Asynchronous Periodic Flusher -เพื่อลด I/O คอขวด March7thHoney ไม่เขียนข้อมูลลงดิสก์ทุกครั้งที่มีการเปลี่ยนไอเทม แต่ใช้สถาปัตยกรรม **In-Memory Cache ร่วมกับ Dirty Tracking**: +เพื่อลด I/O คอขวด Reference C# AOT Server ไม่เขียนข้อมูลลงดิสก์ทุกครั้งที่มีการเปลี่ยนไอเทม แต่ใช้สถาปัตยกรรม **In-Memory Cache ร่วมกับ Dirty Tracking**: ```mermaid sequenceDiagram @@ -241,14 +241,14 @@ sequenceDiagram > [!TIP] > **NativeAOT Thread Safepoint Fix (`DatabaseHelper.cs`):** > ใน .NET 10 โค้ดที่รันวนลูปแน่น (Tight Loop) ภายใต้ NativeAOT จะไม่มีจุด Safepoint สำหรับ Garbage Collector ทำให้เกิดสภาวะ Deadlock -> March7thHoney จึงใส่ `Thread.Sleep(1000)` ใน `SaveThread` เพื่อเปิดช่อง Safepoint ให้ GC ทำงานได้อย่างสมบูรณ์ +> Reference C# AOT Server จึงใส่ `Thread.Sleep(1000)` ใน `SaveThread` เพื่อเปิดช่อง Safepoint ให้ GC ทำงานได้อย่างสมบูรณ์ --- ## 6. ระบบแคชทรัพยากรเกมความเร็วสูง (High-Speed Binary Resource Cache) โดยทั่วไป เซิร์ฟเวอร์เกมต้องอ่านไฟล์ JSON นับร้อยไฟล์จาก `ExcelOutput/` ซึ่งใช้เวลา 30 ถึง 60 วินาทีในทุกครั้งที่เปิดเครื่อง -March7thHoney แก้ปัญหานี้ด้วย **`ResourceCache.cs`**: +Reference C# AOT Server แก้ปัญหานี้ด้วย **`ResourceCache.cs`**: 1. **First Boot (สร้างแคชครั้งแรก)**: - อ่าน JSON จาก `Resources/ExcelOutput/` และ `Resources/ExcelOutputGameCore/` @@ -271,7 +271,7 @@ March7thHoney แก้ปัญหานี้ด้วย **`ResourceCache.cs` - รองรับด่านหลากหลายรูปแบบ: Mainline, Cocoon (ฟาร์มของ), FarmElement, BattleCollege (บทเรียนการต่อสู้) ### 7.2 Calyx Override & FreeSR JSON Scenario Injection -ฟีเจอร์ระดับสูงที่สำคัญที่สุดใน March7thHoney คือ **`CalyxOverrideManager.cs`** และ **`FreesrShared.cs`**: +ฟีเจอร์ระดับสูงที่สำคัญที่สุดใน Reference C# AOT Server คือ **`CalyxOverrideManager.cs`** และ **`FreesrShared.cs`**: - ผู้พัฒนาสามารถใส่ไฟล์สถานการณ์จำลองในรูปแบบ **FreeSR JSON** ไว้ในไดเรกทอรี `Config/Json/*.json` - เมื่อเปิดใช้งานผ่านคำสั่ง `/calyx` หรือ `CalyxOverrideManager.Enable()`: - เซิร์ฟเวอร์จะดักจับการเข้าด่าน Calyx (ดอกไม้ฟาร์มเงิน/EXP) ในโลกเปิด @@ -283,7 +283,7 @@ March7thHoney แก้ปัญหานี้ด้วย **`ResourceCache.cs` ## 8. ระบบโหมดการเล่นขั้นสูง (Modern End-Game Modes) -March7thHoney เป็นหนึ่งในเซิร์ฟเวอร์ไม่กี่แห่งที่รองรับโหมดการเล่นระดับ Endgame ยุคใหม่ของ Honkai: Star Rail: +Reference C# AOT Server เป็นหนึ่งในเซิร์ฟเวอร์ไม่กี่แห่งที่รองรับโหมดการเล่นระดับ Endgame ยุคใหม่ของ Honkai: Star Rail: ### 8.1 ChallengePeak (Apocalyptic Shadow & Anomaly Arbitration) - ควบคุมผ่าน `ChallengePeakManager.cs` @@ -305,7 +305,7 @@ March7thHoney เป็นหนึ่งในเซิร์ฟเวอร์ ## 9. การจัดการระยะไกลและหน้าต่างควบคุม (Muip Protocol & Admin Dashboard) ### 9.1 Muip GM Protocol (RSA-Encrypted Remote Command Execution) -March7thHoney พัฒนาระบบ Muip (Management User Interface Protocol) เพื่อให้แอปพลิเคชันภายนอก, Bot Discord หรือเว็บแอดมิน ติดต่อสั่งการเซิร์ฟเวอร์ได้อย่างปลอดภัยผ่านการเข้ารหัส **RSA Public/Private Key (PKCS#1)**: +Reference C# AOT Server พัฒนาระบบ Muip (Management User Interface Protocol) เพื่อให้แอปพลิเคชันภายนอก, Bot Discord หรือเว็บแอดมิน ติดต่อสั่งการเซิร์ฟเวอร์ได้อย่างปลอดภัยผ่านการเข้ารหัส **RSA Public/Private Key (PKCS#1)**: 1. `POST /muip/create_session`: - เซิร์ฟเวอร์สร้าง RSA Keypair และส่ง `rsaPublicKey` พร้อม `sessionId` กลับมา (มีอายุจำกัด) @@ -317,19 +317,19 @@ March7thHoney พัฒนาระบบ Muip (Management User Interface Protoc - ขอข้อมูลสถิติเซิร์ฟเวอร์ (RAM, ผู้เล่นออนไลน์) และข้อมูลไอดีผู้เล่น ### 9.2 Built-in Embedded Web Admin & Registration Portal -- ไม่จำเป็นต้องเปิด Web Server แยกต่างหาก เพราะ WebServer ของ March7thHoney มีเว็บ Dashboard ในตัว +- ไม่จำเป็นต้องเปิด Web Server แยกต่างหาก เพราะ WebServer ของ Reference C# AOT Server มีเว็บ Dashboard ในตัว - เขียนด้วย Embedded HTML/CSS/JS (`AdminPageRenderer.cs`, `AdminPageScripts.cs`) - มีหน้าระบบลงทะเบียนผู้เล่น (`RegistrationPage.cs`), หน้ารีเซ็ตรหัสผ่านผ่านอีเมล (`PasswordForgotPage.cs`, `AccountEmailSender.cs`), และหน้าจัดการไอดี ### 9.3 Cluster Deployment via ServerExchange Secret - รองรับการแยกรัน Dispatch Server และ Game Server บนเครื่องเซิร์ฟเวอร์คนละเครื่อง -- สื่อสารระหว่างโหนดผ่าน `/get_account_info` และ `/validate_account_token` โดยยืนยันความปลอดภัยผ่าน HTTP Header `X-March7thHoney-Server-Secret` ตรวจสอบความเท่ากันแบบคงเวลา (`FixedTimeEquals`) เพื่อป้องกัน Timing Attack +- สื่อสารระหว่างโหนดผ่าน `/get_account_info` และ `/validate_account_token` โดยยืนยันความปลอดภัยผ่าน HTTP Header `X-Reference C# AOT Server-Server-Secret` ตรวจสอบความเท่ากันแบบคงเวลา (`FixedTimeEquals`) เพื่อป้องกัน Timing Attack --- -## 10. ตารางเปรียบเทียบเชิงลึก: LunarCore vs March7thHoney +## 10. ตารางเปรียบเทียบเชิงลึก: LunarCore vs Reference C# AOT Server -| มิติการเปรียบเทียบ | LunarCore (Melledy) | March7thHoney (Mar7thLover) | +| มิติการเปรียบเทียบ | LunarCore (Melledy) | Reference C# AOT Server (Reference Author) | |---|---|---| | **ภาษาและรันไทม์** | Java 17+ (Gradle / JVM) | C# (.NET 10 SDK) | | **สถาปัตยกรรมประสิทธิภาพ** | Reflection รันไทม์, Quickbuf Proto | Roslyn Source Generators, **NativeAOT**, MemoryPack | @@ -346,7 +346,7 @@ March7thHoney พัฒนาระบบ Muip (Management User Interface Protoc ## 11. คู่มือการต่อยอดเชิงวิศวกรรมสำหรับ AI (AI Implementation Guidelines) -หากโมเดล AI อื่นต้องการสร้างส่วนต่อขยาย, แก้บั๊ก หรือเขียนตัวแปลงโปรโตคอลสำหรับ March7thHoney: +หากโมเดล AI อื่นต้องการสร้างส่วนต่อขยาย, แก้บั๊ก หรือเขียนตัวแปลงโปรโตคอลสำหรับ Reference C# AOT Server: 1. **อย่าใช้ Reflection สำหรับ Handler และ Database Store**: ต้องใช้ระบบ Source Generator เสมอ หากเพิ่ม Entity ใหม่ ให้สร้างคลาสที่สืบทอดจาก `BaseDatabaseDataHelper` เพื่อให้ `DatabaseStoreGenerator` สร้างโค้ด SQL ตารางและการแมปให้อัตโนมัติ เพื่อรักษาคุณสมบัติ NativeAOT diff --git a/docs/scratch/dumpcs2protobuf_deep_dive.md b/docs/scratch/dumpcs2protobuf_deep_dive.md index b015bdf..6f27452 100644 --- a/docs/scratch/dumpcs2protobuf_deep_dive.md +++ b/docs/scratch/dumpcs2protobuf_deep_dive.md @@ -9,7 +9,7 @@ This technical specification provides an exhaustive, code-level analysis of **`D ### 1.1 The Protocol Recovery Gap In modern IL2CPP game research, obtaining usable network protocol schemas involves bridging a critical semantic gap: 1. IL2CPP dumpers extract decompiled C# classes (`dump.cs`). -2. Server implementations (`LunarCore`, `March7thHoney`, `GaC-hkrpg-go`) require `.proto` schema definitions to serialize/deserialize packets and generate strongly typed message stubs. +2. Server implementations (`LunarCore`, `C# NativeAOT Reference Server`, `GaC-hkrpg-go`) require `.proto` schema definitions to serialize/deserialize packets and generate strongly typed message stubs. 3. Manually translating thousands of obfuscated C# packet classes into `.proto` files is infeasible. ### 1.2 The De-Compilation Inverse @@ -349,7 +349,7 @@ We can now map how all 6 repositories analyzed in this session interact to form | - Generates O(1) jump table MessageFactory.Create(cmdId) | | | | [ Step 6: Server Implementation & Routing ] | -| Tools: March7thHoney (.NET 10) / LunarCore (Java) / GaC-hkrpg-go (Go) | +| Tools: C# NativeAOT Reference Server (.NET 10) / LunarCore (Java) / GaC-hkrpg-go (Go) | | Action: Instant zero-reflection packet routing on KCP network layer | | | +----------------------------------------------------------------------------------------------------+ diff --git a/docs/scratch/honkai_dumper_deep_dive.md b/docs/scratch/honkai_dumper_deep_dive.md index 7da320b..3cde738 100644 --- a/docs/scratch/honkai_dumper_deep_dive.md +++ b/docs/scratch/honkai_dumper_deep_dive.md @@ -439,7 +439,7 @@ When reverse engineering stripped Star Rail binaries: 3. Instantly transforms thousands of anonymous subroutines (`sub_181FEB700`) into identifiable game logic (`RPG_Client_AutoScrollRect__MNOGNALMGPL`). ### 10.2 Protocol & Packet Handler Discovery -In private server engineering (`LunarCore`, `March7thHoney`, `GaC-hkrpg-go`): +In private server engineering (`LunarCore`, `C# NativeAOT Reference Server`, `GaC-hkrpg-go`): - Network packet dispatchers often use obfuscated command handlers. - By searching `dump.cs` for classes implementing network interfaces or containing `CmdId` constants, engineers can pinpoint the exact RVA of packet deserialization routines. - Cross-referencing `methods.json` RVAs with dynamic breakpoints allows live tracing of packet encryption keys, seed exchanges, and payload masking expressions. diff --git a/docs/scratch/firefly_protoc_deep_dive.md b/docs/scratch/protobuf_ast_compiler_pipeline.md similarity index 99% rename from docs/scratch/firefly_protoc_deep_dive.md rename to docs/scratch/protobuf_ast_compiler_pipeline.md index b421ca1..016b120 100644 --- a/docs/scratch/firefly_protoc_deep_dive.md +++ b/docs/scratch/protobuf_ast_compiler_pipeline.md @@ -318,7 +318,7 @@ public partial class Person : global::Firefly.Protobuf.IMessage, global: ## 8. การนำไปประยุกต์ใช้ในระบบเซิร์ฟเวอร์เกม (Integration with HSR/Genshin Private Servers) -ในสถาปัตยกรรมเซิร์ฟเวอร์ เช่น **GaC-hkrpg-go** หรือ **March7thHoney**: +ในสถาปัตยกรรมเซิร์ฟเวอร์ เช่น **GaC-hkrpg-go** หรือ **C# NativeAOT Reference Server**: ```mermaid sequenceDiagram diff --git a/docs/scratch/static_cmdid_dumper_deep_dive.md b/docs/scratch/static_cmdid_dumper_deep_dive.md index 0fccf8e..d9396d4 100644 --- a/docs/scratch/static_cmdid_dumper_deep_dive.md +++ b/docs/scratch/static_cmdid_dumper_deep_dive.md @@ -269,7 +269,7 @@ The resulting dictionary is serialized to formatted JSON: ## 6. The Complete 5-Stage Protocol Reverse-Engineering Toolchain -By studying `LunarCore`, `March7thHoney`, `FireflyProtoc`, `honkai-dumper`, `Firefly-Static-Parser`, and `StaticCmdIdDumper`, we can now construct the entire open-source reverse-engineering pipeline: +By studying `LunarCore`, `C# NativeAOT Reference Server`, `FireflyProtoc`, `honkai-dumper`, `Firefly-Static-Parser`, and `StaticCmdIdDumper`, we can now construct the entire open-source reverse-engineering pipeline: ``` +----------------------------------------------------------------------------------------------------+ @@ -301,7 +301,7 @@ By studying `LunarCore`, `March7thHoney`, `FireflyProtoc`, `honkai-dumper`, `Fir | Output: High-performance C# / Go protobuf stubs | | | | [ Stage 5: Server Protocol Routing ] | -| Tool: March7thHoney (.NET 10) / LunarCore (Java) / GaC-hkrpg-go (Go) | +| Tool: C# NativeAOT Reference Server (.NET 10) / LunarCore (Java) / GaC-hkrpg-go (Go) | | Action: Instant zero-reflection packet dispatching on KCP connections | | | +----------------------------------------------------------------------------------------------------+ diff --git a/docs/scratch/firefly_static_parser_deep_dive.md b/docs/scratch/static_pe_metadata_parser.md similarity index 99% rename from docs/scratch/firefly_static_parser_deep_dive.md rename to docs/scratch/static_pe_metadata_parser.md index 936255a..af2d8cc 100644 --- a/docs/scratch/firefly_static_parser_deep_dive.md +++ b/docs/scratch/static_pe_metadata_parser.md @@ -336,7 +336,7 @@ In the Star Rail reverse-engineering toolchain: 1. `Firefly-Static-Parser` extracts the exact class structures and obfuscated field names (e.g., `KOIAJFFGPGF` $\rightarrow$ Wire tag `1` at offset `0x180`). 2. Engineers cross-reference these offsets with network serialization routines. 3. The resulting proto definitions with wire masks (`[get: (id ^ 1) + 2]`) and metadata (`meta uint32 cmd_id = 143;`) are compiled using **`FireflyProtoc`**. -4. The generated high-performance C# or Go models are directly consumed by **`March7thHoney`** or **`GaC-hkrpg-go`**. +4. The generated high-performance C# or Go models are directly consumed by **`C# NativeAOT Reference Server`** or **`GaC-hkrpg-go`**. ### 8.2 Compliance with Repository Rules (`AGENTS.md`) - `Firefly-Static-Parser` operates purely as an offline analysis tool.