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

📄 ctribebl.c

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 C
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************//*                                                                            *//*              COMBA TRIBES - BOOTLEG (C) 1990 TECHNOS JAPAN                 *//*                                                                            *//******************************************************************************/#include "gameinc.h"#include "ctribebl.h"#include "sasound.h"		// sample support routines#include "tchnosnd.h"#ifdef RAINE_DEBUG#include "debug.h"#endifstatic struct DIR_INFO combatribes_dirs[] ={   { "combatribes", },   { "ctribe", },   { NULL, },};static struct ROM_INFO combatribes_roms[] ={   {        "ic-26", 0x00020000, 0xc46b2e63, 0, 0, 0, },   {   "ct_ep2.rom", 0x00010000, 0x8c2c6dbd, 0, 0, 0, },   {        "ic-25", 0x00020000, 0x3221c755, 0, 0, 0, },   {   "ct_ep4.rom", 0x00008000, 0x4346de13, 0, 0, 0, },   {   "ct_ep5.rom", 0x00010000, 0x972faddb, 0, 0, 0, },   {   "ct_ep6.rom", 0x00010000, 0xeb3ab374, 0, 0, 0, },   {   "ct_ep7.rom", 0x00010000, 0xc602ac97, 0, 0, 0, },   {   "ct_ep8.rom", 0x00010000, 0x4da1d8e5, 0, 0, 0, },   {   "ct_mr0.rom", 0x00080000, 0xba73c49e, 0, 0, 0, },   {   "ct_mr1.rom", 0x00080000, 0x1c9badbd, 0, 0, 0, },   {   "ct_mr2.rom", 0x00080000, 0x8c796707, 0, 0, 0, },   {   "ct_mr3.rom", 0x00080000, 0x1ac2a461, 0, 0, 0, },   {   "ct_mr4.rom", 0x00040000, 0xb84fda09, 0, 0, 0, },   {   "ct_mr5.rom", 0x00040000, 0xcef0a821, 0, 0, 0, },   {   "ct_mr6.rom", 0x00040000, 0x617530fc, 0, 0, 0, },   {   "ct_mr7.rom", 0x00040000, 0xa8b773f1, 0, 0, 0, },   {   "ct_mr8.rom", 0x00040000, 0x9963a6be, 0, 0, 0, },   {           NULL,          0,          0, 0, 0, 0, },};static struct INPUT_INFO combatribes_inputs[] ={   { KB_DEF_COIN1,        MSG_COIN1,               0x014001, 0x01, BIT_ACTIVE_0 },   { KB_DEF_COIN2,        MSG_COIN2,               0x014001, 0x02, BIT_ACTIVE_0 },   { KB_DEF_SERVICE,      MSG_SERVICE,             0x014001, 0x04, BIT_ACTIVE_0 },   { KB_DEF_P1_START,     MSG_P1_START,            0x014000, 0x80, BIT_ACTIVE_0 },   { KB_DEF_P1_UP,        MSG_P1_UP,               0x014000, 0x04, BIT_ACTIVE_0 },   { KB_DEF_P1_DOWN,      MSG_P1_DOWN,             0x014000, 0x08, BIT_ACTIVE_0 },   { KB_DEF_P1_LEFT,      MSG_P1_LEFT,             0x014000, 0x02, BIT_ACTIVE_0 },   { KB_DEF_P1_RIGHT,     MSG_P1_RIGHT,            0x014000, 0x01, BIT_ACTIVE_0 },   { KB_DEF_P1_B1,        MSG_P1_B1,               0x014000, 0x10, BIT_ACTIVE_0 },   { KB_DEF_P1_B2,        MSG_P1_B2,               0x014000, 0x20, BIT_ACTIVE_0 },   { KB_DEF_P1_B3,        MSG_P1_B3,               0x014000, 0x40, BIT_ACTIVE_0 },   { KB_DEF_P2_START,     MSG_P2_START,            0x014002, 0x80, BIT_ACTIVE_0 },   { KB_DEF_P2_UP,        MSG_P2_UP,               0x014002, 0x04, BIT_ACTIVE_0 },   { KB_DEF_P2_DOWN,      MSG_P2_DOWN,             0x014002, 0x08, BIT_ACTIVE_0 },   { KB_DEF_P2_LEFT,      MSG_P2_LEFT,             0x014002, 0x02, BIT_ACTIVE_0 },   { KB_DEF_P2_RIGHT,     MSG_P2_RIGHT,            0x014002, 0x01, BIT_ACTIVE_0 },   { KB_DEF_P2_B1,        MSG_P2_B1,               0x014002, 0x10, BIT_ACTIVE_0 },   { KB_DEF_P2_B2,        MSG_P2_B2,               0x014002, 0x20, BIT_ACTIVE_0 },   { KB_DEF_P2_B3,        MSG_P2_B3,               0x014002, 0x40, BIT_ACTIVE_0 },   { KB_DEF_P3_START,     MSG_P3_START,            0x014004, 0x80, BIT_ACTIVE_0 },   { KB_DEF_P3_UP,        MSG_P3_UP,               0x014004, 0x04, BIT_ACTIVE_0 },   { KB_DEF_P3_DOWN,      MSG_P3_DOWN,             0x014004, 0x08, BIT_ACTIVE_0 },   { KB_DEF_P3_LEFT,      MSG_P3_LEFT,             0x014004, 0x02, BIT_ACTIVE_0 },   { KB_DEF_P3_RIGHT,     MSG_P3_RIGHT,            0x014004, 0x01, BIT_ACTIVE_0 },   { KB_DEF_P3_B1,        MSG_P3_B1,               0x014004, 0x10, BIT_ACTIVE_0 },   { KB_DEF_P3_B2,        MSG_P3_B2,               0x014004, 0x20, BIT_ACTIVE_0 },   { KB_DEF_P3_B3,        MSG_P3_B3,               0x014004, 0x40, BIT_ACTIVE_0 },   { 0,                   NULL,                    0,        0,    0            },};struct DSW_DATA dsw_data_combatribes_0[] ={   { MSG_DIFFICULTY,          0x03, 0x04 },   { MSG_NORMAL,              0x03, 0x00 },   { MSG_EASY,                0x02, 0x00 },   { MSG_HARD,                0x01, 0x00 },   { MSG_HARDEST,             0x00, 0x00 },   { MSG_DSWA_BIT3,           0x04, 0x02 },   { MSG_OFF,                 0x04, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DSWA_BIT4,           0x08, 0x02 },   { MSG_OFF,                 0x08, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_TEST_MODE,           0x10, 0x02 },   { MSG_OFF,                 0x10, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DSWA_BIT6,           0x20, 0x02 },   { MSG_OFF,                 0x20, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DSWA_BIT7,           0x40, 0x02 },   { MSG_OFF,                 0x40, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { "Max Players",           0x80, 0x02 },   { "2",                     0x80, 0x00 },   { "3",                     0x00, 0x00 },   { NULL,                    0,    0,   },};struct DSW_DATA dsw_data_combatribes_1[] ={   { "Coin Slots",            0x01, 0x02 },   { MSG_1COIN_1PLAY,         0x01, 0x00 },   { MSG_1COIN_2PLAY,         0x00, 0x00 },   { MSG_DSWB_BIT2,           0x02, 0x02 },   { MSG_OFF,                 0x02, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DSWB_BIT3,           0x04, 0x02 },   { MSG_OFF,                 0x04, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DSWB_BIT4,           0x08, 0x02 },   { MSG_OFF,                 0x08, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DSWB_BIT5,           0x10, 0x02 },   { MSG_OFF,                 0x10, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DEMO_SOUND,          0x20, 0x02 },   { MSG_ON,                  0x20, 0x00 },   { MSG_OFF,                 0x00, 0x00 },   { MSG_DSWB_BIT7,           0x40, 0x02 },   { MSG_OFF,                 0x40, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DSWB_BIT8,           0x80, 0x02 },   { MSG_OFF,                 0x80, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { NULL,                    0,    0,   },};static struct DSW_INFO combatribes_dsw[] ={   { 0x014011, 0x7F, dsw_data_combatribes_0 },   { 0x014013, 0xFF, dsw_data_combatribes_1 },   { 0,        0,    NULL,      },};static struct VIDEO_INFO combatribes_video ={   DrawCombaTribes,   320,   240,   32,   VIDEO_ROTATE_NORMAL |   VIDEO_ROTATABLE,};struct GAME_MAIN game_combatribes ={   combatribes_dirs,   combatribes_roms,   combatribes_inputs,   combatribes_dsw,   NULL,   LoadCombaTribes,   ClearCombaTribes,   &combatribes_video,   ExecuteCombaTribesFrame,   "ctribe",   "Combatribes",   "僓丒僐儞僶僢僩儔僀僽僗",   COMPANY_ID_TECHNOS,   "TA-0028",   1990,   technos_ym2151_m6295_sound,   GAME_BEAT,};static struct DIR_INFO combatribes_bootleg_dirs[] ={   { "combatribes_bootleg", },   { "ctribebl", },   { "ctribeb", },   { ROMOF("ctribe"), },   { CLONEOF("ctribe"), },   { NULL, },};static struct ROM_INFO combatribes_bootleg_roms[] ={   {   "ct_ep1.rom", 0x00020000, 0x9cfa997f, 0, 0, 0, },   {   "ct_ep2.rom", 0x00010000, 0x8c2c6dbd, 0, 0, 0, },   {   "ct_ep3.rom", 0x00020000, 0x2ece8681, 0, 0, 0, },   {   "ct_ep4.rom", 0x00008000, 0x4346de13, 0, 0, 0, },   {   "ct_ep5.rom", 0x00010000, 0x972faddb, 0, 0, 0, },   {   "ct_ep6.rom", 0x00010000, 0xeb3ab374, 0, 0, 0, },   {   "ct_ep7.rom", 0x00010000, 0xc602ac97, 0, 0, 0, },   {   "ct_ep8.rom", 0x00010000, 0x4da1d8e5, 0, 0, 0, },   {   "ct_mr0.rom", 0x00080000, 0xba73c49e, 0, 0, 0, },   {   "ct_mr1.rom", 0x00080000, 0x1c9badbd, 0, 0, 0, },   {   "ct_mr2.rom", 0x00080000, 0x8c796707, 0, 0, 0, },   {   "ct_mr3.rom", 0x00080000, 0x1ac2a461, 0, 0, 0, },   {   "ct_mr4.rom", 0x00040000, 0xb84fda09, 0, 0, 0, },   {   "ct_mr5.rom", 0x00040000, 0xcef0a821, 0, 0, 0, },   {   "ct_mr6.rom", 0x00040000, 0x617530fc, 0, 0, 0, },   {   "ct_mr7.rom", 0x00040000, 0xa8b773f1, 0, 0, 0, },   {   "ct_mr8.rom", 0x00040000, 0x9963a6be, 0, 0, 0, },   {           NULL,          0,          0, 0, 0, 0, },};struct GAME_MAIN game_combatribes_bootleg ={   combatribes_bootleg_dirs,   combatribes_bootleg_roms,   combatribes_inputs,   combatribes_dsw,   NULL,   LoadCombaTribes,   ClearCombaTribes,   &combatribes_video,   ExecuteCombaTribesFrame,   "ctribeb",   "Combatribes (bootleg)",   "僓丒僐儞僶僢僩儔僀僽僗 (bootleg)",   COMPANY_ID_BOOTLEG,   "TA-0028",   1990,   technos_ym2151_m6295_sound,   GAME_BEAT,};static UINT8 *GFX_BG0_SOLID;static UINT8 *GFX_SPR_SOLID;static void WriteOutByte(UINT32 address, UINT8 data){	address &= 0x0F;	RAM[(0x13000+address)^1]=data;		if(address==3)		TechnosSoundWrite68k(address,data);}static void WriteOutWord(UINT32 address, UINT16 data){	address &= 0x0F;	WriteWord(&RAM[0x13000+address],data);		if(address==2)		TechnosSoundWrite68k(address, (UINT8) (data&0xFF) );}static void CombaTribesSpeedPatch(void){   int address;   for(address=0;address<0x40000-8;address+=2){   if(ReadLong68k(&ROM[address+0])==0x08390003){   if(ReadLong68k(&ROM[address+4])==0x00180000){   if(ROM[address+8]==0x66){      WriteLong68k(&ROM[address+0],0x13FC0000);      WriteLong68k(&ROM[address+4],0x00AA0000);      WriteWord68k(&ROM[address+8],0x4E71);   }   else{      WriteLong68k(&ROM[address+0],0x4E714E71);      WriteLong68k(&ROM[address+4],0x4E714E71);      WriteWord68k(&ROM[address+8],0x4E71);   }   }}   }}void LoadCombaTribes(void){   int ta,tb,tc;   RAMSize=0x40000+0x10000;   if(!(ROM=AllocateMem(0x80000))) return;   if(!(RAM=AllocateMem(RAMSize))) return;   if(!(GFX=AllocateMem(0x680000))) return;   /*-------[SOUND SYSTEM INIT]-------*/   Z80ROM=RAM+0x40000;   if(!load_rom("ct_ep4.rom", Z80ROM, 0x8000)) return;	// Z80 SOUND ROM   Z80ROM[0x0098]=0x0F;   Z80ROM[0x009F]=0xA8;   Z80ROM[0x00E0]=0xC9;   if(!(PCMROM = AllocateMem(0x40000))) return;   if(!load_rom("ct_mr8.rom", PCMROM, 0x40000)) return;	// ADPCM ROM   for(ta=0;ta<0x20000;ta++){	// OKI ROM is out of sequence!!      tb=PCMROM[ta];      PCMROM[ta]=PCMROM[ta+0x20000];      PCMROM[ta+0x20000]=tb;   }   AddTechnosSoundOld(0x00A8, 0x0083, 0x8000, PCMROM, 159);   /*---------------------------------*/   tb=0;   if(!load_rom("ct_mr4.rom", ROM, 0x40000)) return;		// BG0   for(ta=0;ta<0x40000;ta++){      tc=ROM[ta];      GFX[tb+0]=(((tc&0x80)>>7)<<0);      GFX[tb+1]=(((tc&0x40)>>6)<<0);      GFX[tb+2]=(((tc&0x20)>>5)<<0);      GFX[tb+3]=(((tc&0x10)>>4)<<0);      GFX[tb+4]=(((tc&0x08)>>3)<<0);      GFX[tb+5]=(((tc&0x04)>>2)<<0);      GFX[tb+6]=(((tc&0x02)>>1)<<0);      GFX[tb+7]=(((tc&0x01)>>0)<<0);      tb+=16;      if((tb&0xFF)==0){tb-=0xF8;}      else{if((tb&0xFF)==8){tb-=0x8;}}   }   tb=0;   if(!load_rom("ct_mr5.rom", ROM, 0x40000)) return;		// BG0   for(ta=0;ta<0x40000;ta++){      tc=ROM[ta];      GFX[tb+0]|=(((tc&0x80)>>7)<<1);      GFX[tb+1]|=(((tc&0x40)>>6)<<1);      GFX[tb+2]|=(((tc&0x20)>>5)<<1);      GFX[tb+3]|=(((tc&0x10)>>4)<<1);      GFX[tb+4]|=(((tc&0x08)>>3)<<1);      GFX[tb+5]|=(((tc&0x04)>>2)<<1);      GFX[tb+6]|=(((tc&0x02)>>1)<<1);      GFX[tb+7]|=(((tc&0x01)>>0)<<1);      tb+=16;      if((tb&0xFF)==0){tb-=0xF8;}      else{if((tb&0xFF)==8){tb-=0x8;}}   }   tb=0;   if(!load_rom("ct_mr6.rom", ROM, 0x40000)) return;		// BG0   for(ta=0;ta<0x40000;ta++){      tc=ROM[ta];      GFX[tb+0]|=(((tc&0x80)>>7)<<2);      GFX[tb+1]|=(((tc&0x40)>>6)<<2);      GFX[tb+2]|=(((tc&0x20)>>5)<<2);      GFX[tb+3]|=(((tc&0x10)>>4)<<2);      GFX[tb+4]|=(((tc&0x08)>>3)<<2);      GFX[tb+5]|=(((tc&0x04)>>2)<<2);      GFX[tb+6]|=(((tc&0x02)>>1)<<2);      GFX[tb+7]|=(((tc&0x01)>>0)<<2);      tb+=16;      if((tb&0xFF)==0){tb-=0xF8;}      else{if((tb&0xFF)==8){tb-=0x8;}}   }   tb=0;   if(!load_rom("ct_mr7.rom", ROM, 0x40000)) return;		// BG0   for(ta=0;ta<0x40000;ta++){      tc=ROM[ta];      GFX[tb+0]|=(((tc&0x80)>>7)<<3);      GFX[tb+1]|=(((tc&0x40)>>6)<<3);      GFX[tb+2]|=(((tc&0x20)>>5)<<3);      GFX[tb+3]|=(((tc&0x10)>>4)<<3);      GFX[tb+4]|=(((tc&0x08)>>3)<<3);      GFX[tb+5]|=(((tc&0x04)>>2)<<3);      GFX[tb+6]|=(((tc&0x02)>>1)<<3);      GFX[tb+7]|=(((tc&0x01)>>0)<<3);      tb+=16;      if((tb&0xFF)==0){tb-=0xF8;}      else{if((tb&0xFF)==8){tb-=0x8;}}   }   tb=0x200000;   if(!load_rom("ct_mr0.rom", ROM, 0x80000)) return;		// SPR   for(ta=0;ta<0x80000;ta++){      tc=ROM[ta];      GFX[tb+0]=(((tc&0x80)>>7)<<0);      GFX[tb+1]=(((tc&0x40)>>6)<<0);      GFX[tb+2]=(((tc&0x20)>>5)<<0);      GFX[tb+3]=(((tc&0x10)>>4)<<0);      GFX[tb+4]=(((tc&0x08)>>3)<<0);      GFX[tb+5]=(((tc&0x04)>>2)<<0);      GFX[tb+6]=(((tc&0x02)>>1)<<0);      GFX[tb+7]=(((tc&0x01)>>0)<<0);      tb+=16;      if((tb&0xFF)==0){tb-=0xF8;}      else{if((tb&0xFF)==8){tb-=0x8;}}   }   tb=0x200000;   if(!load_rom("ct_mr1.rom", ROM, 0x80000)) return;		// SPR   for(ta=0;ta<0x80000;ta++){      tc=ROM[ta];      GFX[tb+0]|=(((tc&0x80)>>7)<<1);      GFX[tb+1]|=(((tc&0x40)>>6)<<1);      GFX[tb+2]|=(((tc&0x20)>>5)<<1);      GFX[tb+3]|=(((tc&0x10)>>4)<<1);      GFX[tb+4]|=(((tc&0x08)>>3)<<1);      GFX[tb+5]|=(((tc&0x04)>>2)<<1);      GFX[tb+6]|=(((tc&0x02)>>1)<<1);      GFX[tb+7]|=(((tc&0x01)>>0)<<1);      tb+=16;      if((tb&0xFF)==0){tb-=0xF8;}      else{if((tb&0xFF)==8){tb-=0x8;}}   }   tb=0x200000;   if(!load_rom("ct_mr2.rom", ROM, 0x80000)) return;		// SPR

⌨️ 快捷键说明

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