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

Author Topic: DS .rtz/.sjs files?  (Read 3131 times)

rikoren

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
    • Translation blog
DS .rtz/.sjs files?
« on: November 21, 2014, 07:52:59 pm »
Hi, I'm pretty much a newbie here, and I'm trying to translate Summon Night 1 for the DS. Now generally I would have attempted the PSX version, because I'm assuming it would be somewhat easier than a DS game, but I found a really useful tool that could extract/import the main script and...nothing else. I figured out that handy script-extracting program had taken .rtz files and changed them to .sjs, which I could open with Notepad.

So! What I need to know is...how do I change .rtz files to/from .sjs? (I'm sorry if there's already an answer to this somewhere, I'm kind of lost.)

pablitox

  • Full Member
  • ***
  • Posts: 106
    • View Profile
Re: DS .rtz/.sjs files?
« Reply #1 on: December 18, 2014, 11:45:46 pm »
I'm bumping this thread because I have a similar question. Though the script can be translated using Darthnemesis tools (which I humbly thank them ^_^) I can't seem to find items/weapons/summons descriptions anywhere. I actually thought they could be stored in the script, but I couldn't find any coincidence. Using tinke the only thing that seems posible is the bmrts folder, which has a lot of files compressed in .rtz, though I'm not entirely sure.

Any help to translate them would be appreciated.

Thanks!

to rikonen: I actually got a translator help to translate the game, and we did make some progress.
Re taking hajimari no ishi!

rikoren

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
    • Translation blog
Re: DS .rtz/.sjs files?
« Reply #2 on: December 19, 2014, 12:44:28 am »
Oh, the place I got the script program from also had a file with items/weapons/etc., though it's not fully translated, and I don't know how they got the information, or how to insert it into the game anyway...I'm glad there's other people working on this though! I've only translated a little past the prologue so far, myself.

pablitox

  • Full Member
  • ***
  • Posts: 106
    • View Profile
Re: DS .rtz/.sjs files?
« Reply #3 on: December 30, 2014, 07:37:54 pm »
Thanks to darthnemesis, they could find the data, it's stored in the arm9.bin
Re taking hajimari no ishi!

pablitox

  • Full Member
  • ***
  • Posts: 106
    • View Profile
Re: DS .rtz/.sjs files?
« Reply #4 on: March 06, 2015, 08:16:22 am »
Sorry for bumping but I would like to know how to edit arm 9 to translate items, summons etc
Re taking hajimari no ishi!

FAST6191

  • Hero Member
  • *****
  • Posts: 3100
    • View Profile
Re: DS .rtz/.sjs files?
« Reply #5 on: March 06, 2015, 09:08:31 am »
Editing binaries is potentially annoying on the DS.

The DS ARM9 and ARM7 binaries are copied into memory on boot of the game and stay there until the end, I have not seen any evidence of self altering code but it is not impossible. When new code wants to be loaded in the DS commercial games employ so called overlays. The overlay system involves a section of memory that is set aside and premade code fragments are loaded in as necessary Some games have just one overlay section, others can have many at different locations.
Equally the ARM7 binaries in commercial games are typically a type of reference library, indeed you can even swap the ARM7 between games of a similar vintage and it will typically carry on working. Not much game code happens in them but they are a nice place to hook.

DS binaries and overlays can be compressed. They use a custom type of compression most refer to either as DS binary compression or more accurately as a type of BLZ (backwards LZ, mainly as it starts from the end and works backwards in a file). The compression tends to be noted in the overlay table so you can disable compression that way. DS binary compression is well documented though. http://www.romhacking.net/utilities/826/ has decompression and compression tools (and source code) and crystaltile2 has support as well, though I will note I have had a few false positives with CT2.

I have never seen encryption or true obfuscation in DS binaries, some types of anti piracy used binary checksums and some AP itself had minor obfuscation, and you have the usual thing either bad coders or cheat prevention coding practices do. This should not trouble text editing though.

Once you have a decompressed binary you are not quite out of the woods. The two main problems will be you are probably back using classical memory aware pointers as opposed to the common DS/filesystem using console method of file level pointers.
http://problemkaputt.de/gbatek.htm , specifically http://problemkaputt.de/gbatek.htm#dsmemorymaps is something you can all read though. DS binaries do not always get put at the start of memory but most assembly tools will handle this and the locations are stored in the  header (and ct2, ndsts http://www.no-intro.org/tools.htm and whatever else will all tell you what goes there).
Theoretically you can still encounter more file level pointers, calculated/referencing pointers and whatever else but I would not go there.

The bigger problem tends to be finding space to do what you want. If you are translating Japanese to something that does not have a massive character set then you can do an 8 bit conversion. Otherwise you get to find space in the memory somewhere (easier said than done if you need it to be available all the time) https://gbatemp.net/threads/unofficial-desmume-build-unused-memory-finder-tool.349332/ has something, my personal favourite is to look for the wifi error codes as they are often long and fairly pointless (especially now DS wifi is down and the only people really using the alternatives should already know what goes). A slightly less fancy tool is deadbeef padding, http://filetrip.net/nds-downloads/utilities/download-dsatm-4-3-4-f27609.html will attempt to flood fill the memory with DEADBEEF so whatever still has it however far into the game

Theoretically you could use your own overlay, most people tend to be discouraged from this in favour of dragging their own code in manually though.

If you want to get really flash then the GBA slot is available and memory mapped. This can give you a nice 32 megs of read only memory at fairly low latency (though access times are still notably higher than CPU to normal memory). Equally it might trouble various users of your hack, though technically it would be hardware compliant.

Oh and it does not sound like it in this case but several games on the DS used various interpreted languages (commonly Lua) so more dynamic memory allocation is not unheard of.

That was the long and hard version, you might still face compression but that is easily sorted. If you can instead keep the lengths the same (or shorter and pad it out) then that is often a better method, find yourself a thesaurus and possible figure out how to do dual tile encoding for the fonts you have.

pablitox

  • Full Member
  • ***
  • Posts: 106
    • View Profile
Re: DS .rtz/.sjs files?
« Reply #6 on: March 07, 2015, 01:23:13 am »
Well that was useful! i think it was compressed as you mention, so, when I decompress it comes the translatioon and then recompressing and saving back, i will try to not use much space, but i fear there will be some pointers to change here and there, might need to learn about that stuff, I am kind of a noob at those things.

Thank you!
Re taking hajimari no ishi!