本文整理汇总了C++中ioport_list类的典型用法代码示例。如果您正苦于以下问题:C++ ioport_list类的具体用法?C++ ioport_list怎么用?C++ ioport_list使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ioport_list类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: output_switches
void info_xml_creator::output_switches(const ioport_list &portlist, const char *root_tag, int type, const char *outertag, const char *innertag)
{
// iterate looking for DIP switches
for (ioport_port *port = portlist.first(); port != NULL; port = port->next())
for (ioport_field *field = port->first_field(); field != NULL; field = field->next())
if (field->type() == type)
{
std::string output;
std::string newtag(port->tag()), oldtag(":");
newtag = newtag.substr(newtag.find(oldtag.append(root_tag).c_str()) + oldtag.length());
// output the switch name information
std::string normalized_field_name(xml_normalize_string(field->name()));
std::string normalized_newtag(xml_normalize_string(newtag.c_str()));
strcatprintf(output,"\t\t<%s name=\"%s\" tag=\"%s\" mask=\"%u\">\n", outertag, normalized_field_name.c_str(), normalized_newtag.c_str(), field->mask());
// loop over settings
for (ioport_setting *setting = field->first_setting(); setting != NULL; setting = setting->next())
{
strcatprintf(output,"\t\t\t<%s name=\"%s\" value=\"%u\"%s/>\n", innertag, xml_normalize_string(setting->name()), setting->value(), setting->value() == field->defvalue() ? " default=\"yes\"" : "");
}
// terminate the switch entry
strcatprintf(output,"\t\t</%s>\n", outertag);
fprintf(m_output, "%s", output.c_str());
}
}
开发者ID:BrandoCommando,项目名称:mame,代码行数:29,代码来源:info.c
示例2: output_categories
void info_xml_creator::output_categories(const ioport_list &portlist)
{
// iterate looking for Categories
for (input_port_config *port = portlist.first(); port != NULL; port = port->next())
for (input_field_config *field = port->fieldlist().first(); field != NULL; field = field->next())
if (field->type == IPT_CATEGORY)
{
// output the category name information
fprintf(m_output, "\t\t<category name=\"%s\">\n", xml_normalize_string(input_field_name(field)));
// loop over item settings
for (input_setting_config *setting = field->settinglist().first(); setting != NULL; setting = setting->next())
{
fprintf(m_output, "\t\t\t<item name=\"%s\"", xml_normalize_string(setting->name));
if (setting->value == field->defvalue)
fprintf(m_output, " default=\"yes\"");
fprintf(m_output, "/>\n");
}
// terminate the category entry
fprintf(m_output, "\t\t</category>\n");
}
}
开发者ID:rogerjowett,项目名称:ClientServerMAME,代码行数:23,代码来源:info.c
示例3: output_input
void info_xml_creator::output_input(const ioport_list &portlist)
{
// enumerated list of control types
enum
{
ANALOG_TYPE_JOYSTICK,
ANALOG_TYPE_DIAL,
ANALOG_TYPE_TRACKBALL,
ANALOG_TYPE_PADDLE,
ANALOG_TYPE_LIGHTGUN,
ANALOG_TYPE_PEDAL,
ANALOG_TYPE_COUNT
};
// directions
const UINT8 DIR_LEFTRIGHT = 0x01;
const UINT8 DIR_UPDOWN = 0x02;
const UINT8 DIR_4WAY = 0x04;
const UINT8 DIR_DUAL = 0x08;
// initialize the list of control types
struct
{
const char * type; /* general type of input */
bool analog;
bool keyb;
INT32 min; /* analog minimum value */
INT32 max; /* analog maximum value */
INT32 sensitivity; /* default analog sensitivity */
INT32 keydelta; /* default analog keydelta */
bool reverse; /* default analog reverse setting */
} control_info[ANALOG_TYPE_COUNT];
memset(&control_info, 0, sizeof(control_info));
// tracking info as we iterate
int nplayer = 0;
int nbutton = 0;
int ncoin = 0;
UINT8 joytype = 0;
bool service = false;
bool tilt = false;
bool keypad = false;
bool keyboard = false;
// iterate over the ports
for (input_port_config *port = portlist.first(); port != NULL; port = port->next())
for (input_field_config *field = port->fieldlist().first(); field != NULL; field = field->next())
{
int analogtype = -1;
// track the highest player number
if (nplayer < field->player + 1)
nplayer = field->player + 1;
// switch off of the type
switch (field->type)
{
// map which joystick directions are present
case IPT_JOYSTICKRIGHT_LEFT:
case IPT_JOYSTICKRIGHT_RIGHT:
case IPT_JOYSTICKLEFT_LEFT:
case IPT_JOYSTICKLEFT_RIGHT:
joytype |= DIR_DUAL;
// fall through...
case IPT_JOYSTICK_LEFT:
case IPT_JOYSTICK_RIGHT:
joytype |= DIR_LEFTRIGHT | ((field->way == 4) ? DIR_4WAY : 0);
break;
case IPT_JOYSTICKRIGHT_UP:
case IPT_JOYSTICKRIGHT_DOWN:
case IPT_JOYSTICKLEFT_UP:
case IPT_JOYSTICKLEFT_DOWN:
joytype |= DIR_DUAL;
// fall through...
case IPT_JOYSTICK_UP:
case IPT_JOYSTICK_DOWN:
joytype |= DIR_UPDOWN | ((field->way == 4) ? DIR_4WAY : 0);
break;
// mark as an analog input, and get analog stats after switch
case IPT_PADDLE:
control_info[analogtype = ANALOG_TYPE_PADDLE].type = "paddle";
break;
case IPT_DIAL:
control_info[analogtype = ANALOG_TYPE_DIAL].type = "dial";
analogtype = ANALOG_TYPE_DIAL;
break;
case IPT_TRACKBALL_X:
case IPT_TRACKBALL_Y:
control_info[analogtype = ANALOG_TYPE_TRACKBALL].type = "trackball";
analogtype = ANALOG_TYPE_TRACKBALL;
break;
case IPT_AD_STICK_X:
//.........这里部分代码省略.........
开发者ID:rogerjowett,项目名称:ClientServerMAME,代码行数:101,代码来源:info.c
注:本文中的ioport_list类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论