Finalburn Alpha 2.9x Writing CPS2 Game Driver
Author: Hu Yingzhuo
Finalburn alpha is one of the best CPS1 / 2 simulators today, more valuable is that it is completely open source. Starting from FinalBurn Alpha 2.93, the Finalburn Alpha group (later referred to as FBA Group) turned to multi-function, multi-model support, rather than a new version of a new game, or something The child has changed a new version. This makes the developer, but the player feels some inconvenience.
At first, I wrote some new version of FBA for everyone, but this will not be able to do with the version of the FBA team. Recently, I need to put the main energy on the online game, so there is not much time to write these drivers for everyone. Here, I am a for example for Finalburn Alpha 2.93 CPS2 game 19XX drivers, give you a explanation so that you can write new drivers yourself.
First, you want to include the drive head file CPS.H, the statement is as follows:
#include "cps.h"
Furthermore, it is an input device definition, nor does it take to explain, and the example is copied:
Static struct burninputinfo drvinputlist [] = {{"p1 coin", 0, cpsinp020 4, "p1 coin"}, {"p1 start", 0, cpsinp020 0, "p1 start"}, {"p1 up", 0, cpsinp001 3, "p1 up"}, {"p1 down", 0, cpsinp001 2, "p1 down"}, {"p1 left", 0, cpsinp001 1, "p1 left"}, {" P1 Right ", 0, cpsinp001 0," p1 right "}, {" p1 shot ", 0, cpsinp001 4," p1 fire 1 "}, {" p1 bomb ", 0, cpsinp001 5," P1 Fire 2 "}, // 19xx is a two-button game, if it is a 3-key game, only need to be added in order, such as // {" p1 autofire ", 0, cpsinp001 6," p1 auto fire "}, { "P2 coin", 0, cpsinp020 5, "p2 coin"}, {"p2 start", 0, cpsinp020 1, "p2 start"}, {"p2 up", 0, cpsinp000 3, "P2 Up "}, {" P2 down ", 0, cpsinp000 2," p2 down "}, {" p2 left ", 0, cpsinp000 1," p2 left "}, {" p2 right ", 0, cpsinp000 0 , "P2 Right"}, {"p2 shot", 0, cpsinp000 4, "p2 fire 1"}, {"p2 bomb", 0, cpsinp000 5, "p2 fire 2"}, {"reset", 0, & cpsReset, "reset"}, {"diagnostic", 0, cpsinp021 1, "diag"}, {"service", 0, cpsinp021 2, "service"},}; stdinputinfo (DRV); there is also one Special circumstances, due to The CPS2 is large, and the button definition method is used is the same, such as "Youth Street 3.", we can use the following method to define:
StdInputinfospec (DRV, CPSFSI);
According to the definition of Razoola, the number of ROM is numbered in accordance with the alignment of the chip:
Specific to the file name, the extension number is as follows:
01-02QSOUND Z80 Data 03-10 Program Data 11-12Qsound Sample Data 13-20 Image Data
ROM table Write us to see 19xx's way:
Static struct burnrominfo ninexromdesc [] = {// file name, file length, CRC check code, type {"19xux.03", 0x80000, 0x239a08ae, 0x10}, // 0 xor table {"19xUX.04", 0x80000, 0xC13A1072, 0x10}, // 1 {"19xUX.05", 0x80000, 0x8c066ec3, 0x10}, // 2 {"19XUX.06", 0x80000, 0x4b1caeb9, 0x10}, // 3 {"19xU.03", 0x80000 0x05955268, 0x10}, // 4 68000 code requires the above decryption {"19xU.04", 0x80000000000, 0X3111AB7F, 0x10}, // 5 {"19xU.05", 0x80000, 0x38df4a63, 0x10}, //6 {"19XU.06", 0x80000, 0x5c7e60d3, 0x10}, // 7 {"19X.07", 0x80000, 0x61c0296c, 0x10}, // 8 {"19X.13", 0x080000, 0x427aeb18, 1}, // 9 Image data, here is to arrange {"19X.15", 0x080000, 0x63BDBF54, 1}, // 10 {"19X.17" in this order of 3, 5, 7, 9, 4, 6, 8, 0 0x080000, 0x2DFE18B5, 1}, // 11 {"19x.19", 0x080000, 0xcbef9579, 1}, // 12 {"19X.14", 0x200000, 0XE916967C, 1}, // 13 {"19X.16 ", 0x200000, 0x6E75F3DB, 1}, // 14 {" 19X.18 ", 0x200000, 0X2213E798, 1}, // 15 {" 19x.20 ", 0x200000, 0XAB9D5B96, 1}, // 16 {" 19X. 01 ", 0x020000, 0xEF55195E, 2}, // 17 QSound data z80 sound data {" 19x.11 ", 0x2000 00, 0xD38Beef3, 2}, // 18 QSound sound sampling {"19x.12", 0x200000, 0xd47c96e2, 2}, // 19}; std_rom_pick (ninexx) STD_ROM_FN (NINEXX) This NINEXX is the name of our own definition It is also possible to modulate _19xx.
Then the driver information structure, the design of 19xx is as follows:
The game ROM file name, if it is 19XX, the corresponding 19xx.zip game name annotation or other information production business models produced the primary ROM name, such as the 19XX version of the Spanish version, you need to hit "19xx" motherboard BIOS here, not in use is defined as Null Run Sign, if you need to add BDF_ROTATE_GRAPHICS_CCW maximum player number hardware type Take zip name Special function ROM information ROM name structure input configuration information table DIP configuration table driver initialization function driver shutdown function game frame processing function game refresh function game Crash Processing function game palette space game screen width game screen high game screen aspect ratio Struct Burndriver Burndrvcps19xx = {{"19xx", "19xx: The War Against Destiny (US 951207)", "CAPCOM", "CPS2" , "1995", NULL, NULL}, BDF_GAME_WORKING | BDF_ROTATE_GRAPHICS_CCW, 2, HARDWARE_CAPCOM_CPS2, NULL, NinexxRomInfo, NinexxRomName, DrvInputInfo, NULL, DrvInit, DrvExit, Cps2Frame, CpsRedraw, CpsAreaScan, & CpsRecalcPal, 224, 384, 3,4}; DrvExit Function We don't have to deal with it, directly copy one, the key is the Drvinit function. Let's take a look at the 19XX DRVINIT function and make a detailed explanation for everyone:
Static int DRVINIT () {INT NRET = 0; INT i = 0; unsigned char * pqs = null; CPS = 2; // CPS1 type game is 1, CPS2 game is 2 ncpsromlen = 5 * 0x080000; // program data Length correspondence file 3-10 ncpscodelen = 4 * 0x080000; // Need to decrypt the length of the XOR table to decrypt the corresponding file 3-10 ncpsgfxlen = 0x1000000; // Image data length correspondence file 13-20 ncpszromlen = 1 * 0x020000; // QSoundDataz80 data Length correspondence file 1-2 ncpsqsamlen = 2 * 0x200000; // qsoundsample length correspondence file 11-12 nret = cpsinit (); if (nret! = 0) Return (1); // Loader ROM, here 5 is the program ROM Quantity, 4 is the number of xOR table ROMs for (i = 0; i <5; i ) {nret = burNloadROM (CPSROM 0x080000 * i, 4 i, 1); if (NRET! = 0) Return 1;} / / Decrypt Program ROM, here 4 is the number of XOR Table ROMs Memcpy (cpscode, cpsrom, ncpscodelen; for (i = 0; i <4; i ) {nret = burnxorrom (cpscode 0x080000 * i, 0 i, 1) ; if (nret! = 0) Return 1;} // Load image ROM nret = cps2loadTILES (CPSGFX, 9); // You can load 4, the rear number is the start number nRet = cps2loadtiles of the ROM (CPSGFX 0x0800000, 13); // 0x0800000 is the total capacity of the front 4 ROM // load z80 ROM NRET = BurnLoadROM (cpszrom, 17, 1); //, the same, 17 is the start number, 1 is the number of ROM, once Can only load 1 // load QSound Samples ROM PQS = (unsigned char *) cpsqsam; nret = burnloadrom (pqs, 18, 1); // 18 is numbered, the number of ROM is only 1 nret = burNloadROM (PQS 0x200000, 19, 1); // BurnTeswap (PQS, NCPSQSAMLEN); NRET = cpsruninit (); if (NRet! = 0) Return 1; Return 0;} To this, the above explanation is enough to write a driver for the new game, I hope that when Razoola will release the new CPS2 game XOR table, everyone can wait for the new driver, and can solve themselves .
Full text