Page 3 of 4

Posted: Tue Aug 17, 2004 12:15 pm
by adurdin
Boeing747 wrote:Thanks! The (unfinished) keen file format doc is better to understand.
I'll make a module with Type declarations.
But one question:
PlaneOffsets(0 to 2) As Integer is the same as:

Code: Select all

Type PlaneOffsets
  PlaneOffS1 As Integer
  PlaneOffS2 As Integer
  PlaneOffS3 As Integer
End Type
?
That's right -- but not that the plane offsets are 32-bit words (Long in VB), not 16-bit words (Integer in VB).
How can I make this bug similar in VB6?
...
But VB6 doesn't see this String as an 0 to 7 array.
You don't need to worry about it -- see below.
What are those "ABC-Words" in gamemaps?
and in this TED5 file, i could not see any junkbytes.
The bug is a buffer overflow: the C code actually tells the program to start writing bytes out, beginning with "T" in "TED5v1.0", and stopping when it reaches a byte equal to &H0 (null). This could be almost anywhere later in memory, so you could get zero or many junk bytes. But it doesn't matter a bit -- you should write "TED5v1.0" at the beginning of the file when saving GameMaps, and you should read it just to be sure that it's a valid file, but to work out where the map data is you need to read the maphead information from the maphead file or the (unlzexed) .exe file.
Public Type GAMEMAPS_HEAD
Signature As String * 8 ' Always set to "TED5v1.0"
Junk() As Byte ' ???
End Type
So remove the "Junk() As Byte" and you've got what you need there.

Posted: Wed Aug 18, 2004 10:14 am
by Boeing747
Thanks I'm worry about the C source of TED5 for the compression methods. I know the syntax of C bot not at all. If I have troubles I
post them here.

In wich sourcemodule of TED5 is the charmack and RLE compression?
I'm searching... ... ... ... Found something in JHUFF.C, JHUFF.H
theres no Charmackize or RLe, only Huffmanize?!
Umm, I'd only found the TED5 ROTT source. Not CK! :(
I'm sorry that I'm so stupid for this.

Suggestion 2: Could we split this topic into 2 parts? KMO | KEDfW?

Posted: Wed Aug 18, 2004 12:27 pm
by Frenkel
Boeing747 wrote:Umm, I'd only found the TED5 ROTT source. Not CK! :(
I'm sorry that I'm so stupid for this.
That's the only version of TED5 that they released, so you got the right one.

Posted: Wed Aug 18, 2004 12:41 pm
by adurdin
Boeing747 wrote:Thanks I'm worry about the C source of TED5 for the compression methods. I know the syntax of C bot not at all. If I have troubles I
post them here.
Don't worry, the TED5 source has both C and Assembly versions of them :-b
In wich sourcemodule of TED5 is the charmack and RLE compression?
I'm searching... ... ... ... Found something in JHUFF.C, JHUFF.H
theres no Charmackize or RLe, only Huffmanize?!
Umm, I'd only found the TED5 ROTT source. Not CK! :(
I'm sorry that I'm so stupid for this.
No, it's all there in JHUFF.C -- Huffman, Carmack, and RLE.
Suggestion 2: Could we split this topic into 2 parts? KMO | KEDfW?
Done way back. And it's been moved now to the TED5 forum.

Posted: Wed Aug 18, 2004 7:00 pm
by Boeing747
Too bad. I can't take these jhuff.c und jhuff.h listings :´(.
HELP!

Posted: Sat Aug 21, 2004 1:51 pm
by Boeing747
Andy i'm at the end of my knowlege. If you have time:
- Please make me a *.bas for encode and decode charmack and rle (not faked)
- Please make maphead, gamemaps load and save in the *.bas
Name for *.bas could be: "modGameMaps.bas"

All my tests won't work. Thanks :´(
Please look into http://www.plsplayer.de/kedfw/kedfwsrc.rar .
Thanks

Posted: Sat Aug 21, 2004 9:59 pm
by adurdin
I'm sorry, Boeing747, I don't have time to do that at the moment, unfortunately.

Posted: Sat Aug 21, 2004 10:10 pm
by Boeing747
Hm I have time. I'm young i can wait ;o).
I MUST wait. I'd tryed everything - no results.

In that time: Anyone could translate this C code to VB6
(FileAcces, not String), PLEASE Image:

Code: Select all

/*
==================
=
= CarmackCompress
=
= Compress a string of words
=
==================
*/

#define NEARTAG	0xa7
#define FARTAG	0xa8

long CarmackCompress (unsigned far *source,long length,
	unsigned far *dest)
{
	unsigned	ch,chhigh;
	unsigned	far *instart, far *inptr, far *inscan,
				far *stopscan, far *outptr;
	unsigned	far *bestscan, beststring;
	unsigned	dist,maxstring,string,outlength;
	unsigned	nearrepeats,farrepeats;
	unsigned	dups,count;
	unsigned	newwords;

//
// this compression method produces a stream of words
// If the words high byte is NEARTAG or FARTAG, the low byte is a word
// copy count from the a position specified by either the next byte
// or the next word, respectively.  A copy count of 0 means to insert the
// next byte as the low byte of the tag into the output
//


//
// set up
//
	instart = inptr = source;
	outptr = dest;

	outlength = 0;
	length = (length+1)/2;

	nearrepeats = farrepeats = dups = 0;
	count = 10;
	newwords = 0;
//
// compress
//
	do
	{
		ch = *inptr;

//
// scan from start for patterns that match current data
//
		beststring = 0;
		for (inscan = instart; inscan<inptr; inscan++)
		{
			if (*inscan != ch)
				continue;

			maxstring = inptr-inscan;
			if (maxstring > length)
				maxstring = length;
			if (maxstring > 255)
				maxstring = 255;

			string = 1;
			while (*(inscan+string) == *(inptr+string) && string<maxstring)
				string++;

			if (string >= beststring)
			{
				beststring = string;
				bestscan = inscan;
			}
		}

		if (beststring > 1 && inptr-bestscan <= 255)
		{
		// near string
			*outptr++ = beststring + (NEARTAG*256);
			*((unsigned char far *)outptr)++ = inptr-bestscan;
			outlength += 3;
			nearrepeats++;
			inptr += beststring;
			length -= beststring;
		}
		else if (beststring > 2)
		{
		// far string
			*outptr++ = beststring + (FARTAG*256);
			*outptr++ = bestscan-instart;
			outlength += 4;
			farrepeats++;
			inptr += beststring;
			length -= beststring;
		}
		else							// no compression
		{
			chhigh = ch>>8;
			if (chhigh == NEARTAG || chhigh == FARTAG)
			{
			// special case of encountering a
			// tag word in the data stream
			// send a length of 0, and follow it with the real low byte
				*outptr++ = ch & 0xff00;
				*((unsigned char far *)outptr)++ = ch&0xff;
				outlength += 3;
				dups++;
			}
			else
			{
				*outptr++ = ch;
				outlength += 2;
			}
			inptr++;
			length--;
			newwords++;
		}

		if (!--count)
		{
			static char cc[2]="-";
			cc[0]^='+'^'-';
			print(cc);
			sx--;

			count = 10;

		 if (keydown[1])
		 {
		  while(keydown[1]);
		  return 0;
		 }
		}
		if (length<0)
			Quit ("Length < 0!");
	} while (length);
	#if 0
	printf ("%u near patterns\n",nearrepeats);
	printf ("%u far patterns\n",farrepeats);
	printf ("%u new words\n",newwords);
	printf ("%u dups\n\n",dups);
	#endif
	return outlength;
}
And a small question? how can I get VB's INTEGER UNSIGNED?
Edit: Unsigned Integers is okay: If it's < 0 then add 65536.

Posted: Wed Aug 25, 2004 11:01 pm
by Boeing747
Lasted source of kedfw: http://www.plsplayer.de/kedfw/src/kedfw.zip
I'll add a Projectmanager!

Here is the first created gamemapsfile for ck.
Please look at this file with your HEXEDITOR.
My question: Is this file compatible to TED5v1.0
when it is Carmack-compressed?
http://www.plsplayer.de/kedfw/1stgamemaps.zip

There is a new source of KEDfW (BETA 0.06) available:
www.plsplayer.de/kedfw/src/006.zip

Posted: Sun Nov 21, 2004 2:58 pm
by SupFanat
All these links don't work! :( :( :( :(

Posted: Mon Nov 22, 2004 7:38 am
by grafix
I'll get round to uploading the files to my server after school. About 7 1/2 hours till I get home from school, so... wait.

Hello?

Posted: Thu Feb 17, 2005 1:46 pm
by DasBrot
Is anyone still working on this editor?

Posted: Thu Feb 17, 2005 1:51 pm
by KeenRush
Not on this.

Posted: Sat Feb 19, 2005 10:42 am
by grafix
Unless Boeing appears again (sounds unlikely - last time I heard he was doing work experience for a steel manufacturer) there won't be any work done on this. I might incorporate some of it into modCore 4-6, when I get around to it.

*DasBrots Keen4 mod dies dreadful*

Posted: Sat Feb 19, 2005 2:19 pm
by DasBrot
Hmm, ok. I will start my work on keen1 mods...