Hi, I'm looking to write a plugin that will display player input while the emulator is running. I've tried looking through the source but have no idea where to start. I'm curious how games like Super Street Fighter 2: Turbo handle button presses. Like what value is set when a button is pressed so I can look for that value in memory and display an input. Is there a particular source file I should be looking at? Thanks.
I found this in d_cps2.cpp:
static struct BurnInputInfo Cps2FightingInputList[] = {
{"P1 Coin" , BIT_DIGITAL , CpsInp020+4, "p1 coin" },
{"P1 Start" , BIT_DIGITAL , CpsInp020+0, "p1 start" },
{"P1 Up" , BIT_DIGITAL , CpsInp001+3, "p1 up" },
{"P1 Down" , BIT_DIGITAL , CpsInp001+2, "p1 down" },
{"P1 Left" , BIT_DIGITAL , CpsInp001+1, "p1 left" },
{"P1 Right" , BIT_DIGITAL , CpsInp001+0, "p1 right" },
{"P1 Weak Punch" , BIT_DIGITAL , CpsInp001+4, "p1 fire 1" },
{"P1 Medium Punch" , BIT_DIGITAL , CpsInp001+5, "p1 fire 2" },
{"P1 Strong Punch" , BIT_DIGITAL , CpsInp001+6, "p1 fire 3" },
{"P1 Weak Kick" , BIT_DIGITAL , CpsInp011+0, "p1 fire 4" },
{"P1 Medium Kick" , BIT_DIGITAL , CpsInp011+1, "p1 fire 5" },
{"P1 Strong Kick" , BIT_DIGITAL , CpsInp011+2, "p1 fire 6" },
{"P2 Coin" , BIT_DIGITAL , CpsInp020+5, "p2 coin" },
{"P2 Start" , BIT_DIGITAL , CpsInp020+1, "p2 start" },
{"P2 Up" , BIT_DIGITAL , CpsInp000+3, "p2 up" },
{"P2 Down" , BIT_DIGITAL , CpsInp000+2, "p2 down" },
{"P2 Left" , BIT_DIGITAL , CpsInp000+1, "p2 left" },
{"P2 Right" , BIT_DIGITAL , CpsInp000+0, "p2 right" },
{"P2 Weak Punch" , BIT_DIGITAL , CpsInp000+4, "p2 fire 1" },
{"P2 Medium Punch" , BIT_DIGITAL , CpsInp000+5, "p2 fire 2" },
{"P2 Strong Punch" , BIT_DIGITAL , CpsInp000+6, "p2 fire 3" },
{"P2 Weak Kick" , BIT_DIGITAL , CpsInp011+4, "p2 fire 4" },
{"P2 Medium Kick" , BIT_DIGITAL , CpsInp011+5, "p2 fire 5" },
{"P2 Strong Kick" , BIT_DIGITAL , CpsInp020+6, "p2 fire 6" },
{"Reset" , BIT_DIGITAL , &CpsReset , "reset" },
{"Diagnostic" , BIT_DIGITAL , CpsInp021+1, "diag" },
{"Service" , BIT_DIGITAL , CpsInp021+2, "service" },
};
STDINPUTINFO(Cps2Fighting)
However, I can't seem to find where CPSINPxxx is defined or STDINPUTINFO(). I'm not very proficient in C++ so this is daunting for me
.
Also, is there any variable, perhaps a pointer that points to allocated memory for the CPS2 rom? I'm trying to find a static position in the memory of the emulator where the rom is stored so I can always find the address associated with the button press values.
If I had to make an educated guess I'd say its (cps2_crpt.cpp):
#if 0
UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1);
int length = memory_region_length(REGION_CPU1);
UINT16 *dec = auto_malloc(length);
int i;
#endif
Either *rom or *dec pointer that points to where the rom memory begins? Am I correct? Or is this allocating memory to decrypt the rom?
Sorry if I'm not being clear enough, hope someone understands what I am trying to say.