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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5b19fb28cdf26eb2dd3f74efb426a77ebf47b9fb | lofunz/mieme | Reloaded/trunk/src/emu/machine/generic.c | [
"Unlicense"
] | C | nvram_save | void | void nvram_save(running_machine *machine)
{
// only need to do something if we have an NVRAM device or an nvram_handler
device_nvram_interface *nvram = NULL;
if (!machine->m_devicelist.first(nvram) && machine->config->m_nvram_handler == NULL)
return;
// open the file; if it exists, call everyone to read from it
mame_file *nvram_file = nvram_fopen(machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
if (nvram_file != NULL)
{
// write data via general NVRAM handler first
if (machine->config->m_nvram_handler != NULL)
(*machine->config->m_nvram_handler)(machine, nvram_file, TRUE);
// find all devices with NVRAM handlers, and tell them to write next
for (bool gotone = (nvram != NULL); gotone; gotone = nvram->next(nvram))
nvram->nvram_save(*nvram_file);
// close the file
mame_fclose(nvram_file);
}
} | /*-------------------------------------------------
nvram_save - save a system's NVRAM
-------------------------------------------------*/ | save a system's NVRAM | [
"save",
"a",
"system",
"'",
"s",
"NVRAM"
] | void nvram_save(running_machine *machine)
{
device_nvram_interface *nvram = NULL;
if (!machine->m_devicelist.first(nvram) && machine->config->m_nvram_handler == NULL)
return;
mame_file *nvram_file = nvram_fopen(machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
if (nvram_file != NULL)
{
if (machine->config->m_nvram_handler != NULL)
(*machine->config->m_nvram_handler)(machine, nvram_file, TRUE);
for (bool gotone = (nvram != NULL); gotone; gotone = nvram->next(nvram))
nvram->nvram_save(*nvram_file);
mame_fclose(nvram_file);
}
} | [
"void",
"nvram_save",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"device_nvram_interface",
"*",
"nvram",
"=",
"NULL",
";",
"if",
"(",
"!",
"machine",
"->",
"m_devicelist",
".",
"first",
"(",
"nvram",
")",
"&&",
"machine",
"->",
"config",
"->",
"m_nvram_handler",
"==",
"NULL",
")",
"return",
";",
"mame_file",
"*",
"nvram_file",
"=",
"nvram_fopen",
"(",
"machine",
",",
"OPEN_FLAG_WRITE",
"|",
"OPEN_FLAG_CREATE",
"|",
"OPEN_FLAG_CREATE_PATHS",
")",
";",
"if",
"(",
"nvram_file",
"!=",
"NULL",
")",
"{",
"if",
"(",
"machine",
"->",
"config",
"->",
"m_nvram_handler",
"!=",
"NULL",
")",
"(",
"*",
"machine",
"->",
"config",
"->",
"m_nvram_handler",
")",
"(",
"machine",
",",
"nvram_file",
",",
"TRUE",
")",
";",
"for",
"(",
"bool",
"gotone",
"=",
"(",
"nvram",
"!=",
"NULL",
")",
";",
"gotone",
";",
"gotone",
"=",
"nvram",
"->",
"next",
"(",
"nvram",
")",
")",
"nvram",
"->",
"nvram_save",
"(",
"*",
"nvram_file",
")",
";",
"mame_fclose",
"(",
"nvram_file",
")",
";",
"}",
"}"
] | nvram_save - save a system's NVRAM | [
"nvram_save",
"-",
"save",
"a",
"system",
"'",
"s",
"NVRAM"
] | [
"// only need to do something if we have an NVRAM device or an nvram_handler\r",
"// open the file; if it exists, call everyone to read from it\r",
"// write data via general NVRAM handler first\r",
"// find all devices with NVRAM handlers, and tell them to write next\r",
"// close the file\r"
] | [
{
"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": []
} |
5b19fb28cdf26eb2dd3f74efb426a77ebf47b9fb | lofunz/mieme | Reloaded/trunk/src/emu/machine/generic.c | [
"Unlicense"
] | C | memcard_present | int | int memcard_present(running_machine *machine)
{
generic_machine_private *state = machine->generic_machine_data;
return state->memcard_inserted;
} | /*-------------------------------------------------
memcard_present - return the currently loaded
card index, or -1 if none
-------------------------------------------------*/ | return the currently loaded
card index, or -1 if none | [
"return",
"the",
"currently",
"loaded",
"card",
"index",
"or",
"-",
"1",
"if",
"none"
] | int memcard_present(running_machine *machine)
{
generic_machine_private *state = machine->generic_machine_data;
return state->memcard_inserted;
} | [
"int",
"memcard_present",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"generic_machine_private",
"*",
"state",
"=",
"machine",
"->",
"generic_machine_data",
";",
"return",
"state",
"->",
"memcard_inserted",
";",
"}"
] | memcard_present - return the currently loaded
card index, or -1 if none | [
"memcard_present",
"-",
"return",
"the",
"currently",
"loaded",
"card",
"index",
"or",
"-",
"1",
"if",
"none"
] | [] | [
{
"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": []
} |
5b08e86ddac91aaea5da64ff6efd228f0f732ab2 | lofunz/mieme | Reloaded/trunk/src/tools/regrep.c | [
"Unlicense"
] | C | read_summary_log | int | static int read_summary_log(const char *filename, int index)
{
summary_file *curfile = NULL;
char linebuffer[1024];
char *linestart;
int drivers = 0;
FILE *file;
/* open the logfile */
file = fopen(filename, "r");
if (file == NULL)
{
fprintf(stderr, "Error: file '%s' not found\n", filename);
return 1;
}
/* parse it */
while (fgets(linebuffer, sizeof(linebuffer), file) != NULL)
{
/* trim the leading/trailing spaces */
linestart = trim_string(linebuffer);
/* is this one of our specials? */
if (strncmp(linestart, "@@@@@", 5) == 0)
{
/* advance past the signature */
linestart += 5;
/* look for the driver= tag */
if (strncmp(linestart, "driver=", 7) == 0)
{
curfile = parse_driver_tag(linestart + 7, index);
if (curfile == NULL)
goto error;
drivers++;
}
/* look for the source= tag */
else if (strncmp(linestart, "source=", 7) == 0)
{
/* error if no driver yet */
if (curfile == NULL)
{
fprintf(stderr, "Unexpected @@@@@source= tag\n");
goto error;
}
/* copy the string */
strcpy(curfile->source, trim_string(linestart + 7));
}
/* look for the dir= tag */
else if (strncmp(linestart, "dir=", 4) == 0)
{
char *dirname = trim_string(linestart + 4);
/* allocate a copy of the string */
lists[index].dir = (char *)malloc(strlen(dirname) + 1);
if (lists[index].dir == NULL)
goto error;
strcpy(lists[index].dir, dirname);
fprintf(stderr, "Directory %s\n", lists[index].dir);
}
}
/* if not, consider other options */
else if (curfile != NULL)
{
int foundchars = 0;
char *curptr;
/* look for the pngcrc= tag */
if (strncmp(linestart, "pngcrc: ", 7) == 0)
{
}
/* otherwise, accumulate the text */
else
{
/* find the end of the line and normalize it with a CR */
for (curptr = linestart; *curptr != 0 && *curptr != '\n' && *curptr != '\r'; curptr++)
if (!isspace((UINT8)*curptr))
foundchars = 1;
*curptr++ = '\n';
*curptr = 0;
/* ignore blank lines */
if (!foundchars)
continue;
/* see if we have enough room */
if (curfile->textsize[index] + (curptr - linestart) + 1 >= curfile->textalloc[index])
{
curfile->textalloc[index] = curfile->textsize[index] + (curptr - linestart) + 256;
curfile->text[index] = (char *)realloc(curfile->text[index], curfile->textalloc[index]);
if (curfile->text[index] == NULL)
{
fprintf(stderr, "Unable to allocate memory for text\n");
goto error;
}
}
/* append our text */
strcpy(curfile->text[index] + curfile->textsize[index], linestart);
curfile->textsize[index] += curptr - linestart;
}
}
/* look for the M.A.M.E. header */
else if (strncmp(linestart, "M.A.M.E. v", 10) == 0)
{
char *start = linestart + 10;
char *end;
/* find the end */
for (end = start; !isspace((UINT8)*end); end++) ;
*end = 0;
strcpy(lists[index].version, start);
fprintf(stderr, "Parsing results from version %s\n", lists[index].version);
}
}
fclose(file);
fprintf(stderr, "Parsed %d drivers\n", drivers);
return 0;
error:
fclose(file);
return 1;
} | /*-------------------------------------------------
read_summary_log - read a summary.log file
and build entries for its data
-------------------------------------------------*/ | read a summary.log file
and build entries for its data | [
"read",
"a",
"summary",
".",
"log",
"file",
"and",
"build",
"entries",
"for",
"its",
"data"
] | static int read_summary_log(const char *filename, int index)
{
summary_file *curfile = NULL;
char linebuffer[1024];
char *linestart;
int drivers = 0;
FILE *file;
file = fopen(filename, "r");
if (file == NULL)
{
fprintf(stderr, "Error: file '%s' not found\n", filename);
return 1;
}
while (fgets(linebuffer, sizeof(linebuffer), file) != NULL)
{
linestart = trim_string(linebuffer);
if (strncmp(linestart, "@@@@@", 5) == 0)
{
linestart += 5;
if (strncmp(linestart, "driver=", 7) == 0)
{
curfile = parse_driver_tag(linestart + 7, index);
if (curfile == NULL)
goto error;
drivers++;
}
else if (strncmp(linestart, "source=", 7) == 0)
{
if (curfile == NULL)
{
fprintf(stderr, "Unexpected @@@@@source= tag\n");
goto error;
}
strcpy(curfile->source, trim_string(linestart + 7));
}
else if (strncmp(linestart, "dir=", 4) == 0)
{
char *dirname = trim_string(linestart + 4);
lists[index].dir = (char *)malloc(strlen(dirname) + 1);
if (lists[index].dir == NULL)
goto error;
strcpy(lists[index].dir, dirname);
fprintf(stderr, "Directory %s\n", lists[index].dir);
}
}
else if (curfile != NULL)
{
int foundchars = 0;
char *curptr;
if (strncmp(linestart, "pngcrc: ", 7) == 0)
{
}
else
{
for (curptr = linestart; *curptr != 0 && *curptr != '\n' && *curptr != '\r'; curptr++)
if (!isspace((UINT8)*curptr))
foundchars = 1;
*curptr++ = '\n';
*curptr = 0;
if (!foundchars)
continue;
if (curfile->textsize[index] + (curptr - linestart) + 1 >= curfile->textalloc[index])
{
curfile->textalloc[index] = curfile->textsize[index] + (curptr - linestart) + 256;
curfile->text[index] = (char *)realloc(curfile->text[index], curfile->textalloc[index]);
if (curfile->text[index] == NULL)
{
fprintf(stderr, "Unable to allocate memory for text\n");
goto error;
}
}
strcpy(curfile->text[index] + curfile->textsize[index], linestart);
curfile->textsize[index] += curptr - linestart;
}
}
else if (strncmp(linestart, "M.A.M.E. v", 10) == 0)
{
char *start = linestart + 10;
char *end;
for (end = start; !isspace((UINT8)*end); end++) ;
*end = 0;
strcpy(lists[index].version, start);
fprintf(stderr, "Parsing results from version %s\n", lists[index].version);
}
}
fclose(file);
fprintf(stderr, "Parsed %d drivers\n", drivers);
return 0;
error:
fclose(file);
return 1;
} | [
"static",
"int",
"read_summary_log",
"(",
"const",
"char",
"*",
"filename",
",",
"int",
"index",
")",
"{",
"summary_file",
"*",
"curfile",
"=",
"NULL",
";",
"char",
"linebuffer",
"[",
"1024",
"]",
";",
"char",
"*",
"linestart",
";",
"int",
"drivers",
"=",
"0",
";",
"FILE",
"*",
"file",
";",
"file",
"=",
"fopen",
"(",
"filename",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"file",
"==",
"NULL",
")",
"{",
"fprintf",
"(",
"stderr",
",",
"\"",
"\\n",
"\"",
",",
"filename",
")",
";",
"return",
"1",
";",
"}",
"while",
"(",
"fgets",
"(",
"linebuffer",
",",
"sizeof",
"(",
"linebuffer",
")",
",",
"file",
")",
"!=",
"NULL",
")",
"{",
"linestart",
"=",
"trim_string",
"(",
"linebuffer",
")",
";",
"if",
"(",
"strncmp",
"(",
"linestart",
",",
"\"",
"\"",
",",
"5",
")",
"==",
"0",
")",
"{",
"linestart",
"+=",
"5",
";",
"if",
"(",
"strncmp",
"(",
"linestart",
",",
"\"",
"\"",
",",
"7",
")",
"==",
"0",
")",
"{",
"curfile",
"=",
"parse_driver_tag",
"(",
"linestart",
"+",
"7",
",",
"index",
")",
";",
"if",
"(",
"curfile",
"==",
"NULL",
")",
"goto",
"error",
";",
"drivers",
"++",
";",
"}",
"else",
"if",
"(",
"strncmp",
"(",
"linestart",
",",
"\"",
"\"",
",",
"7",
")",
"==",
"0",
")",
"{",
"if",
"(",
"curfile",
"==",
"NULL",
")",
"{",
"fprintf",
"(",
"stderr",
",",
"\"",
"\\n",
"\"",
")",
";",
"goto",
"error",
";",
"}",
"strcpy",
"(",
"curfile",
"->",
"source",
",",
"trim_string",
"(",
"linestart",
"+",
"7",
")",
")",
";",
"}",
"else",
"if",
"(",
"strncmp",
"(",
"linestart",
",",
"\"",
"\"",
",",
"4",
")",
"==",
"0",
")",
"{",
"char",
"*",
"dirname",
"=",
"trim_string",
"(",
"linestart",
"+",
"4",
")",
";",
"lists",
"[",
"index",
"]",
".",
"dir",
"=",
"(",
"char",
"*",
")",
"malloc",
"(",
"strlen",
"(",
"dirname",
")",
"+",
"1",
")",
";",
"if",
"(",
"lists",
"[",
"index",
"]",
".",
"dir",
"==",
"NULL",
")",
"goto",
"error",
";",
"strcpy",
"(",
"lists",
"[",
"index",
"]",
".",
"dir",
",",
"dirname",
")",
";",
"fprintf",
"(",
"stderr",
",",
"\"",
"\\n",
"\"",
",",
"lists",
"[",
"index",
"]",
".",
"dir",
")",
";",
"}",
"}",
"else",
"if",
"(",
"curfile",
"!=",
"NULL",
")",
"{",
"int",
"foundchars",
"=",
"0",
";",
"char",
"*",
"curptr",
";",
"if",
"(",
"strncmp",
"(",
"linestart",
",",
"\"",
"\"",
",",
"7",
")",
"==",
"0",
")",
"{",
"}",
"else",
"{",
"for",
"(",
"curptr",
"=",
"linestart",
";",
"*",
"curptr",
"!=",
"0",
"&&",
"*",
"curptr",
"!=",
"'",
"\\n",
"'",
"&&",
"*",
"curptr",
"!=",
"'",
"\\r",
"'",
";",
"curptr",
"++",
")",
"if",
"(",
"!",
"isspace",
"(",
"(",
"UINT8",
")",
"*",
"curptr",
")",
")",
"foundchars",
"=",
"1",
";",
"*",
"curptr",
"++",
"=",
"'",
"\\n",
"'",
";",
"*",
"curptr",
"=",
"0",
";",
"if",
"(",
"!",
"foundchars",
")",
"continue",
";",
"if",
"(",
"curfile",
"->",
"textsize",
"[",
"index",
"]",
"+",
"(",
"curptr",
"-",
"linestart",
")",
"+",
"1",
">=",
"curfile",
"->",
"textalloc",
"[",
"index",
"]",
")",
"{",
"curfile",
"->",
"textalloc",
"[",
"index",
"]",
"=",
"curfile",
"->",
"textsize",
"[",
"index",
"]",
"+",
"(",
"curptr",
"-",
"linestart",
")",
"+",
"256",
";",
"curfile",
"->",
"text",
"[",
"index",
"]",
"=",
"(",
"char",
"*",
")",
"realloc",
"(",
"curfile",
"->",
"text",
"[",
"index",
"]",
",",
"curfile",
"->",
"textalloc",
"[",
"index",
"]",
")",
";",
"if",
"(",
"curfile",
"->",
"text",
"[",
"index",
"]",
"==",
"NULL",
")",
"{",
"fprintf",
"(",
"stderr",
",",
"\"",
"\\n",
"\"",
")",
";",
"goto",
"error",
";",
"}",
"}",
"strcpy",
"(",
"curfile",
"->",
"text",
"[",
"index",
"]",
"+",
"curfile",
"->",
"textsize",
"[",
"index",
"]",
",",
"linestart",
")",
";",
"curfile",
"->",
"textsize",
"[",
"index",
"]",
"+=",
"curptr",
"-",
"linestart",
";",
"}",
"}",
"else",
"if",
"(",
"strncmp",
"(",
"linestart",
",",
"\"",
"\"",
",",
"10",
")",
"==",
"0",
")",
"{",
"char",
"*",
"start",
"=",
"linestart",
"+",
"10",
";",
"char",
"*",
"end",
";",
"for",
"(",
"end",
"=",
"start",
";",
"!",
"isspace",
"(",
"(",
"UINT8",
")",
"*",
"end",
")",
";",
"end",
"++",
")",
";",
"*",
"end",
"=",
"0",
";",
"strcpy",
"(",
"lists",
"[",
"index",
"]",
".",
"version",
",",
"start",
")",
";",
"fprintf",
"(",
"stderr",
",",
"\"",
"\\n",
"\"",
",",
"lists",
"[",
"index",
"]",
".",
"version",
")",
";",
"}",
"}",
"fclose",
"(",
"file",
")",
";",
"fprintf",
"(",
"stderr",
",",
"\"",
"\\n",
"\"",
",",
"drivers",
")",
";",
"return",
"0",
";",
"error",
":",
"fclose",
"(",
"file",
")",
";",
"return",
"1",
";",
"}"
] | read_summary_log - read a summary.log file
and build entries for its data | [
"read_summary_log",
"-",
"read",
"a",
"summary",
".",
"log",
"file",
"and",
"build",
"entries",
"for",
"its",
"data"
] | [
"/* open the logfile */",
"/* parse it */",
"/* trim the leading/trailing spaces */",
"/* is this one of our specials? */",
"/* advance past the signature */",
"/* look for the driver= tag */",
"/* look for the source= tag */",
"/* error if no driver yet */",
"/* copy the string */",
"/* look for the dir= tag */",
"/* allocate a copy of the string */",
"/* if not, consider other options */",
"/* look for the pngcrc= tag */",
"/* otherwise, accumulate the text */",
"/* find the end of the line and normalize it with a CR */",
"/* ignore blank lines */",
"/* see if we have enough room */",
"/* append our text */",
"/* look for the M.A.M.E. header */",
"/* find the end */"
] | [
{
"param": "filename",
"type": "char"
},
{
"param": "index",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": "char",
"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": []
} |
5b08e86ddac91aaea5da64ff6efd228f0f732ab2 | lofunz/mieme | Reloaded/trunk/src/tools/regrep.c | [
"Unlicense"
] | C | parse_driver_tag | summary_file | static summary_file *parse_driver_tag(char *linestart, int index)
{
summary_file *curfile;
char *colon;
/* find the colon separating name from status */
colon = strchr(linestart, ':');
if (colon == NULL)
{
fprintf(stderr, "Unexpected text after @@@@@driver=\n");
return NULL;
}
/* NULL terminate at the colon and look up the file */
*colon = 0;
curfile = get_file(trim_string(linestart));
if (curfile == NULL)
{
fprintf(stderr, "Unable to allocate memory for driver\n");
return NULL;
}
/* clear out any old status for this file */
curfile->status[index] = STATUS_NOT_PRESENT;
if (curfile->text[index] != NULL)
free(curfile->text[index]);
curfile->text[index] = NULL;
curfile->textsize[index] = 0;
curfile->textalloc[index] = 0;
/* strip leading/trailing spaces from the status */
colon = trim_string(colon + 1);
/* convert status into statistics */
if (strcmp(colon, "Success") == 0)
curfile->status[index] = STATUS_SUCCESS;
else if (strcmp(colon, "Missing files") == 0)
curfile->status[index] = STATUS_MISSING_FILES;
else if (strcmp(colon, "Exception") == 0)
curfile->status[index] = STATUS_EXCEPTION;
else if (strcmp(colon, "Fatal error") == 0)
curfile->status[index] = STATUS_FATAL_ERROR;
else if (strcmp(colon, "Failed validity check") == 0)
curfile->status[index] = STATUS_FAILED_VALIDITY;
else
curfile->status[index] = STATUS_OTHER;
return curfile;
} | /*-------------------------------------------------
parse_driver_tag - parse the status info
from a driver tag
-------------------------------------------------*/ | parse the status info
from a driver tag | [
"parse",
"the",
"status",
"info",
"from",
"a",
"driver",
"tag"
] | static summary_file *parse_driver_tag(char *linestart, int index)
{
summary_file *curfile;
char *colon;
colon = strchr(linestart, ':');
if (colon == NULL)
{
fprintf(stderr, "Unexpected text after @@@@@driver=\n");
return NULL;
}
*colon = 0;
curfile = get_file(trim_string(linestart));
if (curfile == NULL)
{
fprintf(stderr, "Unable to allocate memory for driver\n");
return NULL;
}
curfile->status[index] = STATUS_NOT_PRESENT;
if (curfile->text[index] != NULL)
free(curfile->text[index]);
curfile->text[index] = NULL;
curfile->textsize[index] = 0;
curfile->textalloc[index] = 0;
colon = trim_string(colon + 1);
if (strcmp(colon, "Success") == 0)
curfile->status[index] = STATUS_SUCCESS;
else if (strcmp(colon, "Missing files") == 0)
curfile->status[index] = STATUS_MISSING_FILES;
else if (strcmp(colon, "Exception") == 0)
curfile->status[index] = STATUS_EXCEPTION;
else if (strcmp(colon, "Fatal error") == 0)
curfile->status[index] = STATUS_FATAL_ERROR;
else if (strcmp(colon, "Failed validity check") == 0)
curfile->status[index] = STATUS_FAILED_VALIDITY;
else
curfile->status[index] = STATUS_OTHER;
return curfile;
} | [
"static",
"summary_file",
"*",
"parse_driver_tag",
"(",
"char",
"*",
"linestart",
",",
"int",
"index",
")",
"{",
"summary_file",
"*",
"curfile",
";",
"char",
"*",
"colon",
";",
"colon",
"=",
"strchr",
"(",
"linestart",
",",
"'",
"'",
")",
";",
"if",
"(",
"colon",
"==",
"NULL",
")",
"{",
"fprintf",
"(",
"stderr",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
"NULL",
";",
"}",
"*",
"colon",
"=",
"0",
";",
"curfile",
"=",
"get_file",
"(",
"trim_string",
"(",
"linestart",
")",
")",
";",
"if",
"(",
"curfile",
"==",
"NULL",
")",
"{",
"fprintf",
"(",
"stderr",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
"NULL",
";",
"}",
"curfile",
"->",
"status",
"[",
"index",
"]",
"=",
"STATUS_NOT_PRESENT",
";",
"if",
"(",
"curfile",
"->",
"text",
"[",
"index",
"]",
"!=",
"NULL",
")",
"free",
"(",
"curfile",
"->",
"text",
"[",
"index",
"]",
")",
";",
"curfile",
"->",
"text",
"[",
"index",
"]",
"=",
"NULL",
";",
"curfile",
"->",
"textsize",
"[",
"index",
"]",
"=",
"0",
";",
"curfile",
"->",
"textalloc",
"[",
"index",
"]",
"=",
"0",
";",
"colon",
"=",
"trim_string",
"(",
"colon",
"+",
"1",
")",
";",
"if",
"(",
"strcmp",
"(",
"colon",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"curfile",
"->",
"status",
"[",
"index",
"]",
"=",
"STATUS_SUCCESS",
";",
"else",
"if",
"(",
"strcmp",
"(",
"colon",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"curfile",
"->",
"status",
"[",
"index",
"]",
"=",
"STATUS_MISSING_FILES",
";",
"else",
"if",
"(",
"strcmp",
"(",
"colon",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"curfile",
"->",
"status",
"[",
"index",
"]",
"=",
"STATUS_EXCEPTION",
";",
"else",
"if",
"(",
"strcmp",
"(",
"colon",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"curfile",
"->",
"status",
"[",
"index",
"]",
"=",
"STATUS_FATAL_ERROR",
";",
"else",
"if",
"(",
"strcmp",
"(",
"colon",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"curfile",
"->",
"status",
"[",
"index",
"]",
"=",
"STATUS_FAILED_VALIDITY",
";",
"else",
"curfile",
"->",
"status",
"[",
"index",
"]",
"=",
"STATUS_OTHER",
";",
"return",
"curfile",
";",
"}"
] | parse_driver_tag - parse the status info
from a driver tag | [
"parse_driver_tag",
"-",
"parse",
"the",
"status",
"info",
"from",
"a",
"driver",
"tag"
] | [
"/* find the colon separating name from status */",
"/* NULL terminate at the colon and look up the file */",
"/* clear out any old status for this file */",
"/* strip leading/trailing spaces from the status */",
"/* convert status into statistics */"
] | [
{
"param": "linestart",
"type": "char"
},
{
"param": "index",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "linestart",
"type": "char",
"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": []
} |
5b08e86ddac91aaea5da64ff6efd228f0f732ab2 | lofunz/mieme | Reloaded/trunk/src/tools/regrep.c | [
"Unlicense"
] | C | sort_file_list | summary_file | static summary_file *sort_file_list(void)
{
summary_file *listhead, **tailptr, *curfile, **filearray;
int numfiles, filenum;
int c0, c1;
/* count the total number of files */
numfiles = 0;
for (c0 = 0; c0 < 128; c0++)
for (c1 = 0; c1 < 128; c1++)
for (curfile = filehash[c0][c1]; curfile != NULL; curfile = curfile->next)
numfiles++;
/* allocate an array of files */
filearray = (summary_file **)malloc(numfiles * sizeof(*filearray));
if (filearray == NULL)
{
fprintf(stderr, "Out of memory!\n");
return NULL;
}
/* populate the array */
numfiles = 0;
for (c0 = 0; c0 < 128; c0++)
for (c1 = 0; c1 < 128; c1++)
for (curfile = filehash[c0][c1]; curfile != NULL; curfile = curfile->next)
filearray[numfiles++] = curfile;
/* sort the array */
qsort(filearray, numfiles, sizeof(filearray[0]), compare_file);
/* now regenerate a single list */
listhead = NULL;
tailptr = &listhead;
for (filenum = 0; filenum < numfiles; filenum++)
{
*tailptr = filearray[filenum];
tailptr = &(*tailptr)->next;
}
*tailptr = NULL;
free(filearray);
return listhead;
} | /*-------------------------------------------------
sort_file_list - convert the hashed lists
into a single, sorted list
-------------------------------------------------*/ | convert the hashed lists
into a single, sorted list | [
"convert",
"the",
"hashed",
"lists",
"into",
"a",
"single",
"sorted",
"list"
] | static summary_file *sort_file_list(void)
{
summary_file *listhead, **tailptr, *curfile, **filearray;
int numfiles, filenum;
int c0, c1;
numfiles = 0;
for (c0 = 0; c0 < 128; c0++)
for (c1 = 0; c1 < 128; c1++)
for (curfile = filehash[c0][c1]; curfile != NULL; curfile = curfile->next)
numfiles++;
filearray = (summary_file **)malloc(numfiles * sizeof(*filearray));
if (filearray == NULL)
{
fprintf(stderr, "Out of memory!\n");
return NULL;
}
numfiles = 0;
for (c0 = 0; c0 < 128; c0++)
for (c1 = 0; c1 < 128; c1++)
for (curfile = filehash[c0][c1]; curfile != NULL; curfile = curfile->next)
filearray[numfiles++] = curfile;
qsort(filearray, numfiles, sizeof(filearray[0]), compare_file);
listhead = NULL;
tailptr = &listhead;
for (filenum = 0; filenum < numfiles; filenum++)
{
*tailptr = filearray[filenum];
tailptr = &(*tailptr)->next;
}
*tailptr = NULL;
free(filearray);
return listhead;
} | [
"static",
"summary_file",
"*",
"sort_file_list",
"(",
"void",
")",
"{",
"summary_file",
"*",
"listhead",
",",
"*",
"*",
"tailptr",
",",
"*",
"curfile",
",",
"*",
"*",
"filearray",
";",
"int",
"numfiles",
",",
"filenum",
";",
"int",
"c0",
",",
"c1",
";",
"numfiles",
"=",
"0",
";",
"for",
"(",
"c0",
"=",
"0",
";",
"c0",
"<",
"128",
";",
"c0",
"++",
")",
"for",
"(",
"c1",
"=",
"0",
";",
"c1",
"<",
"128",
";",
"c1",
"++",
")",
"for",
"(",
"curfile",
"=",
"filehash",
"[",
"c0",
"]",
"[",
"c1",
"]",
";",
"curfile",
"!=",
"NULL",
";",
"curfile",
"=",
"curfile",
"->",
"next",
")",
"numfiles",
"++",
";",
"filearray",
"=",
"(",
"summary_file",
"*",
"*",
")",
"malloc",
"(",
"numfiles",
"*",
"sizeof",
"(",
"*",
"filearray",
")",
")",
";",
"if",
"(",
"filearray",
"==",
"NULL",
")",
"{",
"fprintf",
"(",
"stderr",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
"NULL",
";",
"}",
"numfiles",
"=",
"0",
";",
"for",
"(",
"c0",
"=",
"0",
";",
"c0",
"<",
"128",
";",
"c0",
"++",
")",
"for",
"(",
"c1",
"=",
"0",
";",
"c1",
"<",
"128",
";",
"c1",
"++",
")",
"for",
"(",
"curfile",
"=",
"filehash",
"[",
"c0",
"]",
"[",
"c1",
"]",
";",
"curfile",
"!=",
"NULL",
";",
"curfile",
"=",
"curfile",
"->",
"next",
")",
"filearray",
"[",
"numfiles",
"++",
"]",
"=",
"curfile",
";",
"qsort",
"(",
"filearray",
",",
"numfiles",
",",
"sizeof",
"(",
"filearray",
"[",
"0",
"]",
")",
",",
"compare_file",
")",
";",
"listhead",
"=",
"NULL",
";",
"tailptr",
"=",
"&",
"listhead",
";",
"for",
"(",
"filenum",
"=",
"0",
";",
"filenum",
"<",
"numfiles",
";",
"filenum",
"++",
")",
"{",
"*",
"tailptr",
"=",
"filearray",
"[",
"filenum",
"]",
";",
"tailptr",
"=",
"&",
"(",
"*",
"tailptr",
")",
"->",
"next",
";",
"}",
"*",
"tailptr",
"=",
"NULL",
";",
"free",
"(",
"filearray",
")",
";",
"return",
"listhead",
";",
"}"
] | sort_file_list - convert the hashed lists
into a single, sorted list | [
"sort_file_list",
"-",
"convert",
"the",
"hashed",
"lists",
"into",
"a",
"single",
"sorted",
"list"
] | [
"/* count the total number of files */",
"/* allocate an array of files */",
"/* populate the array */",
"/* sort the array */",
"/* now regenerate a single list */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
5b08e86ddac91aaea5da64ff6efd228f0f732ab2 | lofunz/mieme | Reloaded/trunk/src/tools/regrep.c | [
"Unlicense"
] | C | create_file_and_output_header | core_file | static core_file *create_file_and_output_header(const astring *filename, const astring *templatefile, const astring *title)
{
astring *modified;
core_file *file;
/* create the indexfile */
if (core_fopen(astring_c(filename), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS | OPEN_FLAG_NO_BOM, &file) != FILERR_NONE)
return NULL;
/* print a header */
modified = astring_dup(templatefile);
astring_replacec(modified, 0, "<!--TITLE-->", astring_c(title));
core_fwrite(file, astring_c(modified), astring_len(modified));
/* return the file */
astring_free(modified);
return file;
} | /*-------------------------------------------------
create_file_and_output_header - create a new
HTML file with a standard header
-------------------------------------------------*/ | create a new
HTML file with a standard header | [
"create",
"a",
"new",
"HTML",
"file",
"with",
"a",
"standard",
"header"
] | static core_file *create_file_and_output_header(const astring *filename, const astring *templatefile, const astring *title)
{
astring *modified;
core_file *file;
if (core_fopen(astring_c(filename), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS | OPEN_FLAG_NO_BOM, &file) != FILERR_NONE)
return NULL;
modified = astring_dup(templatefile);
astring_replacec(modified, 0, "<!--TITLE-->", astring_c(title));
core_fwrite(file, astring_c(modified), astring_len(modified));
astring_free(modified);
return file;
} | [
"static",
"core_file",
"*",
"create_file_and_output_header",
"(",
"const",
"astring",
"*",
"filename",
",",
"const",
"astring",
"*",
"templatefile",
",",
"const",
"astring",
"*",
"title",
")",
"{",
"astring",
"*",
"modified",
";",
"core_file",
"*",
"file",
";",
"if",
"(",
"core_fopen",
"(",
"astring_c",
"(",
"filename",
")",
",",
"OPEN_FLAG_WRITE",
"|",
"OPEN_FLAG_CREATE",
"|",
"OPEN_FLAG_CREATE_PATHS",
"|",
"OPEN_FLAG_NO_BOM",
",",
"&",
"file",
")",
"!=",
"FILERR_NONE",
")",
"return",
"NULL",
";",
"modified",
"=",
"astring_dup",
"(",
"templatefile",
")",
";",
"astring_replacec",
"(",
"modified",
",",
"0",
",",
"\"",
"\"",
",",
"astring_c",
"(",
"title",
")",
")",
";",
"core_fwrite",
"(",
"file",
",",
"astring_c",
"(",
"modified",
")",
",",
"astring_len",
"(",
"modified",
")",
")",
";",
"astring_free",
"(",
"modified",
")",
";",
"return",
"file",
";",
"}"
] | create_file_and_output_header - create a new
HTML file with a standard header | [
"create_file_and_output_header",
"-",
"create",
"a",
"new",
"HTML",
"file",
"with",
"a",
"standard",
"header"
] | [
"/* create the indexfile */",
"/* print a header */",
"/* return the file */"
] | [
{
"param": "filename",
"type": "astring"
},
{
"param": "templatefile",
"type": "astring"
},
{
"param": "title",
"type": "astring"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "templatefile",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "title",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5b08e86ddac91aaea5da64ff6efd228f0f732ab2 | lofunz/mieme | Reloaded/trunk/src/tools/regrep.c | [
"Unlicense"
] | C | output_footer_and_close_file | void | static void output_footer_and_close_file(core_file *file, const astring *templatefile, const astring *title)
{
astring *modified;
modified = astring_dup(templatefile);
astring_replacec(modified, 0, "<!--TITLE-->", astring_c(title));
core_fwrite(file, astring_c(modified), astring_len(modified));
astring_free(modified);
core_fclose(file);
} | /*-------------------------------------------------
output_footer_and_close_file - write a
standard footer to an HTML file and close it
-------------------------------------------------*/ | write a
standard footer to an HTML file and close it | [
"write",
"a",
"standard",
"footer",
"to",
"an",
"HTML",
"file",
"and",
"close",
"it"
] | static void output_footer_and_close_file(core_file *file, const astring *templatefile, const astring *title)
{
astring *modified;
modified = astring_dup(templatefile);
astring_replacec(modified, 0, "<!--TITLE-->", astring_c(title));
core_fwrite(file, astring_c(modified), astring_len(modified));
astring_free(modified);
core_fclose(file);
} | [
"static",
"void",
"output_footer_and_close_file",
"(",
"core_file",
"*",
"file",
",",
"const",
"astring",
"*",
"templatefile",
",",
"const",
"astring",
"*",
"title",
")",
"{",
"astring",
"*",
"modified",
";",
"modified",
"=",
"astring_dup",
"(",
"templatefile",
")",
";",
"astring_replacec",
"(",
"modified",
",",
"0",
",",
"\"",
"\"",
",",
"astring_c",
"(",
"title",
")",
")",
";",
"core_fwrite",
"(",
"file",
",",
"astring_c",
"(",
"modified",
")",
",",
"astring_len",
"(",
"modified",
")",
")",
";",
"astring_free",
"(",
"modified",
")",
";",
"core_fclose",
"(",
"file",
")",
";",
"}"
] | output_footer_and_close_file - write a
standard footer to an HTML file and close it | [
"output_footer_and_close_file",
"-",
"write",
"a",
"standard",
"footer",
"to",
"an",
"HTML",
"file",
"and",
"close",
"it"
] | [] | [
{
"param": "file",
"type": "core_file"
},
{
"param": "templatefile",
"type": "astring"
},
{
"param": "title",
"type": "astring"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "core_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "templatefile",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "title",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5b08e86ddac91aaea5da64ff6efd228f0f732ab2 | lofunz/mieme | Reloaded/trunk/src/tools/regrep.c | [
"Unlicense"
] | C | append_driver_list_table | void | static void append_driver_list_table(const char *header, const astring *dirname, core_file *indexfile, const summary_file *listhead, const astring *tempheader, const astring *tempfooter)
{
const summary_file *curfile, *prevfile;
int width = 100 / (2 + list_count);
int listnum;
/* output a header */
core_fprintf(indexfile, "\t<h2>%s</h2>\n", header);
/* start the table */
core_fprintf(indexfile, "\t<p><table width=\"90%%\">\n");
core_fprintf(indexfile, "\t\t<tr>\n\t\t\t<th width=\"%d%%\">Source</th><th width=\"%d%%\">Driver</th>", width, width);
for (listnum = 0; listnum < list_count; listnum++)
core_fprintf(indexfile, "<th width=\"%d%%\">%s</th>", width, lists[listnum].version);
core_fprintf(indexfile, "\n\t\t</tr>\n");
/* if nothing, print a default message */
if (listhead == NULL)
{
core_fprintf(indexfile, "\t\t<tr>\n\t\t\t");
core_fprintf(indexfile, "<td colspan=\"%d\" align=\"center\">(No regressions detected)</td>", list_count + 2);
core_fprintf(indexfile, "\n\t\t</tr>\n");
}
/* iterate over files */
for (prevfile = NULL, curfile = listhead; curfile != NULL; prevfile = curfile, curfile = curfile->next)
{
int rowspan = 0, uniqueshots = 0;
char pngdiffname[40];
/* if this is the first entry in this source file, count how many rows we need to span */
if (prevfile == NULL || strcmp(prevfile->source, curfile->source) != 0)
{
const summary_file *cur;
for (cur = curfile; cur != NULL; cur = cur->next)
if (strcmp(cur->source, curfile->source) == 0)
rowspan++;
else
break;
}
/* create screenshots if necessary */
pngdiffname[0] = 0;
for (listnum = 0; listnum < list_count; listnum++)
if (curfile->matchbitmap[listnum] == listnum)
uniqueshots++;
if (uniqueshots > 1)
{
sprintf(pngdiffname, "compare_%s.png", curfile->name);
if (generate_png_diff(curfile, dirname, pngdiffname) != 0)
pngdiffname[0] = 0;
}
/* create a linked file */
create_linked_file(dirname, curfile, prevfile, curfile->next, (pngdiffname[0] == 0) ? NULL : pngdiffname, tempheader, tempfooter);
/* create a row */
core_fprintf(indexfile, "\t\t<tr>\n\t\t\t");
if (rowspan > 0)
core_fprintf(indexfile, "<td rowspan=\"%d\">%s</td>", rowspan, curfile->source);
core_fprintf(indexfile, "<td><a href=\"%s.html\">%s</a></td>", curfile->name, curfile->name);
for (listnum = 0; listnum < list_count; listnum++)
{
int unique_index = -1;
if (pngdiffname[0] != 0)
unique_index = get_unique_index(curfile, listnum);
if (unique_index != -1)
core_fprintf(indexfile, "<td><span style=\"%s\"> </span> %s [<a href=\"%s\" target=\"blank\">%d</a>]</td>", status_color[curfile->status[listnum]], status_text[curfile->status[listnum]], pngdiffname, unique_index);
else
core_fprintf(indexfile, "<td><span style=\"%s\"> </span> %s</td>", status_color[curfile->status[listnum]], status_text[curfile->status[listnum]]);
}
core_fprintf(indexfile, "\n\t\t</tr>\n");
/* also print the name and source file */
printf("%s %s\n", curfile->name, curfile->source);
}
/* end of table */
core_fprintf(indexfile, "</table></p>\n");
} | /*-------------------------------------------------
append_driver_list_table - append a table
of drivers from a list to an HTML file
-------------------------------------------------*/ | append a table
of drivers from a list to an HTML file | [
"append",
"a",
"table",
"of",
"drivers",
"from",
"a",
"list",
"to",
"an",
"HTML",
"file"
] | static void append_driver_list_table(const char *header, const astring *dirname, core_file *indexfile, const summary_file *listhead, const astring *tempheader, const astring *tempfooter)
{
const summary_file *curfile, *prevfile;
int width = 100 / (2 + list_count);
int listnum;
core_fprintf(indexfile, "\t<h2>%s</h2>\n", header);
core_fprintf(indexfile, "\t<p><table width=\"90%%\">\n");
core_fprintf(indexfile, "\t\t<tr>\n\t\t\t<th width=\"%d%%\">Source</th><th width=\"%d%%\">Driver</th>", width, width);
for (listnum = 0; listnum < list_count; listnum++)
core_fprintf(indexfile, "<th width=\"%d%%\">%s</th>", width, lists[listnum].version);
core_fprintf(indexfile, "\n\t\t</tr>\n");
if (listhead == NULL)
{
core_fprintf(indexfile, "\t\t<tr>\n\t\t\t");
core_fprintf(indexfile, "<td colspan=\"%d\" align=\"center\">(No regressions detected)</td>", list_count + 2);
core_fprintf(indexfile, "\n\t\t</tr>\n");
}
for (prevfile = NULL, curfile = listhead; curfile != NULL; prevfile = curfile, curfile = curfile->next)
{
int rowspan = 0, uniqueshots = 0;
char pngdiffname[40];
if (prevfile == NULL || strcmp(prevfile->source, curfile->source) != 0)
{
const summary_file *cur;
for (cur = curfile; cur != NULL; cur = cur->next)
if (strcmp(cur->source, curfile->source) == 0)
rowspan++;
else
break;
}
pngdiffname[0] = 0;
for (listnum = 0; listnum < list_count; listnum++)
if (curfile->matchbitmap[listnum] == listnum)
uniqueshots++;
if (uniqueshots > 1)
{
sprintf(pngdiffname, "compare_%s.png", curfile->name);
if (generate_png_diff(curfile, dirname, pngdiffname) != 0)
pngdiffname[0] = 0;
}
create_linked_file(dirname, curfile, prevfile, curfile->next, (pngdiffname[0] == 0) ? NULL : pngdiffname, tempheader, tempfooter);
core_fprintf(indexfile, "\t\t<tr>\n\t\t\t");
if (rowspan > 0)
core_fprintf(indexfile, "<td rowspan=\"%d\">%s</td>", rowspan, curfile->source);
core_fprintf(indexfile, "<td><a href=\"%s.html\">%s</a></td>", curfile->name, curfile->name);
for (listnum = 0; listnum < list_count; listnum++)
{
int unique_index = -1;
if (pngdiffname[0] != 0)
unique_index = get_unique_index(curfile, listnum);
if (unique_index != -1)
core_fprintf(indexfile, "<td><span style=\"%s\"> </span> %s [<a href=\"%s\" target=\"blank\">%d</a>]</td>", status_color[curfile->status[listnum]], status_text[curfile->status[listnum]], pngdiffname, unique_index);
else
core_fprintf(indexfile, "<td><span style=\"%s\"> </span> %s</td>", status_color[curfile->status[listnum]], status_text[curfile->status[listnum]]);
}
core_fprintf(indexfile, "\n\t\t</tr>\n");
printf("%s %s\n", curfile->name, curfile->source);
}
core_fprintf(indexfile, "</table></p>\n");
} | [
"static",
"void",
"append_driver_list_table",
"(",
"const",
"char",
"*",
"header",
",",
"const",
"astring",
"*",
"dirname",
",",
"core_file",
"*",
"indexfile",
",",
"const",
"summary_file",
"*",
"listhead",
",",
"const",
"astring",
"*",
"tempheader",
",",
"const",
"astring",
"*",
"tempfooter",
")",
"{",
"const",
"summary_file",
"*",
"curfile",
",",
"*",
"prevfile",
";",
"int",
"width",
"=",
"100",
"/",
"(",
"2",
"+",
"list_count",
")",
";",
"int",
"listnum",
";",
"core_fprintf",
"(",
"indexfile",
",",
"\"",
"\\t",
"\\n",
"\"",
",",
"header",
")",
";",
"core_fprintf",
"(",
"indexfile",
",",
"\"",
"\\t",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
";",
"core_fprintf",
"(",
"indexfile",
",",
"\"",
"\\t",
"\\t",
"\\n",
"\\t",
"\\t",
"\\t",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"width",
",",
"width",
")",
";",
"for",
"(",
"listnum",
"=",
"0",
";",
"listnum",
"<",
"list_count",
";",
"listnum",
"++",
")",
"core_fprintf",
"(",
"indexfile",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"width",
",",
"lists",
"[",
"listnum",
"]",
".",
"version",
")",
";",
"core_fprintf",
"(",
"indexfile",
",",
"\"",
"\\n",
"\\t",
"\\t",
"\\n",
"\"",
")",
";",
"if",
"(",
"listhead",
"==",
"NULL",
")",
"{",
"core_fprintf",
"(",
"indexfile",
",",
"\"",
"\\t",
"\\t",
"\\n",
"\\t",
"\\t",
"\\t",
"\"",
")",
";",
"core_fprintf",
"(",
"indexfile",
",",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"list_count",
"+",
"2",
")",
";",
"core_fprintf",
"(",
"indexfile",
",",
"\"",
"\\n",
"\\t",
"\\t",
"\\n",
"\"",
")",
";",
"}",
"for",
"(",
"prevfile",
"=",
"NULL",
",",
"curfile",
"=",
"listhead",
";",
"curfile",
"!=",
"NULL",
";",
"prevfile",
"=",
"curfile",
",",
"curfile",
"=",
"curfile",
"->",
"next",
")",
"{",
"int",
"rowspan",
"=",
"0",
",",
"uniqueshots",
"=",
"0",
";",
"char",
"pngdiffname",
"[",
"40",
"]",
";",
"if",
"(",
"prevfile",
"==",
"NULL",
"||",
"strcmp",
"(",
"prevfile",
"->",
"source",
",",
"curfile",
"->",
"source",
")",
"!=",
"0",
")",
"{",
"const",
"summary_file",
"*",
"cur",
";",
"for",
"(",
"cur",
"=",
"curfile",
";",
"cur",
"!=",
"NULL",
";",
"cur",
"=",
"cur",
"->",
"next",
")",
"if",
"(",
"strcmp",
"(",
"cur",
"->",
"source",
",",
"curfile",
"->",
"source",
")",
"==",
"0",
")",
"rowspan",
"++",
";",
"else",
"break",
";",
"}",
"pngdiffname",
"[",
"0",
"]",
"=",
"0",
";",
"for",
"(",
"listnum",
"=",
"0",
";",
"listnum",
"<",
"list_count",
";",
"listnum",
"++",
")",
"if",
"(",
"curfile",
"->",
"matchbitmap",
"[",
"listnum",
"]",
"==",
"listnum",
")",
"uniqueshots",
"++",
";",
"if",
"(",
"uniqueshots",
">",
"1",
")",
"{",
"sprintf",
"(",
"pngdiffname",
",",
"\"",
"\"",
",",
"curfile",
"->",
"name",
")",
";",
"if",
"(",
"generate_png_diff",
"(",
"curfile",
",",
"dirname",
",",
"pngdiffname",
")",
"!=",
"0",
")",
"pngdiffname",
"[",
"0",
"]",
"=",
"0",
";",
"}",
"create_linked_file",
"(",
"dirname",
",",
"curfile",
",",
"prevfile",
",",
"curfile",
"->",
"next",
",",
"(",
"pngdiffname",
"[",
"0",
"]",
"==",
"0",
")",
"?",
"NULL",
":",
"pngdiffname",
",",
"tempheader",
",",
"tempfooter",
")",
";",
"core_fprintf",
"(",
"indexfile",
",",
"\"",
"\\t",
"\\t",
"\\n",
"\\t",
"\\t",
"\\t",
"\"",
")",
";",
"if",
"(",
"rowspan",
">",
"0",
")",
"core_fprintf",
"(",
"indexfile",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"rowspan",
",",
"curfile",
"->",
"source",
")",
";",
"core_fprintf",
"(",
"indexfile",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"curfile",
"->",
"name",
",",
"curfile",
"->",
"name",
")",
";",
"for",
"(",
"listnum",
"=",
"0",
";",
"listnum",
"<",
"list_count",
";",
"listnum",
"++",
")",
"{",
"int",
"unique_index",
"=",
"-1",
";",
"if",
"(",
"pngdiffname",
"[",
"0",
"]",
"!=",
"0",
")",
"unique_index",
"=",
"get_unique_index",
"(",
"curfile",
",",
"listnum",
")",
";",
"if",
"(",
"unique_index",
"!=",
"-1",
")",
"core_fprintf",
"(",
"indexfile",
",",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"status_color",
"[",
"curfile",
"->",
"status",
"[",
"listnum",
"]",
"]",
",",
"status_text",
"[",
"curfile",
"->",
"status",
"[",
"listnum",
"]",
"]",
",",
"pngdiffname",
",",
"unique_index",
")",
";",
"else",
"core_fprintf",
"(",
"indexfile",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"status_color",
"[",
"curfile",
"->",
"status",
"[",
"listnum",
"]",
"]",
",",
"status_text",
"[",
"curfile",
"->",
"status",
"[",
"listnum",
"]",
"]",
")",
";",
"}",
"core_fprintf",
"(",
"indexfile",
",",
"\"",
"\\n",
"\\t",
"\\t",
"\\n",
"\"",
")",
";",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"curfile",
"->",
"name",
",",
"curfile",
"->",
"source",
")",
";",
"}",
"core_fprintf",
"(",
"indexfile",
",",
"\"",
"\\n",
"\"",
")",
";",
"}"
] | append_driver_list_table - append a table
of drivers from a list to an HTML file | [
"append_driver_list_table",
"-",
"append",
"a",
"table",
"of",
"drivers",
"from",
"a",
"list",
"to",
"an",
"HTML",
"file"
] | [
"/* output a header */",
"/* start the table */",
"/* if nothing, print a default message */",
"/* iterate over files */",
"/* if this is the first entry in this source file, count how many rows we need to span */",
"/* create screenshots if necessary */",
"/* create a linked file */",
"/* create a row */",
"/* also print the name and source file */",
"/* end of table */"
] | [
{
"param": "header",
"type": "char"
},
{
"param": "dirname",
"type": "astring"
},
{
"param": "indexfile",
"type": "core_file"
},
{
"param": "listhead",
"type": "summary_file"
},
{
"param": "tempheader",
"type": "astring"
},
{
"param": "tempfooter",
"type": "astring"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "header",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dirname",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "indexfile",
"type": "core_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "listhead",
"type": "summary_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tempheader",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tempfooter",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f7842cb6a59b2ea8238a8f50da1b79b5f17b5acc | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/config.c | [
"Unlicense"
] | C | config_register | void | void config_register(running_machine *machine, const char *nodename, config_callback_func load, config_callback_func save)
{
config_type *newtype;
config_type **ptype;
/* allocate a new type */
newtype = auto_alloc(machine, config_type);
newtype->next = NULL;
newtype->name = nodename;
newtype->load = load;
newtype->save = save;
/* add us to the end */
for (ptype = &typelist; *ptype; ptype = &(*ptype)->next) ;
*ptype = newtype;
} | /*************************************
*
* Register to be involved in config
* save/load
*
*************************************/ | Register to be involved in config
save/load | [
"Register",
"to",
"be",
"involved",
"in",
"config",
"save",
"/",
"load"
] | void config_register(running_machine *machine, const char *nodename, config_callback_func load, config_callback_func save)
{
config_type *newtype;
config_type **ptype;
newtype = auto_alloc(machine, config_type);
newtype->next = NULL;
newtype->name = nodename;
newtype->load = load;
newtype->save = save;
for (ptype = &typelist; *ptype; ptype = &(*ptype)->next) ;
*ptype = newtype;
} | [
"void",
"config_register",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"nodename",
",",
"config_callback_func",
"load",
",",
"config_callback_func",
"save",
")",
"{",
"config_type",
"*",
"newtype",
";",
"config_type",
"*",
"*",
"ptype",
";",
"newtype",
"=",
"auto_alloc",
"(",
"machine",
",",
"config_type",
")",
";",
"newtype",
"->",
"next",
"=",
"NULL",
";",
"newtype",
"->",
"name",
"=",
"nodename",
";",
"newtype",
"->",
"load",
"=",
"load",
";",
"newtype",
"->",
"save",
"=",
"save",
";",
"for",
"(",
"ptype",
"=",
"&",
"typelist",
";",
"*",
"ptype",
";",
"ptype",
"=",
"&",
"(",
"*",
"ptype",
")",
"->",
"next",
")",
";",
"*",
"ptype",
"=",
"newtype",
";",
"}"
] | Register to be involved in config
save/load | [
"Register",
"to",
"be",
"involved",
"in",
"config",
"save",
"/",
"load"
] | [
"/* allocate a new type */",
"/* add us to the end */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "nodename",
"type": "char"
},
{
"param": "load",
"type": "config_callback_func"
},
{
"param": "save",
"type": "config_callback_func"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "nodename",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "load",
"type": "config_callback_func",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "save",
"type": "config_callback_func",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_field_name | char | const char *input_field_name(const input_field_config *field)
{
/* if we have a non-default name, use that */
if ((field->state != NULL) && (field->state->name != NULL))
return field->state->name;
if (field->name != NULL)
return field->name;
/* otherwise, return the name associated with the type */
return input_type_name(field->port->machine, field->type, field->player);
} | /*-------------------------------------------------
input_field_name - return the field name for
a given input field
-------------------------------------------------*/ | return the field name for
a given input field | [
"return",
"the",
"field",
"name",
"for",
"a",
"given",
"input",
"field"
] | const char *input_field_name(const input_field_config *field)
{
if ((field->state != NULL) && (field->state->name != NULL))
return field->state->name;
if (field->name != NULL)
return field->name;
return input_type_name(field->port->machine, field->type, field->player);
} | [
"const",
"char",
"*",
"input_field_name",
"(",
"const",
"input_field_config",
"*",
"field",
")",
"{",
"if",
"(",
"(",
"field",
"->",
"state",
"!=",
"NULL",
")",
"&&",
"(",
"field",
"->",
"state",
"->",
"name",
"!=",
"NULL",
")",
")",
"return",
"field",
"->",
"state",
"->",
"name",
";",
"if",
"(",
"field",
"->",
"name",
"!=",
"NULL",
")",
"return",
"field",
"->",
"name",
";",
"return",
"input_type_name",
"(",
"field",
"->",
"port",
"->",
"machine",
",",
"field",
"->",
"type",
",",
"field",
"->",
"player",
")",
";",
"}"
] | input_field_name - return the field name for
a given input field | [
"input_field_name",
"-",
"return",
"the",
"field",
"name",
"for",
"a",
"given",
"input",
"field"
] | [
"/* if we have a non-default name, use that */",
"/* otherwise, return the name associated with the type */"
] | [
{
"param": "field",
"type": "input_field_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": "input_field_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_field_seq | input_seq | const input_seq *input_field_seq(const input_field_config *field, input_seq_type seqtype)
{
static const input_seq ip_none = SEQ_DEF_0;
const input_seq *portseq = &ip_none;
/* if the field is disabled, return no key */
if (field->flags & FIELD_FLAG_UNUSED)
return portseq;
/* select either the live or config state depending on whether we have live state */
portseq = (field->state == NULL) ? &field->seq[seqtype] : &field->state->seq[seqtype];
/* if the portseq is the special default code, return the expanded default value */
if (input_seq_get_1(portseq) == SEQCODE_DEFAULT)
return input_type_seq(field->port->machine, field->type, field->player, seqtype);
/* otherwise, return the sequence as-is */
return portseq;
} | /*-------------------------------------------------
input_field_seq - return the input sequence
for the given input field
-------------------------------------------------*/ | return the input sequence
for the given input field | [
"return",
"the",
"input",
"sequence",
"for",
"the",
"given",
"input",
"field"
] | const input_seq *input_field_seq(const input_field_config *field, input_seq_type seqtype)
{
static const input_seq ip_none = SEQ_DEF_0;
const input_seq *portseq = &ip_none;
if (field->flags & FIELD_FLAG_UNUSED)
return portseq;
portseq = (field->state == NULL) ? &field->seq[seqtype] : &field->state->seq[seqtype];
if (input_seq_get_1(portseq) == SEQCODE_DEFAULT)
return input_type_seq(field->port->machine, field->type, field->player, seqtype);
return portseq;
} | [
"const",
"input_seq",
"*",
"input_field_seq",
"(",
"const",
"input_field_config",
"*",
"field",
",",
"input_seq_type",
"seqtype",
")",
"{",
"static",
"const",
"input_seq",
"ip_none",
"=",
"SEQ_DEF_0",
";",
"const",
"input_seq",
"*",
"portseq",
"=",
"&",
"ip_none",
";",
"if",
"(",
"field",
"->",
"flags",
"&",
"FIELD_FLAG_UNUSED",
")",
"return",
"portseq",
";",
"portseq",
"=",
"(",
"field",
"->",
"state",
"==",
"NULL",
")",
"?",
"&",
"field",
"->",
"seq",
"[",
"seqtype",
"]",
":",
"&",
"field",
"->",
"state",
"->",
"seq",
"[",
"seqtype",
"]",
";",
"if",
"(",
"input_seq_get_1",
"(",
"portseq",
")",
"==",
"SEQCODE_DEFAULT",
")",
"return",
"input_type_seq",
"(",
"field",
"->",
"port",
"->",
"machine",
",",
"field",
"->",
"type",
",",
"field",
"->",
"player",
",",
"seqtype",
")",
";",
"return",
"portseq",
";",
"}"
] | input_field_seq - return the input sequence
for the given input field | [
"input_field_seq",
"-",
"return",
"the",
"input",
"sequence",
"for",
"the",
"given",
"input",
"field"
] | [
"/* if the field is disabled, return no key */",
"/* select either the live or config state depending on whether we have live state */",
"/* if the portseq is the special default code, return the expanded default value */",
"/* otherwise, return the sequence as-is */"
] | [
{
"param": "field",
"type": "input_field_config"
},
{
"param": "seqtype",
"type": "input_seq_type"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": "input_field_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seqtype",
"type": "input_seq_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_field_get_user_settings | void | void input_field_get_user_settings(const input_field_config *field, input_field_user_settings *settings)
{
int seqtype;
/* zap the entire structure */
memset(settings, 0, sizeof(*settings));
/* copy the basics */
for (seqtype = 0; seqtype < ARRAY_LENGTH(settings->seq); seqtype++)
settings->seq[seqtype] = field->state->seq[seqtype];
/* if there's a list of settings or we're an adjuster, copy the current value */
if (field->settinglist != NULL || field->type == IPT_ADJUSTER)
settings->value = field->state->value;
/* if there's analog data, extract the analog settings */
if (field->state->analog != NULL)
{
settings->sensitivity = field->state->analog->sensitivity;
settings->delta = field->state->analog->delta;
settings->centerdelta = field->state->analog->centerdelta;
settings->reverse = field->state->analog->reverse;
}
} | /*-------------------------------------------------
input_field_get_user_settings - return the current
settings for the given input field
-------------------------------------------------*/ | return the current
settings for the given input field | [
"return",
"the",
"current",
"settings",
"for",
"the",
"given",
"input",
"field"
] | void input_field_get_user_settings(const input_field_config *field, input_field_user_settings *settings)
{
int seqtype;
memset(settings, 0, sizeof(*settings));
for (seqtype = 0; seqtype < ARRAY_LENGTH(settings->seq); seqtype++)
settings->seq[seqtype] = field->state->seq[seqtype];
if (field->settinglist != NULL || field->type == IPT_ADJUSTER)
settings->value = field->state->value;
if (field->state->analog != NULL)
{
settings->sensitivity = field->state->analog->sensitivity;
settings->delta = field->state->analog->delta;
settings->centerdelta = field->state->analog->centerdelta;
settings->reverse = field->state->analog->reverse;
}
} | [
"void",
"input_field_get_user_settings",
"(",
"const",
"input_field_config",
"*",
"field",
",",
"input_field_user_settings",
"*",
"settings",
")",
"{",
"int",
"seqtype",
";",
"memset",
"(",
"settings",
",",
"0",
",",
"sizeof",
"(",
"*",
"settings",
")",
")",
";",
"for",
"(",
"seqtype",
"=",
"0",
";",
"seqtype",
"<",
"ARRAY_LENGTH",
"(",
"settings",
"->",
"seq",
")",
";",
"seqtype",
"++",
")",
"settings",
"->",
"seq",
"[",
"seqtype",
"]",
"=",
"field",
"->",
"state",
"->",
"seq",
"[",
"seqtype",
"]",
";",
"if",
"(",
"field",
"->",
"settinglist",
"!=",
"NULL",
"||",
"field",
"->",
"type",
"==",
"IPT_ADJUSTER",
")",
"settings",
"->",
"value",
"=",
"field",
"->",
"state",
"->",
"value",
";",
"if",
"(",
"field",
"->",
"state",
"->",
"analog",
"!=",
"NULL",
")",
"{",
"settings",
"->",
"sensitivity",
"=",
"field",
"->",
"state",
"->",
"analog",
"->",
"sensitivity",
";",
"settings",
"->",
"delta",
"=",
"field",
"->",
"state",
"->",
"analog",
"->",
"delta",
";",
"settings",
"->",
"centerdelta",
"=",
"field",
"->",
"state",
"->",
"analog",
"->",
"centerdelta",
";",
"settings",
"->",
"reverse",
"=",
"field",
"->",
"state",
"->",
"analog",
"->",
"reverse",
";",
"}",
"}"
] | input_field_get_user_settings - return the current
settings for the given input field | [
"input_field_get_user_settings",
"-",
"return",
"the",
"current",
"settings",
"for",
"the",
"given",
"input",
"field"
] | [
"/* zap the entire structure */",
"/* copy the basics */",
"/* if there's a list of settings or we're an adjuster, copy the current value */",
"/* if there's analog data, extract the analog settings */"
] | [
{
"param": "field",
"type": "input_field_config"
},
{
"param": "settings",
"type": "input_field_user_settings"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": "input_field_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "settings",
"type": "input_field_user_settings",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_field_set_user_settings | void | void input_field_set_user_settings(const input_field_config *field, const input_field_user_settings *settings)
{
static const input_seq default_seq = SEQ_DEF_1(SEQCODE_DEFAULT);
int seqtype;
/* copy the basics */
for (seqtype = 0; seqtype < ARRAY_LENGTH(settings->seq); seqtype++)
{
const input_seq *defseq = input_type_seq(field->port->machine, field->type, field->player, (input_seq_type)seqtype);
if (input_seq_cmp(defseq, &settings->seq[seqtype]) == 0)
field->state->seq[seqtype] = default_seq;
else
field->state->seq[seqtype] = settings->seq[seqtype];
}
/* if there's a list of settings or we're an adjuster, copy the current value */
if (field->settinglist != NULL || field->type == IPT_ADJUSTER)
field->state->value = settings->value;
/* if there's analog data, extract the analog settings */
if (field->state->analog != NULL)
{
field->state->analog->sensitivity = settings->sensitivity;
field->state->analog->delta = settings->delta;
field->state->analog->centerdelta = settings->centerdelta;
field->state->analog->reverse = settings->reverse;
}
} | /*-------------------------------------------------
input_field_set_user_settings - modify the current
settings for the given input field
-------------------------------------------------*/ | modify the current
settings for the given input field | [
"modify",
"the",
"current",
"settings",
"for",
"the",
"given",
"input",
"field"
] | void input_field_set_user_settings(const input_field_config *field, const input_field_user_settings *settings)
{
static const input_seq default_seq = SEQ_DEF_1(SEQCODE_DEFAULT);
int seqtype;
for (seqtype = 0; seqtype < ARRAY_LENGTH(settings->seq); seqtype++)
{
const input_seq *defseq = input_type_seq(field->port->machine, field->type, field->player, (input_seq_type)seqtype);
if (input_seq_cmp(defseq, &settings->seq[seqtype]) == 0)
field->state->seq[seqtype] = default_seq;
else
field->state->seq[seqtype] = settings->seq[seqtype];
}
if (field->settinglist != NULL || field->type == IPT_ADJUSTER)
field->state->value = settings->value;
if (field->state->analog != NULL)
{
field->state->analog->sensitivity = settings->sensitivity;
field->state->analog->delta = settings->delta;
field->state->analog->centerdelta = settings->centerdelta;
field->state->analog->reverse = settings->reverse;
}
} | [
"void",
"input_field_set_user_settings",
"(",
"const",
"input_field_config",
"*",
"field",
",",
"const",
"input_field_user_settings",
"*",
"settings",
")",
"{",
"static",
"const",
"input_seq",
"default_seq",
"=",
"SEQ_DEF_1",
"(",
"SEQCODE_DEFAULT",
")",
";",
"int",
"seqtype",
";",
"for",
"(",
"seqtype",
"=",
"0",
";",
"seqtype",
"<",
"ARRAY_LENGTH",
"(",
"settings",
"->",
"seq",
")",
";",
"seqtype",
"++",
")",
"{",
"const",
"input_seq",
"*",
"defseq",
"=",
"input_type_seq",
"(",
"field",
"->",
"port",
"->",
"machine",
",",
"field",
"->",
"type",
",",
"field",
"->",
"player",
",",
"(",
"input_seq_type",
")",
"seqtype",
")",
";",
"if",
"(",
"input_seq_cmp",
"(",
"defseq",
",",
"&",
"settings",
"->",
"seq",
"[",
"seqtype",
"]",
")",
"==",
"0",
")",
"field",
"->",
"state",
"->",
"seq",
"[",
"seqtype",
"]",
"=",
"default_seq",
";",
"else",
"field",
"->",
"state",
"->",
"seq",
"[",
"seqtype",
"]",
"=",
"settings",
"->",
"seq",
"[",
"seqtype",
"]",
";",
"}",
"if",
"(",
"field",
"->",
"settinglist",
"!=",
"NULL",
"||",
"field",
"->",
"type",
"==",
"IPT_ADJUSTER",
")",
"field",
"->",
"state",
"->",
"value",
"=",
"settings",
"->",
"value",
";",
"if",
"(",
"field",
"->",
"state",
"->",
"analog",
"!=",
"NULL",
")",
"{",
"field",
"->",
"state",
"->",
"analog",
"->",
"sensitivity",
"=",
"settings",
"->",
"sensitivity",
";",
"field",
"->",
"state",
"->",
"analog",
"->",
"delta",
"=",
"settings",
"->",
"delta",
";",
"field",
"->",
"state",
"->",
"analog",
"->",
"centerdelta",
"=",
"settings",
"->",
"centerdelta",
";",
"field",
"->",
"state",
"->",
"analog",
"->",
"reverse",
"=",
"settings",
"->",
"reverse",
";",
"}",
"}"
] | input_field_set_user_settings - modify the current
settings for the given input field | [
"input_field_set_user_settings",
"-",
"modify",
"the",
"current",
"settings",
"for",
"the",
"given",
"input",
"field"
] | [
"/* copy the basics */",
"/* if there's a list of settings or we're an adjuster, copy the current value */",
"/* if there's analog data, extract the analog settings */"
] | [
{
"param": "field",
"type": "input_field_config"
},
{
"param": "settings",
"type": "input_field_user_settings"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": "input_field_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "settings",
"type": "input_field_user_settings",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_field_setting_name | char | const char *input_field_setting_name(const input_field_config *field)
{
const input_setting_config *setting;
/* only makes sense if we have settings */
assert(field->settinglist != NULL);
/* scan the list of settings looking for a match on the current value */
for (setting = field->settinglist; setting != NULL; setting = setting->next)
if (input_condition_true(field->port->machine, &setting->condition))
if (setting->value == field->state->value)
return setting->name;
return "INVALID";
} | /*-------------------------------------------------
input_field_setting_name - return the expanded
setting name for a field
-------------------------------------------------*/ | return the expanded
setting name for a field | [
"return",
"the",
"expanded",
"setting",
"name",
"for",
"a",
"field"
] | const char *input_field_setting_name(const input_field_config *field)
{
const input_setting_config *setting;
assert(field->settinglist != NULL);
for (setting = field->settinglist; setting != NULL; setting = setting->next)
if (input_condition_true(field->port->machine, &setting->condition))
if (setting->value == field->state->value)
return setting->name;
return "INVALID";
} | [
"const",
"char",
"*",
"input_field_setting_name",
"(",
"const",
"input_field_config",
"*",
"field",
")",
"{",
"const",
"input_setting_config",
"*",
"setting",
";",
"assert",
"(",
"field",
"->",
"settinglist",
"!=",
"NULL",
")",
";",
"for",
"(",
"setting",
"=",
"field",
"->",
"settinglist",
";",
"setting",
"!=",
"NULL",
";",
"setting",
"=",
"setting",
"->",
"next",
")",
"if",
"(",
"input_condition_true",
"(",
"field",
"->",
"port",
"->",
"machine",
",",
"&",
"setting",
"->",
"condition",
")",
")",
"if",
"(",
"setting",
"->",
"value",
"==",
"field",
"->",
"state",
"->",
"value",
")",
"return",
"setting",
"->",
"name",
";",
"return",
"\"",
"\"",
";",
"}"
] | input_field_setting_name - return the expanded
setting name for a field | [
"input_field_setting_name",
"-",
"return",
"the",
"expanded",
"setting",
"name",
"for",
"a",
"field"
] | [
"/* only makes sense if we have settings */",
"/* scan the list of settings looking for a match on the current value */"
] | [
{
"param": "field",
"type": "input_field_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": "input_field_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_field_has_previous_setting | int | int input_field_has_previous_setting(const input_field_config *field)
{
const input_setting_config *setting;
/* only makes sense if we have settings */
assert(field->settinglist != NULL);
/* scan the list of settings looking for a match on the current value */
for (setting = field->settinglist; setting != NULL; setting = setting->next)
if (input_condition_true(field->port->machine, &setting->condition))
return (setting->value != field->state->value);
return FALSE;
} | /*-------------------------------------------------
input_field_has_previous_setting - return TRUE
if the given field has a "previous" setting
-------------------------------------------------*/ | return TRUE
if the given field has a "previous" setting | [
"return",
"TRUE",
"if",
"the",
"given",
"field",
"has",
"a",
"\"",
"previous",
"\"",
"setting"
] | int input_field_has_previous_setting(const input_field_config *field)
{
const input_setting_config *setting;
assert(field->settinglist != NULL);
for (setting = field->settinglist; setting != NULL; setting = setting->next)
if (input_condition_true(field->port->machine, &setting->condition))
return (setting->value != field->state->value);
return FALSE;
} | [
"int",
"input_field_has_previous_setting",
"(",
"const",
"input_field_config",
"*",
"field",
")",
"{",
"const",
"input_setting_config",
"*",
"setting",
";",
"assert",
"(",
"field",
"->",
"settinglist",
"!=",
"NULL",
")",
";",
"for",
"(",
"setting",
"=",
"field",
"->",
"settinglist",
";",
"setting",
"!=",
"NULL",
";",
"setting",
"=",
"setting",
"->",
"next",
")",
"if",
"(",
"input_condition_true",
"(",
"field",
"->",
"port",
"->",
"machine",
",",
"&",
"setting",
"->",
"condition",
")",
")",
"return",
"(",
"setting",
"->",
"value",
"!=",
"field",
"->",
"state",
"->",
"value",
")",
";",
"return",
"FALSE",
";",
"}"
] | input_field_has_previous_setting - return TRUE
if the given field has a "previous" setting | [
"input_field_has_previous_setting",
"-",
"return",
"TRUE",
"if",
"the",
"given",
"field",
"has",
"a",
"\"",
"previous",
"\"",
"setting"
] | [
"/* only makes sense if we have settings */",
"/* scan the list of settings looking for a match on the current value */"
] | [
{
"param": "field",
"type": "input_field_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": "input_field_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_field_select_previous_setting | void | void input_field_select_previous_setting(const input_field_config *field)
{
const input_setting_config *setting, *prevsetting;
int found_match = FALSE;
/* only makes sense if we have settings */
assert(field->settinglist != NULL);
/* scan the list of settings looking for a match on the current value */
prevsetting = NULL;
for (setting = field->settinglist; setting != NULL; setting = setting->next)
if (input_condition_true(field->port->machine, &setting->condition))
{
if (setting->value == field->state->value)
{
found_match = TRUE;
if (prevsetting != NULL)
break;
}
prevsetting = setting;
}
/* if we didn't find a matching value, select the first */
if (!found_match)
{
for (prevsetting = field->settinglist; prevsetting != NULL; prevsetting = prevsetting->next)
if (input_condition_true(field->port->machine, &prevsetting->condition))
break;
}
/* update the value to the previous one */
if (prevsetting != NULL)
field->state->value = prevsetting->value;
} | /*-------------------------------------------------
input_field_select_previous_setting - select
the previous item for a DIP switch or
configuration field
-------------------------------------------------*/ | select
the previous item for a DIP switch or
configuration field | [
"select",
"the",
"previous",
"item",
"for",
"a",
"DIP",
"switch",
"or",
"configuration",
"field"
] | void input_field_select_previous_setting(const input_field_config *field)
{
const input_setting_config *setting, *prevsetting;
int found_match = FALSE;
assert(field->settinglist != NULL);
prevsetting = NULL;
for (setting = field->settinglist; setting != NULL; setting = setting->next)
if (input_condition_true(field->port->machine, &setting->condition))
{
if (setting->value == field->state->value)
{
found_match = TRUE;
if (prevsetting != NULL)
break;
}
prevsetting = setting;
}
if (!found_match)
{
for (prevsetting = field->settinglist; prevsetting != NULL; prevsetting = prevsetting->next)
if (input_condition_true(field->port->machine, &prevsetting->condition))
break;
}
if (prevsetting != NULL)
field->state->value = prevsetting->value;
} | [
"void",
"input_field_select_previous_setting",
"(",
"const",
"input_field_config",
"*",
"field",
")",
"{",
"const",
"input_setting_config",
"*",
"setting",
",",
"*",
"prevsetting",
";",
"int",
"found_match",
"=",
"FALSE",
";",
"assert",
"(",
"field",
"->",
"settinglist",
"!=",
"NULL",
")",
";",
"prevsetting",
"=",
"NULL",
";",
"for",
"(",
"setting",
"=",
"field",
"->",
"settinglist",
";",
"setting",
"!=",
"NULL",
";",
"setting",
"=",
"setting",
"->",
"next",
")",
"if",
"(",
"input_condition_true",
"(",
"field",
"->",
"port",
"->",
"machine",
",",
"&",
"setting",
"->",
"condition",
")",
")",
"{",
"if",
"(",
"setting",
"->",
"value",
"==",
"field",
"->",
"state",
"->",
"value",
")",
"{",
"found_match",
"=",
"TRUE",
";",
"if",
"(",
"prevsetting",
"!=",
"NULL",
")",
"break",
";",
"}",
"prevsetting",
"=",
"setting",
";",
"}",
"if",
"(",
"!",
"found_match",
")",
"{",
"for",
"(",
"prevsetting",
"=",
"field",
"->",
"settinglist",
";",
"prevsetting",
"!=",
"NULL",
";",
"prevsetting",
"=",
"prevsetting",
"->",
"next",
")",
"if",
"(",
"input_condition_true",
"(",
"field",
"->",
"port",
"->",
"machine",
",",
"&",
"prevsetting",
"->",
"condition",
")",
")",
"break",
";",
"}",
"if",
"(",
"prevsetting",
"!=",
"NULL",
")",
"field",
"->",
"state",
"->",
"value",
"=",
"prevsetting",
"->",
"value",
";",
"}"
] | input_field_select_previous_setting - select
the previous item for a DIP switch or
configuration field | [
"input_field_select_previous_setting",
"-",
"select",
"the",
"previous",
"item",
"for",
"a",
"DIP",
"switch",
"or",
"configuration",
"field"
] | [
"/* only makes sense if we have settings */",
"/* scan the list of settings looking for a match on the current value */",
"/* if we didn't find a matching value, select the first */",
"/* update the value to the previous one */"
] | [
{
"param": "field",
"type": "input_field_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": "input_field_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_field_has_next_setting | int | int input_field_has_next_setting(const input_field_config *field)
{
const input_setting_config *setting;
int found = FALSE;
/* only makes sense if we have settings */
assert(field->settinglist != NULL);
/* scan the list of settings looking for a match on the current value */
for (setting = field->settinglist; setting != NULL; setting = setting->next)
if (input_condition_true(field->port->machine, &setting->condition))
{
if (found)
return TRUE;
if (setting->value == field->state->value)
found = TRUE;
}
return FALSE;
} | /*-------------------------------------------------
input_field_has_next_setting - return TRUE
if the given field has a "next" setting
-------------------------------------------------*/ | return TRUE
if the given field has a "next" setting | [
"return",
"TRUE",
"if",
"the",
"given",
"field",
"has",
"a",
"\"",
"next",
"\"",
"setting"
] | int input_field_has_next_setting(const input_field_config *field)
{
const input_setting_config *setting;
int found = FALSE;
assert(field->settinglist != NULL);
for (setting = field->settinglist; setting != NULL; setting = setting->next)
if (input_condition_true(field->port->machine, &setting->condition))
{
if (found)
return TRUE;
if (setting->value == field->state->value)
found = TRUE;
}
return FALSE;
} | [
"int",
"input_field_has_next_setting",
"(",
"const",
"input_field_config",
"*",
"field",
")",
"{",
"const",
"input_setting_config",
"*",
"setting",
";",
"int",
"found",
"=",
"FALSE",
";",
"assert",
"(",
"field",
"->",
"settinglist",
"!=",
"NULL",
")",
";",
"for",
"(",
"setting",
"=",
"field",
"->",
"settinglist",
";",
"setting",
"!=",
"NULL",
";",
"setting",
"=",
"setting",
"->",
"next",
")",
"if",
"(",
"input_condition_true",
"(",
"field",
"->",
"port",
"->",
"machine",
",",
"&",
"setting",
"->",
"condition",
")",
")",
"{",
"if",
"(",
"found",
")",
"return",
"TRUE",
";",
"if",
"(",
"setting",
"->",
"value",
"==",
"field",
"->",
"state",
"->",
"value",
")",
"found",
"=",
"TRUE",
";",
"}",
"return",
"FALSE",
";",
"}"
] | input_field_has_next_setting - return TRUE
if the given field has a "next" setting | [
"input_field_has_next_setting",
"-",
"return",
"TRUE",
"if",
"the",
"given",
"field",
"has",
"a",
"\"",
"next",
"\"",
"setting"
] | [
"/* only makes sense if we have settings */",
"/* scan the list of settings looking for a match on the current value */"
] | [
{
"param": "field",
"type": "input_field_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": "input_field_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_field_select_next_setting | void | void input_field_select_next_setting(const input_field_config *field)
{
const input_setting_config *setting, *nextsetting;
/* only makes sense if we have settings */
assert(field->settinglist != NULL);
/* scan the list of settings looking for a match on the current value */
nextsetting = NULL;
for (setting = field->settinglist; setting != NULL; setting = setting->next)
if (input_condition_true(field->port->machine, &setting->condition))
if (setting->value == field->state->value)
break;
/* if we found one, scan forward for the next valid one */
if (setting != NULL)
for (nextsetting = setting->next; nextsetting != NULL; nextsetting = nextsetting->next)
if (input_condition_true(field->port->machine, &nextsetting->condition))
break;
/* if we hit the end, search from the beginning */
if (nextsetting == NULL)
for (nextsetting = field->settinglist; nextsetting != NULL; nextsetting = nextsetting->next)
if (input_condition_true(field->port->machine, &nextsetting->condition))
break;
/* update the value to the previous one */
if (nextsetting != NULL)
field->state->value = nextsetting->value;
} | /*-------------------------------------------------
input_field_select_next_setting - select the
next item for a DIP switch or
configuration field
-------------------------------------------------*/ | select the
next item for a DIP switch or
configuration field | [
"select",
"the",
"next",
"item",
"for",
"a",
"DIP",
"switch",
"or",
"configuration",
"field"
] | void input_field_select_next_setting(const input_field_config *field)
{
const input_setting_config *setting, *nextsetting;
assert(field->settinglist != NULL);
nextsetting = NULL;
for (setting = field->settinglist; setting != NULL; setting = setting->next)
if (input_condition_true(field->port->machine, &setting->condition))
if (setting->value == field->state->value)
break;
if (setting != NULL)
for (nextsetting = setting->next; nextsetting != NULL; nextsetting = nextsetting->next)
if (input_condition_true(field->port->machine, &nextsetting->condition))
break;
if (nextsetting == NULL)
for (nextsetting = field->settinglist; nextsetting != NULL; nextsetting = nextsetting->next)
if (input_condition_true(field->port->machine, &nextsetting->condition))
break;
if (nextsetting != NULL)
field->state->value = nextsetting->value;
} | [
"void",
"input_field_select_next_setting",
"(",
"const",
"input_field_config",
"*",
"field",
")",
"{",
"const",
"input_setting_config",
"*",
"setting",
",",
"*",
"nextsetting",
";",
"assert",
"(",
"field",
"->",
"settinglist",
"!=",
"NULL",
")",
";",
"nextsetting",
"=",
"NULL",
";",
"for",
"(",
"setting",
"=",
"field",
"->",
"settinglist",
";",
"setting",
"!=",
"NULL",
";",
"setting",
"=",
"setting",
"->",
"next",
")",
"if",
"(",
"input_condition_true",
"(",
"field",
"->",
"port",
"->",
"machine",
",",
"&",
"setting",
"->",
"condition",
")",
")",
"if",
"(",
"setting",
"->",
"value",
"==",
"field",
"->",
"state",
"->",
"value",
")",
"break",
";",
"if",
"(",
"setting",
"!=",
"NULL",
")",
"for",
"(",
"nextsetting",
"=",
"setting",
"->",
"next",
";",
"nextsetting",
"!=",
"NULL",
";",
"nextsetting",
"=",
"nextsetting",
"->",
"next",
")",
"if",
"(",
"input_condition_true",
"(",
"field",
"->",
"port",
"->",
"machine",
",",
"&",
"nextsetting",
"->",
"condition",
")",
")",
"break",
";",
"if",
"(",
"nextsetting",
"==",
"NULL",
")",
"for",
"(",
"nextsetting",
"=",
"field",
"->",
"settinglist",
";",
"nextsetting",
"!=",
"NULL",
";",
"nextsetting",
"=",
"nextsetting",
"->",
"next",
")",
"if",
"(",
"input_condition_true",
"(",
"field",
"->",
"port",
"->",
"machine",
",",
"&",
"nextsetting",
"->",
"condition",
")",
")",
"break",
";",
"if",
"(",
"nextsetting",
"!=",
"NULL",
")",
"field",
"->",
"state",
"->",
"value",
"=",
"nextsetting",
"->",
"value",
";",
"}"
] | input_field_select_next_setting - select the
next item for a DIP switch or
configuration field | [
"input_field_select_next_setting",
"-",
"select",
"the",
"next",
"item",
"for",
"a",
"DIP",
"switch",
"or",
"configuration",
"field"
] | [
"/* only makes sense if we have settings */",
"/* scan the list of settings looking for a match on the current value */",
"/* if we found one, scan forward for the next valid one */",
"/* if we hit the end, search from the beginning */",
"/* update the value to the previous one */"
] | [
{
"param": "field",
"type": "input_field_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": "input_field_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_type_name | char | const char *input_type_name(running_machine *machine, int type, int player)
{
/* if we have a machine, use the live state and quick lookup */
if (machine != NULL)
{
input_port_private *portdata = machine->input_port_data;
input_type_state *typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
return typestate->typedesc.name;
}
/* if no machine, fall back to brute force searching */
else
{
int typenum;
for (typenum = 0; typenum < ARRAY_LENGTH(core_types); typenum++)
if (core_types[typenum].type == type && core_types[typenum].player == player)
return core_types[typenum].name;
}
/* if we find nothing, return an invalid group */
return "???";
} | /*-------------------------------------------------
input_type_name - return the name
for the given type/player
-------------------------------------------------*/ | return the name
for the given type/player | [
"return",
"the",
"name",
"for",
"the",
"given",
"type",
"/",
"player"
] | const char *input_type_name(running_machine *machine, int type, int player)
{
if (machine != NULL)
{
input_port_private *portdata = machine->input_port_data;
input_type_state *typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
return typestate->typedesc.name;
}
else
{
int typenum;
for (typenum = 0; typenum < ARRAY_LENGTH(core_types); typenum++)
if (core_types[typenum].type == type && core_types[typenum].player == player)
return core_types[typenum].name;
}
return "???";
} | [
"const",
"char",
"*",
"input_type_name",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"type",
",",
"int",
"player",
")",
"{",
"if",
"(",
"machine",
"!=",
"NULL",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"input_type_state",
"*",
"typestate",
"=",
"portdata",
"->",
"type_to_typestate",
"[",
"type",
"]",
"[",
"player",
"]",
";",
"if",
"(",
"typestate",
"!=",
"NULL",
")",
"return",
"typestate",
"->",
"typedesc",
".",
"name",
";",
"}",
"else",
"{",
"int",
"typenum",
";",
"for",
"(",
"typenum",
"=",
"0",
";",
"typenum",
"<",
"ARRAY_LENGTH",
"(",
"core_types",
")",
";",
"typenum",
"++",
")",
"if",
"(",
"core_types",
"[",
"typenum",
"]",
".",
"type",
"==",
"type",
"&&",
"core_types",
"[",
"typenum",
"]",
".",
"player",
"==",
"player",
")",
"return",
"core_types",
"[",
"typenum",
"]",
".",
"name",
";",
"}",
"return",
"\"",
"\"",
";",
"}"
] | input_type_name - return the name
for the given type/player | [
"input_type_name",
"-",
"return",
"the",
"name",
"for",
"the",
"given",
"type",
"/",
"player"
] | [
"/* if we have a machine, use the live state and quick lookup */",
"/* if no machine, fall back to brute force searching */",
"/* if we find nothing, return an invalid group */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "type",
"type": "int"
},
{
"param": "player",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "player",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_type_group | int | int input_type_group(running_machine *machine, int type, int player)
{
/* if we have a machine, use the live state and quick lookup */
if (machine != NULL)
{
input_port_private *portdata = machine->input_port_data;
input_type_state *typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
return typestate->typedesc.group;
}
/* if no machine, fall back to brute force searching */
else
{
int typenum;
for (typenum = 0; typenum < ARRAY_LENGTH(core_types); typenum++)
if (core_types[typenum].type == type && core_types[typenum].player == player)
return core_types[typenum].group;
}
/* if we find nothing, return an invalid group */
return IPG_INVALID;
} | /*-------------------------------------------------
input_type_group - return the group
for the given type/player
-------------------------------------------------*/ | return the group
for the given type/player | [
"return",
"the",
"group",
"for",
"the",
"given",
"type",
"/",
"player"
] | int input_type_group(running_machine *machine, int type, int player)
{
if (machine != NULL)
{
input_port_private *portdata = machine->input_port_data;
input_type_state *typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
return typestate->typedesc.group;
}
else
{
int typenum;
for (typenum = 0; typenum < ARRAY_LENGTH(core_types); typenum++)
if (core_types[typenum].type == type && core_types[typenum].player == player)
return core_types[typenum].group;
}
return IPG_INVALID;
} | [
"int",
"input_type_group",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"type",
",",
"int",
"player",
")",
"{",
"if",
"(",
"machine",
"!=",
"NULL",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"input_type_state",
"*",
"typestate",
"=",
"portdata",
"->",
"type_to_typestate",
"[",
"type",
"]",
"[",
"player",
"]",
";",
"if",
"(",
"typestate",
"!=",
"NULL",
")",
"return",
"typestate",
"->",
"typedesc",
".",
"group",
";",
"}",
"else",
"{",
"int",
"typenum",
";",
"for",
"(",
"typenum",
"=",
"0",
";",
"typenum",
"<",
"ARRAY_LENGTH",
"(",
"core_types",
")",
";",
"typenum",
"++",
")",
"if",
"(",
"core_types",
"[",
"typenum",
"]",
".",
"type",
"==",
"type",
"&&",
"core_types",
"[",
"typenum",
"]",
".",
"player",
"==",
"player",
")",
"return",
"core_types",
"[",
"typenum",
"]",
".",
"group",
";",
"}",
"return",
"IPG_INVALID",
";",
"}"
] | input_type_group - return the group
for the given type/player | [
"input_type_group",
"-",
"return",
"the",
"group",
"for",
"the",
"given",
"type",
"/",
"player"
] | [
"/* if we have a machine, use the live state and quick lookup */",
"/* if no machine, fall back to brute force searching */",
"/* if we find nothing, return an invalid group */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "type",
"type": "int"
},
{
"param": "player",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "player",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_type_seq | input_seq | const input_seq *input_type_seq(running_machine *machine, int type, int player, input_seq_type seqtype)
{
static const input_seq ip_none = SEQ_DEF_0;
assert((type >= 0) && (type < __ipt_max));
assert((player >= 0) && (player < MAX_PLAYERS));
/* if we have a machine, use the live state and quick lookup */
if (machine != NULL)
{
input_port_private *portdata = machine->input_port_data;
input_type_state *typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
return &typestate->seq[seqtype];
}
/* if no machine, fall back to brute force searching */
else
{
int typenum;
for (typenum = 0; typenum < ARRAY_LENGTH(core_types); typenum++)
if (core_types[typenum].type == type && core_types[typenum].player == player)
return &core_types[typenum].seq[seqtype];
}
/* if we find nothing, return an empty sequence */
return &ip_none;
} | /*-------------------------------------------------
input_type_seq - return the input
sequence for the given type/player
-------------------------------------------------*/ | return the input
sequence for the given type/player | [
"return",
"the",
"input",
"sequence",
"for",
"the",
"given",
"type",
"/",
"player"
] | const input_seq *input_type_seq(running_machine *machine, int type, int player, input_seq_type seqtype)
{
static const input_seq ip_none = SEQ_DEF_0;
assert((type >= 0) && (type < __ipt_max));
assert((player >= 0) && (player < MAX_PLAYERS));
if (machine != NULL)
{
input_port_private *portdata = machine->input_port_data;
input_type_state *typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
return &typestate->seq[seqtype];
}
else
{
int typenum;
for (typenum = 0; typenum < ARRAY_LENGTH(core_types); typenum++)
if (core_types[typenum].type == type && core_types[typenum].player == player)
return &core_types[typenum].seq[seqtype];
}
return &ip_none;
} | [
"const",
"input_seq",
"*",
"input_type_seq",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"type",
",",
"int",
"player",
",",
"input_seq_type",
"seqtype",
")",
"{",
"static",
"const",
"input_seq",
"ip_none",
"=",
"SEQ_DEF_0",
";",
"assert",
"(",
"(",
"type",
">=",
"0",
")",
"&&",
"(",
"type",
"<",
"__ipt_max",
")",
")",
";",
"assert",
"(",
"(",
"player",
">=",
"0",
")",
"&&",
"(",
"player",
"<",
"MAX_PLAYERS",
")",
")",
";",
"if",
"(",
"machine",
"!=",
"NULL",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"input_type_state",
"*",
"typestate",
"=",
"portdata",
"->",
"type_to_typestate",
"[",
"type",
"]",
"[",
"player",
"]",
";",
"if",
"(",
"typestate",
"!=",
"NULL",
")",
"return",
"&",
"typestate",
"->",
"seq",
"[",
"seqtype",
"]",
";",
"}",
"else",
"{",
"int",
"typenum",
";",
"for",
"(",
"typenum",
"=",
"0",
";",
"typenum",
"<",
"ARRAY_LENGTH",
"(",
"core_types",
")",
";",
"typenum",
"++",
")",
"if",
"(",
"core_types",
"[",
"typenum",
"]",
".",
"type",
"==",
"type",
"&&",
"core_types",
"[",
"typenum",
"]",
".",
"player",
"==",
"player",
")",
"return",
"&",
"core_types",
"[",
"typenum",
"]",
".",
"seq",
"[",
"seqtype",
"]",
";",
"}",
"return",
"&",
"ip_none",
";",
"}"
] | input_type_seq - return the input
sequence for the given type/player | [
"input_type_seq",
"-",
"return",
"the",
"input",
"sequence",
"for",
"the",
"given",
"type",
"/",
"player"
] | [
"/* if we have a machine, use the live state and quick lookup */",
"/* if no machine, fall back to brute force searching */",
"/* if we find nothing, return an empty sequence */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "type",
"type": "int"
},
{
"param": "player",
"type": "int"
},
{
"param": "seqtype",
"type": "input_seq_type"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "player",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seqtype",
"type": "input_seq_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_type_set_seq | void | void input_type_set_seq(running_machine *machine, int type, int player, input_seq_type seqtype, const input_seq *newseq)
{
input_port_private *portdata = machine->input_port_data;
input_type_state *typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
typestate->seq[seqtype] = *newseq;
} | /*-------------------------------------------------
input_type_set_seq - change the input
sequence for the given type/player
-------------------------------------------------*/ | change the input
sequence for the given type/player | [
"change",
"the",
"input",
"sequence",
"for",
"the",
"given",
"type",
"/",
"player"
] | void input_type_set_seq(running_machine *machine, int type, int player, input_seq_type seqtype, const input_seq *newseq)
{
input_port_private *portdata = machine->input_port_data;
input_type_state *typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
typestate->seq[seqtype] = *newseq;
} | [
"void",
"input_type_set_seq",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"type",
",",
"int",
"player",
",",
"input_seq_type",
"seqtype",
",",
"const",
"input_seq",
"*",
"newseq",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"input_type_state",
"*",
"typestate",
"=",
"portdata",
"->",
"type_to_typestate",
"[",
"type",
"]",
"[",
"player",
"]",
";",
"if",
"(",
"typestate",
"!=",
"NULL",
")",
"typestate",
"->",
"seq",
"[",
"seqtype",
"]",
"=",
"*",
"newseq",
";",
"}"
] | input_type_set_seq - change the input
sequence for the given type/player | [
"input_type_set_seq",
"-",
"change",
"the",
"input",
"sequence",
"for",
"the",
"given",
"type",
"/",
"player"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "type",
"type": "int"
},
{
"param": "player",
"type": "int"
},
{
"param": "seqtype",
"type": "input_seq_type"
},
{
"param": "newseq",
"type": "input_seq"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "player",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seqtype",
"type": "input_seq_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "newseq",
"type": "input_seq",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_port_read_direct | input_port_value | input_port_value input_port_read_direct(const input_port_config *port)
{
input_port_private *portdata = port->machine->input_port_data;
analog_field_state *analog;
device_field_info *device_field;
input_port_value result;
assert_always(portdata->safe_to_read, "Input ports cannot be read at init time!");
/* start with the digital */
result = port->state->digital;
/* update custom values */
for (device_field = port->state->readdevicelist; device_field != NULL; device_field = device_field->next)
if (input_condition_true(port->machine, &device_field->field->condition))
{
/* replace the bits with bits from the device */
input_port_value newval = (*device_field->field->read_line_device)(device_field->device);
device_field->oldval = newval;
result = (result & ~device_field->field->mask) | ((newval << device_field->shift) & device_field->field->mask);
}
/* update VBLANK bits */
if (port->state->vblank != 0)
{
if (port->machine->primary_screen->vblank())
result |= port->state->vblank;
else
result &= ~port->state->vblank;
}
/* apply active high/low state to digital, custom, and VBLANK inputs */
result ^= port->state->defvalue;
/* merge in analog portions */
for (analog = port->state->analoglist; analog != NULL; analog = analog->next)
if (input_condition_true(port->machine, &analog->field->condition))
{
/* start with the raw value */
INT32 value = analog->accum;
/* interpolate if appropriate and if time has passed since the last update */
if (analog->interpolate && !(analog->field->flags & ANALOG_FLAG_RESET) && portdata->last_delta_nsec != 0)
{
attoseconds_t nsec_since_last = attotime_to_attoseconds(attotime_sub(timer_get_time(port->machine), portdata->last_frame_time)) / ATTOSECONDS_PER_NANOSECOND;
value = analog->previous + ((INT64)(analog->accum - analog->previous) * nsec_since_last / portdata->last_delta_nsec);
}
/* apply standard analog settings */
value = apply_analog_settings(value, analog);
/* remap the value if needed */
if (analog->field->remap_table != NULL)
value = analog->field->remap_table[value];
/* invert bits if needed */
if (analog->field->flags & ANALOG_FLAG_INVERT)
value = ~value;
/* insert into the port */
result = (result & ~analog->field->mask) | ((value << analog->shift) & analog->field->mask);
}
return result;
} | /*-------------------------------------------------
input_port_read_direct - return the value of
an input port
-------------------------------------------------*/ | return the value of
an input port | [
"return",
"the",
"value",
"of",
"an",
"input",
"port"
] | input_port_value input_port_read_direct(const input_port_config *port)
{
input_port_private *portdata = port->machine->input_port_data;
analog_field_state *analog;
device_field_info *device_field;
input_port_value result;
assert_always(portdata->safe_to_read, "Input ports cannot be read at init time!");
result = port->state->digital;
for (device_field = port->state->readdevicelist; device_field != NULL; device_field = device_field->next)
if (input_condition_true(port->machine, &device_field->field->condition))
{
input_port_value newval = (*device_field->field->read_line_device)(device_field->device);
device_field->oldval = newval;
result = (result & ~device_field->field->mask) | ((newval << device_field->shift) & device_field->field->mask);
}
if (port->state->vblank != 0)
{
if (port->machine->primary_screen->vblank())
result |= port->state->vblank;
else
result &= ~port->state->vblank;
}
result ^= port->state->defvalue;
for (analog = port->state->analoglist; analog != NULL; analog = analog->next)
if (input_condition_true(port->machine, &analog->field->condition))
{
INT32 value = analog->accum;
if (analog->interpolate && !(analog->field->flags & ANALOG_FLAG_RESET) && portdata->last_delta_nsec != 0)
{
attoseconds_t nsec_since_last = attotime_to_attoseconds(attotime_sub(timer_get_time(port->machine), portdata->last_frame_time)) / ATTOSECONDS_PER_NANOSECOND;
value = analog->previous + ((INT64)(analog->accum - analog->previous) * nsec_since_last / portdata->last_delta_nsec);
}
value = apply_analog_settings(value, analog);
if (analog->field->remap_table != NULL)
value = analog->field->remap_table[value];
if (analog->field->flags & ANALOG_FLAG_INVERT)
value = ~value;
result = (result & ~analog->field->mask) | ((value << analog->shift) & analog->field->mask);
}
return result;
} | [
"input_port_value",
"input_port_read_direct",
"(",
"const",
"input_port_config",
"*",
"port",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"port",
"->",
"machine",
"->",
"input_port_data",
";",
"analog_field_state",
"*",
"analog",
";",
"device_field_info",
"*",
"device_field",
";",
"input_port_value",
"result",
";",
"assert_always",
"(",
"portdata",
"->",
"safe_to_read",
",",
"\"",
"\"",
")",
";",
"result",
"=",
"port",
"->",
"state",
"->",
"digital",
";",
"for",
"(",
"device_field",
"=",
"port",
"->",
"state",
"->",
"readdevicelist",
";",
"device_field",
"!=",
"NULL",
";",
"device_field",
"=",
"device_field",
"->",
"next",
")",
"if",
"(",
"input_condition_true",
"(",
"port",
"->",
"machine",
",",
"&",
"device_field",
"->",
"field",
"->",
"condition",
")",
")",
"{",
"input_port_value",
"newval",
"=",
"(",
"*",
"device_field",
"->",
"field",
"->",
"read_line_device",
")",
"(",
"device_field",
"->",
"device",
")",
";",
"device_field",
"->",
"oldval",
"=",
"newval",
";",
"result",
"=",
"(",
"result",
"&",
"~",
"device_field",
"->",
"field",
"->",
"mask",
")",
"|",
"(",
"(",
"newval",
"<<",
"device_field",
"->",
"shift",
")",
"&",
"device_field",
"->",
"field",
"->",
"mask",
")",
";",
"}",
"if",
"(",
"port",
"->",
"state",
"->",
"vblank",
"!=",
"0",
")",
"{",
"if",
"(",
"port",
"->",
"machine",
"->",
"primary_screen",
"->",
"vblank",
"(",
")",
")",
"result",
"|=",
"port",
"->",
"state",
"->",
"vblank",
";",
"else",
"result",
"&=",
"~",
"port",
"->",
"state",
"->",
"vblank",
";",
"}",
"result",
"^=",
"port",
"->",
"state",
"->",
"defvalue",
";",
"for",
"(",
"analog",
"=",
"port",
"->",
"state",
"->",
"analoglist",
";",
"analog",
"!=",
"NULL",
";",
"analog",
"=",
"analog",
"->",
"next",
")",
"if",
"(",
"input_condition_true",
"(",
"port",
"->",
"machine",
",",
"&",
"analog",
"->",
"field",
"->",
"condition",
")",
")",
"{",
"INT32",
"value",
"=",
"analog",
"->",
"accum",
";",
"if",
"(",
"analog",
"->",
"interpolate",
"&&",
"!",
"(",
"analog",
"->",
"field",
"->",
"flags",
"&",
"ANALOG_FLAG_RESET",
")",
"&&",
"portdata",
"->",
"last_delta_nsec",
"!=",
"0",
")",
"{",
"attoseconds_t",
"nsec_since_last",
"=",
"attotime_to_attoseconds",
"(",
"attotime_sub",
"(",
"timer_get_time",
"(",
"port",
"->",
"machine",
")",
",",
"portdata",
"->",
"last_frame_time",
")",
")",
"/",
"ATTOSECONDS_PER_NANOSECOND",
";",
"value",
"=",
"analog",
"->",
"previous",
"+",
"(",
"(",
"INT64",
")",
"(",
"analog",
"->",
"accum",
"-",
"analog",
"->",
"previous",
")",
"*",
"nsec_since_last",
"/",
"portdata",
"->",
"last_delta_nsec",
")",
";",
"}",
"value",
"=",
"apply_analog_settings",
"(",
"value",
",",
"analog",
")",
";",
"if",
"(",
"analog",
"->",
"field",
"->",
"remap_table",
"!=",
"NULL",
")",
"value",
"=",
"analog",
"->",
"field",
"->",
"remap_table",
"[",
"value",
"]",
";",
"if",
"(",
"analog",
"->",
"field",
"->",
"flags",
"&",
"ANALOG_FLAG_INVERT",
")",
"value",
"=",
"~",
"value",
";",
"result",
"=",
"(",
"result",
"&",
"~",
"analog",
"->",
"field",
"->",
"mask",
")",
"|",
"(",
"(",
"value",
"<<",
"analog",
"->",
"shift",
")",
"&",
"analog",
"->",
"field",
"->",
"mask",
")",
";",
"}",
"return",
"result",
";",
"}"
] | input_port_read_direct - return the value of
an input port | [
"input_port_read_direct",
"-",
"return",
"the",
"value",
"of",
"an",
"input",
"port"
] | [
"/* start with the digital */",
"/* update custom values */",
"/* replace the bits with bits from the device */",
"/* update VBLANK bits */",
"/* apply active high/low state to digital, custom, and VBLANK inputs */",
"/* merge in analog portions */",
"/* start with the raw value */",
"/* interpolate if appropriate and if time has passed since the last update */",
"/* apply standard analog settings */",
"/* remap the value if needed */",
"/* invert bits if needed */",
"/* insert into the port */"
] | [
{
"param": "port",
"type": "input_port_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "port",
"type": "input_port_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_port_read | input_port_value | input_port_value input_port_read(running_machine *machine, const char *tag)
{
const input_port_config *port = machine->port(tag);
if (port == NULL)
fatalerror("Unable to locate input port '%s'", tag);
return input_port_read_direct(port);
} | /*-------------------------------------------------
input_port_read - return the value of
an input port specified by tag
-------------------------------------------------*/ | return the value of
an input port specified by tag | [
"return",
"the",
"value",
"of",
"an",
"input",
"port",
"specified",
"by",
"tag"
] | input_port_value input_port_read(running_machine *machine, const char *tag)
{
const input_port_config *port = machine->port(tag);
if (port == NULL)
fatalerror("Unable to locate input port '%s'", tag);
return input_port_read_direct(port);
} | [
"input_port_value",
"input_port_read",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"tag",
")",
"{",
"const",
"input_port_config",
"*",
"port",
"=",
"machine",
"->",
"port",
"(",
"tag",
")",
";",
"if",
"(",
"port",
"==",
"NULL",
")",
"fatalerror",
"(",
"\"",
"\"",
",",
"tag",
")",
";",
"return",
"input_port_read_direct",
"(",
"port",
")",
";",
"}"
] | input_port_read - return the value of
an input port specified by tag | [
"input_port_read",
"-",
"return",
"the",
"value",
"of",
"an",
"input",
"port",
"specified",
"by",
"tag"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "tag",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"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": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_port_read_safe | input_port_value | input_port_value input_port_read_safe(running_machine *machine, const char *tag, UINT32 defvalue)
{
const input_port_config *port = machine->port(tag);
return (port == NULL) ? defvalue : input_port_read_direct(port);
} | /*-------------------------------------------------
input_port_read_safe - return the value of
an input port specified by tag, or a default
value if the port does not exist
-------------------------------------------------*/ | return the value of
an input port specified by tag, or a default
value if the port does not exist | [
"return",
"the",
"value",
"of",
"an",
"input",
"port",
"specified",
"by",
"tag",
"or",
"a",
"default",
"value",
"if",
"the",
"port",
"does",
"not",
"exist"
] | input_port_value input_port_read_safe(running_machine *machine, const char *tag, UINT32 defvalue)
{
const input_port_config *port = machine->port(tag);
return (port == NULL) ? defvalue : input_port_read_direct(port);
} | [
"input_port_value",
"input_port_read_safe",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"tag",
",",
"UINT32",
"defvalue",
")",
"{",
"const",
"input_port_config",
"*",
"port",
"=",
"machine",
"->",
"port",
"(",
"tag",
")",
";",
"return",
"(",
"port",
"==",
"NULL",
")",
"?",
"defvalue",
":",
"input_port_read_direct",
"(",
"port",
")",
";",
"}"
] | input_port_read_safe - return the value of
an input port specified by tag, or a default
value if the port does not exist | [
"input_port_read_safe",
"-",
"return",
"the",
"value",
"of",
"an",
"input",
"port",
"specified",
"by",
"tag",
"or",
"a",
"default",
"value",
"if",
"the",
"port",
"does",
"not",
"exist"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "tag",
"type": "char"
},
{
"param": "defvalue",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "defvalue",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_port_get_crosshair_position | int | int input_port_get_crosshair_position(running_machine *machine, int player, float *x, float *y)
{
const input_port_config *port;
const input_field_config *field;
int gotx = FALSE, goty = FALSE;
/* read all the lightgun values */
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
for (field = port->fieldlist; field != NULL; field = field->next)
if (field->player == player && field->crossaxis != CROSSHAIR_AXIS_NONE)
if (input_condition_true(machine, &field->condition))
{
analog_field_state *analog = field->state->analog;
INT32 rawvalue = apply_analog_settings(analog->accum, analog) & (analog->field->mask >> analog->shift);
float value = (float)(rawvalue - field->state->analog->adjmin) / (float)(field->state->analog->adjmax - field->state->analog->adjmin);
/* apply the scale and offset */
if (field->crossscale < 0)
value = -(1.0 - value) * field->crossscale;
else
value *= field->crossscale;
value += field->crossoffset;
/* apply custom mapping if necessary */
if (field->crossmapper != NULL)
value = (*field->crossmapper)(field, value);
/* handle X axis */
if (field->crossaxis == CROSSHAIR_AXIS_X)
{
*x = value;
gotx = TRUE;
if (field->crossaltaxis != 0)
{
*y = field->crossaltaxis;
goty = TRUE;
}
}
/* handle Y axis */
else
{
*y = value;
goty = TRUE;
if (field->crossaltaxis != 0)
{
*x = field->crossaltaxis;
gotx = TRUE;
}
}
/* if we got both, stop */
if (gotx && goty)
break;
}
return (gotx && goty);
} | /*-------------------------------------------------
input_port_read_crosshair - return the
extracted crosshair values for the given
player
-------------------------------------------------*/ | return the
extracted crosshair values for the given
player | [
"return",
"the",
"extracted",
"crosshair",
"values",
"for",
"the",
"given",
"player"
] | int input_port_get_crosshair_position(running_machine *machine, int player, float *x, float *y)
{
const input_port_config *port;
const input_field_config *field;
int gotx = FALSE, goty = FALSE;
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
for (field = port->fieldlist; field != NULL; field = field->next)
if (field->player == player && field->crossaxis != CROSSHAIR_AXIS_NONE)
if (input_condition_true(machine, &field->condition))
{
analog_field_state *analog = field->state->analog;
INT32 rawvalue = apply_analog_settings(analog->accum, analog) & (analog->field->mask >> analog->shift);
float value = (float)(rawvalue - field->state->analog->adjmin) / (float)(field->state->analog->adjmax - field->state->analog->adjmin);
if (field->crossscale < 0)
value = -(1.0 - value) * field->crossscale;
else
value *= field->crossscale;
value += field->crossoffset;
if (field->crossmapper != NULL)
value = (*field->crossmapper)(field, value);
if (field->crossaxis == CROSSHAIR_AXIS_X)
{
*x = value;
gotx = TRUE;
if (field->crossaltaxis != 0)
{
*y = field->crossaltaxis;
goty = TRUE;
}
}
else
{
*y = value;
goty = TRUE;
if (field->crossaltaxis != 0)
{
*x = field->crossaltaxis;
gotx = TRUE;
}
}
if (gotx && goty)
break;
}
return (gotx && goty);
} | [
"int",
"input_port_get_crosshair_position",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"player",
",",
"float",
"*",
"x",
",",
"float",
"*",
"y",
")",
"{",
"const",
"input_port_config",
"*",
"port",
";",
"const",
"input_field_config",
"*",
"field",
";",
"int",
"gotx",
"=",
"FALSE",
",",
"goty",
"=",
"FALSE",
";",
"for",
"(",
"port",
"=",
"machine",
"->",
"m_portlist",
".",
"first",
"(",
")",
";",
"port",
"!=",
"NULL",
";",
"port",
"=",
"port",
"->",
"next",
"(",
")",
")",
"for",
"(",
"field",
"=",
"port",
"->",
"fieldlist",
";",
"field",
"!=",
"NULL",
";",
"field",
"=",
"field",
"->",
"next",
")",
"if",
"(",
"field",
"->",
"player",
"==",
"player",
"&&",
"field",
"->",
"crossaxis",
"!=",
"CROSSHAIR_AXIS_NONE",
")",
"if",
"(",
"input_condition_true",
"(",
"machine",
",",
"&",
"field",
"->",
"condition",
")",
")",
"{",
"analog_field_state",
"*",
"analog",
"=",
"field",
"->",
"state",
"->",
"analog",
";",
"INT32",
"rawvalue",
"=",
"apply_analog_settings",
"(",
"analog",
"->",
"accum",
",",
"analog",
")",
"&",
"(",
"analog",
"->",
"field",
"->",
"mask",
">>",
"analog",
"->",
"shift",
")",
";",
"float",
"value",
"=",
"(",
"float",
")",
"(",
"rawvalue",
"-",
"field",
"->",
"state",
"->",
"analog",
"->",
"adjmin",
")",
"/",
"(",
"float",
")",
"(",
"field",
"->",
"state",
"->",
"analog",
"->",
"adjmax",
"-",
"field",
"->",
"state",
"->",
"analog",
"->",
"adjmin",
")",
";",
"if",
"(",
"field",
"->",
"crossscale",
"<",
"0",
")",
"value",
"=",
"-",
"(",
"1.0",
"-",
"value",
")",
"*",
"field",
"->",
"crossscale",
";",
"else",
"value",
"*=",
"field",
"->",
"crossscale",
";",
"value",
"+=",
"field",
"->",
"crossoffset",
";",
"if",
"(",
"field",
"->",
"crossmapper",
"!=",
"NULL",
")",
"value",
"=",
"(",
"*",
"field",
"->",
"crossmapper",
")",
"(",
"field",
",",
"value",
")",
";",
"if",
"(",
"field",
"->",
"crossaxis",
"==",
"CROSSHAIR_AXIS_X",
")",
"{",
"*",
"x",
"=",
"value",
";",
"gotx",
"=",
"TRUE",
";",
"if",
"(",
"field",
"->",
"crossaltaxis",
"!=",
"0",
")",
"{",
"*",
"y",
"=",
"field",
"->",
"crossaltaxis",
";",
"goty",
"=",
"TRUE",
";",
"}",
"}",
"else",
"{",
"*",
"y",
"=",
"value",
";",
"goty",
"=",
"TRUE",
";",
"if",
"(",
"field",
"->",
"crossaltaxis",
"!=",
"0",
")",
"{",
"*",
"x",
"=",
"field",
"->",
"crossaltaxis",
";",
"gotx",
"=",
"TRUE",
";",
"}",
"}",
"if",
"(",
"gotx",
"&&",
"goty",
")",
"break",
";",
"}",
"return",
"(",
"gotx",
"&&",
"goty",
")",
";",
"}"
] | input_port_read_crosshair - return the
extracted crosshair values for the given
player | [
"input_port_read_crosshair",
"-",
"return",
"the",
"extracted",
"crosshair",
"values",
"for",
"the",
"given",
"player"
] | [
"/* read all the lightgun values */",
"/* apply the scale and offset */",
"/* apply custom mapping if necessary */",
"/* handle X axis */",
"/* handle Y axis */",
"/* if we got both, stop */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "player",
"type": "int"
},
{
"param": "x",
"type": "float"
},
{
"param": "y",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "player",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_port_update_defaults | void | void input_port_update_defaults(running_machine *machine)
{
int loopnum;
/* two passes to catch conditionals properly */
for (loopnum = 0; loopnum < 2; loopnum++)
{
const input_port_config *port;
/* loop over all input ports */
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
{
const input_field_config *field;
/* only clear on the first pass */
if (loopnum == 0)
port->state->defvalue = 0;
/* first compute the default value for the entire port */
for (field = port->fieldlist; field != NULL; field = field->next)
if (input_condition_true(machine, &field->condition))
port->state->defvalue = (port->state->defvalue & ~field->mask) | (field->state->value & field->mask);
}
}
} | /*-------------------------------------------------
input_port_update_defaults - force an update
to the input port values based on current
conditions
-------------------------------------------------*/ | force an update
to the input port values based on current
conditions | [
"force",
"an",
"update",
"to",
"the",
"input",
"port",
"values",
"based",
"on",
"current",
"conditions"
] | void input_port_update_defaults(running_machine *machine)
{
int loopnum;
for (loopnum = 0; loopnum < 2; loopnum++)
{
const input_port_config *port;
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
{
const input_field_config *field;
if (loopnum == 0)
port->state->defvalue = 0;
for (field = port->fieldlist; field != NULL; field = field->next)
if (input_condition_true(machine, &field->condition))
port->state->defvalue = (port->state->defvalue & ~field->mask) | (field->state->value & field->mask);
}
}
} | [
"void",
"input_port_update_defaults",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"int",
"loopnum",
";",
"for",
"(",
"loopnum",
"=",
"0",
";",
"loopnum",
"<",
"2",
";",
"loopnum",
"++",
")",
"{",
"const",
"input_port_config",
"*",
"port",
";",
"for",
"(",
"port",
"=",
"machine",
"->",
"m_portlist",
".",
"first",
"(",
")",
";",
"port",
"!=",
"NULL",
";",
"port",
"=",
"port",
"->",
"next",
"(",
")",
")",
"{",
"const",
"input_field_config",
"*",
"field",
";",
"if",
"(",
"loopnum",
"==",
"0",
")",
"port",
"->",
"state",
"->",
"defvalue",
"=",
"0",
";",
"for",
"(",
"field",
"=",
"port",
"->",
"fieldlist",
";",
"field",
"!=",
"NULL",
";",
"field",
"=",
"field",
"->",
"next",
")",
"if",
"(",
"input_condition_true",
"(",
"machine",
",",
"&",
"field",
"->",
"condition",
")",
")",
"port",
"->",
"state",
"->",
"defvalue",
"=",
"(",
"port",
"->",
"state",
"->",
"defvalue",
"&",
"~",
"field",
"->",
"mask",
")",
"|",
"(",
"field",
"->",
"state",
"->",
"value",
"&",
"field",
"->",
"mask",
")",
";",
"}",
"}",
"}"
] | input_port_update_defaults - force an update
to the input port values based on current
conditions | [
"input_port_update_defaults",
"-",
"force",
"an",
"update",
"to",
"the",
"input",
"port",
"values",
"based",
"on",
"current",
"conditions"
] | [
"/* two passes to catch conditionals properly */",
"/* loop over all input ports */",
"/* only clear on the first pass */",
"/* first compute the default value for the entire port */"
] | [
{
"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": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_port_write_direct | void | void input_port_write_direct(const input_port_config *port, input_port_value data, input_port_value mem_mask)
{
/* call device line changed handlers */
device_field_info *device_field;
COMBINE_DATA(&port->state->outputvalue);
for (device_field = port->state->writedevicelist; device_field; device_field = device_field->next)
if (device_field->field->type == IPT_OUTPUT && input_condition_true(port->machine, &device_field->field->condition))
{
input_port_value newval = ( (port->state->outputvalue ^ device_field->field->defvalue ) & device_field->field->mask) >> device_field->shift;
/* if the bits have changed, call the handler */
if (device_field->oldval != newval)
{
(*device_field->field->write_line_device)(device_field->device, newval);
device_field->oldval = newval;
}
}
} | /*-------------------------------------------------
input_port_write_direct - write a value
to a port
-------------------------------------------------*/ | write a value
to a port | [
"write",
"a",
"value",
"to",
"a",
"port"
] | void input_port_write_direct(const input_port_config *port, input_port_value data, input_port_value mem_mask)
{
device_field_info *device_field;
COMBINE_DATA(&port->state->outputvalue);
for (device_field = port->state->writedevicelist; device_field; device_field = device_field->next)
if (device_field->field->type == IPT_OUTPUT && input_condition_true(port->machine, &device_field->field->condition))
{
input_port_value newval = ( (port->state->outputvalue ^ device_field->field->defvalue ) & device_field->field->mask) >> device_field->shift;
if (device_field->oldval != newval)
{
(*device_field->field->write_line_device)(device_field->device, newval);
device_field->oldval = newval;
}
}
} | [
"void",
"input_port_write_direct",
"(",
"const",
"input_port_config",
"*",
"port",
",",
"input_port_value",
"data",
",",
"input_port_value",
"mem_mask",
")",
"{",
"device_field_info",
"*",
"device_field",
";",
"COMBINE_DATA",
"(",
"&",
"port",
"->",
"state",
"->",
"outputvalue",
")",
";",
"for",
"(",
"device_field",
"=",
"port",
"->",
"state",
"->",
"writedevicelist",
";",
"device_field",
";",
"device_field",
"=",
"device_field",
"->",
"next",
")",
"if",
"(",
"device_field",
"->",
"field",
"->",
"type",
"==",
"IPT_OUTPUT",
"&&",
"input_condition_true",
"(",
"port",
"->",
"machine",
",",
"&",
"device_field",
"->",
"field",
"->",
"condition",
")",
")",
"{",
"input_port_value",
"newval",
"=",
"(",
"(",
"port",
"->",
"state",
"->",
"outputvalue",
"^",
"device_field",
"->",
"field",
"->",
"defvalue",
")",
"&",
"device_field",
"->",
"field",
"->",
"mask",
")",
">>",
"device_field",
"->",
"shift",
";",
"if",
"(",
"device_field",
"->",
"oldval",
"!=",
"newval",
")",
"{",
"(",
"*",
"device_field",
"->",
"field",
"->",
"write_line_device",
")",
"(",
"device_field",
"->",
"device",
",",
"newval",
")",
";",
"device_field",
"->",
"oldval",
"=",
"newval",
";",
"}",
"}",
"}"
] | input_port_write_direct - write a value
to a port | [
"input_port_write_direct",
"-",
"write",
"a",
"value",
"to",
"a",
"port"
] | [
"/* call device line changed handlers */",
"/* if the bits have changed, call the handler */"
] | [
{
"param": "port",
"type": "input_port_config"
},
{
"param": "data",
"type": "input_port_value"
},
{
"param": "mem_mask",
"type": "input_port_value"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "port",
"type": "input_port_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "input_port_value",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mem_mask",
"type": "input_port_value",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_port_write | void | void input_port_write(running_machine *machine, const char *tag, input_port_value value, input_port_value mask)
{
const input_port_config *port = machine->port(tag);
if (port == NULL)
fatalerror("Unable to locate input port '%s'", tag);
input_port_write_direct(port, value, mask);
} | /*-------------------------------------------------
input_port_write - write a value to a
port specified by tag
-------------------------------------------------*/ | write a value to a
port specified by tag | [
"write",
"a",
"value",
"to",
"a",
"port",
"specified",
"by",
"tag"
] | void input_port_write(running_machine *machine, const char *tag, input_port_value value, input_port_value mask)
{
const input_port_config *port = machine->port(tag);
if (port == NULL)
fatalerror("Unable to locate input port '%s'", tag);
input_port_write_direct(port, value, mask);
} | [
"void",
"input_port_write",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"tag",
",",
"input_port_value",
"value",
",",
"input_port_value",
"mask",
")",
"{",
"const",
"input_port_config",
"*",
"port",
"=",
"machine",
"->",
"port",
"(",
"tag",
")",
";",
"if",
"(",
"port",
"==",
"NULL",
")",
"fatalerror",
"(",
"\"",
"\"",
",",
"tag",
")",
";",
"input_port_write_direct",
"(",
"port",
",",
"value",
",",
"mask",
")",
";",
"}"
] | input_port_write - write a value to a
port specified by tag | [
"input_port_write",
"-",
"write",
"a",
"value",
"to",
"a",
"port",
"specified",
"by",
"tag"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "tag",
"type": "char"
},
{
"param": "value",
"type": "input_port_value"
},
{
"param": "mask",
"type": "input_port_value"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "input_port_value",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mask",
"type": "input_port_value",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_port_write_safe | void | void input_port_write_safe(running_machine *machine, const char *tag, input_port_value value, input_port_value mask)
{
const input_port_config *port = machine->port(tag);
if (port != NULL)
input_port_write_direct(port, value, mask);
} | /*-------------------------------------------------
input_port_write_safe - write a value to
a port, ignore if the port does not exist
-------------------------------------------------*/ | write a value to
a port, ignore if the port does not exist | [
"write",
"a",
"value",
"to",
"a",
"port",
"ignore",
"if",
"the",
"port",
"does",
"not",
"exist"
] | void input_port_write_safe(running_machine *machine, const char *tag, input_port_value value, input_port_value mask)
{
const input_port_config *port = machine->port(tag);
if (port != NULL)
input_port_write_direct(port, value, mask);
} | [
"void",
"input_port_write_safe",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"tag",
",",
"input_port_value",
"value",
",",
"input_port_value",
"mask",
")",
"{",
"const",
"input_port_config",
"*",
"port",
"=",
"machine",
"->",
"port",
"(",
"tag",
")",
";",
"if",
"(",
"port",
"!=",
"NULL",
")",
"input_port_write_direct",
"(",
"port",
",",
"value",
",",
"mask",
")",
";",
"}"
] | input_port_write_safe - write a value to
a port, ignore if the port does not exist | [
"input_port_write_safe",
"-",
"write",
"a",
"value",
"to",
"a",
"port",
"ignore",
"if",
"the",
"port",
"does",
"not",
"exist"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "tag",
"type": "char"
},
{
"param": "value",
"type": "input_port_value"
},
{
"param": "mask",
"type": "input_port_value"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "input_port_value",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mask",
"type": "input_port_value",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_condition_true | int | int input_condition_true(running_machine *machine, const input_condition *condition)
{
input_port_value condvalue;
/* always condition is always true */
if (condition->condition == PORTCOND_ALWAYS)
return TRUE;
/* otherwise, read the referenced port */
condvalue = input_port_read(machine, condition->tag);
/* based on the condition encoded, determine truth */
switch (condition->condition)
{
case PORTCOND_EQUALS:
return ((condvalue & condition->mask) == condition->value);
case PORTCOND_NOTEQUALS:
return ((condvalue & condition->mask) != condition->value);
case PORTCOND_GREATERTHAN:
return ((condvalue & condition->mask) > condition->value);
case PORTCOND_NOTGREATERTHAN:
return ((condvalue & condition->mask) <= condition->value);
case PORTCOND_LESSTHAN:
return ((condvalue & condition->mask) < condition->value);
case PORTCOND_NOTLESSTHAN:
return ((condvalue & condition->mask) >= condition->value);
}
return TRUE;
} | /*-------------------------------------------------
input_condition_true - return the TRUE
if the given condition attached is true
-------------------------------------------------*/ | return the TRUE
if the given condition attached is true | [
"return",
"the",
"TRUE",
"if",
"the",
"given",
"condition",
"attached",
"is",
"true"
] | int input_condition_true(running_machine *machine, const input_condition *condition)
{
input_port_value condvalue;
if (condition->condition == PORTCOND_ALWAYS)
return TRUE;
condvalue = input_port_read(machine, condition->tag);
switch (condition->condition)
{
case PORTCOND_EQUALS:
return ((condvalue & condition->mask) == condition->value);
case PORTCOND_NOTEQUALS:
return ((condvalue & condition->mask) != condition->value);
case PORTCOND_GREATERTHAN:
return ((condvalue & condition->mask) > condition->value);
case PORTCOND_NOTGREATERTHAN:
return ((condvalue & condition->mask) <= condition->value);
case PORTCOND_LESSTHAN:
return ((condvalue & condition->mask) < condition->value);
case PORTCOND_NOTLESSTHAN:
return ((condvalue & condition->mask) >= condition->value);
}
return TRUE;
} | [
"int",
"input_condition_true",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"input_condition",
"*",
"condition",
")",
"{",
"input_port_value",
"condvalue",
";",
"if",
"(",
"condition",
"->",
"condition",
"==",
"PORTCOND_ALWAYS",
")",
"return",
"TRUE",
";",
"condvalue",
"=",
"input_port_read",
"(",
"machine",
",",
"condition",
"->",
"tag",
")",
";",
"switch",
"(",
"condition",
"->",
"condition",
")",
"{",
"case",
"PORTCOND_EQUALS",
":",
"return",
"(",
"(",
"condvalue",
"&",
"condition",
"->",
"mask",
")",
"==",
"condition",
"->",
"value",
")",
";",
"case",
"PORTCOND_NOTEQUALS",
":",
"return",
"(",
"(",
"condvalue",
"&",
"condition",
"->",
"mask",
")",
"!=",
"condition",
"->",
"value",
")",
";",
"case",
"PORTCOND_GREATERTHAN",
":",
"return",
"(",
"(",
"condvalue",
"&",
"condition",
"->",
"mask",
")",
">",
"condition",
"->",
"value",
")",
";",
"case",
"PORTCOND_NOTGREATERTHAN",
":",
"return",
"(",
"(",
"condvalue",
"&",
"condition",
"->",
"mask",
")",
"<=",
"condition",
"->",
"value",
")",
";",
"case",
"PORTCOND_LESSTHAN",
":",
"return",
"(",
"(",
"condvalue",
"&",
"condition",
"->",
"mask",
")",
"<",
"condition",
"->",
"value",
")",
";",
"case",
"PORTCOND_NOTLESSTHAN",
":",
"return",
"(",
"(",
"condvalue",
"&",
"condition",
"->",
"mask",
")",
">=",
"condition",
"->",
"value",
")",
";",
"}",
"return",
"TRUE",
";",
"}"
] | input_condition_true - return the TRUE
if the given condition attached is true | [
"input_condition_true",
"-",
"return",
"the",
"TRUE",
"if",
"the",
"given",
"condition",
"attached",
"is",
"true"
] | [
"/* always condition is always true */",
"/* otherwise, read the referenced port */",
"/* based on the condition encoded, determine truth */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "condition",
"type": "input_condition"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "condition",
"type": "input_condition",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_port_string_from_token | char | const char *input_port_string_from_token(const input_port_token token)
{
int index;
/* 0 is an invalid index */
if (token.i == 0)
return NULL;
/* if the index is greater than the count, assume it to be a pointer */
if (token.i >= INPUT_STRING_COUNT)
return token.stringptr;
/* otherwise, scan the list for a matching string and return it */
for (index = 0; index < ARRAY_LENGTH(input_port_default_strings); index++)
if (input_port_default_strings[index].id == token.i)
return input_port_default_strings[index].string;
return "(Unknown Default)";
} | /*-------------------------------------------------
input_port_string_from_token - convert an
input_port_token to a default string
-------------------------------------------------*/ | convert an
input_port_token to a default string | [
"convert",
"an",
"input_port_token",
"to",
"a",
"default",
"string"
] | const char *input_port_string_from_token(const input_port_token token)
{
int index;
if (token.i == 0)
return NULL;
if (token.i >= INPUT_STRING_COUNT)
return token.stringptr;
for (index = 0; index < ARRAY_LENGTH(input_port_default_strings); index++)
if (input_port_default_strings[index].id == token.i)
return input_port_default_strings[index].string;
return "(Unknown Default)";
} | [
"const",
"char",
"*",
"input_port_string_from_token",
"(",
"const",
"input_port_token",
"token",
")",
"{",
"int",
"index",
";",
"if",
"(",
"token",
".",
"i",
"==",
"0",
")",
"return",
"NULL",
";",
"if",
"(",
"token",
".",
"i",
">=",
"INPUT_STRING_COUNT",
")",
"return",
"token",
".",
"stringptr",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"ARRAY_LENGTH",
"(",
"input_port_default_strings",
")",
";",
"index",
"++",
")",
"if",
"(",
"input_port_default_strings",
"[",
"index",
"]",
".",
"id",
"==",
"token",
".",
"i",
")",
"return",
"input_port_default_strings",
"[",
"index",
"]",
".",
"string",
";",
"return",
"\"",
"\"",
";",
"}"
] | input_port_string_from_token - convert an
input_port_token to a default string | [
"input_port_string_from_token",
"-",
"convert",
"an",
"input_port_token",
"to",
"a",
"default",
"string"
] | [
"/* 0 is an invalid index */",
"/* if the index is greater than the count, assume it to be a pointer */",
"/* otherwise, scan the list for a matching string and return it */"
] | [
{
"param": "token",
"type": "input_port_token"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "token",
"type": "input_port_token",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | find_charinfo | char_info | static const char_info *find_charinfo(unicode_char target_char)
{
int low = 0;
int high = ARRAY_LENGTH(charinfo);
int i;
unicode_char ch;
/* perform a simple binary search to find the proper alternate */
while(high > low)
{
i = (high + low) / 2;
ch = charinfo[i].ch;
if (ch < target_char)
low = i + 1;
else if (ch > target_char)
high = i;
else
return &charinfo[i];
}
return NULL;
} | /*-------------------------------------------------
find_charinfo - looks up information about a
particular character
-------------------------------------------------*/ | looks up information about a
particular character | [
"looks",
"up",
"information",
"about",
"a",
"particular",
"character"
] | static const char_info *find_charinfo(unicode_char target_char)
{
int low = 0;
int high = ARRAY_LENGTH(charinfo);
int i;
unicode_char ch;
while(high > low)
{
i = (high + low) / 2;
ch = charinfo[i].ch;
if (ch < target_char)
low = i + 1;
else if (ch > target_char)
high = i;
else
return &charinfo[i];
}
return NULL;
} | [
"static",
"const",
"char_info",
"*",
"find_charinfo",
"(",
"unicode_char",
"target_char",
")",
"{",
"int",
"low",
"=",
"0",
";",
"int",
"high",
"=",
"ARRAY_LENGTH",
"(",
"charinfo",
")",
";",
"int",
"i",
";",
"unicode_char",
"ch",
";",
"while",
"(",
"high",
">",
"low",
")",
"{",
"i",
"=",
"(",
"high",
"+",
"low",
")",
"/",
"2",
";",
"ch",
"=",
"charinfo",
"[",
"i",
"]",
".",
"ch",
";",
"if",
"(",
"ch",
"<",
"target_char",
")",
"low",
"=",
"i",
"+",
"1",
";",
"else",
"if",
"(",
"ch",
">",
"target_char",
")",
"high",
"=",
"i",
";",
"else",
"return",
"&",
"charinfo",
"[",
"i",
"]",
";",
"}",
"return",
"NULL",
";",
"}"
] | find_charinfo - looks up information about a
particular character | [
"find_charinfo",
"-",
"looks",
"up",
"information",
"about",
"a",
"particular",
"character"
] | [
"/* perform a simple binary search to find the proper alternate */"
] | [
{
"param": "target_char",
"type": "unicode_char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "target_char",
"type": "unicode_char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | inputx_key_name | char | static const char *inputx_key_name(unicode_char ch)
{
static char buf[UTF8_CHAR_MAX + 1];
const char_info *ci;
const char *result;
int pos;
ci = find_charinfo(ch);
result = ci ? ci->name : NULL;
if (ci && ci->name)
{
result = ci->name;
}
else
{
if ((ch > 0x7F) || isprint(ch))
{
pos = utf8_from_uchar(buf, ARRAY_LENGTH(buf), ch);
buf[pos] = '\0';
result = buf;
}
else
result = "???";
}
return result;
} | /*-------------------------------------------------
inputx_key_name - returns the name of a
specific key
-------------------------------------------------*/ | returns the name of a
specific key | [
"returns",
"the",
"name",
"of",
"a",
"specific",
"key"
] | static const char *inputx_key_name(unicode_char ch)
{
static char buf[UTF8_CHAR_MAX + 1];
const char_info *ci;
const char *result;
int pos;
ci = find_charinfo(ch);
result = ci ? ci->name : NULL;
if (ci && ci->name)
{
result = ci->name;
}
else
{
if ((ch > 0x7F) || isprint(ch))
{
pos = utf8_from_uchar(buf, ARRAY_LENGTH(buf), ch);
buf[pos] = '\0';
result = buf;
}
else
result = "???";
}
return result;
} | [
"static",
"const",
"char",
"*",
"inputx_key_name",
"(",
"unicode_char",
"ch",
")",
"{",
"static",
"char",
"buf",
"[",
"UTF8_CHAR_MAX",
"+",
"1",
"]",
";",
"const",
"char_info",
"*",
"ci",
";",
"const",
"char",
"*",
"result",
";",
"int",
"pos",
";",
"ci",
"=",
"find_charinfo",
"(",
"ch",
")",
";",
"result",
"=",
"ci",
"?",
"ci",
"->",
"name",
":",
"NULL",
";",
"if",
"(",
"ci",
"&&",
"ci",
"->",
"name",
")",
"{",
"result",
"=",
"ci",
"->",
"name",
";",
"}",
"else",
"{",
"if",
"(",
"(",
"ch",
">",
"0x7F",
")",
"||",
"isprint",
"(",
"ch",
")",
")",
"{",
"pos",
"=",
"utf8_from_uchar",
"(",
"buf",
",",
"ARRAY_LENGTH",
"(",
"buf",
")",
",",
"ch",
")",
";",
"buf",
"[",
"pos",
"]",
"=",
"'",
"\\0",
"'",
";",
"result",
"=",
"buf",
";",
"}",
"else",
"result",
"=",
"\"",
"\"",
";",
"}",
"return",
"result",
";",
"}"
] | inputx_key_name - returns the name of a
specific key | [
"inputx_key_name",
"-",
"returns",
"the",
"name",
"of",
"a",
"specific",
"key"
] | [] | [
{
"param": "ch",
"type": "unicode_char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ch",
"type": "unicode_char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | init_port_state | void | static void init_port_state(running_machine *machine)
{
const char *joystick_map_default = options_get_string(machine->options(), OPTION_JOYSTICK_MAP);
input_port_private *portdata = machine->input_port_data;
const input_field_config *field;
const input_port_config *port;
/* allocate live structures to mirror the configuration */
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
{
analog_field_state **analogstatetail;
device_field_info **readdevicetail;
device_field_info **writedevicetail;
input_port_state *portstate;
/* allocate a new input_port_info structure */
portstate = auto_alloc_clear(machine, input_port_state);
((input_port_config *)port)->state = portstate;
((input_port_config *)port)->machine = machine;
/* start with tail pointers to all the data */
analogstatetail = &portstate->analoglist;
readdevicetail = &portstate->readdevicelist;
writedevicetail = &portstate->writedevicelist;
/* iterate over fields */
for (field = port->fieldlist; field != NULL; field = field->next)
{
input_field_state *fieldstate;
int seqtype;
/* allocate a new input_field_info structure */
fieldstate = auto_alloc_clear(machine, input_field_state);
((input_field_config *)field)->state = fieldstate;
/* fill in the basic values */
for (seqtype = 0; seqtype < ARRAY_LENGTH(fieldstate->seq); seqtype++)
fieldstate->seq[seqtype] = field->seq[seqtype];
fieldstate->value = field->defvalue;
/* if this is an analog field, allocate memory for the analog data */
if (field->type >= __ipt_analog_start && field->type <= __ipt_analog_end)
{
*analogstatetail = fieldstate->analog = init_field_analog_state(field);
analogstatetail = &(*analogstatetail)->next;
}
/* if this is a digital joystick field, make a note of it */
if (field->type >= __ipt_digital_joystick_start && field->type <= __ipt_digital_joystick_end)
{
fieldstate->joystick = &portdata->joystick_info[field->player][(field->type - __ipt_digital_joystick_start) / 4];
fieldstate->joydir = (field->type - __ipt_digital_joystick_start) % 4;
fieldstate->joystick->field[fieldstate->joydir] = field;
fieldstate->joystick->inuse = TRUE;
}
/* if this entry has device input, allocate memory for the tracking structure */
if (field->read_line_device != NULL)
{
*readdevicetail = init_field_device_info(field,field->read_device_name);
readdevicetail = &(*readdevicetail)->next;
}
/* if this entry has device output, allocate memory for the tracking structure */
if (field->write_line_device != NULL)
{
*writedevicetail = init_field_device_info(field,field->write_device_name);
writedevicetail = &(*writedevicetail)->next;
}
/* Name keyboard key names */
if ((field->type == IPT_KEYBOARD || field->type == IPT_KEYPAD) && (field->name == NULL))
{
astring *name = get_keyboard_key_name(field);
if (name != NULL)
{
field->state->name = auto_strdup(machine, astring_c(name));
astring_free(name);
}
}
}
}
/* handle autoselection of devices */
init_autoselect_devices(machine->m_portlist, IPT_PADDLE, IPT_PADDLE_V, 0, OPTION_PADDLE_DEVICE, "paddle");
init_autoselect_devices(machine->m_portlist, IPT_AD_STICK_X, IPT_AD_STICK_Y, IPT_AD_STICK_Z, OPTION_ADSTICK_DEVICE, "analog joystick");
init_autoselect_devices(machine->m_portlist, IPT_LIGHTGUN_X, IPT_LIGHTGUN_Y, 0, OPTION_LIGHTGUN_DEVICE, "lightgun");
init_autoselect_devices(machine->m_portlist, IPT_PEDAL, IPT_PEDAL2, IPT_PEDAL3, OPTION_PEDAL_DEVICE, "pedal");
init_autoselect_devices(machine->m_portlist, IPT_DIAL, IPT_DIAL_V, 0, OPTION_DIAL_DEVICE, "dial");
init_autoselect_devices(machine->m_portlist, IPT_TRACKBALL_X, IPT_TRACKBALL_Y, 0, OPTION_TRACKBALL_DEVICE, "trackball");
init_autoselect_devices(machine->m_portlist, IPT_POSITIONAL, IPT_POSITIONAL_V, 0, OPTION_POSITIONAL_DEVICE, "positional");
init_autoselect_devices(machine->m_portlist, IPT_MOUSE_X, IPT_MOUSE_Y, 0, OPTION_MOUSE_DEVICE, "mouse");
myosd_num_ways = 8;
/* look for 4-way joysticks and change the default map if we find any */
if (joystick_map_default[0] == 0 || strcmp(joystick_map_default, "auto") == 0)
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
for (field = port->fieldlist; field != NULL; field = field->next)
if (field->state->joystick != NULL && field->way == 4)
{
//DAV HACK
myosd_num_ways = 4;
//DAV HACK
input_device_set_joystick_map(machine, -1, (field->flags & FIELD_FLAG_ROTATED) ? joystick_map_4way_diagonal : joystick_map_4way_sticky);
break;
}
} | /*-------------------------------------------------
init_port_state - initialize the live port
states based on the tokens
-------------------------------------------------*/ | initialize the live port
states based on the tokens | [
"initialize",
"the",
"live",
"port",
"states",
"based",
"on",
"the",
"tokens"
] | static void init_port_state(running_machine *machine)
{
const char *joystick_map_default = options_get_string(machine->options(), OPTION_JOYSTICK_MAP);
input_port_private *portdata = machine->input_port_data;
const input_field_config *field;
const input_port_config *port;
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
{
analog_field_state **analogstatetail;
device_field_info **readdevicetail;
device_field_info **writedevicetail;
input_port_state *portstate;
portstate = auto_alloc_clear(machine, input_port_state);
((input_port_config *)port)->state = portstate;
((input_port_config *)port)->machine = machine;
analogstatetail = &portstate->analoglist;
readdevicetail = &portstate->readdevicelist;
writedevicetail = &portstate->writedevicelist;
for (field = port->fieldlist; field != NULL; field = field->next)
{
input_field_state *fieldstate;
int seqtype;
fieldstate = auto_alloc_clear(machine, input_field_state);
((input_field_config *)field)->state = fieldstate;
for (seqtype = 0; seqtype < ARRAY_LENGTH(fieldstate->seq); seqtype++)
fieldstate->seq[seqtype] = field->seq[seqtype];
fieldstate->value = field->defvalue;
if (field->type >= __ipt_analog_start && field->type <= __ipt_analog_end)
{
*analogstatetail = fieldstate->analog = init_field_analog_state(field);
analogstatetail = &(*analogstatetail)->next;
}
if (field->type >= __ipt_digital_joystick_start && field->type <= __ipt_digital_joystick_end)
{
fieldstate->joystick = &portdata->joystick_info[field->player][(field->type - __ipt_digital_joystick_start) / 4];
fieldstate->joydir = (field->type - __ipt_digital_joystick_start) % 4;
fieldstate->joystick->field[fieldstate->joydir] = field;
fieldstate->joystick->inuse = TRUE;
}
if (field->read_line_device != NULL)
{
*readdevicetail = init_field_device_info(field,field->read_device_name);
readdevicetail = &(*readdevicetail)->next;
}
if (field->write_line_device != NULL)
{
*writedevicetail = init_field_device_info(field,field->write_device_name);
writedevicetail = &(*writedevicetail)->next;
}
if ((field->type == IPT_KEYBOARD || field->type == IPT_KEYPAD) && (field->name == NULL))
{
astring *name = get_keyboard_key_name(field);
if (name != NULL)
{
field->state->name = auto_strdup(machine, astring_c(name));
astring_free(name);
}
}
}
}
init_autoselect_devices(machine->m_portlist, IPT_PADDLE, IPT_PADDLE_V, 0, OPTION_PADDLE_DEVICE, "paddle");
init_autoselect_devices(machine->m_portlist, IPT_AD_STICK_X, IPT_AD_STICK_Y, IPT_AD_STICK_Z, OPTION_ADSTICK_DEVICE, "analog joystick");
init_autoselect_devices(machine->m_portlist, IPT_LIGHTGUN_X, IPT_LIGHTGUN_Y, 0, OPTION_LIGHTGUN_DEVICE, "lightgun");
init_autoselect_devices(machine->m_portlist, IPT_PEDAL, IPT_PEDAL2, IPT_PEDAL3, OPTION_PEDAL_DEVICE, "pedal");
init_autoselect_devices(machine->m_portlist, IPT_DIAL, IPT_DIAL_V, 0, OPTION_DIAL_DEVICE, "dial");
init_autoselect_devices(machine->m_portlist, IPT_TRACKBALL_X, IPT_TRACKBALL_Y, 0, OPTION_TRACKBALL_DEVICE, "trackball");
init_autoselect_devices(machine->m_portlist, IPT_POSITIONAL, IPT_POSITIONAL_V, 0, OPTION_POSITIONAL_DEVICE, "positional");
init_autoselect_devices(machine->m_portlist, IPT_MOUSE_X, IPT_MOUSE_Y, 0, OPTION_MOUSE_DEVICE, "mouse");
myosd_num_ways = 8;
if (joystick_map_default[0] == 0 || strcmp(joystick_map_default, "auto") == 0)
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
for (field = port->fieldlist; field != NULL; field = field->next)
if (field->state->joystick != NULL && field->way == 4)
{
myosd_num_ways = 4;
input_device_set_joystick_map(machine, -1, (field->flags & FIELD_FLAG_ROTATED) ? joystick_map_4way_diagonal : joystick_map_4way_sticky);
break;
}
} | [
"static",
"void",
"init_port_state",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"const",
"char",
"*",
"joystick_map_default",
"=",
"options_get_string",
"(",
"machine",
"->",
"options",
"(",
")",
",",
"OPTION_JOYSTICK_MAP",
")",
";",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"const",
"input_field_config",
"*",
"field",
";",
"const",
"input_port_config",
"*",
"port",
";",
"for",
"(",
"port",
"=",
"machine",
"->",
"m_portlist",
".",
"first",
"(",
")",
";",
"port",
"!=",
"NULL",
";",
"port",
"=",
"port",
"->",
"next",
"(",
")",
")",
"{",
"analog_field_state",
"*",
"*",
"analogstatetail",
";",
"device_field_info",
"*",
"*",
"readdevicetail",
";",
"device_field_info",
"*",
"*",
"writedevicetail",
";",
"input_port_state",
"*",
"portstate",
";",
"portstate",
"=",
"auto_alloc_clear",
"(",
"machine",
",",
"input_port_state",
")",
";",
"(",
"(",
"input_port_config",
"*",
")",
"port",
")",
"->",
"state",
"=",
"portstate",
";",
"(",
"(",
"input_port_config",
"*",
")",
"port",
")",
"->",
"machine",
"=",
"machine",
";",
"analogstatetail",
"=",
"&",
"portstate",
"->",
"analoglist",
";",
"readdevicetail",
"=",
"&",
"portstate",
"->",
"readdevicelist",
";",
"writedevicetail",
"=",
"&",
"portstate",
"->",
"writedevicelist",
";",
"for",
"(",
"field",
"=",
"port",
"->",
"fieldlist",
";",
"field",
"!=",
"NULL",
";",
"field",
"=",
"field",
"->",
"next",
")",
"{",
"input_field_state",
"*",
"fieldstate",
";",
"int",
"seqtype",
";",
"fieldstate",
"=",
"auto_alloc_clear",
"(",
"machine",
",",
"input_field_state",
")",
";",
"(",
"(",
"input_field_config",
"*",
")",
"field",
")",
"->",
"state",
"=",
"fieldstate",
";",
"for",
"(",
"seqtype",
"=",
"0",
";",
"seqtype",
"<",
"ARRAY_LENGTH",
"(",
"fieldstate",
"->",
"seq",
")",
";",
"seqtype",
"++",
")",
"fieldstate",
"->",
"seq",
"[",
"seqtype",
"]",
"=",
"field",
"->",
"seq",
"[",
"seqtype",
"]",
";",
"fieldstate",
"->",
"value",
"=",
"field",
"->",
"defvalue",
";",
"if",
"(",
"field",
"->",
"type",
">=",
"__ipt_analog_start",
"&&",
"field",
"->",
"type",
"<=",
"__ipt_analog_end",
")",
"{",
"*",
"analogstatetail",
"=",
"fieldstate",
"->",
"analog",
"=",
"init_field_analog_state",
"(",
"field",
")",
";",
"analogstatetail",
"=",
"&",
"(",
"*",
"analogstatetail",
")",
"->",
"next",
";",
"}",
"if",
"(",
"field",
"->",
"type",
">=",
"__ipt_digital_joystick_start",
"&&",
"field",
"->",
"type",
"<=",
"__ipt_digital_joystick_end",
")",
"{",
"fieldstate",
"->",
"joystick",
"=",
"&",
"portdata",
"->",
"joystick_info",
"[",
"field",
"->",
"player",
"]",
"[",
"(",
"field",
"->",
"type",
"-",
"__ipt_digital_joystick_start",
")",
"/",
"4",
"]",
";",
"fieldstate",
"->",
"joydir",
"=",
"(",
"field",
"->",
"type",
"-",
"__ipt_digital_joystick_start",
")",
"%",
"4",
";",
"fieldstate",
"->",
"joystick",
"->",
"field",
"[",
"fieldstate",
"->",
"joydir",
"]",
"=",
"field",
";",
"fieldstate",
"->",
"joystick",
"->",
"inuse",
"=",
"TRUE",
";",
"}",
"if",
"(",
"field",
"->",
"read_line_device",
"!=",
"NULL",
")",
"{",
"*",
"readdevicetail",
"=",
"init_field_device_info",
"(",
"field",
",",
"field",
"->",
"read_device_name",
")",
";",
"readdevicetail",
"=",
"&",
"(",
"*",
"readdevicetail",
")",
"->",
"next",
";",
"}",
"if",
"(",
"field",
"->",
"write_line_device",
"!=",
"NULL",
")",
"{",
"*",
"writedevicetail",
"=",
"init_field_device_info",
"(",
"field",
",",
"field",
"->",
"write_device_name",
")",
";",
"writedevicetail",
"=",
"&",
"(",
"*",
"writedevicetail",
")",
"->",
"next",
";",
"}",
"if",
"(",
"(",
"field",
"->",
"type",
"==",
"IPT_KEYBOARD",
"||",
"field",
"->",
"type",
"==",
"IPT_KEYPAD",
")",
"&&",
"(",
"field",
"->",
"name",
"==",
"NULL",
")",
")",
"{",
"astring",
"*",
"name",
"=",
"get_keyboard_key_name",
"(",
"field",
")",
";",
"if",
"(",
"name",
"!=",
"NULL",
")",
"{",
"field",
"->",
"state",
"->",
"name",
"=",
"auto_strdup",
"(",
"machine",
",",
"astring_c",
"(",
"name",
")",
")",
";",
"astring_free",
"(",
"name",
")",
";",
"}",
"}",
"}",
"}",
"init_autoselect_devices",
"(",
"machine",
"->",
"m_portlist",
",",
"IPT_PADDLE",
",",
"IPT_PADDLE_V",
",",
"0",
",",
"OPTION_PADDLE_DEVICE",
",",
"\"",
"\"",
")",
";",
"init_autoselect_devices",
"(",
"machine",
"->",
"m_portlist",
",",
"IPT_AD_STICK_X",
",",
"IPT_AD_STICK_Y",
",",
"IPT_AD_STICK_Z",
",",
"OPTION_ADSTICK_DEVICE",
",",
"\"",
"\"",
")",
";",
"init_autoselect_devices",
"(",
"machine",
"->",
"m_portlist",
",",
"IPT_LIGHTGUN_X",
",",
"IPT_LIGHTGUN_Y",
",",
"0",
",",
"OPTION_LIGHTGUN_DEVICE",
",",
"\"",
"\"",
")",
";",
"init_autoselect_devices",
"(",
"machine",
"->",
"m_portlist",
",",
"IPT_PEDAL",
",",
"IPT_PEDAL2",
",",
"IPT_PEDAL3",
",",
"OPTION_PEDAL_DEVICE",
",",
"\"",
"\"",
")",
";",
"init_autoselect_devices",
"(",
"machine",
"->",
"m_portlist",
",",
"IPT_DIAL",
",",
"IPT_DIAL_V",
",",
"0",
",",
"OPTION_DIAL_DEVICE",
",",
"\"",
"\"",
")",
";",
"init_autoselect_devices",
"(",
"machine",
"->",
"m_portlist",
",",
"IPT_TRACKBALL_X",
",",
"IPT_TRACKBALL_Y",
",",
"0",
",",
"OPTION_TRACKBALL_DEVICE",
",",
"\"",
"\"",
")",
";",
"init_autoselect_devices",
"(",
"machine",
"->",
"m_portlist",
",",
"IPT_POSITIONAL",
",",
"IPT_POSITIONAL_V",
",",
"0",
",",
"OPTION_POSITIONAL_DEVICE",
",",
"\"",
"\"",
")",
";",
"init_autoselect_devices",
"(",
"machine",
"->",
"m_portlist",
",",
"IPT_MOUSE_X",
",",
"IPT_MOUSE_Y",
",",
"0",
",",
"OPTION_MOUSE_DEVICE",
",",
"\"",
"\"",
")",
";",
"myosd_num_ways",
"=",
"8",
";",
"if",
"(",
"joystick_map_default",
"[",
"0",
"]",
"==",
"0",
"||",
"strcmp",
"(",
"joystick_map_default",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"for",
"(",
"port",
"=",
"machine",
"->",
"m_portlist",
".",
"first",
"(",
")",
";",
"port",
"!=",
"NULL",
";",
"port",
"=",
"port",
"->",
"next",
"(",
")",
")",
"for",
"(",
"field",
"=",
"port",
"->",
"fieldlist",
";",
"field",
"!=",
"NULL",
";",
"field",
"=",
"field",
"->",
"next",
")",
"if",
"(",
"field",
"->",
"state",
"->",
"joystick",
"!=",
"NULL",
"&&",
"field",
"->",
"way",
"==",
"4",
")",
"{",
"myosd_num_ways",
"=",
"4",
";",
"input_device_set_joystick_map",
"(",
"machine",
",",
"-1",
",",
"(",
"field",
"->",
"flags",
"&",
"FIELD_FLAG_ROTATED",
")",
"?",
"joystick_map_4way_diagonal",
":",
"joystick_map_4way_sticky",
")",
";",
"break",
";",
"}",
"}"
] | init_port_state - initialize the live port
states based on the tokens | [
"init_port_state",
"-",
"initialize",
"the",
"live",
"port",
"states",
"based",
"on",
"the",
"tokens"
] | [
"/* allocate live structures to mirror the configuration */",
"/* allocate a new input_port_info structure */",
"/* start with tail pointers to all the data */",
"/* iterate over fields */",
"/* allocate a new input_field_info structure */",
"/* fill in the basic values */",
"/* if this is an analog field, allocate memory for the analog data */",
"/* if this is a digital joystick field, make a note of it */",
"/* if this entry has device input, allocate memory for the tracking structure */",
"/* if this entry has device output, allocate memory for the tracking structure */",
"/* Name keyboard key names */",
"/* handle autoselection of devices */",
"/* look for 4-way joysticks and change the default map if we find any */",
"//DAV HACK\r",
"//DAV HACK\r"
] | [
{
"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": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | init_field_device_info | device_field_info | static device_field_info *init_field_device_info(const input_field_config *field, const char *device_name)
{
device_field_info *info;
input_port_value mask;
/* allocate memory */
info = auto_alloc_clear(field->port->machine, device_field_info);
/* fill in the data */
info->field = field;
for (mask = field->mask; !(mask & 1); mask >>= 1)
info->shift++;
if (device_name != NULL)
info->device = field->port->machine->device(device_name);
else
info->device = (device_t *) info;
info->oldval = field->defvalue >> info->shift;
return info;
} | /*-------------------------------------------------
init_field_device_info - allocate and populate
information about a device callback
-------------------------------------------------*/ | allocate and populate
information about a device callback | [
"allocate",
"and",
"populate",
"information",
"about",
"a",
"device",
"callback"
] | static device_field_info *init_field_device_info(const input_field_config *field, const char *device_name)
{
device_field_info *info;
input_port_value mask;
info = auto_alloc_clear(field->port->machine, device_field_info);
info->field = field;
for (mask = field->mask; !(mask & 1); mask >>= 1)
info->shift++;
if (device_name != NULL)
info->device = field->port->machine->device(device_name);
else
info->device = (device_t *) info;
info->oldval = field->defvalue >> info->shift;
return info;
} | [
"static",
"device_field_info",
"*",
"init_field_device_info",
"(",
"const",
"input_field_config",
"*",
"field",
",",
"const",
"char",
"*",
"device_name",
")",
"{",
"device_field_info",
"*",
"info",
";",
"input_port_value",
"mask",
";",
"info",
"=",
"auto_alloc_clear",
"(",
"field",
"->",
"port",
"->",
"machine",
",",
"device_field_info",
")",
";",
"info",
"->",
"field",
"=",
"field",
";",
"for",
"(",
"mask",
"=",
"field",
"->",
"mask",
";",
"!",
"(",
"mask",
"&",
"1",
")",
";",
"mask",
">>=",
"1",
")",
"info",
"->",
"shift",
"++",
";",
"if",
"(",
"device_name",
"!=",
"NULL",
")",
"info",
"->",
"device",
"=",
"field",
"->",
"port",
"->",
"machine",
"->",
"device",
"(",
"device_name",
")",
";",
"else",
"info",
"->",
"device",
"=",
"(",
"device_t",
"*",
")",
"info",
";",
"info",
"->",
"oldval",
"=",
"field",
"->",
"defvalue",
">>",
"info",
"->",
"shift",
";",
"return",
"info",
";",
"}"
] | init_field_device_info - allocate and populate
information about a device callback | [
"init_field_device_info",
"-",
"allocate",
"and",
"populate",
"information",
"about",
"a",
"device",
"callback"
] | [
"/* allocate memory */",
"/* fill in the data */"
] | [
{
"param": "field",
"type": "input_field_config"
},
{
"param": "device_name",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": "input_field_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "device_name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | init_field_analog_state | analog_field_state | static analog_field_state *init_field_analog_state(const input_field_config *field)
{
analog_field_state *state;
input_port_value mask;
/* allocate memory */
state = auto_alloc_clear(field->port->machine, analog_field_state);
/* compute the shift amount and number of bits */
for (mask = field->mask; !(mask & 1); mask >>= 1)
state->shift++;
/* initialize core data */
state->field = field;
state->adjdefvalue = (field->defvalue & field->mask) >> state->shift;
state->adjmin = (field->min & field->mask) >> state->shift;
state->adjmax = (field->max & field->mask) >> state->shift;
state->sensitivity = field->sensitivity;
state->reverse = ((field->flags & ANALOG_FLAG_REVERSE) != 0);
state->delta = field->delta;
state->centerdelta = field->centerdelta;
state->minimum = INPUT_ABSOLUTE_MIN;
state->maximum = INPUT_ABSOLUTE_MAX;
/* set basic parameters based on the configured type */
switch (field->type)
{
/* pedals start at and autocenter to the min range */
case IPT_PEDAL:
case IPT_PEDAL2:
case IPT_PEDAL3:
state->center = INPUT_ABSOLUTE_MIN;
state->accum = APPLY_INVERSE_SENSITIVITY(state->center, state->sensitivity);
state->absolute = TRUE;
state->autocenter = TRUE;
state->interpolate = TRUE;
break;
/* paddles and analog joysticks are absolute and autocenter */
case IPT_AD_STICK_X:
case IPT_AD_STICK_Y:
case IPT_AD_STICK_Z:
case IPT_PADDLE:
case IPT_PADDLE_V:
state->absolute = TRUE;
state->autocenter = TRUE;
state->interpolate = TRUE;
break;
/* lightguns are absolute as well, but don't autocenter and don't interpolate their values */
case IPT_LIGHTGUN_X:
case IPT_LIGHTGUN_Y:
state->absolute = TRUE;
state->autocenter = FALSE;
state->interpolate = FALSE;
break;
/* dials, mice and trackballs are relative devices */
/* these have fixed "min" and "max" values based on how many bits are in the port */
/* in addition, we set the wrap around min/max values to 512 * the min/max values */
/* this takes into account the mapping that one mouse unit ~= 512 analog units */
case IPT_DIAL:
case IPT_DIAL_V:
case IPT_MOUSE_X:
case IPT_MOUSE_Y:
case IPT_TRACKBALL_X:
case IPT_TRACKBALL_Y:
state->absolute = FALSE;
state->wraps = TRUE;
state->interpolate = TRUE;
break;
/* positional devices are abolute, but can also wrap like relative devices */
/* set each position to be 512 units */
case IPT_POSITIONAL:
case IPT_POSITIONAL_V:
state->positionalscale = COMPUTE_SCALE(field->max, INPUT_ABSOLUTE_MAX - INPUT_ABSOLUTE_MIN);
state->adjmin = 0;
state->adjmax = field->max - 1;
state->wraps = ((field->flags & ANALOG_FLAG_WRAPS) != 0);
state->autocenter = !state->wraps;
break;
default:
fatalerror("Unknown analog port type -- don't know if it is absolute or not");
break;
}
/* further processing for absolute controls */
if (state->absolute)
{
/* if the default value is pegged at the min or max, use a single scale value for the whole axis */
state->single_scale = (state->adjdefvalue == state->adjmin) || (state->adjdefvalue == state->adjmax);
/* if not "single scale", compute separate scales for each side of the default */
if (!state->single_scale)
{
/* unsigned */
state->scalepos = COMPUTE_SCALE(state->adjmax - state->adjdefvalue, INPUT_ABSOLUTE_MAX - 0);
state->scaleneg = COMPUTE_SCALE(state->adjdefvalue - state->adjmin, 0 - INPUT_ABSOLUTE_MIN);
if (state->adjmin > state->adjmax)
state->scaleneg = -state->scaleneg;
/* reverse point is at center */
state->reverse_val = 0;
}
else
{
/* single axis that increases from default */
state->scalepos = COMPUTE_SCALE(state->adjmax - state->adjmin, INPUT_ABSOLUTE_MAX - INPUT_ABSOLUTE_MIN);
/* move from default */
if (state->adjdefvalue == state->adjmax)
state->scalepos = -state->scalepos;
/* make the scaling the same for easier coding when we need to scale */
state->scaleneg = state->scalepos;
/* reverse point is at max */
state->reverse_val = state->maximum;
}
}
/* relative and positional controls all map directly with a 512x scale factor */
else
{
/* The relative code is set up to allow specifing PORT_MINMAX and default values. */
/* The validity checks are purposely set up to not allow you to use anything other */
/* a default of 0 and PORT_MINMAX(0,mask). This is in case the need arises to use */
/* this feature in the future. Keeping the code in does not hurt anything. */
if (state->adjmin > state->adjmax)
/* adjust for signed */
state->adjmin = -state->adjmin;
state->minimum = (state->adjmin - state->adjdefvalue) * INPUT_RELATIVE_PER_PIXEL;
state->maximum = (state->adjmax - state->adjdefvalue) * INPUT_RELATIVE_PER_PIXEL;
/* make the scaling the same for easier coding when we need to scale */
state->scaleneg = state->scalepos = COMPUTE_SCALE(1, INPUT_RELATIVE_PER_PIXEL);
if (field->flags & ANALOG_FLAG_RESET)
/* delta values reverse from center */
state->reverse_val = 0;
else
{
/* positional controls reverse from their max range */
state->reverse_val = state->maximum + state->minimum;
/* relative controls reverse from 1 past their max range */
if (state->positionalscale == 0)
state->reverse_val += INPUT_RELATIVE_PER_PIXEL;
}
}
/* compute scale for keypresses */
state->keyscalepos = RECIP_SCALE(state->scalepos);
state->keyscaleneg = RECIP_SCALE(state->scaleneg);
return state;
} | /*-------------------------------------------------
init_field_analog_state - allocate and populate
information about an analog port
-------------------------------------------------*/ | allocate and populate
information about an analog port | [
"allocate",
"and",
"populate",
"information",
"about",
"an",
"analog",
"port"
] | static analog_field_state *init_field_analog_state(const input_field_config *field)
{
analog_field_state *state;
input_port_value mask;
state = auto_alloc_clear(field->port->machine, analog_field_state);
for (mask = field->mask; !(mask & 1); mask >>= 1)
state->shift++;
state->field = field;
state->adjdefvalue = (field->defvalue & field->mask) >> state->shift;
state->adjmin = (field->min & field->mask) >> state->shift;
state->adjmax = (field->max & field->mask) >> state->shift;
state->sensitivity = field->sensitivity;
state->reverse = ((field->flags & ANALOG_FLAG_REVERSE) != 0);
state->delta = field->delta;
state->centerdelta = field->centerdelta;
state->minimum = INPUT_ABSOLUTE_MIN;
state->maximum = INPUT_ABSOLUTE_MAX;
switch (field->type)
{
case IPT_PEDAL:
case IPT_PEDAL2:
case IPT_PEDAL3:
state->center = INPUT_ABSOLUTE_MIN;
state->accum = APPLY_INVERSE_SENSITIVITY(state->center, state->sensitivity);
state->absolute = TRUE;
state->autocenter = TRUE;
state->interpolate = TRUE;
break;
case IPT_AD_STICK_X:
case IPT_AD_STICK_Y:
case IPT_AD_STICK_Z:
case IPT_PADDLE:
case IPT_PADDLE_V:
state->absolute = TRUE;
state->autocenter = TRUE;
state->interpolate = TRUE;
break;
case IPT_LIGHTGUN_X:
case IPT_LIGHTGUN_Y:
state->absolute = TRUE;
state->autocenter = FALSE;
state->interpolate = FALSE;
break;
case IPT_DIAL:
case IPT_DIAL_V:
case IPT_MOUSE_X:
case IPT_MOUSE_Y:
case IPT_TRACKBALL_X:
case IPT_TRACKBALL_Y:
state->absolute = FALSE;
state->wraps = TRUE;
state->interpolate = TRUE;
break;
case IPT_POSITIONAL:
case IPT_POSITIONAL_V:
state->positionalscale = COMPUTE_SCALE(field->max, INPUT_ABSOLUTE_MAX - INPUT_ABSOLUTE_MIN);
state->adjmin = 0;
state->adjmax = field->max - 1;
state->wraps = ((field->flags & ANALOG_FLAG_WRAPS) != 0);
state->autocenter = !state->wraps;
break;
default:
fatalerror("Unknown analog port type -- don't know if it is absolute or not");
break;
}
if (state->absolute)
{
state->single_scale = (state->adjdefvalue == state->adjmin) || (state->adjdefvalue == state->adjmax);
if (!state->single_scale)
{
state->scalepos = COMPUTE_SCALE(state->adjmax - state->adjdefvalue, INPUT_ABSOLUTE_MAX - 0);
state->scaleneg = COMPUTE_SCALE(state->adjdefvalue - state->adjmin, 0 - INPUT_ABSOLUTE_MIN);
if (state->adjmin > state->adjmax)
state->scaleneg = -state->scaleneg;
state->reverse_val = 0;
}
else
{
state->scalepos = COMPUTE_SCALE(state->adjmax - state->adjmin, INPUT_ABSOLUTE_MAX - INPUT_ABSOLUTE_MIN);
if (state->adjdefvalue == state->adjmax)
state->scalepos = -state->scalepos;
state->scaleneg = state->scalepos;
state->reverse_val = state->maximum;
}
}
else
{
if (state->adjmin > state->adjmax)
state->adjmin = -state->adjmin;
state->minimum = (state->adjmin - state->adjdefvalue) * INPUT_RELATIVE_PER_PIXEL;
state->maximum = (state->adjmax - state->adjdefvalue) * INPUT_RELATIVE_PER_PIXEL;
state->scaleneg = state->scalepos = COMPUTE_SCALE(1, INPUT_RELATIVE_PER_PIXEL);
if (field->flags & ANALOG_FLAG_RESET)
state->reverse_val = 0;
else
{
state->reverse_val = state->maximum + state->minimum;
if (state->positionalscale == 0)
state->reverse_val += INPUT_RELATIVE_PER_PIXEL;
}
}
state->keyscalepos = RECIP_SCALE(state->scalepos);
state->keyscaleneg = RECIP_SCALE(state->scaleneg);
return state;
} | [
"static",
"analog_field_state",
"*",
"init_field_analog_state",
"(",
"const",
"input_field_config",
"*",
"field",
")",
"{",
"analog_field_state",
"*",
"state",
";",
"input_port_value",
"mask",
";",
"state",
"=",
"auto_alloc_clear",
"(",
"field",
"->",
"port",
"->",
"machine",
",",
"analog_field_state",
")",
";",
"for",
"(",
"mask",
"=",
"field",
"->",
"mask",
";",
"!",
"(",
"mask",
"&",
"1",
")",
";",
"mask",
">>=",
"1",
")",
"state",
"->",
"shift",
"++",
";",
"state",
"->",
"field",
"=",
"field",
";",
"state",
"->",
"adjdefvalue",
"=",
"(",
"field",
"->",
"defvalue",
"&",
"field",
"->",
"mask",
")",
">>",
"state",
"->",
"shift",
";",
"state",
"->",
"adjmin",
"=",
"(",
"field",
"->",
"min",
"&",
"field",
"->",
"mask",
")",
">>",
"state",
"->",
"shift",
";",
"state",
"->",
"adjmax",
"=",
"(",
"field",
"->",
"max",
"&",
"field",
"->",
"mask",
")",
">>",
"state",
"->",
"shift",
";",
"state",
"->",
"sensitivity",
"=",
"field",
"->",
"sensitivity",
";",
"state",
"->",
"reverse",
"=",
"(",
"(",
"field",
"->",
"flags",
"&",
"ANALOG_FLAG_REVERSE",
")",
"!=",
"0",
")",
";",
"state",
"->",
"delta",
"=",
"field",
"->",
"delta",
";",
"state",
"->",
"centerdelta",
"=",
"field",
"->",
"centerdelta",
";",
"state",
"->",
"minimum",
"=",
"INPUT_ABSOLUTE_MIN",
";",
"state",
"->",
"maximum",
"=",
"INPUT_ABSOLUTE_MAX",
";",
"switch",
"(",
"field",
"->",
"type",
")",
"{",
"case",
"IPT_PEDAL",
":",
"case",
"IPT_PEDAL2",
":",
"case",
"IPT_PEDAL3",
":",
"state",
"->",
"center",
"=",
"INPUT_ABSOLUTE_MIN",
";",
"state",
"->",
"accum",
"=",
"APPLY_INVERSE_SENSITIVITY",
"(",
"state",
"->",
"center",
",",
"state",
"->",
"sensitivity",
")",
";",
"state",
"->",
"absolute",
"=",
"TRUE",
";",
"state",
"->",
"autocenter",
"=",
"TRUE",
";",
"state",
"->",
"interpolate",
"=",
"TRUE",
";",
"break",
";",
"case",
"IPT_AD_STICK_X",
":",
"case",
"IPT_AD_STICK_Y",
":",
"case",
"IPT_AD_STICK_Z",
":",
"case",
"IPT_PADDLE",
":",
"case",
"IPT_PADDLE_V",
":",
"state",
"->",
"absolute",
"=",
"TRUE",
";",
"state",
"->",
"autocenter",
"=",
"TRUE",
";",
"state",
"->",
"interpolate",
"=",
"TRUE",
";",
"break",
";",
"case",
"IPT_LIGHTGUN_X",
":",
"case",
"IPT_LIGHTGUN_Y",
":",
"state",
"->",
"absolute",
"=",
"TRUE",
";",
"state",
"->",
"autocenter",
"=",
"FALSE",
";",
"state",
"->",
"interpolate",
"=",
"FALSE",
";",
"break",
";",
"case",
"IPT_DIAL",
":",
"case",
"IPT_DIAL_V",
":",
"case",
"IPT_MOUSE_X",
":",
"case",
"IPT_MOUSE_Y",
":",
"case",
"IPT_TRACKBALL_X",
":",
"case",
"IPT_TRACKBALL_Y",
":",
"state",
"->",
"absolute",
"=",
"FALSE",
";",
"state",
"->",
"wraps",
"=",
"TRUE",
";",
"state",
"->",
"interpolate",
"=",
"TRUE",
";",
"break",
";",
"case",
"IPT_POSITIONAL",
":",
"case",
"IPT_POSITIONAL_V",
":",
"state",
"->",
"positionalscale",
"=",
"COMPUTE_SCALE",
"(",
"field",
"->",
"max",
",",
"INPUT_ABSOLUTE_MAX",
"-",
"INPUT_ABSOLUTE_MIN",
")",
";",
"state",
"->",
"adjmin",
"=",
"0",
";",
"state",
"->",
"adjmax",
"=",
"field",
"->",
"max",
"-",
"1",
";",
"state",
"->",
"wraps",
"=",
"(",
"(",
"field",
"->",
"flags",
"&",
"ANALOG_FLAG_WRAPS",
")",
"!=",
"0",
")",
";",
"state",
"->",
"autocenter",
"=",
"!",
"state",
"->",
"wraps",
";",
"break",
";",
"default",
":",
"fatalerror",
"(",
"\"",
"\"",
")",
";",
"break",
";",
"}",
"if",
"(",
"state",
"->",
"absolute",
")",
"{",
"state",
"->",
"single_scale",
"=",
"(",
"state",
"->",
"adjdefvalue",
"==",
"state",
"->",
"adjmin",
")",
"||",
"(",
"state",
"->",
"adjdefvalue",
"==",
"state",
"->",
"adjmax",
")",
";",
"if",
"(",
"!",
"state",
"->",
"single_scale",
")",
"{",
"state",
"->",
"scalepos",
"=",
"COMPUTE_SCALE",
"(",
"state",
"->",
"adjmax",
"-",
"state",
"->",
"adjdefvalue",
",",
"INPUT_ABSOLUTE_MAX",
"-",
"0",
")",
";",
"state",
"->",
"scaleneg",
"=",
"COMPUTE_SCALE",
"(",
"state",
"->",
"adjdefvalue",
"-",
"state",
"->",
"adjmin",
",",
"0",
"-",
"INPUT_ABSOLUTE_MIN",
")",
";",
"if",
"(",
"state",
"->",
"adjmin",
">",
"state",
"->",
"adjmax",
")",
"state",
"->",
"scaleneg",
"=",
"-",
"state",
"->",
"scaleneg",
";",
"state",
"->",
"reverse_val",
"=",
"0",
";",
"}",
"else",
"{",
"state",
"->",
"scalepos",
"=",
"COMPUTE_SCALE",
"(",
"state",
"->",
"adjmax",
"-",
"state",
"->",
"adjmin",
",",
"INPUT_ABSOLUTE_MAX",
"-",
"INPUT_ABSOLUTE_MIN",
")",
";",
"if",
"(",
"state",
"->",
"adjdefvalue",
"==",
"state",
"->",
"adjmax",
")",
"state",
"->",
"scalepos",
"=",
"-",
"state",
"->",
"scalepos",
";",
"state",
"->",
"scaleneg",
"=",
"state",
"->",
"scalepos",
";",
"state",
"->",
"reverse_val",
"=",
"state",
"->",
"maximum",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"state",
"->",
"adjmin",
">",
"state",
"->",
"adjmax",
")",
"state",
"->",
"adjmin",
"=",
"-",
"state",
"->",
"adjmin",
";",
"state",
"->",
"minimum",
"=",
"(",
"state",
"->",
"adjmin",
"-",
"state",
"->",
"adjdefvalue",
")",
"*",
"INPUT_RELATIVE_PER_PIXEL",
";",
"state",
"->",
"maximum",
"=",
"(",
"state",
"->",
"adjmax",
"-",
"state",
"->",
"adjdefvalue",
")",
"*",
"INPUT_RELATIVE_PER_PIXEL",
";",
"state",
"->",
"scaleneg",
"=",
"state",
"->",
"scalepos",
"=",
"COMPUTE_SCALE",
"(",
"1",
",",
"INPUT_RELATIVE_PER_PIXEL",
")",
";",
"if",
"(",
"field",
"->",
"flags",
"&",
"ANALOG_FLAG_RESET",
")",
"state",
"->",
"reverse_val",
"=",
"0",
";",
"else",
"{",
"state",
"->",
"reverse_val",
"=",
"state",
"->",
"maximum",
"+",
"state",
"->",
"minimum",
";",
"if",
"(",
"state",
"->",
"positionalscale",
"==",
"0",
")",
"state",
"->",
"reverse_val",
"+=",
"INPUT_RELATIVE_PER_PIXEL",
";",
"}",
"}",
"state",
"->",
"keyscalepos",
"=",
"RECIP_SCALE",
"(",
"state",
"->",
"scalepos",
")",
";",
"state",
"->",
"keyscaleneg",
"=",
"RECIP_SCALE",
"(",
"state",
"->",
"scaleneg",
")",
";",
"return",
"state",
";",
"}"
] | init_field_analog_state - allocate and populate
information about an analog port | [
"init_field_analog_state",
"-",
"allocate",
"and",
"populate",
"information",
"about",
"an",
"analog",
"port"
] | [
"/* allocate memory */",
"/* compute the shift amount and number of bits */",
"/* initialize core data */",
"/* set basic parameters based on the configured type */",
"/* pedals start at and autocenter to the min range */",
"/* paddles and analog joysticks are absolute and autocenter */",
"/* lightguns are absolute as well, but don't autocenter and don't interpolate their values */",
"/* dials, mice and trackballs are relative devices */",
"/* these have fixed \"min\" and \"max\" values based on how many bits are in the port */",
"/* in addition, we set the wrap around min/max values to 512 * the min/max values */",
"/* this takes into account the mapping that one mouse unit ~= 512 analog units */",
"/* positional devices are abolute, but can also wrap like relative devices */",
"/* set each position to be 512 units */",
"/* further processing for absolute controls */",
"/* if the default value is pegged at the min or max, use a single scale value for the whole axis */",
"/* if not \"single scale\", compute separate scales for each side of the default */",
"/* unsigned */",
"/* reverse point is at center */",
"/* single axis that increases from default */",
"/* move from default */",
"/* make the scaling the same for easier coding when we need to scale */",
"/* reverse point is at max */",
"/* relative and positional controls all map directly with a 512x scale factor */",
"/* The relative code is set up to allow specifing PORT_MINMAX and default values. */",
"/* The validity checks are purposely set up to not allow you to use anything other */",
"/* a default of 0 and PORT_MINMAX(0,mask). This is in case the need arises to use */",
"/* this feature in the future. Keeping the code in does not hurt anything. */",
"/* adjust for signed */",
"/* make the scaling the same for easier coding when we need to scale */",
"/* delta values reverse from center */",
"/* positional controls reverse from their max range */",
"/* relative controls reverse from 1 past their max range */",
"/* compute scale for keypresses */"
] | [
{
"param": "field",
"type": "input_field_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": "input_field_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_port_update_hook | void | static void input_port_update_hook(running_machine *machine, const input_port_config *port, input_port_value *digital)
{
const key_buffer *keybuf;
const inputx_code *code;
unicode_char ch;
int i;
UINT32 value;
if (inputx_can_post(machine))
{
keybuf = get_buffer(machine);
/* is the key down right now? */
if (keybuf->status_keydown && (keybuf->begin_pos != keybuf->end_pos))
{
/* identify the character that is down right now, and its component codes */
ch = keybuf->buffer[keybuf->begin_pos];
code = find_code(ch);
/* loop through this character's component codes */
if (code != NULL)
{
for (i = 0; i < ARRAY_LENGTH(code->field) && (code->field[i] != NULL); i++)
{
if (code->field[i]->port == port)
{
value = code->field[i]->mask;
*digital |= value;
}
}
}
}
}
} | /*-------------------------------------------------
input_port_update_hook - hook function
called from core to allow for natural keyboard
-------------------------------------------------*/ | hook function
called from core to allow for natural keyboard | [
"hook",
"function",
"called",
"from",
"core",
"to",
"allow",
"for",
"natural",
"keyboard"
] | static void input_port_update_hook(running_machine *machine, const input_port_config *port, input_port_value *digital)
{
const key_buffer *keybuf;
const inputx_code *code;
unicode_char ch;
int i;
UINT32 value;
if (inputx_can_post(machine))
{
keybuf = get_buffer(machine);
if (keybuf->status_keydown && (keybuf->begin_pos != keybuf->end_pos))
{
ch = keybuf->buffer[keybuf->begin_pos];
code = find_code(ch);
if (code != NULL)
{
for (i = 0; i < ARRAY_LENGTH(code->field) && (code->field[i] != NULL); i++)
{
if (code->field[i]->port == port)
{
value = code->field[i]->mask;
*digital |= value;
}
}
}
}
}
} | [
"static",
"void",
"input_port_update_hook",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"input_port_config",
"*",
"port",
",",
"input_port_value",
"*",
"digital",
")",
"{",
"const",
"key_buffer",
"*",
"keybuf",
";",
"const",
"inputx_code",
"*",
"code",
";",
"unicode_char",
"ch",
";",
"int",
"i",
";",
"UINT32",
"value",
";",
"if",
"(",
"inputx_can_post",
"(",
"machine",
")",
")",
"{",
"keybuf",
"=",
"get_buffer",
"(",
"machine",
")",
";",
"if",
"(",
"keybuf",
"->",
"status_keydown",
"&&",
"(",
"keybuf",
"->",
"begin_pos",
"!=",
"keybuf",
"->",
"end_pos",
")",
")",
"{",
"ch",
"=",
"keybuf",
"->",
"buffer",
"[",
"keybuf",
"->",
"begin_pos",
"]",
";",
"code",
"=",
"find_code",
"(",
"ch",
")",
";",
"if",
"(",
"code",
"!=",
"NULL",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"ARRAY_LENGTH",
"(",
"code",
"->",
"field",
")",
"&&",
"(",
"code",
"->",
"field",
"[",
"i",
"]",
"!=",
"NULL",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"code",
"->",
"field",
"[",
"i",
"]",
"->",
"port",
"==",
"port",
")",
"{",
"value",
"=",
"code",
"->",
"field",
"[",
"i",
"]",
"->",
"mask",
";",
"*",
"digital",
"|=",
"value",
";",
"}",
"}",
"}",
"}",
"}",
"}"
] | input_port_update_hook - hook function
called from core to allow for natural keyboard | [
"input_port_update_hook",
"-",
"hook",
"function",
"called",
"from",
"core",
"to",
"allow",
"for",
"natural",
"keyboard"
] | [
"/* is the key down right now? */",
"/* identify the character that is down right now, and its component codes */",
"/* loop through this character's component codes */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "port",
"type": "input_port_config"
},
{
"param": "digital",
"type": "input_port_value"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "port",
"type": "input_port_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "digital",
"type": "input_port_value",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | frame_update | void | static void frame_update(running_machine *machine)
{
input_port_private *portdata = machine->input_port_data;
const input_field_config *mouse_field = NULL;
int ui_visible = ui_is_menu_active();
attotime curtime = timer_get_time(machine);
const input_port_config *port;
render_target *mouse_target;
INT32 mouse_target_x;
INT32 mouse_target_y;
int mouse_button;
profiler_mark_start(PROFILER_INPUT);
/* record/playback information about the current frame */
playback_frame(machine, curtime);
record_frame(machine, curtime);
/* track the duration of the previous frame */
portdata->last_delta_nsec = attotime_to_attoseconds(attotime_sub(curtime, portdata->last_frame_time)) / ATTOSECONDS_PER_NANOSECOND;
portdata->last_frame_time = curtime;
/* update the digital joysticks */
frame_update_digital_joysticks(machine);
/* compute default values for all the ports */
input_port_update_defaults(machine);
/* perform the mouse hit test */
mouse_target = ui_input_find_mouse(machine, &mouse_target_x, &mouse_target_y, &mouse_button);
if (mouse_button && mouse_target)
{
const char *tag = NULL;
input_port_value mask;
if (render_target_map_point_input(mouse_target, mouse_target_x, mouse_target_y, &tag, &mask, NULL, NULL))
mouse_field = input_field_by_tag_and_mask(machine->m_portlist, tag, mask);
}
/* loop over all input ports */
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
{
const input_field_config *field;
device_field_info *device_field;
input_port_value newvalue;
/* start with 0 values for the digital and VBLANK bits */
port->state->digital = 0;
port->state->vblank = 0;
/* now loop back and modify based on the inputs */
for (field = port->fieldlist; field != NULL; field = field->next)
if (input_condition_true(port->machine, &field->condition))
{
/* accumulate VBLANK bits */
if (field->type == IPT_VBLANK)
port->state->vblank ^= field->mask;
/* handle analog inputs */
else if (field->state->analog != NULL)
frame_update_analog_field(machine, field->state->analog);
/* handle non-analog types, but only when the UI isn't visible */
else if (!ui_visible && frame_get_digital_field_state(field, field == mouse_field))
port->state->digital |= field->mask;
}
/* hook for MESS's natural keyboard support */
input_port_update_hook(machine, port, &port->state->digital);
/* handle playback/record */
playback_port(port);
record_port(port);
/* call device line changed handlers */
newvalue = input_port_read_direct(port);
for (device_field = port->state->writedevicelist; device_field; device_field = device_field->next)
if (device_field->field->type != IPT_OUTPUT && input_condition_true(port->machine, &device_field->field->condition))
{
input_port_value newval = (newvalue & device_field->field->mask) >> device_field->shift;
/* if the bits have changed, call the handler */
if (device_field->oldval != newval)
{
(*device_field->field->write_line_device)(device_field->device, newval);
device_field->oldval = newval;
}
}
}
profiler_mark_end();
} | /*-------------------------------------------------
frame_update - core logic for per-frame input
port updating
-------------------------------------------------*/ | core logic for per-frame input
port updating | [
"core",
"logic",
"for",
"per",
"-",
"frame",
"input",
"port",
"updating"
] | static void frame_update(running_machine *machine)
{
input_port_private *portdata = machine->input_port_data;
const input_field_config *mouse_field = NULL;
int ui_visible = ui_is_menu_active();
attotime curtime = timer_get_time(machine);
const input_port_config *port;
render_target *mouse_target;
INT32 mouse_target_x;
INT32 mouse_target_y;
int mouse_button;
profiler_mark_start(PROFILER_INPUT);
playback_frame(machine, curtime);
record_frame(machine, curtime);
portdata->last_delta_nsec = attotime_to_attoseconds(attotime_sub(curtime, portdata->last_frame_time)) / ATTOSECONDS_PER_NANOSECOND;
portdata->last_frame_time = curtime;
frame_update_digital_joysticks(machine);
input_port_update_defaults(machine);
mouse_target = ui_input_find_mouse(machine, &mouse_target_x, &mouse_target_y, &mouse_button);
if (mouse_button && mouse_target)
{
const char *tag = NULL;
input_port_value mask;
if (render_target_map_point_input(mouse_target, mouse_target_x, mouse_target_y, &tag, &mask, NULL, NULL))
mouse_field = input_field_by_tag_and_mask(machine->m_portlist, tag, mask);
}
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
{
const input_field_config *field;
device_field_info *device_field;
input_port_value newvalue;
port->state->digital = 0;
port->state->vblank = 0;
for (field = port->fieldlist; field != NULL; field = field->next)
if (input_condition_true(port->machine, &field->condition))
{
if (field->type == IPT_VBLANK)
port->state->vblank ^= field->mask;
else if (field->state->analog != NULL)
frame_update_analog_field(machine, field->state->analog);
else if (!ui_visible && frame_get_digital_field_state(field, field == mouse_field))
port->state->digital |= field->mask;
}
input_port_update_hook(machine, port, &port->state->digital);
playback_port(port);
record_port(port);
newvalue = input_port_read_direct(port);
for (device_field = port->state->writedevicelist; device_field; device_field = device_field->next)
if (device_field->field->type != IPT_OUTPUT && input_condition_true(port->machine, &device_field->field->condition))
{
input_port_value newval = (newvalue & device_field->field->mask) >> device_field->shift;
if (device_field->oldval != newval)
{
(*device_field->field->write_line_device)(device_field->device, newval);
device_field->oldval = newval;
}
}
}
profiler_mark_end();
} | [
"static",
"void",
"frame_update",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"const",
"input_field_config",
"*",
"mouse_field",
"=",
"NULL",
";",
"int",
"ui_visible",
"=",
"ui_is_menu_active",
"(",
")",
";",
"attotime",
"curtime",
"=",
"timer_get_time",
"(",
"machine",
")",
";",
"const",
"input_port_config",
"*",
"port",
";",
"render_target",
"*",
"mouse_target",
";",
"INT32",
"mouse_target_x",
";",
"INT32",
"mouse_target_y",
";",
"int",
"mouse_button",
";",
"profiler_mark_start",
"(",
"PROFILER_INPUT",
")",
";",
"playback_frame",
"(",
"machine",
",",
"curtime",
")",
";",
"record_frame",
"(",
"machine",
",",
"curtime",
")",
";",
"portdata",
"->",
"last_delta_nsec",
"=",
"attotime_to_attoseconds",
"(",
"attotime_sub",
"(",
"curtime",
",",
"portdata",
"->",
"last_frame_time",
")",
")",
"/",
"ATTOSECONDS_PER_NANOSECOND",
";",
"portdata",
"->",
"last_frame_time",
"=",
"curtime",
";",
"frame_update_digital_joysticks",
"(",
"machine",
")",
";",
"input_port_update_defaults",
"(",
"machine",
")",
";",
"mouse_target",
"=",
"ui_input_find_mouse",
"(",
"machine",
",",
"&",
"mouse_target_x",
",",
"&",
"mouse_target_y",
",",
"&",
"mouse_button",
")",
";",
"if",
"(",
"mouse_button",
"&&",
"mouse_target",
")",
"{",
"const",
"char",
"*",
"tag",
"=",
"NULL",
";",
"input_port_value",
"mask",
";",
"if",
"(",
"render_target_map_point_input",
"(",
"mouse_target",
",",
"mouse_target_x",
",",
"mouse_target_y",
",",
"&",
"tag",
",",
"&",
"mask",
",",
"NULL",
",",
"NULL",
")",
")",
"mouse_field",
"=",
"input_field_by_tag_and_mask",
"(",
"machine",
"->",
"m_portlist",
",",
"tag",
",",
"mask",
")",
";",
"}",
"for",
"(",
"port",
"=",
"machine",
"->",
"m_portlist",
".",
"first",
"(",
")",
";",
"port",
"!=",
"NULL",
";",
"port",
"=",
"port",
"->",
"next",
"(",
")",
")",
"{",
"const",
"input_field_config",
"*",
"field",
";",
"device_field_info",
"*",
"device_field",
";",
"input_port_value",
"newvalue",
";",
"port",
"->",
"state",
"->",
"digital",
"=",
"0",
";",
"port",
"->",
"state",
"->",
"vblank",
"=",
"0",
";",
"for",
"(",
"field",
"=",
"port",
"->",
"fieldlist",
";",
"field",
"!=",
"NULL",
";",
"field",
"=",
"field",
"->",
"next",
")",
"if",
"(",
"input_condition_true",
"(",
"port",
"->",
"machine",
",",
"&",
"field",
"->",
"condition",
")",
")",
"{",
"if",
"(",
"field",
"->",
"type",
"==",
"IPT_VBLANK",
")",
"port",
"->",
"state",
"->",
"vblank",
"^=",
"field",
"->",
"mask",
";",
"else",
"if",
"(",
"field",
"->",
"state",
"->",
"analog",
"!=",
"NULL",
")",
"frame_update_analog_field",
"(",
"machine",
",",
"field",
"->",
"state",
"->",
"analog",
")",
";",
"else",
"if",
"(",
"!",
"ui_visible",
"&&",
"frame_get_digital_field_state",
"(",
"field",
",",
"field",
"==",
"mouse_field",
")",
")",
"port",
"->",
"state",
"->",
"digital",
"|=",
"field",
"->",
"mask",
";",
"}",
"input_port_update_hook",
"(",
"machine",
",",
"port",
",",
"&",
"port",
"->",
"state",
"->",
"digital",
")",
";",
"playback_port",
"(",
"port",
")",
";",
"record_port",
"(",
"port",
")",
";",
"newvalue",
"=",
"input_port_read_direct",
"(",
"port",
")",
";",
"for",
"(",
"device_field",
"=",
"port",
"->",
"state",
"->",
"writedevicelist",
";",
"device_field",
";",
"device_field",
"=",
"device_field",
"->",
"next",
")",
"if",
"(",
"device_field",
"->",
"field",
"->",
"type",
"!=",
"IPT_OUTPUT",
"&&",
"input_condition_true",
"(",
"port",
"->",
"machine",
",",
"&",
"device_field",
"->",
"field",
"->",
"condition",
")",
")",
"{",
"input_port_value",
"newval",
"=",
"(",
"newvalue",
"&",
"device_field",
"->",
"field",
"->",
"mask",
")",
">>",
"device_field",
"->",
"shift",
";",
"if",
"(",
"device_field",
"->",
"oldval",
"!=",
"newval",
")",
"{",
"(",
"*",
"device_field",
"->",
"field",
"->",
"write_line_device",
")",
"(",
"device_field",
"->",
"device",
",",
"newval",
")",
";",
"device_field",
"->",
"oldval",
"=",
"newval",
";",
"}",
"}",
"}",
"profiler_mark_end",
"(",
")",
";",
"}"
] | frame_update - core logic for per-frame input
port updating | [
"frame_update",
"-",
"core",
"logic",
"for",
"per",
"-",
"frame",
"input",
"port",
"updating"
] | [
"/* record/playback information about the current frame */",
"/* track the duration of the previous frame */",
"/* update the digital joysticks */",
"/* compute default values for all the ports */",
"/* perform the mouse hit test */",
"/* loop over all input ports */",
"/* start with 0 values for the digital and VBLANK bits */",
"/* now loop back and modify based on the inputs */",
"/* accumulate VBLANK bits */",
"/* handle analog inputs */",
"/* handle non-analog types, but only when the UI isn't visible */",
"/* hook for MESS's natural keyboard support */",
"/* handle playback/record */",
"/* call device line changed handlers */",
"/* if the bits have changed, call the handler */"
] | [
{
"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": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | frame_update_digital_joysticks | void | static void frame_update_digital_joysticks(running_machine *machine)
{
input_port_private *portdata = machine->input_port_data;
int player, joyindex;
/* loop over all the joysticks */
for (player = 0; player < MAX_PLAYERS; player++)
for (joyindex = 0; joyindex < DIGITAL_JOYSTICKS_PER_PLAYER; joyindex++)
{
digital_joystick_state *joystick = &portdata->joystick_info[player][joyindex];
if (joystick->inuse)
{
joystick->previous = joystick->current;
joystick->current = 0;
/* read all the associated ports */
if (joystick->field[JOYDIR_UP] != NULL && input_seq_pressed(machine, input_field_seq(joystick->field[JOYDIR_UP], SEQ_TYPE_STANDARD)))
joystick->current |= JOYDIR_UP_BIT;
if (joystick->field[JOYDIR_DOWN] != NULL && input_seq_pressed(machine, input_field_seq(joystick->field[JOYDIR_DOWN], SEQ_TYPE_STANDARD)))
joystick->current |= JOYDIR_DOWN_BIT;
if (joystick->field[JOYDIR_LEFT] != NULL && input_seq_pressed(machine, input_field_seq(joystick->field[JOYDIR_LEFT], SEQ_TYPE_STANDARD)))
joystick->current |= JOYDIR_LEFT_BIT;
if (joystick->field[JOYDIR_RIGHT] != NULL && input_seq_pressed(machine, input_field_seq(joystick->field[JOYDIR_RIGHT], SEQ_TYPE_STANDARD)))
joystick->current |= JOYDIR_RIGHT_BIT;
/* lock out opposing directions (left + right or up + down) */
if ((joystick->current & (JOYDIR_UP_BIT | JOYDIR_DOWN_BIT)) == (JOYDIR_UP_BIT | JOYDIR_DOWN_BIT))
joystick->current &= ~(JOYDIR_UP_BIT | JOYDIR_DOWN_BIT);
if ((joystick->current & (JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT)) == (JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT))
joystick->current &= ~(JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT);
/* only update 4-way case if joystick has moved */
if (joystick->current != joystick->previous)
{
joystick->current4way = joystick->current;
/*
If joystick is pointing at a diagonal, acknowledge that the player moved
the joystick by favoring a direction change. This minimizes frustration
when using a keyboard for input, and maximizes responsiveness.
For example, if you are holding "left" then switch to "up" (where both left
and up are briefly pressed at the same time), we'll transition immediately
to "up."
Zero any switches that didn't change from the previous to current state.
*/
if ((joystick->current4way & (JOYDIR_UP_BIT | JOYDIR_DOWN_BIT)) &&
(joystick->current4way & (JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT)))
{
joystick->current4way ^= joystick->current4way & joystick->previous;
}
/*
If we are still pointing at a diagonal, we are in an indeterminant state.
This could happen if the player moved the joystick from the idle position directly
to a diagonal, or from one diagonal directly to an extreme diagonal.
The chances of this happening with a keyboard are slim, but we still need to
constrain this case.
For now, just resolve randomly.
*/
if ((joystick->current4way & (JOYDIR_UP_BIT | JOYDIR_DOWN_BIT)) &&
(joystick->current4way & (JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT)))
{
if (mame_rand(machine) & 1)
joystick->current4way &= ~(JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT);
else
joystick->current4way &= ~(JOYDIR_UP_BIT | JOYDIR_DOWN_BIT);
}
}
}
}
} | /*-------------------------------------------------
frame_update_digital_joysticks - update the
state of digital joysticks prior to
accumulating the results in a port
-------------------------------------------------*/ | update the
state of digital joysticks prior to
accumulating the results in a port | [
"update",
"the",
"state",
"of",
"digital",
"joysticks",
"prior",
"to",
"accumulating",
"the",
"results",
"in",
"a",
"port"
] | static void frame_update_digital_joysticks(running_machine *machine)
{
input_port_private *portdata = machine->input_port_data;
int player, joyindex;
for (player = 0; player < MAX_PLAYERS; player++)
for (joyindex = 0; joyindex < DIGITAL_JOYSTICKS_PER_PLAYER; joyindex++)
{
digital_joystick_state *joystick = &portdata->joystick_info[player][joyindex];
if (joystick->inuse)
{
joystick->previous = joystick->current;
joystick->current = 0;
if (joystick->field[JOYDIR_UP] != NULL && input_seq_pressed(machine, input_field_seq(joystick->field[JOYDIR_UP], SEQ_TYPE_STANDARD)))
joystick->current |= JOYDIR_UP_BIT;
if (joystick->field[JOYDIR_DOWN] != NULL && input_seq_pressed(machine, input_field_seq(joystick->field[JOYDIR_DOWN], SEQ_TYPE_STANDARD)))
joystick->current |= JOYDIR_DOWN_BIT;
if (joystick->field[JOYDIR_LEFT] != NULL && input_seq_pressed(machine, input_field_seq(joystick->field[JOYDIR_LEFT], SEQ_TYPE_STANDARD)))
joystick->current |= JOYDIR_LEFT_BIT;
if (joystick->field[JOYDIR_RIGHT] != NULL && input_seq_pressed(machine, input_field_seq(joystick->field[JOYDIR_RIGHT], SEQ_TYPE_STANDARD)))
joystick->current |= JOYDIR_RIGHT_BIT;
if ((joystick->current & (JOYDIR_UP_BIT | JOYDIR_DOWN_BIT)) == (JOYDIR_UP_BIT | JOYDIR_DOWN_BIT))
joystick->current &= ~(JOYDIR_UP_BIT | JOYDIR_DOWN_BIT);
if ((joystick->current & (JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT)) == (JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT))
joystick->current &= ~(JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT);
if (joystick->current != joystick->previous)
{
joystick->current4way = joystick->current;
if ((joystick->current4way & (JOYDIR_UP_BIT | JOYDIR_DOWN_BIT)) &&
(joystick->current4way & (JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT)))
{
joystick->current4way ^= joystick->current4way & joystick->previous;
}
if ((joystick->current4way & (JOYDIR_UP_BIT | JOYDIR_DOWN_BIT)) &&
(joystick->current4way & (JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT)))
{
if (mame_rand(machine) & 1)
joystick->current4way &= ~(JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT);
else
joystick->current4way &= ~(JOYDIR_UP_BIT | JOYDIR_DOWN_BIT);
}
}
}
}
} | [
"static",
"void",
"frame_update_digital_joysticks",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"int",
"player",
",",
"joyindex",
";",
"for",
"(",
"player",
"=",
"0",
";",
"player",
"<",
"MAX_PLAYERS",
";",
"player",
"++",
")",
"for",
"(",
"joyindex",
"=",
"0",
";",
"joyindex",
"<",
"DIGITAL_JOYSTICKS_PER_PLAYER",
";",
"joyindex",
"++",
")",
"{",
"digital_joystick_state",
"*",
"joystick",
"=",
"&",
"portdata",
"->",
"joystick_info",
"[",
"player",
"]",
"[",
"joyindex",
"]",
";",
"if",
"(",
"joystick",
"->",
"inuse",
")",
"{",
"joystick",
"->",
"previous",
"=",
"joystick",
"->",
"current",
";",
"joystick",
"->",
"current",
"=",
"0",
";",
"if",
"(",
"joystick",
"->",
"field",
"[",
"JOYDIR_UP",
"]",
"!=",
"NULL",
"&&",
"input_seq_pressed",
"(",
"machine",
",",
"input_field_seq",
"(",
"joystick",
"->",
"field",
"[",
"JOYDIR_UP",
"]",
",",
"SEQ_TYPE_STANDARD",
")",
")",
")",
"joystick",
"->",
"current",
"|=",
"JOYDIR_UP_BIT",
";",
"if",
"(",
"joystick",
"->",
"field",
"[",
"JOYDIR_DOWN",
"]",
"!=",
"NULL",
"&&",
"input_seq_pressed",
"(",
"machine",
",",
"input_field_seq",
"(",
"joystick",
"->",
"field",
"[",
"JOYDIR_DOWN",
"]",
",",
"SEQ_TYPE_STANDARD",
")",
")",
")",
"joystick",
"->",
"current",
"|=",
"JOYDIR_DOWN_BIT",
";",
"if",
"(",
"joystick",
"->",
"field",
"[",
"JOYDIR_LEFT",
"]",
"!=",
"NULL",
"&&",
"input_seq_pressed",
"(",
"machine",
",",
"input_field_seq",
"(",
"joystick",
"->",
"field",
"[",
"JOYDIR_LEFT",
"]",
",",
"SEQ_TYPE_STANDARD",
")",
")",
")",
"joystick",
"->",
"current",
"|=",
"JOYDIR_LEFT_BIT",
";",
"if",
"(",
"joystick",
"->",
"field",
"[",
"JOYDIR_RIGHT",
"]",
"!=",
"NULL",
"&&",
"input_seq_pressed",
"(",
"machine",
",",
"input_field_seq",
"(",
"joystick",
"->",
"field",
"[",
"JOYDIR_RIGHT",
"]",
",",
"SEQ_TYPE_STANDARD",
")",
")",
")",
"joystick",
"->",
"current",
"|=",
"JOYDIR_RIGHT_BIT",
";",
"if",
"(",
"(",
"joystick",
"->",
"current",
"&",
"(",
"JOYDIR_UP_BIT",
"|",
"JOYDIR_DOWN_BIT",
")",
")",
"==",
"(",
"JOYDIR_UP_BIT",
"|",
"JOYDIR_DOWN_BIT",
")",
")",
"joystick",
"->",
"current",
"&=",
"~",
"(",
"JOYDIR_UP_BIT",
"|",
"JOYDIR_DOWN_BIT",
")",
";",
"if",
"(",
"(",
"joystick",
"->",
"current",
"&",
"(",
"JOYDIR_LEFT_BIT",
"|",
"JOYDIR_RIGHT_BIT",
")",
")",
"==",
"(",
"JOYDIR_LEFT_BIT",
"|",
"JOYDIR_RIGHT_BIT",
")",
")",
"joystick",
"->",
"current",
"&=",
"~",
"(",
"JOYDIR_LEFT_BIT",
"|",
"JOYDIR_RIGHT_BIT",
")",
";",
"if",
"(",
"joystick",
"->",
"current",
"!=",
"joystick",
"->",
"previous",
")",
"{",
"joystick",
"->",
"current4way",
"=",
"joystick",
"->",
"current",
";",
"if",
"(",
"(",
"joystick",
"->",
"current4way",
"&",
"(",
"JOYDIR_UP_BIT",
"|",
"JOYDIR_DOWN_BIT",
")",
")",
"&&",
"(",
"joystick",
"->",
"current4way",
"&",
"(",
"JOYDIR_LEFT_BIT",
"|",
"JOYDIR_RIGHT_BIT",
")",
")",
")",
"{",
"joystick",
"->",
"current4way",
"^=",
"joystick",
"->",
"current4way",
"&",
"joystick",
"->",
"previous",
";",
"}",
"if",
"(",
"(",
"joystick",
"->",
"current4way",
"&",
"(",
"JOYDIR_UP_BIT",
"|",
"JOYDIR_DOWN_BIT",
")",
")",
"&&",
"(",
"joystick",
"->",
"current4way",
"&",
"(",
"JOYDIR_LEFT_BIT",
"|",
"JOYDIR_RIGHT_BIT",
")",
")",
")",
"{",
"if",
"(",
"mame_rand",
"(",
"machine",
")",
"&",
"1",
")",
"joystick",
"->",
"current4way",
"&=",
"~",
"(",
"JOYDIR_LEFT_BIT",
"|",
"JOYDIR_RIGHT_BIT",
")",
";",
"else",
"joystick",
"->",
"current4way",
"&=",
"~",
"(",
"JOYDIR_UP_BIT",
"|",
"JOYDIR_DOWN_BIT",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | frame_update_digital_joysticks - update the
state of digital joysticks prior to
accumulating the results in a port | [
"frame_update_digital_joysticks",
"-",
"update",
"the",
"state",
"of",
"digital",
"joysticks",
"prior",
"to",
"accumulating",
"the",
"results",
"in",
"a",
"port"
] | [
"/* loop over all the joysticks */",
"/* read all the associated ports */",
"/* lock out opposing directions (left + right or up + down) */",
"/* only update 4-way case if joystick has moved */",
"/*\r\n If joystick is pointing at a diagonal, acknowledge that the player moved\r\n the joystick by favoring a direction change. This minimizes frustration\r\n when using a keyboard for input, and maximizes responsiveness.\r\n\r\n For example, if you are holding \"left\" then switch to \"up\" (where both left\r\n and up are briefly pressed at the same time), we'll transition immediately\r\n to \"up.\"\r\n\r\n Zero any switches that didn't change from the previous to current state.\r\n */",
"/*\r\n If we are still pointing at a diagonal, we are in an indeterminant state.\r\n\r\n This could happen if the player moved the joystick from the idle position directly\r\n to a diagonal, or from one diagonal directly to an extreme diagonal.\r\n\r\n The chances of this happening with a keyboard are slim, but we still need to\r\n constrain this case.\r\n\r\n For now, just resolve randomly.\r\n */"
] | [
{
"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": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | frame_update_analog_field | void | static void frame_update_analog_field(running_machine *machine, analog_field_state *analog)
{
input_item_class itemclass;
int keypressed = FALSE;
INT64 keyscale;
INT32 rawvalue;
INT32 delta = 0;
/* clamp the previous value to the min/max range and remember it */
analog->previous = analog->accum = apply_analog_min_max(analog, analog->accum);
/* get the new raw analog value and its type */
rawvalue = input_seq_axis_value(machine, input_field_seq(analog->field, SEQ_TYPE_STANDARD), &itemclass);
/* if we got an absolute input, it overrides everything else */
if (itemclass == ITEM_CLASS_ABSOLUTE)
{
if (analog->previousanalog != rawvalue)
{
/* only update if analog value changed */
analog->previousanalog = rawvalue;
/* apply the inverse of the sensitivity to the raw value so that */
/* it will still cover the full min->max range requested after */
/* we apply the sensitivity adjustment */
if (analog->absolute || (analog->field->flags & ANALOG_FLAG_RESET))
{
/* if port is absolute, then just return the absolute data supplied */
analog->accum = APPLY_INVERSE_SENSITIVITY(rawvalue, analog->sensitivity);
}
else if (analog->positionalscale != 0)
{
/* if port is positional, we will take the full analog control and divide it */
/* into positions, that way as the control is moved full scale, */
/* it moves through all the positions */
rawvalue = APPLY_SCALE(rawvalue - INPUT_ABSOLUTE_MIN, analog->positionalscale) * INPUT_RELATIVE_PER_PIXEL + analog->minimum;
/* clamp the high value so it does not roll over */
rawvalue = MIN(rawvalue, analog->maximum);
analog->accum = APPLY_INVERSE_SENSITIVITY(rawvalue, analog->sensitivity);
}
else
/* if port is relative, we use the value to simulate the speed of relative movement */
/* sensitivity adjustment is allowed for this mode */
analog->accum += rawvalue;
analog->lastdigital = 0;
/* do not bother with other control types if the analog data is changing */
return;
}
else
{
/* we still have to update fake relative from joystick control */
if (!analog->absolute && analog->positionalscale == 0)
analog->accum += rawvalue;
}
}
/* if we got it from a relative device, use that as the starting delta */
/* also note that the last input was not a digital one */
if (itemclass == ITEM_CLASS_RELATIVE && rawvalue != 0)
{
delta = rawvalue;
analog->lastdigital = 0;
}
keyscale = (analog->accum >= 0) ? analog->keyscalepos : analog->keyscaleneg;
/* if the decrement code sequence is pressed, add the key delta to */
/* the accumulated delta; also note that the last input was a digital one */
if (input_seq_pressed(machine, input_field_seq(analog->field, SEQ_TYPE_DECREMENT)))
{
keypressed = TRUE;
if (analog->delta != 0)
delta -= APPLY_SCALE(analog->delta, keyscale);
else if (!analog->lastdigital)
/* decrement only once when first pressed */
delta -= APPLY_SCALE(1, keyscale);
analog->lastdigital = TRUE;
}
/* same for the increment code sequence */
if (input_seq_pressed(machine, input_field_seq(analog->field, SEQ_TYPE_INCREMENT)))
{
keypressed = TRUE;
if (analog->delta)
delta += APPLY_SCALE(analog->delta, keyscale);
else if (!analog->lastdigital)
/* increment only once when first pressed */
delta += APPLY_SCALE(1, keyscale);
analog->lastdigital = TRUE;
}
/* if resetting is requested, clear the accumulated position to 0 before */
/* applying the deltas so that we only return this frame's delta */
/* note that centering only works for relative controls */
/* no need to check if absolute here because it is checked by the validity tests */
if (analog->field->flags & ANALOG_FLAG_RESET)
analog->accum = 0;
/* apply the delta to the accumulated value */
analog->accum += delta;
/* if our last movement was due to a digital input, and if this control */
/* type autocenters, and if neither the increment nor the decrement seq */
/* was pressed, apply autocentering */
if (analog->autocenter)
{
INT32 center = APPLY_INVERSE_SENSITIVITY(analog->center, analog->sensitivity);
if (analog->lastdigital && !keypressed)
{
/* autocenter from positive values */
if (analog->accum >= center)
{
analog->accum -= APPLY_SCALE(analog->centerdelta, analog->keyscalepos);
if (analog->accum < center)
{
analog->accum = center;
analog->lastdigital = FALSE;
}
}
/* autocenter from negative values */
else
{
analog->accum += APPLY_SCALE(analog->centerdelta, analog->keyscaleneg);
if (analog->accum > center)
{
analog->accum = center;
analog->lastdigital = FALSE;
}
}
}
}
else if (!keypressed)
analog->lastdigital = FALSE;
} | /*-------------------------------------------------
frame_update_analog_field - update the
internals of a single analog field
-------------------------------------------------*/ | update the
internals of a single analog field | [
"update",
"the",
"internals",
"of",
"a",
"single",
"analog",
"field"
] | static void frame_update_analog_field(running_machine *machine, analog_field_state *analog)
{
input_item_class itemclass;
int keypressed = FALSE;
INT64 keyscale;
INT32 rawvalue;
INT32 delta = 0;
analog->previous = analog->accum = apply_analog_min_max(analog, analog->accum);
rawvalue = input_seq_axis_value(machine, input_field_seq(analog->field, SEQ_TYPE_STANDARD), &itemclass);
if (itemclass == ITEM_CLASS_ABSOLUTE)
{
if (analog->previousanalog != rawvalue)
{
analog->previousanalog = rawvalue;
if (analog->absolute || (analog->field->flags & ANALOG_FLAG_RESET))
{
analog->accum = APPLY_INVERSE_SENSITIVITY(rawvalue, analog->sensitivity);
}
else if (analog->positionalscale != 0)
{
rawvalue = APPLY_SCALE(rawvalue - INPUT_ABSOLUTE_MIN, analog->positionalscale) * INPUT_RELATIVE_PER_PIXEL + analog->minimum;
rawvalue = MIN(rawvalue, analog->maximum);
analog->accum = APPLY_INVERSE_SENSITIVITY(rawvalue, analog->sensitivity);
}
else
analog->accum += rawvalue;
analog->lastdigital = 0;
return;
}
else
{
if (!analog->absolute && analog->positionalscale == 0)
analog->accum += rawvalue;
}
}
if (itemclass == ITEM_CLASS_RELATIVE && rawvalue != 0)
{
delta = rawvalue;
analog->lastdigital = 0;
}
keyscale = (analog->accum >= 0) ? analog->keyscalepos : analog->keyscaleneg;
if (input_seq_pressed(machine, input_field_seq(analog->field, SEQ_TYPE_DECREMENT)))
{
keypressed = TRUE;
if (analog->delta != 0)
delta -= APPLY_SCALE(analog->delta, keyscale);
else if (!analog->lastdigital)
delta -= APPLY_SCALE(1, keyscale);
analog->lastdigital = TRUE;
}
if (input_seq_pressed(machine, input_field_seq(analog->field, SEQ_TYPE_INCREMENT)))
{
keypressed = TRUE;
if (analog->delta)
delta += APPLY_SCALE(analog->delta, keyscale);
else if (!analog->lastdigital)
delta += APPLY_SCALE(1, keyscale);
analog->lastdigital = TRUE;
}
if (analog->field->flags & ANALOG_FLAG_RESET)
analog->accum = 0;
analog->accum += delta;
if (analog->autocenter)
{
INT32 center = APPLY_INVERSE_SENSITIVITY(analog->center, analog->sensitivity);
if (analog->lastdigital && !keypressed)
{
if (analog->accum >= center)
{
analog->accum -= APPLY_SCALE(analog->centerdelta, analog->keyscalepos);
if (analog->accum < center)
{
analog->accum = center;
analog->lastdigital = FALSE;
}
}
else
{
analog->accum += APPLY_SCALE(analog->centerdelta, analog->keyscaleneg);
if (analog->accum > center)
{
analog->accum = center;
analog->lastdigital = FALSE;
}
}
}
}
else if (!keypressed)
analog->lastdigital = FALSE;
} | [
"static",
"void",
"frame_update_analog_field",
"(",
"running_machine",
"*",
"machine",
",",
"analog_field_state",
"*",
"analog",
")",
"{",
"input_item_class",
"itemclass",
";",
"int",
"keypressed",
"=",
"FALSE",
";",
"INT64",
"keyscale",
";",
"INT32",
"rawvalue",
";",
"INT32",
"delta",
"=",
"0",
";",
"analog",
"->",
"previous",
"=",
"analog",
"->",
"accum",
"=",
"apply_analog_min_max",
"(",
"analog",
",",
"analog",
"->",
"accum",
")",
";",
"rawvalue",
"=",
"input_seq_axis_value",
"(",
"machine",
",",
"input_field_seq",
"(",
"analog",
"->",
"field",
",",
"SEQ_TYPE_STANDARD",
")",
",",
"&",
"itemclass",
")",
";",
"if",
"(",
"itemclass",
"==",
"ITEM_CLASS_ABSOLUTE",
")",
"{",
"if",
"(",
"analog",
"->",
"previousanalog",
"!=",
"rawvalue",
")",
"{",
"analog",
"->",
"previousanalog",
"=",
"rawvalue",
";",
"if",
"(",
"analog",
"->",
"absolute",
"||",
"(",
"analog",
"->",
"field",
"->",
"flags",
"&",
"ANALOG_FLAG_RESET",
")",
")",
"{",
"analog",
"->",
"accum",
"=",
"APPLY_INVERSE_SENSITIVITY",
"(",
"rawvalue",
",",
"analog",
"->",
"sensitivity",
")",
";",
"}",
"else",
"if",
"(",
"analog",
"->",
"positionalscale",
"!=",
"0",
")",
"{",
"rawvalue",
"=",
"APPLY_SCALE",
"(",
"rawvalue",
"-",
"INPUT_ABSOLUTE_MIN",
",",
"analog",
"->",
"positionalscale",
")",
"*",
"INPUT_RELATIVE_PER_PIXEL",
"+",
"analog",
"->",
"minimum",
";",
"rawvalue",
"=",
"MIN",
"(",
"rawvalue",
",",
"analog",
"->",
"maximum",
")",
";",
"analog",
"->",
"accum",
"=",
"APPLY_INVERSE_SENSITIVITY",
"(",
"rawvalue",
",",
"analog",
"->",
"sensitivity",
")",
";",
"}",
"else",
"analog",
"->",
"accum",
"+=",
"rawvalue",
";",
"analog",
"->",
"lastdigital",
"=",
"0",
";",
"return",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"analog",
"->",
"absolute",
"&&",
"analog",
"->",
"positionalscale",
"==",
"0",
")",
"analog",
"->",
"accum",
"+=",
"rawvalue",
";",
"}",
"}",
"if",
"(",
"itemclass",
"==",
"ITEM_CLASS_RELATIVE",
"&&",
"rawvalue",
"!=",
"0",
")",
"{",
"delta",
"=",
"rawvalue",
";",
"analog",
"->",
"lastdigital",
"=",
"0",
";",
"}",
"keyscale",
"=",
"(",
"analog",
"->",
"accum",
">=",
"0",
")",
"?",
"analog",
"->",
"keyscalepos",
":",
"analog",
"->",
"keyscaleneg",
";",
"if",
"(",
"input_seq_pressed",
"(",
"machine",
",",
"input_field_seq",
"(",
"analog",
"->",
"field",
",",
"SEQ_TYPE_DECREMENT",
")",
")",
")",
"{",
"keypressed",
"=",
"TRUE",
";",
"if",
"(",
"analog",
"->",
"delta",
"!=",
"0",
")",
"delta",
"-=",
"APPLY_SCALE",
"(",
"analog",
"->",
"delta",
",",
"keyscale",
")",
";",
"else",
"if",
"(",
"!",
"analog",
"->",
"lastdigital",
")",
"delta",
"-=",
"APPLY_SCALE",
"(",
"1",
",",
"keyscale",
")",
";",
"analog",
"->",
"lastdigital",
"=",
"TRUE",
";",
"}",
"if",
"(",
"input_seq_pressed",
"(",
"machine",
",",
"input_field_seq",
"(",
"analog",
"->",
"field",
",",
"SEQ_TYPE_INCREMENT",
")",
")",
")",
"{",
"keypressed",
"=",
"TRUE",
";",
"if",
"(",
"analog",
"->",
"delta",
")",
"delta",
"+=",
"APPLY_SCALE",
"(",
"analog",
"->",
"delta",
",",
"keyscale",
")",
";",
"else",
"if",
"(",
"!",
"analog",
"->",
"lastdigital",
")",
"delta",
"+=",
"APPLY_SCALE",
"(",
"1",
",",
"keyscale",
")",
";",
"analog",
"->",
"lastdigital",
"=",
"TRUE",
";",
"}",
"if",
"(",
"analog",
"->",
"field",
"->",
"flags",
"&",
"ANALOG_FLAG_RESET",
")",
"analog",
"->",
"accum",
"=",
"0",
";",
"analog",
"->",
"accum",
"+=",
"delta",
";",
"if",
"(",
"analog",
"->",
"autocenter",
")",
"{",
"INT32",
"center",
"=",
"APPLY_INVERSE_SENSITIVITY",
"(",
"analog",
"->",
"center",
",",
"analog",
"->",
"sensitivity",
")",
";",
"if",
"(",
"analog",
"->",
"lastdigital",
"&&",
"!",
"keypressed",
")",
"{",
"if",
"(",
"analog",
"->",
"accum",
">=",
"center",
")",
"{",
"analog",
"->",
"accum",
"-=",
"APPLY_SCALE",
"(",
"analog",
"->",
"centerdelta",
",",
"analog",
"->",
"keyscalepos",
")",
";",
"if",
"(",
"analog",
"->",
"accum",
"<",
"center",
")",
"{",
"analog",
"->",
"accum",
"=",
"center",
";",
"analog",
"->",
"lastdigital",
"=",
"FALSE",
";",
"}",
"}",
"else",
"{",
"analog",
"->",
"accum",
"+=",
"APPLY_SCALE",
"(",
"analog",
"->",
"centerdelta",
",",
"analog",
"->",
"keyscaleneg",
")",
";",
"if",
"(",
"analog",
"->",
"accum",
">",
"center",
")",
"{",
"analog",
"->",
"accum",
"=",
"center",
";",
"analog",
"->",
"lastdigital",
"=",
"FALSE",
";",
"}",
"}",
"}",
"}",
"else",
"if",
"(",
"!",
"keypressed",
")",
"analog",
"->",
"lastdigital",
"=",
"FALSE",
";",
"}"
] | frame_update_analog_field - update the
internals of a single analog field | [
"frame_update_analog_field",
"-",
"update",
"the",
"internals",
"of",
"a",
"single",
"analog",
"field"
] | [
"/* clamp the previous value to the min/max range and remember it */",
"/* get the new raw analog value and its type */",
"/* if we got an absolute input, it overrides everything else */",
"/* only update if analog value changed */",
"/* apply the inverse of the sensitivity to the raw value so that */",
"/* it will still cover the full min->max range requested after */",
"/* we apply the sensitivity adjustment */",
"/* if port is absolute, then just return the absolute data supplied */",
"/* if port is positional, we will take the full analog control and divide it */",
"/* into positions, that way as the control is moved full scale, */",
"/* it moves through all the positions */",
"/* clamp the high value so it does not roll over */",
"/* if port is relative, we use the value to simulate the speed of relative movement */",
"/* sensitivity adjustment is allowed for this mode */",
"/* do not bother with other control types if the analog data is changing */",
"/* we still have to update fake relative from joystick control */",
"/* if we got it from a relative device, use that as the starting delta */",
"/* also note that the last input was not a digital one */",
"/* if the decrement code sequence is pressed, add the key delta to */",
"/* the accumulated delta; also note that the last input was a digital one */",
"/* decrement only once when first pressed */",
"/* same for the increment code sequence */",
"/* increment only once when first pressed */",
"/* if resetting is requested, clear the accumulated position to 0 before */",
"/* applying the deltas so that we only return this frame's delta */",
"/* note that centering only works for relative controls */",
"/* no need to check if absolute here because it is checked by the validity tests */",
"/* apply the delta to the accumulated value */",
"/* if our last movement was due to a digital input, and if this control */",
"/* type autocenters, and if neither the increment nor the decrement seq */",
"/* was pressed, apply autocentering */",
"/* autocenter from positive values */",
"/* autocenter from negative values */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "analog",
"type": "analog_field_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "analog",
"type": "analog_field_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | frame_get_digital_field_state | int | static int frame_get_digital_field_state(const input_field_config *field, int mouse_down)
{
int curstate = mouse_down || input_seq_pressed(field->port->machine, input_field_seq(field, SEQ_TYPE_STANDARD));
int changed = FALSE;
/* if the state changed, look for switch down/switch up */
if (curstate != field->state->last)
{
field->state->last = curstate;
changed = TRUE;
}
if (field->type == IPT_KEYBOARD && ui_get_use_natural_keyboard(field->port->machine))
return FALSE;
/* if this is a switch-down event, handle impulse and toggle */
if (changed && curstate)
{
/* impluse controls: reset the impulse counter */
if (field->impulse != 0 && field->state->impulse == 0)
field->state->impulse = field->impulse;
/* toggle controls: flip the toggle state or advance to the next setting */
if (field->flags & FIELD_FLAG_TOGGLE)
{
if (field->settinglist == NULL)
field->state->value ^= field->mask;
else
input_field_select_next_setting(field);
}
}
/* update the current state with the impulse state */
if (field->impulse != 0)
{
if (field->state->impulse != 0)
{
field->state->impulse--;
curstate = TRUE;
}
else
curstate = FALSE;
}
/* for toggle switches, the current value is folded into the port's default value */
/* so we always return FALSE here */
if (field->flags & FIELD_FLAG_TOGGLE)
curstate = FALSE;
/* additional logic to restrict digital joysticks */
if (curstate && !mouse_down && field->state->joystick != NULL && field->way != 16)
{
UINT8 mask = (field->way == 4) ? field->state->joystick->current4way : field->state->joystick->current;
if (!(mask & (1 << field->state->joydir)))
curstate = FALSE;
}
/* skip locked-out coin inputs */
if (curstate && field->type >= IPT_COIN1 && field->type <= IPT_COIN12 && coin_lockout_get_state(field->port->machine, field->type - IPT_COIN1) && options_get_bool(mame_options(), OPTION_COIN_LOCKOUT))
{
ui_popup_time(3, "Coinlock disabled %s.", input_field_name(field));
return FALSE;
}
return curstate;
} | /*-------------------------------------------------
frame_get_digital_field_state - get the state
of a digital field
-------------------------------------------------*/ | get the state
of a digital field | [
"get",
"the",
"state",
"of",
"a",
"digital",
"field"
] | static int frame_get_digital_field_state(const input_field_config *field, int mouse_down)
{
int curstate = mouse_down || input_seq_pressed(field->port->machine, input_field_seq(field, SEQ_TYPE_STANDARD));
int changed = FALSE;
if (curstate != field->state->last)
{
field->state->last = curstate;
changed = TRUE;
}
if (field->type == IPT_KEYBOARD && ui_get_use_natural_keyboard(field->port->machine))
return FALSE;
if (changed && curstate)
{
if (field->impulse != 0 && field->state->impulse == 0)
field->state->impulse = field->impulse;
if (field->flags & FIELD_FLAG_TOGGLE)
{
if (field->settinglist == NULL)
field->state->value ^= field->mask;
else
input_field_select_next_setting(field);
}
}
if (field->impulse != 0)
{
if (field->state->impulse != 0)
{
field->state->impulse--;
curstate = TRUE;
}
else
curstate = FALSE;
}
if (field->flags & FIELD_FLAG_TOGGLE)
curstate = FALSE;
if (curstate && !mouse_down && field->state->joystick != NULL && field->way != 16)
{
UINT8 mask = (field->way == 4) ? field->state->joystick->current4way : field->state->joystick->current;
if (!(mask & (1 << field->state->joydir)))
curstate = FALSE;
}
if (curstate && field->type >= IPT_COIN1 && field->type <= IPT_COIN12 && coin_lockout_get_state(field->port->machine, field->type - IPT_COIN1) && options_get_bool(mame_options(), OPTION_COIN_LOCKOUT))
{
ui_popup_time(3, "Coinlock disabled %s.", input_field_name(field));
return FALSE;
}
return curstate;
} | [
"static",
"int",
"frame_get_digital_field_state",
"(",
"const",
"input_field_config",
"*",
"field",
",",
"int",
"mouse_down",
")",
"{",
"int",
"curstate",
"=",
"mouse_down",
"||",
"input_seq_pressed",
"(",
"field",
"->",
"port",
"->",
"machine",
",",
"input_field_seq",
"(",
"field",
",",
"SEQ_TYPE_STANDARD",
")",
")",
";",
"int",
"changed",
"=",
"FALSE",
";",
"if",
"(",
"curstate",
"!=",
"field",
"->",
"state",
"->",
"last",
")",
"{",
"field",
"->",
"state",
"->",
"last",
"=",
"curstate",
";",
"changed",
"=",
"TRUE",
";",
"}",
"if",
"(",
"field",
"->",
"type",
"==",
"IPT_KEYBOARD",
"&&",
"ui_get_use_natural_keyboard",
"(",
"field",
"->",
"port",
"->",
"machine",
")",
")",
"return",
"FALSE",
";",
"if",
"(",
"changed",
"&&",
"curstate",
")",
"{",
"if",
"(",
"field",
"->",
"impulse",
"!=",
"0",
"&&",
"field",
"->",
"state",
"->",
"impulse",
"==",
"0",
")",
"field",
"->",
"state",
"->",
"impulse",
"=",
"field",
"->",
"impulse",
";",
"if",
"(",
"field",
"->",
"flags",
"&",
"FIELD_FLAG_TOGGLE",
")",
"{",
"if",
"(",
"field",
"->",
"settinglist",
"==",
"NULL",
")",
"field",
"->",
"state",
"->",
"value",
"^=",
"field",
"->",
"mask",
";",
"else",
"input_field_select_next_setting",
"(",
"field",
")",
";",
"}",
"}",
"if",
"(",
"field",
"->",
"impulse",
"!=",
"0",
")",
"{",
"if",
"(",
"field",
"->",
"state",
"->",
"impulse",
"!=",
"0",
")",
"{",
"field",
"->",
"state",
"->",
"impulse",
"--",
";",
"curstate",
"=",
"TRUE",
";",
"}",
"else",
"curstate",
"=",
"FALSE",
";",
"}",
"if",
"(",
"field",
"->",
"flags",
"&",
"FIELD_FLAG_TOGGLE",
")",
"curstate",
"=",
"FALSE",
";",
"if",
"(",
"curstate",
"&&",
"!",
"mouse_down",
"&&",
"field",
"->",
"state",
"->",
"joystick",
"!=",
"NULL",
"&&",
"field",
"->",
"way",
"!=",
"16",
")",
"{",
"UINT8",
"mask",
"=",
"(",
"field",
"->",
"way",
"==",
"4",
")",
"?",
"field",
"->",
"state",
"->",
"joystick",
"->",
"current4way",
":",
"field",
"->",
"state",
"->",
"joystick",
"->",
"current",
";",
"if",
"(",
"!",
"(",
"mask",
"&",
"(",
"1",
"<<",
"field",
"->",
"state",
"->",
"joydir",
")",
")",
")",
"curstate",
"=",
"FALSE",
";",
"}",
"if",
"(",
"curstate",
"&&",
"field",
"->",
"type",
">=",
"IPT_COIN1",
"&&",
"field",
"->",
"type",
"<=",
"IPT_COIN12",
"&&",
"coin_lockout_get_state",
"(",
"field",
"->",
"port",
"->",
"machine",
",",
"field",
"->",
"type",
"-",
"IPT_COIN1",
")",
"&&",
"options_get_bool",
"(",
"mame_options",
"(",
")",
",",
"OPTION_COIN_LOCKOUT",
")",
")",
"{",
"ui_popup_time",
"(",
"3",
",",
"\"",
"\"",
",",
"input_field_name",
"(",
"field",
")",
")",
";",
"return",
"FALSE",
";",
"}",
"return",
"curstate",
";",
"}"
] | frame_get_digital_field_state - get the state
of a digital field | [
"frame_get_digital_field_state",
"-",
"get",
"the",
"state",
"of",
"a",
"digital",
"field"
] | [
"/* if the state changed, look for switch down/switch up */",
"/* if this is a switch-down event, handle impulse and toggle */",
"/* impluse controls: reset the impulse counter */",
"/* toggle controls: flip the toggle state or advance to the next setting */",
"/* update the current state with the impulse state */",
"/* for toggle switches, the current value is folded into the port's default value */",
"/* so we always return FALSE here */",
"/* additional logic to restrict digital joysticks */",
"/* skip locked-out coin inputs */"
] | [
{
"param": "field",
"type": "input_field_config"
},
{
"param": "mouse_down",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": "input_field_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mouse_down",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | field_config_alloc | input_field_config | static input_field_config *field_config_alloc(input_port_config *port, int type, input_port_value defvalue, input_port_value maskbits)
{
input_field_config *config;
int seqtype;
/* allocate memory */
config = global_alloc_clear(input_field_config);
/* fill in the basic field values */
config->port = port;
config->type = type;
config->mask = maskbits;
config->defvalue = defvalue & maskbits;
config->max = maskbits;
for (seqtype = 0; seqtype < ARRAY_LENGTH(config->seq); seqtype++)
input_seq_set_1(&config->seq[seqtype], SEQCODE_DEFAULT);
return config;
} | /*-------------------------------------------------
field_config_alloc - allocate a new input
port field config
-------------------------------------------------*/ | allocate a new input
port field config | [
"allocate",
"a",
"new",
"input",
"port",
"field",
"config"
] | static input_field_config *field_config_alloc(input_port_config *port, int type, input_port_value defvalue, input_port_value maskbits)
{
input_field_config *config;
int seqtype;
config = global_alloc_clear(input_field_config);
config->port = port;
config->type = type;
config->mask = maskbits;
config->defvalue = defvalue & maskbits;
config->max = maskbits;
for (seqtype = 0; seqtype < ARRAY_LENGTH(config->seq); seqtype++)
input_seq_set_1(&config->seq[seqtype], SEQCODE_DEFAULT);
return config;
} | [
"static",
"input_field_config",
"*",
"field_config_alloc",
"(",
"input_port_config",
"*",
"port",
",",
"int",
"type",
",",
"input_port_value",
"defvalue",
",",
"input_port_value",
"maskbits",
")",
"{",
"input_field_config",
"*",
"config",
";",
"int",
"seqtype",
";",
"config",
"=",
"global_alloc_clear",
"(",
"input_field_config",
")",
";",
"config",
"->",
"port",
"=",
"port",
";",
"config",
"->",
"type",
"=",
"type",
";",
"config",
"->",
"mask",
"=",
"maskbits",
";",
"config",
"->",
"defvalue",
"=",
"defvalue",
"&",
"maskbits",
";",
"config",
"->",
"max",
"=",
"maskbits",
";",
"for",
"(",
"seqtype",
"=",
"0",
";",
"seqtype",
"<",
"ARRAY_LENGTH",
"(",
"config",
"->",
"seq",
")",
";",
"seqtype",
"++",
")",
"input_seq_set_1",
"(",
"&",
"config",
"->",
"seq",
"[",
"seqtype",
"]",
",",
"SEQCODE_DEFAULT",
")",
";",
"return",
"config",
";",
"}"
] | field_config_alloc - allocate a new input
port field config | [
"field_config_alloc",
"-",
"allocate",
"a",
"new",
"input",
"port",
"field",
"config"
] | [
"/* allocate memory */",
"/* fill in the basic field values */"
] | [
{
"param": "port",
"type": "input_port_config"
},
{
"param": "type",
"type": "int"
},
{
"param": "defvalue",
"type": "input_port_value"
},
{
"param": "maskbits",
"type": "input_port_value"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "port",
"type": "input_port_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "defvalue",
"type": "input_port_value",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "maskbits",
"type": "input_port_value",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | field_config_insert | void | static void field_config_insert(input_field_config *field, input_port_value *disallowedbits, char *errorbuf, int errorbuflen)
{
const input_field_config * const *scanfieldptr;
const input_field_config * const *scanfieldnextptr;
input_field_config *config;
input_port_value lowbit;
/* verify against the disallowed bits, but only if we are condition-free */
if (field->condition.condition == PORTCOND_ALWAYS)
{
if ((field->mask & *disallowedbits) != 0)
error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_FIELD specifies duplicate port bits (mask=%X)\n", field->mask);
*disallowedbits |= field->mask;
}
/* first modify/nuke any entries that intersect our maskbits */
for (scanfieldptr = &field->port->fieldlist; *scanfieldptr != NULL; scanfieldptr = scanfieldnextptr)
{
scanfieldnextptr = &(*scanfieldptr)->next;
if (((*scanfieldptr)->mask & field->mask) != 0 && (field->condition.condition == PORTCOND_ALWAYS ||
(*scanfieldptr)->condition.condition == PORTCOND_ALWAYS ||
condition_equal(&(*scanfieldptr)->condition, &field->condition)))
{
/* reduce the mask of the field we found */
config = (input_field_config *)*scanfieldptr;
config->mask &= ~field->mask;
/* if the new entry fully overrides the previous one, we nuke */
if (INPUT_PORT_OVERRIDE_FULLY_NUKES_PREVIOUS || config->mask == 0)
{
field_config_free((input_field_config **)scanfieldptr);
scanfieldnextptr = scanfieldptr;
}
}
}
/* make a mask of just the low bit */
lowbit = (field->mask ^ (field->mask - 1)) & field->mask;
/* scan forward to find where to insert ourselves */
for (scanfieldptr = (const input_field_config * const *)&field->port->fieldlist; *scanfieldptr != NULL; scanfieldptr = &(*scanfieldptr)->next)
if ((*scanfieldptr)->mask > lowbit)
break;
/* insert it into the list */
field->next = *scanfieldptr;
*(input_field_config **)scanfieldptr = field;
} | /*-------------------------------------------------
field_config_insert - insert an allocated
input port field config, replacing any
intersecting fields already present and
inserting at the correct sorted location
-------------------------------------------------*/ | insert an allocated
input port field config, replacing any
intersecting fields already present and
inserting at the correct sorted location | [
"insert",
"an",
"allocated",
"input",
"port",
"field",
"config",
"replacing",
"any",
"intersecting",
"fields",
"already",
"present",
"and",
"inserting",
"at",
"the",
"correct",
"sorted",
"location"
] | static void field_config_insert(input_field_config *field, input_port_value *disallowedbits, char *errorbuf, int errorbuflen)
{
const input_field_config * const *scanfieldptr;
const input_field_config * const *scanfieldnextptr;
input_field_config *config;
input_port_value lowbit;
if (field->condition.condition == PORTCOND_ALWAYS)
{
if ((field->mask & *disallowedbits) != 0)
error_buf_append(errorbuf, errorbuflen, "INPUT_TOKEN_FIELD specifies duplicate port bits (mask=%X)\n", field->mask);
*disallowedbits |= field->mask;
}
for (scanfieldptr = &field->port->fieldlist; *scanfieldptr != NULL; scanfieldptr = scanfieldnextptr)
{
scanfieldnextptr = &(*scanfieldptr)->next;
if (((*scanfieldptr)->mask & field->mask) != 0 && (field->condition.condition == PORTCOND_ALWAYS ||
(*scanfieldptr)->condition.condition == PORTCOND_ALWAYS ||
condition_equal(&(*scanfieldptr)->condition, &field->condition)))
{
config = (input_field_config *)*scanfieldptr;
config->mask &= ~field->mask;
if (INPUT_PORT_OVERRIDE_FULLY_NUKES_PREVIOUS || config->mask == 0)
{
field_config_free((input_field_config **)scanfieldptr);
scanfieldnextptr = scanfieldptr;
}
}
}
lowbit = (field->mask ^ (field->mask - 1)) & field->mask;
for (scanfieldptr = (const input_field_config * const *)&field->port->fieldlist; *scanfieldptr != NULL; scanfieldptr = &(*scanfieldptr)->next)
if ((*scanfieldptr)->mask > lowbit)
break;
field->next = *scanfieldptr;
*(input_field_config **)scanfieldptr = field;
} | [
"static",
"void",
"field_config_insert",
"(",
"input_field_config",
"*",
"field",
",",
"input_port_value",
"*",
"disallowedbits",
",",
"char",
"*",
"errorbuf",
",",
"int",
"errorbuflen",
")",
"{",
"const",
"input_field_config",
"*",
"const",
"*",
"scanfieldptr",
";",
"const",
"input_field_config",
"*",
"const",
"*",
"scanfieldnextptr",
";",
"input_field_config",
"*",
"config",
";",
"input_port_value",
"lowbit",
";",
"if",
"(",
"field",
"->",
"condition",
".",
"condition",
"==",
"PORTCOND_ALWAYS",
")",
"{",
"if",
"(",
"(",
"field",
"->",
"mask",
"&",
"*",
"disallowedbits",
")",
"!=",
"0",
")",
"error_buf_append",
"(",
"errorbuf",
",",
"errorbuflen",
",",
"\"",
"\\n",
"\"",
",",
"field",
"->",
"mask",
")",
";",
"*",
"disallowedbits",
"|=",
"field",
"->",
"mask",
";",
"}",
"for",
"(",
"scanfieldptr",
"=",
"&",
"field",
"->",
"port",
"->",
"fieldlist",
";",
"*",
"scanfieldptr",
"!=",
"NULL",
";",
"scanfieldptr",
"=",
"scanfieldnextptr",
")",
"{",
"scanfieldnextptr",
"=",
"&",
"(",
"*",
"scanfieldptr",
")",
"->",
"next",
";",
"if",
"(",
"(",
"(",
"*",
"scanfieldptr",
")",
"->",
"mask",
"&",
"field",
"->",
"mask",
")",
"!=",
"0",
"&&",
"(",
"field",
"->",
"condition",
".",
"condition",
"==",
"PORTCOND_ALWAYS",
"||",
"(",
"*",
"scanfieldptr",
")",
"->",
"condition",
".",
"condition",
"==",
"PORTCOND_ALWAYS",
"||",
"condition_equal",
"(",
"&",
"(",
"*",
"scanfieldptr",
")",
"->",
"condition",
",",
"&",
"field",
"->",
"condition",
")",
")",
")",
"{",
"config",
"=",
"(",
"input_field_config",
"*",
")",
"*",
"scanfieldptr",
";",
"config",
"->",
"mask",
"&=",
"~",
"field",
"->",
"mask",
";",
"if",
"(",
"INPUT_PORT_OVERRIDE_FULLY_NUKES_PREVIOUS",
"||",
"config",
"->",
"mask",
"==",
"0",
")",
"{",
"field_config_free",
"(",
"(",
"input_field_config",
"*",
"*",
")",
"scanfieldptr",
")",
";",
"scanfieldnextptr",
"=",
"scanfieldptr",
";",
"}",
"}",
"}",
"lowbit",
"=",
"(",
"field",
"->",
"mask",
"^",
"(",
"field",
"->",
"mask",
"-",
"1",
")",
")",
"&",
"field",
"->",
"mask",
";",
"for",
"(",
"scanfieldptr",
"=",
"(",
"const",
"input_field_config",
"*",
"const",
"*",
")",
"&",
"field",
"->",
"port",
"->",
"fieldlist",
";",
"*",
"scanfieldptr",
"!=",
"NULL",
";",
"scanfieldptr",
"=",
"&",
"(",
"*",
"scanfieldptr",
")",
"->",
"next",
")",
"if",
"(",
"(",
"*",
"scanfieldptr",
")",
"->",
"mask",
">",
"lowbit",
")",
"break",
";",
"field",
"->",
"next",
"=",
"*",
"scanfieldptr",
";",
"*",
"(",
"input_field_config",
"*",
"*",
")",
"scanfieldptr",
"=",
"field",
";",
"}"
] | field_config_insert - insert an allocated
input port field config, replacing any
intersecting fields already present and
inserting at the correct sorted location | [
"field_config_insert",
"-",
"insert",
"an",
"allocated",
"input",
"port",
"field",
"config",
"replacing",
"any",
"intersecting",
"fields",
"already",
"present",
"and",
"inserting",
"at",
"the",
"correct",
"sorted",
"location"
] | [
"/* verify against the disallowed bits, but only if we are condition-free */",
"/* first modify/nuke any entries that intersect our maskbits */",
"/* reduce the mask of the field we found */",
"/* if the new entry fully overrides the previous one, we nuke */",
"/* make a mask of just the low bit */",
"/* scan forward to find where to insert ourselves */",
"/* insert it into the list */"
] | [
{
"param": "field",
"type": "input_field_config"
},
{
"param": "disallowedbits",
"type": "input_port_value"
},
{
"param": "errorbuf",
"type": "char"
},
{
"param": "errorbuflen",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": "input_field_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "disallowedbits",
"type": "input_port_value",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "errorbuf",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "errorbuflen",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | field_config_free | void | static void field_config_free(input_field_config **fieldptr)
{
input_field_config *field = *fieldptr;
/* free any settings and DIP locations first */
while (field->settinglist != NULL)
setting_config_free((input_setting_config **)&field->settinglist);
while (field->diploclist != NULL)
diplocation_free((input_field_diplocation **)&field->diploclist);
/* remove ourself from the list */
*fieldptr = (input_field_config *)field->next;
/* free ourself */
global_free(field);
} | /*-------------------------------------------------
field_config_free - free an allocated input
field configuration
-------------------------------------------------*/ | free an allocated input
field configuration | [
"free",
"an",
"allocated",
"input",
"field",
"configuration"
] | static void field_config_free(input_field_config **fieldptr)
{
input_field_config *field = *fieldptr;
while (field->settinglist != NULL)
setting_config_free((input_setting_config **)&field->settinglist);
while (field->diploclist != NULL)
diplocation_free((input_field_diplocation **)&field->diploclist);
*fieldptr = (input_field_config *)field->next;
global_free(field);
} | [
"static",
"void",
"field_config_free",
"(",
"input_field_config",
"*",
"*",
"fieldptr",
")",
"{",
"input_field_config",
"*",
"field",
"=",
"*",
"fieldptr",
";",
"while",
"(",
"field",
"->",
"settinglist",
"!=",
"NULL",
")",
"setting_config_free",
"(",
"(",
"input_setting_config",
"*",
"*",
")",
"&",
"field",
"->",
"settinglist",
")",
";",
"while",
"(",
"field",
"->",
"diploclist",
"!=",
"NULL",
")",
"diplocation_free",
"(",
"(",
"input_field_diplocation",
"*",
"*",
")",
"&",
"field",
"->",
"diploclist",
")",
";",
"*",
"fieldptr",
"=",
"(",
"input_field_config",
"*",
")",
"field",
"->",
"next",
";",
"global_free",
"(",
"field",
")",
";",
"}"
] | field_config_free - free an allocated input
field configuration | [
"field_config_free",
"-",
"free",
"an",
"allocated",
"input",
"field",
"configuration"
] | [
"/* free any settings and DIP locations first */",
"/* remove ourself from the list */",
"/* free ourself */"
] | [
{
"param": "fieldptr",
"type": "input_field_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fieldptr",
"type": "input_field_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | diplocation_list_alloc | input_field_diplocation | static const input_field_diplocation *diplocation_list_alloc(const input_field_config *field, const char *location, char *errorbuf, int errorbuflen)
{
input_field_diplocation *head = NULL;
input_field_diplocation **tailptr = &head;
const char *curentry = location;
char *lastname = NULL;
char tempbuf[100];
input_port_value temp;
int entries = 0;
int val, bits;
/* if nothing present, bail */
if (location == NULL)
return NULL;
/* parse the string */
while (*curentry != 0)
{
const char *comma, *colon, *number;
/* allocate a new entry */
*tailptr = global_alloc_clear(input_field_diplocation);
entries++;
/* find the end of this entry */
comma = strchr(curentry, ',');
if (comma == NULL)
comma = curentry + strlen(curentry);
/* extract it to tempbuf */
strncpy(tempbuf, curentry, comma - curentry);
tempbuf[comma - curentry] = 0;
/* first extract the switch name if present */
number = tempbuf;
colon = strchr(tempbuf, ':');
/* allocate and copy the name if it is present */
if (colon != NULL)
{
(*tailptr)->swname = lastname = global_alloc_array(char, colon - tempbuf + 1);
strncpy(lastname, tempbuf, colon - tempbuf);
lastname[colon - tempbuf] = 0;
number = colon + 1;
}
/* otherwise, just copy the last name */
else
{
char *namecopy;
if (lastname == NULL)
{
error_buf_append(errorbuf, errorbuflen, "Switch location '%s' missing switch name!\n", location);
lastname = (char *)"UNK";
}
(*tailptr)->swname = namecopy = global_alloc_array(char, strlen(lastname) + 1);
strcpy(namecopy, lastname);
}
/* if the number is preceded by a '!' it's active high */
(*tailptr)->invert = FALSE;
if (*number == '!')
{
(*tailptr)->invert = TRUE;
number++;
}
/* now scan the switch number */
if (sscanf(number, "%d", &val) != 1)
error_buf_append(errorbuf, errorbuflen, "Switch location '%s' has invalid format!\n", location);
else
(*tailptr)->swnum = val;
/* advance to the next item */
curentry = comma;
if (*curentry != 0)
curentry++;
tailptr = &(*tailptr)->next;
}
/* then verify the number of bits in the mask matches */
for (bits = 0, temp = field->mask; temp != 0 && bits < 32; bits++)
temp &= temp - 1;
if (bits != entries)
error_buf_append(errorbuf, errorbuflen, "Switch location '%s' does not describe enough bits for mask %X\n", location, field->mask);
return head;
} | /*-------------------------------------------------
diplocation_expand - expand a string-based
DIP location into a linked list of
descriptions
-------------------------------------------------*/ | expand a string-based
DIP location into a linked list of
descriptions | [
"expand",
"a",
"string",
"-",
"based",
"DIP",
"location",
"into",
"a",
"linked",
"list",
"of",
"descriptions"
] | static const input_field_diplocation *diplocation_list_alloc(const input_field_config *field, const char *location, char *errorbuf, int errorbuflen)
{
input_field_diplocation *head = NULL;
input_field_diplocation **tailptr = &head;
const char *curentry = location;
char *lastname = NULL;
char tempbuf[100];
input_port_value temp;
int entries = 0;
int val, bits;
if (location == NULL)
return NULL;
while (*curentry != 0)
{
const char *comma, *colon, *number;
*tailptr = global_alloc_clear(input_field_diplocation);
entries++;
comma = strchr(curentry, ',');
if (comma == NULL)
comma = curentry + strlen(curentry);
strncpy(tempbuf, curentry, comma - curentry);
tempbuf[comma - curentry] = 0;
number = tempbuf;
colon = strchr(tempbuf, ':');
if (colon != NULL)
{
(*tailptr)->swname = lastname = global_alloc_array(char, colon - tempbuf + 1);
strncpy(lastname, tempbuf, colon - tempbuf);
lastname[colon - tempbuf] = 0;
number = colon + 1;
}
else
{
char *namecopy;
if (lastname == NULL)
{
error_buf_append(errorbuf, errorbuflen, "Switch location '%s' missing switch name!\n", location);
lastname = (char *)"UNK";
}
(*tailptr)->swname = namecopy = global_alloc_array(char, strlen(lastname) + 1);
strcpy(namecopy, lastname);
}
(*tailptr)->invert = FALSE;
if (*number == '!')
{
(*tailptr)->invert = TRUE;
number++;
}
if (sscanf(number, "%d", &val) != 1)
error_buf_append(errorbuf, errorbuflen, "Switch location '%s' has invalid format!\n", location);
else
(*tailptr)->swnum = val;
curentry = comma;
if (*curentry != 0)
curentry++;
tailptr = &(*tailptr)->next;
}
for (bits = 0, temp = field->mask; temp != 0 && bits < 32; bits++)
temp &= temp - 1;
if (bits != entries)
error_buf_append(errorbuf, errorbuflen, "Switch location '%s' does not describe enough bits for mask %X\n", location, field->mask);
return head;
} | [
"static",
"const",
"input_field_diplocation",
"*",
"diplocation_list_alloc",
"(",
"const",
"input_field_config",
"*",
"field",
",",
"const",
"char",
"*",
"location",
",",
"char",
"*",
"errorbuf",
",",
"int",
"errorbuflen",
")",
"{",
"input_field_diplocation",
"*",
"head",
"=",
"NULL",
";",
"input_field_diplocation",
"*",
"*",
"tailptr",
"=",
"&",
"head",
";",
"const",
"char",
"*",
"curentry",
"=",
"location",
";",
"char",
"*",
"lastname",
"=",
"NULL",
";",
"char",
"tempbuf",
"[",
"100",
"]",
";",
"input_port_value",
"temp",
";",
"int",
"entries",
"=",
"0",
";",
"int",
"val",
",",
"bits",
";",
"if",
"(",
"location",
"==",
"NULL",
")",
"return",
"NULL",
";",
"while",
"(",
"*",
"curentry",
"!=",
"0",
")",
"{",
"const",
"char",
"*",
"comma",
",",
"*",
"colon",
",",
"*",
"number",
";",
"*",
"tailptr",
"=",
"global_alloc_clear",
"(",
"input_field_diplocation",
")",
";",
"entries",
"++",
";",
"comma",
"=",
"strchr",
"(",
"curentry",
",",
"'",
"'",
")",
";",
"if",
"(",
"comma",
"==",
"NULL",
")",
"comma",
"=",
"curentry",
"+",
"strlen",
"(",
"curentry",
")",
";",
"strncpy",
"(",
"tempbuf",
",",
"curentry",
",",
"comma",
"-",
"curentry",
")",
";",
"tempbuf",
"[",
"comma",
"-",
"curentry",
"]",
"=",
"0",
";",
"number",
"=",
"tempbuf",
";",
"colon",
"=",
"strchr",
"(",
"tempbuf",
",",
"'",
"'",
")",
";",
"if",
"(",
"colon",
"!=",
"NULL",
")",
"{",
"(",
"*",
"tailptr",
")",
"->",
"swname",
"=",
"lastname",
"=",
"global_alloc_array",
"(",
"char",
",",
"colon",
"-",
"tempbuf",
"+",
"1",
")",
";",
"strncpy",
"(",
"lastname",
",",
"tempbuf",
",",
"colon",
"-",
"tempbuf",
")",
";",
"lastname",
"[",
"colon",
"-",
"tempbuf",
"]",
"=",
"0",
";",
"number",
"=",
"colon",
"+",
"1",
";",
"}",
"else",
"{",
"char",
"*",
"namecopy",
";",
"if",
"(",
"lastname",
"==",
"NULL",
")",
"{",
"error_buf_append",
"(",
"errorbuf",
",",
"errorbuflen",
",",
"\"",
"\\n",
"\"",
",",
"location",
")",
";",
"lastname",
"=",
"(",
"char",
"*",
")",
"\"",
"\"",
";",
"}",
"(",
"*",
"tailptr",
")",
"->",
"swname",
"=",
"namecopy",
"=",
"global_alloc_array",
"(",
"char",
",",
"strlen",
"(",
"lastname",
")",
"+",
"1",
")",
";",
"strcpy",
"(",
"namecopy",
",",
"lastname",
")",
";",
"}",
"(",
"*",
"tailptr",
")",
"->",
"invert",
"=",
"FALSE",
";",
"if",
"(",
"*",
"number",
"==",
"'",
"'",
")",
"{",
"(",
"*",
"tailptr",
")",
"->",
"invert",
"=",
"TRUE",
";",
"number",
"++",
";",
"}",
"if",
"(",
"sscanf",
"(",
"number",
",",
"\"",
"\"",
",",
"&",
"val",
")",
"!=",
"1",
")",
"error_buf_append",
"(",
"errorbuf",
",",
"errorbuflen",
",",
"\"",
"\\n",
"\"",
",",
"location",
")",
";",
"else",
"(",
"*",
"tailptr",
")",
"->",
"swnum",
"=",
"val",
";",
"curentry",
"=",
"comma",
";",
"if",
"(",
"*",
"curentry",
"!=",
"0",
")",
"curentry",
"++",
";",
"tailptr",
"=",
"&",
"(",
"*",
"tailptr",
")",
"->",
"next",
";",
"}",
"for",
"(",
"bits",
"=",
"0",
",",
"temp",
"=",
"field",
"->",
"mask",
";",
"temp",
"!=",
"0",
"&&",
"bits",
"<",
"32",
";",
"bits",
"++",
")",
"temp",
"&=",
"temp",
"-",
"1",
";",
"if",
"(",
"bits",
"!=",
"entries",
")",
"error_buf_append",
"(",
"errorbuf",
",",
"errorbuflen",
",",
"\"",
"\\n",
"\"",
",",
"location",
",",
"field",
"->",
"mask",
")",
";",
"return",
"head",
";",
"}"
] | diplocation_expand - expand a string-based
DIP location into a linked list of
descriptions | [
"diplocation_expand",
"-",
"expand",
"a",
"string",
"-",
"based",
"DIP",
"location",
"into",
"a",
"linked",
"list",
"of",
"descriptions"
] | [
"/* if nothing present, bail */",
"/* parse the string */",
"/* allocate a new entry */",
"/* find the end of this entry */",
"/* extract it to tempbuf */",
"/* first extract the switch name if present */",
"/* allocate and copy the name if it is present */",
"/* otherwise, just copy the last name */",
"/* if the number is preceded by a '!' it's active high */",
"/* now scan the switch number */",
"/* advance to the next item */",
"/* then verify the number of bits in the mask matches */"
] | [
{
"param": "field",
"type": "input_field_config"
},
{
"param": "location",
"type": "char"
},
{
"param": "errorbuf",
"type": "char"
},
{
"param": "errorbuflen",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": "input_field_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "location",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "errorbuf",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "errorbuflen",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | token_to_input_field_type | int | static int token_to_input_field_type(running_machine *machine, const char *string, int *player)
{
input_port_private *portdata = machine->input_port_data;
const input_type_desc *typedesc;
int ipnum;
/* check for our failsafe case first */
if (sscanf(string, "TYPE_OTHER(%d,%d)", &ipnum, player) == 2)
return ipnum;
/* find the token in the list */
for (typedesc = &portdata->typestatelist->typedesc; typedesc != NULL; typedesc = typedesc->next)
if (typedesc->token != NULL && !strcmp(typedesc->token, string))
{
*player = typedesc->player;
return typedesc->type;
}
/* if we fail, return IPT_UNKNOWN */
*player = 0;
return IPT_UNKNOWN;
} | /*-------------------------------------------------
token_to_input_field_type - convert a string
token to an input field type and player
-------------------------------------------------*/ | convert a string
token to an input field type and player | [
"convert",
"a",
"string",
"token",
"to",
"an",
"input",
"field",
"type",
"and",
"player"
] | static int token_to_input_field_type(running_machine *machine, const char *string, int *player)
{
input_port_private *portdata = machine->input_port_data;
const input_type_desc *typedesc;
int ipnum;
if (sscanf(string, "TYPE_OTHER(%d,%d)", &ipnum, player) == 2)
return ipnum;
for (typedesc = &portdata->typestatelist->typedesc; typedesc != NULL; typedesc = typedesc->next)
if (typedesc->token != NULL && !strcmp(typedesc->token, string))
{
*player = typedesc->player;
return typedesc->type;
}
*player = 0;
return IPT_UNKNOWN;
} | [
"static",
"int",
"token_to_input_field_type",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"string",
",",
"int",
"*",
"player",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"const",
"input_type_desc",
"*",
"typedesc",
";",
"int",
"ipnum",
";",
"if",
"(",
"sscanf",
"(",
"string",
",",
"\"",
"\"",
",",
"&",
"ipnum",
",",
"player",
")",
"==",
"2",
")",
"return",
"ipnum",
";",
"for",
"(",
"typedesc",
"=",
"&",
"portdata",
"->",
"typestatelist",
"->",
"typedesc",
";",
"typedesc",
"!=",
"NULL",
";",
"typedesc",
"=",
"typedesc",
"->",
"next",
")",
"if",
"(",
"typedesc",
"->",
"token",
"!=",
"NULL",
"&&",
"!",
"strcmp",
"(",
"typedesc",
"->",
"token",
",",
"string",
")",
")",
"{",
"*",
"player",
"=",
"typedesc",
"->",
"player",
";",
"return",
"typedesc",
"->",
"type",
";",
"}",
"*",
"player",
"=",
"0",
";",
"return",
"IPT_UNKNOWN",
";",
"}"
] | token_to_input_field_type - convert a string
token to an input field type and player | [
"token_to_input_field_type",
"-",
"convert",
"a",
"string",
"token",
"to",
"an",
"input",
"field",
"type",
"and",
"player"
] | [
"/* check for our failsafe case first */",
"/* find the token in the list */",
"/* if we fail, return IPT_UNKNOWN */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "string",
"type": "char"
},
{
"param": "player",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "string",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "player",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_field_type_to_token | char | static const char *input_field_type_to_token(running_machine *machine, int type, int player)
{
input_port_private *portdata = machine->input_port_data;
input_type_state *typestate;
static char tempbuf[32];
/* look up the port and return the token */
typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
return typestate->typedesc.token;
/* if that fails, carry on */
sprintf(tempbuf, "TYPE_OTHER(%d,%d)", type, player);
return tempbuf;
} | /*-------------------------------------------------
input_field_type_to_token - convert an input
field type and player to a string token
-------------------------------------------------*/ | convert an input
field type and player to a string token | [
"convert",
"an",
"input",
"field",
"type",
"and",
"player",
"to",
"a",
"string",
"token"
] | static const char *input_field_type_to_token(running_machine *machine, int type, int player)
{
input_port_private *portdata = machine->input_port_data;
input_type_state *typestate;
static char tempbuf[32];
typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
return typestate->typedesc.token;
sprintf(tempbuf, "TYPE_OTHER(%d,%d)", type, player);
return tempbuf;
} | [
"static",
"const",
"char",
"*",
"input_field_type_to_token",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"type",
",",
"int",
"player",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"input_type_state",
"*",
"typestate",
";",
"static",
"char",
"tempbuf",
"[",
"32",
"]",
";",
"typestate",
"=",
"portdata",
"->",
"type_to_typestate",
"[",
"type",
"]",
"[",
"player",
"]",
";",
"if",
"(",
"typestate",
"!=",
"NULL",
")",
"return",
"typestate",
"->",
"typedesc",
".",
"token",
";",
"sprintf",
"(",
"tempbuf",
",",
"\"",
"\"",
",",
"type",
",",
"player",
")",
";",
"return",
"tempbuf",
";",
"}"
] | input_field_type_to_token - convert an input
field type and player to a string token | [
"input_field_type_to_token",
"-",
"convert",
"an",
"input",
"field",
"type",
"and",
"player",
"to",
"a",
"string",
"token"
] | [
"/* look up the port and return the token */",
"/* if that fails, carry on */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "type",
"type": "int"
},
{
"param": "player",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "player",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | token_to_seq_type | int | static int token_to_seq_type(const char *string)
{
int seqindex;
/* look up the string in the table of possible sequence types and return the index */
for (seqindex = 0; seqindex < ARRAY_LENGTH(seqtypestrings); seqindex++)
if (!mame_stricmp(string, seqtypestrings[seqindex]))
return seqindex;
return -1;
} | /*-------------------------------------------------
token_to_seq_type - convert a string to
a sequence type
-------------------------------------------------*/ | convert a string to
a sequence type | [
"convert",
"a",
"string",
"to",
"a",
"sequence",
"type"
] | static int token_to_seq_type(const char *string)
{
int seqindex;
for (seqindex = 0; seqindex < ARRAY_LENGTH(seqtypestrings); seqindex++)
if (!mame_stricmp(string, seqtypestrings[seqindex]))
return seqindex;
return -1;
} | [
"static",
"int",
"token_to_seq_type",
"(",
"const",
"char",
"*",
"string",
")",
"{",
"int",
"seqindex",
";",
"for",
"(",
"seqindex",
"=",
"0",
";",
"seqindex",
"<",
"ARRAY_LENGTH",
"(",
"seqtypestrings",
")",
";",
"seqindex",
"++",
")",
"if",
"(",
"!",
"mame_stricmp",
"(",
"string",
",",
"seqtypestrings",
"[",
"seqindex",
"]",
")",
")",
"return",
"seqindex",
";",
"return",
"-1",
";",
"}"
] | token_to_seq_type - convert a string to
a sequence type | [
"token_to_seq_type",
"-",
"convert",
"a",
"string",
"to",
"a",
"sequence",
"type"
] | [
"/* look up the string in the table of possible sequence types and return the index */"
] | [
{
"param": "string",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "string",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | load_config_callback | void | static void load_config_callback(running_machine *machine, int config_type, xml_data_node *parentnode)
{
input_port_private *portdata = machine->input_port_data;
xml_data_node *portnode;
int seqtype;
/* in the completion phase, we finish the initialization with the final ports */
if (config_type == CONFIG_TYPE_FINAL)
{
portdata->safe_to_read = TRUE;
frame_update(machine);
}
/* early exit if no data to parse */
if (parentnode == NULL)
return;
/* iterate over all the remap nodes for controller configs only */
if (config_type == CONFIG_TYPE_CONTROLLER)
load_remap_table(machine, parentnode);
/* iterate over all the port nodes */
for (portnode = xml_get_sibling(parentnode->child, "port"); portnode; portnode = xml_get_sibling(portnode->next, "port"))
{
input_seq newseq[SEQ_TYPE_TOTAL], tempseq;
xml_data_node *seqnode;
int type, player;
/* get the basic port info from the attributes */
type = token_to_input_field_type(machine, xml_get_attribute_string(portnode, "type", ""), &player);
/* initialize sequences to invalid defaults */
for (seqtype = 0; seqtype < ARRAY_LENGTH(newseq); seqtype++)
input_seq_set_1(&newseq[seqtype], INPUT_CODE_INVALID);
/* loop over new sequences */
for (seqnode = xml_get_sibling(portnode->child, "newseq"); seqnode; seqnode = xml_get_sibling(seqnode->next, "newseq"))
{
/* with a valid type, parse out the new sequence */
seqtype = token_to_seq_type(xml_get_attribute_string(seqnode, "type", ""));
if (seqtype != -1 && seqnode->value != NULL)
{
if (strcmp(seqnode->value, "NONE") == 0)
input_seq_set_0(&newseq[seqtype]);
else if (input_seq_from_tokens(machine, seqnode->value, &tempseq) != 0)
newseq[seqtype] = tempseq;
}
}
/* if we're loading default ports, apply to the defaults */
if (config_type != CONFIG_TYPE_GAME)
load_default_config(machine, portnode, type, player, newseq);
else
load_game_config(machine, portnode, type, player, newseq);
}
/* after applying the controller config, push that back into the backup, since that is */
/* what we will diff against */
if (config_type == CONFIG_TYPE_CONTROLLER)
{
input_type_state *typestate;
int seqtype;
for (typestate = portdata->typestatelist; typestate != NULL; typestate = typestate->next)
for (seqtype = 0; seqtype < ARRAY_LENGTH(typestate->typedesc.seq); seqtype++)
typestate->typedesc.seq[seqtype] = typestate->seq[seqtype];
}
} | /*-------------------------------------------------
load_config_callback - callback to extract
configuration data from the XML nodes
-------------------------------------------------*/ | callback to extract
configuration data from the XML nodes | [
"callback",
"to",
"extract",
"configuration",
"data",
"from",
"the",
"XML",
"nodes"
] | static void load_config_callback(running_machine *machine, int config_type, xml_data_node *parentnode)
{
input_port_private *portdata = machine->input_port_data;
xml_data_node *portnode;
int seqtype;
if (config_type == CONFIG_TYPE_FINAL)
{
portdata->safe_to_read = TRUE;
frame_update(machine);
}
if (parentnode == NULL)
return;
if (config_type == CONFIG_TYPE_CONTROLLER)
load_remap_table(machine, parentnode);
for (portnode = xml_get_sibling(parentnode->child, "port"); portnode; portnode = xml_get_sibling(portnode->next, "port"))
{
input_seq newseq[SEQ_TYPE_TOTAL], tempseq;
xml_data_node *seqnode;
int type, player;
type = token_to_input_field_type(machine, xml_get_attribute_string(portnode, "type", ""), &player);
for (seqtype = 0; seqtype < ARRAY_LENGTH(newseq); seqtype++)
input_seq_set_1(&newseq[seqtype], INPUT_CODE_INVALID);
for (seqnode = xml_get_sibling(portnode->child, "newseq"); seqnode; seqnode = xml_get_sibling(seqnode->next, "newseq"))
{
seqtype = token_to_seq_type(xml_get_attribute_string(seqnode, "type", ""));
if (seqtype != -1 && seqnode->value != NULL)
{
if (strcmp(seqnode->value, "NONE") == 0)
input_seq_set_0(&newseq[seqtype]);
else if (input_seq_from_tokens(machine, seqnode->value, &tempseq) != 0)
newseq[seqtype] = tempseq;
}
}
if (config_type != CONFIG_TYPE_GAME)
load_default_config(machine, portnode, type, player, newseq);
else
load_game_config(machine, portnode, type, player, newseq);
}
if (config_type == CONFIG_TYPE_CONTROLLER)
{
input_type_state *typestate;
int seqtype;
for (typestate = portdata->typestatelist; typestate != NULL; typestate = typestate->next)
for (seqtype = 0; seqtype < ARRAY_LENGTH(typestate->typedesc.seq); seqtype++)
typestate->typedesc.seq[seqtype] = typestate->seq[seqtype];
}
} | [
"static",
"void",
"load_config_callback",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"config_type",
",",
"xml_data_node",
"*",
"parentnode",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"xml_data_node",
"*",
"portnode",
";",
"int",
"seqtype",
";",
"if",
"(",
"config_type",
"==",
"CONFIG_TYPE_FINAL",
")",
"{",
"portdata",
"->",
"safe_to_read",
"=",
"TRUE",
";",
"frame_update",
"(",
"machine",
")",
";",
"}",
"if",
"(",
"parentnode",
"==",
"NULL",
")",
"return",
";",
"if",
"(",
"config_type",
"==",
"CONFIG_TYPE_CONTROLLER",
")",
"load_remap_table",
"(",
"machine",
",",
"parentnode",
")",
";",
"for",
"(",
"portnode",
"=",
"xml_get_sibling",
"(",
"parentnode",
"->",
"child",
",",
"\"",
"\"",
")",
";",
"portnode",
";",
"portnode",
"=",
"xml_get_sibling",
"(",
"portnode",
"->",
"next",
",",
"\"",
"\"",
")",
")",
"{",
"input_seq",
"newseq",
"[",
"SEQ_TYPE_TOTAL",
"]",
",",
"tempseq",
";",
"xml_data_node",
"*",
"seqnode",
";",
"int",
"type",
",",
"player",
";",
"type",
"=",
"token_to_input_field_type",
"(",
"machine",
",",
"xml_get_attribute_string",
"(",
"portnode",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"&",
"player",
")",
";",
"for",
"(",
"seqtype",
"=",
"0",
";",
"seqtype",
"<",
"ARRAY_LENGTH",
"(",
"newseq",
")",
";",
"seqtype",
"++",
")",
"input_seq_set_1",
"(",
"&",
"newseq",
"[",
"seqtype",
"]",
",",
"INPUT_CODE_INVALID",
")",
";",
"for",
"(",
"seqnode",
"=",
"xml_get_sibling",
"(",
"portnode",
"->",
"child",
",",
"\"",
"\"",
")",
";",
"seqnode",
";",
"seqnode",
"=",
"xml_get_sibling",
"(",
"seqnode",
"->",
"next",
",",
"\"",
"\"",
")",
")",
"{",
"seqtype",
"=",
"token_to_seq_type",
"(",
"xml_get_attribute_string",
"(",
"seqnode",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
")",
";",
"if",
"(",
"seqtype",
"!=",
"-1",
"&&",
"seqnode",
"->",
"value",
"!=",
"NULL",
")",
"{",
"if",
"(",
"strcmp",
"(",
"seqnode",
"->",
"value",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"input_seq_set_0",
"(",
"&",
"newseq",
"[",
"seqtype",
"]",
")",
";",
"else",
"if",
"(",
"input_seq_from_tokens",
"(",
"machine",
",",
"seqnode",
"->",
"value",
",",
"&",
"tempseq",
")",
"!=",
"0",
")",
"newseq",
"[",
"seqtype",
"]",
"=",
"tempseq",
";",
"}",
"}",
"if",
"(",
"config_type",
"!=",
"CONFIG_TYPE_GAME",
")",
"load_default_config",
"(",
"machine",
",",
"portnode",
",",
"type",
",",
"player",
",",
"newseq",
")",
";",
"else",
"load_game_config",
"(",
"machine",
",",
"portnode",
",",
"type",
",",
"player",
",",
"newseq",
")",
";",
"}",
"if",
"(",
"config_type",
"==",
"CONFIG_TYPE_CONTROLLER",
")",
"{",
"input_type_state",
"*",
"typestate",
";",
"int",
"seqtype",
";",
"for",
"(",
"typestate",
"=",
"portdata",
"->",
"typestatelist",
";",
"typestate",
"!=",
"NULL",
";",
"typestate",
"=",
"typestate",
"->",
"next",
")",
"for",
"(",
"seqtype",
"=",
"0",
";",
"seqtype",
"<",
"ARRAY_LENGTH",
"(",
"typestate",
"->",
"typedesc",
".",
"seq",
")",
";",
"seqtype",
"++",
")",
"typestate",
"->",
"typedesc",
".",
"seq",
"[",
"seqtype",
"]",
"=",
"typestate",
"->",
"seq",
"[",
"seqtype",
"]",
";",
"}",
"}"
] | load_config_callback - callback to extract
configuration data from the XML nodes | [
"load_config_callback",
"-",
"callback",
"to",
"extract",
"configuration",
"data",
"from",
"the",
"XML",
"nodes"
] | [
"/* in the completion phase, we finish the initialization with the final ports */",
"/* early exit if no data to parse */",
"/* iterate over all the remap nodes for controller configs only */",
"/* iterate over all the port nodes */",
"/* get the basic port info from the attributes */",
"/* initialize sequences to invalid defaults */",
"/* loop over new sequences */",
"/* with a valid type, parse out the new sequence */",
"/* if we're loading default ports, apply to the defaults */",
"/* after applying the controller config, push that back into the backup, since that is */",
"/* what we will diff against */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "config_type",
"type": "int"
},
{
"param": "parentnode",
"type": "xml_data_node"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config_type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parentnode",
"type": "xml_data_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | load_remap_table | void | static void load_remap_table(running_machine *machine, xml_data_node *parentnode)
{
input_port_private *portdata = machine->input_port_data;
input_code *oldtable, *newtable;
xml_data_node *remapnode;
int count;
/* count items first so we can allocate */
count = 0;
for (remapnode = xml_get_sibling(parentnode->child, "remap"); remapnode != NULL; remapnode = xml_get_sibling(remapnode->next, "remap"))
count++;
/* if we have some, deal with them */
if (count > 0)
{
int remapnum;
/* allocate tables */
oldtable = global_alloc_array(input_code, count);
newtable = global_alloc_array(input_code, count);
/* build up the remap table */
count = 0;
for (remapnode = xml_get_sibling(parentnode->child, "remap"); remapnode != NULL; remapnode = xml_get_sibling(remapnode->next, "remap"))
{
input_code origcode = input_code_from_token(machine, xml_get_attribute_string(remapnode, "origcode", ""));
input_code newcode = input_code_from_token(machine, xml_get_attribute_string(remapnode, "newcode", ""));
if (origcode != INPUT_CODE_INVALID && newcode != INPUT_CODE_INVALID)
{
oldtable[count] = origcode;
newtable[count] = newcode;
count++;
}
}
/* loop over the remapping table, operating only if something was specified */
for (remapnum = 0; remapnum < count; remapnum++)
{
input_code oldcode = oldtable[remapnum];
input_code newcode = newtable[remapnum];
input_type_state *typestate;
/* loop over all default ports, remapping the requested keys */
for (typestate = portdata->typestatelist; typestate != NULL; typestate = typestate->next)
{
int seqtype, codenum;
/* remap anything in the default sequences */
for (seqtype = 0; seqtype < ARRAY_LENGTH(typestate->seq); seqtype++)
for (codenum = 0; codenum < ARRAY_LENGTH(typestate->seq[0].code); codenum++)
if (typestate->seq[seqtype].code[codenum] == oldcode)
typestate->seq[seqtype].code[codenum] = newcode;
}
}
/* release the tables */
global_free(oldtable);
global_free(newtable);
}
} | /*-------------------------------------------------
load_remap_table - extract and apply the
global remapping table
-------------------------------------------------*/ | extract and apply the
global remapping table | [
"extract",
"and",
"apply",
"the",
"global",
"remapping",
"table"
] | static void load_remap_table(running_machine *machine, xml_data_node *parentnode)
{
input_port_private *portdata = machine->input_port_data;
input_code *oldtable, *newtable;
xml_data_node *remapnode;
int count;
count = 0;
for (remapnode = xml_get_sibling(parentnode->child, "remap"); remapnode != NULL; remapnode = xml_get_sibling(remapnode->next, "remap"))
count++;
if (count > 0)
{
int remapnum;
oldtable = global_alloc_array(input_code, count);
newtable = global_alloc_array(input_code, count);
count = 0;
for (remapnode = xml_get_sibling(parentnode->child, "remap"); remapnode != NULL; remapnode = xml_get_sibling(remapnode->next, "remap"))
{
input_code origcode = input_code_from_token(machine, xml_get_attribute_string(remapnode, "origcode", ""));
input_code newcode = input_code_from_token(machine, xml_get_attribute_string(remapnode, "newcode", ""));
if (origcode != INPUT_CODE_INVALID && newcode != INPUT_CODE_INVALID)
{
oldtable[count] = origcode;
newtable[count] = newcode;
count++;
}
}
for (remapnum = 0; remapnum < count; remapnum++)
{
input_code oldcode = oldtable[remapnum];
input_code newcode = newtable[remapnum];
input_type_state *typestate;
for (typestate = portdata->typestatelist; typestate != NULL; typestate = typestate->next)
{
int seqtype, codenum;
for (seqtype = 0; seqtype < ARRAY_LENGTH(typestate->seq); seqtype++)
for (codenum = 0; codenum < ARRAY_LENGTH(typestate->seq[0].code); codenum++)
if (typestate->seq[seqtype].code[codenum] == oldcode)
typestate->seq[seqtype].code[codenum] = newcode;
}
}
global_free(oldtable);
global_free(newtable);
}
} | [
"static",
"void",
"load_remap_table",
"(",
"running_machine",
"*",
"machine",
",",
"xml_data_node",
"*",
"parentnode",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"input_code",
"*",
"oldtable",
",",
"*",
"newtable",
";",
"xml_data_node",
"*",
"remapnode",
";",
"int",
"count",
";",
"count",
"=",
"0",
";",
"for",
"(",
"remapnode",
"=",
"xml_get_sibling",
"(",
"parentnode",
"->",
"child",
",",
"\"",
"\"",
")",
";",
"remapnode",
"!=",
"NULL",
";",
"remapnode",
"=",
"xml_get_sibling",
"(",
"remapnode",
"->",
"next",
",",
"\"",
"\"",
")",
")",
"count",
"++",
";",
"if",
"(",
"count",
">",
"0",
")",
"{",
"int",
"remapnum",
";",
"oldtable",
"=",
"global_alloc_array",
"(",
"input_code",
",",
"count",
")",
";",
"newtable",
"=",
"global_alloc_array",
"(",
"input_code",
",",
"count",
")",
";",
"count",
"=",
"0",
";",
"for",
"(",
"remapnode",
"=",
"xml_get_sibling",
"(",
"parentnode",
"->",
"child",
",",
"\"",
"\"",
")",
";",
"remapnode",
"!=",
"NULL",
";",
"remapnode",
"=",
"xml_get_sibling",
"(",
"remapnode",
"->",
"next",
",",
"\"",
"\"",
")",
")",
"{",
"input_code",
"origcode",
"=",
"input_code_from_token",
"(",
"machine",
",",
"xml_get_attribute_string",
"(",
"remapnode",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
")",
";",
"input_code",
"newcode",
"=",
"input_code_from_token",
"(",
"machine",
",",
"xml_get_attribute_string",
"(",
"remapnode",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
")",
";",
"if",
"(",
"origcode",
"!=",
"INPUT_CODE_INVALID",
"&&",
"newcode",
"!=",
"INPUT_CODE_INVALID",
")",
"{",
"oldtable",
"[",
"count",
"]",
"=",
"origcode",
";",
"newtable",
"[",
"count",
"]",
"=",
"newcode",
";",
"count",
"++",
";",
"}",
"}",
"for",
"(",
"remapnum",
"=",
"0",
";",
"remapnum",
"<",
"count",
";",
"remapnum",
"++",
")",
"{",
"input_code",
"oldcode",
"=",
"oldtable",
"[",
"remapnum",
"]",
";",
"input_code",
"newcode",
"=",
"newtable",
"[",
"remapnum",
"]",
";",
"input_type_state",
"*",
"typestate",
";",
"for",
"(",
"typestate",
"=",
"portdata",
"->",
"typestatelist",
";",
"typestate",
"!=",
"NULL",
";",
"typestate",
"=",
"typestate",
"->",
"next",
")",
"{",
"int",
"seqtype",
",",
"codenum",
";",
"for",
"(",
"seqtype",
"=",
"0",
";",
"seqtype",
"<",
"ARRAY_LENGTH",
"(",
"typestate",
"->",
"seq",
")",
";",
"seqtype",
"++",
")",
"for",
"(",
"codenum",
"=",
"0",
";",
"codenum",
"<",
"ARRAY_LENGTH",
"(",
"typestate",
"->",
"seq",
"[",
"0",
"]",
".",
"code",
")",
";",
"codenum",
"++",
")",
"if",
"(",
"typestate",
"->",
"seq",
"[",
"seqtype",
"]",
".",
"code",
"[",
"codenum",
"]",
"==",
"oldcode",
")",
"typestate",
"->",
"seq",
"[",
"seqtype",
"]",
".",
"code",
"[",
"codenum",
"]",
"=",
"newcode",
";",
"}",
"}",
"global_free",
"(",
"oldtable",
")",
";",
"global_free",
"(",
"newtable",
")",
";",
"}",
"}"
] | load_remap_table - extract and apply the
global remapping table | [
"load_remap_table",
"-",
"extract",
"and",
"apply",
"the",
"global",
"remapping",
"table"
] | [
"/* count items first so we can allocate */",
"/* if we have some, deal with them */",
"/* allocate tables */",
"/* build up the remap table */",
"/* loop over the remapping table, operating only if something was specified */",
"/* loop over all default ports, remapping the requested keys */",
"/* remap anything in the default sequences */",
"/* release the tables */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "parentnode",
"type": "xml_data_node"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parentnode",
"type": "xml_data_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | load_default_config | int | static int load_default_config(running_machine *machine, xml_data_node *portnode, int type, int player, const input_seq *newseq)
{
input_port_private *portdata = machine->input_port_data;
input_type_state *typestate;
int seqtype;
/* find a matching port in the list */
for (typestate = portdata->typestatelist; typestate != NULL; typestate = typestate->next)
if (typestate->typedesc.type == type && typestate->typedesc.player == player)
{
for (seqtype = 0; seqtype < ARRAY_LENGTH(typestate->seq); seqtype++)
if (input_seq_get_1(&newseq[seqtype]) != INPUT_CODE_INVALID)
typestate->seq[seqtype] = newseq[seqtype];
return TRUE;
}
return FALSE;
} | /*-------------------------------------------------
load_default_config - apply configuration
data to the default mappings
-------------------------------------------------*/ | apply configuration
data to the default mappings | [
"apply",
"configuration",
"data",
"to",
"the",
"default",
"mappings"
] | static int load_default_config(running_machine *machine, xml_data_node *portnode, int type, int player, const input_seq *newseq)
{
input_port_private *portdata = machine->input_port_data;
input_type_state *typestate;
int seqtype;
for (typestate = portdata->typestatelist; typestate != NULL; typestate = typestate->next)
if (typestate->typedesc.type == type && typestate->typedesc.player == player)
{
for (seqtype = 0; seqtype < ARRAY_LENGTH(typestate->seq); seqtype++)
if (input_seq_get_1(&newseq[seqtype]) != INPUT_CODE_INVALID)
typestate->seq[seqtype] = newseq[seqtype];
return TRUE;
}
return FALSE;
} | [
"static",
"int",
"load_default_config",
"(",
"running_machine",
"*",
"machine",
",",
"xml_data_node",
"*",
"portnode",
",",
"int",
"type",
",",
"int",
"player",
",",
"const",
"input_seq",
"*",
"newseq",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"input_type_state",
"*",
"typestate",
";",
"int",
"seqtype",
";",
"for",
"(",
"typestate",
"=",
"portdata",
"->",
"typestatelist",
";",
"typestate",
"!=",
"NULL",
";",
"typestate",
"=",
"typestate",
"->",
"next",
")",
"if",
"(",
"typestate",
"->",
"typedesc",
".",
"type",
"==",
"type",
"&&",
"typestate",
"->",
"typedesc",
".",
"player",
"==",
"player",
")",
"{",
"for",
"(",
"seqtype",
"=",
"0",
";",
"seqtype",
"<",
"ARRAY_LENGTH",
"(",
"typestate",
"->",
"seq",
")",
";",
"seqtype",
"++",
")",
"if",
"(",
"input_seq_get_1",
"(",
"&",
"newseq",
"[",
"seqtype",
"]",
")",
"!=",
"INPUT_CODE_INVALID",
")",
"typestate",
"->",
"seq",
"[",
"seqtype",
"]",
"=",
"newseq",
"[",
"seqtype",
"]",
";",
"return",
"TRUE",
";",
"}",
"return",
"FALSE",
";",
"}"
] | load_default_config - apply configuration
data to the default mappings | [
"load_default_config",
"-",
"apply",
"configuration",
"data",
"to",
"the",
"default",
"mappings"
] | [
"/* find a matching port in the list */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "portnode",
"type": "xml_data_node"
},
{
"param": "type",
"type": "int"
},
{
"param": "player",
"type": "int"
},
{
"param": "newseq",
"type": "input_seq"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "portnode",
"type": "xml_data_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "player",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "newseq",
"type": "input_seq",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | load_game_config | int | static int load_game_config(running_machine *machine, xml_data_node *portnode, int type, int player, const input_seq *newseq)
{
input_port_value mask, defvalue;
const input_field_config *field;
const input_port_config *port;
char tempbuffer[20];
const char *tag;
/* read the mask, index, and defvalue attributes */
tag = xml_get_attribute_string(portnode, "tag", NULL);
mask = xml_get_attribute_int(portnode, "mask", 0);
defvalue = xml_get_attribute_int(portnode, "defvalue", 0);
/* find the port we want; if no tag, search them all */
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
if (tag == NULL || strcmp(get_port_tag(port, tempbuffer), tag) == 0)
for (field = port->fieldlist; field != NULL; field = field->next)
/* find the matching mask and defvalue */
if (field->type == type && field->player == player &&
field->mask == mask && (field->defvalue & mask) == (defvalue & mask))
{
const char *revstring;
int seqtype;
/* if a sequence was specified, copy it in */
for (seqtype = 0; seqtype < ARRAY_LENGTH(field->state->seq); seqtype++)
if (input_seq_get_1(&newseq[seqtype]) != INPUT_CODE_INVALID)
field->state->seq[seqtype] = newseq[seqtype];
/* for non-analog fields, fetch the value */
if (field->state->analog == NULL)
field->state->value = xml_get_attribute_int(portnode, "value", field->defvalue);
/* for analog fields, fetch configurable analog attributes */
else
{
/* get base attributes */
field->state->analog->delta = xml_get_attribute_int(portnode, "keydelta", field->delta);
field->state->analog->centerdelta = xml_get_attribute_int(portnode, "centerdelta", field->centerdelta);
field->state->analog->sensitivity = xml_get_attribute_int(portnode, "sensitivity", field->sensitivity);
/* fetch yes/no for reverse setting */
revstring = xml_get_attribute_string(portnode, "reverse", NULL);
if (revstring != NULL)
field->state->analog->reverse = (strcmp(revstring, "yes") == 0);
}
return TRUE;
}
return FALSE;
} | /*-------------------------------------------------
load_game_config - apply configuration
data to the current set of input ports
-------------------------------------------------*/ | apply configuration
data to the current set of input ports | [
"apply",
"configuration",
"data",
"to",
"the",
"current",
"set",
"of",
"input",
"ports"
] | static int load_game_config(running_machine *machine, xml_data_node *portnode, int type, int player, const input_seq *newseq)
{
input_port_value mask, defvalue;
const input_field_config *field;
const input_port_config *port;
char tempbuffer[20];
const char *tag;
tag = xml_get_attribute_string(portnode, "tag", NULL);
mask = xml_get_attribute_int(portnode, "mask", 0);
defvalue = xml_get_attribute_int(portnode, "defvalue", 0);
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
if (tag == NULL || strcmp(get_port_tag(port, tempbuffer), tag) == 0)
for (field = port->fieldlist; field != NULL; field = field->next)
if (field->type == type && field->player == player &&
field->mask == mask && (field->defvalue & mask) == (defvalue & mask))
{
const char *revstring;
int seqtype;
for (seqtype = 0; seqtype < ARRAY_LENGTH(field->state->seq); seqtype++)
if (input_seq_get_1(&newseq[seqtype]) != INPUT_CODE_INVALID)
field->state->seq[seqtype] = newseq[seqtype];
if (field->state->analog == NULL)
field->state->value = xml_get_attribute_int(portnode, "value", field->defvalue);
else
{
field->state->analog->delta = xml_get_attribute_int(portnode, "keydelta", field->delta);
field->state->analog->centerdelta = xml_get_attribute_int(portnode, "centerdelta", field->centerdelta);
field->state->analog->sensitivity = xml_get_attribute_int(portnode, "sensitivity", field->sensitivity);
revstring = xml_get_attribute_string(portnode, "reverse", NULL);
if (revstring != NULL)
field->state->analog->reverse = (strcmp(revstring, "yes") == 0);
}
return TRUE;
}
return FALSE;
} | [
"static",
"int",
"load_game_config",
"(",
"running_machine",
"*",
"machine",
",",
"xml_data_node",
"*",
"portnode",
",",
"int",
"type",
",",
"int",
"player",
",",
"const",
"input_seq",
"*",
"newseq",
")",
"{",
"input_port_value",
"mask",
",",
"defvalue",
";",
"const",
"input_field_config",
"*",
"field",
";",
"const",
"input_port_config",
"*",
"port",
";",
"char",
"tempbuffer",
"[",
"20",
"]",
";",
"const",
"char",
"*",
"tag",
";",
"tag",
"=",
"xml_get_attribute_string",
"(",
"portnode",
",",
"\"",
"\"",
",",
"NULL",
")",
";",
"mask",
"=",
"xml_get_attribute_int",
"(",
"portnode",
",",
"\"",
"\"",
",",
"0",
")",
";",
"defvalue",
"=",
"xml_get_attribute_int",
"(",
"portnode",
",",
"\"",
"\"",
",",
"0",
")",
";",
"for",
"(",
"port",
"=",
"machine",
"->",
"m_portlist",
".",
"first",
"(",
")",
";",
"port",
"!=",
"NULL",
";",
"port",
"=",
"port",
"->",
"next",
"(",
")",
")",
"if",
"(",
"tag",
"==",
"NULL",
"||",
"strcmp",
"(",
"get_port_tag",
"(",
"port",
",",
"tempbuffer",
")",
",",
"tag",
")",
"==",
"0",
")",
"for",
"(",
"field",
"=",
"port",
"->",
"fieldlist",
";",
"field",
"!=",
"NULL",
";",
"field",
"=",
"field",
"->",
"next",
")",
"if",
"(",
"field",
"->",
"type",
"==",
"type",
"&&",
"field",
"->",
"player",
"==",
"player",
"&&",
"field",
"->",
"mask",
"==",
"mask",
"&&",
"(",
"field",
"->",
"defvalue",
"&",
"mask",
")",
"==",
"(",
"defvalue",
"&",
"mask",
")",
")",
"{",
"const",
"char",
"*",
"revstring",
";",
"int",
"seqtype",
";",
"for",
"(",
"seqtype",
"=",
"0",
";",
"seqtype",
"<",
"ARRAY_LENGTH",
"(",
"field",
"->",
"state",
"->",
"seq",
")",
";",
"seqtype",
"++",
")",
"if",
"(",
"input_seq_get_1",
"(",
"&",
"newseq",
"[",
"seqtype",
"]",
")",
"!=",
"INPUT_CODE_INVALID",
")",
"field",
"->",
"state",
"->",
"seq",
"[",
"seqtype",
"]",
"=",
"newseq",
"[",
"seqtype",
"]",
";",
"if",
"(",
"field",
"->",
"state",
"->",
"analog",
"==",
"NULL",
")",
"field",
"->",
"state",
"->",
"value",
"=",
"xml_get_attribute_int",
"(",
"portnode",
",",
"\"",
"\"",
",",
"field",
"->",
"defvalue",
")",
";",
"else",
"{",
"field",
"->",
"state",
"->",
"analog",
"->",
"delta",
"=",
"xml_get_attribute_int",
"(",
"portnode",
",",
"\"",
"\"",
",",
"field",
"->",
"delta",
")",
";",
"field",
"->",
"state",
"->",
"analog",
"->",
"centerdelta",
"=",
"xml_get_attribute_int",
"(",
"portnode",
",",
"\"",
"\"",
",",
"field",
"->",
"centerdelta",
")",
";",
"field",
"->",
"state",
"->",
"analog",
"->",
"sensitivity",
"=",
"xml_get_attribute_int",
"(",
"portnode",
",",
"\"",
"\"",
",",
"field",
"->",
"sensitivity",
")",
";",
"revstring",
"=",
"xml_get_attribute_string",
"(",
"portnode",
",",
"\"",
"\"",
",",
"NULL",
")",
";",
"if",
"(",
"revstring",
"!=",
"NULL",
")",
"field",
"->",
"state",
"->",
"analog",
"->",
"reverse",
"=",
"(",
"strcmp",
"(",
"revstring",
",",
"\"",
"\"",
")",
"==",
"0",
")",
";",
"}",
"return",
"TRUE",
";",
"}",
"return",
"FALSE",
";",
"}"
] | load_game_config - apply configuration
data to the current set of input ports | [
"load_game_config",
"-",
"apply",
"configuration",
"data",
"to",
"the",
"current",
"set",
"of",
"input",
"ports"
] | [
"/* read the mask, index, and defvalue attributes */",
"/* find the port we want; if no tag, search them all */",
"/* find the matching mask and defvalue */",
"/* if a sequence was specified, copy it in */",
"/* for non-analog fields, fetch the value */",
"/* for analog fields, fetch configurable analog attributes */",
"/* get base attributes */",
"/* fetch yes/no for reverse setting */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "portnode",
"type": "xml_data_node"
},
{
"param": "type",
"type": "int"
},
{
"param": "player",
"type": "int"
},
{
"param": "newseq",
"type": "input_seq"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "portnode",
"type": "xml_data_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "player",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "newseq",
"type": "input_seq",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | save_config_callback | void | static void save_config_callback(running_machine *machine, int config_type, xml_data_node *parentnode)
{
/* if no parentnode, ignore */
if (parentnode == NULL)
return;
/* default ports save differently */
if (config_type == CONFIG_TYPE_DEFAULT)
save_default_inputs(machine, parentnode);
else
save_game_inputs(machine, parentnode);
} | /*-------------------------------------------------
save_config_callback - config callback for
saving input port configuration
-------------------------------------------------*/ | config callback for
saving input port configuration | [
"config",
"callback",
"for",
"saving",
"input",
"port",
"configuration"
] | static void save_config_callback(running_machine *machine, int config_type, xml_data_node *parentnode)
{
if (parentnode == NULL)
return;
if (config_type == CONFIG_TYPE_DEFAULT)
save_default_inputs(machine, parentnode);
else
save_game_inputs(machine, parentnode);
} | [
"static",
"void",
"save_config_callback",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"config_type",
",",
"xml_data_node",
"*",
"parentnode",
")",
"{",
"if",
"(",
"parentnode",
"==",
"NULL",
")",
"return",
";",
"if",
"(",
"config_type",
"==",
"CONFIG_TYPE_DEFAULT",
")",
"save_default_inputs",
"(",
"machine",
",",
"parentnode",
")",
";",
"else",
"save_game_inputs",
"(",
"machine",
",",
"parentnode",
")",
";",
"}"
] | save_config_callback - config callback for
saving input port configuration | [
"save_config_callback",
"-",
"config",
"callback",
"for",
"saving",
"input",
"port",
"configuration"
] | [
"/* if no parentnode, ignore */",
"/* default ports save differently */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "config_type",
"type": "int"
},
{
"param": "parentnode",
"type": "xml_data_node"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config_type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parentnode",
"type": "xml_data_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | save_sequence | void | static void save_sequence(running_machine *machine, xml_data_node *parentnode, int type, int porttype, const input_seq *seq)
{
astring seqstring;
xml_data_node *seqnode;
/* get the string for the sequence */
if (input_seq_get_1(seq) == SEQCODE_END)
seqstring.cpy("NONE");
else
input_seq_to_tokens(machine, seqstring, seq);
/* add the new node */
seqnode = xml_add_child(parentnode, "newseq", seqstring);
if (seqnode != NULL)
xml_set_attribute(seqnode, "type", seqtypestrings[type]);
} | /*-------------------------------------------------
save_sequence - add a node for an input
sequence
-------------------------------------------------*/ | add a node for an input
sequence | [
"add",
"a",
"node",
"for",
"an",
"input",
"sequence"
] | static void save_sequence(running_machine *machine, xml_data_node *parentnode, int type, int porttype, const input_seq *seq)
{
astring seqstring;
xml_data_node *seqnode;
if (input_seq_get_1(seq) == SEQCODE_END)
seqstring.cpy("NONE");
else
input_seq_to_tokens(machine, seqstring, seq);
seqnode = xml_add_child(parentnode, "newseq", seqstring);
if (seqnode != NULL)
xml_set_attribute(seqnode, "type", seqtypestrings[type]);
} | [
"static",
"void",
"save_sequence",
"(",
"running_machine",
"*",
"machine",
",",
"xml_data_node",
"*",
"parentnode",
",",
"int",
"type",
",",
"int",
"porttype",
",",
"const",
"input_seq",
"*",
"seq",
")",
"{",
"astring",
"seqstring",
";",
"xml_data_node",
"*",
"seqnode",
";",
"if",
"(",
"input_seq_get_1",
"(",
"seq",
")",
"==",
"SEQCODE_END",
")",
"seqstring",
".",
"cpy",
"(",
"\"",
"\"",
")",
";",
"else",
"input_seq_to_tokens",
"(",
"machine",
",",
"seqstring",
",",
"seq",
")",
";",
"seqnode",
"=",
"xml_add_child",
"(",
"parentnode",
",",
"\"",
"\"",
",",
"seqstring",
")",
";",
"if",
"(",
"seqnode",
"!=",
"NULL",
")",
"xml_set_attribute",
"(",
"seqnode",
",",
"\"",
"\"",
",",
"seqtypestrings",
"[",
"type",
"]",
")",
";",
"}"
] | save_sequence - add a node for an input
sequence | [
"save_sequence",
"-",
"add",
"a",
"node",
"for",
"an",
"input",
"sequence"
] | [
"/* get the string for the sequence */",
"/* add the new node */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "parentnode",
"type": "xml_data_node"
},
{
"param": "type",
"type": "int"
},
{
"param": "porttype",
"type": "int"
},
{
"param": "seq",
"type": "input_seq"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parentnode",
"type": "xml_data_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "porttype",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seq",
"type": "input_seq",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | save_this_input_field_type | int | static int save_this_input_field_type(int type)
{
switch (type)
{
case IPT_UNUSED:
case IPT_END:
case IPT_PORT:
case IPT_VBLANK:
case IPT_UNKNOWN:
return FALSE;
}
return TRUE;
} | /*-------------------------------------------------
save_this_input_field_type - determine if the given
port type is worth saving
-------------------------------------------------*/ | determine if the given
port type is worth saving | [
"determine",
"if",
"the",
"given",
"port",
"type",
"is",
"worth",
"saving"
] | static int save_this_input_field_type(int type)
{
switch (type)
{
case IPT_UNUSED:
case IPT_END:
case IPT_PORT:
case IPT_VBLANK:
case IPT_UNKNOWN:
return FALSE;
}
return TRUE;
} | [
"static",
"int",
"save_this_input_field_type",
"(",
"int",
"type",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"IPT_UNUSED",
":",
"case",
"IPT_END",
":",
"case",
"IPT_PORT",
":",
"case",
"IPT_VBLANK",
":",
"case",
"IPT_UNKNOWN",
":",
"return",
"FALSE",
";",
"}",
"return",
"TRUE",
";",
"}"
] | save_this_input_field_type - determine if the given
port type is worth saving | [
"save_this_input_field_type",
"-",
"determine",
"if",
"the",
"given",
"port",
"type",
"is",
"worth",
"saving"
] | [] | [
{
"param": "type",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | save_default_inputs | void | static void save_default_inputs(running_machine *machine, xml_data_node *parentnode)
{
input_port_private *portdata = machine->input_port_data;
input_type_state *typestate;
/* iterate over ports */
for (typestate = portdata->typestatelist; typestate != NULL; typestate = typestate->next)
{
/* only save if this port is a type we save */
if (save_this_input_field_type(typestate->typedesc.type))
{
int seqtype;
/* see if any of the sequences have changed */
for (seqtype = 0; seqtype < ARRAY_LENGTH(typestate->seq); seqtype++)
if (input_seq_cmp(&typestate->seq[seqtype], &typestate->typedesc.seq[seqtype]) != 0)
break;
/* if so, we need to add a node */
if (seqtype < ARRAY_LENGTH(typestate->seq))
{
/* add a new port node */
xml_data_node *portnode = xml_add_child(parentnode, "port", NULL);
if (portnode != NULL)
{
/* add the port information and attributes */
xml_set_attribute(portnode, "type", input_field_type_to_token(machine, typestate->typedesc.type, typestate->typedesc.player));
/* add only the sequences that have changed from the defaults */
for (seqtype = 0; seqtype < ARRAY_LENGTH(typestate->seq); seqtype++)
if (input_seq_cmp(&typestate->seq[seqtype], &typestate->typedesc.seq[seqtype]) != 0)
save_sequence(machine, portnode, seqtype, typestate->typedesc.type, &typestate->seq[seqtype]);
}
}
}
}
} | /*-------------------------------------------------
save_default_inputs - add nodes for any default
mappings that have changed
-------------------------------------------------*/ | add nodes for any default
mappings that have changed | [
"add",
"nodes",
"for",
"any",
"default",
"mappings",
"that",
"have",
"changed"
] | static void save_default_inputs(running_machine *machine, xml_data_node *parentnode)
{
input_port_private *portdata = machine->input_port_data;
input_type_state *typestate;
for (typestate = portdata->typestatelist; typestate != NULL; typestate = typestate->next)
{
if (save_this_input_field_type(typestate->typedesc.type))
{
int seqtype;
for (seqtype = 0; seqtype < ARRAY_LENGTH(typestate->seq); seqtype++)
if (input_seq_cmp(&typestate->seq[seqtype], &typestate->typedesc.seq[seqtype]) != 0)
break;
if (seqtype < ARRAY_LENGTH(typestate->seq))
{
xml_data_node *portnode = xml_add_child(parentnode, "port", NULL);
if (portnode != NULL)
{
xml_set_attribute(portnode, "type", input_field_type_to_token(machine, typestate->typedesc.type, typestate->typedesc.player));
for (seqtype = 0; seqtype < ARRAY_LENGTH(typestate->seq); seqtype++)
if (input_seq_cmp(&typestate->seq[seqtype], &typestate->typedesc.seq[seqtype]) != 0)
save_sequence(machine, portnode, seqtype, typestate->typedesc.type, &typestate->seq[seqtype]);
}
}
}
}
} | [
"static",
"void",
"save_default_inputs",
"(",
"running_machine",
"*",
"machine",
",",
"xml_data_node",
"*",
"parentnode",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"input_type_state",
"*",
"typestate",
";",
"for",
"(",
"typestate",
"=",
"portdata",
"->",
"typestatelist",
";",
"typestate",
"!=",
"NULL",
";",
"typestate",
"=",
"typestate",
"->",
"next",
")",
"{",
"if",
"(",
"save_this_input_field_type",
"(",
"typestate",
"->",
"typedesc",
".",
"type",
")",
")",
"{",
"int",
"seqtype",
";",
"for",
"(",
"seqtype",
"=",
"0",
";",
"seqtype",
"<",
"ARRAY_LENGTH",
"(",
"typestate",
"->",
"seq",
")",
";",
"seqtype",
"++",
")",
"if",
"(",
"input_seq_cmp",
"(",
"&",
"typestate",
"->",
"seq",
"[",
"seqtype",
"]",
",",
"&",
"typestate",
"->",
"typedesc",
".",
"seq",
"[",
"seqtype",
"]",
")",
"!=",
"0",
")",
"break",
";",
"if",
"(",
"seqtype",
"<",
"ARRAY_LENGTH",
"(",
"typestate",
"->",
"seq",
")",
")",
"{",
"xml_data_node",
"*",
"portnode",
"=",
"xml_add_child",
"(",
"parentnode",
",",
"\"",
"\"",
",",
"NULL",
")",
";",
"if",
"(",
"portnode",
"!=",
"NULL",
")",
"{",
"xml_set_attribute",
"(",
"portnode",
",",
"\"",
"\"",
",",
"input_field_type_to_token",
"(",
"machine",
",",
"typestate",
"->",
"typedesc",
".",
"type",
",",
"typestate",
"->",
"typedesc",
".",
"player",
")",
")",
";",
"for",
"(",
"seqtype",
"=",
"0",
";",
"seqtype",
"<",
"ARRAY_LENGTH",
"(",
"typestate",
"->",
"seq",
")",
";",
"seqtype",
"++",
")",
"if",
"(",
"input_seq_cmp",
"(",
"&",
"typestate",
"->",
"seq",
"[",
"seqtype",
"]",
",",
"&",
"typestate",
"->",
"typedesc",
".",
"seq",
"[",
"seqtype",
"]",
")",
"!=",
"0",
")",
"save_sequence",
"(",
"machine",
",",
"portnode",
",",
"seqtype",
",",
"typestate",
"->",
"typedesc",
".",
"type",
",",
"&",
"typestate",
"->",
"seq",
"[",
"seqtype",
"]",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | save_default_inputs - add nodes for any default
mappings that have changed | [
"save_default_inputs",
"-",
"add",
"nodes",
"for",
"any",
"default",
"mappings",
"that",
"have",
"changed"
] | [
"/* iterate over ports */",
"/* only save if this port is a type we save */",
"/* see if any of the sequences have changed */",
"/* if so, we need to add a node */",
"/* add a new port node */",
"/* add the port information and attributes */",
"/* add only the sequences that have changed from the defaults */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "parentnode",
"type": "xml_data_node"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parentnode",
"type": "xml_data_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | save_game_inputs | void | static void save_game_inputs(running_machine *machine, xml_data_node *parentnode)
{
const input_field_config *field;
const input_port_config *port;
/* iterate over ports */
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
for (field = port->fieldlist; field != NULL; field = field->next)
if (save_this_input_field_type(field->type))
{
int changed = FALSE;
int seqtype;
/* determine if we changed */
for (seqtype = 0; seqtype < ARRAY_LENGTH(field->state->seq); seqtype++)
changed |= (input_seq_cmp(&field->state->seq[seqtype], &field->seq[seqtype]) != 0);
/* non-analog changes */
if (field->state->analog == NULL)
changed |= ((field->state->value & field->mask) != (field->defvalue & field->mask));
/* analog changes */
else
{
changed |= (field->state->analog->delta != field->delta);
changed |= (field->state->analog->centerdelta != field->centerdelta);
changed |= (field->state->analog->sensitivity != field->sensitivity);
changed |= (field->state->analog->reverse != ((field->flags & ANALOG_FLAG_REVERSE) != 0));
}
/* if we did change, add a new node */
if (changed)
{
/* add a new port node */
xml_data_node *portnode = xml_add_child(parentnode, "port", NULL);
if (portnode != NULL)
{
char tempbuffer[20];
/* add the identifying information and attributes */
xml_set_attribute(portnode, "tag", get_port_tag(port, tempbuffer));
xml_set_attribute(portnode, "type", input_field_type_to_token(machine, field->type, field->player));
xml_set_attribute_int(portnode, "mask", field->mask);
xml_set_attribute_int(portnode, "defvalue", field->defvalue & field->mask);
/* add sequences if changed */
for (seqtype = 0; seqtype < ARRAY_LENGTH(field->state->seq); seqtype++)
if (input_seq_cmp(&field->state->seq[seqtype], &field->seq[seqtype]) != 0)
save_sequence(machine, portnode, seqtype, field->type, &field->state->seq[seqtype]);
/* write out non-analog changes */
if (field->state->analog == NULL)
{
if ((field->state->value & field->mask) != (field->defvalue & field->mask))
xml_set_attribute_int(portnode, "value", field->state->value & field->mask);
}
/* write out analog changes */
else
{
if (field->state->analog->delta != field->delta)
xml_set_attribute_int(portnode, "keydelta", field->state->analog->delta);
if (field->state->analog->centerdelta != field->centerdelta)
xml_set_attribute_int(portnode, "centerdelta", field->state->analog->centerdelta);
if (field->state->analog->sensitivity != field->sensitivity)
xml_set_attribute_int(portnode, "sensitivity", field->state->analog->sensitivity);
if (field->state->analog->reverse != ((field->flags & ANALOG_FLAG_REVERSE) != 0))
xml_set_attribute(portnode, "reverse", field->state->analog->reverse ? "yes" : "no");
}
}
}
}
} | /*-------------------------------------------------
save_game_inputs - add nodes for any game
mappings that have changed
-------------------------------------------------*/ | add nodes for any game
mappings that have changed | [
"add",
"nodes",
"for",
"any",
"game",
"mappings",
"that",
"have",
"changed"
] | static void save_game_inputs(running_machine *machine, xml_data_node *parentnode)
{
const input_field_config *field;
const input_port_config *port;
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
for (field = port->fieldlist; field != NULL; field = field->next)
if (save_this_input_field_type(field->type))
{
int changed = FALSE;
int seqtype;
for (seqtype = 0; seqtype < ARRAY_LENGTH(field->state->seq); seqtype++)
changed |= (input_seq_cmp(&field->state->seq[seqtype], &field->seq[seqtype]) != 0);
if (field->state->analog == NULL)
changed |= ((field->state->value & field->mask) != (field->defvalue & field->mask));
else
{
changed |= (field->state->analog->delta != field->delta);
changed |= (field->state->analog->centerdelta != field->centerdelta);
changed |= (field->state->analog->sensitivity != field->sensitivity);
changed |= (field->state->analog->reverse != ((field->flags & ANALOG_FLAG_REVERSE) != 0));
}
if (changed)
{
xml_data_node *portnode = xml_add_child(parentnode, "port", NULL);
if (portnode != NULL)
{
char tempbuffer[20];
xml_set_attribute(portnode, "tag", get_port_tag(port, tempbuffer));
xml_set_attribute(portnode, "type", input_field_type_to_token(machine, field->type, field->player));
xml_set_attribute_int(portnode, "mask", field->mask);
xml_set_attribute_int(portnode, "defvalue", field->defvalue & field->mask);
for (seqtype = 0; seqtype < ARRAY_LENGTH(field->state->seq); seqtype++)
if (input_seq_cmp(&field->state->seq[seqtype], &field->seq[seqtype]) != 0)
save_sequence(machine, portnode, seqtype, field->type, &field->state->seq[seqtype]);
if (field->state->analog == NULL)
{
if ((field->state->value & field->mask) != (field->defvalue & field->mask))
xml_set_attribute_int(portnode, "value", field->state->value & field->mask);
}
else
{
if (field->state->analog->delta != field->delta)
xml_set_attribute_int(portnode, "keydelta", field->state->analog->delta);
if (field->state->analog->centerdelta != field->centerdelta)
xml_set_attribute_int(portnode, "centerdelta", field->state->analog->centerdelta);
if (field->state->analog->sensitivity != field->sensitivity)
xml_set_attribute_int(portnode, "sensitivity", field->state->analog->sensitivity);
if (field->state->analog->reverse != ((field->flags & ANALOG_FLAG_REVERSE) != 0))
xml_set_attribute(portnode, "reverse", field->state->analog->reverse ? "yes" : "no");
}
}
}
}
} | [
"static",
"void",
"save_game_inputs",
"(",
"running_machine",
"*",
"machine",
",",
"xml_data_node",
"*",
"parentnode",
")",
"{",
"const",
"input_field_config",
"*",
"field",
";",
"const",
"input_port_config",
"*",
"port",
";",
"for",
"(",
"port",
"=",
"machine",
"->",
"m_portlist",
".",
"first",
"(",
")",
";",
"port",
"!=",
"NULL",
";",
"port",
"=",
"port",
"->",
"next",
"(",
")",
")",
"for",
"(",
"field",
"=",
"port",
"->",
"fieldlist",
";",
"field",
"!=",
"NULL",
";",
"field",
"=",
"field",
"->",
"next",
")",
"if",
"(",
"save_this_input_field_type",
"(",
"field",
"->",
"type",
")",
")",
"{",
"int",
"changed",
"=",
"FALSE",
";",
"int",
"seqtype",
";",
"for",
"(",
"seqtype",
"=",
"0",
";",
"seqtype",
"<",
"ARRAY_LENGTH",
"(",
"field",
"->",
"state",
"->",
"seq",
")",
";",
"seqtype",
"++",
")",
"changed",
"|=",
"(",
"input_seq_cmp",
"(",
"&",
"field",
"->",
"state",
"->",
"seq",
"[",
"seqtype",
"]",
",",
"&",
"field",
"->",
"seq",
"[",
"seqtype",
"]",
")",
"!=",
"0",
")",
";",
"if",
"(",
"field",
"->",
"state",
"->",
"analog",
"==",
"NULL",
")",
"changed",
"|=",
"(",
"(",
"field",
"->",
"state",
"->",
"value",
"&",
"field",
"->",
"mask",
")",
"!=",
"(",
"field",
"->",
"defvalue",
"&",
"field",
"->",
"mask",
")",
")",
";",
"else",
"{",
"changed",
"|=",
"(",
"field",
"->",
"state",
"->",
"analog",
"->",
"delta",
"!=",
"field",
"->",
"delta",
")",
";",
"changed",
"|=",
"(",
"field",
"->",
"state",
"->",
"analog",
"->",
"centerdelta",
"!=",
"field",
"->",
"centerdelta",
")",
";",
"changed",
"|=",
"(",
"field",
"->",
"state",
"->",
"analog",
"->",
"sensitivity",
"!=",
"field",
"->",
"sensitivity",
")",
";",
"changed",
"|=",
"(",
"field",
"->",
"state",
"->",
"analog",
"->",
"reverse",
"!=",
"(",
"(",
"field",
"->",
"flags",
"&",
"ANALOG_FLAG_REVERSE",
")",
"!=",
"0",
")",
")",
";",
"}",
"if",
"(",
"changed",
")",
"{",
"xml_data_node",
"*",
"portnode",
"=",
"xml_add_child",
"(",
"parentnode",
",",
"\"",
"\"",
",",
"NULL",
")",
";",
"if",
"(",
"portnode",
"!=",
"NULL",
")",
"{",
"char",
"tempbuffer",
"[",
"20",
"]",
";",
"xml_set_attribute",
"(",
"portnode",
",",
"\"",
"\"",
",",
"get_port_tag",
"(",
"port",
",",
"tempbuffer",
")",
")",
";",
"xml_set_attribute",
"(",
"portnode",
",",
"\"",
"\"",
",",
"input_field_type_to_token",
"(",
"machine",
",",
"field",
"->",
"type",
",",
"field",
"->",
"player",
")",
")",
";",
"xml_set_attribute_int",
"(",
"portnode",
",",
"\"",
"\"",
",",
"field",
"->",
"mask",
")",
";",
"xml_set_attribute_int",
"(",
"portnode",
",",
"\"",
"\"",
",",
"field",
"->",
"defvalue",
"&",
"field",
"->",
"mask",
")",
";",
"for",
"(",
"seqtype",
"=",
"0",
";",
"seqtype",
"<",
"ARRAY_LENGTH",
"(",
"field",
"->",
"state",
"->",
"seq",
")",
";",
"seqtype",
"++",
")",
"if",
"(",
"input_seq_cmp",
"(",
"&",
"field",
"->",
"state",
"->",
"seq",
"[",
"seqtype",
"]",
",",
"&",
"field",
"->",
"seq",
"[",
"seqtype",
"]",
")",
"!=",
"0",
")",
"save_sequence",
"(",
"machine",
",",
"portnode",
",",
"seqtype",
",",
"field",
"->",
"type",
",",
"&",
"field",
"->",
"state",
"->",
"seq",
"[",
"seqtype",
"]",
")",
";",
"if",
"(",
"field",
"->",
"state",
"->",
"analog",
"==",
"NULL",
")",
"{",
"if",
"(",
"(",
"field",
"->",
"state",
"->",
"value",
"&",
"field",
"->",
"mask",
")",
"!=",
"(",
"field",
"->",
"defvalue",
"&",
"field",
"->",
"mask",
")",
")",
"xml_set_attribute_int",
"(",
"portnode",
",",
"\"",
"\"",
",",
"field",
"->",
"state",
"->",
"value",
"&",
"field",
"->",
"mask",
")",
";",
"}",
"else",
"{",
"if",
"(",
"field",
"->",
"state",
"->",
"analog",
"->",
"delta",
"!=",
"field",
"->",
"delta",
")",
"xml_set_attribute_int",
"(",
"portnode",
",",
"\"",
"\"",
",",
"field",
"->",
"state",
"->",
"analog",
"->",
"delta",
")",
";",
"if",
"(",
"field",
"->",
"state",
"->",
"analog",
"->",
"centerdelta",
"!=",
"field",
"->",
"centerdelta",
")",
"xml_set_attribute_int",
"(",
"portnode",
",",
"\"",
"\"",
",",
"field",
"->",
"state",
"->",
"analog",
"->",
"centerdelta",
")",
";",
"if",
"(",
"field",
"->",
"state",
"->",
"analog",
"->",
"sensitivity",
"!=",
"field",
"->",
"sensitivity",
")",
"xml_set_attribute_int",
"(",
"portnode",
",",
"\"",
"\"",
",",
"field",
"->",
"state",
"->",
"analog",
"->",
"sensitivity",
")",
";",
"if",
"(",
"field",
"->",
"state",
"->",
"analog",
"->",
"reverse",
"!=",
"(",
"(",
"field",
"->",
"flags",
"&",
"ANALOG_FLAG_REVERSE",
")",
"!=",
"0",
")",
")",
"xml_set_attribute",
"(",
"portnode",
",",
"\"",
"\"",
",",
"field",
"->",
"state",
"->",
"analog",
"->",
"reverse",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | save_game_inputs - add nodes for any game
mappings that have changed | [
"save_game_inputs",
"-",
"add",
"nodes",
"for",
"any",
"game",
"mappings",
"that",
"have",
"changed"
] | [
"/* iterate over ports */",
"/* determine if we changed */",
"/* non-analog changes */",
"/* analog changes */",
"/* if we did change, add a new node */",
"/* add a new port node */",
"/* add the identifying information and attributes */",
"/* add sequences if changed */",
"/* write out non-analog changes */",
"/* write out analog changes */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "parentnode",
"type": "xml_data_node"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parentnode",
"type": "xml_data_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | playback_read_uint8 | UINT8 | static UINT8 playback_read_uint8(running_machine *machine)
{
input_port_private *portdata = machine->input_port_data;
UINT8 result;
/* protect against NULL handles if previous reads fail */
if (portdata->playback_file == NULL)
return 0;
/* read the value; if we fail, end playback */
if (mame_fread(portdata->playback_file, &result, sizeof(result)) != sizeof(result))
{
playback_end(machine, "End of file");
return 0;
}
/* return the appropriate value */
return result;
} | /*-------------------------------------------------
playback_read_uint8 - read an 8-bit value
from the playback file
-------------------------------------------------*/ | read an 8-bit value
from the playback file | [
"read",
"an",
"8",
"-",
"bit",
"value",
"from",
"the",
"playback",
"file"
] | static UINT8 playback_read_uint8(running_machine *machine)
{
input_port_private *portdata = machine->input_port_data;
UINT8 result;
if (portdata->playback_file == NULL)
return 0;
if (mame_fread(portdata->playback_file, &result, sizeof(result)) != sizeof(result))
{
playback_end(machine, "End of file");
return 0;
}
return result;
} | [
"static",
"UINT8",
"playback_read_uint8",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"UINT8",
"result",
";",
"if",
"(",
"portdata",
"->",
"playback_file",
"==",
"NULL",
")",
"return",
"0",
";",
"if",
"(",
"mame_fread",
"(",
"portdata",
"->",
"playback_file",
",",
"&",
"result",
",",
"sizeof",
"(",
"result",
")",
")",
"!=",
"sizeof",
"(",
"result",
")",
")",
"{",
"playback_end",
"(",
"machine",
",",
"\"",
"\"",
")",
";",
"return",
"0",
";",
"}",
"return",
"result",
";",
"}"
] | playback_read_uint8 - read an 8-bit value
from the playback file | [
"playback_read_uint8",
"-",
"read",
"an",
"8",
"-",
"bit",
"value",
"from",
"the",
"playback",
"file"
] | [
"/* protect against NULL handles if previous reads fail */",
"/* read the value; if we fail, end playback */",
"/* return the appropriate value */"
] | [
{
"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": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | playback_read_uint32 | UINT32 | static UINT32 playback_read_uint32(running_machine *machine)
{
input_port_private *portdata = machine->input_port_data;
UINT32 result;
/* protect against NULL handles if previous reads fail */
if (portdata->playback_file == NULL)
return 0;
/* read the value; if we fail, end playback */
if (mame_fread(portdata->playback_file, &result, sizeof(result)) != sizeof(result))
{
playback_end(machine, "End of file");
return 0;
}
/* return the appropriate value */
return LITTLE_ENDIANIZE_INT32(result);
} | /*-------------------------------------------------
playback_read_uint32 - read a 32-bit value
from the playback file
-------------------------------------------------*/ | read a 32-bit value
from the playback file | [
"read",
"a",
"32",
"-",
"bit",
"value",
"from",
"the",
"playback",
"file"
] | static UINT32 playback_read_uint32(running_machine *machine)
{
input_port_private *portdata = machine->input_port_data;
UINT32 result;
if (portdata->playback_file == NULL)
return 0;
if (mame_fread(portdata->playback_file, &result, sizeof(result)) != sizeof(result))
{
playback_end(machine, "End of file");
return 0;
}
return LITTLE_ENDIANIZE_INT32(result);
} | [
"static",
"UINT32",
"playback_read_uint32",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"UINT32",
"result",
";",
"if",
"(",
"portdata",
"->",
"playback_file",
"==",
"NULL",
")",
"return",
"0",
";",
"if",
"(",
"mame_fread",
"(",
"portdata",
"->",
"playback_file",
",",
"&",
"result",
",",
"sizeof",
"(",
"result",
")",
")",
"!=",
"sizeof",
"(",
"result",
")",
")",
"{",
"playback_end",
"(",
"machine",
",",
"\"",
"\"",
")",
";",
"return",
"0",
";",
"}",
"return",
"LITTLE_ENDIANIZE_INT32",
"(",
"result",
")",
";",
"}"
] | playback_read_uint32 - read a 32-bit value
from the playback file | [
"playback_read_uint32",
"-",
"read",
"a",
"32",
"-",
"bit",
"value",
"from",
"the",
"playback",
"file"
] | [
"/* protect against NULL handles if previous reads fail */",
"/* read the value; if we fail, end playback */",
"/* return the appropriate value */"
] | [
{
"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": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | playback_read_uint64 | UINT64 | static UINT64 playback_read_uint64(running_machine *machine)
{
input_port_private *portdata = machine->input_port_data;
UINT64 result;
/* protect against NULL handles if previous reads fail */
if (portdata->playback_file == NULL)
return 0;
/* read the value; if we fail, end playback */
if (mame_fread(portdata->playback_file, &result, sizeof(result)) != sizeof(result))
{
playback_end(machine, "End of file");
return 0;
}
/* return the appropriate value */
return LITTLE_ENDIANIZE_INT64(result);
} | /*-------------------------------------------------
playback_read_uint64 - read a 64-bit value
from the playback file
-------------------------------------------------*/ | read a 64-bit value
from the playback file | [
"read",
"a",
"64",
"-",
"bit",
"value",
"from",
"the",
"playback",
"file"
] | static UINT64 playback_read_uint64(running_machine *machine)
{
input_port_private *portdata = machine->input_port_data;
UINT64 result;
if (portdata->playback_file == NULL)
return 0;
if (mame_fread(portdata->playback_file, &result, sizeof(result)) != sizeof(result))
{
playback_end(machine, "End of file");
return 0;
}
return LITTLE_ENDIANIZE_INT64(result);
} | [
"static",
"UINT64",
"playback_read_uint64",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"UINT64",
"result",
";",
"if",
"(",
"portdata",
"->",
"playback_file",
"==",
"NULL",
")",
"return",
"0",
";",
"if",
"(",
"mame_fread",
"(",
"portdata",
"->",
"playback_file",
",",
"&",
"result",
",",
"sizeof",
"(",
"result",
")",
")",
"!=",
"sizeof",
"(",
"result",
")",
")",
"{",
"playback_end",
"(",
"machine",
",",
"\"",
"\"",
")",
";",
"return",
"0",
";",
"}",
"return",
"LITTLE_ENDIANIZE_INT64",
"(",
"result",
")",
";",
"}"
] | playback_read_uint64 - read a 64-bit value
from the playback file | [
"playback_read_uint64",
"-",
"read",
"a",
"64",
"-",
"bit",
"value",
"from",
"the",
"playback",
"file"
] | [
"/* protect against NULL handles if previous reads fail */",
"/* read the value; if we fail, end playback */",
"/* return the appropriate value */"
] | [
{
"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": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | playback_frame | void | static void playback_frame(running_machine *machine, attotime curtime)
{
input_port_private *portdata = machine->input_port_data;
/* if playing back, fetch the information and verify */
if (portdata->playback_file != NULL)
{
attotime readtime;
/* first the absolute time */
readtime.seconds = playback_read_uint32(machine);
readtime.attoseconds = playback_read_uint64(machine);
if (attotime_compare(readtime, curtime) != 0)
playback_end(machine, "Out of sync");
/* then the speed */
portdata->playback_accumulated_speed += playback_read_uint32(machine);
portdata->playback_accumulated_frames++;
}
} | /*-------------------------------------------------
playback_frame - start of frame callback for
playback
-------------------------------------------------*/ | start of frame callback for
playback | [
"start",
"of",
"frame",
"callback",
"for",
"playback"
] | static void playback_frame(running_machine *machine, attotime curtime)
{
input_port_private *portdata = machine->input_port_data;
if (portdata->playback_file != NULL)
{
attotime readtime;
readtime.seconds = playback_read_uint32(machine);
readtime.attoseconds = playback_read_uint64(machine);
if (attotime_compare(readtime, curtime) != 0)
playback_end(machine, "Out of sync");
portdata->playback_accumulated_speed += playback_read_uint32(machine);
portdata->playback_accumulated_frames++;
}
} | [
"static",
"void",
"playback_frame",
"(",
"running_machine",
"*",
"machine",
",",
"attotime",
"curtime",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"if",
"(",
"portdata",
"->",
"playback_file",
"!=",
"NULL",
")",
"{",
"attotime",
"readtime",
";",
"readtime",
".",
"seconds",
"=",
"playback_read_uint32",
"(",
"machine",
")",
";",
"readtime",
".",
"attoseconds",
"=",
"playback_read_uint64",
"(",
"machine",
")",
";",
"if",
"(",
"attotime_compare",
"(",
"readtime",
",",
"curtime",
")",
"!=",
"0",
")",
"playback_end",
"(",
"machine",
",",
"\"",
"\"",
")",
";",
"portdata",
"->",
"playback_accumulated_speed",
"+=",
"playback_read_uint32",
"(",
"machine",
")",
";",
"portdata",
"->",
"playback_accumulated_frames",
"++",
";",
"}",
"}"
] | playback_frame - start of frame callback for
playback | [
"playback_frame",
"-",
"start",
"of",
"frame",
"callback",
"for",
"playback"
] | [
"/* if playing back, fetch the information and verify */",
"/* first the absolute time */",
"/* then the speed */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "curtime",
"type": "attotime"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "curtime",
"type": "attotime",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | playback_port | void | static void playback_port(const input_port_config *port)
{
input_port_private *portdata = port->machine->input_port_data;
/* if playing back, fetch information about this port */
if (portdata->playback_file != NULL)
{
analog_field_state *analog;
/* read the default value and the digital state */
port->state->defvalue = playback_read_uint32(port->machine);
port->state->digital = playback_read_uint32(port->machine);
/* loop over analog ports and save their data */
for (analog = port->state->analoglist; analog != NULL; analog = analog->next)
{
/* read current and previous values */
analog->accum = playback_read_uint32(port->machine);
analog->previous = playback_read_uint32(port->machine);
/* read configuration information */
analog->sensitivity = playback_read_uint32(port->machine);
analog->reverse = playback_read_uint8(port->machine);
}
}
} | /*-------------------------------------------------
playback_port - per-port callback for playback
-------------------------------------------------*/ | per-port callback for playback | [
"per",
"-",
"port",
"callback",
"for",
"playback"
] | static void playback_port(const input_port_config *port)
{
input_port_private *portdata = port->machine->input_port_data;
if (portdata->playback_file != NULL)
{
analog_field_state *analog;
port->state->defvalue = playback_read_uint32(port->machine);
port->state->digital = playback_read_uint32(port->machine);
for (analog = port->state->analoglist; analog != NULL; analog = analog->next)
{
analog->accum = playback_read_uint32(port->machine);
analog->previous = playback_read_uint32(port->machine);
analog->sensitivity = playback_read_uint32(port->machine);
analog->reverse = playback_read_uint8(port->machine);
}
}
} | [
"static",
"void",
"playback_port",
"(",
"const",
"input_port_config",
"*",
"port",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"port",
"->",
"machine",
"->",
"input_port_data",
";",
"if",
"(",
"portdata",
"->",
"playback_file",
"!=",
"NULL",
")",
"{",
"analog_field_state",
"*",
"analog",
";",
"port",
"->",
"state",
"->",
"defvalue",
"=",
"playback_read_uint32",
"(",
"port",
"->",
"machine",
")",
";",
"port",
"->",
"state",
"->",
"digital",
"=",
"playback_read_uint32",
"(",
"port",
"->",
"machine",
")",
";",
"for",
"(",
"analog",
"=",
"port",
"->",
"state",
"->",
"analoglist",
";",
"analog",
"!=",
"NULL",
";",
"analog",
"=",
"analog",
"->",
"next",
")",
"{",
"analog",
"->",
"accum",
"=",
"playback_read_uint32",
"(",
"port",
"->",
"machine",
")",
";",
"analog",
"->",
"previous",
"=",
"playback_read_uint32",
"(",
"port",
"->",
"machine",
")",
";",
"analog",
"->",
"sensitivity",
"=",
"playback_read_uint32",
"(",
"port",
"->",
"machine",
")",
";",
"analog",
"->",
"reverse",
"=",
"playback_read_uint8",
"(",
"port",
"->",
"machine",
")",
";",
"}",
"}",
"}"
] | playback_port - per-port callback for playback | [
"playback_port",
"-",
"per",
"-",
"port",
"callback",
"for",
"playback"
] | [
"/* if playing back, fetch information about this port */",
"/* read the default value and the digital state */",
"/* loop over analog ports and save their data */",
"/* read current and previous values */",
"/* read configuration information */"
] | [
{
"param": "port",
"type": "input_port_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "port",
"type": "input_port_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | record_write_uint8 | void | static void record_write_uint8(running_machine *machine, UINT8 data)
{
input_port_private *portdata = machine->input_port_data;
UINT8 result = data;
/* protect against NULL handles if previous reads fail */
if (portdata->record_file == NULL)
return;
/* read the value; if we fail, end playback */
if (mame_fwrite(portdata->record_file, &result, sizeof(result)) != sizeof(result))
record_end(machine, "Out of space");
} | /*-------------------------------------------------
record_write_uint8 - write an 8-bit value
to the record file
-------------------------------------------------*/ | write an 8-bit value
to the record file | [
"write",
"an",
"8",
"-",
"bit",
"value",
"to",
"the",
"record",
"file"
] | static void record_write_uint8(running_machine *machine, UINT8 data)
{
input_port_private *portdata = machine->input_port_data;
UINT8 result = data;
if (portdata->record_file == NULL)
return;
if (mame_fwrite(portdata->record_file, &result, sizeof(result)) != sizeof(result))
record_end(machine, "Out of space");
} | [
"static",
"void",
"record_write_uint8",
"(",
"running_machine",
"*",
"machine",
",",
"UINT8",
"data",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"UINT8",
"result",
"=",
"data",
";",
"if",
"(",
"portdata",
"->",
"record_file",
"==",
"NULL",
")",
"return",
";",
"if",
"(",
"mame_fwrite",
"(",
"portdata",
"->",
"record_file",
",",
"&",
"result",
",",
"sizeof",
"(",
"result",
")",
")",
"!=",
"sizeof",
"(",
"result",
")",
")",
"record_end",
"(",
"machine",
",",
"\"",
"\"",
")",
";",
"}"
] | record_write_uint8 - write an 8-bit value
to the record file | [
"record_write_uint8",
"-",
"write",
"an",
"8",
"-",
"bit",
"value",
"to",
"the",
"record",
"file"
] | [
"/* protect against NULL handles if previous reads fail */",
"/* read the value; if we fail, end playback */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "data",
"type": "UINT8"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | record_write_uint32 | void | static void record_write_uint32(running_machine *machine, UINT32 data)
{
input_port_private *portdata = machine->input_port_data;
UINT32 result = LITTLE_ENDIANIZE_INT32(data);
/* protect against NULL handles if previous reads fail */
if (portdata->record_file == NULL)
return;
/* read the value; if we fail, end playback */
if (mame_fwrite(portdata->record_file, &result, sizeof(result)) != sizeof(result))
record_end(machine, "Out of space");
} | /*-------------------------------------------------
record_write_uint32 - write a 32-bit value
to the record file
-------------------------------------------------*/ | write a 32-bit value
to the record file | [
"write",
"a",
"32",
"-",
"bit",
"value",
"to",
"the",
"record",
"file"
] | static void record_write_uint32(running_machine *machine, UINT32 data)
{
input_port_private *portdata = machine->input_port_data;
UINT32 result = LITTLE_ENDIANIZE_INT32(data);
if (portdata->record_file == NULL)
return;
if (mame_fwrite(portdata->record_file, &result, sizeof(result)) != sizeof(result))
record_end(machine, "Out of space");
} | [
"static",
"void",
"record_write_uint32",
"(",
"running_machine",
"*",
"machine",
",",
"UINT32",
"data",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"UINT32",
"result",
"=",
"LITTLE_ENDIANIZE_INT32",
"(",
"data",
")",
";",
"if",
"(",
"portdata",
"->",
"record_file",
"==",
"NULL",
")",
"return",
";",
"if",
"(",
"mame_fwrite",
"(",
"portdata",
"->",
"record_file",
",",
"&",
"result",
",",
"sizeof",
"(",
"result",
")",
")",
"!=",
"sizeof",
"(",
"result",
")",
")",
"record_end",
"(",
"machine",
",",
"\"",
"\"",
")",
";",
"}"
] | record_write_uint32 - write a 32-bit value
to the record file | [
"record_write_uint32",
"-",
"write",
"a",
"32",
"-",
"bit",
"value",
"to",
"the",
"record",
"file"
] | [
"/* protect against NULL handles if previous reads fail */",
"/* read the value; if we fail, end playback */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "data",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | record_write_uint64 | void | static void record_write_uint64(running_machine *machine, UINT64 data)
{
input_port_private *portdata = machine->input_port_data;
UINT64 result = LITTLE_ENDIANIZE_INT64(data);
/* protect against NULL handles if previous reads fail */
if (portdata->record_file == NULL)
return;
/* read the value; if we fail, end playback */
if (mame_fwrite(portdata->record_file, &result, sizeof(result)) != sizeof(result))
record_end(machine, "Out of space");
} | /*-------------------------------------------------
record_write_uint64 - write a 64-bit value
to the record file
-------------------------------------------------*/ | write a 64-bit value
to the record file | [
"write",
"a",
"64",
"-",
"bit",
"value",
"to",
"the",
"record",
"file"
] | static void record_write_uint64(running_machine *machine, UINT64 data)
{
input_port_private *portdata = machine->input_port_data;
UINT64 result = LITTLE_ENDIANIZE_INT64(data);
if (portdata->record_file == NULL)
return;
if (mame_fwrite(portdata->record_file, &result, sizeof(result)) != sizeof(result))
record_end(machine, "Out of space");
} | [
"static",
"void",
"record_write_uint64",
"(",
"running_machine",
"*",
"machine",
",",
"UINT64",
"data",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"UINT64",
"result",
"=",
"LITTLE_ENDIANIZE_INT64",
"(",
"data",
")",
";",
"if",
"(",
"portdata",
"->",
"record_file",
"==",
"NULL",
")",
"return",
";",
"if",
"(",
"mame_fwrite",
"(",
"portdata",
"->",
"record_file",
",",
"&",
"result",
",",
"sizeof",
"(",
"result",
")",
")",
"!=",
"sizeof",
"(",
"result",
")",
")",
"record_end",
"(",
"machine",
",",
"\"",
"\"",
")",
";",
"}"
] | record_write_uint64 - write a 64-bit value
to the record file | [
"record_write_uint64",
"-",
"write",
"a",
"64",
"-",
"bit",
"value",
"to",
"the",
"record",
"file"
] | [
"/* protect against NULL handles if previous reads fail */",
"/* read the value; if we fail, end playback */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "data",
"type": "UINT64"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "UINT64",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | record_frame | void | static void record_frame(running_machine *machine, attotime curtime)
{
input_port_private *portdata = machine->input_port_data;
/* if recording, record information about the current frame */
if (portdata->record_file != NULL)
{
/* first the absolute time */
record_write_uint32(machine, curtime.seconds);
record_write_uint64(machine, curtime.attoseconds);
/* then the current speed */
record_write_uint32(machine, video_get_speed_percent(machine) * (double)(1 << 20));
}
} | /*-------------------------------------------------
record_frame - start of frame callback for
recording
-------------------------------------------------*/ | start of frame callback for
recording | [
"start",
"of",
"frame",
"callback",
"for",
"recording"
] | static void record_frame(running_machine *machine, attotime curtime)
{
input_port_private *portdata = machine->input_port_data;
if (portdata->record_file != NULL)
{
record_write_uint32(machine, curtime.seconds);
record_write_uint64(machine, curtime.attoseconds);
record_write_uint32(machine, video_get_speed_percent(machine) * (double)(1 << 20));
}
} | [
"static",
"void",
"record_frame",
"(",
"running_machine",
"*",
"machine",
",",
"attotime",
"curtime",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"machine",
"->",
"input_port_data",
";",
"if",
"(",
"portdata",
"->",
"record_file",
"!=",
"NULL",
")",
"{",
"record_write_uint32",
"(",
"machine",
",",
"curtime",
".",
"seconds",
")",
";",
"record_write_uint64",
"(",
"machine",
",",
"curtime",
".",
"attoseconds",
")",
";",
"record_write_uint32",
"(",
"machine",
",",
"video_get_speed_percent",
"(",
"machine",
")",
"*",
"(",
"double",
")",
"(",
"1",
"<<",
"20",
")",
")",
";",
"}",
"}"
] | record_frame - start of frame callback for
recording | [
"record_frame",
"-",
"start",
"of",
"frame",
"callback",
"for",
"recording"
] | [
"/* if recording, record information about the current frame */",
"/* first the absolute time */",
"/* then the current speed */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "curtime",
"type": "attotime"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "curtime",
"type": "attotime",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | record_port | void | static void record_port(const input_port_config *port)
{
input_port_private *portdata = port->machine->input_port_data;
/* if recording, store information about this port */
if (portdata->record_file != NULL)
{
analog_field_state *analog;
/* store the default value and digital state */
record_write_uint32(port->machine, port->state->defvalue);
record_write_uint32(port->machine, port->state->digital);
/* loop over analog ports and save their data */
for (analog = port->state->analoglist; analog != NULL; analog = analog->next)
{
/* store current and previous values */
record_write_uint32(port->machine, analog->accum);
record_write_uint32(port->machine, analog->previous);
/* store configuration information */
record_write_uint32(port->machine, analog->sensitivity);
record_write_uint8(port->machine, analog->reverse);
}
}
} | /*-------------------------------------------------
record_port - per-port callback for record
-------------------------------------------------*/ | per-port callback for record | [
"per",
"-",
"port",
"callback",
"for",
"record"
] | static void record_port(const input_port_config *port)
{
input_port_private *portdata = port->machine->input_port_data;
if (portdata->record_file != NULL)
{
analog_field_state *analog;
record_write_uint32(port->machine, port->state->defvalue);
record_write_uint32(port->machine, port->state->digital);
for (analog = port->state->analoglist; analog != NULL; analog = analog->next)
{
record_write_uint32(port->machine, analog->accum);
record_write_uint32(port->machine, analog->previous);
record_write_uint32(port->machine, analog->sensitivity);
record_write_uint8(port->machine, analog->reverse);
}
}
} | [
"static",
"void",
"record_port",
"(",
"const",
"input_port_config",
"*",
"port",
")",
"{",
"input_port_private",
"*",
"portdata",
"=",
"port",
"->",
"machine",
"->",
"input_port_data",
";",
"if",
"(",
"portdata",
"->",
"record_file",
"!=",
"NULL",
")",
"{",
"analog_field_state",
"*",
"analog",
";",
"record_write_uint32",
"(",
"port",
"->",
"machine",
",",
"port",
"->",
"state",
"->",
"defvalue",
")",
";",
"record_write_uint32",
"(",
"port",
"->",
"machine",
",",
"port",
"->",
"state",
"->",
"digital",
")",
";",
"for",
"(",
"analog",
"=",
"port",
"->",
"state",
"->",
"analoglist",
";",
"analog",
"!=",
"NULL",
";",
"analog",
"=",
"analog",
"->",
"next",
")",
"{",
"record_write_uint32",
"(",
"port",
"->",
"machine",
",",
"analog",
"->",
"accum",
")",
";",
"record_write_uint32",
"(",
"port",
"->",
"machine",
",",
"analog",
"->",
"previous",
")",
";",
"record_write_uint32",
"(",
"port",
"->",
"machine",
",",
"analog",
"->",
"sensitivity",
")",
";",
"record_write_uint8",
"(",
"port",
"->",
"machine",
",",
"analog",
"->",
"reverse",
")",
";",
"}",
"}",
"}"
] | record_port - per-port callback for record | [
"record_port",
"-",
"per",
"-",
"port",
"callback",
"for",
"record"
] | [
"/* if recording, store information about this port */",
"/* store the default value and digital state */",
"/* loop over analog ports and save their data */",
"/* store current and previous values */",
"/* store configuration information */"
] | [
{
"param": "port",
"type": "input_port_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "port",
"type": "input_port_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | code_point_string | char | static const char *code_point_string(running_machine *machine, unicode_char ch)
{
static char buf[16];
const char *result = buf;
switch(ch)
{
/* check some magic values */
case '\0': strcpy(buf, "\\0"); break;
case '\r': strcpy(buf, "\\r"); break;
case '\n': strcpy(buf, "\\n"); break;
case '\t': strcpy(buf, "\\t"); break;
default:
if ((ch >= 32) && (ch < 128))
{
/* seven bit ASCII is easy */
buf[0] = (char) ch;
buf[1] = '\0';
}
else if (ch >= UCHAR_MAMEKEY_BEGIN)
{
/* try to obtain a codename with input_code_name(); this can result in an empty string */
astring astr;
input_code_name(machine, astr, (input_code) ch - UCHAR_MAMEKEY_BEGIN);
snprintf(buf, ARRAY_LENGTH(buf), "%s", astr.cstr());
}
else
{
/* empty string; resolve later */
buf[0] = '\0';
}
/* did we fail to resolve? if so, we have a last resort */
if (buf[0] == '\0')
snprintf(buf, ARRAY_LENGTH(buf), "U+%04X", (unsigned) ch);
break;
}
return result;
} | /*-------------------------------------------------
code_point_string - obtain a string representation of a
given code; used for logging and debugging
-------------------------------------------------*/ | obtain a string representation of a
given code; used for logging and debugging | [
"obtain",
"a",
"string",
"representation",
"of",
"a",
"given",
"code",
";",
"used",
"for",
"logging",
"and",
"debugging"
] | static const char *code_point_string(running_machine *machine, unicode_char ch)
{
static char buf[16];
const char *result = buf;
switch(ch)
{
case '\0': strcpy(buf, "\\0"); break;
case '\r': strcpy(buf, "\\r"); break;
case '\n': strcpy(buf, "\\n"); break;
case '\t': strcpy(buf, "\\t"); break;
default:
if ((ch >= 32) && (ch < 128))
{
buf[0] = (char) ch;
buf[1] = '\0';
}
else if (ch >= UCHAR_MAMEKEY_BEGIN)
{
astring astr;
input_code_name(machine, astr, (input_code) ch - UCHAR_MAMEKEY_BEGIN);
snprintf(buf, ARRAY_LENGTH(buf), "%s", astr.cstr());
}
else
{
buf[0] = '\0';
}
if (buf[0] == '\0')
snprintf(buf, ARRAY_LENGTH(buf), "U+%04X", (unsigned) ch);
break;
}
return result;
} | [
"static",
"const",
"char",
"*",
"code_point_string",
"(",
"running_machine",
"*",
"machine",
",",
"unicode_char",
"ch",
")",
"{",
"static",
"char",
"buf",
"[",
"16",
"]",
";",
"const",
"char",
"*",
"result",
"=",
"buf",
";",
"switch",
"(",
"ch",
")",
"{",
"case",
"'",
"\\0",
"'",
":",
"strcpy",
"(",
"buf",
",",
"\"",
"\\\\",
"\"",
")",
";",
"break",
";",
"case",
"'",
"\\r",
"'",
":",
"strcpy",
"(",
"buf",
",",
"\"",
"\\\\",
"\"",
")",
";",
"break",
";",
"case",
"'",
"\\n",
"'",
":",
"strcpy",
"(",
"buf",
",",
"\"",
"\\\\",
"\"",
")",
";",
"break",
";",
"case",
"'",
"\\t",
"'",
":",
"strcpy",
"(",
"buf",
",",
"\"",
"\\\\",
"\"",
")",
";",
"break",
";",
"default",
":",
"if",
"(",
"(",
"ch",
">=",
"32",
")",
"&&",
"(",
"ch",
"<",
"128",
")",
")",
"{",
"buf",
"[",
"0",
"]",
"=",
"(",
"char",
")",
"ch",
";",
"buf",
"[",
"1",
"]",
"=",
"'",
"\\0",
"'",
";",
"}",
"else",
"if",
"(",
"ch",
">=",
"UCHAR_MAMEKEY_BEGIN",
")",
"{",
"astring",
"astr",
";",
"input_code_name",
"(",
"machine",
",",
"astr",
",",
"(",
"input_code",
")",
"ch",
"-",
"UCHAR_MAMEKEY_BEGIN",
")",
";",
"snprintf",
"(",
"buf",
",",
"ARRAY_LENGTH",
"(",
"buf",
")",
",",
"\"",
"\"",
",",
"astr",
".",
"cstr",
"(",
")",
")",
";",
"}",
"else",
"{",
"buf",
"[",
"0",
"]",
"=",
"'",
"\\0",
"'",
";",
"}",
"if",
"(",
"buf",
"[",
"0",
"]",
"==",
"'",
"\\0",
"'",
")",
"snprintf",
"(",
"buf",
",",
"ARRAY_LENGTH",
"(",
"buf",
")",
",",
"\"",
"\"",
",",
"(",
"unsigned",
")",
"ch",
")",
";",
"break",
";",
"}",
"return",
"result",
";",
"}"
] | code_point_string - obtain a string representation of a
given code; used for logging and debugging | [
"code_point_string",
"-",
"obtain",
"a",
"string",
"representation",
"of",
"a",
"given",
"code",
";",
"used",
"for",
"logging",
"and",
"debugging"
] | [
"/* check some magic values */",
"/* seven bit ASCII is easy */",
"/* try to obtain a codename with input_code_name(); this can result in an empty string */",
"/* empty string; resolve later */",
"/* did we fail to resolve? if so, we have a last resort */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "ch",
"type": "unicode_char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ch",
"type": "unicode_char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | scan_keys | int | static int scan_keys(running_machine *machine, const input_port_config *portconfig, inputx_code *codes, const input_port_config * *ports, const input_field_config * *shift_ports, int keys, int shift)
{
int code_count = 0;
const input_port_config *port;
const input_field_config *field;
unicode_char code;
assert(keys < NUM_SIMUL_KEYS);
for (port = portconfig; port != NULL; port = port->next())
{
for (field = port->fieldlist; field != NULL; field = field->next)
{
if (field->type == IPT_KEYBOARD)
{
code = get_keyboard_code(field, shift);
if (code != 0)
{
/* is this a shifter key? */
if ((code >= UCHAR_SHIFT_BEGIN) && (code <= UCHAR_SHIFT_END))
{
shift_ports[keys] = field;
code_count += scan_keys(machine,
portconfig,
codes ? &codes[code_count] : NULL,
ports,
shift_ports,
keys+1,
code - UCHAR_SHIFT_1 + 1);
}
else
{
/* not a shifter key; record normally */
if (codes)
{
/* if we have a destination, record the codes used here */
memcpy((void *) codes[code_count].field, shift_ports, sizeof(shift_ports[0]) * keys);
codes[code_count].ch = code;
codes[code_count].field[keys] = field;
}
/* increment the count */
code_count++;
if (LOG_INPUTX)
logerror("inputx: code=%i (%s) port=%p field->name='%s'\n", (int) code, code_point_string(machine, code), port, field->name);
}
}
}
}
}
return code_count;
} | /*-------------------------------------------------
scan_keys - scans through input ports and
sets up natural keyboard input mapping
-------------------------------------------------*/ | scans through input ports and
sets up natural keyboard input mapping | [
"scans",
"through",
"input",
"ports",
"and",
"sets",
"up",
"natural",
"keyboard",
"input",
"mapping"
] | static int scan_keys(running_machine *machine, const input_port_config *portconfig, inputx_code *codes, const input_port_config * *ports, const input_field_config * *shift_ports, int keys, int shift)
{
int code_count = 0;
const input_port_config *port;
const input_field_config *field;
unicode_char code;
assert(keys < NUM_SIMUL_KEYS);
for (port = portconfig; port != NULL; port = port->next())
{
for (field = port->fieldlist; field != NULL; field = field->next)
{
if (field->type == IPT_KEYBOARD)
{
code = get_keyboard_code(field, shift);
if (code != 0)
{
if ((code >= UCHAR_SHIFT_BEGIN) && (code <= UCHAR_SHIFT_END))
{
shift_ports[keys] = field;
code_count += scan_keys(machine,
portconfig,
codes ? &codes[code_count] : NULL,
ports,
shift_ports,
keys+1,
code - UCHAR_SHIFT_1 + 1);
}
else
{
if (codes)
{
memcpy((void *) codes[code_count].field, shift_ports, sizeof(shift_ports[0]) * keys);
codes[code_count].ch = code;
codes[code_count].field[keys] = field;
}
code_count++;
if (LOG_INPUTX)
logerror("inputx: code=%i (%s) port=%p field->name='%s'\n", (int) code, code_point_string(machine, code), port, field->name);
}
}
}
}
}
return code_count;
} | [
"static",
"int",
"scan_keys",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"input_port_config",
"*",
"portconfig",
",",
"inputx_code",
"*",
"codes",
",",
"const",
"input_port_config",
"*",
"*",
"ports",
",",
"const",
"input_field_config",
"*",
"*",
"shift_ports",
",",
"int",
"keys",
",",
"int",
"shift",
")",
"{",
"int",
"code_count",
"=",
"0",
";",
"const",
"input_port_config",
"*",
"port",
";",
"const",
"input_field_config",
"*",
"field",
";",
"unicode_char",
"code",
";",
"assert",
"(",
"keys",
"<",
"NUM_SIMUL_KEYS",
")",
";",
"for",
"(",
"port",
"=",
"portconfig",
";",
"port",
"!=",
"NULL",
";",
"port",
"=",
"port",
"->",
"next",
"(",
")",
")",
"{",
"for",
"(",
"field",
"=",
"port",
"->",
"fieldlist",
";",
"field",
"!=",
"NULL",
";",
"field",
"=",
"field",
"->",
"next",
")",
"{",
"if",
"(",
"field",
"->",
"type",
"==",
"IPT_KEYBOARD",
")",
"{",
"code",
"=",
"get_keyboard_code",
"(",
"field",
",",
"shift",
")",
";",
"if",
"(",
"code",
"!=",
"0",
")",
"{",
"if",
"(",
"(",
"code",
">=",
"UCHAR_SHIFT_BEGIN",
")",
"&&",
"(",
"code",
"<=",
"UCHAR_SHIFT_END",
")",
")",
"{",
"shift_ports",
"[",
"keys",
"]",
"=",
"field",
";",
"code_count",
"+=",
"scan_keys",
"(",
"machine",
",",
"portconfig",
",",
"codes",
"?",
"&",
"codes",
"[",
"code_count",
"]",
":",
"NULL",
",",
"ports",
",",
"shift_ports",
",",
"keys",
"+",
"1",
",",
"code",
"-",
"UCHAR_SHIFT_1",
"+",
"1",
")",
";",
"}",
"else",
"{",
"if",
"(",
"codes",
")",
"{",
"memcpy",
"(",
"(",
"void",
"*",
")",
"codes",
"[",
"code_count",
"]",
".",
"field",
",",
"shift_ports",
",",
"sizeof",
"(",
"shift_ports",
"[",
"0",
"]",
")",
"*",
"keys",
")",
";",
"codes",
"[",
"code_count",
"]",
".",
"ch",
"=",
"code",
";",
"codes",
"[",
"code_count",
"]",
".",
"field",
"[",
"keys",
"]",
"=",
"field",
";",
"}",
"code_count",
"++",
";",
"if",
"(",
"LOG_INPUTX",
")",
"logerror",
"(",
"\"",
"\\n",
"\"",
",",
"(",
"int",
")",
"code",
",",
"code_point_string",
"(",
"machine",
",",
"code",
")",
",",
"port",
",",
"field",
"->",
"name",
")",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"code_count",
";",
"}"
] | scan_keys - scans through input ports and
sets up natural keyboard input mapping | [
"scan_keys",
"-",
"scans",
"through",
"input",
"ports",
"and",
"sets",
"up",
"natural",
"keyboard",
"input",
"mapping"
] | [
"/* is this a shifter key? */",
"/* not a shifter key; record normally */",
"/* if we have a destination, record the codes used here */",
"/* increment the count */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "portconfig",
"type": "input_port_config"
},
{
"param": "codes",
"type": "inputx_code"
},
{
"param": "ports",
"type": "input_port_config"
},
{
"param": "shift_ports",
"type": "input_field_config"
},
{
"param": "keys",
"type": "int"
},
{
"param": "shift",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "portconfig",
"type": "input_port_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "codes",
"type": "inputx_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ports",
"type": "input_port_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "shift_ports",
"type": "input_field_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "keys",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "shift",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | build_codes | inputx_code | static inputx_code *build_codes(running_machine *machine, const input_port_config *portconfig)
{
inputx_code *codes = NULL;
const input_port_config *ports[NUM_SIMUL_KEYS];
const input_field_config *fields[NUM_SIMUL_KEYS];
int code_count;
/* first count the number of codes */
code_count = scan_keys(machine, portconfig, NULL, ports, fields, 0, 0);
if (code_count > 0)
{
/* allocate the codes */
codes = auto_alloc_array_clear(machine, inputx_code, code_count + 1);
/* and populate them */
scan_keys(machine, portconfig, codes, ports, fields, 0, 0);
}
return codes;
} | /*-------------------------------------------------
build_codes - given an input port table, create
a input code table useful for mapping unicode
chars
-------------------------------------------------*/ | given an input port table, create
a input code table useful for mapping unicode
chars | [
"given",
"an",
"input",
"port",
"table",
"create",
"a",
"input",
"code",
"table",
"useful",
"for",
"mapping",
"unicode",
"chars"
] | static inputx_code *build_codes(running_machine *machine, const input_port_config *portconfig)
{
inputx_code *codes = NULL;
const input_port_config *ports[NUM_SIMUL_KEYS];
const input_field_config *fields[NUM_SIMUL_KEYS];
int code_count;
code_count = scan_keys(machine, portconfig, NULL, ports, fields, 0, 0);
if (code_count > 0)
{
codes = auto_alloc_array_clear(machine, inputx_code, code_count + 1);
scan_keys(machine, portconfig, codes, ports, fields, 0, 0);
}
return codes;
} | [
"static",
"inputx_code",
"*",
"build_codes",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"input_port_config",
"*",
"portconfig",
")",
"{",
"inputx_code",
"*",
"codes",
"=",
"NULL",
";",
"const",
"input_port_config",
"*",
"ports",
"[",
"NUM_SIMUL_KEYS",
"]",
";",
"const",
"input_field_config",
"*",
"fields",
"[",
"NUM_SIMUL_KEYS",
"]",
";",
"int",
"code_count",
";",
"code_count",
"=",
"scan_keys",
"(",
"machine",
",",
"portconfig",
",",
"NULL",
",",
"ports",
",",
"fields",
",",
"0",
",",
"0",
")",
";",
"if",
"(",
"code_count",
">",
"0",
")",
"{",
"codes",
"=",
"auto_alloc_array_clear",
"(",
"machine",
",",
"inputx_code",
",",
"code_count",
"+",
"1",
")",
";",
"scan_keys",
"(",
"machine",
",",
"portconfig",
",",
"codes",
",",
"ports",
",",
"fields",
",",
"0",
",",
"0",
")",
";",
"}",
"return",
"codes",
";",
"}"
] | build_codes - given an input port table, create
a input code table useful for mapping unicode
chars | [
"build_codes",
"-",
"given",
"an",
"input",
"port",
"table",
"create",
"a",
"input",
"code",
"table",
"useful",
"for",
"mapping",
"unicode",
"chars"
] | [
"/* first count the number of codes */",
"/* allocate the codes */",
"/* and populate them */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "portconfig",
"type": "input_port_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "portconfig",
"type": "input_port_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | validate_natural_keyboard_statics | int | int validate_natural_keyboard_statics(void)
{
int i;
int error = FALSE;
unicode_char last_char = 0;
const char_info *ci;
/* check to make sure that charinfo is in order */
for (i = 0; i < ARRAY_LENGTH(charinfo); i++)
{
if (last_char >= charinfo[i].ch)
{
mame_printf_error("inputx: charinfo is out of order; 0x%08x should be higher than 0x%08x\n", charinfo[i].ch, last_char);
error = TRUE;
}
last_char = charinfo[i].ch;
}
/* check to make sure that I can look up everything on alternate_charmap */
for (i = 0; i < ARRAY_LENGTH(charinfo); i++)
{
ci = find_charinfo(charinfo[i].ch);
if (ci != &charinfo[i])
{
mame_printf_error("inputx: expected find_charinfo(0x%08x) to work properly\n", charinfo[i].ch);
error = TRUE;
}
}
return error;
} | /*-------------------------------------------------
validate_natural_keyboard_statics -
validates natural keyboard static data
-------------------------------------------------*/ | validate_natural_keyboard_statics
validates natural keyboard static data | [
"validate_natural_keyboard_statics",
"validates",
"natural",
"keyboard",
"static",
"data"
] | int validate_natural_keyboard_statics(void)
{
int i;
int error = FALSE;
unicode_char last_char = 0;
const char_info *ci;
for (i = 0; i < ARRAY_LENGTH(charinfo); i++)
{
if (last_char >= charinfo[i].ch)
{
mame_printf_error("inputx: charinfo is out of order; 0x%08x should be higher than 0x%08x\n", charinfo[i].ch, last_char);
error = TRUE;
}
last_char = charinfo[i].ch;
}
for (i = 0; i < ARRAY_LENGTH(charinfo); i++)
{
ci = find_charinfo(charinfo[i].ch);
if (ci != &charinfo[i])
{
mame_printf_error("inputx: expected find_charinfo(0x%08x) to work properly\n", charinfo[i].ch);
error = TRUE;
}
}
return error;
} | [
"int",
"validate_natural_keyboard_statics",
"(",
"void",
")",
"{",
"int",
"i",
";",
"int",
"error",
"=",
"FALSE",
";",
"unicode_char",
"last_char",
"=",
"0",
";",
"const",
"char_info",
"*",
"ci",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"ARRAY_LENGTH",
"(",
"charinfo",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"last_char",
">=",
"charinfo",
"[",
"i",
"]",
".",
"ch",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"charinfo",
"[",
"i",
"]",
".",
"ch",
",",
"last_char",
")",
";",
"error",
"=",
"TRUE",
";",
"}",
"last_char",
"=",
"charinfo",
"[",
"i",
"]",
".",
"ch",
";",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"ARRAY_LENGTH",
"(",
"charinfo",
")",
";",
"i",
"++",
")",
"{",
"ci",
"=",
"find_charinfo",
"(",
"charinfo",
"[",
"i",
"]",
".",
"ch",
")",
";",
"if",
"(",
"ci",
"!=",
"&",
"charinfo",
"[",
"i",
"]",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"charinfo",
"[",
"i",
"]",
".",
"ch",
")",
";",
"error",
"=",
"TRUE",
";",
"}",
"}",
"return",
"error",
";",
"}"
] | validate_natural_keyboard_statics
validates natural keyboard static data | [
"validate_natural_keyboard_statics",
"validates",
"natural",
"keyboard",
"static",
"data"
] | [
"/* check to make sure that charinfo is in order */",
"/* check to make sure that I can look up everything on alternate_charmap */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_classify_port | int | int input_classify_port(const input_field_config *field)
{
int result;
if (field->category && (field->type != IPT_CATEGORY))
return INPUT_CLASS_CATEGORIZED;
switch(field->type)
{
case IPT_JOYSTICK_UP:
case IPT_JOYSTICK_DOWN:
case IPT_JOYSTICK_LEFT:
case IPT_JOYSTICK_RIGHT:
case IPT_JOYSTICKLEFT_UP:
case IPT_JOYSTICKLEFT_DOWN:
case IPT_JOYSTICKLEFT_LEFT:
case IPT_JOYSTICKLEFT_RIGHT:
case IPT_JOYSTICKRIGHT_UP:
case IPT_JOYSTICKRIGHT_DOWN:
case IPT_JOYSTICKRIGHT_LEFT:
case IPT_JOYSTICKRIGHT_RIGHT:
case IPT_BUTTON1:
case IPT_BUTTON2:
case IPT_BUTTON3:
case IPT_BUTTON4:
case IPT_BUTTON5:
case IPT_BUTTON6:
case IPT_BUTTON7:
case IPT_BUTTON8:
case IPT_BUTTON9:
case IPT_BUTTON10:
case IPT_AD_STICK_X:
case IPT_AD_STICK_Y:
case IPT_AD_STICK_Z:
case IPT_TRACKBALL_X:
case IPT_TRACKBALL_Y:
case IPT_LIGHTGUN_X:
case IPT_LIGHTGUN_Y:
case IPT_MOUSE_X:
case IPT_MOUSE_Y:
case IPT_START:
case IPT_SELECT:
result = INPUT_CLASS_CONTROLLER;
break;
case IPT_KEYPAD:
case IPT_KEYBOARD:
result = INPUT_CLASS_KEYBOARD;
break;
case IPT_CONFIG:
result = INPUT_CLASS_CONFIG;
break;
case IPT_DIPSWITCH:
result = INPUT_CLASS_DIPSWITCH;
break;
case 0:
if (field->name && (field->name != (const char *) -1))
result = INPUT_CLASS_MISC;
else
result = INPUT_CLASS_INTERNAL;
break;
default:
result = INPUT_CLASS_INTERNAL;
break;
}
return result;
} | /***************************************************************************
Other stuff
This stuff is here more out of convienience than anything else
***************************************************************************/ | Other stuff
This stuff is here more out of convienience than anything else | [
"Other",
"stuff",
"This",
"stuff",
"is",
"here",
"more",
"out",
"of",
"convienience",
"than",
"anything",
"else"
] | int input_classify_port(const input_field_config *field)
{
int result;
if (field->category && (field->type != IPT_CATEGORY))
return INPUT_CLASS_CATEGORIZED;
switch(field->type)
{
case IPT_JOYSTICK_UP:
case IPT_JOYSTICK_DOWN:
case IPT_JOYSTICK_LEFT:
case IPT_JOYSTICK_RIGHT:
case IPT_JOYSTICKLEFT_UP:
case IPT_JOYSTICKLEFT_DOWN:
case IPT_JOYSTICKLEFT_LEFT:
case IPT_JOYSTICKLEFT_RIGHT:
case IPT_JOYSTICKRIGHT_UP:
case IPT_JOYSTICKRIGHT_DOWN:
case IPT_JOYSTICKRIGHT_LEFT:
case IPT_JOYSTICKRIGHT_RIGHT:
case IPT_BUTTON1:
case IPT_BUTTON2:
case IPT_BUTTON3:
case IPT_BUTTON4:
case IPT_BUTTON5:
case IPT_BUTTON6:
case IPT_BUTTON7:
case IPT_BUTTON8:
case IPT_BUTTON9:
case IPT_BUTTON10:
case IPT_AD_STICK_X:
case IPT_AD_STICK_Y:
case IPT_AD_STICK_Z:
case IPT_TRACKBALL_X:
case IPT_TRACKBALL_Y:
case IPT_LIGHTGUN_X:
case IPT_LIGHTGUN_Y:
case IPT_MOUSE_X:
case IPT_MOUSE_Y:
case IPT_START:
case IPT_SELECT:
result = INPUT_CLASS_CONTROLLER;
break;
case IPT_KEYPAD:
case IPT_KEYBOARD:
result = INPUT_CLASS_KEYBOARD;
break;
case IPT_CONFIG:
result = INPUT_CLASS_CONFIG;
break;
case IPT_DIPSWITCH:
result = INPUT_CLASS_DIPSWITCH;
break;
case 0:
if (field->name && (field->name != (const char *) -1))
result = INPUT_CLASS_MISC;
else
result = INPUT_CLASS_INTERNAL;
break;
default:
result = INPUT_CLASS_INTERNAL;
break;
}
return result;
} | [
"int",
"input_classify_port",
"(",
"const",
"input_field_config",
"*",
"field",
")",
"{",
"int",
"result",
";",
"if",
"(",
"field",
"->",
"category",
"&&",
"(",
"field",
"->",
"type",
"!=",
"IPT_CATEGORY",
")",
")",
"return",
"INPUT_CLASS_CATEGORIZED",
";",
"switch",
"(",
"field",
"->",
"type",
")",
"{",
"case",
"IPT_JOYSTICK_UP",
":",
"case",
"IPT_JOYSTICK_DOWN",
":",
"case",
"IPT_JOYSTICK_LEFT",
":",
"case",
"IPT_JOYSTICK_RIGHT",
":",
"case",
"IPT_JOYSTICKLEFT_UP",
":",
"case",
"IPT_JOYSTICKLEFT_DOWN",
":",
"case",
"IPT_JOYSTICKLEFT_LEFT",
":",
"case",
"IPT_JOYSTICKLEFT_RIGHT",
":",
"case",
"IPT_JOYSTICKRIGHT_UP",
":",
"case",
"IPT_JOYSTICKRIGHT_DOWN",
":",
"case",
"IPT_JOYSTICKRIGHT_LEFT",
":",
"case",
"IPT_JOYSTICKRIGHT_RIGHT",
":",
"case",
"IPT_BUTTON1",
":",
"case",
"IPT_BUTTON2",
":",
"case",
"IPT_BUTTON3",
":",
"case",
"IPT_BUTTON4",
":",
"case",
"IPT_BUTTON5",
":",
"case",
"IPT_BUTTON6",
":",
"case",
"IPT_BUTTON7",
":",
"case",
"IPT_BUTTON8",
":",
"case",
"IPT_BUTTON9",
":",
"case",
"IPT_BUTTON10",
":",
"case",
"IPT_AD_STICK_X",
":",
"case",
"IPT_AD_STICK_Y",
":",
"case",
"IPT_AD_STICK_Z",
":",
"case",
"IPT_TRACKBALL_X",
":",
"case",
"IPT_TRACKBALL_Y",
":",
"case",
"IPT_LIGHTGUN_X",
":",
"case",
"IPT_LIGHTGUN_Y",
":",
"case",
"IPT_MOUSE_X",
":",
"case",
"IPT_MOUSE_Y",
":",
"case",
"IPT_START",
":",
"case",
"IPT_SELECT",
":",
"result",
"=",
"INPUT_CLASS_CONTROLLER",
";",
"break",
";",
"case",
"IPT_KEYPAD",
":",
"case",
"IPT_KEYBOARD",
":",
"result",
"=",
"INPUT_CLASS_KEYBOARD",
";",
"break",
";",
"case",
"IPT_CONFIG",
":",
"result",
"=",
"INPUT_CLASS_CONFIG",
";",
"break",
";",
"case",
"IPT_DIPSWITCH",
":",
"result",
"=",
"INPUT_CLASS_DIPSWITCH",
";",
"break",
";",
"case",
"0",
":",
"if",
"(",
"field",
"->",
"name",
"&&",
"(",
"field",
"->",
"name",
"!=",
"(",
"const",
"char",
"*",
")",
"-1",
")",
")",
"result",
"=",
"INPUT_CLASS_MISC",
";",
"else",
"result",
"=",
"INPUT_CLASS_INTERNAL",
";",
"break",
";",
"default",
":",
"result",
"=",
"INPUT_CLASS_INTERNAL",
";",
"break",
";",
"}",
"return",
"result",
";",
"}"
] | Other stuff
This stuff is here more out of convienience than anything else | [
"Other",
"stuff",
"This",
"stuff",
"is",
"here",
"more",
"out",
"of",
"convienience",
"than",
"anything",
"else"
] | [] | [
{
"param": "field",
"type": "input_field_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": "input_field_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_has_input_class | int | int input_has_input_class(running_machine *machine, int inputclass)
{
const input_port_config *port;
const input_field_config *field;
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
{
for (field = port->fieldlist; field != NULL; field = field->next)
{
if (input_classify_port(field) == inputclass)
return TRUE;
}
}
return FALSE;
} | /*-------------------------------------------------
input_has_input_class - checks to see if a
particular input class is present
-------------------------------------------------*/ | checks to see if a
particular input class is present | [
"checks",
"to",
"see",
"if",
"a",
"particular",
"input",
"class",
"is",
"present"
] | int input_has_input_class(running_machine *machine, int inputclass)
{
const input_port_config *port;
const input_field_config *field;
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
{
for (field = port->fieldlist; field != NULL; field = field->next)
{
if (input_classify_port(field) == inputclass)
return TRUE;
}
}
return FALSE;
} | [
"int",
"input_has_input_class",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"inputclass",
")",
"{",
"const",
"input_port_config",
"*",
"port",
";",
"const",
"input_field_config",
"*",
"field",
";",
"for",
"(",
"port",
"=",
"machine",
"->",
"m_portlist",
".",
"first",
"(",
")",
";",
"port",
"!=",
"NULL",
";",
"port",
"=",
"port",
"->",
"next",
"(",
")",
")",
"{",
"for",
"(",
"field",
"=",
"port",
"->",
"fieldlist",
";",
"field",
"!=",
"NULL",
";",
"field",
"=",
"field",
"->",
"next",
")",
"{",
"if",
"(",
"input_classify_port",
"(",
"field",
")",
"==",
"inputclass",
")",
"return",
"TRUE",
";",
"}",
"}",
"return",
"FALSE",
";",
"}"
] | input_has_input_class - checks to see if a
particular input class is present | [
"input_has_input_class",
"-",
"checks",
"to",
"see",
"if",
"a",
"particular",
"input",
"class",
"is",
"present"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "inputclass",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inputclass",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_count_players | int | int input_count_players(running_machine *machine)
{
const input_port_config *port;
const input_field_config *field;
int joystick_count;
joystick_count = 0;
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
{
for (field = port->fieldlist; field != NULL; field = field->next)
{
if (input_classify_port(field) == INPUT_CLASS_CONTROLLER)
{
if (joystick_count <= field->player + 1)
joystick_count = field->player + 1;
}
}
}
return joystick_count;
} | /*-------------------------------------------------
input_count_players - counts the number of
active players
-------------------------------------------------*/ | counts the number of
active players | [
"counts",
"the",
"number",
"of",
"active",
"players"
] | int input_count_players(running_machine *machine)
{
const input_port_config *port;
const input_field_config *field;
int joystick_count;
joystick_count = 0;
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
{
for (field = port->fieldlist; field != NULL; field = field->next)
{
if (input_classify_port(field) == INPUT_CLASS_CONTROLLER)
{
if (joystick_count <= field->player + 1)
joystick_count = field->player + 1;
}
}
}
return joystick_count;
} | [
"int",
"input_count_players",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"const",
"input_port_config",
"*",
"port",
";",
"const",
"input_field_config",
"*",
"field",
";",
"int",
"joystick_count",
";",
"joystick_count",
"=",
"0",
";",
"for",
"(",
"port",
"=",
"machine",
"->",
"m_portlist",
".",
"first",
"(",
")",
";",
"port",
"!=",
"NULL",
";",
"port",
"=",
"port",
"->",
"next",
"(",
")",
")",
"{",
"for",
"(",
"field",
"=",
"port",
"->",
"fieldlist",
";",
"field",
"!=",
"NULL",
";",
"field",
"=",
"field",
"->",
"next",
")",
"{",
"if",
"(",
"input_classify_port",
"(",
"field",
")",
"==",
"INPUT_CLASS_CONTROLLER",
")",
"{",
"if",
"(",
"joystick_count",
"<=",
"field",
"->",
"player",
"+",
"1",
")",
"joystick_count",
"=",
"field",
"->",
"player",
"+",
"1",
";",
"}",
"}",
"}",
"return",
"joystick_count",
";",
"}"
] | input_count_players - counts the number of
active players | [
"input_count_players",
"-",
"counts",
"the",
"number",
"of",
"active",
"players"
] | [] | [
{
"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": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | input_category_active | int | int input_category_active(running_machine *machine, int category)
{
const input_port_config *port;
const input_field_config *field = NULL;
const input_setting_config *setting;
input_field_user_settings settings;
assert(category >= 1);
/* loop through the input ports */
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
{
for (field = port->fieldlist; field != NULL; field = field->next)
{
/* is this field a category? */
if (field->type == IPT_CATEGORY)
{
/* get the settings value */
input_field_get_user_settings(field, &settings);
for (setting = field->settinglist; setting != NULL; setting = setting->next)
{
/* is this the category we want? if so, is this settings value correct? */
if ((setting->category == category) && (settings.value == setting->value))
return TRUE;
}
}
}
}
return FALSE;
} | /*-------------------------------------------------
input_category_active - checks to see if a
specific category is active
-------------------------------------------------*/ | checks to see if a
specific category is active | [
"checks",
"to",
"see",
"if",
"a",
"specific",
"category",
"is",
"active"
] | int input_category_active(running_machine *machine, int category)
{
const input_port_config *port;
const input_field_config *field = NULL;
const input_setting_config *setting;
input_field_user_settings settings;
assert(category >= 1);
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
{
for (field = port->fieldlist; field != NULL; field = field->next)
{
if (field->type == IPT_CATEGORY)
{
input_field_get_user_settings(field, &settings);
for (setting = field->settinglist; setting != NULL; setting = setting->next)
{
if ((setting->category == category) && (settings.value == setting->value))
return TRUE;
}
}
}
}
return FALSE;
} | [
"int",
"input_category_active",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"category",
")",
"{",
"const",
"input_port_config",
"*",
"port",
";",
"const",
"input_field_config",
"*",
"field",
"=",
"NULL",
";",
"const",
"input_setting_config",
"*",
"setting",
";",
"input_field_user_settings",
"settings",
";",
"assert",
"(",
"category",
">=",
"1",
")",
";",
"for",
"(",
"port",
"=",
"machine",
"->",
"m_portlist",
".",
"first",
"(",
")",
";",
"port",
"!=",
"NULL",
";",
"port",
"=",
"port",
"->",
"next",
"(",
")",
")",
"{",
"for",
"(",
"field",
"=",
"port",
"->",
"fieldlist",
";",
"field",
"!=",
"NULL",
";",
"field",
"=",
"field",
"->",
"next",
")",
"{",
"if",
"(",
"field",
"->",
"type",
"==",
"IPT_CATEGORY",
")",
"{",
"input_field_get_user_settings",
"(",
"field",
",",
"&",
"settings",
")",
";",
"for",
"(",
"setting",
"=",
"field",
"->",
"settinglist",
";",
"setting",
"!=",
"NULL",
";",
"setting",
"=",
"setting",
"->",
"next",
")",
"{",
"if",
"(",
"(",
"setting",
"->",
"category",
"==",
"category",
")",
"&&",
"(",
"settings",
".",
"value",
"==",
"setting",
"->",
"value",
")",
")",
"return",
"TRUE",
";",
"}",
"}",
"}",
"}",
"return",
"FALSE",
";",
"}"
] | input_category_active - checks to see if a
specific category is active | [
"input_category_active",
"-",
"checks",
"to",
"see",
"if",
"a",
"specific",
"category",
"is",
"active"
] | [
"/* loop through the input ports */",
"/* is this field a category? */",
"/* get the settings value */",
"/* is this the category we want? if so, is this settings value correct? */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "category",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "category",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c34f41b2fc4743bbc605873a89f18631f8c4153a | lofunz/mieme | Reloaded/trunk/src/emu/inptport.c | [
"Unlicense"
] | C | execute_dumpkbd | void | static void execute_dumpkbd(running_machine *machine, int ref, int params, const char *param[])
{
const char *filename;
FILE *file = NULL;
const inputx_code *code;
char buffer[512];
size_t pos;
int i, j;
size_t left_column_width = 24;
/* was there a file specified? */
filename = (params > 0) ? param[0] : NULL;
if (filename != NULL)
{
/* if so, open it */
file = fopen(filename, "w");
if (file == NULL)
{
debug_console_printf(machine, "Cannot open \"%s\"\n", filename);
return;
}
}
if ((codes != NULL) && (codes[0].ch != 0))
{
/* loop through all codes */
for (i = 0; codes[i].ch; i++)
{
code = &codes[i];
pos = 0;
/* describe the character code */
pos += snprintf(&buffer[pos], ARRAY_LENGTH(buffer) - pos, "%08X (%s) ",
code->ch,
code_point_string(machine, code->ch));
/* pad with spaces */
while(pos < left_column_width)
buffer[pos++] = ' ';
buffer[pos] = '\0';
/* identify the keys used */
for (j = 0; j < ARRAY_LENGTH(code->field) && (code->field[j] != NULL); j++)
{
pos += snprintf(&buffer[pos], ARRAY_LENGTH(buffer) - pos, "%s'%s'",
(j > 0) ? ", " : "",
code->field[j]->name);
}
/* and output it as appropriate */
if (file != NULL)
fprintf(file, "%s\n", buffer);
else
debug_console_printf(machine, "%s\n", buffer);
}
}
else
{
debug_console_printf(machine, "No natural keyboard support\n");
}
/* cleanup */
if (file != NULL)
fclose(file);
} | /*-------------------------------------------------
execute_dumpkbd - debugger command to natural
keyboard codes
-------------------------------------------------*/ | debugger command to natural
keyboard codes | [
"debugger",
"command",
"to",
"natural",
"keyboard",
"codes"
] | static void execute_dumpkbd(running_machine *machine, int ref, int params, const char *param[])
{
const char *filename;
FILE *file = NULL;
const inputx_code *code;
char buffer[512];
size_t pos;
int i, j;
size_t left_column_width = 24;
filename = (params > 0) ? param[0] : NULL;
if (filename != NULL)
{
file = fopen(filename, "w");
if (file == NULL)
{
debug_console_printf(machine, "Cannot open \"%s\"\n", filename);
return;
}
}
if ((codes != NULL) && (codes[0].ch != 0))
{
for (i = 0; codes[i].ch; i++)
{
code = &codes[i];
pos = 0;
pos += snprintf(&buffer[pos], ARRAY_LENGTH(buffer) - pos, "%08X (%s) ",
code->ch,
code_point_string(machine, code->ch));
while(pos < left_column_width)
buffer[pos++] = ' ';
buffer[pos] = '\0';
for (j = 0; j < ARRAY_LENGTH(code->field) && (code->field[j] != NULL); j++)
{
pos += snprintf(&buffer[pos], ARRAY_LENGTH(buffer) - pos, "%s'%s'",
(j > 0) ? ", " : "",
code->field[j]->name);
}
if (file != NULL)
fprintf(file, "%s\n", buffer);
else
debug_console_printf(machine, "%s\n", buffer);
}
}
else
{
debug_console_printf(machine, "No natural keyboard support\n");
}
if (file != NULL)
fclose(file);
} | [
"static",
"void",
"execute_dumpkbd",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"ref",
",",
"int",
"params",
",",
"const",
"char",
"*",
"param",
"[",
"]",
")",
"{",
"const",
"char",
"*",
"filename",
";",
"FILE",
"*",
"file",
"=",
"NULL",
";",
"const",
"inputx_code",
"*",
"code",
";",
"char",
"buffer",
"[",
"512",
"]",
";",
"size_t",
"pos",
";",
"int",
"i",
",",
"j",
";",
"size_t",
"left_column_width",
"=",
"24",
";",
"filename",
"=",
"(",
"params",
">",
"0",
")",
"?",
"param",
"[",
"0",
"]",
":",
"NULL",
";",
"if",
"(",
"filename",
"!=",
"NULL",
")",
"{",
"file",
"=",
"fopen",
"(",
"filename",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"file",
"==",
"NULL",
")",
"{",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"filename",
")",
";",
"return",
";",
"}",
"}",
"if",
"(",
"(",
"codes",
"!=",
"NULL",
")",
"&&",
"(",
"codes",
"[",
"0",
"]",
".",
"ch",
"!=",
"0",
")",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"codes",
"[",
"i",
"]",
".",
"ch",
";",
"i",
"++",
")",
"{",
"code",
"=",
"&",
"codes",
"[",
"i",
"]",
";",
"pos",
"=",
"0",
";",
"pos",
"+=",
"snprintf",
"(",
"&",
"buffer",
"[",
"pos",
"]",
",",
"ARRAY_LENGTH",
"(",
"buffer",
")",
"-",
"pos",
",",
"\"",
"\"",
",",
"code",
"->",
"ch",
",",
"code_point_string",
"(",
"machine",
",",
"code",
"->",
"ch",
")",
")",
";",
"while",
"(",
"pos",
"<",
"left_column_width",
")",
"buffer",
"[",
"pos",
"++",
"]",
"=",
"'",
"'",
";",
"buffer",
"[",
"pos",
"]",
"=",
"'",
"\\0",
"'",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"ARRAY_LENGTH",
"(",
"code",
"->",
"field",
")",
"&&",
"(",
"code",
"->",
"field",
"[",
"j",
"]",
"!=",
"NULL",
")",
";",
"j",
"++",
")",
"{",
"pos",
"+=",
"snprintf",
"(",
"&",
"buffer",
"[",
"pos",
"]",
",",
"ARRAY_LENGTH",
"(",
"buffer",
")",
"-",
"pos",
",",
"\"",
"\"",
",",
"(",
"j",
">",
"0",
")",
"?",
"\"",
"\"",
":",
"\"",
"\"",
",",
"code",
"->",
"field",
"[",
"j",
"]",
"->",
"name",
")",
";",
"}",
"if",
"(",
"file",
"!=",
"NULL",
")",
"fprintf",
"(",
"file",
",",
"\"",
"\\n",
"\"",
",",
"buffer",
")",
";",
"else",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
",",
"buffer",
")",
";",
"}",
"}",
"else",
"{",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"if",
"(",
"file",
"!=",
"NULL",
")",
"fclose",
"(",
"file",
")",
";",
"}"
] | execute_dumpkbd - debugger command to natural
keyboard codes | [
"execute_dumpkbd",
"-",
"debugger",
"command",
"to",
"natural",
"keyboard",
"codes"
] | [
"/* was there a file specified? */",
"/* if so, open it */",
"/* loop through all codes */",
"/* describe the character code */",
"/* pad with spaces */",
"/* identify the keys used */",
"/* and output it as appropriate */",
"/* cleanup */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "ref",
"type": "int"
},
{
"param": "params",
"type": "int"
},
{
"param": "param",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ref",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "params",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5bb652dee67c8a844226e87b3d19c438952380e7 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/v60/am3.c | [
"Unlicense"
] | C | am3Register | UINT32 | static UINT32 am3Register(v60_state *cpustate)
{
switch (cpustate->moddim)
{
case 0:
SETREG8(cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb);
break;
case 1:
SETREG16(cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalh);
break;
case 2:
cpustate->reg[cpustate->modval & 0x1F] = cpustate->modwritevalw;
break;
}
return 1;
} | // AM3 Functions (for ReadAM)
// **************************
| AM3 Functions (for ReadAM) | [
"AM3",
"Functions",
"(",
"for",
"ReadAM",
")"
] | static UINT32 am3Register(v60_state *cpustate)
{
switch (cpustate->moddim)
{
case 0:
SETREG8(cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb);
break;
case 1:
SETREG16(cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalh);
break;
case 2:
cpustate->reg[cpustate->modval & 0x1F] = cpustate->modwritevalw;
break;
}
return 1;
} | [
"static",
"UINT32",
"am3Register",
"(",
"v60_state",
"*",
"cpustate",
")",
"{",
"switch",
"(",
"cpustate",
"->",
"moddim",
")",
"{",
"case",
"0",
":",
"SETREG8",
"(",
"cpustate",
"->",
"reg",
"[",
"cpustate",
"->",
"modval",
"&",
"0x1F",
"]",
",",
"cpustate",
"->",
"modwritevalb",
")",
";",
"break",
";",
"case",
"1",
":",
"SETREG16",
"(",
"cpustate",
"->",
"reg",
"[",
"cpustate",
"->",
"modval",
"&",
"0x1F",
"]",
",",
"cpustate",
"->",
"modwritevalh",
")",
";",
"break",
";",
"case",
"2",
":",
"cpustate",
"->",
"reg",
"[",
"cpustate",
"->",
"modval",
"&",
"0x1F",
"]",
"=",
"cpustate",
"->",
"modwritevalw",
";",
"break",
";",
"}",
"return",
"1",
";",
"}"
] | AM3 Functions (for ReadAM) | [
"AM3",
"Functions",
"(",
"for",
"ReadAM",
")"
] | [] | [
{
"param": "cpustate",
"type": "v60_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "v60_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5bb652dee67c8a844226e87b3d19c438952380e7 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/v60/am3.c | [
"Unlicense"
] | C | am3Error1 | UINT32 | static UINT32 am3Error1(v60_state *cpustate)
{
fatalerror("CPU - AM3 - 1 (cpustate->PC=%06x)", cpustate->PC);
return 0; /* never reached, fatalerror won't return */
} | // AM3 Tables (for ReadAMAddress)
// ******************************
| AM3 Tables (for ReadAMAddress) | [
"AM3",
"Tables",
"(",
"for",
"ReadAMAddress",
")"
] | static UINT32 am3Error1(v60_state *cpustate)
{
fatalerror("CPU - AM3 - 1 (cpustate->PC=%06x)", cpustate->PC);
return 0;
} | [
"static",
"UINT32",
"am3Error1",
"(",
"v60_state",
"*",
"cpustate",
")",
"{",
"fatalerror",
"(",
"\"",
"\"",
",",
"cpustate",
"->",
"PC",
")",
";",
"return",
"0",
";",
"}"
] | AM3 Tables (for ReadAMAddress) | [
"AM3",
"Tables",
"(",
"for",
"ReadAMAddress",
")"
] | [
"/* never reached, fatalerror won't return */"
] | [
{
"param": "cpustate",
"type": "v60_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "v60_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | palette_init | void | void palette_init(running_machine *machine)
{
palette_private *palette = auto_alloc_clear(machine, palette_private);
const device_config *device = video_screen_first(machine->config);
bitmap_format format;
/* get the format from the first screen, or use BITMAP_FORMAT_INVALID, if screenless */
if (device != NULL)
{
screen_config *config = (screen_config *)device->inline_config;
format = config->format;
}
else
format = BITMAP_FORMAT_INVALID;
/* request cleanup */
machine->palette_data = palette;
add_exit_callback(machine, palette_exit);
/* reset all our data */
palette->format = format;
/* determine the color mode */
switch (format)
{
case BITMAP_FORMAT_INDEXED16:
case BITMAP_FORMAT_RGB15:
case BITMAP_FORMAT_RGB32:
/* indexed and RGB modes are fine for everything */
break;
case BITMAP_FORMAT_INVALID:
/* invalid format means no palette - or at least it should */
assert(machine->config->total_colors == 0);
return;
default:
fatalerror("Unsupported screen bitmap format!");
break;
}
/* allocate all the data structures */
if (machine->config->total_colors > 0)
{
int numcolors;
allocate_palette(machine, palette);
allocate_color_tables(machine, palette);
allocate_shadow_tables(machine, palette);
/* set up save/restore of the palette */
numcolors = palette_get_num_colors(machine->palette);
palette->save_pen = auto_alloc_array(machine, pen_t, numcolors);
palette->save_bright = auto_alloc_array(machine, float, numcolors);
state_save_register_global_pointer(machine, palette->save_pen, numcolors);
state_save_register_global_pointer(machine, palette->save_bright, numcolors);
state_save_register_presave(machine, palette_presave, palette);
state_save_register_postload(machine, palette_postload, palette);
}
} | /*-------------------------------------------------
palette_init - palette initialization that
takes place before the display is created
-------------------------------------------------*/ | palette initialization that
takes place before the display is created | [
"palette",
"initialization",
"that",
"takes",
"place",
"before",
"the",
"display",
"is",
"created"
] | void palette_init(running_machine *machine)
{
palette_private *palette = auto_alloc_clear(machine, palette_private);
const device_config *device = video_screen_first(machine->config);
bitmap_format format;
if (device != NULL)
{
screen_config *config = (screen_config *)device->inline_config;
format = config->format;
}
else
format = BITMAP_FORMAT_INVALID;
machine->palette_data = palette;
add_exit_callback(machine, palette_exit);
palette->format = format;
switch (format)
{
case BITMAP_FORMAT_INDEXED16:
case BITMAP_FORMAT_RGB15:
case BITMAP_FORMAT_RGB32:
break;
case BITMAP_FORMAT_INVALID:
assert(machine->config->total_colors == 0);
return;
default:
fatalerror("Unsupported screen bitmap format!");
break;
}
if (machine->config->total_colors > 0)
{
int numcolors;
allocate_palette(machine, palette);
allocate_color_tables(machine, palette);
allocate_shadow_tables(machine, palette);
numcolors = palette_get_num_colors(machine->palette);
palette->save_pen = auto_alloc_array(machine, pen_t, numcolors);
palette->save_bright = auto_alloc_array(machine, float, numcolors);
state_save_register_global_pointer(machine, palette->save_pen, numcolors);
state_save_register_global_pointer(machine, palette->save_bright, numcolors);
state_save_register_presave(machine, palette_presave, palette);
state_save_register_postload(machine, palette_postload, palette);
}
} | [
"void",
"palette_init",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"palette_private",
"*",
"palette",
"=",
"auto_alloc_clear",
"(",
"machine",
",",
"palette_private",
")",
";",
"const",
"device_config",
"*",
"device",
"=",
"video_screen_first",
"(",
"machine",
"->",
"config",
")",
";",
"bitmap_format",
"format",
";",
"if",
"(",
"device",
"!=",
"NULL",
")",
"{",
"screen_config",
"*",
"config",
"=",
"(",
"screen_config",
"*",
")",
"device",
"->",
"inline_config",
";",
"format",
"=",
"config",
"->",
"format",
";",
"}",
"else",
"format",
"=",
"BITMAP_FORMAT_INVALID",
";",
"machine",
"->",
"palette_data",
"=",
"palette",
";",
"add_exit_callback",
"(",
"machine",
",",
"palette_exit",
")",
";",
"palette",
"->",
"format",
"=",
"format",
";",
"switch",
"(",
"format",
")",
"{",
"case",
"BITMAP_FORMAT_INDEXED16",
":",
"case",
"BITMAP_FORMAT_RGB15",
":",
"case",
"BITMAP_FORMAT_RGB32",
":",
"break",
";",
"case",
"BITMAP_FORMAT_INVALID",
":",
"assert",
"(",
"machine",
"->",
"config",
"->",
"total_colors",
"==",
"0",
")",
";",
"return",
";",
"default",
":",
"fatalerror",
"(",
"\"",
"\"",
")",
";",
"break",
";",
"}",
"if",
"(",
"machine",
"->",
"config",
"->",
"total_colors",
">",
"0",
")",
"{",
"int",
"numcolors",
";",
"allocate_palette",
"(",
"machine",
",",
"palette",
")",
";",
"allocate_color_tables",
"(",
"machine",
",",
"palette",
")",
";",
"allocate_shadow_tables",
"(",
"machine",
",",
"palette",
")",
";",
"numcolors",
"=",
"palette_get_num_colors",
"(",
"machine",
"->",
"palette",
")",
";",
"palette",
"->",
"save_pen",
"=",
"auto_alloc_array",
"(",
"machine",
",",
"pen_t",
",",
"numcolors",
")",
";",
"palette",
"->",
"save_bright",
"=",
"auto_alloc_array",
"(",
"machine",
",",
"float",
",",
"numcolors",
")",
";",
"state_save_register_global_pointer",
"(",
"machine",
",",
"palette",
"->",
"save_pen",
",",
"numcolors",
")",
";",
"state_save_register_global_pointer",
"(",
"machine",
",",
"palette",
"->",
"save_bright",
",",
"numcolors",
")",
";",
"state_save_register_presave",
"(",
"machine",
",",
"palette_presave",
",",
"palette",
")",
";",
"state_save_register_postload",
"(",
"machine",
",",
"palette_postload",
",",
"palette",
")",
";",
"}",
"}"
] | palette_init - palette initialization that
takes place before the display is created | [
"palette_init",
"-",
"palette",
"initialization",
"that",
"takes",
"place",
"before",
"the",
"display",
"is",
"created"
] | [
"/* get the format from the first screen, or use BITMAP_FORMAT_INVALID, if screenless */",
"/* request cleanup */",
"/* reset all our data */",
"/* determine the color mode */",
"/* indexed and RGB modes are fine for everything */",
"/* invalid format means no palette - or at least it should */",
"/* allocate all the data structures */",
"/* set up save/restore of the palette */"
] | [
{
"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": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | palette_set_shadow_factor | void | void palette_set_shadow_factor(running_machine *machine, double factor)
{
palette_private *palette = machine->palette_data;
assert(palette->shadow_group != 0);
palette_group_set_contrast(machine->palette, palette->shadow_group, factor);
} | /*-------------------------------------------------
palette_set_shadow_factor - set the global
shadow brightness factor
-------------------------------------------------*/ | set the global
shadow brightness factor | [
"set",
"the",
"global",
"shadow",
"brightness",
"factor"
] | void palette_set_shadow_factor(running_machine *machine, double factor)
{
palette_private *palette = machine->palette_data;
assert(palette->shadow_group != 0);
palette_group_set_contrast(machine->palette, palette->shadow_group, factor);
} | [
"void",
"palette_set_shadow_factor",
"(",
"running_machine",
"*",
"machine",
",",
"double",
"factor",
")",
"{",
"palette_private",
"*",
"palette",
"=",
"machine",
"->",
"palette_data",
";",
"assert",
"(",
"palette",
"->",
"shadow_group",
"!=",
"0",
")",
";",
"palette_group_set_contrast",
"(",
"machine",
"->",
"palette",
",",
"palette",
"->",
"shadow_group",
",",
"factor",
")",
";",
"}"
] | palette_set_shadow_factor - set the global
shadow brightness factor | [
"palette_set_shadow_factor",
"-",
"set",
"the",
"global",
"shadow",
"brightness",
"factor"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "factor",
"type": "double"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "factor",
"type": "double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | palette_set_highlight_factor | void | void palette_set_highlight_factor(running_machine *machine, double factor)
{
palette_private *palette = machine->palette_data;
assert(palette->hilight_group != 0);
palette_group_set_contrast(machine->palette, palette->hilight_group, factor);
} | /*-------------------------------------------------
palette_set_highlight_factor - set the global
highlight brightness factor
-------------------------------------------------*/ | set the global
highlight brightness factor | [
"set",
"the",
"global",
"highlight",
"brightness",
"factor"
] | void palette_set_highlight_factor(running_machine *machine, double factor)
{
palette_private *palette = machine->palette_data;
assert(palette->hilight_group != 0);
palette_group_set_contrast(machine->palette, palette->hilight_group, factor);
} | [
"void",
"palette_set_highlight_factor",
"(",
"running_machine",
"*",
"machine",
",",
"double",
"factor",
")",
"{",
"palette_private",
"*",
"palette",
"=",
"machine",
"->",
"palette_data",
";",
"assert",
"(",
"palette",
"->",
"hilight_group",
"!=",
"0",
")",
";",
"palette_group_set_contrast",
"(",
"machine",
"->",
"palette",
",",
"palette",
"->",
"hilight_group",
",",
"factor",
")",
";",
"}"
] | palette_set_highlight_factor - set the global
highlight brightness factor | [
"palette_set_highlight_factor",
"-",
"set",
"the",
"global",
"highlight",
"brightness",
"factor"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "factor",
"type": "double"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "factor",
"type": "double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | palette_set_shadow_mode | void | void palette_set_shadow_mode(running_machine *machine, int mode)
{
palette_private *palette = machine->palette_data;
assert(mode >= 0 && mode < MAX_SHADOW_PRESETS);
machine->shadow_table = palette->shadow_table[mode].base;
} | /*-------------------------------------------------
palette_set_shadow_mode - select 1 of 4
different live shadow tables
-------------------------------------------------*/ | select 1 of 4
different live shadow tables | [
"select",
"1",
"of",
"4",
"different",
"live",
"shadow",
"tables"
] | void palette_set_shadow_mode(running_machine *machine, int mode)
{
palette_private *palette = machine->palette_data;
assert(mode >= 0 && mode < MAX_SHADOW_PRESETS);
machine->shadow_table = palette->shadow_table[mode].base;
} | [
"void",
"palette_set_shadow_mode",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"mode",
")",
"{",
"palette_private",
"*",
"palette",
"=",
"machine",
"->",
"palette_data",
";",
"assert",
"(",
"mode",
">=",
"0",
"&&",
"mode",
"<",
"MAX_SHADOW_PRESETS",
")",
";",
"machine",
"->",
"shadow_table",
"=",
"palette",
"->",
"shadow_table",
"[",
"mode",
"]",
".",
"base",
";",
"}"
] | palette_set_shadow_mode - select 1 of 4
different live shadow tables | [
"palette_set_shadow_mode",
"-",
"select",
"1",
"of",
"4",
"different",
"live",
"shadow",
"tables"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "mode",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mode",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | palette_set_shadow_dRGB32 | void | void palette_set_shadow_dRGB32(running_machine *machine, int mode, int dr, int dg, int db, int noclip)
{
palette_private *palette = machine->palette_data;
shadow_table_data *stable = &palette->shadow_table[mode];
int i;
/* only applies to RGB direct modes */
assert(palette->format != BITMAP_FORMAT_INDEXED16);
assert(stable->base != NULL);
/* clamp the deltas (why?) */
if (dr < -0xff) dr = -0xff; else if (dr > 0xff) dr = 0xff;
if (dg < -0xff) dg = -0xff; else if (dg > 0xff) dg = 0xff;
if (db < -0xff) db = -0xff; else if (db > 0xff) db = 0xff;
/* early exit if nothing changed */
if (dr == stable->dr && dg == stable->dg && db == stable->db && noclip == stable->noclip)
return;
stable->dr = dr;
stable->dg = dg;
stable->db = db;
stable->noclip = noclip;
if (VERBOSE)
popmessage("shadow %d recalc %d %d %d %02x", mode, dr, dg, db, noclip);
/* regenerate the table */
for (i = 0; i < 32768; i++)
{
int r = pal5bit(i >> 10) + dr;
int g = pal5bit(i >> 5) + dg;
int b = pal5bit(i >> 0) + db;
pen_t final;
/* apply clipping */
if (!noclip)
{
r = rgb_clamp(r);
g = rgb_clamp(g);
b = rgb_clamp(b);
}
final = MAKE_RGB(r, g, b);
/* store either 16 or 32 bit */
if (palette->format == BITMAP_FORMAT_RGB32)
stable->base[i] = final;
else
stable->base[i] = rgb_to_rgb15(final);
}
} | /*-------------------------------------------------
palette_set_shadow_dRGB32 - configure delta
RGB values for 1 of 4 shadow tables
-------------------------------------------------*/ | configure delta
RGB values for 1 of 4 shadow tables | [
"configure",
"delta",
"RGB",
"values",
"for",
"1",
"of",
"4",
"shadow",
"tables"
] | void palette_set_shadow_dRGB32(running_machine *machine, int mode, int dr, int dg, int db, int noclip)
{
palette_private *palette = machine->palette_data;
shadow_table_data *stable = &palette->shadow_table[mode];
int i;
assert(palette->format != BITMAP_FORMAT_INDEXED16);
assert(stable->base != NULL);
if (dr < -0xff) dr = -0xff; else if (dr > 0xff) dr = 0xff;
if (dg < -0xff) dg = -0xff; else if (dg > 0xff) dg = 0xff;
if (db < -0xff) db = -0xff; else if (db > 0xff) db = 0xff;
if (dr == stable->dr && dg == stable->dg && db == stable->db && noclip == stable->noclip)
return;
stable->dr = dr;
stable->dg = dg;
stable->db = db;
stable->noclip = noclip;
if (VERBOSE)
popmessage("shadow %d recalc %d %d %d %02x", mode, dr, dg, db, noclip);
for (i = 0; i < 32768; i++)
{
int r = pal5bit(i >> 10) + dr;
int g = pal5bit(i >> 5) + dg;
int b = pal5bit(i >> 0) + db;
pen_t final;
if (!noclip)
{
r = rgb_clamp(r);
g = rgb_clamp(g);
b = rgb_clamp(b);
}
final = MAKE_RGB(r, g, b);
if (palette->format == BITMAP_FORMAT_RGB32)
stable->base[i] = final;
else
stable->base[i] = rgb_to_rgb15(final);
}
} | [
"void",
"palette_set_shadow_dRGB32",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"mode",
",",
"int",
"dr",
",",
"int",
"dg",
",",
"int",
"db",
",",
"int",
"noclip",
")",
"{",
"palette_private",
"*",
"palette",
"=",
"machine",
"->",
"palette_data",
";",
"shadow_table_data",
"*",
"stable",
"=",
"&",
"palette",
"->",
"shadow_table",
"[",
"mode",
"]",
";",
"int",
"i",
";",
"assert",
"(",
"palette",
"->",
"format",
"!=",
"BITMAP_FORMAT_INDEXED16",
")",
";",
"assert",
"(",
"stable",
"->",
"base",
"!=",
"NULL",
")",
";",
"if",
"(",
"dr",
"<",
"-0xff",
")",
"dr",
"=",
"-0xff",
";",
"else",
"if",
"(",
"dr",
">",
"0xff",
")",
"dr",
"=",
"0xff",
";",
"if",
"(",
"dg",
"<",
"-0xff",
")",
"dg",
"=",
"-0xff",
";",
"else",
"if",
"(",
"dg",
">",
"0xff",
")",
"dg",
"=",
"0xff",
";",
"if",
"(",
"db",
"<",
"-0xff",
")",
"db",
"=",
"-0xff",
";",
"else",
"if",
"(",
"db",
">",
"0xff",
")",
"db",
"=",
"0xff",
";",
"if",
"(",
"dr",
"==",
"stable",
"->",
"dr",
"&&",
"dg",
"==",
"stable",
"->",
"dg",
"&&",
"db",
"==",
"stable",
"->",
"db",
"&&",
"noclip",
"==",
"stable",
"->",
"noclip",
")",
"return",
";",
"stable",
"->",
"dr",
"=",
"dr",
";",
"stable",
"->",
"dg",
"=",
"dg",
";",
"stable",
"->",
"db",
"=",
"db",
";",
"stable",
"->",
"noclip",
"=",
"noclip",
";",
"if",
"(",
"VERBOSE",
")",
"popmessage",
"(",
"\"",
"\"",
",",
"mode",
",",
"dr",
",",
"dg",
",",
"db",
",",
"noclip",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"32768",
";",
"i",
"++",
")",
"{",
"int",
"r",
"=",
"pal5bit",
"(",
"i",
">>",
"10",
")",
"+",
"dr",
";",
"int",
"g",
"=",
"pal5bit",
"(",
"i",
">>",
"5",
")",
"+",
"dg",
";",
"int",
"b",
"=",
"pal5bit",
"(",
"i",
">>",
"0",
")",
"+",
"db",
";",
"pen_t",
"final",
";",
"if",
"(",
"!",
"noclip",
")",
"{",
"r",
"=",
"rgb_clamp",
"(",
"r",
")",
";",
"g",
"=",
"rgb_clamp",
"(",
"g",
")",
";",
"b",
"=",
"rgb_clamp",
"(",
"b",
")",
";",
"}",
"final",
"=",
"MAKE_RGB",
"(",
"r",
",",
"g",
",",
"b",
")",
";",
"if",
"(",
"palette",
"->",
"format",
"==",
"BITMAP_FORMAT_RGB32",
")",
"stable",
"->",
"base",
"[",
"i",
"]",
"=",
"final",
";",
"else",
"stable",
"->",
"base",
"[",
"i",
"]",
"=",
"rgb_to_rgb15",
"(",
"final",
")",
";",
"}",
"}"
] | palette_set_shadow_dRGB32 - configure delta
RGB values for 1 of 4 shadow tables | [
"palette_set_shadow_dRGB32",
"-",
"configure",
"delta",
"RGB",
"values",
"for",
"1",
"of",
"4",
"shadow",
"tables"
] | [
"/* only applies to RGB direct modes */",
"/* clamp the deltas (why?) */",
"/* early exit if nothing changed */",
"/* regenerate the table */",
"/* apply clipping */",
"/* store either 16 or 32 bit */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "mode",
"type": "int"
},
{
"param": "dr",
"type": "int"
},
{
"param": "dg",
"type": "int"
},
{
"param": "db",
"type": "int"
},
{
"param": "noclip",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mode",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dr",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dg",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "db",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "noclip",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | colortable_alloc | colortable_t | colortable_t *colortable_alloc(running_machine *machine, UINT32 palettesize)
{
colortable_t *ctable;
UINT32 index;
assert(machine != NULL);
assert(machine->config != NULL);
assert(palettesize > 0);
/* allocate the colortable */
ctable = auto_alloc_clear(machine, colortable_t);
/* fill in the basics */
ctable->machine = machine;
ctable->entries = machine->config->total_colors;
ctable->palentries = palettesize;
/* allocate the raw colortable */
ctable->raw = auto_alloc_array(machine, UINT16, ctable->entries);
for (index = 0; index < ctable->entries; index++)
ctable->raw[index] = index % ctable->palentries;
state_save_register_global_pointer(machine, ctable->raw, ctable->entries);
/* allocate the palette */
ctable->palette = auto_alloc_array(machine, rgb_t, ctable->palentries);
for (index = 0; index < ctable->palentries; index++)
ctable->palette[index] = MAKE_ARGB(0x80,0xff,0xff,0xff);
state_save_register_global_pointer(machine, ctable->palette, ctable->palentries);
return ctable;
} | /*-------------------------------------------------
colortable_alloc - allocate a new colortable
with the given number of entries
-------------------------------------------------*/ | allocate a new colortable
with the given number of entries | [
"allocate",
"a",
"new",
"colortable",
"with",
"the",
"given",
"number",
"of",
"entries"
] | colortable_t *colortable_alloc(running_machine *machine, UINT32 palettesize)
{
colortable_t *ctable;
UINT32 index;
assert(machine != NULL);
assert(machine->config != NULL);
assert(palettesize > 0);
ctable = auto_alloc_clear(machine, colortable_t);
ctable->machine = machine;
ctable->entries = machine->config->total_colors;
ctable->palentries = palettesize;
ctable->raw = auto_alloc_array(machine, UINT16, ctable->entries);
for (index = 0; index < ctable->entries; index++)
ctable->raw[index] = index % ctable->palentries;
state_save_register_global_pointer(machine, ctable->raw, ctable->entries);
ctable->palette = auto_alloc_array(machine, rgb_t, ctable->palentries);
for (index = 0; index < ctable->palentries; index++)
ctable->palette[index] = MAKE_ARGB(0x80,0xff,0xff,0xff);
state_save_register_global_pointer(machine, ctable->palette, ctable->palentries);
return ctable;
} | [
"colortable_t",
"*",
"colortable_alloc",
"(",
"running_machine",
"*",
"machine",
",",
"UINT32",
"palettesize",
")",
"{",
"colortable_t",
"*",
"ctable",
";",
"UINT32",
"index",
";",
"assert",
"(",
"machine",
"!=",
"NULL",
")",
";",
"assert",
"(",
"machine",
"->",
"config",
"!=",
"NULL",
")",
";",
"assert",
"(",
"palettesize",
">",
"0",
")",
";",
"ctable",
"=",
"auto_alloc_clear",
"(",
"machine",
",",
"colortable_t",
")",
";",
"ctable",
"->",
"machine",
"=",
"machine",
";",
"ctable",
"->",
"entries",
"=",
"machine",
"->",
"config",
"->",
"total_colors",
";",
"ctable",
"->",
"palentries",
"=",
"palettesize",
";",
"ctable",
"->",
"raw",
"=",
"auto_alloc_array",
"(",
"machine",
",",
"UINT16",
",",
"ctable",
"->",
"entries",
")",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"ctable",
"->",
"entries",
";",
"index",
"++",
")",
"ctable",
"->",
"raw",
"[",
"index",
"]",
"=",
"index",
"%",
"ctable",
"->",
"palentries",
";",
"state_save_register_global_pointer",
"(",
"machine",
",",
"ctable",
"->",
"raw",
",",
"ctable",
"->",
"entries",
")",
";",
"ctable",
"->",
"palette",
"=",
"auto_alloc_array",
"(",
"machine",
",",
"rgb_t",
",",
"ctable",
"->",
"palentries",
")",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"ctable",
"->",
"palentries",
";",
"index",
"++",
")",
"ctable",
"->",
"palette",
"[",
"index",
"]",
"=",
"MAKE_ARGB",
"(",
"0x80",
",",
"0xff",
",",
"0xff",
",",
"0xff",
")",
";",
"state_save_register_global_pointer",
"(",
"machine",
",",
"ctable",
"->",
"palette",
",",
"ctable",
"->",
"palentries",
")",
";",
"return",
"ctable",
";",
"}"
] | colortable_alloc - allocate a new colortable
with the given number of entries | [
"colortable_alloc",
"-",
"allocate",
"a",
"new",
"colortable",
"with",
"the",
"given",
"number",
"of",
"entries"
] | [
"/* allocate the colortable */",
"/* fill in the basics */",
"/* allocate the raw colortable */",
"/* allocate the palette */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "palettesize",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "palettesize",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | colortable_entry_set_value | void | void colortable_entry_set_value(colortable_t *ctable, UINT32 entry, UINT16 value)
{
/* ensure values are within range */
assert(ctable != NULL);
assert(entry < ctable->entries);
assert(value < ctable->palentries);
/* update if it has changed */
if (ctable->raw[entry] != value)
{
ctable->raw[entry] = value;
palette_set_color(ctable->machine, entry, ctable->palette[value]);
}
} | /*-------------------------------------------------
colortable_entry_set_value - set the value
of a colortable entry
-------------------------------------------------*/ | set the value
of a colortable entry | [
"set",
"the",
"value",
"of",
"a",
"colortable",
"entry"
] | void colortable_entry_set_value(colortable_t *ctable, UINT32 entry, UINT16 value)
{
assert(ctable != NULL);
assert(entry < ctable->entries);
assert(value < ctable->palentries);
if (ctable->raw[entry] != value)
{
ctable->raw[entry] = value;
palette_set_color(ctable->machine, entry, ctable->palette[value]);
}
} | [
"void",
"colortable_entry_set_value",
"(",
"colortable_t",
"*",
"ctable",
",",
"UINT32",
"entry",
",",
"UINT16",
"value",
")",
"{",
"assert",
"(",
"ctable",
"!=",
"NULL",
")",
";",
"assert",
"(",
"entry",
"<",
"ctable",
"->",
"entries",
")",
";",
"assert",
"(",
"value",
"<",
"ctable",
"->",
"palentries",
")",
";",
"if",
"(",
"ctable",
"->",
"raw",
"[",
"entry",
"]",
"!=",
"value",
")",
"{",
"ctable",
"->",
"raw",
"[",
"entry",
"]",
"=",
"value",
";",
"palette_set_color",
"(",
"ctable",
"->",
"machine",
",",
"entry",
",",
"ctable",
"->",
"palette",
"[",
"value",
"]",
")",
";",
"}",
"}"
] | colortable_entry_set_value - set the value
of a colortable entry | [
"colortable_entry_set_value",
"-",
"set",
"the",
"value",
"of",
"a",
"colortable",
"entry"
] | [
"/* ensure values are within range */",
"/* update if it has changed */"
] | [
{
"param": "ctable",
"type": "colortable_t"
},
{
"param": "entry",
"type": "UINT32"
},
{
"param": "value",
"type": "UINT16"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctable",
"type": "colortable_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entry",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | colortable_entry_get_value | UINT16 | UINT16 colortable_entry_get_value(colortable_t *ctable, UINT32 entry)
{
assert(ctable != NULL);
assert(entry < ctable->entries);
return ctable->raw[entry];
} | /*-------------------------------------------------
colortable_entry_get_value - return the value
of a colortable entry
-------------------------------------------------*/ | return the value
of a colortable entry | [
"return",
"the",
"value",
"of",
"a",
"colortable",
"entry"
] | UINT16 colortable_entry_get_value(colortable_t *ctable, UINT32 entry)
{
assert(ctable != NULL);
assert(entry < ctable->entries);
return ctable->raw[entry];
} | [
"UINT16",
"colortable_entry_get_value",
"(",
"colortable_t",
"*",
"ctable",
",",
"UINT32",
"entry",
")",
"{",
"assert",
"(",
"ctable",
"!=",
"NULL",
")",
";",
"assert",
"(",
"entry",
"<",
"ctable",
"->",
"entries",
")",
";",
"return",
"ctable",
"->",
"raw",
"[",
"entry",
"]",
";",
"}"
] | colortable_entry_get_value - return the value
of a colortable entry | [
"colortable_entry_get_value",
"-",
"return",
"the",
"value",
"of",
"a",
"colortable",
"entry"
] | [] | [
{
"param": "ctable",
"type": "colortable_t"
},
{
"param": "entry",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctable",
"type": "colortable_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entry",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | colortable_palette_set_color | void | void colortable_palette_set_color(colortable_t *ctable, UINT32 entry, rgb_t color)
{
/* ensure values are within range */
assert(ctable != NULL);
assert(entry < ctable->palentries);
/* alpha doesn't matter */
color &= 0xffffff;
/* update if it has changed */
if (ctable->palette[entry] != color)
{
UINT32 index;
ctable->palette[entry] = color;
/* update the palette for any colortable entries that reference it */
for (index = 0; index < ctable->entries; index++)
if (ctable->raw[index] == entry)
palette_set_color(ctable->machine, index, color);
}
} | /*-------------------------------------------------
colortable_palette_set_color - change the
color of a colortable palette entry
-------------------------------------------------*/ | change the
color of a colortable palette entry | [
"change",
"the",
"color",
"of",
"a",
"colortable",
"palette",
"entry"
] | void colortable_palette_set_color(colortable_t *ctable, UINT32 entry, rgb_t color)
{
assert(ctable != NULL);
assert(entry < ctable->palentries);
color &= 0xffffff;
if (ctable->palette[entry] != color)
{
UINT32 index;
ctable->palette[entry] = color;
for (index = 0; index < ctable->entries; index++)
if (ctable->raw[index] == entry)
palette_set_color(ctable->machine, index, color);
}
} | [
"void",
"colortable_palette_set_color",
"(",
"colortable_t",
"*",
"ctable",
",",
"UINT32",
"entry",
",",
"rgb_t",
"color",
")",
"{",
"assert",
"(",
"ctable",
"!=",
"NULL",
")",
";",
"assert",
"(",
"entry",
"<",
"ctable",
"->",
"palentries",
")",
";",
"color",
"&=",
"0xffffff",
";",
"if",
"(",
"ctable",
"->",
"palette",
"[",
"entry",
"]",
"!=",
"color",
")",
"{",
"UINT32",
"index",
";",
"ctable",
"->",
"palette",
"[",
"entry",
"]",
"=",
"color",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"ctable",
"->",
"entries",
";",
"index",
"++",
")",
"if",
"(",
"ctable",
"->",
"raw",
"[",
"index",
"]",
"==",
"entry",
")",
"palette_set_color",
"(",
"ctable",
"->",
"machine",
",",
"index",
",",
"color",
")",
";",
"}",
"}"
] | colortable_palette_set_color - change the
color of a colortable palette entry | [
"colortable_palette_set_color",
"-",
"change",
"the",
"color",
"of",
"a",
"colortable",
"palette",
"entry"
] | [
"/* ensure values are within range */",
"/* alpha doesn't matter */",
"/* update if it has changed */",
"/* update the palette for any colortable entries that reference it */"
] | [
{
"param": "ctable",
"type": "colortable_t"
},
{
"param": "entry",
"type": "UINT32"
},
{
"param": "color",
"type": "rgb_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctable",
"type": "colortable_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entry",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "rgb_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | colortable_palette_get_color | rgb_t | rgb_t colortable_palette_get_color(colortable_t *ctable, UINT32 entry)
{
assert(ctable != NULL);
assert(entry < ctable->palentries);
return ctable->palette[entry];
} | /*-------------------------------------------------
colortable_entry_get_value - return the color
of a colortable palette entry
-------------------------------------------------*/ | return the color
of a colortable palette entry | [
"return",
"the",
"color",
"of",
"a",
"colortable",
"palette",
"entry"
] | rgb_t colortable_palette_get_color(colortable_t *ctable, UINT32 entry)
{
assert(ctable != NULL);
assert(entry < ctable->palentries);
return ctable->palette[entry];
} | [
"rgb_t",
"colortable_palette_get_color",
"(",
"colortable_t",
"*",
"ctable",
",",
"UINT32",
"entry",
")",
"{",
"assert",
"(",
"ctable",
"!=",
"NULL",
")",
";",
"assert",
"(",
"entry",
"<",
"ctable",
"->",
"palentries",
")",
";",
"return",
"ctable",
"->",
"palette",
"[",
"entry",
"]",
";",
"}"
] | colortable_entry_get_value - return the color
of a colortable palette entry | [
"colortable_entry_get_value",
"-",
"return",
"the",
"color",
"of",
"a",
"colortable",
"palette",
"entry"
] | [] | [
{
"param": "ctable",
"type": "colortable_t"
},
{
"param": "entry",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctable",
"type": "colortable_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entry",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | colortable_get_transpen_mask | UINT32 | UINT32 colortable_get_transpen_mask(colortable_t *ctable, const gfx_element *gfx, int color, int transcolor)
{
UINT32 entry = gfx->color_base + (color % gfx->total_colors) * gfx->color_granularity;
UINT32 mask = 0;
UINT32 count, bit;
/* make sure we are in range */
assert(ctable != NULL);
assert(entry < ctable->entries);
assert(gfx->color_depth <= 32);
/* either gfx->color_depth entries or as many as we can get up until the end */
count = MIN(gfx->color_depth, ctable->entries - entry);
/* set a bit anywhere the transcolor matches */
for (bit = 0; bit < count; bit++)
if (ctable->raw[entry++] == transcolor)
mask |= 1 << bit;
/* return the final mask */
return mask;
} | /*-------------------------------------------------
colortable_get_transpen_mask - return a 32-bit
transparency mask for a given gfx element and
color
-------------------------------------------------*/ | return a 32-bit
transparency mask for a given gfx element and
color | [
"return",
"a",
"32",
"-",
"bit",
"transparency",
"mask",
"for",
"a",
"given",
"gfx",
"element",
"and",
"color"
] | UINT32 colortable_get_transpen_mask(colortable_t *ctable, const gfx_element *gfx, int color, int transcolor)
{
UINT32 entry = gfx->color_base + (color % gfx->total_colors) * gfx->color_granularity;
UINT32 mask = 0;
UINT32 count, bit;
assert(ctable != NULL);
assert(entry < ctable->entries);
assert(gfx->color_depth <= 32);
count = MIN(gfx->color_depth, ctable->entries - entry);
for (bit = 0; bit < count; bit++)
if (ctable->raw[entry++] == transcolor)
mask |= 1 << bit;
return mask;
} | [
"UINT32",
"colortable_get_transpen_mask",
"(",
"colortable_t",
"*",
"ctable",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"int",
"color",
",",
"int",
"transcolor",
")",
"{",
"UINT32",
"entry",
"=",
"gfx",
"->",
"color_base",
"+",
"(",
"color",
"%",
"gfx",
"->",
"total_colors",
")",
"*",
"gfx",
"->",
"color_granularity",
";",
"UINT32",
"mask",
"=",
"0",
";",
"UINT32",
"count",
",",
"bit",
";",
"assert",
"(",
"ctable",
"!=",
"NULL",
")",
";",
"assert",
"(",
"entry",
"<",
"ctable",
"->",
"entries",
")",
";",
"assert",
"(",
"gfx",
"->",
"color_depth",
"<=",
"32",
")",
";",
"count",
"=",
"MIN",
"(",
"gfx",
"->",
"color_depth",
",",
"ctable",
"->",
"entries",
"-",
"entry",
")",
";",
"for",
"(",
"bit",
"=",
"0",
";",
"bit",
"<",
"count",
";",
"bit",
"++",
")",
"if",
"(",
"ctable",
"->",
"raw",
"[",
"entry",
"++",
"]",
"==",
"transcolor",
")",
"mask",
"|=",
"1",
"<<",
"bit",
";",
"return",
"mask",
";",
"}"
] | colortable_get_transpen_mask - return a 32-bit
transparency mask for a given gfx element and
color | [
"colortable_get_transpen_mask",
"-",
"return",
"a",
"32",
"-",
"bit",
"transparency",
"mask",
"for",
"a",
"given",
"gfx",
"element",
"and",
"color"
] | [
"/* make sure we are in range */",
"/* either gfx->color_depth entries or as many as we can get up until the end */",
"/* set a bit anywhere the transcolor matches */",
"/* return the final mask */"
] | [
{
"param": "ctable",
"type": "colortable_t"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "color",
"type": "int"
},
{
"param": "transcolor",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctable",
"type": "colortable_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": "color",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transcolor",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | colortable_configure_tilemap_groups | void | void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap *tmap, const gfx_element *gfx, int transcolor)
{
int color;
assert(ctable != NULL);
assert(gfx != NULL);
assert(tmap != NULL);
assert(gfx->total_colors <= TILEMAP_NUM_GROUPS);
/* iterate over all colors in the tilemap */
for (color = 0; color < gfx->total_colors; color++)
tilemap_set_transmask(tmap, color, colortable_get_transpen_mask(ctable, gfx, color, transcolor), 0);
} | /*-------------------------------------------------
colortable_configure_tilemap_groups -
configure groups in a tilemap to represent
transparency based on colortable entries
(each group maps to a gfx color)
-------------------------------------------------*/ | colortable_configure_tilemap_groups
configure groups in a tilemap to represent
transparency based on colortable entries
(each group maps to a gfx color) | [
"colortable_configure_tilemap_groups",
"configure",
"groups",
"in",
"a",
"tilemap",
"to",
"represent",
"transparency",
"based",
"on",
"colortable",
"entries",
"(",
"each",
"group",
"maps",
"to",
"a",
"gfx",
"color",
")"
] | void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap *tmap, const gfx_element *gfx, int transcolor)
{
int color;
assert(ctable != NULL);
assert(gfx != NULL);
assert(tmap != NULL);
assert(gfx->total_colors <= TILEMAP_NUM_GROUPS);
for (color = 0; color < gfx->total_colors; color++)
tilemap_set_transmask(tmap, color, colortable_get_transpen_mask(ctable, gfx, color, transcolor), 0);
} | [
"void",
"colortable_configure_tilemap_groups",
"(",
"colortable_t",
"*",
"ctable",
",",
"tilemap",
"*",
"tmap",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"int",
"transcolor",
")",
"{",
"int",
"color",
";",
"assert",
"(",
"ctable",
"!=",
"NULL",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"assert",
"(",
"tmap",
"!=",
"NULL",
")",
";",
"assert",
"(",
"gfx",
"->",
"total_colors",
"<=",
"TILEMAP_NUM_GROUPS",
")",
";",
"for",
"(",
"color",
"=",
"0",
";",
"color",
"<",
"gfx",
"->",
"total_colors",
";",
"color",
"++",
")",
"tilemap_set_transmask",
"(",
"tmap",
",",
"color",
",",
"colortable_get_transpen_mask",
"(",
"ctable",
",",
"gfx",
",",
"color",
",",
"transcolor",
")",
",",
"0",
")",
";",
"}"
] | colortable_configure_tilemap_groups
configure groups in a tilemap to represent
transparency based on colortable entries
(each group maps to a gfx color) | [
"colortable_configure_tilemap_groups",
"configure",
"groups",
"in",
"a",
"tilemap",
"to",
"represent",
"transparency",
"based",
"on",
"colortable",
"entries",
"(",
"each",
"group",
"maps",
"to",
"a",
"gfx",
"color",
")"
] | [
"/* iterate over all colors in the tilemap */"
] | [
{
"param": "ctable",
"type": "colortable_t"
},
{
"param": "tmap",
"type": "tilemap"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "transcolor",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctable",
"type": "colortable_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tmap",
"type": "tilemap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transcolor",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | colortable_palette_get_size | UINT32 | UINT32 colortable_palette_get_size(colortable_t *ctable)
{
assert(ctable != NULL);
return ctable->palentries;
} | /*-------------------------------------------------
colortable_palette_get_size -
return the number of entries in a colortable
-------------------------------------------------*/ | colortable_palette_get_size
return the number of entries in a colortable | [
"colortable_palette_get_size",
"return",
"the",
"number",
"of",
"entries",
"in",
"a",
"colortable"
] | UINT32 colortable_palette_get_size(colortable_t *ctable)
{
assert(ctable != NULL);
return ctable->palentries;
} | [
"UINT32",
"colortable_palette_get_size",
"(",
"colortable_t",
"*",
"ctable",
")",
"{",
"assert",
"(",
"ctable",
"!=",
"NULL",
")",
";",
"return",
"ctable",
"->",
"palentries",
";",
"}"
] | colortable_palette_get_size
return the number of entries in a colortable | [
"colortable_palette_get_size",
"return",
"the",
"number",
"of",
"entries",
"in",
"a",
"colortable"
] | [] | [
{
"param": "ctable",
"type": "colortable_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctable",
"type": "colortable_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | palette_presave | void | static void palette_presave(running_machine *machine, void *param)
{
int numcolors = palette_get_num_colors(machine->palette);
palette_private *palette = (palette_private *)param;
int index;
/* fill the save arrays with updated pen and brightness information */
for (index = 0; index < numcolors; index++)
{
palette->save_pen[index] = palette_entry_get_color(machine->palette, index);
palette->save_bright[index] = palette_entry_get_contrast(machine->palette, index);
}
} | /*-------------------------------------------------
palette_presave - prepare the save arrays
for saving
-------------------------------------------------*/ | prepare the save arrays
for saving | [
"prepare",
"the",
"save",
"arrays",
"for",
"saving"
] | static void palette_presave(running_machine *machine, void *param)
{
int numcolors = palette_get_num_colors(machine->palette);
palette_private *palette = (palette_private *)param;
int index;
for (index = 0; index < numcolors; index++)
{
palette->save_pen[index] = palette_entry_get_color(machine->palette, index);
palette->save_bright[index] = palette_entry_get_contrast(machine->palette, index);
}
} | [
"static",
"void",
"palette_presave",
"(",
"running_machine",
"*",
"machine",
",",
"void",
"*",
"param",
")",
"{",
"int",
"numcolors",
"=",
"palette_get_num_colors",
"(",
"machine",
"->",
"palette",
")",
";",
"palette_private",
"*",
"palette",
"=",
"(",
"palette_private",
"*",
")",
"param",
";",
"int",
"index",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"numcolors",
";",
"index",
"++",
")",
"{",
"palette",
"->",
"save_pen",
"[",
"index",
"]",
"=",
"palette_entry_get_color",
"(",
"machine",
"->",
"palette",
",",
"index",
")",
";",
"palette",
"->",
"save_bright",
"[",
"index",
"]",
"=",
"palette_entry_get_contrast",
"(",
"machine",
"->",
"palette",
",",
"index",
")",
";",
"}",
"}"
] | palette_presave - prepare the save arrays
for saving | [
"palette_presave",
"-",
"prepare",
"the",
"save",
"arrays",
"for",
"saving"
] | [
"/* fill the save arrays with updated pen and brightness information */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "param",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | palette_postload | void | static void palette_postload(running_machine *machine, void *param)
{
int numcolors = palette_get_num_colors(machine->palette);
palette_private *palette = (palette_private *)param;
int index;
/* reset the pen and brightness for each entry */
for (index = 0; index < numcolors; index++)
{
palette_entry_set_color(machine->palette, index, palette->save_pen[index]);
palette_entry_set_contrast(machine->palette, index, palette->save_bright[index]);
}
} | /*-------------------------------------------------
palette_postload - called after restore to
actually update the palette
-------------------------------------------------*/ | called after restore to
actually update the palette | [
"called",
"after",
"restore",
"to",
"actually",
"update",
"the",
"palette"
] | static void palette_postload(running_machine *machine, void *param)
{
int numcolors = palette_get_num_colors(machine->palette);
palette_private *palette = (palette_private *)param;
int index;
for (index = 0; index < numcolors; index++)
{
palette_entry_set_color(machine->palette, index, palette->save_pen[index]);
palette_entry_set_contrast(machine->palette, index, palette->save_bright[index]);
}
} | [
"static",
"void",
"palette_postload",
"(",
"running_machine",
"*",
"machine",
",",
"void",
"*",
"param",
")",
"{",
"int",
"numcolors",
"=",
"palette_get_num_colors",
"(",
"machine",
"->",
"palette",
")",
";",
"palette_private",
"*",
"palette",
"=",
"(",
"palette_private",
"*",
")",
"param",
";",
"int",
"index",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"numcolors",
";",
"index",
"++",
")",
"{",
"palette_entry_set_color",
"(",
"machine",
"->",
"palette",
",",
"index",
",",
"palette",
"->",
"save_pen",
"[",
"index",
"]",
")",
";",
"palette_entry_set_contrast",
"(",
"machine",
"->",
"palette",
",",
"index",
",",
"palette",
"->",
"save_bright",
"[",
"index",
"]",
")",
";",
"}",
"}"
] | palette_postload - called after restore to
actually update the palette | [
"palette_postload",
"-",
"called",
"after",
"restore",
"to",
"actually",
"update",
"the",
"palette"
] | [
"/* reset the pen and brightness for each entry */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "param",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | allocate_palette | void | static void allocate_palette(running_machine *machine, palette_private *palette)
{
int numgroups, index;
/* determine the number of groups we need */
numgroups = 1;
if (machine->config->video_attributes & VIDEO_HAS_SHADOWS)
palette->shadow_group = numgroups++;
if (machine->config->video_attributes & VIDEO_HAS_HIGHLIGHTS)
palette->hilight_group = numgroups++;
assert_always(machine->config->total_colors * numgroups <= 65536, "Error: palette has more than 65536 colors.");
/* allocate a palette object containing all the colors and groups */
machine->palette = palette_alloc(machine->config->total_colors, numgroups);
assert_always(machine->palette != NULL, "Failed to allocate system palette");
/* configure the groups */
if (palette->shadow_group != 0)
palette_group_set_contrast(machine->palette, palette->shadow_group, (float)PALETTE_DEFAULT_SHADOW_FACTOR);
if (palette->hilight_group != 0)
palette_group_set_contrast(machine->palette, palette->hilight_group, (float)PALETTE_DEFAULT_HIGHLIGHT_FACTOR);
/* set the initial colors to a standard rainbow */
for (index = 0; index < machine->config->total_colors; index++)
palette_entry_set_color(machine->palette, index, MAKE_RGB(pal1bit(index >> 0), pal1bit(index >> 1), pal1bit(index >> 2)));
/* switch off the color mode */
switch (palette->format)
{
/* 16-bit paletteized case */
case BITMAP_FORMAT_INDEXED16:
palette->black_pen = palette_get_black_entry(machine->palette);
palette->white_pen = palette_get_white_entry(machine->palette);
if (palette->black_pen >= 65536)
palette->black_pen = 0;
if (palette->white_pen >= 65536)
palette->white_pen = 65536;
break;
/* 15-bit direct case */
case BITMAP_FORMAT_RGB15:
palette->black_pen = rgb_to_rgb15(MAKE_RGB(0x00,0x00,0x00));
palette->white_pen = rgb_to_rgb15(MAKE_RGB(0xff,0xff,0xff));
break;
/* 32-bit direct case */
case BITMAP_FORMAT_RGB32:
palette->black_pen = MAKE_RGB(0x00,0x00,0x00);
palette->white_pen = MAKE_RGB(0xff,0xff,0xff);
break;
/* screenless case */
case BITMAP_FORMAT_INVALID:
default:
break;
}
} | /*-------------------------------------------------
allocate_palette - allocate and configure the
palette object itself
-------------------------------------------------*/ | allocate and configure the
palette object itself | [
"allocate",
"and",
"configure",
"the",
"palette",
"object",
"itself"
] | static void allocate_palette(running_machine *machine, palette_private *palette)
{
int numgroups, index;
numgroups = 1;
if (machine->config->video_attributes & VIDEO_HAS_SHADOWS)
palette->shadow_group = numgroups++;
if (machine->config->video_attributes & VIDEO_HAS_HIGHLIGHTS)
palette->hilight_group = numgroups++;
assert_always(machine->config->total_colors * numgroups <= 65536, "Error: palette has more than 65536 colors.");
machine->palette = palette_alloc(machine->config->total_colors, numgroups);
assert_always(machine->palette != NULL, "Failed to allocate system palette");
if (palette->shadow_group != 0)
palette_group_set_contrast(machine->palette, palette->shadow_group, (float)PALETTE_DEFAULT_SHADOW_FACTOR);
if (palette->hilight_group != 0)
palette_group_set_contrast(machine->palette, palette->hilight_group, (float)PALETTE_DEFAULT_HIGHLIGHT_FACTOR);
for (index = 0; index < machine->config->total_colors; index++)
palette_entry_set_color(machine->palette, index, MAKE_RGB(pal1bit(index >> 0), pal1bit(index >> 1), pal1bit(index >> 2)));
switch (palette->format)
{
case BITMAP_FORMAT_INDEXED16:
palette->black_pen = palette_get_black_entry(machine->palette);
palette->white_pen = palette_get_white_entry(machine->palette);
if (palette->black_pen >= 65536)
palette->black_pen = 0;
if (palette->white_pen >= 65536)
palette->white_pen = 65536;
break;
case BITMAP_FORMAT_RGB15:
palette->black_pen = rgb_to_rgb15(MAKE_RGB(0x00,0x00,0x00));
palette->white_pen = rgb_to_rgb15(MAKE_RGB(0xff,0xff,0xff));
break;
case BITMAP_FORMAT_RGB32:
palette->black_pen = MAKE_RGB(0x00,0x00,0x00);
palette->white_pen = MAKE_RGB(0xff,0xff,0xff);
break;
case BITMAP_FORMAT_INVALID:
default:
break;
}
} | [
"static",
"void",
"allocate_palette",
"(",
"running_machine",
"*",
"machine",
",",
"palette_private",
"*",
"palette",
")",
"{",
"int",
"numgroups",
",",
"index",
";",
"numgroups",
"=",
"1",
";",
"if",
"(",
"machine",
"->",
"config",
"->",
"video_attributes",
"&",
"VIDEO_HAS_SHADOWS",
")",
"palette",
"->",
"shadow_group",
"=",
"numgroups",
"++",
";",
"if",
"(",
"machine",
"->",
"config",
"->",
"video_attributes",
"&",
"VIDEO_HAS_HIGHLIGHTS",
")",
"palette",
"->",
"hilight_group",
"=",
"numgroups",
"++",
";",
"assert_always",
"(",
"machine",
"->",
"config",
"->",
"total_colors",
"*",
"numgroups",
"<=",
"65536",
",",
"\"",
"\"",
")",
";",
"machine",
"->",
"palette",
"=",
"palette_alloc",
"(",
"machine",
"->",
"config",
"->",
"total_colors",
",",
"numgroups",
")",
";",
"assert_always",
"(",
"machine",
"->",
"palette",
"!=",
"NULL",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"palette",
"->",
"shadow_group",
"!=",
"0",
")",
"palette_group_set_contrast",
"(",
"machine",
"->",
"palette",
",",
"palette",
"->",
"shadow_group",
",",
"(",
"float",
")",
"PALETTE_DEFAULT_SHADOW_FACTOR",
")",
";",
"if",
"(",
"palette",
"->",
"hilight_group",
"!=",
"0",
")",
"palette_group_set_contrast",
"(",
"machine",
"->",
"palette",
",",
"palette",
"->",
"hilight_group",
",",
"(",
"float",
")",
"PALETTE_DEFAULT_HIGHLIGHT_FACTOR",
")",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"machine",
"->",
"config",
"->",
"total_colors",
";",
"index",
"++",
")",
"palette_entry_set_color",
"(",
"machine",
"->",
"palette",
",",
"index",
",",
"MAKE_RGB",
"(",
"pal1bit",
"(",
"index",
">>",
"0",
")",
",",
"pal1bit",
"(",
"index",
">>",
"1",
")",
",",
"pal1bit",
"(",
"index",
">>",
"2",
")",
")",
")",
";",
"switch",
"(",
"palette",
"->",
"format",
")",
"{",
"case",
"BITMAP_FORMAT_INDEXED16",
":",
"palette",
"->",
"black_pen",
"=",
"palette_get_black_entry",
"(",
"machine",
"->",
"palette",
")",
";",
"palette",
"->",
"white_pen",
"=",
"palette_get_white_entry",
"(",
"machine",
"->",
"palette",
")",
";",
"if",
"(",
"palette",
"->",
"black_pen",
">=",
"65536",
")",
"palette",
"->",
"black_pen",
"=",
"0",
";",
"if",
"(",
"palette",
"->",
"white_pen",
">=",
"65536",
")",
"palette",
"->",
"white_pen",
"=",
"65536",
";",
"break",
";",
"case",
"BITMAP_FORMAT_RGB15",
":",
"palette",
"->",
"black_pen",
"=",
"rgb_to_rgb15",
"(",
"MAKE_RGB",
"(",
"0x00",
",",
"0x00",
",",
"0x00",
")",
")",
";",
"palette",
"->",
"white_pen",
"=",
"rgb_to_rgb15",
"(",
"MAKE_RGB",
"(",
"0xff",
",",
"0xff",
",",
"0xff",
")",
")",
";",
"break",
";",
"case",
"BITMAP_FORMAT_RGB32",
":",
"palette",
"->",
"black_pen",
"=",
"MAKE_RGB",
"(",
"0x00",
",",
"0x00",
",",
"0x00",
")",
";",
"palette",
"->",
"white_pen",
"=",
"MAKE_RGB",
"(",
"0xff",
",",
"0xff",
",",
"0xff",
")",
";",
"break",
";",
"case",
"BITMAP_FORMAT_INVALID",
":",
"default",
":",
"break",
";",
"}",
"}"
] | allocate_palette - allocate and configure the
palette object itself | [
"allocate_palette",
"-",
"allocate",
"and",
"configure",
"the",
"palette",
"object",
"itself"
] | [
"/* determine the number of groups we need */",
"/* allocate a palette object containing all the colors and groups */",
"/* configure the groups */",
"/* set the initial colors to a standard rainbow */",
"/* switch off the color mode */",
"/* 16-bit paletteized case */",
"/* 15-bit direct case */",
"/* 32-bit direct case */",
"/* screenless case */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "palette",
"type": "palette_private"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "palette",
"type": "palette_private",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | allocate_color_tables | void | static void allocate_color_tables(running_machine *machine, palette_private *palette)
{
int total_colors = palette_get_num_colors(machine->palette) * palette_get_num_groups(machine->palette);
pen_t *pentable;
int i;
/* allocate memory for the pen table */
switch (palette->format)
{
case BITMAP_FORMAT_INDEXED16:
/* create a dummy 1:1 mapping */
machine->pens = pentable = auto_alloc_array(machine, pen_t, total_colors + 2);
for (i = 0; i < total_colors + 2; i++)
pentable[i] = i;
break;
case BITMAP_FORMAT_RGB15:
machine->pens = palette_entry_list_adjusted_rgb15(machine->palette);
break;
case BITMAP_FORMAT_RGB32:
machine->pens = palette_entry_list_adjusted(machine->palette);
break;
default:
machine->pens = NULL;
break;
}
} | /*-------------------------------------------------
allocate_color_tables - allocate memory for
pen and color tables
-------------------------------------------------*/ | allocate memory for
pen and color tables | [
"allocate",
"memory",
"for",
"pen",
"and",
"color",
"tables"
] | static void allocate_color_tables(running_machine *machine, palette_private *palette)
{
int total_colors = palette_get_num_colors(machine->palette) * palette_get_num_groups(machine->palette);
pen_t *pentable;
int i;
switch (palette->format)
{
case BITMAP_FORMAT_INDEXED16:
machine->pens = pentable = auto_alloc_array(machine, pen_t, total_colors + 2);
for (i = 0; i < total_colors + 2; i++)
pentable[i] = i;
break;
case BITMAP_FORMAT_RGB15:
machine->pens = palette_entry_list_adjusted_rgb15(machine->palette);
break;
case BITMAP_FORMAT_RGB32:
machine->pens = palette_entry_list_adjusted(machine->palette);
break;
default:
machine->pens = NULL;
break;
}
} | [
"static",
"void",
"allocate_color_tables",
"(",
"running_machine",
"*",
"machine",
",",
"palette_private",
"*",
"palette",
")",
"{",
"int",
"total_colors",
"=",
"palette_get_num_colors",
"(",
"machine",
"->",
"palette",
")",
"*",
"palette_get_num_groups",
"(",
"machine",
"->",
"palette",
")",
";",
"pen_t",
"*",
"pentable",
";",
"int",
"i",
";",
"switch",
"(",
"palette",
"->",
"format",
")",
"{",
"case",
"BITMAP_FORMAT_INDEXED16",
":",
"machine",
"->",
"pens",
"=",
"pentable",
"=",
"auto_alloc_array",
"(",
"machine",
",",
"pen_t",
",",
"total_colors",
"+",
"2",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"total_colors",
"+",
"2",
";",
"i",
"++",
")",
"pentable",
"[",
"i",
"]",
"=",
"i",
";",
"break",
";",
"case",
"BITMAP_FORMAT_RGB15",
":",
"machine",
"->",
"pens",
"=",
"palette_entry_list_adjusted_rgb15",
"(",
"machine",
"->",
"palette",
")",
";",
"break",
";",
"case",
"BITMAP_FORMAT_RGB32",
":",
"machine",
"->",
"pens",
"=",
"palette_entry_list_adjusted",
"(",
"machine",
"->",
"palette",
")",
";",
"break",
";",
"default",
":",
"machine",
"->",
"pens",
"=",
"NULL",
";",
"break",
";",
"}",
"}"
] | allocate_color_tables - allocate memory for
pen and color tables | [
"allocate_color_tables",
"-",
"allocate",
"memory",
"for",
"pen",
"and",
"color",
"tables"
] | [
"/* allocate memory for the pen table */",
"/* create a dummy 1:1 mapping */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "palette",
"type": "palette_private"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "palette",
"type": "palette_private",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cb9f9762f77442d6bca8f43fd4db76a82665c32 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/emupal.c | [
"Unlicense"
] | C | configure_rgb_shadows | void | static void configure_rgb_shadows(running_machine *machine, int mode, float factor)
{
palette_private *palette = machine->palette_data;
shadow_table_data *stable = &palette->shadow_table[mode];
int ifactor = (int)(factor * 256.0f);
int i;
/* only applies to RGB direct modes */
assert(palette->format != BITMAP_FORMAT_INDEXED16);
assert(stable->base != NULL);
/* regenerate the table */
for (i = 0; i < 32768; i++)
{
UINT8 r = rgb_clamp((pal5bit(i >> 10) * ifactor) >> 8);
UINT8 g = rgb_clamp((pal5bit(i >> 5) * ifactor) >> 8);
UINT8 b = rgb_clamp((pal5bit(i >> 0) * ifactor) >> 8);
pen_t final = MAKE_RGB(r, g, b);
/* store either 16 or 32 bit */
if (palette->format == BITMAP_FORMAT_RGB32)
stable->base[i] = final;
else
stable->base[i] = rgb_to_rgb15(final);
}
} | /*-------------------------------------------------
configure_rgb_shadows - configure shadows
for the RGB tables
-------------------------------------------------*/ | configure shadows
for the RGB tables | [
"configure",
"shadows",
"for",
"the",
"RGB",
"tables"
] | static void configure_rgb_shadows(running_machine *machine, int mode, float factor)
{
palette_private *palette = machine->palette_data;
shadow_table_data *stable = &palette->shadow_table[mode];
int ifactor = (int)(factor * 256.0f);
int i;
assert(palette->format != BITMAP_FORMAT_INDEXED16);
assert(stable->base != NULL);
for (i = 0; i < 32768; i++)
{
UINT8 r = rgb_clamp((pal5bit(i >> 10) * ifactor) >> 8);
UINT8 g = rgb_clamp((pal5bit(i >> 5) * ifactor) >> 8);
UINT8 b = rgb_clamp((pal5bit(i >> 0) * ifactor) >> 8);
pen_t final = MAKE_RGB(r, g, b);
if (palette->format == BITMAP_FORMAT_RGB32)
stable->base[i] = final;
else
stable->base[i] = rgb_to_rgb15(final);
}
} | [
"static",
"void",
"configure_rgb_shadows",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"mode",
",",
"float",
"factor",
")",
"{",
"palette_private",
"*",
"palette",
"=",
"machine",
"->",
"palette_data",
";",
"shadow_table_data",
"*",
"stable",
"=",
"&",
"palette",
"->",
"shadow_table",
"[",
"mode",
"]",
";",
"int",
"ifactor",
"=",
"(",
"int",
")",
"(",
"factor",
"*",
"256.0f",
")",
";",
"int",
"i",
";",
"assert",
"(",
"palette",
"->",
"format",
"!=",
"BITMAP_FORMAT_INDEXED16",
")",
";",
"assert",
"(",
"stable",
"->",
"base",
"!=",
"NULL",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"32768",
";",
"i",
"++",
")",
"{",
"UINT8",
"r",
"=",
"rgb_clamp",
"(",
"(",
"pal5bit",
"(",
"i",
">>",
"10",
")",
"*",
"ifactor",
")",
">>",
"8",
")",
";",
"UINT8",
"g",
"=",
"rgb_clamp",
"(",
"(",
"pal5bit",
"(",
"i",
">>",
"5",
")",
"*",
"ifactor",
")",
">>",
"8",
")",
";",
"UINT8",
"b",
"=",
"rgb_clamp",
"(",
"(",
"pal5bit",
"(",
"i",
">>",
"0",
")",
"*",
"ifactor",
")",
">>",
"8",
")",
";",
"pen_t",
"final",
"=",
"MAKE_RGB",
"(",
"r",
",",
"g",
",",
"b",
")",
";",
"if",
"(",
"palette",
"->",
"format",
"==",
"BITMAP_FORMAT_RGB32",
")",
"stable",
"->",
"base",
"[",
"i",
"]",
"=",
"final",
";",
"else",
"stable",
"->",
"base",
"[",
"i",
"]",
"=",
"rgb_to_rgb15",
"(",
"final",
")",
";",
"}",
"}"
] | configure_rgb_shadows - configure shadows
for the RGB tables | [
"configure_rgb_shadows",
"-",
"configure",
"shadows",
"for",
"the",
"RGB",
"tables"
] | [
"/* only applies to RGB direct modes */",
"/* regenerate the table */",
"/* store either 16 or 32 bit */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "mode",
"type": "int"
},
{
"param": "factor",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mode",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "factor",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
72c898869fd4ca1ac09d60f79af514d3020532fe | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/drivers/berzerk.c | [
"Unlicense"
] | C | vpos_to_vysnc_chain_counter | void | static void vpos_to_vysnc_chain_counter(int vpos, UINT8 *counter, UINT8 *v256)
{
/* convert from a vertical position to the actual values on the vertical sync counters */
*v256 = ((vpos < VBEND) || (vpos >= VBSTART));
if (*v256)
{
int temp = vpos - VBSTART + VCOUNTER_START_VBLANK;
if (temp < 0)
*counter = temp + VTOTAL;
else
*counter = temp;
}
else
*counter = vpos;
} | /*************************************
*
* Convert to/from our line counting
* to the hardware's vsync chain
*
*************************************/ | Convert to/from our line counting
to the hardware's vsync chain | [
"Convert",
"to",
"/",
"from",
"our",
"line",
"counting",
"to",
"the",
"hardware",
"'",
"s",
"vsync",
"chain"
] | static void vpos_to_vysnc_chain_counter(int vpos, UINT8 *counter, UINT8 *v256)
{
*v256 = ((vpos < VBEND) || (vpos >= VBSTART));
if (*v256)
{
int temp = vpos - VBSTART + VCOUNTER_START_VBLANK;
if (temp < 0)
*counter = temp + VTOTAL;
else
*counter = temp;
}
else
*counter = vpos;
} | [
"static",
"void",
"vpos_to_vysnc_chain_counter",
"(",
"int",
"vpos",
",",
"UINT8",
"*",
"counter",
",",
"UINT8",
"*",
"v256",
")",
"{",
"*",
"v256",
"=",
"(",
"(",
"vpos",
"<",
"VBEND",
")",
"||",
"(",
"vpos",
">=",
"VBSTART",
")",
")",
";",
"if",
"(",
"*",
"v256",
")",
"{",
"int",
"temp",
"=",
"vpos",
"-",
"VBSTART",
"+",
"VCOUNTER_START_VBLANK",
";",
"if",
"(",
"temp",
"<",
"0",
")",
"*",
"counter",
"=",
"temp",
"+",
"VTOTAL",
";",
"else",
"*",
"counter",
"=",
"temp",
";",
"}",
"else",
"*",
"counter",
"=",
"vpos",
";",
"}"
] | Convert to/from our line counting
to the hardware's vsync chain | [
"Convert",
"to",
"/",
"from",
"our",
"line",
"counting",
"to",
"the",
"hardware",
"'",
"s",
"vsync",
"chain"
] | [
"/* convert from a vertical position to the actual values on the vertical sync counters */"
] | [
{
"param": "vpos",
"type": "int"
},
{
"param": "counter",
"type": "UINT8"
},
{
"param": "v256",
"type": "UINT8"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vpos",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "counter",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "v256",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
94522e28dcad0ae3fafd4599ff12665a34e8b3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/drivers/mpu4drvr.c | [
"Unlicense"
] | C | update_mpu68_interrupts | void | static void update_mpu68_interrupts(running_machine *machine)
{
cputag_set_input_line(machine, "video", 1, m6840_irq_state ? ASSERT_LINE : CLEAR_LINE);
cputag_set_input_line(machine, "video", 2, m6850_irq_state ? ASSERT_LINE : CLEAR_LINE);
cputag_set_input_line(machine, "video", 3, scn2674_irq_state ? ASSERT_LINE : CLEAR_LINE);
} | /* The interrupt system consists of a 74148 priority encoder
with the following interrupt priorites. A lower number
indicates a lower priority:
7 - Game Card
6 - Game Card
5 - Game Card
4 - Game Card
3 - 2674 AVDC
2 - 6850 ACIA
1 - 6840 PTM
0 - Unused
*/ | The interrupt system consists of a 74148 priority encoder
with the following interrupt priorites. A lower number
indicates a lower priority.
| [
"The",
"interrupt",
"system",
"consists",
"of",
"a",
"74148",
"priority",
"encoder",
"with",
"the",
"following",
"interrupt",
"priorites",
".",
"A",
"lower",
"number",
"indicates",
"a",
"lower",
"priority",
"."
] | static void update_mpu68_interrupts(running_machine *machine)
{
cputag_set_input_line(machine, "video", 1, m6840_irq_state ? ASSERT_LINE : CLEAR_LINE);
cputag_set_input_line(machine, "video", 2, m6850_irq_state ? ASSERT_LINE : CLEAR_LINE);
cputag_set_input_line(machine, "video", 3, scn2674_irq_state ? ASSERT_LINE : CLEAR_LINE);
} | [
"static",
"void",
"update_mpu68_interrupts",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"cputag_set_input_line",
"(",
"machine",
",",
"\"",
"\"",
",",
"1",
",",
"m6840_irq_state",
"?",
"ASSERT_LINE",
":",
"CLEAR_LINE",
")",
";",
"cputag_set_input_line",
"(",
"machine",
",",
"\"",
"\"",
",",
"2",
",",
"m6850_irq_state",
"?",
"ASSERT_LINE",
":",
"CLEAR_LINE",
")",
";",
"cputag_set_input_line",
"(",
"machine",
",",
"\"",
"\"",
",",
"3",
",",
"scn2674_irq_state",
"?",
"ASSERT_LINE",
":",
"CLEAR_LINE",
")",
";",
"}"
] | The interrupt system consists of a 74148 priority encoder
with the following interrupt priorites. | [
"The",
"interrupt",
"system",
"consists",
"of",
"a",
"74148",
"priority",
"encoder",
"with",
"the",
"following",
"interrupt",
"priorites",
"."
] | [] | [
{
"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": []
} |
9413203d775f7c88f1dd52b917e769ce1be5e8db | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/video/lockon.c | [
"Unlicense"
] | C | hud_draw | void | static void hud_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
{
UINT8 *tile_rom = memory_region(machine, "gfx3");
UINT32 offs;
for (offs = 0x0; offs <= lockon_hudram_size; offs += 2)
{
UINT32 y;
UINT32 y_pos;
UINT32 x_pos;
UINT32 y_size;
UINT32 x_size;
UINT32 layout;
UINT16 colour;
UINT32 code;
UINT32 rom_a12_7;
/* End of sprite list marker */
if (lockon_hud_ram[offs + 1] & 0x8000)
break;
y_pos = lockon_hud_ram[offs] & 0x1ff;
x_pos = lockon_hud_ram[offs + 1] & 0x1ff;
x_size = (lockon_hud_ram[offs + 1] >> 12) & 7;
code = (lockon_hud_ram[offs] >> 9) & 0x7f;
colour = 0x200 + ((lockon_hud_ram[offs + 1] >> 9) & 7);
layout = (code >> 5) & 3;
rom_a12_7 = (code & 0xfe) << 6;
/* Account for line buffering */
y_pos -= 1;
if (layout == 3)
y_size = 32;
else if (layout == 2)
y_size = 16;
else
y_size = 8;
for (y = cliprect->min_y; y <= cliprect->max_y; ++y)
{
UINT32 xt;
UINT32 cy;
cy = y_pos + y;
if (cy < 0x200)
continue;
if ((cy & 0xff) == y_size)
break;
for (xt = 0; xt <= x_size; ++xt)
{
UINT32 rom_a6_3;
UINT32 px;
UINT8 gfx_strip;
if (layout == 3)
rom_a6_3 = (BIT(cy, 4) << 3) | (BIT(cy, 3) << 2) | (BIT(xt, 1) << 1) | BIT(xt, 0);
else if (layout == 2)
rom_a6_3 = ((BIT(code, 0) << 3) | (BIT(xt, 1) << 2) | (BIT(cy, 3) << 1) | (BIT(xt, 0)));
else
rom_a6_3 = (BIT(code, 0) << 3) | (xt & 7);
rom_a6_3 <<= 3;
/* Get tile data */
gfx_strip = tile_rom[rom_a12_7 | rom_a6_3 | (cy & 7)];
if (gfx_strip == 0)
continue;
/* Draw */
for (px = 0; px < 8; ++px)
{
UINT32 x = x_pos + (xt << 3) + px;
if (x <= cliprect->max_x)
{
UINT16 *dst = BITMAP_ADDR16(bitmap, y, x);
if (BIT(gfx_strip, px ^ 7) && *dst > 255)
*dst = colour;
}
}
}
}
}
} | /*******************************************************************************************
HUD Drawing Hardware
A sprite layer that uses 8x8x1bpp tiles to form bigger sprites
0 |.......xxxxxxxxx| Y Position
|xxxxxxx.........| Code
1 |.......xxxxxxxxx| X Position
|....xxx.........| Colour
|.xxx............| Sprite width (0=8, 1=16, 2=24, 3=32 pixels, etc.)
|x...............| End of list marker
*******************************************************************************************/ | HUD Drawing Hardware
A sprite layer that uses 8x8x1bpp tiles to form bigger sprites
| [
"HUD",
"Drawing",
"Hardware",
"A",
"sprite",
"layer",
"that",
"uses",
"8x8x1bpp",
"tiles",
"to",
"form",
"bigger",
"sprites"
] | static void hud_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
{
UINT8 *tile_rom = memory_region(machine, "gfx3");
UINT32 offs;
for (offs = 0x0; offs <= lockon_hudram_size; offs += 2)
{
UINT32 y;
UINT32 y_pos;
UINT32 x_pos;
UINT32 y_size;
UINT32 x_size;
UINT32 layout;
UINT16 colour;
UINT32 code;
UINT32 rom_a12_7;
if (lockon_hud_ram[offs + 1] & 0x8000)
break;
y_pos = lockon_hud_ram[offs] & 0x1ff;
x_pos = lockon_hud_ram[offs + 1] & 0x1ff;
x_size = (lockon_hud_ram[offs + 1] >> 12) & 7;
code = (lockon_hud_ram[offs] >> 9) & 0x7f;
colour = 0x200 + ((lockon_hud_ram[offs + 1] >> 9) & 7);
layout = (code >> 5) & 3;
rom_a12_7 = (code & 0xfe) << 6;
y_pos -= 1;
if (layout == 3)
y_size = 32;
else if (layout == 2)
y_size = 16;
else
y_size = 8;
for (y = cliprect->min_y; y <= cliprect->max_y; ++y)
{
UINT32 xt;
UINT32 cy;
cy = y_pos + y;
if (cy < 0x200)
continue;
if ((cy & 0xff) == y_size)
break;
for (xt = 0; xt <= x_size; ++xt)
{
UINT32 rom_a6_3;
UINT32 px;
UINT8 gfx_strip;
if (layout == 3)
rom_a6_3 = (BIT(cy, 4) << 3) | (BIT(cy, 3) << 2) | (BIT(xt, 1) << 1) | BIT(xt, 0);
else if (layout == 2)
rom_a6_3 = ((BIT(code, 0) << 3) | (BIT(xt, 1) << 2) | (BIT(cy, 3) << 1) | (BIT(xt, 0)));
else
rom_a6_3 = (BIT(code, 0) << 3) | (xt & 7);
rom_a6_3 <<= 3;
gfx_strip = tile_rom[rom_a12_7 | rom_a6_3 | (cy & 7)];
if (gfx_strip == 0)
continue;
for (px = 0; px < 8; ++px)
{
UINT32 x = x_pos + (xt << 3) + px;
if (x <= cliprect->max_x)
{
UINT16 *dst = BITMAP_ADDR16(bitmap, y, x);
if (BIT(gfx_strip, px ^ 7) && *dst > 255)
*dst = colour;
}
}
}
}
}
} | [
"static",
"void",
"hud_draw",
"(",
"running_machine",
"*",
"machine",
",",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
")",
"{",
"UINT8",
"*",
"tile_rom",
"=",
"memory_region",
"(",
"machine",
",",
"\"",
"\"",
")",
";",
"UINT32",
"offs",
";",
"for",
"(",
"offs",
"=",
"0x0",
";",
"offs",
"<=",
"lockon_hudram_size",
";",
"offs",
"+=",
"2",
")",
"{",
"UINT32",
"y",
";",
"UINT32",
"y_pos",
";",
"UINT32",
"x_pos",
";",
"UINT32",
"y_size",
";",
"UINT32",
"x_size",
";",
"UINT32",
"layout",
";",
"UINT16",
"colour",
";",
"UINT32",
"code",
";",
"UINT32",
"rom_a12_7",
";",
"if",
"(",
"lockon_hud_ram",
"[",
"offs",
"+",
"1",
"]",
"&",
"0x8000",
")",
"break",
";",
"y_pos",
"=",
"lockon_hud_ram",
"[",
"offs",
"]",
"&",
"0x1ff",
";",
"x_pos",
"=",
"lockon_hud_ram",
"[",
"offs",
"+",
"1",
"]",
"&",
"0x1ff",
";",
"x_size",
"=",
"(",
"lockon_hud_ram",
"[",
"offs",
"+",
"1",
"]",
">>",
"12",
")",
"&",
"7",
";",
"code",
"=",
"(",
"lockon_hud_ram",
"[",
"offs",
"]",
">>",
"9",
")",
"&",
"0x7f",
";",
"colour",
"=",
"0x200",
"+",
"(",
"(",
"lockon_hud_ram",
"[",
"offs",
"+",
"1",
"]",
">>",
"9",
")",
"&",
"7",
")",
";",
"layout",
"=",
"(",
"code",
">>",
"5",
")",
"&",
"3",
";",
"rom_a12_7",
"=",
"(",
"code",
"&",
"0xfe",
")",
"<<",
"6",
";",
"y_pos",
"-=",
"1",
";",
"if",
"(",
"layout",
"==",
"3",
")",
"y_size",
"=",
"32",
";",
"else",
"if",
"(",
"layout",
"==",
"2",
")",
"y_size",
"=",
"16",
";",
"else",
"y_size",
"=",
"8",
";",
"for",
"(",
"y",
"=",
"cliprect",
"->",
"min_y",
";",
"y",
"<=",
"cliprect",
"->",
"max_y",
";",
"++",
"y",
")",
"{",
"UINT32",
"xt",
";",
"UINT32",
"cy",
";",
"cy",
"=",
"y_pos",
"+",
"y",
";",
"if",
"(",
"cy",
"<",
"0x200",
")",
"continue",
";",
"if",
"(",
"(",
"cy",
"&",
"0xff",
")",
"==",
"y_size",
")",
"break",
";",
"for",
"(",
"xt",
"=",
"0",
";",
"xt",
"<=",
"x_size",
";",
"++",
"xt",
")",
"{",
"UINT32",
"rom_a6_3",
";",
"UINT32",
"px",
";",
"UINT8",
"gfx_strip",
";",
"if",
"(",
"layout",
"==",
"3",
")",
"rom_a6_3",
"=",
"(",
"BIT",
"(",
"cy",
",",
"4",
")",
"<<",
"3",
")",
"|",
"(",
"BIT",
"(",
"cy",
",",
"3",
")",
"<<",
"2",
")",
"|",
"(",
"BIT",
"(",
"xt",
",",
"1",
")",
"<<",
"1",
")",
"|",
"BIT",
"(",
"xt",
",",
"0",
")",
";",
"else",
"if",
"(",
"layout",
"==",
"2",
")",
"rom_a6_3",
"=",
"(",
"(",
"BIT",
"(",
"code",
",",
"0",
")",
"<<",
"3",
")",
"|",
"(",
"BIT",
"(",
"xt",
",",
"1",
")",
"<<",
"2",
")",
"|",
"(",
"BIT",
"(",
"cy",
",",
"3",
")",
"<<",
"1",
")",
"|",
"(",
"BIT",
"(",
"xt",
",",
"0",
")",
")",
")",
";",
"else",
"rom_a6_3",
"=",
"(",
"BIT",
"(",
"code",
",",
"0",
")",
"<<",
"3",
")",
"|",
"(",
"xt",
"&",
"7",
")",
";",
"rom_a6_3",
"<<=",
"3",
";",
"gfx_strip",
"=",
"tile_rom",
"[",
"rom_a12_7",
"|",
"rom_a6_3",
"|",
"(",
"cy",
"&",
"7",
")",
"]",
";",
"if",
"(",
"gfx_strip",
"==",
"0",
")",
"continue",
";",
"for",
"(",
"px",
"=",
"0",
";",
"px",
"<",
"8",
";",
"++",
"px",
")",
"{",
"UINT32",
"x",
"=",
"x_pos",
"+",
"(",
"xt",
"<<",
"3",
")",
"+",
"px",
";",
"if",
"(",
"x",
"<=",
"cliprect",
"->",
"max_x",
")",
"{",
"UINT16",
"*",
"dst",
"=",
"BITMAP_ADDR16",
"(",
"bitmap",
",",
"y",
",",
"x",
")",
";",
"if",
"(",
"BIT",
"(",
"gfx_strip",
",",
"px",
"^",
"7",
")",
"&&",
"*",
"dst",
">",
"255",
")",
"*",
"dst",
"=",
"colour",
";",
"}",
"}",
"}",
"}",
"}",
"}"
] | HUD Drawing Hardware
A sprite layer that uses 8x8x1bpp tiles to form bigger sprites | [
"HUD",
"Drawing",
"Hardware",
"A",
"sprite",
"layer",
"that",
"uses",
"8x8x1bpp",
"tiles",
"to",
"form",
"bigger",
"sprites"
] | [
"/* End of sprite list marker */",
"/* Account for line buffering */",
"/* Get tile data */",
"/* Draw */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
}
] | {
"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
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.