Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up
contains utils for AGS: game extractor, repacker, disassembler and assembler
C
Python
Objective-C
Other
- C 89.7%
- Python 7.0%
- Objective-C 1.9%
- Other 1.4%
Latest commit
Cannot retrieve the latest commit at this time.
Files
| Type | Name | Latest commit message | Commit time |
|---|---|---|---|
| Failed to load latest commit information. | |||
|
|
sim-tests | ||
|
|
.gitignore | ||
|
|
Assembler.c | ||
|
|
Assembler.h | ||
|
|
Bitmap.h | ||
|
|
BitmapFuncs.h | ||
|
|
ByteArray.c | ||
|
|
ByteArray.h | ||
|
|
Clib32.c | ||
|
|
Clib32.h | ||
|
|
DataFile.c | ||
|
|
DataFile.h | ||
|
|
File.c | ||
|
|
File.h | ||
|
|
ImageData.h | ||
|
|
List.c | ||
|
|
List.h | ||
|
|
Makefile | ||
|
|
Makefile.binary | ||
|
|
MemGrow.c | ||
|
|
MemGrow.h | ||
|
|
README | ||
|
|
RoomFile.c | ||
|
|
RoomFile.h | ||
|
|
Script.c | ||
|
|
Script.h | ||
|
|
Script_internal.h | ||
|
|
SpriteFile.c | ||
|
|
SpriteFile.h | ||
|
|
StringEscape.c | ||
|
|
StringEscape.h | ||
|
|
Targa.h | ||
|
|
ags_cpu.h | ||
|
|
agsalphahack.c | ||
|
|
agscriptxtract.c | ||
|
|
agsdisas.c | ||
|
|
agsex | ||
|
|
agsinject.c | ||
|
|
agsoptimize | ||
|
|
agspack.c | ||
|
|
agsprite.c | ||
|
|
agssemble.c | ||
|
|
agssim.c | ||
|
|
agstract.c | ||
|
|
bmap.h | ||
|
|
debug.h | ||
|
|
endianness.h | ||
|
|
hbmap.h | ||
|
|
preproc.c | ||
|
|
preproc.h | ||
|
|
regusage.h | ||
|
|
rle.c | ||
|
|
rle.h | ||
|
|
tglist.h | ||
|
|
tokenizer.c | ||
|
|
tokenizer.h | ||
|
|
version.h | ||
README
agsutils by rofl0r
==================
tools for (un)packing, disassembling, modifying and recompiling ags games.
agsex:
runs agstract and agscriptxtract, then creates a Makefile with rules
to quickly and automatically repack a pack with changed asm files.
this basically does everything for you automatically.
can also use `make optimize` to run agsoptimize on all asm files.
agstract:
extracts the files a game "pack" (.exe) consists of.
creates a file agspack.info which contains metadata about the
files included in the pack.
example:
agstract 252test.exe FILES
:::AGStract 0.9.1 by rofl0r:::
252test.exe: version 10, containing 6 files.
ac2game.dta -> FILES/ac2game.dta
acsprset.spr -> FILES/acsprset.spr
agsfnt0.wfn -> FILES/agsfnt0.wfn
agsfnt1.wfn -> FILES/agsfnt1.wfn
agsfnt2.wfn -> FILES/agsfnt2.wfn
room1.crm -> FILES/room1.crm
agstract can also extract speech.vox and audio.vox files.
make sure to use a different output directory, otherwise your
agspack.info will be overwritten.
in some games, speech.vox is insanely big because the speech files are
saved in studio quality.
i achieved good results by converting them to 16Khz via ffmpeg:
for i in SPEECH/*.ogg ; do
ffmpeg -i "$i" -c:a libvorbis -ar 16384 tmp.oga && mv tmp.oga "$i"
done
then repacking it with agspack, which results in about 6x space improvement.
for audio.vox, you might want to use -b:a 80k instead of -ar 16384.
this shrinks input files by about 400% with almost CD-like quality.
agspack:
takes the files created by agstract and makes a new bundle out of it.
example:
agspack FILES/ 252mytest.exe
the new "exe" will miss the original windows exe stub, but is
compatible with the opensource AGS engine, as well as with scummvm ags port.
that way, a game is about 500 KB smaller after extract and repack as it originally was.
agscriptxtract:
detects and unpacks all binary scripts embedded in room and game files.
the compiled scripts are stored with a .o extension, the disassembled files with .s.
example:
mkdir OBJ ; cd OBJ
agscriptxtract ../FILES
disassembling globalscript.o -> globalscript.s
disassembling room1.o -> room1.s
agsdisas:
disassembles a single .o file to .s. useful to compare a re-assembled file with the original.
example:
agsdisas room1.o room1.s
disassembling room1.o -> room1.s
agssemble:
creates a compiled object file from a .s assembly file.
example:
agssemble room1.s
creates a new room1.o (you will notice filesize/date has changed)
the compiled object file will miss unused strings and thus be smaller than the original.
also imports and exports cover only really used ones.
agsinject:
once you have recompiled an .o file with agssemble, you can inject it into the original
container file (either a .crm room file or a game file like "ac2game.dta")
example:
agsinject 0 OBJ/room1.o FILES/room1.crm
injects room1.o at the first found script (0) in room1.crm.
rooms have only 1 script so you must always use 0.
for ac2game.dta kinda gamefiles, the index is i.e. 0 for the globalscript,
1 for the dialogscript (if one exists), otherwise 1 is the first gamescript, etc.
after you injected your .o file, the next thing you want to do is agspack it all up again.
then you can test your changes in the ags engine.
agsprite:
a tool to extract sprites from acsprset.spr files, and to create a new one
from a directory full of extracted sprites. has several options to create
smaller spritecache files than original, for example by converting all
true-color images to high-color, which is almost impossible to differentiate
visually.
unfortunately ags saves a "uses alpha channel" flag for every sprite in a
different file.
if it was set, a picture converted from 32 to 16bit will become
invisible, unless it is fixed with `agsalphahack` tool.
after repacking a .spr file, a new sprindex.dat must be created and the old
one replaced with it (if one existed). agsprite has an option for that too.
optionally, the old sprindex.dat can simply be removed by commenting out the
line with sprindex.dat in agspack.info and reducing the filecount by 1.
at present, agsprite only creates and accepts TGA files saved in top-to-bottom
order, which is default for tools like GIMP.
if you want to edit a sprite and your tool can't handle TGA format (unlikely),
you can still convert the file into a format of your choice with e.g.
imagemagick's `convert` tool, and then convert it back to TGA before creating
a new sprite pack.
run agsprite --help for usage information, and/or check the git log of
agsprite.c to read a lot of detailed commit messages.
agsalphahack:
a tool to remove alphachannel flags from gamefiles. can delete either all
or a single specified sprite number's alpha channel flag. this tool is a
supplement to agsprite.
agssim:
a simple simulator for ags assembly instructions.
run agssim --help for more info.
agsoptimize:
a python script which is run on some .s asm files, detecting common inefficient
patterns emitted by the AGS compiler, and replacing them with more efficient
versions. using all preset optimization patterns, this improves speed of the
CPU-heavy (because of a lots of scripts) game "Operation Forklift" by ~15-20%,
which is almost identical to the number of asm statements it removes.
another advantage is that the script files become smaller.
ascc:
the original AGS script compiler with some tweaks to support more C features.
it's pretty handy to generate assembly code to inject into scripts.
since ascc is based on the original AGS sources and is written in C++, it's
available in a different repository: https://github.com/rofl0r/ascc .
compilation:
------------
after acquiration of a C compiler toolchain (optimally GCC) and GNU make
(e.g. on ubuntu: `apt install build-essential`),
simply run `make`.
if you need any special CFLAGS, LDFLAGS etc put them into config.mak
or append them to the make command, i.e. `make CFLAGS="-O2 -g"`
third-party library requirements:
---------------------------------
none. \o/
License:
--------
there is a tiny part of code left from the original AGS engine, about 150 LOC in CLib32.c.
it is covered under the artistic license, see file header for details.
all other code is (C) 2012-2019 rofl0r and licensed under the LGPL 2.1+ with the "NO C++"
exception.
the "NO C++" exception means that you are not allowed to convert the code into C++, but
you can link it to C++ code.