Initial commit for GitHub migration based on spice2x-25-03-03

This commit is contained in:
sp2xdev
2025-03-10 19:16:49 -07:00
parent 94af8d32c9
commit ed8c72852f
1008 changed files with 296815 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
#include "bbc.h"
#include "avs/game.h"
#include "games/shared/lcdhandle.h"
#include "hooks/devicehook.h"
#include "hooks/graphics/graphics.h"
#include "util/detour.h"
#include "util/logging.h"
#include "util/sigscan.h"
namespace games::bbc {
BBCGame::BBCGame() : Game("Bishi Bashi Channel") {
}
void BBCGame::attach() {
Game::attach();
devicehook_init();
devicehook_add(new games::shared::LCDHandle());
// window patch
if (GRAPHICS_WINDOWED) {
unsigned char pattern[] = {
0x48, 0x8D, 0x54, 0x24, 0x40, 0x41, 0x8D, 0x4E, 0x20, 0x41, 0x0F, 0xB6, 0xE8
};
unsigned char replace[] = {
0x48, 0x8D, 0x54, 0x24, 0x40, 0x41, 0x8D, 0x4E, 0x20, 0x31, 0xED, 0x90, 0x90
};
std::string mask = "XXXXXXXXXXXXX";
if (!replace_pattern(
avs::game::DLL_INSTANCE,
pattern,
mask.c_str(),
0,
0,
replace,
mask.c_str()))
log_warning("bbc", "windowed mode failed");
}
}
}
+13
View File
@@ -0,0 +1,13 @@
#pragma once
#include "games/game.h"
namespace games::bbc {
class BBCGame : public games::Game {
public:
BBCGame();
virtual void attach() override;
};
}
+115
View File
@@ -0,0 +1,115 @@
#include "io.h"
std::vector<Button> &games::bbc::get_buttons() {
static std::vector<Button> buttons;
if (buttons.empty()) {
buttons = GameAPI::Buttons::getButtons("Bishi Bashi Channel");
GameAPI::Buttons::sortButtons(
&buttons,
"Service",
"Test",
"P1 R",
"P1 G",
"P1 B",
"P1 Disk-",
"P1 Disk+",
"P1 Disk -/+ Slowdown",
"P2 R",
"P2 G",
"P2 B",
"P2 Disk-",
"P2 Disk+",
"P2 Disk -/+ Slowdown",
"P3 R",
"P3 G",
"P3 B",
"P3 Disk-",
"P3 Disk+",
"P3 Disk -/+ Slowdown",
"P4 R",
"P4 G",
"P4 B",
"P4 Disk-",
"P4 Disk+",
"P4 Disk -/+ Slowdown"
);
}
return buttons;
}
std::string games::bbc::get_buttons_help() {
// keep to max 100 characters wide
return
" green \n"
" red blue \n"
"\n"
"Green button is a spinning disk that can be pressed."
;
}
std::vector<Analog> &games::bbc::get_analogs() {
static std::vector<Analog> analogs;
if (analogs.empty()) {
analogs = GameAPI::Analogs::getAnalogs("Bishi Bashi Channel");
GameAPI::Analogs::sortAnalogs(
&analogs,
"P1 Disk",
"P2 Disk",
"P3 Disk",
"P4 Disk"
);
}
return analogs;
}
std::vector<Light> &games::bbc::get_lights() {
static std::vector<Light> lights;
if (lights.empty()) {
lights = GameAPI::Lights::getLights("Bishi Bashi Channel");
GameAPI::Lights::sortLights(
&lights,
"P1 R",
"P1 B",
"P1 Disc R",
"P1 Disc G",
"P1 Disc B",
"P2 R",
"P2 B",
"P2 Disc R",
"P2 Disc G",
"P2 Disc B",
"P3 R",
"P3 B",
"P3 Disc R",
"P3 Disc G",
"P3 Disc B",
"P4 R",
"P4 B",
"P4 Disc R",
"P4 Disc G",
"P4 Disc B",
"IC Card R",
"IC Card G",
"IC Card B",
"Under LED1 R",
"Under LED1 G",
"Under LED1 B",
"Under LED2 R",
"Under LED2 G",
"Under LED2 B",
"Under LED3 R",
"Under LED3 G",
"Under LED3 B"
);
}
return lights;
}
+93
View File
@@ -0,0 +1,93 @@
#pragma once
#include <vector>
#include "cfg/api.h"
namespace games::bbc {
// all buttons in correct order
namespace Buttons {
enum {
Service,
Test,
P1_R,
P1_G,
P1_B,
P1_DiskMinus,
P1_DiskPlus,
P1_DiskSlowdown,
P2_R,
P2_G,
P2_B,
P2_DiskMinus,
P2_DiskPlus,
P2_DiskSlowdown,
P3_R,
P3_G,
P3_B,
P3_DiskMinus,
P3_DiskPlus,
P3_DiskSlowdown,
P4_R,
P4_G,
P4_B,
P4_DiskMinus,
P4_DiskPlus,
P4_DiskSlowdown,
};
}
// all analogs in correct order
namespace Analogs {
enum {
P1_Disk,
P2_Disk,
P3_Disk,
P4_Disk,
};
}
// all lights in correct order
namespace Lights {
enum {
P1_R,
P1_B,
P1_DISC_R,
P1_DISC_G,
P1_DISC_B,
P2_R,
P2_B,
P2_DISC_R,
P2_DISC_G,
P2_DISC_B,
P3_R,
P3_B,
P3_DISC_R,
P3_DISC_G,
P3_DISC_B,
P4_R,
P4_B,
P4_DISC_R,
P4_DISC_G,
P4_DISC_B,
IC_CARD_R,
IC_CARD_G,
IC_CARD_B,
UNDER_LED1_R,
UNDER_LED1_G,
UNDER_LED1_B,
UNDER_LED2_R,
UNDER_LED2_G,
UNDER_LED2_B,
UNDER_LED3_R,
UNDER_LED3_G,
UNDER_LED3_B,
};
}
// getters
std::vector<Button> &get_buttons();
std::string get_buttons_help();
std::vector<Analog> &get_analogs();
std::vector<Light> &get_lights();
}