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
+38
View File
@@ -0,0 +1,38 @@
#include "avs/game.h"
#include "hpm.h"
#include "util/detour.h"
#include "util/libutils.h"
#include "util/logging.h"
#include <mmsystem.h>
namespace games::hpm {
BOOL WINAPI SetCurrentDirectoryW_hook(LPCTSTR lpPathName) {
return true;
}
static decltype(mixerSetControlDetails)* mixerSetControlDetails_real = nullptr;
static MMRESULT WINAPI mixerSetControlDetails_hook(HMIXEROBJ hmxobj, LPMIXERCONTROLDETAILS pmxcd, DWORD fdwDetails) {
mixerSetControlDetails_real(hmxobj, pmxcd, fdwDetails);
return MMSYSERR_NOERROR;
}
HPMGame::HPMGame() : Game("HELLO! Pop'n Music") {
}
void HPMGame::attach() {
Game::attach();
HMODULE kernel32_module = libutils::try_module("kernel32.dll");
// patches
detour::inline_hook((void *) SetCurrentDirectoryW_hook, libutils::try_proc(
kernel32_module, "SetCurrentDirectoryW"));
mixerSetControlDetails_real = detour::iat_try("mixerSetControlDetails", mixerSetControlDetails_hook, avs::game::DLL_INSTANCE);
}
}
+13
View File
@@ -0,0 +1,13 @@
#pragma once
#include "games/game.h"
namespace games::hpm {
class HPMGame : public games::Game {
public:
HPMGame();
virtual void attach() override;
};
}
+62
View File
@@ -0,0 +1,62 @@
#include "io.h"
std::vector<Button> &games::hpm::get_buttons() {
static std::vector<Button> buttons;
if (buttons.empty()) {
buttons = GameAPI::Buttons::getButtons("HELLO! Pop'n Music");
GameAPI::Buttons::sortButtons(
&buttons,
"Service",
"Test",
"Coin Mech",
"P1 Start",
"P1 1",
"P1 2",
"P1 3",
"P1 4",
"P2 Start",
"P2 1",
"P2 2",
"P2 3",
"P2 4"
);
}
return buttons;
}
std::string games::hpm::get_buttons_help() {
// keep to max 100 characters wide
return
" start \n"
" red(1) blue(2) yellow(3) green(4) \n"
;
}
std::vector<Light> &games::hpm::get_lights() {
static std::vector<Light> lights;
if (lights.empty()) {
lights = GameAPI::Lights::getLights("HELLO! Pop'n Music");
GameAPI::Lights::sortLights(
&lights,
"Speaker Red",
"Speaker Orange",
"Speaker Blue",
"P1 Start",
"P1 Red & P2 Green",
"P1 Blue",
"P1 Yellow",
"P1 Green",
"P2 Start",
"P2 Red",
"P2 Blue",
"P2 Yellow"
);
}
return lights;
}
+49
View File
@@ -0,0 +1,49 @@
#pragma once
#include <vector>
#include "cfg/api.h"
namespace games::hpm {
// all buttons in correct order
namespace Buttons {
enum {
Service,
Test,
CoinMech,
P1_Start,
P1_1,
P1_2,
P1_3,
P1_4,
P2_Start,
P2_1,
P2_2,
P2_3,
P2_4,
};
}
// all lights in correct order
namespace Lights {
enum {
SPEAKER_RED,
SPEAKER_ORANGE,
SPEAKER_BLUE,
P1_START,
P1_RED_P2_GREEN,
P1_BLUE,
P1_YELLOW,
P1_GREEN,
P2_START,
P2_RED,
P2_BLUE,
P2_YELLOW,
};
}
// getters
std::vector<Button> &get_buttons();
std::string get_buttons_help();
std::vector<Light> &get_lights();
}