News:

11 March 2016 - Forum Rules

Main Menu

Dragon Quest Delocalized Projects

Started by Chicken Knife, September 02, 2018, 04:17:10 PM

Previous topic - Next topic

abw

Yup, it's a really silly reason :banghead:. How about this - try adding the breakpoint from the Debugger window instead of the Hex Editor. Just Debug -> Debugger -> Add -> Address = 801C, Read, CPU Mem -> OK, nothing fancy.

I sort of mentioned this earlier, but if you look closely at the context menu when you add a breakpoint through the Hex Editor, it says "Add Read Breakpoint for Address 00:801C", which means the breakpoint only fires when the CPU reads RAM $801C while RAM $801C comes from ROM bank 00. If you check the list of breakpoints in the Debugger window, you'll see it says "$801C:ECR--- Conditi" instead of just "$801C:ECR---", and if you select that breakpoint and edit it, you'll see the Condition text box has a "T==#00". The address you want the breakpoint to fire on, however, is 02:801C, not 00:801C, so that's why you're not getting the same experience as me.

Unless you know beforehand which bank you want a breakpoint for or you're getting a lot of hits for the wrong bank(s), it's usually easier to add breakpoints through the Debugger window without any conditions.

Chicken Knife

#141
@abw

Looks like that clarified the issue, thank you. I've been working on following the logic of your original post where you marked all the steps as spoilers. In order to do that I think I need to better understand the logic of 6502 Assembly. The good news is I finally found a web site that teaches in the way that I learn. It breaks each lesson down into exercises that you actually do within the browser. Quite brilliant. Here's the link if anyone is interested. https://skilldrick.github.io/easy6502/. 2 more quick points. Your step about inserting the correct string address--I don't actually know how to determine a specific string address since the Atlas script lumps them into groups. I think there are 20 total. How do you pinpoint the address of one specific string? Something we never discussed. Final point: putting all the information in spoiler boxes was a great idea but it makes it really hard to read, especially when you have to scroll through the debugger data. The fact is, I'm pretty motivated to understand the logic of the step by step at this point so I don't think it's necessary to list everything as spoilers.

@ Everyone

Updated versions of DQ 1 and 2 Delocalized are now live with the new spell names! For those familiar with the style of the Japanese names, I think you will see a lot of similarity. The majority of these are not words we just came up with but actual translations of the Japanese spell  names with the addition of suffixes that are generally in the same style. There are rare cases like Ionazun where the Japanese name was already based on an English word (Ion) and we left it as is. There are times we offer a little more meaning than the Japanese versions do. We thought this time around we should err on the side of more meaning versus less.

For DQ1:

Heali           (Heal)
Flaro           (Hurt)
Slumbari        (Sleep)
Luminara        (Radiant)
Stopmaju        (Stopspell)
Vacatara        (Outside)
Flyrura         (Return)
Abatetoil       (Repel)
Helimi          (Healmore)
Flarama         (Hurtmore)

For DQ2

Heali           (Heal)
Helimi          (Healmore)
Heloma          (Healall)
Curii           (Antidote)
Vivariku        (Revive)
Flaro           (Firebal)
Flarama         (Firebane)
Aeru            (Infernos)
Ionazun         (Explodet)
Exaraki         (Defeat)
Sacrizaku       (Sacrifice)
Slumbari        (Sleep)
Stopmaju        (Stopspell)
Phantasma       (Surround)
Softama         (Defense)
Cosmicaos       (Chance)
Fortiruto       (Increase)
Flyrura         (Return)
Vacatara        (Outside)
Trapelude       (Stepguard)
Abatetoil       (Repel)
Bustiero        (Open)

AdamDravian

Quote from: Chicken Knife on March 03, 2019, 09:37:59 AM
@ Everyone

Updated versions of DQ 1 and 2 Delocalized are now live with the new spell names! For those familiar with the style of the Japanese names, I think you will see a lot of similarity. The majority of these are not words we just came up with but actual translations of the Japanese spell  names with the addition of suffixes that are generally in the same style. There are rare cases like Ionazun where the Japanese name was already based on an English word (Ion) and we left it as is. There are times we offer a little more meaning than the Japanese versions do. We thought this time around we should err on the side of more meaning versus less.

For DQ1:

Heali           (Heal)
Flaro           (Hurt)
Slumbari        (Sleep)
Luminara        (Radiant)
Stopmaju        (Stopspell)
Vacatara        (Outside)
Flyrura         (Return)
Abatetoil       (Repel)
Helimi          (Healmore)
Flarama         (Hurtmore)

For DQ2

Heali           (Heal)
Helimi          (Healmore)
Heloma          (Healall)
Curii           (Antidote)
Vivariku        (Revive)
Flaro           (Firebal)
Flarama         (Firebane)
Aeru            (Infernos)
Ionazun         (Explodet)
Exaraki         (Defeat)
Sacrizaku       (Sacrifice)
Slumbari        (Sleep)
Stopmaju        (Stopspell)
Phantasma       (Surround)
Softama         (Defense)
Cosmicaos       (Chance)
Fortiruto       (Increase)
Flyrura         (Return)
Vacatara        (Outside)
Trapelude       (Stepguard)
Abatetoil       (Repel)
Bustiero        (Open)

I think you handled the spell names perfectly. They're not all immediately obvious, but they provide enough of a context clue that the player should be able to quickly learn them through play (and an occasional reference to the manual)--just as the original Japanese players had to do. Excellent job.
Writer of the '80s-themed webcomic Satan Ninja 198X

Chicken Knife

Quote from: AdamDravian on March 03, 2019, 10:58:58 AM
I think you handled the spell names perfectly. They're not all immediately obvious, but they provide enough of a context clue that the player should be able to quickly learn them through play (and an occasional reference to the manual)--just as the original Japanese players had to do. Excellent job.
Thank you for the kind words! Glad you appreciate what we are going for.

abw

Quote from: Chicken Knife on March 03, 2019, 09:37:59 AM
Looks like that clarified the issue, thank you.
Huzzah!

Quote from: Chicken Knife on March 03, 2019, 09:37:59 AM
Your step about inserting the correct string address--I don't actually know how to determine a specific string address since the Atlas script lumps them into groups. I think there are 20 total. How do you pinpoint the address of one specific string? Something we never discussed.
I actually said string index (e.g. 0, 1, 2, ...), not string address (e.g. $8000, $8001, $8002, ...). The game mostly doesn't care what the string's address is, it just takes the string index, divides by 16 (a.k.a. LSR x 4) to get the pointer index, then looks that pointer up in the pointer table, follows the pointer to a group of strings, and then starts counting end tokens inside the group of strings until it finds the right string. For instance, that "Unfortunately, it is empty." string is the 218th (DA-th) string in the game (counting from 0), or the 10th string inside the 13th group of strings (still counting from 0). If you like counting from 1 instead, it's the 219th string or the 11th string inside the 14th group.

Anyway, basically all we're doing with the trace log is following the flow of data in reverse, starting from where it gets used and going all the way backwards until we find out where in the ROM it came from. Much of the time you can just search the trace log for specific addresses (e.g. searching for the text "$801C", then "$0031", etc.), but you will need to know at least enough ASM to recognize when the game is manipulating data you care about in ways that don't show up as addresses, like in the first snippet of code:

                $FCF1:A5 31     LDA $0031 = #$0E                             A:00 X:9F Y:02 S:EF P:nvUBdIZc
                $FCF3:0A        ASL                                          A:0E X:9F Y:02 S:EF P:nvUBdIzc
                $FCF4:AA        TAX                                          A:1C X:9F Y:02 S:EF P:nvUBdIzc
                $FCF5:BD 00 80  LDA $8000,X @ $801C = #$2E                   A:1C X:1C Y:02 S:EF P:nvUBdIzc

For that, you need to know that the game loading $801C depends on the value of X (via LDA $8000,X), that X got its value from A (via TAX), that A had its value multiplied by 2 (via ASL), and then that the value of A came from $0031.

Chicken Knife

#145
Hello folks! It's been quiet on here for a bit but have no doubt that nejimakipiyo and I have been keeping ourselves busy.

I just posted a comprehensive update to the Dragon Quest II Delocalized patch that is now in que for approval, version 1.07. It includes a few different components.

1st, we decided that the scrolling prologue text and the dialogue during the fall of Moonbrooke needed to be totally rewritten. I originally took only the lightest approach to this text because because none of it was in the original Japanese game. Changes were mostly limited to removing the medieval wordings. Over time I began feeling like the writing style did not match up with what we achieved in the rest of the game based on Horii's writing style. The most significant examples include lines like "Oh, such a brave beauty" the Monster mocked her. And the following: The King was enraged: "Touch her and thou shall not survive this day!" He challenged the fiend. Nejimakipiyo and I decided to look at the Japanese SFC text as a base and found that it fit the tone and style of the rest of the game much better. I will admit there were some challenges in using this text as a base because of elements that play out differently in both versions. For instance, the SFC version does not have the invading monsters speak at all. Frankly, this is preferable as monsters hardly ever speak in the game beyond "kekekeke." When the English game required some dialogue from monsters, we chose to use exactly that--"kekekeke" and I believe it is a significant improvement. We are also very happy to have gotten rid of all that third person text like "And then the king spoke to the princess" etc. Now each shift in speaker is denoted by their name and a colon preceding the text, as is standard in these kinds of games.

It also recently came to our attention that there were text bugs in the equip menu which go back to the original English DW2. Instead of SHIELD, the equip menu showed SHILD. Also, every screen of the equip menu would show DEFENC POWER. After working with abw on setting up an extraction / insertion of menu data through his abcde software, we were able to expand the text of SHILD into SHIELD as well as make the choice to alter DEFENC POWER into DEFEND POWER (expanding the latter would have required significant menu retooling which I don't believe should be necessary.

Beyond that, approximately 20 other text improvements were made based on closely observing a recent play through. The most significant changes were modifying our town name Lirizia to Liriza which is both better aligned to the Japanese name and makes the town sound less like one of the major surrounding castles. We also fixed a problem where the Dragon King's grandson sounded like he was indicating that the Shrine of Rubiss could be found on an island to the south. He was supposed to be telling you to start your search for crests on the island to the south. Many other small text improvements were made but those are the two most significant.

As far as DQ3, that is coming along. Nejimakipiyo is chipping away on her fresh translation of the text which I will eventually help edit and work on inserting.  In the meantime, I will be working on leveraging various resources to improve my understanding of ASM--hopefully to the point where I can eventually fix several of the minor bugs and issues that plague DW3.

abw

Aww, I actually liked the narration in the opening scene :P. I can see your point about it not fitting with the rest of the game's style, though.

Congrats on getting the menu typos fixed! Given the English-specific code changes and the quality of the rest of the translation, I'm a little surprised those slipped through the QA process.

Did you also notice the seeming discrepancy between the usage of Hibabongos in the main script ("Thy strength is that of many fearsome Hibabongos.") vs. the name and pluralization of the Hibabango enemy (One Hibabango, Two Hibabango, etc.)? Maybe they're both related to the Hibabingo... :-\

Chicken Knife

#147
@abw

Ha. Sorry to have removed something you enjoyed, and yes it did have a certain charm (but hopefully our version has some charm as well :P). Beyond the stylistic inconsistency, I also thought it wasn't the best thing to advertise a totally rewritten English script and then start the game out with text that was 90% identical to the original script. :P

I didn't actually notice that discrepancy with Hibabango's spelling and pluralization. That line from the king of Delkondar (Osterfair) got wiped out in favor of the Japanese text "I am a friend of the strong! Ha ha ha!" But as far as the sloppiness of them doing that? I'm not surprised. But I'll say one thing: after working on these projects the last several months, I find it amazing what kind of errors can slip through unnoticed no matter the level of scrutiny. It's such a privilege to be able to go back and continuously fix and improve things--a privilege never afforded to the original teams.

Also, a bit of cool trivia on on the origins of Hibabango that nejimakipiyo dug up.

https://en.wikipedia.org/wiki/Hibagon

Choppasmith

Quote from: Chicken Knife on March 30, 2019, 07:35:07 AM
Hello folks! It's been quiet on here for a bit but have no doubt that nejimakipiyo and I have been keeping ourselves busy.

I just posted a comprehensive update to the Dragon Quest II Delocalized patch that is now in que for approval, version 1.07. It includes a few different components.

1st, we decided that the scrolling prologue text and the dialogue during the fall of Moonbrooke needed to be totally rewritten. I originally took only the lightest approach to this text because because none of it was in the original Japanese game. Changes were mostly limited to removing the medieval wordings. Over time I began feeling like the writing style did not match up with what we achieved in the rest of the game based on Horii's writing style. The most significant examples include lines like "Oh, such a brave beauty" the Monster mocked her. And the following: The King was enraged: "Touch her and thou shall not survive this day!" He challenged the fiend. Nejimakipiyo and I decided to look at the Japanese SFC text as a base and found that it fit the tone and style of the rest of the game much better. I will admit there were some challenges in using this text as a base because of elements that play out differently in both versions. For instance, the SFC version does not have the invading monsters speak at all. Frankly, this is preferable as monsters hardly ever speak in the game beyond "kekekeke." When the English game required some dialogue from monsters, we chose to use exactly that--"kekekeke" and I believe it is a significant improvement. We are also very happy to have gotten rid of all that third person text like "And then the king spoke to the princess" etc. Now each shift in speaker is denoted by their name and a colon preceding the text, as is standard in these kinds of games.

It also recently came to our attention that there were text bugs in the equip menu which go back to the original English DW2. Instead of SHIELD, the equip menu showed SHILD. Also, every screen of the equip menu would show DEFENC POWER. After working with abw on setting up an extraction / insertion of menu data through his abcde software, we were able to expand the text of SHILD into SHIELD as well as make the choice to alter DEFENC POWER into DEFEND POWER (expanding the latter would have required significant menu retooling which I don't believe should be necessary.

Beyond that, approximately 20 other text improvements were made based on closely observing a recent play through. The most significant changes were modifying our town name Lirizia to Liriza which is both better aligned to the Japanese name and makes the town sound less like one of the major surrounding castles. We also fixed a problem where the Dragon King's grandson sounded like he was indicating that the Shrine of Rubiss could be found on an island to the south. He was supposed to be telling you to start your search for crests on the island to the south. Many other small text improvements were made but those are the two most significant.

As far as DQ3, that is coming along. Nejimakipiyo is chipping away on her fresh translation of the text which I will eventually help edit and work on inserting.  In the meantime, I will be working on leveraging various resources to improve my understanding of ASM--hopefully to the point where I can eventually fix several of the minor bugs and issues that plague DW3.

Yeah I had to change the narration as well. Mostly for space reasons.

Having
*: Oh, what a pretty thing
vs
'Oh, what a pretty thing' the monster mocked her.

The latter is almost double the length. I actually looked at two videos side by side. One being the NES version opening and the other being the mobile remake. Not just the monster dialog, but the sprite choreography is quite different as well, so I had to tweak the dialog a bit there. I was so torn on removing the narration in DW1, because it just looks weird next to the modern translation, but keeping it worked out so well there. I will say that having the modern Name: Dialog or *: for Unnamed characters looks quite nice in the classic font and window. I think you could save a lot of space if you converted the whole script that way but I"d love to try and keep it to make the NES version stand out on its own.

Anyway, when you're talking about having proper (name) usage. Did you guys do anything with how (name) works? As far as I can tell, it's just a line by line context. In the remakes they have separate macros for various names: Midenhall's name ($07 in the mobile version), Cannock's name ($0D), Moonbrooke's name (0E), and even one for whoever is the leader of the party (0F)

Also, I had a question. In Beran (I don't know what you named it, the city with the portal to Rhone/Rendarak) there's a Priest NPC just below the room with the locked door to said portal. In the original, they ask you the time followed by a yes or no prompt. What was it originally? What did you go with? In the remake said NPC just says something along the lines of: That Hargon is an abomination who will be struck down by the Goddess! with no prompt. I know the town where you get the ship there's an NPC in the original who says "I have nothing to say to thee. (separate line) Nope nothing at all." The same NPC in the remake says "Begone! I prefer the company of women! ( separate line for when Moonbrooke is in the party) Oh hello there, why don't you join me for a drink my pretty *hic*" I can only imagine the original line was meant to be like the remake and I'm curious what that other line was. I figured it's probably something a little more risqué that had to be censored?

Chicken Knife

#149
Quote from: Choppasmith on March 31, 2019, 06:28:32 PM
Anyway, when you're talking about having proper (name) usage. Did you guys do anything with how (name) works? As far as I can tell, it's just a line by line context. In the remakes they have separate macros for various names: Midenhall's name ($07 in the mobile version), Cannock's name ($0D), Moonbrooke's name (0E), and even one for whoever is the leader of the party (0F)
My understanding of (name) is that it is something controlled by the code as it applies to each individual piece of dialogue. Therefore I couldn't think of any way to produce use of a character specific name where it did not exist previously. I think we are both thinking of the same text where the king of Moonbrooke calls his daughter by name in the remakes during that intro scene. I would have loved to incorporate that as it sounds more affectionate plus offers the bonus of showing the player what her name is going to be right off the bat. Knowing abw, I predict that he is going to offer a way to retool the game to allow us to manipulate this, but I also predict that the complexity of that would be quite prohibitive.  :laugh:

QuoteAlso, I had a question. In Beran (I don't know what you named it, the city with the portal to Rhone/Rendarak) there's a Priest NPC just below the room with the locked door to said portal. In the original, they ask you the time followed by a yes or no prompt. What was it originally? What did you go with? In the remake said NPC just says something along the lines of: That Hargon is an abomination who will be struck down by the Goddess! with no prompt. I know the town where you get the ship there's an NPC in the original who says "I have nothing to say to thee. (separate line) Nope nothing at all." The same NPC in the remake says "Begone! I prefer the company of women! ( separate line for when Moonbrooke is in the party) Oh hello there, why don't you join me for a drink my pretty *hic*" I can only imagine the original line was meant to be like the remake and I'm curious what that other line was. I figured it's probably something a little more risqué that had to be censored?
Yes, I know exactly which character you are refering to in "Beranoor." This was censored in the original and also censored in the remakes it seems. I actually have his text as one of the photos I posted on the publish page for the hack. He asks you if you believe in God. If you say no, he complains about it and blames the issue on Hargon. If you answer in the affirmative, he says: I thank you very much indeed! In Rupugana / Lianport, the man you are referring to said the following in the Japanese and therefore our version:  ']You two guys can get lost[.'] and [wait][ ']Hey, missy with the nice behind.[wait]Why don[' -67]t you come have a drink with me at the bar? Hic[.'] I think this text is dependant on whether or not she is alive, just like the censored puff puff text in the same town. Speaking of, was that uncensored in the remake? Was there a hint for it? I had to add one. Couldn't have players pass that by.

Good catch with those censored bits. There are a couple others like a guy who is pissing in the bushes and yells at you for catching him in the act. I think that's in Liriza / Leftwynn. I'm curious how the remake handled the text in the undersea cave. In the original they are clearly priests in Hargon's order who are in the midst of offering prayers to Shido/Malroth. The original changed the scenerio to some silly business about a wizard's house.

If you want a copy of my atlas file so you can reference our directly translated text, I'm happy to send it.

Choppasmith

#150
Quote from: Chicken Knife on March 31, 2019, 06:56:43 PM
Yes, I know exactly which character you are refering to in "Beranoor." This was censored in the original and also censored in the remakes it seems. I actually have his text as one of the photos I posted on the publish page for the hack. He asks you if you believe in God. If you say no, he complains about it and blames the issue on Hargon. If you answer in the affirmative, he says: I thank you very much indeed!

Huh, that's interesting, I don't know why they couldn't just swap God for Goddess, it would still work unless they felt the whole sense of belief struck a little close to home. But then, the remake ADDS several Yes/No prompts to NPCs as well. Like one in the Wind Tower (?) in the original he just warns you to not go over the edge, in the remake he warns you and then asks you if you'll follow his advice (and scolds you if you say No). There's also an NPC in Leftwynne in the original who says she heard the Prince of Midenhall is on a quest to defeat Hargon with a "Oh you say you're the Prince?" In the remake there's a Yes/No prompt where she just says "Prithee, do not mock me, sirrah" for either option

QuoteIn Rupugana / Lianport, the man you are referring to said the following in the Japanese and therefore our version:  ']You two guys can get lost[.'] and [wait][ ']Hey, missy with the nice behind.[wait]Why don[' -67]t you come have a drink with me at the bar? Hic[.'] I think this text is dependant on whether or not she is alive, just like the censored puff puff text in the same town. Speaking of, was that uncensored in the remake? Was there a hint for it? I had to add one. Couldn't have players pass that by.

Yeah I figured seeing the lines separated like that was for that. As for Puff Puff, yeah it's fully uncensored in the remake. There's even a separate, more "intense" version with Cannock if you talk to her post Malroth.

QuoteGood catch with those censored bits. There are a couple others like a guy who is pissing in the bushes and yells at you for catching him in the act. I think that's in Liriza / Leftwynn. I'm curious how the remake handled the text in the undersea cave. In the original they are clearly priests in Hargon's order who are in the midst of offering prayers to Shido/Malroth. The original changed the scenerio to some silly business about a wizard's house.

If you want a copy of my atlas file so you can reference our directly translated text, I'm happy to send it.

There's something funny to me about a guy saying he wet himself in olde English, but I think that line is even in the GBC version. Also, yeah the scene in the sea cave talks about interrupting their "great conflagration" and that they'd offer their flesh to Hargon.

But sure,  wouldn't mind taking a peek out of your atlas file for reference. I'm just, literally half a world away from my computer on vacation right now. There's a couple lines that I THINK are unused. They're with other battle lines

"No more shall (name) walk this world!"
And
"Follow me and make not a peep."

abw

Quote from: Chicken Knife on March 31, 2019, 06:56:43 PM
Knowing abw, I predict that he is going to offer a way to retool the game to allow us to manipulate this, but I also predict that the complexity of that would be quite prohibitive.  :laugh:
Pfft. Did you guys even try this? :P The [name] control code just prints out whatever happens to be stored starting at $6119; the logic for deciding what to store at $6119 happens elsewhere, but as it turns out, the prologue already does store Moonbrooke's name there just before displaying this string:
Quote
[no voice]Then the King spoke[line]
[no voice]to the Princess:[wait][line]
'Thy life is in danger, my daughter. Hide thyself now, and whatever happens to me thou must be strong[.'][wait][line]
'But Father!' cried the Princess.[wait][line]
'Hurry,' commanded the King.[wait][line]
'I must go to warn my cousin, the King of Midenhall[.'][end-FC]
So from there until the next time $6119 gets overwritten (by Midenhall's name just before the King starts talking to you), you can use Moonbrooke's name as much as you want, which in particular covers the "'Oh, such a brave beauty,' the Monster mocked her." line. If you want to use her name in one of the earlier lines, though, that'll take some more work, since by default you'll just get whatever random string happened to be left over in $6119 from earlier events.

Chicken Knife

Quote from: abw on April 01, 2019, 06:43:44 PM
Pfft. Did you guys even try this? :P The [name] control code just prints out whatever happens to be stored starting at $6119; the logic for deciding what to store at $6119 happens elsewhere, but as it turns out, the prologue already does store Moonbrooke's name there just before displaying this string:So from there until the next time $6119 gets overwritten (by Midenhall's name just before the King starts talking to you), you can use Moonbrooke's name as much as you want, which in particular covers the "'Oh, such a brave beauty,' the Monster mocked her." line. If you want to use her name in one of the earlier lines, though, that'll take some more work, since by default you'll just get whatever random string happened to be left over in $6119 from earlier events.
Well, I'll be damned. I wonder what possessed them to store the princess's name *exactly* where I would need it stored 28 years later when they themselves didn't use it. But, I'm not complaining! Now the player is afforded the opportunity to know the names of both the princess of Moonbrooke & the prince of Samaltria as soon as they make a short trek to speak to the guard posted outside the prince's room.

One thing I find interesting as I do some testing is that their names are not paired--each seems to be matched with different names on occaision. I've always believed it worked the other way where the two names came together as fixed pairs.

In any case, expect a small update shortly.

abw

Quote from: Chicken Knife on April 02, 2019, 07:06:24 AM
Well, I'll be damned. I wonder what possessed them to store the princess's name *exactly* where I would need it stored 28 years later when they themselves didn't use it.
Yeah, sometimes things just work out that way :).

Quote from: Chicken Knife on April 02, 2019, 07:06:24 AM
One thing I find interesting as I do some testing is that their names are not paired--each seems to be matched with different names on occaision. I've always believed it worked the other way where the two names came together as fixed pairs.
Nope, Cannock's and Moonbrooke's names are each selected separately, both based on Midenhall's name. See e.g. https://gamefaqs.gamespot.com/nes/587248-dragon-warrior-ii/faqs/55791, but note that the verbal description of the algorithm has a couple of errors:
  • the code uses all 8 characters of the input name, not just the first 4, so the "add 180" stuff is only valid if the name you input is at most 4 characters long
  • the code does not do anything with the carry from the final addition, so "add third digit to first" is only valid sometimes
For reference:

; control flow target (from $ACE7)
0x01ACFB|$06:$ACEB:A9 00    LDA #$00
0x01ACFD|$06:$ACED:A2 03    LDX #$03
0x01ACFF|$06:$ACEF:18      CLC
; control flow target (from $ACF7)
0x01AD00|$06:$ACF0:7D 09 70 ADC $7009,X ; first 4 characters of Midenhall's name
0x01AD03|$06:$ACF3:7D 63 70 ADC $7063,X ; last 4 characters of Midenhall's name
0x01AD06|$06:$ACF6:CA      DEX
0x01AD07|$06:$ACF7:10 F7    BPL $ACF0
0x01AD09|$06:$ACF9:48      PHA
0x01AD0A|$06:$ACFA:29 07    AND #$07 ; Cannock's name is based on bits 0-2 of the sum of Midenhall's name
0x01AD0C|$06:$ACFC:0A      ASL ; << 3 since names are 8 bytes long
0x01AD0D|$06:$ACFD:0A      ASL
0x01AD0E|$06:$ACFE:0A      ASL
0x01AD0F|$06:$ACFF:AA      TAX
0x01AD10|$06:$AD00:A0 00    LDY #$00
; control flow target (from $AD18)
0x01AD12|$06:$AD02:BD 39 AD LDA $AD39,X ; pointer to list of Cannock names, starting at 0th byte
0x01AD15|$06:$AD05:99 0D 70 STA $700D,Y ; store the first 4 characters in SRAM
0x01AD18|$06:$AD08:99 18 01 STA $0118,Y ; store the first 4 characters in RAM
0x01AD1B|$06:$AD0B:BD 3D AD LDA $AD3D,X ; pointer to list of Cannock names, starting at 4th byte
0x01AD1E|$06:$AD0E:99 67 70 STA $7067,Y ; store the last 4 characters in SRAM
0x01AD21|$06:$AD11:99 8A 01 STA $018A,Y ; store the last 4 characters in RAM
0x01AD24|$06:$AD14:E8      INX
0x01AD25|$06:$AD15:C8      INY
0x01AD26|$06:$AD16:C0 04    CPY #$04
0x01AD28|$06:$AD18:D0 E8    BNE $AD02
0x01AD2A|$06:$AD1A:68      PLA
0x01AD2B|$06:$AD1B:29 38    AND #$38 ; Moonbrooke's name is based on bits 3-6 of the sum of Midenhall's name
0x01AD2D|$06:$AD1D:AA      TAX
0x01AD2E|$06:$AD1E:A0 00    LDY #$00
; control flow target (from $AD36)
0x01AD30|$06:$AD20:BD 79 AD LDA $AD79,X ; pointer to list of Moonbrooke names, starting at 0th byte
0x01AD33|$06:$AD23:99 11 70 STA $7011,Y ; store the first 4 characters in SRAM
0x01AD36|$06:$AD26:99 1D 01 STA $011D,Y ; store the first 4 characters in RAM
0x01AD39|$06:$AD29:BD 7D AD LDA $AD7D,X ; pointer to list of Moonbrooke names, starting at 0th byte
0x01AD3C|$06:$AD2C:99 6B 70 STA $706B,Y ; store the last 4 characters in SRAM
0x01AD3F|$06:$AD2F:99 8E 01 STA $018E,Y ; store the last 4 characters in RAM
0x01AD42|$06:$AD32:E8      INX
0x01AD43|$06:$AD33:C8      INY
0x01AD44|$06:$AD34:C0 04    CPY #$04
0x01AD46|$06:$AD36:D0 E8    BNE $AD20
0x01AD48|$06:$AD38:60      RTS

Chicken Knife

Yes, I recall reading that quite thorough gamefaqs post years ago. When I came across the bugs in the calculation, I essentially didn't want to know more because minor bugs cause me an inordinate amount of stress.

Thankfully the game still seems to execute the function with a reasonable amount of randomization, but over the years it does seem like there are some names I've seen a lot and some names I hardly ever see.

From my point of view, anything dealing with code arithmetic is gonna be above my head until I hopefully get a handle on basic 6502. But from yours does this look like a doable fix? Would be nice if the names appeared with more equal probability.

Choppasmith

Quote from: abw on April 01, 2019, 06:43:44 PM
Pfft. Did you guys even try this? :P The [name] control code just prints out whatever happens to be stored starting at $6119; the logic for deciding what to store at $6119 happens elsewhere, but as it turns out, the prologue already does store Moonbrooke's name there just before displaying this string:So from there until the next time $6119 gets overwritten (by Midenhall's name just before the King starts talking to you), you can use Moonbrooke's name as much as you want, which in particular covers the "'Oh, such a brave beauty,' the Monster mocked her." line. If you want to use her name in one of the earlier lines, though, that'll take some more work, since by default you'll just get whatever random string happened to be left over in $6119 from earlier events.

Sorry, only asked because Chicken Knife made it sound like there was some alterations already done. My bad. Didn't mean to trouble you. But that is interesting, thanks. I had initially thought that Midenhall's name would be the default. Gives me something to look out for when I get to testing as I thinking I added some NPC dialog that adds Midenhall's name (as mentioned above, they can all be individually mentioned with unique byte values in text).

abw

Quote from: Chicken Knife on April 02, 2019, 08:54:33 AM
Would be nice if the names appeared with more equal probability.
If you tend to give Midenhall the same name on each playthrough, then getting the same Cannock/Moonbrooke names over and over again is especially likely. If you wanted to spice things up a bit, it should only take very minor code changes to ask the random number generator for a number and use that to determine which name to assign; probably the trickiest part of that would be that finding the random number generator first (I haven't had any need to go looking for it, but if all else fails I'm sure somebody in the TAS community would know exactly where it is).

Quote from: Choppasmith on April 02, 2019, 05:38:56 PM
Sorry, only asked because Chicken Knife made it sound like there was some alterations already done. My bad. Didn't mean to trouble you. But that is interesting, thanks. I had initially thought that Midenhall's name would be the default. Gives me something to look out for when I get to testing as I thinking I added some NPC dialog that adds Midenhall's name (as mentioned above, they can all be individually mentioned with unique byte values in text).
No worries, it was a fun little thing to check on :P. The menus do have separate codes for displaying (the first 4 characters of) each hero's name, but based on a quick scan of the control codes available in the main script, I don't think anything like that exists there (I did come across a control code for shutting off the music, though!). If you do decide to add some main script control codes to support that, the routine at $FC50 looks like your friend - pass in #$00, #$01, or #$02 in A to get the corresponding (full-length) hero's name stored in $6119 for you to use as you please via the [name] control code.

Ray572

Hello
I find it great that they have changed the title that corresponds to these games. :)

By chance will you have the patch to change only the title? is to patch the game in Spanish.

abw

Quote from: abw on April 03, 2019, 10:38:20 PM
If you wanted to spice things up a bit, it should only take very minor code changes to ask the random number generator for a number and use that to determine which name to assign; probably the trickiest part of that would be that finding the random number generator first.
So, I decided to take a look at this. Rather than try to guess which of the various frequently-updating RAM addresses might be where random numbers get stored, I decided to use the crazy fortuneteller in Osterfair as my starting point. A read breakpoint on the direction names at $06:$9250-$9265 got me the code for displaying direction names (I could also have started with the F9 control code that reads from $5A and set a write breakpoint on $5A to get the same result), and after looking at what the code was doing, it's clear that the random direction is determined by the value $32|$33, and immediately before the reads on those addresses, there's a call to $C3AB, which does a bunch of bit operations to scramble the values of $32 and $33. $C3AB is also called from all over the place, so that looks like our random number generator code.

With that knowledge, we can either make an explicit call to the RNG during Cannock/Moonbrooke name generation, or since the RNG gets called plenty of other times already, we can just be lazy and read $32 directly to get our random number. The following patch seems to work out pretty well for me:

0x1AD07: A5 32

Chicken Knife

#159
Quote from: Ray572 on April 06, 2019, 03:48:36 AM
Hello
I find it great that they have changed the title that corresponds to these games. :)

By chance will you have the patch to change only the title? is to patch the game in Spanish.
Glad you appreciated that improvement! I whipped up a quick little title only patch this morning for DQ1 https://www.dropbox.com/s/pkgyll8k2845yeu/dw1_titleonly.ips?dl=0

If you also want a title only patch for DQ2, let me know if you want me to include my changes to the design and animation for the title sequence or just the title logo.

Quote from: abw on April 06, 2019, 01:56:40 PM
So, I decided to take a look at this. Rather than try to guess which of the various frequently-updating RAM addresses might be where random numbers get stored, I decided to use the crazy fortuneteller in Osterfair as my starting point. A read breakpoint on the direction names at $06:$9250-$9265 got me the code for displaying direction names (I could also have started with the F9 control code that reads from $5A and set a write breakpoint on $5A to get the same result), and after looking at what the code was doing, it's clear that the random direction is determined by the value $32|$33, and immediately before the reads on those addresses, there's a call to $C3AB, which does a bunch of bit operations to scramble the values of $32 and $33. $C3AB is also called from all over the place, so that looks like our random number generator code.

With that knowledge, we can either make an explicit call to the RNG during Cannock/Moonbrooke name generation, or since the RNG gets called plenty of other times already, we can just be lazy and read $32 directly to get our random number. The following patch seems to work out pretty well for me:

0x1AD07: A5 32

abw, you've done it again. I never would have imagined such a complex issue being resolved by four bytes of data. I've implemented it, tested it (at least with the princess of Moonbrooke so far) and it works wonderfully. I really like being able to get different names for your companions without having to switch the name of your main hero.

Btw, it was brought to my attention by a player that the extract/insert routine you helped me with to fix SHILD and DEFENC caused a bug with UNCURSE at the priests/healers. It moved the word one tile to the left out of alignment and made the cursor become N. I was actually able to play around with the atlas file and fix it myself (another small miracle, right?) But you may want to take a peek at that in your version to see if it needs a fix.

@Everyone

Once I do a bit more testing of abw's name randomization fix (primarily with the prince of Samaltria/Cannock) I'll submit a new update including this and the fix to the UNCURSE problem