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

Author Topic: JRPGs: DoubleXP/DoubleGold  (Read 11865 times)

Psyklax

  • Hero Member
  • *****
  • Posts: 731
    • View Profile
    • Psyklax Translations
Re: JRPGs: DoubleXP/DoubleGold
« Reply #40 on: December 16, 2017, 02:27:23 pm »
Maybe this?: https://en.wikipedia.org/wiki/Direct_memory_access :D

Oh hello... :) DMA would certainly explain why the CPU isn't changing RAM, but surely DMA is just for other devices like sound and whatnot. The XP would only be controlled by CPU, no?

Reading on segaretro.org, the Genesis has a powerful DMA controller, but that seems to mainly apply to writing graphics to VRAM. It could be used to write to memory, but I don't see how adding to a handful of addresses would require it. So, again, I'm not sure that's the right thing. Honestly, I don't see how I'm gonna find the instructions I want if I can't figure out which instructions increase your XP. :( Anyone got any experience hacking the Genesis?

Bregalad

  • Hero Member
  • *****
  • Posts: 2552
    • View Profile
Re: JRPGs: DoubleXP/DoubleGold
« Reply #41 on: December 16, 2017, 03:12:56 pm »
Do you plan to do Romancing SaGa ? I started a game, and enjoyed it but at some point I stopped to progress because enemies are too hard and the game is too grindy.

Quote
The XP would only be controlled by CPU, no?
Yep. No game would ever write to EXP using DMA, which is used to write to graphics or stuff like that. This guy just had no idea what he was talking about.

mziab

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
    • mteam
Re: JRPGs: DoubleXP/DoubleGold
« Reply #42 on: December 16, 2017, 03:36:00 pm »
Yes, it's unlikely it's DMA in this case. Besides, even if DMA were used here for some reason, the RAM write breakpoint should still trigger.

Psyklax: What is the address you tried for DQI+II? Did you try an absolute address with the RAM bank? I'm guessing your problem is either bank mirroring or it's a 16-bit write and you've set the breakpoint for the wrong byte. You could try adding/substracting one from the breakpoint address and see if it helps.

Psyklax

  • Hero Member
  • *****
  • Posts: 731
    • View Profile
    • Psyklax Translations
Re: JRPGs: DoubleXP/DoubleGold
« Reply #43 on: December 16, 2017, 05:07:34 pm »
either bank mirroring or it's a 16-bit write and you've set the breakpoint for the wrong byte

I did consider that (not used to using 16-bit numbers after the 6502) but I tried both addresses on the Genesis, and with the SNES I tried a whole 16 byte range, still nothing. I don't know anything about bank mirroring so that could explain it, but it doesn't explain the Genesis.

mziab

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
    • mteam
Re: JRPGs: DoubleXP/DoubleGold
« Reply #44 on: December 16, 2017, 05:30:57 pm »
There might be another reason. The address you're setting the breakpoint to may actually be a ROM address. What was the exact address you tried?

mz

  • Sr. Member
  • ****
  • Posts: 377
  • Whore
    • View Profile
Re: JRPGs: DoubleXP/DoubleGold
« Reply #45 on: December 16, 2017, 05:39:24 pm »

This guy just had no idea what he was talking about.
Haha, sorry about that. :D

In any case, I never said anyone would use DMA for this, I was only telling him why an emulator could ignore a breakpoint (since that happened to me with the GBA once, I believe). Very unlikely that's the culprit in this case, of course.

If you've already tried different bytes, then the cause should be mirroring. Find the mirror addresses that the system might have, or try finding an emulator that would trigger even in these cases. MAME could be another option for the Genesis...

The address you're setting the breakpoint to may actually be a ROM address.
It's very unlikely he could have found a changing byte in ROM... :D
There has to be a better life.

mziab

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
    • mteam
Re: JRPGs: DoubleXP/DoubleGold
« Reply #46 on: December 16, 2017, 06:06:26 pm »
It's very unlikely he could have found a changing byte in ROM... :D

Since Psyklax didn't mention the exact steps taken and admitted he didn't know the SNES memory map, I just wanted to make extra sure. The game uses LoROM, which might be confusing to a newcomer. But I digress...

Snarky remarks aside, I took a quick look at DQ1+2 snes and was able to find the routine in the DQ1 part:
Code: [Select]
// load EXP for monster
0b919d lda $0b0010,x [0bda42] A:0000 X:da32 Y:0000 S:02f1 D:0000 DB:00 nvmxdiZc V:248 H:201 F:45
0b91a1 clc                    A:0003 X:da32 Y:0000 S:02f1 D:0000 DB:00 nvmxdizc V:248 H:213 F:45
0b91a2 adc $0ed8     [000ed8] A:0003 X:da32 Y:0000 S:02f1 D:0000 DB:00 nvmxdizc V:248 H:217 F:45
0b91a5 sta $0ed8     [000ed8] A:0003 X:da32 Y:0000 S:02f1 D:0000 DB:00 nvmxdizc V:248 H:227 F:45
0b91a8 sep #$20               A:0003 X:da32 Y:0000 S:02f1 D:0000 DB:00 nvmxdizc V:248 H:237 F:45
// load gold for monster
0b91aa lda $0b0005,x [0bda37] A:0003 X:da32 Y:0000 S:02f1 D:0000 DB:00 nvMxdizc V:248 H:242 F:45
0b91ae sta $00       [000000] A:0006 X:da32 Y:0000 S:02f1 D:0000 DB:00 nvMxdizc V:248 H:252 F:45

And I made a quick multiply hack of my own to test it out, which seems to work. One thing worth noting is that gold seems to be limited to 0xFF, so one needs to watch out for overflow, at least if you do your shifts here. Shouldn't be a problem if you do it when the game adds gold for all defeated monsters together, but I didn't dig enough to find that part of the code. I also tried to speed up walking just for fun, but that didn't go anywhere. So there you have it. Hope this helps.
« Last Edit: December 16, 2017, 06:14:27 pm by mziab »

mz

  • Sr. Member
  • ****
  • Posts: 377
  • Whore
    • View Profile
Re: JRPGs: DoubleXP/DoubleGold
« Reply #47 on: December 16, 2017, 06:19:03 pm »
Since Psyklax didn't mention the exact steps taken and admitted he didn't know the SNES memory map, I just wanted to make extra sure. The game uses LoROM, which might be confusing to a newcomer.
Ah, I see. Sorry again, I don't know much about this either...

Could you please explain the steps you took to find that routine?
There has to be a better life.

mziab

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
    • mteam
Re: JRPGs: DoubleXP/DoubleGold
« Reply #48 on: December 16, 2017, 06:37:27 pm »
Ah, I see. Sorry again, I don't know much about this either...

Could you please explain the steps you took to find that routine?

Basically, I traced it back from the "Gained X experience" message. I found it in RAM, then set the write breakpoint at the number, while starting a trace just before the battle ended. Then I worked backwards to see where the value being written came from (grepping through uncut trace logs is fun). Turns out, some of this stuff is loaded at the start of the battle, not when you win, so I had to set another breakpoint and do another trace. I don't know if this was the quickest route to take, but hey, it worked. If current EXP was displayed somewhere in an easily accessible menu, I might've traced back from the point the hero's EXP changes instead. But in DQ you need to go to a church to learn such stats and even then, you're only told how much you need to level-up, so it's very useful for our purposes.
« Last Edit: December 16, 2017, 06:44:50 pm by mziab »

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6543
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: JRPGs: DoubleXP/DoubleGold
« Reply #49 on: December 16, 2017, 10:26:16 pm »
If current EXP was displayed somewhere in an easily accessible menu, I might've traced back from the point the hero's EXP changes instead.
Current EXP? Isn't that displayed on the stats menu? On the bottom of the window I think. (I know on the NES it was displayed on that window that's open practically the entire game. :D )
"My watch says 30 chickens" Google, 2018

Psyklax

  • Hero Member
  • *****
  • Posts: 731
    • View Profile
    • Psyklax Translations
Re: JRPGs: DoubleXP/DoubleGold
« Reply #50 on: December 17, 2017, 02:30:59 am »
Current EXP? Isn't that displayed on the stats menu? On the bottom of the window I think. (I know on the NES it was displayed on that window that's open practically the entire game. :D )

That's what I was thinking. I'm pretty sure I found the XP in RAM because it matched what i saw on-screen.

But anyway, it's great that you found something: I didn't use tracing because it can be a slow process, but if I can't use breakpoints then I guess it'll have to do. On the DW NES games I did the doubling when everything was added together: I'd find the routine that comes up with the total and jump in that point with an ASL. I'll have a look today with the advice you've given here.

Asaki

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 166
    • View Profile
Re: JRPGs: DoubleXP/DoubleGold
« Reply #51 on: December 17, 2017, 03:40:00 am »
I'm warming up to this idea, but I'm wondering if there aren't more games that already have patches or Game Genie codes for this type of thing.

EarthBound (NES) might be another good one, I know the GBA port has a patch that adds a "Double XP ring" that can be equipped.

What I would suggest? Besides your idea of doubling EXP/Gold, I would add an option menu, or button combination, to enable/disable random encounters. That way, you decide when grinding is worth it, and you can explore the world much faster with less interrumptions.

There are games like EarthBound (SNES) that did this well, where weaker monsters would run away from you and get defeated without even going to the battle screen, but I'm not sure if there's an easy solution for hacking pre-existing games.

I feel like being able to disable random encounters would be too much of a cheat. If you find yourself with only one party member left, you could just disable the encounters and run back to town, safe and sound. Or you could disable them and then start exploring areas that you shouldn't be high enough level to get to yet.


I think most people just deal with this type of situation by playing the games in an emulator that supports fast-forwarding.

Psyklax

  • Hero Member
  • *****
  • Posts: 731
    • View Profile
    • Psyklax Translations
Re: JRPGs: DoubleXP/DoubleGold
« Reply #52 on: December 17, 2017, 05:21:10 am »
I'm warming up to this idea, but I'm wondering if there aren't more games that already have patches or Game Genie codes for this type of thing.

Game Genie can only change one byte per code, whereas my hacks need more than that.

I feel like being able to disable random encounters would be too much of a cheat.

Exactly. Traversing across the overworld should entail some risk, otherwise what's the point?

mziab

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
    • mteam
Re: JRPGs: DoubleXP/DoubleGold
« Reply #53 on: December 17, 2017, 06:08:28 am »
Current EXP? Isn't that displayed on the stats menu? On the bottom of the window I think. (I know on the NES it was displayed on that window that's open practically the entire game. :D )

I stand corrected. I don't know why I thought that, honestly. I guess I was going by memory instead of actually checking, haha :) Still, all's well that ends well.

There are games like EarthBound (SNES) that did this well, where weaker monsters would run away from you and get defeated without even going to the battle screen, but I'm not sure if there's an easy solution for hacking pre-existing games.

I agree Earthbound's system is really nice. I don't think I've seen it used in any games in the 16-bit era. Some of the PS2 Atelier games have something similar in that you can kill weak monsters in one hit without battling them, just like Earthbound. That being said, implementing this in a game that wasn't designed for it would be a big undertaking.

But anyway, it's great that you found something: I didn't use tracing because it can be a slow process, but if I can't use breakpoints then I guess it'll have to do.

Well, like I said, I did also use breakpoints for this and they triggered when expected. There might be some small mistake you're making. Could you tell me what address you used when debugging DQ1+2? Perhaps you just need to add the 7E bank in front.

Psyklax

  • Hero Member
  • *****
  • Posts: 731
    • View Profile
    • Psyklax Translations
Re: JRPGs: DoubleXP/DoubleGold
« Reply #54 on: December 17, 2017, 10:07:29 am »
Could you tell me what address you used when debugging DQ1+2?

Aha, I've found it! :) But here's the process through which I discovered it.

I used the cheat finder in bsnes-plus after each fight and found the only address which had the same number as my XP each time: $7E0C11. As you see, it has $7E at the start, but as I've just discovered, it seems like every bank is identical ($10C11, $20C11 etc, all the same). So instead of adding $7E, I just set a breakpoint for $C11. And what do you know? $BA889 has an instruction: "lda $0C11,x". So the instruction itself refers to $C11, not $7E0C11, which would explain why it didn't break for me.

Anyway, this happens at the end of a fight, and it adds your current XP to that for the fight (stored at $ED8). So I'll just have a go at making a new routine to double that amount...

EDIT: And it's done. :D

http://s346165667.websitehome.co.uk/psyktrans/dragonquest12-2xp.zip

It was really quite easy once I figured out how the memory mapping worked. I'm amazed at how similar the SNES's 65816 is to the 6502. It was just like hacking the NES, but with a ton more space to play with.

Well, with that out of the way, I can get going on all those other SNES RPGs that need to be done! And I'm sure there are a lot. Incidentally, I think I'm at a point when I should be officially releasing these patches, don't you guys think so?

EDIT2: I should point out that this patch only applies to Dragon Quest 1, not 2. I foolishly forgot that there are two games on the cart. :D

EDIT3: Never mind! Turns out the game uses the same routine for both DQ1 and 2, so my patch works for both games! :)
« Last Edit: December 17, 2017, 03:02:48 pm by Psyklax »

Mauron

  • Sr. Member
  • ****
  • Posts: 424
    • View Profile
Re: JRPGs: DoubleXP/DoubleGold
« Reply #55 on: December 17, 2017, 04:13:27 pm »
If you decide to do Chrono Trigger, I can give you some relevant addresses. Personally I think the game wasn't particularly grindy in the first place.
Mauron wuz here.

darthvaderx

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: JRPGs: DoubleXP/DoubleGold
« Reply #56 on: December 18, 2017, 07:09:03 am »
What is the difference between "dragonquest12-trans1" and "dragonquest12-trans2" patches?

mziab

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
    • mteam
Re: JRPGs: DoubleXP/DoubleGold
« Reply #57 on: December 18, 2017, 07:44:16 am »
I assume they're for the DQ and DW versions of the English translation.

All versions seem to be identical, though:
Code: [Select]
68d7e04e404f1c8a2b2e7b908aeb4ccd  dragonquest12-2xp.ips
68d7e04e404f1c8a2b2e7b908aeb4ccd  dragonquest12-trans1-2xp.ips
68d7e04e404f1c8a2b2e7b908aeb4ccd  dragonquest12-trans2-2xp.ips
ec9ecbbe9d220007117460a1f3e2d306  dragonquest12-2xp2gold.ips
ec9ecbbe9d220007117460a1f3e2d306  dragonquest12-trans1-2xp2gold.ips
ec9ecbbe9d220007117460a1f3e2d306  dragonquest12-trans2-2xp2gold.ips

Psyklax

  • Hero Member
  • *****
  • Posts: 731
    • View Profile
    • Psyklax Translations
Re: JRPGs: DoubleXP/DoubleGold
« Reply #58 on: December 18, 2017, 12:25:35 pm »
You know, guys... I'm glad you mentioned this, because it's just occurred to me that the patch is identical for the original game plus the two translations. :D You see, on my PC I made three ROMs: the original, and the English translation which uses both DW and DQ names. So when I made the patch, my brain said "I'd better make three of these", without realising that it changes the exact same bytes. So yeah, use any of them! :)

I had to do different versions for Phantasy Star you see, so of course I thought I'd need different versions here, but I don't...

vivify93

  • Hero Member
  • *****
  • Posts: 927
  • White Wizard
    • View Profile
Re: JRPGs: DoubleXP/DoubleGold
« Reply #59 on: December 18, 2017, 08:08:26 pm »
so the Phantasy Star I patch for SMS Power's retranslation is in the HalfXP pack right? the ones in DoubleXP won't work if i remember right.

it's a little confusing.
All my life I've tried to fight what history has given me.