Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripts for long strings in text_misc.yml #290

Open
Px-Ch opened this issue Mar 15, 2024 · 3 comments
Open

Scripts for long strings in text_misc.yml #290

Px-Ch opened this issue Mar 15, 2024 · 3 comments

Comments

@Px-Ch
Copy link

Px-Ch commented Mar 15, 2024

Hey, I'm kind of new to CoilSnake, so I wanted to ask about text_misc.yml
I'm translating the game into my language, and I've encountered a problem that my text-speed-selection strings are too long so the compilation crashes. On this page I've read that we can create additional scripts that replace pointers for particular strings. In the list of scripts, only Bash and Row Front are available.

So how can I make such scripts for Text Speed Fast, Text Speed Medium, and Text Speed Slow? And I think I'll have to do some more in the future, so generally: How can I find pointers and make additional scripts for such strings by myself?

@Px-Ch Px-Ch changed the title Scripts with pointers in text_misc.yml Scripts for long strings in text_misc.yml Mar 15, 2024
@Vittorioux
Copy link
Contributor

Vittorioux commented Mar 15, 2024

Hmm that wiki page doesn't look entirely accurate (for some of the misc text at least), just repointing won't be enough in this case. That being said, this script should increase the max. length of the text speed options up to 15 characters + a null byte ([00]).

import asm65816

// Repoint to new text.
ROM[0xC1EF7E] = ASMLoadAddress06(text_speed_text)
ROM[0xC1F3E4] = ASMLoadAddress06(text_speed_text)

// Change maximum length of new strings.
ROM[0xC1F421] = LDA_i(16)	// Length.
ROM[0xC1F450] = LDA_i(32)	// Length x 2.

// Make this thing multiply by 16 instead of 7.
ROM[0xC1EF92] = {ASL NOP ASL ASL NOP}

///////////////////////////////////////////////////////

// Text of length 16, fill the rest with [00] (total amount of bytes should add up to 16).
text_speed_text:
	"Random text[00][00][00][00][00]"
	"More random[00][00][00][00][00]"
	"Another speed[00][00][00]"

In general, there isn't a single way to change the max. length of these specific strings, as the game itself handles them in some different ways.

@Px-Ch
Copy link
Author

Px-Ch commented Mar 16, 2024

It works! Thank you!
I think in this case I'll have to ask for some more of these scripts. So I'll keep it opened for a while.

@Px-Ch
Copy link
Author

Px-Ch commented Mar 22, 2024

Here is the solution I used in my translation to move and expand some original texts in the file menu (thanks to Vittorioux's help and ShadowOne333's works):

import asm65816
import jsl_rts

////////////////OFFSETS////////////////

// Saveslot offsets:
ROM[0xC1EEB6] = LDA_i(8)	// "Level:". Originally 9.
ROM[0xC1EF19] = LDA_i(13)	// (level number). Originally 13.
ROM[0xC1EFAC] = LDA_i(15)	// "Text speed:". Originally 16.

// Save interaction offsets:
ROM[0xC1F0DC] = LDX_i (8)	// "Copy". Originally 6
ROM[0xC1F117] = LDX_i (13)	// "Delete". Originally 10
ROM[0xC1F135] = LDX_i (19)	// "Set Up". Originally 15

// Delete window:
ROM[0xC1F31F] = LDA_i(8)    // Offset for "Level:". Originally 8.
ROM[0xC1F339] = LDA_i(13)   // Offset for the level number. Originally 12.


////////////////LENGTHS////////////////

// "Level:"
ROM[0xC1EE9B] = ASMLoadAddress12 (Level) // Savestate window
ROM[0xC1F326] = ASMLoadAddress0E (Level) // Delete window

ROM[0xC1EEA5] = LDA_i(8) // "Level:" lenght. (Savestate window)
ROM[0xC1F330] = LDA_i(8) // "Level:" lenght. (Delete window)
ROM[0xC1EEAE] = STZ_a(0x9CA7) // Clear tempTextBuffer[8] (0x9CF9 + new length).

Level:
"[85][29][27][9A][9D][26][3A]:"

// Max length for the 3 text-speed words.
ROM[0xC1EFA2] = LDA_i(15)

// This changes the max length for the "Copy to where?" text.
ROM[0xC1F193] = { JSL(copy_to_where_repoint) BRA(0) }	// Repoints "Copy to where?" text.
ROM[0xC1F212] = { JSL(copy_to_where_repoint) BRA(0) }	// Repoints "Copy to where?" text.

copy_to_where_repoint:
    ASMLoadAddress0E(copy_to_where_text)
    LDA_i(16)	// New length here
    JSL_RTS_C1(0xC10EFC)
    RTL

copy_to_where_text:
    "[7C][27][28][21][29][27][9A][98][30][3A] [23][31][9C][98]?"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants