⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 segar.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 5 页
字号:
    sega_security(62);
}

void s005_decode(void)
{
    /* This game uses the 315-0070 security chip */
    sega_security(70);
}

void monsterb_decode(void)
{
    /* This game uses the 315-0082 security chip */
    sega_security(82);
}

void spaceod_decode(void)
{
    /* This game uses the 315-0063 security chip */
    sega_security(63);
}

void pignewt_decode(void)
{
    /* This game uses the 315-0063? security chip */
    sega_security(63);
}

/***************************************************************************
  Hi Score Routines
***************************************************************************/

static int astrob_hiload(void)
{
        unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];


        /* check if the hi score table has already been initialized */
        if ((memcmp(&RAM[0xCC0E],"KUV",3) == 0) &&
                (memcmp(&RAM[0xCC16],"PS\\",3) == 0))
        {
                void *f;


                if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
                {
            osd_fread(f,&RAM[0xCB3F],0xDA);
                        osd_fclose(f);
                }

                return 1;
        }
        else return 0;  /* we can't load the hi scores yet */
}



static void astrob_hisave(void)
{
        void *f;
        unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];


        /* Hi score memory gets corrupted by the self test */
        if (memcmp(&RAM[0xCB3F],"\xFF\xFF\xFF\xFF",4)==0)
                return;

        if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
        {
                osd_fwrite(f,&RAM[0xCB3F],0xDA);
                osd_fclose(f);
        }

}

static int monsterb_hiload(void)
{
        unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];


        /* check if memory has already been initialized */
        if (memcmp(&RAM[0xC8E8],"\x22\x0e\xd5\x0a",4) == 0)
        {
                void *f;

                if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
                {
                        osd_fread(f,&RAM[0xC913],7);
                        osd_fclose(f);
                }

                return 1;
        }
        else return 0;  /* we can't load the hi scores yet */
}



static void monsterb_hisave(void)
{
        void *f;
        unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];


        /* Hi score memory gets corrupted by the self test */
        if (memcmp(&RAM[0xC913],"\xFF\xFF\xFF\xFF",4)==0)
                return;

        if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
        {
                osd_fwrite(f,&RAM[0xC913],7);
                osd_fclose(f);
        }

}

static int s005_hiload(void)
{
        unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];


        /* check if memory has already been initialized */
        if (memcmp(&RAM[0xC8ED],"\x10\x1B\x17",3) == 0)
        {
                void *f;


                if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
                {
                        osd_fread(f,&RAM[0xC911],8);
                        osd_fclose(f);
                }

                return 1;
        }
        else return 0;  /* we can't load the hi scores yet */
}



static void s005_hisave(void)
{
        void *f;
        unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];


        /* Hi score memory gets corrupted by the self test */
        if (memcmp(&RAM[0xC911],"\xFF\xFF\xFF\xFF",4)==0)
                return;

        if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
        {
                osd_fwrite(f,&RAM[0xC911],8);
                osd_fclose(f);
        }

}

static int spaceod_hiload(void)
{
        unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];


        /* check if memory has already been initialized */
        if (memcmp(&RAM[0xC8F1],"\xE2\x00\x04\x03",4) == 0)
        {
                void *f;

                if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
                {
                        osd_fread(f,&RAM[0xC906],4);
                        osd_fclose(f);
                }

                return 1;
        }
        else return 0;  /* we can't load the hi scores yet */
}



static void spaceod_hisave(void)
{
        void *f;
        unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];


        /* Hi score memory gets corrupted by the self test */
        if (memcmp(&RAM[0xC906],"\xFF\xFF\xFF\xFF",4)==0)
                return;

        if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
        {
                osd_fwrite(f,&RAM[0xC906],4);
                osd_fclose(f);
        }

}

/* TODO: fix this */
static int pignewt_hiload(void)
{
        unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];

    /* check if memory has already been initialized */
    if (memcmp(&RAM[0xCFE7],"PIGNEWTON",9) == 0)
        {
                void *f;

                if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
                {
                        osd_fread(f,&RAM[0xCE0C],3*30); /* Top 30 hi scores? */
                        osd_fread(f,&RAM[0xCFD2],3*10); /* Top 10 initials */
                        osd_fclose(f);
                }

                return 1;
        }
        else return 0;  /* we can't load the hi scores yet */
}



static void pignewt_hisave(void)
{
        void *f;
        unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];


        /* Hi score memory gets corrupted by the self test */
        if (memcmp(&RAM[0xCE0C],"\xFF\xFF\xFF\xFF",4)==0)
                return;

        if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
        {
                osd_fwrite(f,&RAM[0xCE0C],3*30);        /* Top 30 hi scores? */
                osd_fwrite(f,&RAM[0xCFD2],3*10);        /* Top 10 initials */
                osd_fclose(f);
        }

}

/***************************************************************************
  Game drivers
***************************************************************************/

static struct Samplesinterface astrob_samples_interface =
{
        12      /* 12 channels */
};

/* TODO: someday this will become a speech synthesis interface */
static struct CustomSound_interface astrob_custom_interface =
{
        astrob_speech_sh_start,
        0,
        astrob_speech_sh_update
};

static struct MachineDriver astrob_machine_driver =
{
        /* basic machine hardware */
        {
                {
                        CPU_Z80,
                        3867120,        /* 3.86712 Mhz ??? */
                        0,
                        readmem,writemem,readport,astrob_writeport,
                        segar_interrupt,1
                },
                {
                        CPU_I8035 | CPU_AUDIO_CPU,
                        3120000,        /* 3.12Mhz crystal ??? */
                        2,
                        speech_readmem,speech_writemem,speech_readport,speech_writeport,
                        ignore_interrupt,1
                }
        },
        60, DEFAULT_60HZ_VBLANK_DURATION,       /* frames per second, vblank duration */
        1,
        0,

        /* video hardware */
        32*8, 32*8, { 0*8, 28*8-1, 0*8, 32*8-1 },
        gfxdecodeinfo,
        16*4+1,16*4+1,
        segar_init_colors,

        VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
        0,
        generic_vh_start,
        generic_vh_stop,
        segar_vh_screenrefresh,

        /* sound hardware */
        0,0,0,0,
        {
    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -