From: Sahin V. <sa...@ho...> - 2005-04-03 00:48:48
|
Hello I have tested the Allocater class but i dont know where a bug could be. The reason for the bug can be that you allocate a Class with it. Use only the new operator for class allocation.Because only the new operator handels the constructor and destructor calls. Try your code againt without the calss allocation with the manager.Use new for it. And if the crash happends again mail me. For you PCX problem. Every PCX file which have a pallet have it on the end of the file. To get it seek to the end of the file and then seek -769 backward. Now check for a pallet. If the next byte in the file is 12 the we have pallet and can read it out if not then there is no plallet. Here the code example from the SFF manager. //first move the file pointer to the end fseek( lpSffFile, 0, SEEK_END ); //move the file pointer to Color pallet of the PCX file fseek(lpSffFile,-769L,SEEK_CUR); //check for pallet if (fgetc(lpSffFile)==12 ) { for(int i=0;i<256;i++) { int r,g,b; r = fgetc(lpSffFile); g = fgetc(lpSffFile); b = fgetc(lpSffFile); } } here the defenition of the pcx format http://www.whisqu.se/per/docs/graphics57.htm >From: Jorge Contreras A <sah...@gm...> >To: Sahin Vardar <sa...@ho...> >Subject: CAllocator::Alloc Bug ?? >Date: Sat, 02 Apr 2005 19:44:23 -0400 > >Hi, > >i was working on the port of snd manager to mugen, i will send new files >and patches >in few time, i just want to say, i was trying to use Allocator::Alloc >class, and this makes >a SIGSEGV, im using: > >CAllocater *m_pAlloc; > m_pAlloc = new CAllocater ("Snd Alloc"); > > CSndManager *m_pSnd; > SNDHEADER *p_SndHeader; > SNDSUBFILE *p_SubFile; > SNDSTORE *p_SndStoreInit; > > FILE *fp; > > DWORD RamUsed=0; > register s32 counter, i; > > m_pSnd = (CSndManager *)m_pAlloc->Alloc (sizeof (CSndManager)); > p_SndHeader = (SNDHEADER *)m_pAlloc->Alloc (sizeof (SNDHEADER)); > p_SubFile = (SNDSUBFILE *)m_pAlloc->Alloc (sizeof (SNDSUBFILE)); > m_pSnd->item = (SNDSTORE *)m_pAlloc->Alloc (sizeof (SNDSTORE)); > >and this crashes, i dont know if this is my problem, or this is a bug in >the source, >anyway let me know for we can fix that :). > >well, greetings, >J.C > |