mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-03-06 14:27:44 +00:00
Defined inputs
This commit is contained in:
parent
fbeeb3c922
commit
a9816467d8
37
Src/Game.cpp
37
Src/Game.cpp
|
@ -64,6 +64,43 @@ static void PopulateGameInfo(Game *game, const Util::Config::Node &game_node)
|
|||
game->manufacturer = game_node["identity/manufacturer"].Value();
|
||||
game->year = game_node["identity/year"].ValueAsUnsigned();
|
||||
game->stepping = game_node["hardware/stepping"].Value();
|
||||
game->mpeg_board = game_node["hardware/mpeg_board"].Value();
|
||||
game->encryption_key = game_node["hardware/encryption_key"].ValueAsUnsigned();
|
||||
std::map<std::string, uint32_t> input_flags
|
||||
{
|
||||
{ "common", Game::INPUT_COMMON },
|
||||
{ "vehicle", Game::INPUT_VEHICLE },
|
||||
{ "joystick1", Game::INPUT_JOYSTICK1 },
|
||||
{ "joystick2", Game::INPUT_JOYSTICK2 },
|
||||
{ "fighting", Game::INPUT_FIGHTING },
|
||||
{ "vr4", Game::INPUT_VR4 },
|
||||
{ "viewchange", Game::INPUT_VIEWCHANGE },
|
||||
{ "shift4", Game::INPUT_SHIFT4 },
|
||||
{ "shiftupdown", Game::INPUT_SHIFTUPDOWN },
|
||||
{ "handbrake", Game::INPUT_HANDBRAKE },
|
||||
{ "harley", Game::INPUT_HARLEY },
|
||||
{ "gun1", Game::INPUT_GUN1 },
|
||||
{ "gun2", Game::INPUT_GUN2 },
|
||||
{ "analog_joystick", Game::INPUT_ANALOG_JOYSTICK },
|
||||
{ "twin_joysticks", Game::INPUT_TWIN_JOYSTICKS },
|
||||
{ "soccer", Game::INPUT_SOCCER },
|
||||
{ "spikeout", Game::INPUT_SPIKEOUT },
|
||||
{ "analog_gun1", Game::INPUT_ANALOG_GUN1 },
|
||||
{ "analog_gun2", Game::INPUT_ANALOG_GUN2 },
|
||||
{ "ski", Game::INPUT_SKI },
|
||||
{ "magtruck", Game::INPUT_MAGTRUCK },
|
||||
{ "fishing", Game::INPUT_FISHING }
|
||||
};
|
||||
for (auto &node: game_node["hardware/inputs"])
|
||||
//for (auto it = game_node["hardware/inputs"].begin(); it != game_node["hardware/inputs"].end(); ++it)
|
||||
{
|
||||
//auto &node = *it;
|
||||
if (node.Key() == "input" && node["type"].Exists())
|
||||
{
|
||||
const std::string input_type = node["type"].Value();
|
||||
game->inputs |= input_flags[input_type];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool GameLoader::ParseXML(const Util::Config::Node::ConstPtr_t &xml)
|
||||
|
|
37
Src/Game.h
37
Src/Game.h
|
@ -6,14 +6,45 @@
|
|||
#include <map>
|
||||
#include <set>
|
||||
|
||||
//TODO: separate Game and ROM structs
|
||||
struct Game
|
||||
{
|
||||
std::string name;
|
||||
std::string title;
|
||||
std::string version;
|
||||
std::string manufacturer;
|
||||
int year;
|
||||
int year = 0;
|
||||
std::string stepping;
|
||||
std::string mpeg_board;
|
||||
uint32_t encryption_key = 0;
|
||||
enum Inputs
|
||||
{
|
||||
INPUT_UI = 0, // special code reserved for Supermodel UI inputs
|
||||
INPUT_COMMON = 0x00000001, // common controls (coins, service, test)
|
||||
INPUT_VEHICLE = 0x00000002, // vehicle controls
|
||||
INPUT_JOYSTICK1 = 0x00000004, // joystick 1
|
||||
INPUT_JOYSTICK2 = 0x00000008, // joystick 2
|
||||
INPUT_FIGHTING = 0x00000010, // fighting game controls
|
||||
INPUT_VR4 = 0x00000020, // four VR view buttons
|
||||
INPUT_VIEWCHANGE = 0x00000040, // single view change button
|
||||
INPUT_SHIFT4 = 0x00000080, // 4-speed shifter
|
||||
INPUT_SHIFTUPDOWN = 0x00000100, // up/down shifter
|
||||
INPUT_HANDBRAKE = 0x00000200, // handbrake
|
||||
INPUT_HARLEY = 0x00000400, // Harley Davidson controls
|
||||
INPUT_GUN1 = 0x00000800, // light gun 1
|
||||
INPUT_GUN2 = 0x00001000, // light gun 2
|
||||
INPUT_ANALOG_JOYSTICK = 0x00002000, // analog joystick
|
||||
INPUT_TWIN_JOYSTICKS = 0x00004000, // twin joysticks
|
||||
INPUT_SOCCER = 0x00008000, // soccer controls
|
||||
INPUT_SPIKEOUT = 0x00010000, // Spikeout buttons
|
||||
INPUT_ANALOG_GUN1 = 0x00020000, // analog gun 1
|
||||
INPUT_ANALOG_GUN2 = 0x00040000, // analog gun 2
|
||||
INPUT_SKI = 0x00080000, // ski controls
|
||||
INPUT_MAGTRUCK = 0x00100000, // magical truck controls
|
||||
INPUT_FISHING = 0x00200000, // fishing controls
|
||||
INPUT_ALL = 0x003FFFFF
|
||||
};
|
||||
uint32_t inputs = 0;
|
||||
// Holds a ROM region
|
||||
struct ROM
|
||||
{
|
||||
|
@ -59,9 +90,13 @@ private:
|
|||
};
|
||||
|
||||
std::map<std::string, Game> m_game_info_by_game; // ROMs not loaded here
|
||||
|
||||
// Parsed XML
|
||||
typedef std::map<std::string, Region::Ptr_t> RegionsByName_t;
|
||||
std::map<std::string, RegionsByName_t> m_regions_by_game;
|
||||
std::string m_xml_filename;
|
||||
|
||||
// Zip file info
|
||||
std::string m_zipfilename;
|
||||
unzFile m_zf;
|
||||
std::map<uint32_t, std::string> m_filename_by_crc32;
|
||||
|
|
Loading…
Reference in a new issue