FBA CPS2 driver writing template

zhaozj2021-02-16  50

/ * CPS2-FBA "- Game Name -" Game Driver * /

#include "cps.h"

/ * Important: The size of the ROM is based on the same type of single ROM maximum * /

/ * Start -> Define Controller * /

/ *

StdInputInfospec (DRV, CPSFSI); // Fighting Game Agency Controller Definition

* /

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"}, // single key

{"P1 bomb", 0, cpsinp001 5, "p1 fire 2"}, // double button

// {"p1 autofire", 0, cpsinp001 6, "p1 auto fire"}, // three-button

{"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"}, // single button

{"P2 Bomb", 0, CPSINP000 5, "P2 Fire 2"}, // Double button

// {"p2 autofire", 0, cpsinp000 6, "p2 auto fire"}, // three-button

{"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; // CPS1 = 1 CPS2 = 2 CPS modified version = 3

NCPSROMLEN = / * quantity * 16 Value maximum volume * /; // program file length

Ncpscodelen = / * number * 16 Value maximum volume * /; // xor decryption file length

Ncpsgfxlen = / * number * 16 Value maximum volume * /; // image file length

Ncpszromlen = / * quantity * 16 invalid value maximum volume * /; // qsound z80 sound file length

Ncpsqsamlen = / * quantity * 16 invalid value maximum volume * /; // qsound sound sampling file length

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

// Read the program ROM

For (i = 0; i

{nret = burnloadrom (CPSROM / * program ROM16 Value maximum volume * / * i, / * number * / i, 1); if (nret! = 0) Return 1;}

// Decryption ROM - XOR

Memcpy (cpscode, cpsrom, ncpscodelen);

For (i = 0; i

{nret = burnxorrom (cpscode / * decryption file 16 Value maximum volume * / * i, 0 i, 1); if (NRET! = 0) Return 1;}

// Read the image - image ROM The serial number is defined in the ROM information (up to 8)

NRET = CPS2LOADTILES (CPSGFX, / * Image Part Start No. * /);

// up to 4 each time, first single double array [for example: 1 3 5 2 4 6]

// nret = CPS2LOADTILES (CPSGFX / * The first 4 images ROM16 VAT Maximum Volume * /, / * Fifth Image ROM Serial No. * /); // Read 4 Images ROM

/ / Read Z80 ROM (up to 2 in CPS2)

NRET = BurnLoadROM (cpszrom, / * z80rom start number * /, 1); // reads the first Z80 ROM only read one.

// nret = burnloadrom (cpszrom / * z80 sound 16 invalid file volume * /, / * z80ROM secondary number * /, 1); // read the second Z80 ROM

// Read QSound Sampling ROM (up to 2 in CPS2)

PQS = (unsigned char *) CPSQSAM;

NRET = BurnLoadROM (PQS, / * Sampling ROM start number * /, 1); // Read the first sample ROM can only read 1 each time.

// nret = burnloadrom (PQS / * Sampling ROM16 Value Maximum Volume * /, / * Sampling ROM Second No. * /, 1); // Read the second Sampling ROM

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 * /

/ * Start -> Definition ROM Information * /

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

Game Name (Version difference: USA, Japan, etc.)

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

Static struct burnrominfo / * Game tag * / romdesc [] =

{

// xor rom information - Type code: 0x10

{"File Name", 16 Vigification Volume, CRC32 check value, type code}, // ROM number starts with 0

// ......

// Program ROM Information - Type Code: 0x10

{"File Name", 16 Value Maximum Volume, CRC32 Check Value, Type Code}, // ROM Number

// ......

// Image ROM Information - Type Code: 1

{"File Name", 16 Value Maximum Volume, CRC32 Check Value, Type Code}, // ROM Number

// ......

// qsound z80 ROM information - Type code: 2

{"File Name", 16 Value Maximum Volume, CRC32 Check Value, Type Code}, // ROM Number

// ......

// QSound Sampling ROM Information - Type Code: 2

{"File Name", 16 Value Maximum Volume, CRC32 Check Value, Type Code}, // ROM Number

// ......

}

STD_ROM_PICK (/ * Game Tag * /) STD_ROM_FN (/ * Game Tag * /) // Before and after, pay attention to case

/ * Complete -> ROM information * /

/ * Start -> Drive Instructions * /

Struct Burndriver BurndRVCPS / * Game Tag * / =

{ // Basic Information

{"ROM file", // ROM ZIP file name

"Game Name", // Game full name abbreviation: additional (language code)

"Description Information", // Comment

"CAPCOM", // produced company

"CPS2", // host platform

"Year", // Yield Year

NULL, // Father ROM Name - If you need to set multiple versions, FBA is displayed in a tree structure

NULL / / Main Edition BIOS

}

// Operation information

BDF_GAME_WORKING | BDF_ROTATE_GRAPHICS_CCW, // Run Sign, if you need to add BDF_ROTATE_GRAPHICS_CCW

2, // maximum number of players

Hardware_capcom_cps2, // hardware type

NULL, // Take a zip name special function

/ * Game tag * / rominfo, // rom information structure

/ * Game tag * / romname, // ROM name structure

DRVINPUTINFO, / / ​​Enter Configuration Information Table

NULL, / / ​​DIP configuration table

// Drive information

DRVINIT, / / ​​Drive Initialization Function

DRVEXIT, / / ​​Drive Close Function CPS2FRAME, // Game Frame Processing Function

Cpsredraw, // Game Refresh Function

Cpsareascan, // Game tailoring function

& Cpsrecalcpal, // Game palette space

224, // Game screen width

384, // Game screen height

3, // Game screen

4 // Game screen bosphime

}

/ * Complete -> Drive information * /

/ *** EOF *** /

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

New Post(0)