View Single Post
djazz djazz's Avatar

JCF Member

Joined: Feb 2009

Posts: 257

djazz is OFF DA CHARTdjazz is OFF DA CHARTdjazz is OFF DA CHART

Jan 19, 2012, 02:00 PM
djazz is offline
Reply With Quote
Talking

Nice neobeo, will try that out someday!

Anyway, got a message from Michiel today. You know, the creator of JCS.
But also some bad news, but we've heard that before. I quote:

Quote:
Originally Posted by Daniel
Hey! As you made JCS, I wonder if you still have the J2L and J2T file format specifications?
As you see we have almost figured out everything, just a few places that have unknown purposes, have a look:
http://www.jazz2online.com/wiki/J2L_File_Format
http://www.jazz2online.com/wiki/J2T_File_Format
Quote:
Originally Posted by Michiel
Sorry, I can't get a grip on Arjan, he's promised to sort out what license to release the source code under, but he just doesn't make any progress.. I gave up on him. And he/his company holds the rights, not me, so I can't just release it.
I can find you the J2L and J2T structs though..
Code:
#ifndef __FILEFORMATS_H__
#define __FILEFORMATS_H__

#ifdef	_LARGE_TILE_LIMIT
/*-------------------------------------------------------------------------------------------------
New version, large tile limits
-------------------------------------------------------------------------------------------------*/

#define	MAXTILES	 4096
#define	MAXANIMTILES	 256

#define	TILESET_LATESTVERSION	 0x201	 // Version 2.01
#define	LEVEL_LATESTVERSION	 0x203	 // Version 2.03
#else
/*-------------------------------------------------------------------------------------------------
Old version, old tile limits
-------------------------------------------------------------------------------------------------*/
#define	MAXTILES	 1024
#define MAXANIMTILES	 128

#define	TILESET_LATESTVERSION	 0x200	 // Version 2.00
#define	LEVEL_LATESTVERSION	 0x202	 // Version 2.02
#endif

/*-------------------------------------------------------------------------------------------------
Constants, limits, etc
-------------------------------------------------------------------------------------------------*/
#define MAXTILES_OLD	 1024
#define	MAXTILESMASK	 (MAXTILES-1)
#define	MAXTILESMASK_OLD	 (MAXTILES_OLD-1)
#define	MAXLAYERS	 8
#define MAXANIMTILES_OLD	 128
#define MAXANIMTILEFRAMES	 64

#define	ALIB_LATESTVERSION	 0x200	 // Version 2.00
#define PLIB_LATESTVERSION	 0x100	 // Version 1.00

#define SECTIONTILES	 4	 // Width of section
#define SECTIONAND	 3	 // AND Mask
#define SECTIONSHIFT	 2	 // Shift count
#define SECTIONSIZE	 (SECTIONTILES*sizeof(word))	// Size of section
#define SECTIONWIDTH	 (SECTIONTILES*32)	 // Width in pixels
#define	SECTIONWIDTHSHIFT	 (SECTIONSHIFT+5)	 // Shifter for width pixels
#define SECTIONHEIGHT	 32	 // Height in pixels
#define SECTIONHEIGHTSHIFT	 5	 // Shifter for height pixels
#define WIDTH_IN_SECTIONS(x)	 (((x)+SECTIONTILES-1) >> SECTIONSHIFT)

#define TILETYPE_NORMAL	 0
#define TILETYPE_TRANS	 1
#define TILETYPE_MENU	 4

#pragma pack(push, 1)
#pragma warning(disable : 4200)



/*-------------------------------------------------------------------------------------------------
Level file
-------------------------------------------------------------------------------------------------*/



//
// Level header structure
//
typedef struct
{
char	ID[4];
byte	Magic[4];
char	Name[32];
word	Version;
dword	FileSize,	 FileCRC;
dword	HdrPackSize,	 HdrUnPackSize;
dword	EventsPackSize,	 EventsUnPackSize;
dword	SectionsPackSize,	SectionsUnPackSize;
dword	LayersPackSize,	 LayersUnPackSize;
} LevelFileHdr;



//
// Animating tile dump structure in level file
//
typedef struct
{
word	DelayTime;
word	DelayTimeAdder;
word	PingPongDelay;
byte	PingPong;
byte	Speed;
byte	NumFrames;
union
{
word	DumpFrames[MAXANIMTILEFRAMES];
word	*pFrames;
};
} AnimTile;



//
// Level dump structure, contains most of the level data
//
typedef struct
{
// Editor
int	 LayerX;
int	 LayerY;
byte	CurLayer;
// General
byte	AmbientMin;
byte	AmbientStart;
word	NumAnimTiles;
byte	SplitScreenType;
byte	MultiPlayer;
dword	sizeof_LevelGameHdr;
// Strings
char	LevelName[32];
char	TileSet[32];
char	BonusLevel[32];
char	NextLevel[32];
char	SecretLevel[32];
char	MusicFile[32];
char	HelpString[16][512];
// Layer data
dword	lFlags[MAXLAYERS];
byte	lType[MAXLAYERS];
byte	lUsed[MAXLAYERS];
dword	lEditorWidth[MAXLAYERS];
dword	lWidth[MAXLAYERS];
dword	lHeight[MAXLAYERS];
int	 lDepth[MAXLAYERS];
byte	lDetailLevel[MAXLAYERS];
int	 lWaveX[MAXLAYERS];
int	 lWaveY[MAXLAYERS];
int	 lSpeedX[MAXLAYERS];
int	 lSpeedY[MAXLAYERS];
int	 lAutoSpeedX[MAXLAYERS];
int	 lAutoSpeedY[MAXLAYERS];
byte	lTextureType[MAXLAYERS];
byte	lTextureParam[MAXLAYERS][3];
// Tiles stuff
word	tRemap;
int	 tEvent[MAXTILES];
byte	tFlip[MAXTILES];
byte	tType[MAXTILES];
byte	tXMask[MAXTILES];	 // ** UNUSED **
AnimTile tAnim[MAXANIMTILES];
// Reserved
dword	Reserved[128];
} LevelGameHdr;



//
// Old level dump structure with less tiles and animtiles
//
typedef struct
{
// Editor
int	 LayerX;
int	 LayerY;
byte	CurLayer;
// General
byte	AmbientMin;
byte	AmbientStart;
word	NumAnimTiles;
byte	SplitScreenType;
byte	MultiPlayer;
dword	sizeof_LevelGameHdr;
// Strings
char	LevelName[32];
char	TileSet[32];
char	BonusLevel[32];
char	NextLevel[32];
char	SecretLevel[32];
char	MusicFile[32];
char	HelpString[16][512];
// Layer data
dword	lFlags[MAXLAYERS];
byte	lType[MAXLAYERS];
byte	lUsed[MAXLAYERS];
dword	lEditorWidth[MAXLAYERS];
dword	lWidth[MAXLAYERS];
dword	lHeight[MAXLAYERS];
int	 lDepth[MAXLAYERS];
byte	lDetailLevel[MAXLAYERS];
int	 lWaveX[MAXLAYERS];
int	 lWaveY[MAXLAYERS];
int	 lSpeedX[MAXLAYERS];
int	 lSpeedY[MAXLAYERS];
int	 lAutoSpeedX[MAXLAYERS];
int	 lAutoSpeedY[MAXLAYERS];
byte	lTextureType[MAXLAYERS];
byte	lTextureParam[MAXLAYERS][3];
// Tiles stuff
word	tRemap;
int	 tEvent[MAXTILES_OLD];
byte	tFlip[MAXTILES_OLD];
byte	tType[MAXTILES_OLD];
byte	tXMask[MAXTILES_OLD];	 // ** UNUSED **
AnimTile tAnim[MAXANIMTILES_OLD];
} LevelGameHdrOld;



//
// Convert old LevelGameHdrOld struct to new LevelGameHdr struct
//
#ifdef __cplusplus
inline void LevelGameHdr_202_To_203(LevelGameHdr *n)
#else
void __inline LevelGameHdr_202_To_203(LevelGameHdr *n)
#endif
{
const int TilesDiff = MAXTILES - MAXTILES_OLD;
const int AnimsDiff = MAXANIMTILES - MAXANIMTILES_OLD;
LevelGameHdrOld *o = (LevelGameHdrOld *)n;

// Copy old->new position
memcpy(n->tAnim, o->tAnim, MAXANIMTILES_OLD * sizeof(AnimTile));
memcpy(n->tXMask, o->tXMask, MAXTILES_OLD * sizeof(byte));
memcpy(n->tType, o->tType, MAXTILES_OLD * sizeof(byte));
memcpy(n->tFlip, o->tFlip, MAXTILES_OLD * sizeof(byte));
memcpy(n->tEvent, o->tEvent, MAXTILES_OLD * sizeof(int));

// Wipe out empty part of arrays
memset(n->tEvent + MAXTILES_OLD, 0, TilesDiff * sizeof(int));
memset(n->tFlip + MAXTILES_OLD, 0, TilesDiff * sizeof(byte));
memset(n->tType + MAXTILES_OLD, 0, TilesDiff * sizeof(byte));
memset(n->tXMask + MAXTILES_OLD, 0, TilesDiff * sizeof(byte));
memset(n->tAnim + MAXANIMTILES_OLD, 0, AnimsDiff * sizeof(AnimTile));
memset(n->Reserved, 0, 128 * sizeof(dword));
}




/*-------------------------------------------------------------------------------------------------
Tile file
-------------------------------------------------------------------------------------------------*/



//
// Tile file header structure
//
typedef struct
{
char	ID[4];	 // "TILE"
byte	Magic[4];	 // Magic number
char	Name[32];	 // Name of tileset
word	Version;
dword	FileSize,	 FileCRC;	 // Size of tile file
dword	HdrPackSize,	 HdrUnPackSize;	 // Header packed and unpacked size
dword	DataPackSize,	 DataUnPackSize;	 // Tiles Data packed and unpacked size
dword	CodePackSize,	 CodeUnPackSize;	 // Tiles Code packed and unpacked size
dword	MasksPackSize,	 MasksUnPackSize;	 // Tiles Masks packed and unpacked size
} TileFileHdr;



//
// Tile file structure
//
typedef struct
{
// Create info block
byte	Palette[1024];	 // Palette for tileset
dword	NumTiles;	 // Amount of tiles
byte	Full[MAXTILES*2];	 // Tiles filled flags
byte	*Data[MAXTILES*2];	 // -> Tiles (OFFSET when in a file)
byte	*Code[MAXTILES*2];	 // -> Codes (OFFSET when in a file)
dword	*Mask[MAXTILES*2];	 // -> Masks (OFFSET when in a file)
} TileFile;



//
// Old tile file structure
//
typedef struct
{
// Create info block
byte	Palette[1024];	 // Palette for tileset
dword	NumTiles;	 // Amount of tiles
byte	Full[MAXTILES_OLD*2];	 // Tiles filled flags
byte	*Data[MAXTILES_OLD*2];	 // -> Tiles (OFFSET when in a file)
byte	*Code[MAXTILES_OLD*2];	 // -> Codes (OFFSET when in a file)
dword	*Mask[MAXTILES_OLD*2];	 // -> Masks (OFFSET when in a file)
} TileFileOld;



//
// Convert old TileFileOld struct to new TileFile struct
//
#ifdef __cplusplus
inline void TileFile_200_To_201(TileFile *n)
#else
void __inline TileFile_200_To_201(TileFile *n)
#endif
{
const int TilesDiff = MAXTILES - MAXTILES_OLD;
TileFileOld *o = (TileFileOld *)n;	 // ->New tilefile

// Copy old->new position
memcpy(n->Mask+MAXTILES,	o->Mask+MAXTILES_OLD, MAXTILES_OLD * sizeof(dword *));
memcpy(n->Mask,	 o->Mask,	 MAXTILES_OLD * sizeof(dword *));
memcpy(n->Code+MAXTILES,	o->Code+MAXTILES_OLD, MAXTILES_OLD * sizeof(byte *));
memcpy(n->Code,	 o->Code,	 MAXTILES_OLD * sizeof(byte *));
memcpy(n->Data+MAXTILES,	o->Data+MAXTILES_OLD, MAXTILES_OLD * sizeof(byte *));
memcpy(n->Data,	 o->Data,	 MAXTILES_OLD * sizeof(byte *));
memcpy(n->Full+MAXTILES,	o->Full+MAXTILES_OLD,	MAXTILES_OLD * sizeof(byte));
memcpy(n->Full,	 o->Full,	 MAXTILES_OLD * sizeof(byte));

// Wipe out empty part of arrays
memset(n->Full + MAXTILES_OLD,	 0, TilesDiff * sizeof(byte));
memset(n->Full + MAXTILES_OLD + MAXTILES,	0, TilesDiff * sizeof(byte));
memset(n->Data + MAXTILES_OLD,	 0, TilesDiff * sizeof(byte *));
memset(n->Data + MAXTILES_OLD + MAXTILES,	0, TilesDiff * sizeof(byte *));
memset(n->Code + MAXTILES_OLD,	 0, TilesDiff * sizeof(byte *));
memset(n->Code + MAXTILES_OLD + MAXTILES,	0, TilesDiff * sizeof(byte *));
memset(n->Mask + MAXTILES_OLD,	 0, TilesDiff * sizeof(dword *));
memset(n->Mask + MAXTILES_OLD + MAXTILES,	0, TilesDiff * sizeof(dword *));
}



/*-------------------------------------------------------------------------------------------------
Library file
-------------------------------------------------------------------------------------------------*/


//
// Library file header
//
typedef struct
{
char	ID[4];	 // Should be "PLIB"
byte	Magic[4];	 // Magic number
dword	Version;	 // Version number
dword	FileSize,	 FileCRC;	 // Size of music file
dword	HdrPackSize,	 HdrUnPackSize;	 // Header packed and unpackacked size
} LibraryFileHdr;



//
// File in library header
//
typedef struct
{
char	Name[32];	 // File name or tag
dword	Type;	 // Type of file
dword	Offset,	 FileCRC;	 // Position in library file + unpacked file CRC
dword	PackSize,	 UnPackSize;	 // Packed and unpacked size
} LibFile;



//
// Picture file in memory and as stored in library
//
typedef struct
{
int	 Width;	 // Width of image
int	 Height;	 // Height of image
int	 BPP;	 // Bit depth of image
byte	Palette[256*4];	 // Palette
byte	Image[];	 // Image data
} Picture;



/*-------------------------------------------------------------------------------------------------
Animation library file
-------------------------------------------------------------------------------------------------*/



//
// Animation library file header structure
//
typedef struct
{
char	ID[4];	 // "ALIB"
byte	Magic[4];	 // 0x00,0xBA,0xBE,0x00
dword	HdrSize;	 // Header size
word	Version;	 // Animation lib version
byte	sizeof_Tanimations,	sizeof_Tframes;	 // sizeof(Tanimations), sizeof(Tframes)
dword	FileSize,	 FileCRC;	 // Size of file
dword	NumAnims;	 // Amount of animations
dword	AnmOffsets[];	 // Offsets to animations in file
} AnimFileHdr;



//
// Animation library file animation dump
//
typedef struct
{
char	ID[4];	 // "ANIM"
byte	NumStates;	 // Amount of states in anim
byte	NumSamples;	 // Amount of samples in anim
word	NumFrames;	 // Amount of frames in all anim states
dword	BaseSampleNum;	 // Base sample number for samples
dword	AnimHdrPackSize,	AnimHdrUnPackSize;	 // Size of animation headers
dword	FrameHdrPackSize,	FrameHdrUnPackSize;	 // Size of frame headers
dword	DataPackSize,	 DataUnPackSize;	 // Size of data+masks
dword	SamplesPackSize,	SamplesUnPackSize;	 // Size of samples
} AnimDump;



/*-------------------------------------------------------------------------------------------------
Music file
-------------------------------------------------------------------------------------------------*/



//
// Music file header structure
//
typedef struct
{
char	ID[4];	 // "MUSE"
byte	Magic[4];	 // Magic number
dword	FileSize,	 FileCRC;	 // Size of music file
dword	AmPackSize,	 AmUnPackSize;	 // Size of Advanced Module
} MusicFileHdr;


#pragma pack(pop)
#endif // __FILEFORMATS_H__??
Quote:
Originally Posted by Michiel
there ya go
Enjoy!
__________________
WebJCS 2 (new and in progress)
WebJCS 1 (old but complete)
SGIP Simple Games in Progress list
Level Packer v2 - With a GUI!
PHP Tileset Compiler