Path: chuka.playstation.co.uk!news From: "grim" Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: GsIMAGE pmode 8 - another red herring Date: 2 Apr 1997 19:56:32 GMT Organization: froth kid Lines: 93 Message-ID: <01bc28b3$29e10100$c793989e@fourny.demon.co.uk> References: <01bc289b$f6314fc0$c793989e@fourny.demon.co.uk> <33422052.4C18@interactive.sony.com> NNTP-Posting-Host: fourny.demon.co.uk X-Newsreader: Microsoft Internet News 4.70.1155 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