iff.library iff.l.main stub existing?

This forum is for general developer support questions.
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: iff.library iff.l.main stub existing?

Post by salass00 »

@JosDuchIt

AFAICT iff.library probably only really supports OCS/ECS ILBM/ANIM files. The library functions only support reading/writing of CMAP with 4 bits per gun (AGA uses 8 bits per gun) and both EasyExample and AnimExample limit the size of the palette to a maximum of 32 colors. Very likely truecolor ILBM/ANIM files are not supported at all.
JosDuchIt
Posts: 291
Joined: Sun Jun 26, 2011 5:47 pm
Contact:

Re: iff.library iff.l.main stub existing?

Post by JosDuchIt »

@salass00
You must be right
I will look closer into the gcview source (plugin to Gui4Cli) how much it depends on iff.library. I would still like to make it work as is before (maybe) using iffparse.library.
I did compile grabscreen.c too. No warnings with Wall. Still it crashes on the lines

Code: Select all

printf("starting\n"); //seen 
	if ((iff = IFFL_OpenIFF(filename, IFFL_MODE_WRITE) ))
	{
		struct IFFL_BMHD	bmhd;
		ULONG				modeid;
		UBYTE				*colortable;
		int					count;
	printf("opened iff"); // not seen

i uploaded the gabscreen source and the crashlog here: http://users.online.be/AD/grabscreen.lha

gcview does not write IFF files so to me this is not an urgent problem
JosDuchIt
Posts: 291
Joined: Sun Jun 26, 2011 5:47 pm
Contact:

Re: iff.library iff.l.main stub existing?

Post by JosDuchIt »

In tryingto compile gcview i ran into other problems

ID_DPAN was not recognised (it is not defined in the V23.2 IFF files)
I made a define
#defeine ID_DPAN 0L
inspired by the 2de argument used in the FindChunk calls of AnimExample
The next problem though was that the 'struct dpainthd' was not recognised.
It is not defined in the gcview source which states it is to be found in 'inc:libs/iff.h"

Code: Select all

	if (dphd = IFFL_FindChunk (pic->form, ID_DPAN))
	{
		dphd = (struct dpainthd *)((BYTE *)dphd + 8);

		// get global speed in frames per second (anbrush = 0 ?)
		if (dphd->speed) 
		{fps = dphd->speed;} /// dereferencing pointer to incomplete
type
		else
		

gcview:ansave1.h
34: struct dpainthd dpan; // defined in inc:libs/iff.h

I have hunted for this include/structure definition with no succes.
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: iff.library iff.l.main stub existing?

Post by salass00 »

@JosDuchIt

http://dl.dropbox.com/u/26599983/iff_os4_glue.7z

I added ID_DPAN definition to "libraries/iff.h" and also "struct IFFL_DPAN" (this is taken from the DPAN chunk specification in "RKRM: Devices").

Edit:
Apparently the flags field isn't unused anymore and the first byte is used to store frames per second.

Code: Select all

struct IFFL_DPAN
{
	UWORD version; /* current version=4 */
	UWORD nframes; /* number of frames in the animation.*/
	UBYTE fps;     /* frames per second */
	UBYTE pad[3];
};
You can either change the code to use the above struct from "libraries/iff.h" (use fps field instead of speed) or you could add the following near the top of the code file in question:

Code: Select all

struct dpainthd
{
	UWORD version; /* current version=4 */
	UWORD nframes; /* number of frames in the animation.*/
	UBYTE speed;     /* frames per second */
	UBYTE pad[3];
};
JosDuchIt
Posts: 291
Joined: Sun Jun 26, 2011 5:47 pm
Contact:

Re: iff.library iff.l.main stub existing?

Post by JosDuchIt »

Thanks, we are advancing much in the porting of gcview to OS4

I have added the struct dpainthd directly to the gcview code
The code in addition of using 'speed' instead of 'fps' does not use the dpainthd item 'nframes' but 'frames' and also a 'dummy' item. Next try: i'll change the code to use nframes and comment out the use of 'dummy'w


The code written by D.Leletsekis dates from 2000 and i have the impression he worked closely with Christian A. Weber.
Maybe there was an evolution in the source code of iff.library that did not make it to Aminet? (all filles in the iff library archive V23.2 date from 1993)


Code: Select all

 
// extract from "ansave1.h"

/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
	WriteDPAN
		  save Special Dpaint Frame timing
	XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */

BOOL writeDPAN (BPTR fp, LONG frames, LONG delay)	// delay in micros (see timer.h/anim.h)
{
	struct dpainthd dpan;	// defined in inc:libs/iff.h

	// prevent from divide by zero - anbrushes ?
	if(delay < 1) delay = 1;

	memset ((UBYTE *)&dpan, 0, sizeof(dpan));
	dpan.dummy   = 3;			// unknown..
	dpan.frames  = frames;
	if (delay < 1) delay = 1;
	dpan.speed   = 1000000 / delay;  // fps

	return (writechunk (fp, ID_DPAN, &dpan, sizeof(dpan)));
}


//extract from "anim.h"

// ==========================================================
//		get bitmaps & screen
// ==========================================================

BOOL anim_load (struct Picture *pic)
{
	struct IFFL_BMHD *bmhd;
	struct dpainthd *dphd;
	UBYTE  fps=0;
	struct anim *an;
	UBYTE *colortab;
	ULONG monitorid;
 /// more code

	if (dphd = IFFL_FindChunk (pic->form, ID_DPAN))
	{
		dphd = (struct dpainthd *)((BYTE *)dphd + 8);

		// get global speed in frames per second (anbrush = 0 ?)
		if (dphd->speed) 
		{fps = dphd->speed;} /// dereferencing pointer to incomplete type
		else
		{	an->isanbr = 1;	// it's an animbrush ?
			an->loadall = 1;	// must be loadall
			fps = 10;			// set a medium rate
		}
		an->andelay = 1000000 / fps;

		an->frames = dphd->frames;				
		// check for -1 = load all frames
		if (an->fnum < 2) an->fnum = an->frames;
	}
      /// more code

Post Reply