xenon: support for multiple controllers

This commit is contained in:
tmbinc 2009-09-11 14:52:03 +00:00
parent feee83d784
commit 0e3155eeda

View File

@ -60,13 +60,16 @@ emulate ()
{ {
while(1) // emulation loop while(1) // emulation loop
{ {
struct controller_data_s c; int ctrl;
if (get_controller_data(&c, 0)) for (ctrl = 0; ctrl < 4; ++ctrl)
{ {
// printf("got controller data!\n"); struct controller_data_s c;
int offset = 0x10; if (get_controller_data(&c, ctrl))
// printf("a=%d, b=%d, x=%d, y=%d, lb=%d, rb=%d, start=%d, select=%d, up=%d, down=%d, left=%d, right=%d\n", {
// c.a, c.b, c.x, c.y, c.lb, c.rb, c.start, c.select, c.up, c.down, c.left, c.right); // printf("got controller data!\n");
int offset = 0x10 + ctrl * 0x10;
// printf("a=%d, b=%d, x=%d, y=%d, lb=%d, rb=%d, start=%d, select=%d, up=%d, down=%d, left=%d, right=%d\n",
// c.a, c.b, c.x, c.y, c.lb, c.rb, c.start, c.select, c.up, c.down, c.left, c.right);
S9xReportButton (offset + 0, c.b); S9xReportButton (offset + 0, c.b);
S9xReportButton (offset + 1, c.a); S9xReportButton (offset + 1, c.a);
@ -84,6 +87,7 @@ emulate ()
S9xReportButton (offset + 10, c.left); S9xReportButton (offset + 10, c.left);
S9xReportButton (offset + 11, c.right); S9xReportButton (offset + 11, c.right);
} }
}
S9xMainLoop (); S9xMainLoop ();
usb_do_poll(); usb_do_poll();