The Forum is up for sale: XeNTaX Forum looking for new owner

Bad toys 3d

The Original Forum. Game archives, full of resources. How to open them? Get help here.
smokeTH
n00b
Posts: 16
Joined: Mon Apr 25, 2011 10:33 pm
Been thanked: 1 time

Bad toys 3d

Post by smokeTH »

Here is a tough one. The program itself is 16bit wolfenstein-like game which i belive was made for originally win 3.2 (but because of good coding it works even under win7 32bit).
Basically i need to unpack its data archive. Hyper-ripper from dragon unpacker was able to extract only wav and some bmp files, but not sprites, neither tiles. Halp! :?

This is main game archive (i believe it is).
http://dl.dropbox.com/u/9288177/data.pck

P.S. This file is not any pck that Internet knows. It was made in ~ 1993 or a bit later years...

UPG: :D

Resources have been released via zdoom forums.
http://forum.zdoom.org/viewtopic.php?f=37&t=49998
Last edited by smokeTH on Fri Nov 27, 2015 7:11 pm, edited 1 time in total.
User avatar
aluigi
VVIP member
VVIP member
Posts: 1916
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 661 times
Contact:

Re: Bad toys 3d

Post by aluigi »

script for QuickBMS:

Code: Select all

get NAMESZ byte
getdstring NAME NAMESZ
get OFFSET long
get FILES long
goto OFFSET
for i = 0 < FILES
    getdstring NAME 8
    get OFFSET long
    get SIZE long
    log NAME OFFSET SIZE
next i
smokeTH
n00b
Posts: 16
Joined: Mon Apr 25, 2011 10:33 pm
Been thanked: 1 time

Re: Bad toys 3d

Post by smokeTH »

:mrgreen: oops..wait i'll see. if this is completed script...then....
smokeTH
n00b
Posts: 16
Joined: Mon Apr 25, 2011 10:33 pm
Been thanked: 1 time

Re: Bad toys 3d

Post by smokeTH »

another question.... how can i define file types? BM its bitmap, SND is Wav pcm..another ones is.....*confused*
What i got is that those bmp files named in archive after their hexadecimal headers.
Darkfox
VVIP member
VVIP member
Posts: 688
Joined: Fri Jul 04, 2003 6:11 pm
Has thanked: 33 times
Been thanked: 16 times

Re: Bad toys 3d

Post by Darkfox »

For Bad Toys 3D I believe not all data is contained in the pck but in the EXE, such as sprites and textures. Am I correct?


Edit: Apparently so.
smokeTH
n00b
Posts: 16
Joined: Mon Apr 25, 2011 10:33 pm
Been thanked: 1 time

Re: Bad toys 3d

Post by smokeTH »

i don't think so. ya see - there is around half of that pck file with unknown files. and there is also PAL file means it using palette....so basically i believe there is images (self-made file format) only with palette links but without palettes themselves. (just like images in red alert 2 to example). Well, if you was able to find and convert some sprites and tiles in default formats (png/bmp) please pack them and post 'em there. I'll be much appreciated.
Darkfox
VVIP member
VVIP member
Posts: 688
Joined: Fri Jul 04, 2003 6:11 pm
Has thanked: 33 times
Been thanked: 16 times

Re: Bad toys 3d

Post by Darkfox »

BM - BMPs, like numbers and screens.
HS - Help Screens, BMP.
M - BMPs, map icons?
SND - WAVs

DEM - Demo recorded gameplay
MAP - Self explanatory.

Will look into what the others are.

VEC and VOS seem to be a kind of encrypted image format, worth checking into?
smokeTH
n00b
Posts: 16
Joined: Mon Apr 25, 2011 10:33 pm
Been thanked: 1 time

Re: Bad toys 3d

Post by smokeTH »

:) why not? Pack of not-bad sprites and tiles. you see - i kinda wanted to make zdoom-skulltag wad based on this game.That's why i tried unpack it myself with few apps and after that found this forum.
Darkfox
VVIP member
VVIP member
Posts: 688
Joined: Fri Jul 04, 2003 6:11 pm
Has thanked: 33 times
Been thanked: 16 times

Re: Bad toys 3d

Post by Darkfox »

Well, not sure what they are, and the BT_PAL is suggested to be a palette but can't seem to get that to work. All the other files I do not know their purpose, aside from CREDITS and README of course. But some cracking of VOS and VEC is needed, anyone game for checking these file types?
smokeTH
n00b
Posts: 16
Joined: Mon Apr 25, 2011 10:33 pm
Been thanked: 1 time

Re: Bad toys 3d

Post by smokeTH »

:twisted: i can suggest you find good 16-bit NE (not PE) disassembler to find-out how game engine itself is reading those files.... what about me - i can't clearly say what type of algorythm does it uses...that was around 95 year when that game was released - basically in that time every devs fapped like they wanted to, there was no standards in graphics packaging.
smokeTH
n00b
Posts: 16
Joined: Mon Apr 25, 2011 10:33 pm
Been thanked: 1 time

Re: Bad toys 3d

Post by smokeTH »

i really interested in topic...and in accomplishing this task so BUMP.
skaman86
ultra-n00b
Posts: 1
Joined: Mon Oct 03, 2011 6:58 pm

Re: Bad toys 3d

Post by skaman86 »

Sorry, I pm'd a some of you about this already. I just really am Interested to find out if this has been accomplished? I tried with Dragon UnPACKer, it seems maybe the previous posters hace had more success than I have with this issue. Any help is appreciated.
smokeTH
n00b
Posts: 16
Joined: Mon Apr 25, 2011 10:33 pm
Been thanked: 1 time

Re: Bad toys 3d

Post by smokeTH »

Ok. Time to resurrect this post.

So, i decided to try it again. Basically VEC/VOC/BLB/PRK/RBT etc are all same kind of graphic. A buddy of mine on #openapoc channel on freenode (check them out, they are trying to bring xcom apocalypse back) helped a great deal in deciphering the format.

As it turns out it is a basic paletted image, column-major one, with 256 byte header, header consisting of 2 packs of uint16_t pairs, each 64 size, which control column begins/ends.
I'll attach linux sourcecode for the converter and some results.

Now, looks like wall/floor/ceiling textures themselves were embedded into .exe after all.

ImageImageImage

Code: Select all

#include <iostream>
#include <fstream>
#include <cstdint>
#include <string>
#include <memory>
#include <array>
#include <algorithm>
#include <cstring>
#include <png++/png.hpp>

struct data_pair
{
	uint8_t row_skip;
	uint8_t copy_count;
};

static_assert(sizeof(data_pair) == 2, "data_pair wrong size");

struct image
{
	std::array<uint16_t,64> offsets;
	std::array<data_pair,64> data_pairs;
	uint8_t data[];
};
static_assert(sizeof(image) == 256, "image wrong size");

struct colour
{
	uint8_t r, g, b;
};
static_assert(sizeof(colour) == 3, "colour wrong size");

struct palette
{
	colour c[256];
};
static_assert(sizeof(palette) == 256*3, "palette wrong size");

int main(int argc, char **argv)
{
	if (argc != 3)
	{
		std::cerr << "Must specify input and palette files\nTo example:\n vec_decode.exe VEC_1 BT_PAL\n";
		return 1;
	}

	std::ifstream inFile(argv[1]);
	if (!inFile)
	{
		std::cerr << "Failed to open \"" << argv[1] << "\"\n";
		return 1;
	}


	inFile.seekg(0, inFile.end);
	size_t length = inFile.tellg();
	inFile.seekg(0, inFile.beg);

	std::unique_ptr<char[]> data(new char[length]);

	if (!inFile.read(data.get(), length))
	{
		std::cerr << "Failed to read " << length << " bytes from \"" << argv[1] << "\"\n";
		return 1;
	}
	std::cerr << "Read " << length << " bytes from \"" << argv[1] << "\"\n";

	palette p;
	std::ifstream inPalette(argv[2]);
	if (!inPalette)
	{
		std::cerr << "Failed to open palette \"" << argv[2] << "\"\n";
		return 1;
	}

	if (!inPalette.read(reinterpret_cast<char*>(&p), sizeof(p)))
	{
		std::cerr << "Failed to read palette from \"" << argv[2] << "\"\n";
		return 1;
	}

	struct image *img = reinterpret_cast<struct image*>(data.get());

	int sizeX = 64;
	int sizeY = 64;

	png::image<png::rgba_pixel> png(sizeX,sizeY);

	//Each record describes a single column
	for (int record = 0; record < 64; record++)
	{
		//There are 'copy_count' pixels in each column, starting after skipping 'row_skip' transparent pixels
		for (int b = 0; b < img->data_pairs[record].copy_count; b++)
		{
			int offset = img->offsets[record] + b;
			//The offset is in the file, but the data[] array starts at the end of the (256-byte) header, so take the header size off the offset
			offset -= 256;
			assert (offset < length);
			uint8_t idx = img->data[offset];
			png::rgba_pixel pix;
			//index 255 is transparent
			if (idx == 255)
				pix = {0,0,0,0};
			else
				pix = {p.c[idx].r, p.c[idx].g, p.c[idx].b, 255};

			int y = img->data_pairs[record].row_skip + b;
			int x = record;
			png[y][x] = pix;
		}
		//Any pixels after a column's 'copy_count' are transparent too
	}
	png.write("out.png");




	return 0;
}
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4231
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1139 times
Been thanked: 2222 times

Re: Bad toys 3d

Post by shakotay2 »

smokeTH wrote:Ok. Time to resurrect this post.
hello, rider of dead horses! :D
(Try to revive a horse, that's dead since 4 years?)

Anyway, thanks for the code.

I managed to compile it on Windows after some struggeling (nasty strerror_r() problem).

Here's a resulting png (uploaded as jpeg):
vec_104.jpg
(Thought it were cut on the righthanded side. Then realized that it needs to be combined with another pic.)
You do not have the required permissions to view the files attached to this post.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
smokeTH
n00b
Posts: 16
Joined: Mon Apr 25, 2011 10:33 pm
Been thanked: 1 time

Re: Bad toys 3d

Post by smokeTH »

shakotay2 wrote:
smokeTH wrote:Ok. Time to resurrect this post.
hello, rider of dead horses! :D
(Try to revive a horse, that's dead since 4 years?)

Anyway, thanks for the code.

I managed to compile it on Windows after some struggeling (nasty strerror_r() problem).

Here's a resulting png (uploaded as jpeg):
vec_104.jpg
(Thought it were cut on the righthanded side. Then realized that it needs to be combined with another pic.)
Dude! Sick! Post windows version of the code as well. C: Also, you're welcome to help searching for wall textures within exe file (i've brokened my heaeaead today trying to find traces of them :evil: )
Post Reply