hexsha
stringlengths 40
40
| repo
stringlengths 5
105
| path
stringlengths 3
173
| license
sequence | language
stringclasses 1
value | identifier
stringlengths 1
438
| return_type
stringlengths 1
106
⌀ | original_string
stringlengths 21
40.7k
| original_docstring
stringlengths 18
13.4k
| docstring
stringlengths 11
3.24k
| docstring_tokens
sequence | code
stringlengths 14
20.4k
| code_tokens
sequence | short_docstring
stringlengths 0
4.36k
| short_docstring_tokens
sequence | comment
sequence | parameters
list | docstring_params
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5aee04886236aa3ca5a5911c8ee530c9953fec26 | lofunz/mieme | Reloaded/trunk/src/emu/info.c | [
"Unlicense"
] | C | print_game_sample | void | static void print_game_sample(FILE *out, const game_driver *game, const machine_config *config)
{
const device_config_sound_interface *sound = NULL;
/* iterate over sound chips looking for samples */
for (bool gotone = config->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
if (sound->devconfig().type() == SOUND_SAMPLES)
{
const char *const *samplenames = ((const samples_interface *)sound->devconfig().static_config())->samplenames;
if (samplenames != NULL)
{
int sampnum;
/* iterate over sample names */
for (sampnum = 0; samplenames[sampnum] != NULL; sampnum++)
{
const char *cursampname = samplenames[sampnum];
int dupnum;
/* ignore the special '*' samplename */
if (sampnum == 0 && cursampname[0] == '*')
continue;
/* filter out duplicates */
for (dupnum = 0; dupnum < sampnum; dupnum++)
if (strcmp(samplenames[dupnum], cursampname) == 0)
break;
if (dupnum < sampnum)
continue;
/* output the sample name */
fprintf(out, "\t\t<sample name=\"%s\"/>\n", xml_normalize_string(cursampname));
}
}
}
} | /*-------------------------------------------------
print_game_sample - print a list of all
samples referenced by a game_driver
-------------------------------------------------*/ | print a list of all
samples referenced by a game_driver | [
"print",
"a",
"list",
"of",
"all",
"samples",
"referenced",
"by",
"a",
"game_driver"
] | static void print_game_sample(FILE *out, const game_driver *game, const machine_config *config)
{
const device_config_sound_interface *sound = NULL;
for (bool gotone = config->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
if (sound->devconfig().type() == SOUND_SAMPLES)
{
const char *const *samplenames = ((const samples_interface *)sound->devconfig().static_config())->samplenames;
if (samplenames != NULL)
{
int sampnum;
for (sampnum = 0; samplenames[sampnum] != NULL; sampnum++)
{
const char *cursampname = samplenames[sampnum];
int dupnum;
if (sampnum == 0 && cursampname[0] == '*')
continue;
for (dupnum = 0; dupnum < sampnum; dupnum++)
if (strcmp(samplenames[dupnum], cursampname) == 0)
break;
if (dupnum < sampnum)
continue;
fprintf(out, "\t\t<sample name=\"%s\"/>\n", xml_normalize_string(cursampname));
}
}
}
} | [
"static",
"void",
"print_game_sample",
"(",
"FILE",
"*",
"out",
",",
"const",
"game_driver",
"*",
"game",
",",
"const",
"machine_config",
"*",
"config",
")",
"{",
"const",
"device_config_sound_interface",
"*",
"sound",
"=",
"NULL",
";",
"for",
"(",
"bool",
"gotone",
"=",
"config",
"->",
"m_devicelist",
".",
"first",
"(",
"sound",
")",
";",
"gotone",
";",
"gotone",
"=",
"sound",
"->",
"next",
"(",
"sound",
")",
")",
"if",
"(",
"sound",
"->",
"devconfig",
"(",
")",
".",
"type",
"(",
")",
"==",
"SOUND_SAMPLES",
")",
"{",
"const",
"char",
"*",
"const",
"*",
"samplenames",
"=",
"(",
"(",
"const",
"samples_interface",
"*",
")",
"sound",
"->",
"devconfig",
"(",
")",
".",
"static_config",
"(",
")",
")",
"->",
"samplenames",
";",
"if",
"(",
"samplenames",
"!=",
"NULL",
")",
"{",
"int",
"sampnum",
";",
"for",
"(",
"sampnum",
"=",
"0",
";",
"samplenames",
"[",
"sampnum",
"]",
"!=",
"NULL",
";",
"sampnum",
"++",
")",
"{",
"const",
"char",
"*",
"cursampname",
"=",
"samplenames",
"[",
"sampnum",
"]",
";",
"int",
"dupnum",
";",
"if",
"(",
"sampnum",
"==",
"0",
"&&",
"cursampname",
"[",
"0",
"]",
"==",
"'",
"'",
")",
"continue",
";",
"for",
"(",
"dupnum",
"=",
"0",
";",
"dupnum",
"<",
"sampnum",
";",
"dupnum",
"++",
")",
"if",
"(",
"strcmp",
"(",
"samplenames",
"[",
"dupnum",
"]",
",",
"cursampname",
")",
"==",
"0",
")",
"break",
";",
"if",
"(",
"dupnum",
"<",
"sampnum",
")",
"continue",
";",
"fprintf",
"(",
"out",
",",
"\"",
"\\t",
"\\t",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"xml_normalize_string",
"(",
"cursampname",
")",
")",
";",
"}",
"}",
"}",
"}"
] | print_game_sample - print a list of all
samples referenced by a game_driver | [
"print_game_sample",
"-",
"print",
"a",
"list",
"of",
"all",
"samples",
"referenced",
"by",
"a",
"game_driver"
] | [
"/* iterate over sound chips looking for samples */",
"/* iterate over sample names */",
"/* ignore the special '*' samplename */",
"/* filter out duplicates */",
"/* output the sample name */"
] | [
{
"param": "out",
"type": "FILE"
},
{
"param": "game",
"type": "game_driver"
},
{
"param": "config",
"type": "machine_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "out",
"type": "FILE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "game",
"type": "game_driver",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config",
"type": "machine_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5aee04886236aa3ca5a5911c8ee530c9953fec26 | lofunz/mieme | Reloaded/trunk/src/emu/info.c | [
"Unlicense"
] | C | print_game_chips | void | static void print_game_chips(FILE *out, const game_driver *game, const machine_config *config)
{
/* iterate over CPUs */
const device_config_execute_interface *exec = NULL;
for (bool gotone = config->m_devicelist.first(exec); gotone; gotone = exec->next(exec))
{
fprintf(out, "\t\t<chip");
fprintf(out, " type=\"cpu\"");
fprintf(out, " tag=\"%s\"", xml_normalize_string(exec->devconfig().tag()));
fprintf(out, " name=\"%s\"", xml_normalize_string(exec->devconfig().name()));
fprintf(out, " clock=\"%d\"", exec->devconfig().clock());
fprintf(out, "/>\n");
}
/* iterate over sound chips */
const device_config_sound_interface *sound = NULL;
for (bool gotone = config->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
{
fprintf(out, "\t\t<chip");
fprintf(out, " type=\"audio\"");
fprintf(out, " tag=\"%s\"", xml_normalize_string(sound->devconfig().tag()));
fprintf(out, " name=\"%s\"", xml_normalize_string(sound->devconfig().name()));
if (sound->devconfig().clock() != 0)
fprintf(out, " clock=\"%d\"", sound->devconfig().clock());
fprintf(out, "/>\n");
}
} | /*-------------------------------------------------
print_game_chips - print a list of CPU and
sound chips used by a game
-------------------------------------------------*/ | print a list of CPU and
sound chips used by a game | [
"print",
"a",
"list",
"of",
"CPU",
"and",
"sound",
"chips",
"used",
"by",
"a",
"game"
] | static void print_game_chips(FILE *out, const game_driver *game, const machine_config *config)
{
const device_config_execute_interface *exec = NULL;
for (bool gotone = config->m_devicelist.first(exec); gotone; gotone = exec->next(exec))
{
fprintf(out, "\t\t<chip");
fprintf(out, " type=\"cpu\"");
fprintf(out, " tag=\"%s\"", xml_normalize_string(exec->devconfig().tag()));
fprintf(out, " name=\"%s\"", xml_normalize_string(exec->devconfig().name()));
fprintf(out, " clock=\"%d\"", exec->devconfig().clock());
fprintf(out, "/>\n");
}
const device_config_sound_interface *sound = NULL;
for (bool gotone = config->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
{
fprintf(out, "\t\t<chip");
fprintf(out, " type=\"audio\"");
fprintf(out, " tag=\"%s\"", xml_normalize_string(sound->devconfig().tag()));
fprintf(out, " name=\"%s\"", xml_normalize_string(sound->devconfig().name()));
if (sound->devconfig().clock() != 0)
fprintf(out, " clock=\"%d\"", sound->devconfig().clock());
fprintf(out, "/>\n");
}
} | [
"static",
"void",
"print_game_chips",
"(",
"FILE",
"*",
"out",
",",
"const",
"game_driver",
"*",
"game",
",",
"const",
"machine_config",
"*",
"config",
")",
"{",
"const",
"device_config_execute_interface",
"*",
"exec",
"=",
"NULL",
";",
"for",
"(",
"bool",
"gotone",
"=",
"config",
"->",
"m_devicelist",
".",
"first",
"(",
"exec",
")",
";",
"gotone",
";",
"gotone",
"=",
"exec",
"->",
"next",
"(",
"exec",
")",
")",
"{",
"fprintf",
"(",
"out",
",",
"\"",
"\\t",
"\\t",
"\"",
")",
";",
"fprintf",
"(",
"out",
",",
"\"",
"\\\"",
"\\\"",
"\"",
")",
";",
"fprintf",
"(",
"out",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"xml_normalize_string",
"(",
"exec",
"->",
"devconfig",
"(",
")",
".",
"tag",
"(",
")",
")",
")",
";",
"fprintf",
"(",
"out",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"xml_normalize_string",
"(",
"exec",
"->",
"devconfig",
"(",
")",
".",
"name",
"(",
")",
")",
")",
";",
"fprintf",
"(",
"out",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"exec",
"->",
"devconfig",
"(",
")",
".",
"clock",
"(",
")",
")",
";",
"fprintf",
"(",
"out",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"const",
"device_config_sound_interface",
"*",
"sound",
"=",
"NULL",
";",
"for",
"(",
"bool",
"gotone",
"=",
"config",
"->",
"m_devicelist",
".",
"first",
"(",
"sound",
")",
";",
"gotone",
";",
"gotone",
"=",
"sound",
"->",
"next",
"(",
"sound",
")",
")",
"{",
"fprintf",
"(",
"out",
",",
"\"",
"\\t",
"\\t",
"\"",
")",
";",
"fprintf",
"(",
"out",
",",
"\"",
"\\\"",
"\\\"",
"\"",
")",
";",
"fprintf",
"(",
"out",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"xml_normalize_string",
"(",
"sound",
"->",
"devconfig",
"(",
")",
".",
"tag",
"(",
")",
")",
")",
";",
"fprintf",
"(",
"out",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"xml_normalize_string",
"(",
"sound",
"->",
"devconfig",
"(",
")",
".",
"name",
"(",
")",
")",
")",
";",
"if",
"(",
"sound",
"->",
"devconfig",
"(",
")",
".",
"clock",
"(",
")",
"!=",
"0",
")",
"fprintf",
"(",
"out",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"sound",
"->",
"devconfig",
"(",
")",
".",
"clock",
"(",
")",
")",
";",
"fprintf",
"(",
"out",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"}"
] | print_game_chips - print a list of CPU and
sound chips used by a game | [
"print_game_chips",
"-",
"print",
"a",
"list",
"of",
"CPU",
"and",
"sound",
"chips",
"used",
"by",
"a",
"game"
] | [
"/* iterate over CPUs */",
"/* iterate over sound chips */"
] | [
{
"param": "out",
"type": "FILE"
},
{
"param": "game",
"type": "game_driver"
},
{
"param": "config",
"type": "machine_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "out",
"type": "FILE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "game",
"type": "game_driver",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config",
"type": "machine_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5aee04886236aa3ca5a5911c8ee530c9953fec26 | lofunz/mieme | Reloaded/trunk/src/emu/info.c | [
"Unlicense"
] | C | print_game_sound | void | static void print_game_sound(FILE *out, const game_driver *game, const machine_config *config)
{
int speakers = speaker_output_count(config);
/* if we have no sound, zero out the speaker count */
const device_config_sound_interface *sound = NULL;
if (!config->m_devicelist.first(sound))
speakers = 0;
fprintf(out, "\t\t<sound channels=\"%d\"/>\n", speakers);
} | /*-------------------------------------------------
print_game_sound - print a list of all the
displays
-------------------------------------------------*/ | print a list of all the
displays | [
"print",
"a",
"list",
"of",
"all",
"the",
"displays"
] | static void print_game_sound(FILE *out, const game_driver *game, const machine_config *config)
{
int speakers = speaker_output_count(config);
const device_config_sound_interface *sound = NULL;
if (!config->m_devicelist.first(sound))
speakers = 0;
fprintf(out, "\t\t<sound channels=\"%d\"/>\n", speakers);
} | [
"static",
"void",
"print_game_sound",
"(",
"FILE",
"*",
"out",
",",
"const",
"game_driver",
"*",
"game",
",",
"const",
"machine_config",
"*",
"config",
")",
"{",
"int",
"speakers",
"=",
"speaker_output_count",
"(",
"config",
")",
";",
"const",
"device_config_sound_interface",
"*",
"sound",
"=",
"NULL",
";",
"if",
"(",
"!",
"config",
"->",
"m_devicelist",
".",
"first",
"(",
"sound",
")",
")",
"speakers",
"=",
"0",
";",
"fprintf",
"(",
"out",
",",
"\"",
"\\t",
"\\t",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"speakers",
")",
";",
"}"
] | print_game_sound - print a list of all the
displays | [
"print_game_sound",
"-",
"print",
"a",
"list",
"of",
"all",
"the",
"displays"
] | [
"/* if we have no sound, zero out the speaker count */"
] | [
{
"param": "out",
"type": "FILE"
},
{
"param": "game",
"type": "game_driver"
},
{
"param": "config",
"type": "machine_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "out",
"type": "FILE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "game",
"type": "game_driver",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config",
"type": "machine_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_list_add | device_config | device_config *device_list_add(device_config **listheadptr, const device_config *owner, device_type type, const char *tag, UINT32 clock)
{
device_config **devptr, **tempdevptr;
device_config *device, *tempdevice;
UINT32 configlen;
assert(listheadptr != NULL);
assert(type != NULL);
assert(tag != NULL);
/* find the end of the list, and ensure no duplicates along the way */
for (devptr = listheadptr; *devptr != NULL; devptr = &(*devptr)->next)
if (strcmp(tag, (*devptr)->tag) == 0)
fatalerror("Attempted to add duplicate device: type=%s tag=%s\n", device_get_name(*devptr), tag);
/* get the size of the inline config */
configlen = (UINT32)devtype_get_info_int(type, DEVINFO_INT_INLINE_CONFIG_BYTES);
/* allocate a new device */
device = (device_config *)alloc_array_or_die(UINT8, sizeof(*device) + strlen(tag));
/* populate device relationships */
device->next = NULL;
device->owner = (device_config *)owner;
device->typenext = NULL;
device->classnext = NULL;
/* populate device properties */
device->type = type;
device->devclass = (device_class)(INT32)devtype_get_info_int(type, DEVINFO_INT_CLASS);
/* populate device configuration */
device->clock = clock;
memset((void *)device->address_map, 0, sizeof(device->address_map));
if ((device->clock & 0xff000000) == 0xff000000)
{
assert(device->owner != NULL);
device->clock = device->owner->clock * ((device->clock >> 12) & 0xfff) / ((device->clock >> 0) & 0xfff);
}
device->static_config = NULL;
/* this can hold floating point values, so make sure it's aligned properly */
device->inline_config = (configlen == 0) ? NULL : alloc_array_or_die(UINT8, configlen);
/* ensure live fields are all cleared */
device->machine = NULL;
device->started = DEVICE_STOPPED;
device->token = NULL;
device->tokenbytes = 0;
device->region = NULL;
device->regionbytes = 0;
memset((void *)device->space, 0, sizeof(device->space));
device->execute = NULL;
/* append the tag */
strcpy(device->tag, tag);
/* reset the inline_config to 0 */
if (configlen > 0)
memset(device->inline_config, 0, configlen);
/* fetch function pointers to the core functions */
/* before adding us to the global list, add us to the end of the type list */
tempdevice = (device_config *)device_list_first(*listheadptr, type);
for (tempdevptr = &tempdevice; *tempdevptr != NULL; tempdevptr = &(*tempdevptr)->typenext) ;
*tempdevptr = device;
/* and to the end of the class list */
tempdevice = (device_config *)device_list_class_first(*listheadptr, device->devclass);
for (tempdevptr = &tempdevice; *tempdevptr != NULL; tempdevptr = &(*tempdevptr)->classnext) ;
*tempdevptr = device;
/* link us to the end of the master list and return */
*devptr = device;
return device;
} | /*-------------------------------------------------
device_list_add - add a new device to the
end of a device list
-------------------------------------------------*/ | add a new device to the
end of a device list | [
"add",
"a",
"new",
"device",
"to",
"the",
"end",
"of",
"a",
"device",
"list"
] | device_config *device_list_add(device_config **listheadptr, const device_config *owner, device_type type, const char *tag, UINT32 clock)
{
device_config **devptr, **tempdevptr;
device_config *device, *tempdevice;
UINT32 configlen;
assert(listheadptr != NULL);
assert(type != NULL);
assert(tag != NULL);
for (devptr = listheadptr; *devptr != NULL; devptr = &(*devptr)->next)
if (strcmp(tag, (*devptr)->tag) == 0)
fatalerror("Attempted to add duplicate device: type=%s tag=%s\n", device_get_name(*devptr), tag);
configlen = (UINT32)devtype_get_info_int(type, DEVINFO_INT_INLINE_CONFIG_BYTES);
device = (device_config *)alloc_array_or_die(UINT8, sizeof(*device) + strlen(tag));
device->next = NULL;
device->owner = (device_config *)owner;
device->typenext = NULL;
device->classnext = NULL;
device->type = type;
device->devclass = (device_class)(INT32)devtype_get_info_int(type, DEVINFO_INT_CLASS);
device->clock = clock;
memset((void *)device->address_map, 0, sizeof(device->address_map));
if ((device->clock & 0xff000000) == 0xff000000)
{
assert(device->owner != NULL);
device->clock = device->owner->clock * ((device->clock >> 12) & 0xfff) / ((device->clock >> 0) & 0xfff);
}
device->static_config = NULL;
device->inline_config = (configlen == 0) ? NULL : alloc_array_or_die(UINT8, configlen);
device->machine = NULL;
device->started = DEVICE_STOPPED;
device->token = NULL;
device->tokenbytes = 0;
device->region = NULL;
device->regionbytes = 0;
memset((void *)device->space, 0, sizeof(device->space));
device->execute = NULL;
strcpy(device->tag, tag);
if (configlen > 0)
memset(device->inline_config, 0, configlen);
tempdevice = (device_config *)device_list_first(*listheadptr, type);
for (tempdevptr = &tempdevice; *tempdevptr != NULL; tempdevptr = &(*tempdevptr)->typenext) ;
*tempdevptr = device;
tempdevice = (device_config *)device_list_class_first(*listheadptr, device->devclass);
for (tempdevptr = &tempdevice; *tempdevptr != NULL; tempdevptr = &(*tempdevptr)->classnext) ;
*tempdevptr = device;
*devptr = device;
return device;
} | [
"device_config",
"*",
"device_list_add",
"(",
"device_config",
"*",
"*",
"listheadptr",
",",
"const",
"device_config",
"*",
"owner",
",",
"device_type",
"type",
",",
"const",
"char",
"*",
"tag",
",",
"UINT32",
"clock",
")",
"{",
"device_config",
"*",
"*",
"devptr",
",",
"*",
"*",
"tempdevptr",
";",
"device_config",
"*",
"device",
",",
"*",
"tempdevice",
";",
"UINT32",
"configlen",
";",
"assert",
"(",
"listheadptr",
"!=",
"NULL",
")",
";",
"assert",
"(",
"type",
"!=",
"NULL",
")",
";",
"assert",
"(",
"tag",
"!=",
"NULL",
")",
";",
"for",
"(",
"devptr",
"=",
"listheadptr",
";",
"*",
"devptr",
"!=",
"NULL",
";",
"devptr",
"=",
"&",
"(",
"*",
"devptr",
")",
"->",
"next",
")",
"if",
"(",
"strcmp",
"(",
"tag",
",",
"(",
"*",
"devptr",
")",
"->",
"tag",
")",
"==",
"0",
")",
"fatalerror",
"(",
"\"",
"\\n",
"\"",
",",
"device_get_name",
"(",
"*",
"devptr",
")",
",",
"tag",
")",
";",
"configlen",
"=",
"(",
"UINT32",
")",
"devtype_get_info_int",
"(",
"type",
",",
"DEVINFO_INT_INLINE_CONFIG_BYTES",
")",
";",
"device",
"=",
"(",
"device_config",
"*",
")",
"alloc_array_or_die",
"(",
"UINT8",
",",
"sizeof",
"(",
"*",
"device",
")",
"+",
"strlen",
"(",
"tag",
")",
")",
";",
"device",
"->",
"next",
"=",
"NULL",
";",
"device",
"->",
"owner",
"=",
"(",
"device_config",
"*",
")",
"owner",
";",
"device",
"->",
"typenext",
"=",
"NULL",
";",
"device",
"->",
"classnext",
"=",
"NULL",
";",
"device",
"->",
"type",
"=",
"type",
";",
"device",
"->",
"devclass",
"=",
"(",
"device_class",
")",
"(",
"INT32",
")",
"devtype_get_info_int",
"(",
"type",
",",
"DEVINFO_INT_CLASS",
")",
";",
"device",
"->",
"clock",
"=",
"clock",
";",
"memset",
"(",
"(",
"void",
"*",
")",
"device",
"->",
"address_map",
",",
"0",
",",
"sizeof",
"(",
"device",
"->",
"address_map",
")",
")",
";",
"if",
"(",
"(",
"device",
"->",
"clock",
"&",
"0xff000000",
")",
"==",
"0xff000000",
")",
"{",
"assert",
"(",
"device",
"->",
"owner",
"!=",
"NULL",
")",
";",
"device",
"->",
"clock",
"=",
"device",
"->",
"owner",
"->",
"clock",
"*",
"(",
"(",
"device",
"->",
"clock",
">>",
"12",
")",
"&",
"0xfff",
")",
"/",
"(",
"(",
"device",
"->",
"clock",
">>",
"0",
")",
"&",
"0xfff",
")",
";",
"}",
"device",
"->",
"static_config",
"=",
"NULL",
";",
"device",
"->",
"inline_config",
"=",
"(",
"configlen",
"==",
"0",
")",
"?",
"NULL",
":",
"alloc_array_or_die",
"(",
"UINT8",
",",
"configlen",
")",
";",
"device",
"->",
"machine",
"=",
"NULL",
";",
"device",
"->",
"started",
"=",
"DEVICE_STOPPED",
";",
"device",
"->",
"token",
"=",
"NULL",
";",
"device",
"->",
"tokenbytes",
"=",
"0",
";",
"device",
"->",
"region",
"=",
"NULL",
";",
"device",
"->",
"regionbytes",
"=",
"0",
";",
"memset",
"(",
"(",
"void",
"*",
")",
"device",
"->",
"space",
",",
"0",
",",
"sizeof",
"(",
"device",
"->",
"space",
")",
")",
";",
"device",
"->",
"execute",
"=",
"NULL",
";",
"strcpy",
"(",
"device",
"->",
"tag",
",",
"tag",
")",
";",
"if",
"(",
"configlen",
">",
"0",
")",
"memset",
"(",
"device",
"->",
"inline_config",
",",
"0",
",",
"configlen",
")",
";",
"tempdevice",
"=",
"(",
"device_config",
"*",
")",
"device_list_first",
"(",
"*",
"listheadptr",
",",
"type",
")",
";",
"for",
"(",
"tempdevptr",
"=",
"&",
"tempdevice",
";",
"*",
"tempdevptr",
"!=",
"NULL",
";",
"tempdevptr",
"=",
"&",
"(",
"*",
"tempdevptr",
")",
"->",
"typenext",
")",
";",
"*",
"tempdevptr",
"=",
"device",
";",
"tempdevice",
"=",
"(",
"device_config",
"*",
")",
"device_list_class_first",
"(",
"*",
"listheadptr",
",",
"device",
"->",
"devclass",
")",
";",
"for",
"(",
"tempdevptr",
"=",
"&",
"tempdevice",
";",
"*",
"tempdevptr",
"!=",
"NULL",
";",
"tempdevptr",
"=",
"&",
"(",
"*",
"tempdevptr",
")",
"->",
"classnext",
")",
";",
"*",
"tempdevptr",
"=",
"device",
";",
"*",
"devptr",
"=",
"device",
";",
"return",
"device",
";",
"}"
] | device_list_add - add a new device to the
end of a device list | [
"device_list_add",
"-",
"add",
"a",
"new",
"device",
"to",
"the",
"end",
"of",
"a",
"device",
"list"
] | [
"/* find the end of the list, and ensure no duplicates along the way */",
"/* get the size of the inline config */",
"/* allocate a new device */",
"/* populate device relationships */",
"/* populate device properties */",
"/* populate device configuration */",
"/* this can hold floating point values, so make sure it's aligned properly */",
"/* ensure live fields are all cleared */",
"/* append the tag */",
"/* reset the inline_config to 0 */",
"/* fetch function pointers to the core functions */",
"/* before adding us to the global list, add us to the end of the type list */",
"/* and to the end of the class list */",
"/* link us to the end of the master list and return */"
] | [
{
"param": "listheadptr",
"type": "device_config"
},
{
"param": "owner",
"type": "device_config"
},
{
"param": "type",
"type": "device_type"
},
{
"param": "tag",
"type": "char"
},
{
"param": "clock",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "listheadptr",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "owner",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "device_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "clock",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_list_remove | void | void device_list_remove(device_config **listheadptr, const char *tag)
{
device_config **devptr, **tempdevptr;
device_config *device, *tempdevice;
assert(listheadptr != NULL);
assert(tag != NULL);
/* find the device in the list */
for (devptr = listheadptr; *devptr != NULL; devptr = &(*devptr)->next)
if (strcmp(tag, (*devptr)->tag) == 0)
break;
device = *devptr;
if (device == NULL)
fatalerror("Attempted to remove non-existant device: tag=%s\n", tag);
/* before removing us from the global list, remove us from the type list */
tempdevice = (device_config *)device_list_first(*listheadptr, device->type);
for (tempdevptr = &tempdevice; *tempdevptr != device; tempdevptr = &(*tempdevptr)->typenext) ;
assert(*tempdevptr == device);
*tempdevptr = device->typenext;
/* and from the class list */
tempdevice = (device_config *)device_list_class_first(*listheadptr, device->devclass);
for (tempdevptr = &tempdevice; *tempdevptr != device; tempdevptr = &(*tempdevptr)->classnext) ;
assert(*tempdevptr == device);
*tempdevptr = device->classnext;
/* remove the device from the list */
*devptr = device->next;
/* free the device object */
free(device);
} | /*-------------------------------------------------
device_list_remove - remove a device from a
device list
-------------------------------------------------*/ | remove a device from a
device list | [
"remove",
"a",
"device",
"from",
"a",
"device",
"list"
] | void device_list_remove(device_config **listheadptr, const char *tag)
{
device_config **devptr, **tempdevptr;
device_config *device, *tempdevice;
assert(listheadptr != NULL);
assert(tag != NULL);
for (devptr = listheadptr; *devptr != NULL; devptr = &(*devptr)->next)
if (strcmp(tag, (*devptr)->tag) == 0)
break;
device = *devptr;
if (device == NULL)
fatalerror("Attempted to remove non-existant device: tag=%s\n", tag);
tempdevice = (device_config *)device_list_first(*listheadptr, device->type);
for (tempdevptr = &tempdevice; *tempdevptr != device; tempdevptr = &(*tempdevptr)->typenext) ;
assert(*tempdevptr == device);
*tempdevptr = device->typenext;
tempdevice = (device_config *)device_list_class_first(*listheadptr, device->devclass);
for (tempdevptr = &tempdevice; *tempdevptr != device; tempdevptr = &(*tempdevptr)->classnext) ;
assert(*tempdevptr == device);
*tempdevptr = device->classnext;
*devptr = device->next;
free(device);
} | [
"void",
"device_list_remove",
"(",
"device_config",
"*",
"*",
"listheadptr",
",",
"const",
"char",
"*",
"tag",
")",
"{",
"device_config",
"*",
"*",
"devptr",
",",
"*",
"*",
"tempdevptr",
";",
"device_config",
"*",
"device",
",",
"*",
"tempdevice",
";",
"assert",
"(",
"listheadptr",
"!=",
"NULL",
")",
";",
"assert",
"(",
"tag",
"!=",
"NULL",
")",
";",
"for",
"(",
"devptr",
"=",
"listheadptr",
";",
"*",
"devptr",
"!=",
"NULL",
";",
"devptr",
"=",
"&",
"(",
"*",
"devptr",
")",
"->",
"next",
")",
"if",
"(",
"strcmp",
"(",
"tag",
",",
"(",
"*",
"devptr",
")",
"->",
"tag",
")",
"==",
"0",
")",
"break",
";",
"device",
"=",
"*",
"devptr",
";",
"if",
"(",
"device",
"==",
"NULL",
")",
"fatalerror",
"(",
"\"",
"\\n",
"\"",
",",
"tag",
")",
";",
"tempdevice",
"=",
"(",
"device_config",
"*",
")",
"device_list_first",
"(",
"*",
"listheadptr",
",",
"device",
"->",
"type",
")",
";",
"for",
"(",
"tempdevptr",
"=",
"&",
"tempdevice",
";",
"*",
"tempdevptr",
"!=",
"device",
";",
"tempdevptr",
"=",
"&",
"(",
"*",
"tempdevptr",
")",
"->",
"typenext",
")",
";",
"assert",
"(",
"*",
"tempdevptr",
"==",
"device",
")",
";",
"*",
"tempdevptr",
"=",
"device",
"->",
"typenext",
";",
"tempdevice",
"=",
"(",
"device_config",
"*",
")",
"device_list_class_first",
"(",
"*",
"listheadptr",
",",
"device",
"->",
"devclass",
")",
";",
"for",
"(",
"tempdevptr",
"=",
"&",
"tempdevice",
";",
"*",
"tempdevptr",
"!=",
"device",
";",
"tempdevptr",
"=",
"&",
"(",
"*",
"tempdevptr",
")",
"->",
"classnext",
")",
";",
"assert",
"(",
"*",
"tempdevptr",
"==",
"device",
")",
";",
"*",
"tempdevptr",
"=",
"device",
"->",
"classnext",
";",
"*",
"devptr",
"=",
"device",
"->",
"next",
";",
"free",
"(",
"device",
")",
";",
"}"
] | device_list_remove - remove a device from a
device list | [
"device_list_remove",
"-",
"remove",
"a",
"device",
"from",
"a",
"device",
"list"
] | [
"/* find the device in the list */",
"/* before removing us from the global list, remove us from the type list */",
"/* and from the class list */",
"/* remove the device from the list */",
"/* free the device object */"
] | [
{
"param": "listheadptr",
"type": "device_config"
},
{
"param": "tag",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "listheadptr",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_build_tag | char | const char *device_build_tag(astring *dest, const device_config *device, const char *tag)
{
if (device != NULL)
{
astring_cpyc(dest, device->tag);
astring_catc(dest, ":");
astring_catc(dest, tag);
}
else
astring_cpyc(dest, tag);
return astring_c(dest);
} | /*-------------------------------------------------
device_build_tag - build a tag that combines
the device's name and the given tag
-------------------------------------------------*/ | build a tag that combines
the device's name and the given tag | [
"build",
"a",
"tag",
"that",
"combines",
"the",
"device",
"'",
"s",
"name",
"and",
"the",
"given",
"tag"
] | const char *device_build_tag(astring *dest, const device_config *device, const char *tag)
{
if (device != NULL)
{
astring_cpyc(dest, device->tag);
astring_catc(dest, ":");
astring_catc(dest, tag);
}
else
astring_cpyc(dest, tag);
return astring_c(dest);
} | [
"const",
"char",
"*",
"device_build_tag",
"(",
"astring",
"*",
"dest",
",",
"const",
"device_config",
"*",
"device",
",",
"const",
"char",
"*",
"tag",
")",
"{",
"if",
"(",
"device",
"!=",
"NULL",
")",
"{",
"astring_cpyc",
"(",
"dest",
",",
"device",
"->",
"tag",
")",
";",
"astring_catc",
"(",
"dest",
",",
"\"",
"\"",
")",
";",
"astring_catc",
"(",
"dest",
",",
"tag",
")",
";",
"}",
"else",
"astring_cpyc",
"(",
"dest",
",",
"tag",
")",
";",
"return",
"astring_c",
"(",
"dest",
")",
";",
"}"
] | device_build_tag - build a tag that combines
the device's name and the given tag | [
"device_build_tag",
"-",
"build",
"a",
"tag",
"that",
"combines",
"the",
"device",
"'",
"s",
"name",
"and",
"the",
"given",
"tag"
] | [] | [
{
"param": "dest",
"type": "astring"
},
{
"param": "device",
"type": "device_config"
},
{
"param": "tag",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "device",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_inherit_tag | char | const char *device_inherit_tag(astring *dest, const char *sourcetag, const char *tag)
{
const char *divider = strrchr(sourcetag, ':');
if (divider != NULL)
{
astring_cpych(dest, sourcetag, divider + 1 - sourcetag);
astring_catc(dest, tag);
}
else
astring_cpyc(dest, tag);
return astring_c(dest);
} | /*-------------------------------------------------
device_inherit_tag - build a tag with the same
device prefix as the source tag
-------------------------------------------------*/ | build a tag with the same
device prefix as the source tag | [
"build",
"a",
"tag",
"with",
"the",
"same",
"device",
"prefix",
"as",
"the",
"source",
"tag"
] | const char *device_inherit_tag(astring *dest, const char *sourcetag, const char *tag)
{
const char *divider = strrchr(sourcetag, ':');
if (divider != NULL)
{
astring_cpych(dest, sourcetag, divider + 1 - sourcetag);
astring_catc(dest, tag);
}
else
astring_cpyc(dest, tag);
return astring_c(dest);
} | [
"const",
"char",
"*",
"device_inherit_tag",
"(",
"astring",
"*",
"dest",
",",
"const",
"char",
"*",
"sourcetag",
",",
"const",
"char",
"*",
"tag",
")",
"{",
"const",
"char",
"*",
"divider",
"=",
"strrchr",
"(",
"sourcetag",
",",
"'",
"'",
")",
";",
"if",
"(",
"divider",
"!=",
"NULL",
")",
"{",
"astring_cpych",
"(",
"dest",
",",
"sourcetag",
",",
"divider",
"+",
"1",
"-",
"sourcetag",
")",
";",
"astring_catc",
"(",
"dest",
",",
"tag",
")",
";",
"}",
"else",
"astring_cpyc",
"(",
"dest",
",",
"tag",
")",
";",
"return",
"astring_c",
"(",
"dest",
")",
";",
"}"
] | device_inherit_tag - build a tag with the same
device prefix as the source tag | [
"device_inherit_tag",
"-",
"build",
"a",
"tag",
"with",
"the",
"same",
"device",
"prefix",
"as",
"the",
"source",
"tag"
] | [] | [
{
"param": "dest",
"type": "astring"
},
{
"param": "sourcetag",
"type": "char"
},
{
"param": "tag",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sourcetag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_get_contract | device_contract | const device_contract *device_get_contract(const device_config *device, const char *name)
{
const device_contract *contract = (const device_contract *)device_get_info_ptr(device, DEVINFO_PTR_CONTRACT_LIST);
/* if no contracts, obviously we don't have it */
if (contract == NULL)
return NULL;
/* scan forward through the array looking for a match */
for ( ; contract->name != NULL; contract++)
if (strcmp(name, contract->name) == 0)
return contract;
return NULL;
} | /*-------------------------------------------------
device_get_contract - find a given contract
on a device
-------------------------------------------------*/ | find a given contract
on a device | [
"find",
"a",
"given",
"contract",
"on",
"a",
"device"
] | const device_contract *device_get_contract(const device_config *device, const char *name)
{
const device_contract *contract = (const device_contract *)device_get_info_ptr(device, DEVINFO_PTR_CONTRACT_LIST);
if (contract == NULL)
return NULL;
for ( ; contract->name != NULL; contract++)
if (strcmp(name, contract->name) == 0)
return contract;
return NULL;
} | [
"const",
"device_contract",
"*",
"device_get_contract",
"(",
"const",
"device_config",
"*",
"device",
",",
"const",
"char",
"*",
"name",
")",
"{",
"const",
"device_contract",
"*",
"contract",
"=",
"(",
"const",
"device_contract",
"*",
")",
"device_get_info_ptr",
"(",
"device",
",",
"DEVINFO_PTR_CONTRACT_LIST",
")",
";",
"if",
"(",
"contract",
"==",
"NULL",
")",
"return",
"NULL",
";",
"for",
"(",
";",
"contract",
"->",
"name",
"!=",
"NULL",
";",
"contract",
"++",
")",
"if",
"(",
"strcmp",
"(",
"name",
",",
"contract",
"->",
"name",
")",
"==",
"0",
")",
"return",
"contract",
";",
"return",
"NULL",
";",
"}"
] | device_get_contract - find a given contract
on a device | [
"device_get_contract",
"-",
"find",
"a",
"given",
"contract",
"on",
"a",
"device"
] | [
"/* if no contracts, obviously we don't have it */",
"/* scan forward through the array looking for a match */"
] | [
{
"param": "device",
"type": "device_config"
},
{
"param": "name",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_list_items | int | int device_list_items(const device_config *listhead, device_type type)
{
const device_config *curdev;
int count = 0;
/* locate all devices */
if (type == DEVICE_TYPE_WILDCARD)
{
for (curdev = listhead; curdev != NULL; curdev = curdev->next)
count++;
}
/* locate all devices of a given type */
else
{
for (curdev = listhead; curdev != NULL && curdev->type != type; curdev = curdev->next) ;
for ( ; curdev != NULL; curdev = curdev->typenext)
count++;
}
return count;
} | /*-------------------------------------------------
device_list_items - return the number of
items of a given type; DEVICE_TYPE_WILDCARD
is allowed
-------------------------------------------------*/ | return the number of
items of a given type; DEVICE_TYPE_WILDCARD
is allowed | [
"return",
"the",
"number",
"of",
"items",
"of",
"a",
"given",
"type",
";",
"DEVICE_TYPE_WILDCARD",
"is",
"allowed"
] | int device_list_items(const device_config *listhead, device_type type)
{
const device_config *curdev;
int count = 0;
if (type == DEVICE_TYPE_WILDCARD)
{
for (curdev = listhead; curdev != NULL; curdev = curdev->next)
count++;
}
else
{
for (curdev = listhead; curdev != NULL && curdev->type != type; curdev = curdev->next) ;
for ( ; curdev != NULL; curdev = curdev->typenext)
count++;
}
return count;
} | [
"int",
"device_list_items",
"(",
"const",
"device_config",
"*",
"listhead",
",",
"device_type",
"type",
")",
"{",
"const",
"device_config",
"*",
"curdev",
";",
"int",
"count",
"=",
"0",
";",
"if",
"(",
"type",
"==",
"DEVICE_TYPE_WILDCARD",
")",
"{",
"for",
"(",
"curdev",
"=",
"listhead",
";",
"curdev",
"!=",
"NULL",
";",
"curdev",
"=",
"curdev",
"->",
"next",
")",
"count",
"++",
";",
"}",
"else",
"{",
"for",
"(",
"curdev",
"=",
"listhead",
";",
"curdev",
"!=",
"NULL",
"&&",
"curdev",
"->",
"type",
"!=",
"type",
";",
"curdev",
"=",
"curdev",
"->",
"next",
")",
";",
"for",
"(",
";",
"curdev",
"!=",
"NULL",
";",
"curdev",
"=",
"curdev",
"->",
"typenext",
")",
"count",
"++",
";",
"}",
"return",
"count",
";",
"}"
] | device_list_items - return the number of
items of a given type; DEVICE_TYPE_WILDCARD
is allowed | [
"device_list_items",
"-",
"return",
"the",
"number",
"of",
"items",
"of",
"a",
"given",
"type",
";",
"DEVICE_TYPE_WILDCARD",
"is",
"allowed"
] | [
"/* locate all devices */",
"/* locate all devices of a given type */"
] | [
{
"param": "listhead",
"type": "device_config"
},
{
"param": "type",
"type": "device_type"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "listhead",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "device_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_list_first | device_config | const device_config *device_list_first(const device_config *listhead, device_type type)
{
const device_config *curdev;
/* first of any device type */
if (type == DEVICE_TYPE_WILDCARD)
return listhead;
/* first of a given type */
for (curdev = listhead; curdev != NULL && curdev->type != type; curdev = curdev->next) ;
return curdev;
} | /*-------------------------------------------------
device_list_first - return the first device
in the list of a given type;
DEVICE_TYPE_WILDCARD is allowed
-------------------------------------------------*/ | return the first device
in the list of a given type;
DEVICE_TYPE_WILDCARD is allowed | [
"return",
"the",
"first",
"device",
"in",
"the",
"list",
"of",
"a",
"given",
"type",
";",
"DEVICE_TYPE_WILDCARD",
"is",
"allowed"
] | const device_config *device_list_first(const device_config *listhead, device_type type)
{
const device_config *curdev;
if (type == DEVICE_TYPE_WILDCARD)
return listhead;
for (curdev = listhead; curdev != NULL && curdev->type != type; curdev = curdev->next) ;
return curdev;
} | [
"const",
"device_config",
"*",
"device_list_first",
"(",
"const",
"device_config",
"*",
"listhead",
",",
"device_type",
"type",
")",
"{",
"const",
"device_config",
"*",
"curdev",
";",
"if",
"(",
"type",
"==",
"DEVICE_TYPE_WILDCARD",
")",
"return",
"listhead",
";",
"for",
"(",
"curdev",
"=",
"listhead",
";",
"curdev",
"!=",
"NULL",
"&&",
"curdev",
"->",
"type",
"!=",
"type",
";",
"curdev",
"=",
"curdev",
"->",
"next",
")",
";",
"return",
"curdev",
";",
"}"
] | device_list_first - return the first device
in the list of a given type;
DEVICE_TYPE_WILDCARD is allowed | [
"device_list_first",
"-",
"return",
"the",
"first",
"device",
"in",
"the",
"list",
"of",
"a",
"given",
"type",
";",
"DEVICE_TYPE_WILDCARD",
"is",
"allowed"
] | [
"/* first of any device type */",
"/* first of a given type */"
] | [
{
"param": "listhead",
"type": "device_config"
},
{
"param": "type",
"type": "device_type"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "listhead",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "device_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_list_next | device_config | const device_config *device_list_next(const device_config *prevdevice, device_type type)
{
assert(prevdevice != NULL);
return (type == DEVICE_TYPE_WILDCARD) ? prevdevice->next : prevdevice->typenext;
} | /*-------------------------------------------------
device_list_next - return the next device
in the list of a given type;
DEVICE_TYPE_WILDCARD is allowed
-------------------------------------------------*/ | return the next device
in the list of a given type;
DEVICE_TYPE_WILDCARD is allowed | [
"return",
"the",
"next",
"device",
"in",
"the",
"list",
"of",
"a",
"given",
"type",
";",
"DEVICE_TYPE_WILDCARD",
"is",
"allowed"
] | const device_config *device_list_next(const device_config *prevdevice, device_type type)
{
assert(prevdevice != NULL);
return (type == DEVICE_TYPE_WILDCARD) ? prevdevice->next : prevdevice->typenext;
} | [
"const",
"device_config",
"*",
"device_list_next",
"(",
"const",
"device_config",
"*",
"prevdevice",
",",
"device_type",
"type",
")",
"{",
"assert",
"(",
"prevdevice",
"!=",
"NULL",
")",
";",
"return",
"(",
"type",
"==",
"DEVICE_TYPE_WILDCARD",
")",
"?",
"prevdevice",
"->",
"next",
":",
"prevdevice",
"->",
"typenext",
";",
"}"
] | device_list_next - return the next device
in the list of a given type;
DEVICE_TYPE_WILDCARD is allowed | [
"device_list_next",
"-",
"return",
"the",
"next",
"device",
"in",
"the",
"list",
"of",
"a",
"given",
"type",
";",
"DEVICE_TYPE_WILDCARD",
"is",
"allowed"
] | [] | [
{
"param": "prevdevice",
"type": "device_config"
},
{
"param": "type",
"type": "device_type"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "prevdevice",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "device_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_list_find_by_tag | device_config | const device_config *device_list_find_by_tag(const device_config *listhead, const char *tag)
{
const device_config *curdev;
assert(tag != NULL);
/* locate among all devices */
for (curdev = listhead; curdev != NULL; curdev = curdev->next)
if (strcmp(tag, curdev->tag) == 0)
return curdev;
/* fail */
return NULL;
} | /*-------------------------------------------------
device_list_find_by_tag - retrieve a device
configuration based on a type and tag;
DEVICE_TYPE_WILDCARD is allowed
-------------------------------------------------*/ | retrieve a device
configuration based on a type and tag;
DEVICE_TYPE_WILDCARD is allowed | [
"retrieve",
"a",
"device",
"configuration",
"based",
"on",
"a",
"type",
"and",
"tag",
";",
"DEVICE_TYPE_WILDCARD",
"is",
"allowed"
] | const device_config *device_list_find_by_tag(const device_config *listhead, const char *tag)
{
const device_config *curdev;
assert(tag != NULL);
for (curdev = listhead; curdev != NULL; curdev = curdev->next)
if (strcmp(tag, curdev->tag) == 0)
return curdev;
return NULL;
} | [
"const",
"device_config",
"*",
"device_list_find_by_tag",
"(",
"const",
"device_config",
"*",
"listhead",
",",
"const",
"char",
"*",
"tag",
")",
"{",
"const",
"device_config",
"*",
"curdev",
";",
"assert",
"(",
"tag",
"!=",
"NULL",
")",
";",
"for",
"(",
"curdev",
"=",
"listhead",
";",
"curdev",
"!=",
"NULL",
";",
"curdev",
"=",
"curdev",
"->",
"next",
")",
"if",
"(",
"strcmp",
"(",
"tag",
",",
"curdev",
"->",
"tag",
")",
"==",
"0",
")",
"return",
"curdev",
";",
"return",
"NULL",
";",
"}"
] | device_list_find_by_tag - retrieve a device
configuration based on a type and tag;
DEVICE_TYPE_WILDCARD is allowed | [
"device_list_find_by_tag",
"-",
"retrieve",
"a",
"device",
"configuration",
"based",
"on",
"a",
"type",
"and",
"tag",
";",
"DEVICE_TYPE_WILDCARD",
"is",
"allowed"
] | [
"/* locate among all devices */",
"/* fail */"
] | [
{
"param": "listhead",
"type": "device_config"
},
{
"param": "tag",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "listhead",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_find_child_by_tag | device_config | const device_config *device_find_child_by_tag(const device_config *owner, const char *tag)
{
astring *tempstring;
const device_config *child;
assert(owner != NULL);
assert(tag != NULL);
tempstring = astring_alloc();
child = device_list_find_by_tag(owner->machine->config->devicelist, device_build_tag(tempstring, owner, tag));
astring_free(tempstring);
return child;
} | /*-------------------------------------------------
device_find_child_by_tag - retrieve a child
device configuration based on a tag
-------------------------------------------------*/ | retrieve a child
device configuration based on a tag | [
"retrieve",
"a",
"child",
"device",
"configuration",
"based",
"on",
"a",
"tag"
] | const device_config *device_find_child_by_tag(const device_config *owner, const char *tag)
{
astring *tempstring;
const device_config *child;
assert(owner != NULL);
assert(tag != NULL);
tempstring = astring_alloc();
child = device_list_find_by_tag(owner->machine->config->devicelist, device_build_tag(tempstring, owner, tag));
astring_free(tempstring);
return child;
} | [
"const",
"device_config",
"*",
"device_find_child_by_tag",
"(",
"const",
"device_config",
"*",
"owner",
",",
"const",
"char",
"*",
"tag",
")",
"{",
"astring",
"*",
"tempstring",
";",
"const",
"device_config",
"*",
"child",
";",
"assert",
"(",
"owner",
"!=",
"NULL",
")",
";",
"assert",
"(",
"tag",
"!=",
"NULL",
")",
";",
"tempstring",
"=",
"astring_alloc",
"(",
")",
";",
"child",
"=",
"device_list_find_by_tag",
"(",
"owner",
"->",
"machine",
"->",
"config",
"->",
"devicelist",
",",
"device_build_tag",
"(",
"tempstring",
",",
"owner",
",",
"tag",
")",
")",
";",
"astring_free",
"(",
"tempstring",
")",
";",
"return",
"child",
";",
"}"
] | device_find_child_by_tag - retrieve a child
device configuration based on a tag | [
"device_find_child_by_tag",
"-",
"retrieve",
"a",
"child",
"device",
"configuration",
"based",
"on",
"a",
"tag"
] | [] | [
{
"param": "owner",
"type": "device_config"
},
{
"param": "tag",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "owner",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_list_index | int | int device_list_index(const device_config *listhead, device_type type, const char *tag)
{
const device_config *curdev;
int index = 0;
assert(tag != NULL);
/* locate among all devices */
if (type == DEVICE_TYPE_WILDCARD)
{
for (curdev = listhead; curdev != NULL; curdev = curdev->next)
{
if (strcmp(tag, curdev->tag) == 0)
return index;
index++;
}
}
/* locate among all devices of a given type */
else
{
for (curdev = listhead; curdev != NULL && curdev->type != type; curdev = curdev->next) ;
for ( ; curdev != NULL; curdev = curdev->typenext)
{
if (strcmp(tag, curdev->tag) == 0)
return index;
index++;
}
}
return -1;
} | /*-------------------------------------------------
device_list_index - return the index of a
device based on its type and tag;
DEVICE_TYPE_WILDCARD is allowed
-------------------------------------------------*/ | return the index of a
device based on its type and tag;
DEVICE_TYPE_WILDCARD is allowed | [
"return",
"the",
"index",
"of",
"a",
"device",
"based",
"on",
"its",
"type",
"and",
"tag",
";",
"DEVICE_TYPE_WILDCARD",
"is",
"allowed"
] | int device_list_index(const device_config *listhead, device_type type, const char *tag)
{
const device_config *curdev;
int index = 0;
assert(tag != NULL);
if (type == DEVICE_TYPE_WILDCARD)
{
for (curdev = listhead; curdev != NULL; curdev = curdev->next)
{
if (strcmp(tag, curdev->tag) == 0)
return index;
index++;
}
}
else
{
for (curdev = listhead; curdev != NULL && curdev->type != type; curdev = curdev->next) ;
for ( ; curdev != NULL; curdev = curdev->typenext)
{
if (strcmp(tag, curdev->tag) == 0)
return index;
index++;
}
}
return -1;
} | [
"int",
"device_list_index",
"(",
"const",
"device_config",
"*",
"listhead",
",",
"device_type",
"type",
",",
"const",
"char",
"*",
"tag",
")",
"{",
"const",
"device_config",
"*",
"curdev",
";",
"int",
"index",
"=",
"0",
";",
"assert",
"(",
"tag",
"!=",
"NULL",
")",
";",
"if",
"(",
"type",
"==",
"DEVICE_TYPE_WILDCARD",
")",
"{",
"for",
"(",
"curdev",
"=",
"listhead",
";",
"curdev",
"!=",
"NULL",
";",
"curdev",
"=",
"curdev",
"->",
"next",
")",
"{",
"if",
"(",
"strcmp",
"(",
"tag",
",",
"curdev",
"->",
"tag",
")",
"==",
"0",
")",
"return",
"index",
";",
"index",
"++",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"curdev",
"=",
"listhead",
";",
"curdev",
"!=",
"NULL",
"&&",
"curdev",
"->",
"type",
"!=",
"type",
";",
"curdev",
"=",
"curdev",
"->",
"next",
")",
";",
"for",
"(",
";",
"curdev",
"!=",
"NULL",
";",
"curdev",
"=",
"curdev",
"->",
"typenext",
")",
"{",
"if",
"(",
"strcmp",
"(",
"tag",
",",
"curdev",
"->",
"tag",
")",
"==",
"0",
")",
"return",
"index",
";",
"index",
"++",
";",
"}",
"}",
"return",
"-1",
";",
"}"
] | device_list_index - return the index of a
device based on its type and tag;
DEVICE_TYPE_WILDCARD is allowed | [
"device_list_index",
"-",
"return",
"the",
"index",
"of",
"a",
"device",
"based",
"on",
"its",
"type",
"and",
"tag",
";",
"DEVICE_TYPE_WILDCARD",
"is",
"allowed"
] | [
"/* locate among all devices */",
"/* locate among all devices of a given type */"
] | [
{
"param": "listhead",
"type": "device_config"
},
{
"param": "type",
"type": "device_type"
},
{
"param": "tag",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "listhead",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "device_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_list_find_by_index | device_config | const device_config *device_list_find_by_index(const device_config *listhead, device_type type, int index)
{
const device_config *curdev;
/* locate among all devices */
if (type == DEVICE_TYPE_WILDCARD)
{
for (curdev = listhead; curdev != NULL; curdev = curdev->next)
if (index-- == 0)
return curdev;
}
/* locate among all devices of a given type */
else
{
for (curdev = listhead; curdev != NULL && curdev->type != type; curdev = curdev->next) ;
for ( ; curdev != NULL; curdev = curdev->typenext)
if (index-- == 0)
return curdev;
}
/* fail */
return NULL;
} | /*-------------------------------------------------
device_list_find_by_index - retrieve a device
configuration based on a type and index
-------------------------------------------------*/ | retrieve a device
configuration based on a type and index | [
"retrieve",
"a",
"device",
"configuration",
"based",
"on",
"a",
"type",
"and",
"index"
] | const device_config *device_list_find_by_index(const device_config *listhead, device_type type, int index)
{
const device_config *curdev;
if (type == DEVICE_TYPE_WILDCARD)
{
for (curdev = listhead; curdev != NULL; curdev = curdev->next)
if (index-- == 0)
return curdev;
}
else
{
for (curdev = listhead; curdev != NULL && curdev->type != type; curdev = curdev->next) ;
for ( ; curdev != NULL; curdev = curdev->typenext)
if (index-- == 0)
return curdev;
}
return NULL;
} | [
"const",
"device_config",
"*",
"device_list_find_by_index",
"(",
"const",
"device_config",
"*",
"listhead",
",",
"device_type",
"type",
",",
"int",
"index",
")",
"{",
"const",
"device_config",
"*",
"curdev",
";",
"if",
"(",
"type",
"==",
"DEVICE_TYPE_WILDCARD",
")",
"{",
"for",
"(",
"curdev",
"=",
"listhead",
";",
"curdev",
"!=",
"NULL",
";",
"curdev",
"=",
"curdev",
"->",
"next",
")",
"if",
"(",
"index",
"--",
"==",
"0",
")",
"return",
"curdev",
";",
"}",
"else",
"{",
"for",
"(",
"curdev",
"=",
"listhead",
";",
"curdev",
"!=",
"NULL",
"&&",
"curdev",
"->",
"type",
"!=",
"type",
";",
"curdev",
"=",
"curdev",
"->",
"next",
")",
";",
"for",
"(",
";",
"curdev",
"!=",
"NULL",
";",
"curdev",
"=",
"curdev",
"->",
"typenext",
")",
"if",
"(",
"index",
"--",
"==",
"0",
")",
"return",
"curdev",
";",
"}",
"return",
"NULL",
";",
"}"
] | device_list_find_by_index - retrieve a device
configuration based on a type and index | [
"device_list_find_by_index",
"-",
"retrieve",
"a",
"device",
"configuration",
"based",
"on",
"a",
"type",
"and",
"index"
] | [
"/* locate among all devices */",
"/* locate among all devices of a given type */",
"/* fail */"
] | [
{
"param": "listhead",
"type": "device_config"
},
{
"param": "type",
"type": "device_type"
},
{
"param": "index",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "listhead",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "device_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "index",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_list_class_items | int | int device_list_class_items(const device_config *listhead, device_class devclass)
{
const device_config *curdev;
int count = 0;
/* locate all devices of a given class */
for (curdev = listhead; curdev != NULL && curdev->devclass != devclass; curdev = curdev->next) ;
for ( ; curdev != NULL; curdev = curdev->classnext)
count++;
return count;
} | /*-------------------------------------------------
device_list_class_items - return the number of
items of a given class
-------------------------------------------------*/ | return the number of
items of a given class | [
"return",
"the",
"number",
"of",
"items",
"of",
"a",
"given",
"class"
] | int device_list_class_items(const device_config *listhead, device_class devclass)
{
const device_config *curdev;
int count = 0;
for (curdev = listhead; curdev != NULL && curdev->devclass != devclass; curdev = curdev->next) ;
for ( ; curdev != NULL; curdev = curdev->classnext)
count++;
return count;
} | [
"int",
"device_list_class_items",
"(",
"const",
"device_config",
"*",
"listhead",
",",
"device_class",
"devclass",
")",
"{",
"const",
"device_config",
"*",
"curdev",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"curdev",
"=",
"listhead",
";",
"curdev",
"!=",
"NULL",
"&&",
"curdev",
"->",
"devclass",
"!=",
"devclass",
";",
"curdev",
"=",
"curdev",
"->",
"next",
")",
";",
"for",
"(",
";",
"curdev",
"!=",
"NULL",
";",
"curdev",
"=",
"curdev",
"->",
"classnext",
")",
"count",
"++",
";",
"return",
"count",
";",
"}"
] | device_list_class_items - return the number of
items of a given class | [
"device_list_class_items",
"-",
"return",
"the",
"number",
"of",
"items",
"of",
"a",
"given",
"class"
] | [
"/* locate all devices of a given class */"
] | [
{
"param": "listhead",
"type": "device_config"
},
{
"param": "devclass",
"type": "device_class"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "listhead",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "devclass",
"type": "device_class",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_list_class_first | device_config | const device_config *device_list_class_first(const device_config *listhead, device_class devclass)
{
const device_config *curdev;
/* first of a given class */
for (curdev = listhead; curdev != NULL && curdev->devclass != devclass; curdev = curdev->next) ;
return curdev;
} | /*-------------------------------------------------
device_list_class_first - return the first
device in the list of a given class
-------------------------------------------------*/ | return the first
device in the list of a given class | [
"return",
"the",
"first",
"device",
"in",
"the",
"list",
"of",
"a",
"given",
"class"
] | const device_config *device_list_class_first(const device_config *listhead, device_class devclass)
{
const device_config *curdev;
for (curdev = listhead; curdev != NULL && curdev->devclass != devclass; curdev = curdev->next) ;
return curdev;
} | [
"const",
"device_config",
"*",
"device_list_class_first",
"(",
"const",
"device_config",
"*",
"listhead",
",",
"device_class",
"devclass",
")",
"{",
"const",
"device_config",
"*",
"curdev",
";",
"for",
"(",
"curdev",
"=",
"listhead",
";",
"curdev",
"!=",
"NULL",
"&&",
"curdev",
"->",
"devclass",
"!=",
"devclass",
";",
"curdev",
"=",
"curdev",
"->",
"next",
")",
";",
"return",
"curdev",
";",
"}"
] | device_list_class_first - return the first
device in the list of a given class | [
"device_list_class_first",
"-",
"return",
"the",
"first",
"device",
"in",
"the",
"list",
"of",
"a",
"given",
"class"
] | [
"/* first of a given class */"
] | [
{
"param": "listhead",
"type": "device_config"
},
{
"param": "devclass",
"type": "device_class"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "listhead",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "devclass",
"type": "device_class",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_list_class_next | device_config | const device_config *device_list_class_next(const device_config *prevdevice, device_class devclass)
{
assert(prevdevice != NULL);
return prevdevice->classnext;
} | /*-------------------------------------------------
device_list_class_next - return the next
device in the list of a given class
-------------------------------------------------*/ | return the next
device in the list of a given class | [
"return",
"the",
"next",
"device",
"in",
"the",
"list",
"of",
"a",
"given",
"class"
] | const device_config *device_list_class_next(const device_config *prevdevice, device_class devclass)
{
assert(prevdevice != NULL);
return prevdevice->classnext;
} | [
"const",
"device_config",
"*",
"device_list_class_next",
"(",
"const",
"device_config",
"*",
"prevdevice",
",",
"device_class",
"devclass",
")",
"{",
"assert",
"(",
"prevdevice",
"!=",
"NULL",
")",
";",
"return",
"prevdevice",
"->",
"classnext",
";",
"}"
] | device_list_class_next - return the next
device in the list of a given class | [
"device_list_class_next",
"-",
"return",
"the",
"next",
"device",
"in",
"the",
"list",
"of",
"a",
"given",
"class"
] | [] | [
{
"param": "prevdevice",
"type": "device_config"
},
{
"param": "devclass",
"type": "device_class"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "prevdevice",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "devclass",
"type": "device_class",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_list_class_index | int | int device_list_class_index(const device_config *listhead, device_class devclass, const char *tag)
{
const device_config *curdev;
int index = 0;
assert(tag != NULL);
/* locate among all devices of a given class */
for (curdev = listhead; curdev != NULL && curdev->devclass != devclass; curdev = curdev->next) ;
for ( ; curdev != NULL; curdev = curdev->classnext)
{
if (strcmp(tag, curdev->tag) == 0)
return index;
index++;
}
return -1;
} | /*-------------------------------------------------
device_list_class_index - return the index of a
device based on its class and tag
-------------------------------------------------*/ | return the index of a
device based on its class and tag | [
"return",
"the",
"index",
"of",
"a",
"device",
"based",
"on",
"its",
"class",
"and",
"tag"
] | int device_list_class_index(const device_config *listhead, device_class devclass, const char *tag)
{
const device_config *curdev;
int index = 0;
assert(tag != NULL);
for (curdev = listhead; curdev != NULL && curdev->devclass != devclass; curdev = curdev->next) ;
for ( ; curdev != NULL; curdev = curdev->classnext)
{
if (strcmp(tag, curdev->tag) == 0)
return index;
index++;
}
return -1;
} | [
"int",
"device_list_class_index",
"(",
"const",
"device_config",
"*",
"listhead",
",",
"device_class",
"devclass",
",",
"const",
"char",
"*",
"tag",
")",
"{",
"const",
"device_config",
"*",
"curdev",
";",
"int",
"index",
"=",
"0",
";",
"assert",
"(",
"tag",
"!=",
"NULL",
")",
";",
"for",
"(",
"curdev",
"=",
"listhead",
";",
"curdev",
"!=",
"NULL",
"&&",
"curdev",
"->",
"devclass",
"!=",
"devclass",
";",
"curdev",
"=",
"curdev",
"->",
"next",
")",
";",
"for",
"(",
";",
"curdev",
"!=",
"NULL",
";",
"curdev",
"=",
"curdev",
"->",
"classnext",
")",
"{",
"if",
"(",
"strcmp",
"(",
"tag",
",",
"curdev",
"->",
"tag",
")",
"==",
"0",
")",
"return",
"index",
";",
"index",
"++",
";",
"}",
"return",
"-1",
";",
"}"
] | device_list_class_index - return the index of a
device based on its class and tag | [
"device_list_class_index",
"-",
"return",
"the",
"index",
"of",
"a",
"device",
"based",
"on",
"its",
"class",
"and",
"tag"
] | [
"/* locate among all devices of a given class */"
] | [
{
"param": "listhead",
"type": "device_config"
},
{
"param": "devclass",
"type": "device_class"
},
{
"param": "tag",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "listhead",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "devclass",
"type": "device_class",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_list_class_find_by_index | device_config | const device_config *device_list_class_find_by_index(const device_config *listhead, device_class devclass, int index)
{
const device_config *curdev;
/* locate among all devices of a given class */
for (curdev = listhead; curdev != NULL && curdev->devclass != devclass; curdev = curdev->next) ;
for ( ; curdev != NULL; curdev = curdev->classnext)
if (index-- == 0)
return curdev;
/* fail */
return NULL;
} | /*-------------------------------------------------
device_list_class_find_by_index - retrieve a
device configuration based on a class and
index
-------------------------------------------------*/ | retrieve a
device configuration based on a class and
index | [
"retrieve",
"a",
"device",
"configuration",
"based",
"on",
"a",
"class",
"and",
"index"
] | const device_config *device_list_class_find_by_index(const device_config *listhead, device_class devclass, int index)
{
const device_config *curdev;
for (curdev = listhead; curdev != NULL && curdev->devclass != devclass; curdev = curdev->next) ;
for ( ; curdev != NULL; curdev = curdev->classnext)
if (index-- == 0)
return curdev;
return NULL;
} | [
"const",
"device_config",
"*",
"device_list_class_find_by_index",
"(",
"const",
"device_config",
"*",
"listhead",
",",
"device_class",
"devclass",
",",
"int",
"index",
")",
"{",
"const",
"device_config",
"*",
"curdev",
";",
"for",
"(",
"curdev",
"=",
"listhead",
";",
"curdev",
"!=",
"NULL",
"&&",
"curdev",
"->",
"devclass",
"!=",
"devclass",
";",
"curdev",
"=",
"curdev",
"->",
"next",
")",
";",
"for",
"(",
";",
"curdev",
"!=",
"NULL",
";",
"curdev",
"=",
"curdev",
"->",
"classnext",
")",
"if",
"(",
"index",
"--",
"==",
"0",
")",
"return",
"curdev",
";",
"return",
"NULL",
";",
"}"
] | device_list_class_find_by_index - retrieve a
device configuration based on a class and
index | [
"device_list_class_find_by_index",
"-",
"retrieve",
"a",
"device",
"configuration",
"based",
"on",
"a",
"class",
"and",
"index"
] | [
"/* locate among all devices of a given class */",
"/* fail */"
] | [
{
"param": "listhead",
"type": "device_config"
},
{
"param": "devclass",
"type": "device_class"
},
{
"param": "index",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "listhead",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "devclass",
"type": "device_class",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "index",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_list_attach_machine | void | void device_list_attach_machine(running_machine *machine)
{
device_config *device;
assert(machine != NULL);
/* iterate over devices and assign the machine to them */
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
device->machine = machine;
} | /*-------------------------------------------------
device_list_attach_machine - "attach" a
running_machine to its list of devices
-------------------------------------------------*/ | "attach" a
running_machine to its list of devices | [
"\"",
"attach",
"\"",
"a",
"running_machine",
"to",
"its",
"list",
"of",
"devices"
] | void device_list_attach_machine(running_machine *machine)
{
device_config *device;
assert(machine != NULL);
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
device->machine = machine;
} | [
"void",
"device_list_attach_machine",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"device_config",
"*",
"device",
";",
"assert",
"(",
"machine",
"!=",
"NULL",
")",
";",
"for",
"(",
"device",
"=",
"(",
"device_config",
"*",
")",
"machine",
"->",
"config",
"->",
"devicelist",
";",
"device",
"!=",
"NULL",
";",
"device",
"=",
"device",
"->",
"next",
")",
"device",
"->",
"machine",
"=",
"machine",
";",
"}"
] | device_list_attach_machine - "attach" a
running_machine to its list of devices | [
"device_list_attach_machine",
"-",
"\"",
"attach",
"\"",
"a",
"running_machine",
"to",
"its",
"list",
"of",
"devices"
] | [
"/* iterate over devices and assign the machine to them */"
] | [
{
"param": "machine",
"type": "running_machine"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_list_start | void | void device_list_start(running_machine *machine)
{
device_config *device;
int numstarted = 0;
int devcount = 0;
assert(machine != NULL);
/* add an exit callback for cleanup */
add_reset_callback(machine, device_list_reset);
add_exit_callback(machine, device_list_stop);
/* iterate over devices and allocate memory for them */
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
{
int spacenum;
assert(!device->started);
assert(device->machine == machine);
assert(device->token == NULL);
assert(device->type != NULL);
devcount++;
/* get the size of the token data; we do it directly because we can't call device_get_info_* with no token */
device->tokenbytes = device_get_info_int(device, DEVINFO_INT_TOKEN_BYTES);
if (device->tokenbytes == 0)
fatalerror("Device %s specifies a 0 token length!\n", device_get_name(device));
/* allocate memory for the token */
device->token = alloc_array_clear_or_die(UINT8, device->tokenbytes);
/* fill in the remaining runtime fields */
device->region = memory_region(machine, device->tag);
device->regionbytes = memory_region_length(machine, device->tag);
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
device->space[spacenum] = memory_find_address_space(device, spacenum);
device->execute = (device_execute_func)device_get_info_fct(device, DEVINFO_FCT_EXECUTE);
}
/* iterate until we've started everything */
while (numstarted < devcount)
{
int prevstarted = numstarted;
/* iterate over devices and start them */
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
{
device_start_func start = (device_start_func)device_get_info_fct(device, DEVINFO_FCT_START);
assert(start != NULL);
if (!device->started)
{
device->started = DEVICE_STARTING;
(*start)(device);
/* if the start was delayed, move back to the stopped state, otherwise count it */
if (device->started == DEVICE_DELAYED)
device->started = DEVICE_STOPPED;
else
{
device->started = DEVICE_STARTED;
numstarted++;
}
}
}
/* if we didn't start anything new, we're in trouble */
if (numstarted == prevstarted)
fatalerror("Circular dependency in device startup; unable to start %d/%d devices\n", devcount - numstarted, devcount);
}
} | /*-------------------------------------------------
device_list_start - start the configured list
of devices for a machine
-------------------------------------------------*/ | start the configured list
of devices for a machine | [
"start",
"the",
"configured",
"list",
"of",
"devices",
"for",
"a",
"machine"
] | void device_list_start(running_machine *machine)
{
device_config *device;
int numstarted = 0;
int devcount = 0;
assert(machine != NULL);
add_reset_callback(machine, device_list_reset);
add_exit_callback(machine, device_list_stop);
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
{
int spacenum;
assert(!device->started);
assert(device->machine == machine);
assert(device->token == NULL);
assert(device->type != NULL);
devcount++;
device->tokenbytes = device_get_info_int(device, DEVINFO_INT_TOKEN_BYTES);
if (device->tokenbytes == 0)
fatalerror("Device %s specifies a 0 token length!\n", device_get_name(device));
device->token = alloc_array_clear_or_die(UINT8, device->tokenbytes);
device->region = memory_region(machine, device->tag);
device->regionbytes = memory_region_length(machine, device->tag);
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
device->space[spacenum] = memory_find_address_space(device, spacenum);
device->execute = (device_execute_func)device_get_info_fct(device, DEVINFO_FCT_EXECUTE);
}
while (numstarted < devcount)
{
int prevstarted = numstarted;
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
{
device_start_func start = (device_start_func)device_get_info_fct(device, DEVINFO_FCT_START);
assert(start != NULL);
if (!device->started)
{
device->started = DEVICE_STARTING;
(*start)(device);
if (device->started == DEVICE_DELAYED)
device->started = DEVICE_STOPPED;
else
{
device->started = DEVICE_STARTED;
numstarted++;
}
}
}
if (numstarted == prevstarted)
fatalerror("Circular dependency in device startup; unable to start %d/%d devices\n", devcount - numstarted, devcount);
}
} | [
"void",
"device_list_start",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"device_config",
"*",
"device",
";",
"int",
"numstarted",
"=",
"0",
";",
"int",
"devcount",
"=",
"0",
";",
"assert",
"(",
"machine",
"!=",
"NULL",
")",
";",
"add_reset_callback",
"(",
"machine",
",",
"device_list_reset",
")",
";",
"add_exit_callback",
"(",
"machine",
",",
"device_list_stop",
")",
";",
"for",
"(",
"device",
"=",
"(",
"device_config",
"*",
")",
"machine",
"->",
"config",
"->",
"devicelist",
";",
"device",
"!=",
"NULL",
";",
"device",
"=",
"device",
"->",
"next",
")",
"{",
"int",
"spacenum",
";",
"assert",
"(",
"!",
"device",
"->",
"started",
")",
";",
"assert",
"(",
"device",
"->",
"machine",
"==",
"machine",
")",
";",
"assert",
"(",
"device",
"->",
"token",
"==",
"NULL",
")",
";",
"assert",
"(",
"device",
"->",
"type",
"!=",
"NULL",
")",
";",
"devcount",
"++",
";",
"device",
"->",
"tokenbytes",
"=",
"device_get_info_int",
"(",
"device",
",",
"DEVINFO_INT_TOKEN_BYTES",
")",
";",
"if",
"(",
"device",
"->",
"tokenbytes",
"==",
"0",
")",
"fatalerror",
"(",
"\"",
"\\n",
"\"",
",",
"device_get_name",
"(",
"device",
")",
")",
";",
"device",
"->",
"token",
"=",
"alloc_array_clear_or_die",
"(",
"UINT8",
",",
"device",
"->",
"tokenbytes",
")",
";",
"device",
"->",
"region",
"=",
"memory_region",
"(",
"machine",
",",
"device",
"->",
"tag",
")",
";",
"device",
"->",
"regionbytes",
"=",
"memory_region_length",
"(",
"machine",
",",
"device",
"->",
"tag",
")",
";",
"for",
"(",
"spacenum",
"=",
"0",
";",
"spacenum",
"<",
"ADDRESS_SPACES",
";",
"spacenum",
"++",
")",
"device",
"->",
"space",
"[",
"spacenum",
"]",
"=",
"memory_find_address_space",
"(",
"device",
",",
"spacenum",
")",
";",
"device",
"->",
"execute",
"=",
"(",
"device_execute_func",
")",
"device_get_info_fct",
"(",
"device",
",",
"DEVINFO_FCT_EXECUTE",
")",
";",
"}",
"while",
"(",
"numstarted",
"<",
"devcount",
")",
"{",
"int",
"prevstarted",
"=",
"numstarted",
";",
"for",
"(",
"device",
"=",
"(",
"device_config",
"*",
")",
"machine",
"->",
"config",
"->",
"devicelist",
";",
"device",
"!=",
"NULL",
";",
"device",
"=",
"device",
"->",
"next",
")",
"{",
"device_start_func",
"start",
"=",
"(",
"device_start_func",
")",
"device_get_info_fct",
"(",
"device",
",",
"DEVINFO_FCT_START",
")",
";",
"assert",
"(",
"start",
"!=",
"NULL",
")",
";",
"if",
"(",
"!",
"device",
"->",
"started",
")",
"{",
"device",
"->",
"started",
"=",
"DEVICE_STARTING",
";",
"(",
"*",
"start",
")",
"(",
"device",
")",
";",
"if",
"(",
"device",
"->",
"started",
"==",
"DEVICE_DELAYED",
")",
"device",
"->",
"started",
"=",
"DEVICE_STOPPED",
";",
"else",
"{",
"device",
"->",
"started",
"=",
"DEVICE_STARTED",
";",
"numstarted",
"++",
";",
"}",
"}",
"}",
"if",
"(",
"numstarted",
"==",
"prevstarted",
")",
"fatalerror",
"(",
"\"",
"\\n",
"\"",
",",
"devcount",
"-",
"numstarted",
",",
"devcount",
")",
";",
"}",
"}"
] | device_list_start - start the configured list
of devices for a machine | [
"device_list_start",
"-",
"start",
"the",
"configured",
"list",
"of",
"devices",
"for",
"a",
"machine"
] | [
"/* add an exit callback for cleanup */",
"/* iterate over devices and allocate memory for them */",
"/* get the size of the token data; we do it directly because we can't call device_get_info_* with no token */",
"/* allocate memory for the token */",
"/* fill in the remaining runtime fields */",
"/* iterate until we've started everything */",
"/* iterate over devices and start them */",
"/* if the start was delayed, move back to the stopped state, otherwise count it */",
"/* if we didn't start anything new, we're in trouble */"
] | [
{
"param": "machine",
"type": "running_machine"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_delay_init | void | void device_delay_init(const device_config *device)
{
if (device->started != DEVICE_STARTING && device->started != DEVICE_DELAYED)
fatalerror("Error: Calling device_delay_init on a device not in the process of starting.");
((device_config *)device)->started = DEVICE_DELAYED;
} | /*-------------------------------------------------
device_delay_init - delay the startup of a
given device for dependency reasons
-------------------------------------------------*/ | delay the startup of a
given device for dependency reasons | [
"delay",
"the",
"startup",
"of",
"a",
"given",
"device",
"for",
"dependency",
"reasons"
] | void device_delay_init(const device_config *device)
{
if (device->started != DEVICE_STARTING && device->started != DEVICE_DELAYED)
fatalerror("Error: Calling device_delay_init on a device not in the process of starting.");
((device_config *)device)->started = DEVICE_DELAYED;
} | [
"void",
"device_delay_init",
"(",
"const",
"device_config",
"*",
"device",
")",
"{",
"if",
"(",
"device",
"->",
"started",
"!=",
"DEVICE_STARTING",
"&&",
"device",
"->",
"started",
"!=",
"DEVICE_DELAYED",
")",
"fatalerror",
"(",
"\"",
"\"",
")",
";",
"(",
"(",
"device_config",
"*",
")",
"device",
")",
"->",
"started",
"=",
"DEVICE_DELAYED",
";",
"}"
] | device_delay_init - delay the startup of a
given device for dependency reasons | [
"device_delay_init",
"-",
"delay",
"the",
"startup",
"of",
"a",
"given",
"device",
"for",
"dependency",
"reasons"
] | [] | [
{
"param": "device",
"type": "device_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_list_stop | void | static void device_list_stop(running_machine *machine)
{
device_config *device;
assert(machine != NULL);
/* iterate over devices and stop them */
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
{
device_stop_func stop = (device_stop_func)device_get_info_fct(device, DEVINFO_FCT_STOP);
assert(device->token != NULL);
assert(device->type != NULL);
/* if we have a stop function, call it */
if (stop != NULL)
(*stop)(device);
/* free allocated memory for the token */
if (device->token != NULL)
free(device->token);
/* reset all runtime fields */
device->token = NULL;
device->tokenbytes = 0;
device->machine = NULL;
device->region = NULL;
device->regionbytes = 0;
}
} | /*-------------------------------------------------
device_list_stop - stop the configured list
of devices for a machine
-------------------------------------------------*/ | stop the configured list
of devices for a machine | [
"stop",
"the",
"configured",
"list",
"of",
"devices",
"for",
"a",
"machine"
] | static void device_list_stop(running_machine *machine)
{
device_config *device;
assert(machine != NULL);
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
{
device_stop_func stop = (device_stop_func)device_get_info_fct(device, DEVINFO_FCT_STOP);
assert(device->token != NULL);
assert(device->type != NULL);
if (stop != NULL)
(*stop)(device);
if (device->token != NULL)
free(device->token);
device->token = NULL;
device->tokenbytes = 0;
device->machine = NULL;
device->region = NULL;
device->regionbytes = 0;
}
} | [
"static",
"void",
"device_list_stop",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"device_config",
"*",
"device",
";",
"assert",
"(",
"machine",
"!=",
"NULL",
")",
";",
"for",
"(",
"device",
"=",
"(",
"device_config",
"*",
")",
"machine",
"->",
"config",
"->",
"devicelist",
";",
"device",
"!=",
"NULL",
";",
"device",
"=",
"device",
"->",
"next",
")",
"{",
"device_stop_func",
"stop",
"=",
"(",
"device_stop_func",
")",
"device_get_info_fct",
"(",
"device",
",",
"DEVINFO_FCT_STOP",
")",
";",
"assert",
"(",
"device",
"->",
"token",
"!=",
"NULL",
")",
";",
"assert",
"(",
"device",
"->",
"type",
"!=",
"NULL",
")",
";",
"if",
"(",
"stop",
"!=",
"NULL",
")",
"(",
"*",
"stop",
")",
"(",
"device",
")",
";",
"if",
"(",
"device",
"->",
"token",
"!=",
"NULL",
")",
"free",
"(",
"device",
"->",
"token",
")",
";",
"device",
"->",
"token",
"=",
"NULL",
";",
"device",
"->",
"tokenbytes",
"=",
"0",
";",
"device",
"->",
"machine",
"=",
"NULL",
";",
"device",
"->",
"region",
"=",
"NULL",
";",
"device",
"->",
"regionbytes",
"=",
"0",
";",
"}",
"}"
] | device_list_stop - stop the configured list
of devices for a machine | [
"device_list_stop",
"-",
"stop",
"the",
"configured",
"list",
"of",
"devices",
"for",
"a",
"machine"
] | [
"/* iterate over devices and stop them */",
"/* if we have a stop function, call it */",
"/* free allocated memory for the token */",
"/* reset all runtime fields */"
] | [
{
"param": "machine",
"type": "running_machine"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_list_reset | void | static void device_list_reset(running_machine *machine)
{
const device_config *device;
assert(machine != NULL);
/* iterate over devices and stop them */
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
device_reset(device);
} | /*-------------------------------------------------
device_list_reset - reset the configured list
of devices for a machine
-------------------------------------------------*/ | reset the configured list
of devices for a machine | [
"reset",
"the",
"configured",
"list",
"of",
"devices",
"for",
"a",
"machine"
] | static void device_list_reset(running_machine *machine)
{
const device_config *device;
assert(machine != NULL);
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
device_reset(device);
} | [
"static",
"void",
"device_list_reset",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"const",
"device_config",
"*",
"device",
";",
"assert",
"(",
"machine",
"!=",
"NULL",
")",
";",
"for",
"(",
"device",
"=",
"(",
"device_config",
"*",
")",
"machine",
"->",
"config",
"->",
"devicelist",
";",
"device",
"!=",
"NULL",
";",
"device",
"=",
"device",
"->",
"next",
")",
"device_reset",
"(",
"device",
")",
";",
"}"
] | device_list_reset - reset the configured list
of devices for a machine | [
"device_list_reset",
"-",
"reset",
"the",
"configured",
"list",
"of",
"devices",
"for",
"a",
"machine"
] | [
"/* iterate over devices and stop them */"
] | [
{
"param": "machine",
"type": "running_machine"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_reset | void | void device_reset(const device_config *device)
{
device_reset_func reset;
assert(device != NULL);
assert(device->token != NULL);
assert(device->type != NULL);
/* if we have a reset function, call it */
reset = (device_reset_func)device_get_info_fct(device, DEVINFO_FCT_RESET);
if (reset != NULL)
(*reset)(device);
} | /*-------------------------------------------------
device_reset - reset a device based on an
allocated device_config
-------------------------------------------------*/ | reset a device based on an
allocated device_config | [
"reset",
"a",
"device",
"based",
"on",
"an",
"allocated",
"device_config"
] | void device_reset(const device_config *device)
{
device_reset_func reset;
assert(device != NULL);
assert(device->token != NULL);
assert(device->type != NULL);
reset = (device_reset_func)device_get_info_fct(device, DEVINFO_FCT_RESET);
if (reset != NULL)
(*reset)(device);
} | [
"void",
"device_reset",
"(",
"const",
"device_config",
"*",
"device",
")",
"{",
"device_reset_func",
"reset",
";",
"assert",
"(",
"device",
"!=",
"NULL",
")",
";",
"assert",
"(",
"device",
"->",
"token",
"!=",
"NULL",
")",
";",
"assert",
"(",
"device",
"->",
"type",
"!=",
"NULL",
")",
";",
"reset",
"=",
"(",
"device_reset_func",
")",
"device_get_info_fct",
"(",
"device",
",",
"DEVINFO_FCT_RESET",
")",
";",
"if",
"(",
"reset",
"!=",
"NULL",
")",
"(",
"*",
"reset",
")",
"(",
"device",
")",
";",
"}"
] | device_reset - reset a device based on an
allocated device_config | [
"device_reset",
"-",
"reset",
"a",
"device",
"based",
"on",
"an",
"allocated",
"device_config"
] | [
"/* if we have a reset function, call it */"
] | [
{
"param": "device",
"type": "device_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_set_clock | void | void device_set_clock(const device_config *device, UINT32 clock)
{
device_config *devicerw = (device_config *)device;
/* not much for now */
devicerw->clock = clock;
} | /*-------------------------------------------------
device_set_clock - change the clock on a
device
-------------------------------------------------*/ | change the clock on a
device | [
"change",
"the",
"clock",
"on",
"a",
"device"
] | void device_set_clock(const device_config *device, UINT32 clock)
{
device_config *devicerw = (device_config *)device;
devicerw->clock = clock;
} | [
"void",
"device_set_clock",
"(",
"const",
"device_config",
"*",
"device",
",",
"UINT32",
"clock",
")",
"{",
"device_config",
"*",
"devicerw",
"=",
"(",
"device_config",
"*",
")",
"device",
";",
"devicerw",
"->",
"clock",
"=",
"clock",
";",
"}"
] | device_set_clock - change the clock on a
device | [
"device_set_clock",
"-",
"change",
"the",
"clock",
"on",
"a",
"device"
] | [
"/* not much for now */"
] | [
{
"param": "device",
"type": "device_config"
},
{
"param": "clock",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "clock",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_get_info_int | INT64 | INT64 device_get_info_int(const device_config *device, UINT32 state)
{
deviceinfo info;
assert(device != NULL);
assert(device->type != NULL);
assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
/* retrieve the value */
info.i = 0;
(*device->type)(device, state, &info);
return info.i;
} | /*-------------------------------------------------
device_get_info_int - return an integer state
value from an allocated device
-------------------------------------------------*/ | return an integer state
value from an allocated device | [
"return",
"an",
"integer",
"state",
"value",
"from",
"an",
"allocated",
"device"
] | INT64 device_get_info_int(const device_config *device, UINT32 state)
{
deviceinfo info;
assert(device != NULL);
assert(device->type != NULL);
assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
info.i = 0;
(*device->type)(device, state, &info);
return info.i;
} | [
"INT64",
"device_get_info_int",
"(",
"const",
"device_config",
"*",
"device",
",",
"UINT32",
"state",
")",
"{",
"deviceinfo",
"info",
";",
"assert",
"(",
"device",
"!=",
"NULL",
")",
";",
"assert",
"(",
"device",
"->",
"type",
"!=",
"NULL",
")",
";",
"assert",
"(",
"state",
">=",
"DEVINFO_INT_FIRST",
"&&",
"state",
"<=",
"DEVINFO_INT_LAST",
")",
";",
"info",
".",
"i",
"=",
"0",
";",
"(",
"*",
"device",
"->",
"type",
")",
"(",
"device",
",",
"state",
",",
"&",
"info",
")",
";",
"return",
"info",
".",
"i",
";",
"}"
] | device_get_info_int - return an integer state
value from an allocated device | [
"device_get_info_int",
"-",
"return",
"an",
"integer",
"state",
"value",
"from",
"an",
"allocated",
"device"
] | [
"/* retrieve the value */"
] | [
{
"param": "device",
"type": "device_config"
},
{
"param": "state",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_get_info_ptr | void | void *device_get_info_ptr(const device_config *device, UINT32 state)
{
deviceinfo info;
assert(device != NULL);
assert(device->type != NULL);
assert(state >= DEVINFO_PTR_FIRST && state <= DEVINFO_PTR_LAST);
/* retrieve the value */
info.p = NULL;
(*device->type)(device, state, &info);
return info.p;
} | /*-------------------------------------------------
device_get_info_ptr - return a pointer state
value from an allocated device
-------------------------------------------------*/ | return a pointer state
value from an allocated device | [
"return",
"a",
"pointer",
"state",
"value",
"from",
"an",
"allocated",
"device"
] | void *device_get_info_ptr(const device_config *device, UINT32 state)
{
deviceinfo info;
assert(device != NULL);
assert(device->type != NULL);
assert(state >= DEVINFO_PTR_FIRST && state <= DEVINFO_PTR_LAST);
info.p = NULL;
(*device->type)(device, state, &info);
return info.p;
} | [
"void",
"*",
"device_get_info_ptr",
"(",
"const",
"device_config",
"*",
"device",
",",
"UINT32",
"state",
")",
"{",
"deviceinfo",
"info",
";",
"assert",
"(",
"device",
"!=",
"NULL",
")",
";",
"assert",
"(",
"device",
"->",
"type",
"!=",
"NULL",
")",
";",
"assert",
"(",
"state",
">=",
"DEVINFO_PTR_FIRST",
"&&",
"state",
"<=",
"DEVINFO_PTR_LAST",
")",
";",
"info",
".",
"p",
"=",
"NULL",
";",
"(",
"*",
"device",
"->",
"type",
")",
"(",
"device",
",",
"state",
",",
"&",
"info",
")",
";",
"return",
"info",
".",
"p",
";",
"}"
] | device_get_info_ptr - return a pointer state
value from an allocated device | [
"device_get_info_ptr",
"-",
"return",
"a",
"pointer",
"state",
"value",
"from",
"an",
"allocated",
"device"
] | [
"/* retrieve the value */"
] | [
{
"param": "device",
"type": "device_config"
},
{
"param": "state",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_get_info_fct | genf | genf *device_get_info_fct(const device_config *device, UINT32 state)
{
deviceinfo info;
assert(device != NULL);
assert(device->type != NULL);
assert(state >= DEVINFO_FCT_FIRST && state <= DEVINFO_FCT_LAST);
/* retrieve the value */
info.f = 0;
(*device->type)(device, state, &info);
return info.f;
} | /*-------------------------------------------------
device_get_info_fct - return a function
pointer state value from an allocated device
-------------------------------------------------*/ | return a function
pointer state value from an allocated device | [
"return",
"a",
"function",
"pointer",
"state",
"value",
"from",
"an",
"allocated",
"device"
] | genf *device_get_info_fct(const device_config *device, UINT32 state)
{
deviceinfo info;
assert(device != NULL);
assert(device->type != NULL);
assert(state >= DEVINFO_FCT_FIRST && state <= DEVINFO_FCT_LAST);
info.f = 0;
(*device->type)(device, state, &info);
return info.f;
} | [
"genf",
"*",
"device_get_info_fct",
"(",
"const",
"device_config",
"*",
"device",
",",
"UINT32",
"state",
")",
"{",
"deviceinfo",
"info",
";",
"assert",
"(",
"device",
"!=",
"NULL",
")",
";",
"assert",
"(",
"device",
"->",
"type",
"!=",
"NULL",
")",
";",
"assert",
"(",
"state",
">=",
"DEVINFO_FCT_FIRST",
"&&",
"state",
"<=",
"DEVINFO_FCT_LAST",
")",
";",
"info",
".",
"f",
"=",
"0",
";",
"(",
"*",
"device",
"->",
"type",
")",
"(",
"device",
",",
"state",
",",
"&",
"info",
")",
";",
"return",
"info",
".",
"f",
";",
"}"
] | device_get_info_fct - return a function
pointer state value from an allocated device | [
"device_get_info_fct",
"-",
"return",
"a",
"function",
"pointer",
"state",
"value",
"from",
"an",
"allocated",
"device"
] | [
"/* retrieve the value */"
] | [
{
"param": "device",
"type": "device_config"
},
{
"param": "state",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | device_get_info_string | char | const char *device_get_info_string(const device_config *device, UINT32 state)
{
deviceinfo info;
assert(device != NULL);
assert(device->type != NULL);
assert(state >= DEVINFO_STR_FIRST && state <= DEVINFO_STR_LAST);
/* retrieve the value */
info.s = get_temp_string_buffer();
(*device->type)(device, state, &info);
if (info.s[0] == 0)
set_default_string(state, info.s);
return info.s;
} | /*-------------------------------------------------
device_get_info_string - return a string value
from an allocated device
-------------------------------------------------*/ | return a string value
from an allocated device | [
"return",
"a",
"string",
"value",
"from",
"an",
"allocated",
"device"
] | const char *device_get_info_string(const device_config *device, UINT32 state)
{
deviceinfo info;
assert(device != NULL);
assert(device->type != NULL);
assert(state >= DEVINFO_STR_FIRST && state <= DEVINFO_STR_LAST);
info.s = get_temp_string_buffer();
(*device->type)(device, state, &info);
if (info.s[0] == 0)
set_default_string(state, info.s);
return info.s;
} | [
"const",
"char",
"*",
"device_get_info_string",
"(",
"const",
"device_config",
"*",
"device",
",",
"UINT32",
"state",
")",
"{",
"deviceinfo",
"info",
";",
"assert",
"(",
"device",
"!=",
"NULL",
")",
";",
"assert",
"(",
"device",
"->",
"type",
"!=",
"NULL",
")",
";",
"assert",
"(",
"state",
">=",
"DEVINFO_STR_FIRST",
"&&",
"state",
"<=",
"DEVINFO_STR_LAST",
")",
";",
"info",
".",
"s",
"=",
"get_temp_string_buffer",
"(",
")",
";",
"(",
"*",
"device",
"->",
"type",
")",
"(",
"device",
",",
"state",
",",
"&",
"info",
")",
";",
"if",
"(",
"info",
".",
"s",
"[",
"0",
"]",
"==",
"0",
")",
"set_default_string",
"(",
"state",
",",
"info",
".",
"s",
")",
";",
"return",
"info",
".",
"s",
";",
"}"
] | device_get_info_string - return a string value
from an allocated device | [
"device_get_info_string",
"-",
"return",
"a",
"string",
"value",
"from",
"an",
"allocated",
"device"
] | [
"/* retrieve the value */"
] | [
{
"param": "device",
"type": "device_config"
},
{
"param": "state",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | devtype_get_info_int | INT64 | INT64 devtype_get_info_int(device_type type, UINT32 state)
{
deviceinfo info;
assert(type != NULL);
assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
/* retrieve the value */
info.i = 0;
(*type)(NULL, state, &info);
return info.i;
} | /*-------------------------------------------------
devtype_get_info_int - return an integer value
from a device type (does not need to be
allocated)
-------------------------------------------------*/ | return an integer value
from a device type (does not need to be
allocated) | [
"return",
"an",
"integer",
"value",
"from",
"a",
"device",
"type",
"(",
"does",
"not",
"need",
"to",
"be",
"allocated",
")"
] | INT64 devtype_get_info_int(device_type type, UINT32 state)
{
deviceinfo info;
assert(type != NULL);
assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
info.i = 0;
(*type)(NULL, state, &info);
return info.i;
} | [
"INT64",
"devtype_get_info_int",
"(",
"device_type",
"type",
",",
"UINT32",
"state",
")",
"{",
"deviceinfo",
"info",
";",
"assert",
"(",
"type",
"!=",
"NULL",
")",
";",
"assert",
"(",
"state",
">=",
"DEVINFO_INT_FIRST",
"&&",
"state",
"<=",
"DEVINFO_INT_LAST",
")",
";",
"info",
".",
"i",
"=",
"0",
";",
"(",
"*",
"type",
")",
"(",
"NULL",
",",
"state",
",",
"&",
"info",
")",
";",
"return",
"info",
".",
"i",
";",
"}"
] | devtype_get_info_int - return an integer value
from a device type (does not need to be
allocated) | [
"devtype_get_info_int",
"-",
"return",
"an",
"integer",
"value",
"from",
"a",
"device",
"type",
"(",
"does",
"not",
"need",
"to",
"be",
"allocated",
")"
] | [
"/* retrieve the value */"
] | [
{
"param": "type",
"type": "device_type"
},
{
"param": "state",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "device_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | devtype_get_info_fct | genf | genf *devtype_get_info_fct(device_type type, UINT32 state)
{
deviceinfo info;
assert(type != NULL);
assert(state >= DEVINFO_FCT_FIRST && state <= DEVINFO_FCT_LAST);
/* retrieve the value */
info.f = 0;
(*type)(NULL, state, &info);
return info.f;
} | /*-------------------------------------------------
devtype_get_info_int - return a function
pointer from a device type (does not need to
be allocated)
-------------------------------------------------*/ | return a function
pointer from a device type (does not need to
be allocated) | [
"return",
"a",
"function",
"pointer",
"from",
"a",
"device",
"type",
"(",
"does",
"not",
"need",
"to",
"be",
"allocated",
")"
] | genf *devtype_get_info_fct(device_type type, UINT32 state)
{
deviceinfo info;
assert(type != NULL);
assert(state >= DEVINFO_FCT_FIRST && state <= DEVINFO_FCT_LAST);
info.f = 0;
(*type)(NULL, state, &info);
return info.f;
} | [
"genf",
"*",
"devtype_get_info_fct",
"(",
"device_type",
"type",
",",
"UINT32",
"state",
")",
"{",
"deviceinfo",
"info",
";",
"assert",
"(",
"type",
"!=",
"NULL",
")",
";",
"assert",
"(",
"state",
">=",
"DEVINFO_FCT_FIRST",
"&&",
"state",
"<=",
"DEVINFO_FCT_LAST",
")",
";",
"info",
".",
"f",
"=",
"0",
";",
"(",
"*",
"type",
")",
"(",
"NULL",
",",
"state",
",",
"&",
"info",
")",
";",
"return",
"info",
".",
"f",
";",
"}"
] | devtype_get_info_int - return a function
pointer from a device type (does not need to
be allocated) | [
"devtype_get_info_int",
"-",
"return",
"a",
"function",
"pointer",
"from",
"a",
"device",
"type",
"(",
"does",
"not",
"need",
"to",
"be",
"allocated",
")"
] | [
"/* retrieve the value */"
] | [
{
"param": "type",
"type": "device_type"
},
{
"param": "state",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "device_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6b91e13e4f708e14bde6810a6d29f0c8cbc8fd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/devintrf.c | [
"Unlicense"
] | C | devtype_get_info_string | char | const char *devtype_get_info_string(device_type type, UINT32 state)
{
deviceinfo info;
assert(type != NULL);
assert(state >= DEVINFO_STR_FIRST && state <= DEVINFO_STR_LAST);
/* retrieve the value */
info.s = get_temp_string_buffer();
(*type)(NULL, state, &info);
if (info.s[0] == 0)
set_default_string(state, info.s);
return info.s;
} | /*-------------------------------------------------
devtype_get_info_string - return a string value
from a device type (does not need to be
allocated)
-------------------------------------------------*/ | return a string value
from a device type (does not need to be
allocated) | [
"return",
"a",
"string",
"value",
"from",
"a",
"device",
"type",
"(",
"does",
"not",
"need",
"to",
"be",
"allocated",
")"
] | const char *devtype_get_info_string(device_type type, UINT32 state)
{
deviceinfo info;
assert(type != NULL);
assert(state >= DEVINFO_STR_FIRST && state <= DEVINFO_STR_LAST);
info.s = get_temp_string_buffer();
(*type)(NULL, state, &info);
if (info.s[0] == 0)
set_default_string(state, info.s);
return info.s;
} | [
"const",
"char",
"*",
"devtype_get_info_string",
"(",
"device_type",
"type",
",",
"UINT32",
"state",
")",
"{",
"deviceinfo",
"info",
";",
"assert",
"(",
"type",
"!=",
"NULL",
")",
";",
"assert",
"(",
"state",
">=",
"DEVINFO_STR_FIRST",
"&&",
"state",
"<=",
"DEVINFO_STR_LAST",
")",
";",
"info",
".",
"s",
"=",
"get_temp_string_buffer",
"(",
")",
";",
"(",
"*",
"type",
")",
"(",
"NULL",
",",
"state",
",",
"&",
"info",
")",
";",
"if",
"(",
"info",
".",
"s",
"[",
"0",
"]",
"==",
"0",
")",
"set_default_string",
"(",
"state",
",",
"info",
".",
"s",
")",
";",
"return",
"info",
".",
"s",
";",
"}"
] | devtype_get_info_string - return a string value
from a device type (does not need to be
allocated) | [
"devtype_get_info_string",
"-",
"return",
"a",
"string",
"value",
"from",
"a",
"device",
"type",
"(",
"does",
"not",
"need",
"to",
"be",
"allocated",
")"
] | [
"/* retrieve the value */"
] | [
{
"param": "type",
"type": "device_type"
},
{
"param": "state",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "device_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c8af8bc95db122bdfa470b690a705852736cb4ce | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/sound/msm5205.c | [
"Unlicense"
] | C | msm5205_vclk_w | void | void msm5205_vclk_w (const device_config *device, int vclk)
{
msm5205_state *voice = get_safe_token(device);
if( voice->prescaler != 0 )
{
logerror("error: msm5205_vclk_w() called with chip = '%s', but VCLK selected master mode\n", device->tag);
}
else
{
if( voice->vclk != vclk)
{
voice->vclk = vclk;
if( !vclk ) MSM5205_vclk_callback(voice->device->machine, voice, 0);
}
}
} | /*
* Handle an update of the vclk status of a chip (1 is reset ON, 0 is reset OFF)
* This function can use selector = MSM5205_SEX only
*/ | Handle an update of the vclk status of a chip (1 is reset ON, 0 is reset OFF)
This function can use selector = MSM5205_SEX only | [
"Handle",
"an",
"update",
"of",
"the",
"vclk",
"status",
"of",
"a",
"chip",
"(",
"1",
"is",
"reset",
"ON",
"0",
"is",
"reset",
"OFF",
")",
"This",
"function",
"can",
"use",
"selector",
"=",
"MSM5205_SEX",
"only"
] | void msm5205_vclk_w (const device_config *device, int vclk)
{
msm5205_state *voice = get_safe_token(device);
if( voice->prescaler != 0 )
{
logerror("error: msm5205_vclk_w() called with chip = '%s', but VCLK selected master mode\n", device->tag);
}
else
{
if( voice->vclk != vclk)
{
voice->vclk = vclk;
if( !vclk ) MSM5205_vclk_callback(voice->device->machine, voice, 0);
}
}
} | [
"void",
"msm5205_vclk_w",
"(",
"const",
"device_config",
"*",
"device",
",",
"int",
"vclk",
")",
"{",
"msm5205_state",
"*",
"voice",
"=",
"get_safe_token",
"(",
"device",
")",
";",
"if",
"(",
"voice",
"->",
"prescaler",
"!=",
"0",
")",
"{",
"logerror",
"(",
"\"",
"\\n",
"\"",
",",
"device",
"->",
"tag",
")",
";",
"}",
"else",
"{",
"if",
"(",
"voice",
"->",
"vclk",
"!=",
"vclk",
")",
"{",
"voice",
"->",
"vclk",
"=",
"vclk",
";",
"if",
"(",
"!",
"vclk",
")",
"MSM5205_vclk_callback",
"(",
"voice",
"->",
"device",
"->",
"machine",
",",
"voice",
",",
"0",
")",
";",
"}",
"}",
"}"
] | Handle an update of the vclk status of a chip (1 is reset ON, 0 is reset OFF)
This function can use selector = MSM5205_SEX only | [
"Handle",
"an",
"update",
"of",
"the",
"vclk",
"status",
"of",
"a",
"chip",
"(",
"1",
"is",
"reset",
"ON",
"0",
"is",
"reset",
"OFF",
")",
"This",
"function",
"can",
"use",
"selector",
"=",
"MSM5205_SEX",
"only"
] | [] | [
{
"param": "device",
"type": "device_config"
},
{
"param": "vclk",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vclk",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c8af8bc95db122bdfa470b690a705852736cb4ce | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/sound/msm5205.c | [
"Unlicense"
] | C | msm5205_reset_w | void | void msm5205_reset_w (const device_config *device, int reset)
{
msm5205_state *voice = get_safe_token(device);
voice->reset = reset;
} | /*
* Handle an update of the reset status of a chip (1 is reset ON, 0 is reset OFF)
*/ | Handle an update of the reset status of a chip (1 is reset ON, 0 is reset OFF) | [
"Handle",
"an",
"update",
"of",
"the",
"reset",
"status",
"of",
"a",
"chip",
"(",
"1",
"is",
"reset",
"ON",
"0",
"is",
"reset",
"OFF",
")"
] | void msm5205_reset_w (const device_config *device, int reset)
{
msm5205_state *voice = get_safe_token(device);
voice->reset = reset;
} | [
"void",
"msm5205_reset_w",
"(",
"const",
"device_config",
"*",
"device",
",",
"int",
"reset",
")",
"{",
"msm5205_state",
"*",
"voice",
"=",
"get_safe_token",
"(",
"device",
")",
";",
"voice",
"->",
"reset",
"=",
"reset",
";",
"}"
] | Handle an update of the reset status of a chip (1 is reset ON, 0 is reset OFF) | [
"Handle",
"an",
"update",
"of",
"the",
"reset",
"status",
"of",
"a",
"chip",
"(",
"1",
"is",
"reset",
"ON",
"0",
"is",
"reset",
"OFF",
")"
] | [] | [
{
"param": "device",
"type": "device_config"
},
{
"param": "reset",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reset",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c8af8bc95db122bdfa470b690a705852736cb4ce | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/sound/msm5205.c | [
"Unlicense"
] | C | msm5205_data_w | void | void msm5205_data_w (const device_config *device, int data)
{
msm5205_state *voice = get_safe_token(device);
if( voice->bitwidth == 4)
voice->data = data & 0x0f;
else
voice->data = (data & 0x07)<<1; /* unknown */
} | /*
* Handle an update of the data to the chip
*/ | Handle an update of the data to the chip | [
"Handle",
"an",
"update",
"of",
"the",
"data",
"to",
"the",
"chip"
] | void msm5205_data_w (const device_config *device, int data)
{
msm5205_state *voice = get_safe_token(device);
if( voice->bitwidth == 4)
voice->data = data & 0x0f;
else
voice->data = (data & 0x07)<<1;
} | [
"void",
"msm5205_data_w",
"(",
"const",
"device_config",
"*",
"device",
",",
"int",
"data",
")",
"{",
"msm5205_state",
"*",
"voice",
"=",
"get_safe_token",
"(",
"device",
")",
";",
"if",
"(",
"voice",
"->",
"bitwidth",
"==",
"4",
")",
"voice",
"->",
"data",
"=",
"data",
"&",
"0x0f",
";",
"else",
"voice",
"->",
"data",
"=",
"(",
"data",
"&",
"0x07",
")",
"<<",
"1",
";",
"}"
] | Handle an update of the data to the chip | [
"Handle",
"an",
"update",
"of",
"the",
"data",
"to",
"the",
"chip"
] | [
"/* unknown */"
] | [
{
"param": "device",
"type": "device_config"
},
{
"param": "data",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c8af8bc95db122bdfa470b690a705852736cb4ce | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/sound/msm5205.c | [
"Unlicense"
] | C | msm5205_playmode_w | void | void msm5205_playmode_w(const device_config *device, int select)
{
msm5205_state *voice = get_safe_token(device);
msm5205_playmode(voice,select);
} | /*
* Handle an change of the selector
*/ | Handle an change of the selector | [
"Handle",
"an",
"change",
"of",
"the",
"selector"
] | void msm5205_playmode_w(const device_config *device, int select)
{
msm5205_state *voice = get_safe_token(device);
msm5205_playmode(voice,select);
} | [
"void",
"msm5205_playmode_w",
"(",
"const",
"device_config",
"*",
"device",
",",
"int",
"select",
")",
"{",
"msm5205_state",
"*",
"voice",
"=",
"get_safe_token",
"(",
"device",
")",
";",
"msm5205_playmode",
"(",
"voice",
",",
"select",
")",
";",
"}"
] | Handle an change of the selector | [
"Handle",
"an",
"change",
"of",
"the",
"selector"
] | [] | [
{
"param": "device",
"type": "device_config"
},
{
"param": "select",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "select",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | cheat_init | void | void cheat_init(running_machine *machine)
{
cheat_private *cheatinfo;
/* request a callback */
add_frame_callback(machine, cheat_frame);
add_exit_callback(machine, cheat_exit);
/* allocate memory */
cheatinfo = auto_alloc_clear(machine, cheat_private);
machine->cheat_data = cheatinfo;
/* load the cheats */
cheat_reload(machine);
/* we rely on the debugger expression callbacks; if the debugger isn't
enabled, we must jumpstart them manually */
if ((machine->debug_flags & DEBUG_FLAG_ENABLED) == 0)
debug_cpu_init(machine);
} | /*-------------------------------------------------
cheat_init - initialize the cheat engine,
loading the cheat file
-------------------------------------------------*/ | initialize the cheat engine,
loading the cheat file | [
"initialize",
"the",
"cheat",
"engine",
"loading",
"the",
"cheat",
"file"
] | void cheat_init(running_machine *machine)
{
cheat_private *cheatinfo;
add_frame_callback(machine, cheat_frame);
add_exit_callback(machine, cheat_exit);
cheatinfo = auto_alloc_clear(machine, cheat_private);
machine->cheat_data = cheatinfo;
cheat_reload(machine);
if ((machine->debug_flags & DEBUG_FLAG_ENABLED) == 0)
debug_cpu_init(machine);
} | [
"void",
"cheat_init",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"cheat_private",
"*",
"cheatinfo",
";",
"add_frame_callback",
"(",
"machine",
",",
"cheat_frame",
")",
";",
"add_exit_callback",
"(",
"machine",
",",
"cheat_exit",
")",
";",
"cheatinfo",
"=",
"auto_alloc_clear",
"(",
"machine",
",",
"cheat_private",
")",
";",
"machine",
"->",
"cheat_data",
"=",
"cheatinfo",
";",
"cheat_reload",
"(",
"machine",
")",
";",
"if",
"(",
"(",
"machine",
"->",
"debug_flags",
"&",
"DEBUG_FLAG_ENABLED",
")",
"==",
"0",
")",
"debug_cpu_init",
"(",
"machine",
")",
";",
"}"
] | cheat_init - initialize the cheat engine,
loading the cheat file | [
"cheat_init",
"-",
"initialize",
"the",
"cheat",
"engine",
"loading",
"the",
"cheat",
"file"
] | [
"/* request a callback */",
"/* allocate memory */",
"/* load the cheats */",
"/* we rely on the debugger expression callbacks; if the debugger isn't\n enabled, we must jumpstart them manually */"
] | [
{
"param": "machine",
"type": "running_machine"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | cheat_reload | void | void cheat_reload(running_machine *machine)
{
cheat_private *cheatinfo = machine->cheat_data;
/* free everything */
cheat_exit(machine);
/* reset our memory */
memset(cheatinfo, 0, sizeof(*cheatinfo));
/* load the cheat file, MESS will load a crc32.xml ( eg. 01234567.xml )
and MAME will load gamename.xml */
#ifdef MESS
{
char mess_cheat_filename[9];
cheat_mess_init(machine);
sprintf(mess_cheat_filename, "%08X", this_game_crc);
cheatinfo->cheatlist = cheat_list_load(machine, mess_cheat_filename);
}
#else
cheatinfo->cheatlist = cheat_list_load(machine, machine->basename);
#endif
/* temporary: save the file back out as output.xml for comparison */
if (cheatinfo->cheatlist != NULL)
cheat_list_save("output", cheatinfo->cheatlist);
} | /*-------------------------------------------------
cheat_reload - re-initialize the cheat engine,
and reload the cheat file(s)
-------------------------------------------------*/ | re-initialize the cheat engine,
and reload the cheat file(s) | [
"re",
"-",
"initialize",
"the",
"cheat",
"engine",
"and",
"reload",
"the",
"cheat",
"file",
"(",
"s",
")"
] | void cheat_reload(running_machine *machine)
{
cheat_private *cheatinfo = machine->cheat_data;
cheat_exit(machine);
memset(cheatinfo, 0, sizeof(*cheatinfo));
#ifdef MESS
{
char mess_cheat_filename[9];
cheat_mess_init(machine);
sprintf(mess_cheat_filename, "%08X", this_game_crc);
cheatinfo->cheatlist = cheat_list_load(machine, mess_cheat_filename);
}
#else
cheatinfo->cheatlist = cheat_list_load(machine, machine->basename);
#endif
if (cheatinfo->cheatlist != NULL)
cheat_list_save("output", cheatinfo->cheatlist);
} | [
"void",
"cheat_reload",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"cheat_private",
"*",
"cheatinfo",
"=",
"machine",
"->",
"cheat_data",
";",
"cheat_exit",
"(",
"machine",
")",
";",
"memset",
"(",
"cheatinfo",
",",
"0",
",",
"sizeof",
"(",
"*",
"cheatinfo",
")",
")",
";",
"#ifdef",
"MESS",
"{",
"char",
"mess_cheat_filename",
"[",
"9",
"]",
";",
"cheat_mess_init",
"(",
"machine",
")",
";",
"sprintf",
"(",
"mess_cheat_filename",
",",
"\"",
"\"",
",",
"this_game_crc",
")",
";",
"cheatinfo",
"->",
"cheatlist",
"=",
"cheat_list_load",
"(",
"machine",
",",
"mess_cheat_filename",
")",
";",
"}",
"#else",
"cheatinfo",
"->",
"cheatlist",
"=",
"cheat_list_load",
"(",
"machine",
",",
"machine",
"->",
"basename",
")",
";",
"#endif",
"if",
"(",
"cheatinfo",
"->",
"cheatlist",
"!=",
"NULL",
")",
"cheat_list_save",
"(",
"\"",
"\"",
",",
"cheatinfo",
"->",
"cheatlist",
")",
";",
"}"
] | cheat_reload - re-initialize the cheat engine,
and reload the cheat file(s) | [
"cheat_reload",
"-",
"re",
"-",
"initialize",
"the",
"cheat",
"engine",
"and",
"reload",
"the",
"cheat",
"file",
"(",
"s",
")"
] | [
"/* free everything */",
"/* reset our memory */",
"/* load the cheat file, MESS will load a crc32.xml ( eg. 01234567.xml )\n and MAME will load gamename.xml */",
"/* temporary: save the file back out as output.xml for comparison */"
] | [
{
"param": "machine",
"type": "running_machine"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | cheat_exit | void | static void cheat_exit(running_machine *machine)
{
cheat_private *cheatinfo = machine->cheat_data;
int linenum;
/* free the list of cheats */
if (cheatinfo->cheatlist != NULL)
cheat_list_free(cheatinfo->cheatlist);
/* free any text strings */
for (linenum = 0; linenum < ARRAY_LENGTH(cheatinfo->output); linenum++)
if (cheatinfo->output[linenum] != NULL)
astring_free(cheatinfo->output[linenum]);
} | /*-------------------------------------------------
cheat_exit - clean up on the way out
-------------------------------------------------*/ | clean up on the way out | [
"clean",
"up",
"on",
"the",
"way",
"out"
] | static void cheat_exit(running_machine *machine)
{
cheat_private *cheatinfo = machine->cheat_data;
int linenum;
if (cheatinfo->cheatlist != NULL)
cheat_list_free(cheatinfo->cheatlist);
for (linenum = 0; linenum < ARRAY_LENGTH(cheatinfo->output); linenum++)
if (cheatinfo->output[linenum] != NULL)
astring_free(cheatinfo->output[linenum]);
} | [
"static",
"void",
"cheat_exit",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"cheat_private",
"*",
"cheatinfo",
"=",
"machine",
"->",
"cheat_data",
";",
"int",
"linenum",
";",
"if",
"(",
"cheatinfo",
"->",
"cheatlist",
"!=",
"NULL",
")",
"cheat_list_free",
"(",
"cheatinfo",
"->",
"cheatlist",
")",
";",
"for",
"(",
"linenum",
"=",
"0",
";",
"linenum",
"<",
"ARRAY_LENGTH",
"(",
"cheatinfo",
"->",
"output",
")",
";",
"linenum",
"++",
")",
"if",
"(",
"cheatinfo",
"->",
"output",
"[",
"linenum",
"]",
"!=",
"NULL",
")",
"astring_free",
"(",
"cheatinfo",
"->",
"output",
"[",
"linenum",
"]",
")",
";",
"}"
] | cheat_exit - clean up on the way out | [
"cheat_exit",
"-",
"clean",
"up",
"on",
"the",
"way",
"out"
] | [
"/* free the list of cheats */",
"/* free any text strings */"
] | [
{
"param": "machine",
"type": "running_machine"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | cheat_get_global_enable | int | int cheat_get_global_enable(running_machine *machine)
{
cheat_private *cheatinfo = machine->cheat_data;
return !cheatinfo->disabled;
} | /*-------------------------------------------------
cheat_get_global_enable - return the global
enabled state of the cheat engine
-------------------------------------------------*/ | return the global
enabled state of the cheat engine | [
"return",
"the",
"global",
"enabled",
"state",
"of",
"the",
"cheat",
"engine"
] | int cheat_get_global_enable(running_machine *machine)
{
cheat_private *cheatinfo = machine->cheat_data;
return !cheatinfo->disabled;
} | [
"int",
"cheat_get_global_enable",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"cheat_private",
"*",
"cheatinfo",
"=",
"machine",
"->",
"cheat_data",
";",
"return",
"!",
"cheatinfo",
"->",
"disabled",
";",
"}"
] | cheat_get_global_enable - return the global
enabled state of the cheat engine | [
"cheat_get_global_enable",
"-",
"return",
"the",
"global",
"enabled",
"state",
"of",
"the",
"cheat",
"engine"
] | [] | [
{
"param": "machine",
"type": "running_machine"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | cheat_set_global_enable | void | void cheat_set_global_enable(running_machine *machine, int enable)
{
cheat_private *cheatinfo = machine->cheat_data;
cheat_entry *cheat;
/* if we're enabled currently and we don't want to be, turn things off */
if (!cheatinfo->disabled && !enable)
{
/* iterate over running cheats and execute any OFF Scripts */
for (cheat = cheatinfo->cheatlist; cheat != NULL; cheat = cheat->next)
if (cheat->state == SCRIPT_STATE_RUN)
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_OFF);
popmessage("Cheats Disabled");
cheatinfo->disabled = TRUE;
}
/* if we're disabled currently and we want to be enabled, turn things on */
else if (cheatinfo->disabled && enable)
{
/* iterate over running cheats and execute any ON Scripts */
cheatinfo->disabled = FALSE;
for (cheat = cheatinfo->cheatlist; cheat != NULL; cheat = cheat->next)
if (cheat->state == SCRIPT_STATE_RUN)
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_ON);
popmessage("Cheats Enabled");
}
} | /*-------------------------------------------------
cheat_set_global_enable - globally enable or
disable the cheat engine
-------------------------------------------------*/ | globally enable or
disable the cheat engine | [
"globally",
"enable",
"or",
"disable",
"the",
"cheat",
"engine"
] | void cheat_set_global_enable(running_machine *machine, int enable)
{
cheat_private *cheatinfo = machine->cheat_data;
cheat_entry *cheat;
if (!cheatinfo->disabled && !enable)
{
for (cheat = cheatinfo->cheatlist; cheat != NULL; cheat = cheat->next)
if (cheat->state == SCRIPT_STATE_RUN)
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_OFF);
popmessage("Cheats Disabled");
cheatinfo->disabled = TRUE;
}
else if (cheatinfo->disabled && enable)
{
cheatinfo->disabled = FALSE;
for (cheat = cheatinfo->cheatlist; cheat != NULL; cheat = cheat->next)
if (cheat->state == SCRIPT_STATE_RUN)
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_ON);
popmessage("Cheats Enabled");
}
} | [
"void",
"cheat_set_global_enable",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"enable",
")",
"{",
"cheat_private",
"*",
"cheatinfo",
"=",
"machine",
"->",
"cheat_data",
";",
"cheat_entry",
"*",
"cheat",
";",
"if",
"(",
"!",
"cheatinfo",
"->",
"disabled",
"&&",
"!",
"enable",
")",
"{",
"for",
"(",
"cheat",
"=",
"cheatinfo",
"->",
"cheatlist",
";",
"cheat",
"!=",
"NULL",
";",
"cheat",
"=",
"cheat",
"->",
"next",
")",
"if",
"(",
"cheat",
"->",
"state",
"==",
"SCRIPT_STATE_RUN",
")",
"cheat_execute_script",
"(",
"cheatinfo",
",",
"cheat",
",",
"SCRIPT_STATE_OFF",
")",
";",
"popmessage",
"(",
"\"",
"\"",
")",
";",
"cheatinfo",
"->",
"disabled",
"=",
"TRUE",
";",
"}",
"else",
"if",
"(",
"cheatinfo",
"->",
"disabled",
"&&",
"enable",
")",
"{",
"cheatinfo",
"->",
"disabled",
"=",
"FALSE",
";",
"for",
"(",
"cheat",
"=",
"cheatinfo",
"->",
"cheatlist",
";",
"cheat",
"!=",
"NULL",
";",
"cheat",
"=",
"cheat",
"->",
"next",
")",
"if",
"(",
"cheat",
"->",
"state",
"==",
"SCRIPT_STATE_RUN",
")",
"cheat_execute_script",
"(",
"cheatinfo",
",",
"cheat",
",",
"SCRIPT_STATE_ON",
")",
";",
"popmessage",
"(",
"\"",
"\"",
")",
";",
"}",
"}"
] | cheat_set_global_enable - globally enable or
disable the cheat engine | [
"cheat_set_global_enable",
"-",
"globally",
"enable",
"or",
"disable",
"the",
"cheat",
"engine"
] | [
"/* if we're enabled currently and we don't want to be, turn things off */",
"/* iterate over running cheats and execute any OFF Scripts */",
"/* if we're disabled currently and we want to be enabled, turn things on */",
"/* iterate over running cheats and execute any ON Scripts */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "enable",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "enable",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | cheat_render_text | void | void cheat_render_text(running_machine *machine)
{
cheat_private *cheatinfo = machine->cheat_data;
if (cheatinfo != NULL)
{
int linenum;
/* render any text and free it along the way */
for (linenum = 0; linenum < ARRAY_LENGTH(cheatinfo->output); linenum++)
if (cheatinfo->output[linenum] != NULL)
{
/* output the text */
ui_draw_text_full(astring_c(cheatinfo->output[linenum]),
0.0f, (float)linenum * ui_get_line_height(), 1.0f,
cheatinfo->justify[linenum], WRAP_NEVER, DRAW_OPAQUE,
ARGB_WHITE, ARGB_BLACK, NULL, NULL);
}
}
} | /*-------------------------------------------------
cheat_render_text - called by the UI system
to render text
-------------------------------------------------*/ | called by the UI system
to render text | [
"called",
"by",
"the",
"UI",
"system",
"to",
"render",
"text"
] | void cheat_render_text(running_machine *machine)
{
cheat_private *cheatinfo = machine->cheat_data;
if (cheatinfo != NULL)
{
int linenum;
for (linenum = 0; linenum < ARRAY_LENGTH(cheatinfo->output); linenum++)
if (cheatinfo->output[linenum] != NULL)
{
ui_draw_text_full(astring_c(cheatinfo->output[linenum]),
0.0f, (float)linenum * ui_get_line_height(), 1.0f,
cheatinfo->justify[linenum], WRAP_NEVER, DRAW_OPAQUE,
ARGB_WHITE, ARGB_BLACK, NULL, NULL);
}
}
} | [
"void",
"cheat_render_text",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"cheat_private",
"*",
"cheatinfo",
"=",
"machine",
"->",
"cheat_data",
";",
"if",
"(",
"cheatinfo",
"!=",
"NULL",
")",
"{",
"int",
"linenum",
";",
"for",
"(",
"linenum",
"=",
"0",
";",
"linenum",
"<",
"ARRAY_LENGTH",
"(",
"cheatinfo",
"->",
"output",
")",
";",
"linenum",
"++",
")",
"if",
"(",
"cheatinfo",
"->",
"output",
"[",
"linenum",
"]",
"!=",
"NULL",
")",
"{",
"ui_draw_text_full",
"(",
"astring_c",
"(",
"cheatinfo",
"->",
"output",
"[",
"linenum",
"]",
")",
",",
"0.0f",
",",
"(",
"float",
")",
"linenum",
"*",
"ui_get_line_height",
"(",
")",
",",
"1.0f",
",",
"cheatinfo",
"->",
"justify",
"[",
"linenum",
"]",
",",
"WRAP_NEVER",
",",
"DRAW_OPAQUE",
",",
"ARGB_WHITE",
",",
"ARGB_BLACK",
",",
"NULL",
",",
"NULL",
")",
";",
"}",
"}",
"}"
] | cheat_render_text - called by the UI system
to render text | [
"cheat_render_text",
"-",
"called",
"by",
"the",
"UI",
"system",
"to",
"render",
"text"
] | [
"/* render any text and free it along the way */",
"/* output the text */"
] | [
{
"param": "machine",
"type": "running_machine"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | cheat_get_next_menu_entry | void | void *cheat_get_next_menu_entry(running_machine *machine, void *previous, const char **description, const char **state, UINT32 *flags)
{
cheat_private *cheatinfo = machine->cheat_data;
cheat_entry *preventry = (cheat_entry *)previous;
cheat_entry *cheat;
/* NULL previous means get the first */
cheat = (preventry == NULL) ? cheatinfo->cheatlist : preventry->next;
if (cheat == NULL)
return NULL;
/* description is standard */
if (description != NULL)
*description = astring_c(cheat->description);
/* some cheat entries are just text for display */
if (is_text_only_cheat(cheat))
{
if (description != NULL)
{
while (isspace((UINT8)**description))
*description += 1;
if (**description == 0)
*description = MENU_SEPARATOR_ITEM;
}
if (state != NULL)
*state = NULL;
if (flags != NULL)
*flags = MENU_FLAG_DISABLE;
}
/* if we have no parameter and no run or off script, it's a oneshot cheat */
else if (is_oneshot_cheat(cheat))
{
if (state != NULL)
*state = "Set";
if (flags != NULL)
*flags = 0;
}
/* if we have no parameter, it's just on/off */
else if (is_onoff_cheat(cheat))
{
if (state != NULL)
*state = (cheat->state == SCRIPT_STATE_RUN) ? "On" : "Off";
if (flags != NULL)
*flags = cheat->state ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW;
}
/* if we have a value parameter, compute it */
else if (is_value_parameter_cheat(cheat))
{
if (cheat->state == SCRIPT_STATE_OFF)
{
if (state != NULL)
*state = is_oneshot_parameter_cheat(cheat) ? "Set" : "Off";
if (flags != NULL)
*flags = MENU_FLAG_RIGHT_ARROW;
}
else
{
if (state != NULL)
{
sprintf(cheat->parameter->valuestring, "%d", (UINT32)cheat->parameter->value);
*state = cheat->parameter->valuestring;
}
if (flags != NULL)
{
*flags = MENU_FLAG_LEFT_ARROW;
if (cheat->parameter->value < cheat->parameter->maxval)
*flags |= MENU_FLAG_RIGHT_ARROW;
}
}
}
/* if we have an item list, pick the index */
else if (is_itemlist_parameter_cheat(cheat))
{
if (cheat->state == SCRIPT_STATE_OFF)
{
if (state != NULL)
*state = is_oneshot_parameter_cheat(cheat) ? "Set" : "Off";
if (flags != NULL)
*flags = MENU_FLAG_RIGHT_ARROW;
}
else
{
parameter_item *item = NULL, *prev = NULL;
for (item = cheat->parameter->itemlist; item != NULL; prev = item, item = item->next)
if (item->value == cheat->parameter->value)
break;
if (state != NULL)
*state = (item != NULL) ? astring_c(item->text) : "??Invalid??";
if (flags != NULL)
{
*flags = MENU_FLAG_LEFT_ARROW;
if (item == NULL || item->next != NULL)
*flags |= MENU_FLAG_RIGHT_ARROW;
cheat->parameter->itemlist->curtext = item->text; /* Take a copy of the most current parameter for the popmessage (if used) */
}
}
}
/* return a pointer to this item */
return cheat;
} | /*-------------------------------------------------
cheat_get_next_menu_entry - return the
text needed to display this cheat in a menu
item
-------------------------------------------------*/ | return the
text needed to display this cheat in a menu
item | [
"return",
"the",
"text",
"needed",
"to",
"display",
"this",
"cheat",
"in",
"a",
"menu",
"item"
] | void *cheat_get_next_menu_entry(running_machine *machine, void *previous, const char **description, const char **state, UINT32 *flags)
{
cheat_private *cheatinfo = machine->cheat_data;
cheat_entry *preventry = (cheat_entry *)previous;
cheat_entry *cheat;
cheat = (preventry == NULL) ? cheatinfo->cheatlist : preventry->next;
if (cheat == NULL)
return NULL;
if (description != NULL)
*description = astring_c(cheat->description);
if (is_text_only_cheat(cheat))
{
if (description != NULL)
{
while (isspace((UINT8)**description))
*description += 1;
if (**description == 0)
*description = MENU_SEPARATOR_ITEM;
}
if (state != NULL)
*state = NULL;
if (flags != NULL)
*flags = MENU_FLAG_DISABLE;
}
else if (is_oneshot_cheat(cheat))
{
if (state != NULL)
*state = "Set";
if (flags != NULL)
*flags = 0;
}
else if (is_onoff_cheat(cheat))
{
if (state != NULL)
*state = (cheat->state == SCRIPT_STATE_RUN) ? "On" : "Off";
if (flags != NULL)
*flags = cheat->state ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW;
}
else if (is_value_parameter_cheat(cheat))
{
if (cheat->state == SCRIPT_STATE_OFF)
{
if (state != NULL)
*state = is_oneshot_parameter_cheat(cheat) ? "Set" : "Off";
if (flags != NULL)
*flags = MENU_FLAG_RIGHT_ARROW;
}
else
{
if (state != NULL)
{
sprintf(cheat->parameter->valuestring, "%d", (UINT32)cheat->parameter->value);
*state = cheat->parameter->valuestring;
}
if (flags != NULL)
{
*flags = MENU_FLAG_LEFT_ARROW;
if (cheat->parameter->value < cheat->parameter->maxval)
*flags |= MENU_FLAG_RIGHT_ARROW;
}
}
}
else if (is_itemlist_parameter_cheat(cheat))
{
if (cheat->state == SCRIPT_STATE_OFF)
{
if (state != NULL)
*state = is_oneshot_parameter_cheat(cheat) ? "Set" : "Off";
if (flags != NULL)
*flags = MENU_FLAG_RIGHT_ARROW;
}
else
{
parameter_item *item = NULL, *prev = NULL;
for (item = cheat->parameter->itemlist; item != NULL; prev = item, item = item->next)
if (item->value == cheat->parameter->value)
break;
if (state != NULL)
*state = (item != NULL) ? astring_c(item->text) : "??Invalid??";
if (flags != NULL)
{
*flags = MENU_FLAG_LEFT_ARROW;
if (item == NULL || item->next != NULL)
*flags |= MENU_FLAG_RIGHT_ARROW;
cheat->parameter->itemlist->curtext = item->text;
}
}
}
return cheat;
} | [
"void",
"*",
"cheat_get_next_menu_entry",
"(",
"running_machine",
"*",
"machine",
",",
"void",
"*",
"previous",
",",
"const",
"char",
"*",
"*",
"description",
",",
"const",
"char",
"*",
"*",
"state",
",",
"UINT32",
"*",
"flags",
")",
"{",
"cheat_private",
"*",
"cheatinfo",
"=",
"machine",
"->",
"cheat_data",
";",
"cheat_entry",
"*",
"preventry",
"=",
"(",
"cheat_entry",
"*",
")",
"previous",
";",
"cheat_entry",
"*",
"cheat",
";",
"cheat",
"=",
"(",
"preventry",
"==",
"NULL",
")",
"?",
"cheatinfo",
"->",
"cheatlist",
":",
"preventry",
"->",
"next",
";",
"if",
"(",
"cheat",
"==",
"NULL",
")",
"return",
"NULL",
";",
"if",
"(",
"description",
"!=",
"NULL",
")",
"*",
"description",
"=",
"astring_c",
"(",
"cheat",
"->",
"description",
")",
";",
"if",
"(",
"is_text_only_cheat",
"(",
"cheat",
")",
")",
"{",
"if",
"(",
"description",
"!=",
"NULL",
")",
"{",
"while",
"(",
"isspace",
"(",
"(",
"UINT8",
")",
"*",
"*",
"description",
")",
")",
"*",
"description",
"+=",
"1",
";",
"if",
"(",
"*",
"*",
"description",
"==",
"0",
")",
"*",
"description",
"=",
"MENU_SEPARATOR_ITEM",
";",
"}",
"if",
"(",
"state",
"!=",
"NULL",
")",
"*",
"state",
"=",
"NULL",
";",
"if",
"(",
"flags",
"!=",
"NULL",
")",
"*",
"flags",
"=",
"MENU_FLAG_DISABLE",
";",
"}",
"else",
"if",
"(",
"is_oneshot_cheat",
"(",
"cheat",
")",
")",
"{",
"if",
"(",
"state",
"!=",
"NULL",
")",
"*",
"state",
"=",
"\"",
"\"",
";",
"if",
"(",
"flags",
"!=",
"NULL",
")",
"*",
"flags",
"=",
"0",
";",
"}",
"else",
"if",
"(",
"is_onoff_cheat",
"(",
"cheat",
")",
")",
"{",
"if",
"(",
"state",
"!=",
"NULL",
")",
"*",
"state",
"=",
"(",
"cheat",
"->",
"state",
"==",
"SCRIPT_STATE_RUN",
")",
"?",
"\"",
"\"",
":",
"\"",
"\"",
";",
"if",
"(",
"flags",
"!=",
"NULL",
")",
"*",
"flags",
"=",
"cheat",
"->",
"state",
"?",
"MENU_FLAG_LEFT_ARROW",
":",
"MENU_FLAG_RIGHT_ARROW",
";",
"}",
"else",
"if",
"(",
"is_value_parameter_cheat",
"(",
"cheat",
")",
")",
"{",
"if",
"(",
"cheat",
"->",
"state",
"==",
"SCRIPT_STATE_OFF",
")",
"{",
"if",
"(",
"state",
"!=",
"NULL",
")",
"*",
"state",
"=",
"is_oneshot_parameter_cheat",
"(",
"cheat",
")",
"?",
"\"",
"\"",
":",
"\"",
"\"",
";",
"if",
"(",
"flags",
"!=",
"NULL",
")",
"*",
"flags",
"=",
"MENU_FLAG_RIGHT_ARROW",
";",
"}",
"else",
"{",
"if",
"(",
"state",
"!=",
"NULL",
")",
"{",
"sprintf",
"(",
"cheat",
"->",
"parameter",
"->",
"valuestring",
",",
"\"",
"\"",
",",
"(",
"UINT32",
")",
"cheat",
"->",
"parameter",
"->",
"value",
")",
";",
"*",
"state",
"=",
"cheat",
"->",
"parameter",
"->",
"valuestring",
";",
"}",
"if",
"(",
"flags",
"!=",
"NULL",
")",
"{",
"*",
"flags",
"=",
"MENU_FLAG_LEFT_ARROW",
";",
"if",
"(",
"cheat",
"->",
"parameter",
"->",
"value",
"<",
"cheat",
"->",
"parameter",
"->",
"maxval",
")",
"*",
"flags",
"|=",
"MENU_FLAG_RIGHT_ARROW",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"is_itemlist_parameter_cheat",
"(",
"cheat",
")",
")",
"{",
"if",
"(",
"cheat",
"->",
"state",
"==",
"SCRIPT_STATE_OFF",
")",
"{",
"if",
"(",
"state",
"!=",
"NULL",
")",
"*",
"state",
"=",
"is_oneshot_parameter_cheat",
"(",
"cheat",
")",
"?",
"\"",
"\"",
":",
"\"",
"\"",
";",
"if",
"(",
"flags",
"!=",
"NULL",
")",
"*",
"flags",
"=",
"MENU_FLAG_RIGHT_ARROW",
";",
"}",
"else",
"{",
"parameter_item",
"*",
"item",
"=",
"NULL",
",",
"*",
"prev",
"=",
"NULL",
";",
"for",
"(",
"item",
"=",
"cheat",
"->",
"parameter",
"->",
"itemlist",
";",
"item",
"!=",
"NULL",
";",
"prev",
"=",
"item",
",",
"item",
"=",
"item",
"->",
"next",
")",
"if",
"(",
"item",
"->",
"value",
"==",
"cheat",
"->",
"parameter",
"->",
"value",
")",
"break",
";",
"if",
"(",
"state",
"!=",
"NULL",
")",
"*",
"state",
"=",
"(",
"item",
"!=",
"NULL",
")",
"?",
"astring_c",
"(",
"item",
"->",
"text",
")",
":",
"\"",
"\"",
";",
"if",
"(",
"flags",
"!=",
"NULL",
")",
"{",
"*",
"flags",
"=",
"MENU_FLAG_LEFT_ARROW",
";",
"if",
"(",
"item",
"==",
"NULL",
"||",
"item",
"->",
"next",
"!=",
"NULL",
")",
"*",
"flags",
"|=",
"MENU_FLAG_RIGHT_ARROW",
";",
"cheat",
"->",
"parameter",
"->",
"itemlist",
"->",
"curtext",
"=",
"item",
"->",
"text",
";",
"}",
"}",
"}",
"return",
"cheat",
";",
"}"
] | cheat_get_next_menu_entry - return the
text needed to display this cheat in a menu
item | [
"cheat_get_next_menu_entry",
"-",
"return",
"the",
"text",
"needed",
"to",
"display",
"this",
"cheat",
"in",
"a",
"menu",
"item"
] | [
"/* NULL previous means get the first */",
"/* description is standard */",
"/* some cheat entries are just text for display */",
"/* if we have no parameter and no run or off script, it's a oneshot cheat */",
"/* if we have no parameter, it's just on/off */",
"/* if we have a value parameter, compute it */",
"/* if we have an item list, pick the index */",
"/* Take a copy of the most current parameter for the popmessage (if used) */",
"/* return a pointer to this item */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "previous",
"type": "void"
},
{
"param": "description",
"type": "char"
},
{
"param": "state",
"type": "char"
},
{
"param": "flags",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "previous",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "description",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | cheat_select_default_state | int | int cheat_select_default_state(running_machine *machine, void *entry)
{
cheat_private *cheatinfo = machine->cheat_data;
cheat_entry *cheat = (cheat_entry *)entry;
int changed = FALSE;
/* if we have no parameter and no run or off script, it's either text or a oneshot cheat */
if (is_oneshot_cheat(cheat))
;
/* if we have no parameter, it's just on/off; default to off */
else
{
if (cheat->state != SCRIPT_STATE_OFF)
{
cheat->state = SCRIPT_STATE_OFF;
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_OFF);
changed = TRUE;
}
}
return changed;
} | /*-------------------------------------------------
cheat_select_default_state - select the
default state for a cheat, or activate a
oneshot cheat
-------------------------------------------------*/ | select the
default state for a cheat, or activate a
oneshot cheat | [
"select",
"the",
"default",
"state",
"for",
"a",
"cheat",
"or",
"activate",
"a",
"oneshot",
"cheat"
] | int cheat_select_default_state(running_machine *machine, void *entry)
{
cheat_private *cheatinfo = machine->cheat_data;
cheat_entry *cheat = (cheat_entry *)entry;
int changed = FALSE;
if (is_oneshot_cheat(cheat))
;
else
{
if (cheat->state != SCRIPT_STATE_OFF)
{
cheat->state = SCRIPT_STATE_OFF;
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_OFF);
changed = TRUE;
}
}
return changed;
} | [
"int",
"cheat_select_default_state",
"(",
"running_machine",
"*",
"machine",
",",
"void",
"*",
"entry",
")",
"{",
"cheat_private",
"*",
"cheatinfo",
"=",
"machine",
"->",
"cheat_data",
";",
"cheat_entry",
"*",
"cheat",
"=",
"(",
"cheat_entry",
"*",
")",
"entry",
";",
"int",
"changed",
"=",
"FALSE",
";",
"if",
"(",
"is_oneshot_cheat",
"(",
"cheat",
")",
")",
";",
"else",
"{",
"if",
"(",
"cheat",
"->",
"state",
"!=",
"SCRIPT_STATE_OFF",
")",
"{",
"cheat",
"->",
"state",
"=",
"SCRIPT_STATE_OFF",
";",
"cheat_execute_script",
"(",
"cheatinfo",
",",
"cheat",
",",
"SCRIPT_STATE_OFF",
")",
";",
"changed",
"=",
"TRUE",
";",
"}",
"}",
"return",
"changed",
";",
"}"
] | cheat_select_default_state - select the
default state for a cheat, or activate a
oneshot cheat | [
"cheat_select_default_state",
"-",
"select",
"the",
"default",
"state",
"for",
"a",
"cheat",
"or",
"activate",
"a",
"oneshot",
"cheat"
] | [
"/* if we have no parameter and no run or off script, it's either text or a oneshot cheat */",
"/* if we have no parameter, it's just on/off; default to off */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "entry",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entry",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | cheat_select_previous_state | int | int cheat_select_previous_state(running_machine *machine, void *entry)
{
cheat_private *cheatinfo = machine->cheat_data;
cheat_entry *cheat = (cheat_entry *)entry;
int changed = FALSE;
/* if we have no parameter and no run or off script, it's either text or a oneshot cheat */
if (is_oneshot_cheat(cheat))
;
/* if we have no parameter, it's just on/off */
else if (is_onoff_cheat(cheat))
{
if (cheat->state != SCRIPT_STATE_OFF)
{
cheat->state = SCRIPT_STATE_OFF;
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_OFF);
changed = TRUE;
}
}
/* if we have a value parameter, compute it */
else if (is_value_parameter_cheat(cheat))
{
if (cheat->parameter->value > cheat->parameter->minval)
{
if (cheat->parameter->value < cheat->parameter->minval + cheat->parameter->stepval)
cheat->parameter->value = cheat->parameter->minval;
else
cheat->parameter->value -= cheat->parameter->stepval;
if (!is_oneshot_parameter_cheat(cheat))
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_CHANGE);
changed = TRUE;
}
else if (cheat->state != SCRIPT_STATE_OFF)
{
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_OFF);
cheat->state = SCRIPT_STATE_OFF;
changed = TRUE;
}
}
/* if we have an item list, pick the index */
else
{
parameter_item *item, *prev = NULL;
for (item = cheat->parameter->itemlist; item != NULL; prev = item, item = item->next)
if (item->value == cheat->parameter->value)
break;
if (prev != NULL)
{
if (cheat->state == SCRIPT_STATE_OFF)
{
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_ON);
cheat->state = SCRIPT_STATE_RUN;
}
cheat->parameter->value = prev->value;
if (!is_oneshot_parameter_cheat(cheat))
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_CHANGE);
changed = TRUE;
}
else if (cheat->state != SCRIPT_STATE_OFF)
{
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_OFF);
cheat->state = SCRIPT_STATE_OFF;
changed = TRUE;
}
}
return changed;
} | /*-------------------------------------------------
cheat_select_previous_state - select the
previous state for a cheat
-------------------------------------------------*/ | select the
previous state for a cheat | [
"select",
"the",
"previous",
"state",
"for",
"a",
"cheat"
] | int cheat_select_previous_state(running_machine *machine, void *entry)
{
cheat_private *cheatinfo = machine->cheat_data;
cheat_entry *cheat = (cheat_entry *)entry;
int changed = FALSE;
if (is_oneshot_cheat(cheat))
;
else if (is_onoff_cheat(cheat))
{
if (cheat->state != SCRIPT_STATE_OFF)
{
cheat->state = SCRIPT_STATE_OFF;
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_OFF);
changed = TRUE;
}
}
else if (is_value_parameter_cheat(cheat))
{
if (cheat->parameter->value > cheat->parameter->minval)
{
if (cheat->parameter->value < cheat->parameter->minval + cheat->parameter->stepval)
cheat->parameter->value = cheat->parameter->minval;
else
cheat->parameter->value -= cheat->parameter->stepval;
if (!is_oneshot_parameter_cheat(cheat))
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_CHANGE);
changed = TRUE;
}
else if (cheat->state != SCRIPT_STATE_OFF)
{
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_OFF);
cheat->state = SCRIPT_STATE_OFF;
changed = TRUE;
}
}
else
{
parameter_item *item, *prev = NULL;
for (item = cheat->parameter->itemlist; item != NULL; prev = item, item = item->next)
if (item->value == cheat->parameter->value)
break;
if (prev != NULL)
{
if (cheat->state == SCRIPT_STATE_OFF)
{
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_ON);
cheat->state = SCRIPT_STATE_RUN;
}
cheat->parameter->value = prev->value;
if (!is_oneshot_parameter_cheat(cheat))
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_CHANGE);
changed = TRUE;
}
else if (cheat->state != SCRIPT_STATE_OFF)
{
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_OFF);
cheat->state = SCRIPT_STATE_OFF;
changed = TRUE;
}
}
return changed;
} | [
"int",
"cheat_select_previous_state",
"(",
"running_machine",
"*",
"machine",
",",
"void",
"*",
"entry",
")",
"{",
"cheat_private",
"*",
"cheatinfo",
"=",
"machine",
"->",
"cheat_data",
";",
"cheat_entry",
"*",
"cheat",
"=",
"(",
"cheat_entry",
"*",
")",
"entry",
";",
"int",
"changed",
"=",
"FALSE",
";",
"if",
"(",
"is_oneshot_cheat",
"(",
"cheat",
")",
")",
";",
"else",
"if",
"(",
"is_onoff_cheat",
"(",
"cheat",
")",
")",
"{",
"if",
"(",
"cheat",
"->",
"state",
"!=",
"SCRIPT_STATE_OFF",
")",
"{",
"cheat",
"->",
"state",
"=",
"SCRIPT_STATE_OFF",
";",
"cheat_execute_script",
"(",
"cheatinfo",
",",
"cheat",
",",
"SCRIPT_STATE_OFF",
")",
";",
"changed",
"=",
"TRUE",
";",
"}",
"}",
"else",
"if",
"(",
"is_value_parameter_cheat",
"(",
"cheat",
")",
")",
"{",
"if",
"(",
"cheat",
"->",
"parameter",
"->",
"value",
">",
"cheat",
"->",
"parameter",
"->",
"minval",
")",
"{",
"if",
"(",
"cheat",
"->",
"parameter",
"->",
"value",
"<",
"cheat",
"->",
"parameter",
"->",
"minval",
"+",
"cheat",
"->",
"parameter",
"->",
"stepval",
")",
"cheat",
"->",
"parameter",
"->",
"value",
"=",
"cheat",
"->",
"parameter",
"->",
"minval",
";",
"else",
"cheat",
"->",
"parameter",
"->",
"value",
"-=",
"cheat",
"->",
"parameter",
"->",
"stepval",
";",
"if",
"(",
"!",
"is_oneshot_parameter_cheat",
"(",
"cheat",
")",
")",
"cheat_execute_script",
"(",
"cheatinfo",
",",
"cheat",
",",
"SCRIPT_STATE_CHANGE",
")",
";",
"changed",
"=",
"TRUE",
";",
"}",
"else",
"if",
"(",
"cheat",
"->",
"state",
"!=",
"SCRIPT_STATE_OFF",
")",
"{",
"cheat_execute_script",
"(",
"cheatinfo",
",",
"cheat",
",",
"SCRIPT_STATE_OFF",
")",
";",
"cheat",
"->",
"state",
"=",
"SCRIPT_STATE_OFF",
";",
"changed",
"=",
"TRUE",
";",
"}",
"}",
"else",
"{",
"parameter_item",
"*",
"item",
",",
"*",
"prev",
"=",
"NULL",
";",
"for",
"(",
"item",
"=",
"cheat",
"->",
"parameter",
"->",
"itemlist",
";",
"item",
"!=",
"NULL",
";",
"prev",
"=",
"item",
",",
"item",
"=",
"item",
"->",
"next",
")",
"if",
"(",
"item",
"->",
"value",
"==",
"cheat",
"->",
"parameter",
"->",
"value",
")",
"break",
";",
"if",
"(",
"prev",
"!=",
"NULL",
")",
"{",
"if",
"(",
"cheat",
"->",
"state",
"==",
"SCRIPT_STATE_OFF",
")",
"{",
"cheat_execute_script",
"(",
"cheatinfo",
",",
"cheat",
",",
"SCRIPT_STATE_ON",
")",
";",
"cheat",
"->",
"state",
"=",
"SCRIPT_STATE_RUN",
";",
"}",
"cheat",
"->",
"parameter",
"->",
"value",
"=",
"prev",
"->",
"value",
";",
"if",
"(",
"!",
"is_oneshot_parameter_cheat",
"(",
"cheat",
")",
")",
"cheat_execute_script",
"(",
"cheatinfo",
",",
"cheat",
",",
"SCRIPT_STATE_CHANGE",
")",
";",
"changed",
"=",
"TRUE",
";",
"}",
"else",
"if",
"(",
"cheat",
"->",
"state",
"!=",
"SCRIPT_STATE_OFF",
")",
"{",
"cheat_execute_script",
"(",
"cheatinfo",
",",
"cheat",
",",
"SCRIPT_STATE_OFF",
")",
";",
"cheat",
"->",
"state",
"=",
"SCRIPT_STATE_OFF",
";",
"changed",
"=",
"TRUE",
";",
"}",
"}",
"return",
"changed",
";",
"}"
] | cheat_select_previous_state - select the
previous state for a cheat | [
"cheat_select_previous_state",
"-",
"select",
"the",
"previous",
"state",
"for",
"a",
"cheat"
] | [
"/* if we have no parameter and no run or off script, it's either text or a oneshot cheat */",
"/* if we have no parameter, it's just on/off */",
"/* if we have a value parameter, compute it */",
"/* if we have an item list, pick the index */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "entry",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entry",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | cheat_select_next_state | int | int cheat_select_next_state(running_machine *machine, void *entry)
{
cheat_private *cheatinfo = machine->cheat_data;
cheat_entry *cheat = (cheat_entry *)entry;
int changed = FALSE;
/* if we have no parameter and no run or off script, it's a oneshot cheat */
if (is_oneshot_cheat(cheat))
;
/* if we have no parameter, it's just on/off */
else if (is_onoff_cheat(cheat))
{
if (cheat->state != SCRIPT_STATE_RUN)
{
cheat->state = SCRIPT_STATE_RUN;
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_ON);
changed = TRUE;
}
}
/* if we have a value parameter, compute it */
else if (is_value_parameter_cheat(cheat))
{
if (cheat->state == SCRIPT_STATE_OFF)
{
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_ON);
cheat->state = SCRIPT_STATE_RUN;
cheat->parameter->value = cheat->parameter->minval;
if (!is_oneshot_parameter_cheat(cheat))
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_CHANGE);
changed = TRUE;
}
else if (cheat->parameter->value < cheat->parameter->maxval)
{
if (cheat->parameter->value > cheat->parameter->maxval - cheat->parameter->stepval)
cheat->parameter->value = cheat->parameter->maxval;
else
cheat->parameter->value += cheat->parameter->stepval;
if (!is_oneshot_parameter_cheat(cheat))
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_CHANGE);
changed = TRUE;
}
}
/* if we have an item list, pick the index */
else
{
parameter_item *item;
if (cheat->state == SCRIPT_STATE_OFF)
{
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_ON);
cheat->state = SCRIPT_STATE_RUN;
cheat->parameter->value = cheat->parameter->itemlist->value;
if (!is_oneshot_parameter_cheat(cheat))
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_CHANGE);
changed = TRUE;
}
else
{
for (item = cheat->parameter->itemlist; item != NULL; item = item->next)
if (item->value == cheat->parameter->value)
break;
if (item->next != NULL)
{
cheat->parameter->value = item->next->value;
if (!is_oneshot_parameter_cheat(cheat))
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_CHANGE);
changed = TRUE;
}
}
}
return changed;
} | /*-------------------------------------------------
cheat_select_next_state - select the
next state for a cheat
-------------------------------------------------*/ | select the
next state for a cheat | [
"select",
"the",
"next",
"state",
"for",
"a",
"cheat"
] | int cheat_select_next_state(running_machine *machine, void *entry)
{
cheat_private *cheatinfo = machine->cheat_data;
cheat_entry *cheat = (cheat_entry *)entry;
int changed = FALSE;
if (is_oneshot_cheat(cheat))
;
else if (is_onoff_cheat(cheat))
{
if (cheat->state != SCRIPT_STATE_RUN)
{
cheat->state = SCRIPT_STATE_RUN;
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_ON);
changed = TRUE;
}
}
else if (is_value_parameter_cheat(cheat))
{
if (cheat->state == SCRIPT_STATE_OFF)
{
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_ON);
cheat->state = SCRIPT_STATE_RUN;
cheat->parameter->value = cheat->parameter->minval;
if (!is_oneshot_parameter_cheat(cheat))
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_CHANGE);
changed = TRUE;
}
else if (cheat->parameter->value < cheat->parameter->maxval)
{
if (cheat->parameter->value > cheat->parameter->maxval - cheat->parameter->stepval)
cheat->parameter->value = cheat->parameter->maxval;
else
cheat->parameter->value += cheat->parameter->stepval;
if (!is_oneshot_parameter_cheat(cheat))
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_CHANGE);
changed = TRUE;
}
}
else
{
parameter_item *item;
if (cheat->state == SCRIPT_STATE_OFF)
{
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_ON);
cheat->state = SCRIPT_STATE_RUN;
cheat->parameter->value = cheat->parameter->itemlist->value;
if (!is_oneshot_parameter_cheat(cheat))
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_CHANGE);
changed = TRUE;
}
else
{
for (item = cheat->parameter->itemlist; item != NULL; item = item->next)
if (item->value == cheat->parameter->value)
break;
if (item->next != NULL)
{
cheat->parameter->value = item->next->value;
if (!is_oneshot_parameter_cheat(cheat))
cheat_execute_script(cheatinfo, cheat, SCRIPT_STATE_CHANGE);
changed = TRUE;
}
}
}
return changed;
} | [
"int",
"cheat_select_next_state",
"(",
"running_machine",
"*",
"machine",
",",
"void",
"*",
"entry",
")",
"{",
"cheat_private",
"*",
"cheatinfo",
"=",
"machine",
"->",
"cheat_data",
";",
"cheat_entry",
"*",
"cheat",
"=",
"(",
"cheat_entry",
"*",
")",
"entry",
";",
"int",
"changed",
"=",
"FALSE",
";",
"if",
"(",
"is_oneshot_cheat",
"(",
"cheat",
")",
")",
";",
"else",
"if",
"(",
"is_onoff_cheat",
"(",
"cheat",
")",
")",
"{",
"if",
"(",
"cheat",
"->",
"state",
"!=",
"SCRIPT_STATE_RUN",
")",
"{",
"cheat",
"->",
"state",
"=",
"SCRIPT_STATE_RUN",
";",
"cheat_execute_script",
"(",
"cheatinfo",
",",
"cheat",
",",
"SCRIPT_STATE_ON",
")",
";",
"changed",
"=",
"TRUE",
";",
"}",
"}",
"else",
"if",
"(",
"is_value_parameter_cheat",
"(",
"cheat",
")",
")",
"{",
"if",
"(",
"cheat",
"->",
"state",
"==",
"SCRIPT_STATE_OFF",
")",
"{",
"cheat_execute_script",
"(",
"cheatinfo",
",",
"cheat",
",",
"SCRIPT_STATE_ON",
")",
";",
"cheat",
"->",
"state",
"=",
"SCRIPT_STATE_RUN",
";",
"cheat",
"->",
"parameter",
"->",
"value",
"=",
"cheat",
"->",
"parameter",
"->",
"minval",
";",
"if",
"(",
"!",
"is_oneshot_parameter_cheat",
"(",
"cheat",
")",
")",
"cheat_execute_script",
"(",
"cheatinfo",
",",
"cheat",
",",
"SCRIPT_STATE_CHANGE",
")",
";",
"changed",
"=",
"TRUE",
";",
"}",
"else",
"if",
"(",
"cheat",
"->",
"parameter",
"->",
"value",
"<",
"cheat",
"->",
"parameter",
"->",
"maxval",
")",
"{",
"if",
"(",
"cheat",
"->",
"parameter",
"->",
"value",
">",
"cheat",
"->",
"parameter",
"->",
"maxval",
"-",
"cheat",
"->",
"parameter",
"->",
"stepval",
")",
"cheat",
"->",
"parameter",
"->",
"value",
"=",
"cheat",
"->",
"parameter",
"->",
"maxval",
";",
"else",
"cheat",
"->",
"parameter",
"->",
"value",
"+=",
"cheat",
"->",
"parameter",
"->",
"stepval",
";",
"if",
"(",
"!",
"is_oneshot_parameter_cheat",
"(",
"cheat",
")",
")",
"cheat_execute_script",
"(",
"cheatinfo",
",",
"cheat",
",",
"SCRIPT_STATE_CHANGE",
")",
";",
"changed",
"=",
"TRUE",
";",
"}",
"}",
"else",
"{",
"parameter_item",
"*",
"item",
";",
"if",
"(",
"cheat",
"->",
"state",
"==",
"SCRIPT_STATE_OFF",
")",
"{",
"cheat_execute_script",
"(",
"cheatinfo",
",",
"cheat",
",",
"SCRIPT_STATE_ON",
")",
";",
"cheat",
"->",
"state",
"=",
"SCRIPT_STATE_RUN",
";",
"cheat",
"->",
"parameter",
"->",
"value",
"=",
"cheat",
"->",
"parameter",
"->",
"itemlist",
"->",
"value",
";",
"if",
"(",
"!",
"is_oneshot_parameter_cheat",
"(",
"cheat",
")",
")",
"cheat_execute_script",
"(",
"cheatinfo",
",",
"cheat",
",",
"SCRIPT_STATE_CHANGE",
")",
";",
"changed",
"=",
"TRUE",
";",
"}",
"else",
"{",
"for",
"(",
"item",
"=",
"cheat",
"->",
"parameter",
"->",
"itemlist",
";",
"item",
"!=",
"NULL",
";",
"item",
"=",
"item",
"->",
"next",
")",
"if",
"(",
"item",
"->",
"value",
"==",
"cheat",
"->",
"parameter",
"->",
"value",
")",
"break",
";",
"if",
"(",
"item",
"->",
"next",
"!=",
"NULL",
")",
"{",
"cheat",
"->",
"parameter",
"->",
"value",
"=",
"item",
"->",
"next",
"->",
"value",
";",
"if",
"(",
"!",
"is_oneshot_parameter_cheat",
"(",
"cheat",
")",
")",
"cheat_execute_script",
"(",
"cheatinfo",
",",
"cheat",
",",
"SCRIPT_STATE_CHANGE",
")",
";",
"changed",
"=",
"TRUE",
";",
"}",
"}",
"}",
"return",
"changed",
";",
"}"
] | cheat_select_next_state - select the
next state for a cheat | [
"cheat_select_next_state",
"-",
"select",
"the",
"next",
"state",
"for",
"a",
"cheat"
] | [
"/* if we have no parameter and no run or off script, it's a oneshot cheat */",
"/* if we have no parameter, it's just on/off */",
"/* if we have a value parameter, compute it */",
"/* if we have an item list, pick the index */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "entry",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entry",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | cheat_get_comment | astring | astring *cheat_get_comment(void *entry)
{
cheat_entry *cheat = (cheat_entry *)entry;
return cheat->comment;
} | /*-------------------------------------------------
cheat_get_comment - called by the UI system
to help render displayable comments
-------------------------------------------------*/ | called by the UI system
to help render displayable comments | [
"called",
"by",
"the",
"UI",
"system",
"to",
"help",
"render",
"displayable",
"comments"
] | astring *cheat_get_comment(void *entry)
{
cheat_entry *cheat = (cheat_entry *)entry;
return cheat->comment;
} | [
"astring",
"*",
"cheat_get_comment",
"(",
"void",
"*",
"entry",
")",
"{",
"cheat_entry",
"*",
"cheat",
"=",
"(",
"cheat_entry",
"*",
")",
"entry",
";",
"return",
"cheat",
"->",
"comment",
";",
"}"
] | cheat_get_comment - called by the UI system
to help render displayable comments | [
"cheat_get_comment",
"-",
"called",
"by",
"the",
"UI",
"system",
"to",
"help",
"render",
"displayable",
"comments"
] | [] | [
{
"param": "entry",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "entry",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | cheat_list_load | cheat_entry | static cheat_entry *cheat_list_load(running_machine *machine, const char *filename)
{
xml_data_node *rootnode = NULL;
cheat_entry *cheatlist = NULL;
cheat_entry **cheattailptr = &cheatlist;
mame_file *cheatfile = NULL;
file_error filerr;
astring *fname;
/* open the file with the proper name */
fname = astring_assemble_2(astring_alloc(), filename, ".xml");
filerr = mame_fopen(SEARCHPATH_CHEAT, astring_c(fname), OPEN_FLAG_READ, &cheatfile);
/* loop over all instrances of the files found in our search paths */
while (filerr == FILERR_NONE)
{
xml_data_node *mamecheatnode, *cheatnode;
xml_parse_options options;
xml_parse_error error;
cheat_entry *scannode;
int version;
mame_printf_verbose("Loading cheats file from %s\n", mame_file_full_name(cheatfile));
/* read the XML file into internal data structures */
memset(&options, 0, sizeof(options));
options.error = &error;
rootnode = xml_file_read(mame_core_file(cheatfile), &options);
/* if unable to parse the file, just bail */
if (rootnode == NULL)
{
mame_printf_error("%s.xml(%d): error parsing XML (%s)\n", filename, error.error_line, error.error_message);
goto error;
}
/* find the layout node */
mamecheatnode = xml_get_sibling(rootnode->child, "mamecheat");
if (mamecheatnode == NULL)
{
mame_printf_error("%s.xml: missing mamecheatnode node", filename);
goto error;
}
/* validate the config data version */
version = xml_get_attribute_int(mamecheatnode, "version", 0);
if (version != CHEAT_VERSION)
{
mame_printf_error("%s.xml(%d): Invalid cheat XML file: unsupported version", filename, mamecheatnode->line);
goto error;
}
/* parse all the elements */
for (cheatnode = xml_get_sibling(mamecheatnode->child, "cheat"); cheatnode != NULL; cheatnode = xml_get_sibling(cheatnode->next, "cheat"))
{
/* load this entry */
cheat_entry *curcheat = cheat_entry_load(machine, filename, cheatnode);
if (curcheat == NULL)
goto error;
/* make sure we're not a duplicate */
scannode = NULL;
if (REMOVE_DUPLICATE_CHEATS)
for (scannode = cheatlist; scannode != NULL; scannode = scannode->next)
if (astring_cmp(scannode->description, curcheat->description) == 0)
{
mame_printf_verbose("Ignoring duplicate cheat '%s' from file %s\n", astring_c(curcheat->description), mame_file_full_name(cheatfile));
break;
}
/* add to the end of the list */
if (scannode == NULL)
{
*cheattailptr = curcheat;
cheattailptr = &curcheat->next;
}
}
/* free the file and loop for the next one */
xml_file_free(rootnode);
/* open the next file in sequence */
filerr = mame_fclose_and_open_next(&cheatfile, astring_c(fname), OPEN_FLAG_READ);
}
/* release memory and return the cheat list */
astring_free(fname);
return cheatlist;
error:
cheat_list_free(cheatlist);
xml_file_free(rootnode);
if (cheatfile != NULL)
mame_fclose(cheatfile);
astring_free(fname);
return NULL;
} | /*-------------------------------------------------
cheat_list_load - load a cheat file into
memory and create the cheat entry list
-------------------------------------------------*/ | load a cheat file into
memory and create the cheat entry list | [
"load",
"a",
"cheat",
"file",
"into",
"memory",
"and",
"create",
"the",
"cheat",
"entry",
"list"
] | static cheat_entry *cheat_list_load(running_machine *machine, const char *filename)
{
xml_data_node *rootnode = NULL;
cheat_entry *cheatlist = NULL;
cheat_entry **cheattailptr = &cheatlist;
mame_file *cheatfile = NULL;
file_error filerr;
astring *fname;
fname = astring_assemble_2(astring_alloc(), filename, ".xml");
filerr = mame_fopen(SEARCHPATH_CHEAT, astring_c(fname), OPEN_FLAG_READ, &cheatfile);
while (filerr == FILERR_NONE)
{
xml_data_node *mamecheatnode, *cheatnode;
xml_parse_options options;
xml_parse_error error;
cheat_entry *scannode;
int version;
mame_printf_verbose("Loading cheats file from %s\n", mame_file_full_name(cheatfile));
memset(&options, 0, sizeof(options));
options.error = &error;
rootnode = xml_file_read(mame_core_file(cheatfile), &options);
if (rootnode == NULL)
{
mame_printf_error("%s.xml(%d): error parsing XML (%s)\n", filename, error.error_line, error.error_message);
goto error;
}
mamecheatnode = xml_get_sibling(rootnode->child, "mamecheat");
if (mamecheatnode == NULL)
{
mame_printf_error("%s.xml: missing mamecheatnode node", filename);
goto error;
}
version = xml_get_attribute_int(mamecheatnode, "version", 0);
if (version != CHEAT_VERSION)
{
mame_printf_error("%s.xml(%d): Invalid cheat XML file: unsupported version", filename, mamecheatnode->line);
goto error;
}
for (cheatnode = xml_get_sibling(mamecheatnode->child, "cheat"); cheatnode != NULL; cheatnode = xml_get_sibling(cheatnode->next, "cheat"))
{
cheat_entry *curcheat = cheat_entry_load(machine, filename, cheatnode);
if (curcheat == NULL)
goto error;
scannode = NULL;
if (REMOVE_DUPLICATE_CHEATS)
for (scannode = cheatlist; scannode != NULL; scannode = scannode->next)
if (astring_cmp(scannode->description, curcheat->description) == 0)
{
mame_printf_verbose("Ignoring duplicate cheat '%s' from file %s\n", astring_c(curcheat->description), mame_file_full_name(cheatfile));
break;
}
if (scannode == NULL)
{
*cheattailptr = curcheat;
cheattailptr = &curcheat->next;
}
}
xml_file_free(rootnode);
filerr = mame_fclose_and_open_next(&cheatfile, astring_c(fname), OPEN_FLAG_READ);
}
astring_free(fname);
return cheatlist;
error:
cheat_list_free(cheatlist);
xml_file_free(rootnode);
if (cheatfile != NULL)
mame_fclose(cheatfile);
astring_free(fname);
return NULL;
} | [
"static",
"cheat_entry",
"*",
"cheat_list_load",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"filename",
")",
"{",
"xml_data_node",
"*",
"rootnode",
"=",
"NULL",
";",
"cheat_entry",
"*",
"cheatlist",
"=",
"NULL",
";",
"cheat_entry",
"*",
"*",
"cheattailptr",
"=",
"&",
"cheatlist",
";",
"mame_file",
"*",
"cheatfile",
"=",
"NULL",
";",
"file_error",
"filerr",
";",
"astring",
"*",
"fname",
";",
"fname",
"=",
"astring_assemble_2",
"(",
"astring_alloc",
"(",
")",
",",
"filename",
",",
"\"",
"\"",
")",
";",
"filerr",
"=",
"mame_fopen",
"(",
"SEARCHPATH_CHEAT",
",",
"astring_c",
"(",
"fname",
")",
",",
"OPEN_FLAG_READ",
",",
"&",
"cheatfile",
")",
";",
"while",
"(",
"filerr",
"==",
"FILERR_NONE",
")",
"{",
"xml_data_node",
"*",
"mamecheatnode",
",",
"*",
"cheatnode",
";",
"xml_parse_options",
"options",
";",
"xml_parse_error",
"error",
";",
"cheat_entry",
"*",
"scannode",
";",
"int",
"version",
";",
"mame_printf_verbose",
"(",
"\"",
"\\n",
"\"",
",",
"mame_file_full_name",
"(",
"cheatfile",
")",
")",
";",
"memset",
"(",
"&",
"options",
",",
"0",
",",
"sizeof",
"(",
"options",
")",
")",
";",
"options",
".",
"error",
"=",
"&",
"error",
";",
"rootnode",
"=",
"xml_file_read",
"(",
"mame_core_file",
"(",
"cheatfile",
")",
",",
"&",
"options",
")",
";",
"if",
"(",
"rootnode",
"==",
"NULL",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"filename",
",",
"error",
".",
"error_line",
",",
"error",
".",
"error_message",
")",
";",
"goto",
"error",
";",
"}",
"mamecheatnode",
"=",
"xml_get_sibling",
"(",
"rootnode",
"->",
"child",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"mamecheatnode",
"==",
"NULL",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\"",
",",
"filename",
")",
";",
"goto",
"error",
";",
"}",
"version",
"=",
"xml_get_attribute_int",
"(",
"mamecheatnode",
",",
"\"",
"\"",
",",
"0",
")",
";",
"if",
"(",
"version",
"!=",
"CHEAT_VERSION",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\"",
",",
"filename",
",",
"mamecheatnode",
"->",
"line",
")",
";",
"goto",
"error",
";",
"}",
"for",
"(",
"cheatnode",
"=",
"xml_get_sibling",
"(",
"mamecheatnode",
"->",
"child",
",",
"\"",
"\"",
")",
";",
"cheatnode",
"!=",
"NULL",
";",
"cheatnode",
"=",
"xml_get_sibling",
"(",
"cheatnode",
"->",
"next",
",",
"\"",
"\"",
")",
")",
"{",
"cheat_entry",
"*",
"curcheat",
"=",
"cheat_entry_load",
"(",
"machine",
",",
"filename",
",",
"cheatnode",
")",
";",
"if",
"(",
"curcheat",
"==",
"NULL",
")",
"goto",
"error",
";",
"scannode",
"=",
"NULL",
";",
"if",
"(",
"REMOVE_DUPLICATE_CHEATS",
")",
"for",
"(",
"scannode",
"=",
"cheatlist",
";",
"scannode",
"!=",
"NULL",
";",
"scannode",
"=",
"scannode",
"->",
"next",
")",
"if",
"(",
"astring_cmp",
"(",
"scannode",
"->",
"description",
",",
"curcheat",
"->",
"description",
")",
"==",
"0",
")",
"{",
"mame_printf_verbose",
"(",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"curcheat",
"->",
"description",
")",
",",
"mame_file_full_name",
"(",
"cheatfile",
")",
")",
";",
"break",
";",
"}",
"if",
"(",
"scannode",
"==",
"NULL",
")",
"{",
"*",
"cheattailptr",
"=",
"curcheat",
";",
"cheattailptr",
"=",
"&",
"curcheat",
"->",
"next",
";",
"}",
"}",
"xml_file_free",
"(",
"rootnode",
")",
";",
"filerr",
"=",
"mame_fclose_and_open_next",
"(",
"&",
"cheatfile",
",",
"astring_c",
"(",
"fname",
")",
",",
"OPEN_FLAG_READ",
")",
";",
"}",
"astring_free",
"(",
"fname",
")",
";",
"return",
"cheatlist",
";",
"error",
":",
"cheat_list_free",
"(",
"cheatlist",
")",
";",
"xml_file_free",
"(",
"rootnode",
")",
";",
"if",
"(",
"cheatfile",
"!=",
"NULL",
")",
"mame_fclose",
"(",
"cheatfile",
")",
";",
"astring_free",
"(",
"fname",
")",
";",
"return",
"NULL",
";",
"}"
] | cheat_list_load - load a cheat file into
memory and create the cheat entry list | [
"cheat_list_load",
"-",
"load",
"a",
"cheat",
"file",
"into",
"memory",
"and",
"create",
"the",
"cheat",
"entry",
"list"
] | [
"/* open the file with the proper name */",
"/* loop over all instrances of the files found in our search paths */",
"/* read the XML file into internal data structures */",
"/* if unable to parse the file, just bail */",
"/* find the layout node */",
"/* validate the config data version */",
"/* parse all the elements */",
"/* load this entry */",
"/* make sure we're not a duplicate */",
"/* add to the end of the list */",
"/* free the file and loop for the next one */",
"/* open the next file in sequence */",
"/* release memory and return the cheat list */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "filename",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | cheat_list_save | int | static int cheat_list_save(const char *filename, const cheat_entry *cheatlist)
{
mame_file *cheatfile;
file_error filerr;
astring *fname;
/* open the file with the proper name */
fname = astring_assemble_2(astring_alloc(), filename, ".xml");
filerr = mame_fopen(SEARCHPATH_CHEAT, astring_c(fname), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &cheatfile);
astring_free(fname);
/* if that failed, return nothing */
if (filerr != FILERR_NONE)
return FALSE;
/* output the outer layers */
mame_fprintf(cheatfile, "<?xml version=\"1.0\"?>\n");
mame_fprintf(cheatfile, "<!-- This file is autogenerated; comments and unknown tags will be stripped -->\n");
mame_fprintf(cheatfile, "<mamecheat version=\"%d\">\n", CHEAT_VERSION);
/* iterate over cheats in the list and save them */
for ( ; cheatlist != NULL; cheatlist = cheatlist->next)
cheat_entry_save(cheatfile, cheatlist);
/* close out the file */
mame_fprintf(cheatfile, "</mamecheat>\n");
mame_fclose(cheatfile);
return TRUE;
} | /*-------------------------------------------------
cheat_list_save - save a cheat file from
memory to the given filename
-------------------------------------------------*/ | save a cheat file from
memory to the given filename | [
"save",
"a",
"cheat",
"file",
"from",
"memory",
"to",
"the",
"given",
"filename"
] | static int cheat_list_save(const char *filename, const cheat_entry *cheatlist)
{
mame_file *cheatfile;
file_error filerr;
astring *fname;
fname = astring_assemble_2(astring_alloc(), filename, ".xml");
filerr = mame_fopen(SEARCHPATH_CHEAT, astring_c(fname), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &cheatfile);
astring_free(fname);
if (filerr != FILERR_NONE)
return FALSE;
mame_fprintf(cheatfile, "<?xml version=\"1.0\"?>\n");
mame_fprintf(cheatfile, "<!-- This file is autogenerated; comments and unknown tags will be stripped -->\n");
mame_fprintf(cheatfile, "<mamecheat version=\"%d\">\n", CHEAT_VERSION);
for ( ; cheatlist != NULL; cheatlist = cheatlist->next)
cheat_entry_save(cheatfile, cheatlist);
mame_fprintf(cheatfile, "</mamecheat>\n");
mame_fclose(cheatfile);
return TRUE;
} | [
"static",
"int",
"cheat_list_save",
"(",
"const",
"char",
"*",
"filename",
",",
"const",
"cheat_entry",
"*",
"cheatlist",
")",
"{",
"mame_file",
"*",
"cheatfile",
";",
"file_error",
"filerr",
";",
"astring",
"*",
"fname",
";",
"fname",
"=",
"astring_assemble_2",
"(",
"astring_alloc",
"(",
")",
",",
"filename",
",",
"\"",
"\"",
")",
";",
"filerr",
"=",
"mame_fopen",
"(",
"SEARCHPATH_CHEAT",
",",
"astring_c",
"(",
"fname",
")",
",",
"OPEN_FLAG_WRITE",
"|",
"OPEN_FLAG_CREATE",
"|",
"OPEN_FLAG_CREATE_PATHS",
",",
"&",
"cheatfile",
")",
";",
"astring_free",
"(",
"fname",
")",
";",
"if",
"(",
"filerr",
"!=",
"FILERR_NONE",
")",
"return",
"FALSE",
";",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
";",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\n",
"\"",
")",
";",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"CHEAT_VERSION",
")",
";",
"for",
"(",
";",
"cheatlist",
"!=",
"NULL",
";",
"cheatlist",
"=",
"cheatlist",
"->",
"next",
")",
"cheat_entry_save",
"(",
"cheatfile",
",",
"cheatlist",
")",
";",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\n",
"\"",
")",
";",
"mame_fclose",
"(",
"cheatfile",
")",
";",
"return",
"TRUE",
";",
"}"
] | cheat_list_save - save a cheat file from
memory to the given filename | [
"cheat_list_save",
"-",
"save",
"a",
"cheat",
"file",
"from",
"memory",
"to",
"the",
"given",
"filename"
] | [
"/* open the file with the proper name */",
"/* if that failed, return nothing */",
"/* output the outer layers */",
"/* iterate over cheats in the list and save them */",
"/* close out the file */"
] | [
{
"param": "filename",
"type": "char"
},
{
"param": "cheatlist",
"type": "cheat_entry"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cheatlist",
"type": "cheat_entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | cheat_entry_load | cheat_entry | static cheat_entry *cheat_entry_load(running_machine *machine, const char *filename, xml_data_node *cheatnode)
{
cheat_private *cheatinfo = machine->cheat_data;
xml_data_node *paramnode, *scriptnode, *commentnode;
const char *description;
int tempcount, curtemp;
cheat_entry *cheat;
/* pull the variable count out ahead of things */
tempcount = xml_get_attribute_int(cheatnode, "tempvariables", DEFAULT_TEMP_VARIABLES);
if (tempcount < 1)
{
mame_printf_error("%s.xml(%d): invalid tempvariables attribute (%d)\n", filename, cheatnode->line, tempcount);
return NULL;
}
/* allocate memory for the cheat */
cheat = (cheat_entry *)alloc_array_clear_or_die(UINT8, sizeof(*cheat) + (tempcount - 1) * sizeof(cheat->tempvar));
cheat->numtemp = tempcount;
/* get the description */
description = xml_get_attribute_string(cheatnode, "desc", NULL);
if (description == NULL || description[0] == 0)
{
mame_printf_error("%s.xml(%d): empty or missing desc attribute on cheat\n", filename, cheatnode->line);
return NULL;
}
cheat->description = astring_dupc(description);
/* create the symbol table */
cheat->symbols = symtable_alloc(NULL, machine);
symtable_add_register(cheat->symbols, "frame", &cheatinfo->framecount, cheat_variable_get, NULL);
symtable_add_register(cheat->symbols, "argindex", &cheat->argindex, cheat_variable_get, NULL);
for (curtemp = 0; curtemp < tempcount; curtemp++)
{
char tempname[20];
sprintf(tempname, "temp%d", curtemp);
symtable_add_register(cheat->symbols, tempname, &cheat->tempvar[curtemp], cheat_variable_get, cheat_variable_set);
}
symtable_add_function(cheat->symbols, "frombcd", NULL, 1, 1, execute_frombcd);
symtable_add_function(cheat->symbols, "tobcd", NULL, 1, 1, execute_tobcd);
/* read the first comment node */
commentnode = xml_get_sibling(cheatnode->child, "comment");
if (commentnode != NULL)
{
if (commentnode->value != NULL && commentnode->value[0] != 0)
cheat->comment = astring_dupc(commentnode->value);
/* only one comment is kept */
commentnode = xml_get_sibling(commentnode->next, "comment");
if (commentnode != NULL)
mame_printf_warning("%s.xml(%d): only one comment node is retained; ignoring additional nodes\n", filename, commentnode->line);
}
/* read the first parameter node */
paramnode = xml_get_sibling(cheatnode->child, "parameter");
if (paramnode != NULL)
{
/* load this parameter */
cheat_parameter *curparam = cheat_parameter_load(filename, paramnode);
if (curparam == NULL)
goto error;
/* set this as the parameter and add the symbol */
cheat->parameter = curparam;
symtable_add_register(cheat->symbols, "param", &curparam->value, cheat_variable_get, NULL);
/* only one parameter allowed */
paramnode = xml_get_sibling(paramnode->next, "parameter");
if (paramnode != NULL)
mame_printf_warning("%s.xml(%d): only one parameter node allowed; ignoring additional nodes\n", filename, paramnode->line);
}
/* read the script nodes */
for (scriptnode = xml_get_sibling(cheatnode->child, "script"); scriptnode != NULL; scriptnode = xml_get_sibling(scriptnode->next, "script"))
{
/* load this entry */
cheat_script *curscript = cheat_script_load(machine, filename, scriptnode, cheat);
if (curscript == NULL)
goto error;
/* if we have a script already for this slot, it is an error */
if (cheat->script[curscript->state] != NULL)
mame_printf_warning("%s.xml(%d): only one script per state allowed; ignoring additional scripts\n", filename, scriptnode->line);
/* otherwise, fill in the slot */
else
cheat->script[curscript->state] = curscript;
}
/* set the initial state */
cheat->state = SCRIPT_STATE_OFF;
return cheat;
error:
cheat_entry_free(cheat);
return NULL;
} | /*-------------------------------------------------
cheat_entry_load - load a single cheat
entry and create the underlying data
structures
-------------------------------------------------*/ | load a single cheat
entry and create the underlying data
structures | [
"load",
"a",
"single",
"cheat",
"entry",
"and",
"create",
"the",
"underlying",
"data",
"structures"
] | static cheat_entry *cheat_entry_load(running_machine *machine, const char *filename, xml_data_node *cheatnode)
{
cheat_private *cheatinfo = machine->cheat_data;
xml_data_node *paramnode, *scriptnode, *commentnode;
const char *description;
int tempcount, curtemp;
cheat_entry *cheat;
tempcount = xml_get_attribute_int(cheatnode, "tempvariables", DEFAULT_TEMP_VARIABLES);
if (tempcount < 1)
{
mame_printf_error("%s.xml(%d): invalid tempvariables attribute (%d)\n", filename, cheatnode->line, tempcount);
return NULL;
}
cheat = (cheat_entry *)alloc_array_clear_or_die(UINT8, sizeof(*cheat) + (tempcount - 1) * sizeof(cheat->tempvar));
cheat->numtemp = tempcount;
description = xml_get_attribute_string(cheatnode, "desc", NULL);
if (description == NULL || description[0] == 0)
{
mame_printf_error("%s.xml(%d): empty or missing desc attribute on cheat\n", filename, cheatnode->line);
return NULL;
}
cheat->description = astring_dupc(description);
cheat->symbols = symtable_alloc(NULL, machine);
symtable_add_register(cheat->symbols, "frame", &cheatinfo->framecount, cheat_variable_get, NULL);
symtable_add_register(cheat->symbols, "argindex", &cheat->argindex, cheat_variable_get, NULL);
for (curtemp = 0; curtemp < tempcount; curtemp++)
{
char tempname[20];
sprintf(tempname, "temp%d", curtemp);
symtable_add_register(cheat->symbols, tempname, &cheat->tempvar[curtemp], cheat_variable_get, cheat_variable_set);
}
symtable_add_function(cheat->symbols, "frombcd", NULL, 1, 1, execute_frombcd);
symtable_add_function(cheat->symbols, "tobcd", NULL, 1, 1, execute_tobcd);
commentnode = xml_get_sibling(cheatnode->child, "comment");
if (commentnode != NULL)
{
if (commentnode->value != NULL && commentnode->value[0] != 0)
cheat->comment = astring_dupc(commentnode->value);
commentnode = xml_get_sibling(commentnode->next, "comment");
if (commentnode != NULL)
mame_printf_warning("%s.xml(%d): only one comment node is retained; ignoring additional nodes\n", filename, commentnode->line);
}
paramnode = xml_get_sibling(cheatnode->child, "parameter");
if (paramnode != NULL)
{
cheat_parameter *curparam = cheat_parameter_load(filename, paramnode);
if (curparam == NULL)
goto error;
cheat->parameter = curparam;
symtable_add_register(cheat->symbols, "param", &curparam->value, cheat_variable_get, NULL);
paramnode = xml_get_sibling(paramnode->next, "parameter");
if (paramnode != NULL)
mame_printf_warning("%s.xml(%d): only one parameter node allowed; ignoring additional nodes\n", filename, paramnode->line);
}
for (scriptnode = xml_get_sibling(cheatnode->child, "script"); scriptnode != NULL; scriptnode = xml_get_sibling(scriptnode->next, "script"))
{
cheat_script *curscript = cheat_script_load(machine, filename, scriptnode, cheat);
if (curscript == NULL)
goto error;
if (cheat->script[curscript->state] != NULL)
mame_printf_warning("%s.xml(%d): only one script per state allowed; ignoring additional scripts\n", filename, scriptnode->line);
else
cheat->script[curscript->state] = curscript;
}
cheat->state = SCRIPT_STATE_OFF;
return cheat;
error:
cheat_entry_free(cheat);
return NULL;
} | [
"static",
"cheat_entry",
"*",
"cheat_entry_load",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"filename",
",",
"xml_data_node",
"*",
"cheatnode",
")",
"{",
"cheat_private",
"*",
"cheatinfo",
"=",
"machine",
"->",
"cheat_data",
";",
"xml_data_node",
"*",
"paramnode",
",",
"*",
"scriptnode",
",",
"*",
"commentnode",
";",
"const",
"char",
"*",
"description",
";",
"int",
"tempcount",
",",
"curtemp",
";",
"cheat_entry",
"*",
"cheat",
";",
"tempcount",
"=",
"xml_get_attribute_int",
"(",
"cheatnode",
",",
"\"",
"\"",
",",
"DEFAULT_TEMP_VARIABLES",
")",
";",
"if",
"(",
"tempcount",
"<",
"1",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"filename",
",",
"cheatnode",
"->",
"line",
",",
"tempcount",
")",
";",
"return",
"NULL",
";",
"}",
"cheat",
"=",
"(",
"cheat_entry",
"*",
")",
"alloc_array_clear_or_die",
"(",
"UINT8",
",",
"sizeof",
"(",
"*",
"cheat",
")",
"+",
"(",
"tempcount",
"-",
"1",
")",
"*",
"sizeof",
"(",
"cheat",
"->",
"tempvar",
")",
")",
";",
"cheat",
"->",
"numtemp",
"=",
"tempcount",
";",
"description",
"=",
"xml_get_attribute_string",
"(",
"cheatnode",
",",
"\"",
"\"",
",",
"NULL",
")",
";",
"if",
"(",
"description",
"==",
"NULL",
"||",
"description",
"[",
"0",
"]",
"==",
"0",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"filename",
",",
"cheatnode",
"->",
"line",
")",
";",
"return",
"NULL",
";",
"}",
"cheat",
"->",
"description",
"=",
"astring_dupc",
"(",
"description",
")",
";",
"cheat",
"->",
"symbols",
"=",
"symtable_alloc",
"(",
"NULL",
",",
"machine",
")",
";",
"symtable_add_register",
"(",
"cheat",
"->",
"symbols",
",",
"\"",
"\"",
",",
"&",
"cheatinfo",
"->",
"framecount",
",",
"cheat_variable_get",
",",
"NULL",
")",
";",
"symtable_add_register",
"(",
"cheat",
"->",
"symbols",
",",
"\"",
"\"",
",",
"&",
"cheat",
"->",
"argindex",
",",
"cheat_variable_get",
",",
"NULL",
")",
";",
"for",
"(",
"curtemp",
"=",
"0",
";",
"curtemp",
"<",
"tempcount",
";",
"curtemp",
"++",
")",
"{",
"char",
"tempname",
"[",
"20",
"]",
";",
"sprintf",
"(",
"tempname",
",",
"\"",
"\"",
",",
"curtemp",
")",
";",
"symtable_add_register",
"(",
"cheat",
"->",
"symbols",
",",
"tempname",
",",
"&",
"cheat",
"->",
"tempvar",
"[",
"curtemp",
"]",
",",
"cheat_variable_get",
",",
"cheat_variable_set",
")",
";",
"}",
"symtable_add_function",
"(",
"cheat",
"->",
"symbols",
",",
"\"",
"\"",
",",
"NULL",
",",
"1",
",",
"1",
",",
"execute_frombcd",
")",
";",
"symtable_add_function",
"(",
"cheat",
"->",
"symbols",
",",
"\"",
"\"",
",",
"NULL",
",",
"1",
",",
"1",
",",
"execute_tobcd",
")",
";",
"commentnode",
"=",
"xml_get_sibling",
"(",
"cheatnode",
"->",
"child",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"commentnode",
"!=",
"NULL",
")",
"{",
"if",
"(",
"commentnode",
"->",
"value",
"!=",
"NULL",
"&&",
"commentnode",
"->",
"value",
"[",
"0",
"]",
"!=",
"0",
")",
"cheat",
"->",
"comment",
"=",
"astring_dupc",
"(",
"commentnode",
"->",
"value",
")",
";",
"commentnode",
"=",
"xml_get_sibling",
"(",
"commentnode",
"->",
"next",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"commentnode",
"!=",
"NULL",
")",
"mame_printf_warning",
"(",
"\"",
"\\n",
"\"",
",",
"filename",
",",
"commentnode",
"->",
"line",
")",
";",
"}",
"paramnode",
"=",
"xml_get_sibling",
"(",
"cheatnode",
"->",
"child",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"paramnode",
"!=",
"NULL",
")",
"{",
"cheat_parameter",
"*",
"curparam",
"=",
"cheat_parameter_load",
"(",
"filename",
",",
"paramnode",
")",
";",
"if",
"(",
"curparam",
"==",
"NULL",
")",
"goto",
"error",
";",
"cheat",
"->",
"parameter",
"=",
"curparam",
";",
"symtable_add_register",
"(",
"cheat",
"->",
"symbols",
",",
"\"",
"\"",
",",
"&",
"curparam",
"->",
"value",
",",
"cheat_variable_get",
",",
"NULL",
")",
";",
"paramnode",
"=",
"xml_get_sibling",
"(",
"paramnode",
"->",
"next",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"paramnode",
"!=",
"NULL",
")",
"mame_printf_warning",
"(",
"\"",
"\\n",
"\"",
",",
"filename",
",",
"paramnode",
"->",
"line",
")",
";",
"}",
"for",
"(",
"scriptnode",
"=",
"xml_get_sibling",
"(",
"cheatnode",
"->",
"child",
",",
"\"",
"\"",
")",
";",
"scriptnode",
"!=",
"NULL",
";",
"scriptnode",
"=",
"xml_get_sibling",
"(",
"scriptnode",
"->",
"next",
",",
"\"",
"\"",
")",
")",
"{",
"cheat_script",
"*",
"curscript",
"=",
"cheat_script_load",
"(",
"machine",
",",
"filename",
",",
"scriptnode",
",",
"cheat",
")",
";",
"if",
"(",
"curscript",
"==",
"NULL",
")",
"goto",
"error",
";",
"if",
"(",
"cheat",
"->",
"script",
"[",
"curscript",
"->",
"state",
"]",
"!=",
"NULL",
")",
"mame_printf_warning",
"(",
"\"",
"\\n",
"\"",
",",
"filename",
",",
"scriptnode",
"->",
"line",
")",
";",
"else",
"cheat",
"->",
"script",
"[",
"curscript",
"->",
"state",
"]",
"=",
"curscript",
";",
"}",
"cheat",
"->",
"state",
"=",
"SCRIPT_STATE_OFF",
";",
"return",
"cheat",
";",
"error",
":",
"cheat_entry_free",
"(",
"cheat",
")",
";",
"return",
"NULL",
";",
"}"
] | cheat_entry_load - load a single cheat
entry and create the underlying data
structures | [
"cheat_entry_load",
"-",
"load",
"a",
"single",
"cheat",
"entry",
"and",
"create",
"the",
"underlying",
"data",
"structures"
] | [
"/* pull the variable count out ahead of things */",
"/* allocate memory for the cheat */",
"/* get the description */",
"/* create the symbol table */",
"/* read the first comment node */",
"/* only one comment is kept */",
"/* read the first parameter node */",
"/* load this parameter */",
"/* set this as the parameter and add the symbol */",
"/* only one parameter allowed */",
"/* read the script nodes */",
"/* load this entry */",
"/* if we have a script already for this slot, it is an error */",
"/* otherwise, fill in the slot */",
"/* set the initial state */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "filename",
"type": "char"
},
{
"param": "cheatnode",
"type": "xml_data_node"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cheatnode",
"type": "xml_data_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | cheat_parameter_load | cheat_parameter | static cheat_parameter *cheat_parameter_load(const char *filename, xml_data_node *paramnode)
{
parameter_item **itemtailptr;
xml_data_node *itemnode;
cheat_parameter *param;
/* allocate memory for it */
param = alloc_clear_or_die(cheat_parameter);
/* read the core attributes */
param->minval = xml_get_attribute_int(paramnode, "min", 0);
param->minformat = xml_get_attribute_int_format(paramnode, "min");
param->maxval = xml_get_attribute_int(paramnode, "max", 0);
param->maxformat = xml_get_attribute_int_format(paramnode, "max");
param->stepval = xml_get_attribute_int(paramnode, "step", 1);
param->stepformat = xml_get_attribute_int_format(paramnode, "step");
/* iterate over items */
itemtailptr = ¶m->itemlist;
for (itemnode = xml_get_sibling(paramnode->child, "item"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "item"))
{
parameter_item *curitem;
/* allocate memory for it */
curitem = alloc_clear_or_die(parameter_item);
/* check for NULL text */
if (itemnode->value == NULL || itemnode->value[0] == 0)
{
mame_printf_error("%s.xml(%d): item is missing text\n", filename, itemnode->line);
goto error;
}
curitem->text = astring_dupc(itemnode->value);
/* read the attributes */
if (xml_get_attribute(itemnode, "value") == NULL)
{
mame_printf_error("%s.xml(%d): item is value\n", filename, itemnode->line);
goto error;
}
curitem->value = xml_get_attribute_int(itemnode, "value", 0);
curitem->valformat = xml_get_attribute_int_format(itemnode, "value");
/* ensure the maximum expands to suit */
param->maxval = MAX(param->maxval, curitem->value);
/* add to the end of the list */
*itemtailptr = curitem;
itemtailptr = &curitem->next;
}
/* start at the minimum */
param->value = param->minval;
return param;
error:
cheat_parameter_free(param);
return NULL;
} | /*-------------------------------------------------
cheat_parameter_load - load a single cheat
parameter and create the underlying data
structures
-------------------------------------------------*/ | load a single cheat
parameter and create the underlying data
structures | [
"load",
"a",
"single",
"cheat",
"parameter",
"and",
"create",
"the",
"underlying",
"data",
"structures"
] | static cheat_parameter *cheat_parameter_load(const char *filename, xml_data_node *paramnode)
{
parameter_item **itemtailptr;
xml_data_node *itemnode;
cheat_parameter *param;
param = alloc_clear_or_die(cheat_parameter);
param->minval = xml_get_attribute_int(paramnode, "min", 0);
param->minformat = xml_get_attribute_int_format(paramnode, "min");
param->maxval = xml_get_attribute_int(paramnode, "max", 0);
param->maxformat = xml_get_attribute_int_format(paramnode, "max");
param->stepval = xml_get_attribute_int(paramnode, "step", 1);
param->stepformat = xml_get_attribute_int_format(paramnode, "step");
itemtailptr = ¶m->itemlist;
for (itemnode = xml_get_sibling(paramnode->child, "item"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "item"))
{
parameter_item *curitem;
curitem = alloc_clear_or_die(parameter_item);
if (itemnode->value == NULL || itemnode->value[0] == 0)
{
mame_printf_error("%s.xml(%d): item is missing text\n", filename, itemnode->line);
goto error;
}
curitem->text = astring_dupc(itemnode->value);
if (xml_get_attribute(itemnode, "value") == NULL)
{
mame_printf_error("%s.xml(%d): item is value\n", filename, itemnode->line);
goto error;
}
curitem->value = xml_get_attribute_int(itemnode, "value", 0);
curitem->valformat = xml_get_attribute_int_format(itemnode, "value");
param->maxval = MAX(param->maxval, curitem->value);
*itemtailptr = curitem;
itemtailptr = &curitem->next;
}
param->value = param->minval;
return param;
error:
cheat_parameter_free(param);
return NULL;
} | [
"static",
"cheat_parameter",
"*",
"cheat_parameter_load",
"(",
"const",
"char",
"*",
"filename",
",",
"xml_data_node",
"*",
"paramnode",
")",
"{",
"parameter_item",
"*",
"*",
"itemtailptr",
";",
"xml_data_node",
"*",
"itemnode",
";",
"cheat_parameter",
"*",
"param",
";",
"param",
"=",
"alloc_clear_or_die",
"(",
"cheat_parameter",
")",
";",
"param",
"->",
"minval",
"=",
"xml_get_attribute_int",
"(",
"paramnode",
",",
"\"",
"\"",
",",
"0",
")",
";",
"param",
"->",
"minformat",
"=",
"xml_get_attribute_int_format",
"(",
"paramnode",
",",
"\"",
"\"",
")",
";",
"param",
"->",
"maxval",
"=",
"xml_get_attribute_int",
"(",
"paramnode",
",",
"\"",
"\"",
",",
"0",
")",
";",
"param",
"->",
"maxformat",
"=",
"xml_get_attribute_int_format",
"(",
"paramnode",
",",
"\"",
"\"",
")",
";",
"param",
"->",
"stepval",
"=",
"xml_get_attribute_int",
"(",
"paramnode",
",",
"\"",
"\"",
",",
"1",
")",
";",
"param",
"->",
"stepformat",
"=",
"xml_get_attribute_int_format",
"(",
"paramnode",
",",
"\"",
"\"",
")",
";",
"itemtailptr",
"=",
"&",
"param",
"->",
"itemlist",
";",
"for",
"(",
"itemnode",
"=",
"xml_get_sibling",
"(",
"paramnode",
"->",
"child",
",",
"\"",
"\"",
")",
";",
"itemnode",
"!=",
"NULL",
";",
"itemnode",
"=",
"xml_get_sibling",
"(",
"itemnode",
"->",
"next",
",",
"\"",
"\"",
")",
")",
"{",
"parameter_item",
"*",
"curitem",
";",
"curitem",
"=",
"alloc_clear_or_die",
"(",
"parameter_item",
")",
";",
"if",
"(",
"itemnode",
"->",
"value",
"==",
"NULL",
"||",
"itemnode",
"->",
"value",
"[",
"0",
"]",
"==",
"0",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"filename",
",",
"itemnode",
"->",
"line",
")",
";",
"goto",
"error",
";",
"}",
"curitem",
"->",
"text",
"=",
"astring_dupc",
"(",
"itemnode",
"->",
"value",
")",
";",
"if",
"(",
"xml_get_attribute",
"(",
"itemnode",
",",
"\"",
"\"",
")",
"==",
"NULL",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"filename",
",",
"itemnode",
"->",
"line",
")",
";",
"goto",
"error",
";",
"}",
"curitem",
"->",
"value",
"=",
"xml_get_attribute_int",
"(",
"itemnode",
",",
"\"",
"\"",
",",
"0",
")",
";",
"curitem",
"->",
"valformat",
"=",
"xml_get_attribute_int_format",
"(",
"itemnode",
",",
"\"",
"\"",
")",
";",
"param",
"->",
"maxval",
"=",
"MAX",
"(",
"param",
"->",
"maxval",
",",
"curitem",
"->",
"value",
")",
";",
"*",
"itemtailptr",
"=",
"curitem",
";",
"itemtailptr",
"=",
"&",
"curitem",
"->",
"next",
";",
"}",
"param",
"->",
"value",
"=",
"param",
"->",
"minval",
";",
"return",
"param",
";",
"error",
":",
"cheat_parameter_free",
"(",
"param",
")",
";",
"return",
"NULL",
";",
"}"
] | cheat_parameter_load - load a single cheat
parameter and create the underlying data
structures | [
"cheat_parameter_load",
"-",
"load",
"a",
"single",
"cheat",
"parameter",
"and",
"create",
"the",
"underlying",
"data",
"structures"
] | [
"/* allocate memory for it */",
"/* read the core attributes */",
"/* iterate over items */",
"/* allocate memory for it */",
"/* check for NULL text */",
"/* read the attributes */",
"/* ensure the maximum expands to suit */",
"/* add to the end of the list */",
"/* start at the minimum */"
] | [
{
"param": "filename",
"type": "char"
},
{
"param": "paramnode",
"type": "xml_data_node"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "paramnode",
"type": "xml_data_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | cheat_script_load | cheat_script | static cheat_script *cheat_script_load(running_machine *machine, const char *filename, xml_data_node *scriptnode, cheat_entry *cheat)
{
script_entry **entrytailptr;
xml_data_node *entrynode;
cheat_script *script;
const char *state;
/* allocate memory for it */
script = alloc_clear_or_die(cheat_script);
/* read the core attributes */
script->state = SCRIPT_STATE_RUN;
state = xml_get_attribute_string(scriptnode, "state", "run");
if (strcmp(state, "on") == 0)
script->state = SCRIPT_STATE_ON;
else if (strcmp(state, "off") == 0)
script->state = SCRIPT_STATE_OFF;
else if (strcmp(state, "change") == 0)
script->state = SCRIPT_STATE_CHANGE;
else if (strcmp(state, "run") != 0)
{
mame_printf_error("%s.xml(%d): invalid script state '%s'\n", filename, scriptnode->line, state);
goto error;
}
/* iterate over nodes within the script */
entrytailptr = &script->entrylist;
for (entrynode = scriptnode->child; entrynode != NULL; entrynode = entrynode->next)
{
script_entry *curentry = NULL;
/* handle action nodes */
if (strcmp(entrynode->name, "action") == 0)
curentry = script_entry_load(machine, filename, entrynode, cheat, TRUE);
/* handle output nodes */
else if (strcmp(entrynode->name, "output") == 0)
curentry = script_entry_load(machine, filename, entrynode, cheat, FALSE);
/* anything else is ignored */
else
{
mame_printf_warning("%s.xml(%d): unknown script item '%s' will be lost if saved\n", filename, entrynode->line, entrynode->name);
continue;
}
if (curentry == NULL)
goto error;
/* add to the end of the list */
*entrytailptr = curentry;
entrytailptr = &curentry->next;
}
return script;
error:
cheat_script_free(script);
return NULL;
} | /*-------------------------------------------------
cheat_script_load - load a single cheat
script and create the underlying data
structures
-------------------------------------------------*/ | load a single cheat
script and create the underlying data
structures | [
"load",
"a",
"single",
"cheat",
"script",
"and",
"create",
"the",
"underlying",
"data",
"structures"
] | static cheat_script *cheat_script_load(running_machine *machine, const char *filename, xml_data_node *scriptnode, cheat_entry *cheat)
{
script_entry **entrytailptr;
xml_data_node *entrynode;
cheat_script *script;
const char *state;
script = alloc_clear_or_die(cheat_script);
script->state = SCRIPT_STATE_RUN;
state = xml_get_attribute_string(scriptnode, "state", "run");
if (strcmp(state, "on") == 0)
script->state = SCRIPT_STATE_ON;
else if (strcmp(state, "off") == 0)
script->state = SCRIPT_STATE_OFF;
else if (strcmp(state, "change") == 0)
script->state = SCRIPT_STATE_CHANGE;
else if (strcmp(state, "run") != 0)
{
mame_printf_error("%s.xml(%d): invalid script state '%s'\n", filename, scriptnode->line, state);
goto error;
}
entrytailptr = &script->entrylist;
for (entrynode = scriptnode->child; entrynode != NULL; entrynode = entrynode->next)
{
script_entry *curentry = NULL;
if (strcmp(entrynode->name, "action") == 0)
curentry = script_entry_load(machine, filename, entrynode, cheat, TRUE);
else if (strcmp(entrynode->name, "output") == 0)
curentry = script_entry_load(machine, filename, entrynode, cheat, FALSE);
else
{
mame_printf_warning("%s.xml(%d): unknown script item '%s' will be lost if saved\n", filename, entrynode->line, entrynode->name);
continue;
}
if (curentry == NULL)
goto error;
*entrytailptr = curentry;
entrytailptr = &curentry->next;
}
return script;
error:
cheat_script_free(script);
return NULL;
} | [
"static",
"cheat_script",
"*",
"cheat_script_load",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"filename",
",",
"xml_data_node",
"*",
"scriptnode",
",",
"cheat_entry",
"*",
"cheat",
")",
"{",
"script_entry",
"*",
"*",
"entrytailptr",
";",
"xml_data_node",
"*",
"entrynode",
";",
"cheat_script",
"*",
"script",
";",
"const",
"char",
"*",
"state",
";",
"script",
"=",
"alloc_clear_or_die",
"(",
"cheat_script",
")",
";",
"script",
"->",
"state",
"=",
"SCRIPT_STATE_RUN",
";",
"state",
"=",
"xml_get_attribute_string",
"(",
"scriptnode",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"strcmp",
"(",
"state",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"script",
"->",
"state",
"=",
"SCRIPT_STATE_ON",
";",
"else",
"if",
"(",
"strcmp",
"(",
"state",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"script",
"->",
"state",
"=",
"SCRIPT_STATE_OFF",
";",
"else",
"if",
"(",
"strcmp",
"(",
"state",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"script",
"->",
"state",
"=",
"SCRIPT_STATE_CHANGE",
";",
"else",
"if",
"(",
"strcmp",
"(",
"state",
",",
"\"",
"\"",
")",
"!=",
"0",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"filename",
",",
"scriptnode",
"->",
"line",
",",
"state",
")",
";",
"goto",
"error",
";",
"}",
"entrytailptr",
"=",
"&",
"script",
"->",
"entrylist",
";",
"for",
"(",
"entrynode",
"=",
"scriptnode",
"->",
"child",
";",
"entrynode",
"!=",
"NULL",
";",
"entrynode",
"=",
"entrynode",
"->",
"next",
")",
"{",
"script_entry",
"*",
"curentry",
"=",
"NULL",
";",
"if",
"(",
"strcmp",
"(",
"entrynode",
"->",
"name",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"curentry",
"=",
"script_entry_load",
"(",
"machine",
",",
"filename",
",",
"entrynode",
",",
"cheat",
",",
"TRUE",
")",
";",
"else",
"if",
"(",
"strcmp",
"(",
"entrynode",
"->",
"name",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"curentry",
"=",
"script_entry_load",
"(",
"machine",
",",
"filename",
",",
"entrynode",
",",
"cheat",
",",
"FALSE",
")",
";",
"else",
"{",
"mame_printf_warning",
"(",
"\"",
"\\n",
"\"",
",",
"filename",
",",
"entrynode",
"->",
"line",
",",
"entrynode",
"->",
"name",
")",
";",
"continue",
";",
"}",
"if",
"(",
"curentry",
"==",
"NULL",
")",
"goto",
"error",
";",
"*",
"entrytailptr",
"=",
"curentry",
";",
"entrytailptr",
"=",
"&",
"curentry",
"->",
"next",
";",
"}",
"return",
"script",
";",
"error",
":",
"cheat_script_free",
"(",
"script",
")",
";",
"return",
"NULL",
";",
"}"
] | cheat_script_load - load a single cheat
script and create the underlying data
structures | [
"cheat_script_load",
"-",
"load",
"a",
"single",
"cheat",
"script",
"and",
"create",
"the",
"underlying",
"data",
"structures"
] | [
"/* allocate memory for it */",
"/* read the core attributes */",
"/* iterate over nodes within the script */",
"/* handle action nodes */",
"/* handle output nodes */",
"/* anything else is ignored */",
"/* add to the end of the list */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "filename",
"type": "char"
},
{
"param": "scriptnode",
"type": "xml_data_node"
},
{
"param": "cheat",
"type": "cheat_entry"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scriptnode",
"type": "xml_data_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cheat",
"type": "cheat_entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | script_entry_load | script_entry | static script_entry *script_entry_load(running_machine *machine, const char *filename, xml_data_node *entrynode, cheat_entry *cheat, int isaction)
{
const char *expression;
script_entry *entry;
EXPRERR experr;
/* allocate memory for it */
entry = alloc_clear_or_die(script_entry);
/* read the condition if present */
expression = xml_get_attribute_string(entrynode, "condition", NULL);
if (expression != NULL)
{
experr = expression_parse(expression, cheat->symbols, &debug_expression_callbacks, machine, &entry->condition);
if (experr != EXPRERR_NONE)
{
mame_printf_error("%s.xml(%d): error parsing cheat expression \"%s\" (%s)\n", filename, entrynode->line, expression, exprerr_to_string(experr));
goto error;
}
}
/* if this is an action, parse the expression */
if (isaction)
{
expression = entrynode->value;
if (expression == NULL || expression[0] == 0)
{
mame_printf_error("%s.xml(%d): missing expression in action tag\n", filename, entrynode->line);
goto error;
}
experr = expression_parse(expression, cheat->symbols, &debug_expression_callbacks, machine, &entry->expression);
if (experr != EXPRERR_NONE)
{
mame_printf_error("%s.xml(%d): error parsing cheat expression \"%s\" (%s)\n", filename, entrynode->line, expression, exprerr_to_string(experr));
goto error;
}
}
/* otherwise, parse the attributes and arguments */
else
{
output_argument **argtailptr;
const char *align, *format;
xml_data_node *argnode;
int totalargs = 0;
/* extract format */
format = xml_get_attribute_string(entrynode, "format", NULL);
if (format == NULL || format[0] == 0)
{
mame_printf_error("%s.xml(%d): missing format in output tag\n", filename, entrynode->line);
goto error;
}
entry->format = astring_dupc(format);
/* extract other attributes */
entry->line = xml_get_attribute_int(entrynode, "line", 0);
entry->justify = JUSTIFY_LEFT;
align = xml_get_attribute_string(entrynode, "align", "left");
if (strcmp(align, "center") == 0)
entry->justify = JUSTIFY_CENTER;
else if (strcmp(align, "right") == 0)
entry->justify = JUSTIFY_RIGHT;
else if (strcmp(align, "left") != 0)
{
mame_printf_error("%s.xml(%d): invalid alignment '%s' specified\n", filename, entrynode->line, align);
goto error;
}
/* then parse arguments */
argtailptr = &entry->arglist;
for (argnode = xml_get_sibling(entrynode->child, "argument"); argnode != NULL; argnode = xml_get_sibling(argnode->next, "argument"))
{
output_argument *curarg;
/* allocate memory for it */
curarg = alloc_clear_or_die(output_argument);
/* first extract attributes */
curarg->count = xml_get_attribute_int(argnode, "count", 1);
totalargs += curarg->count;
/* max out on arguments */
if (totalargs > MAX_ARGUMENTS)
{
mame_printf_error("%s.xml(%d): too many arguments (found %d, max is %d)\n", filename, argnode->line, totalargs, MAX_ARGUMENTS);
goto error;
}
/* read the expression */
expression = argnode->value;
if (expression == NULL || expression[0] == 0)
{
mame_printf_error("%s.xml(%d): missing expression in argument tag\n", filename, argnode->line);
goto error;
}
experr = expression_parse(expression, cheat->symbols, &debug_expression_callbacks, machine, &curarg->expression);
if (experr != EXPRERR_NONE)
{
mame_printf_error("%s.xml(%d): error parsing cheat expression \"%s\" (%s)\n", filename, argnode->line, expression, exprerr_to_string(experr));
goto error;
}
/* add to the end of the list */
*argtailptr = curarg;
argtailptr = &curarg->next;
}
/* validate the format against the arguments */
if (!validate_format(filename, entrynode->line, entry))
goto error;
}
return entry;
error:
script_entry_free(entry);
return NULL;
} | /*-------------------------------------------------
script_entry_load - load a single action
or output create the underlying data
structures
-------------------------------------------------*/ | load a single action
or output create the underlying data
structures | [
"load",
"a",
"single",
"action",
"or",
"output",
"create",
"the",
"underlying",
"data",
"structures"
] | static script_entry *script_entry_load(running_machine *machine, const char *filename, xml_data_node *entrynode, cheat_entry *cheat, int isaction)
{
const char *expression;
script_entry *entry;
EXPRERR experr;
entry = alloc_clear_or_die(script_entry);
expression = xml_get_attribute_string(entrynode, "condition", NULL);
if (expression != NULL)
{
experr = expression_parse(expression, cheat->symbols, &debug_expression_callbacks, machine, &entry->condition);
if (experr != EXPRERR_NONE)
{
mame_printf_error("%s.xml(%d): error parsing cheat expression \"%s\" (%s)\n", filename, entrynode->line, expression, exprerr_to_string(experr));
goto error;
}
}
if (isaction)
{
expression = entrynode->value;
if (expression == NULL || expression[0] == 0)
{
mame_printf_error("%s.xml(%d): missing expression in action tag\n", filename, entrynode->line);
goto error;
}
experr = expression_parse(expression, cheat->symbols, &debug_expression_callbacks, machine, &entry->expression);
if (experr != EXPRERR_NONE)
{
mame_printf_error("%s.xml(%d): error parsing cheat expression \"%s\" (%s)\n", filename, entrynode->line, expression, exprerr_to_string(experr));
goto error;
}
}
else
{
output_argument **argtailptr;
const char *align, *format;
xml_data_node *argnode;
int totalargs = 0;
format = xml_get_attribute_string(entrynode, "format", NULL);
if (format == NULL || format[0] == 0)
{
mame_printf_error("%s.xml(%d): missing format in output tag\n", filename, entrynode->line);
goto error;
}
entry->format = astring_dupc(format);
entry->line = xml_get_attribute_int(entrynode, "line", 0);
entry->justify = JUSTIFY_LEFT;
align = xml_get_attribute_string(entrynode, "align", "left");
if (strcmp(align, "center") == 0)
entry->justify = JUSTIFY_CENTER;
else if (strcmp(align, "right") == 0)
entry->justify = JUSTIFY_RIGHT;
else if (strcmp(align, "left") != 0)
{
mame_printf_error("%s.xml(%d): invalid alignment '%s' specified\n", filename, entrynode->line, align);
goto error;
}
argtailptr = &entry->arglist;
for (argnode = xml_get_sibling(entrynode->child, "argument"); argnode != NULL; argnode = xml_get_sibling(argnode->next, "argument"))
{
output_argument *curarg;
curarg = alloc_clear_or_die(output_argument);
curarg->count = xml_get_attribute_int(argnode, "count", 1);
totalargs += curarg->count;
if (totalargs > MAX_ARGUMENTS)
{
mame_printf_error("%s.xml(%d): too many arguments (found %d, max is %d)\n", filename, argnode->line, totalargs, MAX_ARGUMENTS);
goto error;
}
expression = argnode->value;
if (expression == NULL || expression[0] == 0)
{
mame_printf_error("%s.xml(%d): missing expression in argument tag\n", filename, argnode->line);
goto error;
}
experr = expression_parse(expression, cheat->symbols, &debug_expression_callbacks, machine, &curarg->expression);
if (experr != EXPRERR_NONE)
{
mame_printf_error("%s.xml(%d): error parsing cheat expression \"%s\" (%s)\n", filename, argnode->line, expression, exprerr_to_string(experr));
goto error;
}
*argtailptr = curarg;
argtailptr = &curarg->next;
}
if (!validate_format(filename, entrynode->line, entry))
goto error;
}
return entry;
error:
script_entry_free(entry);
return NULL;
} | [
"static",
"script_entry",
"*",
"script_entry_load",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"filename",
",",
"xml_data_node",
"*",
"entrynode",
",",
"cheat_entry",
"*",
"cheat",
",",
"int",
"isaction",
")",
"{",
"const",
"char",
"*",
"expression",
";",
"script_entry",
"*",
"entry",
";",
"EXPRERR",
"experr",
";",
"entry",
"=",
"alloc_clear_or_die",
"(",
"script_entry",
")",
";",
"expression",
"=",
"xml_get_attribute_string",
"(",
"entrynode",
",",
"\"",
"\"",
",",
"NULL",
")",
";",
"if",
"(",
"expression",
"!=",
"NULL",
")",
"{",
"experr",
"=",
"expression_parse",
"(",
"expression",
",",
"cheat",
"->",
"symbols",
",",
"&",
"debug_expression_callbacks",
",",
"machine",
",",
"&",
"entry",
"->",
"condition",
")",
";",
"if",
"(",
"experr",
"!=",
"EXPRERR_NONE",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"filename",
",",
"entrynode",
"->",
"line",
",",
"expression",
",",
"exprerr_to_string",
"(",
"experr",
")",
")",
";",
"goto",
"error",
";",
"}",
"}",
"if",
"(",
"isaction",
")",
"{",
"expression",
"=",
"entrynode",
"->",
"value",
";",
"if",
"(",
"expression",
"==",
"NULL",
"||",
"expression",
"[",
"0",
"]",
"==",
"0",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"filename",
",",
"entrynode",
"->",
"line",
")",
";",
"goto",
"error",
";",
"}",
"experr",
"=",
"expression_parse",
"(",
"expression",
",",
"cheat",
"->",
"symbols",
",",
"&",
"debug_expression_callbacks",
",",
"machine",
",",
"&",
"entry",
"->",
"expression",
")",
";",
"if",
"(",
"experr",
"!=",
"EXPRERR_NONE",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"filename",
",",
"entrynode",
"->",
"line",
",",
"expression",
",",
"exprerr_to_string",
"(",
"experr",
")",
")",
";",
"goto",
"error",
";",
"}",
"}",
"else",
"{",
"output_argument",
"*",
"*",
"argtailptr",
";",
"const",
"char",
"*",
"align",
",",
"*",
"format",
";",
"xml_data_node",
"*",
"argnode",
";",
"int",
"totalargs",
"=",
"0",
";",
"format",
"=",
"xml_get_attribute_string",
"(",
"entrynode",
",",
"\"",
"\"",
",",
"NULL",
")",
";",
"if",
"(",
"format",
"==",
"NULL",
"||",
"format",
"[",
"0",
"]",
"==",
"0",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"filename",
",",
"entrynode",
"->",
"line",
")",
";",
"goto",
"error",
";",
"}",
"entry",
"->",
"format",
"=",
"astring_dupc",
"(",
"format",
")",
";",
"entry",
"->",
"line",
"=",
"xml_get_attribute_int",
"(",
"entrynode",
",",
"\"",
"\"",
",",
"0",
")",
";",
"entry",
"->",
"justify",
"=",
"JUSTIFY_LEFT",
";",
"align",
"=",
"xml_get_attribute_string",
"(",
"entrynode",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"strcmp",
"(",
"align",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"entry",
"->",
"justify",
"=",
"JUSTIFY_CENTER",
";",
"else",
"if",
"(",
"strcmp",
"(",
"align",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"entry",
"->",
"justify",
"=",
"JUSTIFY_RIGHT",
";",
"else",
"if",
"(",
"strcmp",
"(",
"align",
",",
"\"",
"\"",
")",
"!=",
"0",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"filename",
",",
"entrynode",
"->",
"line",
",",
"align",
")",
";",
"goto",
"error",
";",
"}",
"argtailptr",
"=",
"&",
"entry",
"->",
"arglist",
";",
"for",
"(",
"argnode",
"=",
"xml_get_sibling",
"(",
"entrynode",
"->",
"child",
",",
"\"",
"\"",
")",
";",
"argnode",
"!=",
"NULL",
";",
"argnode",
"=",
"xml_get_sibling",
"(",
"argnode",
"->",
"next",
",",
"\"",
"\"",
")",
")",
"{",
"output_argument",
"*",
"curarg",
";",
"curarg",
"=",
"alloc_clear_or_die",
"(",
"output_argument",
")",
";",
"curarg",
"->",
"count",
"=",
"xml_get_attribute_int",
"(",
"argnode",
",",
"\"",
"\"",
",",
"1",
")",
";",
"totalargs",
"+=",
"curarg",
"->",
"count",
";",
"if",
"(",
"totalargs",
">",
"MAX_ARGUMENTS",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"filename",
",",
"argnode",
"->",
"line",
",",
"totalargs",
",",
"MAX_ARGUMENTS",
")",
";",
"goto",
"error",
";",
"}",
"expression",
"=",
"argnode",
"->",
"value",
";",
"if",
"(",
"expression",
"==",
"NULL",
"||",
"expression",
"[",
"0",
"]",
"==",
"0",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"filename",
",",
"argnode",
"->",
"line",
")",
";",
"goto",
"error",
";",
"}",
"experr",
"=",
"expression_parse",
"(",
"expression",
",",
"cheat",
"->",
"symbols",
",",
"&",
"debug_expression_callbacks",
",",
"machine",
",",
"&",
"curarg",
"->",
"expression",
")",
";",
"if",
"(",
"experr",
"!=",
"EXPRERR_NONE",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"filename",
",",
"argnode",
"->",
"line",
",",
"expression",
",",
"exprerr_to_string",
"(",
"experr",
")",
")",
";",
"goto",
"error",
";",
"}",
"*",
"argtailptr",
"=",
"curarg",
";",
"argtailptr",
"=",
"&",
"curarg",
"->",
"next",
";",
"}",
"if",
"(",
"!",
"validate_format",
"(",
"filename",
",",
"entrynode",
"->",
"line",
",",
"entry",
")",
")",
"goto",
"error",
";",
"}",
"return",
"entry",
";",
"error",
":",
"script_entry_free",
"(",
"entry",
")",
";",
"return",
"NULL",
";",
"}"
] | script_entry_load - load a single action
or output create the underlying data
structures | [
"script_entry_load",
"-",
"load",
"a",
"single",
"action",
"or",
"output",
"create",
"the",
"underlying",
"data",
"structures"
] | [
"/* allocate memory for it */",
"/* read the condition if present */",
"/* if this is an action, parse the expression */",
"/* otherwise, parse the attributes and arguments */",
"/* extract format */",
"/* extract other attributes */",
"/* then parse arguments */",
"/* allocate memory for it */",
"/* first extract attributes */",
"/* max out on arguments */",
"/* read the expression */",
"/* add to the end of the list */",
"/* validate the format against the arguments */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "filename",
"type": "char"
},
{
"param": "entrynode",
"type": "xml_data_node"
},
{
"param": "cheat",
"type": "cheat_entry"
},
{
"param": "isaction",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entrynode",
"type": "xml_data_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cheat",
"type": "cheat_entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "isaction",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | script_entry_save | void | static void script_entry_save(mame_file *cheatfile, const script_entry *entry)
{
astring *tempstring = astring_alloc();
/* output an action */
if (entry->format == NULL)
{
mame_fprintf(cheatfile, "\t\t\t<action");
if (entry->condition != NULL)
{
quote_astring_expression(astring_cpyc(tempstring, expression_original_string(entry->condition)), TRUE);
mame_fprintf(cheatfile, " condition=\"%s\"", astring_c(tempstring));
}
quote_astring_expression(astring_cpyc(tempstring, expression_original_string(entry->expression)), FALSE);
mame_fprintf(cheatfile, ">%s</action>\n", astring_c(tempstring));
}
/* output an output */
else
{
mame_fprintf(cheatfile, "\t\t\t<output format=\"%s\"", astring_c(entry->format));
if (entry->condition != NULL)
{
quote_astring_expression(astring_cpyc(tempstring, expression_original_string(entry->condition)), TRUE);
mame_fprintf(cheatfile, " condition=\"%s\"", astring_c(tempstring));
}
if (entry->line != 0)
mame_fprintf(cheatfile, " line=\"%d\"", entry->line);
if (entry->justify == JUSTIFY_CENTER)
mame_fprintf(cheatfile, " align=\"center\"");
else if (entry->justify == JUSTIFY_RIGHT)
mame_fprintf(cheatfile, " align=\"right\"");
if (entry->arglist == NULL)
mame_fprintf(cheatfile, " />\n");
/* output arguments */
else
{
const output_argument *curarg;
mame_fprintf(cheatfile, ">\n");
for (curarg = entry->arglist; curarg != NULL; curarg = curarg->next)
{
mame_fprintf(cheatfile, "\t\t\t\t<argument");
if (curarg->count != 1)
mame_fprintf(cheatfile, " count=\"%d\"", (int)curarg->count);
quote_astring_expression(astring_cpyc(tempstring, expression_original_string(curarg->expression)), FALSE);
mame_fprintf(cheatfile, ">%s</argument>\n", astring_c(tempstring));
}
mame_fprintf(cheatfile, "\t\t\t</output>\n");
}
}
astring_free(tempstring);
} | /*-------------------------------------------------
script_entry_save - save a single action
or output
-------------------------------------------------*/ | save a single action
or output | [
"save",
"a",
"single",
"action",
"or",
"output"
] | static void script_entry_save(mame_file *cheatfile, const script_entry *entry)
{
astring *tempstring = astring_alloc();
if (entry->format == NULL)
{
mame_fprintf(cheatfile, "\t\t\t<action");
if (entry->condition != NULL)
{
quote_astring_expression(astring_cpyc(tempstring, expression_original_string(entry->condition)), TRUE);
mame_fprintf(cheatfile, " condition=\"%s\"", astring_c(tempstring));
}
quote_astring_expression(astring_cpyc(tempstring, expression_original_string(entry->expression)), FALSE);
mame_fprintf(cheatfile, ">%s</action>\n", astring_c(tempstring));
}
else
{
mame_fprintf(cheatfile, "\t\t\t<output format=\"%s\"", astring_c(entry->format));
if (entry->condition != NULL)
{
quote_astring_expression(astring_cpyc(tempstring, expression_original_string(entry->condition)), TRUE);
mame_fprintf(cheatfile, " condition=\"%s\"", astring_c(tempstring));
}
if (entry->line != 0)
mame_fprintf(cheatfile, " line=\"%d\"", entry->line);
if (entry->justify == JUSTIFY_CENTER)
mame_fprintf(cheatfile, " align=\"center\"");
else if (entry->justify == JUSTIFY_RIGHT)
mame_fprintf(cheatfile, " align=\"right\"");
if (entry->arglist == NULL)
mame_fprintf(cheatfile, " />\n");
else
{
const output_argument *curarg;
mame_fprintf(cheatfile, ">\n");
for (curarg = entry->arglist; curarg != NULL; curarg = curarg->next)
{
mame_fprintf(cheatfile, "\t\t\t\t<argument");
if (curarg->count != 1)
mame_fprintf(cheatfile, " count=\"%d\"", (int)curarg->count);
quote_astring_expression(astring_cpyc(tempstring, expression_original_string(curarg->expression)), FALSE);
mame_fprintf(cheatfile, ">%s</argument>\n", astring_c(tempstring));
}
mame_fprintf(cheatfile, "\t\t\t</output>\n");
}
}
astring_free(tempstring);
} | [
"static",
"void",
"script_entry_save",
"(",
"mame_file",
"*",
"cheatfile",
",",
"const",
"script_entry",
"*",
"entry",
")",
"{",
"astring",
"*",
"tempstring",
"=",
"astring_alloc",
"(",
")",
";",
"if",
"(",
"entry",
"->",
"format",
"==",
"NULL",
")",
"{",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\t",
"\\t",
"\\t",
"\"",
")",
";",
"if",
"(",
"entry",
"->",
"condition",
"!=",
"NULL",
")",
"{",
"quote_astring_expression",
"(",
"astring_cpyc",
"(",
"tempstring",
",",
"expression_original_string",
"(",
"entry",
"->",
"condition",
")",
")",
",",
"TRUE",
")",
";",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"astring_c",
"(",
"tempstring",
")",
")",
";",
"}",
"quote_astring_expression",
"(",
"astring_cpyc",
"(",
"tempstring",
",",
"expression_original_string",
"(",
"entry",
"->",
"expression",
")",
")",
",",
"FALSE",
")",
";",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"tempstring",
")",
")",
";",
"}",
"else",
"{",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\t",
"\\t",
"\\t",
"\\\"",
"\\\"",
"\"",
",",
"astring_c",
"(",
"entry",
"->",
"format",
")",
")",
";",
"if",
"(",
"entry",
"->",
"condition",
"!=",
"NULL",
")",
"{",
"quote_astring_expression",
"(",
"astring_cpyc",
"(",
"tempstring",
",",
"expression_original_string",
"(",
"entry",
"->",
"condition",
")",
")",
",",
"TRUE",
")",
";",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"astring_c",
"(",
"tempstring",
")",
")",
";",
"}",
"if",
"(",
"entry",
"->",
"line",
"!=",
"0",
")",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"entry",
"->",
"line",
")",
";",
"if",
"(",
"entry",
"->",
"justify",
"==",
"JUSTIFY_CENTER",
")",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\\"",
"\\\"",
"\"",
")",
";",
"else",
"if",
"(",
"entry",
"->",
"justify",
"==",
"JUSTIFY_RIGHT",
")",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\\"",
"\\\"",
"\"",
")",
";",
"if",
"(",
"entry",
"->",
"arglist",
"==",
"NULL",
")",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\n",
"\"",
")",
";",
"else",
"{",
"const",
"output_argument",
"*",
"curarg",
";",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\n",
"\"",
")",
";",
"for",
"(",
"curarg",
"=",
"entry",
"->",
"arglist",
";",
"curarg",
"!=",
"NULL",
";",
"curarg",
"=",
"curarg",
"->",
"next",
")",
"{",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\t",
"\\t",
"\\t",
"\\t",
"\"",
")",
";",
"if",
"(",
"curarg",
"->",
"count",
"!=",
"1",
")",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"(",
"int",
")",
"curarg",
"->",
"count",
")",
";",
"quote_astring_expression",
"(",
"astring_cpyc",
"(",
"tempstring",
",",
"expression_original_string",
"(",
"curarg",
"->",
"expression",
")",
")",
",",
"FALSE",
")",
";",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"tempstring",
")",
")",
";",
"}",
"mame_fprintf",
"(",
"cheatfile",
",",
"\"",
"\\t",
"\\t",
"\\t",
"\\n",
"\"",
")",
";",
"}",
"}",
"astring_free",
"(",
"tempstring",
")",
";",
"}"
] | script_entry_save - save a single action
or output | [
"script_entry_save",
"-",
"save",
"a",
"single",
"action",
"or",
"output"
] | [
"/* output an action */",
"/* output an output */",
"/* output arguments */"
] | [
{
"param": "cheatfile",
"type": "mame_file"
},
{
"param": "entry",
"type": "script_entry"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cheatfile",
"type": "mame_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entry",
"type": "script_entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | quote_astring_expression | astring | static astring *quote_astring_expression(astring *string, int isattribute)
{
astring_replacec(string, 0, " && ", " and ");
astring_replacec(string, 0, " &&", " and ");
astring_replacec(string, 0, "&& ", " and ");
astring_replacec(string, 0, "&&", " and ");
astring_replacec(string, 0, " & ", " band ");
astring_replacec(string, 0, " &", " band ");
astring_replacec(string, 0, "& ", " band ");
astring_replacec(string, 0, "&", " band ");
astring_replacec(string, 0, " <= ", " le ");
astring_replacec(string, 0, " <=", " le ");
astring_replacec(string, 0, "<= ", " le ");
astring_replacec(string, 0, "<=", " le ");
astring_replacec(string, 0, " < ", " lt ");
astring_replacec(string, 0, " <", " lt ");
astring_replacec(string, 0, "< ", " lt ");
astring_replacec(string, 0, "<", " lt ");
astring_replacec(string, 0, " << ", " lshift ");
astring_replacec(string, 0, " <<", " lshift ");
astring_replacec(string, 0, "<< ", " lshift ");
astring_replacec(string, 0, "<<", " lshift ");
return string;
} | /*-------------------------------------------------
quote_astring_expression - quote an expression
string so that it is valid to embed in an XML
document
-------------------------------------------------*/ | quote an expression
string so that it is valid to embed in an XML
document | [
"quote",
"an",
"expression",
"string",
"so",
"that",
"it",
"is",
"valid",
"to",
"embed",
"in",
"an",
"XML",
"document"
] | static astring *quote_astring_expression(astring *string, int isattribute)
{
astring_replacec(string, 0, " && ", " and ");
astring_replacec(string, 0, " &&", " and ");
astring_replacec(string, 0, "&& ", " and ");
astring_replacec(string, 0, "&&", " and ");
astring_replacec(string, 0, " & ", " band ");
astring_replacec(string, 0, " &", " band ");
astring_replacec(string, 0, "& ", " band ");
astring_replacec(string, 0, "&", " band ");
astring_replacec(string, 0, " <= ", " le ");
astring_replacec(string, 0, " <=", " le ");
astring_replacec(string, 0, "<= ", " le ");
astring_replacec(string, 0, "<=", " le ");
astring_replacec(string, 0, " < ", " lt ");
astring_replacec(string, 0, " <", " lt ");
astring_replacec(string, 0, "< ", " lt ");
astring_replacec(string, 0, "<", " lt ");
astring_replacec(string, 0, " << ", " lshift ");
astring_replacec(string, 0, " <<", " lshift ");
astring_replacec(string, 0, "<< ", " lshift ");
astring_replacec(string, 0, "<<", " lshift ");
return string;
} | [
"static",
"astring",
"*",
"quote_astring_expression",
"(",
"astring",
"*",
"string",
",",
"int",
"isattribute",
")",
"{",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"astring_replacec",
"(",
"string",
",",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"return",
"string",
";",
"}"
] | quote_astring_expression - quote an expression
string so that it is valid to embed in an XML
document | [
"quote_astring_expression",
"-",
"quote",
"an",
"expression",
"string",
"so",
"that",
"it",
"is",
"valid",
"to",
"embed",
"in",
"an",
"XML",
"document"
] | [] | [
{
"param": "string",
"type": "astring"
},
{
"param": "isattribute",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "string",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "isattribute",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a9fc27df0cf93b5716af75517072c72e68d1567 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cheat.c | [
"Unlicense"
] | C | validate_format | int | static int validate_format(const char *filename, int line, const script_entry *entry)
{
const char *p = astring_c(entry->format);
const output_argument *curarg;
int argsprovided;
int argscounted;
/* first count arguments */
argsprovided = 0;
for (curarg = entry->arglist; curarg != NULL; curarg = curarg->next)
argsprovided += curarg->count;
/* now scan the string for valid argument usage */
p = strchr(p, '%');
argscounted = 0;
while (p != NULL)
{
/* skip past any valid attributes */
p++;
while (strchr("lh0123456789.-+ #", *p) != NULL)
p++;
/* look for a valid type */
if (strchr("cdiouxX", *p) == NULL)
{
mame_printf_error("%s.xml(%d): invalid format specification \"%s\"\n", filename, line, astring_c(entry->format));
return FALSE;
}
argscounted++;
/* look for the next one */
p = strchr(p, '%');
}
/* did we match? */
if (argscounted < argsprovided)
{
mame_printf_error("%s.xml(%d): too many arguments provided (%d) for format \"%s\"\n", filename, line, argsprovided, astring_c(entry->format));
return FALSE;
}
if (argscounted > argsprovided)
{
mame_printf_error("%s.xml(%d): not enough arguments provided (%d) for format \"%s\"\n", filename, line, argsprovided, astring_c(entry->format));
return FALSE;
}
return TRUE;
} | /*-------------------------------------------------
validate_format - check that a format string
has the correct number and type of arguments
-------------------------------------------------*/ | check that a format string
has the correct number and type of arguments | [
"check",
"that",
"a",
"format",
"string",
"has",
"the",
"correct",
"number",
"and",
"type",
"of",
"arguments"
] | static int validate_format(const char *filename, int line, const script_entry *entry)
{
const char *p = astring_c(entry->format);
const output_argument *curarg;
int argsprovided;
int argscounted;
argsprovided = 0;
for (curarg = entry->arglist; curarg != NULL; curarg = curarg->next)
argsprovided += curarg->count;
p = strchr(p, '%');
argscounted = 0;
while (p != NULL)
{
p++;
while (strchr("lh0123456789.-+ #", *p) != NULL)
p++;
if (strchr("cdiouxX", *p) == NULL)
{
mame_printf_error("%s.xml(%d): invalid format specification \"%s\"\n", filename, line, astring_c(entry->format));
return FALSE;
}
argscounted++;
p = strchr(p, '%');
}
if (argscounted < argsprovided)
{
mame_printf_error("%s.xml(%d): too many arguments provided (%d) for format \"%s\"\n", filename, line, argsprovided, astring_c(entry->format));
return FALSE;
}
if (argscounted > argsprovided)
{
mame_printf_error("%s.xml(%d): not enough arguments provided (%d) for format \"%s\"\n", filename, line, argsprovided, astring_c(entry->format));
return FALSE;
}
return TRUE;
} | [
"static",
"int",
"validate_format",
"(",
"const",
"char",
"*",
"filename",
",",
"int",
"line",
",",
"const",
"script_entry",
"*",
"entry",
")",
"{",
"const",
"char",
"*",
"p",
"=",
"astring_c",
"(",
"entry",
"->",
"format",
")",
";",
"const",
"output_argument",
"*",
"curarg",
";",
"int",
"argsprovided",
";",
"int",
"argscounted",
";",
"argsprovided",
"=",
"0",
";",
"for",
"(",
"curarg",
"=",
"entry",
"->",
"arglist",
";",
"curarg",
"!=",
"NULL",
";",
"curarg",
"=",
"curarg",
"->",
"next",
")",
"argsprovided",
"+=",
"curarg",
"->",
"count",
";",
"p",
"=",
"strchr",
"(",
"p",
",",
"'",
"'",
")",
";",
"argscounted",
"=",
"0",
";",
"while",
"(",
"p",
"!=",
"NULL",
")",
"{",
"p",
"++",
";",
"while",
"(",
"strchr",
"(",
"\"",
"\"",
",",
"*",
"p",
")",
"!=",
"NULL",
")",
"p",
"++",
";",
"if",
"(",
"strchr",
"(",
"\"",
"\"",
",",
"*",
"p",
")",
"==",
"NULL",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"filename",
",",
"line",
",",
"astring_c",
"(",
"entry",
"->",
"format",
")",
")",
";",
"return",
"FALSE",
";",
"}",
"argscounted",
"++",
";",
"p",
"=",
"strchr",
"(",
"p",
",",
"'",
"'",
")",
";",
"}",
"if",
"(",
"argscounted",
"<",
"argsprovided",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"filename",
",",
"line",
",",
"argsprovided",
",",
"astring_c",
"(",
"entry",
"->",
"format",
")",
")",
";",
"return",
"FALSE",
";",
"}",
"if",
"(",
"argscounted",
">",
"argsprovided",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"filename",
",",
"line",
",",
"argsprovided",
",",
"astring_c",
"(",
"entry",
"->",
"format",
")",
")",
";",
"return",
"FALSE",
";",
"}",
"return",
"TRUE",
";",
"}"
] | validate_format - check that a format string
has the correct number and type of arguments | [
"validate_format",
"-",
"check",
"that",
"a",
"format",
"string",
"has",
"the",
"correct",
"number",
"and",
"type",
"of",
"arguments"
] | [
"/* first count arguments */",
"/* now scan the string for valid argument usage */",
"/* skip past any valid attributes */",
"/* look for a valid type */",
"/* look for the next one */",
"/* did we match? */"
] | [
{
"param": "filename",
"type": "char"
},
{
"param": "line",
"type": "int"
},
{
"param": "entry",
"type": "script_entry"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "line",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entry",
"type": "script_entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bda7671293430e48babb449579538cfe39c5fa69 | lofunz/mieme | Reloaded/trunk/src/mame/drivers/srmp6.c | [
"Unlicense"
] | C | process | UINT32 | static UINT32 process(running_machine *machine,UINT8 b,UINT32 dst_offset)
{
srmp6_state *state = machine->driver_data<srmp6_state>();
int l=0;
UINT8 *tram=(UINT8*)state->tileram;
if (state->lastb == state->lastb2) //rle
{
int i;
int rle=(b+1)&0xff;
for(i=0;i<rle;++i)
{
tram[dst_offset + state->destl] = state->lastb;
gfx_element_mark_dirty(machine->gfx[0], (dst_offset + state->destl)/0x40);
dst_offset++;
++l;
}
state->lastb2 = 0xffff;
return l;
}
else
{
state->lastb2 = state->lastb;
state->lastb = b;
tram[dst_offset + state->destl] = b;
gfx_element_mark_dirty(machine->gfx[0], (dst_offset + state->destl)/0x40);
return 1;
}
} | /* DMA RLE stuff - the same as CPS3 */ | DMA RLE stuff - the same as CPS3 | [
"DMA",
"RLE",
"stuff",
"-",
"the",
"same",
"as",
"CPS3"
] | static UINT32 process(running_machine *machine,UINT8 b,UINT32 dst_offset)
{
srmp6_state *state = machine->driver_data<srmp6_state>();
int l=0;
UINT8 *tram=(UINT8*)state->tileram;
if (state->lastb == state->lastb2)
{
int i;
int rle=(b+1)&0xff;
for(i=0;i<rle;++i)
{
tram[dst_offset + state->destl] = state->lastb;
gfx_element_mark_dirty(machine->gfx[0], (dst_offset + state->destl)/0x40);
dst_offset++;
++l;
}
state->lastb2 = 0xffff;
return l;
}
else
{
state->lastb2 = state->lastb;
state->lastb = b;
tram[dst_offset + state->destl] = b;
gfx_element_mark_dirty(machine->gfx[0], (dst_offset + state->destl)/0x40);
return 1;
}
} | [
"static",
"UINT32",
"process",
"(",
"running_machine",
"*",
"machine",
",",
"UINT8",
"b",
",",
"UINT32",
"dst_offset",
")",
"{",
"srmp6_state",
"*",
"state",
"=",
"machine",
"->",
"driver_data",
"<",
"srmp6_state",
">",
"(",
"",
")",
";",
"int",
"l",
"=",
"0",
";",
"UINT8",
"*",
"tram",
"=",
"(",
"UINT8",
"*",
")",
"state",
"->",
"tileram",
";",
"if",
"(",
"state",
"->",
"lastb",
"==",
"state",
"->",
"lastb2",
")",
"{",
"int",
"i",
";",
"int",
"rle",
"=",
"(",
"b",
"+",
"1",
")",
"&",
"0xff",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"rle",
";",
"++",
"i",
")",
"{",
"tram",
"[",
"dst_offset",
"+",
"state",
"->",
"destl",
"]",
"=",
"state",
"->",
"lastb",
";",
"gfx_element_mark_dirty",
"(",
"machine",
"->",
"gfx",
"[",
"0",
"]",
",",
"(",
"dst_offset",
"+",
"state",
"->",
"destl",
")",
"/",
"0x40",
")",
";",
"dst_offset",
"++",
";",
"++",
"l",
";",
"}",
"state",
"->",
"lastb2",
"=",
"0xffff",
";",
"return",
"l",
";",
"}",
"else",
"{",
"state",
"->",
"lastb2",
"=",
"state",
"->",
"lastb",
";",
"state",
"->",
"lastb",
"=",
"b",
";",
"tram",
"[",
"dst_offset",
"+",
"state",
"->",
"destl",
"]",
"=",
"b",
";",
"gfx_element_mark_dirty",
"(",
"machine",
"->",
"gfx",
"[",
"0",
"]",
",",
"(",
"dst_offset",
"+",
"state",
"->",
"destl",
")",
"/",
"0x40",
")",
";",
"return",
"1",
";",
"}",
"}"
] | DMA RLE stuff - the same as CPS3 | [
"DMA",
"RLE",
"stuff",
"-",
"the",
"same",
"as",
"CPS3"
] | [
"//rle\r"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "b",
"type": "UINT8"
},
{
"param": "dst_offset",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "b",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst_offset",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
150b244d3fcf3c658bee8ee0e7225ce7562d8cac | lofunz/mieme | Reloaded/trunk/src/emu/validity.c | [
"Unlicense"
] | C | validate_tag | bool | bool validate_tag(const game_driver *driver, const char *object, const char *tag)
{
const char *validchars = "abcdefghijklmnopqrstuvwxyz0123456789_.:";
const char *begin = strrchr(tag, ':');
const char *p;
bool error = false;
/* some common names that are now deprecated */
if (strcmp(tag, "main") == 0 ||
strcmp(tag, "audio") == 0 ||
strcmp(tag, "sound") == 0 ||
strcmp(tag, "left") == 0 ||
strcmp(tag, "right") == 0)
{
mame_printf_error("%s: %s has invalid generic tag '%s'\n", driver->source_file, driver->name, tag);
error = true;
}
for (p = tag; *p != 0; p++)
{
if (*p != tolower((UINT8)*p))
{
mame_printf_error("%s: %s has %s with tag '%s' containing upper-case characters\n", driver->source_file, driver->name, object, tag);
error = true;
break;
}
if (*p == ' ')
{
mame_printf_error("%s: %s has %s with tag '%s' containing spaces\n", driver->source_file, driver->name, object, tag);
error = true;
break;
}
if (strchr(validchars, *p) == NULL)
{
mame_printf_error("%s: %s has %s with tag '%s' containing invalid character '%c'\n", driver->source_file, driver->name, object, tag, *p);
error = true;
break;
}
}
if (begin == NULL)
begin = tag;
else
begin += 1;
if (strlen(begin) == 0)
{
mame_printf_error("%s: %s has %s with 0-length tag\n", driver->source_file, driver->name, object);
error = true;
}
if (strlen(begin) < MIN_TAG_LENGTH)
{
mame_printf_error("%s: %s has %s with tag '%s' < %d characters\n", driver->source_file, driver->name, object, tag, MIN_TAG_LENGTH);
error = true;
}
if (strlen(begin) > MAX_TAG_LENGTH)
{
mame_printf_error("%s: %s has %s with tag '%s' > %d characters\n", driver->source_file, driver->name, object, tag, MAX_TAG_LENGTH);
error = true;
}
return !error;
} | /*-------------------------------------------------
validate_tag - ensure that the given tag
meets the general requirements
-------------------------------------------------*/ | ensure that the given tag
meets the general requirements | [
"ensure",
"that",
"the",
"given",
"tag",
"meets",
"the",
"general",
"requirements"
] | bool validate_tag(const game_driver *driver, const char *object, const char *tag)
{
const char *validchars = "abcdefghijklmnopqrstuvwxyz0123456789_.:";
const char *begin = strrchr(tag, ':');
const char *p;
bool error = false;
if (strcmp(tag, "main") == 0 ||
strcmp(tag, "audio") == 0 ||
strcmp(tag, "sound") == 0 ||
strcmp(tag, "left") == 0 ||
strcmp(tag, "right") == 0)
{
mame_printf_error("%s: %s has invalid generic tag '%s'\n", driver->source_file, driver->name, tag);
error = true;
}
for (p = tag; *p != 0; p++)
{
if (*p != tolower((UINT8)*p))
{
mame_printf_error("%s: %s has %s with tag '%s' containing upper-case characters\n", driver->source_file, driver->name, object, tag);
error = true;
break;
}
if (*p == ' ')
{
mame_printf_error("%s: %s has %s with tag '%s' containing spaces\n", driver->source_file, driver->name, object, tag);
error = true;
break;
}
if (strchr(validchars, *p) == NULL)
{
mame_printf_error("%s: %s has %s with tag '%s' containing invalid character '%c'\n", driver->source_file, driver->name, object, tag, *p);
error = true;
break;
}
}
if (begin == NULL)
begin = tag;
else
begin += 1;
if (strlen(begin) == 0)
{
mame_printf_error("%s: %s has %s with 0-length tag\n", driver->source_file, driver->name, object);
error = true;
}
if (strlen(begin) < MIN_TAG_LENGTH)
{
mame_printf_error("%s: %s has %s with tag '%s' < %d characters\n", driver->source_file, driver->name, object, tag, MIN_TAG_LENGTH);
error = true;
}
if (strlen(begin) > MAX_TAG_LENGTH)
{
mame_printf_error("%s: %s has %s with tag '%s' > %d characters\n", driver->source_file, driver->name, object, tag, MAX_TAG_LENGTH);
error = true;
}
return !error;
} | [
"bool",
"validate_tag",
"(",
"const",
"game_driver",
"*",
"driver",
",",
"const",
"char",
"*",
"object",
",",
"const",
"char",
"*",
"tag",
")",
"{",
"const",
"char",
"*",
"validchars",
"=",
"\"",
"\"",
";",
"const",
"char",
"*",
"begin",
"=",
"strrchr",
"(",
"tag",
",",
"'",
"'",
")",
";",
"const",
"char",
"*",
"p",
";",
"bool",
"error",
"=",
"false",
";",
"if",
"(",
"strcmp",
"(",
"tag",
",",
"\"",
"\"",
")",
"==",
"0",
"||",
"strcmp",
"(",
"tag",
",",
"\"",
"\"",
")",
"==",
"0",
"||",
"strcmp",
"(",
"tag",
",",
"\"",
"\"",
")",
"==",
"0",
"||",
"strcmp",
"(",
"tag",
",",
"\"",
"\"",
")",
"==",
"0",
"||",
"strcmp",
"(",
"tag",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"driver",
"->",
"source_file",
",",
"driver",
"->",
"name",
",",
"tag",
")",
";",
"error",
"=",
"true",
";",
"}",
"for",
"(",
"p",
"=",
"tag",
";",
"*",
"p",
"!=",
"0",
";",
"p",
"++",
")",
"{",
"if",
"(",
"*",
"p",
"!=",
"tolower",
"(",
"(",
"UINT8",
")",
"*",
"p",
")",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"driver",
"->",
"source_file",
",",
"driver",
"->",
"name",
",",
"object",
",",
"tag",
")",
";",
"error",
"=",
"true",
";",
"break",
";",
"}",
"if",
"(",
"*",
"p",
"==",
"'",
"'",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"driver",
"->",
"source_file",
",",
"driver",
"->",
"name",
",",
"object",
",",
"tag",
")",
";",
"error",
"=",
"true",
";",
"break",
";",
"}",
"if",
"(",
"strchr",
"(",
"validchars",
",",
"*",
"p",
")",
"==",
"NULL",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"driver",
"->",
"source_file",
",",
"driver",
"->",
"name",
",",
"object",
",",
"tag",
",",
"*",
"p",
")",
";",
"error",
"=",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"begin",
"==",
"NULL",
")",
"begin",
"=",
"tag",
";",
"else",
"begin",
"+=",
"1",
";",
"if",
"(",
"strlen",
"(",
"begin",
")",
"==",
"0",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"driver",
"->",
"source_file",
",",
"driver",
"->",
"name",
",",
"object",
")",
";",
"error",
"=",
"true",
";",
"}",
"if",
"(",
"strlen",
"(",
"begin",
")",
"<",
"MIN_TAG_LENGTH",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"driver",
"->",
"source_file",
",",
"driver",
"->",
"name",
",",
"object",
",",
"tag",
",",
"MIN_TAG_LENGTH",
")",
";",
"error",
"=",
"true",
";",
"}",
"if",
"(",
"strlen",
"(",
"begin",
")",
">",
"MAX_TAG_LENGTH",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"driver",
"->",
"source_file",
",",
"driver",
"->",
"name",
",",
"object",
",",
"tag",
",",
"MAX_TAG_LENGTH",
")",
";",
"error",
"=",
"true",
";",
"}",
"return",
"!",
"error",
";",
"}"
] | validate_tag - ensure that the given tag
meets the general requirements | [
"validate_tag",
"-",
"ensure",
"that",
"the",
"given",
"tag",
"meets",
"the",
"general",
"requirements"
] | [
"/* some common names that are now deprecated */"
] | [
{
"param": "driver",
"type": "game_driver"
},
{
"param": "object",
"type": "char"
},
{
"param": "tag",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "driver",
"type": "game_driver",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "object",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c80ccf8f5c94ff689a1c3d5bbc7cc8e07ef1521b | lofunz/mieme | Reloaded/trunk/src/osd/sdl/sdlos_win32.c | [
"Unlicense"
] | C | init_cycle_counter | osd_ticks_t | static osd_ticks_t init_cycle_counter(void)
{
osd_ticks_t start, end;
osd_ticks_t a, b;
int priority = GetThreadPriority(GetCurrentThread());
LARGE_INTEGER frequency;
if (QueryPerformanceFrequency( &frequency ))
{
// use performance counter if available as it is constant
cycle_counter = performance_cycle_counter;
ticks_counter = performance_cycle_counter;
ticks_per_second = frequency.QuadPart;
// return the current cycle count
return (*cycle_counter)();
}
else
{
fprintf(stderr, "Error! Unable to QueryPerformanceFrequency!\n");
exit(-1);
}
// temporarily set our priority higher
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
// wait for an edge on the timeGetTime call
a = SDL_GetTicks();
do
{
b = SDL_GetTicks();
} while (a == b);
// get the starting cycle count
start = (*cycle_counter)();
// now wait for 1/4 second total
do
{
a = SDL_GetTicks();
} while (a - b < 250);
// get the ending cycle count
end = (*cycle_counter)();
// compute ticks_per_sec
ticks_per_second = (end - start) * 4;
// restore our priority
SetThreadPriority(GetCurrentThread(), priority);
// return the current cycle count
return (*cycle_counter)();
} | //============================================================
// init_cycle_counter
//
// to avoid total grossness, this function is split by subarch
//============================================================
| init_cycle_counter
to avoid total grossness, this function is split by subarch | [
"init_cycle_counter",
"to",
"avoid",
"total",
"grossness",
"this",
"function",
"is",
"split",
"by",
"subarch"
] | static osd_ticks_t init_cycle_counter(void)
{
osd_ticks_t start, end;
osd_ticks_t a, b;
int priority = GetThreadPriority(GetCurrentThread());
LARGE_INTEGER frequency;
if (QueryPerformanceFrequency( &frequency ))
{
cycle_counter = performance_cycle_counter;
ticks_counter = performance_cycle_counter;
ticks_per_second = frequency.QuadPart;
return (*cycle_counter)();
}
else
{
fprintf(stderr, "Error! Unable to QueryPerformanceFrequency!\n");
exit(-1);
}
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
a = SDL_GetTicks();
do
{
b = SDL_GetTicks();
} while (a == b);
start = (*cycle_counter)();
do
{
a = SDL_GetTicks();
} while (a - b < 250);
end = (*cycle_counter)();
ticks_per_second = (end - start) * 4;
SetThreadPriority(GetCurrentThread(), priority);
return (*cycle_counter)();
} | [
"static",
"osd_ticks_t",
"init_cycle_counter",
"(",
"void",
")",
"{",
"osd_ticks_t",
"start",
",",
"end",
";",
"osd_ticks_t",
"a",
",",
"b",
";",
"int",
"priority",
"=",
"GetThreadPriority",
"(",
"GetCurrentThread",
"(",
")",
")",
";",
"LARGE_INTEGER",
"frequency",
";",
"if",
"(",
"QueryPerformanceFrequency",
"(",
"&",
"frequency",
")",
")",
"{",
"cycle_counter",
"=",
"performance_cycle_counter",
";",
"ticks_counter",
"=",
"performance_cycle_counter",
";",
"ticks_per_second",
"=",
"frequency",
".",
"QuadPart",
";",
"return",
"(",
"*",
"cycle_counter",
")",
"(",
")",
";",
"}",
"else",
"{",
"fprintf",
"(",
"stderr",
",",
"\"",
"\\n",
"\"",
")",
";",
"exit",
"(",
"-1",
")",
";",
"}",
"SetThreadPriority",
"(",
"GetCurrentThread",
"(",
")",
",",
"THREAD_PRIORITY_TIME_CRITICAL",
")",
";",
"a",
"=",
"SDL_GetTicks",
"(",
")",
";",
"do",
"{",
"b",
"=",
"SDL_GetTicks",
"(",
")",
";",
"}",
"while",
"(",
"a",
"==",
"b",
")",
";",
"start",
"=",
"(",
"*",
"cycle_counter",
")",
"(",
")",
";",
"do",
"{",
"a",
"=",
"SDL_GetTicks",
"(",
")",
";",
"}",
"while",
"(",
"a",
"-",
"b",
"<",
"250",
")",
";",
"end",
"=",
"(",
"*",
"cycle_counter",
")",
"(",
")",
";",
"ticks_per_second",
"=",
"(",
"end",
"-",
"start",
")",
"*",
"4",
";",
"SetThreadPriority",
"(",
"GetCurrentThread",
"(",
")",
",",
"priority",
")",
";",
"return",
"(",
"*",
"cycle_counter",
")",
"(",
")",
";",
"}"
] | init_cycle_counter
to avoid total grossness, this function is split by subarch | [
"init_cycle_counter",
"to",
"avoid",
"total",
"grossness",
"this",
"function",
"is",
"split",
"by",
"subarch"
] | [
"// use performance counter if available as it is constant\r",
"// return the current cycle count\r",
"// temporarily set our priority higher\r",
"// wait for an edge on the timeGetTime call\r",
"// get the starting cycle count\r",
"// now wait for 1/4 second total\r",
"// get the ending cycle count\r",
"// compute ticks_per_sec\r",
"// restore our priority\r",
"// return the current cycle count\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
6a705d7912deb0b7c4f2891fd15b0dddfa3b8b6f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drccache.c | [
"Unlicense"
] | C | drccache_memory_alloc | void | void *drccache_memory_alloc(drccache *cache, size_t bytes)
{
drccodeptr ptr;
assert(bytes > 0);
/* pick first from the free list */
if (bytes < MAX_PERMANENT_ALLOC)
{
free_link **linkptr = &cache->free[(bytes + CACHE_ALIGNMENT - 1) / CACHE_ALIGNMENT];
free_link *link = *linkptr;
if (link != NULL)
{
*linkptr = link->next;
return link;
}
}
/* if no space, we just fail */
ptr = (drccodeptr)ALIGN_PTR_DOWN(cache->end - bytes);
if (cache->top > ptr)
return NULL;
/* otherwise update the end of the cache */
cache->end = ptr;
return ptr;
} | /*-------------------------------------------------
drccache_memory_alloc - allocate permanent
memory from the cache
-------------------------------------------------*/ | allocate permanent
memory from the cache | [
"allocate",
"permanent",
"memory",
"from",
"the",
"cache"
] | void *drccache_memory_alloc(drccache *cache, size_t bytes)
{
drccodeptr ptr;
assert(bytes > 0);
if (bytes < MAX_PERMANENT_ALLOC)
{
free_link **linkptr = &cache->free[(bytes + CACHE_ALIGNMENT - 1) / CACHE_ALIGNMENT];
free_link *link = *linkptr;
if (link != NULL)
{
*linkptr = link->next;
return link;
}
}
ptr = (drccodeptr)ALIGN_PTR_DOWN(cache->end - bytes);
if (cache->top > ptr)
return NULL;
cache->end = ptr;
return ptr;
} | [
"void",
"*",
"drccache_memory_alloc",
"(",
"drccache",
"*",
"cache",
",",
"size_t",
"bytes",
")",
"{",
"drccodeptr",
"ptr",
";",
"assert",
"(",
"bytes",
">",
"0",
")",
";",
"if",
"(",
"bytes",
"<",
"MAX_PERMANENT_ALLOC",
")",
"{",
"free_link",
"*",
"*",
"linkptr",
"=",
"&",
"cache",
"->",
"free",
"[",
"(",
"bytes",
"+",
"CACHE_ALIGNMENT",
"-",
"1",
")",
"/",
"CACHE_ALIGNMENT",
"]",
";",
"free_link",
"*",
"link",
"=",
"*",
"linkptr",
";",
"if",
"(",
"link",
"!=",
"NULL",
")",
"{",
"*",
"linkptr",
"=",
"link",
"->",
"next",
";",
"return",
"link",
";",
"}",
"}",
"ptr",
"=",
"(",
"drccodeptr",
")",
"ALIGN_PTR_DOWN",
"(",
"cache",
"->",
"end",
"-",
"bytes",
")",
";",
"if",
"(",
"cache",
"->",
"top",
">",
"ptr",
")",
"return",
"NULL",
";",
"cache",
"->",
"end",
"=",
"ptr",
";",
"return",
"ptr",
";",
"}"
] | drccache_memory_alloc - allocate permanent
memory from the cache | [
"drccache_memory_alloc",
"-",
"allocate",
"permanent",
"memory",
"from",
"the",
"cache"
] | [
"/* pick first from the free list */",
"/* if no space, we just fail */",
"/* otherwise update the end of the cache */"
] | [
{
"param": "cache",
"type": "drccache"
},
{
"param": "bytes",
"type": "size_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cache",
"type": "drccache",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bytes",
"type": "size_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a705d7912deb0b7c4f2891fd15b0dddfa3b8b6f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drccache.c | [
"Unlicense"
] | C | drccache_memory_alloc_near | void | void *drccache_memory_alloc_near(drccache *cache, size_t bytes)
{
drccodeptr ptr;
assert(bytes > 0);
/* pick first from the free list */
if (bytes < MAX_PERMANENT_ALLOC)
{
free_link **linkptr = &cache->nearfree[(bytes + CACHE_ALIGNMENT - 1) / CACHE_ALIGNMENT];
free_link *link = *linkptr;
if (link != NULL)
{
*linkptr = link->next;
return link;
}
}
/* if no space, we just fail */
ptr = (drccodeptr)ALIGN_PTR_UP(cache->neartop);
if (ptr + bytes > cache->base)
return NULL;
/* otherwise update the top of the near part of the cache */
cache->neartop = ptr + bytes;
return ptr;
} | /*-------------------------------------------------
drccache_memory_alloc_near - allocate
permanent memory from the near part of the
cache
-------------------------------------------------*/ | allocate
permanent memory from the near part of the
cache | [
"allocate",
"permanent",
"memory",
"from",
"the",
"near",
"part",
"of",
"the",
"cache"
] | void *drccache_memory_alloc_near(drccache *cache, size_t bytes)
{
drccodeptr ptr;
assert(bytes > 0);
if (bytes < MAX_PERMANENT_ALLOC)
{
free_link **linkptr = &cache->nearfree[(bytes + CACHE_ALIGNMENT - 1) / CACHE_ALIGNMENT];
free_link *link = *linkptr;
if (link != NULL)
{
*linkptr = link->next;
return link;
}
}
ptr = (drccodeptr)ALIGN_PTR_UP(cache->neartop);
if (ptr + bytes > cache->base)
return NULL;
cache->neartop = ptr + bytes;
return ptr;
} | [
"void",
"*",
"drccache_memory_alloc_near",
"(",
"drccache",
"*",
"cache",
",",
"size_t",
"bytes",
")",
"{",
"drccodeptr",
"ptr",
";",
"assert",
"(",
"bytes",
">",
"0",
")",
";",
"if",
"(",
"bytes",
"<",
"MAX_PERMANENT_ALLOC",
")",
"{",
"free_link",
"*",
"*",
"linkptr",
"=",
"&",
"cache",
"->",
"nearfree",
"[",
"(",
"bytes",
"+",
"CACHE_ALIGNMENT",
"-",
"1",
")",
"/",
"CACHE_ALIGNMENT",
"]",
";",
"free_link",
"*",
"link",
"=",
"*",
"linkptr",
";",
"if",
"(",
"link",
"!=",
"NULL",
")",
"{",
"*",
"linkptr",
"=",
"link",
"->",
"next",
";",
"return",
"link",
";",
"}",
"}",
"ptr",
"=",
"(",
"drccodeptr",
")",
"ALIGN_PTR_UP",
"(",
"cache",
"->",
"neartop",
")",
";",
"if",
"(",
"ptr",
"+",
"bytes",
">",
"cache",
"->",
"base",
")",
"return",
"NULL",
";",
"cache",
"->",
"neartop",
"=",
"ptr",
"+",
"bytes",
";",
"return",
"ptr",
";",
"}"
] | drccache_memory_alloc_near - allocate
permanent memory from the near part of the
cache | [
"drccache_memory_alloc_near",
"-",
"allocate",
"permanent",
"memory",
"from",
"the",
"near",
"part",
"of",
"the",
"cache"
] | [
"/* pick first from the free list */",
"/* if no space, we just fail */",
"/* otherwise update the top of the near part of the cache */"
] | [
{
"param": "cache",
"type": "drccache"
},
{
"param": "bytes",
"type": "size_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cache",
"type": "drccache",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bytes",
"type": "size_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a705d7912deb0b7c4f2891fd15b0dddfa3b8b6f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drccache.c | [
"Unlicense"
] | C | drccache_memory_free | void | void drccache_memory_free(drccache *cache, void *memory, size_t bytes)
{
free_link **linkptr;
free_link *link = (free_link *)memory;
assert(bytes < MAX_PERMANENT_ALLOC);
assert(((drccodeptr)memory >= cache->near && (drccodeptr)memory < cache->base) || ((drccodeptr)memory >= cache->end && (drccodeptr)memory < cache->near + cache->size));
/* determine which free list to add to */
if ((drccodeptr)memory < cache->base)
linkptr = &cache->nearfree[(bytes + CACHE_ALIGNMENT - 1) / CACHE_ALIGNMENT];
else
linkptr = &cache->free[(bytes + CACHE_ALIGNMENT - 1) / CACHE_ALIGNMENT];
/* link is into the free list for our size */
link->next = *linkptr;
*linkptr = link;
} | /*-------------------------------------------------
drccache_memory_free - release permanent
memory allocated from the cache
-------------------------------------------------*/ | release permanent
memory allocated from the cache | [
"release",
"permanent",
"memory",
"allocated",
"from",
"the",
"cache"
] | void drccache_memory_free(drccache *cache, void *memory, size_t bytes)
{
free_link **linkptr;
free_link *link = (free_link *)memory;
assert(bytes < MAX_PERMANENT_ALLOC);
assert(((drccodeptr)memory >= cache->near && (drccodeptr)memory < cache->base) || ((drccodeptr)memory >= cache->end && (drccodeptr)memory < cache->near + cache->size));
if ((drccodeptr)memory < cache->base)
linkptr = &cache->nearfree[(bytes + CACHE_ALIGNMENT - 1) / CACHE_ALIGNMENT];
else
linkptr = &cache->free[(bytes + CACHE_ALIGNMENT - 1) / CACHE_ALIGNMENT];
link->next = *linkptr;
*linkptr = link;
} | [
"void",
"drccache_memory_free",
"(",
"drccache",
"*",
"cache",
",",
"void",
"*",
"memory",
",",
"size_t",
"bytes",
")",
"{",
"free_link",
"*",
"*",
"linkptr",
";",
"free_link",
"*",
"link",
"=",
"(",
"free_link",
"*",
")",
"memory",
";",
"assert",
"(",
"bytes",
"<",
"MAX_PERMANENT_ALLOC",
")",
";",
"assert",
"(",
"(",
"(",
"drccodeptr",
")",
"memory",
">=",
"cache",
"->",
"near",
"&&",
"(",
"drccodeptr",
")",
"memory",
"<",
"cache",
"->",
"base",
")",
"||",
"(",
"(",
"drccodeptr",
")",
"memory",
">=",
"cache",
"->",
"end",
"&&",
"(",
"drccodeptr",
")",
"memory",
"<",
"cache",
"->",
"near",
"+",
"cache",
"->",
"size",
")",
")",
";",
"if",
"(",
"(",
"drccodeptr",
")",
"memory",
"<",
"cache",
"->",
"base",
")",
"linkptr",
"=",
"&",
"cache",
"->",
"nearfree",
"[",
"(",
"bytes",
"+",
"CACHE_ALIGNMENT",
"-",
"1",
")",
"/",
"CACHE_ALIGNMENT",
"]",
";",
"else",
"linkptr",
"=",
"&",
"cache",
"->",
"free",
"[",
"(",
"bytes",
"+",
"CACHE_ALIGNMENT",
"-",
"1",
")",
"/",
"CACHE_ALIGNMENT",
"]",
";",
"link",
"->",
"next",
"=",
"*",
"linkptr",
";",
"*",
"linkptr",
"=",
"link",
";",
"}"
] | drccache_memory_free - release permanent
memory allocated from the cache | [
"drccache_memory_free",
"-",
"release",
"permanent",
"memory",
"allocated",
"from",
"the",
"cache"
] | [
"/* determine which free list to add to */",
"/* link is into the free list for our size */"
] | [
{
"param": "cache",
"type": "drccache"
},
{
"param": "memory",
"type": "void"
},
{
"param": "bytes",
"type": "size_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cache",
"type": "drccache",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "memory",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bytes",
"type": "size_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a705d7912deb0b7c4f2891fd15b0dddfa3b8b6f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drccache.c | [
"Unlicense"
] | C | drccache_memory_alloc_temporary | void | void *drccache_memory_alloc_temporary(drccache *cache, size_t bytes)
{
drccodeptr ptr = cache->top;
/* can't allocate in the middle of codegen */
assert(cache->codegen == NULL);
/* if no space, we just fail */
if (ptr + bytes >= cache->end)
return NULL;
/* otherwise, update the cache top */
cache->top = (drccodeptr)ALIGN_PTR_UP(ptr + bytes);
return ptr;
} | /*-------------------------------------------------
drccache_memory_alloc_temporary - allocate
temporary memory from the cache
-------------------------------------------------*/ | allocate
temporary memory from the cache | [
"allocate",
"temporary",
"memory",
"from",
"the",
"cache"
] | void *drccache_memory_alloc_temporary(drccache *cache, size_t bytes)
{
drccodeptr ptr = cache->top;
assert(cache->codegen == NULL);
if (ptr + bytes >= cache->end)
return NULL;
cache->top = (drccodeptr)ALIGN_PTR_UP(ptr + bytes);
return ptr;
} | [
"void",
"*",
"drccache_memory_alloc_temporary",
"(",
"drccache",
"*",
"cache",
",",
"size_t",
"bytes",
")",
"{",
"drccodeptr",
"ptr",
"=",
"cache",
"->",
"top",
";",
"assert",
"(",
"cache",
"->",
"codegen",
"==",
"NULL",
")",
";",
"if",
"(",
"ptr",
"+",
"bytes",
">=",
"cache",
"->",
"end",
")",
"return",
"NULL",
";",
"cache",
"->",
"top",
"=",
"(",
"drccodeptr",
")",
"ALIGN_PTR_UP",
"(",
"ptr",
"+",
"bytes",
")",
";",
"return",
"ptr",
";",
"}"
] | drccache_memory_alloc_temporary - allocate
temporary memory from the cache | [
"drccache_memory_alloc_temporary",
"-",
"allocate",
"temporary",
"memory",
"from",
"the",
"cache"
] | [
"/* can't allocate in the middle of codegen */",
"/* if no space, we just fail */",
"/* otherwise, update the cache top */"
] | [
{
"param": "cache",
"type": "drccache"
},
{
"param": "bytes",
"type": "size_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cache",
"type": "drccache",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bytes",
"type": "size_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a705d7912deb0b7c4f2891fd15b0dddfa3b8b6f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drccache.c | [
"Unlicense"
] | C | drccache_request_oob_codegen | void | void drccache_request_oob_codegen(drccache *cache, drccache_oob_func callback, void *param1, void *param2, void *param3)
{
oob_handler *oob;
assert(cache->codegen != NULL);
/* pull an item from the free list */
oob = (oob_handler *)drccache_memory_alloc(cache, sizeof(*oob));
assert(oob != NULL);
/* fill it in */
oob->next = NULL;
oob->callback = callback;
oob->param1 = param1;
oob->param2 = param2;
oob->param3 = param3;
/* add to the tail */
*cache->oobtail = oob;
cache->oobtail = &oob->next;
} | /*-------------------------------------------------
drccache_request_oob_codegen - request
callback for out-of-band codegen
-------------------------------------------------*/ | request
callback for out-of-band codegen | [
"request",
"callback",
"for",
"out",
"-",
"of",
"-",
"band",
"codegen"
] | void drccache_request_oob_codegen(drccache *cache, drccache_oob_func callback, void *param1, void *param2, void *param3)
{
oob_handler *oob;
assert(cache->codegen != NULL);
oob = (oob_handler *)drccache_memory_alloc(cache, sizeof(*oob));
assert(oob != NULL);
oob->next = NULL;
oob->callback = callback;
oob->param1 = param1;
oob->param2 = param2;
oob->param3 = param3;
*cache->oobtail = oob;
cache->oobtail = &oob->next;
} | [
"void",
"drccache_request_oob_codegen",
"(",
"drccache",
"*",
"cache",
",",
"drccache_oob_func",
"callback",
",",
"void",
"*",
"param1",
",",
"void",
"*",
"param2",
",",
"void",
"*",
"param3",
")",
"{",
"oob_handler",
"*",
"oob",
";",
"assert",
"(",
"cache",
"->",
"codegen",
"!=",
"NULL",
")",
";",
"oob",
"=",
"(",
"oob_handler",
"*",
")",
"drccache_memory_alloc",
"(",
"cache",
",",
"sizeof",
"(",
"*",
"oob",
")",
")",
";",
"assert",
"(",
"oob",
"!=",
"NULL",
")",
";",
"oob",
"->",
"next",
"=",
"NULL",
";",
"oob",
"->",
"callback",
"=",
"callback",
";",
"oob",
"->",
"param1",
"=",
"param1",
";",
"oob",
"->",
"param2",
"=",
"param2",
";",
"oob",
"->",
"param3",
"=",
"param3",
";",
"*",
"cache",
"->",
"oobtail",
"=",
"oob",
";",
"cache",
"->",
"oobtail",
"=",
"&",
"oob",
"->",
"next",
";",
"}"
] | drccache_request_oob_codegen - request
callback for out-of-band codegen | [
"drccache_request_oob_codegen",
"-",
"request",
"callback",
"for",
"out",
"-",
"of",
"-",
"band",
"codegen"
] | [
"/* pull an item from the free list */",
"/* fill it in */",
"/* add to the tail */"
] | [
{
"param": "cache",
"type": "drccache"
},
{
"param": "callback",
"type": "drccache_oob_func"
},
{
"param": "param1",
"type": "void"
},
{
"param": "param2",
"type": "void"
},
{
"param": "param3",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cache",
"type": "drccache",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "callback",
"type": "drccache_oob_func",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param1",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param2",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param3",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1532e7dbb61391a90de76c3f4a3ca7bb8739b27d | lofunz/mieme | Reloaded/trunk/src/mame/video/wecleman.c | [
"Unlicense"
] | C | sortsprite | void | static void sortsprite(int *idx_array, int *key_array, int size)
{
int i, j, tgt_val, low_val, low_pos, src_idx, tgt_idx, hi_idx;
idx_array += size;
for (j=-size; j<-1; j++)
{
src_idx = idx_array[j];
low_pos = j;
low_val = key_array[src_idx];
hi_idx = src_idx;
for (i=j+1; i; i++)
{
tgt_idx = idx_array[i];
tgt_val = key_array[tgt_idx];
if (low_val > tgt_val)
{ low_val = tgt_val; low_pos = i; }
else if ((low_val == tgt_val) && (hi_idx <= tgt_idx))
{ hi_idx = tgt_idx; low_pos = i; }
}
low_val = idx_array[low_pos];
idx_array[low_pos] = src_idx;
idx_array[j] = low_val;
}
} | // priority sorting, silly but good for smaller arrays
| priority sorting, silly but good for smaller arrays | [
"priority",
"sorting",
"silly",
"but",
"good",
"for",
"smaller",
"arrays"
] | static void sortsprite(int *idx_array, int *key_array, int size)
{
int i, j, tgt_val, low_val, low_pos, src_idx, tgt_idx, hi_idx;
idx_array += size;
for (j=-size; j<-1; j++)
{
src_idx = idx_array[j];
low_pos = j;
low_val = key_array[src_idx];
hi_idx = src_idx;
for (i=j+1; i; i++)
{
tgt_idx = idx_array[i];
tgt_val = key_array[tgt_idx];
if (low_val > tgt_val)
{ low_val = tgt_val; low_pos = i; }
else if ((low_val == tgt_val) && (hi_idx <= tgt_idx))
{ hi_idx = tgt_idx; low_pos = i; }
}
low_val = idx_array[low_pos];
idx_array[low_pos] = src_idx;
idx_array[j] = low_val;
}
} | [
"static",
"void",
"sortsprite",
"(",
"int",
"*",
"idx_array",
",",
"int",
"*",
"key_array",
",",
"int",
"size",
")",
"{",
"int",
"i",
",",
"j",
",",
"tgt_val",
",",
"low_val",
",",
"low_pos",
",",
"src_idx",
",",
"tgt_idx",
",",
"hi_idx",
";",
"idx_array",
"+=",
"size",
";",
"for",
"(",
"j",
"=",
"-",
"size",
";",
"j",
"<",
"-1",
";",
"j",
"++",
")",
"{",
"src_idx",
"=",
"idx_array",
"[",
"j",
"]",
";",
"low_pos",
"=",
"j",
";",
"low_val",
"=",
"key_array",
"[",
"src_idx",
"]",
";",
"hi_idx",
"=",
"src_idx",
";",
"for",
"(",
"i",
"=",
"j",
"+",
"1",
";",
"i",
";",
"i",
"++",
")",
"{",
"tgt_idx",
"=",
"idx_array",
"[",
"i",
"]",
";",
"tgt_val",
"=",
"key_array",
"[",
"tgt_idx",
"]",
";",
"if",
"(",
"low_val",
">",
"tgt_val",
")",
"{",
"low_val",
"=",
"tgt_val",
";",
"low_pos",
"=",
"i",
";",
"}",
"else",
"if",
"(",
"(",
"low_val",
"==",
"tgt_val",
")",
"&&",
"(",
"hi_idx",
"<=",
"tgt_idx",
")",
")",
"{",
"hi_idx",
"=",
"tgt_idx",
";",
"low_pos",
"=",
"i",
";",
"}",
"}",
"low_val",
"=",
"idx_array",
"[",
"low_pos",
"]",
";",
"idx_array",
"[",
"low_pos",
"]",
"=",
"src_idx",
";",
"idx_array",
"[",
"j",
"]",
"=",
"low_val",
";",
"}",
"}"
] | priority sorting, silly but good for smaller arrays | [
"priority",
"sorting",
"silly",
"but",
"good",
"for",
"smaller",
"arrays"
] | [] | [
{
"param": "idx_array",
"type": "int"
},
{
"param": "key_array",
"type": "int"
},
{
"param": "size",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "idx_array",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "key_array",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "size",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1532e7dbb61391a90de76c3f4a3ca7bb8739b27d | lofunz/mieme | Reloaded/trunk/src/mame/video/wecleman.c | [
"Unlicense"
] | C | do_blit_zoom32 | void | static void do_blit_zoom32(bitmap_t *bitmap, const rectangle *cliprect, struct sprite *sprite)
{
#define PRECISION_X 20
#define PRECISION_Y 20
#define FPY_HALF (1<<(PRECISION_Y-1))
const pen_t *pal_base;
int src_f0y, src_fdy, src_f0x, src_fdx, src_fpx;
int x1, x2, y1, y2, dx, dy, sx, sy;
int xcount0=0, ycount0=0;
if (sprite->flags & SPRITE_FLIPX)
{
x2 = sprite->x;
x1 = x2 + sprite->total_width;
dx = -1;
if (x2 < cliprect->min_x) x2 = cliprect->min_x;
if (x1 > cliprect->max_x )
{
xcount0 = x1 - cliprect->max_x;
x1 = cliprect->max_x;
}
if (x2 >= x1) return;
x1--; x2--;
}
else
{
x1 = sprite->x;
x2 = x1 + sprite->total_width;
dx = 1;
if (x1 < cliprect->min_x )
{
xcount0 = cliprect->min_x - x1;
x1 = cliprect->min_x;
}
if (x2 > cliprect->max_x ) x2 = cliprect->max_x;
if (x1 >= x2) return;
}
if (sprite->flags & SPRITE_FLIPY)
{
y2 = sprite->y;
y1 = y2 + sprite->total_height;
dy = -1;
if (y2 < cliprect->min_y ) y2 = cliprect->min_y;
if (y1 > cliprect->max_y )
{
ycount0 = cliprect->max_y;
y1 = cliprect->max_y;
}
if (y2 >= y1) return;
y1--; y2--;
}
else
{
y1 = sprite->y;
y2 = y1 + sprite->total_height;
dy = 1;
if (y1 < cliprect->min_y )
{
ycount0 = cliprect->min_y - y1;
y1 = cliprect->min_y;
}
if (y2 > cliprect->max_y) y2 = cliprect->max_y;
if (y1 >= y2) return;
}
// calculate entry point decimals
src_fdy = (sprite->tile_height<<PRECISION_Y) / sprite->total_height;
src_f0y = src_fdy * ycount0 + FPY_HALF;
src_fdx = (sprite->tile_width<<PRECISION_X) / sprite->total_width;
src_f0x = src_fdx * xcount0;
// pre-loop assignments and adjustments
pal_base = sprite->pal_data;
if (x1 > cliprect->min_x)
{
x1 -= dx;
x2 -= dx;
}
for (sy = y1; sy != y2; sy += dy)
{
UINT8 *row_base = sprite->pen_data + (src_f0y>>PRECISION_Y) * sprite->line_offset;
src_fpx = src_f0x;
if (bitmap->format == BITMAP_FORMAT_RGB32) // Wec Le Mans
{
UINT32 *dst_ptr = BITMAP_ADDR32(bitmap, sy, 0);
if (!sprite->shadow_mode)
{
for (sx = x1; sx != x2; sx += dx)
{
int pix = row_base[src_fpx >> PRECISION_X];
if (pix & 0x80) break;
if (pix)
dst_ptr[sx] = pal_base[pix];
src_fpx += src_fdx;
}
}
else
{
for (sx = x1; sx != x2; sx += dx)
{
int pix = row_base[src_fpx >> PRECISION_X];
if (pix & 0x80) break;
if (pix)
{
if (pix != 0xa)
dst_ptr[sx] = pal_base[pix];
else
dst_ptr[sx] = (dst_ptr[sx] >> 1) & MAKE_RGB(0x7f,0x7f,0x7f);
}
src_fpx += src_fdx;
}
}
}
else // Hot Chase
{
UINT16 *dst_ptr = BITMAP_ADDR16(bitmap, sy, 0);
pen_t base = sprite->pal_base;
if (!sprite->shadow_mode)
{
for (sx = x1; sx != x2; sx += dx)
{
int pix = row_base[src_fpx >> PRECISION_X];
if (pix & 0x80) break;
if (pix)
dst_ptr[sx] = base + pix;
src_fpx += src_fdx;
}
}
else
{
for (sx = x1; sx != x2; sx += dx)
{
int pix = row_base[src_fpx >> PRECISION_X];
if (pix & 0x80) break;
if (pix)
{
if (pix != 0xa)
dst_ptr[sx] = base + pix;
else
{
if (dst_ptr[sx] != black_pen)
dst_ptr[sx] |= 0x800;
}
}
src_fpx += src_fdx;
}
}
}
src_f0y += src_fdy;
}
} | // draws a 8bpp palette sprites on a 16bpp direct RGB target (sub-par implementation)
| draws a 8bpp palette sprites on a 16bpp direct RGB target (sub-par implementation) | [
"draws",
"a",
"8bpp",
"palette",
"sprites",
"on",
"a",
"16bpp",
"direct",
"RGB",
"target",
"(",
"sub",
"-",
"par",
"implementation",
")"
] | static void do_blit_zoom32(bitmap_t *bitmap, const rectangle *cliprect, struct sprite *sprite)
{
#define PRECISION_X 20
#define PRECISION_Y 20
#define FPY_HALF (1<<(PRECISION_Y-1))
const pen_t *pal_base;
int src_f0y, src_fdy, src_f0x, src_fdx, src_fpx;
int x1, x2, y1, y2, dx, dy, sx, sy;
int xcount0=0, ycount0=0;
if (sprite->flags & SPRITE_FLIPX)
{
x2 = sprite->x;
x1 = x2 + sprite->total_width;
dx = -1;
if (x2 < cliprect->min_x) x2 = cliprect->min_x;
if (x1 > cliprect->max_x )
{
xcount0 = x1 - cliprect->max_x;
x1 = cliprect->max_x;
}
if (x2 >= x1) return;
x1--; x2--;
}
else
{
x1 = sprite->x;
x2 = x1 + sprite->total_width;
dx = 1;
if (x1 < cliprect->min_x )
{
xcount0 = cliprect->min_x - x1;
x1 = cliprect->min_x;
}
if (x2 > cliprect->max_x ) x2 = cliprect->max_x;
if (x1 >= x2) return;
}
if (sprite->flags & SPRITE_FLIPY)
{
y2 = sprite->y;
y1 = y2 + sprite->total_height;
dy = -1;
if (y2 < cliprect->min_y ) y2 = cliprect->min_y;
if (y1 > cliprect->max_y )
{
ycount0 = cliprect->max_y;
y1 = cliprect->max_y;
}
if (y2 >= y1) return;
y1--; y2--;
}
else
{
y1 = sprite->y;
y2 = y1 + sprite->total_height;
dy = 1;
if (y1 < cliprect->min_y )
{
ycount0 = cliprect->min_y - y1;
y1 = cliprect->min_y;
}
if (y2 > cliprect->max_y) y2 = cliprect->max_y;
if (y1 >= y2) return;
}
src_fdy = (sprite->tile_height<<PRECISION_Y) / sprite->total_height;
src_f0y = src_fdy * ycount0 + FPY_HALF;
src_fdx = (sprite->tile_width<<PRECISION_X) / sprite->total_width;
src_f0x = src_fdx * xcount0;
pal_base = sprite->pal_data;
if (x1 > cliprect->min_x)
{
x1 -= dx;
x2 -= dx;
}
for (sy = y1; sy != y2; sy += dy)
{
UINT8 *row_base = sprite->pen_data + (src_f0y>>PRECISION_Y) * sprite->line_offset;
src_fpx = src_f0x;
if (bitmap->format == BITMAP_FORMAT_RGB32)
{
UINT32 *dst_ptr = BITMAP_ADDR32(bitmap, sy, 0);
if (!sprite->shadow_mode)
{
for (sx = x1; sx != x2; sx += dx)
{
int pix = row_base[src_fpx >> PRECISION_X];
if (pix & 0x80) break;
if (pix)
dst_ptr[sx] = pal_base[pix];
src_fpx += src_fdx;
}
}
else
{
for (sx = x1; sx != x2; sx += dx)
{
int pix = row_base[src_fpx >> PRECISION_X];
if (pix & 0x80) break;
if (pix)
{
if (pix != 0xa)
dst_ptr[sx] = pal_base[pix];
else
dst_ptr[sx] = (dst_ptr[sx] >> 1) & MAKE_RGB(0x7f,0x7f,0x7f);
}
src_fpx += src_fdx;
}
}
}
else
{
UINT16 *dst_ptr = BITMAP_ADDR16(bitmap, sy, 0);
pen_t base = sprite->pal_base;
if (!sprite->shadow_mode)
{
for (sx = x1; sx != x2; sx += dx)
{
int pix = row_base[src_fpx >> PRECISION_X];
if (pix & 0x80) break;
if (pix)
dst_ptr[sx] = base + pix;
src_fpx += src_fdx;
}
}
else
{
for (sx = x1; sx != x2; sx += dx)
{
int pix = row_base[src_fpx >> PRECISION_X];
if (pix & 0x80) break;
if (pix)
{
if (pix != 0xa)
dst_ptr[sx] = base + pix;
else
{
if (dst_ptr[sx] != black_pen)
dst_ptr[sx] |= 0x800;
}
}
src_fpx += src_fdx;
}
}
}
src_f0y += src_fdy;
}
} | [
"static",
"void",
"do_blit_zoom32",
"(",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"struct",
"sprite",
"*",
"sprite",
")",
"{",
"#define",
"PRECISION_X",
" 20\r",
"\n",
"#define",
"PRECISION_Y",
" 20\r",
"\n",
"#define",
"FPY_HALF",
" (1<<(PRECISION_Y-1))\r",
"\n",
"const",
"pen_t",
"*",
"pal_base",
";",
"int",
"src_f0y",
",",
"src_fdy",
",",
"src_f0x",
",",
"src_fdx",
",",
"src_fpx",
";",
"int",
"x1",
",",
"x2",
",",
"y1",
",",
"y2",
",",
"dx",
",",
"dy",
",",
"sx",
",",
"sy",
";",
"int",
"xcount0",
"=",
"0",
",",
"ycount0",
"=",
"0",
";",
"if",
"(",
"sprite",
"->",
"flags",
"&",
"SPRITE_FLIPX",
")",
"{",
"x2",
"=",
"sprite",
"->",
"x",
";",
"x1",
"=",
"x2",
"+",
"sprite",
"->",
"total_width",
";",
"dx",
"=",
"-1",
";",
"if",
"(",
"x2",
"<",
"cliprect",
"->",
"min_x",
")",
"x2",
"=",
"cliprect",
"->",
"min_x",
";",
"if",
"(",
"x1",
">",
"cliprect",
"->",
"max_x",
")",
"{",
"xcount0",
"=",
"x1",
"-",
"cliprect",
"->",
"max_x",
";",
"x1",
"=",
"cliprect",
"->",
"max_x",
";",
"}",
"if",
"(",
"x2",
">=",
"x1",
")",
"return",
";",
"x1",
"--",
";",
"x2",
"--",
";",
"}",
"else",
"{",
"x1",
"=",
"sprite",
"->",
"x",
";",
"x2",
"=",
"x1",
"+",
"sprite",
"->",
"total_width",
";",
"dx",
"=",
"1",
";",
"if",
"(",
"x1",
"<",
"cliprect",
"->",
"min_x",
")",
"{",
"xcount0",
"=",
"cliprect",
"->",
"min_x",
"-",
"x1",
";",
"x1",
"=",
"cliprect",
"->",
"min_x",
";",
"}",
"if",
"(",
"x2",
">",
"cliprect",
"->",
"max_x",
")",
"x2",
"=",
"cliprect",
"->",
"max_x",
";",
"if",
"(",
"x1",
">=",
"x2",
")",
"return",
";",
"}",
"if",
"(",
"sprite",
"->",
"flags",
"&",
"SPRITE_FLIPY",
")",
"{",
"y2",
"=",
"sprite",
"->",
"y",
";",
"y1",
"=",
"y2",
"+",
"sprite",
"->",
"total_height",
";",
"dy",
"=",
"-1",
";",
"if",
"(",
"y2",
"<",
"cliprect",
"->",
"min_y",
")",
"y2",
"=",
"cliprect",
"->",
"min_y",
";",
"if",
"(",
"y1",
">",
"cliprect",
"->",
"max_y",
")",
"{",
"ycount0",
"=",
"cliprect",
"->",
"max_y",
";",
"y1",
"=",
"cliprect",
"->",
"max_y",
";",
"}",
"if",
"(",
"y2",
">=",
"y1",
")",
"return",
";",
"y1",
"--",
";",
"y2",
"--",
";",
"}",
"else",
"{",
"y1",
"=",
"sprite",
"->",
"y",
";",
"y2",
"=",
"y1",
"+",
"sprite",
"->",
"total_height",
";",
"dy",
"=",
"1",
";",
"if",
"(",
"y1",
"<",
"cliprect",
"->",
"min_y",
")",
"{",
"ycount0",
"=",
"cliprect",
"->",
"min_y",
"-",
"y1",
";",
"y1",
"=",
"cliprect",
"->",
"min_y",
";",
"}",
"if",
"(",
"y2",
">",
"cliprect",
"->",
"max_y",
")",
"y2",
"=",
"cliprect",
"->",
"max_y",
";",
"if",
"(",
"y1",
">=",
"y2",
")",
"return",
";",
"}",
"src_fdy",
"=",
"(",
"sprite",
"->",
"tile_height",
"<<",
"PRECISION_Y",
")",
"/",
"sprite",
"->",
"total_height",
";",
"src_f0y",
"=",
"src_fdy",
"*",
"ycount0",
"+",
"FPY_HALF",
";",
"src_fdx",
"=",
"(",
"sprite",
"->",
"tile_width",
"<<",
"PRECISION_X",
")",
"/",
"sprite",
"->",
"total_width",
";",
"src_f0x",
"=",
"src_fdx",
"*",
"xcount0",
";",
"pal_base",
"=",
"sprite",
"->",
"pal_data",
";",
"if",
"(",
"x1",
">",
"cliprect",
"->",
"min_x",
")",
"{",
"x1",
"-=",
"dx",
";",
"x2",
"-=",
"dx",
";",
"}",
"for",
"(",
"sy",
"=",
"y1",
";",
"sy",
"!=",
"y2",
";",
"sy",
"+=",
"dy",
")",
"{",
"UINT8",
"*",
"row_base",
"=",
"sprite",
"->",
"pen_data",
"+",
"(",
"src_f0y",
">>",
"PRECISION_Y",
")",
"*",
"sprite",
"->",
"line_offset",
";",
"src_fpx",
"=",
"src_f0x",
";",
"if",
"(",
"bitmap",
"->",
"format",
"==",
"BITMAP_FORMAT_RGB32",
")",
"{",
"UINT32",
"*",
"dst_ptr",
"=",
"BITMAP_ADDR32",
"(",
"bitmap",
",",
"sy",
",",
"0",
")",
";",
"if",
"(",
"!",
"sprite",
"->",
"shadow_mode",
")",
"{",
"for",
"(",
"sx",
"=",
"x1",
";",
"sx",
"!=",
"x2",
";",
"sx",
"+=",
"dx",
")",
"{",
"int",
"pix",
"=",
"row_base",
"[",
"src_fpx",
">>",
"PRECISION_X",
"]",
";",
"if",
"(",
"pix",
"&",
"0x80",
")",
"break",
";",
"if",
"(",
"pix",
")",
"dst_ptr",
"[",
"sx",
"]",
"=",
"pal_base",
"[",
"pix",
"]",
";",
"src_fpx",
"+=",
"src_fdx",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"sx",
"=",
"x1",
";",
"sx",
"!=",
"x2",
";",
"sx",
"+=",
"dx",
")",
"{",
"int",
"pix",
"=",
"row_base",
"[",
"src_fpx",
">>",
"PRECISION_X",
"]",
";",
"if",
"(",
"pix",
"&",
"0x80",
")",
"break",
";",
"if",
"(",
"pix",
")",
"{",
"if",
"(",
"pix",
"!=",
"0xa",
")",
"dst_ptr",
"[",
"sx",
"]",
"=",
"pal_base",
"[",
"pix",
"]",
";",
"else",
"dst_ptr",
"[",
"sx",
"]",
"=",
"(",
"dst_ptr",
"[",
"sx",
"]",
">>",
"1",
")",
"&",
"MAKE_RGB",
"(",
"0x7f",
",",
"0x7f",
",",
"0x7f",
")",
";",
"}",
"src_fpx",
"+=",
"src_fdx",
";",
"}",
"}",
"}",
"else",
"{",
"UINT16",
"*",
"dst_ptr",
"=",
"BITMAP_ADDR16",
"(",
"bitmap",
",",
"sy",
",",
"0",
")",
";",
"pen_t",
"base",
"=",
"sprite",
"->",
"pal_base",
";",
"if",
"(",
"!",
"sprite",
"->",
"shadow_mode",
")",
"{",
"for",
"(",
"sx",
"=",
"x1",
";",
"sx",
"!=",
"x2",
";",
"sx",
"+=",
"dx",
")",
"{",
"int",
"pix",
"=",
"row_base",
"[",
"src_fpx",
">>",
"PRECISION_X",
"]",
";",
"if",
"(",
"pix",
"&",
"0x80",
")",
"break",
";",
"if",
"(",
"pix",
")",
"dst_ptr",
"[",
"sx",
"]",
"=",
"base",
"+",
"pix",
";",
"src_fpx",
"+=",
"src_fdx",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"sx",
"=",
"x1",
";",
"sx",
"!=",
"x2",
";",
"sx",
"+=",
"dx",
")",
"{",
"int",
"pix",
"=",
"row_base",
"[",
"src_fpx",
">>",
"PRECISION_X",
"]",
";",
"if",
"(",
"pix",
"&",
"0x80",
")",
"break",
";",
"if",
"(",
"pix",
")",
"{",
"if",
"(",
"pix",
"!=",
"0xa",
")",
"dst_ptr",
"[",
"sx",
"]",
"=",
"base",
"+",
"pix",
";",
"else",
"{",
"if",
"(",
"dst_ptr",
"[",
"sx",
"]",
"!=",
"black_pen",
")",
"dst_ptr",
"[",
"sx",
"]",
"|=",
"0x800",
";",
"}",
"}",
"src_fpx",
"+=",
"src_fdx",
";",
"}",
"}",
"}",
"src_f0y",
"+=",
"src_fdy",
";",
"}",
"}"
] | draws a 8bpp palette sprites on a 16bpp direct RGB target (sub-par implementation) | [
"draws",
"a",
"8bpp",
"palette",
"sprites",
"on",
"a",
"16bpp",
"direct",
"RGB",
"target",
"(",
"sub",
"-",
"par",
"implementation",
")"
] | [
"// calculate entry point decimals\r",
"// pre-loop assignments and adjustments\r",
"// Wec Le Mans\r",
"// Hot Chase\r"
] | [
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "sprite",
"type": "struct sprite"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sprite",
"type": "struct sprite",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1532e7dbb61391a90de76c3f4a3ca7bb8739b27d | lofunz/mieme | Reloaded/trunk/src/mame/video/wecleman.c | [
"Unlicense"
] | C | wecleman_draw_road | void | static void wecleman_draw_road(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
{
// must be powers of 2
#define XSIZE 512
#define YSIZE 256
#define YMASK (YSIZE-1)
#define DST_WIDTH 320
#define DST_HEIGHT 224
#define MIDCURB_DY 5
#define TOPCURB_DY 7
static const pen_t road_color[48] =
{
0x3f1,0x3f3,0x3f5,0x3fd,0x3fd,0x3fb,0x3fd,0x7ff, // road color 0
0x3f0,0x3f2,0x3f4,0x3fc,0x3fc,0x3fb,0x3fc,0x7fe, // road color 1
0, 0, 0,0x3f9,0x3f9, 0, 0, 0, // midcurb color 0
0, 0, 0,0x3f8,0x3f8, 0, 0, 0, // midcurb color 1
0, 0, 0,0x3f7, 0, 0, 0, 0, // topcurb color 0
0, 0, 0,0x3f6, 0, 0, 0, 0 // topcutb color 1
};
const UINT8 *src_ptr;
const pen_t *pal_ptr, *rgb_ptr;
int scrollx, sy, sx;
int mdy, tdy, i;
rgb_ptr = machine->pens;
if (priority == 0x02)
{
// draw sky; each scanline is assumed to be dword aligned
for (sy=cliprect->min_y-BMP_PAD; sy<DST_HEIGHT; sy++)
{
UINT32 *dst = BITMAP_ADDR32(bitmap, sy+BMP_PAD, BMP_PAD);
UINT32 pix;
UINT16 road;
road = wecleman_roadram[sy];
if ((road>>8) != 0x02) continue;
pix = rgb_ptr[(wecleman_roadram[sy+(YSIZE*2)] & 0xf) + 0x7f0];
for (sx = 0; sx < DST_WIDTH; sx++)
dst[sx] = pix;
}
}
else if (priority == 0x04)
{
// draw road
pen_t road_rgb[48];
for (i=0; i<48; i++)
{
int color = road_color[i];
road_rgb[i] = color ? rgb_ptr[color] : 0xffffffff;
}
for (sy=cliprect->min_y-BMP_PAD; sy<DST_HEIGHT; sy++)
{
UINT32 *dst = BITMAP_ADDR32(bitmap, sy+BMP_PAD, BMP_PAD);
UINT32 pix;
UINT16 road;
road = wecleman_roadram[sy];
if ((road>>8) != 0x04) continue;
road &= YMASK;
src_ptr = gfx_element_get_data(machine->gfx[1], (road << 3));
gfx_element_get_data(machine->gfx[1], (road << 3) + 1);
gfx_element_get_data(machine->gfx[1], (road << 3) + 2);
gfx_element_get_data(machine->gfx[1], (road << 3) + 3);
gfx_element_get_data(machine->gfx[1], (road << 3) + 4);
gfx_element_get_data(machine->gfx[1], (road << 3) + 5);
gfx_element_get_data(machine->gfx[1], (road << 3) + 6);
gfx_element_get_data(machine->gfx[1], (road << 3) + 7);
mdy = ((road * MIDCURB_DY) >> 8) * bitmap->rowpixels;
tdy = ((road * TOPCURB_DY) >> 8) * bitmap->rowpixels;
scrollx = wecleman_roadram[sy+YSIZE] + (0x18 - 0xe00);
pal_ptr = road_rgb + ((wecleman_roadram[sy+(YSIZE*2)]<<3) & 8);
for (sx = 0; sx < DST_WIDTH; sx++, scrollx++)
{
if (scrollx >= 0 && scrollx < XSIZE)
{
pen_t temp;
pix = src_ptr[scrollx];
dst[sx] = pal_ptr[pix];
temp = pal_ptr[pix + 16];
if (temp != 0xffffffff) dst[sx - mdy] = temp;
temp = pal_ptr[pix + 32];
if (temp != 0xffffffff) dst[sx - tdy] = temp;
}
else
dst[sx] = pal_ptr[7];
}
}
}
#undef YSIZE
#undef XSIZE
} | /*------------------------------------------------------------------------
Road Drawing
This layer is composed of horizontal lines gfx elements
There are 256 lines in ROM, each is 512 pixels wide
Offset: Elements: Data:
0000-01ff 100 Words Code
fedcba98-------- Priority?
--------76543210 Line Number
0200-03ff 100 Words Horizontal Scroll
0400-05ff 100 Words Color
0600-07ff 100 Words ??
We draw each line using a bunch of 64x1 tiles
------------------------------------------------------------------------*/ | Road Drawing
This layer is composed of horizontal lines gfx elements
There are 256 lines in ROM, each is 512 pixels wide
fedcba98 Priority.
We draw each line using a bunch of 64x1 tiles | [
"Road",
"Drawing",
"This",
"layer",
"is",
"composed",
"of",
"horizontal",
"lines",
"gfx",
"elements",
"There",
"are",
"256",
"lines",
"in",
"ROM",
"each",
"is",
"512",
"pixels",
"wide",
"fedcba98",
"Priority",
".",
"We",
"draw",
"each",
"line",
"using",
"a",
"bunch",
"of",
"64x1",
"tiles"
] | static void wecleman_draw_road(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
{
#define XSIZE 512
#define YSIZE 256
#define YMASK (YSIZE-1)
#define DST_WIDTH 320
#define DST_HEIGHT 224
#define MIDCURB_DY 5
#define TOPCURB_DY 7
static const pen_t road_color[48] =
{
0x3f1,0x3f3,0x3f5,0x3fd,0x3fd,0x3fb,0x3fd,0x7ff,
0x3f0,0x3f2,0x3f4,0x3fc,0x3fc,0x3fb,0x3fc,0x7fe,
0, 0, 0,0x3f9,0x3f9, 0, 0, 0,
0, 0, 0,0x3f8,0x3f8, 0, 0, 0,
0, 0, 0,0x3f7, 0, 0, 0, 0,
0, 0, 0,0x3f6, 0, 0, 0, 0
};
const UINT8 *src_ptr;
const pen_t *pal_ptr, *rgb_ptr;
int scrollx, sy, sx;
int mdy, tdy, i;
rgb_ptr = machine->pens;
if (priority == 0x02)
{
for (sy=cliprect->min_y-BMP_PAD; sy<DST_HEIGHT; sy++)
{
UINT32 *dst = BITMAP_ADDR32(bitmap, sy+BMP_PAD, BMP_PAD);
UINT32 pix;
UINT16 road;
road = wecleman_roadram[sy];
if ((road>>8) != 0x02) continue;
pix = rgb_ptr[(wecleman_roadram[sy+(YSIZE*2)] & 0xf) + 0x7f0];
for (sx = 0; sx < DST_WIDTH; sx++)
dst[sx] = pix;
}
}
else if (priority == 0x04)
{
pen_t road_rgb[48];
for (i=0; i<48; i++)
{
int color = road_color[i];
road_rgb[i] = color ? rgb_ptr[color] : 0xffffffff;
}
for (sy=cliprect->min_y-BMP_PAD; sy<DST_HEIGHT; sy++)
{
UINT32 *dst = BITMAP_ADDR32(bitmap, sy+BMP_PAD, BMP_PAD);
UINT32 pix;
UINT16 road;
road = wecleman_roadram[sy];
if ((road>>8) != 0x04) continue;
road &= YMASK;
src_ptr = gfx_element_get_data(machine->gfx[1], (road << 3));
gfx_element_get_data(machine->gfx[1], (road << 3) + 1);
gfx_element_get_data(machine->gfx[1], (road << 3) + 2);
gfx_element_get_data(machine->gfx[1], (road << 3) + 3);
gfx_element_get_data(machine->gfx[1], (road << 3) + 4);
gfx_element_get_data(machine->gfx[1], (road << 3) + 5);
gfx_element_get_data(machine->gfx[1], (road << 3) + 6);
gfx_element_get_data(machine->gfx[1], (road << 3) + 7);
mdy = ((road * MIDCURB_DY) >> 8) * bitmap->rowpixels;
tdy = ((road * TOPCURB_DY) >> 8) * bitmap->rowpixels;
scrollx = wecleman_roadram[sy+YSIZE] + (0x18 - 0xe00);
pal_ptr = road_rgb + ((wecleman_roadram[sy+(YSIZE*2)]<<3) & 8);
for (sx = 0; sx < DST_WIDTH; sx++, scrollx++)
{
if (scrollx >= 0 && scrollx < XSIZE)
{
pen_t temp;
pix = src_ptr[scrollx];
dst[sx] = pal_ptr[pix];
temp = pal_ptr[pix + 16];
if (temp != 0xffffffff) dst[sx - mdy] = temp;
temp = pal_ptr[pix + 32];
if (temp != 0xffffffff) dst[sx - tdy] = temp;
}
else
dst[sx] = pal_ptr[7];
}
}
}
#undef YSIZE
#undef XSIZE
} | [
"static",
"void",
"wecleman_draw_road",
"(",
"running_machine",
"*",
"machine",
",",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"int",
"priority",
")",
"{",
"#define",
"XSIZE",
" 512\r",
"\n",
"#define",
"YSIZE",
" 256\r",
"\n",
"#define",
"YMASK",
" (YSIZE-1)\r",
"\n",
"#define",
"DST_WIDTH",
" 320\r",
"\n",
"#define",
"DST_HEIGHT",
" 224\r",
"\n",
"#define",
"MIDCURB_DY",
" 5\r",
"\n",
"#define",
"TOPCURB_DY",
" 7\r",
"\n",
"static",
"const",
"pen_t",
"road_color",
"[",
"48",
"]",
"=",
"{",
"0x3f1",
",",
"0x3f3",
",",
"0x3f5",
",",
"0x3fd",
",",
"0x3fd",
",",
"0x3fb",
",",
"0x3fd",
",",
"0x7ff",
",",
"0x3f0",
",",
"0x3f2",
",",
"0x3f4",
",",
"0x3fc",
",",
"0x3fc",
",",
"0x3fb",
",",
"0x3fc",
",",
"0x7fe",
",",
"0",
",",
"0",
",",
"0",
",",
"0x3f9",
",",
"0x3f9",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0x3f8",
",",
"0x3f8",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0x3f7",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0x3f6",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
"}",
";",
"const",
"UINT8",
"*",
"src_ptr",
";",
"const",
"pen_t",
"*",
"pal_ptr",
",",
"*",
"rgb_ptr",
";",
"int",
"scrollx",
",",
"sy",
",",
"sx",
";",
"int",
"mdy",
",",
"tdy",
",",
"i",
";",
"rgb_ptr",
"=",
"machine",
"->",
"pens",
";",
"if",
"(",
"priority",
"==",
"0x02",
")",
"{",
"for",
"(",
"sy",
"=",
"cliprect",
"->",
"min_y",
"-",
"BMP_PAD",
";",
"sy",
"<",
"DST_HEIGHT",
";",
"sy",
"++",
")",
"{",
"UINT32",
"*",
"dst",
"=",
"BITMAP_ADDR32",
"(",
"bitmap",
",",
"sy",
"+",
"BMP_PAD",
",",
"BMP_PAD",
")",
";",
"UINT32",
"pix",
";",
"UINT16",
"road",
";",
"road",
"=",
"wecleman_roadram",
"[",
"sy",
"]",
";",
"if",
"(",
"(",
"road",
">>",
"8",
")",
"!=",
"0x02",
")",
"continue",
";",
"pix",
"=",
"rgb_ptr",
"[",
"(",
"wecleman_roadram",
"[",
"sy",
"+",
"(",
"YSIZE",
"*",
"2",
")",
"]",
"&",
"0xf",
")",
"+",
"0x7f0",
"]",
";",
"for",
"(",
"sx",
"=",
"0",
";",
"sx",
"<",
"DST_WIDTH",
";",
"sx",
"++",
")",
"dst",
"[",
"sx",
"]",
"=",
"pix",
";",
"}",
"}",
"else",
"if",
"(",
"priority",
"==",
"0x04",
")",
"{",
"pen_t",
"road_rgb",
"[",
"48",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"48",
";",
"i",
"++",
")",
"{",
"int",
"color",
"=",
"road_color",
"[",
"i",
"]",
";",
"road_rgb",
"[",
"i",
"]",
"=",
"color",
"?",
"rgb_ptr",
"[",
"color",
"]",
":",
"0xffffffff",
";",
"}",
"for",
"(",
"sy",
"=",
"cliprect",
"->",
"min_y",
"-",
"BMP_PAD",
";",
"sy",
"<",
"DST_HEIGHT",
";",
"sy",
"++",
")",
"{",
"UINT32",
"*",
"dst",
"=",
"BITMAP_ADDR32",
"(",
"bitmap",
",",
"sy",
"+",
"BMP_PAD",
",",
"BMP_PAD",
")",
";",
"UINT32",
"pix",
";",
"UINT16",
"road",
";",
"road",
"=",
"wecleman_roadram",
"[",
"sy",
"]",
";",
"if",
"(",
"(",
"road",
">>",
"8",
")",
"!=",
"0x04",
")",
"continue",
";",
"road",
"&=",
"YMASK",
";",
"src_ptr",
"=",
"gfx_element_get_data",
"(",
"machine",
"->",
"gfx",
"[",
"1",
"]",
",",
"(",
"road",
"<<",
"3",
")",
")",
";",
"gfx_element_get_data",
"(",
"machine",
"->",
"gfx",
"[",
"1",
"]",
",",
"(",
"road",
"<<",
"3",
")",
"+",
"1",
")",
";",
"gfx_element_get_data",
"(",
"machine",
"->",
"gfx",
"[",
"1",
"]",
",",
"(",
"road",
"<<",
"3",
")",
"+",
"2",
")",
";",
"gfx_element_get_data",
"(",
"machine",
"->",
"gfx",
"[",
"1",
"]",
",",
"(",
"road",
"<<",
"3",
")",
"+",
"3",
")",
";",
"gfx_element_get_data",
"(",
"machine",
"->",
"gfx",
"[",
"1",
"]",
",",
"(",
"road",
"<<",
"3",
")",
"+",
"4",
")",
";",
"gfx_element_get_data",
"(",
"machine",
"->",
"gfx",
"[",
"1",
"]",
",",
"(",
"road",
"<<",
"3",
")",
"+",
"5",
")",
";",
"gfx_element_get_data",
"(",
"machine",
"->",
"gfx",
"[",
"1",
"]",
",",
"(",
"road",
"<<",
"3",
")",
"+",
"6",
")",
";",
"gfx_element_get_data",
"(",
"machine",
"->",
"gfx",
"[",
"1",
"]",
",",
"(",
"road",
"<<",
"3",
")",
"+",
"7",
")",
";",
"mdy",
"=",
"(",
"(",
"road",
"*",
"MIDCURB_DY",
")",
">>",
"8",
")",
"*",
"bitmap",
"->",
"rowpixels",
";",
"tdy",
"=",
"(",
"(",
"road",
"*",
"TOPCURB_DY",
")",
">>",
"8",
")",
"*",
"bitmap",
"->",
"rowpixels",
";",
"scrollx",
"=",
"wecleman_roadram",
"[",
"sy",
"+",
"YSIZE",
"]",
"+",
"(",
"0x18",
"-",
"0xe00",
")",
";",
"pal_ptr",
"=",
"road_rgb",
"+",
"(",
"(",
"wecleman_roadram",
"[",
"sy",
"+",
"(",
"YSIZE",
"*",
"2",
")",
"]",
"<<",
"3",
")",
"&",
"8",
")",
";",
"for",
"(",
"sx",
"=",
"0",
";",
"sx",
"<",
"DST_WIDTH",
";",
"sx",
"++",
",",
"scrollx",
"++",
")",
"{",
"if",
"(",
"scrollx",
">=",
"0",
"&&",
"scrollx",
"<",
"XSIZE",
")",
"{",
"pen_t",
"temp",
";",
"pix",
"=",
"src_ptr",
"[",
"scrollx",
"]",
";",
"dst",
"[",
"sx",
"]",
"=",
"pal_ptr",
"[",
"pix",
"]",
";",
"temp",
"=",
"pal_ptr",
"[",
"pix",
"+",
"16",
"]",
";",
"if",
"(",
"temp",
"!=",
"0xffffffff",
")",
"dst",
"[",
"sx",
"-",
"mdy",
"]",
"=",
"temp",
";",
"temp",
"=",
"pal_ptr",
"[",
"pix",
"+",
"32",
"]",
";",
"if",
"(",
"temp",
"!=",
"0xffffffff",
")",
"dst",
"[",
"sx",
"-",
"tdy",
"]",
"=",
"temp",
";",
"}",
"else",
"dst",
"[",
"sx",
"]",
"=",
"pal_ptr",
"[",
"7",
"]",
";",
"}",
"}",
"}",
"#undef",
" YSIZE\r",
"\n",
"#undef",
" XSIZE\r",
"\n",
"}"
] | Road Drawing
This layer is composed of horizontal lines gfx elements
There are 256 lines in ROM, each is 512 pixels wide | [
"Road",
"Drawing",
"This",
"layer",
"is",
"composed",
"of",
"horizontal",
"lines",
"gfx",
"elements",
"There",
"are",
"256",
"lines",
"in",
"ROM",
"each",
"is",
"512",
"pixels",
"wide"
] | [
"// must be powers of 2\r",
"// road color 0\r",
"// road color 1\r",
"// midcurb color 0\r",
"// midcurb color 1\r",
"// topcurb color 0\r",
"// topcutb color 1\r",
"// draw sky; each scanline is assumed to be dword aligned\r",
"// draw road\r"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "priority",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1532e7dbb61391a90de76c3f4a3ca7bb8739b27d | lofunz/mieme | Reloaded/trunk/src/mame/video/wecleman.c | [
"Unlicense"
] | C | draw_cloud | void | static void draw_cloud(bitmap_t *bitmap,
const gfx_element *gfx,
UINT16 *tm_base,
int x0, int y0, // target coordinate
int xcount, int ycount, // number of tiles to draw in x and y
int scrollx, int scrolly, // tilemap scroll position
int tmw_l2, int tmh_l2, // tilemap width and height in log(2)
int alpha, int pal_offset ) // alpha(0-3f), # of color codes to shift
{
const UINT8 *src_ptr;
UINT16 *tmap_ptr;
UINT32 *dst_base, *dst_ptr;
const pen_t *pal_base, *pal_ptr;
int tilew, tileh;
int tmskipx, tmskipy, tmscanx, tmmaskx, tmmasky;
int dx, dy;
int i, j, tx, ty;
if (alpha > 0x1f) return;
tilew = gfx->width;
tileh = gfx->height;
tmmaskx = (1<<tmw_l2) - 1;
tmmasky = (1<<tmh_l2) - 1;
scrollx &= ((tilew<<tmw_l2) - 1);
scrolly &= ((tileh<<tmh_l2) - 1);
tmskipx = scrollx / tilew;
dx = -(scrollx & (tilew-1));
tmskipy = scrolly / tileh;
dy = -(scrolly & (tileh-1));
dst_base = BITMAP_ADDR32(bitmap, y0+dy, x0+dx);
pal_base = gfx->machine->pens + pal_offset * gfx->color_granularity;
alpha <<= 6;
dst_base += 8;
for (i = 0; i < ycount; i++)
{
tmap_ptr = tm_base + ((tmskipy++ & tmmasky)<<tmw_l2);
tmscanx = tmskipx;
for (j = 0; j < xcount; j++)
{
UINT16 tiledata = tmap_ptr[tmscanx++ & tmmaskx];
// Wec Le Mans specific: decodes tile index in EBX
UINT16 tile_index = tiledata & 0xfff;
// Wec Le Mans specific: decodes tile color in EAX
UINT16 tile_color = ((tiledata >> 5) & 0x78) + (tiledata >> 12);
src_ptr = gfx_element_get_data(gfx, tile_index);
pal_ptr = pal_base + tile_color * gfx->color_granularity;
dst_ptr = dst_base + j * tilew;
/* alpha case */
if (alpha > 0)
{
for (ty = 0; ty < tileh; ty++)
{
for (tx = 0; tx < tilew; tx++)
{
UINT8 srcpix = *src_ptr++;
pen_t srcrgb = pal_ptr[srcpix];
UINT32 dstrgb = dst_ptr[tx];
int sr, sg, sb, dr, dg, db;
sr = (srcrgb >> 3) & 0x1f;
sg = (srcrgb >> 11) & 0x1f;
sb = (srcrgb >> 19) & 0x1f;
dr = (dstrgb >> 3) & 0x1f;
dg = (dstrgb >> 11) & 0x1f;
db = (dstrgb >> 19) & 0x1f;
dr = (t32x32pm[dr - sr + alpha] >> 5) + dr;
dg = (t32x32pm[dg - sg + alpha] >> 5) + dg;
db = (t32x32pm[db - sb + alpha] >> 5) + db;
dst_ptr[tx] = MAKE_RGB(pal5bit(db), pal5bit(dg), pal5bit(dr));
}
dst_ptr += bitmap->rowpixels;
}
}
/* non-alpha case */
else
{
for (ty = 0; ty < tileh; ty++)
{
for (tx = 0; tx < tilew; tx++)
dst_ptr[tx] = pal_ptr[*src_ptr++];
dst_ptr += bitmap->rowpixels;
}
}
}
dst_base += bitmap->rowpixels * tileh;
}
} | // blends two 8x8x16bpp direct RGB tilemaps
| blends two 8x8x16bpp direct RGB tilemaps | [
"blends",
"two",
"8x8x16bpp",
"direct",
"RGB",
"tilemaps"
] | static void draw_cloud(bitmap_t *bitmap,
const gfx_element *gfx,
UINT16 *tm_base,
int x0, int y0,
int xcount, int ycount,
int scrollx, int scrolly,
int tmw_l2, int tmh_l2,
int alpha, int pal_offset )
{
const UINT8 *src_ptr;
UINT16 *tmap_ptr;
UINT32 *dst_base, *dst_ptr;
const pen_t *pal_base, *pal_ptr;
int tilew, tileh;
int tmskipx, tmskipy, tmscanx, tmmaskx, tmmasky;
int dx, dy;
int i, j, tx, ty;
if (alpha > 0x1f) return;
tilew = gfx->width;
tileh = gfx->height;
tmmaskx = (1<<tmw_l2) - 1;
tmmasky = (1<<tmh_l2) - 1;
scrollx &= ((tilew<<tmw_l2) - 1);
scrolly &= ((tileh<<tmh_l2) - 1);
tmskipx = scrollx / tilew;
dx = -(scrollx & (tilew-1));
tmskipy = scrolly / tileh;
dy = -(scrolly & (tileh-1));
dst_base = BITMAP_ADDR32(bitmap, y0+dy, x0+dx);
pal_base = gfx->machine->pens + pal_offset * gfx->color_granularity;
alpha <<= 6;
dst_base += 8;
for (i = 0; i < ycount; i++)
{
tmap_ptr = tm_base + ((tmskipy++ & tmmasky)<<tmw_l2);
tmscanx = tmskipx;
for (j = 0; j < xcount; j++)
{
UINT16 tiledata = tmap_ptr[tmscanx++ & tmmaskx];
UINT16 tile_index = tiledata & 0xfff;
UINT16 tile_color = ((tiledata >> 5) & 0x78) + (tiledata >> 12);
src_ptr = gfx_element_get_data(gfx, tile_index);
pal_ptr = pal_base + tile_color * gfx->color_granularity;
dst_ptr = dst_base + j * tilew;
if (alpha > 0)
{
for (ty = 0; ty < tileh; ty++)
{
for (tx = 0; tx < tilew; tx++)
{
UINT8 srcpix = *src_ptr++;
pen_t srcrgb = pal_ptr[srcpix];
UINT32 dstrgb = dst_ptr[tx];
int sr, sg, sb, dr, dg, db;
sr = (srcrgb >> 3) & 0x1f;
sg = (srcrgb >> 11) & 0x1f;
sb = (srcrgb >> 19) & 0x1f;
dr = (dstrgb >> 3) & 0x1f;
dg = (dstrgb >> 11) & 0x1f;
db = (dstrgb >> 19) & 0x1f;
dr = (t32x32pm[dr - sr + alpha] >> 5) + dr;
dg = (t32x32pm[dg - sg + alpha] >> 5) + dg;
db = (t32x32pm[db - sb + alpha] >> 5) + db;
dst_ptr[tx] = MAKE_RGB(pal5bit(db), pal5bit(dg), pal5bit(dr));
}
dst_ptr += bitmap->rowpixels;
}
}
else
{
for (ty = 0; ty < tileh; ty++)
{
for (tx = 0; tx < tilew; tx++)
dst_ptr[tx] = pal_ptr[*src_ptr++];
dst_ptr += bitmap->rowpixels;
}
}
}
dst_base += bitmap->rowpixels * tileh;
}
} | [
"static",
"void",
"draw_cloud",
"(",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT16",
"*",
"tm_base",
",",
"int",
"x0",
",",
"int",
"y0",
",",
"int",
"xcount",
",",
"int",
"ycount",
",",
"int",
"scrollx",
",",
"int",
"scrolly",
",",
"int",
"tmw_l2",
",",
"int",
"tmh_l2",
",",
"int",
"alpha",
",",
"int",
"pal_offset",
")",
"{",
"const",
"UINT8",
"*",
"src_ptr",
";",
"UINT16",
"*",
"tmap_ptr",
";",
"UINT32",
"*",
"dst_base",
",",
"*",
"dst_ptr",
";",
"const",
"pen_t",
"*",
"pal_base",
",",
"*",
"pal_ptr",
";",
"int",
"tilew",
",",
"tileh",
";",
"int",
"tmskipx",
",",
"tmskipy",
",",
"tmscanx",
",",
"tmmaskx",
",",
"tmmasky",
";",
"int",
"dx",
",",
"dy",
";",
"int",
"i",
",",
"j",
",",
"tx",
",",
"ty",
";",
"if",
"(",
"alpha",
">",
"0x1f",
")",
"return",
";",
"tilew",
"=",
"gfx",
"->",
"width",
";",
"tileh",
"=",
"gfx",
"->",
"height",
";",
"tmmaskx",
"=",
"(",
"1",
"<<",
"tmw_l2",
")",
"-",
"1",
";",
"tmmasky",
"=",
"(",
"1",
"<<",
"tmh_l2",
")",
"-",
"1",
";",
"scrollx",
"&=",
"(",
"(",
"tilew",
"<<",
"tmw_l2",
")",
"-",
"1",
")",
";",
"scrolly",
"&=",
"(",
"(",
"tileh",
"<<",
"tmh_l2",
")",
"-",
"1",
")",
";",
"tmskipx",
"=",
"scrollx",
"/",
"tilew",
";",
"dx",
"=",
"-",
"(",
"scrollx",
"&",
"(",
"tilew",
"-",
"1",
")",
")",
";",
"tmskipy",
"=",
"scrolly",
"/",
"tileh",
";",
"dy",
"=",
"-",
"(",
"scrolly",
"&",
"(",
"tileh",
"-",
"1",
")",
")",
";",
"dst_base",
"=",
"BITMAP_ADDR32",
"(",
"bitmap",
",",
"y0",
"+",
"dy",
",",
"x0",
"+",
"dx",
")",
";",
"pal_base",
"=",
"gfx",
"->",
"machine",
"->",
"pens",
"+",
"pal_offset",
"*",
"gfx",
"->",
"color_granularity",
";",
"alpha",
"<<=",
"6",
";",
"dst_base",
"+=",
"8",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"ycount",
";",
"i",
"++",
")",
"{",
"tmap_ptr",
"=",
"tm_base",
"+",
"(",
"(",
"tmskipy",
"++",
"&",
"tmmasky",
")",
"<<",
"tmw_l2",
")",
";",
"tmscanx",
"=",
"tmskipx",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"xcount",
";",
"j",
"++",
")",
"{",
"UINT16",
"tiledata",
"=",
"tmap_ptr",
"[",
"tmscanx",
"++",
"&",
"tmmaskx",
"]",
";",
"UINT16",
"tile_index",
"=",
"tiledata",
"&",
"0xfff",
";",
"UINT16",
"tile_color",
"=",
"(",
"(",
"tiledata",
">>",
"5",
")",
"&",
"0x78",
")",
"+",
"(",
"tiledata",
">>",
"12",
")",
";",
"src_ptr",
"=",
"gfx_element_get_data",
"(",
"gfx",
",",
"tile_index",
")",
";",
"pal_ptr",
"=",
"pal_base",
"+",
"tile_color",
"*",
"gfx",
"->",
"color_granularity",
";",
"dst_ptr",
"=",
"dst_base",
"+",
"j",
"*",
"tilew",
";",
"if",
"(",
"alpha",
">",
"0",
")",
"{",
"for",
"(",
"ty",
"=",
"0",
";",
"ty",
"<",
"tileh",
";",
"ty",
"++",
")",
"{",
"for",
"(",
"tx",
"=",
"0",
";",
"tx",
"<",
"tilew",
";",
"tx",
"++",
")",
"{",
"UINT8",
"srcpix",
"=",
"*",
"src_ptr",
"++",
";",
"pen_t",
"srcrgb",
"=",
"pal_ptr",
"[",
"srcpix",
"]",
";",
"UINT32",
"dstrgb",
"=",
"dst_ptr",
"[",
"tx",
"]",
";",
"int",
"sr",
",",
"sg",
",",
"sb",
",",
"dr",
",",
"dg",
",",
"db",
";",
"sr",
"=",
"(",
"srcrgb",
">>",
"3",
")",
"&",
"0x1f",
";",
"sg",
"=",
"(",
"srcrgb",
">>",
"11",
")",
"&",
"0x1f",
";",
"sb",
"=",
"(",
"srcrgb",
">>",
"19",
")",
"&",
"0x1f",
";",
"dr",
"=",
"(",
"dstrgb",
">>",
"3",
")",
"&",
"0x1f",
";",
"dg",
"=",
"(",
"dstrgb",
">>",
"11",
")",
"&",
"0x1f",
";",
"db",
"=",
"(",
"dstrgb",
">>",
"19",
")",
"&",
"0x1f",
";",
"dr",
"=",
"(",
"t32x32pm",
"[",
"dr",
"-",
"sr",
"+",
"alpha",
"]",
">>",
"5",
")",
"+",
"dr",
";",
"dg",
"=",
"(",
"t32x32pm",
"[",
"dg",
"-",
"sg",
"+",
"alpha",
"]",
">>",
"5",
")",
"+",
"dg",
";",
"db",
"=",
"(",
"t32x32pm",
"[",
"db",
"-",
"sb",
"+",
"alpha",
"]",
">>",
"5",
")",
"+",
"db",
";",
"dst_ptr",
"[",
"tx",
"]",
"=",
"MAKE_RGB",
"(",
"pal5bit",
"(",
"db",
")",
",",
"pal5bit",
"(",
"dg",
")",
",",
"pal5bit",
"(",
"dr",
")",
")",
";",
"}",
"dst_ptr",
"+=",
"bitmap",
"->",
"rowpixels",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"ty",
"=",
"0",
";",
"ty",
"<",
"tileh",
";",
"ty",
"++",
")",
"{",
"for",
"(",
"tx",
"=",
"0",
";",
"tx",
"<",
"tilew",
";",
"tx",
"++",
")",
"dst_ptr",
"[",
"tx",
"]",
"=",
"pal_ptr",
"[",
"*",
"src_ptr",
"++",
"]",
";",
"dst_ptr",
"+=",
"bitmap",
"->",
"rowpixels",
";",
"}",
"}",
"}",
"dst_base",
"+=",
"bitmap",
"->",
"rowpixels",
"*",
"tileh",
";",
"}",
"}"
] | blends two 8x8x16bpp direct RGB tilemaps | [
"blends",
"two",
"8x8x16bpp",
"direct",
"RGB",
"tilemaps"
] | [
"// target coordinate\r",
"// number of tiles to draw in x and y\r",
"// tilemap scroll position\r",
"// tilemap width and height in log(2)\r",
"// alpha(0-3f), # of color codes to shift\r",
"// Wec Le Mans specific: decodes tile index in EBX\r",
"// Wec Le Mans specific: decodes tile color in EAX\r",
"/* alpha case */",
"/* non-alpha case */"
] | [
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "tm_base",
"type": "UINT16"
},
{
"param": "x0",
"type": "int"
},
{
"param": "y0",
"type": "int"
},
{
"param": "xcount",
"type": "int"
},
{
"param": "ycount",
"type": "int"
},
{
"param": "scrollx",
"type": "int"
},
{
"param": "scrolly",
"type": "int"
},
{
"param": "tmw_l2",
"type": "int"
},
{
"param": "tmh_l2",
"type": "int"
},
{
"param": "alpha",
"type": "int"
},
{
"param": "pal_offset",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tm_base",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x0",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y0",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xcount",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ycount",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scrollx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scrolly",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tmw_l2",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tmh_l2",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "alpha",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pal_offset",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7b3ecef056a59763ca0af44be18b8e9c16a2e620 | lofunz/mieme | Reloaded/trunk/src/mame/video/gunbustr.c | [
"Unlicense"
] | C | draw_sprites | void | static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,const int *primasks,int x_offs,int y_offs)
{
UINT32 *spriteram32 = machine->generic.spriteram.u32;
UINT16 *spritemap = (UINT16 *)memory_region(machine, "user1");
int offs, data, tilenum, color, flipx, flipy;
int x, y, priority, dblsize, curx, cury;
int sprites_flipscreen = 0;
int zoomx, zoomy, zx, zy;
int sprite_chunk,map_offset,code,j,k,px,py;
int dimension,total_chunks,bad_chunks;
/* pdrawgfx() needs us to draw sprites front to back, so we have to build a list
while processing sprite ram and then draw them all at the end */
struct tempsprite *sprite_ptr = spritelist;
for (offs = (machine->generic.spriteram_size/4-4);offs >= 0;offs -= 4)
{
data = spriteram32[offs+0];
flipx = (data & 0x00800000) >> 23;
zoomx = (data & 0x007f0000) >> 16;
tilenum = (data & 0x00007fff);
data = spriteram32[offs+2];
priority = (data & 0x000c0000) >> 18;
color = (data & 0x0003fc00) >> 10;
x = (data & 0x000003ff);
data = spriteram32[offs+3];
dblsize = (data & 0x00040000) >> 18;
flipy = (data & 0x00020000) >> 17;
zoomy = (data & 0x0001fc00) >> 10;
y = (data & 0x000003ff);
color |= 0x80;
if (!tilenum) continue;
flipy = !flipy;
zoomx += 1;
zoomy += 1;
y += y_offs;
/* treat coords as signed */
if (x>0x340) x -= 0x400;
if (y>0x340) y -= 0x400;
x -= x_offs;
bad_chunks = 0;
dimension = ((dblsize*2) + 2); // 2 or 4
total_chunks = ((dblsize*3) + 1) << 2; // 4 or 16
map_offset = tilenum << 2;
{
for (sprite_chunk=0;sprite_chunk<total_chunks;sprite_chunk++)
{
j = sprite_chunk / dimension; /* rows */
k = sprite_chunk % dimension; /* chunks per row */
px = k;
py = j;
/* pick tiles back to front for x and y flips */
if (flipx) px = dimension-1-k;
if (flipy) py = dimension-1-j;
code = spritemap[map_offset + px + (py<<(dblsize+1))];
if (code==0xffff)
{
bad_chunks += 1;
continue;
}
curx = x + ((k*zoomx)/dimension);
cury = y + ((j*zoomy)/dimension);
zx= x + (((k+1)*zoomx)/dimension) - curx;
zy= y + (((j+1)*zoomy)/dimension) - cury;
if (sprites_flipscreen)
{
/* -zx/y is there to fix zoomed sprite coords in screenflip.
drawgfxzoom does not know to draw from flip-side of sprites when
screen is flipped; so we must correct the coords ourselves. */
curx = 320 - curx - zx;
cury = 256 - cury - zy;
flipx = !flipx;
flipy = !flipy;
}
sprite_ptr->gfx = 0;
sprite_ptr->code = code;
sprite_ptr->color = color;
sprite_ptr->flipx = !flipx;
sprite_ptr->flipy = flipy;
sprite_ptr->x = curx;
sprite_ptr->y = cury;
sprite_ptr->zoomx = zx << 12;
sprite_ptr->zoomy = zy << 12;
if (primasks)
{
sprite_ptr->primask = primasks[priority];
sprite_ptr++;
}
else
{
drawgfxzoom_transpen(bitmap,cliprect,machine->gfx[sprite_ptr->gfx],
sprite_ptr->code,
sprite_ptr->color,
sprite_ptr->flipx,sprite_ptr->flipy,
sprite_ptr->x,sprite_ptr->y,
sprite_ptr->zoomx,sprite_ptr->zoomy,0);
}
}
}
if (bad_chunks)
logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks);
}
/* this happens only if primsks != NULL */
while (sprite_ptr != spritelist)
{
sprite_ptr--;
pdrawgfxzoom_transpen(bitmap,cliprect,machine->gfx[sprite_ptr->gfx],
sprite_ptr->code,
sprite_ptr->color,
sprite_ptr->flipx,sprite_ptr->flipy,
sprite_ptr->x,sprite_ptr->y,
sprite_ptr->zoomx,sprite_ptr->zoomy,
machine->priority_bitmap,sprite_ptr->primask,0);
}
} | /************************************************************
SPRITE DRAW ROUTINES
We draw a series of small tiles ("chunks") together to
create each big sprite. The spritemap rom provides the lookup
table for this. The game hardware looks up 16x16 sprite chunks
from the spritemap rom, creating a 64x64 sprite like this:
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
(where the number is the word offset into the spritemap rom).
It can also create 32x32 sprites.
NB: unused portions of the spritemap rom contain hex FF's.
It is a useful coding check to warn in the log if these
are being accessed. [They can be inadvertently while
spriteram is being tested, take no notice of that.]
Heavy use is made of sprite zooming.
***
Sprite table layout (4 long words per entry)
------------------------------------------
0 | ........ x....... ........ ........ | Flip X
0 | ........ .xxxxxxx ........ ........ | ZoomX
0 | ........ ........ .xxxxxxx xxxxxxxx | Sprite Tile
| |
2 | ........ ....xx.. ........ ........ | Sprite/tile priority [*]
2 | ........ ......xx xxxxxx.. ........ | Palette bank
2 | ........ ........ ......xx xxxxxxxx | X position
| |
3 | ........ .....x.. ........ ........ | Sprite size (0=32x32, 1=64x64)
3 | ........ ......x. ........ ........ | Flip Y
3 | ........ .......x xxxxxx.. ........ | ZoomY
3 | ........ ........ ......xx xxxxxxxx | Y position
------------------------------------------
[* 00=over BG1; 01=BG2; 10=BG3; 11=over text ???]
********************************************************/ | SPRITE DRAW ROUTINES
We draw a series of small tiles ("chunks") together to
create each big sprite. The spritemap rom provides the lookup
table for this. The game hardware looks up 16x16 sprite chunks
from the spritemap rom, creating a 64x64 sprite like this.
(where the number is the word offset into the spritemap rom).
It can also create 32x32 sprites.
unused portions of the spritemap rom contain hex FF's.
It is a useful coding check to warn in the log if these
are being accessed. [They can be inadvertently while
spriteram is being tested, take no notice of that.]
Heavy use is made of sprite zooming.
Sprite table layout (4 long words per entry)
| [
"SPRITE",
"DRAW",
"ROUTINES",
"We",
"draw",
"a",
"series",
"of",
"small",
"tiles",
"(",
"\"",
"chunks",
"\"",
")",
"together",
"to",
"create",
"each",
"big",
"sprite",
".",
"The",
"spritemap",
"rom",
"provides",
"the",
"lookup",
"table",
"for",
"this",
".",
"The",
"game",
"hardware",
"looks",
"up",
"16x16",
"sprite",
"chunks",
"from",
"the",
"spritemap",
"rom",
"creating",
"a",
"64x64",
"sprite",
"like",
"this",
".",
"(",
"where",
"the",
"number",
"is",
"the",
"word",
"offset",
"into",
"the",
"spritemap",
"rom",
")",
".",
"It",
"can",
"also",
"create",
"32x32",
"sprites",
".",
"unused",
"portions",
"of",
"the",
"spritemap",
"rom",
"contain",
"hex",
"FF",
"'",
"s",
".",
"It",
"is",
"a",
"useful",
"coding",
"check",
"to",
"warn",
"in",
"the",
"log",
"if",
"these",
"are",
"being",
"accessed",
".",
"[",
"They",
"can",
"be",
"inadvertently",
"while",
"spriteram",
"is",
"being",
"tested",
"take",
"no",
"notice",
"of",
"that",
".",
"]",
"Heavy",
"use",
"is",
"made",
"of",
"sprite",
"zooming",
".",
"Sprite",
"table",
"layout",
"(",
"4",
"long",
"words",
"per",
"entry",
")"
] | static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,const int *primasks,int x_offs,int y_offs)
{
UINT32 *spriteram32 = machine->generic.spriteram.u32;
UINT16 *spritemap = (UINT16 *)memory_region(machine, "user1");
int offs, data, tilenum, color, flipx, flipy;
int x, y, priority, dblsize, curx, cury;
int sprites_flipscreen = 0;
int zoomx, zoomy, zx, zy;
int sprite_chunk,map_offset,code,j,k,px,py;
int dimension,total_chunks,bad_chunks;
struct tempsprite *sprite_ptr = spritelist;
for (offs = (machine->generic.spriteram_size/4-4);offs >= 0;offs -= 4)
{
data = spriteram32[offs+0];
flipx = (data & 0x00800000) >> 23;
zoomx = (data & 0x007f0000) >> 16;
tilenum = (data & 0x00007fff);
data = spriteram32[offs+2];
priority = (data & 0x000c0000) >> 18;
color = (data & 0x0003fc00) >> 10;
x = (data & 0x000003ff);
data = spriteram32[offs+3];
dblsize = (data & 0x00040000) >> 18;
flipy = (data & 0x00020000) >> 17;
zoomy = (data & 0x0001fc00) >> 10;
y = (data & 0x000003ff);
color |= 0x80;
if (!tilenum) continue;
flipy = !flipy;
zoomx += 1;
zoomy += 1;
y += y_offs;
if (x>0x340) x -= 0x400;
if (y>0x340) y -= 0x400;
x -= x_offs;
bad_chunks = 0;
dimension = ((dblsize*2) + 2);
total_chunks = ((dblsize*3) + 1) << 2;
map_offset = tilenum << 2;
{
for (sprite_chunk=0;sprite_chunk<total_chunks;sprite_chunk++)
{
j = sprite_chunk / dimension;
k = sprite_chunk % dimension;
px = k;
py = j;
if (flipx) px = dimension-1-k;
if (flipy) py = dimension-1-j;
code = spritemap[map_offset + px + (py<<(dblsize+1))];
if (code==0xffff)
{
bad_chunks += 1;
continue;
}
curx = x + ((k*zoomx)/dimension);
cury = y + ((j*zoomy)/dimension);
zx= x + (((k+1)*zoomx)/dimension) - curx;
zy= y + (((j+1)*zoomy)/dimension) - cury;
if (sprites_flipscreen)
{
curx = 320 - curx - zx;
cury = 256 - cury - zy;
flipx = !flipx;
flipy = !flipy;
}
sprite_ptr->gfx = 0;
sprite_ptr->code = code;
sprite_ptr->color = color;
sprite_ptr->flipx = !flipx;
sprite_ptr->flipy = flipy;
sprite_ptr->x = curx;
sprite_ptr->y = cury;
sprite_ptr->zoomx = zx << 12;
sprite_ptr->zoomy = zy << 12;
if (primasks)
{
sprite_ptr->primask = primasks[priority];
sprite_ptr++;
}
else
{
drawgfxzoom_transpen(bitmap,cliprect,machine->gfx[sprite_ptr->gfx],
sprite_ptr->code,
sprite_ptr->color,
sprite_ptr->flipx,sprite_ptr->flipy,
sprite_ptr->x,sprite_ptr->y,
sprite_ptr->zoomx,sprite_ptr->zoomy,0);
}
}
}
if (bad_chunks)
logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks);
}
while (sprite_ptr != spritelist)
{
sprite_ptr--;
pdrawgfxzoom_transpen(bitmap,cliprect,machine->gfx[sprite_ptr->gfx],
sprite_ptr->code,
sprite_ptr->color,
sprite_ptr->flipx,sprite_ptr->flipy,
sprite_ptr->x,sprite_ptr->y,
sprite_ptr->zoomx,sprite_ptr->zoomy,
machine->priority_bitmap,sprite_ptr->primask,0);
}
} | [
"static",
"void",
"draw_sprites",
"(",
"running_machine",
"*",
"machine",
",",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"int",
"*",
"primasks",
",",
"int",
"x_offs",
",",
"int",
"y_offs",
")",
"{",
"UINT32",
"*",
"spriteram32",
"=",
"machine",
"->",
"generic",
".",
"spriteram",
".",
"u32",
";",
"UINT16",
"*",
"spritemap",
"=",
"(",
"UINT16",
"*",
")",
"memory_region",
"(",
"machine",
",",
"\"",
"\"",
")",
";",
"int",
"offs",
",",
"data",
",",
"tilenum",
",",
"color",
",",
"flipx",
",",
"flipy",
";",
"int",
"x",
",",
"y",
",",
"priority",
",",
"dblsize",
",",
"curx",
",",
"cury",
";",
"int",
"sprites_flipscreen",
"=",
"0",
";",
"int",
"zoomx",
",",
"zoomy",
",",
"zx",
",",
"zy",
";",
"int",
"sprite_chunk",
",",
"map_offset",
",",
"code",
",",
"j",
",",
"k",
",",
"px",
",",
"py",
";",
"int",
"dimension",
",",
"total_chunks",
",",
"bad_chunks",
";",
"struct",
"tempsprite",
"*",
"sprite_ptr",
"=",
"spritelist",
";",
"for",
"(",
"offs",
"=",
"(",
"machine",
"->",
"generic",
".",
"spriteram_size",
"/",
"4",
"-",
"4",
")",
";",
"offs",
">=",
"0",
";",
"offs",
"-=",
"4",
")",
"{",
"data",
"=",
"spriteram32",
"[",
"offs",
"+",
"0",
"]",
";",
"flipx",
"=",
"(",
"data",
"&",
"0x00800000",
")",
">>",
"23",
";",
"zoomx",
"=",
"(",
"data",
"&",
"0x007f0000",
")",
">>",
"16",
";",
"tilenum",
"=",
"(",
"data",
"&",
"0x00007fff",
")",
";",
"data",
"=",
"spriteram32",
"[",
"offs",
"+",
"2",
"]",
";",
"priority",
"=",
"(",
"data",
"&",
"0x000c0000",
")",
">>",
"18",
";",
"color",
"=",
"(",
"data",
"&",
"0x0003fc00",
")",
">>",
"10",
";",
"x",
"=",
"(",
"data",
"&",
"0x000003ff",
")",
";",
"data",
"=",
"spriteram32",
"[",
"offs",
"+",
"3",
"]",
";",
"dblsize",
"=",
"(",
"data",
"&",
"0x00040000",
")",
">>",
"18",
";",
"flipy",
"=",
"(",
"data",
"&",
"0x00020000",
")",
">>",
"17",
";",
"zoomy",
"=",
"(",
"data",
"&",
"0x0001fc00",
")",
">>",
"10",
";",
"y",
"=",
"(",
"data",
"&",
"0x000003ff",
")",
";",
"color",
"|=",
"0x80",
";",
"if",
"(",
"!",
"tilenum",
")",
"continue",
";",
"flipy",
"=",
"!",
"flipy",
";",
"zoomx",
"+=",
"1",
";",
"zoomy",
"+=",
"1",
";",
"y",
"+=",
"y_offs",
";",
"if",
"(",
"x",
">",
"0x340",
")",
"x",
"-=",
"0x400",
";",
"if",
"(",
"y",
">",
"0x340",
")",
"y",
"-=",
"0x400",
";",
"x",
"-=",
"x_offs",
";",
"bad_chunks",
"=",
"0",
";",
"dimension",
"=",
"(",
"(",
"dblsize",
"*",
"2",
")",
"+",
"2",
")",
";",
"total_chunks",
"=",
"(",
"(",
"dblsize",
"*",
"3",
")",
"+",
"1",
")",
"<<",
"2",
";",
"map_offset",
"=",
"tilenum",
"<<",
"2",
";",
"{",
"for",
"(",
"sprite_chunk",
"=",
"0",
";",
"sprite_chunk",
"<",
"total_chunks",
";",
"sprite_chunk",
"++",
")",
"{",
"j",
"=",
"sprite_chunk",
"/",
"dimension",
";",
"k",
"=",
"sprite_chunk",
"%",
"dimension",
";",
"px",
"=",
"k",
";",
"py",
"=",
"j",
";",
"if",
"(",
"flipx",
")",
"px",
"=",
"dimension",
"-",
"1",
"-",
"k",
";",
"if",
"(",
"flipy",
")",
"py",
"=",
"dimension",
"-",
"1",
"-",
"j",
";",
"code",
"=",
"spritemap",
"[",
"map_offset",
"+",
"px",
"+",
"(",
"py",
"<<",
"(",
"dblsize",
"+",
"1",
")",
")",
"]",
";",
"if",
"(",
"code",
"==",
"0xffff",
")",
"{",
"bad_chunks",
"+=",
"1",
";",
"continue",
";",
"}",
"curx",
"=",
"x",
"+",
"(",
"(",
"k",
"*",
"zoomx",
")",
"/",
"dimension",
")",
";",
"cury",
"=",
"y",
"+",
"(",
"(",
"j",
"*",
"zoomy",
")",
"/",
"dimension",
")",
";",
"zx",
"=",
"x",
"+",
"(",
"(",
"(",
"k",
"+",
"1",
")",
"*",
"zoomx",
")",
"/",
"dimension",
")",
"-",
"curx",
";",
"zy",
"=",
"y",
"+",
"(",
"(",
"(",
"j",
"+",
"1",
")",
"*",
"zoomy",
")",
"/",
"dimension",
")",
"-",
"cury",
";",
"if",
"(",
"sprites_flipscreen",
")",
"{",
"curx",
"=",
"320",
"-",
"curx",
"-",
"zx",
";",
"cury",
"=",
"256",
"-",
"cury",
"-",
"zy",
";",
"flipx",
"=",
"!",
"flipx",
";",
"flipy",
"=",
"!",
"flipy",
";",
"}",
"sprite_ptr",
"->",
"gfx",
"=",
"0",
";",
"sprite_ptr",
"->",
"code",
"=",
"code",
";",
"sprite_ptr",
"->",
"color",
"=",
"color",
";",
"sprite_ptr",
"->",
"flipx",
"=",
"!",
"flipx",
";",
"sprite_ptr",
"->",
"flipy",
"=",
"flipy",
";",
"sprite_ptr",
"->",
"x",
"=",
"curx",
";",
"sprite_ptr",
"->",
"y",
"=",
"cury",
";",
"sprite_ptr",
"->",
"zoomx",
"=",
"zx",
"<<",
"12",
";",
"sprite_ptr",
"->",
"zoomy",
"=",
"zy",
"<<",
"12",
";",
"if",
"(",
"primasks",
")",
"{",
"sprite_ptr",
"->",
"primask",
"=",
"primasks",
"[",
"priority",
"]",
";",
"sprite_ptr",
"++",
";",
"}",
"else",
"{",
"drawgfxzoom_transpen",
"(",
"bitmap",
",",
"cliprect",
",",
"machine",
"->",
"gfx",
"[",
"sprite_ptr",
"->",
"gfx",
"]",
",",
"sprite_ptr",
"->",
"code",
",",
"sprite_ptr",
"->",
"color",
",",
"sprite_ptr",
"->",
"flipx",
",",
"sprite_ptr",
"->",
"flipy",
",",
"sprite_ptr",
"->",
"x",
",",
"sprite_ptr",
"->",
"y",
",",
"sprite_ptr",
"->",
"zoomx",
",",
"sprite_ptr",
"->",
"zoomy",
",",
"0",
")",
";",
"}",
"}",
"}",
"if",
"(",
"bad_chunks",
")",
"logerror",
"(",
"\"",
"\\n",
"\"",
",",
"tilenum",
",",
"bad_chunks",
")",
";",
"}",
"while",
"(",
"sprite_ptr",
"!=",
"spritelist",
")",
"{",
"sprite_ptr",
"--",
";",
"pdrawgfxzoom_transpen",
"(",
"bitmap",
",",
"cliprect",
",",
"machine",
"->",
"gfx",
"[",
"sprite_ptr",
"->",
"gfx",
"]",
",",
"sprite_ptr",
"->",
"code",
",",
"sprite_ptr",
"->",
"color",
",",
"sprite_ptr",
"->",
"flipx",
",",
"sprite_ptr",
"->",
"flipy",
",",
"sprite_ptr",
"->",
"x",
",",
"sprite_ptr",
"->",
"y",
",",
"sprite_ptr",
"->",
"zoomx",
",",
"sprite_ptr",
"->",
"zoomy",
",",
"machine",
"->",
"priority_bitmap",
",",
"sprite_ptr",
"->",
"primask",
",",
"0",
")",
";",
"}",
"}"
] | SPRITE DRAW ROUTINES
We draw a series of small tiles ("chunks") together to
create each big sprite. | [
"SPRITE",
"DRAW",
"ROUTINES",
"We",
"draw",
"a",
"series",
"of",
"small",
"tiles",
"(",
"\"",
"chunks",
"\"",
")",
"together",
"to",
"create",
"each",
"big",
"sprite",
"."
] | [
"/* pdrawgfx() needs us to draw sprites front to back, so we have to build a list\r\n while processing sprite ram and then draw them all at the end */",
"/* treat coords as signed */",
"// 2 or 4\r",
"// 4 or 16\r",
"/* rows */",
"/* chunks per row */",
"/* pick tiles back to front for x and y flips */",
"/* -zx/y is there to fix zoomed sprite coords in screenflip.\r\n drawgfxzoom does not know to draw from flip-side of sprites when\r\n screen is flipped; so we must correct the coords ourselves. */",
"/* this happens only if primsks != NULL */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "primasks",
"type": "int"
},
{
"param": "x_offs",
"type": "int"
},
{
"param": "y_offs",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "primasks",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x_offs",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y_offs",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6260422b35a9760979d0c8ccd70f99da6359e0 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/spc700/spc700.c | [
"Unlicense"
] | C | spc700_set_nmi_line | void | static void spc700_set_nmi_line(spc700i_cpu *cpustate,int state)
{
#if !SPC700_OPTIMIZE_SNES
if(state == CLEAR_LINE)
LINE_NMI = 0;
else if(!LINE_NMI)
{
LINE_NMI = 1;
CLK(7);
PUSH_16(cpustate, REG_PC);
PUSH_8(cpustate, GET_REG_P_INT());
JUMP(cpustate, read_16_VEC(VECTOR_NMI));
}
#endif /* SPC700_OPTIMIZE_SNES */
} | /* Assert or clear the NMI line of the CPU */ | Assert or clear the NMI line of the CPU | [
"Assert",
"or",
"clear",
"the",
"NMI",
"line",
"of",
"the",
"CPU"
] | static void spc700_set_nmi_line(spc700i_cpu *cpustate,int state)
{
#if !SPC700_OPTIMIZE_SNES
if(state == CLEAR_LINE)
LINE_NMI = 0;
else if(!LINE_NMI)
{
LINE_NMI = 1;
CLK(7);
PUSH_16(cpustate, REG_PC);
PUSH_8(cpustate, GET_REG_P_INT());
JUMP(cpustate, read_16_VEC(VECTOR_NMI));
}
#endif
} | [
"static",
"void",
"spc700_set_nmi_line",
"(",
"spc700i_cpu",
"*",
"cpustate",
",",
"int",
"state",
")",
"{",
"#if",
"!",
"SPC700_OPTIMIZE_SNES",
"\n",
"if",
"(",
"state",
"==",
"CLEAR_LINE",
")",
"LINE_NMI",
"=",
"0",
";",
"else",
"if",
"(",
"!",
"LINE_NMI",
")",
"{",
"LINE_NMI",
"=",
"1",
";",
"CLK",
"(",
"7",
")",
";",
"PUSH_16",
"(",
"cpustate",
",",
"REG_PC",
")",
";",
"PUSH_8",
"(",
"cpustate",
",",
"GET_REG_P_INT",
"(",
")",
")",
";",
"JUMP",
"(",
"cpustate",
",",
"read_16_VEC",
"(",
"VECTOR_NMI",
")",
")",
";",
"}",
"#endif",
"}"
] | Assert or clear the NMI line of the CPU | [
"Assert",
"or",
"clear",
"the",
"NMI",
"line",
"of",
"the",
"CPU"
] | [
"/* SPC700_OPTIMIZE_SNES */"
] | [
{
"param": "cpustate",
"type": "spc700i_cpu"
},
{
"param": "state",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "spc700i_cpu",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5a6260422b35a9760979d0c8ccd70f99da6359e0 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/spc700/spc700.c | [
"Unlicense"
] | C | spc700_set_irq_line | void | static void spc700_set_irq_line(spc700i_cpu *cpustate,int line, int state)
{
#if !SPC700_OPTIMIZE_SNES
LINE_IRQ = (state != CLEAR_LINE) ? IRQ_SET : IRQ_CLEAR;
CHECK_IRQ();
#endif /* SPC700_OPTIMIZE_SNES */
} | /* Assert or clear the IRQ line of the CPU */ | Assert or clear the IRQ line of the CPU | [
"Assert",
"or",
"clear",
"the",
"IRQ",
"line",
"of",
"the",
"CPU"
] | static void spc700_set_irq_line(spc700i_cpu *cpustate,int line, int state)
{
#if !SPC700_OPTIMIZE_SNES
LINE_IRQ = (state != CLEAR_LINE) ? IRQ_SET : IRQ_CLEAR;
CHECK_IRQ();
#endif
} | [
"static",
"void",
"spc700_set_irq_line",
"(",
"spc700i_cpu",
"*",
"cpustate",
",",
"int",
"line",
",",
"int",
"state",
")",
"{",
"#if",
"!",
"SPC700_OPTIMIZE_SNES",
"\n",
"LINE_IRQ",
"=",
"(",
"state",
"!=",
"CLEAR_LINE",
")",
"?",
"IRQ_SET",
":",
"IRQ_CLEAR",
";",
"CHECK_IRQ",
"(",
")",
";",
"#endif",
"}"
] | Assert or clear the IRQ line of the CPU | [
"Assert",
"or",
"clear",
"the",
"IRQ",
"line",
"of",
"the",
"CPU"
] | [
"/* SPC700_OPTIMIZE_SNES */"
] | [
{
"param": "cpustate",
"type": "spc700i_cpu"
},
{
"param": "line",
"type": "int"
},
{
"param": "state",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "spc700i_cpu",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "line",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | drcbex64_free | void | static void drcbex64_free(drcbe_state *drcbe)
{
/* free the log context */
if (drcbe->log != NULL)
x86log_free_context(drcbe->log);
} | /*-------------------------------------------------
drcbex64_free - free back-end specific state
-------------------------------------------------*/ | free back-end specific state | [
"free",
"back",
"-",
"end",
"specific",
"state"
] | static void drcbex64_free(drcbe_state *drcbe)
{
if (drcbe->log != NULL)
x86log_free_context(drcbe->log);
} | [
"static",
"void",
"drcbex64_free",
"(",
"drcbe_state",
"*",
"drcbe",
")",
"{",
"if",
"(",
"drcbe",
"->",
"log",
"!=",
"NULL",
")",
"x86log_free_context",
"(",
"drcbe",
"->",
"log",
")",
";",
"}"
] | drcbex64_free - free back-end specific state | [
"drcbex64_free",
"-",
"free",
"back",
"-",
"end",
"specific",
"state"
] | [
"/* free the log context */"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | drcbex64_reset | void | static void drcbex64_reset(drcbe_state *drcbe)
{
UINT32 (*cpuid_ecx_stub)(void);
x86code **dst;
/* output a note to the log */
if (drcbe->log != NULL)
x86log_printf(drcbe->log, "\n\n===========\nCACHE RESET\n===========\n\n");
/* generate a little bit of glue code to set up the environment */
dst = (x86code **)drccache_begin_codegen(drcbe->cache, 500);
if (dst == NULL)
fatalerror("Out of cache space after a reset!");
/* generate a simple CPUID stub */
cpuid_ecx_stub = (UINT32 (*)(void))*dst;
emit_push_r64(dst, REG_RBX); // push rbx
emit_mov_r32_imm(dst, REG_EAX, 1); // mov eax,1
emit_cpuid(dst); // cpuid
emit_mov_r32_r32(dst, REG_EAX, REG_ECX); // mov eax,ecx
emit_pop_r64(dst, REG_RBX); // pop rbx
emit_ret(dst); // ret
/* call it to determine if we have SSE4.1 support */
drcbe->sse41 = (((*cpuid_ecx_stub)() & 0x80000) != 0);
/* generate an entry point */
drcbe->entry = (x86_entry_point_func)*dst;
emit_push_r64(dst, REG_RBX); // push rbx
emit_push_r64(dst, REG_RSI); // push rsi
emit_push_r64(dst, REG_RDI); // push rdi
emit_push_r64(dst, REG_RBP); // push rbp
emit_push_r64(dst, REG_R12); // push r12
emit_push_r64(dst, REG_R13); // push r13
emit_push_r64(dst, REG_R14); // push r14
emit_push_r64(dst, REG_R15); // push r15
emit_mov_r64_r64(dst, REG_RBP, REG_PARAM1); // mov rbp,param1
emit_sub_r64_imm(dst, REG_RSP, 32); // sub rsp,32
emit_mov_m64_r64(dst, MABS(drcbe, &drcbe->hashstacksave), REG_RSP); // mov [hashstacksave],rsp
emit_sub_r64_imm(dst, REG_RSP, 8); // sub rsp,8
emit_mov_m64_r64(dst, MABS(drcbe, &drcbe->stacksave), REG_RSP); // mov [stacksave],rsp
emit_stmxcsr_m32(dst, MABS(drcbe, &drcbe->ssemode)); // stmxcsr [ssemode]
emit_jmp_r64(dst, REG_PARAM2); // jmp param2
if (drcbe->log != NULL)
x86log_disasm_code_range(drcbe->log, "entry_point", (x86code *)drcbe->entry, *dst);
/* generate an exit point */
drcbe->exit = *dst;
emit_ldmxcsr_m32(dst, MABS(drcbe, &drcbe->ssemode)); // ldmxcsr [ssemode]
emit_mov_r64_m64(dst, REG_RSP, MABS(drcbe, &drcbe->hashstacksave)); // mov rsp,[hashstacksave]
emit_add_r64_imm(dst, REG_RSP, 32); // add rsp,32
emit_pop_r64(dst, REG_R15); // pop r15
emit_pop_r64(dst, REG_R14); // pop r14
emit_pop_r64(dst, REG_R13); // pop r13
emit_pop_r64(dst, REG_R12); // pop r12
emit_pop_r64(dst, REG_RBP); // pop rbp
emit_pop_r64(dst, REG_RDI); // pop rdi
emit_pop_r64(dst, REG_RSI); // pop rsi
emit_pop_r64(dst, REG_RBX); // pop rbx
emit_ret(dst); // ret
if (drcbe->log != NULL)
x86log_disasm_code_range(drcbe->log, "exit_point", drcbe->exit, *dst);
/* generate a no code point */
drcbe->nocode = *dst;
emit_ret(dst); // ret
if (drcbe->log != NULL)
x86log_disasm_code_range(drcbe->log, "nocode", drcbe->nocode, *dst);
/* finish up codegen */
drccache_end_codegen(drcbe->cache);
/* reset our hash tables */
drchash_reset(drcbe->hash);
drchash_set_default_codeptr(drcbe->hash, drcbe->nocode);
} | /*-------------------------------------------------
drcbex64_reset - reset back-end specific state
-------------------------------------------------*/ | reset back-end specific state | [
"reset",
"back",
"-",
"end",
"specific",
"state"
] | static void drcbex64_reset(drcbe_state *drcbe)
{
UINT32 (*cpuid_ecx_stub)(void);
x86code **dst;
if (drcbe->log != NULL)
x86log_printf(drcbe->log, "\n\n===========\nCACHE RESET\n===========\n\n");
dst = (x86code **)drccache_begin_codegen(drcbe->cache, 500);
if (dst == NULL)
fatalerror("Out of cache space after a reset!");
cpuid_ecx_stub = (UINT32 (*)(void))*dst;
emit_push_r64(dst, REG_RBX);
emit_mov_r32_imm(dst, REG_EAX, 1);
emit_cpuid(dst);
emit_mov_r32_r32(dst, REG_EAX, REG_ECX);
emit_pop_r64(dst, REG_RBX);
emit_ret(dst);
drcbe->sse41 = (((*cpuid_ecx_stub)() & 0x80000) != 0);
drcbe->entry = (x86_entry_point_func)*dst;
emit_push_r64(dst, REG_RBX);
emit_push_r64(dst, REG_RSI);
emit_push_r64(dst, REG_RDI);
emit_push_r64(dst, REG_RBP);
emit_push_r64(dst, REG_R12);
emit_push_r64(dst, REG_R13);
emit_push_r64(dst, REG_R14);
emit_push_r64(dst, REG_R15);
emit_mov_r64_r64(dst, REG_RBP, REG_PARAM1);
emit_sub_r64_imm(dst, REG_RSP, 32);
emit_mov_m64_r64(dst, MABS(drcbe, &drcbe->hashstacksave), REG_RSP);
emit_sub_r64_imm(dst, REG_RSP, 8);
emit_mov_m64_r64(dst, MABS(drcbe, &drcbe->stacksave), REG_RSP);
emit_stmxcsr_m32(dst, MABS(drcbe, &drcbe->ssemode));
emit_jmp_r64(dst, REG_PARAM2);
if (drcbe->log != NULL)
x86log_disasm_code_range(drcbe->log, "entry_point", (x86code *)drcbe->entry, *dst);
drcbe->exit = *dst;
emit_ldmxcsr_m32(dst, MABS(drcbe, &drcbe->ssemode));
emit_mov_r64_m64(dst, REG_RSP, MABS(drcbe, &drcbe->hashstacksave));
emit_add_r64_imm(dst, REG_RSP, 32);
emit_pop_r64(dst, REG_R15);
emit_pop_r64(dst, REG_R14);
emit_pop_r64(dst, REG_R13);
emit_pop_r64(dst, REG_R12);
emit_pop_r64(dst, REG_RBP);
emit_pop_r64(dst, REG_RDI);
emit_pop_r64(dst, REG_RSI);
emit_pop_r64(dst, REG_RBX);
emit_ret(dst);
if (drcbe->log != NULL)
x86log_disasm_code_range(drcbe->log, "exit_point", drcbe->exit, *dst);
drcbe->nocode = *dst;
emit_ret(dst);
if (drcbe->log != NULL)
x86log_disasm_code_range(drcbe->log, "nocode", drcbe->nocode, *dst);
drccache_end_codegen(drcbe->cache);
drchash_reset(drcbe->hash);
drchash_set_default_codeptr(drcbe->hash, drcbe->nocode);
} | [
"static",
"void",
"drcbex64_reset",
"(",
"drcbe_state",
"*",
"drcbe",
")",
"{",
"UINT32",
"(",
"*",
"cpuid_ecx_stub",
")",
"(",
"void",
")",
";",
"x86code",
"*",
"*",
"dst",
";",
"if",
"(",
"drcbe",
"->",
"log",
"!=",
"NULL",
")",
"x86log_printf",
"(",
"drcbe",
"->",
"log",
",",
"\"",
"\\n",
"\\n",
"\\n",
"\\n",
"\\n",
"\\n",
"\"",
")",
";",
"dst",
"=",
"(",
"x86code",
"*",
"*",
")",
"drccache_begin_codegen",
"(",
"drcbe",
"->",
"cache",
",",
"500",
")",
";",
"if",
"(",
"dst",
"==",
"NULL",
")",
"fatalerror",
"(",
"\"",
"\"",
")",
";",
"cpuid_ecx_stub",
"=",
"(",
"UINT32",
"(",
"*",
")",
"(",
"void",
")",
")",
"*",
"dst",
";",
"emit_push_r64",
"(",
"dst",
",",
"REG_RBX",
")",
";",
"emit_mov_r32_imm",
"(",
"dst",
",",
"REG_EAX",
",",
"1",
")",
";",
"emit_cpuid",
"(",
"dst",
")",
";",
"emit_mov_r32_r32",
"(",
"dst",
",",
"REG_EAX",
",",
"REG_ECX",
")",
";",
"emit_pop_r64",
"(",
"dst",
",",
"REG_RBX",
")",
";",
"emit_ret",
"(",
"dst",
")",
";",
"drcbe",
"->",
"sse41",
"=",
"(",
"(",
"(",
"*",
"cpuid_ecx_stub",
")",
"(",
")",
"&",
"0x80000",
")",
"!=",
"0",
")",
";",
"drcbe",
"->",
"entry",
"=",
"(",
"x86_entry_point_func",
")",
"*",
"dst",
";",
"emit_push_r64",
"(",
"dst",
",",
"REG_RBX",
")",
";",
"emit_push_r64",
"(",
"dst",
",",
"REG_RSI",
")",
";",
"emit_push_r64",
"(",
"dst",
",",
"REG_RDI",
")",
";",
"emit_push_r64",
"(",
"dst",
",",
"REG_RBP",
")",
";",
"emit_push_r64",
"(",
"dst",
",",
"REG_R12",
")",
";",
"emit_push_r64",
"(",
"dst",
",",
"REG_R13",
")",
";",
"emit_push_r64",
"(",
"dst",
",",
"REG_R14",
")",
";",
"emit_push_r64",
"(",
"dst",
",",
"REG_R15",
")",
";",
"emit_mov_r64_r64",
"(",
"dst",
",",
"REG_RBP",
",",
"REG_PARAM1",
")",
";",
"emit_sub_r64_imm",
"(",
"dst",
",",
"REG_RSP",
",",
"32",
")",
";",
"emit_mov_m64_r64",
"(",
"dst",
",",
"MABS",
"(",
"drcbe",
",",
"&",
"drcbe",
"->",
"hashstacksave",
")",
",",
"REG_RSP",
")",
";",
"emit_sub_r64_imm",
"(",
"dst",
",",
"REG_RSP",
",",
"8",
")",
";",
"emit_mov_m64_r64",
"(",
"dst",
",",
"MABS",
"(",
"drcbe",
",",
"&",
"drcbe",
"->",
"stacksave",
")",
",",
"REG_RSP",
")",
";",
"emit_stmxcsr_m32",
"(",
"dst",
",",
"MABS",
"(",
"drcbe",
",",
"&",
"drcbe",
"->",
"ssemode",
")",
")",
";",
"emit_jmp_r64",
"(",
"dst",
",",
"REG_PARAM2",
")",
";",
"if",
"(",
"drcbe",
"->",
"log",
"!=",
"NULL",
")",
"x86log_disasm_code_range",
"(",
"drcbe",
"->",
"log",
",",
"\"",
"\"",
",",
"(",
"x86code",
"*",
")",
"drcbe",
"->",
"entry",
",",
"*",
"dst",
")",
";",
"drcbe",
"->",
"exit",
"=",
"*",
"dst",
";",
"emit_ldmxcsr_m32",
"(",
"dst",
",",
"MABS",
"(",
"drcbe",
",",
"&",
"drcbe",
"->",
"ssemode",
")",
")",
";",
"emit_mov_r64_m64",
"(",
"dst",
",",
"REG_RSP",
",",
"MABS",
"(",
"drcbe",
",",
"&",
"drcbe",
"->",
"hashstacksave",
")",
")",
";",
"emit_add_r64_imm",
"(",
"dst",
",",
"REG_RSP",
",",
"32",
")",
";",
"emit_pop_r64",
"(",
"dst",
",",
"REG_R15",
")",
";",
"emit_pop_r64",
"(",
"dst",
",",
"REG_R14",
")",
";",
"emit_pop_r64",
"(",
"dst",
",",
"REG_R13",
")",
";",
"emit_pop_r64",
"(",
"dst",
",",
"REG_R12",
")",
";",
"emit_pop_r64",
"(",
"dst",
",",
"REG_RBP",
")",
";",
"emit_pop_r64",
"(",
"dst",
",",
"REG_RDI",
")",
";",
"emit_pop_r64",
"(",
"dst",
",",
"REG_RSI",
")",
";",
"emit_pop_r64",
"(",
"dst",
",",
"REG_RBX",
")",
";",
"emit_ret",
"(",
"dst",
")",
";",
"if",
"(",
"drcbe",
"->",
"log",
"!=",
"NULL",
")",
"x86log_disasm_code_range",
"(",
"drcbe",
"->",
"log",
",",
"\"",
"\"",
",",
"drcbe",
"->",
"exit",
",",
"*",
"dst",
")",
";",
"drcbe",
"->",
"nocode",
"=",
"*",
"dst",
";",
"emit_ret",
"(",
"dst",
")",
";",
"if",
"(",
"drcbe",
"->",
"log",
"!=",
"NULL",
")",
"x86log_disasm_code_range",
"(",
"drcbe",
"->",
"log",
",",
"\"",
"\"",
",",
"drcbe",
"->",
"nocode",
",",
"*",
"dst",
")",
";",
"drccache_end_codegen",
"(",
"drcbe",
"->",
"cache",
")",
";",
"drchash_reset",
"(",
"drcbe",
"->",
"hash",
")",
";",
"drchash_set_default_codeptr",
"(",
"drcbe",
"->",
"hash",
",",
"drcbe",
"->",
"nocode",
")",
";",
"}"
] | drcbex64_reset - reset back-end specific state | [
"drcbex64_reset",
"-",
"reset",
"back",
"-",
"end",
"specific",
"state"
] | [
"/* output a note to the log */",
"/* generate a little bit of glue code to set up the environment */",
"/* generate a simple CPUID stub */",
"// push rbx\r",
"// mov eax,1\r",
"// cpuid\r",
"// mov eax,ecx\r",
"// pop rbx\r",
"// ret\r",
"/* call it to determine if we have SSE4.1 support */",
"/* generate an entry point */",
"// push rbx\r",
"// push rsi\r",
"// push rdi\r",
"// push rbp\r",
"// push r12\r",
"// push r13\r",
"// push r14\r",
"// push r15\r",
"// mov rbp,param1\r",
"// sub rsp,32\r",
"// mov [hashstacksave],rsp\r",
"// sub rsp,8\r",
"// mov [stacksave],rsp\r",
"// stmxcsr [ssemode]\r",
"// jmp param2\r",
"/* generate an exit point */",
"// ldmxcsr [ssemode]\r",
"// mov rsp,[hashstacksave]\r",
"// add rsp,32\r",
"// pop r15\r",
"// pop r14\r",
"// pop r13\r",
"// pop r12\r",
"// pop rbp\r",
"// pop rdi\r",
"// pop rsi\r",
"// pop rbx\r",
"// ret\r",
"/* generate a no code point */",
"// ret\r",
"/* finish up codegen */",
"/* reset our hash tables */"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | drcbex64_execute | int | static int drcbex64_execute(drcbe_state *drcbe, drcuml_codehandle *entry)
{
/* call our entry point which will jump to the destination */
return (*drcbe->entry)(drcbe->rbpvalue, (x86code *)drcuml_handle_codeptr(entry));
} | /*-------------------------------------------------
drcbex64_execute - execute a block of code
referenced by the given handle
-------------------------------------------------*/ | execute a block of code
referenced by the given handle | [
"execute",
"a",
"block",
"of",
"code",
"referenced",
"by",
"the",
"given",
"handle"
] | static int drcbex64_execute(drcbe_state *drcbe, drcuml_codehandle *entry)
{
return (*drcbe->entry)(drcbe->rbpvalue, (x86code *)drcuml_handle_codeptr(entry));
} | [
"static",
"int",
"drcbex64_execute",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"drcuml_codehandle",
"*",
"entry",
")",
"{",
"return",
"(",
"*",
"drcbe",
"->",
"entry",
")",
"(",
"drcbe",
"->",
"rbpvalue",
",",
"(",
"x86code",
"*",
")",
"drcuml_handle_codeptr",
"(",
"entry",
")",
")",
";",
"}"
] | drcbex64_execute - execute a block of code
referenced by the given handle | [
"drcbex64_execute",
"-",
"execute",
"a",
"block",
"of",
"code",
"referenced",
"by",
"the",
"given",
"handle"
] | [
"/* call our entry point which will jump to the destination */"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "entry",
"type": "drcuml_codehandle"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entry",
"type": "drcuml_codehandle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | drcbex64_get_info | void | static void drcbex64_get_info(drcbe_state *state, drcbe_info *info)
{
for (info->direct_iregs = 0; info->direct_iregs < DRCUML_REG_I_END - DRCUML_REG_I0; info->direct_iregs++)
if (int_register_map[info->direct_iregs] == 0)
break;
for (info->direct_fregs = 0; info->direct_fregs < DRCUML_REG_F_END - DRCUML_REG_F0; info->direct_fregs++)
if (float_register_map[info->direct_fregs] == 0)
break;
} | /*-------------------------------------------------
drcbex64_get_info - return information about
the back-end implementation
-------------------------------------------------*/ | return information about
the back-end implementation | [
"return",
"information",
"about",
"the",
"back",
"-",
"end",
"implementation"
] | static void drcbex64_get_info(drcbe_state *state, drcbe_info *info)
{
for (info->direct_iregs = 0; info->direct_iregs < DRCUML_REG_I_END - DRCUML_REG_I0; info->direct_iregs++)
if (int_register_map[info->direct_iregs] == 0)
break;
for (info->direct_fregs = 0; info->direct_fregs < DRCUML_REG_F_END - DRCUML_REG_F0; info->direct_fregs++)
if (float_register_map[info->direct_fregs] == 0)
break;
} | [
"static",
"void",
"drcbex64_get_info",
"(",
"drcbe_state",
"*",
"state",
",",
"drcbe_info",
"*",
"info",
")",
"{",
"for",
"(",
"info",
"->",
"direct_iregs",
"=",
"0",
";",
"info",
"->",
"direct_iregs",
"<",
"DRCUML_REG_I_END",
"-",
"DRCUML_REG_I0",
";",
"info",
"->",
"direct_iregs",
"++",
")",
"if",
"(",
"int_register_map",
"[",
"info",
"->",
"direct_iregs",
"]",
"==",
"0",
")",
"break",
";",
"for",
"(",
"info",
"->",
"direct_fregs",
"=",
"0",
";",
"info",
"->",
"direct_fregs",
"<",
"DRCUML_REG_F_END",
"-",
"DRCUML_REG_F0",
";",
"info",
"->",
"direct_fregs",
"++",
")",
"if",
"(",
"float_register_map",
"[",
"info",
"->",
"direct_fregs",
"]",
"==",
"0",
")",
"break",
";",
"}"
] | drcbex64_get_info - return information about
the back-end implementation | [
"drcbex64_get_info",
"-",
"return",
"information",
"about",
"the",
"back",
"-",
"end",
"implementation"
] | [] | [
{
"param": "state",
"type": "drcbe_state"
},
{
"param": "info",
"type": "drcbe_info"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "state",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "info",
"type": "drcbe_info",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | param_normalize | void | static void param_normalize(drcbe_state *drcbe, const drcuml_parameter *src, drcuml_parameter *dest, UINT32 allowed)
{
int regnum;
switch (src->type)
{
/* immediates pass through */
case DRCUML_PTYPE_IMMEDIATE:
assert(allowed & PTYPE_I);
dest->type = DRCUML_PTYPE_IMMEDIATE;
dest->value = src->value;
break;
/* memory passes through */
case DRCUML_PTYPE_MEMORY:
assert(allowed & PTYPE_M);
dest->type = DRCUML_PTYPE_MEMORY;
dest->value = (FPTR)src->value;
break;
/* if a register maps to a register, keep it as a register; otherwise map it to memory */
case DRCUML_PTYPE_INT_REGISTER:
assert(allowed & PTYPE_R);
assert(allowed & PTYPE_M);
regnum = int_register_map[src->value - DRCUML_REG_I0];
if (regnum != 0)
{
dest->type = DRCUML_PTYPE_INT_REGISTER;
dest->value = regnum;
}
else
{
dest->type = DRCUML_PTYPE_MEMORY;
dest->value = (FPTR)&drcbe->state.r[src->value - DRCUML_REG_I0];
}
break;
/* if a register maps to a register, keep it as a register; otherwise map it to memory */
case DRCUML_PTYPE_FLOAT_REGISTER:
assert(allowed & PTYPE_F);
assert(allowed & PTYPE_M);
regnum = float_register_map[src->value - DRCUML_REG_F0];
if (regnum != 0)
{
dest->type = DRCUML_PTYPE_FLOAT_REGISTER;
dest->value = regnum;
}
else
{
dest->type = DRCUML_PTYPE_MEMORY;
dest->value = (FPTR)&drcbe->state.f[src->value - DRCUML_REG_F0];
}
break;
/* everything else is unexpected */
default:
fatalerror("Unexpected parameter type");
break;
}
} | /*-------------------------------------------------
param_normalize - convert a full parameter
into a reduced set
-------------------------------------------------*/ | convert a full parameter
into a reduced set | [
"convert",
"a",
"full",
"parameter",
"into",
"a",
"reduced",
"set"
] | static void param_normalize(drcbe_state *drcbe, const drcuml_parameter *src, drcuml_parameter *dest, UINT32 allowed)
{
int regnum;
switch (src->type)
{
case DRCUML_PTYPE_IMMEDIATE:
assert(allowed & PTYPE_I);
dest->type = DRCUML_PTYPE_IMMEDIATE;
dest->value = src->value;
break;
case DRCUML_PTYPE_MEMORY:
assert(allowed & PTYPE_M);
dest->type = DRCUML_PTYPE_MEMORY;
dest->value = (FPTR)src->value;
break;
case DRCUML_PTYPE_INT_REGISTER:
assert(allowed & PTYPE_R);
assert(allowed & PTYPE_M);
regnum = int_register_map[src->value - DRCUML_REG_I0];
if (regnum != 0)
{
dest->type = DRCUML_PTYPE_INT_REGISTER;
dest->value = regnum;
}
else
{
dest->type = DRCUML_PTYPE_MEMORY;
dest->value = (FPTR)&drcbe->state.r[src->value - DRCUML_REG_I0];
}
break;
case DRCUML_PTYPE_FLOAT_REGISTER:
assert(allowed & PTYPE_F);
assert(allowed & PTYPE_M);
regnum = float_register_map[src->value - DRCUML_REG_F0];
if (regnum != 0)
{
dest->type = DRCUML_PTYPE_FLOAT_REGISTER;
dest->value = regnum;
}
else
{
dest->type = DRCUML_PTYPE_MEMORY;
dest->value = (FPTR)&drcbe->state.f[src->value - DRCUML_REG_F0];
}
break;
default:
fatalerror("Unexpected parameter type");
break;
}
} | [
"static",
"void",
"param_normalize",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"const",
"drcuml_parameter",
"*",
"src",
",",
"drcuml_parameter",
"*",
"dest",
",",
"UINT32",
"allowed",
")",
"{",
"int",
"regnum",
";",
"switch",
"(",
"src",
"->",
"type",
")",
"{",
"case",
"DRCUML_PTYPE_IMMEDIATE",
":",
"assert",
"(",
"allowed",
"&",
"PTYPE_I",
")",
";",
"dest",
"->",
"type",
"=",
"DRCUML_PTYPE_IMMEDIATE",
";",
"dest",
"->",
"value",
"=",
"src",
"->",
"value",
";",
"break",
";",
"case",
"DRCUML_PTYPE_MEMORY",
":",
"assert",
"(",
"allowed",
"&",
"PTYPE_M",
")",
";",
"dest",
"->",
"type",
"=",
"DRCUML_PTYPE_MEMORY",
";",
"dest",
"->",
"value",
"=",
"(",
"FPTR",
")",
"src",
"->",
"value",
";",
"break",
";",
"case",
"DRCUML_PTYPE_INT_REGISTER",
":",
"assert",
"(",
"allowed",
"&",
"PTYPE_R",
")",
";",
"assert",
"(",
"allowed",
"&",
"PTYPE_M",
")",
";",
"regnum",
"=",
"int_register_map",
"[",
"src",
"->",
"value",
"-",
"DRCUML_REG_I0",
"]",
";",
"if",
"(",
"regnum",
"!=",
"0",
")",
"{",
"dest",
"->",
"type",
"=",
"DRCUML_PTYPE_INT_REGISTER",
";",
"dest",
"->",
"value",
"=",
"regnum",
";",
"}",
"else",
"{",
"dest",
"->",
"type",
"=",
"DRCUML_PTYPE_MEMORY",
";",
"dest",
"->",
"value",
"=",
"(",
"FPTR",
")",
"&",
"drcbe",
"->",
"state",
".",
"r",
"[",
"src",
"->",
"value",
"-",
"DRCUML_REG_I0",
"]",
";",
"}",
"break",
";",
"case",
"DRCUML_PTYPE_FLOAT_REGISTER",
":",
"assert",
"(",
"allowed",
"&",
"PTYPE_F",
")",
";",
"assert",
"(",
"allowed",
"&",
"PTYPE_M",
")",
";",
"regnum",
"=",
"float_register_map",
"[",
"src",
"->",
"value",
"-",
"DRCUML_REG_F0",
"]",
";",
"if",
"(",
"regnum",
"!=",
"0",
")",
"{",
"dest",
"->",
"type",
"=",
"DRCUML_PTYPE_FLOAT_REGISTER",
";",
"dest",
"->",
"value",
"=",
"regnum",
";",
"}",
"else",
"{",
"dest",
"->",
"type",
"=",
"DRCUML_PTYPE_MEMORY",
";",
"dest",
"->",
"value",
"=",
"(",
"FPTR",
")",
"&",
"drcbe",
"->",
"state",
".",
"f",
"[",
"src",
"->",
"value",
"-",
"DRCUML_REG_F0",
"]",
";",
"}",
"break",
";",
"default",
":",
"fatalerror",
"(",
"\"",
"\"",
")",
";",
"break",
";",
"}",
"}"
] | param_normalize - convert a full parameter
into a reduced set | [
"param_normalize",
"-",
"convert",
"a",
"full",
"parameter",
"into",
"a",
"reduced",
"set"
] | [
"/* immediates pass through */",
"/* memory passes through */",
"/* if a register maps to a register, keep it as a register; otherwise map it to memory */",
"/* if a register maps to a register, keep it as a register; otherwise map it to memory */",
"/* everything else is unexpected */"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "src",
"type": "drcuml_parameter"
},
{
"param": "dest",
"type": "drcuml_parameter"
},
{
"param": "allowed",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "allowed",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | param_normalize_2_commutative | void | static void param_normalize_2_commutative(drcbe_state *drcbe, const drcuml_instruction *inst, drcuml_parameter *dest0, UINT32 allowed0, drcuml_parameter *dest1, UINT32 allowed1)
{
param_normalize_2(drcbe, inst, dest0, allowed0, dest1, allowed1);
/* if the inner parameter is a memory operand, push it to the outer */
if (dest0->type == DRCUML_PTYPE_MEMORY)
{
drcuml_parameter temp = *dest0;
*dest0 = *dest1;
*dest1 = temp;
}
/* if the inner parameter is an immediate, push it to the outer */
if (dest0->type == DRCUML_PTYPE_IMMEDIATE)
{
drcuml_parameter temp = *dest0;
*dest0 = *dest1;
*dest1 = temp;
}
} | /*-------------------------------------------------
param_normalize_2_commutative - normalize a 2
parameter instruction, shuffling the
parameters on the assumption that the two
parameters can be swapped
-------------------------------------------------*/ | normalize a 2
parameter instruction, shuffling the
parameters on the assumption that the two
parameters can be swapped | [
"normalize",
"a",
"2",
"parameter",
"instruction",
"shuffling",
"the",
"parameters",
"on",
"the",
"assumption",
"that",
"the",
"two",
"parameters",
"can",
"be",
"swapped"
] | static void param_normalize_2_commutative(drcbe_state *drcbe, const drcuml_instruction *inst, drcuml_parameter *dest0, UINT32 allowed0, drcuml_parameter *dest1, UINT32 allowed1)
{
param_normalize_2(drcbe, inst, dest0, allowed0, dest1, allowed1);
if (dest0->type == DRCUML_PTYPE_MEMORY)
{
drcuml_parameter temp = *dest0;
*dest0 = *dest1;
*dest1 = temp;
}
if (dest0->type == DRCUML_PTYPE_IMMEDIATE)
{
drcuml_parameter temp = *dest0;
*dest0 = *dest1;
*dest1 = temp;
}
} | [
"static",
"void",
"param_normalize_2_commutative",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"const",
"drcuml_instruction",
"*",
"inst",
",",
"drcuml_parameter",
"*",
"dest0",
",",
"UINT32",
"allowed0",
",",
"drcuml_parameter",
"*",
"dest1",
",",
"UINT32",
"allowed1",
")",
"{",
"param_normalize_2",
"(",
"drcbe",
",",
"inst",
",",
"dest0",
",",
"allowed0",
",",
"dest1",
",",
"allowed1",
")",
";",
"if",
"(",
"dest0",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"{",
"drcuml_parameter",
"temp",
"=",
"*",
"dest0",
";",
"*",
"dest0",
"=",
"*",
"dest1",
";",
"*",
"dest1",
"=",
"temp",
";",
"}",
"if",
"(",
"dest0",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"drcuml_parameter",
"temp",
"=",
"*",
"dest0",
";",
"*",
"dest0",
"=",
"*",
"dest1",
";",
"*",
"dest1",
"=",
"temp",
";",
"}",
"}"
] | param_normalize_2_commutative - normalize a 2
parameter instruction, shuffling the
parameters on the assumption that the two
parameters can be swapped | [
"param_normalize_2_commutative",
"-",
"normalize",
"a",
"2",
"parameter",
"instruction",
"shuffling",
"the",
"parameters",
"on",
"the",
"assumption",
"that",
"the",
"two",
"parameters",
"can",
"be",
"swapped"
] | [
"/* if the inner parameter is a memory operand, push it to the outer */",
"/* if the inner parameter is an immediate, push it to the outer */"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "inst",
"type": "drcuml_instruction"
},
{
"param": "dest0",
"type": "drcuml_parameter"
},
{
"param": "allowed0",
"type": "UINT32"
},
{
"param": "dest1",
"type": "drcuml_parameter"
},
{
"param": "allowed1",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest0",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "allowed0",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest1",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "allowed1",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | param_normalize_3_commutative | void | static void param_normalize_3_commutative(drcbe_state *drcbe, const drcuml_instruction *inst, drcuml_parameter *dest0, UINT32 allowed0, drcuml_parameter *dest1, UINT32 allowed1, drcuml_parameter *dest2, UINT32 allowed2)
{
param_normalize_3(drcbe, inst, dest0, allowed0, dest1, allowed1, dest2, allowed2);
/* if the inner parameter is a memory operand, push it to the outer */
if (dest1->type == DRCUML_PTYPE_MEMORY)
{
drcuml_parameter temp = *dest1;
*dest1 = *dest2;
*dest2 = temp;
}
/* if the inner parameter is an immediate, push it to the outer */
if (dest1->type == DRCUML_PTYPE_IMMEDIATE)
{
drcuml_parameter temp = *dest1;
*dest1 = *dest2;
*dest2 = temp;
}
/* if the destination and outer parameters are equal, move the outer to the inner */
if (dest0->type == dest2->type && dest0->value == dest2->value && dest0->type != DRCUML_PTYPE_IMMEDIATE)
{
drcuml_parameter temp = *dest1;
*dest1 = *dest2;
*dest2 = temp;
}
} | /*-------------------------------------------------
param_normalize_3_commutative - normalize a 3
parameter instruction, shuffling the
parameters on the assumption that the last
2 can be swapped
-------------------------------------------------*/ | normalize a 3
parameter instruction, shuffling the
parameters on the assumption that the last
2 can be swapped | [
"normalize",
"a",
"3",
"parameter",
"instruction",
"shuffling",
"the",
"parameters",
"on",
"the",
"assumption",
"that",
"the",
"last",
"2",
"can",
"be",
"swapped"
] | static void param_normalize_3_commutative(drcbe_state *drcbe, const drcuml_instruction *inst, drcuml_parameter *dest0, UINT32 allowed0, drcuml_parameter *dest1, UINT32 allowed1, drcuml_parameter *dest2, UINT32 allowed2)
{
param_normalize_3(drcbe, inst, dest0, allowed0, dest1, allowed1, dest2, allowed2);
if (dest1->type == DRCUML_PTYPE_MEMORY)
{
drcuml_parameter temp = *dest1;
*dest1 = *dest2;
*dest2 = temp;
}
if (dest1->type == DRCUML_PTYPE_IMMEDIATE)
{
drcuml_parameter temp = *dest1;
*dest1 = *dest2;
*dest2 = temp;
}
if (dest0->type == dest2->type && dest0->value == dest2->value && dest0->type != DRCUML_PTYPE_IMMEDIATE)
{
drcuml_parameter temp = *dest1;
*dest1 = *dest2;
*dest2 = temp;
}
} | [
"static",
"void",
"param_normalize_3_commutative",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"const",
"drcuml_instruction",
"*",
"inst",
",",
"drcuml_parameter",
"*",
"dest0",
",",
"UINT32",
"allowed0",
",",
"drcuml_parameter",
"*",
"dest1",
",",
"UINT32",
"allowed1",
",",
"drcuml_parameter",
"*",
"dest2",
",",
"UINT32",
"allowed2",
")",
"{",
"param_normalize_3",
"(",
"drcbe",
",",
"inst",
",",
"dest0",
",",
"allowed0",
",",
"dest1",
",",
"allowed1",
",",
"dest2",
",",
"allowed2",
")",
";",
"if",
"(",
"dest1",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"{",
"drcuml_parameter",
"temp",
"=",
"*",
"dest1",
";",
"*",
"dest1",
"=",
"*",
"dest2",
";",
"*",
"dest2",
"=",
"temp",
";",
"}",
"if",
"(",
"dest1",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"drcuml_parameter",
"temp",
"=",
"*",
"dest1",
";",
"*",
"dest1",
"=",
"*",
"dest2",
";",
"*",
"dest2",
"=",
"temp",
";",
"}",
"if",
"(",
"dest0",
"->",
"type",
"==",
"dest2",
"->",
"type",
"&&",
"dest0",
"->",
"value",
"==",
"dest2",
"->",
"value",
"&&",
"dest0",
"->",
"type",
"!=",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"drcuml_parameter",
"temp",
"=",
"*",
"dest1",
";",
"*",
"dest1",
"=",
"*",
"dest2",
";",
"*",
"dest2",
"=",
"temp",
";",
"}",
"}"
] | param_normalize_3_commutative - normalize a 3
parameter instruction, shuffling the
parameters on the assumption that the last
2 can be swapped | [
"param_normalize_3_commutative",
"-",
"normalize",
"a",
"3",
"parameter",
"instruction",
"shuffling",
"the",
"parameters",
"on",
"the",
"assumption",
"that",
"the",
"last",
"2",
"can",
"be",
"swapped"
] | [
"/* if the inner parameter is a memory operand, push it to the outer */",
"/* if the inner parameter is an immediate, push it to the outer */",
"/* if the destination and outer parameters are equal, move the outer to the inner */"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "inst",
"type": "drcuml_instruction"
},
{
"param": "dest0",
"type": "drcuml_parameter"
},
{
"param": "allowed0",
"type": "UINT32"
},
{
"param": "dest1",
"type": "drcuml_parameter"
},
{
"param": "allowed1",
"type": "UINT32"
},
{
"param": "dest2",
"type": "drcuml_parameter"
},
{
"param": "allowed2",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest0",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "allowed0",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest1",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "allowed1",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest2",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "allowed2",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | param_normalize_4_commutative | void | static void param_normalize_4_commutative(drcbe_state *drcbe, const drcuml_instruction *inst, drcuml_parameter *dest0, UINT32 allowed0, drcuml_parameter *dest1, UINT32 allowed1, drcuml_parameter *dest2, UINT32 allowed2, drcuml_parameter *dest3, UINT32 allowed3)
{
param_normalize_4(drcbe, inst, dest0, allowed0, dest1, allowed1, dest2, allowed2, dest3, allowed3);
/* if the inner parameter is a memory operand, push it to the outer */
if (dest2->type == DRCUML_PTYPE_MEMORY)
{
drcuml_parameter temp = *dest2;
*dest2 = *dest3;
*dest3 = temp;
}
/* if the inner parameter is an immediate, push it to the outer */
if (dest2->type == DRCUML_PTYPE_IMMEDIATE)
{
drcuml_parameter temp = *dest2;
*dest2 = *dest3;
*dest3 = temp;
}
/* if the destination and outer parameters are equal, move the outer to the inner */
if (dest0->type == dest3->type && dest0->value == dest3->value && dest0->type != DRCUML_PTYPE_IMMEDIATE)
{
drcuml_parameter temp = *dest2;
*dest2 = *dest3;
*dest3 = temp;
}
} | /*-------------------------------------------------
param_normalize_4_commutative - normalize a 4
parameter instruction, shuffling the
parameters on the assumption that the last
2 can be swapped
-------------------------------------------------*/ | normalize a 4
parameter instruction, shuffling the
parameters on the assumption that the last
2 can be swapped | [
"normalize",
"a",
"4",
"parameter",
"instruction",
"shuffling",
"the",
"parameters",
"on",
"the",
"assumption",
"that",
"the",
"last",
"2",
"can",
"be",
"swapped"
] | static void param_normalize_4_commutative(drcbe_state *drcbe, const drcuml_instruction *inst, drcuml_parameter *dest0, UINT32 allowed0, drcuml_parameter *dest1, UINT32 allowed1, drcuml_parameter *dest2, UINT32 allowed2, drcuml_parameter *dest3, UINT32 allowed3)
{
param_normalize_4(drcbe, inst, dest0, allowed0, dest1, allowed1, dest2, allowed2, dest3, allowed3);
if (dest2->type == DRCUML_PTYPE_MEMORY)
{
drcuml_parameter temp = *dest2;
*dest2 = *dest3;
*dest3 = temp;
}
if (dest2->type == DRCUML_PTYPE_IMMEDIATE)
{
drcuml_parameter temp = *dest2;
*dest2 = *dest3;
*dest3 = temp;
}
if (dest0->type == dest3->type && dest0->value == dest3->value && dest0->type != DRCUML_PTYPE_IMMEDIATE)
{
drcuml_parameter temp = *dest2;
*dest2 = *dest3;
*dest3 = temp;
}
} | [
"static",
"void",
"param_normalize_4_commutative",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"const",
"drcuml_instruction",
"*",
"inst",
",",
"drcuml_parameter",
"*",
"dest0",
",",
"UINT32",
"allowed0",
",",
"drcuml_parameter",
"*",
"dest1",
",",
"UINT32",
"allowed1",
",",
"drcuml_parameter",
"*",
"dest2",
",",
"UINT32",
"allowed2",
",",
"drcuml_parameter",
"*",
"dest3",
",",
"UINT32",
"allowed3",
")",
"{",
"param_normalize_4",
"(",
"drcbe",
",",
"inst",
",",
"dest0",
",",
"allowed0",
",",
"dest1",
",",
"allowed1",
",",
"dest2",
",",
"allowed2",
",",
"dest3",
",",
"allowed3",
")",
";",
"if",
"(",
"dest2",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"{",
"drcuml_parameter",
"temp",
"=",
"*",
"dest2",
";",
"*",
"dest2",
"=",
"*",
"dest3",
";",
"*",
"dest3",
"=",
"temp",
";",
"}",
"if",
"(",
"dest2",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"drcuml_parameter",
"temp",
"=",
"*",
"dest2",
";",
"*",
"dest2",
"=",
"*",
"dest3",
";",
"*",
"dest3",
"=",
"temp",
";",
"}",
"if",
"(",
"dest0",
"->",
"type",
"==",
"dest3",
"->",
"type",
"&&",
"dest0",
"->",
"value",
"==",
"dest3",
"->",
"value",
"&&",
"dest0",
"->",
"type",
"!=",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"drcuml_parameter",
"temp",
"=",
"*",
"dest2",
";",
"*",
"dest2",
"=",
"*",
"dest3",
";",
"*",
"dest3",
"=",
"temp",
";",
"}",
"}"
] | param_normalize_4_commutative - normalize a 4
parameter instruction, shuffling the
parameters on the assumption that the last
2 can be swapped | [
"param_normalize_4_commutative",
"-",
"normalize",
"a",
"4",
"parameter",
"instruction",
"shuffling",
"the",
"parameters",
"on",
"the",
"assumption",
"that",
"the",
"last",
"2",
"can",
"be",
"swapped"
] | [
"/* if the inner parameter is a memory operand, push it to the outer */",
"/* if the inner parameter is an immediate, push it to the outer */",
"/* if the destination and outer parameters are equal, move the outer to the inner */"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "inst",
"type": "drcuml_instruction"
},
{
"param": "dest0",
"type": "drcuml_parameter"
},
{
"param": "allowed0",
"type": "UINT32"
},
{
"param": "dest1",
"type": "drcuml_parameter"
},
{
"param": "allowed1",
"type": "UINT32"
},
{
"param": "dest2",
"type": "drcuml_parameter"
},
{
"param": "allowed2",
"type": "UINT32"
},
{
"param": "dest3",
"type": "drcuml_parameter"
},
{
"param": "allowed3",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest0",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "allowed0",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest1",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "allowed1",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest2",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "allowed2",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest3",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "allowed3",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_mov_r32_p32 | void | static void emit_mov_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (param->value == 0)
emit_xor_r32_r32(dst, reg, reg); // xor reg,reg
else
emit_mov_r32_imm(dst, reg, param->value); // mov reg,param
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_mov_r32_m32(dst, reg, MABS(drcbe, param->value)); // mov reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reg != param->value)
emit_mov_r32_r32(dst, reg, param->value); // mov reg,param
}
} | /*-------------------------------------------------
emit_mov_r32_p32 - move a 32-bit parameter
into a register
-------------------------------------------------*/ | move a 32-bit parameter
into a register | [
"move",
"a",
"32",
"-",
"bit",
"parameter",
"into",
"a",
"register"
] | static void emit_mov_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (param->value == 0)
emit_xor_r32_r32(dst, reg, reg);
else
emit_mov_r32_imm(dst, reg, param->value);
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_mov_r32_m32(dst, reg, MABS(drcbe, param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reg != param->value)
emit_mov_r32_r32(dst, reg, param->value);
}
} | [
"static",
"void",
"emit_mov_r32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"param",
"->",
"value",
"==",
"0",
")",
"emit_xor_r32_r32",
"(",
"dst",
",",
"reg",
",",
"reg",
")",
";",
"else",
"emit_mov_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_mov_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"drcbe",
",",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"if",
"(",
"reg",
"!=",
"param",
"->",
"value",
")",
"emit_mov_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}",
"}"
] | emit_mov_r32_p32 - move a 32-bit parameter
into a register | [
"emit_mov_r32_p32",
"-",
"move",
"a",
"32",
"-",
"bit",
"parameter",
"into",
"a",
"register"
] | [
"// xor reg,reg\r",
"// mov reg,param\r",
"// mov reg,[param]\r",
"// mov reg,param\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_movsx_r64_p32 | void | static void emit_movsx_r64_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (param->value == 0)
emit_xor_r32_r32(dst, reg, reg); // xor reg,reg
else if ((INT32)param->value >= 0)
emit_mov_r32_imm(dst, reg, param->value); // mov reg,param
else
emit_mov_r64_imm(dst, reg, (INT32)param->value); // mov reg,param
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_movsxd_r64_m32(dst, reg, MABS(drcbe, param->value)); // movsxd reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_movsxd_r64_r32(dst, reg, param->value); // movsdx reg,param
} | /*-------------------------------------------------
emit_movsx_r64_p32 - move a 32-bit parameter
sign-extended into a register
-------------------------------------------------*/ | move a 32-bit parameter
sign-extended into a register | [
"move",
"a",
"32",
"-",
"bit",
"parameter",
"sign",
"-",
"extended",
"into",
"a",
"register"
] | static void emit_movsx_r64_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (param->value == 0)
emit_xor_r32_r32(dst, reg, reg);
else if ((INT32)param->value >= 0)
emit_mov_r32_imm(dst, reg, param->value);
else
emit_mov_r64_imm(dst, reg, (INT32)param->value);
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_movsxd_r64_m32(dst, reg, MABS(drcbe, param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_movsxd_r64_r32(dst, reg, param->value);
} | [
"static",
"void",
"emit_movsx_r64_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"param",
"->",
"value",
"==",
"0",
")",
"emit_xor_r32_r32",
"(",
"dst",
",",
"reg",
",",
"reg",
")",
";",
"else",
"if",
"(",
"(",
"INT32",
")",
"param",
"->",
"value",
">=",
"0",
")",
"emit_mov_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"else",
"emit_mov_r64_imm",
"(",
"dst",
",",
"reg",
",",
"(",
"INT32",
")",
"param",
"->",
"value",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_movsxd_r64_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"drcbe",
",",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_movsxd_r64_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_movsx_r64_p32 - move a 32-bit parameter
sign-extended into a register | [
"emit_movsx_r64_p32",
"-",
"move",
"a",
"32",
"-",
"bit",
"parameter",
"sign",
"-",
"extended",
"into",
"a",
"register"
] | [
"// xor reg,reg\r",
"// mov reg,param\r",
"// mov reg,param\r",
"// movsxd reg,[param]\r",
"// movsdx reg,param\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_mov_r32_p32_keepflags | void | static void emit_mov_r32_p32_keepflags(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_mov_r32_imm(dst, reg, param->value); // mov reg,param
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_mov_r32_m32(dst, reg, MABS(drcbe, param->value)); // mov reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reg != param->value)
emit_mov_r32_r32(dst, reg, param->value); // mov reg,param
}
} | /*-------------------------------------------------
emit_mov_r32_p32_keepflags - move a 32-bit
parameter into a register without affecting
any flags
-------------------------------------------------*/ | move a 32-bit
parameter into a register without affecting
any flags | [
"move",
"a",
"32",
"-",
"bit",
"parameter",
"into",
"a",
"register",
"without",
"affecting",
"any",
"flags"
] | static void emit_mov_r32_p32_keepflags(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_mov_r32_imm(dst, reg, param->value);
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_mov_r32_m32(dst, reg, MABS(drcbe, param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reg != param->value)
emit_mov_r32_r32(dst, reg, param->value);
}
} | [
"static",
"void",
"emit_mov_r32_p32_keepflags",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"emit_mov_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_mov_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"drcbe",
",",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"if",
"(",
"reg",
"!=",
"param",
"->",
"value",
")",
"emit_mov_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}",
"}"
] | emit_mov_r32_p32_keepflags - move a 32-bit
parameter into a register without affecting
any flags | [
"emit_mov_r32_p32_keepflags",
"-",
"move",
"a",
"32",
"-",
"bit",
"parameter",
"into",
"a",
"register",
"without",
"affecting",
"any",
"flags"
] | [
"// mov reg,param\r",
"// mov reg,[param]\r",
"// mov reg,param\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_mov_m32_p32 | void | static void emit_mov_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_mov_m32_imm(dst, MEMPARAMS, param->value); // mov [mem],param
else if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_mov_r32_m32(dst, REG_EAX, MABS(drcbe, param->value)); // mov eax,[param]
emit_mov_m32_r32(dst, MEMPARAMS, REG_EAX); // mov [mem],eax
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_mov_m32_r32(dst, MEMPARAMS, param->value); // mov [mem],param
} | /*-------------------------------------------------
emit_mov_m32_p32 - move a 32-bit parameter
into a memory location
-------------------------------------------------*/ | move a 32-bit parameter
into a memory location | [
"move",
"a",
"32",
"-",
"bit",
"parameter",
"into",
"a",
"memory",
"location"
] | static void emit_mov_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_mov_m32_imm(dst, MEMPARAMS, param->value);
else if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_mov_r32_m32(dst, REG_EAX, MABS(drcbe, param->value));
emit_mov_m32_r32(dst, MEMPARAMS, REG_EAX);
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_mov_m32_r32(dst, MEMPARAMS, param->value);
} | [
"static",
"void",
"emit_mov_m32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"DECLARE_MEMPARAMS",
",",
"const",
"drcuml_parameter",
"*",
"param",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"emit_mov_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"{",
"emit_mov_r32_m32",
"(",
"dst",
",",
"REG_EAX",
",",
"MABS",
"(",
"drcbe",
",",
"param",
"->",
"value",
")",
")",
";",
"emit_mov_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"REG_EAX",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_mov_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_mov_m32_p32 - move a 32-bit parameter
into a memory location | [
"emit_mov_m32_p32",
"-",
"move",
"a",
"32",
"-",
"bit",
"parameter",
"into",
"a",
"memory",
"location"
] | [
"// mov [mem],param\r",
"// mov eax,[param]\r",
"// mov [mem],eax\r",
"// mov [mem],param\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_mov_p32_r32 | void | static void emit_mov_p32_r32(drcbe_state *drcbe, x86code **dst, const drcuml_parameter *param, UINT8 reg)
{
assert(param->type != DRCUML_PTYPE_IMMEDIATE);
if (param->type == DRCUML_PTYPE_MEMORY)
emit_mov_m32_r32(dst, MABS(drcbe, param->value), reg); // mov [param],reg
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reg != param->value)
emit_mov_r32_r32(dst, param->value, reg); // mov param,reg
}
} | /*-------------------------------------------------
emit_mov_p32_r32 - move a register into a
32-bit parameter
-------------------------------------------------*/ | move a register into a
32-bit parameter | [
"move",
"a",
"register",
"into",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_mov_p32_r32(drcbe_state *drcbe, x86code **dst, const drcuml_parameter *param, UINT8 reg)
{
assert(param->type != DRCUML_PTYPE_IMMEDIATE);
if (param->type == DRCUML_PTYPE_MEMORY)
emit_mov_m32_r32(dst, MABS(drcbe, param->value), reg);
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reg != param->value)
emit_mov_r32_r32(dst, param->value, reg);
}
} | [
"static",
"void",
"emit_mov_p32_r32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"UINT8",
"reg",
")",
"{",
"assert",
"(",
"param",
"->",
"type",
"!=",
"DRCUML_PTYPE_IMMEDIATE",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_mov_m32_r32",
"(",
"dst",
",",
"MABS",
"(",
"drcbe",
",",
"param",
"->",
"value",
")",
",",
"reg",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"if",
"(",
"reg",
"!=",
"param",
"->",
"value",
")",
"emit_mov_r32_r32",
"(",
"dst",
",",
"param",
"->",
"value",
",",
"reg",
")",
";",
"}",
"}"
] | emit_mov_p32_r32 - move a register into a
32-bit parameter | [
"emit_mov_p32_r32",
"-",
"move",
"a",
"register",
"into",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"// mov [param],reg\r",
"// mov param,reg\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "reg",
"type": "UINT8"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_add_r32_p32 | void | static void emit_add_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags != 0 || param->value != 0)
emit_add_r32_imm(dst, reg, param->value); // add reg,param
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_add_r32_m32(dst, reg, MABS(drcbe, param->value)); // add reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_add_r32_r32(dst, reg, param->value); // add reg,param
} | /*-------------------------------------------------
emit_add_r32_p32 - add operation to a 32-bit
register from a 32-bit parameter
-------------------------------------------------*/ | add operation to a 32-bit
register from a 32-bit parameter | [
"add",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_add_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags != 0 || param->value != 0)
emit_add_r32_imm(dst, reg, param->value);
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_add_r32_m32(dst, reg, MABS(drcbe, param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_add_r32_r32(dst, reg, param->value);
} | [
"static",
"void",
"emit_add_r32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
"||",
"param",
"->",
"value",
"!=",
"0",
")",
"emit_add_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_add_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"drcbe",
",",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_add_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_add_r32_p32 - add operation to a 32-bit
register from a 32-bit parameter | [
"emit_add_r32_p32",
"-",
"add",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"// add reg,param\r",
"// add reg,[param]\r",
"// add reg,param\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_add_m32_p32 | void | static void emit_add_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags != 0 || param->value != 0)
emit_add_m32_imm(dst, MEMPARAMS, param->value); // add [dest],param
}
else
{
int reg = param_select_register(REG_EAX, param, NULL);
emit_mov_r32_p32(drcbe, dst, reg, param); // mov reg,param
emit_add_m32_r32(dst, MEMPARAMS, reg); // add [dest],reg
}
} | /*-------------------------------------------------
emit_add_m32_p32 - add operation to a 32-bit
memory location from a 32-bit parameter
-------------------------------------------------*/ | add operation to a 32-bit
memory location from a 32-bit parameter | [
"add",
"operation",
"to",
"a",
"32",
"-",
"bit",
"memory",
"location",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_add_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags != 0 || param->value != 0)
emit_add_m32_imm(dst, MEMPARAMS, param->value);
}
else
{
int reg = param_select_register(REG_EAX, param, NULL);
emit_mov_r32_p32(drcbe, dst, reg, param);
emit_add_m32_r32(dst, MEMPARAMS, reg);
}
} | [
"static",
"void",
"emit_add_m32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"DECLARE_MEMPARAMS",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
"||",
"param",
"->",
"value",
"!=",
"0",
")",
"emit_add_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"}",
"else",
"{",
"int",
"reg",
"=",
"param_select_register",
"(",
"REG_EAX",
",",
"param",
",",
"NULL",
")",
";",
"emit_mov_r32_p32",
"(",
"drcbe",
",",
"dst",
",",
"reg",
",",
"param",
")",
";",
"emit_add_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"reg",
")",
";",
"}",
"}"
] | emit_add_m32_p32 - add operation to a 32-bit
memory location from a 32-bit parameter | [
"emit_add_m32_p32",
"-",
"add",
"operation",
"to",
"a",
"32",
"-",
"bit",
"memory",
"location",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"// add [dest],param\r",
"// mov reg,param\r",
"// add [dest],reg\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_adc_r32_p32 | void | static void emit_adc_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_adc_r32_imm(dst, reg, param->value); // adc reg,param
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_adc_r32_m32(dst, reg, MABS(drcbe, param->value)); // adc reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_adc_r32_r32(dst, reg, param->value); // adc reg,param
} | /*-------------------------------------------------
emit_adc_r32_p32 - adc operation to a 32-bit
register from a 32-bit parameter
-------------------------------------------------*/ | adc operation to a 32-bit
register from a 32-bit parameter | [
"adc",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_adc_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_adc_r32_imm(dst, reg, param->value);
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_adc_r32_m32(dst, reg, MABS(drcbe, param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_adc_r32_r32(dst, reg, param->value);
} | [
"static",
"void",
"emit_adc_r32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"emit_adc_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_adc_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"drcbe",
",",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_adc_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_adc_r32_p32 - adc operation to a 32-bit
register from a 32-bit parameter | [
"emit_adc_r32_p32",
"-",
"adc",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"// adc reg,param\r",
"// adc reg,[param]\r",
"// adc reg,param\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_adc_m32_p32 | void | static void emit_adc_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_adc_m32_imm(dst, MEMPARAMS, param->value); // adc [dest],param
else
{
int reg = param_select_register(REG_EAX, param, NULL);
emit_mov_r32_p32_keepflags(drcbe, dst, reg, param); // mov reg,param
emit_adc_m32_r32(dst, MEMPARAMS, reg); // adc [dest],reg
}
} | /*-------------------------------------------------
emit_adc_m32_p32 - adc operation to a 32-bit
memory location from a 32-bit parameter
-------------------------------------------------*/ | adc operation to a 32-bit
memory location from a 32-bit parameter | [
"adc",
"operation",
"to",
"a",
"32",
"-",
"bit",
"memory",
"location",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_adc_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_adc_m32_imm(dst, MEMPARAMS, param->value);
else
{
int reg = param_select_register(REG_EAX, param, NULL);
emit_mov_r32_p32_keepflags(drcbe, dst, reg, param);
emit_adc_m32_r32(dst, MEMPARAMS, reg);
}
} | [
"static",
"void",
"emit_adc_m32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"DECLARE_MEMPARAMS",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"emit_adc_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"else",
"{",
"int",
"reg",
"=",
"param_select_register",
"(",
"REG_EAX",
",",
"param",
",",
"NULL",
")",
";",
"emit_mov_r32_p32_keepflags",
"(",
"drcbe",
",",
"dst",
",",
"reg",
",",
"param",
")",
";",
"emit_adc_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"reg",
")",
";",
"}",
"}"
] | emit_adc_m32_p32 - adc operation to a 32-bit
memory location from a 32-bit parameter | [
"emit_adc_m32_p32",
"-",
"adc",
"operation",
"to",
"a",
"32",
"-",
"bit",
"memory",
"location",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"// adc [dest],param\r",
"// mov reg,param\r",
"// adc [dest],reg\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_sub_r32_p32 | void | static void emit_sub_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags != 0 || param->value != 0)
emit_sub_r32_imm(dst, reg, param->value); // sub reg,param
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_sub_r32_m32(dst, reg, MABS(drcbe, param->value)); // sub reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_sub_r32_r32(dst, reg, param->value); // sub reg,param
} | /*-------------------------------------------------
emit_sub_r32_p32 - sub operation to a 32-bit
register from a 32-bit parameter
-------------------------------------------------*/ | sub operation to a 32-bit
register from a 32-bit parameter | [
"sub",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_sub_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags != 0 || param->value != 0)
emit_sub_r32_imm(dst, reg, param->value);
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_sub_r32_m32(dst, reg, MABS(drcbe, param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_sub_r32_r32(dst, reg, param->value);
} | [
"static",
"void",
"emit_sub_r32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
"||",
"param",
"->",
"value",
"!=",
"0",
")",
"emit_sub_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_sub_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"drcbe",
",",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_sub_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_sub_r32_p32 - sub operation to a 32-bit
register from a 32-bit parameter | [
"emit_sub_r32_p32",
"-",
"sub",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"// sub reg,param\r",
"// sub reg,[param]\r",
"// sub reg,param\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_sub_m32_p32 | void | static void emit_sub_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags != 0 || param->value != 0)
emit_sub_m32_imm(dst, MEMPARAMS, param->value); // sub [dest],param
}
else
{
int reg = param_select_register(REG_EAX, param, NULL);
emit_mov_r32_p32(drcbe, dst, reg, param); // mov reg,param
emit_sub_m32_r32(dst, MEMPARAMS, reg); // sub [dest],reg
}
} | /*-------------------------------------------------
emit_sub_m32_p32 - sub operation to a 32-bit
memory location from a 32-bit parameter
-------------------------------------------------*/ | sub operation to a 32-bit
memory location from a 32-bit parameter | [
"sub",
"operation",
"to",
"a",
"32",
"-",
"bit",
"memory",
"location",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_sub_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags != 0 || param->value != 0)
emit_sub_m32_imm(dst, MEMPARAMS, param->value);
}
else
{
int reg = param_select_register(REG_EAX, param, NULL);
emit_mov_r32_p32(drcbe, dst, reg, param);
emit_sub_m32_r32(dst, MEMPARAMS, reg);
}
} | [
"static",
"void",
"emit_sub_m32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"DECLARE_MEMPARAMS",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
"||",
"param",
"->",
"value",
"!=",
"0",
")",
"emit_sub_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"}",
"else",
"{",
"int",
"reg",
"=",
"param_select_register",
"(",
"REG_EAX",
",",
"param",
",",
"NULL",
")",
";",
"emit_mov_r32_p32",
"(",
"drcbe",
",",
"dst",
",",
"reg",
",",
"param",
")",
";",
"emit_sub_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"reg",
")",
";",
"}",
"}"
] | emit_sub_m32_p32 - sub operation to a 32-bit
memory location from a 32-bit parameter | [
"emit_sub_m32_p32",
"-",
"sub",
"operation",
"to",
"a",
"32",
"-",
"bit",
"memory",
"location",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"// sub [dest],param\r",
"// mov reg,param\r",
"// sub [dest],reg\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_sbb_r32_p32 | void | static void emit_sbb_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_sbb_r32_imm(dst, reg, param->value); // sbb reg,param
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_sbb_r32_m32(dst, reg, MABS(drcbe, param->value)); // sbb reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_sbb_r32_r32(dst, reg, param->value); // sbb reg,param
} | /*-------------------------------------------------
emit_sbb_r32_p32 - sbb operation to a 32-bit
register from a 32-bit parameter
-------------------------------------------------*/ | sbb operation to a 32-bit
register from a 32-bit parameter | [
"sbb",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_sbb_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_sbb_r32_imm(dst, reg, param->value);
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_sbb_r32_m32(dst, reg, MABS(drcbe, param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_sbb_r32_r32(dst, reg, param->value);
} | [
"static",
"void",
"emit_sbb_r32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"emit_sbb_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_sbb_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"drcbe",
",",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_sbb_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_sbb_r32_p32 - sbb operation to a 32-bit
register from a 32-bit parameter | [
"emit_sbb_r32_p32",
"-",
"sbb",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"// sbb reg,param\r",
"// sbb reg,[param]\r",
"// sbb reg,param\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_sbb_m32_p32 | void | static void emit_sbb_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_sbb_m32_imm(dst, MEMPARAMS, param->value); // sbb [dest],param
else
{
int reg = param_select_register(REG_EAX, param, NULL);
emit_mov_r32_p32_keepflags(drcbe, dst, reg, param); // mov reg,param
emit_sbb_m32_r32(dst, MEMPARAMS, reg); // sbb [dest],reg
}
} | /*-------------------------------------------------
emit_sbb_m32_p32 - sbb operation to a 32-bit
memory location from a 32-bit parameter
-------------------------------------------------*/ | sbb operation to a 32-bit
memory location from a 32-bit parameter | [
"sbb",
"operation",
"to",
"a",
"32",
"-",
"bit",
"memory",
"location",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_sbb_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_sbb_m32_imm(dst, MEMPARAMS, param->value);
else
{
int reg = param_select_register(REG_EAX, param, NULL);
emit_mov_r32_p32_keepflags(drcbe, dst, reg, param);
emit_sbb_m32_r32(dst, MEMPARAMS, reg);
}
} | [
"static",
"void",
"emit_sbb_m32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"DECLARE_MEMPARAMS",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"emit_sbb_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"else",
"{",
"int",
"reg",
"=",
"param_select_register",
"(",
"REG_EAX",
",",
"param",
",",
"NULL",
")",
";",
"emit_mov_r32_p32_keepflags",
"(",
"drcbe",
",",
"dst",
",",
"reg",
",",
"param",
")",
";",
"emit_sbb_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"reg",
")",
";",
"}",
"}"
] | emit_sbb_m32_p32 - sbb operation to a 32-bit
memory location from a 32-bit parameter | [
"emit_sbb_m32_p32",
"-",
"sbb",
"operation",
"to",
"a",
"32",
"-",
"bit",
"memory",
"location",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"// sbb [dest],param\r",
"// mov reg,param\r",
"// sbb [dest],reg\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_cmp_r32_p32 | void | static void emit_cmp_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_cmp_r32_imm(dst, reg, param->value); // cmp reg,param
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_cmp_r32_m32(dst, reg, MABS(drcbe, param->value)); // cmp reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_cmp_r32_r32(dst, reg, param->value); // cmp reg,param
} | /*-------------------------------------------------
emit_cmp_r32_p32 - cmp operation to a 32-bit
register from a 32-bit parameter
-------------------------------------------------*/ | cmp operation to a 32-bit
register from a 32-bit parameter | [
"cmp",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_cmp_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_cmp_r32_imm(dst, reg, param->value);
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_cmp_r32_m32(dst, reg, MABS(drcbe, param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_cmp_r32_r32(dst, reg, param->value);
} | [
"static",
"void",
"emit_cmp_r32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"emit_cmp_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_cmp_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"drcbe",
",",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_cmp_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_cmp_r32_p32 - cmp operation to a 32-bit
register from a 32-bit parameter | [
"emit_cmp_r32_p32",
"-",
"cmp",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"// cmp reg,param\r",
"// cmp reg,[param]\r",
"// cmp reg,param\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_cmp_m32_p32 | void | static void emit_cmp_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_cmp_m32_imm(dst, MEMPARAMS, param->value); // cmp [dest],param
else
{
int reg = param_select_register(REG_EAX, param, NULL);
emit_mov_r32_p32(drcbe, dst, reg, param); // mov reg,param
emit_cmp_m32_r32(dst, MEMPARAMS, reg); // cmp [dest],reg
}
} | /*-------------------------------------------------
emit_cmp_m32_p32 - cmp operation to a 32-bit
memory location from a 32-bit parameter
-------------------------------------------------*/ | cmp operation to a 32-bit
memory location from a 32-bit parameter | [
"cmp",
"operation",
"to",
"a",
"32",
"-",
"bit",
"memory",
"location",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_cmp_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_cmp_m32_imm(dst, MEMPARAMS, param->value);
else
{
int reg = param_select_register(REG_EAX, param, NULL);
emit_mov_r32_p32(drcbe, dst, reg, param);
emit_cmp_m32_r32(dst, MEMPARAMS, reg);
}
} | [
"static",
"void",
"emit_cmp_m32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"DECLARE_MEMPARAMS",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"emit_cmp_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"else",
"{",
"int",
"reg",
"=",
"param_select_register",
"(",
"REG_EAX",
",",
"param",
",",
"NULL",
")",
";",
"emit_mov_r32_p32",
"(",
"drcbe",
",",
"dst",
",",
"reg",
",",
"param",
")",
";",
"emit_cmp_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"reg",
")",
";",
"}",
"}"
] | emit_cmp_m32_p32 - cmp operation to a 32-bit
memory location from a 32-bit parameter | [
"emit_cmp_m32_p32",
"-",
"cmp",
"operation",
"to",
"a",
"32",
"-",
"bit",
"memory",
"location",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"// cmp [dest],param\r",
"// mov reg,param\r",
"// cmp [dest],reg\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_and_r32_p32 | void | static void emit_and_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
/* skip */;
else if (inst->flags == 0 && (UINT32)param->value == 0)
emit_xor_r32_r32(dst, reg, reg); // xor reg,reg
else
emit_and_r32_imm(dst, reg, param->value); // and reg,param
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_and_r32_m32(dst, reg, MABS(drcbe, param->value)); // and reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_and_r32_r32(dst, reg, param->value); // and reg,param
} | /*-------------------------------------------------
emit_and_r32_p32 - and operation to a 32-bit
register from a 32-bit parameter
-------------------------------------------------*/ | and operation to a 32-bit
register from a 32-bit parameter | [
"and",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_and_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
;
else if (inst->flags == 0 && (UINT32)param->value == 0)
emit_xor_r32_r32(dst, reg, reg);
else
emit_and_r32_imm(dst, reg, param->value);
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_and_r32_m32(dst, reg, MABS(drcbe, param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_and_r32_r32(dst, reg, param->value);
} | [
"static",
"void",
"emit_and_r32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0xffffffff",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0",
")",
"emit_xor_r32_r32",
"(",
"dst",
",",
"reg",
",",
"reg",
")",
";",
"else",
"emit_and_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_and_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"drcbe",
",",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_and_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_and_r32_p32 - and operation to a 32-bit
register from a 32-bit parameter | [
"emit_and_r32_p32",
"-",
"and",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"/* skip */",
"// xor reg,reg\r",
"// and reg,param\r",
"// and reg,[param]\r",
"// and reg,param\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_and_m32_p32 | void | static void emit_and_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
/* skip */;
else if (inst->flags == 0 && (UINT32)param->value == 0)
emit_mov_m32_imm(dst, MEMPARAMS, 0); // mov [dest],0
else
emit_and_m32_imm(dst, MEMPARAMS, param->value); // and [dest],param
}
else
{
int reg = param_select_register(REG_EAX, param, NULL);
emit_mov_r32_p32(drcbe, dst, reg, param); // mov reg,param
emit_and_m32_r32(dst, MEMPARAMS, reg); // and [dest],reg
}
} | /*-------------------------------------------------
emit_and_m32_p32 - and operation to a 32-bit
memory location from a 32-bit parameter
-------------------------------------------------*/ | and operation to a 32-bit
memory location from a 32-bit parameter | [
"and",
"operation",
"to",
"a",
"32",
"-",
"bit",
"memory",
"location",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_and_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
;
else if (inst->flags == 0 && (UINT32)param->value == 0)
emit_mov_m32_imm(dst, MEMPARAMS, 0);
else
emit_and_m32_imm(dst, MEMPARAMS, param->value);
}
else
{
int reg = param_select_register(REG_EAX, param, NULL);
emit_mov_r32_p32(drcbe, dst, reg, param);
emit_and_m32_r32(dst, MEMPARAMS, reg);
}
} | [
"static",
"void",
"emit_and_m32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"DECLARE_MEMPARAMS",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0xffffffff",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0",
")",
"emit_mov_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"0",
")",
";",
"else",
"emit_and_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"}",
"else",
"{",
"int",
"reg",
"=",
"param_select_register",
"(",
"REG_EAX",
",",
"param",
",",
"NULL",
")",
";",
"emit_mov_r32_p32",
"(",
"drcbe",
",",
"dst",
",",
"reg",
",",
"param",
")",
";",
"emit_and_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"reg",
")",
";",
"}",
"}"
] | emit_and_m32_p32 - and operation to a 32-bit
memory location from a 32-bit parameter | [
"emit_and_m32_p32",
"-",
"and",
"operation",
"to",
"a",
"32",
"-",
"bit",
"memory",
"location",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"/* skip */",
"// mov [dest],0\r",
"// and [dest],param\r",
"// mov reg,param\r",
"// and [dest],reg\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_or_r32_p32 | void | static void emit_or_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0)
/* skip */;
else if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
emit_mov_r32_imm(dst, reg, -1); // mov reg,-1
else
emit_or_r32_imm(dst, reg, param->value); // or reg,param
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_or_r32_m32(dst, reg, MABS(drcbe, param->value)); // or reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_or_r32_r32(dst, reg, param->value); // or reg,param
} | /*-------------------------------------------------
emit_or_r32_p32 - or operation to a 32-bit
register from a 32-bit parameter
-------------------------------------------------*/ | or operation to a 32-bit
register from a 32-bit parameter | [
"or",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_or_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0)
;
else if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
emit_mov_r32_imm(dst, reg, -1);
else
emit_or_r32_imm(dst, reg, param->value);
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_or_r32_m32(dst, reg, MABS(drcbe, param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_or_r32_r32(dst, reg, param->value);
} | [
"static",
"void",
"emit_or_r32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0xffffffff",
")",
"emit_mov_r32_imm",
"(",
"dst",
",",
"reg",
",",
"-1",
")",
";",
"else",
"emit_or_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_or_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"drcbe",
",",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_or_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_or_r32_p32 - or operation to a 32-bit
register from a 32-bit parameter | [
"emit_or_r32_p32",
"-",
"or",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"/* skip */",
"// mov reg,-1\r",
"// or reg,param\r",
"// or reg,[param]\r",
"// or reg,param\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83e07bf5e7c896f6d63e6b87d110edf2c88d8f12 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbex64.c | [
"Unlicense"
] | C | emit_or_m32_p32 | void | static void emit_or_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0)
/* skip */;
else if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
emit_mov_m32_imm(dst, MEMPARAMS, -1); // mov [dest],-1
else
emit_or_m32_imm(dst, MEMPARAMS, param->value); // or [dest],param
}
else
{
int reg = param_select_register(REG_EAX, param, NULL);
emit_mov_r32_p32(drcbe, dst, reg, param); // mov reg,param
emit_or_m32_r32(dst, MEMPARAMS, reg); // or [dest],reg
}
} | /*-------------------------------------------------
emit_or_m32_p32 - or operation to a 32-bit
memory location from a 32-bit parameter
-------------------------------------------------*/ | or operation to a 32-bit
memory location from a 32-bit parameter | [
"or",
"operation",
"to",
"a",
"32",
"-",
"bit",
"memory",
"location",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_or_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0)
;
else if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
emit_mov_m32_imm(dst, MEMPARAMS, -1);
else
emit_or_m32_imm(dst, MEMPARAMS, param->value);
}
else
{
int reg = param_select_register(REG_EAX, param, NULL);
emit_mov_r32_p32(drcbe, dst, reg, param);
emit_or_m32_r32(dst, MEMPARAMS, reg);
}
} | [
"static",
"void",
"emit_or_m32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"DECLARE_MEMPARAMS",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0xffffffff",
")",
"emit_mov_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"-1",
")",
";",
"else",
"emit_or_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"}",
"else",
"{",
"int",
"reg",
"=",
"param_select_register",
"(",
"REG_EAX",
",",
"param",
",",
"NULL",
")",
";",
"emit_mov_r32_p32",
"(",
"drcbe",
",",
"dst",
",",
"reg",
",",
"param",
")",
";",
"emit_or_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"reg",
")",
";",
"}",
"}"
] | emit_or_m32_p32 - or operation to a 32-bit
memory location from a 32-bit parameter | [
"emit_or_m32_p32",
"-",
"or",
"operation",
"to",
"a",
"32",
"-",
"bit",
"memory",
"location",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"/* skip */",
"// mov [dest],-1\r",
"// or [dest],param\r",
"// mov reg,param\r",
"// or [dest],reg\r"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.