NicknineTheEagle / Frostbite-Scripts

Python scripts for extracting Frostbite Engine assets
Other
87 stars 14 forks source link

Error when trying to run fb3 ebxtottext #30

Closed FlashHit closed 2 years ago

FlashHit commented 2 years ago
Levels/MP/MP_Naval/ConquestSmall0/MeshVariationDb_Win32
Levels/MP/MP_Naval/UI
Levels/MP/MP_Naval/Island_Main_Harbour
Traceback (most recent call last):
  File "C:\Users\Administrator\Downloads\Frostbite-Scripts-master\Frostbite-Scripts-master\frostbite3\ebxtottext.py", line 29, in <module>
    dbx=ebx.Dbx(os.path.join(dir0,fname),ebxFolder)
  File "C:\Users\Administrator\Downloads\Frostbite-Scripts-master\Frostbite-Scripts-master\frostbite3\ebx.py", line 280, in __init__
    inst=self.readComplex(instanceRepeater.complexIndex,f,True)
  File "C:\Users\Administrator\Downloads\Frostbite-Scripts-master\Frostbite-Scripts-master\frostbite3\ebx.py", line 307, in readComplex
    cmplx.fields.append(self.readField(fieldIndex,f))
  File "C:\Users\Administrator\Downloads\Frostbite-Scripts-master\Frostbite-Scripts-master\frostbite3\ebx.py", line 353, in readField
    field.value=data.decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x98 in position 2: invalid start byte

Hope you can help me with this issue as well :)

I repaired the game through origin before using the dumper. Then after the dumper finished I started the ebxtottext.py.

dumpDirectory   = r"D:\hexing\bf4_dump"
targetDirectory = r"D:\hexing\bf4_ebx"
inputFolder     = r"" #relative to ebxFolder

that's the only thing I did in that file. With the default inputFolder it did nothing for me.

FlashHit commented 2 years ago

I ran this again and added a print of the data (print(data)) before doing field.value=data.decode("utf-8")

b'Wreck_RGB'
Levels/MP/MP_Naval/ConquestLarge0/MeshVariationDb_Win32
b'Levels/MP/MP_Naval/ConquestSmall0_Logic'
Levels/MP/MP_Naval/ConquestSmall0_Logic
b'Levels/MP/MP_Naval/ConquestSmall0_Logic_Schematic'
Levels/MP/MP_Naval/ConquestSmall0_Logic_Schematic
b'Levels/MP/MP_Naval/ConquestSmall0/MeshVariationDb_Win32'
b'Camo'
b'Logo'
Levels/MP/MP_Naval/ConquestSmall0/MeshVariationDb_Win32
b'Levels/MP/MP_Naval/UI'
Levels/MP/MP_Naval/UI
b'Levels/MP/MP_Naval/Island_Main_Harbour'
Levels/MP/MP_Naval/Island_Main_Harbour
b'Levels/MP/MP_Naval/Levolution_Schematic'
b'instaCalm'
b'instaStorm'
b'calm'
b'storm/calm: '
b'storm'
b'_b\x98\xa6\x8a\xaa\xb6\xb3\xb7'
Traceback (most recent call last):
  File "C:\Users\Administrator\Downloads\Frostbite-Scripts-master\Frostbite-Scripts-master\frostbite3\ebxtottext.py", line 29, in <module>
    dbx=ebx.Dbx(os.path.join(dir0,fname),ebxFolder)
  File "C:\Users\Administrator\Downloads\Frostbite-Scripts-master\Frostbite-Scripts-master\frostbite3\ebx.py", line 280, in __init__
    inst=self.readComplex(instanceRepeater.complexIndex,f,True)
  File "C:\Users\Administrator\Downloads\Frostbite-Scripts-master\Frostbite-Scripts-master\frostbite3\ebx.py", line 307, in readComplex
    cmplx.fields.append(self.readField(fieldIndex,f))
  File "C:\Users\Administrator\Downloads\Frostbite-Scripts-master\Frostbite-Scripts-master\frostbite3\ebx.py", line 354, in readField
    field.value=data.decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x98 in position 2: invalid start byte
FlashHit commented 2 years ago

Could it be that a string like this is causing the issue? https://github.com/GreyDynamics/BF4_EBX/blob/4e19b479df7294c70744fedf762575bdef9c6db8/Levels/MP/MP_Naval/Levolution_Schematic_offset_.txt#L717

FlashHit commented 2 years ago

Is this a good solution?

replacing: field.value=data.decode("utf-8") with: field.value=data.decode("utf-8", "backslashreplace")

NicknineTheEagle commented 2 years ago

That's weird, it seems like they're storing some data in a string field that is not actually text.

NicknineTheEagle commented 2 years ago

Is this a good solution?

replacing: field.value=data.decode("utf-8") with: field.value=data.decode("utf-8", "backslashreplace")

Yeah, that should work.

NicknineTheEagle commented 2 years ago

Should be fixed in https://github.com/NicknineTheEagle/Frostbite-Scripts/commit/09fe77c2c38bfec1543b55eb02f20855a3c84447.