Skip to content

Instantly share code, notes, and snippets.

@ide-an
Last active March 26, 2021 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ide-an/e2f26daa0b3cfd80e5965c43bf5f176b to your computer and use it in GitHub Desktop.
Save ide-an/e2f26daa0b3cfd80e5965c43bf5f176b to your computer and use it in GitHub Desktop.
th18_desync_fix.ssg fixes th18(trial) replay desynchronization bug.

th18_desync_fix.ssg (experimental)

What's this?

東方虹龍洞 体験版で、法力経典を装備したときに発生するリプレイずれを修正するパッチです。

This is a bug fix patch for TH18 trial(Unconnected Marketeers), which corrects replay desynchronization when using byakuren's scroll(法力経典).

Usage

SpoilerALth18_desync_fix.ssg を指定してください。

Run Spoiler AL with th18_desync_fix.ssg.

Bug mechanism

TL;DR

法力経典のクールタイムの効果がリプレイ時に反映されてない。

Cool time reduction effect doesn't work in replay.

Detail

(誰か英訳して)

クールタイムの初期値は以下のように計算される。

item_specific_initial_cool_time * cool_time_ratio
  • item_specific_initial_cool_time はアイテムごとに決まっているクールタイム
  • cool_time_ratio は補正の係数。通常は1.0、法力経典を装備している場合は0.8

cool_time_ratio は変数としてアドレス0DA1CB60に保存されているが、この変数の初期化の仕方が実際のプレイ時とリプレイ再生時で異なる。

実際のプレイ時(法力経典装備)

実行順 EIP 実行後のcool_time_ratioの値
1 004389DF 1.0
2 0040AFE9 0.8

リプレイ時(法力経典装備)

実行順 EIP 実行後のcool_time_ratioの値
1 004389DF 1.0
2 0040AFE9 0.8
3 00408436 1.0

リプレイ時には00408436の命令が実行された結果、法力経典によるcool_time_ratioの変更が戻されている。 これによりクールタイムが変わってしまう。

Patch Mechanism

th18_desync_fix.ssg では 00408436 でのcool_time_ratioの上書きをスキップすることでリプレイずれを修正している。

th18_desync_fix.ssg fixes replay desynchronization, skipping instruction at 00408436 to avoid cool_time_ratio overwrite.

SSG for SpoilerAL ver 6.0
[script]
[title]th18.exe(Trial)
[creator]ide_an
[maker]Team Shanghai Alice
[process]th18.exe
[note]wordwrap
This patch fixes replay desync with Byakuren's scroll on th18 trial
[/note]
[involve]th18tr
[group]Main
[subject]ver 0.02a:dir
[subject]bugfix/ON/_:b_toggle,0,th18tr->desyncfix,real
[back]
[/group]
[group]desyncfix
0x00408436, 90909090909090909090, c783580c00000000803f
[/group]
[/involve]
[replace]0,th18tr->Main
[/script]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment