Closed gamecenterjun closed 2 years ago
Hi! Sure, that's easy. If you don't need VMU LCD functionality, it might be easier for you to start from Charcole's original Pop'n Music controller code, since you wouldn't have to strip out MaplePad's analog stick/trigger code. Either way the edits would be similar.
First you'd need to make some changes to the main controller InfoPacket:
void BuildInfoPacket()
{
InfoPacket.BitPairsMinus1 = (sizeof(InfoPacket) - 7) * 4 - 1;
InfoPacket.Header.Command = CMD_RESPOND_DEVICE_INFO;
InfoPacket.Header.Recipient = ADDRESS_DREAMCAST;
InfoPacket.Header.Sender = ADDRESS_CONTROLLER_AND_SUBS;
InfoPacket.Header.NumWords = sizeof(InfoPacket.Info) / sizeof(uint);
InfoPacket.Info.Func = __builtin_bswap32(FUNC_CONTROLLER);
InfoPacket.Info.FuncData[0] = __builtin_bswap32(0x000f06fe); // What buttons it supports
InfoPacket.Info.FuncData[1] = 0;
InfoPacket.Info.FuncData[2] = 0;
InfoPacket.Info.AreaCode = -1;
InfoPacket.Info.ConnectorDirection = 0;
strncpy(InfoPacket.Info.ProductName,
"Dreamcast Controller ",
sizeof(InfoPacket.Info.ProductName));
strncpy(InfoPacket.Info.ProductLicense,
// NOT REALLY! Don't sue me Sega!
"Produced By or Under License From SEGA ENTERPRISES,LTD. ",
sizeof(InfoPacket.Info.ProductLicense));
InfoPacket.Info.StandbyPower = 430;
InfoPacket.Info.MaxPower = 500;
InfoPacket.CRC = CalcCRC((uint *)&InfoPacket.Header, sizeof(InfoPacket) / sizeof(uint) - 2);
}
This is the Maple packet the controller sends to the Dreamcast to identify itself. InfoPacket.Info.FuncData[0] should be updated to indicate the buttons the Arcade Stick supports (Dpad, ABXYCZ, Start) based on Sega's official Arcade Stick documentation (05_Svs090e.doc in Kochise's dreamcast-docs). It's also wise to match Sega's spec for the ProductName and Power fields, just to be safe.
Then you'd just need to update the buttons themselves-- increase the NUM_BUTTONS macro to 11, and add the new buttons (including the GPIOs you wire them to, and their bitmask as per Sega's controller docs) to the ButtonInfo struct. You can see the unused C button left over from Charcole's Pop'n Music controller below.
static ButtonInfo ButtonInfos[NUM_BUTTONS]=
{
{ 0, 0x0004}, // Red centre, A
{ 1, 0x0002}, // Green right, B
{ 4, 0x0400}, // Blue right, X
{ 5, 0x0200}, // Yellow right, Y
{ 6, 0x0010}, // Yellow left, UP
{ 7, 0x0020}, // Green left, DOWN
{ 8, 0x0040}, // White left, LEFT
{ 9, 0x0080}, // Blue left, RIGHT
{ 10, 0x0008} // White right, START
// { 13, 0x0001} // White right, C
};
Finally, if using MaplePad's codebase, you would need to remove or comment out all the analog stick and trigger code in SendControllerStatus(), so it doesn't mess up the packet checksum. If you use Charcole's original codebase you don't have to worry about this.
Hopefully that answers your question. If you'd like me to make a branch of MaplePad with these changes, let me know and I'll see what I can do!
I have no coding experience, so I think I'd mess it up pretty easily if I tried to do it myself! It would be perfect if you could make a branch for the Arcade stick version!
i forked this and did a version with L and R as buttons instead of triggers.
Exactly what I needed! Thank you!! I'll be trying this out soon!
I've been including an HKT-7300 binary in each release since v1.3b, so I'm going to close this. Saw on Twitter you made an arcade stick with it! Very cool!
Is it possible to make an arcade stick version for this? Basically the same thing, but using C and Z buttons instead of L and R triggers, since digital inputs are better than analog for arcade sticks and games. It would be fantastic if this were possible!