News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Dragon Warrior 1, 2 & 3 Hacking Discussion  (Read 148951 times)

Chicken Knife

  • Sr. Member
  • ****
  • Posts: 456
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #200 on: June 09, 2020, 09:41:18 am »
A couple things:

All this talking of NOP'ing out bytes. I assume that is assembler speak, which I have yet to have to engage in (I'm sure it's coming soon). But in case I need to NOP something, is that the equivalent of just replacing with FF or 00 or something like that in hex?

As for a more relevant matter, I finished my DQ2 script revision, which turned out to be an enormous amount of revision. While nejimakipiyo does their sweep, it's time for me to work on inserting the DQ3 script, and I have a couple questions.

When I set up the parameters that tells me how many bytes remain in each data bank, if I run over, is abcde going to tell me by how many bytes I ran over? Or is it just going to give me a fail? I'd love to know how much I'm running over so I can choose between finding some opportunities for space efficiency or looking at your compression scheme. Also, what actually happens when I run over? This would be new to me. Does it fill data up until the cut off point? Or does it have data run into the next section? Or does it simply not do a write at all? I could definitely experiment with this myself, but I'm at work right now and the curiosity is killing me. :P

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 504
  • I am the baldest romhacker
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #201 on: June 09, 2020, 11:44:11 am »
NOP (EA opcode) is an instruction that does nothing except wasting cpu cycles during its execution. It is used for deleting (temporary or permanently) other instructions by overwriting their length with EAs.

You can't overwrite them with 00 or FF, because 00 is an opcode for BRK instruction that causes an interrupt, and there is no such opcode as FF, you can freeze your code execution with it.
iromhacker.ru - NES ROM hacking tutorials for beginners. Please use Google Translate browser extension

Chicken Knife

  • Sr. Member
  • ****
  • Posts: 456
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #202 on: June 09, 2020, 11:46:59 am »
Perfect. So if I can manage to track down the DQ3 code that is applying a 125% gold and experience multiplier to monster rewards, I just EA through it.  :thumbsup:

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 504
  • I am the baldest romhacker
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #203 on: June 09, 2020, 12:01:46 pm »
Basically yes, however you need to understand what a routine is doing exactly before start hastily deleting its instructions
iromhacker.ru - NES ROM hacking tutorials for beginners. Please use Google Translate browser extension

abw

  • Hero Member
  • *****
  • Posts: 554
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #204 on: June 09, 2020, 09:36:35 pm »
Cyneprepou4uk's covered NOPs pretty well already, so I'll just reply to this part:

When I set up the parameters that tells me how many bytes remain in each data bank, if I run over, is abcde going to tell me by how many bytes I ran over? Or is it just going to give me a fail? I'd love to know how much I'm running over so I can choose between finding some opportunities for space efficiency or looking at your compression scheme. Also, what actually happens when I run over? This would be new to me. Does it fill data up until the cut off point? Or does it have data run into the next section? Or does it simply not do a write at all? I could definitely experiment with this myself, but I'm at work right now and the curiosity is killing me. :P
Is you set an upper limit on the insert address with #JMP(Address, MaxAddress), then yes, (recent versions of) abcde will tell you how many bytes you have to spare if your script fit into the available space or how many bytes didn't fit otherwise. If your script doesn't fit, then any data up to MaxAddress will still get inserted, but data beyond that won't be overwritten.

For DW3, if you can fit the same number of strings in each bank as the original text used, then great. There is a little bit of free space at the end of each of the first 5 banks of text, but not much, so it could be a tight fit. There is plenty of free space at the end of the 6th bank, but in order to use it you'll need to shift strings from one bank to the next and update the code for determining which bank holds each string; that code starts at $0E:$AE8F and is kind of messy. If finding and updating the right values in the original code doesn't appeal to you, you can apply the patch I made to rewrite that code which has a little table at the bottom of the ASM file for setting up the string/pointer/bank mapping that should be easy to edit; as a reminder, though, I haven't really tested that patch much, so it's possible there could be some mistakes.

Chicken Knife

  • Sr. Member
  • ****
  • Posts: 456
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #205 on: June 09, 2020, 11:25:35 pm »
f finding and updating the right values in the original code doesn't appeal to you, you can apply the patch I made to rewrite that code which has a little table at the bottom of the ASM file for setting up the string/pointer/bank mapping that should be easy to edit; as a reminder, though, I haven't really tested that patch much, so it's possible there could be some mistakes.
I'll give your script code rewrite patch a try if (when) I determine that our script doesn't fit. I assume that this will require me to get moving with using one of assemblers we spoke about.

Choppasmith

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #206 on: June 14, 2020, 12:41:59 pm »
So I dipped my toes into DW3 yesterday. Found myself replacing the Gadabout/Goof Off dialog first. The differences between versions are HUGE

NES:
Code: [Select]
[name] suddenly starts to flee.[end-EE]

[name] catches a whiff of the socks.[end-EE]

[name] begins to mimic the arms shopkeeper:[line]
[*']This store deals in weapons and armor[..][.'][end-EE]

[name] casts the spell, Explodet.[end-EE]

[name] speaks ill of [name][letter].[end-EE]

[name][letter] becomes enraged.[end-EE]

[name][letter] is not listening.[end-EE]

[name] is honing his body to be ready for anything.[end-EE]

[name] starts doing Jazzercise![end-EE]

[name] suddenly becomes enlightened.[end-EE]
// current address: $41A91

//POINTER #14 @ $2809C - STRING #14 @ $41A91
#W16($2809C)
[name] points [his/her] finger at [name][letter] and guffaws.[end-EE]

[name] gets tangled up in his own legs and falls down.[end-EE]

[name] pokes at the dead monster.[end-EE]

[name] remarks smugly:[line]
[*']I wouldn't fight if I were you. Even a victory would be hollow[.'][end-EE]

[name] is confused for some reason.[end-EE]

[name] lies down for a nap.[end-EE]

[name] spruces [himself/herself] up.[end-EE]

[name] is lost in thought.[end-EE]

[name] is taking a break.[end-EE]

[name] recoils![end-EE]

[name] cheers on [his/her] companions.[end-EE]

But [his/her] companions are not there.[end-EE]

But no one is listening.[end-EE]

[name] suddenly found [he/she] couldn't move a single muscle.[end-EE]

[name] beckons the heavens.[end-EE]

[name] breaks out in a smile.[end-EE]
// current address: $41C89

//POINTER #15 @ $2809E - STRING #15 @ $41C89
#W16($2809E)
[name] suddenly pinches [name].[end-EE]

[name] :[line]
[*']Hey!! What do you think you're doing?[' ][end-EE]

[name] blusters:[line]
[*']Do you realize who you are speaking to? Impertinent![' ][end-EE]

[name] gives a kind glance.[end-EE]

[name] pretends to be dead.[end-EE]

But fools no one![end-EE]

[name] soft soaps [name][letter].[end-EE]

[name] is chewing onion-flavored gum.[end-EE]

The strong smell is drifting everywhere.[end-EE]

[name] blows a kiss.[end-EE]

[name] suddenly turns around and rolls up a sleeve.[end-EE]

[ .][..]exposing a small tatoo![end-EE]

[name] is momentarily transfixed.[end-EE]

[name] sings a song.[end-EE]

[name] makes an awful pun.[end-EE]

[name] is momentarily transfixed.[end-EE]

Mobile/Switch

Code: [Select]
~<13<23<3A shuts out everything around <46him<47her<48it<64, and hunkers down to defend <46himself<47herself<48itself<64!<12<0F  ]<13<23<3A holds off on doing anything for now, and stands back to assess the situation.<12<0F  i<13<23<3A calls for backup!<12
But <46his<47her<48its<64 faithful playmates are nowhere to be seen!<12<0F  Y<13<23<3A suddenly makes a run for it!<12
But <46his<47her<48its<64 way is blocked!<12<0F  *<13<23<3A pretends to take a tumble!<12<0F  ?<46His<47Her<48Its<64 weapon catches <3B on the way down!<12<0F  M<46He<47She<48It<64 lands badly, and grazes <46his<47her<48its<64 knee!<12<0F  &<13<23<3A grins from ear to ear!<12<0F  B<13<23<3A suddenly falls flat on <46his<47her<48its<64 face!<12<0F  N<23<07: Zzz...
Would you believe it!?
<49He<4AShe<4BIt<64's fast asleep!<12<0F  C<13<23<3A picks up some stones and starts juggling with them!<12<0F  F<13<23<06: Whoopsy-daisy!
One of the stones lands on <3B's head!<12<0F  I<13<23<06: Whoopsy-daisy!
One of the stones lands on <3B's big toe!<12<0F  <<13<23<3A starts to sing and dance about like a loony!<12<0F  м13<23<3A blasts the enemy with a stinging verbal tirade!<12
<23<06: Ner-ner-na-ner-nerrr!
You smell! A-And you're rubbish!
...So THERE!<12
But <46his<47her<48its<64 words fail to ruffle any feathers...<12<0F  ><13<23<3A puts <46his<47her<48its<64 hair back in order!<12<0F  ׼13<23<3A taps <46his<47her<48its<64 feet to the rhythm of the battle!<12
Suddenly, ducking and swaying out of danger's way doesn't seem so hard!<12<0F  L<13<23<3A twirls <46his<47her<48its<64 fingers in front of <3B's face!<12<0F  5<14<23<3B's eyes start to spin round and round!<12<0F  0<14But <3B isn't fazed in the slightest...<12<0F  5<14<23<3B's eyes start to spin round and round!<12<0F  2<13<23<3A pinches <3B crudely on the behind.<12<0F  ;<23<07: Oi! What the heck do you think you're doing!?<12<0F  6<13<23<3A gets a well-deserved slap in the face.<12<0F  X<13<23<3A pulls out a mirror and starts touching up <46his<47her<48its<64 make-up.<12<0F  Ӽ13<23<3A hurls <46him<47her<48it<64self to the ground and starts bawling!<12
<23<06: Waaaah! (sob) Boo-hooo!
I'm s-so s-sad, I can't even mooove!<12
<46He<47She<48It<64's literally paralysed with sadness!<12<0F  5<13<23<3A tries making up an amazing new spell.<12<0F  <23<06: <05<1A  -<05!<12
But of course, nothing happens.<12<0F  ˼13<23<3A prays fervently to the heavens...<12
<23<06: O merciful Goddess, I beg of you—bring peace to our world!<12
...But this is neither the time nor the place.<12<0F 9<13<23<3A suddenly realises that maybe it's time to stop messing around and take life seriously.<12
<46He<47She<48It<64 gets the distinct feeling there was something very important <46he<47she<48it<64 was supposed to be doing...<12
And starts muttering away feverishly to <46himself<47herself<48itself<64...<12<0F  /<13<23<3A comes up with a hilarious joke!<12<0F  @<13<23<06: ...WHY THE LONG FACE!!!
Geddit? Hyuk hyuk hyuk!<12<0F  G<13Direct hit! <23<3B collapses on the floor in fits of laughter!<12<0F  6<13<23<3A is rolling on the floor with laughter!<12<0F  '<13<23<3A is distinctly unamused.<12<0F  D<13<23<06: ...NO, I'M A FRAYED KNOT!!!
Woohoohoooo! Boom boom!<12<0F  6<13<23<06: ...A STICK!!!
Woohoohoooo! Boom boom!<12<0F  A<13<23<06: ...HE KNEADED A POO!!!
Yuk yuk yuk! Classic, eh?<12<0F  C<13<23<06: ...NO-EYED DEER!!!
Har har! ‘No idea’! Geddit?<12<0F  T<13<23<06: ...BECAUSE HE WAS A LITTLE HORSE!!!
You know—horse, hoarse... No?<12<0F     @<13<23<06: ...BECAUSE THE SEA WEED!!!
Wacka wacka! Hooonk!<12<0F  x<13<23<06: ...NOTHING, IT JUST LET OUT A LITTLE WINE!!! You know... Grapes...wine...? Yeah!
Hur de hur de hur hur!<12<0F  ;<13<23<3A slowly and deliberately rolls a large dice.<12<0F  /It lands on a <03...
And nothing happens.<12<0F  &<13<23<3A starts singing loudly.<12<0F  :The haunting melody drifts across the battlefield...<12<0F  )<15<23<3B is completely captivated!<12<0F  )<13<23<3A is completely captivated!<12<0F  (<15But <3B isn't really listening.<12<0F  4It sounds like cats screeching in an alleyway!<12<0F  _<15<23<3B runs off as fast as <49his<4Aher<4Bits<64 legs will carry <49him<4Aher<4Bit<64!<12<0F  I<15But luckily for <3B, <49he<4Ashe<4Bit<64 isn't really listening.<12<0F  ;<13<23<3A is suddenly distracted by a smutty thought.<12<0F  D<23<06: Hur hur hur...<12
<46He<47She<48It<64 chuckles lewdly.<12<0F  G<23<06: Hyeh hyeh hyeh...<12
<46He<47She<48It<64 chuckles lewdly.<12<0F  E<13<23<06: Ahhhhhh-CHOO!!!<12
<23<3A lets out a massive sneeze!<12<0F  F<14<23<3B jumps out of <49his<4Aher<4Bits<64 skin with surprise!<12<0F  F<13<23<3A jumps out of <46his<47her<48its<64 skin with surprise!<12<0F  )<15But <3B doesn't take any notice.<12<0F  D<23<06: Ahhhhhh-TISHOO!!!<12
<23<3A lets out a massive sneeze!<12<0F  5<13<3A starts an impromptu game of ‘I Spy’.<12<0F  <23<06: I spy with my little eye, something beginning wiiith...<05! No, wait! I-I meant to say— Ach!<12
<46He<47She<48It<64 makes a complete mess of it!<12<0F  "<13<23<3A makes eyes at <3B!<12<0F  /<23<3B gets all flustered and looks away!<12<0F  5<13<23<3A looks at the ground in embarrassment!<12<0F  &But <3B doesn't take any notice.<12<0F  ˼13<3A starts telling a spooky story...<12
<23<06: It was a dark and stormy night...<12
<13That was enough to give anyone the creeps!<12<0F  <23<3B gets goosebumps!<12<0F  )<13<23<3A is shivering with fright!<12<0F  But nobody's listening.<12<0F  ڼ13<23<3A pulls a crown from somewhere and puts it on!<12
<13<23<06: Verily, I am the king of thee! HA HA HA! Kneel before me!<12
<13<46He<47She<48It<64 beckons imperiously to <3B!<12<0F  Ҽ13<23<3B shuffles nervously up to <3A and bows low!<12
<13<3A spots <46his<47her<48its<64 chance, and biffs <3B on the back of the head!<12<13<0F  )But <3B clearly isn't a monarchist!<12<0F  μ13<23<3A puts on a crown, whips out a sceptre, and adopts a thoroughly queenly air!<12
<13<23<06: Yea, I am thy queen!
HA HA HA! Kneel before me!<12
<13<46He<47She<48It<64 beckons imperiously to <3B!<12<0F  ˼13<23<3B shuffles nervously up to <3A and bows low!<12
<13<23<3A spots <46his<47her<48its<64 chance, and stamps on <3B's big toe!<12<13<0F  )But <3B clearly isn't a monarchist!<12<0F  ļ13<23<3A sneaks up behind <3B and puts <46his<47her<48its<64 hands over <49his<4Aher<4Bits<64 eyes!
<23<06: Guess whooo!<12
<13<23<07: Um...<06?<12
Oh no! <49He<4AShe<4BIt<64 got it in one!<12<0F  -<13<23<3A suddenly bursts out laughing!<12<0F  ;<13<23<06: Hohohohohoho! Hahahahahaha! HEE HEE HEE!!!<12<0F  /<13<23<3B gets weirded out and runs away!<12<0F  9<13<23<06: Wahahahaha! Woohoohoohoo! HAR HAR HAR!!!<12<0F  r<13<23<3A gives the party some stirring words of encouragement!<12
<23<06: Come on, you lot! We can do this!<12<0F  5<13<23<3A's words get the party totally pumped!<12<0F  2<13<23<3A's words totally bum everybody out!<12<0F  !Sadly, nobody is listening.<12<0F  Ӽ13<23<3A pulls out a drink <46he<47she<48it<64 has stashed up <46his<47her<48its<64 sleeve, and downs it in one!<12
<23<06: (glug glug glug) Ahhh!!!
That hit the spot! Hic!<12<0F  μ13<23<06: What'sh your—Hic!—problem, eh?
Reckon you're shpecial, do you? (burp)
Think you're—Hic!—better than me?<12
<23<3A starts haranguing <3B incoherently!<12<0F  '<13<23<3A is busy haranguing <3B.<12<0F  :<13<23<3A is busy trying to fend off a slurring <3B.<12<0F  G<13<23<06: Hic! Bleeeurgh!
<23<3A is feeling a little...poorly...<12<0F  "<13<23<3A is feeling poorly.<12<0F  R<13<23<3A points at <3B and starts bad-mouthing <49him<4Aher<4Bit<64 loudly!<12<0F  S<23<06: Yeah, yeah... That one...
Looks like a right wimp, eh?
Heh! Pathetic!<12<0F  $<14<23<3B gets really annoyed!<12<0F  $<14<23<3B gets really upset...<12<0F  )<14<23<3B wasn't taking any notice.<12<0F  Ҽ13<23<3A summons up all <46his<47her<48its<64 strength, and hurls a huge boulder straight up in the air!<12
The boulder comes hurtling down...<0F  -<13...And lands squarely on <3B's head!<12<0F  ,...And lands harmlessly on the ground.<12<0F  E<13<23<3A performs <46his<47her<48its<64 best puff-puff on <3B!<12<0F  #<23<06: (puff-puff puff-puff)<12<0F  But <3B isn't impressed!<12<0F  ;<23<3B has a huge grin on <49his<4Aher<4Bits<64 face!<12<0F  <13<23<3A is mesmerised!<12<0F  -But <3B manages to resist <3A's charms!<12<0F  V<13<23<3A tries out a special move <46he<47she<48it<64's just thought up on <3B!<12<0F  7<13<23<06: You shall be the first to feel my...
<05 <1A  <05 <1A  B<05!!!<12
...But it looks suspiciously like a normal attack.<12<0F  ^<13<23<3A starts doing something very naughty!<12
<13Everybody pretends not to notice...<12<0F  ɼ13<23<3A pulls a scrap of paper out of <46his<47her<48its<64 pocket and sets fire to it for fun!<12
<13<23<06: Owowowow!
<46He<47She<48It<64 throws the burning piece of paper in <3B's direction!<12<0F  Ӽ13<23<3A starts trying to think of fun games to play with <46his<47her<48its<64 friends.<12
...But <46he<47she<48it<64 soon remembers that the battlefield is no playground.<12<0F  ݼ13The sight of <46his<47her<48its<64 friends fighting alongside <46him<47her<48it<64 warms <3A's heart!<12
<13The warmth spreads throughout the party!<12<0F  1<14<23<3B's wounds are miraculously healed!<12<0F

Speaking of space though, am I right in that a line has to start with the quote in order to have the "speaking" sound effect? Because when I look at the format at a lot of the dialog is like this

[name] :[line]
[ ']It doesn't look especially cursed[.']

And I just think how you could save a lot of space by doing this ala more modern DQ games

[name]: It doesn't look especially cursed.

You could even edit the colon tile to be on the left side so that you wouldn't have to even use a space after.

June 14, 2020, 03:48:30 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Yep, just found with DW2, text definitely has to start with the single quote to do the sound effect, and you can definitely go back and forth between text and silence (I think that's what [wait] is for), but the space after [name] in a lot of the dialogs is still unnecessary and can definitely free up space.

EDIT: Oh wait, you don't even need a [line], it'll start right after the ` starts.
« Last Edit: June 14, 2020, 04:00:36 pm by Choppasmith »

Chicken Knife

  • Sr. Member
  • ****
  • Posts: 456
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #207 on: June 15, 2020, 07:50:58 am »
@Choppasmith

I've also found that their approach to dialogue with named speakers can be a little more space efficient.

@abw (or Choppasmith if you want to take a stab)

I have an issue making me crazy which relates to the insert script I had just set up for DQ3. The script part "seems" to be working fine (without having actually inserted our changes) and I also included the lists for spells/items/monsters. The latter list section also seemed to be working fine until I incorporated our new spell names, which increased the size of the spell list by about 30 characters. Everything seems good until the spell "Probasu" (formerly called X-Ray). The insert script has Probasu[$FF], but after running the insertion, the rom ends up with an $AD byte in the location where $FF is supposed to be written. For the life of me, I can't understand why this is happening. I could simply change 0x00AD12 to $FF (which I've done) but I end up with the end of the spell list screwed up regardless. The spell list only has one pointer, so I don't believe that could be the issue. Curiously, the spell list is getting borked only a couple bytes after where it ended in the original rom. In the past, I manually inserted the romaji Japanese spell list I was using previously (which I believe was larger than both of these lists) and it seemed fine. There are other problems with the item names, which could very well be due to a manual error, but for the life of me, I can't figure out this spell list issue, and would be very grateful if you could take a look.

Here is the insert script and the two table files I use (one for script, one for lists) https://www.dropbox.com/sh/20kwx353wplbcv4/AADvP7VMwqumHZhlwonKv928a?dl=0
« Last Edit: June 15, 2020, 09:07:57 am by Chicken Knife »

Choppasmith

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #208 on: June 15, 2020, 09:07:28 am »
Well, just really quick you could force it by doing

Code: [Select]
Probasu<$FF>
The only thing I can think of is I'm looking at your table and I'm not sure why you need the $ sign for A2 and FF but I don't know why that would affect anything.

abw

  • Hero Member
  • *****
  • Posts: 554
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #209 on: June 15, 2020, 09:11:20 am »
Everything seems good until the spell "Probasu" (formerly called X-Ray). The insert script has Probasu[$FF], but after running the insertion, the rom ends up with an $AD byte in the location where $FF is supposed to be written. For the life of me, I can't understand why this is happening.
This
Quote
#W16($AD11)
is the culprit - the pointer write is clobbering your previously-inserted text. It's just pure luck that the low byte of the pointer happens to have the same value as the text you want ($AD1F vs. 1F=u) and happens to align with the previously-written [$FF]. I think you meant to say #W16($AA1E) instead!

Chicken Knife

  • Sr. Member
  • ****
  • Posts: 456
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #210 on: June 15, 2020, 11:04:07 am »
Went home for lunch and tested the pointer address change. Yep! That was it. First time I've screwed up a #W16 address, so now I know it can do this kind of thing. I honestly should have suspected my address was wrong based on how far off that address was from the others.

Thanks a million, as always!
« Last Edit: June 15, 2020, 12:24:55 pm by Chicken Knife »

abw

  • Hero Member
  • *****
  • Posts: 554
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #211 on: June 15, 2020, 07:50:57 pm »
First time I've screwed up a #W16 address, so now I know it can do this kind of thing.
Heh, there's a first time for everything, isn't there? ;) Getting everything to line up like that was pretty special, though!

Choppasmith

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #212 on: June 17, 2020, 02:27:00 pm »
Hey abw, I wanted to try something you suggested to Chicken Knife, unique Dragonlord text, a while back and wanted to make sure I got it right.

A few minutes with a debugger says that the "A Dragonlord draws near!" text (the 0xE2'th string) comes from the 0xE2 following $03:$E595, so if you wanted different text for the Dragonlord, you'd need to change 0xE2 to whatever string you wanted to use instead. It looks like the current enemy ID is stored in RAM at $E0, so something like this should do the trick:
Code: [Select]
; $03:$E595
JSR choose_text
NOP

; free space somewhere else
choose_text:
LDA $E0
CMP #$26 ; enemy ID for Dragonlord's first form
BEQ @use_awesome_text
; otherwise use the normal text
JSR $C7CB
.byte E2 ; normal string ID
RTS
@use_awesome_text:
JSR $C7CB
.byte ?? ; whatever free string ID you want to use for your new text
RTS

I found some space for this routine at ROM 7F40, this would be RAM $3F50 and space for the string 9B, the unused 7th string in Pointer 8024. Does that sound about right?

abw

  • Hero Member
  • *****
  • Posts: 554
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #213 on: June 17, 2020, 07:29:25 pm »
What happened when you tried it?

I'm assuming by $3F50 you meant $BF50 and by 9B you meant 96, but I think you'll find that ROM bank 1 is not swapped in to RAM at the point when $03:$E595 gets executed, so if you want to call code in ROM bank 1, you'll first need to add some code to swap that bank in and then swap the previous bank back when you're done. If you haven't already used them, there appear to be a few long stretches of unused $FF bytes in bank 3, so those would be the easiest places to reach since they're guaranteed to be visible.

Chicken Knife

  • Sr. Member
  • ****
  • Posts: 456
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #214 on: June 18, 2020, 09:15:56 am »
I'm intrigued to hear how this goes. I hope to revisit at some point soon. My brain is so deeply in script editing right now, I'm not really capable of shifting gears smoothly into figuring out a whole new hacking method (assembler). But as soon as I get the DQ3 script inserted, the focus will be on hacking issues between this and DQ3.

Ah, and going back a previous comment, Choppasmith mentioned above how inefficient the script format was at times in DQ3. Stuff like:

[line][wait]
(space x3)[line]
blah blah blah blah blah balh
[line](space x3)[end]

This isn't exact, but close enough to illustrate. There are a number of these scenarios, but one example is with the early line "...and the day breaks" or something like that.

For the life of me, I can't understand why they would add all those extra spaces when they could just be [line] bytes. Usually things they did have a reason, but I'm here scratching my head. So far, I'm removing all of that.

Choppasmith

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #215 on: June 19, 2020, 12:30:34 am »
What happened when you tried it?

I'm assuming by $3F50 you meant $BF50 and by 9B you meant 96, but I think you'll find that ROM bank 1 is not swapped in to RAM at the point when $03:$E595 gets executed, so if you want to call code in ROM bank 1, you'll first need to add some code to swap that bank in and then swap the previous bank back when you're done. If you haven't already used them, there appear to be a few long stretches of unused $FF bytes in bank 3, so those would be the easiest places to reach since they're guaranteed to be visible.

Have to admit, I was working this out while I was on hold over the phone and didn't get a chance to try it. I figured something was off and felt better asking, sorry. Mostly because I wanted to convert my new script over to abcde (I still had everything setup for Pointer Tables complete with manual pointer editing and I just couldn't go back to that :D) before making any more changes.

So I successfully managed to convert everything in my DW1 work over (even the Menu stuff in the DW2 example files works great and just needed a couple tweaks)

But I had a couple of abcde questions

When editing table files what does placing / before the value (usually an End Token supposed to do? I get that putting /n means the output file will make a new line (or two in the case of a proper end string token) Nevermind found the explanation in the documentation.

When doing the DW1 menu stuff, it ends at x752C however when I put #SCRIPT STOP: $752C it'll stop one byte short and my output will say #JMP($6FC0, $752B) is this intentional?
« Last Edit: June 19, 2020, 12:38:55 am by Choppasmith »

abw

  • Hero Member
  • *****
  • Posts: 554
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #216 on: June 19, 2020, 09:47:58 am »
Have to admit, I was working this out while I was on hold over the phone and didn't get a chance to try it. I figured something was off and felt better asking, sorry.
No worries. I haven't tried it myself either, but it should be fairly easy as ASM changes go. I provided a general plan for the change, but I'll leave the details up to whoever actually wants to implement it :P.

(I still had everything setup for Pointer Tables complete with manual pointer editing and I just couldn't go back to that :D)
Not having to manually edit pointers is a thing of beauty indeed :D.

When doing the DW1 menu stuff, it ends at x752C however when I put #SCRIPT STOP: $752C it'll stop one byte short and my output will say #JMP($6FC0, $752B) is this intentional?
The way Cartographer works (which is not at all clear from its documentation) is that the #SCRIPT STOP address is exclusive, i.e. "extract up to but not including this address".

On the other hand, the upper limit on Atlas' #JMP command is inclusive, i.e. "insert up and including this address".

I kept both of those behaviours for abcde for the sake of backwards compatibility, but that does conflict with the goal of having a consistent interface. I'll probably end up converting abcde::Cartographer to work inclusively to match Atlas since it's much easier for people to change their extract scripts than their insert scripts.

Chicken Knife

  • Sr. Member
  • ****
  • Posts: 456
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #217 on: June 23, 2020, 11:11:19 am »
As I am now approaching the half-way point in the process of inputting new text into DQ3, I wanted to toss out a few things to you guys that I'm thinking about beyond just the text. I have a feeling Choppasmith may want some of these fixes / improvements as well for RE-QUEST. I'm planning on working on all of these, but if anyone wants to jump in, I would be more than grateful.

NECESSARY FOR RELEASE:

TITLE SCREEN:
I believe we have to fix the nametable arrangement for the title screen because it duplicates certain letters for the Dragon Quest logo, similar to how DQ1 did. I'm also thinking about moving the III up to the upper right, filling out the space based on shrinking WARRIOR to QUEST like how I did in II. And where the III is now, I would probably write the subtitle. Would need to think about ideal font for the subtitle, and I'm definitely open to any other ideas for the title screen.

RESTORED DIFFICULTY:
Perhaps this is a little less necessary, but for me it's huge. I need to be able to locate and NOP out the code that gives the 25% bonus gold/xp added for the US version. I'll include an optional patch to revert for the grind haters, but this feels like a pretty essential part of my concept of removing localization. It should also result in the game feeling more part of a whole with the first two.

NAME RESTRICTION:
Right now the game prevents you from naming a new recruit Erdrick. I need to change that to Roto. I was a little confused when I couldn't simply find Erdrick somewhere in the rom as the disallowed name. I have some ideas on how I might find it though. Worst case scenario, I include a corny jab at the Erdrick name being not up to snuff. But I'd much rather keep things professional and include the translated text based on choosing Roto.

IMPORTANT, NOT NECESSARY FOR RELEASE

PARRY BUG:
Want to fix the bug where you can parry, then cancel, but keep the defensive bonus from the parry. Zombero included this in his hardtype patch. I reached out some time ago to ask if he could give us the code or make it available as a separate patch. I didn't get a reply, sadly. I surfed around looking for other contact details for him and couldn't find any. We may have to reinvent the wheel with this.

CROSSES / BUDDHIST SYMBOL:
Need to restore the 2 large floor crosses and a buddhist symbol that were censored in the US release. I made an attempt to do this when I was fixing the Priest / Coffin sprites but didn't get anywhere. Willing to tape another stab later but *gulp* it was scary.

Let me know guys if there's anything else that feels like it needs updating.
« Last Edit: June 23, 2020, 11:58:39 am by Chicken Knife »

abw

  • Hero Member
  • *****
  • Posts: 554
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #218 on: June 23, 2020, 06:35:02 pm »
NAME RESTRICTION:
This one is pretty easy to track down - if you watch RAM with a table file open while entering "Erdrick", you'll see the name being stored starting at $0009; from there, a read breakpoint will (after a few other hits) get you to the code for comparing the entered name against "Erdrick"... case insensitively ;).

Chicken Knife

  • Sr. Member
  • ****
  • Posts: 456
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #219 on: June 23, 2020, 11:56:39 pm »
This one is pretty easy to track down - if you watch RAM with a table file open while entering "Erdrick", you'll see the name being stored starting at $0009; from there, a read breakpoint will (after a few other hits) get you to the code for comparing the entered name against "Erdrick"... case insensitively ;).
To your credit, this is probably a very nice, simple learning exercise in using breakpoints / trace logger. I'm going to attempt it soon. Let's hope the effort goes better than last time when I had to send you a video of my ineptitude.

One cool thing that happened tonight: I figured out how to swap out the relatively unnecessary himself/herself gendered opcode for a king/queen one. Now a female hero can become a queen when you return the golden crown instead of becoming... a king.
« Last Edit: June 24, 2020, 12:03:11 am by Chicken Knife »