AeAssetFile.h 2.58 KB

#ifndef _AE_FileMgr_h
#define _AE_FileMgr_h

#include <PR/libaudio.h>
#include <PR/audiotools.h>
#include "Hash.h"

enum
{
    FILE_NOT_SUPPORTED	= -2,
    FILE_FAILURE	= -1,
    FILE_OK		= 0,
    NO_FILE		= 1
};


class AeAsset;
class AeBankFileAsset;
class AeBankAsset;
class AeInstAsset;
class AeSoundAsset;
class AeEnvAsset;
class AeKeymapAsset;
class AeWaveAsset;
class AeLoopAsset;
class AeBookAsset;


class AeFile
{
  public:

                        AeFile (const char *, const char *, const char *); 
    virtual	       	~AeFile (void);
   
    const char *	GetFileName (void) { return fFileName; }
    const char *	GetDirName (void) { return fDirName; }

  protected:

    int   	       	GetFileData (char * fname, char *& fData, int & fSize);
    static void		parseFileString (const char *, char *& dir,
					 char *& file, char *& suffix);
    static TAssetType  	suffix2type (char *);

    const char *	fDirName;
    const char *       	fFileName;
    const char *       	fFileSuffix;
};


class AeN64ConfigFile : public AeFile
{
                        AeN64ConfigFile (const char *, const char *, const char *); 
    virtual	       	~AeN64ConfigFile (void);
    
    int        		Read (AeN64Config *&);

};



class AeAssetFile : public AeFile
{
  public:
                        AeAssetFile (const char *, const char *, const char *); 
    virtual	       	~AeAssetFile (void);
   
    virtual int        	Read (AeAsset *&);
};


class AeBankFile : public AeAssetFile
{
public:
                        AeBankFile (const char *, const char *, const char *);
    virtual		~AeBankFile (void);

    virtual int		Read (AeAsset *&);

private:

    int     	       	_ParseAssets (AeAsset *&);

    void    	       	_ParseBankFile (AeBankFileAsset *, int);
    void    	       	_ParseBank (AeBankAsset *, int);
    void    	       	_ParseInst (AeInstAsset *, int);
    void    	       	_ParseSound (AeSoundAsset *, int);
    void    	       	_ParseKeymap (AeKeymapAsset *, int);
    void    	       	_ParseEnvlp (AeEnvAsset *, int);
    void   	        _ParseWavet (AeWaveAsset *, int);
    void    	       	_ParseLoop (AeLoopAsset *, int);
    void    	       	_ParseBook (AeADPCMBookAsset *, int);

    ALSymFile *		fSymData;
    int         	fSymSize;

    ALBankFile *	fCtlData;    
    int         	fCtlSize;

    u8 *		fTblData;
    int         	fTblSize;

    HashTable *		fHashTbl;
};


class AeWaveFile : public AeAssetFile
{
  public:

                        AeWaveFile (const char *, const char *, const char *); 
    virtual	       	~AeWaveFile (void);
   
    virtual int        	Read (AeAsset *&);
};


#endif