Scribblenauts Unlimited *.p files
Posted: Mon Feb 11, 2013 11:14 am
Hello. I need help with unpacking archives in this game. could u try to extract them?? thanks
Code: Select all
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00000000 31 46 43 42 02 02 44 AC E0 6B 1A 00 6C 07 00 00 1FCB..Dˆk..l...
00000010 F0 F1 12 00 86 03 01 00 30 05 D4 06 E0 06 90 06 ðñ..†...0.Ô.à...
00000020 C8 06 90 06 8C 06 94 06 C8 06 58 06 B0 04 28 04 È...Œ.”.È.X.°.(.
00000030 44 05 34 06 80 06 88 06 7C 06 68 06 6C 05 74 06 D.4.€.ˆ.|.h.l.t.
00000040 84 06 10 05 40 06 A4 06 B8 05 40 04 0C 04 30 04 „...@.¤.¸[email protected].
00000050 B4 05 88 06 80 06 A8 04 20 04 1C 04 7C 05 18 05 ´.ˆ.€.¨. ...|...
00000060 74 05 A8 05 60 06 B0 06 E0 06 A0 06 D8 06 1C 07 t.¨.`.°.à. .Ø...
00000070 FC 05 B8 06 D8 06 70 06 0C 06 04 05 C8 05 20 07 ü.¸.Ø.p.....È. .
00000080 F8 06 14 07 5C 07 48 07 20 07 40 07 F0 06 90 04 ø...\.H. .@.ð...
00000090 C8 04 1C 04 58 05 98 06 90 06 CC 06 AC 06 B0 06 È...X.˜...Ì.¬.°.
000000A0 04 06 A4 06 38 05 7C 04 40 06 D0 06 00 07 04 05 ..¤.8.|.@.Ð.....
000000B0 6C 04 58 04 E8 05 B4 06 1C 06 60 06 BC 06 28 07 l.X.è.´...`.¼.(.
000000C0 C0 06 84 06 E8 05 D0 05 CC 06 E4 06 D4 06 04 07 À.„.è.Ð.Ì.ä.Ô...
000000D0 40 07 4C 06 68 06 28 07 3C 07 4C 06 F4 06 AC 06 @.L.h.(.<.L.ô.¬.
000000E0 10 06 28 07 24 07 48 07 14 07 24 07 5C 07 2C 07 ..(.$.H...$.\.,.
000000F0 30 07 04 06 D4 04 28 04 80 05 DC 06 FC 06 1C 07 0...Ô.(.€.Ü.ü...
00000100 24 07 1C 07 C0 05 30 06 34 06 98 05 BC 06 20 07 $...À.0.4.˜.¼. .
Code: Select all
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace BinkA2WAV
{
internal unsafe class Program
{
private static void Main(string[] args)
{
byte[] inData = File.ReadAllBytes(args[0]);
IntPtr resultPtr;
uint resultSize = 0;
AIL_set_redist_directory(".");
AIL_startup();
if (AIL_decompress_ASI(inData, (uint) inData.Length, ".binka", &resultPtr, &resultSize, 0) == 0)
{
Console.WriteLine("Native call returned 0: failure; it reports \"{0}\"",
Marshal.PtrToStringAnsi(AIL_last_error()));
return;
}
var result = new byte[resultSize];
Marshal.Copy(resultPtr, result, 0, result.Length);
AIL_mem_free_lock(resultPtr);
AIL_shutdown();
File.WriteAllBytes(args.Length > 1 ? args[1] : args[0], result);
}
[DllImport("mss32.dll", EntryPoint = "_AIL_decompress_ASI@24")]
private static extern int AIL_decompress_ASI([MarshalAs(UnmanagedType.LPArray)] byte[] indata, uint insize,
[MarshalAs(UnmanagedType.LPStr)] String ext, IntPtr* result,
uint* resultsize, uint zero);
[DllImport("mss32.dll", EntryPoint = "_AIL_last_error@0")]
private static extern IntPtr AIL_last_error();
[DllImport("mss32.dll", EntryPoint = "_AIL_set_redist_directory@4")]
private static extern IntPtr AIL_set_redist_directory([MarshalAs(UnmanagedType.LPStr)] string redistDir);
[DllImport("mss32.dll", EntryPoint = "_AIL_mem_free_lock@4")]
private static extern void AIL_mem_free_lock(IntPtr ptr);
[DllImport("mss32.dll", EntryPoint = "_AIL_startup@0")]
private static extern int AIL_startup();
[DllImport("mss32.dll", EntryPoint = "_AIL_shutdown@0")]
private static extern int AIL_shutdown();
}
}
What issue are you having? It's C#, by the way, not C++, so you'll have to compile it as that. And be sure to either change the relative path to mss32.dll to an absolute path, or you'll have to use it in the same directory where mss32.dll and binkawin.asi are located (same as ScribbleExtract).kooz wrote:This is really awesome! Can someone compile these to win32 binaries?
EDIT:
Grabbed VS2012 and I'm going to try to give this a go myself. If I'm not mistaken both ScribbleExtract and the code AngelSL posted should compile with it, right? Hopefully I can figure it out
EDIT #2:
Nice, I got ScribbleExtract compiled and it works perfectly! I will include this for anyone else who wants to use it. Just put it in the main install directory of Scribblenauts Unlimited and it will make an "extracted" folder.
I can't seem to get the code AngelSL posted working yet. If anyone can provide some insight, it would be greatly appreciated.
Mostly it's a complete unfamiliarity with the language and, in general, compiling native code. I managed to get past the /unsafe flag and some other issues with VS2012 but I'm sure I was doing something wrong. I pasted the code into a new "C# console application" and eventually got an exe compiled.AngelSL wrote:What issue are you having?
Code: Select all
C:\Users\Administrator\Desktop\binka2wav>dir
Volume in drive C has no label.
Volume Serial Number is 460C-7EAC
Directory of C:\Users\Administrator\Desktop\binka2wav
05/20/2013 06:00 AM <DIR> .
05/20/2013 06:00 AM <DIR> ..
05/20/2013 05:42 AM 2,069 BinkA2WAV
11/21/2012 04:38 PM 55,296 binkawin.asi
11/21/2012 04:38 PM 424,448 mss32.dll
05/19/2013 06:11 PM 1,241,584 SCRIB.WAV
4 File(s) 1,723,397 bytes
2 Dir(s) 73,667,923,968 bytes free
C:\Users\Administrator\Desktop\binka2wav>mcs BinkA2WAV
BinkA2WAV(7,14): error CS0227: Unsafe code requires the `unsafe' command line option to be specified
Compilation failed: 1 error(s), 0 warnings
C:\Users\Administrator\Desktop\binka2wav>mcs BinkA2WAV /unsafe
C:\Users\Administrator\Desktop\binka2wav>BinkA2WAV SCRIB.WAV
Unhandled Exception: System.BadImageFormatException: An attempt was made to load a program with an incorrect format.
(Exception from HRESULT: 0x8007000B)
at BinkA2WAV.Program.AIL_set_redist_directory(String redistDir)
at BinkA2WAV.Program.Main(String[] args)
C:\Users\Administrator\Desktop\binka2wav>
C# compiles to MSIL. It's a managed language.kooz wrote:Mostly it's a complete unfamiliarity with the language and, in general, compiling native code. I managed to get past the /unsafe flag and some other issues with VS2012 but I'm sure I was doing something wrong. I pasted the code into a new "C# console application" and eventually got an exe compiled.AngelSL wrote:What issue are you having?
I tried Mono this morning while at work and managed to get it compiled via command line, seemingly without errors, but I am still getting an error when running it:
I will try the cmd line VS2012 compiler when I get home.Code: Select all
C:\Users\Administrator\Desktop\binka2wav>dir Volume in drive C has no label. Volume Serial Number is 460C-7EAC Directory of C:\Users\Administrator\Desktop\binka2wav 05/20/2013 06:00 AM <DIR> . 05/20/2013 06:00 AM <DIR> .. 05/20/2013 05:42 AM 2,069 BinkA2WAV 11/21/2012 04:38 PM 55,296 binkawin.asi 11/21/2012 04:38 PM 424,448 mss32.dll 05/19/2013 06:11 PM 1,241,584 SCRIB.WAV 4 File(s) 1,723,397 bytes 2 Dir(s) 73,667,923,968 bytes free C:\Users\Administrator\Desktop\binka2wav>mcs BinkA2WAV BinkA2WAV(7,14): error CS0227: Unsafe code requires the `unsafe' command line option to be specified Compilation failed: 1 error(s), 0 warnings C:\Users\Administrator\Desktop\binka2wav>mcs BinkA2WAV /unsafe C:\Users\Administrator\Desktop\binka2wav>BinkA2WAV SCRIB.WAV Unhandled Exception: System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at BinkA2WAV.Program.AIL_set_redist_directory(String redistDir) at BinkA2WAV.Program.Main(String[] args) C:\Users\Administrator\Desktop\binka2wav>
Okay, that makes sense; I didn't even consider the compiler might default to x64. I made another attempt at it with that in mind, but I'm still missing something:AngelSL wrote:You need to target 32-bit when compiling, because mss32.dll is a 32-bit DLL. If not, BinkA2WAV will launch in 64-bit mode and it'll not be able to P/Invoke mss32.dll.
Code: Select all
D:\scribb>"C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" BinkA2WAV.cs /unsafe /platform:x86
Microsoft (R) Visual C# Compiler version 4.0.30319.17929
for Microsoft (R) .NET Framework 4.5
Copyright (C) Microsoft Corporation. All rights reserved.
D:\scribb>BinkA2WAV TITLE.WAV
Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at BinkA2WAV.Program.Main(String[] args)
D:\scribb>
It works beautifully, thank you so much!AngelSL wrote:I've attached a working compile; make sure mss32.dll and binkawin.asi are in the same directory as it.
That would be awesome. I'm sure there are/will be plenty of games that would benefit from it (like Defiance). Perhaps it could even be added to vgmstream.AngelSL wrote:When time permits, I'll try and disassemble binkawin.asi and write a proper decoder.
I've changed one LoC up there so it defaults to overwriting the original file if a new output filename is not provided (I already did this in my local copy but that was after I posted the source here).kooz wrote:Okay, that makes sense; I didn't even consider the compiler might default to x64. I made another attempt at it with that in mind, but I'm still missing something:AngelSL wrote:You need to target 32-bit when compiling, because mss32.dll is a 32-bit DLL. If not, BinkA2WAV will launch in 64-bit mode and it'll not be able to P/Invoke mss32.dll.
Code: Select all
D:\scribb>"C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" BinkA2WAV.cs /unsafe /platform:x86 Microsoft (R) Visual C# Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 Copyright (C) Microsoft Corporation. All rights reserved. D:\scribb>BinkA2WAV TITLE.WAV Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array. at BinkA2WAV.Program.Main(String[] args) D:\scribb>