QUICKBMS GUIDE

I am going to make a tutorial for using quickbms for extracting archives that are no extractors for.
I am going to start off easy then add more and more difficult archives so you can learn and write your own scripts.
the tools you need are just 4 things.
1. A HEX editor I use HxD
2.Quick BMS http://aluigi.org/papers/quickbms.zip
3. a text editor like wordpad
4. a calculator that supports hex like the one built into windows.
We will start with a game called FEZ (Fantasy Earth Zero)
this is a great archive format for someone to learn bms scripting from.
I attached a sample.
website http://tw.fez.gamania.com/
installer http://tw.dl.gamania.com/fez/FEZ_1103.exe
this game uses textures with wrong headers mainly dds and some tga and some kind of .mdl format.

ok so you can download the full installer
ok so open the file up in your hex editor so you see what I have open here

so if you look to the right you will notice some readable text 
Etc\aura.tex , Etc\cursor.tex , Etc\mahoujin.tex , Etc\env2.tex , and Etc\kaze.tex .
so just looking with out eyes we now know that there are at least 5 files in this bin file and after we extract them they will be placed in a folder called Etc.
so lets start looking at the other parts of the header in this file we will start with the first 4 bytes

well we have 05 00 00 00
whenever you are working with archives for computer games 99% of the time you read the values in reverse so the above number
would not be 5,000,000 but instead would be read as 00 00 00 05 or 5
Well if we remember from earlier we saw 5 file names and our first 4 bytes of our file are equal to 5 so there is a good chance we just discovered where the file count is stored in this archive.
data is stored in groups of 4 bytes " a long" 2 bytes " a short" or 1 byte "a byte" so we have our first part of our script
get FILES long
this tells quickbms to read a long value "aka 4 bytes" and store it as the variable FILES.
ok the next 4 bytes 74 00 00 00 are not needed in order for quickbms to extract our files but it represents the total size of our header.

so I will write the next line of code for quickbms
get HEADERSZ long 
this stores the header size in the variable HEADERSZ
ok now we have 2 more bytes before the file name
so that is 0C 00 well 2 bytes is know as a short. but what does 00 0C stand for?
if we highlight the whole name of the file in out hex editor it shows us a length of C 
we found the name length so we would write that as
get NSIZE short
this stores the 2 bytes in the variable NSIZE representing the length of the name

well next comes the name so to store that as a word in bms language we will write the next line
getdstring NAME NSIZE
this is saying store a string "aka a word" in the variable NAME and its length is equal to the variable NSIZE.
ok now we have another 4 bytes after the name 7C 00 00 00
well we already know the name of the file so now to extract the file we need to know its size and location in the archive.
7C is not a very big number for the size of the file to lets see what happens if we go to offset 7C
in HxD press ctrl +E and type in 7c for the start and end then click ok.

you should look like this after clicking ok

hmm this looks good it looks like a file header IMG0 so we will write out line saying that is the start of the file
get OFFSET long
this stores the 4 bytes as the variable OFFSET
ok the next 4 bytes are 70 10 00 00 well that looks bigger so lets see if that is the size of out file so it will translate into 00 00 10 70 or 1070
so lets go to our offset 7C and then we will add in the length column 1070

wow look at that I see TRUEVISION-XFILE that is a classic tga ending and we also end just before IMG0 which was the start of our first file

so that means we found our size 
we write that as 
get SIZE long
this stores the 4 bytes in the variable SIZE
ok now we have 2 bytes then the next file name hmm that seems familiar 
lets see 0E 00so that means it translates into 00 0E or E
well the last 2 bytes we had before a name was the name size lets see if it still holds true

it does the name length is E 
so that means we found where the pattern in the header repeats and we identified all that we need to extract the files so now we can finish our script and our extractor.
whenever the pattern starts you want to begin a loop so it will keep cycling through it until there are no files left. the easiest way to write that is.
for i = 0 < FILES
this means run the following commands until i = 0 and set i = FILES
so we will put that before our NSIZE variable because that is where the pattern starts.
next you want it to write out the file and we do that with the log command in the following format
log NAME OFFSET SIZE
this says write the file name and fill it with the data starting at the variable OFFSET and a length of SIZE.
now this is great but we want it to keep repeating the loop till there are no more files so we must add
next i
at the end so the loop continues.
ok so now save the file we created as extract.bms
and put Etc.pac extract.bms and quickbms.exe all in the same folder for wthis demo we will say c:\temp
so now at the command prompt change to that directory and type
quickbms.exe -l extract.bms Etc.pac .
this will list the the file contents and size or give you an error if your script is not correct.
Yay it worked 

now lets try extracting them create a folder in c:\temp called extracted
now type the command 
quickbms.exe extract.bms Etc.pac extracted
yes it worked now they are in the filder and extracted.

Code:

get FILES long
get HEADERSZ long
for i = 0 < FILES
get NSIZE short
getdstring NAME NSIZE
get OFFSET long
get SIZE long

log NAME OFFSET SIZE
next i

Let me know what you think of this tutorial and if you want me to continue on with more examples and more compex scripts.

时间: 2024-11-02 02:47:51

QUICKBMS GUIDE的相关文章

The Struts Users Guide 翻译作品1

guid 在接下来的几个周里 我会陆续的把APACHE网站上的 Structs User's Guide 翻译过来,由于在公司好象打不开CSDN BLOG 所以只要晚上或者周末 翻印.希望大家能够关注我的翻译,也对我的翻译提出意见和建议!0. 前言 0.1 基本要求 0.2 HTTP, HTML, 用户代理 0.3 HTTP 请求/应答   0.4 Java 语言和应用程序框架 0.5 JavaBeans 0.6 属性文件和资源包 0.7 Java Servlets 0.8 JavaServer

dotNET C# Programmer’s Guide to the Win32 API (Win

dotNET C# Programmer's Guide to the Win32 API (Win32 API 声明C#版) 小气的神 2001.09.07 噢,对不起我用了这个标题,事实上如果我能做到10%,我就很高兴了.因为我的桌上正放着一本Dan Appleman的书,它曾伴随我许多年,也许你也有一本:1215页,蓝色书皮,机械工业出版社.英文名叫:< Dan Appleman's Visual Basic 5.0 Programmer's Guide to the Win32 API

UVa 10099:The Tourist Guide(Floyd, 最大生成树)

链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1040 题目: Problem D The Tourist Guide Input: standard input Output: standard output Mr. G. works as a tourist guide. His current

QuickBMS通用解包器使用指南

从本质上来说,QuickBMS只是一个通用解包器引擎,由Luigi Auriemma开发并维护,虽然QuickBMS简单而高效,技术组也经常使用QuickBMS来解包游戏的资源文件,但任何技术都存在一个入门门槛,而本篇以及后续教学笔记就试图为同学们拆除这个门槛.          那么,进入QuickBMS世界的门槛有多高呢?我将使用什么方法来拆除这个门槛呢?    第一节 QuickBMS使用方法            QuickBMS的使用方法没有任何难度,其步骤如下所示:    1.使用鼠

Java Secure Socket Extension (JSSE) Reference Guide

Skip to Content Oracle Technology Network Software Downloads Documentation Search Java Secure Socket Extension (JSSE) Reference Guide This guide covers the following topics: Skip Navigation Links Introduction Features and Benefits JSSE Standard API S

New Release: patterns &amp; practices App Arch Guide 2.0 Beta 1

[From J.D Meier's Blog:http://blogs.msdn.com/jmeier/default.aspx] Today we released our patterns & practices App Arch Guide 2.0 Beta 1.  This is our guide to help solution architects and developers make the most of the Microsoft platform.  It's a dis

Step by step guide to set up master and slave machines(转)

Note: There is no need to install Jenkins on the slave machine. On your master machine go to Manage Jenkins > Manage Nodes. New Node --> Enter Node Name. Select Dumb Slave --> Press OK. Fill out the following: Set a number of executors (one or mo

Sonatype OSS Maven Repository Usage Guide

原文:https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide Sonatype OSS Maven Repository Usage Guide Attachments:4 Added by Juven Xu, last edited by Joel Orlina on Jun 05, 2013  (view change) 1. Introduction 1a. Terms o

Google Style Guides-Shell Style Guide(翻译)

  背景 使用什么shell? Bash是允许的可执行文件中的的唯一一个shell脚本语言.其可执行文件必须是以#!/bin/bash开头,使用set来设置shell的选项,以便你可以按照bash 来调用你的脚本,而不破坏它的功能.限制所有可执行的shell脚本为bash,为我们提供了所安装的所有机器上的一致shell语言.唯一的例外是在种强制要求你编码为某种格式的地方,例如在Solaris SVR4的软件包中所有的脚本都要求是普通的Bourne shell. 什么时候使用shell? shel