Well, I found which memory address is used for indexing which dialogue line is spoken by AI players.
Unfortunately, because I didn't finish tagging things in my disassembly, I can't cross-reference where the breakpoint I set fired with it, because that section of code is untagged...
I guess I know what I'll be doing today.
Oh wow, this is neat.
So, when choosing AI characters you can play against, there are actually two different lines that can appear! I didn't notice that there were multiple lines until I was reading through what @WTCGames@twitter.com had translated so far.
If you choose most characters, you get the first line ("Player # will be ____, right?")... but if you choose Konomi, you get the second ("I'll join as player #, alright?")
I guess Konomi really does host the whole game!
When IS2 draws a dialogue box on screen, it uses a particular 3-byte memory address for loading the window parameters from; and since all window parameters are in the same bank, it never updates the bank byte in that address.
I've moved all my custom code out into a new bank, though, including window parameters, so I have a hack in place that saves, replaces, and restores that bank byte when it loads custom text...
Except... the continue arrow also references those parameters, but the bank has already been restored when it tries drawing it, so it's using incorrect/invalid data when determining where it should draw that arrow.
I'll probably just have to find the continue arrow code and hook it somehow, just like my custom text code...
Okay there is no way I'm doing this by hand. My wrists already hate me x.x
I'll ask @Xkeeper if they could do it for me instead with a PHP script or something...
Oh, bleh. A realization about character dialogue hit me...
There is a function used during character dialogue in-game that copies data from a temporary buffer into a particular location, which is read later when drawing character dialogue on-screen. This function only copies 64 bytes of data. (There might only even be 64 bytes of free space available in this location; I don't know for sure.)
I've already fixed one of those bugs (extra spaces in names), which was caused because I didn't bugtest my code when I originally wrote my variable-width font code, and a register got clobbered. ^^;;;
The dialog boxes that I didn't recognize are actually character-specific dialogue that is in a different format from what the game expects there, so that's why they are completely broken. I'll look for those code references later, I guess...
And that flashy, glitch mess at the end... is probably caused by a bank value being wrong, and incorrectly-formatted, unterminated text being drawn, which overflows the tilemap into other parts of RAM, and eventually consumes the entire game...
I don't know exactly how I'll tackle that yet. .-.;;; It's part of a few lines that required extra work, so I left them out when formatting the rest of the menu text...
Well, I fixed what caused everything to break yesterday, and ran into a different, very annoying and also very strange bug:
When playing any game with an AI opponent, after that AI player says anything, the game clears completely wrong memory addresses when removing their dialogue box. This causes all sorts of problems, like corrupt tiles overwriting the map, the HUD disappearing, or the game soft-locking after displaying that dialogue box...
Nothing I added recently directly caused this; it is either a byproduct of something I added in my very first patcher build, or something related to how my patcher itself builds everything into the ROM.
My hand-patched build from months ago doesn't exhibit this bug, so I have no idea what is wrong...
Oh no... I isolated what is wrong here, and I am not happy at all...
It's another instance of this game always expecting its text to be in a very specific bank. It never, ever updates what bank it searches for dialog boxes in, only what address within that bank is being currently used.
That causes problems like this, where another function is looking for where it should draw (or, in this case, clear) a dialog box, but it runs off into who-knows-where and trashes memory...
Awesome, rewriting everything that touched SearchDialogDefinitionForA fixed the corruption bug that was crashing games when AI characters said anything! ^w^
... aaaand I immediately found another corruption bug in a dialog window I didn't touch yet. >.<;;;
I don't even know how Konomi's face got corrupted...
"Hmm, why is the vowel extender mark so short in this dialog box? Is there some bug with my text drawing code...?"
...
"wait a second... that's... not a chōonpu... that's a hyphen..."
While translating venture card-related text, I found a debugging feature left in the game ^w^
https://tcrf.net/Itadaki_Street_2:_Neon_Sign_wa_Bara_Iro_ni#Debug_Venture_Card_Function
Another Ita2 tidbit:
There's a bit of unreferenced text near one routine that handles venture cards #61 and #62, which give stock dividends of 10%/20% normally. At first glance, though, this text seems like it would just print garbage tiles on screen...
It turns out this extra text is old enough that it expects a lowercase English font, which isn't in the final game anymore... and it also suggests you originally got paid a flat amount per stock share you owned instead!
In today's "why is this code making the game crash" adventures, spot the bug:
stack.push(tile_ID);
stack.push(tilemap_index);
stack.push(bank_number);
... // Run code here
stack.pull(tile_ID);
stack.pull(tilemap_index);
stack.pull(bank_number);
return;
... It's doing things in the same order! How can this code be broken...? ^^;;;;;
(I have since fixed this bug. ^.^)
I haven't gotten around to writing another Patreon post in a while, because I've been working on things that aren't finished yet... .w.;;;
I'm kind of changing my workflow for the IS2 translation a lot! and it involves rewriting a bunch of the disassembly I had so it's compatible with a different program... but hopefully it will be done soon and I can ... maybe... get working on adding new things again soon... .w.;;;
@Raspberryfloof Nice!
@Raspberryfloof That's...unfortunate? Gosh.
Out of curiosity, are the bugfixes separable from the translation?
@BatElite Some of them are, but the way I implemented others would require me to change the implementation before they could be fully separated.
For example, one of them is a bug related to an unreachable textbox, but the text in that textbox is unterminated. The way I fixed it was by replacing the textbox with a translated version, so separating that bugfix out would require going in and fixing the original text so it was properly terminated.
My data files now have these lines in them. :|