GBC_load_exec.h 1.83 KB


#ifndef __gbcp_LOAD_H__
#define __gbcp_LOAD_H__



/*********************************************************************************
 * º¯ÊýÀàÐÍ
 *********************************************************************************/
typedef int FAppInit(void);
typedef int FAppEntry(char **argv);
typedef int FAppExit(void);
typedef void* FGetAddr (int id);
typedef unsigned int FGetConst (int id, int *e);


#define APP_HEADER_MAGIC   0x3141574D
#define APP_TYPE_NULL      0
#define APP_TYPE_UAPP      1
#define APP_TYPE_TSR       2

typedef struct TTPAppHeader_
{
    unsigned int    magic;
    unsigned int    flags;
    unsigned int    version;
    char            name[32];  //ucs2±àÂë
    unsigned int    vendor;
    unsigned int    time;
    unsigned short  icon_flags;
    unsigned short  icon_size;
    unsigned int    text_size;
    unsigned int    rw_size;
    unsigned int    zi_size;
    unsigned char   sign[8];
}TTPAppHeader;

typedef struct TTPAppInfo_
{
    unsigned int     flags;
    int              pid;

    struct {
        FGetAddr  *get_addr;
        FGetConst *get_const;
    } mw;

    struct {
        char     *saved_sb;
        FAppInit    *init;     
        FAppEntry   *entry;   
        FAppExit    *exit;    
    } app;

    unsigned int rwzi_size;
    char         rwzi_data[1];      
}TTPAppInfo;

typedef struct TTPAppStruct_
{
    unsigned int         state;      //bitmap

    union {
        unsigned int data;
        struct {
            unsigned int exiting : 1;
        } bits;
    } flags;

    int pid;

    TTPAppHeader     *ah;

    TTPAppInfo       *ai;

    struct TTPAppStruct_     *next;
}TTPAppStruct;


typedef struct TTPLoadStruct_
{
    TTPAppStruct *tsr;
    TTPAppStruct *uapp;
}TTPLoadStruct;




extern const char gbcp_APP_PATH[];


//----------------------------------------------------------------------------
#endif