GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - JasperGeurtz/JSFMPQ: Java library to read and modify StarCraft:Broodwar MPQ's

BranchesTags
Open more actions menu

Latest commit

 

History

27 Commits
27 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

Repository files navigation

JSFMPQ

Java library to

  • read and modify StarCraft:Broodwar MPQ's (archiving file format used by Blizzard games)
  • extract files contained in those MPQ's
  • decompile & compile TBL files (Starcraft text string)

(Uses SFmpqapi internally to manipulate the MPQ's)

MPQ

This library offers 3 layers of abstraction to manipulate MPQ's:

  • MPQEditor: highest level, offers easy and simple manipulation of MPQ archives (enough for most use cases)
  • SFMPQ: lowest level, pure C-style calls, only use if you know what you are doing
  • SFMPQWrapper: middle level, still pretty lowlevel, but has a more intuitive interface for Java programmers

TBL

  • TBLTools.decompile tbl→txt
  • TBLTools.compile txt→tbl

Installation

  • Add to your project tools via JitPack: https://jitpack.io/#JasperGeurtz/JSFMPQ
  • Alternatively compile yourself: mvn package

Example Usage

Modifying hotkeys for StarCraft:Broodwar

public class CustomHotkeys {
   public static void main(String[] args) {
       Path patchMPQ = Paths.get("src/test/resources/patch_rt.mpq");

       // Open MPQ file
       try (MPQEditor editor = new MPQEditor(patchMPQ)) {
           String hotkeysFilename = "rez\\stat_txt.tbl";
           assert editor.hasFile(hotkeysFilename);

           // Extract hotkey file
           byte[] keyBytes = editor.extractFileBuffer(hotkeysFilename);

           // change zergling hotkey from `z` to `m`
           List<String> strings = TBLTools.decompile(keyBytes);
           int idx = strings.indexOf("z<1>Morph to <3>Z<1>erglings<0>");
           strings.set(idx, "m<1>Morph to Zerglings<0><3>M<1>");
           byte[] newKeyBytes = TBLTools.compile(strings);

           // update the hotkey file
           editor.addFileFromBuffer(newKeyBytes, "rez\\stat_txt.tbl");

       } catch (IOException e) {
           e.printStackTrace();
       }
   }
}

Todo

  • command line application (on request)
  • support more SC:BW formats? (on request)

About

Java library to read and modify StarCraft:Broodwar MPQ's

Resources

Readme
MIT license
Activity

Stars

4 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.