News: 11 March 2016 - Forum Rules

Author Topic: changing text in Uncharted Waters by KOEI - NES  (Read 6191 times)

kwm576

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
changing text in Uncharted Waters by KOEI - NES
« on: May 11, 2015, 02:49:06 pm »
Hello,

I am trying to alter the script of Uncharted Waters for the NES.
This should be easy since all the text in in ASCII code.

However, if I change any text in the ROM, it seems to screw up the entire game. I am using a hex editor and being careful to only overwrite the existing text.
( I changed the 'E' in 'Eighty' from the opening scroll and when I went to see the change the game crashed on a yellow-board screen with a text box at the bottom.)

Any ideas?

BlackDog61

  • Hero Member
  • *****
  • Posts: 784
    • View Profile
    • Super Robot Wars A Portable translation thread
Re: changing text in Uncharted Waters by KOEI - NES
« Reply #1 on: May 11, 2015, 03:57:11 pm »
The data might have some checksum somewhere?
Try and alter things before / after the text, to see if there's any of those that impacts the same text, maybe?
Otherwise, it sounds like something to debug to understand... (Memory breakpoint on the original text location.)

kwm576

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: changing text in Uncharted Waters by KOEI - NES
« Reply #2 on: May 14, 2015, 05:14:06 pm »
The data might have some checksum somewhere?
Try and alter things before / after the text, to see if there's any of those that impacts the same text, maybe?
Otherwise, it sounds like something to debug to understand... (Memory breakpoint on the original text location.)

thank you for your reply.
The checksum remains same.
I used "FCEUX" to understand what I need to know, but no luck.
Can someone help me out?

granitor

  • Jr. Member
  • **
  • Posts: 14
    • View Profile
Re: changing text in Uncharted Waters by KOEI - NES
« Reply #3 on: May 14, 2015, 09:04:35 pm »
thank you for your reply.
The checksum remains same.
I used "FCEUX" to understand what I need to know, but no luck.
Can someone help me out?

The ROM check-sum may be the same, but there might be a small routine that checks the integrity of the code in software, and that is what is giving your trouble. The only way to really know about it would be to do a trace of it before and after the changes, and see where the execution path changed significantly.

It might also be that you aren't changing the data that represents that "E", but really, data that represents something else and just happens to have the same value. Changing one critical op-code would cause that trouble. So it would be hard to say.

They changing the "i" instead, and see if it works any better.

... there are just stabs in the dark. You can most short disassembly code or short hexdumps here and it might trigger someone who can help. FCEUX is a great tool (from what I remember) but I don't have the ROM you are using and more importantly I don't have the time right now or I might follow my curiosity to see if I could at least reproduce the problem, but if you post the offset address and such then it might help others who might have the time to work with you in parallel.

Hope this helps. I'll re-lurk now.


kwm576

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: changing text in Uncharted Waters by KOEI - NES
« Reply #4 on: May 16, 2015, 07:48:36 pm »
The ROM check-sum may be the same, but there might be a small routine that checks the integrity of the code in software, and that is what is giving your trouble. The only way to really know about it would be to do a trace of it before and after the changes, and see where the execution path changed significantly.

It might also be that you aren't changing the data that represents that "E", but really, data that represents something else and just happens to have the same value. Changing one critical op-code would cause that trouble. So it would be hard to say.

They changing the "i" instead, and see if it works any better.

... there are just stabs in the dark. You can most short disassembly code or short hexdumps here and it might trigger someone who can help. FCEUX is a great tool (from what I remember) but I don't have the ROM you are using and more importantly I don't have the time right now or I might follow my curiosity to see if I could at least reproduce the problem, but if you post the offset address and such then it might help others who might have the time to work with you in parallel.

Hope this helps. I'll re-lurk now.

You are right. After I change "New Adventure" to "Sew Adventure" the following values are changed. I checked on VirtuaNES.

Original CRC Values
PRG CRC = CD35E2E9
CHR CRC = D492AFC8
ALL CRC =ACA15643

New CRC Values(I just changed one alphabet "N" to "S"
PRG CRC = A4F643E1
CHR CRC = D492AFC8
ALL CRC = 5DBF8A27

Now what I need to do?


granitor

  • Jr. Member
  • **
  • Posts: 14
    • View Profile
Re: changing text in Uncharted Waters by KOEI - NES
« Reply #5 on: May 16, 2015, 08:18:42 pm »
Since then, I gave into my overly curious nature and used some spare time to look into it.

Well, the situation is both more simple and more complicated.

For most of the text, it is in plain ASCII, so I was able to change the "years" in "Eighty years" to "Eighty zarnz" (just a random nonsense word) without trouble. FCEUX didn't give any trouble.

I was able to start a game and go into one of the rooms of the town, without any obvious problems, so when you say it crashes if you change something, I am a bit lost.

Does it crash after the text scrolls by? At which point exactly?

The complication for me is that I'm not sure where you're having trouble, in the first place.

However, with FCEUX you can easily set breakpoints and gradually narrow down problems, if you understand debugging and have the time and patience for it... if you upload a video to YouTube of the problem in action then I'd have some idea of what you mean by "crashing"... you said:

" it seems to screw up the entire game.[...] when I went to see the change the game crashed on a yellow-board screen with a text box at the bottom.)"

Well, so far, the game doesn't seem to crash when you carefully edit only the text.

Offhand, the initial letters might not be letters but pointers to sub-routines that set up the text display and push out the first character before returning. In other words, compound control codes. If that is the case, you shouldn't edit the initial letters but instead trace the problem and modify the routine.

To test for that, try what I said initially and try changing a non-initial letter.

Modifying and debugging takes a lot of time an patience, and you might need the help of a basic guide if you haven't done something like this before.... or a programmer minion/friend/cohort to extract and re-insert the text for you.

goldenband

  • Sr. Member
  • ****
  • Posts: 378
    • View Profile
Re: changing text in Uncharted Waters by KOEI - NES
« Reply #6 on: May 16, 2015, 09:02:12 pm »
I tried changing "ancestors" in the opening text crawl to "apcestors", and got an immediate crash in Nestopia (as soon as you hit Start on the title screen, basically), with the same yellow screen already described.

That said, maybe there's a simpler explanation: is it possible that changing the ROM is just making these emulators fail to detect the MMC5 mapper? That'll certainly make them crash hard.

Otherwise I'm guessing there's some copy protection/checksum-checker thing going on.

kwm2815

  • Jr. Member
  • **
  • Posts: 2
    • View Profile
Re: changing text in Uncharted Waters by KOEI - NES
« Reply #7 on: May 16, 2015, 11:24:53 pm »
Since then, I gave into my overly curious nature and used some spare time to look into it.

Well, the situation is both more simple and more complicated.

For most of the text, it is in plain ASCII, so I was able to change the "years" in "Eighty years" to "Eighty zarnz" (just a random nonsense word) without trouble. FCEUX didn't give any trouble.

I was able to start a game and go into one of the rooms of the town, without any obvious problems, so when you say it crashes if you change something, I am a bit lost.

Does it crash after the text scrolls by? At which point exactly?

The complication for me is that I'm not sure where you're having trouble, in the first place.

However, with FCEUX you can easily set breakpoints and gradually narrow down problems, if you understand debugging and have the time and patience for it... if you upload a video to YouTube of the problem in action then I'd have some idea of what you mean by "crashing"... you said:

" it seems to screw up the entire game.[...] when I went to see the change the game crashed on a yellow-board screen with a text box at the bottom.)"

Well, so far, the game doesn't seem to crash when you carefully edit only the text.

Offhand, the initial letters might not be letters but pointers to sub-routines that set up the text display and push out the first character before returning. In other words, compound control codes. If that is the case, you shouldn't edit the initial letters but instead trace the problem and modify the routine.

To test for that, try what I said initially and try changing a non-initial letter.

Modifying and debugging takes a lot of time an patience, and you might need the help of a basic guide if you haven't done something like this before.... or a programmer minion/friend/cohort to extract and re-insert the text for you.

Wow
I ran a rom with FCEUX, I could play well even after I changed many alphabet letters on the rom.
But I ran the same rom with VirtuaNES, it crashed after the opening script scroll.
checksum or mapper issue then?



« Last Edit: May 17, 2015, 12:05:06 am by kwm2815 »

Disch

  • Hero Member
  • *****
  • Posts: 2814
  • NES Junkie
    • View Profile
Re: changing text in Uncharted Waters by KOEI - NES
« Reply #8 on: May 17, 2015, 12:45:38 am »
An emulator mapper issue is certainly a possibility.  NEStopia certainly does use checksums to identify games and use the appropriate board/mapper for them.  It is very likely that a changed checksum would result in it thinking the game uses a different board and therefore causing it to fail.

Fortunately, NEStopia should support NES 2.0 headers which might be able to address this issue:
http://wiki.nesdev.com/w/index.php/NES_2.0


Particular, if memory serves, Uncharted Waters has 8K of battery backed SRAM, and another 8K of non-battery RAM on a separate chip.  With NES 2.0 you could specify that by setting offset 0x0000A to '77' to indicate 8K of each.


That + changing the appropriate bits of byte 7 in the header to indicate it's a 2.0 header, and that should satisfy NEStopia.  Try it out and see.



EDIT:

And I wouldn't bother with VirtuaNES.  That emu is a dinosaur and I doubt there is anything you can do to get it to work.

kwm576

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: changing text in Uncharted Waters by KOEI - NES
« Reply #9 on: May 17, 2015, 08:30:00 am »
An emulator mapper issue is certainly a possibility.  NEStopia certainly does use checksums to identify games and use the appropriate board/mapper for them.  It is very likely that a changed checksum would result in it thinking the game uses a different board and therefore causing it to fail.

Fortunately, NEStopia should support NES 2.0 headers which might be able to address this issue:
http://wiki.nesdev.com/w/index.php/NES_2.0


Particular, if memory serves, Uncharted Waters has 8K of battery backed SRAM, and another 8K of non-battery RAM on a separate chip.  With NES 2.0 you could specify that by setting offset 0x0000A to '77' to indicate 8K of each.


That + changing the appropriate bits of byte 7 in the header to indicate it's a 2.0 header, and that should satisfy NEStopia.  Try it out and see.



EDIT:

And I wouldn't bother with VirtuaNES.  That emu is a dinosaur and I doubt there is anything you can do to get it to work.

Thank you very much for all your helps! I really appreciated.

EDIT:

I have a last question.
What if I make a reproduction cartridge with modified rom and try play on a real NES?

Disch

  • Hero Member
  • *****
  • Posts: 2814
  • NES Junkie
    • View Profile
Re: changing text in Uncharted Waters by KOEI - NES
« Reply #10 on: May 17, 2015, 08:35:05 am »
Quote
Thank you very much for all your helps! I really appreciated.

Did it work?

Quote
I have a last question.
What if I make a reproduction cartridge with modified rom and try play on a real NES?

This is all a sounding like a hardware issue, not a software issue.  Emus are choking not because what your ROM is doing, but because they are choosing to emulate the wrong hardware for it.  By tweaking the header you are simply telling them the right kind of hardware to emulate.

So it'll work just fine on a repro cart as long as the hardware is right.  So if you have the right kind of cartridge with the right mapper and the right kinds of memory mapped to the right places, then it'll be fine.

goldenband

  • Sr. Member
  • ****
  • Posts: 378
    • View Profile
Re: changing text in Uncharted Waters by KOEI - NES
« Reply #11 on: May 17, 2015, 11:42:55 am »
Fortunately, NEStopia should support NES 2.0 headers which might be able to address this issue:
http://wiki.nesdev.com/w/index.php/NES_2.0

Particular, if memory serves, Uncharted Waters has 8K of battery backed SRAM, and another 8K of non-battery RAM on a separate chip.  With NES 2.0 you could specify that by setting offset 0x0000A to '77' to indicate 8K of each.

That + changing the appropriate bits of byte 7 in the header to indicate it's a 2.0 header, and that should satisfy NEStopia.  Try it out and see.

Yep, I changed 0x00008 to $08, and 0x0000A to $77, and Uncharted Waters now runs with no issue and displays the altered text. Thanks for that.

However, I think byte 10 might still need tweaking. If I'm reading this PCB profile correctly, should 0x00008 actually be $88 for 16K SRAM and 16K WRAM? EDIT: Never mind, I think I know what I misunderstood there -- I didn't realize SRAM and WRAM are the same thing.

Also, this page suggests allocating 64K since the WRAM isn't contiguous -- I don't know if that's an issue here (is it?).
« Last Edit: May 17, 2015, 11:51:11 am by goldenband »

Disch

  • Hero Member
  • *****
  • Posts: 2814
  • NES Junkie
    • View Profile
Re: changing text in Uncharted Waters by KOEI - NES
« Reply #12 on: May 17, 2015, 11:50:42 am »
Quote
should 0x00008 actually be $88 for 16K SRAM and 16K WRAM?

Also, this page suggests allocating 64K since the WRAM isn't contiguous -- I don't know if that's an issue here (is it?).

Nah it looks like I had it right.

If you look at the chip listing on the bottom of the page, there are 2 SRAM chips, one has a battery and the other does not.  Each are 8K in size, which matches the '77' header value.  The "WRAM size" on the side bar is like the sum of all RAM on the cartridge.

As for the memory being non-contiguous, that is correct -- but is manifested in the memory being on different chips.  MMC5 has a "chip select" bit for RAM swapping which will choose between battery and non-battery backed SRAM.  So we are accounting for that with our '77' value.

And in fact, this is exactly why '77' works, but '08' or '80' would not work.  Even though all of those values represent 16K RAM total, 80 and 08 would put the 16K on one chip and therefore make it contiguous.  Whereas 77 splits it across 2 chips making it non-contiguous.



Setting it to use 64K total would certainly work since you're just adding more RAM, but is unnecessary here.

goldenband

  • Sr. Member
  • ****
  • Posts: 378
    • View Profile
Re: changing text in Uncharted Waters by KOEI - NES
« Reply #13 on: May 17, 2015, 11:53:19 am »
Yeah, I just realized that SRAM = WRAM, which is what was throwing me off. Actually this is what set me straight:

Quote
"WRAM", "SRAM", and "PRG-RAM" are used synonymously and inconsistently in these docs.  Kind of sloppy of me, I know.  All three terms refer to on-cartridge RAM.

 ;D Thanks for your help (and for the very clear explanation in your previous post -- that makes a lot of sense).

kwm576

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: changing text in Uncharted Waters by KOEI - NES
« Reply #14 on: May 17, 2015, 11:44:13 pm »
Did it work?
Yes, it is working fine. Thank you again!

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7253
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: changing text in Uncharted Waters by KOEI - NES
« Reply #15 on: May 21, 2015, 11:49:41 pm »
Yeah, I just realized that SRAM = WRAM, which is what was throwing me off. Actually this is what set me straight:

 ;D Thanks for your help (and for the very clear explanation in your previous post -- that makes a lot of sense).
I believe the convention is to refer to is as SRAM when the data is used for saved-game purposes and WRAM or PRG-RAM otherwise. But technically all data on a chip used for save purposes will be saved.
"My watch says 30 chickens" Google, 2018

goldenband

  • Sr. Member
  • ****
  • Posts: 378
    • View Profile
Re: changing text in Uncharted Waters by KOEI - NES
« Reply #16 on: May 23, 2015, 12:34:13 am »
I believe the convention is to refer to is as SRAM when the data is used for saved-game purposes and WRAM or PRG-RAM otherwise.

That's more or less what I was expecting, but the PCB profile seems to flout that convention -- it lists Uncharted Waters as having 16KB of WRAM, and/but down below it itemizes two chips (U4 W-RAM-0 & U5 W-RAM-1) with 8KB of SRAM each (so it calls them both "SRAM" as well).-

That's what made me wonder if it was 16K/16K, especially since the small battery icon next to U5 W-RAM-1 didn't catch my eye. You can see how all this might be confusing to a newcomer. :D If it just called U4 W-RAM-0 "WRAM 8 KB (100 ns)" then I'd have understood sooner...
« Last Edit: May 23, 2015, 12:39:32 am by goldenband »