CPS2-FBA driver development example

zhaozj2021-02-16  57

/ * CPS2-FBA "MARS Matrix" Driver Source * /

#include "cps.h"

/ * AUTHER: Wangmeng (HeartiTible@163.com)

-------

Changelog:

02/05/2003 Fixed Rominfo type error = .. =

02/05/2003 Supported Janpan Editor - Needed XOR'S CRACKED

02/05/2003 Supported English Editor - Needed XOR's CRACKED

-------

Doubler Player and One Key's

* /

/ * Start -> Define Controller * /

Static struct burninputinfo drvinputlist [] =

{

{"P1 coin", 0, cpsinp020 4, "p1 coin"}, // p1 coin

{"P1 start", 0, cpsinp020 0, "p1 start"}, // p1 start

{"P1 up", 0, cpsinp001 3, "p1 up"}, // p1

{"P1 down", 0, cpsinp001 2, "p1 down"}, // p1

{"P1 left", 0, cpsinp001 1, "p1 left"}, // p1 left

{"P1 Right", 0, cpsinp001 0, "p1 right"}, // p1 right

{"P1 shot", 0, cpsinp001 4, "p1 fire 1"}, // shot

{"P2 coin", 0, cpsinp020 5, "p2 coin"}, // p2 coin

{"P2 start", 0, cpsinp020 1, "p2 start"}, // p2 start

{"P2 up", 0, cpsinp000 3, "p2 up"}, // p2

{"P2 down", 0, cpsinp000 2, "p2 down"}, // p2

{"P2 left", 0, cpsinp000 1, "p2 left"}, // p2 left

{"P2 right", 0, cpsinp000 0, "p2 right"}, // p2 right

{"P2 shot", 0, cpsinp000 4, "p2 fire 1"}, // shot

{"Reset", 0, & cpsreset, "reset"}, // restart

{"Diagnostic", 0, cpsinp021 1, "diag"}, // debug menu

{"Service", 0, cpsinp021 2, "service"}, // service

}

STDINPUTINFO (DRV);

/ * Complete -> Define Controller * /

/ * Start -> Game Load * /

Static int DRVINIT ()

{

INT nret = 0; int i = 0; unsigned char * pqs = null; CPS = 2;

ncpsromlen = 3 * 0x080000; // Program file length

Ncpscodelen = 3 * 0x080000; // xor decryption file length

ncpsgfxlen = 8 * 0x400000; // Image file length

ncpszromlen = 0x020000; // qsound z80 sound file length

ncpsqsamlen = 2 * 0x400000; // QSound sound sampling file length

NRET = cpsinit (); if (nret! = 0) Return 1;

// Read the program ROM (USA: mmxu.03 mmxu.04 mmxu.05 janpan: mmxuj.03 mmxuj.04 mmxuj.05)

For (i = 0; i <3; i )

{Nret = BurnLoadrom (CPSROM 0x080000 * i, 3 ​​ i, 1); if (NRET! = 0) Return 1;}

// Decryption ROM - XOR Table (USA: mmxux.03 mmxux.04 mmxux.05 janpan: mmxujx.03 mmxujx.04 mmxujx.05)

Memcpy (cpscode, cpsrom, ncpscodelen);

For (i = 0; i <3; i )

{nret = burnxorrom (cpscode 0x080000 * i, 0 i, 1); if (NRET! = 0) Return 1;}

// read the image

NRET = CPS2LOADTILES (CPSGFX, 6); // Read MMXU.13 mmxu.15 mmxu.17 mmxu.19

NRET = CPS2LOADTILES (CPSGFX 4 * 0x400000, 10); // Read mmxu.14 mmxu.16 mmxu.18 mmxu.20

// Read Z80 ROM

NRET = BurnLoadrom (cpszrom, 14, 1); // Read Z80 ROM mmxu.01

// Read QSound Sampling ROM

PQS = (unsigned char *) CPSQSAM;

NRET = BurnLoadROM (PQS, 15, 1); // Read the first sample ROM mmxu.11

NRET = BurnLoadROM (PQS 0x400000, 16, 1); // Read the second sample ROM mmxu.12

BurnByteswap (PQS, NCPSQSAMLEN);

NRET = cpsruninit (); if (nret! = 0) Return 1;

Return 0;

}

/ * Complete -> Game loading * /

/ * Start -> Exit Game * /

Static int DRVEXIT ()

{

Cpsrunexit ();

CPSEXIT ();

ncpsqsamlen = 0;

ncpszromlen = 0;

ncpsgfxlen = 0;

ncpscodelen = 0;

ncpsromlen = 0;

CPS = 0;

Return 0;

}

/ * Complete -> Exit game * /

/ ********************************************

Mars Matrix - USA Revision: 000412

******************************************* /

/ * Start -> Definition ROM Information * /

Static struct burnrominfo mmatrixromdesc [] = {

// xor rom information - Type code: 0x10

{"mmxux.03", 0x080000, 0x7868ae77, 0x10}, // 0

{"mmxux.04", 0x080000, 0xa5ee6d07, 0x10}, // 1

{"mmxux.05", 0x080000, 0xB07745FF, 0x10}, // 2

// Program ROM Information - Type Code: 0x10

{"mmxu.03", 0x080000, 0xAb65b599, 0x10}, // 3

{"mmxu.04", 0x080000, 0x0135fc6c, 0x10}, // 4

{"mmxu.05", 0x080000, 0xf1fd2b84, 0x10}, // 5

// Image ROM Information - Type Code: 1

{"mmxu.13", 0x400000, 0x04748718, 1}, // 6

{"mmxu.15", 0x400000, 0x38074f44, 1}, // 7

{"mmxu.17", 0x400000, 0xe4635e35, 1}, // 8

{"mmxu.19", 0x400000, 0x4400A3f2, 1}, // 9

{"mmxu.14", 0x400000, 0xD52BF491, 1}, // 10

{"mmxu.16", 0x400000, 0x23f70780, 1}, // 11

{"mmxu.18", 0x400000, 0x2562c9d5, 1}, // 12

{"mmxu.20", 0x400000, 0x583A9687, 1}, // 13

// qsound z80 ROM information - Type code: 2

{"mmxu.01", 0x020000, 0xc57e8171, 2}, // 14

// QSound Sampling ROM Information - Type Code: 2

{"mmxu.11", 0x400000, 0x4180b39f, 2}, // 15

{"mmxu.12", 0x400000, 0x95e22a59, 2}, // 16

}

STD_ROM_PICK (mmatrix) STD_ROM_FN (mmatrix)

/ * Complete -> ROM information * /

/ * Start -> Drive Instructions * /

Struct Burndriver Burndrvcpsmmatrix =

{

// Basic Information

{"mmatrix", "Mars Matrix: Hyper Solid Shooting (USA)", "CODER BY Wangmeng, 02/05/2003.",

"CAPCOM", "CPS2", "2000", NULL, NULL},

// Operation information

1, 2, hardware_capcom_cps2, null, mmatrixrominfo, mmatrixromname, drvinputinfo, null,

// Drive information

Drvinit, DrVEXIT, CPS2Frame, CPSredraw, Cpsareascan, & CPSRECPAL, 224, 384, 3, 4

}

/ * Complete -> Drive information * /

/ **********************************************

MARS Matrix - Janpan Revision: 000412 ************************************************

/ * Start -> Definition ROM Information * /

Static struct burnrominfo mmatrixjromdesc [] =

{

// xor rom information - Type code: 0x10

{"mmxujx.03", 0x080000, 0x4ca1424f, 0x10}, // 0

{"mmxujx.04", 0x080000, 0x61b9b2a1, 0x10}, // 1

{"mmxujx.05", 0x080000, 0xbdd304cf, 0x10}, // 2

// Program ROM Information - Type Code: 0x10

{"mmxuj.03", 0x080000, 0x1d5de213, 0x10}, // 3

{"mmxuj.04", 0x080000, 0xd943a339, 0x10}, // 4

{"mmxuj.05", 0x080000, 0x0c8b4ab, 0x10}, // 5

// Image ROM Information - Type Code: 1

{"mmxu.13", 0x400000, 0x04748718, 1}, // 6

{"mmxu.15", 0x400000, 0x38074f44, 1}, // 7

{"mmxu.17", 0x400000, 0xe4635e35, 1}, // 8

{"mmxu.19", 0x400000, 0x4400A3f2, 1}, // 9

{"mmxu.14", 0x400000, 0xD52BF491, 1}, // 10

{"mmxu.16", 0x400000, 0x23f70780, 1}, // 11

{"mmxu.18", 0x400000, 0x2562c9d5, 1}, // 12

{"mmxu.20", 0x400000, 0x583A9687, 1}, // 13

// qsound z80 ROM information - Type code: 2

{"mmxu.01", 0x020000, 0xc57e8171, 2}, // 14

// QSound Sampling ROM Information - Type Code: 2

{"mmxu.11", 0x400000, 0x4180b39f, 2}, // 15

{"mmxu.12", 0x400000, 0x95e22a59, 2}, // 16

}

STD_ROM_PICK (mmatrixj) STD_ROM_FN (mmatrixj)

/ * Complete -> ROM information * /

/ * Start -> Drive Instructions * /

Struct Burndriver Burndrvcpsmmatrixj =

{

// Basic Information

{"mmatrixj", "MARS Matrix: Hyper Solid Shooting (Janpan)", "CODER BY Wangmeng, 02/05/2003.",

"CAPCOM", "CPS2", "2000", "MMATRIX", NULL},

// Operation information

1, 2, hardware_capcom_cps2, null, mmatrixjrominfo, mmatrixjromname, drvinputinfo, null,

// Drive information

Drvinit, DrVEXIT, CPS2Frame, Cpsredraw, CPSareascan, & CPSRECALCPAL, 224, 384, 3, 4}

/ * Complete -> Drive information * /

/ * EOF * /

/ ************************************************** *******************************

If you want to write FBA game drivers you can write to www.hyzgame.com to check the relevant information. Over!

*********************************************************** *********************** /

转载请注明原文地址:https://www.9cbs.com/read-24574.html

New Post(0)