Skip to content

Instantly share code, notes, and snippets.

@Brawl345
Last active March 21, 2024 18:19
Show Gist options
  • Save Brawl345/aeeea1a7fcfbfa64e85bb723fe5b49ab to your computer and use it in GitHub Desktop.
Save Brawl345/aeeea1a7fcfbfa64e85bb723fe5b49ab to your computer and use it in GitHub Desktop.
Yuuki Yuuna Wa Yuusha de Aru: Jukai no Kioku Research

Yuuki Yuuna Wa Yuusha de Aru: Jukai no Kioku Research

Table of contents:

Software

Volume.dat Extracting Script

#quickbms script
#by chrrox
#AKIBAS TRIP Undead Undressed
endian BIG
get MAGIC long
get FILES long
get FILES2 long
get BASE long
get UNK long
savepos TMP
for i = 0 < files
   goto TMP
   get HASH long #?
   get OFFSET long
   get SIZE long
   get COMTYPE long
   get NAMEOFF long
   get NSIZE long
   savepos TMP
   set ZSIZE NAMEOFF
   math ZSIZE -= OFFSET
   math OFFSET += BASE
   math NAMEOFF += BASE
   goto NAMEOFF
   getdstring NAME NSIZE
   if ZSIZE == SIZE
      log NAME OFFSET ZSIZE
   else
      clog NAME OFFSET ZSIZE SIZE
   endif
next i

Extracting

  1. Use the QuickBMS script to extract the volume.dat.
  2. Merge the patch folder (?)
  3. Texts are in \lang_jp\gametext.bin and must be extracted via akibastripundeadnundressed_export.au3
  4. Edit the texts
  5. Repack with akibastripundeadnundressed_import.au3

TODO: Check if you need to repack the volume.dat

Resources

$Path = FileOpenDialog("Select the BIN file", @ScriptDir, "bin files (*.bin)",1)
If @error = 1 Then Exit
$File = fileopen($Path,16)
$Name = CompGetFileName($Path)
Dim $Text
$Files = FileRead($File,4)
If FileRead($File,4) = 0 Then
FileRead($File,8)
For $i = 1 to $Files
$Offset = FileRead($File,4)
$Size = FileRead($File,4)
FileRead($File,4)
$pos = FileGetPos($File)
FileSetPos($File,$Offset,0)
$S = ""
$Str = ""
Do
$Str &= BinaryToString($S,2)
$S = FileRead($File, 2)
Until $S = 0
$Str = StringRegExpReplace($Str,@CRLF,"<cf>")
$Str = StringRegExpReplace($Str,@LF,"<lf>")
$Str = StringRegExpReplace($Str,@CR,"<cr>")
$Text &= $Str & @CRLF
FileSetPos($File,$pos,0)
Next
Else
For $i = 1 to $Files
$Offset = _BinaryToInt32(FileRead($File,4))+8
$pos = FileGetPos($File)
FileSetPos($File,$Offset,0)
$S = ""
$Str = ""
Do
$Str &= BinaryToString($S,2)
$S = FileRead($File, 2)
Until $S = 0
$Str = StringRegExpReplace($Str,@CRLF,"<cf>")
$Str = StringRegExpReplace($Str,@LF,"<lf>")
$Str = StringRegExpReplace($Str,@CR,"<cr>")
$Text &= $Str & @CRLF
FileSetPos($File,$pos,0)
Next
EndIf
$hFile = FileOpen ($Name&".txt", 2+32)
FileWrite ($hFile, $Text)
FileClose ($hFile)
TrayTip ("Exporter", "Finish!", 3)
sleep (3000)
Func CompGetFileName($Path)
If StringLen($Path) < 4 Then Return -1
$ret = StringSplit($Path,"\",2)
If IsArray($ret) Then
Return $ret[UBound($ret)-1]
EndIf
If @error Then Return -1
EndFunc
Func _BinaryToInt32($Binary)
Return BitAND(Int(Binary($Binary)), 0xFFFFFFFF)
EndFunc
#include<File.au3>
#include<Binary.au3> ;Binary UDF, https://www.autoitscript.com/forum/topic/131037-binary-udf/
Dim $NEWdata, $f = 1, $pos = 20
$TxtPath = FileOpenDialog("Select the TXT file", @ScriptDir, "text files (*.txt)",1)
If @error = 1 Then Exit
_FileReadToArray($TxtPath,$NEWdata)
$Name = StringTrimRight(CompGetFileName($TxtPath),4)
$File = FileOpen ($Name, 0+16)
If $File = -1 Then
MsgBox(0,"Error","Can't open "&$Name&" file.")
Exit
EndIf
$Files = _BinaryToInt32(FileRead($File,4))
If FileRead($File,4) = 0 Then
FileSetPos($File,0,0)
$Offset = 16+$Files*12
$Newfile = FileRead($File,$Offset)
$pos = 17
For $i = 1 to $Files
$NEWdata[$i] = StringRegExpReplace($NEWdata[$i],"<cf>",@CRLF)
$NEWdata[$i] = StringRegExpReplace($NEWdata[$i],"<lf>",@LF)
$NEWdata[$i] = StringRegExpReplace($NEWdata[$i],"<cr>",@CR)
$NewText = StringToBinary($NEWdata[$i],2) & Binary("0x00000000")
$Len = BinaryLen($NewText)
$Newfile &= $NewText
$Newfile = _BinaryPoke($Newfile,$pos,$Offset,"dword")
$Newfile = _BinaryPoke($Newfile,$pos+4,$Len,"dword")
$Offset += $Len
$pos += 12
Next
Else
FileSetPos($File,0,0)
$Offset = $Files*4
$Newfile = FileRead($File,$Offset+8)
$pos = 9
For $i = 1 to $Files
$NEWdata[$i] = StringRegExpReplace($NEWdata[$i],"<cf>",@CRLF)
$NEWdata[$i] = StringRegExpReplace($NEWdata[$i],"<lf>",@LF)
$NEWdata[$i] = StringRegExpReplace($NEWdata[$i],"<cr>",@CR)
$NewText = StringToBinary($NEWdata[$i],2) & Binary("0x0000")
$Len = BinaryLen($NewText)
$Newfile &= $NewText
$Newfile = _BinaryPoke($Newfile,$pos,$Offset,"dword")
$Offset += $Len
$pos += 4
Next
EndIf
$hNewfile = FileOpen ("NEW_"&$Name, 2+16)
FileWrite ($hNewfile, $Newfile)
FileClose ($hNewfile)
TrayTip ("Importer", "Finish!", 3)
sleep (3000)
Func CompGetFileName($Path)
If StringLen($Path) < 4 Then Return -1
$ret = StringSplit($Path,"\",2)
If IsArray($ret) Then
Return $ret[UBound($ret)-1]
EndIf
If @error Then Return -1
EndFunc
#quickbms script
#by chrrox
#AKIBAS TRIP Undead Undressed
endian BIG
get MAGIC long
get FILES long
get FILES2 long
get BASE long
get UNK long
savepos TMP
for i = 0 < files
goto TMP
get HASH long #?
get OFFSET long
get SIZE long
get COMTYPE long
get NAMEOFF long
get NSIZE long
savepos TMP
set ZSIZE NAMEOFF
math ZSIZE -= OFFSET
math OFFSET += BASE
math NAMEOFF += BASE
goto NAMEOFF
getdstring NAME NSIZE
if ZSIZE == SIZE
log NAME OFFSET ZSIZE
else
clog NAME OFFSET ZSIZE SIZE
endif
next i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment