Page 1 of 1

Dark Souls - BND Import [XBOX360]

Posted: Tue Dec 23, 2014 3:53 pm
by AniFox
Please help me with importing the files back to the BND. Found this script, but it is only for the PC version. The only difference between the PC and XBOX, it's endiand. In the XBOX 360 uses a large endiand. Please, help me with convert this script under XBOX 360.

Sorry for my bad English.

Code: Select all

$bndpath = FileOpenDialog("Select the BND file", @ScriptDir, "bnd files (*.bnd)", 1)
If @error = 1 Then Exit
$bndfile = FileOpen($bndpath, 16)
$dir = FileSelectFolder("Select the folder...", "", "", @ScriptDir)
If $dir = "" Then
	Exit
EndIf
Dim $names, $pos = 33
_filereadtoarray($dir & "\" & "names.txt", $names)
FileSetPos($bndfile, 20, 0)
$baseoffset = _binarytoint32(FileRead($bndfile, 4))
$basepad = 16 - Mod($baseoffset, 16)
If $basepad < 16 Then
	$baseoffset += $basepad
EndIf
FileSetPos($bndfile, 0, 0)
$newfilehead = FileRead($bndfile, $baseoffset)
$newfiletext = Binary("0x00")
For $i = 1 To $names[0]
	$file = FileOpen($dir & "\" & $names[$i], 0 + 16)
	$size = FileGetSize($dir & "\" & $names[$i])
	$padding = 16 - Mod($size, 16)
	If $padding < 16 Then
		$newfiletext &= FileRead($file) & _binaryrandom($padding, 0, 0)
	Else
		$newfiletext &= FileRead($file)
	EndIf
	$newfilehead = _binarypoke($newfilehead, $pos + 4, $size, "dword")
	$newfilehead = _binarypoke($newfilehead, $pos + 8, $baseoffset, "dword")
	$newfilehead = _binarypoke($newfilehead, $pos + 20, $size, "dword")
	$pos += 24
	If $padding < 16 Then
		$baseoffset += $size + $padding
	Else
		$baseoffset += $size
	EndIf
	FileClose($file)
Next
$hnewfile = FileOpen(compgetfilename($bndpath), 2 + 16)
FileWrite($hnewfile, $newfilehead & BinaryMid($newfiletext, 2))
FileClose($hnewfile)
TrayTip("Importer", "Finish!", 3)

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

Re: Dark Souls - BND Import [XBOX360]

Posted: Tue Dec 23, 2014 3:55 pm
by AniFox
An additional attach BND example of a PC.

Re: Dark Souls - BND Import [XBOX360]

Posted: Wed Dec 24, 2014 10:57 am
by swuforce
AniFox wrote:Please help me with importing the files back to the BND. Found this script, but it is only for the PC version. The only difference between the PC and XBOX, it's endiand. In the XBOX 360 uses a large endiand. Please, help me with convert this script under XBOX 360.
Tell me the site name, where you found this script, please.

Re: Dark Souls - BND Import [XBOX360]

Posted: Wed Dec 24, 2014 1:05 pm
by AniFox
swuforce wrote:
AniFox wrote:Please help me with importing the files back to the BND. Found this script, but it is only for the PC version. The only difference between the PC and XBOX, it's endiand. In the XBOX 360 uses a large endiand. Please, help me with convert this script under XBOX 360.
Tell me the site name, where you found this script, please.
From your post on Xentax. From this link: https://www.sendspace.com/file/cbhe3v

In this link you give autoit3 exe. A code autoit is not encrypted. I'm got a source code using a decompiler. I guess I had to ask permission. I need to remove the code?

Re: Dark Souls - BND Import [XBOX360]

Posted: Wed Dec 24, 2014 2:29 pm
by TON
Agree. An unpack/repack script for Dark Souls Xbox360 version would be awesome.

Re: Dark Souls - BND Import [XBOX360]

Posted: Thu Dec 25, 2014 10:28 am
by RangerRus
Dark Souls BND files is the same as in Demon's Souls (PS3), as I remember since I had work on translation PS3 version DS to Russian.
Try to search public tools for Demon's Souls.