Hacking ROM Hack Translation Pocket R , help, How to decompress the Zlib deflate, the RDI and RDB file

game2005

New Member
OP
Newbie
Joined
Mar 24, 2022
Messages
2
Trophies
0
Age
35
Location
Taiwan
XP
83
Country
Taiwan
Hello everyone and experts
I am trying to translate the Pure JAPESE BASEBALL GAME ,Pocket R.(p.s. because I want translate the text into chinses to enjoy the story mode in the game, but kenami, seem to keep the game in Japanese forever with no hope to have a language localization)
So I try to do some work and spent/waste a lot of time
#What I have done
For runtime dump and ELF analysis of "main.nso" . It use the SHIFT-JIS(JP) encoding for the game text. There are two regions for text
##The Region 1 : from main.nso (runtime) offset 0x1CB52E0 with Big-Endian order in two byte (dump with 26213 rows)
e.g.: 0x1811| 0x1821|オーバースロー7|8349815b836f815b8358838d815b8256
##The Region 2: from main.nso (runtime) offset 0x2634710 with Littel-Endian order in two Byte (dump with 82031 rows)
e.g.:0x7dea|0x7e08|いろいろな設定が変更できます。|a282eb82a282eb82c882dd90e892aa82cf95588dc582ab82dc82b7824281
The Region 2 is more complex, for it contains text decoration, different font colors and paragraph control , which fc05,fc08(function like <color>) and fc03(function like </color>), and ffe80*** for represent different people and school, fc00(likes <br>)
For Translation, the SHIFT-JS share words in chinese, I could use SHIFT-JS encoding for 80% of word
padding 0x00 Right to its original length, e.g. 7395a5908a919693b292718ee682b3825e90ef98428100000000000000000000 despite Region 1 or Region 2
The Region 3 is in ROMFS, I am unable to do that, which I descibe below

#What I NEED
BUT FOR the OCD!!!!!! There are things I want to overcome
1.Patch Game Font 2.ROM HACK to patch remaining text <===Solving the Zlib inflate

## the GAME text ENCODING SHJIT-JIS only support to its level I, which mean it could only display the Text to 0x98x72, who over this hex value would show 〓. I found it limited by the game font(see the FNTL 28 pixel in width, and FNTS 22 pixel in width) the dump area seem not to be a actual font file but already extracted for GPU rendering
So, I dump the romfs and showed RES00.RDI(223KB,0x37a00), RES00.RBI(2.91 GB), and other sound file. The key would in the RES00.RDI and RES00.RDB.
RES00.RDI would be index file for RES00.RDB but both file seem to be zlib compressed
With IDA pro analysis. The main.nso own its ZLib function rather then import, which the inner code indentical to the SDK.nso
With analysis. I guess the step would be FileInfalteThread ==> FileThread==>read RES00.RDI==>UnCompress: **utilZlib_inflateInit2_(zstrm, 15, "1.2.11.f-N***-SDK-v1", 0x70)==>**utilZlib_inflate(__int64 a1, int *a2, int *a3, int *a4, int *a5, int *a6).
I could observe the UN_RDI(size 0x37a00) on runtime. The result look like a address table with total 8480 chunk( I Guessed map to RDB file).
But I have no idea how it inflate out. I have tried offzip with -z 15, -z -15 but only unrecognized hex. I dont know If zlib needed to provide extra parameters or byte for zlib inflate).

I am the not in IT/Game field and new to zlib, and very poor level in Japanese. I just want to enjoy the game with my native language, I need you experts help, thanks
Sincerely game 2005
 

Attachments

  • ORI_RDI.png
    ORI_RDI.png
    87.6 KB · Views: 75
  • UN_RDI.png
    UN_RDI.png
    57.4 KB · Views: 79
  • FNTL.PNG
    FNTL.PNG
    15.2 KB · Views: 73
  • FNTS.PNG
    FNTS.PNG
    12.5 KB · Views: 72
  • Like
Reactions: Yanda

game2005

New Member
OP
Newbie
Joined
Mar 24, 2022
Messages
2
Trophies
0
Age
35
Location
Taiwan
XP
83
Country
Taiwan
Update!
I found out the Encrypt method.
It use the keygen by the resource name "RES00.RID" then generate a 4 Bytes RDI_KEY
and as CHUNK resource like "CESAWARN.CHK" to get a mCHK_KEY, then use it to XOR with RDI_KEY to generate a 4 Bytes CHK_KEY
By using the CHK_KEY with XOR and bit shift to generate a 0x100 Bytes Keyblock to encrypt/decrypt the original CHK data
After the Keyblock encryption/decryption. The first 0x20 Byte showed the the CHUNK information, including the CHKNAME, , compressed chunk size and decompressed chunk size. and the remained binary is the zlib Deflate data with windowbit -15. you can use "offzip -z -15 -a result.chk" to get the original chunk
The RDB Offset information of CHUNK is in RDI2(the decrypted RDI).
 
Last edited by game2005,
  • Like
Reactions: Yanda

Yanda

Well-Known Member
Member
Joined
Aug 26, 2015
Messages
140
Trophies
0
XP
705
Country
Update!
I found out the Encrypt method.
It use the keygen by the resource name "RES00.RID" then generate a 4 Bytes RDI_KEY
and as CHUNK resource like "CESAWARN.CHK" to get a mCHK_KEY, then use it to XOR with RDI_KEY to generate a 4 Bytes CHK_KEY
By using the CHK_KEY with XOR and bit shift to generate a 0x100 Bytes Keyblock to encrypt/decrypt the original CHK data
After the Keyblock encryption/decryption. The first 0x20 Byte showed the the CHUNK information, including the CHKNAME, , compressed chunk size and decompressed chunk size. and the remained binary is the zlib Deflate data with windowbit -15. you can use "offzip -z -15 -a result.chk" to get the original chunk
The RDB Offset information of CHUNK is in RDI2(the decrypted RDI).
I have this game files and am interested in this topic.
What is keygen? What is the tool or code to create it?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BigOnYa @ BigOnYa:
    They're made with left over pancake/wafle batter, that's been sitting out all day.
  • BigOnYa @ BigOnYa:
    3 hours on a riding lawn mower, my butt is numb and my whole body is still vibrating. Gonna be a long summer. :cry: I just need to buy some goats.
    +1
  • SylverReZ @ SylverReZ:
    @BigOnYa, Did you leave your buttplug in?
    +2
  • BigOnYa @ BigOnYa:
    I feel like I spent the night with Ancientboi
    +3
  • Flame @ Flame:
    Ancientboi at it again.
    +2
  • Flame @ Flame:
    is it a bird is it a plane... no its Ancientboi banging your ass away !
    +3
  • K3Nv2 @ K3Nv2:
    Took along time to fit it in?
  • K3Nv2 @ K3Nv2:
    Snow days $25 on steam may grab it
  • SylverReZ @ SylverReZ:
    Measuring sizes with AncientBoi, I see.
  • K3Nv2 @ K3Nv2:
    I guess Ancientboi would be Peter
    +2
  • SylverReZ @ SylverReZ:
    Loooooool :rofl2:
  • SylverReZ @ SylverReZ:
    So true
  • BigOnYa @ BigOnYa:
    @K3Nv2 Snow Day is pretty fun. My only bitch would be the camera controls, when you move around, say down, you have to move the right stick left or right to get camera to turn and get your view, other than that I like it so far.
  • K3Nv2 @ K3Nv2:
    From what people say pvp isn't even worth it
  • BigOnYa @ BigOnYa:
    I just been playing offline, and they give you a few bots here n there on your team to help battle. I don't think it's as funny as the other games tho, more battle oriented than humor, which kinda sucks, but I'm still early in it
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, doesnt the game have a campaign mode?
  • BigOnYa @ BigOnYa:
    Yea, and co-op, but you can also start a pvp session and battle just with friends. You get special skill cards (powers) the more you play. And higher value cards, but you can only enable so many cards at a time.
  • K3Nv2 @ K3Nv2:
    If you can find enough for it
  • BigOnYa @ BigOnYa:
    Toilet paper is considered the money, you collect and buy stuff with TP, kinda funny. Graphics are def better than the other games tho, I think they used Unity 5 engine.
  • Psionic Roshambo @ Psionic Roshambo:
    Look if I zoom in enough I can see the herpes!!!
    +1
  • BigOnYa @ BigOnYa:
    In fact I'm gonna go make a drink, roll a fatty n play some, good night to all!
    +2
    Xdqwerty @ Xdqwerty: