Closed thajunk closed 8 years ago
@thajunk from what I see, the scripts for this game are located in bsxx.dat
. I'm afraid I can't be of much help when it comes to decoding this specific file. I'll add support for media, e.g. .bsa
archives and .bsg
images (the audio is stored as OGG.)
As for the script file: it looks like it's divided into few parts - opcodes (game logic expressed as 4 byte integers), followed by some unknown structures, followed by all the text. The text is encoded as UTF16 little endian. The file is unecrypted. Proof - you can pass the file through iconv
- sample output of iconv -f=utf16le bsxx.dat -c
:
ใฃ๐ใๆๅณใ็่งฃใใๆงๆชใช็ฌใฟใงใใชใใใไฟบใใกใฏ่ฆ็ทใ้จๅฎคใซๆปใใใใใ ใโฆโฆใชใใฃโฆโฆ๏ผใใใใซใฏ้ ใใฆใชใใฃใฆใใใฎใฃโฆโฆ๏ผใไธๅบฆ่ฆใใฏใใฎใญใใซใผใไฝๅบฆใ่ชฟใน็ดใใๆ็ถใจใใ้กใงใคใถใใใใใชใๅ็พฝ่ฉฐใพใฃใฆใใใใใ ใใใโฆโฆใใฎ้ตโฆโฆ๏ผ ใใฎ้ตใฏใพใ ใไฝฟใฃใฆใชใใฃโฆโฆใ้ตๆใ่ฆใคใใฆๅใใๆญขใใใจใๅ้ณใฏๆๅพ ใฎใใใฃใ็ฎใง้จๅฑใฎไธญใ่ฆๆธกใใใใใใฎๆบโฆโฆ๏ผใใพใ ๆใใคใใฆใใชใใฃใใ้จๅฑใฎ้ ใฎไบๅๆบใซๆฅใใง้งใๅฏใฃใฆใใใใใฉใฎใๅผใๅบใโฆโฆใใฃใใใใฃ๏ผใใฌใใฃใฌใใฃใจ้ณใ ใใใฆใๆบใฎไธ็ชไธใซใใๅคงใใชๅผใๅบใใธ้ตใๅทฎใ่พผใใใ้ใใใฃ๏ผใ้ตใฎ้ใ้ณใซใๅ้ณใฏๆญๅใฎๅซใณใใใใใใใใใ ใใ้้ใใชใใฃ๏ผใใฌใฉใชใจๅผใๅบใใ้ใใใใฎไธญใใ็บ่ฆใใใซใกใฉใจใกใขใชใผใซใผใใๅใไธใใฆใๅฐ่บใใใใใใซ่บซไฝใ ใใใใใโฆโฆใๅฎ็บ่ฆใใใใงใจใใใใใใใใๅคฉๅฝใใๅฐ็ใธๅ ใกใฆใใใใโฆโฆ๏ผไฟบใฏๆ็พใซ็ฎใงๅๅณใ้ใใจใ้จๅฎคใฎๆธใซๆใไผธใฐใใใใใใใใใๅญฆ็ไผ้ทใใใ้จๅฎค่ใใใชใใใใฉใใใใคใใใ ๏ผใใใใ๏ผ๏ผใ\Aใใใฃโฆโฆใฉใใใฆใใใใซโฆโฆใฃ ๏ผใใใใคใใใผใบ๐ใ่ใใใใ้จๅฎคใจๅใใคใๅ้ณใใไฟบใฎ่ๅพใใ็พใใๆ็พใๆบๅธฏใง้ฃๅใใใใใใใใฃใใใใฃใใใฃโฆโฆใใใ้ซๆดฅๅ ็ใโฆโฆ๏ผ๏ผใใซใทใฃใใใซใทใฃใใจๆบๅธฏใฎใซใกใฉใฎ้ณใ้ฟใไธญใๅ้ณใฏๅ็ถใจใใฎๅ ดใง็ซใกๅฐฝใใใใใใใผใใผใใ ใใถใๆดพๆใซ่ใใใฆใใใใใใ ใชใใใพใใซใใใฎๆใซๆใฃใฆใใใขใโฆโฆใใใใฉใใใใคใใใ ใฃใใใ ๏ผใใๅคฉๅใใโฆโฆใพใใ็ใใคใใใ ใฃใใฎ๏ผใใใใซใใฉใใใฆ้จๅฎคใซๅ ฅใใใฎใใใโฆโฆ๏ผใ้ตใฏ็งใไฟ็ฎกใใฆใใใฏใใชใฎใซโฆโฆใใใฏใใโฆโฆใใฃใ ใโฆโฆใใใพใใฎๆฅๅฑ้ใซๅ้ณใฏ้ ญใใคใใฆใใใชใๆงๅญใงใไฝใ่จใใใใใ ใใ ่บซไฝใ้ใใใฆใใใไฟบใฏใใใชๅ้ณใซใๅใก่ชใฃใ็ฌใฟใๅใใใใใตใตใใๆฎๅฟตใ ใฃใใชใใๅใฎ่ใใชใใใใในใฆใ่ฆ้ใใ ใฃใใใ ใใใใใฃโฆโฆ๏ผใๅพๆๆฐใชไฟบใฎๅฐ่ฉใซ ๆ็พใ้ใฎๆใใๅฃฐใๆใใงใใใใใงใใ\Bใใใๅฅใซใใใพใง่ชญใใฆใใใใใโฆโฆใ\sใใใซใฃโฆโฆไฝ่จใชใใจ่จใใชใใใใใใฎใฏใชใ็ธๆใ่ชๅใใไธๆใ ใฃใฆใๅฐใใงใๆใใใฆใใใๆนใใใใใ ใใไฝ่จใชใใใณใใๅ ฅใใๆ็พใซใๆ ใฆใฆๅฐๅฃฐใงๆณจๆ ใใ\sใใใฃใใใฃใใ\sใใใใฃใใใฃใใใใใชใใฃใฆใฎโฆโฆใใใตใตใตใฃใๆฎๅฟตใ ใฃใใญๅคฉๅใใใๅฝผใฏใใ่ฆใใฆใใใฃใใใญใฌ่ ใชใใ ใใโชใๆนใใฆๅ้ณใซ่ธใๅผตใๆ็พใใใฃใใใฎๆฑบใใทใผใณใใๅฐใชใใซใชใฃใๆฐใใใใโฆโฆใใ โฆโฆโฆโฆใ ใ ใฃโฆโฆใใใชโฆ ใ ใฃใใ ใ ใฃโฆโฆโฆโฆโฆโฆใไปใฎๅ้ณใซใฏใใใใชใใๅใใๆฐใซ็ใใไฝ่ฃใชใฉใใพใฃใใใชใใใใ ใไธกๆใซ่จผๆ ๅใๆใฃใใพใพใใใ ่จ็ปใๅคฑๆใใใใจใๅใใๆใๆถใ็ฎใซๆตฎใในใชใใ่ฉใๆบใใใฐใใใ ใฃใใใใใใซใใฆใใใทใงใใฏ๏ฝโฆโฆใพใใใๅคฉๅใ ใๆณฅๆฃใชใใใใใชใใฆโฆโฆใใใใใใ็งใฎๆบใใโฆโฆใใฃใใฃใๅ ็ใๅนปๆป ใใกใใฃใใใใใใ โฆโฆใชใไฝใ่จใฃใฆใใใงใใใฃโฆโฆ็งใๆณฅๆฃใชใใใใโฆโฆ๏ผใใฒใใฒใฉใใงใโฆโฆ้ซๆดฅๅ ็ใใใใใฃใฆใใใใซโฆโฆใๅผฑใ ใใๅฃฐใงๅ่ซใใใใพใ ๅฎๅ จใซใฏใๅฟใฏๆใใฆ ใชใใใใใใใใใใใใฎๅ็ใฏไฝใชใฎ๏ผใๆ็พใฏๆๅฐๆชใ็ฌใใๆบๅธฏใฎใใฃในใใฌใคใซๆ ใฃใๅ้ณใฎๅงฟใ่ฆใใณใใใใใใณใฌใใฉใ่ฆใฆใๆณฅๆฃใซใใ่ฆใใชใใใญ๏ผใไปใฎไบบใ่ฆใใใใฉใๆใใใใ๏ผใใใกใ้ใใพใใฃ๏ผใ็งใฏๆณฅๆฃใใใใใพใใใฃโฆโฆ ใใใงใใใใใๅคๆญใใใฎใฏใไปใฎๅ ็ๆนใ ใใใโฆโฆใใใใฃโฆโฆ๏ผใใใใโฆโฆ็งใ ใฃใฆ็ฉไพฟใซๆธใพใใใใใใฉโฆโฆใใฃใฑใใ็ซๅ ดไธใใณใฌใฏ่ทๅกไผ่ญฐใงๅ ฑๅใใ็พฉๅใใใใฎใใญใ๏ฝโฆโฆใใใใใใใใใคใฏ็ตใใฃใใชใๅญฆ็ไผ้ทใๆณฅๆฃใใๅๅญฆโฆโฆใใใใใ้ ๅฆๅใ ใฃใฆๅ ใใชใใ ใใใชใ๏ผใใใใใชใฃโฆโฆใใ้ๅญฆใฃใฆใฃโฆโฆใฉใใใฆใใใใชโฆโฆใฒใ่ขซๅฎณ่ ใฏใ็งใฎๆนใชใฎใซโฆโฆใๅ้ณใฎ้กใฏใฟใใฟใ่กใฎๆฐใๅคฑใใๅใใชใปใฉใซ้ใใใฆใใฃใใใใใใใ็ดๆฅใไฟบใ็ใใใใใชใใ่จผๆ ๅใซ็ใ็ตใฃใใฎใฏใใ็็ผ็น ใฃใใโฆโฆใใฉใ่ฉฐใใ็ใใฃใใใใ ใชใใใพใฃใใใใฏใใฆใใโฆโฆใ ใใๅใ่ฆๆใฏใงใใฆใใใใ ใใใช๏ผใใโฆโฆ่ฆๆใฃโฆโฆ๏ผใใๅใซใ่จใฃใใใไฟบใซ้ใใใฐใใฉใใใใณใใซใชใใโฆโฆใใใโฆโฆโฆโฆ๏ผใๅ้ณใฏใใฏใใจ้กใไธใใฆ็ฎใ่ฆ้ใใใใไฟบใฏๆ่จๅฎ ใฎ็ทใชใใ ใ็ดๆ้ใใไฟบใซ้ใใฃใ็ฝฐใจใใฆใๅ็ใจๅ็ปใฏๅ จ้จใใฉใพใใใฆใใใใ๏ผใใใใฃใใใใชใฃโฆโฆ๏ผ๏ผใใใฏใฏใฏใโฆโฆใใใใใใฎใใใใณใใซใชใใใใฉใใ ใๆณๅใงใใใ๏ผใใใชใชใใชใไฝใโฆโฆใงใใ๏ผใใๆฑบใพใฃใฆใใ ใใๅญฆๅไธญใฎ็ทๅญใซ ใๅใฎใจใญๅ็ปใใจใญๅ็ใใใฉใพใใใใใ ใ๏ผใใๆฌฒๆ ใใใใใคใใใๆๆฅใใๆฏๆฅใใๅใ็ฏใใซๆฎบๅฐใใใใ ใใฏใฏใใใใใโฆโฆใใใคใฏ่ฆ็ฉใ ใใฃ๏ผใใใใฃใโฆโฆ๏ผ๏ผใๅคงใใใจ่จใใใใใชใ่ๅ็ก็จฝใช่ ใใ ใใใใ ใงใใ็ด ็ดใชๅ้ณใฏใ่ฟฝใ่ฉฐ
Sample visual histogram of the file from which I drew my conclusion about its layout:
So your job would be to discover the nature of the structures within this file in detail. Then you'd need to get to know which opcodes mean what so that you can convert binary code into something more high-level. At very least if all you want is to translate the text, you'd need to know what references the text in the latter section, so that when you recompile the script file with your text, the game still knows which string is located where and doesn't crash. To do this, you can use a debugger and set up breakpoints:
OpenFileA
to discover where bsxx.dat
is openedReadFile
to discover where its handle is actually used (the game probably reads all the file into memory at once)bsxx.dat
, step in and out etc. This is where you get to know what actually triggered the text read, and how you could use this information to recompile the script.The fourth step is different for each game and is a very time consuming process. You could combine this approach with creating histogram of most commonly used bytes to make educated guesses about which opcode might be used to draw text etc.
As promised, I've implemented BSA and BSC archives as well as BSG image files - this is as far as we can go staying in the realm of arc_unpacker
's responsibilities.
Thank you so much, you've been a great help. Your tips are very useful. And also thanks for the BSA unpacking, you have already gone above what i expected. :)
@thajunk not sure if you're interested in binaries but nonetheless, the builds seem to have been broken for about two weeks. The build 0.10.349 should work fine.
https://vndb.org/v6357
Hello, my ultimate goal with this game is to be able to extract and inject the UI and script, however I am very new to this. I already understand that you don't do injection requests, but if you could get the script decoded and extracted that would be more than enough. If you can't help any tips or guides that have helped you in the past would be nice as well.