diasurgical / devilutionX

Diablo build for modern operating systems
Other
7.98k stars 781 forks source link

Automatically install Shareware version #387

Open AJenbo opened 4 years ago

AJenbo commented 4 years ago

It would be nice if we had a tool that could automatically extract the spawn.mpq from the spawn installer. We could then include this tool in an installer that automatically fetches the shareware and extracts the mpq during installation.

This could be done using LibStorm so that it will work on any platform that DevilutionX works on.

image

http://ftp.blizzard.com/pub/demos/diablosw.exe

jcubic commented 4 years ago

Is it possible to do this by hand, I would like to play on Linux but before I buy the game to have original MPQ file I would like to test shareware version. I've found recently about Diablo Web and it use shareware version if one don't have MPQ file. https://d07riv.github.io/diabloweb/

AJenbo commented 4 years ago

Yes, use any MPQ tool on diablosw.exe and you will be able to extract spawn.mpq. Remember that you have to specify -DSPAWN=ON to CMake when you build DevilutionX for it to build the shareware version.

AJenbo commented 4 years ago

The menu for the shareware version is now fully implemented.

mewmew commented 4 years ago

Added a tool in mewspring/spawn_mpq@f74ad5d which extracts spawn.mpq from diablosw.exe. The extracted spawn.mpq hashsum is validated against that of Zezula's MPQ Editor.

The spawn_mpq tool may be used as follows:

Extracts spawn.mpq from diablosw.exe.

$ spawn_mpq diablosw.exe
# Output:
#
# extracting "overlay.mpq" from "diablosw.exe"
# extracting "spawn.mpq" from "overlay.mpq"
# creating file "_dump_/spawn.mpq"

Extracts spawn.mpq from http://ftp.blizzard.com/pub/demos/diablosw.exe

$ spawn_mpq
# Output:
#
# downloading "http://ftp.blizzard.com/pub/demos/diablosw.exe" (please wait)
# creating file "_dump_/diablosw.exe"
# extracting "overlay.mpq" from "_dump_/diablosw.exe"
# extracting "spawn.mpq" from "overlay.mpq"
# creating file "_dump_/spawn.mpq"

To download the spawn_mpq tool, run:

go get github.com/mewspring/spawn_mpq
AJenbo commented 4 years ago

Excellent this would go well with a Debian package 😊

muzena commented 4 years ago

@AJenbo I added -DSPAWN=ON flag to rules file, now devilutionX works only with demo version of diablo. I try execute: go get github.com/mewspring/spawn_mpq This command do nothing in Ubuntu, it seems to have some issues. I try to set up go from google search, export path in .profile add latest PPA, but without success.

AJenbo commented 3 years ago

To simplify this the spawn code has now been unified with the main program Meaning you only have to build one exec and future releases will be able to run the shareware version. This is either controlled per detection of mpq or you can force the retail version to run in spawned mode by providing --spawn as a parameter.

sskras commented 2 years ago

@AJenbo wrote:

Yes, use any MPQ tool on diablosw.exe and you will be able to extract spawn.mpq.

Do you really mean MPQ tool? I used MPQEditor 4.0, but it shows some incomprehendable stuff: image

Maybe you meant some PE-EXE extarction tool?

sskras commented 2 years ago

Now I found a script that uses 7z to extract the thing: https://github.com/pkegg/PortMaster-Build/blob/0fa59eacadd997ffb4e097540bc756d454a785cb/ports/devilution/package#L29

But it still not so obvious on the first sight:

$ 7z l diablosw.exe

7-Zip [64] 17.04 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.04 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,4 CPUs Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz (406E3),ASM,AES-NI)

Scanning the drive for archives:
1 file, 52223944 bytes (50 MiB)

Listing archive: diablosw.exe

--
Path = diablosw.exe
Type = PE
Physical Size = 52223944
CPU = x86
Characteristics = Executable 32-bit NoLineNums NoLocalSyms
Created = 1997-01-08 08:34:42
Headers Size = 1024
Checksum = 52245349
Name = setup.exe
Image Size = 188416
Section Alignment = 4096
File Alignment = 512
Code Size = 100352
Initialized Data Size = 72704
Uninitialized Data Size = 0
Linker Version = 4.20
OS Version = 4.0
Image Version = 0.0
Subsystem Version = 4.0
Subsystem = Windows GUI
Stack Reserve = 1048576
Stack Commit = 4096
Heap Reserve = 1048576
Heap Commit = 4096
Image Base = 4194304
Comment = FileVersion: 1.0.0.1
FileVersion: 1, 0, 0, 1
ProductVersion: 1.0.0.1
ProductVersion: 1, 0, 0, 1
CompanyName: Blizzard Entertainment
FileDescription: setup
InternalName: setup
LegalCopyright: Copyright © 1996
OriginalFilename: setup.exe
ProductName: Blizzard Entertainment setup

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
1997-01-08 08:34:42 .....       100352       100352  .text
1997-01-08 08:34:42 .....         7168         7168  .rdata
1997-01-08 08:34:42 .....        17408        17408  .data
1997-01-08 08:34:42 .....         5120         5120  .idata
                    .....         1432         1432  .rsrc/version.txt
                    .....         4374         4374  .rsrc/string.txt
                    .....         3774         3752  .rsrc/ICON/1.ico
                    .....          766          744  .rsrc/ICON/2.ico
                    .....          318          296  .rsrc/ICON/3.ico
                    .....          446          446  .rsrc/DIALOG/104
                    .....          268          268  .rsrc/DIALOG/105
                    .....          400          400  .rsrc/DIALOG/113
                    .....          400          400  .rsrc/DIALOG/114
                    .....         1290         1290  .rsrc/DIALOG/115
                    .....          184          184  .rsrc/DIALOG/200
                    .....          516          516  .rsrc/DIALOG/201
                    .....          508          508  .rsrc/DIALOG/202
                    .....          616          616  .rsrc/DIALOG/2010
                    .....          264          264  .rsrc/DIALOG/2011
                    .....           48           48  .rsrc/GROUP_ICON/DIABLO_SETUP
1997-01-08 08:34:42 .....         7168         7168  .reloc
1997-01-08 08:34:42 .....         3536         3536  CERTIFICATE
1997-01-08 08:34:42 .....     52066296     52066296  [0]
------------------- ----- ------------ ------------  ------------------------
1997-01-08 08:34:42           52222652     52222586  23 files

Looks like it's the [0] item (the last one from the list).

AJenbo commented 2 years ago

Do you really mean MPQ tool? I used MPQEditor 4.0, but it shows some incomprehendable stuff: image

Maybe you meant some PE-EXE extarction tool?

Yes i really did mean MPQ tools, you need to provide it with a list file (a text file with "spawn.mpq" should be enough for this) for it to be able to show file names. But you can even spot it in your list just by size: image

7z will probably just give you the parent MPQ portion of the exe, not so useful.

AJenbo commented 2 years ago

Here is a simple bash script that does the trick:

echo "spawn.mpq" > list.txt
wget http://ftp.blizzard.com/pub/demos/diablosw.exe
smpq -L list.txt -x diablosw.exe 'spawn.mpq'

(expects smpq and wget to be installed)

sskras commented 2 years ago

Thanks for the tool. I postpone building it (under MSYS2) for the future. Now I see, it will be easier for me to just install the original game.

Now:

Yes i really did mean MPQ tools, you need to provide it with a list file (a text file with "spawn.mpq" should be enough for this) for it to be able to show file names. ... 7z will probably just give you the parent MPQ portion of the exe, not so useful.

If this is an MPQ inside MPQ case, then it's fair enough.

What I don't understand is how does it differentiate between the other files (like click.wav) that should reside in the same virtual catalog inside the parent MPQ container.

But you can even spot it in your list just by size: image

I tried extracting it, but the tool fails for some reason:

image

Cheers.

AJenbo commented 2 years ago

What I don't understand is how does it differentiate between the other files (like click.wav) that should reside in the same virtual catalog inside the parent MPQ container.

The exe has the names build in to it, so doesn't need a list file.

I tried extracting it, but the tool fails for some reason:

Try providing it with the list file.

sskras commented 2 years ago

Yes, the list file helped.

But why does it need the name, why the file cannot be extracted anonymously?

Then these two statements contradicts IMO. If the .exe has the names built in, and the tool is opening that exe file, why the hell it even expects to give it in addition?

StephenCWills commented 2 years ago

The executable code knows the names of the files so it can decode the embedded MPQ when you run the executable. The executable can also be opened directly by MPQ tools because the MPQ format supports this, but they are not running the executable code and therefore do not know the names of the files.

qndel commented 2 years ago

Yes, the list file helped.

But why does it need the name, why the file cannot be extracted anonymously?

Then these two statements contradicts IMO. If the .exe has the names built in, and the tool is opening that exe file, why the hell it even expects to give it in addition?

How about moving to discord? We aren't really here to cover your lack of knowledge regarding handing MPQ files :/