Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
115 user(s) are online (71 user(s) are browsing Forums)

Members: 0
Guests: 115

more...

Headlines

 
  Register To Post  

Use Datatypes Random DSI error ... but work ok.
Quite a regular
Quite a regular


See User information
Hi All,

Following the last message concerning DataTypes, I manage to have my images loaded and everything work perfectly, images are ok on screen and on 3D objects but.... Because there is always "but" somewhere ... I get random DSI error ...
When I choose "ignore DSI errors", the program run perfectly and all images are displayed on screen like they should. Showing they are loaded ...
So, what's wrong ? I didn't find why ...

Here is the code :
#include <stdlib.h>
#include <stdio.h>

// #include <amiga-align.h>
#include <datatypes/datatypes.h>
#include <datatypes/pictureclass.h>
#include <clib/alib_protos.h>
#include <proto/datatypes.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <proto/graphics.h>
// #include <cybergraphx/cybergraphics.h>
// #include <proto/cybergraphics.h>
// #include <default-align.h>

#include <exec/memory.h>

// struct IntuitionBase *MyIntuitionBase;
// struct GfxBase *GfxBase;
// struct Library *CyberGfxBase;
struct Library *DataTypesBase;
struct DataTypesIFace IDataTypes 0;
/*
struct MyPicture{
  int Width;
  int Height;
  int Depth;
  unsigned char *Pixels;
 };
*/
struct MyPicture AllocPictureint Widthint Heightint Depth ){
  
struct MyPicture *pt NULL;
  
int Bytes;
  
Bytes Depth 8;
  
pt = (struct MyPicture *)IExec->AllocVecsizeofstruct MyPicture ), MEMF_ANY|MEMF_CLEAR );
  if ( 
pt ){
    
pt->Pixels IExec->AllocVecWidth Height BytesMEMF_ANY );
    
pt->Width Width;
    
pt->Height Height;
    
pt->Depth Depth;

    if ( 
pt->Pixels == NULL ){
      
IExec->FreeVecpt );
      
pt NULL;
     }
   }
  return 
pt;
 }

void FreePicturestruct MyPicture *pt ){
  if ( 
pt ){
    
IExec->FreeVecpt->Pixels );
    
pt->Pixels NULL;
    
IExec->FreeVecpt );
   }
 }

struct MyPicture LoadPictureAPTR FileNameint Alpha ){
  
struct MyPicture *pt NULL;
  
Object *dto NULL;
  
ULONG nb;
  
struct BitMapHeader *bmh NULL;
  
struct pdtBlitPixelArray bpa;
  
void bpaptr = &bpa;

  if ( !
FileName ) return NULL;

  
DataTypesBase IExec->OpenLibrary"datatypes.library"43 );
  if ( 
DataTypesBase ){
    
IDataTypes = ( struct DataTypesIFace *)IExec->GetInterfaceDataTypesBase"main"1NULL );
    if ( 
IDataTypes != ){
     
dto = ( Object *)IDataTypes->NewDTObject( (STRPTR)FileName,  DTA_GroupID,        GID_PICTURE,
                                               
PDTA_DestMode,     PMODE_V43,          PDTA_Remap,
                                               
FALSE,             TAG_DONE );
      if ( 
dto ){
        
nb IDataTypes->GetDTAttrsdtoPDTA_BitMapHeader, &bmhTAG_DONE );
//        nb = IIntuition->GetAttr( PDTA_BitMapHeader, dto, &bmh );
        
if( nb != ){
          
int resread;
          
printf"Sizes: %dx%dx%d\n"bmh->bmh_Widthbmh->bmh_Heightbmh->bmh_Depth );
          
/* Allocation de la structure Picture et du buffer m?moire */
          
pt AllocPicturebmh->bmh_Widthbmh->bmh_Height32 );
          if ( 
pt != NULL ){
            
bpa.MethodID PDTM_READPIXELARRAY;
            
bpa.pbpa_PixelData pt->Pixels;
            
bpa.pbpa_PixelFormat Alpha?PBPAFMT_RGBA:PBPAFMT_RGB;
            
bpa.pbpa_PixelArrayMod bmh->bmh_Width 4;
            
bpa.pbpa_Left 0;
            
bpa.pbpa_Top 0;
            
bpa.pbpa_Width bmh->bmh_Width;
            
bpa.pbpa_Height bmh->bmh_Height;
            
resread IIntuition->IDoMethodAdtobpaptr );
//            resread = IDataTypes->DoDTMethodA( dto, 0, 0, bpaptr );
           
}else{
            
printf"Cannot allocate memory for mypicture structure\n" );
           }
         }else{
          
printf"Impossible to read image data informations\n" );
         }
        
IDataTypes->DisposeDTObjectdto );
       }else{
        
printf"Unable to load file\n" );
       }
      
IExec->DropInterface( ( struct Interface * )IDataTypes );
     }else{
      
printf"DataType interface cannot be opened" );
     }
    
IExec->CloseLibraryDataTypesBase );
   }else{
    
printf"impossible to open datatypes.library ver 43+\n" );
   }
  return 
pt;
 }

As you can see in the source code, I tried both Intuition and Datatypes funcions to get Objects attributes and to do method ... Same result ...

EDIT :
Apparently the crash came from MiniGL.library and not from DataTypes as I can see in the crash log file :
"Crash occured in module minigl.library at address 0x6F5C2384"
Symbol Info :
Instruction pointer 0x6F5C23B4 belongs to module "minigl.library" (HUNK/Kickstart)

Hope someone already experienced this and can help :)

EDIT :
After some tests, I suspect WarpPNG is faulty because if I change the WarpDT prefs, I get other issues with images and DSI errors ...

Regards,
AmiDARK.


Edited by freddix on 2010/8/30 21:35:46
Edited by freddix on 2010/8/30 22:44:43
Edited by freddix on 2010/8/31 9:00:10
All we have to decide is what to do with the time that is given to us.
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project