[TOOL] .hwl unpack utility

The role-playing games (I-X) that started it all and the various spin-offs (including Dark Messiah).
Emjayen
Peasant
Peasant
Posts: 53
Joined: 01 Aug 2013
Location: Sydney, Australia
Contact:

[TOOL] .hwl unpack utility

Unread postby Emjayen » 17 Sep 2018, 12:43

I noticed there doesn't appear to be anything around for unpacking these archives and so I've made one of my internal tools friendlier for public use. You can download it here

Example usage: hwl /f:bmp /s:somearchive.hwl

Above will unpack the textures contained in the HWL archive file somearchive.hwl to the current directory in bitmap format (A1R5G5B5)


EDIT: Source is available here
Last edited by Emjayen on 22 Mar 2019, 10:41, edited 1 time in total.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1660
Joined: 29 Nov 2005

Re: [TOOL] .hwl unpack utility

Unread postby GrayFace » 17 Sep 2018, 14:46

There was a tool for it somewhere, but just a few days ago I tried to find it and couldn't. I'm wondering though what use there is for it now. I recalled it because I was thinking of making HD textures in mods only in D3D and doing it via HWL, but decided that having them in a "magic" LOD might be better, because PaletteSMul and PaletteVMul options would be respected. For HWL the textures have to be pre-filtered.
Last edited by GrayFace on 17 Sep 2018, 14:48, edited 2 times in total.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1660
Joined: 29 Nov 2005

Re: [TOOL] .hwl unpack utility

Unread postby GrayFace » 21 Mar 2019, 06:54

I found the tool I had used in the past: http://mm6789.narod.ru/files/might_and_ ... wl2bmp.rar
Maybe I'll use HWL format after all. Though, I'll probably make a new LOD-based format instead (with HWL structures for individual files, but not for archive structure). Thinking about ways to support HD 16-bit textures in D3D mode.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

Emjayen
Peasant
Peasant
Posts: 53
Joined: 01 Aug 2013
Location: Sydney, Australia
Contact:

Re: [TOOL] .hwl unpack utility

Unread postby Emjayen » 21 Mar 2019, 22:30

There's a mechanism of my next MMCL revision that could be leveraged. At present it provides an optional, run-time filtering layer for textures; generating a scaled up mipchain version in technically any native hardware format, for now just the usual 32-bit R8G8B8A8 due to ubiquitous support.
Last edited by Emjayen on 21 Mar 2019, 22:58, edited 3 times in total.

User avatar
Erisian
Leprechaun
Leprechaun
Posts: 31
Joined: 15 Mar 2019
Location: Gothenburg Sweden

Re: [TOOL] .hwl unpack utility

Unread postby Erisian » 22 Mar 2019, 09:56

How do you open a texture file using these tools?
"It is good to have an end to journey towards, but it is the journey that matters in the end"
(Ursula K Le Guin)

Emjayen
Peasant
Peasant
Posts: 53
Joined: 01 Aug 2013
Location: Sydney, Australia
Contact:

Re: [TOOL] .hwl unpack utility

Unread postby Emjayen » 22 Mar 2019, 10:29

They're located in your game installation's "DATA" directory, e.g: d3dsprite.hwl
Last edited by Emjayen on 22 Mar 2019, 10:30, edited 1 time in total.

User avatar
Erisian
Leprechaun
Leprechaun
Posts: 31
Joined: 15 Mar 2019
Location: Gothenburg Sweden

Re: [TOOL] .hwl unpack utility

Unread postby Erisian » 23 Mar 2019, 11:18

Emjayen wrote:They're located in your game installation's "DATA" directory, e.g: d3dsprite.hwl
When I try to run the software nothing happens. I also tried highlighting the .hwl file then choosing "open with hwl" but again nothing happens. What do I do with the exe to make it work?
"It is good to have an end to journey towards, but it is the journey that matters in the end"
(Ursula K Le Guin)

Emjayen
Peasant
Peasant
Posts: 53
Joined: 01 Aug 2013
Location: Sydney, Australia
Contact:

Re: [TOOL] .hwl unpack utility

Unread postby Emjayen » 23 Mar 2019, 20:26

It's a command-line tool.

Easiest thing to do would be:

- Copy hwl.exe to your DATA directory
- In the explorer address bar, type cmd
- Use the syntax described in the OP, so e.g hwl /o:sprites /f:bmp /s:d3dsprite.hwl

EDIT: I've updated it to support how you're trying to invoke it (e.g, you can use explorer's "Open With" and it'll work with some sane defaults) -- download link is the same
Last edited by Emjayen on 23 Mar 2019, 23:33, edited 1 time in total.

User avatar
Erisian
Leprechaun
Leprechaun
Posts: 31
Joined: 15 Mar 2019
Location: Gothenburg Sweden

Re: [TOOL] .hwl unpack utility

Unread postby Erisian » 25 Mar 2019, 10:46

Emjayen wrote:EDIT: I've updated it to support how you're trying to invoke it (e.g, you can use explorer's "Open With" and it'll work with some sane defaults) -- download link is the same
Wow, thank you. I wasn't expecting you to change anything but I'm glad you did. I suppose I should stop being lazy and learn to use command line really. It might open doors for me but thank you for this.
"It is good to have an end to journey towards, but it is the journey that matters in the end"
(Ursula K Le Guin)

User avatar
Dragonfly
Leprechaun
Leprechaun
Posts: 23
Joined: 27 Sep 2017

Re: [TOOL] .hwl unpack utility

Unread postby Dragonfly » 12 May 2019, 05:47

Hey! Great tool!
Can we make the oppositte? Add/replace a texture from an HWL file?
Was trying to compile the code but I can't resolve
#include <pce\pce.h>
#include <pce\pce_crt.h>
I'm using VS2017
Am I missing an external reference?
Thanks

Emjayen
Peasant
Peasant
Posts: 53
Joined: 01 Aug 2013
Location: Sydney, Australia
Contact:

Re: [TOOL] .hwl unpack utility

Unread postby Emjayen » 18 Jun 2019, 05:46

If you're still in need of such functionality (writing HWL) let me know.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1660
Joined: 29 Nov 2005

Re: [TOOL] .hwl unpack utility

Unread postby GrayFace » 23 Jun 2019, 21:10

The patch will support new LOD-based LWD format with 24-bit textures. (also gotta ditch 16-bit textures internally, but not in the coming patch version)
Last edited by GrayFace on 26 Jun 2019, 23:52, edited 3 times in total.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
Dragonfly
Leprechaun
Leprechaun
Posts: 23
Joined: 27 Sep 2017

Re: [TOOL] .hwl unpack utility

Unread postby Dragonfly » 25 Jun 2019, 03:52

GrayFace wrote:The patch will support new LOD-based LWD format with 24-bit textures. (also gotta ditch 16-bit textures internally, but not in the coming patch version)
superb!!!

User avatar
tomchen1989
Pixie
Pixie
Posts: 136
Joined: 21 Jun 2008
Location: Europe / China

Re: [TOOL] .hwl unpack utility

Unread postby tomchen1989 » 29 Oct 2021, 21:14

GrayFace wrote: 21 Mar 2019, 06:54 I found the tool I had used in the past: http://mm6789.narod.ru/files/might_and_ ... wl2bmp.rar
Maybe I'll use HWL format after all. Though, I'll probably make a new LOD-based format instead (with HWL structures for individual files, but not for archive structure). Thinking about ways to support HD 16-bit textures in D3D mode.
http://mm6789.narod.ru/files/might_and_ ... wl2bmp.rar may be blocked by some browser or ads blocker I don't know. If anyone wants to download it but cannot do it, copy the link and paste it in the address bar and enter.

---------

Simple usage:

Put hwl2bmp.exe directly in C:\, then search cmd and open Command Prompt, then enter something like:

Code: Select all

C:\>hwl2bmp "C:\game\mm7en\DATA\d3dsprite.hwl" C:\game\output\
The output folder must exist before the execution of the command!

---------

There's a description file in Russian and encoded with Russian encoding (cp1251) in hwl2bmp.rar, here's a rough English translation in case anyone needs it:
The HWL file format of Might & Magic VIII

These files contain the graphics used by the 3D gas pedal.
The file format is:

0 signature (DWORD) "D3DT"
4 offset to the beginning of the FAT
8..n data

FAT format:

Pretty convoluted :)

0 number of entries in FAT (DWORD)
4 FAT

FAT consists of 2 parts placed one after another

First part is file names - each record is 14h bytes long
file name starts at position 0 and reads to the first 0 (ASCIIZ).
The rest of the record is garbage.

The second part is just after the first one. It's just an array of offsets
from the beginning of the HWL to the files stored in it. (DWORD)

The files format:

The files themselves are 15-bit graphics (5:5:5), header
and packed with ZLib. The length of the header is 24h. The following fields are of interest:

0 packed data size (DWORD)
14h sprite width (DWORD)
18h sprite height (DWORD)

the rest is junk.

A command line program to unpack ALL of the HWL into a designated directory and simultaneously
to BMP at the same time.

Success in unpacking toys.
Andrey Ermakov aka Jel.


Return to “Might and Magic”

Who is online

Users browsing this forum: No registered users and 55 guests