Path: chuka.playstation.co.uk!news From: sceetech Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: GsIMAGE pmode 8 - another red herring Date: Thu, 03 Apr 1997 10:14:33 +0100 Organization: SCEE Lines: 101 Message-ID: <334374F9.17CE@interactive.sony.com> References: <01bc289b$f6314fc0$c793989e@fourny.demon.co.uk> <33422052.4C18@interactive.sony.com> <01bc28b3$29e10100$c793989e@fourny.demon.co.uk> Reply-To: ps_yaroze@interactive.sony.com NNTP-Posting-Host: 194.203.13.10 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.01 (Win95; I) grim wrote: > > OK you asked for it :) > > Sorry if it's a bit C++. I'm not ashamed. Picture if you will an > object-oriented fishing game. > > main() > { > SetVideoMode(MODE_PAL); > GsInitGraph(320, 256, 4, 0, 0); > GsDefDispBuff(0, 0, 0, 256); > CSea sea(0, 0, 0, 0); > > calls contructor for CSea > > CSea::CSea(int player1, int player2, int player3, int player4) > { > mOT[0].length=OT_LENGTH; //ordering tables, copied > mOT[1].length=OT_LENGTH; //from the balls demo > mOT[0].org=mTags[0]; //but irrelevant I think > mOT[1].org=mTags[1]; //given I only get where I do > CFish *firstfish=new CFish(30, 30); > > calls constructor for CFish > > CFish::CFish(unsigned int x, unsigned int y) > { > mSprite = new CSprite(1); > mX=x; > mY=y; > } > > calls constructor for CSprite > > CSprite::CSprite(int frames) > { > mFrames=frames; > mTPages=new unsigned short[mFrames]; > } > > finishes, drops back to CSea constructor again > > firstfish->LoadSprite(); > > calls LoadSprite in CFish > > void CFish::LoadSprite() > { > mSprite->Load(0, "small.tim", 576); > } > > calls load in CSprite > > void CSprite::Load(int frame, char *filename, int filesize) > { > GsIMAGE image; > RECT pixRect; > RECT colRect; > unsigned short tPage; > > MWRedirectIO(__MWIO_CDROM); > void *location=malloc(filesize); > long bytes=MWbload(filename, location); > GsGetTimInfo((u_long *)(((char *)location)+4), &image); > pixRect.x=image.px; > pixRect.y=image.py; > pixRect.w=image.pw; > pixRect.h=image.ph; > LoadImage(&pixRect, image.pixel); > DrawSync(0); > tPage=GetTPage(0, 0, pixRect.x, pixRect.y); > > Single step the debugger through that lot and it always crashes on > LoadImage. Likewise put a breakpoint on GetTPage it will always crash > before the breakpoint. > > image.pixel points 40 bytes after location, on the heap (initialised by > codewarrior > between the end of the program and the start of the stack, both in default > positions). I believe there is a CLUT just before the pixel data. > > 576 bytes are actually read by MWbload, and this is also the DOS size of > the TIM. > > I downloaded the textutil file as was suggested, but it looked just like I > expected it to, pretty much just like the code above. I wouldnt normally > pester people with my stupid bugs but this has been annoying me for 3 days > and I'm just not getting anywhere with it. Please let there be a simple > oversight on my part. > > yours in hope > > Grim It looks fine, what are the values for pixRect and location. Might also try declaring location as a variable not a malloc (shouldn't make a difference, but you never know). Stuart