READ THE RULES: Click here

Follow us on Facebook: https://www.facebook.com/xentax/ :)

Need For Speed: The Run [.SB & .TOC]

The Original Forum. Game archives, full of resources. How to open them? Get help here.
Axsis
advanced
Posts: 48
Joined: Fri Oct 21, 2011 12:55 pm
Has thanked: 2 times
Been thanked: 20 times

Re: Need For Speed: The Run [.SB & .TOC]

Post by Axsis » Thu Dec 01, 2011 3:38 am

As I promised, the unpacked UI.sb, with bundles, that needs further reversing and unpacking (but format is not very complicated at first look):
http://www.multiupload.com/KU6463PF11
BMS script is still buggy (bundles unpacking part is ok, but chunks unpacking isn't), so I'm not going to post it now. Maybe, if I finish it, I'll post it. :bleh:
A small bonus: http://www.multiupload.com/CT1O4ALM35
Convert it to .avi with eaconv.exe :wink:
Last edited by Axsis on Wed Dec 14, 2011 5:29 pm, edited 1 time in total.

OrangeC
double-veteran
double-veteran
Posts: 860
Joined: Sun Apr 20, 2008 2:58 am
Has thanked: 5 times
Been thanked: 33 times

Re: Need For Speed: The Run [.SB & .TOC]

Post by OrangeC » Sat Dec 03, 2011 8:19 pm

Nice, can't wait for the final bms script!

xpertvision
ultra-n00b
Posts: 4
Joined: Fri Dec 09, 2011 12:14 am

Re: Need For Speed: The Run [.SB & .TOC]

Post by xpertvision » Fri Dec 09, 2011 12:20 am

cant wait to start making mods dor NFS THE RUN

i need the .sb unpacker/repacker please

many thanks ;)

sarzamin
beginner
Posts: 38
Joined: Fri Nov 19, 2010 3:19 pm
Location: Dubai
Has thanked: 3 times
Contact:

Re: Need For Speed: The Run [.SB & .TOC]

Post by sarzamin » Fri Dec 09, 2011 7:34 pm

unpacker please

User avatar
REDZOEU
veteran
Posts: 150
Joined: Thu Mar 10, 2011 8:03 am
Location: Jakarta, Indonesia
Has thanked: 71 times
Been thanked: 43 times
Contact:

Re: Need For Speed: The Run [.SB & .TOC]

Post by REDZOEU » Wed Dec 14, 2011 9:01 am

Hhhhmmm... if the unpacker is done... Will it extract car model and texture data(s)?
If it is possible, good :D. If we can also extract some dummies like headlight dummies, or wheel dummies (for wheel position), it'll be a hella nice work :)

SnarbleBarb
n00b
Posts: 17
Joined: Thu Dec 15, 2011 9:24 am
Has thanked: 9 times
Been thanked: 1 time

Re: Need For Speed: The Run [.SB & .TOC]

Post by SnarbleBarb » Thu Dec 15, 2011 9:33 am

Axsis how far did you get?

I wrote a python script using the libfb2 to dump out all of the vehicles... but I'm not sure what to do with the resulting files. Looking at them in a hex editor, they have all sorts of _c4/*** directory listings with blobs of binary. It kinda sounds like they combine all of the meshes, textures, and other parameters into these files. Any idea how to extract/unpack these resultant files into workable images and mesh files? I'd love to get some of these cars into GTA4, etc.

Code: Select all

from libfb2.sb import Bundle
import os
import shutil

dst = r'C:\Temp\NFS'
idx = 0

BUNDLE_PATH = r'C:\Program Files (x86)\Need for Speed The Run\Need for Speed The Run\Data\Win32\ShippingVehicles'
"BUNDLE_PATH = r'C:\Program Files (x86)\Need for Speed The Run\Need for Speed The Run\Data\Win32\_c4\Blueprint\Metadata\AllVehicles_BlueprintMDB'"

bundle = Bundle(BUNDLE_PATH)
total = len(bundle.bundle_files)

idx = 0

for items in bundle.iter_files():
    vehicle = bundle.get_file(items.id)
    fn = os.path.join(dst, items.id)
    directory = os.path.dirname(fn)
    if not os.path.isdir(directory):
        os.makedirs(directory)
    with open(fn, 'wb') as out:
        print 'Extracting %s % 8d Bytes (%d/%d)' % \
            (vehicle.id, vehicle.size, idx, total)
        shutil.copyfileobj(vehicle.open(), out)
    idx = idx + 1

sarzamin
beginner
Posts: 38
Joined: Fri Nov 19, 2010 3:19 pm
Location: Dubai
Has thanked: 3 times
Contact:

Re: Need For Speed: The Run [.SB & .TOC]

Post by sarzamin » Tue Dec 20, 2011 10:43 pm

Axsis,ANY NEWS?

xpertvision
ultra-n00b
Posts: 4
Joined: Fri Dec 09, 2011 12:14 am

Re: Need For Speed: The Run [.SB & .TOC]

Post by xpertvision » Wed Dec 21, 2011 12:37 am

any new on this?

Axsis
advanced
Posts: 48
Joined: Fri Oct 21, 2011 12:55 pm
Has thanked: 2 times
Been thanked: 20 times

Re: Need For Speed: The Run [.SB & .TOC]

Post by Axsis » Wed Dec 21, 2011 4:29 am

Ok, here is the script for unpacking chunks and bundles from toc+sb files.
Audio and video are stored in chunks, while textures, levels and cars geometry and other data are in bundles. There is no chunk filenames stored in .toc, only hashes, so extracted filenames will be like "1DBEAD526CD3C6A1652994ACAF4D3C76" - that's normal.
Bundles are unpacked with normal names like "Win32\_c4\ui\flow\graph\frontend\ferootgraph_resourcebundle". Any help on further bundle unpacking is welcomed.
Repacking using quickbms -r should work, but not throughly tested. (with standart repacking limitations like <= size of repacking file)
Use this script on original .toc file (not decrypted with bf3decrypt or any other tool).
Usually script finishes with error "incomplete input file number -1, can't read 1 bytes." - this is normal.

Code: Select all

Open FDDE SB 1
Get DICE_HDR long
If DICE_HDR == 0x00CED100
 Get TOC_SIZE asize
 Math TOC_SIZE -= 0x22C
 CallFunction DecryptTOC
 #Log "_decrypted.toc" 0 TOC_SIZE MEMORY_FILE
 CallFunction TOCParser
EndIf

##############################
StartFunction DecryptTOC
 FileXOR 0x7B
 Log MEMORY_FILE2 0x128 0x101
 FileXOR ""
 Log MEMORY_FILE 0x22C TOC_SIZE
 For I = 0 < TOC_SIZE
  Math J = I
  Math J %= 0x101
  GetVarChr KEY MEMORY_FILE2 J byte
  GetVarChr B MEMORY_FILE I byte
  Math B ^= KEY
  PutVarChr MEMORY_FILE I B byte
 Next I
EndFunction
##############################
StartFunction GetVLISize
Set SHIFT byte 0
Set ENTRYSIZE long 0
Do
 Get B byte MEMORY_FILE
 Math MSB = B
 Math B & 0x7F
 Math B < SHIFT
 Math SHIFT + 7
 Math ENTRYSIZE | B
 Math MSB > 7
While MSB == 1
EndFunction
##############################
StartFunction TOCParser
Math FFLAG = 0
Do
 Get TYPECODE byte MEMORY_FILE
 Math FLAGS = TYPECODE
 Math TYPECODE & 0x1F
 Math FLAGS > 5
 #Print "T:%TYPECODE% \t F:%FLAGS%"

 If FLAGS >= 4
  Set KEY string ""
 ElseIf TYPECODE == 0
  Set KEY string ""
 Else
  Get KEY string MEMORY_FILE
 EndIf

 If TYPECODE == 0 # Terminator
  Print "End of current LIST or ENTRY"
 ElseIf TYPECODE == 1 # List
  CallFunction GetVLISize 1
  Print "Start of LIST '%KEY%' with size = %ENTRYSIZE%"
  CallFunction TOCParser
 ElseIf TYPECODE == 2 # Entry
  CallFunction GetVLISize 1
  Print "Start of ENTRY '%KEY%' with size = %ENTRYSIZE%"
  CallFunction TOCParser
 ElseIf TYPECODE == 6 # Bool
  Get VALUE byte MEMORY_FILE
  Print " %KEY% = %VALUE%"
 ElseIf TYPECODE == 7 # String
  Get STRLEN byte MEMORY_FILE
  GetDString VALUE STRLEN MEMORY_FILE
  Print " %KEY% = %VALUE%"
 ElseIf TYPECODE == 8 # Int32
  Get VALUE long MEMORY_FILE
  Print " %KEY% = %VALUE%"
 ElseIf TYPECODE == 9 # Int64
  Get VALUE longlong MEMORY_FILE
  Print " %KEY% = %VALUE%"
 ElseIf TYPECODE == 15 # UUID
  Endian BIG
  Get HASH1 long MEMORY_FILE
  Get HASH2 long MEMORY_FILE
  Get HASH3 long MEMORY_FILE
  Get HASH4 long MEMORY_FILE
  Endian LITTLE
  String VALUE p= "%08X%08X%08X%08X" HASH1 HASH2 HASH3 HASH4
  Print " %KEY% = %VALUE%"
 Else
  Print "Unknown TYPECODE = %TYPECODE%"
  CleanExit
 EndIf
 
 If KEY == "id"
  Set FNAME string VALUE
  Math FFLAG | 1
 ElseIf KEY == "offset"
  Math FOFFSET = VALUE
  Math FFLAG | 2
 ElseIf KEY == "size"
  Math FSIZE = VALUE
  Math FFLAG | 4
 EndIf
 If FFLAG == 7
  #Print "%FNAME% %FOFFSET% %FSIZE%"
  Log FNAME FOFFSET FSIZE 1
  Math FFLAG = 0
 EndIf

While TYPECODE != 0
EndFunction
##############################

User avatar
nosfornos
advanced
Posts: 55
Joined: Wed Dec 21, 2011 9:16 am
Has thanked: 12 times
Been thanked: 3 times

Re: Need For Speed: The Run [.SB & .TOC]

Post by nosfornos » Wed Dec 21, 2011 9:25 am

ohh.
For now, I wait for progress.
Once the BMS Script used, then I think the best feeling.
Sorry in such poor English.
ImageI Love Nermal!!!

OrangeC
double-veteran
double-veteran
Posts: 860
Joined: Sun Apr 20, 2008 2:58 am
Has thanked: 5 times
Been thanked: 33 times

Re: Need For Speed: The Run [.SB & .TOC]

Post by OrangeC » Wed Dec 21, 2011 6:39 pm

Thanks it worked!!

I found the filenames for the audio chunks in the Level SB files but as to how to get that out and match them is way out of my league.

michalss
Moderator
Posts: 942
Joined: Sun Mar 27, 2011 8:42 pm
Has thanked: 10 times
Been thanked: 135 times

Re: Need For Speed: The Run [.SB & .TOC]

Post by michalss » Wed Dec 21, 2011 6:47 pm

Axsis wrote:Ok, here is the script for unpacking chunks and bundles from toc+sb files.
Audio and video are stored in chunks, while textures, levels and cars geometry and other data are in bundles. There is no chunk filenames stored in .toc, only hashes, so extracted filenames will be like "1DBEAD526CD3C6A1652994ACAF4D3C76" - that's normal.
Bundles are unpacked with normal names like "Win32\_c4\ui\flow\graph\frontend\ferootgraph_resourcebundle". Any help on further bundle unpacking is welcomed.
Repacking using quickbms -r should work, but not throughly tested. (with standart repacking limitations like <= size of repacking file)
Use this script on original .toc file (not decrypted with bf3decrypt or any other tool).
Usually script finishes with error "incomplete input file number -1, can't read 1 bytes." - this is normal.

Code: Select all

Open FDDE SB 1
Get DICE_HDR long
If DICE_HDR == 0x00CED100
 Get TOC_SIZE asize
 Math TOC_SIZE -= 0x22C
 CallFunction DecryptTOC
 #Log "_decrypted.toc" 0 TOC_SIZE MEMORY_FILE
 CallFunction TOCParser
EndIf

##############################
StartFunction DecryptTOC
 FileXOR 0x7B
 Log MEMORY_FILE2 0x128 0x101
 FileXOR ""
 Log MEMORY_FILE 0x22C TOC_SIZE
 For I = 0 < TOC_SIZE
  Math J = I
  Math J %= 0x101
  GetVarChr KEY MEMORY_FILE2 J byte
  GetVarChr B MEMORY_FILE I byte
  Math B ^= KEY
  PutVarChr MEMORY_FILE I B byte
 Next I
EndFunction
##############################
StartFunction GetVLISize
Set SHIFT byte 0
Set ENTRYSIZE long 0
Do
 Get B byte MEMORY_FILE
 Math MSB = B
 Math B & 0x7F
 Math B < SHIFT
 Math SHIFT + 7
 Math ENTRYSIZE | B
 Math MSB > 7
While MSB == 1
EndFunction
##############################
StartFunction TOCParser
Math FFLAG = 0
Do
 Get TYPECODE byte MEMORY_FILE
 Math FLAGS = TYPECODE
 Math TYPECODE & 0x1F
 Math FLAGS > 5
 #Print "T:%TYPECODE% \t F:%FLAGS%"

 If FLAGS >= 4
  Set KEY string ""
 ElseIf TYPECODE == 0
  Set KEY string ""
 Else
  Get KEY string MEMORY_FILE
 EndIf

 If TYPECODE == 0 # Terminator
  Print "End of current LIST or ENTRY"
 ElseIf TYPECODE == 1 # List
  CallFunction GetVLISize 1
  Print "Start of LIST '%KEY%' with size = %ENTRYSIZE%"
  CallFunction TOCParser
 ElseIf TYPECODE == 2 # Entry
  CallFunction GetVLISize 1
  Print "Start of ENTRY '%KEY%' with size = %ENTRYSIZE%"
  CallFunction TOCParser
 ElseIf TYPECODE == 6 # Bool
  Get VALUE byte MEMORY_FILE
  Print " %KEY% = %VALUE%"
 ElseIf TYPECODE == 7 # String
  Get STRLEN byte MEMORY_FILE
  GetDString VALUE STRLEN MEMORY_FILE
  Print " %KEY% = %VALUE%"
 ElseIf TYPECODE == 8 # Int32
  Get VALUE long MEMORY_FILE
  Print " %KEY% = %VALUE%"
 ElseIf TYPECODE == 9 # Int64
  Get VALUE longlong MEMORY_FILE
  Print " %KEY% = %VALUE%"
 ElseIf TYPECODE == 15 # UUID
  Endian BIG
  Get HASH1 long MEMORY_FILE
  Get HASH2 long MEMORY_FILE
  Get HASH3 long MEMORY_FILE
  Get HASH4 long MEMORY_FILE
  Endian LITTLE
  String VALUE p= "%08X%08X%08X%08X" HASH1 HASH2 HASH3 HASH4
  Print " %KEY% = %VALUE%"
 Else
  Print "Unknown TYPECODE = %TYPECODE%"
  CleanExit
 EndIf
 
 If KEY == "id"
  Set FNAME string VALUE
  Math FFLAG | 1
 ElseIf KEY == "offset"
  Math FOFFSET = VALUE
  Math FFLAG | 2
 ElseIf KEY == "size"
  Math FSIZE = VALUE
  Math FFLAG | 4
 EndIf
 If FFLAG == 7
  #Print "%FNAME% %FOFFSET% %FSIZE%"
  Log FNAME FOFFSET FSIZE 1
  Math FFLAG = 0
 EndIf

While TYPECODE != 0
EndFunction
##############################
Hi thx for script. Does it also work for X360 version please ?
Quick BMS Editor GUI - simple easy to use
Goto : viewtopic.php?uid=34229&f=29&t=6797&start=0

Downloads from DropBox : https://dl.dropboxusercontent.com/u/

OrangeC
double-veteran
double-veteran
Posts: 860
Joined: Sun Apr 20, 2008 2:58 am
Has thanked: 5 times
Been thanked: 33 times

Re: Need For Speed: The Run [.SB & .TOC]

Post by OrangeC » Wed Dec 21, 2011 6:56 pm

It works on both pc and 360.

michalss
Moderator
Posts: 942
Joined: Sun Mar 27, 2011 8:42 pm
Has thanked: 10 times
Been thanked: 135 times

Re: Need For Speed: The Run [.SB & .TOC]

Post by michalss » Wed Dec 21, 2011 9:03 pm

does work for loc files :) but extracted text files are mess :(
Quick BMS Editor GUI - simple easy to use
Goto : viewtopic.php?uid=34229&f=29&t=6797&start=0

Downloads from DropBox : https://dl.dropboxusercontent.com/u/

TomWin
veteran
Posts: 137
Joined: Sun Apr 11, 2010 7:46 pm
Has thanked: 8 times
Been thanked: 6 times

Re: Need For Speed: The Run [.SB & .TOC]

Post by TomWin » Thu Dec 22, 2011 7:58 am

I'm glad that somebody figured out how to extract data from .SB and .TOC files.

Post Reply