Jump to content

Rewriting Cryo's Dune 1 : it seems possible !!!


Monsieur OUXX
 Share

Recommended Posts

Hello

I'm interested to port excelent Cryo's Dune to my self built arm (cortex-m3) based embedded board (like small gaming console).

Is anybody in this thread still working on rewriting DUNE?

Did you progress more, than unhsq? Do you have some kind of sources?

I disassembled LOGO.EXE. After I fixed source, I assembled again with Turbo Assembler from Borland.

It runs under DOSBOX. Now I rewriting it to C. It will soon run under DOSBOX compiled from C source.

LOGO.EXE plays LOGO.HNM file and shows many tricks how graphics are organized and encoded in files.

I say all DUNE was originaly writen in assembly because sources does'nt include entry/exit codes common in higher level languages.

All values and params are passed in registers, it means there is no parameter stack frame in procedures.

LOGO will soon also run under WIN32 with SDL library.

Sorry, if my english is not good

Link to comment
Share on other sites

I've read about the project and i really want to revive the dune 1 even if that's just to reveal it's secrets!

there is a lot of progress since the project started but now i see that it has stopped.

the experts have managed to finally extract the sound(or i misunderstood?)

http://nyerguds.arsaneus-design.com/dune/dune1

and the static icons

http://www.bigs.fr/dune_old/

i personally am interested in the map recreation

http://www.cbm.eng.br/cbm/dune/map.htm

@bigs:please can you give me a clue on (map2.hsq-->map2.___)-->map2.bmp

Link to comment
Share on other sites

Hello

Did you noticed that files dune386.hsq, duneadl.hsq, duneagd.hsq,dunemid.hsq,dunesdb.hsq,dunevga.hsq are hsq packed drivers of respective devices?

Upacked files contains entry table of different length at begining and entry addresses disassembles correctly.

Link to comment
Share on other sites

Hey guys,

recently i was taking a look at the CD version with ida...

yes honza you are correct , they're drivers for the various hardware

included is an ida 4.9 db, it has the dunevga.hsq loaded to seg002. its not complete, but its a start... most of the loading routines are figured out, as well as the menu/interface system, main loop and some associated stuff.. but there is alot of work to be done,

ive been considering implementing this as an engine for scummvm, but dont really have the time to dedicate myself fully to it (ive done the file loading routines)

IDA DB:

http://www.mediafire.com/?yoqlwgqmkqm

Link to comment
Share on other sites

Do somebody have hsqpack routine or tool (source in c or c++) or have to be written?

I disasembled duneadl, duneagd and dunesdb drivers and compiled again from new asm sources. I get same image as original drivers, I'm not afraid of than will not work correctly (or I will fix it). But I want to check to be sure and replace original drivers with new one. Problem is, that drivers have to be hsq-packed before testing.

Thanks

Link to comment
Share on other sites

  • 2 weeks later...

Hey MrFlibble, it has been hasnt it?

I miss the Dune RE days :P it was alot of fun ;)

Did recently however finish up another project,

http://creep.sourceforge.net/

port of an old Commodore64 Game

Honza, you could try setting breakpoints before the unpack routine executes and merely adjust the EIP ahead once the file your testing has been loaded (ive mapped out most of the loading/unpack routines in the IDA db posted previously ).

Link to comment
Share on other sites

Hey MrFlibble, it has been hasnt it?

I miss the Dune RE days :P it was alot of fun ;)

If you're getting nostalgic about the Dune RE days, you might just wanna take a quick look on how I've made use of and developed your OD 2 code further.

I'd like to think that you'll be happy to see that your code was made actual use of and to great benefit for others directly,

rather than being left behind abandoned and unused (worst fate I can think of for my code to suffer, I'm such a sentimental when it comes to it;)!

:D

Have nice weekend! :)

Link to comment
Share on other sites

Hello

I am sorry, I don't have a lot of free time now. Actualy I am programming hsq (compression) tool, but i still not finish. I also have to figure out how drivers works. I'll be back after some time with new uploads. I don't understand IDA disassembler. I'm using my dissassembler, which is able produce asm source. If somebody also trying disaasembly executables, have to be noticed that exe files are packed with lzexe (originated from Fabrice Bellard). You can see "LZ91" signature after ececutable header, so it's recomended to uncompress exe files before with unlzexe tool. I would like to continue after I get more free time. I attached unlzexe tool adapted for visualc/win32.

unlzexe.zip

Link to comment
Share on other sites

Hi, it's nice to see, even after all this time, that this project is slowly going on :)

If I remember correctly, bigs came up with an hsq-compressor of his own, written in C, and, testing it on the BALCON.UNP uncompressed file, it seemed to produce the original BALCON.HSQ archive.

Unfortunately, there is no link on www.bigs.fr/dune_old to download it...  Maybe if we contact him

he still has the source...

Rymoah

Link to comment
Share on other sites

Hello

I can upload binary + source of hsq compressor/decompressor adapted for dos (working under dosbox) and precompiled binary for win32, if you are interested. Unfortunately I still have no much time to make more tool testing. This command line tool is simple to use:

hsq -x infile outfile ... to extract packed file data

hsq infile outfile ... to compress data

If you enable selftest you would be able to extract hsq packed game data files. If you find some bugs, please let me to know. Your old source of unhsq tool seems doesn't proceess larger files under win32, my tool have to do. Actualy I'm disassembling duneprg - main executable.

Keep a good work.

Link to comment
Share on other sites

If you enable selftest you would be able to extract hsq packed game data files. If you find some bugs, please let me to know. Your old source of unhsq tool seems doesn't proceess larger files under win32, my tool have to do. Actualy I'm disassembling duneprg - main executable.

Keep a good work.

Exactly, what do you mean by "larger" files? I remember the old unhsq seemed to unpack all the hsq files contained in the game... and even the hnm videos (they are compressed with the same routine), which,

considered those stored on the CD version, are very large.

Rymoah

Link to comment
Share on other sites

Hello rymoah

Well, clear some mistakes now would be fair.

>>>>I remember the old unhsq seemed to unpack all the hsq files contained in the game... and even the hnm videos

Hnm (256 color, paletized) video files are not hsq packed. Its impossible to unpack them with unhsq tool.

unhsq tool cannot success, because checks header (6 heading bytes). Remember unhsq code:

char unpack2(byte *src, byte *dst) {

byte *src2 = src, *dst2 = dst;

if (((src[0] + src[1] + src[2] + src[3] + src[4] + src[5]) & 0xff) != 171)

return 0;

Header bytes has special meaning

byte0 + (byte1 << 8) + (byte2 << 16) forms size of unpacked data (limited up to 16MB)

byte3 + (byte4 << 8) forms size of packed data (limited up to 64kB)

This means sum of 6 heading bytes must result 0xab => data are hsq packed. But some blocks of internal data would be hsq packed.

There is special flag in high byte of image width (or height, I don't remember) signaling to apply unhsq method on current block.

If you are interested about this old video format you may look wiki pages. I disassembled logo.exe (uses logo.hnm file).

Logo.hnm start with first block size followed by palete data. Unhsq must always fail.

Unhsq tool has several bugs which escalate to unpredictable results, memory corruption or tool colapse.

Author generaly ignnores results of functions (nothing against him).

for example:

size = *((short *) src) ;

dst = (byte *) malloc(size);

ori_dst = dst;

This code results in access violation (win32) during access to allocated memory, when requested memory is not available. This doesn't occure offten.

>>>> Exactly, what do you mean by larger files ?

      unsigned short size = 0;

      fseek(f, 3, SEEK_SET);

      fread(&size, 2, 1, f);

      byte *data = (byte *) malloc(size);

  printf("source =%xn",data);

      fseek(f, 0, SEEK_SET);

      fread(data, size, 1, f);

Functions fread and fwrite (win32, visual c compiler) fail allways, if you try to read/write large blocks (about 64k in size) or specialy whole file. Try it.

Sorry if I'm impreccise, sorry my english is not good.

I wish you succes.

Link to comment
Share on other sites

Hello rymoah.

Sorry, I forgot very important think.

Unhsq tool allocates memory for unpacked data, after reading size of data from header. Size value storage is 2 bytes. It means unhsq is able unpack files with maximal size 65535 bytes. You also have to get message "unpacking ... done" or "unpacking ... failed" on your screen.

Link to comment
Share on other sites

Hi honza.c,

My bad, I remembered incorrectly how hnm videos work (it's been a while since I don't spend time on this project).

In facts, we were talking about two different video formats: hnm videos like logo.hnm (which

you managed to disassemble its player, logo.exe) are coded with HNM version 0. Videos included in the CD version of the game are instead coded with HNM version 1.

As you can see in this wiki page

http://wiki.multimedia.cx/index.php?title=HNM_%281%29

an HNM-1 video file is splitted in several chunks, and each of them begins with a 6 bytes header. If the sum of these 6 bytes is 171 (that is, 0xAB) then the chunk represents a keyframe and it is hsq-compressed.

Rymoah

Link to comment
Share on other sites

I Agree. Thanks.

Maybe I will write new hnm player based on tricks and algos figured out from logo.exe and on docs available. If I get more time. I tested hsq compression. Works well for files about 1MB under win32. Under dosbox - imposible. Very long time no response ...

If will you want to unpack large files (>64kB) with my tool hsq, you must break unhsq compatible header checking.

Look for decompress function and replace line:

if (isize != bitstream_p->ifsize) {

with:

if (isize != (bitstream_p->ifsize & 0x0000ffff)) {

Link to comment
Share on other sites

Honza, you are doing a great job  :)

About the hnm videos, if you look back in the pages of this thread I have attached c++ source for

a program to decode them, written by Vladimir "VAG" Gneushev (unfortunately it is not a player but a frame dumper)... Maybe it could be useful to you. Be aware that it is designed only for HNM-1 videos; once, in facts, I tried to run it with logo.hnm which is HNM-0 formatted, and it gave me frames with messy colors.

VAG was really surprised that the program didn't crash, since it told me that version 0 and 1 of HNM codec are quite different  ;D

Rymoah

Link to comment
Share on other sites

Good, I read wiki pages.

Formats are realy different. I think organization of game data is most based on "cryo" vesion 0. I will tell more after I disassembly duneprg.exe and I build new game executables from asm sources. I partialy rewriten logo.asm to logo.c, but I stoped it for a while. I'm focussed to duneprg now.

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...