{"id":16842555,"url":"https://github.com/rofl0r/agsutils","last_synced_at":"2025-03-22T05:31:10.314Z","repository":{"id":5598318,"uuid":"6805145","full_name":"rofl0r/agsutils","owner":"rofl0r","description":"contains utils for AGS: game extractor, repacker, disassembler and assembler","archived":false,"fork":false,"pushed_at":"2025-02-28T21:13:15.000Z","size":484,"stargazers_count":47,"open_issues_count":9,"forks_count":14,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-18T08:48:10.199Z","etag":null,"topics":["ags","assembler","disassembler","unpacker"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rofl0r.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-11-21T23:51:28.000Z","updated_at":"2025-03-09T16:40:28.000Z","dependencies_parsed_at":"2024-10-28T12:25:35.285Z","dependency_job_id":"ac0e7403-628c-493a-8a25-6223f2bc6a04","html_url":"https://github.com/rofl0r/agsutils","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fagsutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fagsutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fagsutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fagsutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rofl0r","download_url":"https://codeload.github.com/rofl0r/agsutils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244912800,"owners_count":20530764,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ags","assembler","disassembler","unpacker"],"created_at":"2024-10-13T12:46:39.017Z","updated_at":"2025-03-22T05:31:10.308Z","avatar_url":"https://github.com/rofl0r.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"agsutils by rofl0r\n==================\n\ntools for (un)packing, disassembling, modifying and recompiling ags games.\n\nagsex:\n  runs agstract and agscriptxtract, then creates a Makefile with rules\n  to quickly and automatically repack a pack with changed asm files.\n  this basically does everything for you automatically.\n  can also use `make optimize` to run agsoptimize on all asm files.\n\nagstract:\n  extracts the files a game \"pack\" (.exe) consists of.\n  creates a file agspack.info which contains metadata about the\n  files included in the pack.\n  example:\n\n\tagstract 252test.exe FILES\n\t:::AGStract 0.9.1 by rofl0r:::\n\t252test.exe: version 10, containing 6 files.\n\tac2game.dta -\u003e FILES/ac2game.dta\n\tacsprset.spr -\u003e FILES/acsprset.spr\n\tagsfnt0.wfn -\u003e FILES/agsfnt0.wfn\n\tagsfnt1.wfn -\u003e FILES/agsfnt1.wfn\n\tagsfnt2.wfn -\u003e FILES/agsfnt2.wfn\n\troom1.crm -\u003e FILES/room1.crm\n\n  agstract can also extract speech.vox and audio.vox files.\n  make sure to use a different output directory, otherwise your\n  agspack.info will be overwritten.\n\n  in some games, speech.vox is insanely big because the speech files are\n  saved in studio quality.\n\n  i achieved good results by converting them to 16Khz via ffmpeg:\n\n      for i in SPEECH/*.ogg ; do\n        ffmpeg -i \"$i\" -c:a libvorbis -ar 16384 tmp.oga \u0026\u0026 mv tmp.oga \"$i\"\n      done\n\n  then repacking it with agspack, which results in about 6x space improvement.\n\n  for audio.vox, you might want to use -b:a 80k instead of -ar 16384.\n  this shrinks input files by about 400% with almost CD-like quality.\n\nagspack:\n  takes the files created by agstract and makes a new bundle out of it.\n  example:\n\n\tagspack FILES/ 252mytest.ags\n\tagspack -e FILES/ 252mytest.exe\n\n  without arguments, agspack produces a game pack missing the original\n  windows exe stub, but is compatible with the opensource AGS engine,\n  as well as with scummvm ags port.\n  that way, a game is about 500 KB smaller after extract and repack than it\n  originally was.\n\n  using the -e option, the original exestub is prepended to the game pack,\n  and the offset to the start of the pack data encoded into the end signature,\n  which reproduces the fully working windows executable with the new content.\n\n  note that agspack always produces a version 20/30 packfile, compatible only\n  with ags 3.0 or newer, so if your exe stub is from an earlier game, it\n  will fail to recognize the attached game data. in such a case you can\n  use the exestub from a newer version, e.g.\n  https://github.com/ags-archives/engines/blob/master/ags302sp1/acwin.exe\n  save it as agspack.exestub in your extract directory.\n\nagscriptxtract:\n  detects and unpacks all binary scripts embedded in room and game files.\n  the compiled scripts are stored with a .o extension, the disassembled files with .s.\n  example:\n\n        mkdir OBJ ; cd OBJ\n\tagscriptxtract ../FILES\n\tdisassembling globalscript.o -\u003e globalscript.s\n\tdisassembling room1.o -\u003e room1.s\n\nagsdisas:\n  disassembles a single .o file to .s. useful to compare a re-assembled file with the original.\n  example:\n\n\tagsdisas room1.o room1.s\n\tdisassembling room1.o -\u003e room1.s\n\nagssemble:\n  creates a compiled object file from a .s assembly file.\n  example:\n\n\tagssemble room1.s\n\tcreates a new room1.o (you will notice filesize/date has changed)\n\n  the compiled object file will miss unused strings and thus be smaller than the original.\n  also imports and exports cover only really used ones.\n\nagsinject:\n  once you have recompiled an .o file with agssemble, you can inject it into the original\n  container file (either a .crm room file or a game file like \"ac2game.dta\")\n  example:\n\n\tagsinject 0 OBJ/room1.o FILES/room1.crm\n\n\tinjects room1.o at the first found script (0) in room1.crm.\n\trooms have only 1 script so you must always use 0.\n\tfor ac2game.dta kinda gamefiles, the index is i.e. 0 for the globalscript,\n\t1 for the dialogscript (if one exists), otherwise 1 is the first gamescript, etc.\n\n  after you injected your .o file, the next thing you want to do is agspack it all up again.\n  then you can test your changes in the ags engine.\n\nagsprite:\n  a tool to extract sprites from acsprset.spr files, and to create a new one\n  from a directory full of extracted sprites. has several options to create\n  smaller spritecache files than original, for example by converting all\n  true-color images to high-color, which is almost impossible to differentiate\n  visually.\n  unfortunately ags saves a \"uses alpha channel\" flag for every sprite in a\n  different file.\n  if it was set, a picture converted from 32 to 16bit will become\n  invisible, unless it is fixed with `agsalphahack` tool.\n  after repacking a .spr file, a new sprindex.dat must be created and the old\n  one replaced with it (if one existed). agsprite has an option for that too.\n  optionally, the old sprindex.dat can simply be removed by commenting out the\n  line with sprindex.dat in agspack.info and reducing the filecount by 1.\n  at present, agsprite only creates and accepts TGA files.\n  if you want to edit a sprite and your tool can't handle TGA format (unlikely),\n  you can still convert the file into a format of your choice with e.g.\n  imagemagick's `convert` tool, and then convert it back to TGA before creating\n  a new sprite pack.\n  run agsprite --help for usage information, and/or check the git log of\n  agsprite.c to read a lot of detailed commit messages.\n\nagsalphahack:\n  a tool to remove alphachannel flags from gamefiles. can delete either all\n  or a single specified sprite number's alpha channel flag. this tool is a\n  supplement to agsprite.\n\nagsalphainfo:\n  a tool to print alphachannel information for each sprite.\n\nagssim:\n  a simple simulator for ags assembly instructions.\n  run agssim --help for more info.\n\nagsoptimize:\n  a python script which is run on some .s asm files, detecting common inefficient\n  patterns emitted by the AGS compiler, and replacing them with more efficient\n  versions. using all preset optimization patterns, this improves speed of the\n  CPU-heavy (because of a lots of scripts) game \"Operation Forklift\" by ~15-20%,\n  which is almost identical to the number of asm statements it removes.\n  another advantage is that the script files become smaller.\n\nascc:\n  the original AGS script compiler with some tweaks to support more C features.\n  it's pretty handy to generate assembly code to inject into scripts.\n  since ascc is based on the original AGS sources and is written in C++, it's\n  available in a different repository: https://github.com/rofl0r/ascc .\n\n\ncompilation:\n------------\n\nafter acquiration of a C compiler toolchain (optimally GCC) and GNU make\n(e.g. on ubuntu: `apt install build-essential`),\n\nsimply run `make`.\n\nif you need any special CFLAGS, LDFLAGS etc put them into config.mak\nor append them to the make command, i.e. `make CFLAGS=\"-O2 -g\"`\n\ncompilation on windos:\n----------------------\n\nmingw is not supported. it' s a half-baked PoS, which lacks a dozen or more of\nthe POSIX APIs we require. worse than that, it even has *wrong* prototypes\nfor some of them, for example it defines mkdir(char*), but the proper prototype\nis mkdir(char*, int), so we'd have to litter the code with #ifdefs and remove\nparts of the functionality to support it. that's not gonna happen.\n\nuse cygwin. with cygwin, every works just fine without *any* changes. you can\neven run `make` and it produces files with .exe extensions even though we don't\nhave a rule for that anywhere. you only need to ship cygwin-1.dll together with\nthe binaries.\n\nNEW!!! agsutils can now also be compiled using [PellesC](http://www.smorgasbordet.com/pellesc/)\n(use [pellescc wrapper](https://github.com/rofl0r/pellescc) to build from Makefile).\n\nalternatively you can use WSL/WSL2 and just use native linux compiler and the\nbinaries inside the WSL environment.\n\nthird-party library requirements:\n---------------------------------\nnone. \\o/\n\nsupported AGS versions:\n-----------------------\nlike the opensource AGS engine, version 2.0 - 2.4 aren't properly supported\ndue to lack of available format information. currently it's possible to\nextract the packfiles, sprites, and scripts (for 2.2+).\nfull support for those might be completed at some point in the future.\nall versions \u003e= 2.5.0 are supported, and if one of the tools bails out on them\nit's considered a bug.\n\nLicense:\n--------\nthere is a tiny part of code left from the original AGS engine, about 150 LOC\nin CLib32.c.\nit is covered under the artistic license, see file header for details.\nall other code is (C) 2012-2025 rofl0r and licensed under the LGPL 2.1+ with\nthe \"NO C++\" exception.\nthe \"NO C++\" exception means that you are not allowed to convert the code into\nC++, but you can link it to C++ code.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frofl0r%2Fagsutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frofl0r%2Fagsutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frofl0r%2Fagsutils/lists"}