Format reference/end06: Difference between revisions

From Touhou Patch Center
Jump to navigation Jump to search
(Added unused opcodes @0 and @1.)
(Update the link to decompiler)
Line 90: Line 90:


* <sup>1</sup> The static English patch for {{GameLabel|th08}} by NDT seems to have an extra null after most instructions. For compatibility with that patch, ignore any extra arguments.
* <sup>1</sup> The static English patch for {{GameLabel|th08}} by NDT seems to have an extra null after most instructions. For compatibility with that patch, ignore any extra arguments.
* <sup>2</sup> as used by [[User:Egor|Egor]]'s [https://opensrc.club/projects/end6/ decompiler]
* <sup>2</sup> as used by [[User:Egor|Egor]]'s [https://www.thpatch.net/end6/index.html decompiler]
* <sup>3</sup> in {{GameLabel|th09}} this is actually a single byte. 0x10 is [[Th09/Music#No._18_.E8.8A.B1.E3.81.AF.E5.B9.BB.E6.83.B3.E3.81.AE.E3.81.BE.E3.81.BE.E3.81.AB|ending theme]], 0x11 is [[Th09/Music#No._19_.E9.AD.82.E3.81.AE.E8.8A.B1.E3.80.80.EF.BD.9E_Another_Dream...|staff roll theme]].
* <sup>3</sup> in {{GameLabel|th09}} this is actually a single byte. 0x10 is [[Th09/Music#No._18_.E8.8A.B1.E3.81.AF.E5.B9.BB.E6.83.B3.E3.81.AE.E3.81.BE.E3.81.BE.E3.81.AB|ending theme]], 0x11 is [[Th09/Music#No._19_.E9.AD.82.E3.81.AE.E8.8A.B1.E3.80.80.EF.BD.9E_Another_Dream...|staff roll theme]].
==Limitations==
==Limitations==

Revision as of 13:02, 1 September 2019

This is the ending script format for Touhou 06-09 (Icon th06.png Embodiment of Scarlet Devil, Icon th07.png Perfect Cherry Blossom, Icon th08.png Imperishable Night and Icon th09.png Phantasmagoria of Flower View).

Opcodes

As this is a text-based format, all parameters are given as ASCII strings. Each parameter is terminated with a null byte, each instruction with a line break1.

Opcode Mnemonic2 Parameter 1 Parameter 2 Parameter 3 Description
(empty) display String (N/a) (N/a) Display a line of text.
@0 (N/a) Frames (N/a) (N/a) Unused
@1 (N/a) Frames (N/a) (N/a) Unused
@2 fadein Frames (N/a) (N/a) Displays a white quad on top of the screen and fade it out in the given time.
@3 fadeout Frames (N/a) (N/a) Fades the screen to white.
@a anm ??? Script index? Sprite index? Execute anm script
@b background .jpg file (N/a) (N/a) Displays the given file as background.
@c color Color in 24-bit decimal BGR format.

e.g. #9370d8 → d87093 → 14184595

(N/a) (N/a) Changes the text color.
@F exec .end file (N/a) (N/a) Executes the ending script in the given file. This file is re-loaded from the archive.
@M musicfade Fade-out duration in seconds (N/a) (N/a) Fades out BGM.

Passing 0 will stop playback immediately - active MIDI notes are not stopped in this case.

@m musicplay .mid file3 (N/a) (N/a) Loads the given BGM and restarts playback.
@R staffroll Empty string? (N/a) (N/a) Unknown. Usually present at the beggining of staff .end files
@r waitreset Maximum frames Minimum frames (N/a) Same as @w, but resets text display after wait.
@s setdelay Frames to wait after displaying line 2 and beyond Frames to wait after displaying the top line (N/a) Set line delays.

When holding the Skip key, parameter 1 is applied for every line.

@V scrollbg Distance in pixels Duration in frames (N/a) Scrolls background up (i.e. the image moves downward)
@v setscroll Vertical coordinate of the new top border of the image (N/a) (N/a) Sets the background vertical scroll position
@w wait Maximum frames Minimum frames (N/a) Waits for input and pauses script execution.

Parameter 2 is ignored if larger than parameter 1.

@z end (N/a) (N/a) (N/a) Ends script execution. Not calling this at the end will cause the game to crash!

Limitations

  • Text lines are limited to 64 bytes.
    • Icon th06.png th06: Like all longer text in this game, these are split on the 32th byte and rendered as a left and right half.
  • A maximum of 6 lines can be displayed at once. Everything after that will be invisible, and the 10th line crashes the game.

Patching approach

Firstly, I'd really like to have the layout engine done before doing this. Aligning text and character names with full-width spaces is silly.
Also, EoSD requires its separate beautification treatment.

Each contiguous block of text, delimited by @c, @w or @r, counts as one translation unit/template. Then, we simply replace the entire block with the new translated text.

Line count doesn't matter at all - it's highly unlikely to crash the game, and there's always one additional line available. Empty lines do matter, though.