fix: improve endgame clock and gameplay stability

This commit is contained in:
CAtlas0784 committed 2026-11-04 15:59:48 +07:00
1 parent ce6aabfc55
commit 658298ee86
46 files changed
+1915 -99

No files matched your search

+24 -1
View File
@@ -42,8 +42,21 @@ func loadHotfix() map[string]VersionConfig {
if raw, err := os.ReadFile("hotfix.json"); err == nil {
_ = json.Unmarshal(raw, &out)
}
if out == nil {
out = map[string]VersionConfig{}
}
if raw, err := os.ReadFile("versions.json"); err == nil {
_ = json.Unmarshal(raw, &out)
var cached map[string]VersionConfig
if json.Unmarshal(raw, &cached) == nil {
for version, cfg := range cached {
// A failed fetch previously persisted an empty cache entry. It
// must not hide usable bundled metadata for the same version.
if cfg == (VersionConfig{}) && out[version] != (VersionConfig{}) {
continue
}
out[version] = cfg
}
}
}
return out
}
@@ -201,6 +214,7 @@ func queryGateway(state *appState) http.HandlerFunc {
_ = params{}
cfg := state.getOrInsertHotfix(version, seed)
Log(fmt.Sprintf("[gateway] version=%q game=%s:%d asset=%t ex_resource=%t lua=%t", version, state.runtime.PublicGameHost, state.runtime.GamePort, cfg.AssetBundleURL != "", cfg.ExResourceURL != "", cfg.LuaURL != ""))
if state.runtime.LuaOverlay.Enabled {
cfg.LuaURL = state.runtime.PublicSDKURL + luaOverlayRoute
}
@@ -305,6 +319,12 @@ func (a *appState) granterLoginReply(w http.ResponseWriter) {
})
}
// The Android SDK decodes data as BeforeVerifyEntity before continuing
// into the game. An empty object supplies its default false flags.
func beforeVerifyReply(w http.ResponseWriter) {
writeJSON(w, map[string]any{"data": map[string]any{}, "message": "OK", "retcode": 0})
}
func riskyCheckReply(w http.ResponseWriter) {
writeJSON(w, map[string]any{
"data": map[string]any{
@@ -628,6 +648,7 @@ func Listen() error {
mux.HandleFunc("/{product_name}/combo/granter/api/getConfig", func(w http.ResponseWriter, _ *http.Request) { comboGetConfigReply(w) })
mux.HandleFunc("/{product_name}/combo/granter/api/compareProtocolVersion", func(w http.ResponseWriter, _ *http.Request) { compareProtocolVersionReply(w) })
mux.HandleFunc("/{product_name}/combo/granter/login/v2/login", func(w http.ResponseWriter, _ *http.Request) { state.granterLoginReply(w) })
mux.HandleFunc("/{product_name}/combo/granter/login/beforeVerify", func(w http.ResponseWriter, _ *http.Request) { beforeVerifyReply(w) })
mux.HandleFunc("/{product_name}/mdk/agreement/api/getAgreementInfos", func(w http.ResponseWriter, _ *http.Request) { agreementInfosReply(w) })
mux.HandleFunc("/combo/box/api/config/sdk/combo", func(w http.ResponseWriter, _ *http.Request) { comboConfigReply(w) })
@@ -664,6 +685,8 @@ func Listen() error {
state.loginReply(w, r)
case strings.Contains(path, "combo/granter/login/v2/login"):
state.granterLoginReply(w)
case strings.Contains(path, "combo/granter/login/beforeVerify"):
beforeVerifyReply(w)
case strings.Contains(path, "mdk/shield/api/loadConfig"):
shieldLoadConfigReply(w)
case strings.Contains(path, "combo/granter/api/getConfig"):