Corrupted Lua and XMLs when extracting from .pfp

Doubts, help and support about QuickBMS and other game research tools
Times New Woman
Posts: 24
Joined: Sun Oct 14, 2018 6:51 am

Corrupted Lua and XMLs when extracting from .pfp

Post by Times New Woman »

(I wasn't sure whether to post this here or in Code Talk, but I feel like it should go here.)

https://drive.google.com/open?id=1NQ6IX ... x7f1YL7TeE

Attached is a .rar containing the .pfp code, an example Lua file and the pfp I extracted it from.
The Lua appears to have the heading "LuaP" but after that it appears as garbled crap in Notepad++.
I don't know if it's an issue with the .pfp extraction code or the header. This problem has occurred for all the Lua (and XML, as those are garbled too) files extracted from the pfp.
Does anyone know why this problem happens?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Corrupted Lua and XMLs when extracting from .pfp

Post by aluigi »

I guess you have to post in the topic (if any) that has been open for this specifc game (what game?) and this pfp format.

Your file is not visible to everybody.
Times New Woman
Posts: 24
Joined: Sun Oct 14, 2018 6:51 am

Re: Corrupted Lua and XMLs when extracting from .pfp

Post by Times New Woman »

I've made the .rar file public (because I'm dumb).
The .pfp is the compressed assets file and not the panorama sort.
The .pfp and corresponding ripped (corrupted?) .lua are from a game called Fitness Dash, but I've experienced the same issue with quite a few games I've tried ripping .pfp contents from. I'm pretty certain that the game I'm ripping doesn't have an active topic, and I don't want to necro.

Sorry if I'm being an idiot.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Corrupted Lua and XMLs when extracting from .pfp

Post by aluigi »

ok so you used the pfpk.bms script from my website.

The lua files are simply compiled which is very common in games, therefore you just need a decompiler.
There are various decompilers available, if you need an advice try to search the following on google:
luadec site:zenhax.com
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Corrupted Lua and XMLs when extracting from .pfp

Post by aluigi »

xml files are simply compressed.
Try this script on them:

Code: Select all

idstring "ZXML"
get ZSIZE long
get SIZE long
savepos OFFSET
get NAME filename
clog NAME OFFSET ZSIZE SIZE
Times New Woman
Posts: 24
Joined: Sun Oct 14, 2018 6:51 am

Re: Corrupted Lua and XMLs when extracting from .pfp

Post by Times New Woman »

Thanks, now the unzipped xml files are readable.
Is there any way to do the same with the Lua files?
The first readable part in all the 'broken' Lua files is "LuaP" if that helps.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Corrupted Lua and XMLs when extracting from .pfp

Post by aluigi »

Eh you missed my previous post :)
Times New Woman
Posts: 24
Joined: Sun Oct 14, 2018 6:51 am

Re: Corrupted Lua and XMLs when extracting from .pfp

Post by Times New Woman »

...So does the zxml script work with the Lua files as well?
Times New Woman
Posts: 24
Joined: Sun Oct 14, 2018 6:51 am

Re: Corrupted Lua and XMLs when extracting from .pfp

Post by Times New Woman »

I've tried searching for a script to unzip the LuaP files, but the one I did find doesn't work at all. The zxml script works perfectly. I'm a huge idiot, so: I'd like to be able to both extract and reimport the Lua files from the LuaP one.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Corrupted Lua and XMLs when extracting from .pfp

Post by aluigi »

I told you to use a Lua decompiler:
viewtopic.php?p=39610#p39610
Times New Woman
Posts: 24
Joined: Sun Oct 14, 2018 6:51 am

Re: Corrupted Lua and XMLs when extracting from .pfp

Post by Times New Woman »

sorry, I'm an idiot. I've tried looking for one just now but I can't find anything I know how to use at all. I'm probably just too dumb to try and use any of them. Do you know one that's easy to use for a coding imbecile like me?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Corrupted Lua and XMLs when extracting from .pfp

Post by aluigi »

Come on don't say that.
Often people have problems with lua decompilers due to the various versions and the bugs in the decompilers.

For example Lua 5.0 ("LuaP") can be decompiled by some very old tools like:
http://files.luaforge.net/releases/luadec/luadec/0.6
http://files.luaforge.net/releases/chun ... -bin-0.7.0
http://files.luaforge.net/releases/chun ... -win32-bin
BUT none of them works with your customers.lua returning some "bad code" error.
Maybe just chunkspy gives some results but not exactly what you want.

Honestly I can't help you further so good luck.
Visual917
Posts: 1
Joined: Mon May 27, 2019 2:54 am

Re: Corrupted Lua and XMLs when extracting from .pfp

Post by Visual917 »

I'm working on a PlayFirst game myself...
1. I can decrypt XML files using your script, but how can I put it back to ZXML for the game to use? Can I encrypt it using another script of yours?
2. I still can't decrypt the lua files. It says LuaP in the beginning.

Please help me :(
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Corrupted Lua and XMLs when extracting from .pfp

Post by aluigi »

1)

Code: Select all

comtype zlib_compress
get SIZE asize
log MEMORY_FILE 0 0
putdstring "ZXML" 4 MEMORY_FILE
put 0 long MEMORY_FILE
put SIZE long MEMORY_FILE
savepos OFFSET MEMORY_FILE
append
clog MEMORY_FILE 0 SIZE SIZE
append
get ZSIZE asize MEMORY_FILE
math ZSIZE - OFFSET
goto 4 MEMORY_FILE
put ZSIZE long MEMORY_FILE
get NAME basename
string NAME + ".zxml"
get SIZE asize MEMORY_FILE
log NAME 0 SIZE MEMORY_FILE


2)
Maybe try a different lua 5.0 decompiler