8.6 KiB
8.6 KiB
บันทึกความจำ 2026-10-16: แก้ไขปัญหา Calyx (ดอกไม้) เข้าต่อสู้ไม่ได้ / Network Flood Loop / REST API Gateway สำหรับ GaC-Srtool
1. REST API Gateway (port 21000)
- นำหน้าเว็บ HTML Dashboard ภายในออกตามความต้องการของผู้ใช้ เพื่อเตรียมรองรับ GaC-Srtool ภายนอก
- สร้าง REST API Gateway (
internal/sdkserver/api.go) พร้อม CORS Header:GET /และGET /dashboard: ดูรายการ API ทั้งหมดGET, POST /api/freesr: อ่าน/เขียนfreesr-data.jsonทั้งหมดGET, POST /api/freesr/avatars: จัดการเลเวล, ปลดดาว, รีลิกส์, Ex-RankGET, POST /api/persistent: อ่าน/เขียนไฟล์ persistentPOST /api/exrank/toggle: เปิด/ปิด Ex-Rank รายตัวหรือทุกตัวPOST /api/avatar/rank: ปรับ Eidolon (0-6)POST /api/avatar/max_all: แม็กซ์ตัวละครทุกตัวPOST /api/teleport: วาปตำแหน่ง/ฉากGET /api/status: สรุปสถานะเซิร์ฟเวอร์, จำนวนตัวละคร, ทีมปัจจุบัน
2. แก้ปัญหา Calyx (ดอกไม้) เข้าไม่ได้ และ Network Flood Loop
- สาเหตุที่ 1 (Network Flood Loop & Battle Reset):
- ใน
handlers_scene.goที่ฟังก์ชันSceneEntityMoveมีการเรียกplayer.SavePersistent()ทุกเฟรมที่มีการเคลื่อนที่ของผู้เล่น - ใน
gateway.goฟังก์ชันwatchFreesrDataเฝ้าดูการเปลี่ยนแปลงของไฟล์persistentทุก 1 วินาที - เมื่อผู้เล่นขยับ
persistentถูกเขียนซ้ำตลอดเวลา ทำให้watchFreesrDataสั่งsession.SyncPlayer()ทุกวินาที SyncPlayer()ยิงแพ็กเก็ตPlayerSyncScNotifyขนาดกว่า 60KB (ประกอบด้วยDelRelicList,DelEquipmentList,AvatarSync) ล้างไอเทมและรีเซ็ตตัวละครกลับมาเป็นสถานะ Overworld ขัดจังหวะการโหลดเข้าสู่การต่อสู้ Calyx
- ใน
- สาเหตุที่ 2 (NullReferenceException ใน
GetCurBattleInfo):- ใน
handlers_battle.goฟังก์ชันGetCurBattleInfoมีโค้ด fallback ปลอมที่สร้าง battleInfo ส่งกลับด้วย retcode 0 แม้ไม่ได้อยู่ในการต่อสู้ - ทำให้ Client เมื่อเรียก
GetCurBattleInfoCsReqเกิด crash NRE ในAdventureModule._OnGetCurBattleInfoScRsp(RVA0xceb7e65) เนื่องจาก Battle Module ภายในยังไม่ถูก initialize
- ใน
- สาเหตุที่ 3 (การตัดและบิดเบือน MonsterWaveList ใน Calyx):
- ใน
StartCocoonStageและStartQuickCocoonStageมีการบังคับตัดเวฟMonsterWaveList[:1]และเซ็ตw.WaveId = 1ให้กับทุกเวฟ ทำให้โครงสร้างเวฟของ Client เสียหาย
- ใน
- การแก้ไข:
- แก้
gateway.go: ให้watchFreesrDataเฝ้าดูเฉพาะfreesr-data.jsonเท่านั้น (ไม่ดูpersistent) เหมือนโครงสร้างต้นฉบับ - แก้
handlers_scene.go: นำplayer.SavePersistent()ออกจากSceneEntityMoveเพื่อหยุดการเขียนดิสก์และลูป Network flood โดยสิ้นเชิง - แก้
handlers_battle.go:- ใน
GetCurBattleInfoตัด fallback ปลอมออก หากไม่มี Token ในCURRENT_BATTLEให้ตอบRET_BATTLE_STAGE_NOT_MATCH(2000) ป้องกัน NRE - ใน
StartCocoonStageและStartQuickCocoonStageส่งbattleInfoที่สมบูรณ์พร้อมเวฟที่ถูกต้อง และเพิ่ม Log แสดงค่าCocoonId,Wave,WorldLevel
- ใน
- คอมไพล์
gameserver-go.exeใหม่และรีสตาร์ทกระบวนการ
- แก้
Codex battle investigation correction — main affix (2026-10-16)
- Client stack RVA 0xc4eb77c is the return address after the throw call at 0xc4eb777, reached when main-affix lookup returns null (branch at 0xc4eb2b3). It does NOT prove a null sub-affix array; that throw call would return to 0xc4eb781. Earlier interpretation is withdrawn.
- Captured Calyx/SceneCastSkill payload and inventory UID 483: avatar 1213, relic 63095, main_affix_id 11. Reference relic main group 55 contains IDs 1–10, with 10=ImaginaryAddedRatio. Local AvatarConfig confirms Imaginary for 1213.
- Repaired only this inventory field in freesr-data.json: 11 -> 10. No converter ID override. All 24 relic main affixes in the captured team validate against reference data. Reference lacks new relics 63295/63296, so whole inventory is not fully validated.
- Source: Mar-7th/StarRailRes commit dbe8cdfcfb0bf657b9fe1cf92d5537f118ccb487, index_new/en/relics.json and relic_main_affixes.json.
- Backup: ignored battle_diagnostics/main-affix-repair/. Build completed; root gameserver-go.exe/sdkserver-go.exe updated. In-game battle success still requires a new client run.
- First readback probe reported parser property not found. V2 includes non-public fields and CodedInputStream fallback, but local diagnostic probe is disabled for the repair verification. V2 is not yet verified in client.
Handler/dispatch update against PearlSR 4.6.53 reference
- Synced 2,690 current command names/IDs from upstream revision 005d2c12db4781071f4b5b68e8f364587886a710; generated table preserves verified old Go type aliases and fails on conflicts.
- Source audit: all 865 existing request/response pairs and 4,435 shared message field-number sets match. This does not validate all field types/defaults or client behavior. Include oneof members (including enum-valued wrappers) when auditing; ignoring oneof produces false missing-field reports.
- Replaced numeric raw registrations/old alias ranges with current named bindings. Removed multi-response guesses. Added missing typed Tierce lineup request8992/response8979, fields4/5; fixed cumulative reward request1747/response1748, group10 -> group12/retcode9.
- Current schema statistics fields1/3/11 are a oneof; do not claim they are absent. Updated Go schema to oneof; statistics handler now echoes group without fabricated past scores, matching upstream.
- Added ReplaceLineupScRsp field14; regenerated protobuf. Peak start/leave bindings restored; empty current Peak response no longer fabricates PeakID1. Challenge leave uses saved overworld scene rather than fixed destination.
- Tutorial handlers load IDs from installed TutorialData/TutorialGuideGroup resources, removing the embedded old list. Removed unused generated activity list.
- ClientDownloadData version51 remains because current upstream still uses51 for Lua payloads; do not infer53 from client patch. Avatar command400 response pairing remains semantically obfuscated; current adjacent schema response is used instead of spraying5 candidates, still requires client verification.
- Added reproducible offline source sync/audit tools and docs/protocol-update.md; README/AGENTS updated. Final run.bat build completed, both root executables updated at22:16 local time. No in-game success claimed; no test suite run in this turn.
Launcher visibility preference
- User explicitly requested visible SDK/game server consoles and launcher menu closure after5 seconds.
- run.ps1 now launches both root server executables with WindowStyle Normal and no stdout/stderr redirection; each server console remains independent when run.bat exits.
- Interactive menu waits5 seconds after the selected action finishes, preserving exit codes. Argument-based build/check/stop returns immediately. README/AGENTS updated. No binary rebuild needed for this script-only change; did not launch or stop running servers.