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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Nagato

Pages: [1]
1

Doman's Revenge (Ayakashi no Shiro)
Genre: Old School Dungeon Crawler/RPG
Release date: May 25, 1990

summvs, the translator for Nanashi no Game (The Nameless Game), got in contact with me last week saying he wanted to work on another translation project together. In less than a week we've gone from "hey, would you be interested in working on this?" to having a full translation complete and ready for some play testing!

So right now we're looking for a few people who wouldn't mind playing through the game and give us a report on if anything is buggy or broken. If you're interested then please leave a comment here or send a message to me or summvs.

This post will be updated at a later date to include download links when we're ready for a full release.
We've also made a thread over at GBATemp but I figured Romhacking.net would be more friendly to Gameboy translations projects.

Screenshots:
Spoiler:



2
Programming / Fuzzy string search tool
« on: August 06, 2014, 11:02:34 am »
I'd like some feedback on a tool I made before submitting this to the utilities database if anyone has some free time and is interested.

I started development on this tool last night after playing around with a GBC game I've been interested in for a while. The tool itself might be a bit specific in its usage, but it was enough for me to find what I needed. The reason I wanted to make the tool is because I wanted to find the strings in a certain Japanese GBC game, but I don't have much experience with reverse engineering GBC games and I didn't know what kind of character encoding the game was using. I looked in the tile viewer and saw the entire character set so I made a table and then wrote this tool to do a fuzzy string search. Turns out that the table I wrote was mostly right (most of the text in the game started at index 0), but not all of the text, so it was still useful for finding those odd strings. You can see an example at the bottom of my examples where the base of the character encoding starts at index 0xb0 but my tool is still able to interact with it. The search and replace functions are able to determine what index the character encoding starts at automatically, so they can be used to search/replace every instance in the ROM.

Admittedly I didn't do too much searching to see if there were already popular tools like this, but is it something that would be useful for anyone?
Does anyone have any suggestions/improvements/comments they could offer?
Are there any obvious bugs or crashes that I forgot to handle?

The tool is written in C# (min .NET 3.5) entirely open source, licensed under the MIT license and put on Github: https://github.com/polaris-/romtool-textutil
Binaries can be found here: https://github.com/polaris-/romtool-textutil/releases
I'm willing to accept pull requests if anyone wants to add their own features or bugfixes.

I've included the charset.xml for the game I was working on in the release file. It can be used as an example of how to make your own charset.xml. Sorry for the Xml. :(
The Index field can be in base 10 or base 16 (must be prefixed with 0x). The Character field can be a string of any length.

Edit just for more clarification in case I didn't state it clearly: The charset.xml does not have to be the exact character table. If, for instance, you know that A comes before B, which comes before C, you could define it as A = 0, B = 1, C = 2, then search for "ACBAC" and it'll search the entire ROM for any sequence of bytes that match the pattern x+0 x+2 x+1 x+0 x+2, where x is an unknown shared based index. Everything is relative here so A could be 15, B could be 16, and C could be 17 and it should still work.

How to use with detailed examples with results:
Code: [Select]
Usage:
search - Searching for string with unknown base offset
        romtool-textutil.exe search (datafile.bin) (search string)
        Ex: romtool-textutil.exe search rom.gbc "Hello!"

convert - Convert string using given base
        romtool-textutil.exe convert (string) (charset base)
        Ex: romtool-textutil.exe convert "Hello!" 145

gentable - Generate Thingy table based on character mapping with base offset added
        romtool-textutil.exe gentable (output.tbl) (charset base)
        Ex: romtool-textutil.exe gentable output.tbl 145

replace - Replace text of even or less length
        romtool-textutil.exe replace (datafile.bin) (outputfile.bin) (search string) (replace string)
        romtool-textutil.exe replace rom.gbc rom2.gbc "Hello!" "World!"

forcereplace - Force replace text of a greater length
        romtool-textutil.exe forcereplace (datafile.bin) (outputfile.bin) (search string) (replace string)
        romtool-textutil.exe forcereplace rom.gbc rom2.gbc "Hello!" "Overwritten"

display - Convert the string at the given address to plaintext
        romtool-textutil.exe display (datafile.bin) (hex address) (length) (charset base)
        romtool-textutil.exe forcereplace rom.gbc ce9fa 8 0

Finding arbitrary string in ROM based on character table:
Code: [Select]
C:\Projects\romtool-textutil\romtool-textutil\bin\Debug>romtool-textutil.exe search rom.gbc "はじめから"
Searching for 'はじめから' in rom.gbc...
Searching for pattern:
00000000 | 1a 39 22 06 27

Found 3 matches:
Character Base: 00
0006d443 | 1a 39 22 06 27 00 02 07 1f 0d fe e1 14 00 ec ff
0006d453 | 55 4c 2d 00 14 28 1a 3a 0c 10 19 1a fd 4d 4f 74

Character Base: 00
0007b939 | 1a 39 22 06 27 fe 0b 0f 2c 15 02 0a 14 40 0d fc
0007b949 | 5c 99 6b 33 fd 02 2f 47 02 15 27 00 0b 0f 2c 15

Character Base: 00
000ce81b | 1a 39 22 06 27 ff ff 12 3f 07 06 27 ff ff 9a a0
000ce82b | 9e a7 ad cb fd 9c a5 9a ac ac cb fd a2 9d 00 00

Convert string to use character table encoding:
Code: [Select]
C:\Projects\romtool-textutil\romtool-textutil\bin\Debug>romtool-textutil.exe convert "Hello, world!" 0
00000000 | a1 9e a5 a5 a8 ff 00 b0 a8 ab a5 9d c2

C:\Projects\romtool-textutil\romtool-textutil\bin\Debug>romtool-textutil.exe convert "Hello, world!" 10
00000000 | ab a8 af af b2 09 0a ba b2 b5 af a7 cc

Generate Thingy table using character table:
Code: [Select]
C:\Projects\romtool-textutil\romtool-textutil\bin\Debug>romtool-textutil.exe gentable output.tbl 0
Generated new file output.tbl with 236 entries.

Replace text of equal or less length:
Code: [Select]
C:\Projects\romtool-textutil\romtool-textutil\bin\Debug>romtool-textutil.exe replace rom.gbc rom2.gbc "はじめから" "Start"
Replacing 'はじめから' with 'Start' in rom.gbc...
Character Base: 00
0006d443 | 1a 39 22 06 27 00 02 07 1f 0d fe e1 14 00 ec ff
0006d453 | 55 4c 2d 00 14 28 1a 3a 0c 10 19 1a fd 4d 4f 74
->
0006d443 | ac ad 9a ab ad 00 02 07 1f 0d fe e1 14 00 ec ff
0006d453 | 55 4c 2d 00 14 28 1a 3a 0c 10 19 1a fd 4d 4f 74

Character Base: 00
0007b939 | 1a 39 22 06 27 fe 0b 0f 2c 15 02 0a 14 40 0d fc
0007b949 | 5c 99 6b 33 fd 02 2f 47 02 15 27 00 0b 0f 2c 15
->
0007b939 | ac ad 9a ab ad fe 0b 0f 2c 15 02 0a 14 40 0d fc
0007b949 | 5c 99 6b 33 fd 02 2f 47 02 15 27 00 0b 0f 2c 15

Character Base: 00
000ce81b | 1a 39 22 06 27 ff ff 12 3f 07 06 27 ff ff 9a a0
000ce82b | 9e a7 ad cb fd 9c a5 9a ac ac cb fd a2 9d 00 00
->
000ce81b | ac ad 9a ab ad ff ff 12 3f 07 06 27 ff ff 9a a0
000ce82b | 9e a7 ad cb fd 9c a5 9a ac ac cb fd a2 9d 00 00

Generated new file rom2.gbc.
Code: [Select]
C:\Projects\romtool-textutil\romtool-textutil\bin\Debug>romtool-textutil.exe replace rom.gbc rom2.gbc "はじめから" "Start Game"
Replacing 'はじめから' with 'Start Game' in rom.gbc...
ERROR: Length of replacement string (10) is greater than the length of the original string (5).
Use forcereplace if this was intentional.

Replace text of greater length:
Code: [Select]
C:\Projects\romtool-textutil\romtool-textutil\bin\Debug>romtool-textutil.exe forcereplace rom.gbc rom2.gbc "はじめから" "Start Game"
Replacing 'はじめから' with 'Start Game' in rom.gbc...
Character Base: 00
0006d443 | 1a 39 22 06 27 00 02 07 1f 0d fe e1 14 00 ec ff
0006d453 | 55 4c 2d 00 14 28 1a 3a 0c 10 19 1a fd 4d 4f 74
->
0006d443 | ac ad 9a ab ad 00 a0 9a a6 9e fe e1 14 00 ec ff
0006d453 | 55 4c 2d 00 14 28 1a 3a 0c 10 19 1a fd 4d 4f 74

Character Base: 00
0007b939 | 1a 39 22 06 27 fe 0b 0f 2c 15 02 0a 14 40 0d fc
0007b949 | 5c 99 6b 33 fd 02 2f 47 02 15 27 00 0b 0f 2c 15
->
0007b939 | ac ad 9a ab ad 00 a0 9a a6 9e 02 0a 14 40 0d fc
0007b949 | 5c 99 6b 33 fd 02 2f 47 02 15 27 00 0b 0f 2c 15

Character Base: 00
000ce81b | 1a 39 22 06 27 ff ff 12 3f 07 06 27 ff ff 9a a0
000ce82b | 9e a7 ad cb fd 9c a5 9a ac ac cb fd a2 9d 00 00
->
000ce81b | ac ad 9a ab ad 00 a0 9a a6 9e 06 27 ff ff 9a a0
000ce82b | 9e a7 ad cb fd 9c a5 9a ac ac cb fd a2 9d 00 00

Generated new file rom2.gbc.

Display arbitrary binary data using character table:
Code: [Select]
C:\Projects\romtool-textutil\romtool-textutil\bin\Debug>romtool-textutil.exe display rom.gbc 0007b939 0x32 0
00000000 | 1a 39 22 06 27 fe 0b 0f 2c 15 02 0a 14 40 0d fc
00000010 | 5c 99 6b 33 fd 02 2f 47 02 15 27 00 0b 0f 2c 15
00000020 | 02 fe 0a 14 3d 15 fc ec eb 2a 2e 27 08 15 41 c9
00000030 | c9 c9
Plaintext: はじめから さそわないことです チームが いっぱいなら さそわない ことだな   れんらくなど・・・
Code: [Select]
C:\Projects\romtool-textutil\romtool-textutil\bin\Debug>romtool-textutil.exe display rom.gbc 0xd11ca 20 0xb0
00000000 | c5 cf b4 29 03 0e 02 c8 de da 79 b2 0f 02 07 04
00000010 | be b2 f5 c2
Plaintext: なまえ    ねんれ い    せいべつ

Pages: [1]