News: 11 March 2016 - Forum Rules

Author Topic: SOLVED: Relative Search Help  (Read 763 times)

msmalik681

  • Jr. Member
  • **
  • Posts: 19
    • View Profile
SOLVED: Relative Search Help
« on: May 13, 2022, 03:31:10 pm »
Game: Shinsetsu Samurai Spirits Bushidō Retsuden
Platform: Neo Geo Cd
Solution: This game stores text in double bytes strarting from hex value 212B (8491 in decimal) with every increment it moves forward 1 tile 16x16 in the file chip000f.spr the image shown below is from the partial french to english translation.







===================================

Hi I am trying to perform my first relative search. I found a nice long string of hiragana text and I know the game uses 4 byte text encoding so I presumed I would times each value by 4 to get a relative search but its not working in Translhextion value scan relative also tried without x4 got nothing. If anyone knows what I am doing wrong please help.

Here is what I am working with:



text  し た い と い う の か
diff  12 16 02 20 02 03 25 06
difx4 48 64 08 80 08 12 100 24

01 あ
02 い
03 う
04 え
05 お
06 か
07 き
08 く
09 け
10 こ
11 さ
12 し
13 す
14 せ
15 そ
16 た
17 ち
18 つ
19 て
20 と
21 な
22 に
23 ぬ
24 ね
25 の
26 は
27 ひ
28 ふ
29 へ
30 ほ
31 ま
32 み
33 む
34 め
35 も
36 や
37 ゆ
38 よ
39 ら
40 り
41 る
42 れ
43 ろ
44 わ
45 を
46 ん
« Last Edit: May 16, 2022, 05:13:29 pm by msmalik681 »

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 895
  • I am the baldest romhacker
    • View Profile
Re: Relative Search Help
« Reply #1 on: May 13, 2022, 07:13:29 pm »
4 byte text encoding means that a single letter could be stored in 4 bytes.

For example in UTF-32 し would be 00 00 30 57.
https://www.compart.com/en/unicode/U+3057

msmalik681

  • Jr. Member
  • **
  • Posts: 19
    • View Profile
Re: Relative Search Help
« Reply #2 on: May 14, 2022, 02:53:37 am »
So is it possible to do a relative search ?

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 895
  • I am the baldest romhacker
    • View Profile
Re: Relative Search Help
« Reply #3 on: May 14, 2022, 08:13:23 am »
Yeah

msmalik681

  • Jr. Member
  • **
  • Posts: 19
    • View Profile
Re: Relative Search Help
« Reply #4 on: May 14, 2022, 09:13:45 am »
Could you point me in the right direction I am a total noob to rom hacking but it seems fun. All tutorials I found only cover how to relative search single byte roms like GG or NES.

Maybe I need a different hex editor or utility to do a 4 byte search ?

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 895
  • I am the baldest romhacker
    • View Profile
Re: Relative Search Help
« Reply #5 on: May 14, 2022, 09:31:46 am »
I never used relative search myself and don't really know any tools for that. I would write my own script for this case.

But if you already know what bytes correspond to what letters, why do you need a relative search in the first place? Just search those bytes. Searching with wildcards in 010 Editor might come in handy, since in theory you have no idea what or how many bytes are in between actual bytes for letters IDs.

msmalik681

  • Jr. Member
  • **
  • Posts: 19
    • View Profile
Re: Relative Search Help
« Reply #6 on: May 14, 2022, 03:27:06 pm »
How interesting so what language would you write a script in and do you have a example i could see ?

Tried to search for the advised hex values 00 00 30 57 with no luck. Found some results using wildcards but the random amount of bytes between values makes me think it was just coincidence.

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 895
  • I am the baldest romhacker
    • View Profile
Re: Relative Search Help
« Reply #7 on: May 14, 2022, 03:58:11 pm »
00 00 30 57 was just an example of a 4 byte text encoding. But it's not necessary that your game has the same values for letters like UTF. I was talking about your table from OP, like your confidence in decimal 12 being し for some reason. And also your confidence in the game having 4 byte text encoding.

My script would be in Lua (in fact, all my scripts are). If you're talking about my example of the relative search for 4 bytes, then I don't have one.

msmalik681

  • Jr. Member
  • **
  • Posts: 19
    • View Profile
Re: Relative Search Help
« Reply #8 on: May 14, 2022, 05:17:09 pm »
I read from someone else who started translation of this game that the text encoding was 4 bytes and if the text tiles are 16x16 but neo geo tiles are 8x8 4 bytes makes sense as its referencing 4 tiles.

With the numbers I thought with a relative search you can input any numbers it just checks difference between them. Then it will look for hex values with a matching difference.

Never tried lua do you need to run it through a specific application ?

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 895
  • I am the baldest romhacker
    • View Profile
Re: Relative Search Help
« Reply #9 on: May 15, 2022, 02:50:24 am »
I recommend using 5.3 version, since it's supported by ZeroBrane IDE. You can download lua53.dll and lua53.exe files from here
https://github.com/cyneprepou4uk/BZK-6502-Disassembler

And store them somewhere, for example in C:\Lua

Then create a text file with .lua extension and paste this code there

Code: [Select]
local txt = "Hello World"
print(txt)

for i = 1, 10 do
    print(i)
end

io.read() -- prevents console from closing

Select lua53.exe as a default aplication for .lua files, and launch your firsr script.

Download ZeroBrane from here
https://studio.zerobrane.com/

Select 5.3 version in settings after installation. This tool will help you to handle errors, because Windows console will probably close right away if something went wrong.

msmalik681

  • Jr. Member
  • **
  • Posts: 19
    • View Profile
Re: Relative Search Help
« Reply #10 on: May 16, 2022, 01:15:47 pm »
Thanks for the support, but from playing around with the emulator and some hex editing i figured out it's double byte encoded now to figure out how to get these silly pointer tables.

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 895
  • I am the baldest romhacker
    • View Profile
Re: SOLVED: Relative Search Help
« Reply #11 on: May 16, 2022, 03:15:49 pm »
Good. But you should post what you've found in OP in case someone will need it Also mention game's name and platform.

msmalik681

  • Jr. Member
  • **
  • Posts: 19
    • View Profile
Re: SOLVED: Relative Search Help
« Reply #12 on: May 16, 2022, 03:58:36 pm »
What is OP ?

FAST6191

  • Hero Member
  • *****
  • Posts: 3554
    • View Profile
Re: SOLVED: Relative Search Help
« Reply #13 on: May 16, 2022, 04:14:24 pm »
What is OP ?

Short for original poster/opening post (you are the OP of this topic, and also control the opening post), fairly common on internet discussion boards, though in gaming circles might also be used to mean overpowered but context should help with that one.

msmalik681

  • Jr. Member
  • **
  • Posts: 19
    • View Profile
Re: SOLVED: Relative Search Help
« Reply #14 on: May 16, 2022, 05:14:15 pm »
Is that good for you ?

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 895
  • I am the baldest romhacker
    • View Profile
Re: SOLVED: Relative Search Help
« Reply #15 on: May 16, 2022, 05:27:15 pm »
Yeah, file name and hex offset should be enough to get started. Posting an encoding table would be nice as well.

msmalik681

  • Jr. Member
  • **
  • Posts: 19
    • View Profile
Re: SOLVED: Relative Search Help
« Reply #16 on: May 16, 2022, 05:28:46 pm »
encoding table ? You lost me again lol

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 895
  • I am the baldest romhacker
    • View Profile
Re: SOLVED: Relative Search Help
« Reply #17 on: May 16, 2022, 06:05:49 pm »
Which bytes correspond to which letters.