Comments (5)
Here's a very rudimentary decoder you can use in fq
. Run fq -d raw -i . MAPS2.wad
and paste the following into the REPL:
def num_le: tobytes|explode|reverse|map(. band 0xff)|tobytes|tonumber;
tobytes as $file | {}
| .type = $file[:4]
| .n_lumps = ($file[4:8]|num_le)
| .offset = ($file[8:12]|num_le)
| ($file[.offset:]) as $lumpdir
| .lumps = [
range(.n_lumps)
| ($lumpdir[16* . :16*( . +1)]) as $rec | {}
| .offset = ($rec[:4]|num_le)
|.size = ($rec[4:8]|num_le)
|.name = ($rec[8:16]|gsub("\u0000";""))
|.data = $file[.offset:.offset+.size]
]
fq
doesn't support creating Decode Values, so you don't get those nice-looking hexdumps like this, but it's a start.
from fq.
Hey! sure i'm willing to add any format that is used publicly. Want to work on adding support? as it seems to be a quite basic archive format i'm guessing it shouldn't be that much work.
from fq.
Definitely! I can't say I'm familiar with the internals of fq
just yet but I would love to get started and see what I can pull off. Doom WADs have a very simple structure of header, LUMP table, then a blob of all object tables. It should be fun to add in.
from fq.
Nice! hopefully you should not need to know much about most internals, the decode API used by a format decoders don't know much a the rest of fq on puropse. Maybe a good start is to look at some existing format decode that is similar, maybe ar, tar or zip? also i'm happy to help out, you can for example open a PR with a early draft and then we work from that.
from fq.
Nice! tip is to put the code into a file wad.jq
as a function from_wad
and then do fq -d bytes -I . 'include "wad"; from_wad' file.wad
btw is this for an older version of fq? the band
infix-operator is now a function band/2
and -d raw
has been split into bytes
and bits
for different slicing units.
from fq.
Related Issues (20)
- problems with zip support HOT 21
- Add TLS support
- Runtime/bespoke format support like kaitai struct HOT 12
- Msgpack: fixstr gets wrong length HOT 4
- Editing a binary HOT 9
- demo.svg looks wired in my environment HOT 11
- [feature] shell completions HOT 3
- [Feature request] Support cwf, swf, zwf HOT 1
- [Feature request] Support pdf HOT 1
- [feature] add decimal floating-point number support HOT 2
- mp3 file with id3 2.4.0 got killed from console output HOT 6
- typo HOT 3
- [Documentation] Any interest in creating a man page? HOT 5
- Feature request: zero-length start/end properties HOT 7
- Support for non-canonical tags with html HOT 5
- Color output is unreadable on terminals using light backgrounds. HOT 4
- make use of kaitai struct for additional formats? HOT 4
- [Feature request] Support image/bmp HOT 1
- Format Decoder Conventions HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fq.