NARUTO: Ultimate Ninja STORM .xfbin

How to translate the files of a game
makc_ar
Posts: 1193
Joined: Sun Aug 17, 2014 7:27 pm

NARUTO: Ultimate Ninja STORM .xfbin

Post by makc_ar »

Game: http://store.steampowered.com/app/49514 ... inja_STORM
Image

Someone tool to decrypt EN files or export_import for all?
Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

Re: NARUTO: Ultimate Ninja STORM .xfbin

Post by Ekey »

PseudoCode, a1 > Buffer, a2 > Size

Code: Select all

__int64 __fastcall sub_140510790(__int64 a1, signed int a2)
{
  __int64 v3; // r10
  signed int v4; // edi
  signed int v5; // esi
  signed int v6; // ebp
  unsigned int v7; // ebx
  char *v8; // r9
  signed int v9; // er11
  int v10; // ecx
  __int64 v11; // rdx
  __int64 v12; // rax
  char v13; // cl
  unsigned int v15; // [rsp+20h]

  v3 = a1;
  v4 = 357500045;
  v5 = 45339085;
  v6 = 1134809849;
  v7 = 1635685890;
  if ( a2 > 0 )
  {
    v8 = (char *)&v15 - a1;
    do
    {
      v9 = a2;
      v10 = v4 ^ (v4 << 11);
      v4 = v5;
      v5 = v6;
      v6 = v7;
      v7 ^= v10 ^ ((v10 ^ (v7 >> 11)) >> 8);
      if ( a2 > 4 )
        v9 = 4;
      v15 = v7;
      v11 = v9;
      if ( v9 > 0 )
      {
        v12 = v3;
        do
        {
          v13 = v8[v12++];
          *(_BYTE *)(v12 - 1) ^= v13;
          --v11;
        }
        while ( v11 );
      }
      a2 -= v9;
      v3 += 4i64;
      v8 -= 4;
    }
    while ( a2 > 0 );
  }
  return 0i64;
}
makc_ar
Posts: 1193
Joined: Sun Aug 17, 2014 7:27 pm

Re: NARUTO: Ultimate Ninja STORM .xfbin

Post by makc_ar »

Welcome back Ekey! :) Can you write a utility?
Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

Re: NARUTO: Ultimate Ninja STORM .xfbin

Post by Ekey »

Thanks :). The decrypted xfbin's of the PC version differs from the PS3 version. Seems they compressed. Anyway here test tool.
On files xflst works fine.

Code: Select all

Usage:
xfbin_test menu.xfbin menu.xfbin.dec
xfbin_test menu.xfbin.dec menu.xfbin


Example > option_button00.xflst

Code: Select all

<?xml version="1.0" ?>
<xflst>
  <xfbin name="option_button.xfbin">
Z:\char\x\option\max\steam\option_button00.mdl.xfbin
Z:\char\x\option\tex\steam\option_button03_win.tex.xfbin
Z:\char\x\option\anm\steam\option_button00.anm.xfbin
</xfbin>
<xflst>
</xflst>
makc_ar
Posts: 1193
Joined: Sun Aug 17, 2014 7:27 pm

Re: NARUTO: Ultimate Ninja STORM .xfbin

Post by makc_ar »

Thanks a lot Ekey! Double compression? Maybe footer this a header (Confusing encryption CRILAYLA)?

Image
ssh
Posts: 33
Joined: Sun Aug 17, 2014 5:50 pm

Re: NARUTO: Ultimate Ninja STORM .xfbin

Post by ssh »

This should work, didn't test it on all archives, no errors so far.
CC2_CPK_Decrypter.bms

Code: Select all

# CyberConnect2 CPK archives
# NARUTO SHIPPUDEN: Ultimate Ninja STORM 1,2,3_HD,4
comtype cpk
idstring "CPK "

endian big
set POS long 0x818
goto POS
get ROFF long
get SOFF long
goto 0x82C
get FILES long
xmath TMP "POS + SOFF"
math POS + ROFF
goto POS

if ROFF == 0x3F
  for i = 0 < FILES
   get PATHOFF long
   callfunction CC2_CPK_Encryption
  next i
else
  set PATHOFF long 0x1A
  for i = 0 < FILES
   callfunction CC2_CPK_Encryption
  next i
endif
 
startfunction CC2_CPK_Encryption
 get NAMEOFF long
 get SIZE long
 get ESIZE long
 get OFFSET longlong
 get DUMMY long
 savepos POS
 math OFFSET + 0x800
 goto OFFSET
 log MEMORY_FILE OFFSET SIZE
 
 get HDR long
 if HDR == 0x8FCF3140 || HDR == 0xF0A20061 || HDR == 0x45CD364B || HDR == 0x82C83B4F

 endian little
 
 set KEY1 long 0x617E9602
 set KEY2 long 0x154F048D
 set KEY3 long 0x154F048D
 set KEY4 long 0x617E9602
 set KEY5 long 0x02B3D1CD
 set KEY6 long 0x43A3D2F9
 
 math XSIZE = SIZE
 
 for j = 0 < SIZE
    math KEY1 u>> 0xB
    math KEY2 u<< 0xB
    math KEY2 & 0xFFFFFFFF
    math KEY2 ^ KEY3
    math KEY3 = KEY5
    math KEY5 = KEY6
    math KEY1 ^ KEY2
    math KEY6 = KEY4
    math KEY1 u>> 0x8
    math KEY4 ^ KEY1
    math KEY4 ^ KEY2
   
   if XSIZE > 4
    math XSIZE - 4
    getvarchr KEYX MEMORY_FILE j long
    math KEYX ^ KEY4
    putvarchr MEMORY_FILE j KEYX long
   else
    for k = 0 < XSIZE
      getvarchr KEYX MEMORY_FILE j byte
      math TMPK = KEY4
      math TMPK & 0xFF
      math KEYX ^ TMPK
      math KEYX & 0xFF
      math KEY4 u>> 0x8
      putvarchr MEMORY_FILE j KEYX byte
      math j + 1
    next k
   endif
   
    math KEY1 = KEY4
    math KEY2 = KEY3
 next j + 4
 endif

 math PATHOFF + TMP
 goto PATHOFF
 getct DirName string 0
 math NAMEOFF + TMP
 goto NAMEOFF
 getct NAME string 0
 
 string DirName += /
 string DirName += NAME

 if ESIZE > SIZE
   clog DirName 0 SIZE ESIZE MEMORY_FILE
 else
   log DirName 0 SIZE MEMORY_FILE
 endif
 
 endian big
 goto POS
endfunction
makc_ar
Posts: 1193
Joined: Sun Aug 17, 2014 7:27 pm

Re: NARUTO: Ultimate Ninja STORM .xfbin

Post by makc_ar »

Awesome! Thanks a lot ssh!

Someone tool export/import .xfbin files and encryption back?
Image
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Re: NARUTO: Ultimate Ninja STORM .xfbin

Post by sigroon365 »

I already told you that re-encryption does not need for translation patch as far as I remember.

2018.1.12 test
https://blog.naver.com/physics1114/221183270533
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Re: NARUTO: Ultimate Ninja STORM .xfbin

Post by sigroon365 »

Here is my export Tools. (I already sent it to you through private message on ZoG)
I already made it 2 months ago and Storm 1 Korean translation is almost finished..
But these days I'm busy with my jobs so I don't have enough time to make import tools.

naruto1_export.au3 works on itemtext.bin.xfbin, message.bin.xfbin, message_btl.bin.xfbin
TelopBin_export.au3 works on dioramaTelopBin.xfbin, iaTelopBin.xfbin, movieTelopBin.xfbin, spSkillTelopBin.xfbin

By the way, MissionInfo.bin.xfbin is a mess. My tool only works on PS3 JPN. But it will reads on PC.
For make export tool for PC(MissionInfo.bin), one have to change my source code.
zexl
Posts: 13
Joined: Wed Jan 27, 2016 1:26 am

Re: NARUTO: Ultimate Ninja STORM .xfbin

Post by zexl »

How to export all xfbin??
sergop
Posts: 125
Joined: Mon Jul 31, 2017 2:28 am

Re: NARUTO: Ultimate Ninja STORM .xfbin

Post by sergop »

sigroon365 wrote:Here is my export Tools. (I already sent it to you through private message on ZoG)
I already made it 2 months ago and Storm 1 Korean translation is almost finished..
But these days I'm busy with my jobs so I don't have enough time to make import tools.

naruto1_export.au3 works on itemtext.bin.xfbin, message.bin.xfbin, message_btl.bin.xfbin
TelopBin_export.au3 works on dioramaTelopBin.xfbin, iaTelopBin.xfbin, movieTelopBin.xfbin, spSkillTelopBin.xfbin

By the way, MissionInfo.bin.xfbin is a mess. My tool only works on PS3 JPN. But it will reads on PC.
For make export tool for PC(MissionInfo.bin), one have to change my source code.

Hey have you made any tools for reimporting? Or are there any tools for that?