Optimised code

This commit is contained in:
crediar 2025-08-01 20:19:58 +02:00
commit c4a0d61c90

View file

@ -1565,6 +1565,10 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* buffer, int request_length)
{ {
unsigned char player_data[3] = {0, 0, 0}; unsigned char player_data[3] = {0, 0, 0};
// Service button
if (PadStatus.switches & PAD_SWITCH_SERVICE)
player_data[0] |= 0x40;
switch (AMMediaboard::GetGameType()) switch (AMMediaboard::GetGameType())
{ {
// Controller configuration for F-Zero AX (DX) // Controller configuration for F-Zero AX (DX)
@ -1580,9 +1584,6 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* buffer, int request_length)
// Start // Start
if (PadStatus.button & PAD_BUTTON_START) if (PadStatus.button & PAD_BUTTON_START)
player_data[0] |= 0x80; player_data[0] |= 0x80;
// Service button
if (PadStatus.switches&PAD_SWITCH_SERVICE)
player_data[0] |= 0x40;
// Boost // Boost
if (PadStatus.button & PAD_BUTTON_Y) if (PadStatus.button & PAD_BUTTON_Y)
player_data[0] |= 0x02; player_data[0] |= 0x02;
@ -1637,10 +1638,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* buffer, int request_length)
// Start // Start
if (PadStatus.button & PAD_BUTTON_START) if (PadStatus.button & PAD_BUTTON_START)
player_data[0] |= 0x80; player_data[0] |= 0x80;
// Service button
if (PadStatus.switches&PAD_SWITCH_SERVICE)
player_data[0] |= 0x40;
// Boost // Boost
if (PadStatus.button & PAD_BUTTON_Y) if (PadStatus.button & PAD_BUTTON_Y)
player_data[0] |= 0x02; player_data[0] |= 0x02;
@ -1687,10 +1685,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* buffer, int request_length)
PadStatus = Pad::GetStatus(i); PadStatus = Pad::GetStatus(i);
// Start // Start
if (PadStatus.button & PAD_BUTTON_START) if (PadStatus.button & PAD_BUTTON_START)
player_data[0] |= 0x80; player_data[0] |= 0x80;
// Service button
if (PadStatus.switches&PAD_SWITCH_SERVICE)
player_data[0] |= 0x40;
// Long Pass // Long Pass
if (PadStatus.button & PAD_TRIGGER_L) if (PadStatus.button & PAD_TRIGGER_L)
player_data[0] |= 0x01; player_data[0] |= 0x01;
@ -1719,10 +1714,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* buffer, int request_length)
PadStatus = Pad::GetStatus(i); PadStatus = Pad::GetStatus(i);
// Start // Start
if (PadStatus.button & PAD_BUTTON_START) if (PadStatus.button & PAD_BUTTON_START)
player_data[0] |= 0x80; player_data[0] |= 0x80;
// Service button
if (PadStatus.switches&PAD_SWITCH_SERVICE)
player_data[0] |= 0x40;
// Long Pass // Long Pass
if (PadStatus.button & PAD_TRIGGER_L) if (PadStatus.button & PAD_TRIGGER_L)
player_data[0] |= 0x01; player_data[0] |= 0x01;
@ -1760,10 +1752,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* buffer, int request_length)
PadStatus = Pad::GetStatus(i); PadStatus = Pad::GetStatus(i);
// Start // Start
if (PadStatus.button & PAD_BUTTON_START) if (PadStatus.button & PAD_BUTTON_START)
player_data[0] |= 0x80; player_data[0] |= 0x80;
// Service button
if (PadStatus.switches&PAD_SWITCH_SERVICE)
player_data[0] |= 0x40;
// A // A
if (PadStatus.button & PAD_BUTTON_B) if (PadStatus.button & PAD_BUTTON_B)
player_data[0] |= 0x01; player_data[0] |= 0x01;
@ -1811,10 +1800,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* buffer, int request_length)
PadStatus = Pad::GetStatus(0); PadStatus = Pad::GetStatus(0);
// Debug On // Debug On
if (PadStatus.button & PAD_BUTTON_START) if (PadStatus.button & PAD_BUTTON_START)
player_data[0] |= 0x80; player_data[0] |= 0x80;
// Service button
if (PadStatus.switches&PAD_SWITCH_SERVICE)
player_data[0] |= 0x40;
// Switch 1 // Switch 1
if (PadStatus.button & PAD_BUTTON_A) if (PadStatus.button & PAD_BUTTON_A)
player_data[0] |= 0x04; player_data[0] |= 0x04;