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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4ccaf5acc2026c9c1b255678380bf80773edc96c | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/machine/slikshot.c | [
"Unlicense"
] | C | words_to_sensors | void | static void words_to_sensors(UINT16 word1, UINT16 word2, UINT16 word3, UINT8 beams,
UINT16 *sens0, UINT16 *sens1, UINT16 *sens2, UINT16 *sens3)
{
/* if bit 0 of the beams is set, sensor 1 fired first; otherwise sensor 0 fired */
if (beams & 1)
*sens0 = 0, *sens1 = word3;
else
*sens0 = word3, *sens1 = 0;
/* if bit 1 of the beams is set, sensor 3 had a larger value */
if (beams & 2)
*sens3 = word2 + word1, *sens2 = word2;
else
*sens2 = word2 + word1, *sens3 = word2;
} | /*************************************
*
* words_to_sensors
*
* converts from the three words +
* byte that the Z80 sends to the
* main 6809 back to raw sensor data
*
*************************************/ | words_to_sensors
converts from the three words +
byte that the Z80 sends to the
main 6809 back to raw sensor data | [
"words_to_sensors",
"converts",
"from",
"the",
"three",
"words",
"+",
"byte",
"that",
"the",
"Z80",
"sends",
"to",
"the",
"main",
"6809",
"back",
"to",
"raw",
"sensor",
"data"
] | static void words_to_sensors(UINT16 word1, UINT16 word2, UINT16 word3, UINT8 beams,
UINT16 *sens0, UINT16 *sens1, UINT16 *sens2, UINT16 *sens3)
{
if (beams & 1)
*sens0 = 0, *sens1 = word3;
else
*sens0 = word3, *sens1 = 0;
if (beams & 2)
*sens3 = word2 + word1, *sens2 = word2;
else
*sens2 = word2 + word1, *sens3 = word2;
} | [
"static",
"void",
"words_to_sensors",
"(",
"UINT16",
"word1",
",",
"UINT16",
"word2",
",",
"UINT16",
"word3",
",",
"UINT8",
"beams",
",",
"UINT16",
"*",
"sens0",
",",
"UINT16",
"*",
"sens1",
",",
"UINT16",
"*",
"sens2",
",",
"UINT16",
"*",
"sens3",
")",
"{",
"if",
"(",
"beams",
"&",
"1",
")",
"*",
"sens0",
"=",
"0",
",",
"*",
"sens1",
"=",
"word3",
";",
"else",
"*",
"sens0",
"=",
"word3",
",",
"*",
"sens1",
"=",
"0",
";",
"if",
"(",
"beams",
"&",
"2",
")",
"*",
"sens3",
"=",
"word2",
"+",
"word1",
",",
"*",
"sens2",
"=",
"word2",
";",
"else",
"*",
"sens2",
"=",
"word2",
"+",
"word1",
",",
"*",
"sens3",
"=",
"word2",
";",
"}"
] | words_to_sensors
converts from the three words +
byte that the Z80 sends to the
main 6809 back to raw sensor data | [
"words_to_sensors",
"converts",
"from",
"the",
"three",
"words",
"+",
"byte",
"that",
"the",
"Z80",
"sends",
"to",
"the",
"main",
"6809",
"back",
"to",
"raw",
"sensor",
"data"
] | [
"/* if bit 0 of the beams is set, sensor 1 fired first; otherwise sensor 0 fired */",
"/* if bit 1 of the beams is set, sensor 3 had a larger value */"
] | [
{
"param": "word1",
"type": "UINT16"
},
{
"param": "word2",
"type": "UINT16"
},
{
"param": "word3",
"type": "UINT16"
},
{
"param": "beams",
"type": "UINT8"
},
{
"param": "sens0",
"type": "UINT16"
},
{
"param": "sens1",
"type": "UINT16"
},
{
"param": "sens2",
"type": "UINT16"
},
{
"param": "sens3",
"type": "UINT16"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "word1",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "word2",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "word3",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "beams",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sens0",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sens1",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sens2",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sens3",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
78cdaf704baa9f8d3aa4930825af12806041b6a5 | lofunz/mieme | Reloaded/trunk/src/emu/profiler.c | [
"Unlicense"
] | C | _profiler_mark_start | void | void _profiler_mark_start(int type)
{
profiler_data *data = &global_profiler.data[global_profiler.dataindex];
osd_ticks_t curticks = get_profile_ticks();
profiler_filo_entry *entry;
int index;
/* track context switches */
if (type >= PROFILER_DEVICE_FIRST && type <= PROFILER_DEVICE_MAX)
data->context_switches++;
/* we're starting a new bucket, begin now */
index = global_profiler.filoindex++;
entry = &global_profiler.filo[index];
/* fail if we overflow */
if (index > ARRAY_LENGTH(global_profiler.filo))
fatalerror("Profiler FILO overflow (type = %d)\n", type);
/* if we're nested, stop the previous entry */
if (index > 0)
{
profiler_filo_entry *preventry = entry - 1;
data->duration[preventry->type] += curticks - preventry->start;
}
/* fill in this entry */
entry->type = type;
entry->start = curticks;
} | /*-------------------------------------------------
_profiler_mark_start - mark the beginning of a
profiler entry
-------------------------------------------------*/ | mark the beginning of a
profiler entry | [
"mark",
"the",
"beginning",
"of",
"a",
"profiler",
"entry"
] | void _profiler_mark_start(int type)
{
profiler_data *data = &global_profiler.data[global_profiler.dataindex];
osd_ticks_t curticks = get_profile_ticks();
profiler_filo_entry *entry;
int index;
if (type >= PROFILER_DEVICE_FIRST && type <= PROFILER_DEVICE_MAX)
data->context_switches++;
index = global_profiler.filoindex++;
entry = &global_profiler.filo[index];
if (index > ARRAY_LENGTH(global_profiler.filo))
fatalerror("Profiler FILO overflow (type = %d)\n", type);
if (index > 0)
{
profiler_filo_entry *preventry = entry - 1;
data->duration[preventry->type] += curticks - preventry->start;
}
entry->type = type;
entry->start = curticks;
} | [
"void",
"_profiler_mark_start",
"(",
"int",
"type",
")",
"{",
"profiler_data",
"*",
"data",
"=",
"&",
"global_profiler",
".",
"data",
"[",
"global_profiler",
".",
"dataindex",
"]",
";",
"osd_ticks_t",
"curticks",
"=",
"get_profile_ticks",
"(",
")",
";",
"profiler_filo_entry",
"*",
"entry",
";",
"int",
"index",
";",
"if",
"(",
"type",
">=",
"PROFILER_DEVICE_FIRST",
"&&",
"type",
"<=",
"PROFILER_DEVICE_MAX",
")",
"data",
"->",
"context_switches",
"++",
";",
"index",
"=",
"global_profiler",
".",
"filoindex",
"++",
";",
"entry",
"=",
"&",
"global_profiler",
".",
"filo",
"[",
"index",
"]",
";",
"if",
"(",
"index",
">",
"ARRAY_LENGTH",
"(",
"global_profiler",
".",
"filo",
")",
")",
"fatalerror",
"(",
"\"",
"\\n",
"\"",
",",
"type",
")",
";",
"if",
"(",
"index",
">",
"0",
")",
"{",
"profiler_filo_entry",
"*",
"preventry",
"=",
"entry",
"-",
"1",
";",
"data",
"->",
"duration",
"[",
"preventry",
"->",
"type",
"]",
"+=",
"curticks",
"-",
"preventry",
"->",
"start",
";",
"}",
"entry",
"->",
"type",
"=",
"type",
";",
"entry",
"->",
"start",
"=",
"curticks",
";",
"}"
] | _profiler_mark_start - mark the beginning of a
profiler entry | [
"_profiler_mark_start",
"-",
"mark",
"the",
"beginning",
"of",
"a",
"profiler",
"entry"
] | [
"/* track context switches */",
"/* we're starting a new bucket, begin now */",
"/* fail if we overflow */",
"/* if we're nested, stop the previous entry */",
"/* fill in this entry */"
] | [
{
"param": "type",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
78cdaf704baa9f8d3aa4930825af12806041b6a5 | lofunz/mieme | Reloaded/trunk/src/emu/profiler.c | [
"Unlicense"
] | C | _profiler_mark_end | void | void _profiler_mark_end(void)
{
profiler_data *data = &global_profiler.data[global_profiler.dataindex];
osd_ticks_t curticks = get_profile_ticks();
/* we're ending an existing bucket, update the time */
if (global_profiler.filoindex > 0)
{
int index = --global_profiler.filoindex;
profiler_filo_entry *entry = &global_profiler.filo[index];
/* account for the time taken */
data->duration[entry->type] += curticks - entry->start;
/* if we have a previous entry, restart his time now */
if (index != 0)
{
profiler_filo_entry *preventry = entry - 1;
preventry->start = curticks;
}
}
} | /*-------------------------------------------------
_profiler_mark_end - mark the end of a
profiler entry
-------------------------------------------------*/ | mark the end of a
profiler entry | [
"mark",
"the",
"end",
"of",
"a",
"profiler",
"entry"
] | void _profiler_mark_end(void)
{
profiler_data *data = &global_profiler.data[global_profiler.dataindex];
osd_ticks_t curticks = get_profile_ticks();
if (global_profiler.filoindex > 0)
{
int index = --global_profiler.filoindex;
profiler_filo_entry *entry = &global_profiler.filo[index];
data->duration[entry->type] += curticks - entry->start;
if (index != 0)
{
profiler_filo_entry *preventry = entry - 1;
preventry->start = curticks;
}
}
} | [
"void",
"_profiler_mark_end",
"(",
"void",
")",
"{",
"profiler_data",
"*",
"data",
"=",
"&",
"global_profiler",
".",
"data",
"[",
"global_profiler",
".",
"dataindex",
"]",
";",
"osd_ticks_t",
"curticks",
"=",
"get_profile_ticks",
"(",
")",
";",
"if",
"(",
"global_profiler",
".",
"filoindex",
">",
"0",
")",
"{",
"int",
"index",
"=",
"--",
"global_profiler",
".",
"filoindex",
";",
"profiler_filo_entry",
"*",
"entry",
"=",
"&",
"global_profiler",
".",
"filo",
"[",
"index",
"]",
";",
"data",
"->",
"duration",
"[",
"entry",
"->",
"type",
"]",
"+=",
"curticks",
"-",
"entry",
"->",
"start",
";",
"if",
"(",
"index",
"!=",
"0",
")",
"{",
"profiler_filo_entry",
"*",
"preventry",
"=",
"entry",
"-",
"1",
";",
"preventry",
"->",
"start",
"=",
"curticks",
";",
"}",
"}",
"}"
] | _profiler_mark_end - mark the end of a
profiler entry | [
"_profiler_mark_end",
"-",
"mark",
"the",
"end",
"of",
"a",
"profiler",
"entry"
] | [
"/* we're ending an existing bucket, update the time */",
"/* account for the time taken */",
"/* if we have a previous entry, restart his time now */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | gfx_element_alloc | gfx_element | gfx_element *gfx_element_alloc(running_machine *machine, const gfx_layout *gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base)
{
int israw = (gl->planeoffset[0] == GFX_RAW);
int planes = gl->planes;
UINT16 width = gl->width;
UINT16 height = gl->height;
UINT32 total = gl->total;
gfx_element *gfx;
/* allocate memory for the gfx_element structure */
gfx = alloc_clear_or_die(gfx_element);
/* fill in the data */
gfx->width = width;
gfx->height = height;
gfx->origwidth = width;
gfx->origheight = height;
gfx->total_elements = total;
gfx->color_base = color_base;
gfx->color_depth = 1 << planes;
gfx->color_granularity = 1 << planes;
gfx->total_colors = total_colors;
gfx->srcdata = srcdata;
gfx->machine = machine;
/* copy the layout */
gfx->layout = *gl;
if (gfx->layout.extxoffs != NULL)
{
if (gfx->layout.width < ARRAY_LENGTH(gfx->layout.xoffset))
{
memcpy(gfx->layout.xoffset, gfx->layout.extxoffs, sizeof(gfx->layout.xoffset[0]) * gfx->layout.width);
gfx->layout.extxoffs = NULL;
}
else
{
UINT32 *buffer = alloc_array_or_die(UINT32, gfx->layout.width);
memcpy(buffer, gfx->layout.extxoffs, sizeof(gfx->layout.extxoffs[0]) * gfx->layout.width);
gfx->layout.extxoffs = buffer;
}
}
if (gfx->layout.extyoffs != NULL)
{
if (gfx->layout.height < ARRAY_LENGTH(gfx->layout.yoffset))
{
memcpy(gfx->layout.yoffset, gfx->layout.extyoffs, sizeof(gfx->layout.yoffset[0]) * gfx->layout.height);
gfx->layout.extyoffs = NULL;
}
else
{
UINT32 *buffer = alloc_array_or_die(UINT32, gfx->layout.height);
memcpy(buffer, gfx->layout.extyoffs, sizeof(gfx->layout.extyoffs[0]) * gfx->layout.height);
gfx->layout.extyoffs = buffer;
}
}
/* allocate a pen usage array for entries with 32 pens or less */
if (gfx->color_depth <= 32)
gfx->pen_usage = alloc_array_or_die(UINT32, gfx->total_elements);
/* allocate a dirty array */
gfx->dirty = alloc_array_or_die(UINT8, gfx->total_elements);
memset(gfx->dirty, 1, gfx->total_elements * sizeof(*gfx->dirty));
/* raw graphics case */
if (israw)
{
/* modulos are determined for us by the layout */
gfx->line_modulo = (gl->extyoffs ? gl->extyoffs[0] : gl->yoffset[0]) / 8;
gfx->char_modulo = gl->charincrement / 8;
/* don't free the data because we will get a pointer at decode time */
gfx->flags |= GFX_ELEMENT_DONT_FREE;
if (planes <= 4)
gfx->flags |= GFX_ELEMENT_PACKED;
/* RAW graphics must have a pointer up front */
gfx->gfxdata = (UINT8 *)gfx->srcdata;
}
/* decoded graphics case */
else
{
/* we get to pick our own modulos */
gfx->line_modulo = gfx->origwidth;
gfx->char_modulo = gfx->line_modulo * gfx->origheight;
/* allocate memory for the data */
gfx->gfxdata = alloc_array_or_die(UINT8, gfx->total_elements * gfx->char_modulo);
}
return gfx;
} | /*-------------------------------------------------
gfx_element_alloc - allocate a gfx_element structure
based on a given layout
-------------------------------------------------*/ | allocate a gfx_element structure
based on a given layout | [
"allocate",
"a",
"gfx_element",
"structure",
"based",
"on",
"a",
"given",
"layout"
] | gfx_element *gfx_element_alloc(running_machine *machine, const gfx_layout *gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base)
{
int israw = (gl->planeoffset[0] == GFX_RAW);
int planes = gl->planes;
UINT16 width = gl->width;
UINT16 height = gl->height;
UINT32 total = gl->total;
gfx_element *gfx;
gfx = alloc_clear_or_die(gfx_element);
gfx->width = width;
gfx->height = height;
gfx->origwidth = width;
gfx->origheight = height;
gfx->total_elements = total;
gfx->color_base = color_base;
gfx->color_depth = 1 << planes;
gfx->color_granularity = 1 << planes;
gfx->total_colors = total_colors;
gfx->srcdata = srcdata;
gfx->machine = machine;
gfx->layout = *gl;
if (gfx->layout.extxoffs != NULL)
{
if (gfx->layout.width < ARRAY_LENGTH(gfx->layout.xoffset))
{
memcpy(gfx->layout.xoffset, gfx->layout.extxoffs, sizeof(gfx->layout.xoffset[0]) * gfx->layout.width);
gfx->layout.extxoffs = NULL;
}
else
{
UINT32 *buffer = alloc_array_or_die(UINT32, gfx->layout.width);
memcpy(buffer, gfx->layout.extxoffs, sizeof(gfx->layout.extxoffs[0]) * gfx->layout.width);
gfx->layout.extxoffs = buffer;
}
}
if (gfx->layout.extyoffs != NULL)
{
if (gfx->layout.height < ARRAY_LENGTH(gfx->layout.yoffset))
{
memcpy(gfx->layout.yoffset, gfx->layout.extyoffs, sizeof(gfx->layout.yoffset[0]) * gfx->layout.height);
gfx->layout.extyoffs = NULL;
}
else
{
UINT32 *buffer = alloc_array_or_die(UINT32, gfx->layout.height);
memcpy(buffer, gfx->layout.extyoffs, sizeof(gfx->layout.extyoffs[0]) * gfx->layout.height);
gfx->layout.extyoffs = buffer;
}
}
if (gfx->color_depth <= 32)
gfx->pen_usage = alloc_array_or_die(UINT32, gfx->total_elements);
gfx->dirty = alloc_array_or_die(UINT8, gfx->total_elements);
memset(gfx->dirty, 1, gfx->total_elements * sizeof(*gfx->dirty));
if (israw)
{
gfx->line_modulo = (gl->extyoffs ? gl->extyoffs[0] : gl->yoffset[0]) / 8;
gfx->char_modulo = gl->charincrement / 8;
gfx->flags |= GFX_ELEMENT_DONT_FREE;
if (planes <= 4)
gfx->flags |= GFX_ELEMENT_PACKED;
gfx->gfxdata = (UINT8 *)gfx->srcdata;
}
else
{
gfx->line_modulo = gfx->origwidth;
gfx->char_modulo = gfx->line_modulo * gfx->origheight;
gfx->gfxdata = alloc_array_or_die(UINT8, gfx->total_elements * gfx->char_modulo);
}
return gfx;
} | [
"gfx_element",
"*",
"gfx_element_alloc",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"gfx_layout",
"*",
"gl",
",",
"const",
"UINT8",
"*",
"srcdata",
",",
"UINT32",
"total_colors",
",",
"UINT32",
"color_base",
")",
"{",
"int",
"israw",
"=",
"(",
"gl",
"->",
"planeoffset",
"[",
"0",
"]",
"==",
"GFX_RAW",
")",
";",
"int",
"planes",
"=",
"gl",
"->",
"planes",
";",
"UINT16",
"width",
"=",
"gl",
"->",
"width",
";",
"UINT16",
"height",
"=",
"gl",
"->",
"height",
";",
"UINT32",
"total",
"=",
"gl",
"->",
"total",
";",
"gfx_element",
"*",
"gfx",
";",
"gfx",
"=",
"alloc_clear_or_die",
"(",
"gfx_element",
")",
";",
"gfx",
"->",
"width",
"=",
"width",
";",
"gfx",
"->",
"height",
"=",
"height",
";",
"gfx",
"->",
"origwidth",
"=",
"width",
";",
"gfx",
"->",
"origheight",
"=",
"height",
";",
"gfx",
"->",
"total_elements",
"=",
"total",
";",
"gfx",
"->",
"color_base",
"=",
"color_base",
";",
"gfx",
"->",
"color_depth",
"=",
"1",
"<<",
"planes",
";",
"gfx",
"->",
"color_granularity",
"=",
"1",
"<<",
"planes",
";",
"gfx",
"->",
"total_colors",
"=",
"total_colors",
";",
"gfx",
"->",
"srcdata",
"=",
"srcdata",
";",
"gfx",
"->",
"machine",
"=",
"machine",
";",
"gfx",
"->",
"layout",
"=",
"*",
"gl",
";",
"if",
"(",
"gfx",
"->",
"layout",
".",
"extxoffs",
"!=",
"NULL",
")",
"{",
"if",
"(",
"gfx",
"->",
"layout",
".",
"width",
"<",
"ARRAY_LENGTH",
"(",
"gfx",
"->",
"layout",
".",
"xoffset",
")",
")",
"{",
"memcpy",
"(",
"gfx",
"->",
"layout",
".",
"xoffset",
",",
"gfx",
"->",
"layout",
".",
"extxoffs",
",",
"sizeof",
"(",
"gfx",
"->",
"layout",
".",
"xoffset",
"[",
"0",
"]",
")",
"*",
"gfx",
"->",
"layout",
".",
"width",
")",
";",
"gfx",
"->",
"layout",
".",
"extxoffs",
"=",
"NULL",
";",
"}",
"else",
"{",
"UINT32",
"*",
"buffer",
"=",
"alloc_array_or_die",
"(",
"UINT32",
",",
"gfx",
"->",
"layout",
".",
"width",
")",
";",
"memcpy",
"(",
"buffer",
",",
"gfx",
"->",
"layout",
".",
"extxoffs",
",",
"sizeof",
"(",
"gfx",
"->",
"layout",
".",
"extxoffs",
"[",
"0",
"]",
")",
"*",
"gfx",
"->",
"layout",
".",
"width",
")",
";",
"gfx",
"->",
"layout",
".",
"extxoffs",
"=",
"buffer",
";",
"}",
"}",
"if",
"(",
"gfx",
"->",
"layout",
".",
"extyoffs",
"!=",
"NULL",
")",
"{",
"if",
"(",
"gfx",
"->",
"layout",
".",
"height",
"<",
"ARRAY_LENGTH",
"(",
"gfx",
"->",
"layout",
".",
"yoffset",
")",
")",
"{",
"memcpy",
"(",
"gfx",
"->",
"layout",
".",
"yoffset",
",",
"gfx",
"->",
"layout",
".",
"extyoffs",
",",
"sizeof",
"(",
"gfx",
"->",
"layout",
".",
"yoffset",
"[",
"0",
"]",
")",
"*",
"gfx",
"->",
"layout",
".",
"height",
")",
";",
"gfx",
"->",
"layout",
".",
"extyoffs",
"=",
"NULL",
";",
"}",
"else",
"{",
"UINT32",
"*",
"buffer",
"=",
"alloc_array_or_die",
"(",
"UINT32",
",",
"gfx",
"->",
"layout",
".",
"height",
")",
";",
"memcpy",
"(",
"buffer",
",",
"gfx",
"->",
"layout",
".",
"extyoffs",
",",
"sizeof",
"(",
"gfx",
"->",
"layout",
".",
"extyoffs",
"[",
"0",
"]",
")",
"*",
"gfx",
"->",
"layout",
".",
"height",
")",
";",
"gfx",
"->",
"layout",
".",
"extyoffs",
"=",
"buffer",
";",
"}",
"}",
"if",
"(",
"gfx",
"->",
"color_depth",
"<=",
"32",
")",
"gfx",
"->",
"pen_usage",
"=",
"alloc_array_or_die",
"(",
"UINT32",
",",
"gfx",
"->",
"total_elements",
")",
";",
"gfx",
"->",
"dirty",
"=",
"alloc_array_or_die",
"(",
"UINT8",
",",
"gfx",
"->",
"total_elements",
")",
";",
"memset",
"(",
"gfx",
"->",
"dirty",
",",
"1",
",",
"gfx",
"->",
"total_elements",
"*",
"sizeof",
"(",
"*",
"gfx",
"->",
"dirty",
")",
")",
";",
"if",
"(",
"israw",
")",
"{",
"gfx",
"->",
"line_modulo",
"=",
"(",
"gl",
"->",
"extyoffs",
"?",
"gl",
"->",
"extyoffs",
"[",
"0",
"]",
":",
"gl",
"->",
"yoffset",
"[",
"0",
"]",
")",
"/",
"8",
";",
"gfx",
"->",
"char_modulo",
"=",
"gl",
"->",
"charincrement",
"/",
"8",
";",
"gfx",
"->",
"flags",
"|=",
"GFX_ELEMENT_DONT_FREE",
";",
"if",
"(",
"planes",
"<=",
"4",
")",
"gfx",
"->",
"flags",
"|=",
"GFX_ELEMENT_PACKED",
";",
"gfx",
"->",
"gfxdata",
"=",
"(",
"UINT8",
"*",
")",
"gfx",
"->",
"srcdata",
";",
"}",
"else",
"{",
"gfx",
"->",
"line_modulo",
"=",
"gfx",
"->",
"origwidth",
";",
"gfx",
"->",
"char_modulo",
"=",
"gfx",
"->",
"line_modulo",
"*",
"gfx",
"->",
"origheight",
";",
"gfx",
"->",
"gfxdata",
"=",
"alloc_array_or_die",
"(",
"UINT8",
",",
"gfx",
"->",
"total_elements",
"*",
"gfx",
"->",
"char_modulo",
")",
";",
"}",
"return",
"gfx",
";",
"}"
] | gfx_element_alloc - allocate a gfx_element structure
based on a given layout | [
"gfx_element_alloc",
"-",
"allocate",
"a",
"gfx_element",
"structure",
"based",
"on",
"a",
"given",
"layout"
] | [
"/* allocate memory for the gfx_element structure */",
"/* fill in the data */",
"/* copy the layout */",
"/* allocate a pen usage array for entries with 32 pens or less */",
"/* allocate a dirty array */",
"/* raw graphics case */",
"/* modulos are determined for us by the layout */",
"/* don't free the data because we will get a pointer at decode time */",
"/* RAW graphics must have a pointer up front */",
"/* decoded graphics case */",
"/* we get to pick our own modulos */",
"/* allocate memory for the data */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "gl",
"type": "gfx_layout"
},
{
"param": "srcdata",
"type": "UINT8"
},
{
"param": "total_colors",
"type": "UINT32"
},
{
"param": "color_base",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gl",
"type": "gfx_layout",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "srcdata",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "total_colors",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color_base",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | gfx_element_build_temporary | void | void gfx_element_build_temporary(gfx_element *gfx, running_machine *machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity, UINT32 flags)
{
static UINT8 not_dirty = 0;
gfx->width = width;
gfx->height = height;
gfx->startx = 0;
gfx->starty = 0;
gfx->origwidth = width;
gfx->origheight = height;
gfx->flags = flags;
gfx->total_elements = 1;
gfx->color_base = color_base;
gfx->color_depth = color_granularity;
gfx->color_granularity = color_granularity;
gfx->total_colors = (machine->config->total_colors - color_base) / color_granularity;
gfx->pen_usage = NULL;
gfx->gfxdata = base;
gfx->line_modulo = rowbytes;
gfx->char_modulo = 0;
gfx->srcdata = base;
gfx->dirty = ¬_dirty;
gfx->dirtyseq = 0;
gfx->machine = machine;
} | /*-------------------------------------------------
gfx_element_build_temporary - create a
temporary one-off gfx_element
-------------------------------------------------*/ | create a
temporary one-off gfx_element | [
"create",
"a",
"temporary",
"one",
"-",
"off",
"gfx_element"
] | void gfx_element_build_temporary(gfx_element *gfx, running_machine *machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity, UINT32 flags)
{
static UINT8 not_dirty = 0;
gfx->width = width;
gfx->height = height;
gfx->startx = 0;
gfx->starty = 0;
gfx->origwidth = width;
gfx->origheight = height;
gfx->flags = flags;
gfx->total_elements = 1;
gfx->color_base = color_base;
gfx->color_depth = color_granularity;
gfx->color_granularity = color_granularity;
gfx->total_colors = (machine->config->total_colors - color_base) / color_granularity;
gfx->pen_usage = NULL;
gfx->gfxdata = base;
gfx->line_modulo = rowbytes;
gfx->char_modulo = 0;
gfx->srcdata = base;
gfx->dirty = ¬_dirty;
gfx->dirtyseq = 0;
gfx->machine = machine;
} | [
"void",
"gfx_element_build_temporary",
"(",
"gfx_element",
"*",
"gfx",
",",
"running_machine",
"*",
"machine",
",",
"UINT8",
"*",
"base",
",",
"UINT32",
"width",
",",
"UINT32",
"height",
",",
"UINT32",
"rowbytes",
",",
"UINT32",
"color_base",
",",
"UINT32",
"color_granularity",
",",
"UINT32",
"flags",
")",
"{",
"static",
"UINT8",
"not_dirty",
"=",
"0",
";",
"gfx",
"->",
"width",
"=",
"width",
";",
"gfx",
"->",
"height",
"=",
"height",
";",
"gfx",
"->",
"startx",
"=",
"0",
";",
"gfx",
"->",
"starty",
"=",
"0",
";",
"gfx",
"->",
"origwidth",
"=",
"width",
";",
"gfx",
"->",
"origheight",
"=",
"height",
";",
"gfx",
"->",
"flags",
"=",
"flags",
";",
"gfx",
"->",
"total_elements",
"=",
"1",
";",
"gfx",
"->",
"color_base",
"=",
"color_base",
";",
"gfx",
"->",
"color_depth",
"=",
"color_granularity",
";",
"gfx",
"->",
"color_granularity",
"=",
"color_granularity",
";",
"gfx",
"->",
"total_colors",
"=",
"(",
"machine",
"->",
"config",
"->",
"total_colors",
"-",
"color_base",
")",
"/",
"color_granularity",
";",
"gfx",
"->",
"pen_usage",
"=",
"NULL",
";",
"gfx",
"->",
"gfxdata",
"=",
"base",
";",
"gfx",
"->",
"line_modulo",
"=",
"rowbytes",
";",
"gfx",
"->",
"char_modulo",
"=",
"0",
";",
"gfx",
"->",
"srcdata",
"=",
"base",
";",
"gfx",
"->",
"dirty",
"=",
"&",
"not_dirty",
";",
"gfx",
"->",
"dirtyseq",
"=",
"0",
";",
"gfx",
"->",
"machine",
"=",
"machine",
";",
"}"
] | gfx_element_build_temporary - create a
temporary one-off gfx_element | [
"gfx_element_build_temporary",
"-",
"create",
"a",
"temporary",
"one",
"-",
"off",
"gfx_element"
] | [] | [
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "machine",
"type": "running_machine"
},
{
"param": "base",
"type": "UINT8"
},
{
"param": "width",
"type": "UINT32"
},
{
"param": "height",
"type": "UINT32"
},
{
"param": "rowbytes",
"type": "UINT32"
},
{
"param": "color_base",
"type": "UINT32"
},
{
"param": "color_granularity",
"type": "UINT32"
},
{
"param": "flags",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "base",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "width",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "height",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rowbytes",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color_base",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color_granularity",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | calc_penusage | void | static void calc_penusage(const gfx_element *gfx, UINT32 code)
{
const UINT8 *dp = gfx->gfxdata + code * gfx->char_modulo;
UINT32 usage = 0;
int x, y;
/* if nothing allocated, don't do it */
if (gfx->pen_usage == NULL)
return;
/* packed case */
if (gfx->flags & GFX_ELEMENT_PACKED)
for (y = 0; y < gfx->origheight; y++)
{
for (x = 0; x < gfx->origwidth/2; x++)
usage |= (1 << (dp[x] & 0x0f)) | (1 << (dp[x] >> 4));
dp += gfx->line_modulo;
}
/* unpacked case */
else
for (y = 0; y < gfx->origheight; y++)
{
for (x = 0; x < gfx->origwidth; x++)
usage |= 1 << dp[x];
dp += gfx->line_modulo;
}
/* store the final result */
gfx->pen_usage[code] = usage;
} | /*-------------------------------------------------
calc_penusage - calculate the pen usage for
a given graphics tile
-------------------------------------------------*/ | calculate the pen usage for
a given graphics tile | [
"calculate",
"the",
"pen",
"usage",
"for",
"a",
"given",
"graphics",
"tile"
] | static void calc_penusage(const gfx_element *gfx, UINT32 code)
{
const UINT8 *dp = gfx->gfxdata + code * gfx->char_modulo;
UINT32 usage = 0;
int x, y;
if (gfx->pen_usage == NULL)
return;
if (gfx->flags & GFX_ELEMENT_PACKED)
for (y = 0; y < gfx->origheight; y++)
{
for (x = 0; x < gfx->origwidth/2; x++)
usage |= (1 << (dp[x] & 0x0f)) | (1 << (dp[x] >> 4));
dp += gfx->line_modulo;
}
else
for (y = 0; y < gfx->origheight; y++)
{
for (x = 0; x < gfx->origwidth; x++)
usage |= 1 << dp[x];
dp += gfx->line_modulo;
}
gfx->pen_usage[code] = usage;
} | [
"static",
"void",
"calc_penusage",
"(",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
")",
"{",
"const",
"UINT8",
"*",
"dp",
"=",
"gfx",
"->",
"gfxdata",
"+",
"code",
"*",
"gfx",
"->",
"char_modulo",
";",
"UINT32",
"usage",
"=",
"0",
";",
"int",
"x",
",",
"y",
";",
"if",
"(",
"gfx",
"->",
"pen_usage",
"==",
"NULL",
")",
"return",
";",
"if",
"(",
"gfx",
"->",
"flags",
"&",
"GFX_ELEMENT_PACKED",
")",
"for",
"(",
"y",
"=",
"0",
";",
"y",
"<",
"gfx",
"->",
"origheight",
";",
"y",
"++",
")",
"{",
"for",
"(",
"x",
"=",
"0",
";",
"x",
"<",
"gfx",
"->",
"origwidth",
"/",
"2",
";",
"x",
"++",
")",
"usage",
"|=",
"(",
"1",
"<<",
"(",
"dp",
"[",
"x",
"]",
"&",
"0x0f",
")",
")",
"|",
"(",
"1",
"<<",
"(",
"dp",
"[",
"x",
"]",
">>",
"4",
")",
")",
";",
"dp",
"+=",
"gfx",
"->",
"line_modulo",
";",
"}",
"else",
"for",
"(",
"y",
"=",
"0",
";",
"y",
"<",
"gfx",
"->",
"origheight",
";",
"y",
"++",
")",
"{",
"for",
"(",
"x",
"=",
"0",
";",
"x",
"<",
"gfx",
"->",
"origwidth",
";",
"x",
"++",
")",
"usage",
"|=",
"1",
"<<",
"dp",
"[",
"x",
"]",
";",
"dp",
"+=",
"gfx",
"->",
"line_modulo",
";",
"}",
"gfx",
"->",
"pen_usage",
"[",
"code",
"]",
"=",
"usage",
";",
"}"
] | calc_penusage - calculate the pen usage for
a given graphics tile | [
"calc_penusage",
"-",
"calculate",
"the",
"pen",
"usage",
"for",
"a",
"given",
"graphics",
"tile"
] | [
"/* if nothing allocated, don't do it */",
"/* packed case */",
"/* unpacked case */",
"/* store the final result */"
] | [
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | decodechar | void | void decodechar(const gfx_element *gfx, UINT32 code, const UINT8 *src)
{
const gfx_layout *gl = &gfx->layout;
int israw = (gl->planeoffset[0] == GFX_RAW);
int planes = gl->planes;
UINT32 charincrement = gl->charincrement;
const UINT32 *poffset = gl->planeoffset;
const UINT32 *xoffset = gl->extxoffs ? gl->extxoffs : gl->xoffset;
const UINT32 *yoffset = gl->extyoffs ? gl->extyoffs : gl->yoffset;
UINT8 *dp = gfx->gfxdata + code * gfx->char_modulo;
int plane, x, y;
if (!israw)
{
/* zap the data to 0 */
memset(dp, 0, gfx->char_modulo);
/* packed case */
if (gfx->flags & GFX_ELEMENT_PACKED)
for (plane = 0; plane < planes; plane++)
{
int planebit = 1 << (planes - 1 - plane);
int planeoffs = code * charincrement + poffset[plane];
for (y = 0; y < gfx->origheight; y++)
{
int yoffs = planeoffs + yoffset[y];
dp = gfx->gfxdata + code * gfx->char_modulo + y * gfx->line_modulo;
for (x = 0; x < gfx->origwidth; x += 2)
{
if (readbit(src, yoffs + xoffset[x+0]))
dp[x+0] |= planebit;
if (readbit(src, yoffs + xoffset[x+1]))
dp[x+1] |= planebit;
}
}
}
/* unpacked case */
else
for (plane = 0; plane < planes; plane++)
{
int planebit = 1 << (planes - 1 - plane);
int planeoffs = code * charincrement + poffset[plane];
for (y = 0; y < gfx->origheight; y++)
{
int yoffs = planeoffs + yoffset[y];
dp = gfx->gfxdata + code * gfx->char_modulo + y * gfx->line_modulo;
for (x = 0; x < gfx->origwidth; x++)
if (readbit(src, yoffs + xoffset[x]))
dp[x] |= planebit;
}
}
}
/* compute pen usage */
calc_penusage(gfx, code);
/* no longer dirty */
gfx->dirty[code] = 0;
} | /*-------------------------------------------------
decodechar - decode a single character based
on a specified layout
-------------------------------------------------*/ | decode a single character based
on a specified layout | [
"decode",
"a",
"single",
"character",
"based",
"on",
"a",
"specified",
"layout"
] | void decodechar(const gfx_element *gfx, UINT32 code, const UINT8 *src)
{
const gfx_layout *gl = &gfx->layout;
int israw = (gl->planeoffset[0] == GFX_RAW);
int planes = gl->planes;
UINT32 charincrement = gl->charincrement;
const UINT32 *poffset = gl->planeoffset;
const UINT32 *xoffset = gl->extxoffs ? gl->extxoffs : gl->xoffset;
const UINT32 *yoffset = gl->extyoffs ? gl->extyoffs : gl->yoffset;
UINT8 *dp = gfx->gfxdata + code * gfx->char_modulo;
int plane, x, y;
if (!israw)
{
memset(dp, 0, gfx->char_modulo);
if (gfx->flags & GFX_ELEMENT_PACKED)
for (plane = 0; plane < planes; plane++)
{
int planebit = 1 << (planes - 1 - plane);
int planeoffs = code * charincrement + poffset[plane];
for (y = 0; y < gfx->origheight; y++)
{
int yoffs = planeoffs + yoffset[y];
dp = gfx->gfxdata + code * gfx->char_modulo + y * gfx->line_modulo;
for (x = 0; x < gfx->origwidth; x += 2)
{
if (readbit(src, yoffs + xoffset[x+0]))
dp[x+0] |= planebit;
if (readbit(src, yoffs + xoffset[x+1]))
dp[x+1] |= planebit;
}
}
}
else
for (plane = 0; plane < planes; plane++)
{
int planebit = 1 << (planes - 1 - plane);
int planeoffs = code * charincrement + poffset[plane];
for (y = 0; y < gfx->origheight; y++)
{
int yoffs = planeoffs + yoffset[y];
dp = gfx->gfxdata + code * gfx->char_modulo + y * gfx->line_modulo;
for (x = 0; x < gfx->origwidth; x++)
if (readbit(src, yoffs + xoffset[x]))
dp[x] |= planebit;
}
}
}
calc_penusage(gfx, code);
gfx->dirty[code] = 0;
} | [
"void",
"decodechar",
"(",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"const",
"UINT8",
"*",
"src",
")",
"{",
"const",
"gfx_layout",
"*",
"gl",
"=",
"&",
"gfx",
"->",
"layout",
";",
"int",
"israw",
"=",
"(",
"gl",
"->",
"planeoffset",
"[",
"0",
"]",
"==",
"GFX_RAW",
")",
";",
"int",
"planes",
"=",
"gl",
"->",
"planes",
";",
"UINT32",
"charincrement",
"=",
"gl",
"->",
"charincrement",
";",
"const",
"UINT32",
"*",
"poffset",
"=",
"gl",
"->",
"planeoffset",
";",
"const",
"UINT32",
"*",
"xoffset",
"=",
"gl",
"->",
"extxoffs",
"?",
"gl",
"->",
"extxoffs",
":",
"gl",
"->",
"xoffset",
";",
"const",
"UINT32",
"*",
"yoffset",
"=",
"gl",
"->",
"extyoffs",
"?",
"gl",
"->",
"extyoffs",
":",
"gl",
"->",
"yoffset",
";",
"UINT8",
"*",
"dp",
"=",
"gfx",
"->",
"gfxdata",
"+",
"code",
"*",
"gfx",
"->",
"char_modulo",
";",
"int",
"plane",
",",
"x",
",",
"y",
";",
"if",
"(",
"!",
"israw",
")",
"{",
"memset",
"(",
"dp",
",",
"0",
",",
"gfx",
"->",
"char_modulo",
")",
";",
"if",
"(",
"gfx",
"->",
"flags",
"&",
"GFX_ELEMENT_PACKED",
")",
"for",
"(",
"plane",
"=",
"0",
";",
"plane",
"<",
"planes",
";",
"plane",
"++",
")",
"{",
"int",
"planebit",
"=",
"1",
"<<",
"(",
"planes",
"-",
"1",
"-",
"plane",
")",
";",
"int",
"planeoffs",
"=",
"code",
"*",
"charincrement",
"+",
"poffset",
"[",
"plane",
"]",
";",
"for",
"(",
"y",
"=",
"0",
";",
"y",
"<",
"gfx",
"->",
"origheight",
";",
"y",
"++",
")",
"{",
"int",
"yoffs",
"=",
"planeoffs",
"+",
"yoffset",
"[",
"y",
"]",
";",
"dp",
"=",
"gfx",
"->",
"gfxdata",
"+",
"code",
"*",
"gfx",
"->",
"char_modulo",
"+",
"y",
"*",
"gfx",
"->",
"line_modulo",
";",
"for",
"(",
"x",
"=",
"0",
";",
"x",
"<",
"gfx",
"->",
"origwidth",
";",
"x",
"+=",
"2",
")",
"{",
"if",
"(",
"readbit",
"(",
"src",
",",
"yoffs",
"+",
"xoffset",
"[",
"x",
"+",
"0",
"]",
")",
")",
"dp",
"[",
"x",
"+",
"0",
"]",
"|=",
"planebit",
";",
"if",
"(",
"readbit",
"(",
"src",
",",
"yoffs",
"+",
"xoffset",
"[",
"x",
"+",
"1",
"]",
")",
")",
"dp",
"[",
"x",
"+",
"1",
"]",
"|=",
"planebit",
";",
"}",
"}",
"}",
"else",
"for",
"(",
"plane",
"=",
"0",
";",
"plane",
"<",
"planes",
";",
"plane",
"++",
")",
"{",
"int",
"planebit",
"=",
"1",
"<<",
"(",
"planes",
"-",
"1",
"-",
"plane",
")",
";",
"int",
"planeoffs",
"=",
"code",
"*",
"charincrement",
"+",
"poffset",
"[",
"plane",
"]",
";",
"for",
"(",
"y",
"=",
"0",
";",
"y",
"<",
"gfx",
"->",
"origheight",
";",
"y",
"++",
")",
"{",
"int",
"yoffs",
"=",
"planeoffs",
"+",
"yoffset",
"[",
"y",
"]",
";",
"dp",
"=",
"gfx",
"->",
"gfxdata",
"+",
"code",
"*",
"gfx",
"->",
"char_modulo",
"+",
"y",
"*",
"gfx",
"->",
"line_modulo",
";",
"for",
"(",
"x",
"=",
"0",
";",
"x",
"<",
"gfx",
"->",
"origwidth",
";",
"x",
"++",
")",
"if",
"(",
"readbit",
"(",
"src",
",",
"yoffs",
"+",
"xoffset",
"[",
"x",
"]",
")",
")",
"dp",
"[",
"x",
"]",
"|=",
"planebit",
";",
"}",
"}",
"}",
"calc_penusage",
"(",
"gfx",
",",
"code",
")",
";",
"gfx",
"->",
"dirty",
"[",
"code",
"]",
"=",
"0",
";",
"}"
] | decodechar - decode a single character based
on a specified layout | [
"decodechar",
"-",
"decode",
"a",
"single",
"character",
"based",
"on",
"a",
"specified",
"layout"
] | [
"/* zap the data to 0 */",
"/* packed case */",
"/* unpacked case */",
"/* compute pen usage */",
"/* no longer dirty */"
] | [
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "src",
"type": "UINT8"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | decodegfx | void | void decodegfx(gfx_element *gfx, UINT32 first, UINT32 count)
{
int last = first + count - 1;
int c;
assert(gfx != NULL);
assert(gfx->srcdata != NULL);
assert(first < gfx->total_elements);
assert(last < gfx->total_elements);
/* if this is raw graphics data, just set the pointer and compute pen usage */
if (gfx->flags & GFX_ELEMENT_DONT_FREE)
{
/* if we got a pointer, set it */
gfx->gfxdata = (UINT8 *)gfx->srcdata;
/* compute pen usage for everything */
for (c = first; c <= last; c++)
calc_penusage(gfx, c);
}
/* otherwise, we get to manually decode */
else
for (c = first; c <= last; c++)
decodechar(gfx, c, gfx->srcdata);
} | /*-------------------------------------------------
decodegfx - decode a series of tiles from
a particular gfx_element
-------------------------------------------------*/ | decode a series of tiles from
a particular gfx_element | [
"decode",
"a",
"series",
"of",
"tiles",
"from",
"a",
"particular",
"gfx_element"
] | void decodegfx(gfx_element *gfx, UINT32 first, UINT32 count)
{
int last = first + count - 1;
int c;
assert(gfx != NULL);
assert(gfx->srcdata != NULL);
assert(first < gfx->total_elements);
assert(last < gfx->total_elements);
if (gfx->flags & GFX_ELEMENT_DONT_FREE)
{
gfx->gfxdata = (UINT8 *)gfx->srcdata;
for (c = first; c <= last; c++)
calc_penusage(gfx, c);
}
else
for (c = first; c <= last; c++)
decodechar(gfx, c, gfx->srcdata);
} | [
"void",
"decodegfx",
"(",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"first",
",",
"UINT32",
"count",
")",
"{",
"int",
"last",
"=",
"first",
"+",
"count",
"-",
"1",
";",
"int",
"c",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"assert",
"(",
"gfx",
"->",
"srcdata",
"!=",
"NULL",
")",
";",
"assert",
"(",
"first",
"<",
"gfx",
"->",
"total_elements",
")",
";",
"assert",
"(",
"last",
"<",
"gfx",
"->",
"total_elements",
")",
";",
"if",
"(",
"gfx",
"->",
"flags",
"&",
"GFX_ELEMENT_DONT_FREE",
")",
"{",
"gfx",
"->",
"gfxdata",
"=",
"(",
"UINT8",
"*",
")",
"gfx",
"->",
"srcdata",
";",
"for",
"(",
"c",
"=",
"first",
";",
"c",
"<=",
"last",
";",
"c",
"++",
")",
"calc_penusage",
"(",
"gfx",
",",
"c",
")",
";",
"}",
"else",
"for",
"(",
"c",
"=",
"first",
";",
"c",
"<=",
"last",
";",
"c",
"++",
")",
"decodechar",
"(",
"gfx",
",",
"c",
",",
"gfx",
"->",
"srcdata",
")",
";",
"}"
] | decodegfx - decode a series of tiles from
a particular gfx_element | [
"decodegfx",
"-",
"decode",
"a",
"series",
"of",
"tiles",
"from",
"a",
"particular",
"gfx_element"
] | [
"/* if this is raw graphics data, just set the pointer and compute pen usage */",
"/* if we got a pointer, set it */",
"/* compute pen usage for everything */",
"/* otherwise, we get to manually decode */"
] | [
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "first",
"type": "UINT32"
},
{
"param": "count",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "first",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "count",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | drawgfx_opaque | void | void drawgfx_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
const pen_t *paldata;
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
} | /*-------------------------------------------------
drawgfx_opaque - render a gfx element with
no transparency
-------------------------------------------------*/ | render a gfx element with
no transparency | [
"render",
"a",
"gfx",
"element",
"with",
"no",
"transparency"
] | void drawgfx_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty)
{
bitmap_t *priority = NULL;
const pen_t *paldata;
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
} | [
"void",
"drawgfx_opaque",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"const",
"pen_t",
"*",
"paldata",
";",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFX_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWGFX_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"}"
] | drawgfx_opaque - render a gfx element with
no transparency | [
"drawgfx_opaque",
"-",
"render",
"a",
"gfx",
"element",
"with",
"no",
"transparency"
] | [
"/* dummy, no priority in this case */",
"/* get final code and color, and grab lookup tables */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | drawgfx_transpen | void | void drawgfx_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 transpen)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
const pen_t *paldata;
/* special case invalid pens to opaque */
if (transpen > 0xff)
{
drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* use pen usage to optimize */
if (gfx->pen_usage != NULL && !gfx->dirty[code])
{
UINT32 usage = gfx->pen_usage[code];
/* fully transparent; do nothing */
if ((usage & ~(1 << transpen)) == 0)
return;
/* fully opaque; draw as such */
if ((usage & (1 << transpen)) == 0)
{
drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty);
return;
}
}
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY);
} | /*-------------------------------------------------
drawgfx_transpen - render a gfx element with
a single transparent pen
-------------------------------------------------*/ | render a gfx element with
a single transparent pen | [
"render",
"a",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen"
] | void drawgfx_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 transpen)
{
bitmap_t *priority = NULL;
const pen_t *paldata;
if (transpen > 0xff)
{
drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
if (gfx->pen_usage != NULL && !gfx->dirty[code])
{
UINT32 usage = gfx->pen_usage[code];
if ((usage & ~(1 << transpen)) == 0)
return;
if ((usage & (1 << transpen)) == 0)
{
drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty);
return;
}
}
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY);
} | [
"void",
"drawgfx_transpen",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"UINT32",
"transpen",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"const",
"pen_t",
"*",
"paldata",
";",
"if",
"(",
"transpen",
">",
"0xff",
")",
"{",
"drawgfx_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"if",
"(",
"gfx",
"->",
"pen_usage",
"!=",
"NULL",
"&&",
"!",
"gfx",
"->",
"dirty",
"[",
"code",
"]",
")",
"{",
"UINT32",
"usage",
"=",
"gfx",
"->",
"pen_usage",
"[",
"code",
"]",
";",
"if",
"(",
"(",
"usage",
"&",
"~",
"(",
"1",
"<<",
"transpen",
")",
")",
"==",
"0",
")",
"return",
";",
"if",
"(",
"(",
"usage",
"&",
"(",
"1",
"<<",
"transpen",
")",
")",
"==",
"0",
")",
"{",
"drawgfx_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
")",
";",
"return",
";",
"}",
"}",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFX_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_TRANSPEN",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWGFX_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANSPEN",
",",
"NO_PRIORITY",
")",
";",
"}"
] | drawgfx_transpen - render a gfx element with
a single transparent pen | [
"drawgfx_transpen",
"-",
"render",
"a",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen"
] | [
"/* dummy, no priority in this case */",
"/* special case invalid pens to opaque */",
"/* get final code and color, and grab lookup tables */",
"/* use pen usage to optimize */",
"/* fully transparent; do nothing */",
"/* fully opaque; draw as such */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "transpen",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transpen",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | drawgfx_transpen_raw | void | void drawgfx_transpen_raw(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 transpen)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
/* early out if completely transparent */
if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
return;
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY);
} | /*-------------------------------------------------
drawgfx_transpen_raw - render a gfx element
with a single transparent pen and no color
lookups
-------------------------------------------------*/ | render a gfx element
with a single transparent pen and no color
lookups | [
"render",
"a",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"and",
"no",
"color",
"lookups"
] | void drawgfx_transpen_raw(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 transpen)
{
bitmap_t *priority = NULL;
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
return;
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY);
} | [
"void",
"drawgfx_transpen_raw",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"UINT32",
"transpen",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"if",
"(",
"gfx",
"->",
"pen_usage",
"!=",
"NULL",
"&&",
"!",
"gfx",
"->",
"dirty",
"[",
"code",
"]",
"&&",
"(",
"gfx",
"->",
"pen_usage",
"[",
"code",
"]",
"&",
"~",
"(",
"1",
"<<",
"transpen",
")",
")",
"==",
"0",
")",
"return",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFX_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REBASE_TRANSPEN",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWGFX_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REBASE_TRANSPEN",
",",
"NO_PRIORITY",
")",
";",
"}"
] | drawgfx_transpen_raw - render a gfx element
with a single transparent pen and no color
lookups | [
"drawgfx_transpen_raw",
"-",
"render",
"a",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"and",
"no",
"color",
"lookups"
] | [
"/* dummy, no priority in this case */",
"/* get final code and color, and grab lookup tables */",
"/* early out if completely transparent */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "transpen",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transpen",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | drawgfx_transmask | void | void drawgfx_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 transmask)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
const pen_t *paldata;
/* special case 0 mask to opaque */
if (transmask == 0)
{
drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* use pen usage to optimize */
if (gfx->pen_usage != NULL && !gfx->dirty[code])
{
UINT32 usage = gfx->pen_usage[code];
/* fully transparent; do nothing */
if ((usage & ~transmask) == 0)
return;
/* fully opaque; draw as such */
if ((usage & transmask) == 0)
{
drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty);
return;
}
}
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY);
} | /*-------------------------------------------------
drawgfx_transmask - render a gfx element
with a multiple transparent pens provided as
a mask
-------------------------------------------------*/ | render a gfx element
with a multiple transparent pens provided as
a mask | [
"render",
"a",
"gfx",
"element",
"with",
"a",
"multiple",
"transparent",
"pens",
"provided",
"as",
"a",
"mask"
] | void drawgfx_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 transmask)
{
bitmap_t *priority = NULL;
const pen_t *paldata;
if (transmask == 0)
{
drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
if (gfx->pen_usage != NULL && !gfx->dirty[code])
{
UINT32 usage = gfx->pen_usage[code];
if ((usage & ~transmask) == 0)
return;
if ((usage & transmask) == 0)
{
drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty);
return;
}
}
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY);
} | [
"void",
"drawgfx_transmask",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"UINT32",
"transmask",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"const",
"pen_t",
"*",
"paldata",
";",
"if",
"(",
"transmask",
"==",
"0",
")",
"{",
"drawgfx_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"if",
"(",
"gfx",
"->",
"pen_usage",
"!=",
"NULL",
"&&",
"!",
"gfx",
"->",
"dirty",
"[",
"code",
"]",
")",
"{",
"UINT32",
"usage",
"=",
"gfx",
"->",
"pen_usage",
"[",
"code",
"]",
";",
"if",
"(",
"(",
"usage",
"&",
"~",
"transmask",
")",
"==",
"0",
")",
"return",
";",
"if",
"(",
"(",
"usage",
"&",
"transmask",
")",
"==",
"0",
")",
"{",
"drawgfx_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
")",
";",
"return",
";",
"}",
"}",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFX_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_TRANSMASK",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWGFX_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANSMASK",
",",
"NO_PRIORITY",
")",
";",
"}"
] | drawgfx_transmask - render a gfx element
with a multiple transparent pens provided as
a mask | [
"drawgfx_transmask",
"-",
"render",
"a",
"gfx",
"element",
"with",
"a",
"multiple",
"transparent",
"pens",
"provided",
"as",
"a",
"mask"
] | [
"/* dummy, no priority in this case */",
"/* special case 0 mask to opaque */",
"/* get final code and color, and grab lookup tables */",
"/* use pen usage to optimize */",
"/* fully transparent; do nothing */",
"/* fully opaque; draw as such */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "transmask",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transmask",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | drawgfx_transtable | void | void drawgfx_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
const UINT8 *pentable, const pen_t *shadowtable)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
const pen_t *paldata;
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
assert(pentable != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16, NO_PRIORITY);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY);
} | /*-------------------------------------------------
drawgfx_transtable - render a gfx element
using a table to look up which pens are
transparent, opaque, or shadowing
-------------------------------------------------*/ | render a gfx element
using a table to look up which pens are
transparent, opaque, or shadowing | [
"render",
"a",
"gfx",
"element",
"using",
"a",
"table",
"to",
"look",
"up",
"which",
"pens",
"are",
"transparent",
"opaque",
"or",
"shadowing"
] | void drawgfx_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
const UINT8 *pentable, const pen_t *shadowtable)
{
bitmap_t *priority = NULL;
const pen_t *paldata;
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
assert(pentable != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16, NO_PRIORITY);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY);
} | [
"void",
"drawgfx_transtable",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"const",
"UINT8",
"*",
"pentable",
",",
"const",
"pen_t",
"*",
"shadowtable",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"const",
"pen_t",
"*",
"paldata",
";",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"assert",
"(",
"pentable",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFX_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_TRANSTABLE16",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWGFX_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANSTABLE32",
",",
"NO_PRIORITY",
")",
";",
"}"
] | drawgfx_transtable - render a gfx element
using a table to look up which pens are
transparent, opaque, or shadowing | [
"drawgfx_transtable",
"-",
"render",
"a",
"gfx",
"element",
"using",
"a",
"table",
"to",
"look",
"up",
"which",
"pens",
"are",
"transparent",
"opaque",
"or",
"shadowing"
] | [
"/* dummy, no priority in this case */",
"/* get final code and color, and grab lookup tables */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "pentable",
"type": "UINT8"
},
{
"param": "shadowtable",
"type": "pen_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pentable",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "shadowtable",
"type": "pen_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | drawgfx_alpha | void | void drawgfx_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 transpen, UINT8 alpha)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
const pen_t *paldata;
/* special case alpha = 0xff */
if (alpha == 0xff)
{
drawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transpen);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* early out if completely transparent */
if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
return;
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_ALPHA16, NO_PRIORITY);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY);
} | /*-------------------------------------------------
drawgfx_alpha - render a gfx element with
a single transparent pen, alpha blending the
remaining pixels with a fixed alpha value
-------------------------------------------------*/ | render a gfx element with
a single transparent pen, alpha blending the
remaining pixels with a fixed alpha value | [
"render",
"a",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"alpha",
"blending",
"the",
"remaining",
"pixels",
"with",
"a",
"fixed",
"alpha",
"value"
] | void drawgfx_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 transpen, UINT8 alpha)
{
bitmap_t *priority = NULL;
const pen_t *paldata;
if (alpha == 0xff)
{
drawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transpen);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
return;
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_ALPHA16, NO_PRIORITY);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY);
} | [
"void",
"drawgfx_alpha",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"UINT32",
"transpen",
",",
"UINT8",
"alpha",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"const",
"pen_t",
"*",
"paldata",
";",
"if",
"(",
"alpha",
"==",
"0xff",
")",
"{",
"drawgfx_transpen",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"transpen",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"if",
"(",
"gfx",
"->",
"pen_usage",
"!=",
"NULL",
"&&",
"!",
"gfx",
"->",
"dirty",
"[",
"code",
"]",
"&&",
"(",
"gfx",
"->",
"pen_usage",
"[",
"code",
"]",
"&",
"~",
"(",
"1",
"<<",
"transpen",
")",
")",
"==",
"0",
")",
"return",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFX_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_TRANSPEN_ALPHA16",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWGFX_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANSPEN_ALPHA32",
",",
"NO_PRIORITY",
")",
";",
"}"
] | drawgfx_alpha - render a gfx element with
a single transparent pen, alpha blending the
remaining pixels with a fixed alpha value | [
"drawgfx_alpha",
"-",
"render",
"a",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"alpha",
"blending",
"the",
"remaining",
"pixels",
"with",
"a",
"fixed",
"alpha",
"value"
] | [
"/* dummy, no priority in this case */",
"/* special case alpha = 0xff */",
"/* get final code and color, and grab lookup tables */",
"/* early out if completely transparent */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "transpen",
"type": "UINT32"
},
{
"param": "alpha",
"type": "UINT8"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transpen",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "alpha",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | drawgfxzoom_opaque | void | void drawgfxzoom_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
const pen_t *paldata;
/* non-zoom case */
if (scalex == 0x10000 && scaley == 0x10000)
{
drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
} | /*-------------------------------------------------
drawgfxzoom_opaque - render a scaled gfx
element with no transparency
-------------------------------------------------*/ | render a scaled gfx
element with no transparency | [
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"no",
"transparency"
] | void drawgfxzoom_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley)
{
bitmap_t *priority = NULL;
const pen_t *paldata;
if (scalex == 0x10000 && scaley == 0x10000)
{
drawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
} | [
"void",
"drawgfxzoom_opaque",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"UINT32",
"scalex",
",",
"UINT32",
"scaley",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"const",
"pen_t",
"*",
"paldata",
";",
"if",
"(",
"scalex",
"==",
"0x10000",
"&&",
"scaley",
"==",
"0x10000",
")",
"{",
"drawgfx_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFXZOOM_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWGFXZOOM_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"}"
] | drawgfxzoom_opaque - render a scaled gfx
element with no transparency | [
"drawgfxzoom_opaque",
"-",
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"no",
"transparency"
] | [
"/* dummy, no priority in this case */",
"/* non-zoom case */",
"/* get final code and color, and grab lookup tables */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "scalex",
"type": "UINT32"
},
{
"param": "scaley",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scalex",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scaley",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | drawgfxzoom_transpen | void | void drawgfxzoom_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, UINT32 transpen)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
const pen_t *paldata;
/* non-zoom case */
if (scalex == 0x10000 && scaley == 0x10000)
{
drawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transpen);
return;
}
/* special case invalid pens to opaque */
if (transpen > 0xff)
{
drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* use pen usage to optimize */
if (gfx->pen_usage != NULL && !gfx->dirty[code])
{
UINT32 usage = gfx->pen_usage[code];
/* fully transparent; do nothing */
if ((usage & ~(1 << transpen)) == 0)
return;
/* fully opaque; draw as such */
if ((usage & (1 << transpen)) == 0)
{
drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley);
return;
}
}
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY);
} | /*-------------------------------------------------
drawgfxzoom_transpen - render a scaled gfx
element with a single transparent pen
-------------------------------------------------*/ | render a scaled gfx
element with a single transparent pen | [
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen"
] | void drawgfxzoom_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, UINT32 transpen)
{
bitmap_t *priority = NULL;
const pen_t *paldata;
if (scalex == 0x10000 && scaley == 0x10000)
{
drawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transpen);
return;
}
if (transpen > 0xff)
{
drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
if (gfx->pen_usage != NULL && !gfx->dirty[code])
{
UINT32 usage = gfx->pen_usage[code];
if ((usage & ~(1 << transpen)) == 0)
return;
if ((usage & (1 << transpen)) == 0)
{
drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley);
return;
}
}
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY);
} | [
"void",
"drawgfxzoom_transpen",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"UINT32",
"scalex",
",",
"UINT32",
"scaley",
",",
"UINT32",
"transpen",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"const",
"pen_t",
"*",
"paldata",
";",
"if",
"(",
"scalex",
"==",
"0x10000",
"&&",
"scaley",
"==",
"0x10000",
")",
"{",
"drawgfx_transpen",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"transpen",
")",
";",
"return",
";",
"}",
"if",
"(",
"transpen",
">",
"0xff",
")",
"{",
"drawgfxzoom_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"scalex",
",",
"scaley",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"if",
"(",
"gfx",
"->",
"pen_usage",
"!=",
"NULL",
"&&",
"!",
"gfx",
"->",
"dirty",
"[",
"code",
"]",
")",
"{",
"UINT32",
"usage",
"=",
"gfx",
"->",
"pen_usage",
"[",
"code",
"]",
";",
"if",
"(",
"(",
"usage",
"&",
"~",
"(",
"1",
"<<",
"transpen",
")",
")",
"==",
"0",
")",
"return",
";",
"if",
"(",
"(",
"usage",
"&",
"(",
"1",
"<<",
"transpen",
")",
")",
"==",
"0",
")",
"{",
"drawgfxzoom_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"scalex",
",",
"scaley",
")",
";",
"return",
";",
"}",
"}",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFXZOOM_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_TRANSPEN",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWGFXZOOM_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANSPEN",
",",
"NO_PRIORITY",
")",
";",
"}"
] | drawgfxzoom_transpen - render a scaled gfx
element with a single transparent pen | [
"drawgfxzoom_transpen",
"-",
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen"
] | [
"/* dummy, no priority in this case */",
"/* non-zoom case */",
"/* special case invalid pens to opaque */",
"/* get final code and color, and grab lookup tables */",
"/* use pen usage to optimize */",
"/* fully transparent; do nothing */",
"/* fully opaque; draw as such */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "scalex",
"type": "UINT32"
},
{
"param": "scaley",
"type": "UINT32"
},
{
"param": "transpen",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scalex",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scaley",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transpen",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | drawgfxzoom_transpen_raw | void | void drawgfxzoom_transpen_raw(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, UINT32 transpen)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
/* non-zoom case */
if (scalex == 0x10000 && scaley == 0x10000)
{
drawgfx_transpen_raw(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transpen);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
/* early out if completely transparent */
if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
return;
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY);
} | /*-------------------------------------------------
drawgfxzoom_transpen_raw - render a scaled gfx
element with a single transparent pen and no
color lookups
-------------------------------------------------*/ | render a scaled gfx
element with a single transparent pen and no
color lookups | [
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"and",
"no",
"color",
"lookups"
] | void drawgfxzoom_transpen_raw(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, UINT32 transpen)
{
bitmap_t *priority = NULL;
if (scalex == 0x10000 && scaley == 0x10000)
{
drawgfx_transpen_raw(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transpen);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
return;
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY);
} | [
"void",
"drawgfxzoom_transpen_raw",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"UINT32",
"scalex",
",",
"UINT32",
"scaley",
",",
"UINT32",
"transpen",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"if",
"(",
"scalex",
"==",
"0x10000",
"&&",
"scaley",
"==",
"0x10000",
")",
"{",
"drawgfx_transpen_raw",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"transpen",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"if",
"(",
"gfx",
"->",
"pen_usage",
"!=",
"NULL",
"&&",
"!",
"gfx",
"->",
"dirty",
"[",
"code",
"]",
"&&",
"(",
"gfx",
"->",
"pen_usage",
"[",
"code",
"]",
"&",
"~",
"(",
"1",
"<<",
"transpen",
")",
")",
"==",
"0",
")",
"return",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFXZOOM_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REBASE_TRANSPEN",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWGFXZOOM_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REBASE_TRANSPEN",
",",
"NO_PRIORITY",
")",
";",
"}"
] | drawgfxzoom_transpen_raw - render a scaled gfx
element with a single transparent pen and no
color lookups | [
"drawgfxzoom_transpen_raw",
"-",
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"and",
"no",
"color",
"lookups"
] | [
"/* dummy, no priority in this case */",
"/* non-zoom case */",
"/* get final code and color, and grab lookup tables */",
"/* early out if completely transparent */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "scalex",
"type": "UINT32"
},
{
"param": "scaley",
"type": "UINT32"
},
{
"param": "transpen",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scalex",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scaley",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transpen",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | drawgfxzoom_transmask | void | void drawgfxzoom_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, UINT32 transmask)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
const pen_t *paldata;
/* non-zoom case */
if (scalex == 0x10000 && scaley == 0x10000)
{
drawgfx_transmask(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transmask);
return;
}
/* special case 0 mask to opaque */
if (transmask == 0)
{
drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* use pen usage to optimize */
if (gfx->pen_usage != NULL && !gfx->dirty[code])
{
UINT32 usage = gfx->pen_usage[code];
/* fully transparent; do nothing */
if ((usage & ~transmask) == 0)
return;
/* fully opaque; draw as such */
if ((usage & transmask) == 0)
{
drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley);
return;
}
}
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY);
} | /*-------------------------------------------------
drawgfxzoom_transmask - render a scaled gfx
element with a multiple transparent pens
provided as a mask
-------------------------------------------------*/ | render a scaled gfx
element with a multiple transparent pens
provided as a mask | [
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"a",
"multiple",
"transparent",
"pens",
"provided",
"as",
"a",
"mask"
] | void drawgfxzoom_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, UINT32 transmask)
{
bitmap_t *priority = NULL;
const pen_t *paldata;
if (scalex == 0x10000 && scaley == 0x10000)
{
drawgfx_transmask(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transmask);
return;
}
if (transmask == 0)
{
drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
if (gfx->pen_usage != NULL && !gfx->dirty[code])
{
UINT32 usage = gfx->pen_usage[code];
if ((usage & ~transmask) == 0)
return;
if ((usage & transmask) == 0)
{
drawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley);
return;
}
}
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY);
} | [
"void",
"drawgfxzoom_transmask",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"UINT32",
"scalex",
",",
"UINT32",
"scaley",
",",
"UINT32",
"transmask",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"const",
"pen_t",
"*",
"paldata",
";",
"if",
"(",
"scalex",
"==",
"0x10000",
"&&",
"scaley",
"==",
"0x10000",
")",
"{",
"drawgfx_transmask",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"transmask",
")",
";",
"return",
";",
"}",
"if",
"(",
"transmask",
"==",
"0",
")",
"{",
"drawgfxzoom_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"scalex",
",",
"scaley",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"if",
"(",
"gfx",
"->",
"pen_usage",
"!=",
"NULL",
"&&",
"!",
"gfx",
"->",
"dirty",
"[",
"code",
"]",
")",
"{",
"UINT32",
"usage",
"=",
"gfx",
"->",
"pen_usage",
"[",
"code",
"]",
";",
"if",
"(",
"(",
"usage",
"&",
"~",
"transmask",
")",
"==",
"0",
")",
"return",
";",
"if",
"(",
"(",
"usage",
"&",
"transmask",
")",
"==",
"0",
")",
"{",
"drawgfxzoom_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"scalex",
",",
"scaley",
")",
";",
"return",
";",
"}",
"}",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFXZOOM_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_TRANSMASK",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWGFXZOOM_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANSMASK",
",",
"NO_PRIORITY",
")",
";",
"}"
] | drawgfxzoom_transmask - render a scaled gfx
element with a multiple transparent pens
provided as a mask | [
"drawgfxzoom_transmask",
"-",
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"a",
"multiple",
"transparent",
"pens",
"provided",
"as",
"a",
"mask"
] | [
"/* dummy, no priority in this case */",
"/* non-zoom case */",
"/* special case 0 mask to opaque */",
"/* get final code and color, and grab lookup tables */",
"/* use pen usage to optimize */",
"/* fully transparent; do nothing */",
"/* fully opaque; draw as such */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "scalex",
"type": "UINT32"
},
{
"param": "scaley",
"type": "UINT32"
},
{
"param": "transmask",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scalex",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scaley",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transmask",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | drawgfxzoom_transtable | void | void drawgfxzoom_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
const pen_t *paldata;
/* non-zoom case */
if (scalex == 0x10000 && scaley == 0x10000)
{
drawgfx_transtable(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, pentable, shadowtable);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
assert(pentable != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16, NO_PRIORITY);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY);
} | /*-------------------------------------------------
drawgfxzoom_transtable - render a scaled gfx
element using a table to look up which pens
are transparent, opaque, or shadowing
-------------------------------------------------*/ | render a scaled gfx
element using a table to look up which pens
are transparent, opaque, or shadowing | [
"render",
"a",
"scaled",
"gfx",
"element",
"using",
"a",
"table",
"to",
"look",
"up",
"which",
"pens",
"are",
"transparent",
"opaque",
"or",
"shadowing"
] | void drawgfxzoom_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable)
{
bitmap_t *priority = NULL;
const pen_t *paldata;
if (scalex == 0x10000 && scaley == 0x10000)
{
drawgfx_transtable(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, pentable, shadowtable);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
assert(pentable != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16, NO_PRIORITY);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY);
} | [
"void",
"drawgfxzoom_transtable",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"UINT32",
"scalex",
",",
"UINT32",
"scaley",
",",
"const",
"UINT8",
"*",
"pentable",
",",
"const",
"pen_t",
"*",
"shadowtable",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"const",
"pen_t",
"*",
"paldata",
";",
"if",
"(",
"scalex",
"==",
"0x10000",
"&&",
"scaley",
"==",
"0x10000",
")",
"{",
"drawgfx_transtable",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"pentable",
",",
"shadowtable",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"assert",
"(",
"pentable",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFXZOOM_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_TRANSTABLE16",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWGFXZOOM_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANSTABLE32",
",",
"NO_PRIORITY",
")",
";",
"}"
] | drawgfxzoom_transtable - render a scaled gfx
element using a table to look up which pens
are transparent, opaque, or shadowing | [
"drawgfxzoom_transtable",
"-",
"render",
"a",
"scaled",
"gfx",
"element",
"using",
"a",
"table",
"to",
"look",
"up",
"which",
"pens",
"are",
"transparent",
"opaque",
"or",
"shadowing"
] | [
"/* dummy, no priority in this case */",
"/* non-zoom case */",
"/* get final code and color, and grab lookup tables */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "scalex",
"type": "UINT32"
},
{
"param": "scaley",
"type": "UINT32"
},
{
"param": "pentable",
"type": "UINT8"
},
{
"param": "shadowtable",
"type": "pen_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scalex",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scaley",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pentable",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "shadowtable",
"type": "pen_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | drawgfxzoom_alpha | void | void drawgfxzoom_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, UINT32 transpen, UINT8 alpha)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
const pen_t *paldata;
/* non-zoom case */
if (scalex == 0x10000 && scaley == 0x10000)
{
drawgfx_alpha(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transpen, alpha);
return;
}
/* special case alpha = 0xff */
if (alpha == 0xff)
{
drawgfxzoom_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, transpen);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* early out if completely transparent */
if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
return;
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_ALPHA16, NO_PRIORITY);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY);
} | /*-------------------------------------------------
drawgfxzoom_alpha - render a scaled gfx element
with a single transparent pen, alpha blending
the remaining pixels with a fixed alpha value
-------------------------------------------------*/ | render a scaled gfx element
with a single transparent pen, alpha blending
the remaining pixels with a fixed alpha value | [
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"alpha",
"blending",
"the",
"remaining",
"pixels",
"with",
"a",
"fixed",
"alpha",
"value"
] | void drawgfxzoom_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, UINT32 transpen, UINT8 alpha)
{
bitmap_t *priority = NULL;
const pen_t *paldata;
if (scalex == 0x10000 && scaley == 0x10000)
{
drawgfx_alpha(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, transpen, alpha);
return;
}
if (alpha == 0xff)
{
drawgfxzoom_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, transpen);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
return;
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_ALPHA16, NO_PRIORITY);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY);
} | [
"void",
"drawgfxzoom_alpha",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"UINT32",
"scalex",
",",
"UINT32",
"scaley",
",",
"UINT32",
"transpen",
",",
"UINT8",
"alpha",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"const",
"pen_t",
"*",
"paldata",
";",
"if",
"(",
"scalex",
"==",
"0x10000",
"&&",
"scaley",
"==",
"0x10000",
")",
"{",
"drawgfx_alpha",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"transpen",
",",
"alpha",
")",
";",
"return",
";",
"}",
"if",
"(",
"alpha",
"==",
"0xff",
")",
"{",
"drawgfxzoom_transpen",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"scalex",
",",
"scaley",
",",
"transpen",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"if",
"(",
"gfx",
"->",
"pen_usage",
"!=",
"NULL",
"&&",
"!",
"gfx",
"->",
"dirty",
"[",
"code",
"]",
"&&",
"(",
"gfx",
"->",
"pen_usage",
"[",
"code",
"]",
"&",
"~",
"(",
"1",
"<<",
"transpen",
")",
")",
"==",
"0",
")",
"return",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFXZOOM_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_TRANSPEN_ALPHA16",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWGFXZOOM_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANSPEN_ALPHA32",
",",
"NO_PRIORITY",
")",
";",
"}"
] | drawgfxzoom_alpha - render a scaled gfx element
with a single transparent pen, alpha blending
the remaining pixels with a fixed alpha value | [
"drawgfxzoom_alpha",
"-",
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"alpha",
"blending",
"the",
"remaining",
"pixels",
"with",
"a",
"fixed",
"alpha",
"value"
] | [
"/* dummy, no priority in this case */",
"/* non-zoom case */",
"/* special case alpha = 0xff */",
"/* get final code and color, and grab lookup tables */",
"/* early out if completely transparent */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "scalex",
"type": "UINT32"
},
{
"param": "scaley",
"type": "UINT32"
},
{
"param": "transpen",
"type": "UINT32"
},
{
"param": "alpha",
"type": "UINT8"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scalex",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scaley",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transpen",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "alpha",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | pdrawgfx_opaque | void | void pdrawgfx_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_t *priority, UINT32 pmask)
{
const pen_t *paldata;
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* high bit of the mask is implicitly on */
pmask |= 1 << 31;
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8);
} | /*-------------------------------------------------
pdrawgfx_opaque - render a gfx element with
no transparency, checking against the priority
bitmap
-------------------------------------------------*/ | render a gfx element with
no transparency, checking against the priority
bitmap | [
"render",
"a",
"gfx",
"element",
"with",
"no",
"transparency",
"checking",
"against",
"the",
"priority",
"bitmap"
] | void pdrawgfx_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_t *priority, UINT32 pmask)
{
const pen_t *paldata;
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
pmask |= 1 << 31;
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8);
} | [
"void",
"pdrawgfx_opaque",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"bitmap_t",
"*",
"priority",
",",
"UINT32",
"pmask",
")",
"{",
"const",
"pen_t",
"*",
"paldata",
";",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"pmask",
"|=",
"1",
"<<",
"31",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFX_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_OPAQUE_PRIORITY",
",",
"UINT8",
")",
";",
"else",
"DRAWGFX_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_OPAQUE_PRIORITY",
",",
"UINT8",
")",
";",
"}"
] | pdrawgfx_opaque - render a gfx element with
no transparency, checking against the priority
bitmap | [
"pdrawgfx_opaque",
"-",
"render",
"a",
"gfx",
"element",
"with",
"no",
"transparency",
"checking",
"against",
"the",
"priority",
"bitmap"
] | [
"/* get final code and color, and grab lookup tables */",
"/* high bit of the mask is implicitly on */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "priority",
"type": "bitmap_t"
},
{
"param": "pmask",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pmask",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | pdrawgfx_transpen | void | void pdrawgfx_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_t *priority, UINT32 pmask, UINT32 transpen)
{
const pen_t *paldata;
/* special case invalid pens to opaque */
if (transpen > 0xff)
{
pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* use pen usage to optimize */
if (gfx->pen_usage != NULL && !gfx->dirty[code])
{
UINT32 usage = gfx->pen_usage[code];
/* fully transparent; do nothing */
if ((usage & ~(1 << transpen)) == 0)
return;
/* fully opaque; draw as such */
if ((usage & (1 << transpen)) == 0)
{
pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask);
return;
}
}
/* high bit of the mask is implicitly on */
pmask |= 1 << 31;
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8);
} | /*-------------------------------------------------
pdrawgfx_transpen - render a gfx element with
a single transparent pen, checking against the
priority bitmap
-------------------------------------------------*/ | render a gfx element with
a single transparent pen, checking against the
priority bitmap | [
"render",
"a",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"checking",
"against",
"the",
"priority",
"bitmap"
] | void pdrawgfx_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_t *priority, UINT32 pmask, UINT32 transpen)
{
const pen_t *paldata;
if (transpen > 0xff)
{
pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
if (gfx->pen_usage != NULL && !gfx->dirty[code])
{
UINT32 usage = gfx->pen_usage[code];
if ((usage & ~(1 << transpen)) == 0)
return;
if ((usage & (1 << transpen)) == 0)
{
pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask);
return;
}
}
pmask |= 1 << 31;
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8);
} | [
"void",
"pdrawgfx_transpen",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"bitmap_t",
"*",
"priority",
",",
"UINT32",
"pmask",
",",
"UINT32",
"transpen",
")",
"{",
"const",
"pen_t",
"*",
"paldata",
";",
"if",
"(",
"transpen",
">",
"0xff",
")",
"{",
"pdrawgfx_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"priority",
",",
"pmask",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"if",
"(",
"gfx",
"->",
"pen_usage",
"!=",
"NULL",
"&&",
"!",
"gfx",
"->",
"dirty",
"[",
"code",
"]",
")",
"{",
"UINT32",
"usage",
"=",
"gfx",
"->",
"pen_usage",
"[",
"code",
"]",
";",
"if",
"(",
"(",
"usage",
"&",
"~",
"(",
"1",
"<<",
"transpen",
")",
")",
"==",
"0",
")",
"return",
";",
"if",
"(",
"(",
"usage",
"&",
"(",
"1",
"<<",
"transpen",
")",
")",
"==",
"0",
")",
"{",
"pdrawgfx_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"priority",
",",
"pmask",
")",
";",
"return",
";",
"}",
"}",
"pmask",
"|=",
"1",
"<<",
"31",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFX_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_TRANSPEN_PRIORITY",
",",
"UINT8",
")",
";",
"else",
"DRAWGFX_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANSPEN_PRIORITY",
",",
"UINT8",
")",
";",
"}"
] | pdrawgfx_transpen - render a gfx element with
a single transparent pen, checking against the
priority bitmap | [
"pdrawgfx_transpen",
"-",
"render",
"a",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"checking",
"against",
"the",
"priority",
"bitmap"
] | [
"/* special case invalid pens to opaque */",
"/* get final code and color, and grab lookup tables */",
"/* use pen usage to optimize */",
"/* fully transparent; do nothing */",
"/* fully opaque; draw as such */",
"/* high bit of the mask is implicitly on */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "priority",
"type": "bitmap_t"
},
{
"param": "pmask",
"type": "UINT32"
},
{
"param": "transpen",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pmask",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transpen",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | pdrawgfx_transpen_raw | void | void pdrawgfx_transpen_raw(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_t *priority, UINT32 pmask, UINT32 transpen)
{
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
/* early out if completely transparent */
if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
return;
/* high bit of the mask is implicitly on */
pmask |= 1 << 31;
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, UINT8);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, UINT8);
} | /*-------------------------------------------------
pdrawgfx_transpen_raw - render a gfx element
with a single transparent pen and no color
lookups, checking against the priority bitmap
-------------------------------------------------*/ | render a gfx element
with a single transparent pen and no color
lookups, checking against the priority bitmap | [
"render",
"a",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"and",
"no",
"color",
"lookups",
"checking",
"against",
"the",
"priority",
"bitmap"
] | void pdrawgfx_transpen_raw(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_t *priority, UINT32 pmask, UINT32 transpen)
{
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
return;
pmask |= 1 << 31;
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, UINT8);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, UINT8);
} | [
"void",
"pdrawgfx_transpen_raw",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"bitmap_t",
"*",
"priority",
",",
"UINT32",
"pmask",
",",
"UINT32",
"transpen",
")",
"{",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"if",
"(",
"gfx",
"->",
"pen_usage",
"!=",
"NULL",
"&&",
"!",
"gfx",
"->",
"dirty",
"[",
"code",
"]",
"&&",
"(",
"gfx",
"->",
"pen_usage",
"[",
"code",
"]",
"&",
"~",
"(",
"1",
"<<",
"transpen",
")",
")",
"==",
"0",
")",
"return",
";",
"pmask",
"|=",
"1",
"<<",
"31",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFX_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REBASE_TRANSPEN_PRIORITY",
",",
"UINT8",
")",
";",
"else",
"DRAWGFX_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REBASE_TRANSPEN_PRIORITY",
",",
"UINT8",
")",
";",
"}"
] | pdrawgfx_transpen_raw - render a gfx element
with a single transparent pen and no color
lookups, checking against the priority bitmap | [
"pdrawgfx_transpen_raw",
"-",
"render",
"a",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"and",
"no",
"color",
"lookups",
"checking",
"against",
"the",
"priority",
"bitmap"
] | [
"/* get final code and color, and grab lookup tables */",
"/* early out if completely transparent */",
"/* high bit of the mask is implicitly on */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "priority",
"type": "bitmap_t"
},
{
"param": "pmask",
"type": "UINT32"
},
{
"param": "transpen",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pmask",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transpen",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | pdrawgfx_transmask | void | void pdrawgfx_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_t *priority, UINT32 pmask, UINT32 transmask)
{
const pen_t *paldata;
/* special case 0 mask to opaque */
if (transmask == 0)
{
pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* use pen usage to optimize */
if (gfx->pen_usage != NULL && !gfx->dirty[code])
{
UINT32 usage = gfx->pen_usage[code];
/* fully transparent; do nothing */
if ((usage & ~transmask) == 0)
return;
/* fully opaque; draw as such */
if ((usage & transmask) == 0)
{
pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask);
return;
}
}
/* high bit of the mask is implicitly on */
pmask |= 1 << 31;
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8);
} | /*-------------------------------------------------
pdrawgfx_transmask - render a gfx element
with a multiple transparent pens provided as
a mask, checking against the priority bitmap
-------------------------------------------------*/ | render a gfx element
with a multiple transparent pens provided as
a mask, checking against the priority bitmap | [
"render",
"a",
"gfx",
"element",
"with",
"a",
"multiple",
"transparent",
"pens",
"provided",
"as",
"a",
"mask",
"checking",
"against",
"the",
"priority",
"bitmap"
] | void pdrawgfx_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_t *priority, UINT32 pmask, UINT32 transmask)
{
const pen_t *paldata;
if (transmask == 0)
{
pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
if (gfx->pen_usage != NULL && !gfx->dirty[code])
{
UINT32 usage = gfx->pen_usage[code];
if ((usage & ~transmask) == 0)
return;
if ((usage & transmask) == 0)
{
pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask);
return;
}
}
pmask |= 1 << 31;
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8);
} | [
"void",
"pdrawgfx_transmask",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"bitmap_t",
"*",
"priority",
",",
"UINT32",
"pmask",
",",
"UINT32",
"transmask",
")",
"{",
"const",
"pen_t",
"*",
"paldata",
";",
"if",
"(",
"transmask",
"==",
"0",
")",
"{",
"pdrawgfx_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"priority",
",",
"pmask",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"if",
"(",
"gfx",
"->",
"pen_usage",
"!=",
"NULL",
"&&",
"!",
"gfx",
"->",
"dirty",
"[",
"code",
"]",
")",
"{",
"UINT32",
"usage",
"=",
"gfx",
"->",
"pen_usage",
"[",
"code",
"]",
";",
"if",
"(",
"(",
"usage",
"&",
"~",
"transmask",
")",
"==",
"0",
")",
"return",
";",
"if",
"(",
"(",
"usage",
"&",
"transmask",
")",
"==",
"0",
")",
"{",
"pdrawgfx_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"priority",
",",
"pmask",
")",
";",
"return",
";",
"}",
"}",
"pmask",
"|=",
"1",
"<<",
"31",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFX_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_TRANSMASK_PRIORITY",
",",
"UINT8",
")",
";",
"else",
"DRAWGFX_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANSMASK_PRIORITY",
",",
"UINT8",
")",
";",
"}"
] | pdrawgfx_transmask - render a gfx element
with a multiple transparent pens provided as
a mask, checking against the priority bitmap | [
"pdrawgfx_transmask",
"-",
"render",
"a",
"gfx",
"element",
"with",
"a",
"multiple",
"transparent",
"pens",
"provided",
"as",
"a",
"mask",
"checking",
"against",
"the",
"priority",
"bitmap"
] | [
"/* special case 0 mask to opaque */",
"/* get final code and color, and grab lookup tables */",
"/* use pen usage to optimize */",
"/* fully transparent; do nothing */",
"/* fully opaque; draw as such */",
"/* high bit of the mask is implicitly on */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "priority",
"type": "bitmap_t"
},
{
"param": "pmask",
"type": "UINT32"
},
{
"param": "transmask",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pmask",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transmask",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | pdrawgfx_transtable | void | void pdrawgfx_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_t *priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable)
{
const pen_t *paldata;
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
assert(pentable != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* high bit of the mask is implicitly on */
pmask |= 1 << 31;
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16_PRIORITY, UINT8);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, UINT8);
} | /*-------------------------------------------------
pdrawgfx_transtable - render a gfx element
using a table to look up which pens are
transparent, opaque, or shadowing, checking
against the priority bitmap
-------------------------------------------------*/ | render a gfx element
using a table to look up which pens are
transparent, opaque, or shadowing, checking
against the priority bitmap | [
"render",
"a",
"gfx",
"element",
"using",
"a",
"table",
"to",
"look",
"up",
"which",
"pens",
"are",
"transparent",
"opaque",
"or",
"shadowing",
"checking",
"against",
"the",
"priority",
"bitmap"
] | void pdrawgfx_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_t *priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable)
{
const pen_t *paldata;
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
assert(pentable != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
pmask |= 1 << 31;
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16_PRIORITY, UINT8);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, UINT8);
} | [
"void",
"pdrawgfx_transtable",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"bitmap_t",
"*",
"priority",
",",
"UINT32",
"pmask",
",",
"const",
"UINT8",
"*",
"pentable",
",",
"const",
"pen_t",
"*",
"shadowtable",
")",
"{",
"const",
"pen_t",
"*",
"paldata",
";",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"assert",
"(",
"pentable",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"pmask",
"|=",
"1",
"<<",
"31",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFX_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_TRANSTABLE16_PRIORITY",
",",
"UINT8",
")",
";",
"else",
"DRAWGFX_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY",
",",
"UINT8",
")",
";",
"}"
] | pdrawgfx_transtable - render a gfx element
using a table to look up which pens are
transparent, opaque, or shadowing, checking
against the priority bitmap | [
"pdrawgfx_transtable",
"-",
"render",
"a",
"gfx",
"element",
"using",
"a",
"table",
"to",
"look",
"up",
"which",
"pens",
"are",
"transparent",
"opaque",
"or",
"shadowing",
"checking",
"against",
"the",
"priority",
"bitmap"
] | [
"/* get final code and color, and grab lookup tables */",
"/* high bit of the mask is implicitly on */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "priority",
"type": "bitmap_t"
},
{
"param": "pmask",
"type": "UINT32"
},
{
"param": "pentable",
"type": "UINT8"
},
{
"param": "shadowtable",
"type": "pen_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pmask",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pentable",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "shadowtable",
"type": "pen_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | pdrawgfx_alpha | void | void pdrawgfx_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_t *priority, UINT32 pmask, UINT32 transpen, UINT8 alpha)
{
const pen_t *paldata;
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* special case alpha = 0xff */
if (alpha == 0xff)
{
pdrawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen);
return;
}
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* early out if completely transparent */
if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
return;
/* high bit of the mask is implicitly on */
pmask |= 1 << 31;
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_ALPHA16_PRIORITY, UINT8);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, UINT8);
} | /*-------------------------------------------------
pdrawgfx_alpha - render a gfx element with
a single transparent pen, alpha blending the
remaining pixels with a fixed alpha value,
checking against the priority bitmap
-------------------------------------------------*/ | render a gfx element with
a single transparent pen, alpha blending the
remaining pixels with a fixed alpha value,
checking against the priority bitmap | [
"render",
"a",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"alpha",
"blending",
"the",
"remaining",
"pixels",
"with",
"a",
"fixed",
"alpha",
"value",
"checking",
"against",
"the",
"priority",
"bitmap"
] | void pdrawgfx_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_t *priority, UINT32 pmask, UINT32 transpen, UINT8 alpha)
{
const pen_t *paldata;
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
if (alpha == 0xff)
{
pdrawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen);
return;
}
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
return;
pmask |= 1 << 31;
if (dest->bpp == 16)
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_ALPHA16_PRIORITY, UINT8);
else
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, UINT8);
} | [
"void",
"pdrawgfx_alpha",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"bitmap_t",
"*",
"priority",
",",
"UINT32",
"pmask",
",",
"UINT32",
"transpen",
",",
"UINT8",
"alpha",
")",
"{",
"const",
"pen_t",
"*",
"paldata",
";",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"if",
"(",
"alpha",
"==",
"0xff",
")",
"{",
"pdrawgfx_transpen",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"priority",
",",
"pmask",
",",
"transpen",
")",
";",
"return",
";",
"}",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"if",
"(",
"gfx",
"->",
"pen_usage",
"!=",
"NULL",
"&&",
"!",
"gfx",
"->",
"dirty",
"[",
"code",
"]",
"&&",
"(",
"gfx",
"->",
"pen_usage",
"[",
"code",
"]",
"&",
"~",
"(",
"1",
"<<",
"transpen",
")",
")",
"==",
"0",
")",
"return",
";",
"pmask",
"|=",
"1",
"<<",
"31",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFX_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_TRANSPEN_ALPHA16_PRIORITY",
",",
"UINT8",
")",
";",
"else",
"DRAWGFX_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY",
",",
"UINT8",
")",
";",
"}"
] | pdrawgfx_alpha - render a gfx element with
a single transparent pen, alpha blending the
remaining pixels with a fixed alpha value,
checking against the priority bitmap | [
"pdrawgfx_alpha",
"-",
"render",
"a",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"alpha",
"blending",
"the",
"remaining",
"pixels",
"with",
"a",
"fixed",
"alpha",
"value",
"checking",
"against",
"the",
"priority",
"bitmap"
] | [
"/* special case alpha = 0xff */",
"/* get final code and color, and grab lookup tables */",
"/* early out if completely transparent */",
"/* high bit of the mask is implicitly on */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "priority",
"type": "bitmap_t"
},
{
"param": "pmask",
"type": "UINT32"
},
{
"param": "transpen",
"type": "UINT32"
},
{
"param": "alpha",
"type": "UINT8"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pmask",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transpen",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "alpha",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | pdrawgfxzoom_opaque | void | void pdrawgfxzoom_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask)
{
const pen_t *paldata;
/* non-zoom case */
if (scalex == 0x10000 && scaley == 0x10000)
{
pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* high bit of the mask is implicitly on */
pmask |= 1 << 31;
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8);
} | /*-------------------------------------------------
pdrawgfxzoom_opaque - render a scaled gfx
element with no transparency, checking against
the priority bitmap
-------------------------------------------------*/ | render a scaled gfx
element with no transparency, checking against
the priority bitmap | [
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"no",
"transparency",
"checking",
"against",
"the",
"priority",
"bitmap"
] | void pdrawgfxzoom_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask)
{
const pen_t *paldata;
if (scalex == 0x10000 && scaley == 0x10000)
{
pdrawgfx_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
pmask |= 1 << 31;
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8);
} | [
"void",
"pdrawgfxzoom_opaque",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"UINT32",
"scalex",
",",
"UINT32",
"scaley",
",",
"bitmap_t",
"*",
"priority",
",",
"UINT32",
"pmask",
")",
"{",
"const",
"pen_t",
"*",
"paldata",
";",
"if",
"(",
"scalex",
"==",
"0x10000",
"&&",
"scaley",
"==",
"0x10000",
")",
"{",
"pdrawgfx_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"priority",
",",
"pmask",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"pmask",
"|=",
"1",
"<<",
"31",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFXZOOM_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_OPAQUE_PRIORITY",
",",
"UINT8",
")",
";",
"else",
"DRAWGFXZOOM_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_OPAQUE_PRIORITY",
",",
"UINT8",
")",
";",
"}"
] | pdrawgfxzoom_opaque - render a scaled gfx
element with no transparency, checking against
the priority bitmap | [
"pdrawgfxzoom_opaque",
"-",
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"no",
"transparency",
"checking",
"against",
"the",
"priority",
"bitmap"
] | [
"/* non-zoom case */",
"/* get final code and color, and grab lookup tables */",
"/* high bit of the mask is implicitly on */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "scalex",
"type": "UINT32"
},
{
"param": "scaley",
"type": "UINT32"
},
{
"param": "priority",
"type": "bitmap_t"
},
{
"param": "pmask",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scalex",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scaley",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pmask",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | pdrawgfxzoom_transpen | void | void pdrawgfxzoom_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask,
UINT32 transpen)
{
const pen_t *paldata;
/* non-zoom case */
if (scalex == 0x10000 && scaley == 0x10000)
{
pdrawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen);
return;
}
/* special case invalid pens to opaque */
if (transpen > 0xff)
{
pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* use pen usage to optimize */
if (gfx->pen_usage != NULL && !gfx->dirty[code])
{
UINT32 usage = gfx->pen_usage[code];
/* fully transparent; do nothing */
if ((usage & ~(1 << transpen)) == 0)
return;
/* fully opaque; draw as such */
if ((usage & (1 << transpen)) == 0)
{
pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
return;
}
}
/* high bit of the mask is implicitly on */
pmask |= 1 << 31;
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8);
} | /*-------------------------------------------------
pdrawgfxzoom_transpen - render a scaled gfx
element with a single transparent pen,
checking against the priority bitmap
-------------------------------------------------*/ | render a scaled gfx
element with a single transparent pen,
checking against the priority bitmap | [
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"checking",
"against",
"the",
"priority",
"bitmap"
] | void pdrawgfxzoom_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask,
UINT32 transpen)
{
const pen_t *paldata;
if (scalex == 0x10000 && scaley == 0x10000)
{
pdrawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen);
return;
}
if (transpen > 0xff)
{
pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
if (gfx->pen_usage != NULL && !gfx->dirty[code])
{
UINT32 usage = gfx->pen_usage[code];
if ((usage & ~(1 << transpen)) == 0)
return;
if ((usage & (1 << transpen)) == 0)
{
pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
return;
}
}
pmask |= 1 << 31;
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8);
} | [
"void",
"pdrawgfxzoom_transpen",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"UINT32",
"scalex",
",",
"UINT32",
"scaley",
",",
"bitmap_t",
"*",
"priority",
",",
"UINT32",
"pmask",
",",
"UINT32",
"transpen",
")",
"{",
"const",
"pen_t",
"*",
"paldata",
";",
"if",
"(",
"scalex",
"==",
"0x10000",
"&&",
"scaley",
"==",
"0x10000",
")",
"{",
"pdrawgfx_transpen",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"priority",
",",
"pmask",
",",
"transpen",
")",
";",
"return",
";",
"}",
"if",
"(",
"transpen",
">",
"0xff",
")",
"{",
"pdrawgfxzoom_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"scalex",
",",
"scaley",
",",
"priority",
",",
"pmask",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"if",
"(",
"gfx",
"->",
"pen_usage",
"!=",
"NULL",
"&&",
"!",
"gfx",
"->",
"dirty",
"[",
"code",
"]",
")",
"{",
"UINT32",
"usage",
"=",
"gfx",
"->",
"pen_usage",
"[",
"code",
"]",
";",
"if",
"(",
"(",
"usage",
"&",
"~",
"(",
"1",
"<<",
"transpen",
")",
")",
"==",
"0",
")",
"return",
";",
"if",
"(",
"(",
"usage",
"&",
"(",
"1",
"<<",
"transpen",
")",
")",
"==",
"0",
")",
"{",
"pdrawgfxzoom_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"scalex",
",",
"scaley",
",",
"priority",
",",
"pmask",
")",
";",
"return",
";",
"}",
"}",
"pmask",
"|=",
"1",
"<<",
"31",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFXZOOM_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_TRANSPEN_PRIORITY",
",",
"UINT8",
")",
";",
"else",
"DRAWGFXZOOM_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANSPEN_PRIORITY",
",",
"UINT8",
")",
";",
"}"
] | pdrawgfxzoom_transpen - render a scaled gfx
element with a single transparent pen,
checking against the priority bitmap | [
"pdrawgfxzoom_transpen",
"-",
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"checking",
"against",
"the",
"priority",
"bitmap"
] | [
"/* non-zoom case */",
"/* special case invalid pens to opaque */",
"/* get final code and color, and grab lookup tables */",
"/* use pen usage to optimize */",
"/* fully transparent; do nothing */",
"/* fully opaque; draw as such */",
"/* high bit of the mask is implicitly on */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "scalex",
"type": "UINT32"
},
{
"param": "scaley",
"type": "UINT32"
},
{
"param": "priority",
"type": "bitmap_t"
},
{
"param": "pmask",
"type": "UINT32"
},
{
"param": "transpen",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scalex",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scaley",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pmask",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transpen",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | pdrawgfxzoom_transpen_raw | void | void pdrawgfxzoom_transpen_raw(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask,
UINT32 transpen)
{
/* non-zoom case */
if (scalex == 0x10000 && scaley == 0x10000)
{
pdrawgfx_transpen_raw(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
/* early out if completely transparent */
if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
return;
/* high bit of the mask is implicitly on */
pmask |= 1 << 31;
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, UINT8);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, UINT8);
} | /*-------------------------------------------------
pdrawgfxzoom_transpen_raw - render a scaled gfx
element with a single transparent pen and no
color lookups, checking against the priority
bitmap
-------------------------------------------------*/ | render a scaled gfx
element with a single transparent pen and no
color lookups, checking against the priority
bitmap | [
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"and",
"no",
"color",
"lookups",
"checking",
"against",
"the",
"priority",
"bitmap"
] | void pdrawgfxzoom_transpen_raw(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask,
UINT32 transpen)
{
if (scalex == 0x10000 && scaley == 0x10000)
{
pdrawgfx_transpen_raw(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
return;
pmask |= 1 << 31;
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, UINT8);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, UINT8);
} | [
"void",
"pdrawgfxzoom_transpen_raw",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"UINT32",
"scalex",
",",
"UINT32",
"scaley",
",",
"bitmap_t",
"*",
"priority",
",",
"UINT32",
"pmask",
",",
"UINT32",
"transpen",
")",
"{",
"if",
"(",
"scalex",
"==",
"0x10000",
"&&",
"scaley",
"==",
"0x10000",
")",
"{",
"pdrawgfx_transpen_raw",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"priority",
",",
"pmask",
",",
"transpen",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"if",
"(",
"gfx",
"->",
"pen_usage",
"!=",
"NULL",
"&&",
"!",
"gfx",
"->",
"dirty",
"[",
"code",
"]",
"&&",
"(",
"gfx",
"->",
"pen_usage",
"[",
"code",
"]",
"&",
"~",
"(",
"1",
"<<",
"transpen",
")",
")",
"==",
"0",
")",
"return",
";",
"pmask",
"|=",
"1",
"<<",
"31",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFXZOOM_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REBASE_TRANSPEN_PRIORITY",
",",
"UINT8",
")",
";",
"else",
"DRAWGFXZOOM_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REBASE_TRANSPEN_PRIORITY",
",",
"UINT8",
")",
";",
"}"
] | pdrawgfxzoom_transpen_raw - render a scaled gfx
element with a single transparent pen and no
color lookups, checking against the priority
bitmap | [
"pdrawgfxzoom_transpen_raw",
"-",
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"and",
"no",
"color",
"lookups",
"checking",
"against",
"the",
"priority",
"bitmap"
] | [
"/* non-zoom case */",
"/* get final code and color, and grab lookup tables */",
"/* early out if completely transparent */",
"/* high bit of the mask is implicitly on */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "scalex",
"type": "UINT32"
},
{
"param": "scaley",
"type": "UINT32"
},
{
"param": "priority",
"type": "bitmap_t"
},
{
"param": "pmask",
"type": "UINT32"
},
{
"param": "transpen",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scalex",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scaley",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pmask",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transpen",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | pdrawgfxzoom_transmask | void | void pdrawgfxzoom_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask,
UINT32 transmask)
{
const pen_t *paldata;
/* non-zoom case */
if (scalex == 0x10000 && scaley == 0x10000)
{
pdrawgfx_transmask(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transmask);
return;
}
/* special case 0 mask to opaque */
if (transmask == 0)
{
pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* use pen usage to optimize */
if (gfx->pen_usage != NULL && !gfx->dirty[code])
{
UINT32 usage = gfx->pen_usage[code];
/* fully transparent; do nothing */
if ((usage & ~transmask) == 0)
return;
/* fully opaque; draw as such */
if ((usage & transmask) == 0)
{
pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
return;
}
}
/* high bit of the mask is implicitly on */
pmask |= 1 << 31;
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8);
} | /*-------------------------------------------------
pdrawgfxzoom_transmask - render a scaled gfx
element with a multiple transparent pens
provided as a mask, checking against the
priority bitmap
-------------------------------------------------*/ | render a scaled gfx
element with a multiple transparent pens
provided as a mask, checking against the
priority bitmap | [
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"a",
"multiple",
"transparent",
"pens",
"provided",
"as",
"a",
"mask",
"checking",
"against",
"the",
"priority",
"bitmap"
] | void pdrawgfxzoom_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask,
UINT32 transmask)
{
const pen_t *paldata;
if (scalex == 0x10000 && scaley == 0x10000)
{
pdrawgfx_transmask(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transmask);
return;
}
if (transmask == 0)
{
pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
if (gfx->pen_usage != NULL && !gfx->dirty[code])
{
UINT32 usage = gfx->pen_usage[code];
if ((usage & ~transmask) == 0)
return;
if ((usage & transmask) == 0)
{
pdrawgfxzoom_opaque(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
return;
}
}
pmask |= 1 << 31;
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8);
} | [
"void",
"pdrawgfxzoom_transmask",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"UINT32",
"scalex",
",",
"UINT32",
"scaley",
",",
"bitmap_t",
"*",
"priority",
",",
"UINT32",
"pmask",
",",
"UINT32",
"transmask",
")",
"{",
"const",
"pen_t",
"*",
"paldata",
";",
"if",
"(",
"scalex",
"==",
"0x10000",
"&&",
"scaley",
"==",
"0x10000",
")",
"{",
"pdrawgfx_transmask",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"priority",
",",
"pmask",
",",
"transmask",
")",
";",
"return",
";",
"}",
"if",
"(",
"transmask",
"==",
"0",
")",
"{",
"pdrawgfxzoom_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"scalex",
",",
"scaley",
",",
"priority",
",",
"pmask",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"if",
"(",
"gfx",
"->",
"pen_usage",
"!=",
"NULL",
"&&",
"!",
"gfx",
"->",
"dirty",
"[",
"code",
"]",
")",
"{",
"UINT32",
"usage",
"=",
"gfx",
"->",
"pen_usage",
"[",
"code",
"]",
";",
"if",
"(",
"(",
"usage",
"&",
"~",
"transmask",
")",
"==",
"0",
")",
"return",
";",
"if",
"(",
"(",
"usage",
"&",
"transmask",
")",
"==",
"0",
")",
"{",
"pdrawgfxzoom_opaque",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"scalex",
",",
"scaley",
",",
"priority",
",",
"pmask",
")",
";",
"return",
";",
"}",
"}",
"pmask",
"|=",
"1",
"<<",
"31",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFXZOOM_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_TRANSMASK_PRIORITY",
",",
"UINT8",
")",
";",
"else",
"DRAWGFXZOOM_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANSMASK_PRIORITY",
",",
"UINT8",
")",
";",
"}"
] | pdrawgfxzoom_transmask - render a scaled gfx
element with a multiple transparent pens
provided as a mask, checking against the
priority bitmap | [
"pdrawgfxzoom_transmask",
"-",
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"a",
"multiple",
"transparent",
"pens",
"provided",
"as",
"a",
"mask",
"checking",
"against",
"the",
"priority",
"bitmap"
] | [
"/* non-zoom case */",
"/* special case 0 mask to opaque */",
"/* get final code and color, and grab lookup tables */",
"/* use pen usage to optimize */",
"/* fully transparent; do nothing */",
"/* fully opaque; draw as such */",
"/* high bit of the mask is implicitly on */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "scalex",
"type": "UINT32"
},
{
"param": "scaley",
"type": "UINT32"
},
{
"param": "priority",
"type": "bitmap_t"
},
{
"param": "pmask",
"type": "UINT32"
},
{
"param": "transmask",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scalex",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scaley",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pmask",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transmask",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | pdrawgfxzoom_transtable | void | void pdrawgfxzoom_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask,
const UINT8 *pentable, const pen_t *shadowtable)
{
const pen_t *paldata;
/* non-zoom case */
if (scalex == 0x10000 && scaley == 0x10000)
{
pdrawgfx_transtable(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, pentable, shadowtable);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
assert(pentable != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* high bit of the mask is implicitly on */
pmask |= 1 << 31;
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16_PRIORITY, UINT8);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, UINT8);
} | /*-------------------------------------------------
pdrawgfxzoom_transtable - render a scaled gfx
element using a table to look up which pens
are transparent, opaque, or shadowing,
checking against the priority bitmap
-------------------------------------------------*/ | render a scaled gfx
element using a table to look up which pens
are transparent, opaque, or shadowing,
checking against the priority bitmap | [
"render",
"a",
"scaled",
"gfx",
"element",
"using",
"a",
"table",
"to",
"look",
"up",
"which",
"pens",
"are",
"transparent",
"opaque",
"or",
"shadowing",
"checking",
"against",
"the",
"priority",
"bitmap"
] | void pdrawgfxzoom_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask,
const UINT8 *pentable, const pen_t *shadowtable)
{
const pen_t *paldata;
if (scalex == 0x10000 && scaley == 0x10000)
{
pdrawgfx_transtable(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, pentable, shadowtable);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
assert(pentable != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
pmask |= 1 << 31;
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16_PRIORITY, UINT8);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, UINT8);
} | [
"void",
"pdrawgfxzoom_transtable",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"UINT32",
"scalex",
",",
"UINT32",
"scaley",
",",
"bitmap_t",
"*",
"priority",
",",
"UINT32",
"pmask",
",",
"const",
"UINT8",
"*",
"pentable",
",",
"const",
"pen_t",
"*",
"shadowtable",
")",
"{",
"const",
"pen_t",
"*",
"paldata",
";",
"if",
"(",
"scalex",
"==",
"0x10000",
"&&",
"scaley",
"==",
"0x10000",
")",
"{",
"pdrawgfx_transtable",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"priority",
",",
"pmask",
",",
"pentable",
",",
"shadowtable",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"assert",
"(",
"pentable",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"pmask",
"|=",
"1",
"<<",
"31",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFXZOOM_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_TRANSTABLE16_PRIORITY",
",",
"UINT8",
")",
";",
"else",
"DRAWGFXZOOM_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY",
",",
"UINT8",
")",
";",
"}"
] | pdrawgfxzoom_transtable - render a scaled gfx
element using a table to look up which pens
are transparent, opaque, or shadowing,
checking against the priority bitmap | [
"pdrawgfxzoom_transtable",
"-",
"render",
"a",
"scaled",
"gfx",
"element",
"using",
"a",
"table",
"to",
"look",
"up",
"which",
"pens",
"are",
"transparent",
"opaque",
"or",
"shadowing",
"checking",
"against",
"the",
"priority",
"bitmap"
] | [
"/* non-zoom case */",
"/* get final code and color, and grab lookup tables */",
"/* high bit of the mask is implicitly on */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "scalex",
"type": "UINT32"
},
{
"param": "scaley",
"type": "UINT32"
},
{
"param": "priority",
"type": "bitmap_t"
},
{
"param": "pmask",
"type": "UINT32"
},
{
"param": "pentable",
"type": "UINT8"
},
{
"param": "shadowtable",
"type": "pen_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scalex",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scaley",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pmask",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pentable",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "shadowtable",
"type": "pen_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | pdrawgfxzoom_alpha | void | void pdrawgfxzoom_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask,
UINT32 transpen, UINT8 alpha)
{
const pen_t *paldata;
/* non-zoom case */
if (scalex == 0x10000 && scaley == 0x10000)
{
pdrawgfx_alpha(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen, alpha);
return;
}
/* special case alpha = 0xff */
if (alpha == 0xff)
{
pdrawgfxzoom_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask, transpen);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
/* get final code and color, and grab lookup tables */
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
/* early out if completely transparent */
if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
return;
/* high bit of the mask is implicitly on */
pmask |= 1 << 31;
/* render based on dest bitmap depth */
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_ALPHA16_PRIORITY, UINT8);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, UINT8);
} | /*-------------------------------------------------
pdrawgfxzoom_alpha - render a scaled gfx
element with a single transparent pen, alpha
blending the remaining pixels with a fixed
alpha value, checking against the priority
bitmap
-------------------------------------------------*/ | render a scaled gfx
element with a single transparent pen, alpha
blending the remaining pixels with a fixed
alpha value, checking against the priority
bitmap | [
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"alpha",
"blending",
"the",
"remaining",
"pixels",
"with",
"a",
"fixed",
"alpha",
"value",
"checking",
"against",
"the",
"priority",
"bitmap"
] | void pdrawgfxzoom_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_t *priority, UINT32 pmask,
UINT32 transpen, UINT8 alpha)
{
const pen_t *paldata;
if (scalex == 0x10000 && scaley == 0x10000)
{
pdrawgfx_alpha(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, priority, pmask, transpen, alpha);
return;
}
if (alpha == 0xff)
{
pdrawgfxzoom_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask, transpen);
return;
}
assert(dest != NULL);
assert(dest->bpp == 16 || dest->bpp == 32);
assert(gfx != NULL);
code %= gfx->total_elements;
color %= gfx->total_colors;
paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color];
if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0)
return;
pmask |= 1 << 31;
if (dest->bpp == 16)
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_ALPHA16_PRIORITY, UINT8);
else
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, UINT8);
} | [
"void",
"pdrawgfxzoom_alpha",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"UINT32",
"scalex",
",",
"UINT32",
"scaley",
",",
"bitmap_t",
"*",
"priority",
",",
"UINT32",
"pmask",
",",
"UINT32",
"transpen",
",",
"UINT8",
"alpha",
")",
"{",
"const",
"pen_t",
"*",
"paldata",
";",
"if",
"(",
"scalex",
"==",
"0x10000",
"&&",
"scaley",
"==",
"0x10000",
")",
"{",
"pdrawgfx_alpha",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"priority",
",",
"pmask",
",",
"transpen",
",",
"alpha",
")",
";",
"return",
";",
"}",
"if",
"(",
"alpha",
"==",
"0xff",
")",
"{",
"pdrawgfxzoom_transpen",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"scalex",
",",
"scaley",
",",
"priority",
",",
"pmask",
",",
"transpen",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"code",
"%=",
"gfx",
"->",
"total_elements",
";",
"color",
"%=",
"gfx",
"->",
"total_colors",
";",
"paldata",
"=",
"&",
"gfx",
"->",
"machine",
"->",
"pens",
"[",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"color",
"]",
";",
"if",
"(",
"gfx",
"->",
"pen_usage",
"!=",
"NULL",
"&&",
"!",
"gfx",
"->",
"dirty",
"[",
"code",
"]",
"&&",
"(",
"gfx",
"->",
"pen_usage",
"[",
"code",
"]",
"&",
"~",
"(",
"1",
"<<",
"transpen",
")",
")",
"==",
"0",
")",
"return",
";",
"pmask",
"|=",
"1",
"<<",
"31",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"DRAWGFXZOOM_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_TRANSPEN_ALPHA16_PRIORITY",
",",
"UINT8",
")",
";",
"else",
"DRAWGFXZOOM_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY",
",",
"UINT8",
")",
";",
"}"
] | pdrawgfxzoom_alpha - render a scaled gfx
element with a single transparent pen, alpha
blending the remaining pixels with a fixed
alpha value, checking against the priority
bitmap | [
"pdrawgfxzoom_alpha",
"-",
"render",
"a",
"scaled",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"alpha",
"blending",
"the",
"remaining",
"pixels",
"with",
"a",
"fixed",
"alpha",
"value",
"checking",
"against",
"the",
"priority",
"bitmap"
] | [
"/* non-zoom case */",
"/* special case alpha = 0xff */",
"/* get final code and color, and grab lookup tables */",
"/* early out if completely transparent */",
"/* high bit of the mask is implicitly on */",
"/* render based on dest bitmap depth */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "scalex",
"type": "UINT32"
},
{
"param": "scaley",
"type": "UINT32"
},
{
"param": "priority",
"type": "bitmap_t"
},
{
"param": "pmask",
"type": "UINT32"
},
{
"param": "transpen",
"type": "UINT32"
},
{
"param": "alpha",
"type": "UINT8"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scalex",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scaley",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pmask",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transpen",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "alpha",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | draw_scanline8 | void | void draw_scanline8(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT8 *srcptr, const pen_t *paldata)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
assert(bitmap != NULL);
assert(bitmap->bpp == 16 || bitmap->bpp == 32);
/* palette lookup case */
if (paldata != NULL)
{
/* 16bpp case */
if (bitmap->bpp == 16)
DRAWSCANLINE_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
else
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
}
/* raw copy case */
else
{
/* 16bpp case */
if (bitmap->bpp == 16)
DRAWSCANLINE_CORE(UINT16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
else
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
}
} | /*-------------------------------------------------
draw_scanline8 - copy pixels from an 8bpp
buffer to a single scanline of a bitmap
-------------------------------------------------*/ | copy pixels from an 8bpp
buffer to a single scanline of a bitmap | [
"copy",
"pixels",
"from",
"an",
"8bpp",
"buffer",
"to",
"a",
"single",
"scanline",
"of",
"a",
"bitmap"
] | void draw_scanline8(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT8 *srcptr, const pen_t *paldata)
{
bitmap_t *priority = NULL;
assert(bitmap != NULL);
assert(bitmap->bpp == 16 || bitmap->bpp == 32);
if (paldata != NULL)
{
if (bitmap->bpp == 16)
DRAWSCANLINE_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
else
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
}
else
{
if (bitmap->bpp == 16)
DRAWSCANLINE_CORE(UINT16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
else
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
}
} | [
"void",
"draw_scanline8",
"(",
"bitmap_t",
"*",
"bitmap",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"INT32",
"length",
",",
"const",
"UINT8",
"*",
"srcptr",
",",
"const",
"pen_t",
"*",
"paldata",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"assert",
"(",
"bitmap",
"!=",
"NULL",
")",
";",
"assert",
"(",
"bitmap",
"->",
"bpp",
"==",
"16",
"||",
"bitmap",
"->",
"bpp",
"==",
"32",
")",
";",
"if",
"(",
"paldata",
"!=",
"NULL",
")",
"{",
"if",
"(",
"bitmap",
"->",
"bpp",
"==",
"16",
")",
"DRAWSCANLINE_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWSCANLINE_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"}",
"else",
"{",
"if",
"(",
"bitmap",
"->",
"bpp",
"==",
"16",
")",
"DRAWSCANLINE_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_COPY_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWSCANLINE_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_COPY_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"}",
"}"
] | draw_scanline8 - copy pixels from an 8bpp
buffer to a single scanline of a bitmap | [
"draw_scanline8",
"-",
"copy",
"pixels",
"from",
"an",
"8bpp",
"buffer",
"to",
"a",
"single",
"scanline",
"of",
"a",
"bitmap"
] | [
"/* dummy, no priority in this case */",
"/* palette lookup case */",
"/* 16bpp case */",
"/* raw copy case */",
"/* 16bpp case */"
] | [
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "length",
"type": "INT32"
},
{
"param": "srcptr",
"type": "UINT8"
},
{
"param": "paldata",
"type": "pen_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "length",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "srcptr",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "paldata",
"type": "pen_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | draw_scanline16 | void | void draw_scanline16(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT16 *srcptr, const pen_t *paldata)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
assert(bitmap != NULL);
assert(bitmap->bpp == 16 || bitmap->bpp == 32);
/* palette lookup case */
if (paldata != NULL)
{
/* 16bpp case */
if (bitmap->bpp == 16)
DRAWSCANLINE_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
else
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
}
/* raw copy case */
else
{
/* 16bpp case */
if (bitmap->bpp == 16)
DRAWSCANLINE_CORE(UINT16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
else
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
}
} | /*-------------------------------------------------
draw_scanline16 - copy pixels from a 16bpp
buffer to a single scanline of a bitmap
-------------------------------------------------*/ | copy pixels from a 16bpp
buffer to a single scanline of a bitmap | [
"copy",
"pixels",
"from",
"a",
"16bpp",
"buffer",
"to",
"a",
"single",
"scanline",
"of",
"a",
"bitmap"
] | void draw_scanline16(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT16 *srcptr, const pen_t *paldata)
{
bitmap_t *priority = NULL;
assert(bitmap != NULL);
assert(bitmap->bpp == 16 || bitmap->bpp == 32);
if (paldata != NULL)
{
if (bitmap->bpp == 16)
DRAWSCANLINE_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
else
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
}
else
{
if (bitmap->bpp == 16)
DRAWSCANLINE_CORE(UINT16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
else
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
}
} | [
"void",
"draw_scanline16",
"(",
"bitmap_t",
"*",
"bitmap",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"INT32",
"length",
",",
"const",
"UINT16",
"*",
"srcptr",
",",
"const",
"pen_t",
"*",
"paldata",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"assert",
"(",
"bitmap",
"!=",
"NULL",
")",
";",
"assert",
"(",
"bitmap",
"->",
"bpp",
"==",
"16",
"||",
"bitmap",
"->",
"bpp",
"==",
"32",
")",
";",
"if",
"(",
"paldata",
"!=",
"NULL",
")",
"{",
"if",
"(",
"bitmap",
"->",
"bpp",
"==",
"16",
")",
"DRAWSCANLINE_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWSCANLINE_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"}",
"else",
"{",
"if",
"(",
"bitmap",
"->",
"bpp",
"==",
"16",
")",
"DRAWSCANLINE_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_COPY_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWSCANLINE_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_COPY_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"}",
"}"
] | draw_scanline16 - copy pixels from a 16bpp
buffer to a single scanline of a bitmap | [
"draw_scanline16",
"-",
"copy",
"pixels",
"from",
"a",
"16bpp",
"buffer",
"to",
"a",
"single",
"scanline",
"of",
"a",
"bitmap"
] | [
"/* dummy, no priority in this case */",
"/* palette lookup case */",
"/* 16bpp case */",
"/* raw copy case */",
"/* 16bpp case */"
] | [
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "length",
"type": "INT32"
},
{
"param": "srcptr",
"type": "UINT16"
},
{
"param": "paldata",
"type": "pen_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "length",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "srcptr",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "paldata",
"type": "pen_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | draw_scanline32 | void | void draw_scanline32(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr, const pen_t *paldata)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
assert(bitmap != NULL);
assert(bitmap->bpp == 16 || bitmap->bpp == 32);
/* palette lookup case */
if (paldata != NULL)
{
/* 16bpp case */
if (bitmap->bpp == 16)
DRAWSCANLINE_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
else
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
}
/* raw copy case */
else
{
/* 16bpp case */
if (bitmap->bpp == 16)
DRAWSCANLINE_CORE(UINT16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
else
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
}
} | /*-------------------------------------------------
draw_scanline32 - copy pixels from a 32bpp
buffer to a single scanline of a bitmap
-------------------------------------------------*/ | copy pixels from a 32bpp
buffer to a single scanline of a bitmap | [
"copy",
"pixels",
"from",
"a",
"32bpp",
"buffer",
"to",
"a",
"single",
"scanline",
"of",
"a",
"bitmap"
] | void draw_scanline32(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr, const pen_t *paldata)
{
bitmap_t *priority = NULL;
assert(bitmap != NULL);
assert(bitmap->bpp == 16 || bitmap->bpp == 32);
if (paldata != NULL)
{
if (bitmap->bpp == 16)
DRAWSCANLINE_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
else
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
}
else
{
if (bitmap->bpp == 16)
DRAWSCANLINE_CORE(UINT16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
else
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
}
} | [
"void",
"draw_scanline32",
"(",
"bitmap_t",
"*",
"bitmap",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"INT32",
"length",
",",
"const",
"UINT32",
"*",
"srcptr",
",",
"const",
"pen_t",
"*",
"paldata",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"assert",
"(",
"bitmap",
"!=",
"NULL",
")",
";",
"assert",
"(",
"bitmap",
"->",
"bpp",
"==",
"16",
"||",
"bitmap",
"->",
"bpp",
"==",
"32",
")",
";",
"if",
"(",
"paldata",
"!=",
"NULL",
")",
"{",
"if",
"(",
"bitmap",
"->",
"bpp",
"==",
"16",
")",
"DRAWSCANLINE_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_REMAP_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWSCANLINE_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"}",
"else",
"{",
"if",
"(",
"bitmap",
"->",
"bpp",
"==",
"16",
")",
"DRAWSCANLINE_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_COPY_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"else",
"DRAWSCANLINE_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_COPY_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"}",
"}"
] | draw_scanline32 - copy pixels from a 32bpp
buffer to a single scanline of a bitmap | [
"draw_scanline32",
"-",
"copy",
"pixels",
"from",
"a",
"32bpp",
"buffer",
"to",
"a",
"single",
"scanline",
"of",
"a",
"bitmap"
] | [
"/* dummy, no priority in this case */",
"/* palette lookup case */",
"/* 16bpp case */",
"/* raw copy case */",
"/* 16bpp case */"
] | [
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "length",
"type": "INT32"
},
{
"param": "srcptr",
"type": "UINT32"
},
{
"param": "paldata",
"type": "pen_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "length",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "srcptr",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "paldata",
"type": "pen_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | extract_scanline8 | void | void extract_scanline8(bitmap_t *bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT8 *destptr)
{
assert(bitmap != NULL);
assert(bitmap->bpp == 16 || bitmap->bpp == 32);
/* 16bpp case */
if (bitmap->bpp == 16)
EXTRACTSCANLINE_CORE(UINT16);
else
EXTRACTSCANLINE_CORE(UINT32);
} | /*-------------------------------------------------
extract_scanline8 - copy pixels from a single
scanline of a bitmap to an 8bpp buffer
-------------------------------------------------*/ | copy pixels from a single
scanline of a bitmap to an 8bpp buffer | [
"copy",
"pixels",
"from",
"a",
"single",
"scanline",
"of",
"a",
"bitmap",
"to",
"an",
"8bpp",
"buffer"
] | void extract_scanline8(bitmap_t *bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT8 *destptr)
{
assert(bitmap != NULL);
assert(bitmap->bpp == 16 || bitmap->bpp == 32);
if (bitmap->bpp == 16)
EXTRACTSCANLINE_CORE(UINT16);
else
EXTRACTSCANLINE_CORE(UINT32);
} | [
"void",
"extract_scanline8",
"(",
"bitmap_t",
"*",
"bitmap",
",",
"INT32",
"srcx",
",",
"INT32",
"srcy",
",",
"INT32",
"length",
",",
"UINT8",
"*",
"destptr",
")",
"{",
"assert",
"(",
"bitmap",
"!=",
"NULL",
")",
";",
"assert",
"(",
"bitmap",
"->",
"bpp",
"==",
"16",
"||",
"bitmap",
"->",
"bpp",
"==",
"32",
")",
";",
"if",
"(",
"bitmap",
"->",
"bpp",
"==",
"16",
")",
"EXTRACTSCANLINE_CORE",
"(",
"UINT16",
")",
";",
"else",
"EXTRACTSCANLINE_CORE",
"(",
"UINT32",
")",
";",
"}"
] | extract_scanline8 - copy pixels from a single
scanline of a bitmap to an 8bpp buffer | [
"extract_scanline8",
"-",
"copy",
"pixels",
"from",
"a",
"single",
"scanline",
"of",
"a",
"bitmap",
"to",
"an",
"8bpp",
"buffer"
] | [
"/* 16bpp case */"
] | [
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "srcx",
"type": "INT32"
},
{
"param": "srcy",
"type": "INT32"
},
{
"param": "length",
"type": "INT32"
},
{
"param": "destptr",
"type": "UINT8"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "srcx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "srcy",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "length",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destptr",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | extract_scanline16 | void | void extract_scanline16(bitmap_t *bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT16 *destptr)
{
assert(bitmap != NULL);
assert(bitmap->bpp == 16 || bitmap->bpp == 32);
/* 16bpp case */
if (bitmap->bpp == 16)
EXTRACTSCANLINE_CORE(UINT16);
else
EXTRACTSCANLINE_CORE(UINT32);
} | /*-------------------------------------------------
extract_scanline16 - copy pixels from a single
scanline of a bitmap to a 16bpp buffer
-------------------------------------------------*/ | copy pixels from a single
scanline of a bitmap to a 16bpp buffer | [
"copy",
"pixels",
"from",
"a",
"single",
"scanline",
"of",
"a",
"bitmap",
"to",
"a",
"16bpp",
"buffer"
] | void extract_scanline16(bitmap_t *bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT16 *destptr)
{
assert(bitmap != NULL);
assert(bitmap->bpp == 16 || bitmap->bpp == 32);
if (bitmap->bpp == 16)
EXTRACTSCANLINE_CORE(UINT16);
else
EXTRACTSCANLINE_CORE(UINT32);
} | [
"void",
"extract_scanline16",
"(",
"bitmap_t",
"*",
"bitmap",
",",
"INT32",
"srcx",
",",
"INT32",
"srcy",
",",
"INT32",
"length",
",",
"UINT16",
"*",
"destptr",
")",
"{",
"assert",
"(",
"bitmap",
"!=",
"NULL",
")",
";",
"assert",
"(",
"bitmap",
"->",
"bpp",
"==",
"16",
"||",
"bitmap",
"->",
"bpp",
"==",
"32",
")",
";",
"if",
"(",
"bitmap",
"->",
"bpp",
"==",
"16",
")",
"EXTRACTSCANLINE_CORE",
"(",
"UINT16",
")",
";",
"else",
"EXTRACTSCANLINE_CORE",
"(",
"UINT32",
")",
";",
"}"
] | extract_scanline16 - copy pixels from a single
scanline of a bitmap to a 16bpp buffer | [
"extract_scanline16",
"-",
"copy",
"pixels",
"from",
"a",
"single",
"scanline",
"of",
"a",
"bitmap",
"to",
"a",
"16bpp",
"buffer"
] | [
"/* 16bpp case */"
] | [
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "srcx",
"type": "INT32"
},
{
"param": "srcy",
"type": "INT32"
},
{
"param": "length",
"type": "INT32"
},
{
"param": "destptr",
"type": "UINT16"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "srcx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "srcy",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "length",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destptr",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | extract_scanline32 | void | void extract_scanline32(bitmap_t *bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT32 *destptr)
{
assert(bitmap != NULL);
assert(bitmap->bpp == 16 || bitmap->bpp == 32);
/* 16bpp case */
if (bitmap->bpp == 16)
EXTRACTSCANLINE_CORE(UINT16);
else
EXTRACTSCANLINE_CORE(UINT32);
} | /*-------------------------------------------------
extract_scanline32 - copy pixels from a single
scanline of a bitmap to a 32bpp buffer
-------------------------------------------------*/ | copy pixels from a single
scanline of a bitmap to a 32bpp buffer | [
"copy",
"pixels",
"from",
"a",
"single",
"scanline",
"of",
"a",
"bitmap",
"to",
"a",
"32bpp",
"buffer"
] | void extract_scanline32(bitmap_t *bitmap, INT32 srcx, INT32 srcy, INT32 length, UINT32 *destptr)
{
assert(bitmap != NULL);
assert(bitmap->bpp == 16 || bitmap->bpp == 32);
if (bitmap->bpp == 16)
EXTRACTSCANLINE_CORE(UINT16);
else
EXTRACTSCANLINE_CORE(UINT32);
} | [
"void",
"extract_scanline32",
"(",
"bitmap_t",
"*",
"bitmap",
",",
"INT32",
"srcx",
",",
"INT32",
"srcy",
",",
"INT32",
"length",
",",
"UINT32",
"*",
"destptr",
")",
"{",
"assert",
"(",
"bitmap",
"!=",
"NULL",
")",
";",
"assert",
"(",
"bitmap",
"->",
"bpp",
"==",
"16",
"||",
"bitmap",
"->",
"bpp",
"==",
"32",
")",
";",
"if",
"(",
"bitmap",
"->",
"bpp",
"==",
"16",
")",
"EXTRACTSCANLINE_CORE",
"(",
"UINT16",
")",
";",
"else",
"EXTRACTSCANLINE_CORE",
"(",
"UINT32",
")",
";",
"}"
] | extract_scanline32 - copy pixels from a single
scanline of a bitmap to a 32bpp buffer | [
"extract_scanline32",
"-",
"copy",
"pixels",
"from",
"a",
"single",
"scanline",
"of",
"a",
"bitmap",
"to",
"a",
"32bpp",
"buffer"
] | [
"/* 16bpp case */"
] | [
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "srcx",
"type": "INT32"
},
{
"param": "srcy",
"type": "INT32"
},
{
"param": "length",
"type": "INT32"
},
{
"param": "destptr",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "srcx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "srcy",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "length",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destptr",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | copybitmap | void | void copybitmap(bitmap_t *dest, bitmap_t *src, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle *cliprect)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
assert(dest != NULL);
assert(src != NULL);
assert(dest->bpp == 8 || dest->bpp == 16 || dest->bpp == 32);
assert(src->bpp == dest->bpp);
if (dest->bpp == 8)
COPYBITMAP_CORE(UINT8, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
else if (dest->bpp == 16)
COPYBITMAP_CORE(UINT16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
else
COPYBITMAP_CORE(UINT32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
} | /*-------------------------------------------------
copybitmap - copy from one bitmap to another,
copying all unclipped pixels
-------------------------------------------------*/ | copy from one bitmap to another,
copying all unclipped pixels | [
"copy",
"from",
"one",
"bitmap",
"to",
"another",
"copying",
"all",
"unclipped",
"pixels"
] | void copybitmap(bitmap_t *dest, bitmap_t *src, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle *cliprect)
{
bitmap_t *priority = NULL;
assert(dest != NULL);
assert(src != NULL);
assert(dest->bpp == 8 || dest->bpp == 16 || dest->bpp == 32);
assert(src->bpp == dest->bpp);
if (dest->bpp == 8)
COPYBITMAP_CORE(UINT8, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
else if (dest->bpp == 16)
COPYBITMAP_CORE(UINT16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
else
COPYBITMAP_CORE(UINT32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
} | [
"void",
"copybitmap",
"(",
"bitmap_t",
"*",
"dest",
",",
"bitmap_t",
"*",
"src",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"const",
"rectangle",
"*",
"cliprect",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"src",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"8",
"||",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"src",
"->",
"bpp",
"==",
"dest",
"->",
"bpp",
")",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"8",
")",
"COPYBITMAP_CORE",
"(",
"UINT8",
",",
"PIXEL_OP_COPY_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"else",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"COPYBITMAP_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_COPY_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"else",
"COPYBITMAP_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_COPY_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"}"
] | copybitmap - copy from one bitmap to another,
copying all unclipped pixels | [
"copybitmap",
"-",
"copy",
"from",
"one",
"bitmap",
"to",
"another",
"copying",
"all",
"unclipped",
"pixels"
] | [
"/* dummy, no priority in this case */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "src",
"type": "bitmap_t"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "cliprect",
"type": "rectangle"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"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": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | copybitmap_trans | void | void copybitmap_trans(bitmap_t *dest, bitmap_t *src, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle *cliprect, UINT32 transpen)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
assert(dest != NULL);
assert(src != NULL);
assert(dest->bpp == 8 || dest->bpp == 16 || dest->bpp == 32);
assert(src->bpp == dest->bpp);
if (dest->bpp == 8)
{
if (transpen > 0xff)
copybitmap(dest, src, flipx, flipy, destx, desty, cliprect);
else
COPYBITMAP_CORE(UINT8, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY);
}
else if (dest->bpp == 16)
{
if (transpen > 0xffff)
copybitmap(dest, src, flipx, flipy, destx, desty, cliprect);
else
COPYBITMAP_CORE(UINT16, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY);
}
else
{
if (transpen == 0xffffffff)
copybitmap(dest, src, flipx, flipy, destx, desty, cliprect);
else
COPYBITMAP_CORE(UINT32, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY);
}
} | /*-------------------------------------------------
copybitmap_trans - copy from one bitmap to
another, copying all unclipped pixels except
those that match transpen
-------------------------------------------------*/ | copy from one bitmap to
another, copying all unclipped pixels except
those that match transpen | [
"copy",
"from",
"one",
"bitmap",
"to",
"another",
"copying",
"all",
"unclipped",
"pixels",
"except",
"those",
"that",
"match",
"transpen"
] | void copybitmap_trans(bitmap_t *dest, bitmap_t *src, int flipx, int flipy, INT32 destx, INT32 desty, const rectangle *cliprect, UINT32 transpen)
{
bitmap_t *priority = NULL;
assert(dest != NULL);
assert(src != NULL);
assert(dest->bpp == 8 || dest->bpp == 16 || dest->bpp == 32);
assert(src->bpp == dest->bpp);
if (dest->bpp == 8)
{
if (transpen > 0xff)
copybitmap(dest, src, flipx, flipy, destx, desty, cliprect);
else
COPYBITMAP_CORE(UINT8, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY);
}
else if (dest->bpp == 16)
{
if (transpen > 0xffff)
copybitmap(dest, src, flipx, flipy, destx, desty, cliprect);
else
COPYBITMAP_CORE(UINT16, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY);
}
else
{
if (transpen == 0xffffffff)
copybitmap(dest, src, flipx, flipy, destx, desty, cliprect);
else
COPYBITMAP_CORE(UINT32, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY);
}
} | [
"void",
"copybitmap_trans",
"(",
"bitmap_t",
"*",
"dest",
",",
"bitmap_t",
"*",
"src",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"UINT32",
"transpen",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"src",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"8",
"||",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"src",
"->",
"bpp",
"==",
"dest",
"->",
"bpp",
")",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"8",
")",
"{",
"if",
"(",
"transpen",
">",
"0xff",
")",
"copybitmap",
"(",
"dest",
",",
"src",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"cliprect",
")",
";",
"else",
"COPYBITMAP_CORE",
"(",
"UINT8",
",",
"PIXEL_OP_COPY_TRANSPEN",
",",
"NO_PRIORITY",
")",
";",
"}",
"else",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"{",
"if",
"(",
"transpen",
">",
"0xffff",
")",
"copybitmap",
"(",
"dest",
",",
"src",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"cliprect",
")",
";",
"else",
"COPYBITMAP_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_COPY_TRANSPEN",
",",
"NO_PRIORITY",
")",
";",
"}",
"else",
"{",
"if",
"(",
"transpen",
"==",
"0xffffffff",
")",
"copybitmap",
"(",
"dest",
",",
"src",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"cliprect",
")",
";",
"else",
"COPYBITMAP_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_COPY_TRANSPEN",
",",
"NO_PRIORITY",
")",
";",
"}",
"}"
] | copybitmap_trans - copy from one bitmap to
another, copying all unclipped pixels except
those that match transpen | [
"copybitmap_trans",
"-",
"copy",
"from",
"one",
"bitmap",
"to",
"another",
"copying",
"all",
"unclipped",
"pixels",
"except",
"those",
"that",
"match",
"transpen"
] | [
"/* dummy, no priority in this case */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "src",
"type": "bitmap_t"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "transpen",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transpen",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | copyscrollbitmap | void | void copyscrollbitmap(bitmap_t *dest, bitmap_t *src, UINT32 numrows, const INT32 *rowscroll, UINT32 numcols, const INT32 *colscroll, const rectangle *cliprect)
{
/* just call through to the transparent case as the underlying copybitmap will
optimize for pen == 0xffffffff */
copyscrollbitmap_trans(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, 0xffffffff);
} | /*-------------------------------------------------
copyscrollbitmap - copy from one bitmap to
another, copying all unclipped pixels, and
applying scrolling to one or more rows/colums
-------------------------------------------------*/ | copy from one bitmap to
another, copying all unclipped pixels, and
applying scrolling to one or more rows/colums | [
"copy",
"from",
"one",
"bitmap",
"to",
"another",
"copying",
"all",
"unclipped",
"pixels",
"and",
"applying",
"scrolling",
"to",
"one",
"or",
"more",
"rows",
"/",
"colums"
] | void copyscrollbitmap(bitmap_t *dest, bitmap_t *src, UINT32 numrows, const INT32 *rowscroll, UINT32 numcols, const INT32 *colscroll, const rectangle *cliprect)
{
copyscrollbitmap_trans(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, 0xffffffff);
} | [
"void",
"copyscrollbitmap",
"(",
"bitmap_t",
"*",
"dest",
",",
"bitmap_t",
"*",
"src",
",",
"UINT32",
"numrows",
",",
"const",
"INT32",
"*",
"rowscroll",
",",
"UINT32",
"numcols",
",",
"const",
"INT32",
"*",
"colscroll",
",",
"const",
"rectangle",
"*",
"cliprect",
")",
"{",
"copyscrollbitmap_trans",
"(",
"dest",
",",
"src",
",",
"numrows",
",",
"rowscroll",
",",
"numcols",
",",
"colscroll",
",",
"cliprect",
",",
"0xffffffff",
")",
";",
"}"
] | copyscrollbitmap - copy from one bitmap to
another, copying all unclipped pixels, and
applying scrolling to one or more rows/colums | [
"copyscrollbitmap",
"-",
"copy",
"from",
"one",
"bitmap",
"to",
"another",
"copying",
"all",
"unclipped",
"pixels",
"and",
"applying",
"scrolling",
"to",
"one",
"or",
"more",
"rows",
"/",
"colums"
] | [
"/* just call through to the transparent case as the underlying copybitmap will\n optimize for pen == 0xffffffff */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "src",
"type": "bitmap_t"
},
{
"param": "numrows",
"type": "UINT32"
},
{
"param": "rowscroll",
"type": "INT32"
},
{
"param": "numcols",
"type": "UINT32"
},
{
"param": "colscroll",
"type": "INT32"
},
{
"param": "cliprect",
"type": "rectangle"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "numrows",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rowscroll",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "numcols",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "colscroll",
"type": "INT32",
"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": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | copyscrollbitmap_trans | void | void copyscrollbitmap_trans(bitmap_t *dest, bitmap_t *src, UINT32 numrows, const INT32 *rowscroll, UINT32 numcols, const INT32 *colscroll, const rectangle *cliprect, UINT32 transpen)
{
/* no rowscroll and no colscroll means no scroll */
if (numrows == 0 && numcols == 0)
{
copybitmap_trans(dest, src, 0, 0, 0, 0, cliprect, transpen);
return;
}
assert(dest != NULL);
assert(src != NULL);
assert(dest->bpp == 8 || dest->bpp == 16 || dest->bpp == 32);
assert(dest->bpp == src->bpp);
assert(numrows != 0 || rowscroll == NULL);
assert(numrows == 0 || rowscroll != NULL);
assert(numcols != 0 || colscroll == NULL);
assert(numcols == 0 || colscroll != NULL);
/* NULL clip means use the full bitmap */
if (cliprect == NULL)
cliprect = &dest->cliprect;
/* fully scrolling X,Y playfield */
if (numrows <= 1 && numcols <= 1)
{
INT32 xscroll = normalize_xscroll(src, (numrows == 0) ? 0 : rowscroll[0]);
INT32 yscroll = normalize_yscroll(src, (numcols == 0) ? 0 : colscroll[0]);
INT32 sx, sy;
/* iterate over all portions of the scroll that overlap the destination */
for (sx = xscroll - src->width; sx < dest->width; sx += src->width)
for (sy = yscroll - src->height; sy < dest->height; sy += src->height)
copybitmap_trans(dest, src, 0, 0, sx, sy, cliprect, transpen);
}
/* scrolling columns plus horizontal scroll */
else if (numrows <= 1)
{
INT32 xscroll = normalize_xscroll(src, (numrows == 0) ? 0 : rowscroll[0]);
rectangle subclip = *cliprect;
int col, colwidth, groupcols;
/* determine width of each column */
colwidth = src->width / numcols;
assert(src->width % colwidth == 0);
/* iterate over each column */
for (col = 0; col < numcols; col += groupcols)
{
INT32 yscroll = colscroll[col];
INT32 sx, sy;
/* count consecutive columns scrolled by the same amount */
for (groupcols = 1; col + groupcols < numcols; groupcols++)
if (colscroll[col + groupcols] != yscroll)
break;
/* iterate over reps of the columns in question */
yscroll = normalize_yscroll(src, yscroll);
for (sx = xscroll - src->width; sx < dest->width; sx += src->width)
{
/* compute the cliprect for this group */
subclip.min_x = col * colwidth + sx;
subclip.max_x = (col + groupcols) * colwidth - 1 + sx;
sect_rect(&subclip, cliprect);
/* iterate over all portions of the scroll that overlap the destination */
for (sy = yscroll - src->height; sy < dest->height; sy += src->height)
copybitmap_trans(dest, src, 0, 0, sx, sy, &subclip, transpen);
}
}
}
/* scrolling rows plus vertical scroll */
else if (numcols <= 1)
{
INT32 yscroll = normalize_yscroll(src, (numcols == 0) ? 0 : colscroll[0]);
rectangle subclip = *cliprect;
int row, rowheight, grouprows;
/* determine width of each rows */
rowheight = src->height / numrows;
assert(src->height % rowheight == 0);
/* iterate over each row */
for (row = 0; row < numrows; row += grouprows)
{
INT32 xscroll = rowscroll[row];
INT32 sx, sy;
/* count consecutive rows scrolled by the same amount */
for (grouprows = 1; row + grouprows < numrows; grouprows++)
if (rowscroll[row + grouprows] != xscroll)
break;
/* iterate over reps of the rows in question */
xscroll = normalize_xscroll(src, xscroll);
for (sy = yscroll - src->height; sy < dest->height; sy += src->height)
{
/* compute the cliprect for this group */
subclip.min_y = row * rowheight + sy;
subclip.max_y = (row + grouprows) * rowheight - 1 + sy;
sect_rect(&subclip, cliprect);
/* iterate over all portions of the scroll that overlap the destination */
for (sx = xscroll - src->width; sx < dest->width; sx += src->width)
copybitmap_trans(dest, src, 0, 0, sx, sy, &subclip, transpen);
}
}
}
} | /*-------------------------------------------------
copyscrollbitmap_trans - copy from one bitmap
to another, copying all unclipped pixels
except those that match transpen, and applying
scrolling to one or more rows/colums
-------------------------------------------------*/ | copy from one bitmap
to another, copying all unclipped pixels
except those that match transpen, and applying
scrolling to one or more rows/colums | [
"copy",
"from",
"one",
"bitmap",
"to",
"another",
"copying",
"all",
"unclipped",
"pixels",
"except",
"those",
"that",
"match",
"transpen",
"and",
"applying",
"scrolling",
"to",
"one",
"or",
"more",
"rows",
"/",
"colums"
] | void copyscrollbitmap_trans(bitmap_t *dest, bitmap_t *src, UINT32 numrows, const INT32 *rowscroll, UINT32 numcols, const INT32 *colscroll, const rectangle *cliprect, UINT32 transpen)
{
if (numrows == 0 && numcols == 0)
{
copybitmap_trans(dest, src, 0, 0, 0, 0, cliprect, transpen);
return;
}
assert(dest != NULL);
assert(src != NULL);
assert(dest->bpp == 8 || dest->bpp == 16 || dest->bpp == 32);
assert(dest->bpp == src->bpp);
assert(numrows != 0 || rowscroll == NULL);
assert(numrows == 0 || rowscroll != NULL);
assert(numcols != 0 || colscroll == NULL);
assert(numcols == 0 || colscroll != NULL);
if (cliprect == NULL)
cliprect = &dest->cliprect;
if (numrows <= 1 && numcols <= 1)
{
INT32 xscroll = normalize_xscroll(src, (numrows == 0) ? 0 : rowscroll[0]);
INT32 yscroll = normalize_yscroll(src, (numcols == 0) ? 0 : colscroll[0]);
INT32 sx, sy;
for (sx = xscroll - src->width; sx < dest->width; sx += src->width)
for (sy = yscroll - src->height; sy < dest->height; sy += src->height)
copybitmap_trans(dest, src, 0, 0, sx, sy, cliprect, transpen);
}
else if (numrows <= 1)
{
INT32 xscroll = normalize_xscroll(src, (numrows == 0) ? 0 : rowscroll[0]);
rectangle subclip = *cliprect;
int col, colwidth, groupcols;
colwidth = src->width / numcols;
assert(src->width % colwidth == 0);
for (col = 0; col < numcols; col += groupcols)
{
INT32 yscroll = colscroll[col];
INT32 sx, sy;
for (groupcols = 1; col + groupcols < numcols; groupcols++)
if (colscroll[col + groupcols] != yscroll)
break;
yscroll = normalize_yscroll(src, yscroll);
for (sx = xscroll - src->width; sx < dest->width; sx += src->width)
{
subclip.min_x = col * colwidth + sx;
subclip.max_x = (col + groupcols) * colwidth - 1 + sx;
sect_rect(&subclip, cliprect);
for (sy = yscroll - src->height; sy < dest->height; sy += src->height)
copybitmap_trans(dest, src, 0, 0, sx, sy, &subclip, transpen);
}
}
}
else if (numcols <= 1)
{
INT32 yscroll = normalize_yscroll(src, (numcols == 0) ? 0 : colscroll[0]);
rectangle subclip = *cliprect;
int row, rowheight, grouprows;
rowheight = src->height / numrows;
assert(src->height % rowheight == 0);
for (row = 0; row < numrows; row += grouprows)
{
INT32 xscroll = rowscroll[row];
INT32 sx, sy;
for (grouprows = 1; row + grouprows < numrows; grouprows++)
if (rowscroll[row + grouprows] != xscroll)
break;
xscroll = normalize_xscroll(src, xscroll);
for (sy = yscroll - src->height; sy < dest->height; sy += src->height)
{
subclip.min_y = row * rowheight + sy;
subclip.max_y = (row + grouprows) * rowheight - 1 + sy;
sect_rect(&subclip, cliprect);
for (sx = xscroll - src->width; sx < dest->width; sx += src->width)
copybitmap_trans(dest, src, 0, 0, sx, sy, &subclip, transpen);
}
}
}
} | [
"void",
"copyscrollbitmap_trans",
"(",
"bitmap_t",
"*",
"dest",
",",
"bitmap_t",
"*",
"src",
",",
"UINT32",
"numrows",
",",
"const",
"INT32",
"*",
"rowscroll",
",",
"UINT32",
"numcols",
",",
"const",
"INT32",
"*",
"colscroll",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"UINT32",
"transpen",
")",
"{",
"if",
"(",
"numrows",
"==",
"0",
"&&",
"numcols",
"==",
"0",
")",
"{",
"copybitmap_trans",
"(",
"dest",
",",
"src",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"cliprect",
",",
"transpen",
")",
";",
"return",
";",
"}",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"src",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"8",
"||",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"src",
"->",
"bpp",
")",
";",
"assert",
"(",
"numrows",
"!=",
"0",
"||",
"rowscroll",
"==",
"NULL",
")",
";",
"assert",
"(",
"numrows",
"==",
"0",
"||",
"rowscroll",
"!=",
"NULL",
")",
";",
"assert",
"(",
"numcols",
"!=",
"0",
"||",
"colscroll",
"==",
"NULL",
")",
";",
"assert",
"(",
"numcols",
"==",
"0",
"||",
"colscroll",
"!=",
"NULL",
")",
";",
"if",
"(",
"cliprect",
"==",
"NULL",
")",
"cliprect",
"=",
"&",
"dest",
"->",
"cliprect",
";",
"if",
"(",
"numrows",
"<=",
"1",
"&&",
"numcols",
"<=",
"1",
")",
"{",
"INT32",
"xscroll",
"=",
"normalize_xscroll",
"(",
"src",
",",
"(",
"numrows",
"==",
"0",
")",
"?",
"0",
":",
"rowscroll",
"[",
"0",
"]",
")",
";",
"INT32",
"yscroll",
"=",
"normalize_yscroll",
"(",
"src",
",",
"(",
"numcols",
"==",
"0",
")",
"?",
"0",
":",
"colscroll",
"[",
"0",
"]",
")",
";",
"INT32",
"sx",
",",
"sy",
";",
"for",
"(",
"sx",
"=",
"xscroll",
"-",
"src",
"->",
"width",
";",
"sx",
"<",
"dest",
"->",
"width",
";",
"sx",
"+=",
"src",
"->",
"width",
")",
"for",
"(",
"sy",
"=",
"yscroll",
"-",
"src",
"->",
"height",
";",
"sy",
"<",
"dest",
"->",
"height",
";",
"sy",
"+=",
"src",
"->",
"height",
")",
"copybitmap_trans",
"(",
"dest",
",",
"src",
",",
"0",
",",
"0",
",",
"sx",
",",
"sy",
",",
"cliprect",
",",
"transpen",
")",
";",
"}",
"else",
"if",
"(",
"numrows",
"<=",
"1",
")",
"{",
"INT32",
"xscroll",
"=",
"normalize_xscroll",
"(",
"src",
",",
"(",
"numrows",
"==",
"0",
")",
"?",
"0",
":",
"rowscroll",
"[",
"0",
"]",
")",
";",
"rectangle",
"subclip",
"=",
"*",
"cliprect",
";",
"int",
"col",
",",
"colwidth",
",",
"groupcols",
";",
"colwidth",
"=",
"src",
"->",
"width",
"/",
"numcols",
";",
"assert",
"(",
"src",
"->",
"width",
"%",
"colwidth",
"==",
"0",
")",
";",
"for",
"(",
"col",
"=",
"0",
";",
"col",
"<",
"numcols",
";",
"col",
"+=",
"groupcols",
")",
"{",
"INT32",
"yscroll",
"=",
"colscroll",
"[",
"col",
"]",
";",
"INT32",
"sx",
",",
"sy",
";",
"for",
"(",
"groupcols",
"=",
"1",
";",
"col",
"+",
"groupcols",
"<",
"numcols",
";",
"groupcols",
"++",
")",
"if",
"(",
"colscroll",
"[",
"col",
"+",
"groupcols",
"]",
"!=",
"yscroll",
")",
"break",
";",
"yscroll",
"=",
"normalize_yscroll",
"(",
"src",
",",
"yscroll",
")",
";",
"for",
"(",
"sx",
"=",
"xscroll",
"-",
"src",
"->",
"width",
";",
"sx",
"<",
"dest",
"->",
"width",
";",
"sx",
"+=",
"src",
"->",
"width",
")",
"{",
"subclip",
".",
"min_x",
"=",
"col",
"*",
"colwidth",
"+",
"sx",
";",
"subclip",
".",
"max_x",
"=",
"(",
"col",
"+",
"groupcols",
")",
"*",
"colwidth",
"-",
"1",
"+",
"sx",
";",
"sect_rect",
"(",
"&",
"subclip",
",",
"cliprect",
")",
";",
"for",
"(",
"sy",
"=",
"yscroll",
"-",
"src",
"->",
"height",
";",
"sy",
"<",
"dest",
"->",
"height",
";",
"sy",
"+=",
"src",
"->",
"height",
")",
"copybitmap_trans",
"(",
"dest",
",",
"src",
",",
"0",
",",
"0",
",",
"sx",
",",
"sy",
",",
"&",
"subclip",
",",
"transpen",
")",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"numcols",
"<=",
"1",
")",
"{",
"INT32",
"yscroll",
"=",
"normalize_yscroll",
"(",
"src",
",",
"(",
"numcols",
"==",
"0",
")",
"?",
"0",
":",
"colscroll",
"[",
"0",
"]",
")",
";",
"rectangle",
"subclip",
"=",
"*",
"cliprect",
";",
"int",
"row",
",",
"rowheight",
",",
"grouprows",
";",
"rowheight",
"=",
"src",
"->",
"height",
"/",
"numrows",
";",
"assert",
"(",
"src",
"->",
"height",
"%",
"rowheight",
"==",
"0",
")",
";",
"for",
"(",
"row",
"=",
"0",
";",
"row",
"<",
"numrows",
";",
"row",
"+=",
"grouprows",
")",
"{",
"INT32",
"xscroll",
"=",
"rowscroll",
"[",
"row",
"]",
";",
"INT32",
"sx",
",",
"sy",
";",
"for",
"(",
"grouprows",
"=",
"1",
";",
"row",
"+",
"grouprows",
"<",
"numrows",
";",
"grouprows",
"++",
")",
"if",
"(",
"rowscroll",
"[",
"row",
"+",
"grouprows",
"]",
"!=",
"xscroll",
")",
"break",
";",
"xscroll",
"=",
"normalize_xscroll",
"(",
"src",
",",
"xscroll",
")",
";",
"for",
"(",
"sy",
"=",
"yscroll",
"-",
"src",
"->",
"height",
";",
"sy",
"<",
"dest",
"->",
"height",
";",
"sy",
"+=",
"src",
"->",
"height",
")",
"{",
"subclip",
".",
"min_y",
"=",
"row",
"*",
"rowheight",
"+",
"sy",
";",
"subclip",
".",
"max_y",
"=",
"(",
"row",
"+",
"grouprows",
")",
"*",
"rowheight",
"-",
"1",
"+",
"sy",
";",
"sect_rect",
"(",
"&",
"subclip",
",",
"cliprect",
")",
";",
"for",
"(",
"sx",
"=",
"xscroll",
"-",
"src",
"->",
"width",
";",
"sx",
"<",
"dest",
"->",
"width",
";",
"sx",
"+=",
"src",
"->",
"width",
")",
"copybitmap_trans",
"(",
"dest",
",",
"src",
",",
"0",
",",
"0",
",",
"sx",
",",
"sy",
",",
"&",
"subclip",
",",
"transpen",
")",
";",
"}",
"}",
"}",
"}"
] | copyscrollbitmap_trans - copy from one bitmap
to another, copying all unclipped pixels
except those that match transpen, and applying
scrolling to one or more rows/colums | [
"copyscrollbitmap_trans",
"-",
"copy",
"from",
"one",
"bitmap",
"to",
"another",
"copying",
"all",
"unclipped",
"pixels",
"except",
"those",
"that",
"match",
"transpen",
"and",
"applying",
"scrolling",
"to",
"one",
"or",
"more",
"rows",
"/",
"colums"
] | [
"/* no rowscroll and no colscroll means no scroll */",
"/* NULL clip means use the full bitmap */",
"/* fully scrolling X,Y playfield */",
"/* iterate over all portions of the scroll that overlap the destination */",
"/* scrolling columns plus horizontal scroll */",
"/* determine width of each column */",
"/* iterate over each column */",
"/* count consecutive columns scrolled by the same amount */",
"/* iterate over reps of the columns in question */",
"/* compute the cliprect for this group */",
"/* iterate over all portions of the scroll that overlap the destination */",
"/* scrolling rows plus vertical scroll */",
"/* determine width of each rows */",
"/* iterate over each row */",
"/* count consecutive rows scrolled by the same amount */",
"/* iterate over reps of the rows in question */",
"/* compute the cliprect for this group */",
"/* iterate over all portions of the scroll that overlap the destination */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "src",
"type": "bitmap_t"
},
{
"param": "numrows",
"type": "UINT32"
},
{
"param": "rowscroll",
"type": "INT32"
},
{
"param": "numcols",
"type": "UINT32"
},
{
"param": "colscroll",
"type": "INT32"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "transpen",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "numrows",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rowscroll",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "numcols",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "colscroll",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transpen",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | copyrozbitmap | void | void copyrozbitmap(bitmap_t *dest, const rectangle *cliprect, bitmap_t *src, INT32 startx, INT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, int wraparound)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
assert(dest != NULL);
assert(src != NULL);
assert(dest->bpp == 8 || dest->bpp == 16 || dest->bpp == 32);
assert(src->bpp == dest->bpp);
if (dest->bpp == 8)
COPYROZBITMAP_CORE(UINT8, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
else if (dest->bpp == 16)
COPYROZBITMAP_CORE(UINT16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
else
COPYROZBITMAP_CORE(UINT32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
} | /*-------------------------------------------------
copyrozbitmap - copy from one bitmap to another,
with zoom and rotation, copying all unclipped
pixels
-------------------------------------------------*/ | copy from one bitmap to another,
with zoom and rotation, copying all unclipped
pixels | [
"copy",
"from",
"one",
"bitmap",
"to",
"another",
"with",
"zoom",
"and",
"rotation",
"copying",
"all",
"unclipped",
"pixels"
] | void copyrozbitmap(bitmap_t *dest, const rectangle *cliprect, bitmap_t *src, INT32 startx, INT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, int wraparound)
{
bitmap_t *priority = NULL;
assert(dest != NULL);
assert(src != NULL);
assert(dest->bpp == 8 || dest->bpp == 16 || dest->bpp == 32);
assert(src->bpp == dest->bpp);
if (dest->bpp == 8)
COPYROZBITMAP_CORE(UINT8, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
else if (dest->bpp == 16)
COPYROZBITMAP_CORE(UINT16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
else
COPYROZBITMAP_CORE(UINT32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
} | [
"void",
"copyrozbitmap",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"bitmap_t",
"*",
"src",
",",
"INT32",
"startx",
",",
"INT32",
"starty",
",",
"INT32",
"incxx",
",",
"INT32",
"incxy",
",",
"INT32",
"incyx",
",",
"INT32",
"incyy",
",",
"int",
"wraparound",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"src",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"8",
"||",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"src",
"->",
"bpp",
"==",
"dest",
"->",
"bpp",
")",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"8",
")",
"COPYROZBITMAP_CORE",
"(",
"UINT8",
",",
"PIXEL_OP_COPY_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"else",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"COPYROZBITMAP_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_COPY_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"else",
"COPYROZBITMAP_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_COPY_OPAQUE",
",",
"NO_PRIORITY",
")",
";",
"}"
] | copyrozbitmap - copy from one bitmap to another,
with zoom and rotation, copying all unclipped
pixels | [
"copyrozbitmap",
"-",
"copy",
"from",
"one",
"bitmap",
"to",
"another",
"with",
"zoom",
"and",
"rotation",
"copying",
"all",
"unclipped",
"pixels"
] | [
"/* dummy, no priority in this case */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "src",
"type": "bitmap_t"
},
{
"param": "startx",
"type": "INT32"
},
{
"param": "starty",
"type": "INT32"
},
{
"param": "incxx",
"type": "INT32"
},
{
"param": "incxy",
"type": "INT32"
},
{
"param": "incyx",
"type": "INT32"
},
{
"param": "incyy",
"type": "INT32"
},
{
"param": "wraparound",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "startx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "starty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "incxx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "incxy",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "incyx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "incyy",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wraparound",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a199997a20fb828101200f57ebb2be8388d58e2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/drawgfx.c | [
"Unlicense"
] | C | copyrozbitmap_trans | void | void copyrozbitmap_trans(bitmap_t *dest, const rectangle *cliprect, bitmap_t *src, INT32 startx, INT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, int wraparound, UINT32 transpen)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
assert(dest != NULL);
assert(src != NULL);
assert(dest->bpp == 8 || dest->bpp == 16 || dest->bpp == 32);
assert(src->bpp == dest->bpp);
if (dest->bpp == 8)
COPYROZBITMAP_CORE(UINT8, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY);
else if (dest->bpp == 16)
COPYROZBITMAP_CORE(UINT16, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY);
else
COPYROZBITMAP_CORE(UINT32, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY);
} | /*-------------------------------------------------
copyrozbitmap_trans - copy from one bitmap to
another, with zoom and rotation, copying all
unclipped pixels whose values do not match
transpen
-------------------------------------------------*/ | copy from one bitmap to
another, with zoom and rotation, copying all
unclipped pixels whose values do not match
transpen | [
"copy",
"from",
"one",
"bitmap",
"to",
"another",
"with",
"zoom",
"and",
"rotation",
"copying",
"all",
"unclipped",
"pixels",
"whose",
"values",
"do",
"not",
"match",
"transpen"
] | void copyrozbitmap_trans(bitmap_t *dest, const rectangle *cliprect, bitmap_t *src, INT32 startx, INT32 starty, INT32 incxx, INT32 incxy, INT32 incyx, INT32 incyy, int wraparound, UINT32 transpen)
{
bitmap_t *priority = NULL;
assert(dest != NULL);
assert(src != NULL);
assert(dest->bpp == 8 || dest->bpp == 16 || dest->bpp == 32);
assert(src->bpp == dest->bpp);
if (dest->bpp == 8)
COPYROZBITMAP_CORE(UINT8, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY);
else if (dest->bpp == 16)
COPYROZBITMAP_CORE(UINT16, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY);
else
COPYROZBITMAP_CORE(UINT32, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY);
} | [
"void",
"copyrozbitmap_trans",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"bitmap_t",
"*",
"src",
",",
"INT32",
"startx",
",",
"INT32",
"starty",
",",
"INT32",
"incxx",
",",
"INT32",
"incxy",
",",
"INT32",
"incyx",
",",
"INT32",
"incyy",
",",
"int",
"wraparound",
",",
"UINT32",
"transpen",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"src",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"8",
"||",
"dest",
"->",
"bpp",
"==",
"16",
"||",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"src",
"->",
"bpp",
"==",
"dest",
"->",
"bpp",
")",
";",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"8",
")",
"COPYROZBITMAP_CORE",
"(",
"UINT8",
",",
"PIXEL_OP_COPY_TRANSPEN",
",",
"NO_PRIORITY",
")",
";",
"else",
"if",
"(",
"dest",
"->",
"bpp",
"==",
"16",
")",
"COPYROZBITMAP_CORE",
"(",
"UINT16",
",",
"PIXEL_OP_COPY_TRANSPEN",
",",
"NO_PRIORITY",
")",
";",
"else",
"COPYROZBITMAP_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_COPY_TRANSPEN",
",",
"NO_PRIORITY",
")",
";",
"}"
] | copyrozbitmap_trans - copy from one bitmap to
another, with zoom and rotation, copying all
unclipped pixels whose values do not match
transpen | [
"copyrozbitmap_trans",
"-",
"copy",
"from",
"one",
"bitmap",
"to",
"another",
"with",
"zoom",
"and",
"rotation",
"copying",
"all",
"unclipped",
"pixels",
"whose",
"values",
"do",
"not",
"match",
"transpen"
] | [
"/* dummy, no priority in this case */"
] | [
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "src",
"type": "bitmap_t"
},
{
"param": "startx",
"type": "INT32"
},
{
"param": "starty",
"type": "INT32"
},
{
"param": "incxx",
"type": "INT32"
},
{
"param": "incxy",
"type": "INT32"
},
{
"param": "incyx",
"type": "INT32"
},
{
"param": "incyy",
"type": "INT32"
},
{
"param": "wraparound",
"type": "int"
},
{
"param": "transpen",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "startx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "starty",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "incxx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "incxy",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "incyx",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "incyy",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wraparound",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transpen",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4f5259d6ddff71a2cb100f4fcef36b10e027f413 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/video/taitoic.c | [
"Unlicense"
] | C | has_write_handler8 | int | static int has_write_handler8(const device_config *cpu, write8_space_func handler)
{
if (cpu != NULL)
{
const address_space *space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM);
const address_map_entry *entry;
if (space != NULL && space->map != NULL)
for (entry = space->map->entrylist; entry != NULL; entry = entry->next)
if (entry->write.shandler8 == handler)
return 1;
}
return 0;
} | /* Note: various assumptions are made in these routines, typically that
only CPU#0 is of interest. If in doubt, check the routine. */ | various assumptions are made in these routines, typically that
only CPU#0 is of interest. If in doubt, check the routine. | [
"various",
"assumptions",
"are",
"made",
"in",
"these",
"routines",
"typically",
"that",
"only",
"CPU#0",
"is",
"of",
"interest",
".",
"If",
"in",
"doubt",
"check",
"the",
"routine",
"."
] | static int has_write_handler8(const device_config *cpu, write8_space_func handler)
{
if (cpu != NULL)
{
const address_space *space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM);
const address_map_entry *entry;
if (space != NULL && space->map != NULL)
for (entry = space->map->entrylist; entry != NULL; entry = entry->next)
if (entry->write.shandler8 == handler)
return 1;
}
return 0;
} | [
"static",
"int",
"has_write_handler8",
"(",
"const",
"device_config",
"*",
"cpu",
",",
"write8_space_func",
"handler",
")",
"{",
"if",
"(",
"cpu",
"!=",
"NULL",
")",
"{",
"const",
"address_space",
"*",
"space",
"=",
"cpu_get_address_space",
"(",
"cpu",
",",
"ADDRESS_SPACE_PROGRAM",
")",
";",
"const",
"address_map_entry",
"*",
"entry",
";",
"if",
"(",
"space",
"!=",
"NULL",
"&&",
"space",
"->",
"map",
"!=",
"NULL",
")",
"for",
"(",
"entry",
"=",
"space",
"->",
"map",
"->",
"entrylist",
";",
"entry",
"!=",
"NULL",
";",
"entry",
"=",
"entry",
"->",
"next",
")",
"if",
"(",
"entry",
"->",
"write",
".",
"shandler8",
"==",
"handler",
")",
"return",
"1",
";",
"}",
"return",
"0",
";",
"}"
] | Note: various assumptions are made in these routines, typically that
only CPU#0 is of interest. | [
"Note",
":",
"various",
"assumptions",
"are",
"made",
"in",
"these",
"routines",
"typically",
"that",
"only",
"CPU#0",
"is",
"of",
"interest",
"."
] | [] | [
{
"param": "cpu",
"type": "device_config"
},
{
"param": "handler",
"type": "write8_space_func"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpu",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "handler",
"type": "write8_space_func",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4f5259d6ddff71a2cb100f4fcef36b10e027f413 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/video/taitoic.c | [
"Unlicense"
] | C | PC080SN_vh_start | void | void PC080SN_vh_start(running_machine *machine,int chips,int gfxnum,int x_offset,int y_offset,int y_invert,
int opaque,int dblwidth)
{
int i;
assert(chips <= PC080SN_MAX_CHIPS);
PC080SN_chips = chips;
PC080SN_yinvert = y_invert;
PC080SN_dblwidth = dblwidth;
PC080SN_xoffs = x_offset;
PC080SN_yoffs = y_offset;
for (i = 0;i < chips;i++)
{
int xd,yd;
if (!PC080SN_dblwidth) /* standard tilemaps */
{
PC080SN_tilemap[i][0] = tilemap_create(machine, PC080SN_get_tile_info[i][0],tilemap_scan_rows,8,8,64,64);
PC080SN_tilemap[i][1] = tilemap_create(machine, PC080SN_get_tile_info[i][1],tilemap_scan_rows,8,8,64,64);
}
else /* double width tilemaps */
{
PC080SN_tilemap[i][0] = tilemap_create(machine, PC080SN_get_tile_info[i][0],tilemap_scan_rows,8,8,128,64);
PC080SN_tilemap[i][1] = tilemap_create(machine, PC080SN_get_tile_info[i][1],tilemap_scan_rows,8,8,128,64);
}
PC080SN_ram[i] = auto_alloc_array_clear(machine, UINT16, PC080SN_RAM_SIZE/2);
PC080SN_bg_ram[i][0] = PC080SN_ram[i] + 0x0000 /2;
PC080SN_bg_ram[i][1] = PC080SN_ram[i] + 0x8000 /2;
PC080SN_bgscroll_ram[i][0] = PC080SN_ram[i] + 0x4000 /2;
PC080SN_bgscroll_ram[i][1] = PC080SN_ram[i] + 0xc000 /2;
state_save_register_item_pointer(machine, "PC080SN", NULL, i, PC080SN_ram[i], PC080SN_RAM_SIZE/2);
state_save_register_item_array(machine, "PC080SN", NULL, i, PC080SN_ctrl[i]);
state_save_register_postload(machine, PC080SN_restore_scroll, (void *)(FPTR)i);
/* use the given gfx set for bg tiles */
PC080SN_bg_gfx[i] = gfxnum;
tilemap_set_transparent_pen(PC080SN_tilemap[i][0],0);
tilemap_set_transparent_pen(PC080SN_tilemap[i][1],0);
/* I'm setting optional chip #2 with the same offsets (Topspeed) */
xd = (i == 0) ? -x_offset : -x_offset;
yd = (i == 0) ? y_offset : y_offset;
tilemap_set_scrolldx(PC080SN_tilemap[i][0],-16 + xd,-16 - xd);
tilemap_set_scrolldy(PC080SN_tilemap[i][0],yd,-yd);
tilemap_set_scrolldx(PC080SN_tilemap[i][1],-16 + xd,-16 - xd);
tilemap_set_scrolldy(PC080SN_tilemap[i][1],yd,-yd);
if (!PC080SN_dblwidth)
{
tilemap_set_scroll_rows(PC080SN_tilemap[i][0],512);
tilemap_set_scroll_rows(PC080SN_tilemap[i][1],512);
}
}
} | /* opaque parameter is no longer supported and will be removed */ | opaque parameter is no longer supported and will be removed | [
"opaque",
"parameter",
"is",
"no",
"longer",
"supported",
"and",
"will",
"be",
"removed"
] | void PC080SN_vh_start(running_machine *machine,int chips,int gfxnum,int x_offset,int y_offset,int y_invert,
int opaque,int dblwidth)
{
int i;
assert(chips <= PC080SN_MAX_CHIPS);
PC080SN_chips = chips;
PC080SN_yinvert = y_invert;
PC080SN_dblwidth = dblwidth;
PC080SN_xoffs = x_offset;
PC080SN_yoffs = y_offset;
for (i = 0;i < chips;i++)
{
int xd,yd;
if (!PC080SN_dblwidth)
{
PC080SN_tilemap[i][0] = tilemap_create(machine, PC080SN_get_tile_info[i][0],tilemap_scan_rows,8,8,64,64);
PC080SN_tilemap[i][1] = tilemap_create(machine, PC080SN_get_tile_info[i][1],tilemap_scan_rows,8,8,64,64);
}
else
{
PC080SN_tilemap[i][0] = tilemap_create(machine, PC080SN_get_tile_info[i][0],tilemap_scan_rows,8,8,128,64);
PC080SN_tilemap[i][1] = tilemap_create(machine, PC080SN_get_tile_info[i][1],tilemap_scan_rows,8,8,128,64);
}
PC080SN_ram[i] = auto_alloc_array_clear(machine, UINT16, PC080SN_RAM_SIZE/2);
PC080SN_bg_ram[i][0] = PC080SN_ram[i] + 0x0000 /2;
PC080SN_bg_ram[i][1] = PC080SN_ram[i] + 0x8000 /2;
PC080SN_bgscroll_ram[i][0] = PC080SN_ram[i] + 0x4000 /2;
PC080SN_bgscroll_ram[i][1] = PC080SN_ram[i] + 0xc000 /2;
state_save_register_item_pointer(machine, "PC080SN", NULL, i, PC080SN_ram[i], PC080SN_RAM_SIZE/2);
state_save_register_item_array(machine, "PC080SN", NULL, i, PC080SN_ctrl[i]);
state_save_register_postload(machine, PC080SN_restore_scroll, (void *)(FPTR)i);
PC080SN_bg_gfx[i] = gfxnum;
tilemap_set_transparent_pen(PC080SN_tilemap[i][0],0);
tilemap_set_transparent_pen(PC080SN_tilemap[i][1],0);
xd = (i == 0) ? -x_offset : -x_offset;
yd = (i == 0) ? y_offset : y_offset;
tilemap_set_scrolldx(PC080SN_tilemap[i][0],-16 + xd,-16 - xd);
tilemap_set_scrolldy(PC080SN_tilemap[i][0],yd,-yd);
tilemap_set_scrolldx(PC080SN_tilemap[i][1],-16 + xd,-16 - xd);
tilemap_set_scrolldy(PC080SN_tilemap[i][1],yd,-yd);
if (!PC080SN_dblwidth)
{
tilemap_set_scroll_rows(PC080SN_tilemap[i][0],512);
tilemap_set_scroll_rows(PC080SN_tilemap[i][1],512);
}
}
} | [
"void",
"PC080SN_vh_start",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"chips",
",",
"int",
"gfxnum",
",",
"int",
"x_offset",
",",
"int",
"y_offset",
",",
"int",
"y_invert",
",",
"int",
"opaque",
",",
"int",
"dblwidth",
")",
"{",
"int",
"i",
";",
"assert",
"(",
"chips",
"<=",
"PC080SN_MAX_CHIPS",
")",
";",
"PC080SN_chips",
"=",
"chips",
";",
"PC080SN_yinvert",
"=",
"y_invert",
";",
"PC080SN_dblwidth",
"=",
"dblwidth",
";",
"PC080SN_xoffs",
"=",
"x_offset",
";",
"PC080SN_yoffs",
"=",
"y_offset",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"chips",
";",
"i",
"++",
")",
"{",
"int",
"xd",
",",
"yd",
";",
"if",
"(",
"!",
"PC080SN_dblwidth",
")",
"{",
"PC080SN_tilemap",
"[",
"i",
"]",
"[",
"0",
"]",
"=",
"tilemap_create",
"(",
"machine",
",",
"PC080SN_get_tile_info",
"[",
"i",
"]",
"[",
"0",
"]",
",",
"tilemap_scan_rows",
",",
"8",
",",
"8",
",",
"64",
",",
"64",
")",
";",
"PC080SN_tilemap",
"[",
"i",
"]",
"[",
"1",
"]",
"=",
"tilemap_create",
"(",
"machine",
",",
"PC080SN_get_tile_info",
"[",
"i",
"]",
"[",
"1",
"]",
",",
"tilemap_scan_rows",
",",
"8",
",",
"8",
",",
"64",
",",
"64",
")",
";",
"}",
"else",
"{",
"PC080SN_tilemap",
"[",
"i",
"]",
"[",
"0",
"]",
"=",
"tilemap_create",
"(",
"machine",
",",
"PC080SN_get_tile_info",
"[",
"i",
"]",
"[",
"0",
"]",
",",
"tilemap_scan_rows",
",",
"8",
",",
"8",
",",
"128",
",",
"64",
")",
";",
"PC080SN_tilemap",
"[",
"i",
"]",
"[",
"1",
"]",
"=",
"tilemap_create",
"(",
"machine",
",",
"PC080SN_get_tile_info",
"[",
"i",
"]",
"[",
"1",
"]",
",",
"tilemap_scan_rows",
",",
"8",
",",
"8",
",",
"128",
",",
"64",
")",
";",
"}",
"PC080SN_ram",
"[",
"i",
"]",
"=",
"auto_alloc_array_clear",
"(",
"machine",
",",
"UINT16",
",",
"PC080SN_RAM_SIZE",
"/",
"2",
")",
";",
"PC080SN_bg_ram",
"[",
"i",
"]",
"[",
"0",
"]",
"=",
"PC080SN_ram",
"[",
"i",
"]",
"+",
"0x0000",
"/",
"2",
";",
"PC080SN_bg_ram",
"[",
"i",
"]",
"[",
"1",
"]",
"=",
"PC080SN_ram",
"[",
"i",
"]",
"+",
"0x8000",
"/",
"2",
";",
"PC080SN_bgscroll_ram",
"[",
"i",
"]",
"[",
"0",
"]",
"=",
"PC080SN_ram",
"[",
"i",
"]",
"+",
"0x4000",
"/",
"2",
";",
"PC080SN_bgscroll_ram",
"[",
"i",
"]",
"[",
"1",
"]",
"=",
"PC080SN_ram",
"[",
"i",
"]",
"+",
"0xc000",
"/",
"2",
";",
"state_save_register_item_pointer",
"(",
"machine",
",",
"\"",
"\"",
",",
"NULL",
",",
"i",
",",
"PC080SN_ram",
"[",
"i",
"]",
",",
"PC080SN_RAM_SIZE",
"/",
"2",
")",
";",
"state_save_register_item_array",
"(",
"machine",
",",
"\"",
"\"",
",",
"NULL",
",",
"i",
",",
"PC080SN_ctrl",
"[",
"i",
"]",
")",
";",
"state_save_register_postload",
"(",
"machine",
",",
"PC080SN_restore_scroll",
",",
"(",
"void",
"*",
")",
"(",
"FPTR",
")",
"i",
")",
";",
"PC080SN_bg_gfx",
"[",
"i",
"]",
"=",
"gfxnum",
";",
"tilemap_set_transparent_pen",
"(",
"PC080SN_tilemap",
"[",
"i",
"]",
"[",
"0",
"]",
",",
"0",
")",
";",
"tilemap_set_transparent_pen",
"(",
"PC080SN_tilemap",
"[",
"i",
"]",
"[",
"1",
"]",
",",
"0",
")",
";",
"xd",
"=",
"(",
"i",
"==",
"0",
")",
"?",
"-",
"x_offset",
":",
"-",
"x_offset",
";",
"yd",
"=",
"(",
"i",
"==",
"0",
")",
"?",
"y_offset",
":",
"y_offset",
";",
"tilemap_set_scrolldx",
"(",
"PC080SN_tilemap",
"[",
"i",
"]",
"[",
"0",
"]",
",",
"-16",
"+",
"xd",
",",
"-16",
"-",
"xd",
")",
";",
"tilemap_set_scrolldy",
"(",
"PC080SN_tilemap",
"[",
"i",
"]",
"[",
"0",
"]",
",",
"yd",
",",
"-",
"yd",
")",
";",
"tilemap_set_scrolldx",
"(",
"PC080SN_tilemap",
"[",
"i",
"]",
"[",
"1",
"]",
",",
"-16",
"+",
"xd",
",",
"-16",
"-",
"xd",
")",
";",
"tilemap_set_scrolldy",
"(",
"PC080SN_tilemap",
"[",
"i",
"]",
"[",
"1",
"]",
",",
"yd",
",",
"-",
"yd",
")",
";",
"if",
"(",
"!",
"PC080SN_dblwidth",
")",
"{",
"tilemap_set_scroll_rows",
"(",
"PC080SN_tilemap",
"[",
"i",
"]",
"[",
"0",
"]",
",",
"512",
")",
";",
"tilemap_set_scroll_rows",
"(",
"PC080SN_tilemap",
"[",
"i",
"]",
"[",
"1",
"]",
",",
"512",
")",
";",
"}",
"}",
"}"
] | opaque parameter is no longer supported and will be removed | [
"opaque",
"parameter",
"is",
"no",
"longer",
"supported",
"and",
"will",
"be",
"removed"
] | [
"/* standard tilemaps */",
"/* double width tilemaps */",
"/* use the given gfx set for bg tiles */",
"/* I'm setting optional chip #2 with the same offsets (Topspeed) */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "chips",
"type": "int"
},
{
"param": "gfxnum",
"type": "int"
},
{
"param": "x_offset",
"type": "int"
},
{
"param": "y_offset",
"type": "int"
},
{
"param": "y_invert",
"type": "int"
},
{
"param": "opaque",
"type": "int"
},
{
"param": "dblwidth",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "chips",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfxnum",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x_offset",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y_offset",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y_invert",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "opaque",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dblwidth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4f5259d6ddff71a2cb100f4fcef36b10e027f413 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/video/taitoic.c | [
"Unlicense"
] | C | TC0080VCO_bg0_tilemap_draw | void | static void TC0080VCO_bg0_tilemap_draw(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int flags,UINT32 priority)
{
UINT16 zoom = TC0080VCO_scroll_ram[6];
int zx, zy;
zx = (zoom & 0xff00) >> 8;
zy = zoom & 0x00ff;
if (zx == 0x3f && zy == 0x7f) /* normal size */
{
tilemap_draw(bitmap,cliprect,TC0080VCO_tilemap[0],flags,priority);
}
else /* zoom + rowscroll = custom draw routine */
{
UINT16 *dst16,*src16;
UINT8 *tsrc;
UINT16 scanline[512];
bitmap_t *srcbitmap = tilemap_get_pixmap(TC0080VCO_tilemap[0]);
bitmap_t *flagsbitmap = tilemap_get_flagsmap(TC0080VCO_tilemap[0]);
int sx,zoomx,zoomy;
int dx,ex,dy,ey;
int i,y,y_index,src_y_index,row_index;
int x_index,x_step;
int flip = TC0080VCO_flipscreen;
int machine_flip = 0; /* for ROT 180 ? */
int min_x = cliprect->min_x;
int max_x = cliprect->max_x;
int min_y = cliprect->min_y;
int max_y = cliprect->max_y;
int screen_width = max_x + 1;
int width_mask=0x3ff; /* underlying tilemap */
#if 0
{
char buf[100];
sprintf(buf,"xmin= %04x xmax= %04x ymin= %04x ymax= %04x",min_x,max_x,min_y,max_y);
popmessage(buf);
}
#endif
if (zx < 63)
{
/* no evidence for these calcs? */
dx = 16 - (zx + 2) / 8;
ex = (zx + 2) % 8;
zoomx = ((dx << 3) - ex) << 10;
}
else
{
/* 256 is speculative, haven't found a game using zoomx yet */
zoomx = 0x10000 - ((zx - 0x3f) * 256);
}
if (zy < 127)
{
/* no evidence for these calcs? */
dy = 16 - (zy + 2) / 16;
ey = (zy + 2) % 16;
zoomy = ((dy << 4) - ey) << 9;
}
else
{
/* confirmed with real board */
zoomy = 0x10000 - ((zy - 0x7f) * 512);
}
if (!flip)
{
sx = (-TC0080VCO_scroll_ram[1] - 1) << 16;
y_index = (( TC0080VCO_scroll_ram[3] - 1) << 16) + min_y * zoomy;
}
else
{
/* adjustment for zx is entirely speculative */
sx = (( 0x200 + TC0080VCO_scroll_ram[1]) << 16)
- (max_x + min_x) * (zoomx-0x10000);
/* 0x130 correct for Dleague. Syvalion correct with 0x1f0.
min_y is 0x20 and 0x30; max_y is 0x10f and 0x1bf;
max_y + min_y seems a good bet... */
y_index = ((-TC0080VCO_scroll_ram[3] - 2) << 16)
+ min_y * zoomy - (max_y + min_y) * (zoomy-0x10000);
}
if (!machine_flip) y = min_y; else y = max_y;
do
{
src_y_index = (y_index>>16) &0x3ff; /* tilemaps are 1024 px up/down */
/* row areas are the same in flipscreen, so we must read in reverse */
row_index = (src_y_index &0x1ff);
if (flip) row_index = 0x1ff - row_index;
x_index = sx - ((TC0080VCO_bgscroll_ram[row_index] << 16));
src16 = BITMAP_ADDR16(srcbitmap, src_y_index, 0);
tsrc = BITMAP_ADDR8(flagsbitmap, src_y_index, 0);
dst16 = scanline;
x_step = zoomx;
/*** NEW ***/
if (flags & TILEMAP_DRAW_OPAQUE)
{
for (i=0; i<screen_width; i++)
{
*dst16++ = src16[(x_index >> 16) &width_mask];
x_index += x_step;
}
}
else
{
for (i=0; i<screen_width; i++)
{
if (tsrc[(x_index >> 16) &width_mask])
*dst16++ = src16[(x_index >> 16) &width_mask];
else
*dst16++ = 0x8000;
x_index += x_step;
}
}
/***********/
// while (x_index<x_max)
// {
// *dst16++ = src16[(x_index >> 16) &width_mask];
// x_index += x_step;
// }
//
// pdraw_scanline16(bitmap,0,y,screen_width,
// scanline,0,0,rot,priority);
/*** NEW ***/
taitoic_drawscanline(bitmap,cliprect,0,y,scanline,(flags & TILEMAP_DRAW_OPAQUE)?0:1,ROT0,machine->priority_bitmap,priority);
/***********/
y_index += zoomy;
if (!machine_flip) y++; else y--;
}
while ( (!machine_flip && y <= max_y) || (machine_flip && y >= min_y) );
}
} | /* NB: orientation_flipx code in following routine has not been tested */ | orientation_flipx code in following routine has not been tested | [
"orientation_flipx",
"code",
"in",
"following",
"routine",
"has",
"not",
"been",
"tested"
] | static void TC0080VCO_bg0_tilemap_draw(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int flags,UINT32 priority)
{
UINT16 zoom = TC0080VCO_scroll_ram[6];
int zx, zy;
zx = (zoom & 0xff00) >> 8;
zy = zoom & 0x00ff;
if (zx == 0x3f && zy == 0x7f)
{
tilemap_draw(bitmap,cliprect,TC0080VCO_tilemap[0],flags,priority);
}
else
{
UINT16 *dst16,*src16;
UINT8 *tsrc;
UINT16 scanline[512];
bitmap_t *srcbitmap = tilemap_get_pixmap(TC0080VCO_tilemap[0]);
bitmap_t *flagsbitmap = tilemap_get_flagsmap(TC0080VCO_tilemap[0]);
int sx,zoomx,zoomy;
int dx,ex,dy,ey;
int i,y,y_index,src_y_index,row_index;
int x_index,x_step;
int flip = TC0080VCO_flipscreen;
int machine_flip = 0;
int min_x = cliprect->min_x;
int max_x = cliprect->max_x;
int min_y = cliprect->min_y;
int max_y = cliprect->max_y;
int screen_width = max_x + 1;
int width_mask=0x3ff;
#if 0
{
char buf[100];
sprintf(buf,"xmin= %04x xmax= %04x ymin= %04x ymax= %04x",min_x,max_x,min_y,max_y);
popmessage(buf);
}
#endif
if (zx < 63)
{
dx = 16 - (zx + 2) / 8;
ex = (zx + 2) % 8;
zoomx = ((dx << 3) - ex) << 10;
}
else
{
zoomx = 0x10000 - ((zx - 0x3f) * 256);
}
if (zy < 127)
{
dy = 16 - (zy + 2) / 16;
ey = (zy + 2) % 16;
zoomy = ((dy << 4) - ey) << 9;
}
else
{
zoomy = 0x10000 - ((zy - 0x7f) * 512);
}
if (!flip)
{
sx = (-TC0080VCO_scroll_ram[1] - 1) << 16;
y_index = (( TC0080VCO_scroll_ram[3] - 1) << 16) + min_y * zoomy;
}
else
{
sx = (( 0x200 + TC0080VCO_scroll_ram[1]) << 16)
- (max_x + min_x) * (zoomx-0x10000);
y_index = ((-TC0080VCO_scroll_ram[3] - 2) << 16)
+ min_y * zoomy - (max_y + min_y) * (zoomy-0x10000);
}
if (!machine_flip) y = min_y; else y = max_y;
do
{
src_y_index = (y_index>>16) &0x3ff;
row_index = (src_y_index &0x1ff);
if (flip) row_index = 0x1ff - row_index;
x_index = sx - ((TC0080VCO_bgscroll_ram[row_index] << 16));
src16 = BITMAP_ADDR16(srcbitmap, src_y_index, 0);
tsrc = BITMAP_ADDR8(flagsbitmap, src_y_index, 0);
dst16 = scanline;
x_step = zoomx;
if (flags & TILEMAP_DRAW_OPAQUE)
{
for (i=0; i<screen_width; i++)
{
*dst16++ = src16[(x_index >> 16) &width_mask];
x_index += x_step;
}
}
else
{
for (i=0; i<screen_width; i++)
{
if (tsrc[(x_index >> 16) &width_mask])
*dst16++ = src16[(x_index >> 16) &width_mask];
else
*dst16++ = 0x8000;
x_index += x_step;
}
}
pdraw_scanline16(bitmap,0,y,screen_width,
scanline,0,0,rot,priority);
taitoic_drawscanline(bitmap,cliprect,0,y,scanline,(flags & TILEMAP_DRAW_OPAQUE)?0:1,ROT0,machine->priority_bitmap,priority);
y_index += zoomy;
if (!machine_flip) y++; else y--;
}
while ( (!machine_flip && y <= max_y) || (machine_flip && y >= min_y) );
}
} | [
"static",
"void",
"TC0080VCO_bg0_tilemap_draw",
"(",
"running_machine",
"*",
"machine",
",",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"int",
"flags",
",",
"UINT32",
"priority",
")",
"{",
"UINT16",
"zoom",
"=",
"TC0080VCO_scroll_ram",
"[",
"6",
"]",
";",
"int",
"zx",
",",
"zy",
";",
"zx",
"=",
"(",
"zoom",
"&",
"0xff00",
")",
">>",
"8",
";",
"zy",
"=",
"zoom",
"&",
"0x00ff",
";",
"if",
"(",
"zx",
"==",
"0x3f",
"&&",
"zy",
"==",
"0x7f",
")",
"{",
"tilemap_draw",
"(",
"bitmap",
",",
"cliprect",
",",
"TC0080VCO_tilemap",
"[",
"0",
"]",
",",
"flags",
",",
"priority",
")",
";",
"}",
"else",
"{",
"UINT16",
"*",
"dst16",
",",
"*",
"src16",
";",
"UINT8",
"*",
"tsrc",
";",
"UINT16",
"scanline",
"[",
"512",
"]",
";",
"bitmap_t",
"*",
"srcbitmap",
"=",
"tilemap_get_pixmap",
"(",
"TC0080VCO_tilemap",
"[",
"0",
"]",
")",
";",
"bitmap_t",
"*",
"flagsbitmap",
"=",
"tilemap_get_flagsmap",
"(",
"TC0080VCO_tilemap",
"[",
"0",
"]",
")",
";",
"int",
"sx",
",",
"zoomx",
",",
"zoomy",
";",
"int",
"dx",
",",
"ex",
",",
"dy",
",",
"ey",
";",
"int",
"i",
",",
"y",
",",
"y_index",
",",
"src_y_index",
",",
"row_index",
";",
"int",
"x_index",
",",
"x_step",
";",
"int",
"flip",
"=",
"TC0080VCO_flipscreen",
";",
"int",
"machine_flip",
"=",
"0",
";",
"int",
"min_x",
"=",
"cliprect",
"->",
"min_x",
";",
"int",
"max_x",
"=",
"cliprect",
"->",
"max_x",
";",
"int",
"min_y",
"=",
"cliprect",
"->",
"min_y",
";",
"int",
"max_y",
"=",
"cliprect",
"->",
"max_y",
";",
"int",
"screen_width",
"=",
"max_x",
"+",
"1",
";",
"int",
"width_mask",
"=",
"0x3ff",
";",
"#if",
"0",
"\n",
"{",
"char",
"buf",
"[",
"100",
"]",
";",
"sprintf",
"(",
"buf",
",",
"\"",
"\"",
",",
"min_x",
",",
"max_x",
",",
"min_y",
",",
"max_y",
")",
";",
"popmessage",
"(",
"buf",
")",
";",
"}",
"#endif",
"if",
"(",
"zx",
"<",
"63",
")",
"{",
"dx",
"=",
"16",
"-",
"(",
"zx",
"+",
"2",
")",
"/",
"8",
";",
"ex",
"=",
"(",
"zx",
"+",
"2",
")",
"%",
"8",
";",
"zoomx",
"=",
"(",
"(",
"dx",
"<<",
"3",
")",
"-",
"ex",
")",
"<<",
"10",
";",
"}",
"else",
"{",
"zoomx",
"=",
"0x10000",
"-",
"(",
"(",
"zx",
"-",
"0x3f",
")",
"*",
"256",
")",
";",
"}",
"if",
"(",
"zy",
"<",
"127",
")",
"{",
"dy",
"=",
"16",
"-",
"(",
"zy",
"+",
"2",
")",
"/",
"16",
";",
"ey",
"=",
"(",
"zy",
"+",
"2",
")",
"%",
"16",
";",
"zoomy",
"=",
"(",
"(",
"dy",
"<<",
"4",
")",
"-",
"ey",
")",
"<<",
"9",
";",
"}",
"else",
"{",
"zoomy",
"=",
"0x10000",
"-",
"(",
"(",
"zy",
"-",
"0x7f",
")",
"*",
"512",
")",
";",
"}",
"if",
"(",
"!",
"flip",
")",
"{",
"sx",
"=",
"(",
"-",
"TC0080VCO_scroll_ram",
"[",
"1",
"]",
"-",
"1",
")",
"<<",
"16",
";",
"y_index",
"=",
"(",
"(",
"TC0080VCO_scroll_ram",
"[",
"3",
"]",
"-",
"1",
")",
"<<",
"16",
")",
"+",
"min_y",
"*",
"zoomy",
";",
"}",
"else",
"{",
"sx",
"=",
"(",
"(",
"0x200",
"+",
"TC0080VCO_scroll_ram",
"[",
"1",
"]",
")",
"<<",
"16",
")",
"-",
"(",
"max_x",
"+",
"min_x",
")",
"*",
"(",
"zoomx",
"-",
"0x10000",
")",
";",
"y_index",
"=",
"(",
"(",
"-",
"TC0080VCO_scroll_ram",
"[",
"3",
"]",
"-",
"2",
")",
"<<",
"16",
")",
"+",
"min_y",
"*",
"zoomy",
"-",
"(",
"max_y",
"+",
"min_y",
")",
"*",
"(",
"zoomy",
"-",
"0x10000",
")",
";",
"}",
"if",
"(",
"!",
"machine_flip",
")",
"y",
"=",
"min_y",
";",
"else",
"y",
"=",
"max_y",
";",
"do",
"{",
"src_y_index",
"=",
"(",
"y_index",
">>",
"16",
")",
"&",
"0x3ff",
";",
"row_index",
"=",
"(",
"src_y_index",
"&",
"0x1ff",
")",
";",
"if",
"(",
"flip",
")",
"row_index",
"=",
"0x1ff",
"-",
"row_index",
";",
"x_index",
"=",
"sx",
"-",
"(",
"(",
"TC0080VCO_bgscroll_ram",
"[",
"row_index",
"]",
"<<",
"16",
")",
")",
";",
"src16",
"=",
"BITMAP_ADDR16",
"(",
"srcbitmap",
",",
"src_y_index",
",",
"0",
")",
";",
"tsrc",
"=",
"BITMAP_ADDR8",
"(",
"flagsbitmap",
",",
"src_y_index",
",",
"0",
")",
";",
"dst16",
"=",
"scanline",
";",
"x_step",
"=",
"zoomx",
";",
"if",
"(",
"flags",
"&",
"TILEMAP_DRAW_OPAQUE",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"screen_width",
";",
"i",
"++",
")",
"{",
"*",
"dst16",
"++",
"=",
"src16",
"[",
"(",
"x_index",
">>",
"16",
")",
"&",
"width_mask",
"]",
";",
"x_index",
"+=",
"x_step",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"screen_width",
";",
"i",
"++",
")",
"{",
"if",
"(",
"tsrc",
"[",
"(",
"x_index",
">>",
"16",
")",
"&",
"width_mask",
"]",
")",
"*",
"dst16",
"++",
"=",
"src16",
"[",
"(",
"x_index",
">>",
"16",
")",
"&",
"width_mask",
"]",
";",
"else",
"*",
"dst16",
"++",
"=",
"0x8000",
";",
"x_index",
"+=",
"x_step",
";",
"}",
"}",
"taitoic_drawscanline",
"(",
"bitmap",
",",
"cliprect",
",",
"0",
",",
"y",
",",
"scanline",
",",
"(",
"flags",
"&",
"TILEMAP_DRAW_OPAQUE",
")",
"?",
"0",
":",
"1",
",",
"ROT0",
",",
"machine",
"->",
"priority_bitmap",
",",
"priority",
")",
";",
"y_index",
"+=",
"zoomy",
";",
"if",
"(",
"!",
"machine_flip",
")",
"y",
"++",
";",
"else",
"y",
"--",
";",
"}",
"while",
"(",
"(",
"!",
"machine_flip",
"&&",
"y",
"<=",
"max_y",
")",
"||",
"(",
"machine_flip",
"&&",
"y",
">=",
"min_y",
")",
")",
";",
"}",
"}"
] | NB: orientation_flipx code in following routine has not been tested | [
"NB",
":",
"orientation_flipx",
"code",
"in",
"following",
"routine",
"has",
"not",
"been",
"tested"
] | [
"/* normal size */",
"/* zoom + rowscroll = custom draw routine */",
"/* for ROT 180 ? */",
"/* underlying tilemap */",
"/* no evidence for these calcs? */",
"/* 256 is speculative, haven't found a game using zoomx yet */",
"/* no evidence for these calcs? */",
"/* confirmed with real board */",
"/* adjustment for zx is entirely speculative */",
"/* 0x130 correct for Dleague. Syvalion correct with 0x1f0.\n min_y is 0x20 and 0x30; max_y is 0x10f and 0x1bf;\n max_y + min_y seems a good bet... */",
"/* tilemaps are 1024 px up/down */",
"/* row areas are the same in flipscreen, so we must read in reverse */",
"/*** NEW ***/",
"/***********/",
"// while (x_index<x_max)",
"// {",
"// *dst16++ = src16[(x_index >> 16) &width_mask];",
"// x_index += x_step;",
"// }",
"//",
"// pdraw_scanline16(bitmap,0,y,screen_width,",
"// scanline,0,0,rot,priority);",
"/*** NEW ***/",
"/***********/"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "flags",
"type": "int"
},
{
"param": "priority",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4f5259d6ddff71a2cb100f4fcef36b10e027f413 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/video/taitoic.c | [
"Unlicense"
] | C | TC0480SCP_bg01_draw | void | static void TC0480SCP_bg01_draw(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority)
{
/* X-axis zoom offers expansion only: 0 = no zoom, 0xff = max
Y-axis zoom offers expansion/compression: 0x7f = no zoom, 0xff = max
(0x1a in Footchmp hiscore = shrunk) */
int zoomx = 0x10000 - (TC0480SCP_ctrl[0x08 + layer] &0xff00);
int zoomy = 0x10000 - (((TC0480SCP_ctrl[0x08 + layer] &0xff) - 0x7f) * 512);
if ((zoomx == 0x10000) && (zoomy == 0x10000)) /* no zoom, simple */
{
/* Prevent bad things */
tilemap_draw(bitmap,cliprect,TC0480SCP_tilemap[layer][TC0480SCP_dblwidth],flags,priority);
}
else /* zoom */
{
UINT16 *dst16,*src16;
UINT8 *tsrc;
UINT16 scanline[512];
UINT32 sx;
bitmap_t *srcbitmap = tilemap_get_pixmap(TC0480SCP_tilemap[layer][TC0480SCP_dblwidth]);
bitmap_t *flagsbitmap = tilemap_get_flagsmap
(TC0480SCP_tilemap[layer][TC0480SCP_dblwidth]);
int flip = TC0480SCP_pri_reg & 0x40;
int i,y,y_index,src_y_index,row_index;
int x_index,x_step;
int machine_flip = 0; /* for ROT 180 ? */
UINT16 screen_width = 512; //cliprect->max_x - cliprect->min_x + 1;
UINT16 min_y = cliprect->min_y;
UINT16 max_y = cliprect->max_y;
int width_mask=0x1ff;
if (TC0480SCP_dblwidth) width_mask=0x3ff;
if (!flip)
{
sx = ((TC0480SCP_bgscrollx[layer] + 15 + layer*4) << 16)
+ ((255-(TC0480SCP_ctrl[0x10 + layer] & 0xff)) << 8);
sx += (TC0480SCP_x_offs - 15 - layer*4) * zoomx;
y_index = (TC0480SCP_bgscrolly[layer] << 16)
+ ((TC0480SCP_ctrl[0x14 + layer] & 0xff) << 8);
y_index -= (TC0480SCP_y_offs - min_y) * zoomy;
}
else /* TC0480SCP tiles flipscreen */
{
sx = ((-TC0480SCP_bgscrollx[layer] + 15 + layer*4 + TC0480SCP_flip_xoffs ) << 16)
+ ((255-(TC0480SCP_ctrl[0x10 + layer] & 0xff)) << 8);
sx += (TC0480SCP_x_offs - 15 - layer*4) * zoomx;
y_index = ((-TC0480SCP_bgscrolly[layer] + TC0480SCP_flip_yoffs) << 16)
+ ((TC0480SCP_ctrl[0x14 + layer] & 0xff) << 8);
y_index -= (TC0480SCP_y_offs - min_y) * zoomy;
}
if (!machine_flip) y=min_y; else y=max_y;
do
{
src_y_index = (y_index>>16) &0x1ff;
/* row areas are the same in flipscreen, so we must read in reverse */
row_index = src_y_index;
if (flip) row_index = 0x1ff - row_index;
x_index = sx - ((TC0480SCP_bgscroll_ram[layer][row_index] << 16))
- ((TC0480SCP_bgscroll_ram[layer][row_index+0x800] << 8) &0xffff);
src16 = BITMAP_ADDR16(srcbitmap, src_y_index, 0);
tsrc = BITMAP_ADDR8(flagsbitmap, src_y_index, 0);
dst16 = scanline;
x_step = zoomx;
if (flags & TILEMAP_DRAW_OPAQUE)
{
for (i=0; i<screen_width; i++)
{
*dst16++ = src16[(x_index >> 16) &width_mask];
x_index += x_step;
}
}
else
{
for (i=0; i<screen_width; i++)
{
if (tsrc[(x_index >> 16) &width_mask])
*dst16++ = src16[(x_index >> 16) &width_mask];
else
*dst16++ = 0x8000;
x_index += x_step;
}
}
taitoic_drawscanline(bitmap,cliprect,0,y,scanline,(flags & TILEMAP_DRAW_OPAQUE)?0:1,ROT0,machine->priority_bitmap,priority);
y_index += zoomy;
if (!machine_flip) y++; else y--;
}
while ( (!machine_flip && y<=max_y) || (machine_flip && y>=min_y) );
}
} | /*********************************************************************
BG0,1 LAYER DRAW
TODO
----
Broken for any rotation except ROT0. ROT180 support could probably
be added without too much difficulty: machine_flip is there as a
place-holder for this purpose.
Wouldn't work if y needs to be > 255 (i.e. if some game uses a
bigger than usual vertical visible area). Refer to TC0080VCO
custom draw routine for an example of dealing with this.
Historical Issues
-----------------
1) bg layers got too far left and down, the greater the magnification.
Largely fixed by adding offsets (to sx&y) which get bigger as we
zoom in (why we have *zoomx and *zoomy in the calculations).
2) Hthero and Footchmp bg layers behaved differently when zoomed.
Fixed by bringing tc0480scp_x&y_offs into calculations.
3) Metalb "TAITO" text in attract too far to the right. Fixed by
bringing (layer*4) into offset calculations. But might be possible
to avoid this by stepping the scroll deltas for the four layers -
currently they are the same, and we have to kludge the offsets in
TC0480SCP_ctrl_word_write.
4) Zoom movement was jagged: improved by bringing in scroll delta
values... but the results are noticably imperfect.
**********************************************************************/ | BG0,1 LAYER DRAW
TODO
Broken for any rotation except ROT0. ROT180 support could probably
be added without too much difficulty: machine_flip is there as a
place-holder for this purpose.
Wouldn't work if y needs to be > 255 . Refer to TC0080VCO
custom draw routine for an example of dealing with this.
Historical Issues
1) bg layers got too far left and down, the greater the magnification.
Largely fixed by adding offsets (to sx&y) which get bigger as we
zoom in (why we have *zoomx and *zoomy in the calculations).
2) Hthero and Footchmp bg layers behaved differently when zoomed.
3) Metalb "TAITO" text in attract too far to the right. Fixed by
bringing (layer*4) into offset calculations. But might be possible
to avoid this by stepping the scroll deltas for the four layers
currently they are the same, and we have to kludge the offsets in
TC0480SCP_ctrl_word_write.
4) Zoom movement was jagged: improved by bringing in scroll delta
values... but the results are noticably imperfect. | [
"BG0",
"1",
"LAYER",
"DRAW",
"TODO",
"Broken",
"for",
"any",
"rotation",
"except",
"ROT0",
".",
"ROT180",
"support",
"could",
"probably",
"be",
"added",
"without",
"too",
"much",
"difficulty",
":",
"machine_flip",
"is",
"there",
"as",
"a",
"place",
"-",
"holder",
"for",
"this",
"purpose",
".",
"Wouldn",
"'",
"t",
"work",
"if",
"y",
"needs",
"to",
"be",
">",
"255",
".",
"Refer",
"to",
"TC0080VCO",
"custom",
"draw",
"routine",
"for",
"an",
"example",
"of",
"dealing",
"with",
"this",
".",
"Historical",
"Issues",
"1",
")",
"bg",
"layers",
"got",
"too",
"far",
"left",
"and",
"down",
"the",
"greater",
"the",
"magnification",
".",
"Largely",
"fixed",
"by",
"adding",
"offsets",
"(",
"to",
"sx&y",
")",
"which",
"get",
"bigger",
"as",
"we",
"zoom",
"in",
"(",
"why",
"we",
"have",
"*",
"zoomx",
"and",
"*",
"zoomy",
"in",
"the",
"calculations",
")",
".",
"2",
")",
"Hthero",
"and",
"Footchmp",
"bg",
"layers",
"behaved",
"differently",
"when",
"zoomed",
".",
"3",
")",
"Metalb",
"\"",
"TAITO",
"\"",
"text",
"in",
"attract",
"too",
"far",
"to",
"the",
"right",
".",
"Fixed",
"by",
"bringing",
"(",
"layer",
"*",
"4",
")",
"into",
"offset",
"calculations",
".",
"But",
"might",
"be",
"possible",
"to",
"avoid",
"this",
"by",
"stepping",
"the",
"scroll",
"deltas",
"for",
"the",
"four",
"layers",
"currently",
"they",
"are",
"the",
"same",
"and",
"we",
"have",
"to",
"kludge",
"the",
"offsets",
"in",
"TC0480SCP_ctrl_word_write",
".",
"4",
")",
"Zoom",
"movement",
"was",
"jagged",
":",
"improved",
"by",
"bringing",
"in",
"scroll",
"delta",
"values",
"...",
"but",
"the",
"results",
"are",
"noticably",
"imperfect",
"."
] | static void TC0480SCP_bg01_draw(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority)
{
int zoomx = 0x10000 - (TC0480SCP_ctrl[0x08 + layer] &0xff00);
int zoomy = 0x10000 - (((TC0480SCP_ctrl[0x08 + layer] &0xff) - 0x7f) * 512);
if ((zoomx == 0x10000) && (zoomy == 0x10000))
{
tilemap_draw(bitmap,cliprect,TC0480SCP_tilemap[layer][TC0480SCP_dblwidth],flags,priority);
}
else
{
UINT16 *dst16,*src16;
UINT8 *tsrc;
UINT16 scanline[512];
UINT32 sx;
bitmap_t *srcbitmap = tilemap_get_pixmap(TC0480SCP_tilemap[layer][TC0480SCP_dblwidth]);
bitmap_t *flagsbitmap = tilemap_get_flagsmap
(TC0480SCP_tilemap[layer][TC0480SCP_dblwidth]);
int flip = TC0480SCP_pri_reg & 0x40;
int i,y,y_index,src_y_index,row_index;
int x_index,x_step;
int machine_flip = 0;
UINT16 screen_width = 512;
UINT16 min_y = cliprect->min_y;
UINT16 max_y = cliprect->max_y;
int width_mask=0x1ff;
if (TC0480SCP_dblwidth) width_mask=0x3ff;
if (!flip)
{
sx = ((TC0480SCP_bgscrollx[layer] + 15 + layer*4) << 16)
+ ((255-(TC0480SCP_ctrl[0x10 + layer] & 0xff)) << 8);
sx += (TC0480SCP_x_offs - 15 - layer*4) * zoomx;
y_index = (TC0480SCP_bgscrolly[layer] << 16)
+ ((TC0480SCP_ctrl[0x14 + layer] & 0xff) << 8);
y_index -= (TC0480SCP_y_offs - min_y) * zoomy;
}
else
{
sx = ((-TC0480SCP_bgscrollx[layer] + 15 + layer*4 + TC0480SCP_flip_xoffs ) << 16)
+ ((255-(TC0480SCP_ctrl[0x10 + layer] & 0xff)) << 8);
sx += (TC0480SCP_x_offs - 15 - layer*4) * zoomx;
y_index = ((-TC0480SCP_bgscrolly[layer] + TC0480SCP_flip_yoffs) << 16)
+ ((TC0480SCP_ctrl[0x14 + layer] & 0xff) << 8);
y_index -= (TC0480SCP_y_offs - min_y) * zoomy;
}
if (!machine_flip) y=min_y; else y=max_y;
do
{
src_y_index = (y_index>>16) &0x1ff;
row_index = src_y_index;
if (flip) row_index = 0x1ff - row_index;
x_index = sx - ((TC0480SCP_bgscroll_ram[layer][row_index] << 16))
- ((TC0480SCP_bgscroll_ram[layer][row_index+0x800] << 8) &0xffff);
src16 = BITMAP_ADDR16(srcbitmap, src_y_index, 0);
tsrc = BITMAP_ADDR8(flagsbitmap, src_y_index, 0);
dst16 = scanline;
x_step = zoomx;
if (flags & TILEMAP_DRAW_OPAQUE)
{
for (i=0; i<screen_width; i++)
{
*dst16++ = src16[(x_index >> 16) &width_mask];
x_index += x_step;
}
}
else
{
for (i=0; i<screen_width; i++)
{
if (tsrc[(x_index >> 16) &width_mask])
*dst16++ = src16[(x_index >> 16) &width_mask];
else
*dst16++ = 0x8000;
x_index += x_step;
}
}
taitoic_drawscanline(bitmap,cliprect,0,y,scanline,(flags & TILEMAP_DRAW_OPAQUE)?0:1,ROT0,machine->priority_bitmap,priority);
y_index += zoomy;
if (!machine_flip) y++; else y--;
}
while ( (!machine_flip && y<=max_y) || (machine_flip && y>=min_y) );
}
} | [
"static",
"void",
"TC0480SCP_bg01_draw",
"(",
"running_machine",
"*",
"machine",
",",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"int",
"layer",
",",
"int",
"flags",
",",
"UINT32",
"priority",
")",
"{",
"int",
"zoomx",
"=",
"0x10000",
"-",
"(",
"TC0480SCP_ctrl",
"[",
"0x08",
"+",
"layer",
"]",
"&",
"0xff00",
")",
";",
"int",
"zoomy",
"=",
"0x10000",
"-",
"(",
"(",
"(",
"TC0480SCP_ctrl",
"[",
"0x08",
"+",
"layer",
"]",
"&",
"0xff",
")",
"-",
"0x7f",
")",
"*",
"512",
")",
";",
"if",
"(",
"(",
"zoomx",
"==",
"0x10000",
")",
"&&",
"(",
"zoomy",
"==",
"0x10000",
")",
")",
"{",
"tilemap_draw",
"(",
"bitmap",
",",
"cliprect",
",",
"TC0480SCP_tilemap",
"[",
"layer",
"]",
"[",
"TC0480SCP_dblwidth",
"]",
",",
"flags",
",",
"priority",
")",
";",
"}",
"else",
"{",
"UINT16",
"*",
"dst16",
",",
"*",
"src16",
";",
"UINT8",
"*",
"tsrc",
";",
"UINT16",
"scanline",
"[",
"512",
"]",
";",
"UINT32",
"sx",
";",
"bitmap_t",
"*",
"srcbitmap",
"=",
"tilemap_get_pixmap",
"(",
"TC0480SCP_tilemap",
"[",
"layer",
"]",
"[",
"TC0480SCP_dblwidth",
"]",
")",
";",
"bitmap_t",
"*",
"flagsbitmap",
"=",
"tilemap_get_flagsmap",
"(",
"TC0480SCP_tilemap",
"[",
"layer",
"]",
"[",
"TC0480SCP_dblwidth",
"]",
")",
";",
"int",
"flip",
"=",
"TC0480SCP_pri_reg",
"&",
"0x40",
";",
"int",
"i",
",",
"y",
",",
"y_index",
",",
"src_y_index",
",",
"row_index",
";",
"int",
"x_index",
",",
"x_step",
";",
"int",
"machine_flip",
"=",
"0",
";",
"UINT16",
"screen_width",
"=",
"512",
";",
"UINT16",
"min_y",
"=",
"cliprect",
"->",
"min_y",
";",
"UINT16",
"max_y",
"=",
"cliprect",
"->",
"max_y",
";",
"int",
"width_mask",
"=",
"0x1ff",
";",
"if",
"(",
"TC0480SCP_dblwidth",
")",
"width_mask",
"=",
"0x3ff",
";",
"if",
"(",
"!",
"flip",
")",
"{",
"sx",
"=",
"(",
"(",
"TC0480SCP_bgscrollx",
"[",
"layer",
"]",
"+",
"15",
"+",
"layer",
"*",
"4",
")",
"<<",
"16",
")",
"+",
"(",
"(",
"255",
"-",
"(",
"TC0480SCP_ctrl",
"[",
"0x10",
"+",
"layer",
"]",
"&",
"0xff",
")",
")",
"<<",
"8",
")",
";",
"sx",
"+=",
"(",
"TC0480SCP_x_offs",
"-",
"15",
"-",
"layer",
"*",
"4",
")",
"*",
"zoomx",
";",
"y_index",
"=",
"(",
"TC0480SCP_bgscrolly",
"[",
"layer",
"]",
"<<",
"16",
")",
"+",
"(",
"(",
"TC0480SCP_ctrl",
"[",
"0x14",
"+",
"layer",
"]",
"&",
"0xff",
")",
"<<",
"8",
")",
";",
"y_index",
"-=",
"(",
"TC0480SCP_y_offs",
"-",
"min_y",
")",
"*",
"zoomy",
";",
"}",
"else",
"{",
"sx",
"=",
"(",
"(",
"-",
"TC0480SCP_bgscrollx",
"[",
"layer",
"]",
"+",
"15",
"+",
"layer",
"*",
"4",
"+",
"TC0480SCP_flip_xoffs",
")",
"<<",
"16",
")",
"+",
"(",
"(",
"255",
"-",
"(",
"TC0480SCP_ctrl",
"[",
"0x10",
"+",
"layer",
"]",
"&",
"0xff",
")",
")",
"<<",
"8",
")",
";",
"sx",
"+=",
"(",
"TC0480SCP_x_offs",
"-",
"15",
"-",
"layer",
"*",
"4",
")",
"*",
"zoomx",
";",
"y_index",
"=",
"(",
"(",
"-",
"TC0480SCP_bgscrolly",
"[",
"layer",
"]",
"+",
"TC0480SCP_flip_yoffs",
")",
"<<",
"16",
")",
"+",
"(",
"(",
"TC0480SCP_ctrl",
"[",
"0x14",
"+",
"layer",
"]",
"&",
"0xff",
")",
"<<",
"8",
")",
";",
"y_index",
"-=",
"(",
"TC0480SCP_y_offs",
"-",
"min_y",
")",
"*",
"zoomy",
";",
"}",
"if",
"(",
"!",
"machine_flip",
")",
"y",
"=",
"min_y",
";",
"else",
"y",
"=",
"max_y",
";",
"do",
"{",
"src_y_index",
"=",
"(",
"y_index",
">>",
"16",
")",
"&",
"0x1ff",
";",
"row_index",
"=",
"src_y_index",
";",
"if",
"(",
"flip",
")",
"row_index",
"=",
"0x1ff",
"-",
"row_index",
";",
"x_index",
"=",
"sx",
"-",
"(",
"(",
"TC0480SCP_bgscroll_ram",
"[",
"layer",
"]",
"[",
"row_index",
"]",
"<<",
"16",
")",
")",
"-",
"(",
"(",
"TC0480SCP_bgscroll_ram",
"[",
"layer",
"]",
"[",
"row_index",
"+",
"0x800",
"]",
"<<",
"8",
")",
"&",
"0xffff",
")",
";",
"src16",
"=",
"BITMAP_ADDR16",
"(",
"srcbitmap",
",",
"src_y_index",
",",
"0",
")",
";",
"tsrc",
"=",
"BITMAP_ADDR8",
"(",
"flagsbitmap",
",",
"src_y_index",
",",
"0",
")",
";",
"dst16",
"=",
"scanline",
";",
"x_step",
"=",
"zoomx",
";",
"if",
"(",
"flags",
"&",
"TILEMAP_DRAW_OPAQUE",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"screen_width",
";",
"i",
"++",
")",
"{",
"*",
"dst16",
"++",
"=",
"src16",
"[",
"(",
"x_index",
">>",
"16",
")",
"&",
"width_mask",
"]",
";",
"x_index",
"+=",
"x_step",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"screen_width",
";",
"i",
"++",
")",
"{",
"if",
"(",
"tsrc",
"[",
"(",
"x_index",
">>",
"16",
")",
"&",
"width_mask",
"]",
")",
"*",
"dst16",
"++",
"=",
"src16",
"[",
"(",
"x_index",
">>",
"16",
")",
"&",
"width_mask",
"]",
";",
"else",
"*",
"dst16",
"++",
"=",
"0x8000",
";",
"x_index",
"+=",
"x_step",
";",
"}",
"}",
"taitoic_drawscanline",
"(",
"bitmap",
",",
"cliprect",
",",
"0",
",",
"y",
",",
"scanline",
",",
"(",
"flags",
"&",
"TILEMAP_DRAW_OPAQUE",
")",
"?",
"0",
":",
"1",
",",
"ROT0",
",",
"machine",
"->",
"priority_bitmap",
",",
"priority",
")",
";",
"y_index",
"+=",
"zoomy",
";",
"if",
"(",
"!",
"machine_flip",
")",
"y",
"++",
";",
"else",
"y",
"--",
";",
"}",
"while",
"(",
"(",
"!",
"machine_flip",
"&&",
"y",
"<=",
"max_y",
")",
"||",
"(",
"machine_flip",
"&&",
"y",
">=",
"min_y",
")",
")",
";",
"}",
"}"
] | BG0,1 LAYER DRAW
TODO | [
"BG0",
"1",
"LAYER",
"DRAW",
"TODO"
] | [
"/* X-axis zoom offers expansion only: 0 = no zoom, 0xff = max\n Y-axis zoom offers expansion/compression: 0x7f = no zoom, 0xff = max\n (0x1a in Footchmp hiscore = shrunk) */",
"/* no zoom, simple */",
"/* Prevent bad things */",
"/* zoom */",
"/* for ROT 180 ? */",
"//cliprect->max_x - cliprect->min_x + 1;",
"/* TC0480SCP tiles flipscreen */",
"/* row areas are the same in flipscreen, so we must read in reverse */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "layer",
"type": "int"
},
{
"param": "flags",
"type": "int"
},
{
"param": "priority",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "layer",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4f5259d6ddff71a2cb100f4fcef36b10e027f413 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/video/taitoic.c | [
"Unlicense"
] | C | TC0480SCP_bg23_draw | void | static void TC0480SCP_bg23_draw(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority)
{
bitmap_t *srcbitmap = tilemap_get_pixmap(TC0480SCP_tilemap[layer][TC0480SCP_dblwidth]);
bitmap_t *flagsbitmap = tilemap_get_flagsmap
(TC0480SCP_tilemap[layer][TC0480SCP_dblwidth]);
UINT16 *dst16,*src16;
UINT8 *tsrc;
int i,y,y_index,src_y_index,row_index,row_zoom;
int sx,x_index,x_step;
UINT32 zoomx,zoomy;
UINT16 scanline[512];
int flipscreen = TC0480SCP_pri_reg & 0x40;
int machine_flip = 0; /* for ROT 180 ? */
UINT16 screen_width = 512; //cliprect->max_x - cliprect->min_x + 1;
UINT16 min_y = cliprect->min_y;
UINT16 max_y = cliprect->max_y;
int width_mask=0x1ff;
if (TC0480SCP_dblwidth) width_mask=0x3ff;
/* X-axis zoom offers expansion only: 0 = no zoom, 0xff = max
Y-axis zoom offers expansion/compression: 0x7f = no zoom, 0xff = max
(0x1a in Footchmp hiscore = shrunk) */
zoomx = 0x10000 - (TC0480SCP_ctrl[0x08 + layer] &0xff00);
zoomy = 0x10000 - (((TC0480SCP_ctrl[0x08 + layer] &0xff) - 0x7f) * 512);
if (!flipscreen)
{
sx = ((TC0480SCP_bgscrollx[layer] + 15 + layer*4) << 16)
+ ((255-(TC0480SCP_ctrl[0x10 + layer] & 0xff)) << 8);
sx += (TC0480SCP_x_offs - 15 - layer*4) * zoomx;
y_index = (TC0480SCP_bgscrolly[layer] << 16)
+ ((TC0480SCP_ctrl[0x14 + layer] & 0xff) << 8);
y_index -= (TC0480SCP_y_offs - min_y) * zoomy;
}
else /* TC0480SCP tiles flipscreen */
{
sx = ((-TC0480SCP_bgscrollx[layer] + 15 + layer*4 + TC0480SCP_flip_xoffs ) << 16)
+ ((255-(TC0480SCP_ctrl[0x10 + layer] & 0xff)) << 8);
sx += (TC0480SCP_x_offs - 15 - layer*4) * zoomx;
y_index = ((-TC0480SCP_bgscrolly[layer] + TC0480SCP_flip_yoffs) << 16)
+ ((TC0480SCP_ctrl[0x14 + layer] & 0xff) << 8);
y_index -= (TC0480SCP_y_offs - min_y) * zoomy;
}
if (!machine_flip) y=min_y; else y=max_y;
do
{
if (!flipscreen)
src_y_index = ((y_index>>16) + TC0480SCP_bgcolumn_ram[layer][(y -
TC0480SCP_y_offs) &0x1ff]) &0x1ff;
else /* colscroll area is back to front in flipscreen */
src_y_index = ((y_index>>16) + TC0480SCP_bgcolumn_ram[layer][0x1ff -
((y - TC0480SCP_y_offs) &0x1ff)]) &0x1ff;
/* row areas are the same in flipscreen, so we must read in reverse */
row_index = src_y_index;
if (flipscreen) row_index = 0x1ff - row_index;
if (TC0480SCP_pri_reg & (layer-1)) /* bit0 enables for BG2, bit1 for BG3 */
row_zoom = TC0480SCP_rowzoom_ram[layer][row_index];
else
row_zoom = 0;
x_index = sx - ((TC0480SCP_bgscroll_ram[layer][row_index] << 16))
- ((TC0480SCP_bgscroll_ram[layer][row_index+0x800] << 8) &0xffff);
/* flawed calc ?? */
x_index -= (TC0480SCP_x_offs - 0x1f + layer*4) * ((row_zoom &0xff) << 8);
/* We used to kludge 270 multiply factor, before adjusting x_index instead */
x_step = zoomx;
if (row_zoom) /* need to reduce x_step */
{
if (!(row_zoom &0xff00))
x_step -= ((row_zoom * 256) &0xffff);
else /* Undrfire uses the hi byte, why? */
x_step -= (((row_zoom &0xff) * 256) &0xffff);
}
src16 = BITMAP_ADDR16(srcbitmap, src_y_index, 0);
tsrc = BITMAP_ADDR8(flagsbitmap, src_y_index, 0);
dst16 = scanline;
if (flags & TILEMAP_DRAW_OPAQUE)
{
for (i=0; i<screen_width; i++)
{
*dst16++ = src16[(x_index >> 16) &width_mask];
x_index += x_step;
}
}
else
{
for (i=0; i<screen_width; i++)
{
if (tsrc[(x_index >> 16) &width_mask])
*dst16++ = src16[(x_index >> 16) &width_mask];
else
*dst16++ = 0x8000;
x_index += x_step;
}
}
taitoic_drawscanline(bitmap,cliprect,0,y,scanline,(flags & TILEMAP_DRAW_OPAQUE)?0:1,ROT0,machine->priority_bitmap,priority);
y_index += zoomy;
if (!machine_flip) y++; else y--;
}
while ( (!machine_flip && y<=max_y) || (machine_flip && y>=min_y) );
} | /****************************************************************
BG2,3 LAYER DRAW
TODO
----
Broken for any rotation except ROT0. ROT180 support could probably
be added without too much difficulty: machine_flip is there as a
place-holder for this purpose.
Wouldn't work if y needs to be > 255 (i.e. if some game uses a
bigger than usual vertical visible area). Refer to TC0080VCO
custom draw routine for an example of dealing with this.
Low order words for overall layer zoom are not really understood.
In Metalbj initial text screen zoom you can see they ARE words
(not separate bytes); however, I just use the low byte to smooth
the zooming sequences. This is noticeably imperfect on the Y axis.
Verify behaviour of Taito logo (Gunbustr) against real machine
to perfect the row zoom emulation.
What do high bytes of row zoom do - if anything - in UndrFire?
There is still jaggedness to the road in this game and Superchs.
Historical Issues
-----------------
Sometimes BG2/3 were misaligned by 1 pixel horizontally: this
was due to low order byte of 0 causing different (sx >> 16) than
when it was 1-255. To prevent this we use (255-byte) so
(sx >> 16) no longer depends on the low order byte.
In flipscreen we have to bring in extra offsets, since various
games don't have exactly (320-,256-) tilemap scroll deltas in
flipscreen.
****************************************************************/ | BG2,3 LAYER DRAW
TODO
Broken for any rotation except ROT0. ROT180 support could probably
be added without too much difficulty: machine_flip is there as a
place-holder for this purpose.
Wouldn't work if y needs to be > 255 . Refer to TC0080VCO
custom draw routine for an example of dealing with this.
Low order words for overall layer zoom are not really understood.
In Metalbj initial text screen zoom you can see they ARE words
(not separate bytes); however, I just use the low byte to smooth
the zooming sequences. This is noticeably imperfect on the Y axis.
Verify behaviour of Taito logo (Gunbustr) against real machine
to perfect the row zoom emulation.
Historical Issues
Sometimes BG2/3 were misaligned by 1 pixel horizontally: this
was due to low order byte of 0 causing different (sx >> 16) than
when it was 1-255. To prevent this we use (255-byte) so
(sx >> 16) no longer depends on the low order byte.
In flipscreen we have to bring in extra offsets, since various
games don't have exactly (320-,256-) tilemap scroll deltas in
flipscreen. | [
"BG2",
"3",
"LAYER",
"DRAW",
"TODO",
"Broken",
"for",
"any",
"rotation",
"except",
"ROT0",
".",
"ROT180",
"support",
"could",
"probably",
"be",
"added",
"without",
"too",
"much",
"difficulty",
":",
"machine_flip",
"is",
"there",
"as",
"a",
"place",
"-",
"holder",
"for",
"this",
"purpose",
".",
"Wouldn",
"'",
"t",
"work",
"if",
"y",
"needs",
"to",
"be",
">",
"255",
".",
"Refer",
"to",
"TC0080VCO",
"custom",
"draw",
"routine",
"for",
"an",
"example",
"of",
"dealing",
"with",
"this",
".",
"Low",
"order",
"words",
"for",
"overall",
"layer",
"zoom",
"are",
"not",
"really",
"understood",
".",
"In",
"Metalbj",
"initial",
"text",
"screen",
"zoom",
"you",
"can",
"see",
"they",
"ARE",
"words",
"(",
"not",
"separate",
"bytes",
")",
";",
"however",
"I",
"just",
"use",
"the",
"low",
"byte",
"to",
"smooth",
"the",
"zooming",
"sequences",
".",
"This",
"is",
"noticeably",
"imperfect",
"on",
"the",
"Y",
"axis",
".",
"Verify",
"behaviour",
"of",
"Taito",
"logo",
"(",
"Gunbustr",
")",
"against",
"real",
"machine",
"to",
"perfect",
"the",
"row",
"zoom",
"emulation",
".",
"Historical",
"Issues",
"Sometimes",
"BG2",
"/",
"3",
"were",
"misaligned",
"by",
"1",
"pixel",
"horizontally",
":",
"this",
"was",
"due",
"to",
"low",
"order",
"byte",
"of",
"0",
"causing",
"different",
"(",
"sx",
">>",
"16",
")",
"than",
"when",
"it",
"was",
"1",
"-",
"255",
".",
"To",
"prevent",
"this",
"we",
"use",
"(",
"255",
"-",
"byte",
")",
"so",
"(",
"sx",
">>",
"16",
")",
"no",
"longer",
"depends",
"on",
"the",
"low",
"order",
"byte",
".",
"In",
"flipscreen",
"we",
"have",
"to",
"bring",
"in",
"extra",
"offsets",
"since",
"various",
"games",
"don",
"'",
"t",
"have",
"exactly",
"(",
"320",
"-",
"256",
"-",
")",
"tilemap",
"scroll",
"deltas",
"in",
"flipscreen",
"."
] | static void TC0480SCP_bg23_draw(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority)
{
bitmap_t *srcbitmap = tilemap_get_pixmap(TC0480SCP_tilemap[layer][TC0480SCP_dblwidth]);
bitmap_t *flagsbitmap = tilemap_get_flagsmap
(TC0480SCP_tilemap[layer][TC0480SCP_dblwidth]);
UINT16 *dst16,*src16;
UINT8 *tsrc;
int i,y,y_index,src_y_index,row_index,row_zoom;
int sx,x_index,x_step;
UINT32 zoomx,zoomy;
UINT16 scanline[512];
int flipscreen = TC0480SCP_pri_reg & 0x40;
int machine_flip = 0;
UINT16 screen_width = 512;
UINT16 min_y = cliprect->min_y;
UINT16 max_y = cliprect->max_y;
int width_mask=0x1ff;
if (TC0480SCP_dblwidth) width_mask=0x3ff;
zoomx = 0x10000 - (TC0480SCP_ctrl[0x08 + layer] &0xff00);
zoomy = 0x10000 - (((TC0480SCP_ctrl[0x08 + layer] &0xff) - 0x7f) * 512);
if (!flipscreen)
{
sx = ((TC0480SCP_bgscrollx[layer] + 15 + layer*4) << 16)
+ ((255-(TC0480SCP_ctrl[0x10 + layer] & 0xff)) << 8);
sx += (TC0480SCP_x_offs - 15 - layer*4) * zoomx;
y_index = (TC0480SCP_bgscrolly[layer] << 16)
+ ((TC0480SCP_ctrl[0x14 + layer] & 0xff) << 8);
y_index -= (TC0480SCP_y_offs - min_y) * zoomy;
}
else
{
sx = ((-TC0480SCP_bgscrollx[layer] + 15 + layer*4 + TC0480SCP_flip_xoffs ) << 16)
+ ((255-(TC0480SCP_ctrl[0x10 + layer] & 0xff)) << 8);
sx += (TC0480SCP_x_offs - 15 - layer*4) * zoomx;
y_index = ((-TC0480SCP_bgscrolly[layer] + TC0480SCP_flip_yoffs) << 16)
+ ((TC0480SCP_ctrl[0x14 + layer] & 0xff) << 8);
y_index -= (TC0480SCP_y_offs - min_y) * zoomy;
}
if (!machine_flip) y=min_y; else y=max_y;
do
{
if (!flipscreen)
src_y_index = ((y_index>>16) + TC0480SCP_bgcolumn_ram[layer][(y -
TC0480SCP_y_offs) &0x1ff]) &0x1ff;
else
src_y_index = ((y_index>>16) + TC0480SCP_bgcolumn_ram[layer][0x1ff -
((y - TC0480SCP_y_offs) &0x1ff)]) &0x1ff;
row_index = src_y_index;
if (flipscreen) row_index = 0x1ff - row_index;
if (TC0480SCP_pri_reg & (layer-1))
row_zoom = TC0480SCP_rowzoom_ram[layer][row_index];
else
row_zoom = 0;
x_index = sx - ((TC0480SCP_bgscroll_ram[layer][row_index] << 16))
- ((TC0480SCP_bgscroll_ram[layer][row_index+0x800] << 8) &0xffff);
x_index -= (TC0480SCP_x_offs - 0x1f + layer*4) * ((row_zoom &0xff) << 8);
x_step = zoomx;
if (row_zoom)
{
if (!(row_zoom &0xff00))
x_step -= ((row_zoom * 256) &0xffff);
else
x_step -= (((row_zoom &0xff) * 256) &0xffff);
}
src16 = BITMAP_ADDR16(srcbitmap, src_y_index, 0);
tsrc = BITMAP_ADDR8(flagsbitmap, src_y_index, 0);
dst16 = scanline;
if (flags & TILEMAP_DRAW_OPAQUE)
{
for (i=0; i<screen_width; i++)
{
*dst16++ = src16[(x_index >> 16) &width_mask];
x_index += x_step;
}
}
else
{
for (i=0; i<screen_width; i++)
{
if (tsrc[(x_index >> 16) &width_mask])
*dst16++ = src16[(x_index >> 16) &width_mask];
else
*dst16++ = 0x8000;
x_index += x_step;
}
}
taitoic_drawscanline(bitmap,cliprect,0,y,scanline,(flags & TILEMAP_DRAW_OPAQUE)?0:1,ROT0,machine->priority_bitmap,priority);
y_index += zoomy;
if (!machine_flip) y++; else y--;
}
while ( (!machine_flip && y<=max_y) || (machine_flip && y>=min_y) );
} | [
"static",
"void",
"TC0480SCP_bg23_draw",
"(",
"running_machine",
"*",
"machine",
",",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"int",
"layer",
",",
"int",
"flags",
",",
"UINT32",
"priority",
")",
"{",
"bitmap_t",
"*",
"srcbitmap",
"=",
"tilemap_get_pixmap",
"(",
"TC0480SCP_tilemap",
"[",
"layer",
"]",
"[",
"TC0480SCP_dblwidth",
"]",
")",
";",
"bitmap_t",
"*",
"flagsbitmap",
"=",
"tilemap_get_flagsmap",
"(",
"TC0480SCP_tilemap",
"[",
"layer",
"]",
"[",
"TC0480SCP_dblwidth",
"]",
")",
";",
"UINT16",
"*",
"dst16",
",",
"*",
"src16",
";",
"UINT8",
"*",
"tsrc",
";",
"int",
"i",
",",
"y",
",",
"y_index",
",",
"src_y_index",
",",
"row_index",
",",
"row_zoom",
";",
"int",
"sx",
",",
"x_index",
",",
"x_step",
";",
"UINT32",
"zoomx",
",",
"zoomy",
";",
"UINT16",
"scanline",
"[",
"512",
"]",
";",
"int",
"flipscreen",
"=",
"TC0480SCP_pri_reg",
"&",
"0x40",
";",
"int",
"machine_flip",
"=",
"0",
";",
"UINT16",
"screen_width",
"=",
"512",
";",
"UINT16",
"min_y",
"=",
"cliprect",
"->",
"min_y",
";",
"UINT16",
"max_y",
"=",
"cliprect",
"->",
"max_y",
";",
"int",
"width_mask",
"=",
"0x1ff",
";",
"if",
"(",
"TC0480SCP_dblwidth",
")",
"width_mask",
"=",
"0x3ff",
";",
"zoomx",
"=",
"0x10000",
"-",
"(",
"TC0480SCP_ctrl",
"[",
"0x08",
"+",
"layer",
"]",
"&",
"0xff00",
")",
";",
"zoomy",
"=",
"0x10000",
"-",
"(",
"(",
"(",
"TC0480SCP_ctrl",
"[",
"0x08",
"+",
"layer",
"]",
"&",
"0xff",
")",
"-",
"0x7f",
")",
"*",
"512",
")",
";",
"if",
"(",
"!",
"flipscreen",
")",
"{",
"sx",
"=",
"(",
"(",
"TC0480SCP_bgscrollx",
"[",
"layer",
"]",
"+",
"15",
"+",
"layer",
"*",
"4",
")",
"<<",
"16",
")",
"+",
"(",
"(",
"255",
"-",
"(",
"TC0480SCP_ctrl",
"[",
"0x10",
"+",
"layer",
"]",
"&",
"0xff",
")",
")",
"<<",
"8",
")",
";",
"sx",
"+=",
"(",
"TC0480SCP_x_offs",
"-",
"15",
"-",
"layer",
"*",
"4",
")",
"*",
"zoomx",
";",
"y_index",
"=",
"(",
"TC0480SCP_bgscrolly",
"[",
"layer",
"]",
"<<",
"16",
")",
"+",
"(",
"(",
"TC0480SCP_ctrl",
"[",
"0x14",
"+",
"layer",
"]",
"&",
"0xff",
")",
"<<",
"8",
")",
";",
"y_index",
"-=",
"(",
"TC0480SCP_y_offs",
"-",
"min_y",
")",
"*",
"zoomy",
";",
"}",
"else",
"{",
"sx",
"=",
"(",
"(",
"-",
"TC0480SCP_bgscrollx",
"[",
"layer",
"]",
"+",
"15",
"+",
"layer",
"*",
"4",
"+",
"TC0480SCP_flip_xoffs",
")",
"<<",
"16",
")",
"+",
"(",
"(",
"255",
"-",
"(",
"TC0480SCP_ctrl",
"[",
"0x10",
"+",
"layer",
"]",
"&",
"0xff",
")",
")",
"<<",
"8",
")",
";",
"sx",
"+=",
"(",
"TC0480SCP_x_offs",
"-",
"15",
"-",
"layer",
"*",
"4",
")",
"*",
"zoomx",
";",
"y_index",
"=",
"(",
"(",
"-",
"TC0480SCP_bgscrolly",
"[",
"layer",
"]",
"+",
"TC0480SCP_flip_yoffs",
")",
"<<",
"16",
")",
"+",
"(",
"(",
"TC0480SCP_ctrl",
"[",
"0x14",
"+",
"layer",
"]",
"&",
"0xff",
")",
"<<",
"8",
")",
";",
"y_index",
"-=",
"(",
"TC0480SCP_y_offs",
"-",
"min_y",
")",
"*",
"zoomy",
";",
"}",
"if",
"(",
"!",
"machine_flip",
")",
"y",
"=",
"min_y",
";",
"else",
"y",
"=",
"max_y",
";",
"do",
"{",
"if",
"(",
"!",
"flipscreen",
")",
"src_y_index",
"=",
"(",
"(",
"y_index",
">>",
"16",
")",
"+",
"TC0480SCP_bgcolumn_ram",
"[",
"layer",
"]",
"[",
"(",
"y",
"-",
"TC0480SCP_y_offs",
")",
"&",
"0x1ff",
"]",
")",
"&",
"0x1ff",
";",
"else",
"src_y_index",
"=",
"(",
"(",
"y_index",
">>",
"16",
")",
"+",
"TC0480SCP_bgcolumn_ram",
"[",
"layer",
"]",
"[",
"0x1ff",
"-",
"(",
"(",
"y",
"-",
"TC0480SCP_y_offs",
")",
"&",
"0x1ff",
")",
"]",
")",
"&",
"0x1ff",
";",
"row_index",
"=",
"src_y_index",
";",
"if",
"(",
"flipscreen",
")",
"row_index",
"=",
"0x1ff",
"-",
"row_index",
";",
"if",
"(",
"TC0480SCP_pri_reg",
"&",
"(",
"layer",
"-",
"1",
")",
")",
"row_zoom",
"=",
"TC0480SCP_rowzoom_ram",
"[",
"layer",
"]",
"[",
"row_index",
"]",
";",
"else",
"row_zoom",
"=",
"0",
";",
"x_index",
"=",
"sx",
"-",
"(",
"(",
"TC0480SCP_bgscroll_ram",
"[",
"layer",
"]",
"[",
"row_index",
"]",
"<<",
"16",
")",
")",
"-",
"(",
"(",
"TC0480SCP_bgscroll_ram",
"[",
"layer",
"]",
"[",
"row_index",
"+",
"0x800",
"]",
"<<",
"8",
")",
"&",
"0xffff",
")",
";",
"x_index",
"-=",
"(",
"TC0480SCP_x_offs",
"-",
"0x1f",
"+",
"layer",
"*",
"4",
")",
"*",
"(",
"(",
"row_zoom",
"&",
"0xff",
")",
"<<",
"8",
")",
";",
"x_step",
"=",
"zoomx",
";",
"if",
"(",
"row_zoom",
")",
"{",
"if",
"(",
"!",
"(",
"row_zoom",
"&",
"0xff00",
")",
")",
"x_step",
"-=",
"(",
"(",
"row_zoom",
"*",
"256",
")",
"&",
"0xffff",
")",
";",
"else",
"x_step",
"-=",
"(",
"(",
"(",
"row_zoom",
"&",
"0xff",
")",
"*",
"256",
")",
"&",
"0xffff",
")",
";",
"}",
"src16",
"=",
"BITMAP_ADDR16",
"(",
"srcbitmap",
",",
"src_y_index",
",",
"0",
")",
";",
"tsrc",
"=",
"BITMAP_ADDR8",
"(",
"flagsbitmap",
",",
"src_y_index",
",",
"0",
")",
";",
"dst16",
"=",
"scanline",
";",
"if",
"(",
"flags",
"&",
"TILEMAP_DRAW_OPAQUE",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"screen_width",
";",
"i",
"++",
")",
"{",
"*",
"dst16",
"++",
"=",
"src16",
"[",
"(",
"x_index",
">>",
"16",
")",
"&",
"width_mask",
"]",
";",
"x_index",
"+=",
"x_step",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"screen_width",
";",
"i",
"++",
")",
"{",
"if",
"(",
"tsrc",
"[",
"(",
"x_index",
">>",
"16",
")",
"&",
"width_mask",
"]",
")",
"*",
"dst16",
"++",
"=",
"src16",
"[",
"(",
"x_index",
">>",
"16",
")",
"&",
"width_mask",
"]",
";",
"else",
"*",
"dst16",
"++",
"=",
"0x8000",
";",
"x_index",
"+=",
"x_step",
";",
"}",
"}",
"taitoic_drawscanline",
"(",
"bitmap",
",",
"cliprect",
",",
"0",
",",
"y",
",",
"scanline",
",",
"(",
"flags",
"&",
"TILEMAP_DRAW_OPAQUE",
")",
"?",
"0",
":",
"1",
",",
"ROT0",
",",
"machine",
"->",
"priority_bitmap",
",",
"priority",
")",
";",
"y_index",
"+=",
"zoomy",
";",
"if",
"(",
"!",
"machine_flip",
")",
"y",
"++",
";",
"else",
"y",
"--",
";",
"}",
"while",
"(",
"(",
"!",
"machine_flip",
"&&",
"y",
"<=",
"max_y",
")",
"||",
"(",
"machine_flip",
"&&",
"y",
">=",
"min_y",
")",
")",
";",
"}"
] | BG2,3 LAYER DRAW
TODO | [
"BG2",
"3",
"LAYER",
"DRAW",
"TODO"
] | [
"/* for ROT 180 ? */",
"//cliprect->max_x - cliprect->min_x + 1;",
"/* X-axis zoom offers expansion only: 0 = no zoom, 0xff = max\n Y-axis zoom offers expansion/compression: 0x7f = no zoom, 0xff = max\n (0x1a in Footchmp hiscore = shrunk) */",
"/* TC0480SCP tiles flipscreen */",
"/* colscroll area is back to front in flipscreen */",
"/* row areas are the same in flipscreen, so we must read in reverse */",
"/* bit0 enables for BG2, bit1 for BG3 */",
"/* flawed calc ?? */",
"/* We used to kludge 270 multiply factor, before adjusting x_index instead */",
"/* need to reduce x_step */",
"/* Undrfire uses the hi byte, why? */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "layer",
"type": "int"
},
{
"param": "flags",
"type": "int"
},
{
"param": "priority",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "layer",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
caf3b9ef62f1a5ee86af888d286c127a585b22cc | lofunz/mieme | Reloaded/trunk/src/emu/crsshair.c | [
"Unlicense"
] | C | create_bitmap | void | static void create_bitmap(running_machine *machine, int player)
{
int x, y;
char filename[20];
rgb_t color = crosshair_colors[player];
/* if we have a bitmap for this player, kill it */
global_free(global.bitmap[player]);
if (global.name[player][0] != 0)
{
/* look for user specified file */
sprintf(filename, "%s.png", global.name[player]);
global.bitmap[player] = render_load_png(OPTION_CROSSHAIRPATH, NULL, filename, NULL, NULL);
}
else
{
/* look for default cross?.png in crsshair\game dir */
sprintf(filename, "cross%d.png", player + 1);
global.bitmap[player] = render_load_png(OPTION_CROSSHAIRPATH, machine->gamedrv->name, filename, NULL, NULL);
/* look for default cross?.png in crsshair dir */
if (global.bitmap[player] == NULL)
global.bitmap[player] = render_load_png(OPTION_CROSSHAIRPATH, NULL, filename, NULL, NULL);
}
/* if that didn't work, use the built-in one */
if (global.bitmap[player] == NULL)
{
/* allocate a blank bitmap to start with */
global.bitmap[player] = global_alloc(bitmap_t(CROSSHAIR_RAW_SIZE, CROSSHAIR_RAW_SIZE, BITMAP_FORMAT_ARGB32));
bitmap_fill(global.bitmap[player], NULL, MAKE_ARGB(0x00,0xff,0xff,0xff));
/* extract the raw source data to it */
for (y = 0; y < CROSSHAIR_RAW_SIZE / 2; y++)
{
/* assume it is mirrored vertically */
UINT32 *dest0 = BITMAP_ADDR32(global.bitmap[player], y, 0);
UINT32 *dest1 = BITMAP_ADDR32(global.bitmap[player], CROSSHAIR_RAW_SIZE - 1 - y, 0);
/* extract to two rows simultaneously */
for (x = 0; x < CROSSHAIR_RAW_SIZE; x++)
if ((crosshair_raw_top[y * CROSSHAIR_RAW_ROWBYTES + x / 8] << (x % 8)) & 0x80)
dest0[x] = dest1[x] = MAKE_ARGB(0xff,0x00,0x00,0x00) | color;
}
}
/* create a texture to reference the bitmap */
global.texture[player] = render_texture_alloc(render_texture_hq_scale, NULL);
render_texture_set_bitmap(global.texture[player], global.bitmap[player], NULL, TEXFORMAT_ARGB32, NULL);
} | /*-------------------------------------------------
create_bitmap - create the rendering
structures for the given player
-------------------------------------------------*/ | create the rendering
structures for the given player | [
"create",
"the",
"rendering",
"structures",
"for",
"the",
"given",
"player"
] | static void create_bitmap(running_machine *machine, int player)
{
int x, y;
char filename[20];
rgb_t color = crosshair_colors[player];
global_free(global.bitmap[player]);
if (global.name[player][0] != 0)
{
sprintf(filename, "%s.png", global.name[player]);
global.bitmap[player] = render_load_png(OPTION_CROSSHAIRPATH, NULL, filename, NULL, NULL);
}
else
{
sprintf(filename, "cross%d.png", player + 1);
global.bitmap[player] = render_load_png(OPTION_CROSSHAIRPATH, machine->gamedrv->name, filename, NULL, NULL);
if (global.bitmap[player] == NULL)
global.bitmap[player] = render_load_png(OPTION_CROSSHAIRPATH, NULL, filename, NULL, NULL);
}
if (global.bitmap[player] == NULL)
{
global.bitmap[player] = global_alloc(bitmap_t(CROSSHAIR_RAW_SIZE, CROSSHAIR_RAW_SIZE, BITMAP_FORMAT_ARGB32));
bitmap_fill(global.bitmap[player], NULL, MAKE_ARGB(0x00,0xff,0xff,0xff));
for (y = 0; y < CROSSHAIR_RAW_SIZE / 2; y++)
{
UINT32 *dest0 = BITMAP_ADDR32(global.bitmap[player], y, 0);
UINT32 *dest1 = BITMAP_ADDR32(global.bitmap[player], CROSSHAIR_RAW_SIZE - 1 - y, 0);
for (x = 0; x < CROSSHAIR_RAW_SIZE; x++)
if ((crosshair_raw_top[y * CROSSHAIR_RAW_ROWBYTES + x / 8] << (x % 8)) & 0x80)
dest0[x] = dest1[x] = MAKE_ARGB(0xff,0x00,0x00,0x00) | color;
}
}
global.texture[player] = render_texture_alloc(render_texture_hq_scale, NULL);
render_texture_set_bitmap(global.texture[player], global.bitmap[player], NULL, TEXFORMAT_ARGB32, NULL);
} | [
"static",
"void",
"create_bitmap",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"player",
")",
"{",
"int",
"x",
",",
"y",
";",
"char",
"filename",
"[",
"20",
"]",
";",
"rgb_t",
"color",
"=",
"crosshair_colors",
"[",
"player",
"]",
";",
"global_free",
"(",
"global",
".",
"bitmap",
"[",
"player",
"]",
")",
";",
"if",
"(",
"global",
".",
"name",
"[",
"player",
"]",
"[",
"0",
"]",
"!=",
"0",
")",
"{",
"sprintf",
"(",
"filename",
",",
"\"",
"\"",
",",
"global",
".",
"name",
"[",
"player",
"]",
")",
";",
"global",
".",
"bitmap",
"[",
"player",
"]",
"=",
"render_load_png",
"(",
"OPTION_CROSSHAIRPATH",
",",
"NULL",
",",
"filename",
",",
"NULL",
",",
"NULL",
")",
";",
"}",
"else",
"{",
"sprintf",
"(",
"filename",
",",
"\"",
"\"",
",",
"player",
"+",
"1",
")",
";",
"global",
".",
"bitmap",
"[",
"player",
"]",
"=",
"render_load_png",
"(",
"OPTION_CROSSHAIRPATH",
",",
"machine",
"->",
"gamedrv",
"->",
"name",
",",
"filename",
",",
"NULL",
",",
"NULL",
")",
";",
"if",
"(",
"global",
".",
"bitmap",
"[",
"player",
"]",
"==",
"NULL",
")",
"global",
".",
"bitmap",
"[",
"player",
"]",
"=",
"render_load_png",
"(",
"OPTION_CROSSHAIRPATH",
",",
"NULL",
",",
"filename",
",",
"NULL",
",",
"NULL",
")",
";",
"}",
"if",
"(",
"global",
".",
"bitmap",
"[",
"player",
"]",
"==",
"NULL",
")",
"{",
"global",
".",
"bitmap",
"[",
"player",
"]",
"=",
"global_alloc",
"(",
"bitmap_t",
"(",
"CROSSHAIR_RAW_SIZE",
",",
"CROSSHAIR_RAW_SIZE",
",",
"BITMAP_FORMAT_ARGB32",
")",
")",
";",
"bitmap_fill",
"(",
"global",
".",
"bitmap",
"[",
"player",
"]",
",",
"NULL",
",",
"MAKE_ARGB",
"(",
"0x00",
",",
"0xff",
",",
"0xff",
",",
"0xff",
")",
")",
";",
"for",
"(",
"y",
"=",
"0",
";",
"y",
"<",
"CROSSHAIR_RAW_SIZE",
"/",
"2",
";",
"y",
"++",
")",
"{",
"UINT32",
"*",
"dest0",
"=",
"BITMAP_ADDR32",
"(",
"global",
".",
"bitmap",
"[",
"player",
"]",
",",
"y",
",",
"0",
")",
";",
"UINT32",
"*",
"dest1",
"=",
"BITMAP_ADDR32",
"(",
"global",
".",
"bitmap",
"[",
"player",
"]",
",",
"CROSSHAIR_RAW_SIZE",
"-",
"1",
"-",
"y",
",",
"0",
")",
";",
"for",
"(",
"x",
"=",
"0",
";",
"x",
"<",
"CROSSHAIR_RAW_SIZE",
";",
"x",
"++",
")",
"if",
"(",
"(",
"crosshair_raw_top",
"[",
"y",
"*",
"CROSSHAIR_RAW_ROWBYTES",
"+",
"x",
"/",
"8",
"]",
"<<",
"(",
"x",
"%",
"8",
")",
")",
"&",
"0x80",
")",
"dest0",
"[",
"x",
"]",
"=",
"dest1",
"[",
"x",
"]",
"=",
"MAKE_ARGB",
"(",
"0xff",
",",
"0x00",
",",
"0x00",
",",
"0x00",
")",
"|",
"color",
";",
"}",
"}",
"global",
".",
"texture",
"[",
"player",
"]",
"=",
"render_texture_alloc",
"(",
"render_texture_hq_scale",
",",
"NULL",
")",
";",
"render_texture_set_bitmap",
"(",
"global",
".",
"texture",
"[",
"player",
"]",
",",
"global",
".",
"bitmap",
"[",
"player",
"]",
",",
"NULL",
",",
"TEXFORMAT_ARGB32",
",",
"NULL",
")",
";",
"}"
] | create_bitmap - create the rendering
structures for the given player | [
"create_bitmap",
"-",
"create",
"the",
"rendering",
"structures",
"for",
"the",
"given",
"player"
] | [
"/* if we have a bitmap for this player, kill it */",
"/* look for user specified file */",
"/* look for default cross?.png in crsshair\\game dir */",
"/* look for default cross?.png in crsshair dir */",
"/* if that didn't work, use the built-in one */",
"/* allocate a blank bitmap to start with */",
"/* extract the raw source data to it */",
"/* assume it is mirrored vertically */",
"/* extract to two rows simultaneously */",
"/* create a texture to reference the bitmap */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "player",
"type": "int"
}
] | {
"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
}
],
"outlier_params": [],
"others": []
} |
caf3b9ef62f1a5ee86af888d286c127a585b22cc | lofunz/mieme | Reloaded/trunk/src/emu/crsshair.c | [
"Unlicense"
] | C | crosshair_init | void | void crosshair_init(running_machine *machine)
{
const input_port_config *port;
const input_field_config *field;
/* request a callback upon exiting */
machine->add_notifier(MACHINE_NOTIFY_EXIT, crosshair_exit);
/* clear all the globals */
memset(&global, 0, sizeof(global));
/* setup the default auto visibility time */
global.auto_time = CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT;
/* determine who needs crosshairs */
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
for (field = port->fieldlist; field != NULL; field = field->next)
if (field->crossaxis != CROSSHAIR_AXIS_NONE)
{
int player = field->player;
assert(player < MAX_PLAYERS);
/* mark as used and set the default visibility and mode */
global.usage = TRUE;
global.used[player] = TRUE;
global.mode[player] = CROSSHAIR_VISIBILITY_DEFAULT;
global.visible[player] = (CROSSHAIR_VISIBILITY_DEFAULT == CROSSHAIR_VISIBILITY_OFF) ? FALSE : TRUE;
/* for now, use the main screen */
global.screen[player] = machine->primary_screen;
create_bitmap(machine, player);
}
/* register callbacks for when we load/save configurations */
if (global.usage)
config_register(machine, "crosshairs", crosshair_load, crosshair_save);
/* register the animation callback */
if (machine->primary_screen != NULL)
machine->primary_screen->register_vblank_callback(animate, NULL);
} | /*-------------------------------------------------
crosshair_init - initialize the crosshair
bitmaps and such
-------------------------------------------------*/ | initialize the crosshair
bitmaps and such | [
"initialize",
"the",
"crosshair",
"bitmaps",
"and",
"such"
] | void crosshair_init(running_machine *machine)
{
const input_port_config *port;
const input_field_config *field;
machine->add_notifier(MACHINE_NOTIFY_EXIT, crosshair_exit);
memset(&global, 0, sizeof(global));
global.auto_time = CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT;
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
for (field = port->fieldlist; field != NULL; field = field->next)
if (field->crossaxis != CROSSHAIR_AXIS_NONE)
{
int player = field->player;
assert(player < MAX_PLAYERS);
global.usage = TRUE;
global.used[player] = TRUE;
global.mode[player] = CROSSHAIR_VISIBILITY_DEFAULT;
global.visible[player] = (CROSSHAIR_VISIBILITY_DEFAULT == CROSSHAIR_VISIBILITY_OFF) ? FALSE : TRUE;
global.screen[player] = machine->primary_screen;
create_bitmap(machine, player);
}
if (global.usage)
config_register(machine, "crosshairs", crosshair_load, crosshair_save);
if (machine->primary_screen != NULL)
machine->primary_screen->register_vblank_callback(animate, NULL);
} | [
"void",
"crosshair_init",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"const",
"input_port_config",
"*",
"port",
";",
"const",
"input_field_config",
"*",
"field",
";",
"machine",
"->",
"add_notifier",
"(",
"MACHINE_NOTIFY_EXIT",
",",
"crosshair_exit",
")",
";",
"memset",
"(",
"&",
"global",
",",
"0",
",",
"sizeof",
"(",
"global",
")",
")",
";",
"global",
".",
"auto_time",
"=",
"CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT",
";",
"for",
"(",
"port",
"=",
"machine",
"->",
"m_portlist",
".",
"first",
"(",
")",
";",
"port",
"!=",
"NULL",
";",
"port",
"=",
"port",
"->",
"next",
"(",
")",
")",
"for",
"(",
"field",
"=",
"port",
"->",
"fieldlist",
";",
"field",
"!=",
"NULL",
";",
"field",
"=",
"field",
"->",
"next",
")",
"if",
"(",
"field",
"->",
"crossaxis",
"!=",
"CROSSHAIR_AXIS_NONE",
")",
"{",
"int",
"player",
"=",
"field",
"->",
"player",
";",
"assert",
"(",
"player",
"<",
"MAX_PLAYERS",
")",
";",
"global",
".",
"usage",
"=",
"TRUE",
";",
"global",
".",
"used",
"[",
"player",
"]",
"=",
"TRUE",
";",
"global",
".",
"mode",
"[",
"player",
"]",
"=",
"CROSSHAIR_VISIBILITY_DEFAULT",
";",
"global",
".",
"visible",
"[",
"player",
"]",
"=",
"(",
"CROSSHAIR_VISIBILITY_DEFAULT",
"==",
"CROSSHAIR_VISIBILITY_OFF",
")",
"?",
"FALSE",
":",
"TRUE",
";",
"global",
".",
"screen",
"[",
"player",
"]",
"=",
"machine",
"->",
"primary_screen",
";",
"create_bitmap",
"(",
"machine",
",",
"player",
")",
";",
"}",
"if",
"(",
"global",
".",
"usage",
")",
"config_register",
"(",
"machine",
",",
"\"",
"\"",
",",
"crosshair_load",
",",
"crosshair_save",
")",
";",
"if",
"(",
"machine",
"->",
"primary_screen",
"!=",
"NULL",
")",
"machine",
"->",
"primary_screen",
"->",
"register_vblank_callback",
"(",
"animate",
",",
"NULL",
")",
";",
"}"
] | crosshair_init - initialize the crosshair
bitmaps and such | [
"crosshair_init",
"-",
"initialize",
"the",
"crosshair",
"bitmaps",
"and",
"such"
] | [
"/* request a callback upon exiting */",
"/* clear all the globals */",
"/* setup the default auto visibility time */",
"/* determine who needs crosshairs */",
"/* mark as used and set the default visibility and mode */",
"/* for now, use the main screen */",
"/* register callbacks for when we load/save configurations */",
"/* register the animation callback */"
] | [
{
"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": []
} |
caf3b9ef62f1a5ee86af888d286c127a585b22cc | lofunz/mieme | Reloaded/trunk/src/emu/crsshair.c | [
"Unlicense"
] | C | crosshair_get_user_settings | void | void crosshair_get_user_settings(running_machine *machine, UINT8 player, crosshair_user_settings *settings)
{
settings->auto_time = global.auto_time;
settings->used = global.used[player];
settings->mode = global.mode[player];
strcpy(settings->name, global.name[player]);
} | /*-------------------------------------------------
crosshair_get_user_settings - return the
current crosshair settings for a player
Note: auto_time is common for all players
-------------------------------------------------*/ | return the
current crosshair settings for a player
Note: auto_time is common for all players | [
"return",
"the",
"current",
"crosshair",
"settings",
"for",
"a",
"player",
"Note",
":",
"auto_time",
"is",
"common",
"for",
"all",
"players"
] | void crosshair_get_user_settings(running_machine *machine, UINT8 player, crosshair_user_settings *settings)
{
settings->auto_time = global.auto_time;
settings->used = global.used[player];
settings->mode = global.mode[player];
strcpy(settings->name, global.name[player]);
} | [
"void",
"crosshair_get_user_settings",
"(",
"running_machine",
"*",
"machine",
",",
"UINT8",
"player",
",",
"crosshair_user_settings",
"*",
"settings",
")",
"{",
"settings",
"->",
"auto_time",
"=",
"global",
".",
"auto_time",
";",
"settings",
"->",
"used",
"=",
"global",
".",
"used",
"[",
"player",
"]",
";",
"settings",
"->",
"mode",
"=",
"global",
".",
"mode",
"[",
"player",
"]",
";",
"strcpy",
"(",
"settings",
"->",
"name",
",",
"global",
".",
"name",
"[",
"player",
"]",
")",
";",
"}"
] | crosshair_get_user_settings - return the
current crosshair settings for a player
Note: auto_time is common for all players | [
"crosshair_get_user_settings",
"-",
"return",
"the",
"current",
"crosshair",
"settings",
"for",
"a",
"player",
"Note",
":",
"auto_time",
"is",
"common",
"for",
"all",
"players"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "player",
"type": "UINT8"
},
{
"param": "settings",
"type": "crosshair_user_settings"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "player",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "settings",
"type": "crosshair_user_settings",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
caf3b9ef62f1a5ee86af888d286c127a585b22cc | lofunz/mieme | Reloaded/trunk/src/emu/crsshair.c | [
"Unlicense"
] | C | crosshair_set_user_settings | void | void crosshair_set_user_settings(running_machine *machine, UINT8 player, crosshair_user_settings *settings)
{
int changed = FALSE;
global.auto_time = settings->auto_time;
global.used[player] = settings->used;
global.mode[player] = settings->mode;
/* set visibility as specified by mode */
/* auto mode starts with visibility off */
global.visible[player] = (settings->mode == CROSSHAIR_VISIBILITY_ON) ? TRUE : FALSE;
/* update bitmap if name has changed */
changed = strcmp(settings->name, global.name[player]);
strcpy(global.name[player], settings->name);
if (changed)
create_bitmap(machine, player);
} | /*-------------------------------------------------
crosshair_set_user_settings - modify the
current crosshair settings for a player
Note: auto_time is common for all players
-------------------------------------------------*/ | modify the
current crosshair settings for a player
Note: auto_time is common for all players | [
"modify",
"the",
"current",
"crosshair",
"settings",
"for",
"a",
"player",
"Note",
":",
"auto_time",
"is",
"common",
"for",
"all",
"players"
] | void crosshair_set_user_settings(running_machine *machine, UINT8 player, crosshair_user_settings *settings)
{
int changed = FALSE;
global.auto_time = settings->auto_time;
global.used[player] = settings->used;
global.mode[player] = settings->mode;
global.visible[player] = (settings->mode == CROSSHAIR_VISIBILITY_ON) ? TRUE : FALSE;
changed = strcmp(settings->name, global.name[player]);
strcpy(global.name[player], settings->name);
if (changed)
create_bitmap(machine, player);
} | [
"void",
"crosshair_set_user_settings",
"(",
"running_machine",
"*",
"machine",
",",
"UINT8",
"player",
",",
"crosshair_user_settings",
"*",
"settings",
")",
"{",
"int",
"changed",
"=",
"FALSE",
";",
"global",
".",
"auto_time",
"=",
"settings",
"->",
"auto_time",
";",
"global",
".",
"used",
"[",
"player",
"]",
"=",
"settings",
"->",
"used",
";",
"global",
".",
"mode",
"[",
"player",
"]",
"=",
"settings",
"->",
"mode",
";",
"global",
".",
"visible",
"[",
"player",
"]",
"=",
"(",
"settings",
"->",
"mode",
"==",
"CROSSHAIR_VISIBILITY_ON",
")",
"?",
"TRUE",
":",
"FALSE",
";",
"changed",
"=",
"strcmp",
"(",
"settings",
"->",
"name",
",",
"global",
".",
"name",
"[",
"player",
"]",
")",
";",
"strcpy",
"(",
"global",
".",
"name",
"[",
"player",
"]",
",",
"settings",
"->",
"name",
")",
";",
"if",
"(",
"changed",
")",
"create_bitmap",
"(",
"machine",
",",
"player",
")",
";",
"}"
] | crosshair_set_user_settings - modify the
current crosshair settings for a player
Note: auto_time is common for all players | [
"crosshair_set_user_settings",
"-",
"modify",
"the",
"current",
"crosshair",
"settings",
"for",
"a",
"player",
"Note",
":",
"auto_time",
"is",
"common",
"for",
"all",
"players"
] | [
"/* set visibility as specified by mode */",
"/* auto mode starts with visibility off */",
"/* update bitmap if name has changed */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "player",
"type": "UINT8"
},
{
"param": "settings",
"type": "crosshair_user_settings"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "player",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "settings",
"type": "crosshair_user_settings",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
caf3b9ef62f1a5ee86af888d286c127a585b22cc | lofunz/mieme | Reloaded/trunk/src/emu/crsshair.c | [
"Unlicense"
] | C | crosshair_load | void | static void crosshair_load(running_machine *machine, int config_type, xml_data_node *parentnode)
{
/* Note: crosshair_load() is only registered if croshairs are used */
xml_data_node *crosshairnode;
int auto_time;
/* we only care about game files */
if (config_type != CONFIG_TYPE_GAME)
return;
/* might not have any data */
if (parentnode == NULL)
return;
/* loop and get player crosshair info */
for (crosshairnode = xml_get_sibling(parentnode->child, "crosshair"); crosshairnode; crosshairnode = xml_get_sibling(crosshairnode->next, "crosshair"))
{
int player, mode;
player = xml_get_attribute_int(crosshairnode, "player", -1);
/* check to make sure we have a valid player */
/* also check if the player really uses a crosshair */
if (player >=0 && player < MAX_PLAYERS && global.used[player])
{
/* get, check, and store visibility mode */
mode = xml_get_attribute_int(crosshairnode, "mode", CROSSHAIR_VISIBILITY_DEFAULT);
if (mode >= CROSSHAIR_VISIBILITY_OFF && mode <= CROSSHAIR_VISIBILITY_AUTO)
{
global.mode[player] = (UINT8)mode;
/* set visibility as specified by mode */
/* auto mode starts with visibility off */
global.visible[player] = (mode == CROSSHAIR_VISIBILITY_ON) ? TRUE : FALSE;
}
/* get and store crosshair pic name, truncate name to max length */
strncpy(global.name[player], xml_get_attribute_string(crosshairnode, "pic", ""), CROSSHAIR_PIC_NAME_LENGTH);
/* update bitmap */
create_bitmap(machine, player);
}
}
/* get, check, and store auto visibility time */
crosshairnode = xml_get_sibling(parentnode->child, "autotime");
if (crosshairnode != NULL)
{
auto_time = xml_get_attribute_int(crosshairnode, "val", CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT);
if ((auto_time >= CROSSHAIR_VISIBILITY_AUTOTIME_MIN) && (auto_time <= CROSSHAIR_VISIBILITY_AUTOTIME_MAX))
global.auto_time = (UINT8)auto_time;
}
} | /*-------------------------------------------------
crosshair_load - read and apply data from the
configuration file
-------------------------------------------------*/ | read and apply data from the
configuration file | [
"read",
"and",
"apply",
"data",
"from",
"the",
"configuration",
"file"
] | static void crosshair_load(running_machine *machine, int config_type, xml_data_node *parentnode)
{
xml_data_node *crosshairnode;
int auto_time;
if (config_type != CONFIG_TYPE_GAME)
return;
if (parentnode == NULL)
return;
for (crosshairnode = xml_get_sibling(parentnode->child, "crosshair"); crosshairnode; crosshairnode = xml_get_sibling(crosshairnode->next, "crosshair"))
{
int player, mode;
player = xml_get_attribute_int(crosshairnode, "player", -1);
if (player >=0 && player < MAX_PLAYERS && global.used[player])
{
mode = xml_get_attribute_int(crosshairnode, "mode", CROSSHAIR_VISIBILITY_DEFAULT);
if (mode >= CROSSHAIR_VISIBILITY_OFF && mode <= CROSSHAIR_VISIBILITY_AUTO)
{
global.mode[player] = (UINT8)mode;
global.visible[player] = (mode == CROSSHAIR_VISIBILITY_ON) ? TRUE : FALSE;
}
strncpy(global.name[player], xml_get_attribute_string(crosshairnode, "pic", ""), CROSSHAIR_PIC_NAME_LENGTH);
create_bitmap(machine, player);
}
}
crosshairnode = xml_get_sibling(parentnode->child, "autotime");
if (crosshairnode != NULL)
{
auto_time = xml_get_attribute_int(crosshairnode, "val", CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT);
if ((auto_time >= CROSSHAIR_VISIBILITY_AUTOTIME_MIN) && (auto_time <= CROSSHAIR_VISIBILITY_AUTOTIME_MAX))
global.auto_time = (UINT8)auto_time;
}
} | [
"static",
"void",
"crosshair_load",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"config_type",
",",
"xml_data_node",
"*",
"parentnode",
")",
"{",
"xml_data_node",
"*",
"crosshairnode",
";",
"int",
"auto_time",
";",
"if",
"(",
"config_type",
"!=",
"CONFIG_TYPE_GAME",
")",
"return",
";",
"if",
"(",
"parentnode",
"==",
"NULL",
")",
"return",
";",
"for",
"(",
"crosshairnode",
"=",
"xml_get_sibling",
"(",
"parentnode",
"->",
"child",
",",
"\"",
"\"",
")",
";",
"crosshairnode",
";",
"crosshairnode",
"=",
"xml_get_sibling",
"(",
"crosshairnode",
"->",
"next",
",",
"\"",
"\"",
")",
")",
"{",
"int",
"player",
",",
"mode",
";",
"player",
"=",
"xml_get_attribute_int",
"(",
"crosshairnode",
",",
"\"",
"\"",
",",
"-1",
")",
";",
"if",
"(",
"player",
">=",
"0",
"&&",
"player",
"<",
"MAX_PLAYERS",
"&&",
"global",
".",
"used",
"[",
"player",
"]",
")",
"{",
"mode",
"=",
"xml_get_attribute_int",
"(",
"crosshairnode",
",",
"\"",
"\"",
",",
"CROSSHAIR_VISIBILITY_DEFAULT",
")",
";",
"if",
"(",
"mode",
">=",
"CROSSHAIR_VISIBILITY_OFF",
"&&",
"mode",
"<=",
"CROSSHAIR_VISIBILITY_AUTO",
")",
"{",
"global",
".",
"mode",
"[",
"player",
"]",
"=",
"(",
"UINT8",
")",
"mode",
";",
"global",
".",
"visible",
"[",
"player",
"]",
"=",
"(",
"mode",
"==",
"CROSSHAIR_VISIBILITY_ON",
")",
"?",
"TRUE",
":",
"FALSE",
";",
"}",
"strncpy",
"(",
"global",
".",
"name",
"[",
"player",
"]",
",",
"xml_get_attribute_string",
"(",
"crosshairnode",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"CROSSHAIR_PIC_NAME_LENGTH",
")",
";",
"create_bitmap",
"(",
"machine",
",",
"player",
")",
";",
"}",
"}",
"crosshairnode",
"=",
"xml_get_sibling",
"(",
"parentnode",
"->",
"child",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"crosshairnode",
"!=",
"NULL",
")",
"{",
"auto_time",
"=",
"xml_get_attribute_int",
"(",
"crosshairnode",
",",
"\"",
"\"",
",",
"CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT",
")",
";",
"if",
"(",
"(",
"auto_time",
">=",
"CROSSHAIR_VISIBILITY_AUTOTIME_MIN",
")",
"&&",
"(",
"auto_time",
"<=",
"CROSSHAIR_VISIBILITY_AUTOTIME_MAX",
")",
")",
"global",
".",
"auto_time",
"=",
"(",
"UINT8",
")",
"auto_time",
";",
"}",
"}"
] | crosshair_load - read and apply data from the
configuration file | [
"crosshair_load",
"-",
"read",
"and",
"apply",
"data",
"from",
"the",
"configuration",
"file"
] | [
"/* Note: crosshair_load() is only registered if croshairs are used */",
"/* we only care about game files */",
"/* might not have any data */",
"/* loop and get player crosshair info */",
"/* check to make sure we have a valid player */",
"/* also check if the player really uses a crosshair */",
"/* get, check, and store visibility mode */",
"/* set visibility as specified by mode */",
"/* auto mode starts with visibility off */",
"/* get and store crosshair pic name, truncate name to max length */",
"/* update bitmap */",
"/* get, check, and store auto visibility time */"
] | [
{
"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": []
} |
caf3b9ef62f1a5ee86af888d286c127a585b22cc | lofunz/mieme | Reloaded/trunk/src/emu/crsshair.c | [
"Unlicense"
] | C | crosshair_save | void | static void crosshair_save(running_machine *machine, int config_type, xml_data_node *parentnode)
{
/* Note: crosshair_save() is only registered if crosshairs are used */
xml_data_node *crosshairnode;
int player;
/* we only care about game files */
if (config_type != CONFIG_TYPE_GAME)
return;
for (player = 0; player < MAX_PLAYERS; player++)
{
if (global.used[player])
{
/* create a node */
crosshairnode = xml_add_child(parentnode, "crosshair", NULL);
if (crosshairnode != NULL)
{
int changed = FALSE;
xml_set_attribute_int(crosshairnode, "player", player);
if (global.visible[player] != CROSSHAIR_VISIBILITY_DEFAULT)
{
xml_set_attribute_int(crosshairnode, "mode", global.mode[player]);
changed = TRUE;
}
/* the default graphic name is "", so only save if not */
if (strlen(global.name[player]) > 0)
{
xml_set_attribute(crosshairnode, "pic", global.name[player]);
changed = TRUE;
}
/* if nothing changed, kill the node */
if (!changed)
xml_delete_node(crosshairnode);
}
}
}
/* always store autotime so that it stays at the user value if it is needed */
if (global.auto_time != CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT)
{
/* create a node */
crosshairnode = xml_add_child(parentnode, "autotime", NULL);
if (crosshairnode != NULL)
xml_set_attribute_int(crosshairnode, "val", global.auto_time);
}
} | /*-------------------------------------------------
crosshair_save - save data to the
configuration file
-------------------------------------------------*/ | save data to the
configuration file | [
"save",
"data",
"to",
"the",
"configuration",
"file"
] | static void crosshair_save(running_machine *machine, int config_type, xml_data_node *parentnode)
{
xml_data_node *crosshairnode;
int player;
if (config_type != CONFIG_TYPE_GAME)
return;
for (player = 0; player < MAX_PLAYERS; player++)
{
if (global.used[player])
{
crosshairnode = xml_add_child(parentnode, "crosshair", NULL);
if (crosshairnode != NULL)
{
int changed = FALSE;
xml_set_attribute_int(crosshairnode, "player", player);
if (global.visible[player] != CROSSHAIR_VISIBILITY_DEFAULT)
{
xml_set_attribute_int(crosshairnode, "mode", global.mode[player]);
changed = TRUE;
}
if (strlen(global.name[player]) > 0)
{
xml_set_attribute(crosshairnode, "pic", global.name[player]);
changed = TRUE;
}
if (!changed)
xml_delete_node(crosshairnode);
}
}
}
if (global.auto_time != CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT)
{
crosshairnode = xml_add_child(parentnode, "autotime", NULL);
if (crosshairnode != NULL)
xml_set_attribute_int(crosshairnode, "val", global.auto_time);
}
} | [
"static",
"void",
"crosshair_save",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"config_type",
",",
"xml_data_node",
"*",
"parentnode",
")",
"{",
"xml_data_node",
"*",
"crosshairnode",
";",
"int",
"player",
";",
"if",
"(",
"config_type",
"!=",
"CONFIG_TYPE_GAME",
")",
"return",
";",
"for",
"(",
"player",
"=",
"0",
";",
"player",
"<",
"MAX_PLAYERS",
";",
"player",
"++",
")",
"{",
"if",
"(",
"global",
".",
"used",
"[",
"player",
"]",
")",
"{",
"crosshairnode",
"=",
"xml_add_child",
"(",
"parentnode",
",",
"\"",
"\"",
",",
"NULL",
")",
";",
"if",
"(",
"crosshairnode",
"!=",
"NULL",
")",
"{",
"int",
"changed",
"=",
"FALSE",
";",
"xml_set_attribute_int",
"(",
"crosshairnode",
",",
"\"",
"\"",
",",
"player",
")",
";",
"if",
"(",
"global",
".",
"visible",
"[",
"player",
"]",
"!=",
"CROSSHAIR_VISIBILITY_DEFAULT",
")",
"{",
"xml_set_attribute_int",
"(",
"crosshairnode",
",",
"\"",
"\"",
",",
"global",
".",
"mode",
"[",
"player",
"]",
")",
";",
"changed",
"=",
"TRUE",
";",
"}",
"if",
"(",
"strlen",
"(",
"global",
".",
"name",
"[",
"player",
"]",
")",
">",
"0",
")",
"{",
"xml_set_attribute",
"(",
"crosshairnode",
",",
"\"",
"\"",
",",
"global",
".",
"name",
"[",
"player",
"]",
")",
";",
"changed",
"=",
"TRUE",
";",
"}",
"if",
"(",
"!",
"changed",
")",
"xml_delete_node",
"(",
"crosshairnode",
")",
";",
"}",
"}",
"}",
"if",
"(",
"global",
".",
"auto_time",
"!=",
"CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT",
")",
"{",
"crosshairnode",
"=",
"xml_add_child",
"(",
"parentnode",
",",
"\"",
"\"",
",",
"NULL",
")",
";",
"if",
"(",
"crosshairnode",
"!=",
"NULL",
")",
"xml_set_attribute_int",
"(",
"crosshairnode",
",",
"\"",
"\"",
",",
"global",
".",
"auto_time",
")",
";",
"}",
"}"
] | crosshair_save - save data to the
configuration file | [
"crosshair_save",
"-",
"save",
"data",
"to",
"the",
"configuration",
"file"
] | [
"/* Note: crosshair_save() is only registered if crosshairs are used */",
"/* we only care about game files */",
"/* create a node */",
"/* the default graphic name is \"\", so only save if not */",
"/* if nothing changed, kill the node */",
"/* always store autotime so that it stays at the user value if it is needed */",
"/* create a node */"
] | [
{
"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": []
} |
6d60ac93772158c3c4737b94d2f2e06d4ac8e381 | lofunz/mieme | Reloaded/trunk/src/mame/drivers/ninjakd2.c | [
"Unlicense"
] | C | omegaf_io_protection_reset | void | void omegaf_io_protection_reset(void)
{
// make sure protection starts in a known state
omegaf_io_protection[0] = 0;
omegaf_io_protection[1] = 0;
omegaf_io_protection[2] = 0;
omegaf_io_protection_input = 0;
omegaf_io_protection_tic = 0;
} | /*************************************
*
* Omega Fighter I/O protection simulation
*
*************************************/ | Omega Fighter I/O protection simulation | [
"Omega",
"Fighter",
"I",
"/",
"O",
"protection",
"simulation"
] | void omegaf_io_protection_reset(void)
{
omegaf_io_protection[0] = 0;
omegaf_io_protection[1] = 0;
omegaf_io_protection[2] = 0;
omegaf_io_protection_input = 0;
omegaf_io_protection_tic = 0;
} | [
"void",
"omegaf_io_protection_reset",
"(",
"void",
")",
"{",
"omegaf_io_protection",
"[",
"0",
"]",
"=",
"0",
";",
"omegaf_io_protection",
"[",
"1",
"]",
"=",
"0",
";",
"omegaf_io_protection",
"[",
"2",
"]",
"=",
"0",
";",
"omegaf_io_protection_input",
"=",
"0",
";",
"omegaf_io_protection_tic",
"=",
"0",
";",
"}"
] | Omega Fighter I/O protection simulation | [
"Omega",
"Fighter",
"I",
"/",
"O",
"protection",
"simulation"
] | [
"// make sure protection starts in a known state\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
cac6494b9f325b52c32331a558716b360043f365 | lofunz/mieme | Reloaded/trunk/src/mame/drivers/taito_b.c | [
"Unlicense"
] | C | mb87078_gain_changed | void | static void mb87078_gain_changed( running_machine *machine, int channel, int percent )
{
taitob_state *state = machine->driver_data<taitob_state>();
if (channel == 1)
{
sound_set_output_gain(state->ym, 0, percent / 100.0);
sound_set_output_gain(state->ym, 1, percent / 100.0);
sound_set_output_gain(state->ym, 2, percent / 100.0);
//popmessage("MB87078 gain ch#%i percent=%i", channel, percent);
}
} | /*
Games that use the mb87078 are: pbobble, spacedx and qzshowby
schems are not available, but from the writes I guess that
they only use channel 1
The sound chips' volume altered with the mb87078 are:
ym2610 in spacedx,
ym2610b in pbobble,qzshowby,
Both ym2610 and ym2610b generate 3 (PSG like) + 2 (fm left,right) channels.
I use mixer_set_volume() to emulate the effect.
*/ | Games that use the mb87078 are: pbobble, spacedx and qzshowby
schems are not available, but from the writes I guess that
they only use channel 1
The sound chips' volume altered with the mb87078 are:
ym2610 in spacedx,
ym2610b in pbobble,qzshowby.
Both ym2610 and ym2610b generate 3 (PSG like) + 2 (fm left,right) channels.
I use mixer_set_volume() to emulate the effect. | [
"Games",
"that",
"use",
"the",
"mb87078",
"are",
":",
"pbobble",
"spacedx",
"and",
"qzshowby",
"schems",
"are",
"not",
"available",
"but",
"from",
"the",
"writes",
"I",
"guess",
"that",
"they",
"only",
"use",
"channel",
"1",
"The",
"sound",
"chips",
"'",
"volume",
"altered",
"with",
"the",
"mb87078",
"are",
":",
"ym2610",
"in",
"spacedx",
"ym2610b",
"in",
"pbobble",
"qzshowby",
".",
"Both",
"ym2610",
"and",
"ym2610b",
"generate",
"3",
"(",
"PSG",
"like",
")",
"+",
"2",
"(",
"fm",
"left",
"right",
")",
"channels",
".",
"I",
"use",
"mixer_set_volume",
"()",
"to",
"emulate",
"the",
"effect",
"."
] | static void mb87078_gain_changed( running_machine *machine, int channel, int percent )
{
taitob_state *state = machine->driver_data<taitob_state>();
if (channel == 1)
{
sound_set_output_gain(state->ym, 0, percent / 100.0);
sound_set_output_gain(state->ym, 1, percent / 100.0);
sound_set_output_gain(state->ym, 2, percent / 100.0);
}
} | [
"static",
"void",
"mb87078_gain_changed",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"channel",
",",
"int",
"percent",
")",
"{",
"taitob_state",
"*",
"state",
"=",
"machine",
"->",
"driver_data",
"<",
"taitob_state",
">",
"(",
"",
")",
";",
"if",
"(",
"channel",
"==",
"1",
")",
"{",
"sound_set_output_gain",
"(",
"state",
"->",
"ym",
",",
"0",
",",
"percent",
"/",
"100.0",
")",
";",
"sound_set_output_gain",
"(",
"state",
"->",
"ym",
",",
"1",
",",
"percent",
"/",
"100.0",
")",
";",
"sound_set_output_gain",
"(",
"state",
"->",
"ym",
",",
"2",
",",
"percent",
"/",
"100.0",
")",
";",
"}",
"}"
] | Games that use the mb87078 are: pbobble, spacedx and qzshowby
schems are not available, but from the writes I guess that
they only use channel 1
The sound chips' volume altered with the mb87078 are:
ym2610 in spacedx,
ym2610b in pbobble,qzshowby, | [
"Games",
"that",
"use",
"the",
"mb87078",
"are",
":",
"pbobble",
"spacedx",
"and",
"qzshowby",
"schems",
"are",
"not",
"available",
"but",
"from",
"the",
"writes",
"I",
"guess",
"that",
"they",
"only",
"use",
"channel",
"1",
"The",
"sound",
"chips",
"'",
"volume",
"altered",
"with",
"the",
"mb87078",
"are",
":",
"ym2610",
"in",
"spacedx",
"ym2610b",
"in",
"pbobble",
"qzshowby"
] | [
"//popmessage(\"MB87078 gain ch#%i percent=%i\", channel, percent);\r"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "channel",
"type": "int"
},
{
"param": "percent",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "channel",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "percent",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6087a7b4e0c385b75bbc8542cb0ab67fc004a035 | lofunz/mieme | Reloaded/trunk/src/mame/drivers/pcxt.c | [
"Unlicense"
] | C | cga_graphic_bitmap | void | static void cga_graphic_bitmap(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,UINT16 size,UINT32 map_offs)
{
static UINT16 x,y;
static UINT32 offs;
SET_VISIBLE_AREA(320,200);
offs = map_offs;
for(y=0;y<200;y+=2)
for(x=0;x<320;x+=4)
{
*BITMAP_ADDR16(bitmap, y, x+0) = machine->pens[0x200+(((vga_vram[offs] & 0xc0)>>6)<<1)];
*BITMAP_ADDR16(bitmap, y, x+1) = machine->pens[0x200+(((vga_vram[offs] & 0x30)>>4)<<1)];
*BITMAP_ADDR16(bitmap, y, x+2) = machine->pens[0x200+(((vga_vram[offs] & 0x0c)>>2)<<1)];
*BITMAP_ADDR16(bitmap, y, x+3) = machine->pens[0x200+(((vga_vram[offs] & 0x03)>>0)<<1)];
offs++;
}
offs = 0x2000+map_offs;
for(y=1;y<200;y+=2)
for(x=0;x<320;x+=4)
{
*BITMAP_ADDR16(bitmap, y, x+0) = machine->pens[0x200+(((vga_vram[offs] & 0xc0)>>6)<<1)];
*BITMAP_ADDR16(bitmap, y, x+1) = machine->pens[0x200+(((vga_vram[offs] & 0x30)>>4)<<1)];
*BITMAP_ADDR16(bitmap, y, x+2) = machine->pens[0x200+(((vga_vram[offs] & 0x0c)>>2)<<1)];
*BITMAP_ADDR16(bitmap, y, x+3) = machine->pens[0x200+(((vga_vram[offs] & 0x03)>>0)<<1)];
offs++;
}
} | /*Basic Graphic mode */
/*TODO: non-black colours should use the bright versions*/ | Basic Graphic mode
TODO: non-black colours should use the bright versions | [
"Basic",
"Graphic",
"mode",
"TODO",
":",
"non",
"-",
"black",
"colours",
"should",
"use",
"the",
"bright",
"versions"
] | static void cga_graphic_bitmap(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,UINT16 size,UINT32 map_offs)
{
static UINT16 x,y;
static UINT32 offs;
SET_VISIBLE_AREA(320,200);
offs = map_offs;
for(y=0;y<200;y+=2)
for(x=0;x<320;x+=4)
{
*BITMAP_ADDR16(bitmap, y, x+0) = machine->pens[0x200+(((vga_vram[offs] & 0xc0)>>6)<<1)];
*BITMAP_ADDR16(bitmap, y, x+1) = machine->pens[0x200+(((vga_vram[offs] & 0x30)>>4)<<1)];
*BITMAP_ADDR16(bitmap, y, x+2) = machine->pens[0x200+(((vga_vram[offs] & 0x0c)>>2)<<1)];
*BITMAP_ADDR16(bitmap, y, x+3) = machine->pens[0x200+(((vga_vram[offs] & 0x03)>>0)<<1)];
offs++;
}
offs = 0x2000+map_offs;
for(y=1;y<200;y+=2)
for(x=0;x<320;x+=4)
{
*BITMAP_ADDR16(bitmap, y, x+0) = machine->pens[0x200+(((vga_vram[offs] & 0xc0)>>6)<<1)];
*BITMAP_ADDR16(bitmap, y, x+1) = machine->pens[0x200+(((vga_vram[offs] & 0x30)>>4)<<1)];
*BITMAP_ADDR16(bitmap, y, x+2) = machine->pens[0x200+(((vga_vram[offs] & 0x0c)>>2)<<1)];
*BITMAP_ADDR16(bitmap, y, x+3) = machine->pens[0x200+(((vga_vram[offs] & 0x03)>>0)<<1)];
offs++;
}
} | [
"static",
"void",
"cga_graphic_bitmap",
"(",
"running_machine",
"*",
"machine",
",",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"UINT16",
"size",
",",
"UINT32",
"map_offs",
")",
"{",
"static",
"UINT16",
"x",
",",
"y",
";",
"static",
"UINT32",
"offs",
";",
"SET_VISIBLE_AREA",
"(",
"320",
",",
"200",
")",
";",
"offs",
"=",
"map_offs",
";",
"for",
"(",
"y",
"=",
"0",
";",
"y",
"<",
"200",
";",
"y",
"+=",
"2",
")",
"for",
"(",
"x",
"=",
"0",
";",
"x",
"<",
"320",
";",
"x",
"+=",
"4",
")",
"{",
"*",
"BITMAP_ADDR16",
"(",
"bitmap",
",",
"y",
",",
"x",
"+",
"0",
")",
"=",
"machine",
"->",
"pens",
"[",
"0x200",
"+",
"(",
"(",
"(",
"vga_vram",
"[",
"offs",
"]",
"&",
"0xc0",
")",
">>",
"6",
")",
"<<",
"1",
")",
"]",
";",
"*",
"BITMAP_ADDR16",
"(",
"bitmap",
",",
"y",
",",
"x",
"+",
"1",
")",
"=",
"machine",
"->",
"pens",
"[",
"0x200",
"+",
"(",
"(",
"(",
"vga_vram",
"[",
"offs",
"]",
"&",
"0x30",
")",
">>",
"4",
")",
"<<",
"1",
")",
"]",
";",
"*",
"BITMAP_ADDR16",
"(",
"bitmap",
",",
"y",
",",
"x",
"+",
"2",
")",
"=",
"machine",
"->",
"pens",
"[",
"0x200",
"+",
"(",
"(",
"(",
"vga_vram",
"[",
"offs",
"]",
"&",
"0x0c",
")",
">>",
"2",
")",
"<<",
"1",
")",
"]",
";",
"*",
"BITMAP_ADDR16",
"(",
"bitmap",
",",
"y",
",",
"x",
"+",
"3",
")",
"=",
"machine",
"->",
"pens",
"[",
"0x200",
"+",
"(",
"(",
"(",
"vga_vram",
"[",
"offs",
"]",
"&",
"0x03",
")",
">>",
"0",
")",
"<<",
"1",
")",
"]",
";",
"offs",
"++",
";",
"}",
"offs",
"=",
"0x2000",
"+",
"map_offs",
";",
"for",
"(",
"y",
"=",
"1",
";",
"y",
"<",
"200",
";",
"y",
"+=",
"2",
")",
"for",
"(",
"x",
"=",
"0",
";",
"x",
"<",
"320",
";",
"x",
"+=",
"4",
")",
"{",
"*",
"BITMAP_ADDR16",
"(",
"bitmap",
",",
"y",
",",
"x",
"+",
"0",
")",
"=",
"machine",
"->",
"pens",
"[",
"0x200",
"+",
"(",
"(",
"(",
"vga_vram",
"[",
"offs",
"]",
"&",
"0xc0",
")",
">>",
"6",
")",
"<<",
"1",
")",
"]",
";",
"*",
"BITMAP_ADDR16",
"(",
"bitmap",
",",
"y",
",",
"x",
"+",
"1",
")",
"=",
"machine",
"->",
"pens",
"[",
"0x200",
"+",
"(",
"(",
"(",
"vga_vram",
"[",
"offs",
"]",
"&",
"0x30",
")",
">>",
"4",
")",
"<<",
"1",
")",
"]",
";",
"*",
"BITMAP_ADDR16",
"(",
"bitmap",
",",
"y",
",",
"x",
"+",
"2",
")",
"=",
"machine",
"->",
"pens",
"[",
"0x200",
"+",
"(",
"(",
"(",
"vga_vram",
"[",
"offs",
"]",
"&",
"0x0c",
")",
">>",
"2",
")",
"<<",
"1",
")",
"]",
";",
"*",
"BITMAP_ADDR16",
"(",
"bitmap",
",",
"y",
",",
"x",
"+",
"3",
")",
"=",
"machine",
"->",
"pens",
"[",
"0x200",
"+",
"(",
"(",
"(",
"vga_vram",
"[",
"offs",
"]",
"&",
"0x03",
")",
">>",
"0",
")",
"<<",
"1",
")",
"]",
";",
"offs",
"++",
";",
"}",
"}"
] | Basic Graphic mode
TODO: non-black colours should use the bright versions | [
"Basic",
"Graphic",
"mode",
"TODO",
":",
"non",
"-",
"black",
"colours",
"should",
"use",
"the",
"bright",
"versions"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "size",
"type": "UINT16"
},
{
"param": "map_offs",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "size",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "map_offs",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f48730c9c1d4f482e9c44610beb1d2bf3193b372 | lofunz/mieme | Reloaded/trunk/src/mame/drivers/segamsys.c | [
"Unlicense"
] | C | segae_md_sms_stop_scanline_timer | void | void segae_md_sms_stop_scanline_timer(void)
{
timer_adjust_oneshot(md_sms_vdp->sms_scanline_timer, attotime_never, 0);
memset(md_sms_vdp->vram,0x00,0x4000);
} | /* stop timer and clear ram.. used on megatech when we switch between genesis and sms mode */ | stop timer and clear ram.. used on megatech when we switch between genesis and sms mode | [
"stop",
"timer",
"and",
"clear",
"ram",
"..",
"used",
"on",
"megatech",
"when",
"we",
"switch",
"between",
"genesis",
"and",
"sms",
"mode"
] | void segae_md_sms_stop_scanline_timer(void)
{
timer_adjust_oneshot(md_sms_vdp->sms_scanline_timer, attotime_never, 0);
memset(md_sms_vdp->vram,0x00,0x4000);
} | [
"void",
"segae_md_sms_stop_scanline_timer",
"(",
"void",
")",
"{",
"timer_adjust_oneshot",
"(",
"md_sms_vdp",
"->",
"sms_scanline_timer",
",",
"attotime_never",
",",
"0",
")",
";",
"memset",
"(",
"md_sms_vdp",
"->",
"vram",
",",
"0x00",
",",
"0x4000",
")",
";",
"}"
] | stop timer and clear ram.. used on megatech when we switch between genesis and sms mode | [
"stop",
"timer",
"and",
"clear",
"ram",
"..",
"used",
"on",
"megatech",
"when",
"we",
"switch",
"between",
"genesis",
"and",
"sms",
"mode"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
ca6ce477f6b0ae127f04a036c155174fae376bef | lofunz/mieme | Reloaded/trunk/src/mame/machine/pgmprot.c | [
"Unlicense"
] | C | asic3_compute_hold | void | static void asic3_compute_hold(running_machine *machine)
{
pgm_state *state = machine->driver_data<pgm_state>();
// The mode is dependent on the region
static const int modes[4] = { 1, 1, 3, 2 };
int mode = modes[input_port_read(machine, "Region") & 3];
switch (mode)
{
case 1:
state->asic3_hold =
(state->asic3_hold << 1)
^ 0x2bad
^ BIT(state->asic3_hold, 15) ^ BIT(state->asic3_hold, 10) ^ BIT(state->asic3_hold, 8) ^ BIT(state->asic3_hold, 5)
^ BIT(state->asic3_z, state->asic3_y)
^ (BIT(state->asic3_x, 0) << 1) ^ (BIT(state->asic3_x, 1) << 6) ^ (BIT(state->asic3_x, 2) << 10) ^ (BIT(state->asic3_x, 3) << 14);
break;
case 2:
state->asic3_hold =
(state->asic3_hold << 1)
^ 0x2bad
^ BIT(state->asic3_hold, 15) ^ BIT(state->asic3_hold, 7) ^ BIT(state->asic3_hold, 6) ^ BIT(state->asic3_hold, 5)
^ BIT(state->asic3_z, state->asic3_y)
^ (BIT(state->asic3_x, 0) << 4) ^ (BIT(state->asic3_x, 1) << 6) ^ (BIT(state->asic3_x, 2) << 10) ^ (BIT(state->asic3_x, 3) << 12);
break;
case 3:
state->asic3_hold =
(state->asic3_hold << 1)
^ 0x2bad
^ BIT(state->asic3_hold, 15) ^ BIT(state->asic3_hold, 10) ^ BIT(state->asic3_hold, 8) ^ BIT(state->asic3_hold, 5)
^ BIT(state->asic3_z, state->asic3_y)
^ (BIT(state->asic3_x, 0) << 4) ^ (BIT(state->asic3_x, 1) << 6) ^ (BIT(state->asic3_x, 2) << 10) ^ (BIT(state->asic3_x, 3) << 12);
break;
}
} | /*** ASIC 3 (oriental legends protection) ****************************************/ | ASIC 3 (oriental legends protection) | [
"ASIC",
"3",
"(",
"oriental",
"legends",
"protection",
")"
] | static void asic3_compute_hold(running_machine *machine)
{
pgm_state *state = machine->driver_data<pgm_state>();
static const int modes[4] = { 1, 1, 3, 2 };
int mode = modes[input_port_read(machine, "Region") & 3];
switch (mode)
{
case 1:
state->asic3_hold =
(state->asic3_hold << 1)
^ 0x2bad
^ BIT(state->asic3_hold, 15) ^ BIT(state->asic3_hold, 10) ^ BIT(state->asic3_hold, 8) ^ BIT(state->asic3_hold, 5)
^ BIT(state->asic3_z, state->asic3_y)
^ (BIT(state->asic3_x, 0) << 1) ^ (BIT(state->asic3_x, 1) << 6) ^ (BIT(state->asic3_x, 2) << 10) ^ (BIT(state->asic3_x, 3) << 14);
break;
case 2:
state->asic3_hold =
(state->asic3_hold << 1)
^ 0x2bad
^ BIT(state->asic3_hold, 15) ^ BIT(state->asic3_hold, 7) ^ BIT(state->asic3_hold, 6) ^ BIT(state->asic3_hold, 5)
^ BIT(state->asic3_z, state->asic3_y)
^ (BIT(state->asic3_x, 0) << 4) ^ (BIT(state->asic3_x, 1) << 6) ^ (BIT(state->asic3_x, 2) << 10) ^ (BIT(state->asic3_x, 3) << 12);
break;
case 3:
state->asic3_hold =
(state->asic3_hold << 1)
^ 0x2bad
^ BIT(state->asic3_hold, 15) ^ BIT(state->asic3_hold, 10) ^ BIT(state->asic3_hold, 8) ^ BIT(state->asic3_hold, 5)
^ BIT(state->asic3_z, state->asic3_y)
^ (BIT(state->asic3_x, 0) << 4) ^ (BIT(state->asic3_x, 1) << 6) ^ (BIT(state->asic3_x, 2) << 10) ^ (BIT(state->asic3_x, 3) << 12);
break;
}
} | [
"static",
"void",
"asic3_compute_hold",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"pgm_state",
"*",
"state",
"=",
"machine",
"->",
"driver_data",
"<",
"pgm_state",
">",
"(",
"",
")",
";",
"static",
"const",
"int",
"modes",
"[",
"4",
"]",
"=",
"{",
"1",
",",
"1",
",",
"3",
",",
"2",
"}",
";",
"int",
"mode",
"=",
"modes",
"[",
"input_port_read",
"(",
"machine",
",",
"\"",
"\"",
")",
"&",
"3",
"]",
";",
"switch",
"(",
"mode",
")",
"{",
"case",
"1",
":",
"state",
"->",
"asic3_hold",
"=",
"(",
"state",
"->",
"asic3_hold",
"<<",
"1",
")",
"^",
"0x2bad",
"^",
"BIT",
"(",
"state",
"->",
"asic3_hold",
",",
"15",
")",
"^",
"BIT",
"(",
"state",
"->",
"asic3_hold",
",",
"10",
")",
"^",
"BIT",
"(",
"state",
"->",
"asic3_hold",
",",
"8",
")",
"^",
"BIT",
"(",
"state",
"->",
"asic3_hold",
",",
"5",
")",
"^",
"BIT",
"(",
"state",
"->",
"asic3_z",
",",
"state",
"->",
"asic3_y",
")",
"^",
"(",
"BIT",
"(",
"state",
"->",
"asic3_x",
",",
"0",
")",
"<<",
"1",
")",
"^",
"(",
"BIT",
"(",
"state",
"->",
"asic3_x",
",",
"1",
")",
"<<",
"6",
")",
"^",
"(",
"BIT",
"(",
"state",
"->",
"asic3_x",
",",
"2",
")",
"<<",
"10",
")",
"^",
"(",
"BIT",
"(",
"state",
"->",
"asic3_x",
",",
"3",
")",
"<<",
"14",
")",
";",
"break",
";",
"case",
"2",
":",
"state",
"->",
"asic3_hold",
"=",
"(",
"state",
"->",
"asic3_hold",
"<<",
"1",
")",
"^",
"0x2bad",
"^",
"BIT",
"(",
"state",
"->",
"asic3_hold",
",",
"15",
")",
"^",
"BIT",
"(",
"state",
"->",
"asic3_hold",
",",
"7",
")",
"^",
"BIT",
"(",
"state",
"->",
"asic3_hold",
",",
"6",
")",
"^",
"BIT",
"(",
"state",
"->",
"asic3_hold",
",",
"5",
")",
"^",
"BIT",
"(",
"state",
"->",
"asic3_z",
",",
"state",
"->",
"asic3_y",
")",
"^",
"(",
"BIT",
"(",
"state",
"->",
"asic3_x",
",",
"0",
")",
"<<",
"4",
")",
"^",
"(",
"BIT",
"(",
"state",
"->",
"asic3_x",
",",
"1",
")",
"<<",
"6",
")",
"^",
"(",
"BIT",
"(",
"state",
"->",
"asic3_x",
",",
"2",
")",
"<<",
"10",
")",
"^",
"(",
"BIT",
"(",
"state",
"->",
"asic3_x",
",",
"3",
")",
"<<",
"12",
")",
";",
"break",
";",
"case",
"3",
":",
"state",
"->",
"asic3_hold",
"=",
"(",
"state",
"->",
"asic3_hold",
"<<",
"1",
")",
"^",
"0x2bad",
"^",
"BIT",
"(",
"state",
"->",
"asic3_hold",
",",
"15",
")",
"^",
"BIT",
"(",
"state",
"->",
"asic3_hold",
",",
"10",
")",
"^",
"BIT",
"(",
"state",
"->",
"asic3_hold",
",",
"8",
")",
"^",
"BIT",
"(",
"state",
"->",
"asic3_hold",
",",
"5",
")",
"^",
"BIT",
"(",
"state",
"->",
"asic3_z",
",",
"state",
"->",
"asic3_y",
")",
"^",
"(",
"BIT",
"(",
"state",
"->",
"asic3_x",
",",
"0",
")",
"<<",
"4",
")",
"^",
"(",
"BIT",
"(",
"state",
"->",
"asic3_x",
",",
"1",
")",
"<<",
"6",
")",
"^",
"(",
"BIT",
"(",
"state",
"->",
"asic3_x",
",",
"2",
")",
"<<",
"10",
")",
"^",
"(",
"BIT",
"(",
"state",
"->",
"asic3_x",
",",
"3",
")",
"<<",
"12",
")",
";",
"break",
";",
"}",
"}"
] | ASIC 3 (oriental legends protection) | [
"ASIC",
"3",
"(",
"oriental",
"legends",
"protection",
")"
] | [
"// The mode is dependent on the region\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": []
} |
99fbf6b355135ff7d4d9d2feef8f07924f8f07cb | lofunz/mieme | Reloaded/trunk/src/mame/drivers/bestleag.c | [
"Unlicense"
] | C | draw_sprites | void | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
{
UINT16 *spriteram16 = machine->generic.spriteram.u16;
/*
Sprites are the same to sslam, but using 16x16 sprites instead of 8x8
*/
int offs;
for (offs = 0x16/2;offs < machine->generic.spriteram_size/2;offs += 4)
{
int code = spriteram16[offs+3] & 0xfff;
int color = (spriteram16[offs+2] & 0xf000) >> 12;
int sx = (spriteram16[offs+2] & 0x1ff) - 20;
int sy = (0xff - (spriteram16[offs+0] & 0xff)) - 15;
int flipx = (spriteram16[offs+0] & 0x4000) >> 14;
/* Sprite list end code */
if(spriteram16[offs+0] & 0x2000)
return;
/* it can change sprites color mask like the original set */
if(bestleag_vregs[0x00/2] & 0x1000)
color &= 7;
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
code,
color,
flipx, 0,
flipx ? (sx+16) : (sx),sy,15);
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
code+1,
color,
flipx, 0,
flipx ? (sx) : (sx+16),sy,15);
/* wraparound x */
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
code,
color,
flipx, 0,
flipx ? (sx+16 - 512) : (sx - 512),sy,15);
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
code+1,
color,
flipx, 0,
flipx ? (sx - 512) : (sx+16 - 512),sy,15);
}
} | /*
Note: sprite chip is different than the other Big Striker sets and they
include several similiarities with other Playmark games (including
the sprite end code and the data being offset (i.e. spriteram starting from 0x16/2))
*/ | sprite chip is different than the other Big Striker sets and they
include several similiarities with other Playmark games (including
the sprite end code and the data being offset ) | [
"sprite",
"chip",
"is",
"different",
"than",
"the",
"other",
"Big",
"Striker",
"sets",
"and",
"they",
"include",
"several",
"similiarities",
"with",
"other",
"Playmark",
"games",
"(",
"including",
"the",
"sprite",
"end",
"code",
"and",
"the",
"data",
"being",
"offset",
")"
] | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
{
UINT16 *spriteram16 = machine->generic.spriteram.u16;
int offs;
for (offs = 0x16/2;offs < machine->generic.spriteram_size/2;offs += 4)
{
int code = spriteram16[offs+3] & 0xfff;
int color = (spriteram16[offs+2] & 0xf000) >> 12;
int sx = (spriteram16[offs+2] & 0x1ff) - 20;
int sy = (0xff - (spriteram16[offs+0] & 0xff)) - 15;
int flipx = (spriteram16[offs+0] & 0x4000) >> 14;
if(spriteram16[offs+0] & 0x2000)
return;
if(bestleag_vregs[0x00/2] & 0x1000)
color &= 7;
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
code,
color,
flipx, 0,
flipx ? (sx+16) : (sx),sy,15);
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
code+1,
color,
flipx, 0,
flipx ? (sx) : (sx+16),sy,15);
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
code,
color,
flipx, 0,
flipx ? (sx+16 - 512) : (sx - 512),sy,15);
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
code+1,
color,
flipx, 0,
flipx ? (sx - 512) : (sx+16 - 512),sy,15);
}
} | [
"static",
"void",
"draw_sprites",
"(",
"running_machine",
"*",
"machine",
",",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
")",
"{",
"UINT16",
"*",
"spriteram16",
"=",
"machine",
"->",
"generic",
".",
"spriteram",
".",
"u16",
";",
"int",
"offs",
";",
"for",
"(",
"offs",
"=",
"0x16",
"/",
"2",
";",
"offs",
"<",
"machine",
"->",
"generic",
".",
"spriteram_size",
"/",
"2",
";",
"offs",
"+=",
"4",
")",
"{",
"int",
"code",
"=",
"spriteram16",
"[",
"offs",
"+",
"3",
"]",
"&",
"0xfff",
";",
"int",
"color",
"=",
"(",
"spriteram16",
"[",
"offs",
"+",
"2",
"]",
"&",
"0xf000",
")",
">>",
"12",
";",
"int",
"sx",
"=",
"(",
"spriteram16",
"[",
"offs",
"+",
"2",
"]",
"&",
"0x1ff",
")",
"-",
"20",
";",
"int",
"sy",
"=",
"(",
"0xff",
"-",
"(",
"spriteram16",
"[",
"offs",
"+",
"0",
"]",
"&",
"0xff",
")",
")",
"-",
"15",
";",
"int",
"flipx",
"=",
"(",
"spriteram16",
"[",
"offs",
"+",
"0",
"]",
"&",
"0x4000",
")",
">>",
"14",
";",
"if",
"(",
"spriteram16",
"[",
"offs",
"+",
"0",
"]",
"&",
"0x2000",
")",
"return",
";",
"if",
"(",
"bestleag_vregs",
"[",
"0x00",
"/",
"2",
"]",
"&",
"0x1000",
")",
"color",
"&=",
"7",
";",
"drawgfx_transpen",
"(",
"bitmap",
",",
"cliprect",
",",
"machine",
"->",
"gfx",
"[",
"2",
"]",
",",
"code",
",",
"color",
",",
"flipx",
",",
"0",
",",
"flipx",
"?",
"(",
"sx",
"+",
"16",
")",
":",
"(",
"sx",
")",
",",
"sy",
",",
"15",
")",
";",
"drawgfx_transpen",
"(",
"bitmap",
",",
"cliprect",
",",
"machine",
"->",
"gfx",
"[",
"2",
"]",
",",
"code",
"+",
"1",
",",
"color",
",",
"flipx",
",",
"0",
",",
"flipx",
"?",
"(",
"sx",
")",
":",
"(",
"sx",
"+",
"16",
")",
",",
"sy",
",",
"15",
")",
";",
"drawgfx_transpen",
"(",
"bitmap",
",",
"cliprect",
",",
"machine",
"->",
"gfx",
"[",
"2",
"]",
",",
"code",
",",
"color",
",",
"flipx",
",",
"0",
",",
"flipx",
"?",
"(",
"sx",
"+",
"16",
"-",
"512",
")",
":",
"(",
"sx",
"-",
"512",
")",
",",
"sy",
",",
"15",
")",
";",
"drawgfx_transpen",
"(",
"bitmap",
",",
"cliprect",
",",
"machine",
"->",
"gfx",
"[",
"2",
"]",
",",
"code",
"+",
"1",
",",
"color",
",",
"flipx",
",",
"0",
",",
"flipx",
"?",
"(",
"sx",
"-",
"512",
")",
":",
"(",
"sx",
"+",
"16",
"-",
"512",
")",
",",
"sy",
",",
"15",
")",
";",
"}",
"}"
] | Note: sprite chip is different than the other Big Striker sets and they
include several similiarities with other Playmark games (including
the sprite end code and the data being offset (i.e. | [
"Note",
":",
"sprite",
"chip",
"is",
"different",
"than",
"the",
"other",
"Big",
"Striker",
"sets",
"and",
"they",
"include",
"several",
"similiarities",
"with",
"other",
"Playmark",
"games",
"(",
"including",
"the",
"sprite",
"end",
"code",
"and",
"the",
"data",
"being",
"offset",
"(",
"i",
".",
"e",
"."
] | [
"/*\r\n\r\n Sprites are the same to sslam, but using 16x16 sprites instead of 8x8\r\n\r\n */",
"/* Sprite list end code */",
"/* it can change sprites color mask like the original set */",
"/* wraparound x */"
] | [
{
"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": []
} |
ca9072d942cb71762f1f96644ac4b55a1446abb9 | lofunz/mieme | Reloaded/trunk/src/mame/drivers/superqix.c | [
"Unlicense"
] | C | read_dial | int | static int read_dial(running_machine *machine, int player)
{
int newpos;
static int oldpos[2];
static int sign[2];
/* get the new position and adjust the result */
newpos = input_port_read(machine, player ? "DIAL2" : "DIAL1");
if (newpos != oldpos[player])
{
sign[player] = ((newpos - oldpos[player]) & 0x80) >> 7;
oldpos[player] = newpos;
}
if (player == 0)
return ((oldpos[player] & 1) << 2) | (sign[player] << 3);
else // player == 1
return ((oldpos[player] & 1) << 3) | (sign[player] << 2);
} | /*
* This wrapper routine is necessary because the dial is not connected to an
* hardware counter as usual, but the DIR and CLOCK inputs are directly
* connected to the 68705 which acts as a counter.
*/ | This wrapper routine is necessary because the dial is not connected to an
hardware counter as usual, but the DIR and CLOCK inputs are directly
connected to the 68705 which acts as a counter. | [
"This",
"wrapper",
"routine",
"is",
"necessary",
"because",
"the",
"dial",
"is",
"not",
"connected",
"to",
"an",
"hardware",
"counter",
"as",
"usual",
"but",
"the",
"DIR",
"and",
"CLOCK",
"inputs",
"are",
"directly",
"connected",
"to",
"the",
"68705",
"which",
"acts",
"as",
"a",
"counter",
"."
] | static int read_dial(running_machine *machine, int player)
{
int newpos;
static int oldpos[2];
static int sign[2];
newpos = input_port_read(machine, player ? "DIAL2" : "DIAL1");
if (newpos != oldpos[player])
{
sign[player] = ((newpos - oldpos[player]) & 0x80) >> 7;
oldpos[player] = newpos;
}
if (player == 0)
return ((oldpos[player] & 1) << 2) | (sign[player] << 3);
else
return ((oldpos[player] & 1) << 3) | (sign[player] << 2);
} | [
"static",
"int",
"read_dial",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"player",
")",
"{",
"int",
"newpos",
";",
"static",
"int",
"oldpos",
"[",
"2",
"]",
";",
"static",
"int",
"sign",
"[",
"2",
"]",
";",
"newpos",
"=",
"input_port_read",
"(",
"machine",
",",
"player",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"if",
"(",
"newpos",
"!=",
"oldpos",
"[",
"player",
"]",
")",
"{",
"sign",
"[",
"player",
"]",
"=",
"(",
"(",
"newpos",
"-",
"oldpos",
"[",
"player",
"]",
")",
"&",
"0x80",
")",
">>",
"7",
";",
"oldpos",
"[",
"player",
"]",
"=",
"newpos",
";",
"}",
"if",
"(",
"player",
"==",
"0",
")",
"return",
"(",
"(",
"oldpos",
"[",
"player",
"]",
"&",
"1",
")",
"<<",
"2",
")",
"|",
"(",
"sign",
"[",
"player",
"]",
"<<",
"3",
")",
";",
"else",
"return",
"(",
"(",
"oldpos",
"[",
"player",
"]",
"&",
"1",
")",
"<<",
"3",
")",
"|",
"(",
"sign",
"[",
"player",
"]",
"<<",
"2",
")",
";",
"}"
] | This wrapper routine is necessary because the dial is not connected to an
hardware counter as usual, but the DIR and CLOCK inputs are directly
connected to the 68705 which acts as a counter. | [
"This",
"wrapper",
"routine",
"is",
"necessary",
"because",
"the",
"dial",
"is",
"not",
"connected",
"to",
"an",
"hardware",
"counter",
"as",
"usual",
"but",
"the",
"DIR",
"and",
"CLOCK",
"inputs",
"are",
"directly",
"connected",
"to",
"the",
"68705",
"which",
"acts",
"as",
"a",
"counter",
"."
] | [
"/* get the new position and adjust the result */",
"// player == 1\r"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "player",
"type": "int"
}
] | {
"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
}
],
"outlier_params": [],
"others": []
} |
bceeadb170e03b2b83bca314354dc1273acb6e6f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/rendfont.c | [
"Unlicense"
] | C | render_font_alloc | render_font | render_font *render_font_alloc(const char *filename)
{
file_error filerr;
mame_file *ramfile;
render_font *font;
/* allocate and clear memory */
font = alloc_clear_or_die(render_font);
/* attempt to load the cached version of the font first */
if (filename != NULL && render_font_load_cached_bdf(font, filename) == 0)
return font;
/* if we failed, clean up and realloc */
render_font_free(font);
font = alloc_clear_or_die(render_font);
/* load the raw data instead */
filerr = mame_fopen_ram(font_uismall, sizeof(font_uismall), OPEN_FLAG_READ, &ramfile);
if (filerr == FILERR_NONE)
{
render_font_load_cached(font, ramfile, 0);
mame_fclose(ramfile);
}
return font;
} | /*-------------------------------------------------
render_font_alloc - allocate a new font
and load the BDF file
-------------------------------------------------*/ | allocate a new font
and load the BDF file | [
"allocate",
"a",
"new",
"font",
"and",
"load",
"the",
"BDF",
"file"
] | render_font *render_font_alloc(const char *filename)
{
file_error filerr;
mame_file *ramfile;
render_font *font;
font = alloc_clear_or_die(render_font);
if (filename != NULL && render_font_load_cached_bdf(font, filename) == 0)
return font;
render_font_free(font);
font = alloc_clear_or_die(render_font);
filerr = mame_fopen_ram(font_uismall, sizeof(font_uismall), OPEN_FLAG_READ, &ramfile);
if (filerr == FILERR_NONE)
{
render_font_load_cached(font, ramfile, 0);
mame_fclose(ramfile);
}
return font;
} | [
"render_font",
"*",
"render_font_alloc",
"(",
"const",
"char",
"*",
"filename",
")",
"{",
"file_error",
"filerr",
";",
"mame_file",
"*",
"ramfile",
";",
"render_font",
"*",
"font",
";",
"font",
"=",
"alloc_clear_or_die",
"(",
"render_font",
")",
";",
"if",
"(",
"filename",
"!=",
"NULL",
"&&",
"render_font_load_cached_bdf",
"(",
"font",
",",
"filename",
")",
"==",
"0",
")",
"return",
"font",
";",
"render_font_free",
"(",
"font",
")",
";",
"font",
"=",
"alloc_clear_or_die",
"(",
"render_font",
")",
";",
"filerr",
"=",
"mame_fopen_ram",
"(",
"font_uismall",
",",
"sizeof",
"(",
"font_uismall",
")",
",",
"OPEN_FLAG_READ",
",",
"&",
"ramfile",
")",
";",
"if",
"(",
"filerr",
"==",
"FILERR_NONE",
")",
"{",
"render_font_load_cached",
"(",
"font",
",",
"ramfile",
",",
"0",
")",
";",
"mame_fclose",
"(",
"ramfile",
")",
";",
"}",
"return",
"font",
";",
"}"
] | render_font_alloc - allocate a new font
and load the BDF file | [
"render_font_alloc",
"-",
"allocate",
"a",
"new",
"font",
"and",
"load",
"the",
"BDF",
"file"
] | [
"/* allocate and clear memory */",
"/* attempt to load the cached version of the font first */",
"/* if we failed, clean up and realloc */",
"/* load the raw data instead */"
] | [
{
"param": "filename",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bceeadb170e03b2b83bca314354dc1273acb6e6f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/rendfont.c | [
"Unlicense"
] | C | render_font_free | void | void render_font_free(render_font *font)
{
int tablenum;
/* free all the subtables */
for (tablenum = 0; tablenum < 256; tablenum++)
if (font->chars[tablenum] != NULL)
{
int charnum;
/* loop over characters */
for (charnum = 0; charnum < 256; charnum++)
{
render_font_char *ch = &font->chars[tablenum][charnum];
if (ch->texture != NULL)
render_texture_free(ch->texture);
if (ch->bitmap != NULL)
bitmap_free(ch->bitmap);
}
/* free the subtable itself */
free(font->chars[tablenum]);
}
/* free the raw data and the size itself */
if (font->rawdata != NULL)
free((void *)font->rawdata);
free(font);
} | /*-------------------------------------------------
render_font_free - free an allocated font and
all of its owned subobjects
-------------------------------------------------*/ | free an allocated font and
all of its owned subobjects | [
"free",
"an",
"allocated",
"font",
"and",
"all",
"of",
"its",
"owned",
"subobjects"
] | void render_font_free(render_font *font)
{
int tablenum;
for (tablenum = 0; tablenum < 256; tablenum++)
if (font->chars[tablenum] != NULL)
{
int charnum;
for (charnum = 0; charnum < 256; charnum++)
{
render_font_char *ch = &font->chars[tablenum][charnum];
if (ch->texture != NULL)
render_texture_free(ch->texture);
if (ch->bitmap != NULL)
bitmap_free(ch->bitmap);
}
free(font->chars[tablenum]);
}
if (font->rawdata != NULL)
free((void *)font->rawdata);
free(font);
} | [
"void",
"render_font_free",
"(",
"render_font",
"*",
"font",
")",
"{",
"int",
"tablenum",
";",
"for",
"(",
"tablenum",
"=",
"0",
";",
"tablenum",
"<",
"256",
";",
"tablenum",
"++",
")",
"if",
"(",
"font",
"->",
"chars",
"[",
"tablenum",
"]",
"!=",
"NULL",
")",
"{",
"int",
"charnum",
";",
"for",
"(",
"charnum",
"=",
"0",
";",
"charnum",
"<",
"256",
";",
"charnum",
"++",
")",
"{",
"render_font_char",
"*",
"ch",
"=",
"&",
"font",
"->",
"chars",
"[",
"tablenum",
"]",
"[",
"charnum",
"]",
";",
"if",
"(",
"ch",
"->",
"texture",
"!=",
"NULL",
")",
"render_texture_free",
"(",
"ch",
"->",
"texture",
")",
";",
"if",
"(",
"ch",
"->",
"bitmap",
"!=",
"NULL",
")",
"bitmap_free",
"(",
"ch",
"->",
"bitmap",
")",
";",
"}",
"free",
"(",
"font",
"->",
"chars",
"[",
"tablenum",
"]",
")",
";",
"}",
"if",
"(",
"font",
"->",
"rawdata",
"!=",
"NULL",
")",
"free",
"(",
"(",
"void",
"*",
")",
"font",
"->",
"rawdata",
")",
";",
"free",
"(",
"font",
")",
";",
"}"
] | render_font_free - free an allocated font and
all of its owned subobjects | [
"render_font_free",
"-",
"free",
"an",
"allocated",
"font",
"and",
"all",
"of",
"its",
"owned",
"subobjects"
] | [
"/* free all the subtables */",
"/* loop over characters */",
"/* free the subtable itself */",
"/* free the raw data and the size itself */"
] | [
{
"param": "font",
"type": "render_font"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "font",
"type": "render_font",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bceeadb170e03b2b83bca314354dc1273acb6e6f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/rendfont.c | [
"Unlicense"
] | C | render_font_char_expand | void | static void render_font_char_expand(render_font *font, render_font_char *ch)
{
const char *ptr = ch->rawdata;
UINT8 accum = 0, accumbit = 7;
int x, y;
/* punt if nothing there */
if (ch->bmwidth == 0 || ch->bmheight == 0 || ch->rawdata == NULL)
return;
/* allocate a new bitmap of the size we need */
ch->bitmap = bitmap_alloc(ch->bmwidth, font->height, BITMAP_FORMAT_ARGB32);
bitmap_fill(ch->bitmap, NULL, 0);
/* extract the data */
for (y = 0; y < ch->bmheight; y++)
{
int desty = y + font->height + font->yoffs - ch->yoffs - ch->bmheight;
UINT32 *dest = (desty >= 0 && desty < font->height) ? BITMAP_ADDR32(ch->bitmap, desty, 0) : NULL;
/* text format */
if (font->format == FONT_FORMAT_TEXT)
{
/* loop over bytes */
for (x = 0; x < ch->bmwidth; x += 4)
{
int bits = -1;
/* scan for the next hex digit */
while (*ptr != 13 && bits == -1)
{
if (*ptr >= '0' && *ptr <= '9')
bits = *ptr++ - '0';
else if (*ptr >= 'A' && *ptr <= 'F')
bits = *ptr++ - 'A' + 10;
else if (*ptr >= 'a' && *ptr <= 'f')
bits = *ptr++ - 'a' + 10;
else
ptr++;
}
/* expand the four bits */
if (dest != NULL)
{
*dest++ = (bits & 8) ? MAKE_ARGB(0xff,0xff,0xff,0xff) : MAKE_ARGB(0x00,0xff,0xff,0xff);
*dest++ = (bits & 4) ? MAKE_ARGB(0xff,0xff,0xff,0xff) : MAKE_ARGB(0x00,0xff,0xff,0xff);
*dest++ = (bits & 2) ? MAKE_ARGB(0xff,0xff,0xff,0xff) : MAKE_ARGB(0x00,0xff,0xff,0xff);
*dest++ = (bits & 1) ? MAKE_ARGB(0xff,0xff,0xff,0xff) : MAKE_ARGB(0x00,0xff,0xff,0xff);
}
}
/* advance to the next line */
ptr = next_line(ptr);
}
/* cached format */
else if (font->format == FONT_FORMAT_CACHED)
{
for (x = 0; x < ch->bmwidth; x++)
{
if (accumbit == 7)
accum = *ptr++;
if (dest != NULL)
*dest++ = (accum & (1 << accumbit)) ? MAKE_ARGB(0xff,0xff,0xff,0xff) : MAKE_ARGB(0x00,0xff,0xff,0xff);
accumbit = (accumbit - 1) & 7;
}
}
}
/* wrap a texture around the bitmap */
ch->texture = render_texture_alloc(render_texture_hq_scale, NULL);
render_texture_set_bitmap(ch->texture, ch->bitmap, NULL, TEXFORMAT_ARGB32, NULL);
} | /*-------------------------------------------------
render_font_char_expand - expand the raw data
for a character into a bitmap
-------------------------------------------------*/ | expand the raw data
for a character into a bitmap | [
"expand",
"the",
"raw",
"data",
"for",
"a",
"character",
"into",
"a",
"bitmap"
] | static void render_font_char_expand(render_font *font, render_font_char *ch)
{
const char *ptr = ch->rawdata;
UINT8 accum = 0, accumbit = 7;
int x, y;
if (ch->bmwidth == 0 || ch->bmheight == 0 || ch->rawdata == NULL)
return;
ch->bitmap = bitmap_alloc(ch->bmwidth, font->height, BITMAP_FORMAT_ARGB32);
bitmap_fill(ch->bitmap, NULL, 0);
for (y = 0; y < ch->bmheight; y++)
{
int desty = y + font->height + font->yoffs - ch->yoffs - ch->bmheight;
UINT32 *dest = (desty >= 0 && desty < font->height) ? BITMAP_ADDR32(ch->bitmap, desty, 0) : NULL;
if (font->format == FONT_FORMAT_TEXT)
{
for (x = 0; x < ch->bmwidth; x += 4)
{
int bits = -1;
while (*ptr != 13 && bits == -1)
{
if (*ptr >= '0' && *ptr <= '9')
bits = *ptr++ - '0';
else if (*ptr >= 'A' && *ptr <= 'F')
bits = *ptr++ - 'A' + 10;
else if (*ptr >= 'a' && *ptr <= 'f')
bits = *ptr++ - 'a' + 10;
else
ptr++;
}
if (dest != NULL)
{
*dest++ = (bits & 8) ? MAKE_ARGB(0xff,0xff,0xff,0xff) : MAKE_ARGB(0x00,0xff,0xff,0xff);
*dest++ = (bits & 4) ? MAKE_ARGB(0xff,0xff,0xff,0xff) : MAKE_ARGB(0x00,0xff,0xff,0xff);
*dest++ = (bits & 2) ? MAKE_ARGB(0xff,0xff,0xff,0xff) : MAKE_ARGB(0x00,0xff,0xff,0xff);
*dest++ = (bits & 1) ? MAKE_ARGB(0xff,0xff,0xff,0xff) : MAKE_ARGB(0x00,0xff,0xff,0xff);
}
}
ptr = next_line(ptr);
}
else if (font->format == FONT_FORMAT_CACHED)
{
for (x = 0; x < ch->bmwidth; x++)
{
if (accumbit == 7)
accum = *ptr++;
if (dest != NULL)
*dest++ = (accum & (1 << accumbit)) ? MAKE_ARGB(0xff,0xff,0xff,0xff) : MAKE_ARGB(0x00,0xff,0xff,0xff);
accumbit = (accumbit - 1) & 7;
}
}
}
ch->texture = render_texture_alloc(render_texture_hq_scale, NULL);
render_texture_set_bitmap(ch->texture, ch->bitmap, NULL, TEXFORMAT_ARGB32, NULL);
} | [
"static",
"void",
"render_font_char_expand",
"(",
"render_font",
"*",
"font",
",",
"render_font_char",
"*",
"ch",
")",
"{",
"const",
"char",
"*",
"ptr",
"=",
"ch",
"->",
"rawdata",
";",
"UINT8",
"accum",
"=",
"0",
",",
"accumbit",
"=",
"7",
";",
"int",
"x",
",",
"y",
";",
"if",
"(",
"ch",
"->",
"bmwidth",
"==",
"0",
"||",
"ch",
"->",
"bmheight",
"==",
"0",
"||",
"ch",
"->",
"rawdata",
"==",
"NULL",
")",
"return",
";",
"ch",
"->",
"bitmap",
"=",
"bitmap_alloc",
"(",
"ch",
"->",
"bmwidth",
",",
"font",
"->",
"height",
",",
"BITMAP_FORMAT_ARGB32",
")",
";",
"bitmap_fill",
"(",
"ch",
"->",
"bitmap",
",",
"NULL",
",",
"0",
")",
";",
"for",
"(",
"y",
"=",
"0",
";",
"y",
"<",
"ch",
"->",
"bmheight",
";",
"y",
"++",
")",
"{",
"int",
"desty",
"=",
"y",
"+",
"font",
"->",
"height",
"+",
"font",
"->",
"yoffs",
"-",
"ch",
"->",
"yoffs",
"-",
"ch",
"->",
"bmheight",
";",
"UINT32",
"*",
"dest",
"=",
"(",
"desty",
">=",
"0",
"&&",
"desty",
"<",
"font",
"->",
"height",
")",
"?",
"BITMAP_ADDR32",
"(",
"ch",
"->",
"bitmap",
",",
"desty",
",",
"0",
")",
":",
"NULL",
";",
"if",
"(",
"font",
"->",
"format",
"==",
"FONT_FORMAT_TEXT",
")",
"{",
"for",
"(",
"x",
"=",
"0",
";",
"x",
"<",
"ch",
"->",
"bmwidth",
";",
"x",
"+=",
"4",
")",
"{",
"int",
"bits",
"=",
"-1",
";",
"while",
"(",
"*",
"ptr",
"!=",
"13",
"&&",
"bits",
"==",
"-1",
")",
"{",
"if",
"(",
"*",
"ptr",
">=",
"'",
"'",
"&&",
"*",
"ptr",
"<=",
"'",
"'",
")",
"bits",
"=",
"*",
"ptr",
"++",
"-",
"'",
"'",
";",
"else",
"if",
"(",
"*",
"ptr",
">=",
"'",
"'",
"&&",
"*",
"ptr",
"<=",
"'",
"'",
")",
"bits",
"=",
"*",
"ptr",
"++",
"-",
"'",
"'",
"+",
"10",
";",
"else",
"if",
"(",
"*",
"ptr",
">=",
"'",
"'",
"&&",
"*",
"ptr",
"<=",
"'",
"'",
")",
"bits",
"=",
"*",
"ptr",
"++",
"-",
"'",
"'",
"+",
"10",
";",
"else",
"ptr",
"++",
";",
"}",
"if",
"(",
"dest",
"!=",
"NULL",
")",
"{",
"*",
"dest",
"++",
"=",
"(",
"bits",
"&",
"8",
")",
"?",
"MAKE_ARGB",
"(",
"0xff",
",",
"0xff",
",",
"0xff",
",",
"0xff",
")",
":",
"MAKE_ARGB",
"(",
"0x00",
",",
"0xff",
",",
"0xff",
",",
"0xff",
")",
";",
"*",
"dest",
"++",
"=",
"(",
"bits",
"&",
"4",
")",
"?",
"MAKE_ARGB",
"(",
"0xff",
",",
"0xff",
",",
"0xff",
",",
"0xff",
")",
":",
"MAKE_ARGB",
"(",
"0x00",
",",
"0xff",
",",
"0xff",
",",
"0xff",
")",
";",
"*",
"dest",
"++",
"=",
"(",
"bits",
"&",
"2",
")",
"?",
"MAKE_ARGB",
"(",
"0xff",
",",
"0xff",
",",
"0xff",
",",
"0xff",
")",
":",
"MAKE_ARGB",
"(",
"0x00",
",",
"0xff",
",",
"0xff",
",",
"0xff",
")",
";",
"*",
"dest",
"++",
"=",
"(",
"bits",
"&",
"1",
")",
"?",
"MAKE_ARGB",
"(",
"0xff",
",",
"0xff",
",",
"0xff",
",",
"0xff",
")",
":",
"MAKE_ARGB",
"(",
"0x00",
",",
"0xff",
",",
"0xff",
",",
"0xff",
")",
";",
"}",
"}",
"ptr",
"=",
"next_line",
"(",
"ptr",
")",
";",
"}",
"else",
"if",
"(",
"font",
"->",
"format",
"==",
"FONT_FORMAT_CACHED",
")",
"{",
"for",
"(",
"x",
"=",
"0",
";",
"x",
"<",
"ch",
"->",
"bmwidth",
";",
"x",
"++",
")",
"{",
"if",
"(",
"accumbit",
"==",
"7",
")",
"accum",
"=",
"*",
"ptr",
"++",
";",
"if",
"(",
"dest",
"!=",
"NULL",
")",
"*",
"dest",
"++",
"=",
"(",
"accum",
"&",
"(",
"1",
"<<",
"accumbit",
")",
")",
"?",
"MAKE_ARGB",
"(",
"0xff",
",",
"0xff",
",",
"0xff",
",",
"0xff",
")",
":",
"MAKE_ARGB",
"(",
"0x00",
",",
"0xff",
",",
"0xff",
",",
"0xff",
")",
";",
"accumbit",
"=",
"(",
"accumbit",
"-",
"1",
")",
"&",
"7",
";",
"}",
"}",
"}",
"ch",
"->",
"texture",
"=",
"render_texture_alloc",
"(",
"render_texture_hq_scale",
",",
"NULL",
")",
";",
"render_texture_set_bitmap",
"(",
"ch",
"->",
"texture",
",",
"ch",
"->",
"bitmap",
",",
"NULL",
",",
"TEXFORMAT_ARGB32",
",",
"NULL",
")",
";",
"}"
] | render_font_char_expand - expand the raw data
for a character into a bitmap | [
"render_font_char_expand",
"-",
"expand",
"the",
"raw",
"data",
"for",
"a",
"character",
"into",
"a",
"bitmap"
] | [
"/* punt if nothing there */",
"/* allocate a new bitmap of the size we need */",
"/* extract the data */",
"/* text format */",
"/* loop over bytes */",
"/* scan for the next hex digit */",
"/* expand the four bits */",
"/* advance to the next line */",
"/* cached format */",
"/* wrap a texture around the bitmap */"
] | [
{
"param": "font",
"type": "render_font"
},
{
"param": "ch",
"type": "render_font_char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "font",
"type": "render_font",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ch",
"type": "render_font_char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bceeadb170e03b2b83bca314354dc1273acb6e6f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/rendfont.c | [
"Unlicense"
] | C | render_font_get_char_texture_and_bounds | render_texture | render_texture *render_font_get_char_texture_and_bounds(render_font *font, float height, float aspect, unicode_char chnum, render_bounds *bounds)
{
render_font_char *ch = get_char(font, chnum);
float scale = font->scale * height;
/* on entry, assume x0,y0 are the top,left coordinate of the cell and add */
/* the character bounding box to that position */
bounds->x0 += (float)ch->xoffs * scale * aspect;
/* compute x1,y1 from there based on the bitmap size */
bounds->x1 = bounds->x0 + (float)ch->bmwidth * scale * aspect;
bounds->y1 = bounds->y0 + (float)font->height * scale;
/* return the texture */
return ch->texture;
} | /*-------------------------------------------------
render_font_get_char_texture_and_bounds -
return the texture for a character and compute
the bounds of the final bitmap
-------------------------------------------------*/ | render_font_get_char_texture_and_bounds
return the texture for a character and compute
the bounds of the final bitmap | [
"render_font_get_char_texture_and_bounds",
"return",
"the",
"texture",
"for",
"a",
"character",
"and",
"compute",
"the",
"bounds",
"of",
"the",
"final",
"bitmap"
] | render_texture *render_font_get_char_texture_and_bounds(render_font *font, float height, float aspect, unicode_char chnum, render_bounds *bounds)
{
render_font_char *ch = get_char(font, chnum);
float scale = font->scale * height;
bounds->x0 += (float)ch->xoffs * scale * aspect;
bounds->x1 = bounds->x0 + (float)ch->bmwidth * scale * aspect;
bounds->y1 = bounds->y0 + (float)font->height * scale;
return ch->texture;
} | [
"render_texture",
"*",
"render_font_get_char_texture_and_bounds",
"(",
"render_font",
"*",
"font",
",",
"float",
"height",
",",
"float",
"aspect",
",",
"unicode_char",
"chnum",
",",
"render_bounds",
"*",
"bounds",
")",
"{",
"render_font_char",
"*",
"ch",
"=",
"get_char",
"(",
"font",
",",
"chnum",
")",
";",
"float",
"scale",
"=",
"font",
"->",
"scale",
"*",
"height",
";",
"bounds",
"->",
"x0",
"+=",
"(",
"float",
")",
"ch",
"->",
"xoffs",
"*",
"scale",
"*",
"aspect",
";",
"bounds",
"->",
"x1",
"=",
"bounds",
"->",
"x0",
"+",
"(",
"float",
")",
"ch",
"->",
"bmwidth",
"*",
"scale",
"*",
"aspect",
";",
"bounds",
"->",
"y1",
"=",
"bounds",
"->",
"y0",
"+",
"(",
"float",
")",
"font",
"->",
"height",
"*",
"scale",
";",
"return",
"ch",
"->",
"texture",
";",
"}"
] | render_font_get_char_texture_and_bounds
return the texture for a character and compute
the bounds of the final bitmap | [
"render_font_get_char_texture_and_bounds",
"return",
"the",
"texture",
"for",
"a",
"character",
"and",
"compute",
"the",
"bounds",
"of",
"the",
"final",
"bitmap"
] | [
"/* on entry, assume x0,y0 are the top,left coordinate of the cell and add */",
"/* the character bounding box to that position */",
"/* compute x1,y1 from there based on the bitmap size */",
"/* return the texture */"
] | [
{
"param": "font",
"type": "render_font"
},
{
"param": "height",
"type": "float"
},
{
"param": "aspect",
"type": "float"
},
{
"param": "chnum",
"type": "unicode_char"
},
{
"param": "bounds",
"type": "render_bounds"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "font",
"type": "render_font",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "height",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "aspect",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "chnum",
"type": "unicode_char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bounds",
"type": "render_bounds",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bceeadb170e03b2b83bca314354dc1273acb6e6f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/rendfont.c | [
"Unlicense"
] | C | render_font_get_scaled_bitmap_and_bounds | void | void render_font_get_scaled_bitmap_and_bounds(render_font *font, bitmap_t *dest, float height, float aspect, unicode_char chnum, rectangle *bounds)
{
render_font_char *ch = get_char(font, chnum);
float scale = font->scale * height;
INT32 origwidth, origheight;
/* on entry, assume x0,y0 are the top,left coordinate of the cell and add */
/* the character bounding box to that position */
bounds->min_x = (float)ch->xoffs * scale * aspect;
bounds->min_y = 0;
/* compute x1,y1 from there based on the bitmap size */
bounds->max_x = bounds->min_x + (float)ch->bmwidth * scale * aspect;
bounds->max_y = bounds->min_y + (float)font->height * scale;
/* if the bitmap isn't big enough, bail */
if (dest->width < bounds->max_x - bounds->min_x || dest->height < bounds->max_y - bounds->min_y)
return;
/* scale the font */
origwidth = dest->width;
origheight = dest->height;
dest->width = bounds->max_x - bounds->min_x;
dest->height = bounds->max_y - bounds->min_y;
render_texture_hq_scale(dest, ch->bitmap, NULL, NULL);
dest->width = origwidth;
dest->height = origheight;
} | /*-------------------------------------------------
render_font_draw_string_to_bitmap - draw a
string to a bitmap
-------------------------------------------------*/ | draw a
string to a bitmap | [
"draw",
"a",
"string",
"to",
"a",
"bitmap"
] | void render_font_get_scaled_bitmap_and_bounds(render_font *font, bitmap_t *dest, float height, float aspect, unicode_char chnum, rectangle *bounds)
{
render_font_char *ch = get_char(font, chnum);
float scale = font->scale * height;
INT32 origwidth, origheight;
bounds->min_x = (float)ch->xoffs * scale * aspect;
bounds->min_y = 0;
bounds->max_x = bounds->min_x + (float)ch->bmwidth * scale * aspect;
bounds->max_y = bounds->min_y + (float)font->height * scale;
if (dest->width < bounds->max_x - bounds->min_x || dest->height < bounds->max_y - bounds->min_y)
return;
origwidth = dest->width;
origheight = dest->height;
dest->width = bounds->max_x - bounds->min_x;
dest->height = bounds->max_y - bounds->min_y;
render_texture_hq_scale(dest, ch->bitmap, NULL, NULL);
dest->width = origwidth;
dest->height = origheight;
} | [
"void",
"render_font_get_scaled_bitmap_and_bounds",
"(",
"render_font",
"*",
"font",
",",
"bitmap_t",
"*",
"dest",
",",
"float",
"height",
",",
"float",
"aspect",
",",
"unicode_char",
"chnum",
",",
"rectangle",
"*",
"bounds",
")",
"{",
"render_font_char",
"*",
"ch",
"=",
"get_char",
"(",
"font",
",",
"chnum",
")",
";",
"float",
"scale",
"=",
"font",
"->",
"scale",
"*",
"height",
";",
"INT32",
"origwidth",
",",
"origheight",
";",
"bounds",
"->",
"min_x",
"=",
"(",
"float",
")",
"ch",
"->",
"xoffs",
"*",
"scale",
"*",
"aspect",
";",
"bounds",
"->",
"min_y",
"=",
"0",
";",
"bounds",
"->",
"max_x",
"=",
"bounds",
"->",
"min_x",
"+",
"(",
"float",
")",
"ch",
"->",
"bmwidth",
"*",
"scale",
"*",
"aspect",
";",
"bounds",
"->",
"max_y",
"=",
"bounds",
"->",
"min_y",
"+",
"(",
"float",
")",
"font",
"->",
"height",
"*",
"scale",
";",
"if",
"(",
"dest",
"->",
"width",
"<",
"bounds",
"->",
"max_x",
"-",
"bounds",
"->",
"min_x",
"||",
"dest",
"->",
"height",
"<",
"bounds",
"->",
"max_y",
"-",
"bounds",
"->",
"min_y",
")",
"return",
";",
"origwidth",
"=",
"dest",
"->",
"width",
";",
"origheight",
"=",
"dest",
"->",
"height",
";",
"dest",
"->",
"width",
"=",
"bounds",
"->",
"max_x",
"-",
"bounds",
"->",
"min_x",
";",
"dest",
"->",
"height",
"=",
"bounds",
"->",
"max_y",
"-",
"bounds",
"->",
"min_y",
";",
"render_texture_hq_scale",
"(",
"dest",
",",
"ch",
"->",
"bitmap",
",",
"NULL",
",",
"NULL",
")",
";",
"dest",
"->",
"width",
"=",
"origwidth",
";",
"dest",
"->",
"height",
"=",
"origheight",
";",
"}"
] | render_font_draw_string_to_bitmap - draw a
string to a bitmap | [
"render_font_draw_string_to_bitmap",
"-",
"draw",
"a",
"string",
"to",
"a",
"bitmap"
] | [
"/* on entry, assume x0,y0 are the top,left coordinate of the cell and add */",
"/* the character bounding box to that position */",
"/* compute x1,y1 from there based on the bitmap size */",
"/* if the bitmap isn't big enough, bail */",
"/* scale the font */"
] | [
{
"param": "font",
"type": "render_font"
},
{
"param": "dest",
"type": "bitmap_t"
},
{
"param": "height",
"type": "float"
},
{
"param": "aspect",
"type": "float"
},
{
"param": "chnum",
"type": "unicode_char"
},
{
"param": "bounds",
"type": "rectangle"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "font",
"type": "render_font",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "height",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "aspect",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "chnum",
"type": "unicode_char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bounds",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bceeadb170e03b2b83bca314354dc1273acb6e6f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/rendfont.c | [
"Unlicense"
] | C | render_font_get_string_width | float | float render_font_get_string_width(render_font *font, float height, float aspect, const char *string)
{
const unsigned char *ptr;
int totwidth = 0;
/* loop over the string and accumulate widths */
for (ptr = (const unsigned char *)string; *ptr != 0; ptr++)
totwidth += get_char(font, *ptr)->width;
/* scale the final result based on height */
return (float)totwidth * font->scale * height * aspect;
} | /*-------------------------------------------------
render_font_string_width - return the width of
a string at the given height
-------------------------------------------------*/ | return the width of
a string at the given height | [
"return",
"the",
"width",
"of",
"a",
"string",
"at",
"the",
"given",
"height"
] | float render_font_get_string_width(render_font *font, float height, float aspect, const char *string)
{
const unsigned char *ptr;
int totwidth = 0;
for (ptr = (const unsigned char *)string; *ptr != 0; ptr++)
totwidth += get_char(font, *ptr)->width;
return (float)totwidth * font->scale * height * aspect;
} | [
"float",
"render_font_get_string_width",
"(",
"render_font",
"*",
"font",
",",
"float",
"height",
",",
"float",
"aspect",
",",
"const",
"char",
"*",
"string",
")",
"{",
"const",
"unsigned",
"char",
"*",
"ptr",
";",
"int",
"totwidth",
"=",
"0",
";",
"for",
"(",
"ptr",
"=",
"(",
"const",
"unsigned",
"char",
"*",
")",
"string",
";",
"*",
"ptr",
"!=",
"0",
";",
"ptr",
"++",
")",
"totwidth",
"+=",
"get_char",
"(",
"font",
",",
"*",
"ptr",
")",
"->",
"width",
";",
"return",
"(",
"float",
")",
"totwidth",
"*",
"font",
"->",
"scale",
"*",
"height",
"*",
"aspect",
";",
"}"
] | render_font_string_width - return the width of
a string at the given height | [
"render_font_string_width",
"-",
"return",
"the",
"width",
"of",
"a",
"string",
"at",
"the",
"given",
"height"
] | [
"/* loop over the string and accumulate widths */",
"/* scale the final result based on height */"
] | [
{
"param": "font",
"type": "render_font"
},
{
"param": "height",
"type": "float"
},
{
"param": "aspect",
"type": "float"
},
{
"param": "string",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "font",
"type": "render_font",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "height",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "aspect",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "string",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bceeadb170e03b2b83bca314354dc1273acb6e6f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/rendfont.c | [
"Unlicense"
] | C | render_font_get_utf8string_width | float | float render_font_get_utf8string_width(render_font *font, float height, float aspect, const char *utf8string)
{
int length = strlen(utf8string);
unicode_char uchar;
int totwidth = 0;
int count = 0;
int offset;
/* loop over the string and accumulate widths */
for (offset = 0; offset < length; offset += count)
{
count = uchar_from_utf8(&uchar, utf8string + offset, length - offset);
if (count == -1)
break;
if (uchar < 0x10000)
totwidth += get_char(font, uchar)->width;
}
/* scale the final result based on height */
return (float)totwidth * font->scale * height * aspect;
} | /*-------------------------------------------------
render_font_get_utf8string_width - return the
width of a UTF8-encoded string at the given
height
-------------------------------------------------*/ | return the
width of a UTF8-encoded string at the given
height | [
"return",
"the",
"width",
"of",
"a",
"UTF8",
"-",
"encoded",
"string",
"at",
"the",
"given",
"height"
] | float render_font_get_utf8string_width(render_font *font, float height, float aspect, const char *utf8string)
{
int length = strlen(utf8string);
unicode_char uchar;
int totwidth = 0;
int count = 0;
int offset;
for (offset = 0; offset < length; offset += count)
{
count = uchar_from_utf8(&uchar, utf8string + offset, length - offset);
if (count == -1)
break;
if (uchar < 0x10000)
totwidth += get_char(font, uchar)->width;
}
return (float)totwidth * font->scale * height * aspect;
} | [
"float",
"render_font_get_utf8string_width",
"(",
"render_font",
"*",
"font",
",",
"float",
"height",
",",
"float",
"aspect",
",",
"const",
"char",
"*",
"utf8string",
")",
"{",
"int",
"length",
"=",
"strlen",
"(",
"utf8string",
")",
";",
"unicode_char",
"uchar",
";",
"int",
"totwidth",
"=",
"0",
";",
"int",
"count",
"=",
"0",
";",
"int",
"offset",
";",
"for",
"(",
"offset",
"=",
"0",
";",
"offset",
"<",
"length",
";",
"offset",
"+=",
"count",
")",
"{",
"count",
"=",
"uchar_from_utf8",
"(",
"&",
"uchar",
",",
"utf8string",
"+",
"offset",
",",
"length",
"-",
"offset",
")",
";",
"if",
"(",
"count",
"==",
"-1",
")",
"break",
";",
"if",
"(",
"uchar",
"<",
"0x10000",
")",
"totwidth",
"+=",
"get_char",
"(",
"font",
",",
"uchar",
")",
"->",
"width",
";",
"}",
"return",
"(",
"float",
")",
"totwidth",
"*",
"font",
"->",
"scale",
"*",
"height",
"*",
"aspect",
";",
"}"
] | render_font_get_utf8string_width - return the
width of a UTF8-encoded string at the given
height | [
"render_font_get_utf8string_width",
"-",
"return",
"the",
"width",
"of",
"a",
"UTF8",
"-",
"encoded",
"string",
"at",
"the",
"given",
"height"
] | [
"/* loop over the string and accumulate widths */",
"/* scale the final result based on height */"
] | [
{
"param": "font",
"type": "render_font"
},
{
"param": "height",
"type": "float"
},
{
"param": "aspect",
"type": "float"
},
{
"param": "utf8string",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "font",
"type": "render_font",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "height",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "aspect",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "utf8string",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bceeadb170e03b2b83bca314354dc1273acb6e6f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/rendfont.c | [
"Unlicense"
] | C | render_font_load_cached_bdf | int | static int render_font_load_cached_bdf(render_font *font, const char *filename)
{
file_error filerr;
char *cachedname = NULL;
char *data = NULL;
mame_file *cachefile;
mame_file *file;
int result = 1;
UINT32 bytes;
UINT32 hash;
/* first try to open the BDF itself */
filerr = mame_fopen(SEARCHPATH_FONT, filename, OPEN_FLAG_READ, &file);
if (filerr != FILERR_NONE)
return 1;
/* determine the file size and allocate memory */
font->rawsize = mame_fsize(file);
data = alloc_array_clear_or_die(char, font->rawsize + 1);
/* read and hash the first chunk */
bytes = mame_fread(file, data, MIN(CACHED_BDF_HASH_SIZE, font->rawsize));
if (bytes != MIN(CACHED_BDF_HASH_SIZE, font->rawsize))
goto error;
hash = crc32(0, (const UINT8*)data, bytes) ^ (UINT32)font->rawsize;
/* create the cached filename */
cachedname = mame_strdup(filename);
if (cachedname == NULL)
goto error;
/* change the 'F' to a 'C' on the extension */
cachedname[strlen(cachedname) - 1] -= 3;
/* attempt to load a cached version of the font */
filerr = mame_fopen(SEARCHPATH_FONT, cachedname, OPEN_FLAG_READ, &cachefile);
if (filerr == FILERR_NONE)
{
result = render_font_load_cached(font, cachefile, hash);
mame_fclose(cachefile);
}
if (result != 0)
{
/* if that failed, read the rest of the font and parse it */
if (bytes < font->rawsize)
{
UINT32 read = mame_fread(file, data + bytes, font->rawsize - bytes);
if (read != font->rawsize - bytes)
goto error;
}
/* NULL-terminate the data and attach it to the font */
data[font->rawsize] = 0;
font->rawdata = data;
/* load the BDF */
result = render_font_load_bdf(font);
/* if we loaded okay, create a cached one */
if (result == 0)
render_font_save_cached(font, cachedname, hash);
}
else
free(data);
/* close the file */
free(cachedname);
mame_fclose(file);
return result;
error:
/* close the file */
if (cachedname != NULL)
free(cachedname);
if (data != NULL)
free(data);
mame_fclose(file);
return 1;
} | /*-------------------------------------------------
render_font_load_cached_bdf - attempt to load
a cached version of the BDF font 'filename';
if that fails, fall back on the regular BDF
loader and create a new cached version
-------------------------------------------------*/ | attempt to load
a cached version of the BDF font 'filename';
if that fails, fall back on the regular BDF
loader and create a new cached version | [
"attempt",
"to",
"load",
"a",
"cached",
"version",
"of",
"the",
"BDF",
"font",
"'",
"filename",
"'",
";",
"if",
"that",
"fails",
"fall",
"back",
"on",
"the",
"regular",
"BDF",
"loader",
"and",
"create",
"a",
"new",
"cached",
"version"
] | static int render_font_load_cached_bdf(render_font *font, const char *filename)
{
file_error filerr;
char *cachedname = NULL;
char *data = NULL;
mame_file *cachefile;
mame_file *file;
int result = 1;
UINT32 bytes;
UINT32 hash;
filerr = mame_fopen(SEARCHPATH_FONT, filename, OPEN_FLAG_READ, &file);
if (filerr != FILERR_NONE)
return 1;
font->rawsize = mame_fsize(file);
data = alloc_array_clear_or_die(char, font->rawsize + 1);
bytes = mame_fread(file, data, MIN(CACHED_BDF_HASH_SIZE, font->rawsize));
if (bytes != MIN(CACHED_BDF_HASH_SIZE, font->rawsize))
goto error;
hash = crc32(0, (const UINT8*)data, bytes) ^ (UINT32)font->rawsize;
cachedname = mame_strdup(filename);
if (cachedname == NULL)
goto error;
cachedname[strlen(cachedname) - 1] -= 3;
filerr = mame_fopen(SEARCHPATH_FONT, cachedname, OPEN_FLAG_READ, &cachefile);
if (filerr == FILERR_NONE)
{
result = render_font_load_cached(font, cachefile, hash);
mame_fclose(cachefile);
}
if (result != 0)
{
if (bytes < font->rawsize)
{
UINT32 read = mame_fread(file, data + bytes, font->rawsize - bytes);
if (read != font->rawsize - bytes)
goto error;
}
data[font->rawsize] = 0;
font->rawdata = data;
result = render_font_load_bdf(font);
if (result == 0)
render_font_save_cached(font, cachedname, hash);
}
else
free(data);
free(cachedname);
mame_fclose(file);
return result;
error:
if (cachedname != NULL)
free(cachedname);
if (data != NULL)
free(data);
mame_fclose(file);
return 1;
} | [
"static",
"int",
"render_font_load_cached_bdf",
"(",
"render_font",
"*",
"font",
",",
"const",
"char",
"*",
"filename",
")",
"{",
"file_error",
"filerr",
";",
"char",
"*",
"cachedname",
"=",
"NULL",
";",
"char",
"*",
"data",
"=",
"NULL",
";",
"mame_file",
"*",
"cachefile",
";",
"mame_file",
"*",
"file",
";",
"int",
"result",
"=",
"1",
";",
"UINT32",
"bytes",
";",
"UINT32",
"hash",
";",
"filerr",
"=",
"mame_fopen",
"(",
"SEARCHPATH_FONT",
",",
"filename",
",",
"OPEN_FLAG_READ",
",",
"&",
"file",
")",
";",
"if",
"(",
"filerr",
"!=",
"FILERR_NONE",
")",
"return",
"1",
";",
"font",
"->",
"rawsize",
"=",
"mame_fsize",
"(",
"file",
")",
";",
"data",
"=",
"alloc_array_clear_or_die",
"(",
"char",
",",
"font",
"->",
"rawsize",
"+",
"1",
")",
";",
"bytes",
"=",
"mame_fread",
"(",
"file",
",",
"data",
",",
"MIN",
"(",
"CACHED_BDF_HASH_SIZE",
",",
"font",
"->",
"rawsize",
")",
")",
";",
"if",
"(",
"bytes",
"!=",
"MIN",
"(",
"CACHED_BDF_HASH_SIZE",
",",
"font",
"->",
"rawsize",
")",
")",
"goto",
"error",
";",
"hash",
"=",
"crc32",
"(",
"0",
",",
"(",
"const",
"UINT8",
"*",
")",
"data",
",",
"bytes",
")",
"^",
"(",
"UINT32",
")",
"font",
"->",
"rawsize",
";",
"cachedname",
"=",
"mame_strdup",
"(",
"filename",
")",
";",
"if",
"(",
"cachedname",
"==",
"NULL",
")",
"goto",
"error",
";",
"cachedname",
"[",
"strlen",
"(",
"cachedname",
")",
"-",
"1",
"]",
"-=",
"3",
";",
"filerr",
"=",
"mame_fopen",
"(",
"SEARCHPATH_FONT",
",",
"cachedname",
",",
"OPEN_FLAG_READ",
",",
"&",
"cachefile",
")",
";",
"if",
"(",
"filerr",
"==",
"FILERR_NONE",
")",
"{",
"result",
"=",
"render_font_load_cached",
"(",
"font",
",",
"cachefile",
",",
"hash",
")",
";",
"mame_fclose",
"(",
"cachefile",
")",
";",
"}",
"if",
"(",
"result",
"!=",
"0",
")",
"{",
"if",
"(",
"bytes",
"<",
"font",
"->",
"rawsize",
")",
"{",
"UINT32",
"read",
"=",
"mame_fread",
"(",
"file",
",",
"data",
"+",
"bytes",
",",
"font",
"->",
"rawsize",
"-",
"bytes",
")",
";",
"if",
"(",
"read",
"!=",
"font",
"->",
"rawsize",
"-",
"bytes",
")",
"goto",
"error",
";",
"}",
"data",
"[",
"font",
"->",
"rawsize",
"]",
"=",
"0",
";",
"font",
"->",
"rawdata",
"=",
"data",
";",
"result",
"=",
"render_font_load_bdf",
"(",
"font",
")",
";",
"if",
"(",
"result",
"==",
"0",
")",
"render_font_save_cached",
"(",
"font",
",",
"cachedname",
",",
"hash",
")",
";",
"}",
"else",
"free",
"(",
"data",
")",
";",
"free",
"(",
"cachedname",
")",
";",
"mame_fclose",
"(",
"file",
")",
";",
"return",
"result",
";",
"error",
":",
"if",
"(",
"cachedname",
"!=",
"NULL",
")",
"free",
"(",
"cachedname",
")",
";",
"if",
"(",
"data",
"!=",
"NULL",
")",
"free",
"(",
"data",
")",
";",
"mame_fclose",
"(",
"file",
")",
";",
"return",
"1",
";",
"}"
] | render_font_load_cached_bdf - attempt to load
a cached version of the BDF font 'filename';
if that fails, fall back on the regular BDF
loader and create a new cached version | [
"render_font_load_cached_bdf",
"-",
"attempt",
"to",
"load",
"a",
"cached",
"version",
"of",
"the",
"BDF",
"font",
"'",
"filename",
"'",
";",
"if",
"that",
"fails",
"fall",
"back",
"on",
"the",
"regular",
"BDF",
"loader",
"and",
"create",
"a",
"new",
"cached",
"version"
] | [
"/* first try to open the BDF itself */",
"/* determine the file size and allocate memory */",
"/* read and hash the first chunk */",
"/* create the cached filename */",
"/* change the 'F' to a 'C' on the extension */",
"/* attempt to load a cached version of the font */",
"/* if that failed, read the rest of the font and parse it */",
"/* NULL-terminate the data and attach it to the font */",
"/* load the BDF */",
"/* if we loaded okay, create a cached one */",
"/* close the file */",
"/* close the file */"
] | [
{
"param": "font",
"type": "render_font"
},
{
"param": "filename",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "font",
"type": "render_font",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bceeadb170e03b2b83bca314354dc1273acb6e6f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/rendfont.c | [
"Unlicense"
] | C | render_font_load_bdf | int | static int render_font_load_bdf(render_font *font)
{
const char *ptr;
int charcount = 0;
/* set the format to text */
font->format = FONT_FORMAT_TEXT;
/* first find the FONTBOUNDINGBOX tag */
for (ptr = font->rawdata; ptr != NULL; ptr = next_line(ptr))
{
int dummy1, dummy2;
/* we only care about a tiny few fields */
if (strncmp(ptr, "FONTBOUNDINGBOX ", 16) == 0)
{
if (sscanf(ptr + 16, "%d %d %d %d", &dummy1, &font->height, &dummy2, &font->yoffs) != 4)
return 1;
break;
}
}
/* compute the scale factor */
font->scale = 1.0f / (float)font->height;
/* now scan for characters */
for ( ; ptr != NULL; ptr = next_line(ptr))
{
/* stop at ENDFONT */
if (strncmp(ptr, "ENDFONT", 7) == 0)
break;
/* once we hit a STARTCHAR, parse until the end */
if (strncmp(ptr, "STARTCHAR ", 10) == 0)
{
int bmwidth = -1, bmheight = -1, xoffs = -1, yoffs = -1;
const char *rawdata = NULL;
int charnum = -1;
int width = -1;
int dummy1;
/* scan for interesting per-character tags */
for ( ; ptr != NULL; ptr = next_line(ptr))
{
/* ENCODING tells us which character */
if (strncmp(ptr, "ENCODING ", 9) == 0)
{
if (sscanf(ptr + 9, "%d", &charnum) != 1)
return 1;
}
/* DWIDTH tells us the width to the next character */
else if (strncmp(ptr, "DWIDTH ", 7) == 0)
{
if (sscanf(ptr + 7, "%d %d", &width, &dummy1) != 2)
return 1;
}
/* BBX tells us the height/width of the bitmap and the offsets */
else if (strncmp(ptr, "BBX ", 4) == 0)
{
if (sscanf(ptr + 4, "%d %d %d %d", &bmwidth, &bmheight, &xoffs, &yoffs) != 4)
return 1;
}
/* BITMAP is the start of the data */
else if (strncmp(ptr, "BITMAP", 6) == 0)
{
/* stash the raw pointer and scan for the end of the character */
for (rawdata = ptr = next_line(ptr); ptr != NULL && strncmp(ptr, "ENDCHAR", 7) != 0; ptr = next_line(ptr)) ;
break;
}
}
/* if we have everything, allocate a new character */
if (charnum >= 0 && charnum < 65536 && rawdata != NULL && bmwidth >= 0 && bmheight >= 0)
{
render_font_char *ch;
/* if we don't have a subtable yet, make one */
if (font->chars[charnum / 256] == NULL)
font->chars[charnum / 256] = alloc_array_clear_or_die(render_font_char, 256);
/* fill in the entry */
ch = &font->chars[charnum / 256][charnum % 256];
ch->width = width;
ch->bmwidth = bmwidth;
ch->bmheight = bmheight;
ch->xoffs = xoffs;
ch->yoffs = yoffs;
ch->rawdata = rawdata;
}
/* some progress for big fonts */
if (++charcount % 256 == 0)
mame_printf_warning("Loading BDF font... (%d characters loaded)\n", charcount);
}
}
return 0;
} | /*-------------------------------------------------
render_font_load_bdf - parse and load a BDF
font
-------------------------------------------------*/ | parse and load a BDF
font | [
"parse",
"and",
"load",
"a",
"BDF",
"font"
] | static int render_font_load_bdf(render_font *font)
{
const char *ptr;
int charcount = 0;
font->format = FONT_FORMAT_TEXT;
for (ptr = font->rawdata; ptr != NULL; ptr = next_line(ptr))
{
int dummy1, dummy2;
if (strncmp(ptr, "FONTBOUNDINGBOX ", 16) == 0)
{
if (sscanf(ptr + 16, "%d %d %d %d", &dummy1, &font->height, &dummy2, &font->yoffs) != 4)
return 1;
break;
}
}
font->scale = 1.0f / (float)font->height;
for ( ; ptr != NULL; ptr = next_line(ptr))
{
if (strncmp(ptr, "ENDFONT", 7) == 0)
break;
if (strncmp(ptr, "STARTCHAR ", 10) == 0)
{
int bmwidth = -1, bmheight = -1, xoffs = -1, yoffs = -1;
const char *rawdata = NULL;
int charnum = -1;
int width = -1;
int dummy1;
for ( ; ptr != NULL; ptr = next_line(ptr))
{
if (strncmp(ptr, "ENCODING ", 9) == 0)
{
if (sscanf(ptr + 9, "%d", &charnum) != 1)
return 1;
}
else if (strncmp(ptr, "DWIDTH ", 7) == 0)
{
if (sscanf(ptr + 7, "%d %d", &width, &dummy1) != 2)
return 1;
}
else if (strncmp(ptr, "BBX ", 4) == 0)
{
if (sscanf(ptr + 4, "%d %d %d %d", &bmwidth, &bmheight, &xoffs, &yoffs) != 4)
return 1;
}
else if (strncmp(ptr, "BITMAP", 6) == 0)
{
for (rawdata = ptr = next_line(ptr); ptr != NULL && strncmp(ptr, "ENDCHAR", 7) != 0; ptr = next_line(ptr)) ;
break;
}
}
if (charnum >= 0 && charnum < 65536 && rawdata != NULL && bmwidth >= 0 && bmheight >= 0)
{
render_font_char *ch;
if (font->chars[charnum / 256] == NULL)
font->chars[charnum / 256] = alloc_array_clear_or_die(render_font_char, 256);
ch = &font->chars[charnum / 256][charnum % 256];
ch->width = width;
ch->bmwidth = bmwidth;
ch->bmheight = bmheight;
ch->xoffs = xoffs;
ch->yoffs = yoffs;
ch->rawdata = rawdata;
}
if (++charcount % 256 == 0)
mame_printf_warning("Loading BDF font... (%d characters loaded)\n", charcount);
}
}
return 0;
} | [
"static",
"int",
"render_font_load_bdf",
"(",
"render_font",
"*",
"font",
")",
"{",
"const",
"char",
"*",
"ptr",
";",
"int",
"charcount",
"=",
"0",
";",
"font",
"->",
"format",
"=",
"FONT_FORMAT_TEXT",
";",
"for",
"(",
"ptr",
"=",
"font",
"->",
"rawdata",
";",
"ptr",
"!=",
"NULL",
";",
"ptr",
"=",
"next_line",
"(",
"ptr",
")",
")",
"{",
"int",
"dummy1",
",",
"dummy2",
";",
"if",
"(",
"strncmp",
"(",
"ptr",
",",
"\"",
"\"",
",",
"16",
")",
"==",
"0",
")",
"{",
"if",
"(",
"sscanf",
"(",
"ptr",
"+",
"16",
",",
"\"",
"\"",
",",
"&",
"dummy1",
",",
"&",
"font",
"->",
"height",
",",
"&",
"dummy2",
",",
"&",
"font",
"->",
"yoffs",
")",
"!=",
"4",
")",
"return",
"1",
";",
"break",
";",
"}",
"}",
"font",
"->",
"scale",
"=",
"1.0f",
"/",
"(",
"float",
")",
"font",
"->",
"height",
";",
"for",
"(",
";",
"ptr",
"!=",
"NULL",
";",
"ptr",
"=",
"next_line",
"(",
"ptr",
")",
")",
"{",
"if",
"(",
"strncmp",
"(",
"ptr",
",",
"\"",
"\"",
",",
"7",
")",
"==",
"0",
")",
"break",
";",
"if",
"(",
"strncmp",
"(",
"ptr",
",",
"\"",
"\"",
",",
"10",
")",
"==",
"0",
")",
"{",
"int",
"bmwidth",
"=",
"-1",
",",
"bmheight",
"=",
"-1",
",",
"xoffs",
"=",
"-1",
",",
"yoffs",
"=",
"-1",
";",
"const",
"char",
"*",
"rawdata",
"=",
"NULL",
";",
"int",
"charnum",
"=",
"-1",
";",
"int",
"width",
"=",
"-1",
";",
"int",
"dummy1",
";",
"for",
"(",
";",
"ptr",
"!=",
"NULL",
";",
"ptr",
"=",
"next_line",
"(",
"ptr",
")",
")",
"{",
"if",
"(",
"strncmp",
"(",
"ptr",
",",
"\"",
"\"",
",",
"9",
")",
"==",
"0",
")",
"{",
"if",
"(",
"sscanf",
"(",
"ptr",
"+",
"9",
",",
"\"",
"\"",
",",
"&",
"charnum",
")",
"!=",
"1",
")",
"return",
"1",
";",
"}",
"else",
"if",
"(",
"strncmp",
"(",
"ptr",
",",
"\"",
"\"",
",",
"7",
")",
"==",
"0",
")",
"{",
"if",
"(",
"sscanf",
"(",
"ptr",
"+",
"7",
",",
"\"",
"\"",
",",
"&",
"width",
",",
"&",
"dummy1",
")",
"!=",
"2",
")",
"return",
"1",
";",
"}",
"else",
"if",
"(",
"strncmp",
"(",
"ptr",
",",
"\"",
"\"",
",",
"4",
")",
"==",
"0",
")",
"{",
"if",
"(",
"sscanf",
"(",
"ptr",
"+",
"4",
",",
"\"",
"\"",
",",
"&",
"bmwidth",
",",
"&",
"bmheight",
",",
"&",
"xoffs",
",",
"&",
"yoffs",
")",
"!=",
"4",
")",
"return",
"1",
";",
"}",
"else",
"if",
"(",
"strncmp",
"(",
"ptr",
",",
"\"",
"\"",
",",
"6",
")",
"==",
"0",
")",
"{",
"for",
"(",
"rawdata",
"=",
"ptr",
"=",
"next_line",
"(",
"ptr",
")",
";",
"ptr",
"!=",
"NULL",
"&&",
"strncmp",
"(",
"ptr",
",",
"\"",
"\"",
",",
"7",
")",
"!=",
"0",
";",
"ptr",
"=",
"next_line",
"(",
"ptr",
")",
")",
";",
"break",
";",
"}",
"}",
"if",
"(",
"charnum",
">=",
"0",
"&&",
"charnum",
"<",
"65536",
"&&",
"rawdata",
"!=",
"NULL",
"&&",
"bmwidth",
">=",
"0",
"&&",
"bmheight",
">=",
"0",
")",
"{",
"render_font_char",
"*",
"ch",
";",
"if",
"(",
"font",
"->",
"chars",
"[",
"charnum",
"/",
"256",
"]",
"==",
"NULL",
")",
"font",
"->",
"chars",
"[",
"charnum",
"/",
"256",
"]",
"=",
"alloc_array_clear_or_die",
"(",
"render_font_char",
",",
"256",
")",
";",
"ch",
"=",
"&",
"font",
"->",
"chars",
"[",
"charnum",
"/",
"256",
"]",
"[",
"charnum",
"%",
"256",
"]",
";",
"ch",
"->",
"width",
"=",
"width",
";",
"ch",
"->",
"bmwidth",
"=",
"bmwidth",
";",
"ch",
"->",
"bmheight",
"=",
"bmheight",
";",
"ch",
"->",
"xoffs",
"=",
"xoffs",
";",
"ch",
"->",
"yoffs",
"=",
"yoffs",
";",
"ch",
"->",
"rawdata",
"=",
"rawdata",
";",
"}",
"if",
"(",
"++",
"charcount",
"%",
"256",
"==",
"0",
")",
"mame_printf_warning",
"(",
"\"",
"\\n",
"\"",
",",
"charcount",
")",
";",
"}",
"}",
"return",
"0",
";",
"}"
] | render_font_load_bdf - parse and load a BDF
font | [
"render_font_load_bdf",
"-",
"parse",
"and",
"load",
"a",
"BDF",
"font"
] | [
"/* set the format to text */",
"/* first find the FONTBOUNDINGBOX tag */",
"/* we only care about a tiny few fields */",
"/* compute the scale factor */",
"/* now scan for characters */",
"/* stop at ENDFONT */",
"/* once we hit a STARTCHAR, parse until the end */",
"/* scan for interesting per-character tags */",
"/* ENCODING tells us which character */",
"/* DWIDTH tells us the width to the next character */",
"/* BBX tells us the height/width of the bitmap and the offsets */",
"/* BITMAP is the start of the data */",
"/* stash the raw pointer and scan for the end of the character */",
"/* if we have everything, allocate a new character */",
"/* if we don't have a subtable yet, make one */",
"/* fill in the entry */",
"/* some progress for big fonts */"
] | [
{
"param": "font",
"type": "render_font"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "font",
"type": "render_font",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bceeadb170e03b2b83bca314354dc1273acb6e6f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/rendfont.c | [
"Unlicense"
] | C | render_font_load_cached | int | static int render_font_load_cached(render_font *font, mame_file *file, UINT32 hash)
{
UINT8 header[CACHED_HEADER_SIZE];
UINT64 offset, filesize;
UINT8 *data = NULL;
UINT32 bytes_read;
int numchars;
int chindex;
/* get the file size */
filesize = mame_fsize(file);
/* first read the header */
bytes_read = mame_fread(file, header, CACHED_HEADER_SIZE);
if (bytes_read != CACHED_HEADER_SIZE)
goto error;
/* validate the header */
if (header[0] != 'f' || header[1] != 'o' || header[2] != 'n' || header[3] != 't')
goto error;
if (header[4] != (UINT8)(hash >> 24) || header[5] != (UINT8)(hash >> 16) || header[6] != (UINT8)(hash >> 8) || header[7] != (UINT8)hash)
goto error;
font->height = (header[8] << 8) | header[9];
font->scale = 1.0f / (float)font->height;
font->yoffs = (INT16)((header[10] << 8) | header[11]);
numchars = (header[12] << 24) | (header[13] << 16) | (header[14] << 8) | header[15];
if (filesize - CACHED_HEADER_SIZE < numchars * CACHED_CHAR_SIZE)
goto error;
/* now read the rest of the data */
data = alloc_array_or_die(UINT8, filesize - CACHED_HEADER_SIZE);
bytes_read = mame_fread(file, data, filesize - CACHED_HEADER_SIZE);
if (bytes_read != filesize - CACHED_HEADER_SIZE)
goto error;
/* extract the data from the data */
offset = numchars * CACHED_CHAR_SIZE;
for (chindex = 0; chindex < numchars; chindex++)
{
const UINT8 *info = &data[chindex * CACHED_CHAR_SIZE];
int chnum = (info[0] << 8) | info[1];
render_font_char *ch;
/* if we don't have a subtable yet, make one */
if (font->chars[chnum / 256] == NULL)
font->chars[chnum / 256] = alloc_array_clear_or_die(render_font_char, 256);
/* fill in the entry */
ch = &font->chars[chnum / 256][chnum % 256];
ch->width = (info[2] << 8) | info[3];
ch->xoffs = (INT16)((info[4] << 8) | info[5]);
ch->yoffs = (INT16)((info[6] << 8) | info[7]);
ch->bmwidth = (info[8] << 8) | info[9];
ch->bmheight = (info[10] << 8) | info[11];
ch->rawdata = (char *)data + offset;
/* advance the offset past the character */
offset += (ch->bmwidth * ch->bmheight + 7) / 8;
if (offset > filesize - CACHED_HEADER_SIZE)
goto error;
}
/* reuse the chartable as a temporary buffer */
font->format = FONT_FORMAT_CACHED;
font->rawdata = (char *)data;
return 0;
error:
if (data != NULL)
free(data);
return 1;
} | /*-------------------------------------------------
render_font_load_cached - load a font in
cached format
-------------------------------------------------*/ | load a font in
cached format | [
"load",
"a",
"font",
"in",
"cached",
"format"
] | static int render_font_load_cached(render_font *font, mame_file *file, UINT32 hash)
{
UINT8 header[CACHED_HEADER_SIZE];
UINT64 offset, filesize;
UINT8 *data = NULL;
UINT32 bytes_read;
int numchars;
int chindex;
filesize = mame_fsize(file);
bytes_read = mame_fread(file, header, CACHED_HEADER_SIZE);
if (bytes_read != CACHED_HEADER_SIZE)
goto error;
if (header[0] != 'f' || header[1] != 'o' || header[2] != 'n' || header[3] != 't')
goto error;
if (header[4] != (UINT8)(hash >> 24) || header[5] != (UINT8)(hash >> 16) || header[6] != (UINT8)(hash >> 8) || header[7] != (UINT8)hash)
goto error;
font->height = (header[8] << 8) | header[9];
font->scale = 1.0f / (float)font->height;
font->yoffs = (INT16)((header[10] << 8) | header[11]);
numchars = (header[12] << 24) | (header[13] << 16) | (header[14] << 8) | header[15];
if (filesize - CACHED_HEADER_SIZE < numchars * CACHED_CHAR_SIZE)
goto error;
data = alloc_array_or_die(UINT8, filesize - CACHED_HEADER_SIZE);
bytes_read = mame_fread(file, data, filesize - CACHED_HEADER_SIZE);
if (bytes_read != filesize - CACHED_HEADER_SIZE)
goto error;
offset = numchars * CACHED_CHAR_SIZE;
for (chindex = 0; chindex < numchars; chindex++)
{
const UINT8 *info = &data[chindex * CACHED_CHAR_SIZE];
int chnum = (info[0] << 8) | info[1];
render_font_char *ch;
if (font->chars[chnum / 256] == NULL)
font->chars[chnum / 256] = alloc_array_clear_or_die(render_font_char, 256);
ch = &font->chars[chnum / 256][chnum % 256];
ch->width = (info[2] << 8) | info[3];
ch->xoffs = (INT16)((info[4] << 8) | info[5]);
ch->yoffs = (INT16)((info[6] << 8) | info[7]);
ch->bmwidth = (info[8] << 8) | info[9];
ch->bmheight = (info[10] << 8) | info[11];
ch->rawdata = (char *)data + offset;
offset += (ch->bmwidth * ch->bmheight + 7) / 8;
if (offset > filesize - CACHED_HEADER_SIZE)
goto error;
}
font->format = FONT_FORMAT_CACHED;
font->rawdata = (char *)data;
return 0;
error:
if (data != NULL)
free(data);
return 1;
} | [
"static",
"int",
"render_font_load_cached",
"(",
"render_font",
"*",
"font",
",",
"mame_file",
"*",
"file",
",",
"UINT32",
"hash",
")",
"{",
"UINT8",
"header",
"[",
"CACHED_HEADER_SIZE",
"]",
";",
"UINT64",
"offset",
",",
"filesize",
";",
"UINT8",
"*",
"data",
"=",
"NULL",
";",
"UINT32",
"bytes_read",
";",
"int",
"numchars",
";",
"int",
"chindex",
";",
"filesize",
"=",
"mame_fsize",
"(",
"file",
")",
";",
"bytes_read",
"=",
"mame_fread",
"(",
"file",
",",
"header",
",",
"CACHED_HEADER_SIZE",
")",
";",
"if",
"(",
"bytes_read",
"!=",
"CACHED_HEADER_SIZE",
")",
"goto",
"error",
";",
"if",
"(",
"header",
"[",
"0",
"]",
"!=",
"'",
"'",
"||",
"header",
"[",
"1",
"]",
"!=",
"'",
"'",
"||",
"header",
"[",
"2",
"]",
"!=",
"'",
"'",
"||",
"header",
"[",
"3",
"]",
"!=",
"'",
"'",
")",
"goto",
"error",
";",
"if",
"(",
"header",
"[",
"4",
"]",
"!=",
"(",
"UINT8",
")",
"(",
"hash",
">>",
"24",
")",
"||",
"header",
"[",
"5",
"]",
"!=",
"(",
"UINT8",
")",
"(",
"hash",
">>",
"16",
")",
"||",
"header",
"[",
"6",
"]",
"!=",
"(",
"UINT8",
")",
"(",
"hash",
">>",
"8",
")",
"||",
"header",
"[",
"7",
"]",
"!=",
"(",
"UINT8",
")",
"hash",
")",
"goto",
"error",
";",
"font",
"->",
"height",
"=",
"(",
"header",
"[",
"8",
"]",
"<<",
"8",
")",
"|",
"header",
"[",
"9",
"]",
";",
"font",
"->",
"scale",
"=",
"1.0f",
"/",
"(",
"float",
")",
"font",
"->",
"height",
";",
"font",
"->",
"yoffs",
"=",
"(",
"INT16",
")",
"(",
"(",
"header",
"[",
"10",
"]",
"<<",
"8",
")",
"|",
"header",
"[",
"11",
"]",
")",
";",
"numchars",
"=",
"(",
"header",
"[",
"12",
"]",
"<<",
"24",
")",
"|",
"(",
"header",
"[",
"13",
"]",
"<<",
"16",
")",
"|",
"(",
"header",
"[",
"14",
"]",
"<<",
"8",
")",
"|",
"header",
"[",
"15",
"]",
";",
"if",
"(",
"filesize",
"-",
"CACHED_HEADER_SIZE",
"<",
"numchars",
"*",
"CACHED_CHAR_SIZE",
")",
"goto",
"error",
";",
"data",
"=",
"alloc_array_or_die",
"(",
"UINT8",
",",
"filesize",
"-",
"CACHED_HEADER_SIZE",
")",
";",
"bytes_read",
"=",
"mame_fread",
"(",
"file",
",",
"data",
",",
"filesize",
"-",
"CACHED_HEADER_SIZE",
")",
";",
"if",
"(",
"bytes_read",
"!=",
"filesize",
"-",
"CACHED_HEADER_SIZE",
")",
"goto",
"error",
";",
"offset",
"=",
"numchars",
"*",
"CACHED_CHAR_SIZE",
";",
"for",
"(",
"chindex",
"=",
"0",
";",
"chindex",
"<",
"numchars",
";",
"chindex",
"++",
")",
"{",
"const",
"UINT8",
"*",
"info",
"=",
"&",
"data",
"[",
"chindex",
"*",
"CACHED_CHAR_SIZE",
"]",
";",
"int",
"chnum",
"=",
"(",
"info",
"[",
"0",
"]",
"<<",
"8",
")",
"|",
"info",
"[",
"1",
"]",
";",
"render_font_char",
"*",
"ch",
";",
"if",
"(",
"font",
"->",
"chars",
"[",
"chnum",
"/",
"256",
"]",
"==",
"NULL",
")",
"font",
"->",
"chars",
"[",
"chnum",
"/",
"256",
"]",
"=",
"alloc_array_clear_or_die",
"(",
"render_font_char",
",",
"256",
")",
";",
"ch",
"=",
"&",
"font",
"->",
"chars",
"[",
"chnum",
"/",
"256",
"]",
"[",
"chnum",
"%",
"256",
"]",
";",
"ch",
"->",
"width",
"=",
"(",
"info",
"[",
"2",
"]",
"<<",
"8",
")",
"|",
"info",
"[",
"3",
"]",
";",
"ch",
"->",
"xoffs",
"=",
"(",
"INT16",
")",
"(",
"(",
"info",
"[",
"4",
"]",
"<<",
"8",
")",
"|",
"info",
"[",
"5",
"]",
")",
";",
"ch",
"->",
"yoffs",
"=",
"(",
"INT16",
")",
"(",
"(",
"info",
"[",
"6",
"]",
"<<",
"8",
")",
"|",
"info",
"[",
"7",
"]",
")",
";",
"ch",
"->",
"bmwidth",
"=",
"(",
"info",
"[",
"8",
"]",
"<<",
"8",
")",
"|",
"info",
"[",
"9",
"]",
";",
"ch",
"->",
"bmheight",
"=",
"(",
"info",
"[",
"10",
"]",
"<<",
"8",
")",
"|",
"info",
"[",
"11",
"]",
";",
"ch",
"->",
"rawdata",
"=",
"(",
"char",
"*",
")",
"data",
"+",
"offset",
";",
"offset",
"+=",
"(",
"ch",
"->",
"bmwidth",
"*",
"ch",
"->",
"bmheight",
"+",
"7",
")",
"/",
"8",
";",
"if",
"(",
"offset",
">",
"filesize",
"-",
"CACHED_HEADER_SIZE",
")",
"goto",
"error",
";",
"}",
"font",
"->",
"format",
"=",
"FONT_FORMAT_CACHED",
";",
"font",
"->",
"rawdata",
"=",
"(",
"char",
"*",
")",
"data",
";",
"return",
"0",
";",
"error",
":",
"if",
"(",
"data",
"!=",
"NULL",
")",
"free",
"(",
"data",
")",
";",
"return",
"1",
";",
"}"
] | render_font_load_cached - load a font in
cached format | [
"render_font_load_cached",
"-",
"load",
"a",
"font",
"in",
"cached",
"format"
] | [
"/* get the file size */",
"/* first read the header */",
"/* validate the header */",
"/* now read the rest of the data */",
"/* extract the data from the data */",
"/* if we don't have a subtable yet, make one */",
"/* fill in the entry */",
"/* advance the offset past the character */",
"/* reuse the chartable as a temporary buffer */"
] | [
{
"param": "font",
"type": "render_font"
},
{
"param": "file",
"type": "mame_file"
},
{
"param": "hash",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "font",
"type": "render_font",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file",
"type": "mame_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "hash",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bceeadb170e03b2b83bca314354dc1273acb6e6f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/rendfont.c | [
"Unlicense"
] | C | render_font_save_cached | int | static int render_font_save_cached(render_font *font, const char *filename, UINT32 hash)
{
file_error filerr;
render_font_char *ch;
UINT32 bytes_written;
UINT8 *tempbuffer;
UINT8 *chartable;
mame_file *file;
int numchars;
UINT8 *dest;
int tableindex;
int chnum;
mame_printf_warning("Generating cached BDF font...\n");
/* attempt to open the file */
filerr = mame_fopen(SEARCHPATH_FONT, filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file);
if (filerr != FILERR_NONE)
return 1;
/* determine the number of characters */
numchars = 0;
for (chnum = 0; chnum < 65536; chnum++)
{
render_font_char *chtable = font->chars[chnum / 256];
if (chtable != NULL)
{
ch = &chtable[chnum % 256];
if (ch->width > 0)
numchars++;
}
}
/* allocate an array to hold the character data */
chartable = alloc_array_clear_or_die(UINT8, numchars * CACHED_CHAR_SIZE);
/* allocate a temp buffer to compress into */
tempbuffer = alloc_array_or_die(UINT8, 65536);
/* write the header */
dest = tempbuffer;
*dest++ = 'f';
*dest++ = 'o';
*dest++ = 'n';
*dest++ = 't';
*dest++ = hash >> 24;
*dest++ = hash >> 16;
*dest++ = hash >> 8;
*dest++ = hash & 0xff;
*dest++ = font->height >> 8;
*dest++ = font->height & 0xff;
*dest++ = font->yoffs >> 8;
*dest++ = font->yoffs & 0xff;
*dest++ = numchars >> 24;
*dest++ = numchars >> 16;
*dest++ = numchars >> 8;
*dest++ = numchars & 0xff;
assert(dest - tempbuffer == CACHED_HEADER_SIZE);
bytes_written = mame_fwrite(file, tempbuffer, dest - tempbuffer);
if (bytes_written != dest - tempbuffer)
goto error;
/* write the empty table to the beginning of the file */
bytes_written = mame_fwrite(file, chartable, numchars * CACHED_CHAR_SIZE);
if (bytes_written != numchars * CACHED_CHAR_SIZE)
goto error;
/* loop over all characters */
tableindex = 0;
for (chnum = 0; chnum < 65536; chnum++)
{
ch = get_char(font, chnum);
if (ch != NULL && ch->width > 0)
{
UINT8 accum, accbit;
int x, y;
/* write out a bit-compressed bitmap if we have one */
if (ch->bitmap != NULL)
{
/* write the data to the tempbuffer */
dest = tempbuffer;
accum = 0;
accbit = 7;
/* bit-encode the character data */
for (y = 0; y < ch->bmheight; y++)
{
int desty = y + font->height + font->yoffs - ch->yoffs - ch->bmheight;
const UINT32 *src = (desty >= 0 && desty < font->height) ? BITMAP_ADDR32(ch->bitmap, desty, 0) : NULL;
for (x = 0; x < ch->bmwidth; x++)
{
if (src != NULL && RGB_ALPHA(src[x]) != 0)
accum |= 1 << accbit;
if (accbit-- == 0)
{
*dest++ = accum;
accum = 0;
accbit = 7;
}
}
}
/* flush any extra */
if (accbit != 7)
*dest++ = accum;
/* write the data */
bytes_written = mame_fwrite(file, tempbuffer, dest - tempbuffer);
if (bytes_written != dest - tempbuffer)
goto error;
/* free the bitmap and texture */
if (ch->texture != NULL)
render_texture_free(ch->texture);
ch->texture = NULL;
bitmap_free(ch->bitmap);
ch->bitmap = NULL;
}
/* compute the table entry */
dest = &chartable[tableindex++ * CACHED_CHAR_SIZE];
*dest++ = chnum >> 8;
*dest++ = chnum & 0xff;
*dest++ = ch->width >> 8;
*dest++ = ch->width & 0xff;
*dest++ = ch->xoffs >> 8;
*dest++ = ch->xoffs & 0xff;
*dest++ = ch->yoffs >> 8;
*dest++ = ch->yoffs & 0xff;
*dest++ = ch->bmwidth >> 8;
*dest++ = ch->bmwidth & 0xff;
*dest++ = ch->bmheight >> 8;
*dest++ = ch->bmheight & 0xff;
}
}
/* seek back to the beginning and rewrite the table */
mame_fseek(file, CACHED_HEADER_SIZE, SEEK_SET);
bytes_written = mame_fwrite(file, chartable, numchars * CACHED_CHAR_SIZE);
if (bytes_written != numchars * CACHED_CHAR_SIZE)
goto error;
/* all done */
mame_fclose(file);
free(tempbuffer);
free(chartable);
return 0;
error:
mame_fclose(file);
osd_rmfile(filename);
free(tempbuffer);
free(chartable);
return 1;
} | /*-------------------------------------------------
render_font_save_cached - save a font in
cached format
-------------------------------------------------*/ | save a font in
cached format | [
"save",
"a",
"font",
"in",
"cached",
"format"
] | static int render_font_save_cached(render_font *font, const char *filename, UINT32 hash)
{
file_error filerr;
render_font_char *ch;
UINT32 bytes_written;
UINT8 *tempbuffer;
UINT8 *chartable;
mame_file *file;
int numchars;
UINT8 *dest;
int tableindex;
int chnum;
mame_printf_warning("Generating cached BDF font...\n");
filerr = mame_fopen(SEARCHPATH_FONT, filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file);
if (filerr != FILERR_NONE)
return 1;
numchars = 0;
for (chnum = 0; chnum < 65536; chnum++)
{
render_font_char *chtable = font->chars[chnum / 256];
if (chtable != NULL)
{
ch = &chtable[chnum % 256];
if (ch->width > 0)
numchars++;
}
}
chartable = alloc_array_clear_or_die(UINT8, numchars * CACHED_CHAR_SIZE);
tempbuffer = alloc_array_or_die(UINT8, 65536);
dest = tempbuffer;
*dest++ = 'f';
*dest++ = 'o';
*dest++ = 'n';
*dest++ = 't';
*dest++ = hash >> 24;
*dest++ = hash >> 16;
*dest++ = hash >> 8;
*dest++ = hash & 0xff;
*dest++ = font->height >> 8;
*dest++ = font->height & 0xff;
*dest++ = font->yoffs >> 8;
*dest++ = font->yoffs & 0xff;
*dest++ = numchars >> 24;
*dest++ = numchars >> 16;
*dest++ = numchars >> 8;
*dest++ = numchars & 0xff;
assert(dest - tempbuffer == CACHED_HEADER_SIZE);
bytes_written = mame_fwrite(file, tempbuffer, dest - tempbuffer);
if (bytes_written != dest - tempbuffer)
goto error;
bytes_written = mame_fwrite(file, chartable, numchars * CACHED_CHAR_SIZE);
if (bytes_written != numchars * CACHED_CHAR_SIZE)
goto error;
tableindex = 0;
for (chnum = 0; chnum < 65536; chnum++)
{
ch = get_char(font, chnum);
if (ch != NULL && ch->width > 0)
{
UINT8 accum, accbit;
int x, y;
if (ch->bitmap != NULL)
{
dest = tempbuffer;
accum = 0;
accbit = 7;
for (y = 0; y < ch->bmheight; y++)
{
int desty = y + font->height + font->yoffs - ch->yoffs - ch->bmheight;
const UINT32 *src = (desty >= 0 && desty < font->height) ? BITMAP_ADDR32(ch->bitmap, desty, 0) : NULL;
for (x = 0; x < ch->bmwidth; x++)
{
if (src != NULL && RGB_ALPHA(src[x]) != 0)
accum |= 1 << accbit;
if (accbit-- == 0)
{
*dest++ = accum;
accum = 0;
accbit = 7;
}
}
}
if (accbit != 7)
*dest++ = accum;
bytes_written = mame_fwrite(file, tempbuffer, dest - tempbuffer);
if (bytes_written != dest - tempbuffer)
goto error;
if (ch->texture != NULL)
render_texture_free(ch->texture);
ch->texture = NULL;
bitmap_free(ch->bitmap);
ch->bitmap = NULL;
}
dest = &chartable[tableindex++ * CACHED_CHAR_SIZE];
*dest++ = chnum >> 8;
*dest++ = chnum & 0xff;
*dest++ = ch->width >> 8;
*dest++ = ch->width & 0xff;
*dest++ = ch->xoffs >> 8;
*dest++ = ch->xoffs & 0xff;
*dest++ = ch->yoffs >> 8;
*dest++ = ch->yoffs & 0xff;
*dest++ = ch->bmwidth >> 8;
*dest++ = ch->bmwidth & 0xff;
*dest++ = ch->bmheight >> 8;
*dest++ = ch->bmheight & 0xff;
}
}
mame_fseek(file, CACHED_HEADER_SIZE, SEEK_SET);
bytes_written = mame_fwrite(file, chartable, numchars * CACHED_CHAR_SIZE);
if (bytes_written != numchars * CACHED_CHAR_SIZE)
goto error;
mame_fclose(file);
free(tempbuffer);
free(chartable);
return 0;
error:
mame_fclose(file);
osd_rmfile(filename);
free(tempbuffer);
free(chartable);
return 1;
} | [
"static",
"int",
"render_font_save_cached",
"(",
"render_font",
"*",
"font",
",",
"const",
"char",
"*",
"filename",
",",
"UINT32",
"hash",
")",
"{",
"file_error",
"filerr",
";",
"render_font_char",
"*",
"ch",
";",
"UINT32",
"bytes_written",
";",
"UINT8",
"*",
"tempbuffer",
";",
"UINT8",
"*",
"chartable",
";",
"mame_file",
"*",
"file",
";",
"int",
"numchars",
";",
"UINT8",
"*",
"dest",
";",
"int",
"tableindex",
";",
"int",
"chnum",
";",
"mame_printf_warning",
"(",
"\"",
"\\n",
"\"",
")",
";",
"filerr",
"=",
"mame_fopen",
"(",
"SEARCHPATH_FONT",
",",
"filename",
",",
"OPEN_FLAG_WRITE",
"|",
"OPEN_FLAG_CREATE",
",",
"&",
"file",
")",
";",
"if",
"(",
"filerr",
"!=",
"FILERR_NONE",
")",
"return",
"1",
";",
"numchars",
"=",
"0",
";",
"for",
"(",
"chnum",
"=",
"0",
";",
"chnum",
"<",
"65536",
";",
"chnum",
"++",
")",
"{",
"render_font_char",
"*",
"chtable",
"=",
"font",
"->",
"chars",
"[",
"chnum",
"/",
"256",
"]",
";",
"if",
"(",
"chtable",
"!=",
"NULL",
")",
"{",
"ch",
"=",
"&",
"chtable",
"[",
"chnum",
"%",
"256",
"]",
";",
"if",
"(",
"ch",
"->",
"width",
">",
"0",
")",
"numchars",
"++",
";",
"}",
"}",
"chartable",
"=",
"alloc_array_clear_or_die",
"(",
"UINT8",
",",
"numchars",
"*",
"CACHED_CHAR_SIZE",
")",
";",
"tempbuffer",
"=",
"alloc_array_or_die",
"(",
"UINT8",
",",
"65536",
")",
";",
"dest",
"=",
"tempbuffer",
";",
"*",
"dest",
"++",
"=",
"'",
"'",
";",
"*",
"dest",
"++",
"=",
"'",
"'",
";",
"*",
"dest",
"++",
"=",
"'",
"'",
";",
"*",
"dest",
"++",
"=",
"'",
"'",
";",
"*",
"dest",
"++",
"=",
"hash",
">>",
"24",
";",
"*",
"dest",
"++",
"=",
"hash",
">>",
"16",
";",
"*",
"dest",
"++",
"=",
"hash",
">>",
"8",
";",
"*",
"dest",
"++",
"=",
"hash",
"&",
"0xff",
";",
"*",
"dest",
"++",
"=",
"font",
"->",
"height",
">>",
"8",
";",
"*",
"dest",
"++",
"=",
"font",
"->",
"height",
"&",
"0xff",
";",
"*",
"dest",
"++",
"=",
"font",
"->",
"yoffs",
">>",
"8",
";",
"*",
"dest",
"++",
"=",
"font",
"->",
"yoffs",
"&",
"0xff",
";",
"*",
"dest",
"++",
"=",
"numchars",
">>",
"24",
";",
"*",
"dest",
"++",
"=",
"numchars",
">>",
"16",
";",
"*",
"dest",
"++",
"=",
"numchars",
">>",
"8",
";",
"*",
"dest",
"++",
"=",
"numchars",
"&",
"0xff",
";",
"assert",
"(",
"dest",
"-",
"tempbuffer",
"==",
"CACHED_HEADER_SIZE",
")",
";",
"bytes_written",
"=",
"mame_fwrite",
"(",
"file",
",",
"tempbuffer",
",",
"dest",
"-",
"tempbuffer",
")",
";",
"if",
"(",
"bytes_written",
"!=",
"dest",
"-",
"tempbuffer",
")",
"goto",
"error",
";",
"bytes_written",
"=",
"mame_fwrite",
"(",
"file",
",",
"chartable",
",",
"numchars",
"*",
"CACHED_CHAR_SIZE",
")",
";",
"if",
"(",
"bytes_written",
"!=",
"numchars",
"*",
"CACHED_CHAR_SIZE",
")",
"goto",
"error",
";",
"tableindex",
"=",
"0",
";",
"for",
"(",
"chnum",
"=",
"0",
";",
"chnum",
"<",
"65536",
";",
"chnum",
"++",
")",
"{",
"ch",
"=",
"get_char",
"(",
"font",
",",
"chnum",
")",
";",
"if",
"(",
"ch",
"!=",
"NULL",
"&&",
"ch",
"->",
"width",
">",
"0",
")",
"{",
"UINT8",
"accum",
",",
"accbit",
";",
"int",
"x",
",",
"y",
";",
"if",
"(",
"ch",
"->",
"bitmap",
"!=",
"NULL",
")",
"{",
"dest",
"=",
"tempbuffer",
";",
"accum",
"=",
"0",
";",
"accbit",
"=",
"7",
";",
"for",
"(",
"y",
"=",
"0",
";",
"y",
"<",
"ch",
"->",
"bmheight",
";",
"y",
"++",
")",
"{",
"int",
"desty",
"=",
"y",
"+",
"font",
"->",
"height",
"+",
"font",
"->",
"yoffs",
"-",
"ch",
"->",
"yoffs",
"-",
"ch",
"->",
"bmheight",
";",
"const",
"UINT32",
"*",
"src",
"=",
"(",
"desty",
">=",
"0",
"&&",
"desty",
"<",
"font",
"->",
"height",
")",
"?",
"BITMAP_ADDR32",
"(",
"ch",
"->",
"bitmap",
",",
"desty",
",",
"0",
")",
":",
"NULL",
";",
"for",
"(",
"x",
"=",
"0",
";",
"x",
"<",
"ch",
"->",
"bmwidth",
";",
"x",
"++",
")",
"{",
"if",
"(",
"src",
"!=",
"NULL",
"&&",
"RGB_ALPHA",
"(",
"src",
"[",
"x",
"]",
")",
"!=",
"0",
")",
"accum",
"|=",
"1",
"<<",
"accbit",
";",
"if",
"(",
"accbit",
"--",
"==",
"0",
")",
"{",
"*",
"dest",
"++",
"=",
"accum",
";",
"accum",
"=",
"0",
";",
"accbit",
"=",
"7",
";",
"}",
"}",
"}",
"if",
"(",
"accbit",
"!=",
"7",
")",
"*",
"dest",
"++",
"=",
"accum",
";",
"bytes_written",
"=",
"mame_fwrite",
"(",
"file",
",",
"tempbuffer",
",",
"dest",
"-",
"tempbuffer",
")",
";",
"if",
"(",
"bytes_written",
"!=",
"dest",
"-",
"tempbuffer",
")",
"goto",
"error",
";",
"if",
"(",
"ch",
"->",
"texture",
"!=",
"NULL",
")",
"render_texture_free",
"(",
"ch",
"->",
"texture",
")",
";",
"ch",
"->",
"texture",
"=",
"NULL",
";",
"bitmap_free",
"(",
"ch",
"->",
"bitmap",
")",
";",
"ch",
"->",
"bitmap",
"=",
"NULL",
";",
"}",
"dest",
"=",
"&",
"chartable",
"[",
"tableindex",
"++",
"*",
"CACHED_CHAR_SIZE",
"]",
";",
"*",
"dest",
"++",
"=",
"chnum",
">>",
"8",
";",
"*",
"dest",
"++",
"=",
"chnum",
"&",
"0xff",
";",
"*",
"dest",
"++",
"=",
"ch",
"->",
"width",
">>",
"8",
";",
"*",
"dest",
"++",
"=",
"ch",
"->",
"width",
"&",
"0xff",
";",
"*",
"dest",
"++",
"=",
"ch",
"->",
"xoffs",
">>",
"8",
";",
"*",
"dest",
"++",
"=",
"ch",
"->",
"xoffs",
"&",
"0xff",
";",
"*",
"dest",
"++",
"=",
"ch",
"->",
"yoffs",
">>",
"8",
";",
"*",
"dest",
"++",
"=",
"ch",
"->",
"yoffs",
"&",
"0xff",
";",
"*",
"dest",
"++",
"=",
"ch",
"->",
"bmwidth",
">>",
"8",
";",
"*",
"dest",
"++",
"=",
"ch",
"->",
"bmwidth",
"&",
"0xff",
";",
"*",
"dest",
"++",
"=",
"ch",
"->",
"bmheight",
">>",
"8",
";",
"*",
"dest",
"++",
"=",
"ch",
"->",
"bmheight",
"&",
"0xff",
";",
"}",
"}",
"mame_fseek",
"(",
"file",
",",
"CACHED_HEADER_SIZE",
",",
"SEEK_SET",
")",
";",
"bytes_written",
"=",
"mame_fwrite",
"(",
"file",
",",
"chartable",
",",
"numchars",
"*",
"CACHED_CHAR_SIZE",
")",
";",
"if",
"(",
"bytes_written",
"!=",
"numchars",
"*",
"CACHED_CHAR_SIZE",
")",
"goto",
"error",
";",
"mame_fclose",
"(",
"file",
")",
";",
"free",
"(",
"tempbuffer",
")",
";",
"free",
"(",
"chartable",
")",
";",
"return",
"0",
";",
"error",
":",
"mame_fclose",
"(",
"file",
")",
";",
"osd_rmfile",
"(",
"filename",
")",
";",
"free",
"(",
"tempbuffer",
")",
";",
"free",
"(",
"chartable",
")",
";",
"return",
"1",
";",
"}"
] | render_font_save_cached - save a font in
cached format | [
"render_font_save_cached",
"-",
"save",
"a",
"font",
"in",
"cached",
"format"
] | [
"/* attempt to open the file */",
"/* determine the number of characters */",
"/* allocate an array to hold the character data */",
"/* allocate a temp buffer to compress into */",
"/* write the header */",
"/* write the empty table to the beginning of the file */",
"/* loop over all characters */",
"/* write out a bit-compressed bitmap if we have one */",
"/* write the data to the tempbuffer */",
"/* bit-encode the character data */",
"/* flush any extra */",
"/* write the data */",
"/* free the bitmap and texture */",
"/* compute the table entry */",
"/* seek back to the beginning and rewrite the table */",
"/* all done */"
] | [
{
"param": "font",
"type": "render_font"
},
{
"param": "filename",
"type": "char"
},
{
"param": "hash",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "font",
"type": "render_font",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "hash",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
077f97a38e61438f8783700a521ce6cbea3ff584 | lofunz/mieme | Reloaded/tags/MAME4droid1.1.2&MAME4iOS 1.1Reloaded/src/emu/input.c | [
"Unlicense"
] | C | input_device_class_enable | void | void input_device_class_enable(running_machine *machine, input_device_class devclass, UINT8 enable)
{
input_device_list *device_list = machine->input_data->device_list;
assert(devclass > DEVICE_CLASS_INVALID && devclass < DEVICE_CLASS_MAXIMUM);
device_list[devclass].enabled = enable;
} | /*-------------------------------------------------
input_device_class_enable - enable or disable
a device class
-------------------------------------------------*/ | enable or disable
a device class | [
"enable",
"or",
"disable",
"a",
"device",
"class"
] | void input_device_class_enable(running_machine *machine, input_device_class devclass, UINT8 enable)
{
input_device_list *device_list = machine->input_data->device_list;
assert(devclass > DEVICE_CLASS_INVALID && devclass < DEVICE_CLASS_MAXIMUM);
device_list[devclass].enabled = enable;
} | [
"void",
"input_device_class_enable",
"(",
"running_machine",
"*",
"machine",
",",
"input_device_class",
"devclass",
",",
"UINT8",
"enable",
")",
"{",
"input_device_list",
"*",
"device_list",
"=",
"machine",
"->",
"input_data",
"->",
"device_list",
";",
"assert",
"(",
"devclass",
">",
"DEVICE_CLASS_INVALID",
"&&",
"devclass",
"<",
"DEVICE_CLASS_MAXIMUM",
")",
";",
"device_list",
"[",
"devclass",
"]",
".",
"enabled",
"=",
"enable",
";",
"}"
] | input_device_class_enable - enable or disable
a device class | [
"input_device_class_enable",
"-",
"enable",
"or",
"disable",
"a",
"device",
"class"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "devclass",
"type": "input_device_class"
},
{
"param": "enable",
"type": "UINT8"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "devclass",
"type": "input_device_class",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "enable",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
077f97a38e61438f8783700a521ce6cbea3ff584 | lofunz/mieme | Reloaded/tags/MAME4droid1.1.2&MAME4iOS 1.1Reloaded/src/emu/input.c | [
"Unlicense"
] | C | input_device_set_joystick_map | int | int input_device_set_joystick_map(running_machine *machine, int devindex, const char *mapstring)
{
input_device_list *device_list = machine->input_data->device_list;
int startindex = devindex;
int stopindex = devindex;
joystick_map map;
int joynum;
/* parse the map */
if (!joystick_map_parse(mapstring, &map))
return FALSE;
/* devindex -1 means set the same for all */
if (devindex == -1)
{
startindex = 0;
stopindex = device_list[DEVICE_CLASS_JOYSTICK].count - 1;
joystick_map_print("Input: Changing default joystick map", mapstring, &map);
}
/* ignore if out of range */
else if (devindex >= device_list[DEVICE_CLASS_JOYSTICK].count)
return TRUE;
/* iterate over joysticks and set the map */
for (joynum = startindex; joynum <= stopindex; joynum++)
device_list[DEVICE_CLASS_JOYSTICK].list[joynum]->joymap = map;
return TRUE;
} | /*-------------------------------------------------
input_device_set_joystick_map - set the
joystick map for a device
-------------------------------------------------*/ | set the
joystick map for a device | [
"set",
"the",
"joystick",
"map",
"for",
"a",
"device"
] | int input_device_set_joystick_map(running_machine *machine, int devindex, const char *mapstring)
{
input_device_list *device_list = machine->input_data->device_list;
int startindex = devindex;
int stopindex = devindex;
joystick_map map;
int joynum;
if (!joystick_map_parse(mapstring, &map))
return FALSE;
if (devindex == -1)
{
startindex = 0;
stopindex = device_list[DEVICE_CLASS_JOYSTICK].count - 1;
joystick_map_print("Input: Changing default joystick map", mapstring, &map);
}
else if (devindex >= device_list[DEVICE_CLASS_JOYSTICK].count)
return TRUE;
for (joynum = startindex; joynum <= stopindex; joynum++)
device_list[DEVICE_CLASS_JOYSTICK].list[joynum]->joymap = map;
return TRUE;
} | [
"int",
"input_device_set_joystick_map",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"devindex",
",",
"const",
"char",
"*",
"mapstring",
")",
"{",
"input_device_list",
"*",
"device_list",
"=",
"machine",
"->",
"input_data",
"->",
"device_list",
";",
"int",
"startindex",
"=",
"devindex",
";",
"int",
"stopindex",
"=",
"devindex",
";",
"joystick_map",
"map",
";",
"int",
"joynum",
";",
"if",
"(",
"!",
"joystick_map_parse",
"(",
"mapstring",
",",
"&",
"map",
")",
")",
"return",
"FALSE",
";",
"if",
"(",
"devindex",
"==",
"-1",
")",
"{",
"startindex",
"=",
"0",
";",
"stopindex",
"=",
"device_list",
"[",
"DEVICE_CLASS_JOYSTICK",
"]",
".",
"count",
"-",
"1",
";",
"joystick_map_print",
"(",
"\"",
"\"",
",",
"mapstring",
",",
"&",
"map",
")",
";",
"}",
"else",
"if",
"(",
"devindex",
">=",
"device_list",
"[",
"DEVICE_CLASS_JOYSTICK",
"]",
".",
"count",
")",
"return",
"TRUE",
";",
"for",
"(",
"joynum",
"=",
"startindex",
";",
"joynum",
"<=",
"stopindex",
";",
"joynum",
"++",
")",
"device_list",
"[",
"DEVICE_CLASS_JOYSTICK",
"]",
".",
"list",
"[",
"joynum",
"]",
"->",
"joymap",
"=",
"map",
";",
"return",
"TRUE",
";",
"}"
] | input_device_set_joystick_map - set the
joystick map for a device | [
"input_device_set_joystick_map",
"-",
"set",
"the",
"joystick",
"map",
"for",
"a",
"device"
] | [
"/* parse the map */",
"/* devindex -1 means set the same for all */",
"/* ignore if out of range */",
"/* iterate over joysticks and set the map */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "devindex",
"type": "int"
},
{
"param": "mapstring",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "devindex",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mapstring",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
077f97a38e61438f8783700a521ce6cbea3ff584 | lofunz/mieme | Reloaded/tags/MAME4droid1.1.2&MAME4iOS 1.1Reloaded/src/emu/input.c | [
"Unlicense"
] | C | input_device_item_add | void | void input_device_item_add(input_device *device, const char *name, void *internal, input_item_id itemid, item_get_state_func getstate)
{
input_device_item *item;
input_item_id itemid_std = itemid;
assert_always(device->machine->phase() == MACHINE_PHASE_INIT, "Can only call input_device_item_add at init time!");
assert(name != NULL);
assert(itemid > ITEM_ID_INVALID && itemid < ITEM_ID_MAXIMUM);
assert(getstate != NULL);
/* if we have a generic ID, pick a new internal one */
if (itemid >= ITEM_ID_OTHER_SWITCH && itemid <= ITEM_ID_OTHER_AXIS_RELATIVE)
for (itemid = (input_item_id)(ITEM_ID_MAXIMUM + 1); itemid <= ITEM_ID_ABSOLUTE_MAXIMUM; itemid++)
if (device->item[itemid] == NULL)
break;
assert(itemid <= ITEM_ID_ABSOLUTE_MAXIMUM);
/* make sure we don't have any overlap */
assert(device->item[itemid] == NULL);
/* allocate a new item and copy data into it */
item = auto_alloc_clear(device->machine, input_device_item);
device->item[itemid] = item;
device->maxitem = MAX(device->maxitem, itemid);
/* copy in the data passed in from the item list */
item->devclass = device->devclass;
item->devindex = device->devindex;
item->name.cpy(name);
item->internal = internal;
item->itemclass = input_item_standard_class(device->devclass, itemid_std);
item->itemid = itemid;
item->getstate = getstate;
/* if we're custom, create a tokenized name */
if (itemid > ITEM_ID_MAXIMUM)
{
/* copy the item name, removing spaces/underscores and making all caps */
item->token.cpy(name).toupper().delchr(' ').delchr('_');
}
/* otherwise, make sure we have a valid standard token */
else
{
assert(code_to_string(itemid_token_table, itemid) != NULL);
}
} | /*-------------------------------------------------
input_device_item_add - add a new item to an
input device
-------------------------------------------------*/ | add a new item to an
input device | [
"add",
"a",
"new",
"item",
"to",
"an",
"input",
"device"
] | void input_device_item_add(input_device *device, const char *name, void *internal, input_item_id itemid, item_get_state_func getstate)
{
input_device_item *item;
input_item_id itemid_std = itemid;
assert_always(device->machine->phase() == MACHINE_PHASE_INIT, "Can only call input_device_item_add at init time!");
assert(name != NULL);
assert(itemid > ITEM_ID_INVALID && itemid < ITEM_ID_MAXIMUM);
assert(getstate != NULL);
if (itemid >= ITEM_ID_OTHER_SWITCH && itemid <= ITEM_ID_OTHER_AXIS_RELATIVE)
for (itemid = (input_item_id)(ITEM_ID_MAXIMUM + 1); itemid <= ITEM_ID_ABSOLUTE_MAXIMUM; itemid++)
if (device->item[itemid] == NULL)
break;
assert(itemid <= ITEM_ID_ABSOLUTE_MAXIMUM);
assert(device->item[itemid] == NULL);
item = auto_alloc_clear(device->machine, input_device_item);
device->item[itemid] = item;
device->maxitem = MAX(device->maxitem, itemid);
item->devclass = device->devclass;
item->devindex = device->devindex;
item->name.cpy(name);
item->internal = internal;
item->itemclass = input_item_standard_class(device->devclass, itemid_std);
item->itemid = itemid;
item->getstate = getstate;
if (itemid > ITEM_ID_MAXIMUM)
{
item->token.cpy(name).toupper().delchr(' ').delchr('_');
}
else
{
assert(code_to_string(itemid_token_table, itemid) != NULL);
}
} | [
"void",
"input_device_item_add",
"(",
"input_device",
"*",
"device",
",",
"const",
"char",
"*",
"name",
",",
"void",
"*",
"internal",
",",
"input_item_id",
"itemid",
",",
"item_get_state_func",
"getstate",
")",
"{",
"input_device_item",
"*",
"item",
";",
"input_item_id",
"itemid_std",
"=",
"itemid",
";",
"assert_always",
"(",
"device",
"->",
"machine",
"->",
"phase",
"(",
")",
"==",
"MACHINE_PHASE_INIT",
",",
"\"",
"\"",
")",
";",
"assert",
"(",
"name",
"!=",
"NULL",
")",
";",
"assert",
"(",
"itemid",
">",
"ITEM_ID_INVALID",
"&&",
"itemid",
"<",
"ITEM_ID_MAXIMUM",
")",
";",
"assert",
"(",
"getstate",
"!=",
"NULL",
")",
";",
"if",
"(",
"itemid",
">=",
"ITEM_ID_OTHER_SWITCH",
"&&",
"itemid",
"<=",
"ITEM_ID_OTHER_AXIS_RELATIVE",
")",
"for",
"(",
"itemid",
"=",
"(",
"input_item_id",
")",
"(",
"ITEM_ID_MAXIMUM",
"+",
"1",
")",
";",
"itemid",
"<=",
"ITEM_ID_ABSOLUTE_MAXIMUM",
";",
"itemid",
"++",
")",
"if",
"(",
"device",
"->",
"item",
"[",
"itemid",
"]",
"==",
"NULL",
")",
"break",
";",
"assert",
"(",
"itemid",
"<=",
"ITEM_ID_ABSOLUTE_MAXIMUM",
")",
";",
"assert",
"(",
"device",
"->",
"item",
"[",
"itemid",
"]",
"==",
"NULL",
")",
";",
"item",
"=",
"auto_alloc_clear",
"(",
"device",
"->",
"machine",
",",
"input_device_item",
")",
";",
"device",
"->",
"item",
"[",
"itemid",
"]",
"=",
"item",
";",
"device",
"->",
"maxitem",
"=",
"MAX",
"(",
"device",
"->",
"maxitem",
",",
"itemid",
")",
";",
"item",
"->",
"devclass",
"=",
"device",
"->",
"devclass",
";",
"item",
"->",
"devindex",
"=",
"device",
"->",
"devindex",
";",
"item",
"->",
"name",
".",
"cpy",
"(",
"name",
")",
";",
"item",
"->",
"internal",
"=",
"internal",
";",
"item",
"->",
"itemclass",
"=",
"input_item_standard_class",
"(",
"device",
"->",
"devclass",
",",
"itemid_std",
")",
";",
"item",
"->",
"itemid",
"=",
"itemid",
";",
"item",
"->",
"getstate",
"=",
"getstate",
";",
"if",
"(",
"itemid",
">",
"ITEM_ID_MAXIMUM",
")",
"{",
"item",
"->",
"token",
".",
"cpy",
"(",
"name",
")",
".",
"toupper",
"(",
")",
".",
"delchr",
"(",
"'",
"'",
")",
".",
"delchr",
"(",
"'",
"'",
")",
";",
"}",
"else",
"{",
"assert",
"(",
"code_to_string",
"(",
"itemid_token_table",
",",
"itemid",
")",
"!=",
"NULL",
")",
";",
"}",
"}"
] | input_device_item_add - add a new item to an
input device | [
"input_device_item_add",
"-",
"add",
"a",
"new",
"item",
"to",
"an",
"input",
"device"
] | [
"/* if we have a generic ID, pick a new internal one */",
"/* make sure we don't have any overlap */",
"/* allocate a new item and copy data into it */",
"/* copy in the data passed in from the item list */",
"/* if we're custom, create a tokenized name */",
"/* copy the item name, removing spaces/underscores and making all caps */",
"/* otherwise, make sure we have a valid standard token */"
] | [
{
"param": "device",
"type": "input_device"
},
{
"param": "name",
"type": "char"
},
{
"param": "internal",
"type": "void"
},
{
"param": "itemid",
"type": "input_item_id"
},
{
"param": "getstate",
"type": "item_get_state_func"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "input_device",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "internal",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "itemid",
"type": "input_item_id",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "getstate",
"type": "item_get_state_func",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
077f97a38e61438f8783700a521ce6cbea3ff584 | lofunz/mieme | Reloaded/tags/MAME4droid1.1.2&MAME4iOS 1.1Reloaded/src/emu/input.c | [
"Unlicense"
] | C | input_code_value | INT32 | INT32 input_code_value(running_machine *machine, input_code code)
{
input_device_list *device_list = machine->input_data->device_list;
input_device_class devclass = INPUT_CODE_DEVCLASS(code);
int startindex = INPUT_CODE_DEVINDEX(code);
int stopindex = startindex;
INT32 result = 0;
int curindex;
profiler_mark_start(PROFILER_INPUT);
/* return 0 for any disabled or invalid device classes */
if (devclass <= DEVICE_CLASS_INVALID || devclass >= DEVICE_CLASS_MAXIMUM || !device_list[devclass].enabled)
goto exit;
if (startindex >= device_list[devclass].count)
goto exit;
/* if this is not a multi device, only return data for item 0 */
if (!device_list[devclass].multi)
{
if (startindex != 0)
goto exit;
/* otherwise, iterate over all */
startindex = 0;
stopindex = device_list[devclass].count - 1;
}
/* iterate over all indices */
for (curindex = startindex; curindex <= stopindex; curindex++)
{
/* lookup the item for the appropriate index */
input_device_item *item = input_code_item(machine, INPUT_CODE_SET_DEVINDEX(code, curindex));
if (item == NULL)
continue;
/* update the value of this item */
input_item_update_value(machine, item);
/* process items according to their native type */
switch (item->itemclass)
{
case ITEM_CLASS_ABSOLUTE:
result = convert_absolute_value(machine, code, item);
break;
case ITEM_CLASS_RELATIVE:
result += convert_relative_value(code, item);
break;
case ITEM_CLASS_SWITCH:
result |= convert_switch_value(machine, code, item);
break;
default:
break;
}
}
exit:
profiler_mark_end();
return result;
} | /*-------------------------------------------------
input_code_value - return the value of a
given input code
-------------------------------------------------*/ | return the value of a
given input code | [
"return",
"the",
"value",
"of",
"a",
"given",
"input",
"code"
] | INT32 input_code_value(running_machine *machine, input_code code)
{
input_device_list *device_list = machine->input_data->device_list;
input_device_class devclass = INPUT_CODE_DEVCLASS(code);
int startindex = INPUT_CODE_DEVINDEX(code);
int stopindex = startindex;
INT32 result = 0;
int curindex;
profiler_mark_start(PROFILER_INPUT);
if (devclass <= DEVICE_CLASS_INVALID || devclass >= DEVICE_CLASS_MAXIMUM || !device_list[devclass].enabled)
goto exit;
if (startindex >= device_list[devclass].count)
goto exit;
if (!device_list[devclass].multi)
{
if (startindex != 0)
goto exit;
startindex = 0;
stopindex = device_list[devclass].count - 1;
}
for (curindex = startindex; curindex <= stopindex; curindex++)
{
input_device_item *item = input_code_item(machine, INPUT_CODE_SET_DEVINDEX(code, curindex));
if (item == NULL)
continue;
input_item_update_value(machine, item);
switch (item->itemclass)
{
case ITEM_CLASS_ABSOLUTE:
result = convert_absolute_value(machine, code, item);
break;
case ITEM_CLASS_RELATIVE:
result += convert_relative_value(code, item);
break;
case ITEM_CLASS_SWITCH:
result |= convert_switch_value(machine, code, item);
break;
default:
break;
}
}
exit:
profiler_mark_end();
return result;
} | [
"INT32",
"input_code_value",
"(",
"running_machine",
"*",
"machine",
",",
"input_code",
"code",
")",
"{",
"input_device_list",
"*",
"device_list",
"=",
"machine",
"->",
"input_data",
"->",
"device_list",
";",
"input_device_class",
"devclass",
"=",
"INPUT_CODE_DEVCLASS",
"(",
"code",
")",
";",
"int",
"startindex",
"=",
"INPUT_CODE_DEVINDEX",
"(",
"code",
")",
";",
"int",
"stopindex",
"=",
"startindex",
";",
"INT32",
"result",
"=",
"0",
";",
"int",
"curindex",
";",
"profiler_mark_start",
"(",
"PROFILER_INPUT",
")",
";",
"if",
"(",
"devclass",
"<=",
"DEVICE_CLASS_INVALID",
"||",
"devclass",
">=",
"DEVICE_CLASS_MAXIMUM",
"||",
"!",
"device_list",
"[",
"devclass",
"]",
".",
"enabled",
")",
"goto",
"exit",
";",
"if",
"(",
"startindex",
">=",
"device_list",
"[",
"devclass",
"]",
".",
"count",
")",
"goto",
"exit",
";",
"if",
"(",
"!",
"device_list",
"[",
"devclass",
"]",
".",
"multi",
")",
"{",
"if",
"(",
"startindex",
"!=",
"0",
")",
"goto",
"exit",
";",
"startindex",
"=",
"0",
";",
"stopindex",
"=",
"device_list",
"[",
"devclass",
"]",
".",
"count",
"-",
"1",
";",
"}",
"for",
"(",
"curindex",
"=",
"startindex",
";",
"curindex",
"<=",
"stopindex",
";",
"curindex",
"++",
")",
"{",
"input_device_item",
"*",
"item",
"=",
"input_code_item",
"(",
"machine",
",",
"INPUT_CODE_SET_DEVINDEX",
"(",
"code",
",",
"curindex",
")",
")",
";",
"if",
"(",
"item",
"==",
"NULL",
")",
"continue",
";",
"input_item_update_value",
"(",
"machine",
",",
"item",
")",
";",
"switch",
"(",
"item",
"->",
"itemclass",
")",
"{",
"case",
"ITEM_CLASS_ABSOLUTE",
":",
"result",
"=",
"convert_absolute_value",
"(",
"machine",
",",
"code",
",",
"item",
")",
";",
"break",
";",
"case",
"ITEM_CLASS_RELATIVE",
":",
"result",
"+=",
"convert_relative_value",
"(",
"code",
",",
"item",
")",
";",
"break",
";",
"case",
"ITEM_CLASS_SWITCH",
":",
"result",
"|=",
"convert_switch_value",
"(",
"machine",
",",
"code",
",",
"item",
")",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"}",
"exit",
":",
"profiler_mark_end",
"(",
")",
";",
"return",
"result",
";",
"}"
] | input_code_value - return the value of a
given input code | [
"input_code_value",
"-",
"return",
"the",
"value",
"of",
"a",
"given",
"input",
"code"
] | [
"/* return 0 for any disabled or invalid device classes */",
"/* if this is not a multi device, only return data for item 0 */",
"/* otherwise, iterate over all */",
"/* iterate over all indices */",
"/* lookup the item for the appropriate index */",
"/* update the value of this item */",
"/* process items according to their native type */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "code",
"type": "input_code"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "input_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
077f97a38e61438f8783700a521ce6cbea3ff584 | lofunz/mieme | Reloaded/tags/MAME4droid1.1.2&MAME4iOS 1.1Reloaded/src/emu/input.c | [
"Unlicense"
] | C | input_code_pressed_once | int | int input_code_pressed_once(running_machine *machine, input_code code)
{
input_code *code_pressed_memory = machine->input_data->code_pressed_memory;
int curvalue = input_code_pressed(machine, code);
int memnum, empty = -1;
/* look for the code in the memory */
for (memnum = 0; memnum < MAX_PRESSED_SWITCHES; memnum++)
{
/* were we previous pressed on the last time through here? */
if (code_pressed_memory[memnum] == code)
{
/* if no longer pressed, clear entry */
if (curvalue == 0)
code_pressed_memory[memnum] = INPUT_CODE_INVALID;
/* always return 0 */
return 0;
}
/* remember the first empty entry */
if (empty == -1 && code_pressed_memory[memnum] == INPUT_CODE_INVALID)
empty = memnum;
}
/* if we get here, we were not previously pressed; if still not pressed, return 0 */
if (curvalue == 0)
return 0;
/* otherwise, add ourself to the memory and return 1 */
assert(empty != -1);
if (empty != -1)
code_pressed_memory[empty] = code;
return 1;
} | /*-------------------------------------------------
input_code_pressed_once - return non-zero if a
given input code has transitioned from off to
on since the last call
-------------------------------------------------*/ | return non-zero if a
given input code has transitioned from off to
on since the last call | [
"return",
"non",
"-",
"zero",
"if",
"a",
"given",
"input",
"code",
"has",
"transitioned",
"from",
"off",
"to",
"on",
"since",
"the",
"last",
"call"
] | int input_code_pressed_once(running_machine *machine, input_code code)
{
input_code *code_pressed_memory = machine->input_data->code_pressed_memory;
int curvalue = input_code_pressed(machine, code);
int memnum, empty = -1;
for (memnum = 0; memnum < MAX_PRESSED_SWITCHES; memnum++)
{
if (code_pressed_memory[memnum] == code)
{
if (curvalue == 0)
code_pressed_memory[memnum] = INPUT_CODE_INVALID;
return 0;
}
if (empty == -1 && code_pressed_memory[memnum] == INPUT_CODE_INVALID)
empty = memnum;
}
if (curvalue == 0)
return 0;
assert(empty != -1);
if (empty != -1)
code_pressed_memory[empty] = code;
return 1;
} | [
"int",
"input_code_pressed_once",
"(",
"running_machine",
"*",
"machine",
",",
"input_code",
"code",
")",
"{",
"input_code",
"*",
"code_pressed_memory",
"=",
"machine",
"->",
"input_data",
"->",
"code_pressed_memory",
";",
"int",
"curvalue",
"=",
"input_code_pressed",
"(",
"machine",
",",
"code",
")",
";",
"int",
"memnum",
",",
"empty",
"=",
"-1",
";",
"for",
"(",
"memnum",
"=",
"0",
";",
"memnum",
"<",
"MAX_PRESSED_SWITCHES",
";",
"memnum",
"++",
")",
"{",
"if",
"(",
"code_pressed_memory",
"[",
"memnum",
"]",
"==",
"code",
")",
"{",
"if",
"(",
"curvalue",
"==",
"0",
")",
"code_pressed_memory",
"[",
"memnum",
"]",
"=",
"INPUT_CODE_INVALID",
";",
"return",
"0",
";",
"}",
"if",
"(",
"empty",
"==",
"-1",
"&&",
"code_pressed_memory",
"[",
"memnum",
"]",
"==",
"INPUT_CODE_INVALID",
")",
"empty",
"=",
"memnum",
";",
"}",
"if",
"(",
"curvalue",
"==",
"0",
")",
"return",
"0",
";",
"assert",
"(",
"empty",
"!=",
"-1",
")",
";",
"if",
"(",
"empty",
"!=",
"-1",
")",
"code_pressed_memory",
"[",
"empty",
"]",
"=",
"code",
";",
"return",
"1",
";",
"}"
] | input_code_pressed_once - return non-zero if a
given input code has transitioned from off to
on since the last call | [
"input_code_pressed_once",
"-",
"return",
"non",
"-",
"zero",
"if",
"a",
"given",
"input",
"code",
"has",
"transitioned",
"from",
"off",
"to",
"on",
"since",
"the",
"last",
"call"
] | [
"/* look for the code in the memory */",
"/* were we previous pressed on the last time through here? */",
"/* if no longer pressed, clear entry */",
"/* always return 0 */",
"/* remember the first empty entry */",
"/* if we get here, we were not previously pressed; if still not pressed, return 0 */",
"/* otherwise, add ourself to the memory and return 1 */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "code",
"type": "input_code"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "input_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
077f97a38e61438f8783700a521ce6cbea3ff584 | lofunz/mieme | Reloaded/tags/MAME4droid1.1.2&MAME4iOS 1.1Reloaded/src/emu/input.c | [
"Unlicense"
] | C | input_code_poll_keyboard_switches | input_code | input_code input_code_poll_keyboard_switches(running_machine *machine, int reset)
{
input_device_list *devlist = &machine->input_data->device_list[DEVICE_CLASS_KEYBOARD];
int devnum;
/* if resetting memory, do it now */
if (reset)
code_pressed_memory_reset(machine);
/* iterate over devices within each class */
for (devnum = 0; devnum < devlist->count; devnum++)
{
input_device *device = devlist->list[devnum];
input_item_id itemid;
/* iterate over items within each device */
for (itemid = ITEM_ID_FIRST_VALID; itemid <= device->maxitem; itemid++)
{
input_device_item *item = device->item[itemid];
if (item != NULL && item->itemclass == ITEM_CLASS_SWITCH)
{
input_code code = device_item_to_code(device, itemid);
if (input_code_pressed_once(machine, code))
return code;
}
}
}
/* if nothing, return an invalid code */
return INPUT_CODE_INVALID;
} | /*-------------------------------------------------
input_code_poll_keyboard_switches - poll for
any keyboard-specific input
-------------------------------------------------*/ | poll for
any keyboard-specific input | [
"poll",
"for",
"any",
"keyboard",
"-",
"specific",
"input"
] | input_code input_code_poll_keyboard_switches(running_machine *machine, int reset)
{
input_device_list *devlist = &machine->input_data->device_list[DEVICE_CLASS_KEYBOARD];
int devnum;
if (reset)
code_pressed_memory_reset(machine);
for (devnum = 0; devnum < devlist->count; devnum++)
{
input_device *device = devlist->list[devnum];
input_item_id itemid;
for (itemid = ITEM_ID_FIRST_VALID; itemid <= device->maxitem; itemid++)
{
input_device_item *item = device->item[itemid];
if (item != NULL && item->itemclass == ITEM_CLASS_SWITCH)
{
input_code code = device_item_to_code(device, itemid);
if (input_code_pressed_once(machine, code))
return code;
}
}
}
return INPUT_CODE_INVALID;
} | [
"input_code",
"input_code_poll_keyboard_switches",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"reset",
")",
"{",
"input_device_list",
"*",
"devlist",
"=",
"&",
"machine",
"->",
"input_data",
"->",
"device_list",
"[",
"DEVICE_CLASS_KEYBOARD",
"]",
";",
"int",
"devnum",
";",
"if",
"(",
"reset",
")",
"code_pressed_memory_reset",
"(",
"machine",
")",
";",
"for",
"(",
"devnum",
"=",
"0",
";",
"devnum",
"<",
"devlist",
"->",
"count",
";",
"devnum",
"++",
")",
"{",
"input_device",
"*",
"device",
"=",
"devlist",
"->",
"list",
"[",
"devnum",
"]",
";",
"input_item_id",
"itemid",
";",
"for",
"(",
"itemid",
"=",
"ITEM_ID_FIRST_VALID",
";",
"itemid",
"<=",
"device",
"->",
"maxitem",
";",
"itemid",
"++",
")",
"{",
"input_device_item",
"*",
"item",
"=",
"device",
"->",
"item",
"[",
"itemid",
"]",
";",
"if",
"(",
"item",
"!=",
"NULL",
"&&",
"item",
"->",
"itemclass",
"==",
"ITEM_CLASS_SWITCH",
")",
"{",
"input_code",
"code",
"=",
"device_item_to_code",
"(",
"device",
",",
"itemid",
")",
";",
"if",
"(",
"input_code_pressed_once",
"(",
"machine",
",",
"code",
")",
")",
"return",
"code",
";",
"}",
"}",
"}",
"return",
"INPUT_CODE_INVALID",
";",
"}"
] | input_code_poll_keyboard_switches - poll for
any keyboard-specific input | [
"input_code_poll_keyboard_switches",
"-",
"poll",
"for",
"any",
"keyboard",
"-",
"specific",
"input"
] | [
"/* if resetting memory, do it now */",
"/* iterate over devices within each class */",
"/* iterate over items within each device */",
"/* if nothing, return an invalid code */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "reset",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reset",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
077f97a38e61438f8783700a521ce6cbea3ff584 | lofunz/mieme | Reloaded/tags/MAME4droid1.1.2&MAME4iOS 1.1Reloaded/src/emu/input.c | [
"Unlicense"
] | C | input_code_check_axis | int | static int input_code_check_axis(running_machine *machine, input_device_item *item, input_code code)
{
INT32 curval, diff;
/* poll the current value */
curval = input_code_value(machine, code);
/* if we've already reported this one, don't bother */
if (item->memory == INVALID_AXIS_VALUE)
return FALSE;
/* ignore min/max for lightguns */
/* so the selection will not be affected by a gun going out of range */
if ((INPUT_CODE_DEVCLASS(code) == DEVICE_CLASS_LIGHTGUN)
&& (INPUT_CODE_ITEMID(code) == ITEM_ID_XAXIS || INPUT_CODE_ITEMID(code) == ITEM_ID_YAXIS)
&& (curval == INPUT_ABSOLUTE_MAX || curval == INPUT_ABSOLUTE_MIN))
return FALSE;
/* compute the diff against memory */
diff = curval - item->memory;
if (diff < 0)
diff = -diff;
/* for absolute axes, look for 25% of maximum */
if (item->itemclass == ITEM_CLASS_ABSOLUTE && diff > (INPUT_ABSOLUTE_MAX - INPUT_ABSOLUTE_MIN) / 4)
{
item->memory = INVALID_AXIS_VALUE;
return TRUE;
}
/* for relative axes, look for ~20 pixels movement */
if (item->itemclass == ITEM_CLASS_RELATIVE && diff > 20 * INPUT_RELATIVE_PER_PIXEL)
{
item->memory = INVALID_AXIS_VALUE;
return TRUE;
}
return FALSE;
} | /*-------------------------------------------------
input_code_check_axis - see if axis has
move far enough
-------------------------------------------------*/ | see if axis has
move far enough | [
"see",
"if",
"axis",
"has",
"move",
"far",
"enough"
] | static int input_code_check_axis(running_machine *machine, input_device_item *item, input_code code)
{
INT32 curval, diff;
curval = input_code_value(machine, code);
if (item->memory == INVALID_AXIS_VALUE)
return FALSE;
if ((INPUT_CODE_DEVCLASS(code) == DEVICE_CLASS_LIGHTGUN)
&& (INPUT_CODE_ITEMID(code) == ITEM_ID_XAXIS || INPUT_CODE_ITEMID(code) == ITEM_ID_YAXIS)
&& (curval == INPUT_ABSOLUTE_MAX || curval == INPUT_ABSOLUTE_MIN))
return FALSE;
diff = curval - item->memory;
if (diff < 0)
diff = -diff;
if (item->itemclass == ITEM_CLASS_ABSOLUTE && diff > (INPUT_ABSOLUTE_MAX - INPUT_ABSOLUTE_MIN) / 4)
{
item->memory = INVALID_AXIS_VALUE;
return TRUE;
}
if (item->itemclass == ITEM_CLASS_RELATIVE && diff > 20 * INPUT_RELATIVE_PER_PIXEL)
{
item->memory = INVALID_AXIS_VALUE;
return TRUE;
}
return FALSE;
} | [
"static",
"int",
"input_code_check_axis",
"(",
"running_machine",
"*",
"machine",
",",
"input_device_item",
"*",
"item",
",",
"input_code",
"code",
")",
"{",
"INT32",
"curval",
",",
"diff",
";",
"curval",
"=",
"input_code_value",
"(",
"machine",
",",
"code",
")",
";",
"if",
"(",
"item",
"->",
"memory",
"==",
"INVALID_AXIS_VALUE",
")",
"return",
"FALSE",
";",
"if",
"(",
"(",
"INPUT_CODE_DEVCLASS",
"(",
"code",
")",
"==",
"DEVICE_CLASS_LIGHTGUN",
")",
"&&",
"(",
"INPUT_CODE_ITEMID",
"(",
"code",
")",
"==",
"ITEM_ID_XAXIS",
"||",
"INPUT_CODE_ITEMID",
"(",
"code",
")",
"==",
"ITEM_ID_YAXIS",
")",
"&&",
"(",
"curval",
"==",
"INPUT_ABSOLUTE_MAX",
"||",
"curval",
"==",
"INPUT_ABSOLUTE_MIN",
")",
")",
"return",
"FALSE",
";",
"diff",
"=",
"curval",
"-",
"item",
"->",
"memory",
";",
"if",
"(",
"diff",
"<",
"0",
")",
"diff",
"=",
"-",
"diff",
";",
"if",
"(",
"item",
"->",
"itemclass",
"==",
"ITEM_CLASS_ABSOLUTE",
"&&",
"diff",
">",
"(",
"INPUT_ABSOLUTE_MAX",
"-",
"INPUT_ABSOLUTE_MIN",
")",
"/",
"4",
")",
"{",
"item",
"->",
"memory",
"=",
"INVALID_AXIS_VALUE",
";",
"return",
"TRUE",
";",
"}",
"if",
"(",
"item",
"->",
"itemclass",
"==",
"ITEM_CLASS_RELATIVE",
"&&",
"diff",
">",
"20",
"*",
"INPUT_RELATIVE_PER_PIXEL",
")",
"{",
"item",
"->",
"memory",
"=",
"INVALID_AXIS_VALUE",
";",
"return",
"TRUE",
";",
"}",
"return",
"FALSE",
";",
"}"
] | input_code_check_axis - see if axis has
move far enough | [
"input_code_check_axis",
"-",
"see",
"if",
"axis",
"has",
"move",
"far",
"enough"
] | [
"/* poll the current value */",
"/* if we've already reported this one, don't bother */",
"/* ignore min/max for lightguns */",
"/* so the selection will not be affected by a gun going out of range */",
"/* compute the diff against memory */",
"/* for absolute axes, look for 25% of maximum */",
"/* for relative axes, look for ~20 pixels movement */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "item",
"type": "input_device_item"
},
{
"param": "code",
"type": "input_code"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "item",
"type": "input_device_item",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "input_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
077f97a38e61438f8783700a521ce6cbea3ff584 | lofunz/mieme | Reloaded/tags/MAME4droid1.1.2&MAME4iOS 1.1Reloaded/src/emu/input.c | [
"Unlicense"
] | C | input_code_from_token | input_code | input_code input_code_from_token(running_machine *machine, const char *_token)
{
UINT32 devclass, itemid, devindex, modifier, standard;
UINT32 itemclass = ITEM_CLASS_INVALID;
input_code code = INPUT_CODE_INVALID;
astring token[6];
int numtokens, curtok;
/* copy the token and break it into pieces */
for (numtokens = 0; numtokens < ARRAY_LENGTH(token); )
{
/* make a token up to the next underscore */
char *score = (char *)strchr(_token, '_');
token[numtokens++].cpy(_token, (score == NULL) ? strlen(_token) : (score - _token));
/* if we hit the end, we're done, else advance our pointer */
if (score == NULL)
break;
_token = score + 1;
}
/* first token should be the devclass */
curtok = 0;
devclass = string_to_code(devclass_token_table, token[curtok++]);
if (devclass == ~0)
goto exit;
/* second token might be index; look for number */
devindex = 0;
if (numtokens > 2 && sscanf(token[curtok], "%d", &devindex) == 1)
{
curtok++;
devindex--;
}
if (curtok >= numtokens)
goto exit;
/* next token is the item ID */
itemid = string_to_code(itemid_token_table, token[curtok]);
standard = (itemid != ~0);
/* if we're a standard code, default the itemclass based on it */
if (standard)
itemclass = input_item_standard_class((input_device_class)devclass, (input_item_id)itemid);
/* otherwise, keep parsing */
else
{
input_device_list *device_list = (machine != NULL) ? machine->input_data->device_list : NULL;
input_device *device;
/* if this is an invalid device, we have nothing to look up */
if (device_list == NULL || devindex >= device_list[devclass].count)
goto exit;
device = device_list[devclass].list[devindex];
/* if not a standard code, look it up in the device specific codes */
for (itemid = ITEM_ID_FIRST_VALID; itemid <= device->maxitem; itemid++)
{
input_device_item *item = device->item[itemid];
if (item != NULL && token[curtok].cmp(item->token) == 0)
{
/* take the itemclass from the item */
itemclass = item->itemclass;
break;
}
}
/* bail on fail */
if (itemid > device->maxitem)
goto exit;
}
curtok++;
/* if we have another token, it is probably a modifier */
modifier = ITEM_MODIFIER_NONE;
if (curtok < numtokens)
{
modifier = string_to_code(modifier_token_table, token[curtok]);
if (modifier != ~0)
curtok++;
else
modifier = ITEM_MODIFIER_NONE;
}
/* if we have another token, it is the item class */
if (curtok < numtokens)
{
UINT32 temp = string_to_code(itemclass_token_table, token[curtok]);
if (temp != ~0)
{
curtok++;
itemclass = temp;
}
}
/* we should have consumed all tokens */
if (curtok != numtokens)
goto exit;
/* assemble the final code */
code = INPUT_CODE(devclass, devindex, itemclass, modifier, itemid);
exit:
return code;
} | /*-------------------------------------------------
input_code_from_token - extract an input
code from a token
-------------------------------------------------*/ | extract an input
code from a token | [
"extract",
"an",
"input",
"code",
"from",
"a",
"token"
] | input_code input_code_from_token(running_machine *machine, const char *_token)
{
UINT32 devclass, itemid, devindex, modifier, standard;
UINT32 itemclass = ITEM_CLASS_INVALID;
input_code code = INPUT_CODE_INVALID;
astring token[6];
int numtokens, curtok;
for (numtokens = 0; numtokens < ARRAY_LENGTH(token); )
{
char *score = (char *)strchr(_token, '_');
token[numtokens++].cpy(_token, (score == NULL) ? strlen(_token) : (score - _token));
if (score == NULL)
break;
_token = score + 1;
}
curtok = 0;
devclass = string_to_code(devclass_token_table, token[curtok++]);
if (devclass == ~0)
goto exit;
devindex = 0;
if (numtokens > 2 && sscanf(token[curtok], "%d", &devindex) == 1)
{
curtok++;
devindex--;
}
if (curtok >= numtokens)
goto exit;
itemid = string_to_code(itemid_token_table, token[curtok]);
standard = (itemid != ~0);
if (standard)
itemclass = input_item_standard_class((input_device_class)devclass, (input_item_id)itemid);
else
{
input_device_list *device_list = (machine != NULL) ? machine->input_data->device_list : NULL;
input_device *device;
if (device_list == NULL || devindex >= device_list[devclass].count)
goto exit;
device = device_list[devclass].list[devindex];
for (itemid = ITEM_ID_FIRST_VALID; itemid <= device->maxitem; itemid++)
{
input_device_item *item = device->item[itemid];
if (item != NULL && token[curtok].cmp(item->token) == 0)
{
itemclass = item->itemclass;
break;
}
}
if (itemid > device->maxitem)
goto exit;
}
curtok++;
modifier = ITEM_MODIFIER_NONE;
if (curtok < numtokens)
{
modifier = string_to_code(modifier_token_table, token[curtok]);
if (modifier != ~0)
curtok++;
else
modifier = ITEM_MODIFIER_NONE;
}
if (curtok < numtokens)
{
UINT32 temp = string_to_code(itemclass_token_table, token[curtok]);
if (temp != ~0)
{
curtok++;
itemclass = temp;
}
}
if (curtok != numtokens)
goto exit;
code = INPUT_CODE(devclass, devindex, itemclass, modifier, itemid);
exit:
return code;
} | [
"input_code",
"input_code_from_token",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"_token",
")",
"{",
"UINT32",
"devclass",
",",
"itemid",
",",
"devindex",
",",
"modifier",
",",
"standard",
";",
"UINT32",
"itemclass",
"=",
"ITEM_CLASS_INVALID",
";",
"input_code",
"code",
"=",
"INPUT_CODE_INVALID",
";",
"astring",
"token",
"[",
"6",
"]",
";",
"int",
"numtokens",
",",
"curtok",
";",
"for",
"(",
"numtokens",
"=",
"0",
";",
"numtokens",
"<",
"ARRAY_LENGTH",
"(",
"token",
")",
";",
")",
"{",
"char",
"*",
"score",
"=",
"(",
"char",
"*",
")",
"strchr",
"(",
"_token",
",",
"'",
"'",
")",
";",
"token",
"[",
"numtokens",
"++",
"]",
".",
"cpy",
"(",
"_token",
",",
"(",
"score",
"==",
"NULL",
")",
"?",
"strlen",
"(",
"_token",
")",
":",
"(",
"score",
"-",
"_token",
")",
")",
";",
"if",
"(",
"score",
"==",
"NULL",
")",
"break",
";",
"_token",
"=",
"score",
"+",
"1",
";",
"}",
"curtok",
"=",
"0",
";",
"devclass",
"=",
"string_to_code",
"(",
"devclass_token_table",
",",
"token",
"[",
"curtok",
"++",
"]",
")",
";",
"if",
"(",
"devclass",
"==",
"~",
"0",
")",
"goto",
"exit",
";",
"devindex",
"=",
"0",
";",
"if",
"(",
"numtokens",
">",
"2",
"&&",
"sscanf",
"(",
"token",
"[",
"curtok",
"]",
",",
"\"",
"\"",
",",
"&",
"devindex",
")",
"==",
"1",
")",
"{",
"curtok",
"++",
";",
"devindex",
"--",
";",
"}",
"if",
"(",
"curtok",
">=",
"numtokens",
")",
"goto",
"exit",
";",
"itemid",
"=",
"string_to_code",
"(",
"itemid_token_table",
",",
"token",
"[",
"curtok",
"]",
")",
";",
"standard",
"=",
"(",
"itemid",
"!=",
"~",
"0",
")",
";",
"if",
"(",
"standard",
")",
"itemclass",
"=",
"input_item_standard_class",
"(",
"(",
"input_device_class",
")",
"devclass",
",",
"(",
"input_item_id",
")",
"itemid",
")",
";",
"else",
"{",
"input_device_list",
"*",
"device_list",
"=",
"(",
"machine",
"!=",
"NULL",
")",
"?",
"machine",
"->",
"input_data",
"->",
"device_list",
":",
"NULL",
";",
"input_device",
"*",
"device",
";",
"if",
"(",
"device_list",
"==",
"NULL",
"||",
"devindex",
">=",
"device_list",
"[",
"devclass",
"]",
".",
"count",
")",
"goto",
"exit",
";",
"device",
"=",
"device_list",
"[",
"devclass",
"]",
".",
"list",
"[",
"devindex",
"]",
";",
"for",
"(",
"itemid",
"=",
"ITEM_ID_FIRST_VALID",
";",
"itemid",
"<=",
"device",
"->",
"maxitem",
";",
"itemid",
"++",
")",
"{",
"input_device_item",
"*",
"item",
"=",
"device",
"->",
"item",
"[",
"itemid",
"]",
";",
"if",
"(",
"item",
"!=",
"NULL",
"&&",
"token",
"[",
"curtok",
"]",
".",
"cmp",
"(",
"item",
"->",
"token",
")",
"==",
"0",
")",
"{",
"itemclass",
"=",
"item",
"->",
"itemclass",
";",
"break",
";",
"}",
"}",
"if",
"(",
"itemid",
">",
"device",
"->",
"maxitem",
")",
"goto",
"exit",
";",
"}",
"curtok",
"++",
";",
"modifier",
"=",
"ITEM_MODIFIER_NONE",
";",
"if",
"(",
"curtok",
"<",
"numtokens",
")",
"{",
"modifier",
"=",
"string_to_code",
"(",
"modifier_token_table",
",",
"token",
"[",
"curtok",
"]",
")",
";",
"if",
"(",
"modifier",
"!=",
"~",
"0",
")",
"curtok",
"++",
";",
"else",
"modifier",
"=",
"ITEM_MODIFIER_NONE",
";",
"}",
"if",
"(",
"curtok",
"<",
"numtokens",
")",
"{",
"UINT32",
"temp",
"=",
"string_to_code",
"(",
"itemclass_token_table",
",",
"token",
"[",
"curtok",
"]",
")",
";",
"if",
"(",
"temp",
"!=",
"~",
"0",
")",
"{",
"curtok",
"++",
";",
"itemclass",
"=",
"temp",
";",
"}",
"}",
"if",
"(",
"curtok",
"!=",
"numtokens",
")",
"goto",
"exit",
";",
"code",
"=",
"INPUT_CODE",
"(",
"devclass",
",",
"devindex",
",",
"itemclass",
",",
"modifier",
",",
"itemid",
")",
";",
"exit",
":",
"return",
"code",
";",
"}"
] | input_code_from_token - extract an input
code from a token | [
"input_code_from_token",
"-",
"extract",
"an",
"input",
"code",
"from",
"a",
"token"
] | [
"/* copy the token and break it into pieces */",
"/* make a token up to the next underscore */",
"/* if we hit the end, we're done, else advance our pointer */",
"/* first token should be the devclass */",
"/* second token might be index; look for number */",
"/* next token is the item ID */",
"/* if we're a standard code, default the itemclass based on it */",
"/* otherwise, keep parsing */",
"/* if this is an invalid device, we have nothing to look up */",
"/* if not a standard code, look it up in the device specific codes */",
"/* take the itemclass from the item */",
"/* bail on fail */",
"/* if we have another token, it is probably a modifier */",
"/* if we have another token, it is the item class */",
"/* we should have consumed all tokens */",
"/* assemble the final code */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "_token",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "_token",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
077f97a38e61438f8783700a521ce6cbea3ff584 | lofunz/mieme | Reloaded/tags/MAME4droid1.1.2&MAME4iOS 1.1Reloaded/src/emu/input.c | [
"Unlicense"
] | C | debug_global_input_code_pressed | INT32 | INT32 debug_global_input_code_pressed(input_code code)
{
if (!mame_is_valid_machine(stashed_machine))
return 0;
return input_code_pressed(stashed_machine, code);
} | /*-------------------------------------------------
debug_global_input_code_pressed - return TRUE
if the given input code has been pressed
-------------------------------------------------*/ | return TRUE
if the given input code has been pressed | [
"return",
"TRUE",
"if",
"the",
"given",
"input",
"code",
"has",
"been",
"pressed"
] | INT32 debug_global_input_code_pressed(input_code code)
{
if (!mame_is_valid_machine(stashed_machine))
return 0;
return input_code_pressed(stashed_machine, code);
} | [
"INT32",
"debug_global_input_code_pressed",
"(",
"input_code",
"code",
")",
"{",
"if",
"(",
"!",
"mame_is_valid_machine",
"(",
"stashed_machine",
")",
")",
"return",
"0",
";",
"return",
"input_code_pressed",
"(",
"stashed_machine",
",",
"code",
")",
";",
"}"
] | debug_global_input_code_pressed - return TRUE
if the given input code has been pressed | [
"debug_global_input_code_pressed",
"-",
"return",
"TRUE",
"if",
"the",
"given",
"input",
"code",
"has",
"been",
"pressed"
] | [] | [
{
"param": "code",
"type": "input_code"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "input_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
077f97a38e61438f8783700a521ce6cbea3ff584 | lofunz/mieme | Reloaded/tags/MAME4droid1.1.2&MAME4iOS 1.1Reloaded/src/emu/input.c | [
"Unlicense"
] | C | input_code_item | input_device_item | static input_device_item *input_code_item(running_machine *machine, input_code code)
{
input_device *device = input_code_device(machine, code);
input_item_id itemid;
/* if no device, we fail */
if (device == NULL)
return NULL;
/* if the devcode is in range, return a pointer to the item */
itemid = INPUT_CODE_ITEMID(code);
if (itemid < ARRAY_LENGTH(device->item))
return device->item[itemid];
/* otherwise fail with NULL */
return NULL;
} | /*-------------------------------------------------
input_code_item - get a pointer to the item
from the code
-------------------------------------------------*/ | get a pointer to the item
from the code | [
"get",
"a",
"pointer",
"to",
"the",
"item",
"from",
"the",
"code"
] | static input_device_item *input_code_item(running_machine *machine, input_code code)
{
input_device *device = input_code_device(machine, code);
input_item_id itemid;
if (device == NULL)
return NULL;
itemid = INPUT_CODE_ITEMID(code);
if (itemid < ARRAY_LENGTH(device->item))
return device->item[itemid];
return NULL;
} | [
"static",
"input_device_item",
"*",
"input_code_item",
"(",
"running_machine",
"*",
"machine",
",",
"input_code",
"code",
")",
"{",
"input_device",
"*",
"device",
"=",
"input_code_device",
"(",
"machine",
",",
"code",
")",
";",
"input_item_id",
"itemid",
";",
"if",
"(",
"device",
"==",
"NULL",
")",
"return",
"NULL",
";",
"itemid",
"=",
"INPUT_CODE_ITEMID",
"(",
"code",
")",
";",
"if",
"(",
"itemid",
"<",
"ARRAY_LENGTH",
"(",
"device",
"->",
"item",
")",
")",
"return",
"device",
"->",
"item",
"[",
"itemid",
"]",
";",
"return",
"NULL",
";",
"}"
] | input_code_item - get a pointer to the item
from the code | [
"input_code_item",
"-",
"get",
"a",
"pointer",
"to",
"the",
"item",
"from",
"the",
"code"
] | [
"/* if no device, we fail */",
"/* if the devcode is in range, return a pointer to the item */",
"/* otherwise fail with NULL */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "code",
"type": "input_code"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "input_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
077f97a38e61438f8783700a521ce6cbea3ff584 | lofunz/mieme | Reloaded/tags/MAME4droid1.1.2&MAME4iOS 1.1Reloaded/src/emu/input.c | [
"Unlicense"
] | C | convert_absolute_value | INT32 | static INT32 convert_absolute_value(running_machine *machine, input_code code, input_device_item *item)
{
input_private *state = machine->input_data;
/* make sure values are valid */
assert(item->current >= INPUT_ABSOLUTE_MIN && item->current <= INPUT_ABSOLUTE_MAX);
/* relative value conversion not supported */
if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_RELATIVE)
return 0;
/* if we want the absolute value, process it according to the modifier field */
else if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_ABSOLUTE)
{
input_item_modifier modifier = INPUT_CODE_MODIFIER(code);
INT32 result = apply_deadzone_and_saturation(machine, code, item->current);
/* if we're doing a lightgun reload hack, override the value */
if (state->lightgun_reload_button && item->devclass == DEVICE_CLASS_LIGHTGUN)
{
input_device_item *button2_item = state->device_list[item->devclass].list[item->devindex]->item[ITEM_ID_BUTTON2];
if (button2_item != NULL)
{
/* if it is pressed, return (min,max) */
input_item_update_value(machine, button2_item);
if (button2_item->current)
result = (INPUT_CODE_ITEMID(code) == ITEM_ID_XAXIS) ? INPUT_ABSOLUTE_MIN : INPUT_ABSOLUTE_MAX;
}
}
/* standard axis: apply deadzone and saturation */
if (modifier == ITEM_MODIFIER_NONE)
return result;
/* positive/negative: scale to full axis */
else if (modifier == ITEM_MODIFIER_POS)
return MAX(result, 0) * 2 + INPUT_ABSOLUTE_MIN;
else if (modifier == ITEM_MODIFIER_NEG)
return MAX(-result, 0) * 2 + INPUT_ABSOLUTE_MIN;
}
/* if we want a switch value, process it according to the modifier field */
else if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_SWITCH)
{
input_item_modifier modifier = INPUT_CODE_MODIFIER(code);
/* left/right/up/down: if this is a joystick, fetch the paired X/Y axis values and convert */
if (modifier >= ITEM_MODIFIER_LEFT && modifier <= ITEM_MODIFIER_DOWN && item->devclass == DEVICE_CLASS_JOYSTICK)
{
input_device *device = state->device_list[item->devclass].list[item->devindex];
input_device_item *xaxis_item = device->item[ITEM_ID_XAXIS];
input_device_item *yaxis_item = device->item[ITEM_ID_YAXIS];
if (xaxis_item != NULL && yaxis_item != NULL)
{
INT32 xaxisval, yaxisval;
UINT8 mapval;
/* determine which item we didn't update, and update it */
assert(item == xaxis_item || item == yaxis_item);
input_item_update_value(machine, (item == xaxis_item) ? yaxis_item : xaxis_item);
/* now map the X and Y axes to a 9x9 grid */
xaxisval = ((xaxis_item->current - INPUT_ABSOLUTE_MIN) * 9) / (INPUT_ABSOLUTE_MAX - INPUT_ABSOLUTE_MIN + 1);
yaxisval = ((yaxis_item->current - INPUT_ABSOLUTE_MIN) * 9) / (INPUT_ABSOLUTE_MAX - INPUT_ABSOLUTE_MIN + 1);
mapval = device->joymap.map[yaxisval][xaxisval];
/* handle stickiness */
if (mapval == JOYSTICK_MAP_STICKY)
mapval = device->lastmap;
else
device->lastmap = mapval;
/* return based on whether the appropriate bit is set */
return (mapval >> (modifier - ITEM_MODIFIER_LEFT)) & 1;
}
}
/* positive/negative: TRUE if past the deadzone in either direction */
if (modifier == ITEM_MODIFIER_POS || modifier == ITEM_MODIFIER_RIGHT || modifier == ITEM_MODIFIER_DOWN)
return (apply_deadzone_and_saturation(machine, code, item->current) > 0);
else if (modifier == ITEM_MODIFIER_NEG || modifier == ITEM_MODIFIER_LEFT || modifier == ITEM_MODIFIER_UP)
return (apply_deadzone_and_saturation(machine, code, item->current) < 0);
}
return 0;
} | /*-------------------------------------------------
convert_absolute_value - convert an absolute
value into the class specified by code
-------------------------------------------------*/ | convert an absolute
value into the class specified by code | [
"convert",
"an",
"absolute",
"value",
"into",
"the",
"class",
"specified",
"by",
"code"
] | static INT32 convert_absolute_value(running_machine *machine, input_code code, input_device_item *item)
{
input_private *state = machine->input_data;
assert(item->current >= INPUT_ABSOLUTE_MIN && item->current <= INPUT_ABSOLUTE_MAX);
if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_RELATIVE)
return 0;
else if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_ABSOLUTE)
{
input_item_modifier modifier = INPUT_CODE_MODIFIER(code);
INT32 result = apply_deadzone_and_saturation(machine, code, item->current);
if (state->lightgun_reload_button && item->devclass == DEVICE_CLASS_LIGHTGUN)
{
input_device_item *button2_item = state->device_list[item->devclass].list[item->devindex]->item[ITEM_ID_BUTTON2];
if (button2_item != NULL)
{
input_item_update_value(machine, button2_item);
if (button2_item->current)
result = (INPUT_CODE_ITEMID(code) == ITEM_ID_XAXIS) ? INPUT_ABSOLUTE_MIN : INPUT_ABSOLUTE_MAX;
}
}
if (modifier == ITEM_MODIFIER_NONE)
return result;
else if (modifier == ITEM_MODIFIER_POS)
return MAX(result, 0) * 2 + INPUT_ABSOLUTE_MIN;
else if (modifier == ITEM_MODIFIER_NEG)
return MAX(-result, 0) * 2 + INPUT_ABSOLUTE_MIN;
}
else if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_SWITCH)
{
input_item_modifier modifier = INPUT_CODE_MODIFIER(code);
if (modifier >= ITEM_MODIFIER_LEFT && modifier <= ITEM_MODIFIER_DOWN && item->devclass == DEVICE_CLASS_JOYSTICK)
{
input_device *device = state->device_list[item->devclass].list[item->devindex];
input_device_item *xaxis_item = device->item[ITEM_ID_XAXIS];
input_device_item *yaxis_item = device->item[ITEM_ID_YAXIS];
if (xaxis_item != NULL && yaxis_item != NULL)
{
INT32 xaxisval, yaxisval;
UINT8 mapval;
assert(item == xaxis_item || item == yaxis_item);
input_item_update_value(machine, (item == xaxis_item) ? yaxis_item : xaxis_item);
xaxisval = ((xaxis_item->current - INPUT_ABSOLUTE_MIN) * 9) / (INPUT_ABSOLUTE_MAX - INPUT_ABSOLUTE_MIN + 1);
yaxisval = ((yaxis_item->current - INPUT_ABSOLUTE_MIN) * 9) / (INPUT_ABSOLUTE_MAX - INPUT_ABSOLUTE_MIN + 1);
mapval = device->joymap.map[yaxisval][xaxisval];
if (mapval == JOYSTICK_MAP_STICKY)
mapval = device->lastmap;
else
device->lastmap = mapval;
return (mapval >> (modifier - ITEM_MODIFIER_LEFT)) & 1;
}
}
if (modifier == ITEM_MODIFIER_POS || modifier == ITEM_MODIFIER_RIGHT || modifier == ITEM_MODIFIER_DOWN)
return (apply_deadzone_and_saturation(machine, code, item->current) > 0);
else if (modifier == ITEM_MODIFIER_NEG || modifier == ITEM_MODIFIER_LEFT || modifier == ITEM_MODIFIER_UP)
return (apply_deadzone_and_saturation(machine, code, item->current) < 0);
}
return 0;
} | [
"static",
"INT32",
"convert_absolute_value",
"(",
"running_machine",
"*",
"machine",
",",
"input_code",
"code",
",",
"input_device_item",
"*",
"item",
")",
"{",
"input_private",
"*",
"state",
"=",
"machine",
"->",
"input_data",
";",
"assert",
"(",
"item",
"->",
"current",
">=",
"INPUT_ABSOLUTE_MIN",
"&&",
"item",
"->",
"current",
"<=",
"INPUT_ABSOLUTE_MAX",
")",
";",
"if",
"(",
"INPUT_CODE_ITEMCLASS",
"(",
"code",
")",
"==",
"ITEM_CLASS_RELATIVE",
")",
"return",
"0",
";",
"else",
"if",
"(",
"INPUT_CODE_ITEMCLASS",
"(",
"code",
")",
"==",
"ITEM_CLASS_ABSOLUTE",
")",
"{",
"input_item_modifier",
"modifier",
"=",
"INPUT_CODE_MODIFIER",
"(",
"code",
")",
";",
"INT32",
"result",
"=",
"apply_deadzone_and_saturation",
"(",
"machine",
",",
"code",
",",
"item",
"->",
"current",
")",
";",
"if",
"(",
"state",
"->",
"lightgun_reload_button",
"&&",
"item",
"->",
"devclass",
"==",
"DEVICE_CLASS_LIGHTGUN",
")",
"{",
"input_device_item",
"*",
"button2_item",
"=",
"state",
"->",
"device_list",
"[",
"item",
"->",
"devclass",
"]",
".",
"list",
"[",
"item",
"->",
"devindex",
"]",
"->",
"item",
"[",
"ITEM_ID_BUTTON2",
"]",
";",
"if",
"(",
"button2_item",
"!=",
"NULL",
")",
"{",
"input_item_update_value",
"(",
"machine",
",",
"button2_item",
")",
";",
"if",
"(",
"button2_item",
"->",
"current",
")",
"result",
"=",
"(",
"INPUT_CODE_ITEMID",
"(",
"code",
")",
"==",
"ITEM_ID_XAXIS",
")",
"?",
"INPUT_ABSOLUTE_MIN",
":",
"INPUT_ABSOLUTE_MAX",
";",
"}",
"}",
"if",
"(",
"modifier",
"==",
"ITEM_MODIFIER_NONE",
")",
"return",
"result",
";",
"else",
"if",
"(",
"modifier",
"==",
"ITEM_MODIFIER_POS",
")",
"return",
"MAX",
"(",
"result",
",",
"0",
")",
"*",
"2",
"+",
"INPUT_ABSOLUTE_MIN",
";",
"else",
"if",
"(",
"modifier",
"==",
"ITEM_MODIFIER_NEG",
")",
"return",
"MAX",
"(",
"-",
"result",
",",
"0",
")",
"*",
"2",
"+",
"INPUT_ABSOLUTE_MIN",
";",
"}",
"else",
"if",
"(",
"INPUT_CODE_ITEMCLASS",
"(",
"code",
")",
"==",
"ITEM_CLASS_SWITCH",
")",
"{",
"input_item_modifier",
"modifier",
"=",
"INPUT_CODE_MODIFIER",
"(",
"code",
")",
";",
"if",
"(",
"modifier",
">=",
"ITEM_MODIFIER_LEFT",
"&&",
"modifier",
"<=",
"ITEM_MODIFIER_DOWN",
"&&",
"item",
"->",
"devclass",
"==",
"DEVICE_CLASS_JOYSTICK",
")",
"{",
"input_device",
"*",
"device",
"=",
"state",
"->",
"device_list",
"[",
"item",
"->",
"devclass",
"]",
".",
"list",
"[",
"item",
"->",
"devindex",
"]",
";",
"input_device_item",
"*",
"xaxis_item",
"=",
"device",
"->",
"item",
"[",
"ITEM_ID_XAXIS",
"]",
";",
"input_device_item",
"*",
"yaxis_item",
"=",
"device",
"->",
"item",
"[",
"ITEM_ID_YAXIS",
"]",
";",
"if",
"(",
"xaxis_item",
"!=",
"NULL",
"&&",
"yaxis_item",
"!=",
"NULL",
")",
"{",
"INT32",
"xaxisval",
",",
"yaxisval",
";",
"UINT8",
"mapval",
";",
"assert",
"(",
"item",
"==",
"xaxis_item",
"||",
"item",
"==",
"yaxis_item",
")",
";",
"input_item_update_value",
"(",
"machine",
",",
"(",
"item",
"==",
"xaxis_item",
")",
"?",
"yaxis_item",
":",
"xaxis_item",
")",
";",
"xaxisval",
"=",
"(",
"(",
"xaxis_item",
"->",
"current",
"-",
"INPUT_ABSOLUTE_MIN",
")",
"*",
"9",
")",
"/",
"(",
"INPUT_ABSOLUTE_MAX",
"-",
"INPUT_ABSOLUTE_MIN",
"+",
"1",
")",
";",
"yaxisval",
"=",
"(",
"(",
"yaxis_item",
"->",
"current",
"-",
"INPUT_ABSOLUTE_MIN",
")",
"*",
"9",
")",
"/",
"(",
"INPUT_ABSOLUTE_MAX",
"-",
"INPUT_ABSOLUTE_MIN",
"+",
"1",
")",
";",
"mapval",
"=",
"device",
"->",
"joymap",
".",
"map",
"[",
"yaxisval",
"]",
"[",
"xaxisval",
"]",
";",
"if",
"(",
"mapval",
"==",
"JOYSTICK_MAP_STICKY",
")",
"mapval",
"=",
"device",
"->",
"lastmap",
";",
"else",
"device",
"->",
"lastmap",
"=",
"mapval",
";",
"return",
"(",
"mapval",
">>",
"(",
"modifier",
"-",
"ITEM_MODIFIER_LEFT",
")",
")",
"&",
"1",
";",
"}",
"}",
"if",
"(",
"modifier",
"==",
"ITEM_MODIFIER_POS",
"||",
"modifier",
"==",
"ITEM_MODIFIER_RIGHT",
"||",
"modifier",
"==",
"ITEM_MODIFIER_DOWN",
")",
"return",
"(",
"apply_deadzone_and_saturation",
"(",
"machine",
",",
"code",
",",
"item",
"->",
"current",
")",
">",
"0",
")",
";",
"else",
"if",
"(",
"modifier",
"==",
"ITEM_MODIFIER_NEG",
"||",
"modifier",
"==",
"ITEM_MODIFIER_LEFT",
"||",
"modifier",
"==",
"ITEM_MODIFIER_UP",
")",
"return",
"(",
"apply_deadzone_and_saturation",
"(",
"machine",
",",
"code",
",",
"item",
"->",
"current",
")",
"<",
"0",
")",
";",
"}",
"return",
"0",
";",
"}"
] | convert_absolute_value - convert an absolute
value into the class specified by code | [
"convert_absolute_value",
"-",
"convert",
"an",
"absolute",
"value",
"into",
"the",
"class",
"specified",
"by",
"code"
] | [
"/* make sure values are valid */",
"/* relative value conversion not supported */",
"/* if we want the absolute value, process it according to the modifier field */",
"/* if we're doing a lightgun reload hack, override the value */",
"/* if it is pressed, return (min,max) */",
"/* standard axis: apply deadzone and saturation */",
"/* positive/negative: scale to full axis */",
"/* if we want a switch value, process it according to the modifier field */",
"/* left/right/up/down: if this is a joystick, fetch the paired X/Y axis values and convert */",
"/* determine which item we didn't update, and update it */",
"/* now map the X and Y axes to a 9x9 grid */",
"/* handle stickiness */",
"/* return based on whether the appropriate bit is set */",
"/* positive/negative: TRUE if past the deadzone in either direction */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "code",
"type": "input_code"
},
{
"param": "item",
"type": "input_device_item"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "input_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "item",
"type": "input_device_item",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
077f97a38e61438f8783700a521ce6cbea3ff584 | lofunz/mieme | Reloaded/tags/MAME4droid1.1.2&MAME4iOS 1.1Reloaded/src/emu/input.c | [
"Unlicense"
] | C | convert_relative_value | INT32 | static INT32 convert_relative_value(input_code code, input_device_item *item)
{
/* if we want relative values, take it as-is */
if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_RELATIVE)
return item->current;
/* absolute value conversion not supported */
else if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_ABSOLUTE)
return 0;
/* if we want a switch value, process it according to the modifier field */
else if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_SWITCH)
{
input_item_modifier modifier = INPUT_CODE_MODIFIER(code);
/* positive/negative: TRUE if non-zero in either direction */
if (modifier == ITEM_MODIFIER_POS || modifier == ITEM_MODIFIER_RIGHT || modifier == ITEM_MODIFIER_DOWN)
return (item->current > 0);
else if (modifier == ITEM_MODIFIER_NEG || modifier == ITEM_MODIFIER_LEFT || modifier == ITEM_MODIFIER_UP)
return (item->current < 0);
}
return 0;
} | /*-------------------------------------------------
convert_relative_value - convert a relative
value into the class specified by code
-------------------------------------------------*/ | convert a relative
value into the class specified by code | [
"convert",
"a",
"relative",
"value",
"into",
"the",
"class",
"specified",
"by",
"code"
] | static INT32 convert_relative_value(input_code code, input_device_item *item)
{
if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_RELATIVE)
return item->current;
else if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_ABSOLUTE)
return 0;
else if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_SWITCH)
{
input_item_modifier modifier = INPUT_CODE_MODIFIER(code);
if (modifier == ITEM_MODIFIER_POS || modifier == ITEM_MODIFIER_RIGHT || modifier == ITEM_MODIFIER_DOWN)
return (item->current > 0);
else if (modifier == ITEM_MODIFIER_NEG || modifier == ITEM_MODIFIER_LEFT || modifier == ITEM_MODIFIER_UP)
return (item->current < 0);
}
return 0;
} | [
"static",
"INT32",
"convert_relative_value",
"(",
"input_code",
"code",
",",
"input_device_item",
"*",
"item",
")",
"{",
"if",
"(",
"INPUT_CODE_ITEMCLASS",
"(",
"code",
")",
"==",
"ITEM_CLASS_RELATIVE",
")",
"return",
"item",
"->",
"current",
";",
"else",
"if",
"(",
"INPUT_CODE_ITEMCLASS",
"(",
"code",
")",
"==",
"ITEM_CLASS_ABSOLUTE",
")",
"return",
"0",
";",
"else",
"if",
"(",
"INPUT_CODE_ITEMCLASS",
"(",
"code",
")",
"==",
"ITEM_CLASS_SWITCH",
")",
"{",
"input_item_modifier",
"modifier",
"=",
"INPUT_CODE_MODIFIER",
"(",
"code",
")",
";",
"if",
"(",
"modifier",
"==",
"ITEM_MODIFIER_POS",
"||",
"modifier",
"==",
"ITEM_MODIFIER_RIGHT",
"||",
"modifier",
"==",
"ITEM_MODIFIER_DOWN",
")",
"return",
"(",
"item",
"->",
"current",
">",
"0",
")",
";",
"else",
"if",
"(",
"modifier",
"==",
"ITEM_MODIFIER_NEG",
"||",
"modifier",
"==",
"ITEM_MODIFIER_LEFT",
"||",
"modifier",
"==",
"ITEM_MODIFIER_UP",
")",
"return",
"(",
"item",
"->",
"current",
"<",
"0",
")",
";",
"}",
"return",
"0",
";",
"}"
] | convert_relative_value - convert a relative
value into the class specified by code | [
"convert_relative_value",
"-",
"convert",
"a",
"relative",
"value",
"into",
"the",
"class",
"specified",
"by",
"code"
] | [
"/* if we want relative values, take it as-is */",
"/* absolute value conversion not supported */",
"/* if we want a switch value, process it according to the modifier field */",
"/* positive/negative: TRUE if non-zero in either direction */"
] | [
{
"param": "code",
"type": "input_code"
},
{
"param": "item",
"type": "input_device_item"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "input_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "item",
"type": "input_device_item",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
077f97a38e61438f8783700a521ce6cbea3ff584 | lofunz/mieme | Reloaded/tags/MAME4droid1.1.2&MAME4iOS 1.1Reloaded/src/emu/input.c | [
"Unlicense"
] | C | convert_switch_value | INT32 | static INT32 convert_switch_value(running_machine *machine, input_code code, input_device_item *item)
{
input_private *state = machine->input_data;
/* only a switch is supported */
if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_SWITCH)
{
/* if we're doing a lightgun reload hack, button 1 and 2 operate differently */
if (state->lightgun_reload_button && item->devclass == DEVICE_CLASS_LIGHTGUN)
{
/* button 1 is pressed if either button 1 or 2 are active */
if (INPUT_CODE_ITEMID(code) == ITEM_ID_BUTTON1)
{
input_device_item *button2_item = state->device_list[item->devclass].list[item->devindex]->item[ITEM_ID_BUTTON2];
if (button2_item != NULL)
{
input_item_update_value(machine, button2_item);
return item->current | button2_item->current;
}
}
/* button 2 is never officially pressed */
if (INPUT_CODE_ITEMID(code) == ITEM_ID_BUTTON2)
return 0;
}
/* steadykey for keyboards */
if (state->steadykey_enabled && item->devclass == DEVICE_CLASS_KEYBOARD)
return item->steadykey;
/* everything else is just the current value as-is */
return item->current;
}
return 0;
} | /*-------------------------------------------------
convert_switch_value - convert a switch
value into the class specified by code
-------------------------------------------------*/ | convert a switch
value into the class specified by code | [
"convert",
"a",
"switch",
"value",
"into",
"the",
"class",
"specified",
"by",
"code"
] | static INT32 convert_switch_value(running_machine *machine, input_code code, input_device_item *item)
{
input_private *state = machine->input_data;
if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_SWITCH)
{
if (state->lightgun_reload_button && item->devclass == DEVICE_CLASS_LIGHTGUN)
{
if (INPUT_CODE_ITEMID(code) == ITEM_ID_BUTTON1)
{
input_device_item *button2_item = state->device_list[item->devclass].list[item->devindex]->item[ITEM_ID_BUTTON2];
if (button2_item != NULL)
{
input_item_update_value(machine, button2_item);
return item->current | button2_item->current;
}
}
if (INPUT_CODE_ITEMID(code) == ITEM_ID_BUTTON2)
return 0;
}
if (state->steadykey_enabled && item->devclass == DEVICE_CLASS_KEYBOARD)
return item->steadykey;
return item->current;
}
return 0;
} | [
"static",
"INT32",
"convert_switch_value",
"(",
"running_machine",
"*",
"machine",
",",
"input_code",
"code",
",",
"input_device_item",
"*",
"item",
")",
"{",
"input_private",
"*",
"state",
"=",
"machine",
"->",
"input_data",
";",
"if",
"(",
"INPUT_CODE_ITEMCLASS",
"(",
"code",
")",
"==",
"ITEM_CLASS_SWITCH",
")",
"{",
"if",
"(",
"state",
"->",
"lightgun_reload_button",
"&&",
"item",
"->",
"devclass",
"==",
"DEVICE_CLASS_LIGHTGUN",
")",
"{",
"if",
"(",
"INPUT_CODE_ITEMID",
"(",
"code",
")",
"==",
"ITEM_ID_BUTTON1",
")",
"{",
"input_device_item",
"*",
"button2_item",
"=",
"state",
"->",
"device_list",
"[",
"item",
"->",
"devclass",
"]",
".",
"list",
"[",
"item",
"->",
"devindex",
"]",
"->",
"item",
"[",
"ITEM_ID_BUTTON2",
"]",
";",
"if",
"(",
"button2_item",
"!=",
"NULL",
")",
"{",
"input_item_update_value",
"(",
"machine",
",",
"button2_item",
")",
";",
"return",
"item",
"->",
"current",
"|",
"button2_item",
"->",
"current",
";",
"}",
"}",
"if",
"(",
"INPUT_CODE_ITEMID",
"(",
"code",
")",
"==",
"ITEM_ID_BUTTON2",
")",
"return",
"0",
";",
"}",
"if",
"(",
"state",
"->",
"steadykey_enabled",
"&&",
"item",
"->",
"devclass",
"==",
"DEVICE_CLASS_KEYBOARD",
")",
"return",
"item",
"->",
"steadykey",
";",
"return",
"item",
"->",
"current",
";",
"}",
"return",
"0",
";",
"}"
] | convert_switch_value - convert a switch
value into the class specified by code | [
"convert_switch_value",
"-",
"convert",
"a",
"switch",
"value",
"into",
"the",
"class",
"specified",
"by",
"code"
] | [
"/* only a switch is supported */",
"/* if we're doing a lightgun reload hack, button 1 and 2 operate differently */",
"/* button 1 is pressed if either button 1 or 2 are active */",
"/* button 2 is never officially pressed */",
"/* steadykey for keyboards */",
"/* everything else is just the current value as-is */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "code",
"type": "input_code"
},
{
"param": "item",
"type": "input_device_item"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "input_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "item",
"type": "input_device_item",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
077f97a38e61438f8783700a521ce6cbea3ff584 | lofunz/mieme | Reloaded/tags/MAME4droid1.1.2&MAME4iOS 1.1Reloaded/src/emu/input.c | [
"Unlicense"
] | C | apply_deadzone_and_saturation | INT32 | static INT32 apply_deadzone_and_saturation(running_machine *machine, input_code code, INT32 result)
{
input_private *state = machine->input_data;
int negative = FALSE;
/* ignore if not a joystick */
if (INPUT_CODE_DEVCLASS(code) != DEVICE_CLASS_JOYSTICK)
return result;
/* properties are symmetric */
if (result < 0)
{
negative = TRUE;
result = -result;
}
/* if in the deadzone, return 0 */
if (result < state->joystick_deadzone)
result = 0;
/* if saturated, return the max */
else if (result > state->joystick_saturation)
result = INPUT_ABSOLUTE_MAX;
/* otherwise, scale */
else
result = (INT64)(result - state->joystick_deadzone) * (INT64)INPUT_ABSOLUTE_MAX / (INT64)(state->joystick_saturation - state->joystick_deadzone);
/* apply sign and return */
return negative ? -result : result;
} | /*-------------------------------------------------
apply_deadzone_and_saturation - apply global
deadzone and saturation parameters to an
absolute value
-------------------------------------------------*/ | apply global
deadzone and saturation parameters to an
absolute value | [
"apply",
"global",
"deadzone",
"and",
"saturation",
"parameters",
"to",
"an",
"absolute",
"value"
] | static INT32 apply_deadzone_and_saturation(running_machine *machine, input_code code, INT32 result)
{
input_private *state = machine->input_data;
int negative = FALSE;
if (INPUT_CODE_DEVCLASS(code) != DEVICE_CLASS_JOYSTICK)
return result;
if (result < 0)
{
negative = TRUE;
result = -result;
}
if (result < state->joystick_deadzone)
result = 0;
else if (result > state->joystick_saturation)
result = INPUT_ABSOLUTE_MAX;
else
result = (INT64)(result - state->joystick_deadzone) * (INT64)INPUT_ABSOLUTE_MAX / (INT64)(state->joystick_saturation - state->joystick_deadzone);
return negative ? -result : result;
} | [
"static",
"INT32",
"apply_deadzone_and_saturation",
"(",
"running_machine",
"*",
"machine",
",",
"input_code",
"code",
",",
"INT32",
"result",
")",
"{",
"input_private",
"*",
"state",
"=",
"machine",
"->",
"input_data",
";",
"int",
"negative",
"=",
"FALSE",
";",
"if",
"(",
"INPUT_CODE_DEVCLASS",
"(",
"code",
")",
"!=",
"DEVICE_CLASS_JOYSTICK",
")",
"return",
"result",
";",
"if",
"(",
"result",
"<",
"0",
")",
"{",
"negative",
"=",
"TRUE",
";",
"result",
"=",
"-",
"result",
";",
"}",
"if",
"(",
"result",
"<",
"state",
"->",
"joystick_deadzone",
")",
"result",
"=",
"0",
";",
"else",
"if",
"(",
"result",
">",
"state",
"->",
"joystick_saturation",
")",
"result",
"=",
"INPUT_ABSOLUTE_MAX",
";",
"else",
"result",
"=",
"(",
"INT64",
")",
"(",
"result",
"-",
"state",
"->",
"joystick_deadzone",
")",
"*",
"(",
"INT64",
")",
"INPUT_ABSOLUTE_MAX",
"/",
"(",
"INT64",
")",
"(",
"state",
"->",
"joystick_saturation",
"-",
"state",
"->",
"joystick_deadzone",
")",
";",
"return",
"negative",
"?",
"-",
"result",
":",
"result",
";",
"}"
] | apply_deadzone_and_saturation - apply global
deadzone and saturation parameters to an
absolute value | [
"apply_deadzone_and_saturation",
"-",
"apply",
"global",
"deadzone",
"and",
"saturation",
"parameters",
"to",
"an",
"absolute",
"value"
] | [
"/* ignore if not a joystick */",
"/* properties are symmetric */",
"/* if in the deadzone, return 0 */",
"/* if saturated, return the max */",
"/* otherwise, scale */",
"/* apply sign and return */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "code",
"type": "input_code"
},
{
"param": "result",
"type": "INT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "input_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "result",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
077f97a38e61438f8783700a521ce6cbea3ff584 | lofunz/mieme | Reloaded/tags/MAME4droid1.1.2&MAME4iOS 1.1Reloaded/src/emu/input.c | [
"Unlicense"
] | C | joystick_map_parse | int | static int joystick_map_parse(const char *mapstring, joystick_map *map)
{
int rownum, colnum;
/* iterate over rows */
for (rownum = 0; rownum < 9; rownum++)
{
/* if we're done, copy from another row */
if (*mapstring == 0 || *mapstring == '.')
{
int symmetric = (rownum >= 5 && *mapstring == 0);
const UINT8 *srcrow = &map->map[symmetric ? (8 - rownum) : (rownum - 1)][0];
/* if this is row 0, we don't have a source row -- invalid */
if (rownum == 0)
return FALSE;
/* copy from the srcrow, applying up/down symmetry if in the bottom half */
for (colnum = 0; colnum < 9; colnum++)
{
UINT8 val = srcrow[colnum];
if (symmetric)
val = (val & (JOYSTICK_MAP_LEFT | JOYSTICK_MAP_RIGHT)) | ((val & JOYSTICK_MAP_UP) << 1) | ((val & JOYSTICK_MAP_DOWN) >> 1);
map->map[rownum][colnum] = val;
}
}
/* otherwise, parse this column */
else
{
for (colnum = 0; colnum < 9; colnum++)
{
/* if we're at the end of row, copy previous to the middle, then apply left/right symmetry */
if (colnum > 0 && (*mapstring == 0 || *mapstring == '.'))
{
int symmetric = (colnum >= 5);
UINT8 val = map->map[rownum][symmetric ? (8 - colnum) : (colnum - 1)];
if (symmetric)
val = (val & (JOYSTICK_MAP_UP | JOYSTICK_MAP_DOWN)) | ((val & JOYSTICK_MAP_LEFT) << 1) | ((val & JOYSTICK_MAP_RIGHT) >> 1);
map->map[rownum][colnum] = val;
}
/* otherwise, convert the character to its value */
else
{
static const UINT8 charmap[] =
{
JOYSTICK_MAP_UP | JOYSTICK_MAP_LEFT,
JOYSTICK_MAP_UP,
JOYSTICK_MAP_UP | JOYSTICK_MAP_RIGHT,
JOYSTICK_MAP_LEFT,
JOYSTICK_MAP_NEUTRAL,
JOYSTICK_MAP_RIGHT,
JOYSTICK_MAP_DOWN | JOYSTICK_MAP_LEFT,
JOYSTICK_MAP_DOWN,
JOYSTICK_MAP_DOWN | JOYSTICK_MAP_RIGHT,
JOYSTICK_MAP_STICKY
};
static const char validchars[] = "789456123s";
const char *ptr = strchr(validchars, *mapstring++);
/* invalid characters exit immediately */
if (ptr == NULL)
return FALSE;
map->map[rownum][colnum] = charmap[ptr - validchars];
}
}
}
/* if we ended with a period, advance to the next row */
if (*mapstring == '.')
mapstring++;
}
return TRUE;
} | /*-------------------------------------------------
joystick_map_parse - parse a string into
a joystick map
-------------------------------------------------*/ | parse a string into
a joystick map | [
"parse",
"a",
"string",
"into",
"a",
"joystick",
"map"
] | static int joystick_map_parse(const char *mapstring, joystick_map *map)
{
int rownum, colnum;
for (rownum = 0; rownum < 9; rownum++)
{
if (*mapstring == 0 || *mapstring == '.')
{
int symmetric = (rownum >= 5 && *mapstring == 0);
const UINT8 *srcrow = &map->map[symmetric ? (8 - rownum) : (rownum - 1)][0];
if (rownum == 0)
return FALSE;
for (colnum = 0; colnum < 9; colnum++)
{
UINT8 val = srcrow[colnum];
if (symmetric)
val = (val & (JOYSTICK_MAP_LEFT | JOYSTICK_MAP_RIGHT)) | ((val & JOYSTICK_MAP_UP) << 1) | ((val & JOYSTICK_MAP_DOWN) >> 1);
map->map[rownum][colnum] = val;
}
}
else
{
for (colnum = 0; colnum < 9; colnum++)
{
if (colnum > 0 && (*mapstring == 0 || *mapstring == '.'))
{
int symmetric = (colnum >= 5);
UINT8 val = map->map[rownum][symmetric ? (8 - colnum) : (colnum - 1)];
if (symmetric)
val = (val & (JOYSTICK_MAP_UP | JOYSTICK_MAP_DOWN)) | ((val & JOYSTICK_MAP_LEFT) << 1) | ((val & JOYSTICK_MAP_RIGHT) >> 1);
map->map[rownum][colnum] = val;
}
else
{
static const UINT8 charmap[] =
{
JOYSTICK_MAP_UP | JOYSTICK_MAP_LEFT,
JOYSTICK_MAP_UP,
JOYSTICK_MAP_UP | JOYSTICK_MAP_RIGHT,
JOYSTICK_MAP_LEFT,
JOYSTICK_MAP_NEUTRAL,
JOYSTICK_MAP_RIGHT,
JOYSTICK_MAP_DOWN | JOYSTICK_MAP_LEFT,
JOYSTICK_MAP_DOWN,
JOYSTICK_MAP_DOWN | JOYSTICK_MAP_RIGHT,
JOYSTICK_MAP_STICKY
};
static const char validchars[] = "789456123s";
const char *ptr = strchr(validchars, *mapstring++);
if (ptr == NULL)
return FALSE;
map->map[rownum][colnum] = charmap[ptr - validchars];
}
}
}
if (*mapstring == '.')
mapstring++;
}
return TRUE;
} | [
"static",
"int",
"joystick_map_parse",
"(",
"const",
"char",
"*",
"mapstring",
",",
"joystick_map",
"*",
"map",
")",
"{",
"int",
"rownum",
",",
"colnum",
";",
"for",
"(",
"rownum",
"=",
"0",
";",
"rownum",
"<",
"9",
";",
"rownum",
"++",
")",
"{",
"if",
"(",
"*",
"mapstring",
"==",
"0",
"||",
"*",
"mapstring",
"==",
"'",
"'",
")",
"{",
"int",
"symmetric",
"=",
"(",
"rownum",
">=",
"5",
"&&",
"*",
"mapstring",
"==",
"0",
")",
";",
"const",
"UINT8",
"*",
"srcrow",
"=",
"&",
"map",
"->",
"map",
"[",
"symmetric",
"?",
"(",
"8",
"-",
"rownum",
")",
":",
"(",
"rownum",
"-",
"1",
")",
"]",
"[",
"0",
"]",
";",
"if",
"(",
"rownum",
"==",
"0",
")",
"return",
"FALSE",
";",
"for",
"(",
"colnum",
"=",
"0",
";",
"colnum",
"<",
"9",
";",
"colnum",
"++",
")",
"{",
"UINT8",
"val",
"=",
"srcrow",
"[",
"colnum",
"]",
";",
"if",
"(",
"symmetric",
")",
"val",
"=",
"(",
"val",
"&",
"(",
"JOYSTICK_MAP_LEFT",
"|",
"JOYSTICK_MAP_RIGHT",
")",
")",
"|",
"(",
"(",
"val",
"&",
"JOYSTICK_MAP_UP",
")",
"<<",
"1",
")",
"|",
"(",
"(",
"val",
"&",
"JOYSTICK_MAP_DOWN",
")",
">>",
"1",
")",
";",
"map",
"->",
"map",
"[",
"rownum",
"]",
"[",
"colnum",
"]",
"=",
"val",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"colnum",
"=",
"0",
";",
"colnum",
"<",
"9",
";",
"colnum",
"++",
")",
"{",
"if",
"(",
"colnum",
">",
"0",
"&&",
"(",
"*",
"mapstring",
"==",
"0",
"||",
"*",
"mapstring",
"==",
"'",
"'",
")",
")",
"{",
"int",
"symmetric",
"=",
"(",
"colnum",
">=",
"5",
")",
";",
"UINT8",
"val",
"=",
"map",
"->",
"map",
"[",
"rownum",
"]",
"[",
"symmetric",
"?",
"(",
"8",
"-",
"colnum",
")",
":",
"(",
"colnum",
"-",
"1",
")",
"]",
";",
"if",
"(",
"symmetric",
")",
"val",
"=",
"(",
"val",
"&",
"(",
"JOYSTICK_MAP_UP",
"|",
"JOYSTICK_MAP_DOWN",
")",
")",
"|",
"(",
"(",
"val",
"&",
"JOYSTICK_MAP_LEFT",
")",
"<<",
"1",
")",
"|",
"(",
"(",
"val",
"&",
"JOYSTICK_MAP_RIGHT",
")",
">>",
"1",
")",
";",
"map",
"->",
"map",
"[",
"rownum",
"]",
"[",
"colnum",
"]",
"=",
"val",
";",
"}",
"else",
"{",
"static",
"const",
"UINT8",
"charmap",
"[",
"]",
"=",
"{",
"JOYSTICK_MAP_UP",
"|",
"JOYSTICK_MAP_LEFT",
",",
"JOYSTICK_MAP_UP",
",",
"JOYSTICK_MAP_UP",
"|",
"JOYSTICK_MAP_RIGHT",
",",
"JOYSTICK_MAP_LEFT",
",",
"JOYSTICK_MAP_NEUTRAL",
",",
"JOYSTICK_MAP_RIGHT",
",",
"JOYSTICK_MAP_DOWN",
"|",
"JOYSTICK_MAP_LEFT",
",",
"JOYSTICK_MAP_DOWN",
",",
"JOYSTICK_MAP_DOWN",
"|",
"JOYSTICK_MAP_RIGHT",
",",
"JOYSTICK_MAP_STICKY",
"}",
";",
"static",
"const",
"char",
"validchars",
"[",
"]",
"=",
"\"",
"\"",
";",
"const",
"char",
"*",
"ptr",
"=",
"strchr",
"(",
"validchars",
",",
"*",
"mapstring",
"++",
")",
";",
"if",
"(",
"ptr",
"==",
"NULL",
")",
"return",
"FALSE",
";",
"map",
"->",
"map",
"[",
"rownum",
"]",
"[",
"colnum",
"]",
"=",
"charmap",
"[",
"ptr",
"-",
"validchars",
"]",
";",
"}",
"}",
"}",
"if",
"(",
"*",
"mapstring",
"==",
"'",
"'",
")",
"mapstring",
"++",
";",
"}",
"return",
"TRUE",
";",
"}"
] | joystick_map_parse - parse a string into
a joystick map | [
"joystick_map_parse",
"-",
"parse",
"a",
"string",
"into",
"a",
"joystick",
"map"
] | [
"/* iterate over rows */",
"/* if we're done, copy from another row */",
"/* if this is row 0, we don't have a source row -- invalid */",
"/* copy from the srcrow, applying up/down symmetry if in the bottom half */",
"/* otherwise, parse this column */",
"/* if we're at the end of row, copy previous to the middle, then apply left/right symmetry */",
"/* otherwise, convert the character to its value */",
"/* invalid characters exit immediately */",
"/* if we ended with a period, advance to the next row */"
] | [
{
"param": "mapstring",
"type": "char"
},
{
"param": "map",
"type": "joystick_map"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mapstring",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "map",
"type": "joystick_map",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
077f97a38e61438f8783700a521ce6cbea3ff584 | lofunz/mieme | Reloaded/tags/MAME4droid1.1.2&MAME4iOS 1.1Reloaded/src/emu/input.c | [
"Unlicense"
] | C | joystick_map_print | void | static void joystick_map_print(const char *header, const char *origstring, const joystick_map *map)
{
int rownum, colnum;
mame_printf_verbose("%s = %s\n", header, origstring);
for (rownum = 0; rownum < 9; rownum++)
{
mame_printf_verbose(" ");
for (colnum = 0; colnum < 9; colnum++)
switch (map->map[rownum][colnum])
{
case JOYSTICK_MAP_UP | JOYSTICK_MAP_LEFT: mame_printf_verbose("7"); break;
case JOYSTICK_MAP_UP: mame_printf_verbose("8"); break;
case JOYSTICK_MAP_UP | JOYSTICK_MAP_RIGHT: mame_printf_verbose("9"); break;
case JOYSTICK_MAP_LEFT: mame_printf_verbose("4"); break;
case JOYSTICK_MAP_NEUTRAL: mame_printf_verbose("5"); break;
case JOYSTICK_MAP_RIGHT: mame_printf_verbose("6"); break;
case JOYSTICK_MAP_DOWN | JOYSTICK_MAP_LEFT: mame_printf_verbose("1"); break;
case JOYSTICK_MAP_DOWN: mame_printf_verbose("2"); break;
case JOYSTICK_MAP_DOWN | JOYSTICK_MAP_RIGHT:mame_printf_verbose("3"); break;
case JOYSTICK_MAP_STICKY: mame_printf_verbose("s"); break;
default: mame_printf_verbose("?"); break;
}
mame_printf_verbose("\n");
}
} | /*-------------------------------------------------
joystick_map_print - print a joystick map via
the verbose output
-------------------------------------------------*/ | print a joystick map via
the verbose output | [
"print",
"a",
"joystick",
"map",
"via",
"the",
"verbose",
"output"
] | static void joystick_map_print(const char *header, const char *origstring, const joystick_map *map)
{
int rownum, colnum;
mame_printf_verbose("%s = %s\n", header, origstring);
for (rownum = 0; rownum < 9; rownum++)
{
mame_printf_verbose(" ");
for (colnum = 0; colnum < 9; colnum++)
switch (map->map[rownum][colnum])
{
case JOYSTICK_MAP_UP | JOYSTICK_MAP_LEFT: mame_printf_verbose("7"); break;
case JOYSTICK_MAP_UP: mame_printf_verbose("8"); break;
case JOYSTICK_MAP_UP | JOYSTICK_MAP_RIGHT: mame_printf_verbose("9"); break;
case JOYSTICK_MAP_LEFT: mame_printf_verbose("4"); break;
case JOYSTICK_MAP_NEUTRAL: mame_printf_verbose("5"); break;
case JOYSTICK_MAP_RIGHT: mame_printf_verbose("6"); break;
case JOYSTICK_MAP_DOWN | JOYSTICK_MAP_LEFT: mame_printf_verbose("1"); break;
case JOYSTICK_MAP_DOWN: mame_printf_verbose("2"); break;
case JOYSTICK_MAP_DOWN | JOYSTICK_MAP_RIGHT:mame_printf_verbose("3"); break;
case JOYSTICK_MAP_STICKY: mame_printf_verbose("s"); break;
default: mame_printf_verbose("?"); break;
}
mame_printf_verbose("\n");
}
} | [
"static",
"void",
"joystick_map_print",
"(",
"const",
"char",
"*",
"header",
",",
"const",
"char",
"*",
"origstring",
",",
"const",
"joystick_map",
"*",
"map",
")",
"{",
"int",
"rownum",
",",
"colnum",
";",
"mame_printf_verbose",
"(",
"\"",
"\\n",
"\"",
",",
"header",
",",
"origstring",
")",
";",
"for",
"(",
"rownum",
"=",
"0",
";",
"rownum",
"<",
"9",
";",
"rownum",
"++",
")",
"{",
"mame_printf_verbose",
"(",
"\"",
"\"",
")",
";",
"for",
"(",
"colnum",
"=",
"0",
";",
"colnum",
"<",
"9",
";",
"colnum",
"++",
")",
"switch",
"(",
"map",
"->",
"map",
"[",
"rownum",
"]",
"[",
"colnum",
"]",
")",
"{",
"case",
"JOYSTICK_MAP_UP",
"|",
"JOYSTICK_MAP_LEFT",
":",
"mame_printf_verbose",
"(",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"JOYSTICK_MAP_UP",
":",
"mame_printf_verbose",
"(",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"JOYSTICK_MAP_UP",
"|",
"JOYSTICK_MAP_RIGHT",
":",
"mame_printf_verbose",
"(",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"JOYSTICK_MAP_LEFT",
":",
"mame_printf_verbose",
"(",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"JOYSTICK_MAP_NEUTRAL",
":",
"mame_printf_verbose",
"(",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"JOYSTICK_MAP_RIGHT",
":",
"mame_printf_verbose",
"(",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"JOYSTICK_MAP_DOWN",
"|",
"JOYSTICK_MAP_LEFT",
":",
"mame_printf_verbose",
"(",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"JOYSTICK_MAP_DOWN",
":",
"mame_printf_verbose",
"(",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"JOYSTICK_MAP_DOWN",
"|",
"JOYSTICK_MAP_RIGHT",
":",
"mame_printf_verbose",
"(",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"JOYSTICK_MAP_STICKY",
":",
"mame_printf_verbose",
"(",
"\"",
"\"",
")",
";",
"break",
";",
"default",
":",
"mame_printf_verbose",
"(",
"\"",
"\"",
")",
";",
"break",
";",
"}",
"mame_printf_verbose",
"(",
"\"",
"\\n",
"\"",
")",
";",
"}",
"}"
] | joystick_map_print - print a joystick map via
the verbose output | [
"joystick_map_print",
"-",
"print",
"a",
"joystick",
"map",
"via",
"the",
"verbose",
"output"
] | [] | [
{
"param": "header",
"type": "char"
},
{
"param": "origstring",
"type": "char"
},
{
"param": "map",
"type": "joystick_map"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "header",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "origstring",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "map",
"type": "joystick_map",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7a9c5cd9a6003e7671d28ad308ff128e5e8bae19 | lofunz/mieme | Reloaded/trunk/src/lib/util/cdrom.c | [
"Unlicense"
] | C | cdrom_read_data | UINT32 | UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32 datatype)
{
UINT32 tracktype, tracknum, sectoroffs;
chd_error err;
if (file == NULL)
return 0;
/* cache in the sector */
err = read_sector_into_cache(file, lbasector, §oroffs, &tracknum);
if (err != CHDERR_NONE)
return 0;
/* copy out the requested sector */
tracktype = file->cdtoc.tracks[tracknum].trktype;
if ((datatype == tracktype) || (datatype == CD_TRACK_RAW_DONTCARE))
{
memcpy(buffer, &file->cache[sectoroffs * CD_FRAME_SIZE], file->cdtoc.tracks[tracknum].datasize);
}
else
{
/* return 2048 bytes of mode 1 data from a 2352 byte mode 1 raw sector */
if ((datatype == CD_TRACK_MODE1) && (tracktype == CD_TRACK_MODE1_RAW))
{
memcpy(buffer, &file->cache[(sectoroffs * CD_FRAME_SIZE) + 16], 2048);
return 1;
}
/* return 2048 bytes of mode 1 data from a mode2 form1 or raw sector */
if ((datatype == CD_TRACK_MODE1) && ((tracktype == CD_TRACK_MODE2_FORM1)||(tracktype == CD_TRACK_MODE2_RAW)))
{
memcpy(buffer, &file->cache[(sectoroffs * CD_FRAME_SIZE) + 24], 2048);
return 1;
}
/* return mode 2 2336 byte data from a 2352 byte mode 1 or 2 raw sector (skip the header) */
if ((datatype == CD_TRACK_MODE2) && ((tracktype == CD_TRACK_MODE1_RAW) || (tracktype == CD_TRACK_MODE2_RAW)))
{
memcpy(buffer, &file->cache[(sectoroffs * CD_FRAME_SIZE) + 16], 2336);
return 1;
}
LOG(("CDROM: Conversion from type %d to type %d not supported!\n", tracktype, datatype));
return 0;
}
return 1;
} | /*-------------------------------------------------
cdrom_read_data - read one or more sectors
from a CD-ROM
-------------------------------------------------*/ | read one or more sectors
from a CD-ROM | [
"read",
"one",
"or",
"more",
"sectors",
"from",
"a",
"CD",
"-",
"ROM"
] | UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32 datatype)
{
UINT32 tracktype, tracknum, sectoroffs;
chd_error err;
if (file == NULL)
return 0;
err = read_sector_into_cache(file, lbasector, §oroffs, &tracknum);
if (err != CHDERR_NONE)
return 0;
tracktype = file->cdtoc.tracks[tracknum].trktype;
if ((datatype == tracktype) || (datatype == CD_TRACK_RAW_DONTCARE))
{
memcpy(buffer, &file->cache[sectoroffs * CD_FRAME_SIZE], file->cdtoc.tracks[tracknum].datasize);
}
else
{
if ((datatype == CD_TRACK_MODE1) && (tracktype == CD_TRACK_MODE1_RAW))
{
memcpy(buffer, &file->cache[(sectoroffs * CD_FRAME_SIZE) + 16], 2048);
return 1;
}
if ((datatype == CD_TRACK_MODE1) && ((tracktype == CD_TRACK_MODE2_FORM1)||(tracktype == CD_TRACK_MODE2_RAW)))
{
memcpy(buffer, &file->cache[(sectoroffs * CD_FRAME_SIZE) + 24], 2048);
return 1;
}
if ((datatype == CD_TRACK_MODE2) && ((tracktype == CD_TRACK_MODE1_RAW) || (tracktype == CD_TRACK_MODE2_RAW)))
{
memcpy(buffer, &file->cache[(sectoroffs * CD_FRAME_SIZE) + 16], 2336);
return 1;
}
LOG(("CDROM: Conversion from type %d to type %d not supported!\n", tracktype, datatype));
return 0;
}
return 1;
} | [
"UINT32",
"cdrom_read_data",
"(",
"cdrom_file",
"*",
"file",
",",
"UINT32",
"lbasector",
",",
"void",
"*",
"buffer",
",",
"UINT32",
"datatype",
")",
"{",
"UINT32",
"tracktype",
",",
"tracknum",
",",
"sectoroffs",
";",
"chd_error",
"err",
";",
"if",
"(",
"file",
"==",
"NULL",
")",
"return",
"0",
";",
"err",
"=",
"read_sector_into_cache",
"(",
"file",
",",
"lbasector",
",",
"&",
"sectoroffs",
",",
"&",
"tracknum",
")",
";",
"if",
"(",
"err",
"!=",
"CHDERR_NONE",
")",
"return",
"0",
";",
"tracktype",
"=",
"file",
"->",
"cdtoc",
".",
"tracks",
"[",
"tracknum",
"]",
".",
"trktype",
";",
"if",
"(",
"(",
"datatype",
"==",
"tracktype",
")",
"||",
"(",
"datatype",
"==",
"CD_TRACK_RAW_DONTCARE",
")",
")",
"{",
"memcpy",
"(",
"buffer",
",",
"&",
"file",
"->",
"cache",
"[",
"sectoroffs",
"*",
"CD_FRAME_SIZE",
"]",
",",
"file",
"->",
"cdtoc",
".",
"tracks",
"[",
"tracknum",
"]",
".",
"datasize",
")",
";",
"}",
"else",
"{",
"if",
"(",
"(",
"datatype",
"==",
"CD_TRACK_MODE1",
")",
"&&",
"(",
"tracktype",
"==",
"CD_TRACK_MODE1_RAW",
")",
")",
"{",
"memcpy",
"(",
"buffer",
",",
"&",
"file",
"->",
"cache",
"[",
"(",
"sectoroffs",
"*",
"CD_FRAME_SIZE",
")",
"+",
"16",
"]",
",",
"2048",
")",
";",
"return",
"1",
";",
"}",
"if",
"(",
"(",
"datatype",
"==",
"CD_TRACK_MODE1",
")",
"&&",
"(",
"(",
"tracktype",
"==",
"CD_TRACK_MODE2_FORM1",
")",
"||",
"(",
"tracktype",
"==",
"CD_TRACK_MODE2_RAW",
")",
")",
")",
"{",
"memcpy",
"(",
"buffer",
",",
"&",
"file",
"->",
"cache",
"[",
"(",
"sectoroffs",
"*",
"CD_FRAME_SIZE",
")",
"+",
"24",
"]",
",",
"2048",
")",
";",
"return",
"1",
";",
"}",
"if",
"(",
"(",
"datatype",
"==",
"CD_TRACK_MODE2",
")",
"&&",
"(",
"(",
"tracktype",
"==",
"CD_TRACK_MODE1_RAW",
")",
"||",
"(",
"tracktype",
"==",
"CD_TRACK_MODE2_RAW",
")",
")",
")",
"{",
"memcpy",
"(",
"buffer",
",",
"&",
"file",
"->",
"cache",
"[",
"(",
"sectoroffs",
"*",
"CD_FRAME_SIZE",
")",
"+",
"16",
"]",
",",
"2336",
")",
";",
"return",
"1",
";",
"}",
"LOG",
"(",
"(",
"\"",
"\\n",
"\"",
",",
"tracktype",
",",
"datatype",
")",
")",
";",
"return",
"0",
";",
"}",
"return",
"1",
";",
"}"
] | cdrom_read_data - read one or more sectors
from a CD-ROM | [
"cdrom_read_data",
"-",
"read",
"one",
"or",
"more",
"sectors",
"from",
"a",
"CD",
"-",
"ROM"
] | [
"/* cache in the sector */",
"/* copy out the requested sector */",
"/* return 2048 bytes of mode 1 data from a 2352 byte mode 1 raw sector */",
"/* return 2048 bytes of mode 1 data from a mode2 form1 or raw sector */",
"/* return mode 2 2336 byte data from a 2352 byte mode 1 or 2 raw sector (skip the header) */"
] | [
{
"param": "file",
"type": "cdrom_file"
},
{
"param": "lbasector",
"type": "UINT32"
},
{
"param": "buffer",
"type": "void"
},
{
"param": "datatype",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "cdrom_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lbasector",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "buffer",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "datatype",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7a9c5cd9a6003e7671d28ad308ff128e5e8bae19 | lofunz/mieme | Reloaded/trunk/src/lib/util/cdrom.c | [
"Unlicense"
] | C | cdrom_get_info_from_type_string | void | static void cdrom_get_info_from_type_string(const char *typestring, UINT32 *trktype, UINT32 *datasize)
{
if (!strcmp(typestring, "MODE1"))
{
*trktype = CD_TRACK_MODE1;
*datasize = 2048;
}
else if (!strcmp(typestring, "MODE1/2048"))
{
*trktype = CD_TRACK_MODE1;
*datasize = 2048;
}
else if (!strcmp(typestring, "MODE1_RAW"))
{
*trktype = CD_TRACK_MODE1_RAW;
*datasize = 2352;
}
else if (!strcmp(typestring, "MODE1/2352"))
{
*trktype = CD_TRACK_MODE1_RAW;
*datasize = 2352;
}
else if (!strcmp(typestring, "MODE2"))
{
*trktype = CD_TRACK_MODE2;
*datasize = 2336;
}
else if (!strcmp(typestring, "MODE2/2336"))
{
*trktype = CD_TRACK_MODE2;
*datasize = 2336;
}
else if (!strcmp(typestring, "MODE2_FORM1"))
{
*trktype = CD_TRACK_MODE2_FORM1;
*datasize = 2048;
}
else if (!strcmp(typestring, "MODE2/2048"))
{
*trktype = CD_TRACK_MODE2_FORM1;
*datasize = 2048;
}
else if (!strcmp(typestring, "MODE2_FORM2"))
{
*trktype = CD_TRACK_MODE2_FORM2;
*datasize = 2324;
}
else if (!strcmp(typestring, "MODE2/2324"))
{
*trktype = CD_TRACK_MODE2_FORM2;
*datasize = 2324;
}
else if (!strcmp(typestring, "MODE2_FORM_MIX"))
{
*trktype = CD_TRACK_MODE2_FORM_MIX;
*datasize = 2336;
}
else if (!strcmp(typestring, "MODE2/2336"))
{
*trktype = CD_TRACK_MODE2_FORM_MIX;
*datasize = 2336;
}
else if (!strcmp(typestring, "MODE2_RAW"))
{
*trktype = CD_TRACK_MODE2_RAW;
*datasize = 2352;
}
else if (!strcmp(typestring, "MODE2/2352"))
{
*trktype = CD_TRACK_MODE2_RAW;
*datasize = 2352;
}
else if (!strcmp(typestring, "AUDIO"))
{
*trktype = CD_TRACK_AUDIO;
*datasize = 2352;
}
} | /*-------------------------------------------------
cdrom_get_info_from_type_string
take a string and convert it into track type
and track data size
-------------------------------------------------*/ | cdrom_get_info_from_type_string
take a string and convert it into track type
and track data size | [
"cdrom_get_info_from_type_string",
"take",
"a",
"string",
"and",
"convert",
"it",
"into",
"track",
"type",
"and",
"track",
"data",
"size"
] | static void cdrom_get_info_from_type_string(const char *typestring, UINT32 *trktype, UINT32 *datasize)
{
if (!strcmp(typestring, "MODE1"))
{
*trktype = CD_TRACK_MODE1;
*datasize = 2048;
}
else if (!strcmp(typestring, "MODE1/2048"))
{
*trktype = CD_TRACK_MODE1;
*datasize = 2048;
}
else if (!strcmp(typestring, "MODE1_RAW"))
{
*trktype = CD_TRACK_MODE1_RAW;
*datasize = 2352;
}
else if (!strcmp(typestring, "MODE1/2352"))
{
*trktype = CD_TRACK_MODE1_RAW;
*datasize = 2352;
}
else if (!strcmp(typestring, "MODE2"))
{
*trktype = CD_TRACK_MODE2;
*datasize = 2336;
}
else if (!strcmp(typestring, "MODE2/2336"))
{
*trktype = CD_TRACK_MODE2;
*datasize = 2336;
}
else if (!strcmp(typestring, "MODE2_FORM1"))
{
*trktype = CD_TRACK_MODE2_FORM1;
*datasize = 2048;
}
else if (!strcmp(typestring, "MODE2/2048"))
{
*trktype = CD_TRACK_MODE2_FORM1;
*datasize = 2048;
}
else if (!strcmp(typestring, "MODE2_FORM2"))
{
*trktype = CD_TRACK_MODE2_FORM2;
*datasize = 2324;
}
else if (!strcmp(typestring, "MODE2/2324"))
{
*trktype = CD_TRACK_MODE2_FORM2;
*datasize = 2324;
}
else if (!strcmp(typestring, "MODE2_FORM_MIX"))
{
*trktype = CD_TRACK_MODE2_FORM_MIX;
*datasize = 2336;
}
else if (!strcmp(typestring, "MODE2/2336"))
{
*trktype = CD_TRACK_MODE2_FORM_MIX;
*datasize = 2336;
}
else if (!strcmp(typestring, "MODE2_RAW"))
{
*trktype = CD_TRACK_MODE2_RAW;
*datasize = 2352;
}
else if (!strcmp(typestring, "MODE2/2352"))
{
*trktype = CD_TRACK_MODE2_RAW;
*datasize = 2352;
}
else if (!strcmp(typestring, "AUDIO"))
{
*trktype = CD_TRACK_AUDIO;
*datasize = 2352;
}
} | [
"static",
"void",
"cdrom_get_info_from_type_string",
"(",
"const",
"char",
"*",
"typestring",
",",
"UINT32",
"*",
"trktype",
",",
"UINT32",
"*",
"datasize",
")",
"{",
"if",
"(",
"!",
"strcmp",
"(",
"typestring",
",",
"\"",
"\"",
")",
")",
"{",
"*",
"trktype",
"=",
"CD_TRACK_MODE1",
";",
"*",
"datasize",
"=",
"2048",
";",
"}",
"else",
"if",
"(",
"!",
"strcmp",
"(",
"typestring",
",",
"\"",
"\"",
")",
")",
"{",
"*",
"trktype",
"=",
"CD_TRACK_MODE1",
";",
"*",
"datasize",
"=",
"2048",
";",
"}",
"else",
"if",
"(",
"!",
"strcmp",
"(",
"typestring",
",",
"\"",
"\"",
")",
")",
"{",
"*",
"trktype",
"=",
"CD_TRACK_MODE1_RAW",
";",
"*",
"datasize",
"=",
"2352",
";",
"}",
"else",
"if",
"(",
"!",
"strcmp",
"(",
"typestring",
",",
"\"",
"\"",
")",
")",
"{",
"*",
"trktype",
"=",
"CD_TRACK_MODE1_RAW",
";",
"*",
"datasize",
"=",
"2352",
";",
"}",
"else",
"if",
"(",
"!",
"strcmp",
"(",
"typestring",
",",
"\"",
"\"",
")",
")",
"{",
"*",
"trktype",
"=",
"CD_TRACK_MODE2",
";",
"*",
"datasize",
"=",
"2336",
";",
"}",
"else",
"if",
"(",
"!",
"strcmp",
"(",
"typestring",
",",
"\"",
"\"",
")",
")",
"{",
"*",
"trktype",
"=",
"CD_TRACK_MODE2",
";",
"*",
"datasize",
"=",
"2336",
";",
"}",
"else",
"if",
"(",
"!",
"strcmp",
"(",
"typestring",
",",
"\"",
"\"",
")",
")",
"{",
"*",
"trktype",
"=",
"CD_TRACK_MODE2_FORM1",
";",
"*",
"datasize",
"=",
"2048",
";",
"}",
"else",
"if",
"(",
"!",
"strcmp",
"(",
"typestring",
",",
"\"",
"\"",
")",
")",
"{",
"*",
"trktype",
"=",
"CD_TRACK_MODE2_FORM1",
";",
"*",
"datasize",
"=",
"2048",
";",
"}",
"else",
"if",
"(",
"!",
"strcmp",
"(",
"typestring",
",",
"\"",
"\"",
")",
")",
"{",
"*",
"trktype",
"=",
"CD_TRACK_MODE2_FORM2",
";",
"*",
"datasize",
"=",
"2324",
";",
"}",
"else",
"if",
"(",
"!",
"strcmp",
"(",
"typestring",
",",
"\"",
"\"",
")",
")",
"{",
"*",
"trktype",
"=",
"CD_TRACK_MODE2_FORM2",
";",
"*",
"datasize",
"=",
"2324",
";",
"}",
"else",
"if",
"(",
"!",
"strcmp",
"(",
"typestring",
",",
"\"",
"\"",
")",
")",
"{",
"*",
"trktype",
"=",
"CD_TRACK_MODE2_FORM_MIX",
";",
"*",
"datasize",
"=",
"2336",
";",
"}",
"else",
"if",
"(",
"!",
"strcmp",
"(",
"typestring",
",",
"\"",
"\"",
")",
")",
"{",
"*",
"trktype",
"=",
"CD_TRACK_MODE2_FORM_MIX",
";",
"*",
"datasize",
"=",
"2336",
";",
"}",
"else",
"if",
"(",
"!",
"strcmp",
"(",
"typestring",
",",
"\"",
"\"",
")",
")",
"{",
"*",
"trktype",
"=",
"CD_TRACK_MODE2_RAW",
";",
"*",
"datasize",
"=",
"2352",
";",
"}",
"else",
"if",
"(",
"!",
"strcmp",
"(",
"typestring",
",",
"\"",
"\"",
")",
")",
"{",
"*",
"trktype",
"=",
"CD_TRACK_MODE2_RAW",
";",
"*",
"datasize",
"=",
"2352",
";",
"}",
"else",
"if",
"(",
"!",
"strcmp",
"(",
"typestring",
",",
"\"",
"\"",
")",
")",
"{",
"*",
"trktype",
"=",
"CD_TRACK_AUDIO",
";",
"*",
"datasize",
"=",
"2352",
";",
"}",
"}"
] | cdrom_get_info_from_type_string
take a string and convert it into track type
and track data size | [
"cdrom_get_info_from_type_string",
"take",
"a",
"string",
"and",
"convert",
"it",
"into",
"track",
"type",
"and",
"track",
"data",
"size"
] | [] | [
{
"param": "typestring",
"type": "char"
},
{
"param": "trktype",
"type": "UINT32"
},
{
"param": "datasize",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "typestring",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "trktype",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "datasize",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7a9c5cd9a6003e7671d28ad308ff128e5e8bae19 | lofunz/mieme | Reloaded/trunk/src/lib/util/cdrom.c | [
"Unlicense"
] | C | cdrom_convert_subtype_string_to_pregap_info | void | void cdrom_convert_subtype_string_to_pregap_info(const char *typestring, cdrom_track_info *info)
{
if (!strcmp(typestring, "RW"))
{
info->pgsub = CD_SUB_NORMAL;
info->pgsubsize = 96;
}
else if (!strcmp(typestring, "RW_RAW"))
{
info->pgsub = CD_SUB_RAW;
info->pgsubsize = 96;
}
} | /*-------------------------------------------------
cdrom_convert_subtype_string_to_pregap_info -
take a string and convert it into track subtype
and track subcode data size
-------------------------------------------------*/ | cdrom_convert_subtype_string_to_pregap_info
take a string and convert it into track subtype
and track subcode data size | [
"cdrom_convert_subtype_string_to_pregap_info",
"take",
"a",
"string",
"and",
"convert",
"it",
"into",
"track",
"subtype",
"and",
"track",
"subcode",
"data",
"size"
] | void cdrom_convert_subtype_string_to_pregap_info(const char *typestring, cdrom_track_info *info)
{
if (!strcmp(typestring, "RW"))
{
info->pgsub = CD_SUB_NORMAL;
info->pgsubsize = 96;
}
else if (!strcmp(typestring, "RW_RAW"))
{
info->pgsub = CD_SUB_RAW;
info->pgsubsize = 96;
}
} | [
"void",
"cdrom_convert_subtype_string_to_pregap_info",
"(",
"const",
"char",
"*",
"typestring",
",",
"cdrom_track_info",
"*",
"info",
")",
"{",
"if",
"(",
"!",
"strcmp",
"(",
"typestring",
",",
"\"",
"\"",
")",
")",
"{",
"info",
"->",
"pgsub",
"=",
"CD_SUB_NORMAL",
";",
"info",
"->",
"pgsubsize",
"=",
"96",
";",
"}",
"else",
"if",
"(",
"!",
"strcmp",
"(",
"typestring",
",",
"\"",
"\"",
")",
")",
"{",
"info",
"->",
"pgsub",
"=",
"CD_SUB_RAW",
";",
"info",
"->",
"pgsubsize",
"=",
"96",
";",
"}",
"}"
] | cdrom_convert_subtype_string_to_pregap_info
take a string and convert it into track subtype
and track subcode data size | [
"cdrom_convert_subtype_string_to_pregap_info",
"take",
"a",
"string",
"and",
"convert",
"it",
"into",
"track",
"subtype",
"and",
"track",
"subcode",
"data",
"size"
] | [] | [
{
"param": "typestring",
"type": "char"
},
{
"param": "info",
"type": "cdrom_track_info"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "typestring",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "info",
"type": "cdrom_track_info",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7a9c5cd9a6003e7671d28ad308ff128e5e8bae19 | lofunz/mieme | Reloaded/trunk/src/lib/util/cdrom.c | [
"Unlicense"
] | C | cdrom_get_type_string | char | const char *cdrom_get_type_string(UINT32 trktype)
{
switch (trktype)
{
case CD_TRACK_MODE1: return "MODE1";
case CD_TRACK_MODE1_RAW: return "MODE1_RAW";
case CD_TRACK_MODE2: return "MODE2";
case CD_TRACK_MODE2_FORM1: return "MODE2_FORM1";
case CD_TRACK_MODE2_FORM2: return "MODE2_FORM2";
case CD_TRACK_MODE2_FORM_MIX: return "MODE2_FORM_MIX";
case CD_TRACK_MODE2_RAW: return "MODE2_RAW";
case CD_TRACK_AUDIO: return "AUDIO";
default: return "UNKNOWN";
}
} | /*-------------------------------------------------
cdrom_get_type_string - get the string
associated with the given type
-------------------------------------------------*/ | get the string
associated with the given type | [
"get",
"the",
"string",
"associated",
"with",
"the",
"given",
"type"
] | const char *cdrom_get_type_string(UINT32 trktype)
{
switch (trktype)
{
case CD_TRACK_MODE1: return "MODE1";
case CD_TRACK_MODE1_RAW: return "MODE1_RAW";
case CD_TRACK_MODE2: return "MODE2";
case CD_TRACK_MODE2_FORM1: return "MODE2_FORM1";
case CD_TRACK_MODE2_FORM2: return "MODE2_FORM2";
case CD_TRACK_MODE2_FORM_MIX: return "MODE2_FORM_MIX";
case CD_TRACK_MODE2_RAW: return "MODE2_RAW";
case CD_TRACK_AUDIO: return "AUDIO";
default: return "UNKNOWN";
}
} | [
"const",
"char",
"*",
"cdrom_get_type_string",
"(",
"UINT32",
"trktype",
")",
"{",
"switch",
"(",
"trktype",
")",
"{",
"case",
"CD_TRACK_MODE1",
":",
"return",
"\"",
"\"",
";",
"case",
"CD_TRACK_MODE1_RAW",
":",
"return",
"\"",
"\"",
";",
"case",
"CD_TRACK_MODE2",
":",
"return",
"\"",
"\"",
";",
"case",
"CD_TRACK_MODE2_FORM1",
":",
"return",
"\"",
"\"",
";",
"case",
"CD_TRACK_MODE2_FORM2",
":",
"return",
"\"",
"\"",
";",
"case",
"CD_TRACK_MODE2_FORM_MIX",
":",
"return",
"\"",
"\"",
";",
"case",
"CD_TRACK_MODE2_RAW",
":",
"return",
"\"",
"\"",
";",
"case",
"CD_TRACK_AUDIO",
":",
"return",
"\"",
"\"",
";",
"default",
":",
"return",
"\"",
"\"",
";",
"}",
"}"
] | cdrom_get_type_string - get the string
associated with the given type | [
"cdrom_get_type_string",
"-",
"get",
"the",
"string",
"associated",
"with",
"the",
"given",
"type"
] | [] | [
{
"param": "trktype",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "trktype",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7a9c5cd9a6003e7671d28ad308ff128e5e8bae19 | lofunz/mieme | Reloaded/trunk/src/lib/util/cdrom.c | [
"Unlicense"
] | C | cdrom_get_subtype_string | char | const char *cdrom_get_subtype_string(UINT32 subtype)
{
switch (subtype)
{
case CD_SUB_NORMAL: return "RW";
case CD_SUB_RAW: return "RW_RAW";
default: return "NONE";
}
} | /*-------------------------------------------------
cdrom_get_subtype_string - get the string
associated with the given subcode type
-------------------------------------------------*/ | get the string
associated with the given subcode type | [
"get",
"the",
"string",
"associated",
"with",
"the",
"given",
"subcode",
"type"
] | const char *cdrom_get_subtype_string(UINT32 subtype)
{
switch (subtype)
{
case CD_SUB_NORMAL: return "RW";
case CD_SUB_RAW: return "RW_RAW";
default: return "NONE";
}
} | [
"const",
"char",
"*",
"cdrom_get_subtype_string",
"(",
"UINT32",
"subtype",
")",
"{",
"switch",
"(",
"subtype",
")",
"{",
"case",
"CD_SUB_NORMAL",
":",
"return",
"\"",
"\"",
";",
"case",
"CD_SUB_RAW",
":",
"return",
"\"",
"\"",
";",
"default",
":",
"return",
"\"",
"\"",
";",
"}",
"}"
] | cdrom_get_subtype_string - get the string
associated with the given subcode type | [
"cdrom_get_subtype_string",
"-",
"get",
"the",
"string",
"associated",
"with",
"the",
"given",
"subcode",
"type"
] | [] | [
{
"param": "subtype",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "subtype",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7a9c5cd9a6003e7671d28ad308ff128e5e8bae19 | lofunz/mieme | Reloaded/trunk/src/lib/util/cdrom.c | [
"Unlicense"
] | C | cdrom_parse_metadata | chd_error | chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc)
{
static UINT32 oldmetadata[CD_METADATA_WORDS], *mrp;
const chd_header *header = chd_get_header(chd);
UINT32 hunksectors = header->hunkbytes / CD_FRAME_SIZE;
char metadata[512];
chd_error err;
int i;
/* start with no tracks */
for (toc->numtrks = 0; toc->numtrks < CD_MAX_TRACKS; toc->numtrks++)
{
int tracknum = -1, frames = 0, hunks, pregap, postgap;
char type[16], subtype[16], pgtype[16], pgsub[16];
cdrom_track_info *track;
pregap = postgap = 0;
/* fetch the metadata for this track */
err = chd_get_metadata(chd, CDROM_TRACK_METADATA_TAG, toc->numtrks, metadata, sizeof(metadata), NULL, NULL, NULL);
if (err == CHDERR_NONE)
{
/* parse the metadata */
type[0] = subtype[0] = 0;
if (sscanf(metadata, CDROM_TRACK_METADATA_FORMAT, &tracknum, type, subtype, &frames) != 4)
return CHDERR_INVALID_DATA;
if (tracknum == 0 || tracknum > CD_MAX_TRACKS)
return CHDERR_INVALID_DATA;
track = &toc->tracks[tracknum - 1];
}
else
{
err = chd_get_metadata(chd, CDROM_TRACK_METADATA2_TAG, toc->numtrks, metadata, sizeof(metadata), NULL, NULL, NULL);
if (err != CHDERR_NONE)
break;
/* parse the metadata */
type[0] = subtype[0] = 0;
pregap = postgap = 0;
if (sscanf(metadata, CDROM_TRACK_METADATA2_FORMAT, &tracknum, type, subtype, &frames, &pregap, pgtype, pgsub, &postgap) != 8)
return CHDERR_INVALID_DATA;
if (tracknum == 0 || tracknum > CD_MAX_TRACKS)
return CHDERR_INVALID_DATA;
track = &toc->tracks[tracknum - 1];
}
/* extract the track type and determine the data size */
track->trktype = CD_TRACK_MODE1;
track->datasize = 0;
cdrom_convert_type_string_to_track_info(type, track);
if (track->datasize == 0)
return CHDERR_INVALID_DATA;
/* extract the subtype and determine the subcode data size */
track->subtype = CD_SUB_NONE;
track->subsize = 0;
cdrom_convert_subtype_string_to_track_info(subtype, track);
/* set the frames and extra frames data */
track->frames = frames;
hunks = (frames + hunksectors - 1) / hunksectors;
track->extraframes = hunks * hunksectors - frames;
/* set the pregap info */
track->pregap = pregap;
track->pgtype = CD_TRACK_MODE1;
track->pgsub = CD_SUB_NONE;
track->pgdatasize = 0;
track->pgsubsize = 0;
cdrom_convert_type_string_to_pregap_info(pgtype, track);
cdrom_convert_subtype_string_to_pregap_info(pgsub, track);
}
/* if we got any tracks this way, we're done */
if (toc->numtrks > 0)
return CHDERR_NONE;
/* look for old-style metadata */
err = chd_get_metadata(chd, CDROM_OLD_METADATA_TAG, 0, oldmetadata, sizeof(oldmetadata), NULL, NULL, NULL);
if (err != CHDERR_NONE)
return err;
/* reconstruct the TOC from it */
mrp = &oldmetadata[0];
toc->numtrks = *mrp++;
for (i = 0; i < CD_MAX_TRACKS; i++)
{
toc->tracks[i].trktype = *mrp++;
toc->tracks[i].subtype = *mrp++;
toc->tracks[i].datasize = *mrp++;
toc->tracks[i].subsize = *mrp++;
toc->tracks[i].frames = *mrp++;
toc->tracks[i].extraframes = *mrp++;
}
/* TODO: I don't know why sometimes the data is one endian and sometimes another */
if ((toc->numtrks < 0) || (toc->numtrks > CD_MAX_TRACKS))
{
toc->numtrks = FLIPENDIAN_INT32(toc->numtrks);
for (i = 0; i < CD_MAX_TRACKS; i++)
{
toc->tracks[i].trktype = FLIPENDIAN_INT32(toc->tracks[i].trktype);
toc->tracks[i].subtype = FLIPENDIAN_INT32(toc->tracks[i].subtype);
toc->tracks[i].datasize = FLIPENDIAN_INT32(toc->tracks[i].datasize);
toc->tracks[i].subsize = FLIPENDIAN_INT32(toc->tracks[i].subsize);
toc->tracks[i].frames = FLIPENDIAN_INT32(toc->tracks[i].frames);
toc->tracks[i].extraframes = FLIPENDIAN_INT32(toc->tracks[i].extraframes);
}
}
return CHDERR_NONE;
} | /*-------------------------------------------------
cdrom_parse_metadata - parse metadata into the
TOC structure
-------------------------------------------------*/ | parse metadata into the
TOC structure | [
"parse",
"metadata",
"into",
"the",
"TOC",
"structure"
] | chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc)
{
static UINT32 oldmetadata[CD_METADATA_WORDS], *mrp;
const chd_header *header = chd_get_header(chd);
UINT32 hunksectors = header->hunkbytes / CD_FRAME_SIZE;
char metadata[512];
chd_error err;
int i;
for (toc->numtrks = 0; toc->numtrks < CD_MAX_TRACKS; toc->numtrks++)
{
int tracknum = -1, frames = 0, hunks, pregap, postgap;
char type[16], subtype[16], pgtype[16], pgsub[16];
cdrom_track_info *track;
pregap = postgap = 0;
err = chd_get_metadata(chd, CDROM_TRACK_METADATA_TAG, toc->numtrks, metadata, sizeof(metadata), NULL, NULL, NULL);
if (err == CHDERR_NONE)
{
type[0] = subtype[0] = 0;
if (sscanf(metadata, CDROM_TRACK_METADATA_FORMAT, &tracknum, type, subtype, &frames) != 4)
return CHDERR_INVALID_DATA;
if (tracknum == 0 || tracknum > CD_MAX_TRACKS)
return CHDERR_INVALID_DATA;
track = &toc->tracks[tracknum - 1];
}
else
{
err = chd_get_metadata(chd, CDROM_TRACK_METADATA2_TAG, toc->numtrks, metadata, sizeof(metadata), NULL, NULL, NULL);
if (err != CHDERR_NONE)
break;
type[0] = subtype[0] = 0;
pregap = postgap = 0;
if (sscanf(metadata, CDROM_TRACK_METADATA2_FORMAT, &tracknum, type, subtype, &frames, &pregap, pgtype, pgsub, &postgap) != 8)
return CHDERR_INVALID_DATA;
if (tracknum == 0 || tracknum > CD_MAX_TRACKS)
return CHDERR_INVALID_DATA;
track = &toc->tracks[tracknum - 1];
}
track->trktype = CD_TRACK_MODE1;
track->datasize = 0;
cdrom_convert_type_string_to_track_info(type, track);
if (track->datasize == 0)
return CHDERR_INVALID_DATA;
track->subtype = CD_SUB_NONE;
track->subsize = 0;
cdrom_convert_subtype_string_to_track_info(subtype, track);
track->frames = frames;
hunks = (frames + hunksectors - 1) / hunksectors;
track->extraframes = hunks * hunksectors - frames;
track->pregap = pregap;
track->pgtype = CD_TRACK_MODE1;
track->pgsub = CD_SUB_NONE;
track->pgdatasize = 0;
track->pgsubsize = 0;
cdrom_convert_type_string_to_pregap_info(pgtype, track);
cdrom_convert_subtype_string_to_pregap_info(pgsub, track);
}
if (toc->numtrks > 0)
return CHDERR_NONE;
err = chd_get_metadata(chd, CDROM_OLD_METADATA_TAG, 0, oldmetadata, sizeof(oldmetadata), NULL, NULL, NULL);
if (err != CHDERR_NONE)
return err;
mrp = &oldmetadata[0];
toc->numtrks = *mrp++;
for (i = 0; i < CD_MAX_TRACKS; i++)
{
toc->tracks[i].trktype = *mrp++;
toc->tracks[i].subtype = *mrp++;
toc->tracks[i].datasize = *mrp++;
toc->tracks[i].subsize = *mrp++;
toc->tracks[i].frames = *mrp++;
toc->tracks[i].extraframes = *mrp++;
}
if ((toc->numtrks < 0) || (toc->numtrks > CD_MAX_TRACKS))
{
toc->numtrks = FLIPENDIAN_INT32(toc->numtrks);
for (i = 0; i < CD_MAX_TRACKS; i++)
{
toc->tracks[i].trktype = FLIPENDIAN_INT32(toc->tracks[i].trktype);
toc->tracks[i].subtype = FLIPENDIAN_INT32(toc->tracks[i].subtype);
toc->tracks[i].datasize = FLIPENDIAN_INT32(toc->tracks[i].datasize);
toc->tracks[i].subsize = FLIPENDIAN_INT32(toc->tracks[i].subsize);
toc->tracks[i].frames = FLIPENDIAN_INT32(toc->tracks[i].frames);
toc->tracks[i].extraframes = FLIPENDIAN_INT32(toc->tracks[i].extraframes);
}
}
return CHDERR_NONE;
} | [
"chd_error",
"cdrom_parse_metadata",
"(",
"chd_file",
"*",
"chd",
",",
"cdrom_toc",
"*",
"toc",
")",
"{",
"static",
"UINT32",
"oldmetadata",
"[",
"CD_METADATA_WORDS",
"]",
",",
"*",
"mrp",
";",
"const",
"chd_header",
"*",
"header",
"=",
"chd_get_header",
"(",
"chd",
")",
";",
"UINT32",
"hunksectors",
"=",
"header",
"->",
"hunkbytes",
"/",
"CD_FRAME_SIZE",
";",
"char",
"metadata",
"[",
"512",
"]",
";",
"chd_error",
"err",
";",
"int",
"i",
";",
"for",
"(",
"toc",
"->",
"numtrks",
"=",
"0",
";",
"toc",
"->",
"numtrks",
"<",
"CD_MAX_TRACKS",
";",
"toc",
"->",
"numtrks",
"++",
")",
"{",
"int",
"tracknum",
"=",
"-1",
",",
"frames",
"=",
"0",
",",
"hunks",
",",
"pregap",
",",
"postgap",
";",
"char",
"type",
"[",
"16",
"]",
",",
"subtype",
"[",
"16",
"]",
",",
"pgtype",
"[",
"16",
"]",
",",
"pgsub",
"[",
"16",
"]",
";",
"cdrom_track_info",
"*",
"track",
";",
"pregap",
"=",
"postgap",
"=",
"0",
";",
"err",
"=",
"chd_get_metadata",
"(",
"chd",
",",
"CDROM_TRACK_METADATA_TAG",
",",
"toc",
"->",
"numtrks",
",",
"metadata",
",",
"sizeof",
"(",
"metadata",
")",
",",
"NULL",
",",
"NULL",
",",
"NULL",
")",
";",
"if",
"(",
"err",
"==",
"CHDERR_NONE",
")",
"{",
"type",
"[",
"0",
"]",
"=",
"subtype",
"[",
"0",
"]",
"=",
"0",
";",
"if",
"(",
"sscanf",
"(",
"metadata",
",",
"CDROM_TRACK_METADATA_FORMAT",
",",
"&",
"tracknum",
",",
"type",
",",
"subtype",
",",
"&",
"frames",
")",
"!=",
"4",
")",
"return",
"CHDERR_INVALID_DATA",
";",
"if",
"(",
"tracknum",
"==",
"0",
"||",
"tracknum",
">",
"CD_MAX_TRACKS",
")",
"return",
"CHDERR_INVALID_DATA",
";",
"track",
"=",
"&",
"toc",
"->",
"tracks",
"[",
"tracknum",
"-",
"1",
"]",
";",
"}",
"else",
"{",
"err",
"=",
"chd_get_metadata",
"(",
"chd",
",",
"CDROM_TRACK_METADATA2_TAG",
",",
"toc",
"->",
"numtrks",
",",
"metadata",
",",
"sizeof",
"(",
"metadata",
")",
",",
"NULL",
",",
"NULL",
",",
"NULL",
")",
";",
"if",
"(",
"err",
"!=",
"CHDERR_NONE",
")",
"break",
";",
"type",
"[",
"0",
"]",
"=",
"subtype",
"[",
"0",
"]",
"=",
"0",
";",
"pregap",
"=",
"postgap",
"=",
"0",
";",
"if",
"(",
"sscanf",
"(",
"metadata",
",",
"CDROM_TRACK_METADATA2_FORMAT",
",",
"&",
"tracknum",
",",
"type",
",",
"subtype",
",",
"&",
"frames",
",",
"&",
"pregap",
",",
"pgtype",
",",
"pgsub",
",",
"&",
"postgap",
")",
"!=",
"8",
")",
"return",
"CHDERR_INVALID_DATA",
";",
"if",
"(",
"tracknum",
"==",
"0",
"||",
"tracknum",
">",
"CD_MAX_TRACKS",
")",
"return",
"CHDERR_INVALID_DATA",
";",
"track",
"=",
"&",
"toc",
"->",
"tracks",
"[",
"tracknum",
"-",
"1",
"]",
";",
"}",
"track",
"->",
"trktype",
"=",
"CD_TRACK_MODE1",
";",
"track",
"->",
"datasize",
"=",
"0",
";",
"cdrom_convert_type_string_to_track_info",
"(",
"type",
",",
"track",
")",
";",
"if",
"(",
"track",
"->",
"datasize",
"==",
"0",
")",
"return",
"CHDERR_INVALID_DATA",
";",
"track",
"->",
"subtype",
"=",
"CD_SUB_NONE",
";",
"track",
"->",
"subsize",
"=",
"0",
";",
"cdrom_convert_subtype_string_to_track_info",
"(",
"subtype",
",",
"track",
")",
";",
"track",
"->",
"frames",
"=",
"frames",
";",
"hunks",
"=",
"(",
"frames",
"+",
"hunksectors",
"-",
"1",
")",
"/",
"hunksectors",
";",
"track",
"->",
"extraframes",
"=",
"hunks",
"*",
"hunksectors",
"-",
"frames",
";",
"track",
"->",
"pregap",
"=",
"pregap",
";",
"track",
"->",
"pgtype",
"=",
"CD_TRACK_MODE1",
";",
"track",
"->",
"pgsub",
"=",
"CD_SUB_NONE",
";",
"track",
"->",
"pgdatasize",
"=",
"0",
";",
"track",
"->",
"pgsubsize",
"=",
"0",
";",
"cdrom_convert_type_string_to_pregap_info",
"(",
"pgtype",
",",
"track",
")",
";",
"cdrom_convert_subtype_string_to_pregap_info",
"(",
"pgsub",
",",
"track",
")",
";",
"}",
"if",
"(",
"toc",
"->",
"numtrks",
">",
"0",
")",
"return",
"CHDERR_NONE",
";",
"err",
"=",
"chd_get_metadata",
"(",
"chd",
",",
"CDROM_OLD_METADATA_TAG",
",",
"0",
",",
"oldmetadata",
",",
"sizeof",
"(",
"oldmetadata",
")",
",",
"NULL",
",",
"NULL",
",",
"NULL",
")",
";",
"if",
"(",
"err",
"!=",
"CHDERR_NONE",
")",
"return",
"err",
";",
"mrp",
"=",
"&",
"oldmetadata",
"[",
"0",
"]",
";",
"toc",
"->",
"numtrks",
"=",
"*",
"mrp",
"++",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"CD_MAX_TRACKS",
";",
"i",
"++",
")",
"{",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"trktype",
"=",
"*",
"mrp",
"++",
";",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"subtype",
"=",
"*",
"mrp",
"++",
";",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"datasize",
"=",
"*",
"mrp",
"++",
";",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"subsize",
"=",
"*",
"mrp",
"++",
";",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"frames",
"=",
"*",
"mrp",
"++",
";",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"extraframes",
"=",
"*",
"mrp",
"++",
";",
"}",
"if",
"(",
"(",
"toc",
"->",
"numtrks",
"<",
"0",
")",
"||",
"(",
"toc",
"->",
"numtrks",
">",
"CD_MAX_TRACKS",
")",
")",
"{",
"toc",
"->",
"numtrks",
"=",
"FLIPENDIAN_INT32",
"(",
"toc",
"->",
"numtrks",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"CD_MAX_TRACKS",
";",
"i",
"++",
")",
"{",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"trktype",
"=",
"FLIPENDIAN_INT32",
"(",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"trktype",
")",
";",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"subtype",
"=",
"FLIPENDIAN_INT32",
"(",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"subtype",
")",
";",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"datasize",
"=",
"FLIPENDIAN_INT32",
"(",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"datasize",
")",
";",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"subsize",
"=",
"FLIPENDIAN_INT32",
"(",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"subsize",
")",
";",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"frames",
"=",
"FLIPENDIAN_INT32",
"(",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"frames",
")",
";",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"extraframes",
"=",
"FLIPENDIAN_INT32",
"(",
"toc",
"->",
"tracks",
"[",
"i",
"]",
".",
"extraframes",
")",
";",
"}",
"}",
"return",
"CHDERR_NONE",
";",
"}"
] | cdrom_parse_metadata - parse metadata into the
TOC structure | [
"cdrom_parse_metadata",
"-",
"parse",
"metadata",
"into",
"the",
"TOC",
"structure"
] | [
"/* start with no tracks */",
"/* fetch the metadata for this track */",
"/* parse the metadata */",
"/* parse the metadata */",
"/* extract the track type and determine the data size */",
"/* extract the subtype and determine the subcode data size */",
"/* set the frames and extra frames data */",
"/* set the pregap info */",
"/* if we got any tracks this way, we're done */",
"/* look for old-style metadata */",
"/* reconstruct the TOC from it */",
"/* TODO: I don't know why sometimes the data is one endian and sometimes another */"
] | [
{
"param": "chd",
"type": "chd_file"
},
{
"param": "toc",
"type": "cdrom_toc"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "chd",
"type": "chd_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "toc",
"type": "cdrom_toc",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3c46a328572438f4f9f64412947473c9d48299ab | lofunz/mieme | Reloaded/trunk/src/lib/util/xmlfile.c | [
"Unlicense"
] | C | copystring | char | static const char *copystring(const char *input)
{
char *newstr;
/* NULL just passes through */
if (input == NULL)
return NULL;
/* make a lower-case copy if the allocation worked */
newstr = (char *)malloc(strlen(input) + 1);
if (newstr != NULL)
strcpy(newstr, input);
return newstr;
} | /*-------------------------------------------------
copystring - make an allocated copy of a
string
-------------------------------------------------*/ | make an allocated copy of a
string | [
"make",
"an",
"allocated",
"copy",
"of",
"a",
"string"
] | static const char *copystring(const char *input)
{
char *newstr;
if (input == NULL)
return NULL;
newstr = (char *)malloc(strlen(input) + 1);
if (newstr != NULL)
strcpy(newstr, input);
return newstr;
} | [
"static",
"const",
"char",
"*",
"copystring",
"(",
"const",
"char",
"*",
"input",
")",
"{",
"char",
"*",
"newstr",
";",
"if",
"(",
"input",
"==",
"NULL",
")",
"return",
"NULL",
";",
"newstr",
"=",
"(",
"char",
"*",
")",
"malloc",
"(",
"strlen",
"(",
"input",
")",
"+",
"1",
")",
";",
"if",
"(",
"newstr",
"!=",
"NULL",
")",
"strcpy",
"(",
"newstr",
",",
"input",
")",
";",
"return",
"newstr",
";",
"}"
] | copystring - make an allocated copy of a
string | [
"copystring",
"-",
"make",
"an",
"allocated",
"copy",
"of",
"a",
"string"
] | [
"/* NULL just passes through */",
"/* make a lower-case copy if the allocation worked */"
] | [
{
"param": "input",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3c46a328572438f4f9f64412947473c9d48299ab | lofunz/mieme | Reloaded/trunk/src/lib/util/xmlfile.c | [
"Unlicense"
] | C | copystring_lower | char | static const char *copystring_lower(const char *input)
{
char *newstr;
int i;
/* NULL just passes through */
if (input == NULL)
return NULL;
/* make a lower-case copy if the allocation worked */
newstr = (char *)malloc(strlen(input) + 1);
if (newstr != NULL)
{
for (i = 0; input[i] != 0; i++)
newstr[i] = tolower((UINT8)input[i]);
newstr[i] = 0;
}
return newstr;
} | /*-------------------------------------------------
copystring_lower - make an allocated copy of
a string and convert it to lowercase along
the way
-------------------------------------------------*/ | make an allocated copy of
a string and convert it to lowercase along
the way | [
"make",
"an",
"allocated",
"copy",
"of",
"a",
"string",
"and",
"convert",
"it",
"to",
"lowercase",
"along",
"the",
"way"
] | static const char *copystring_lower(const char *input)
{
char *newstr;
int i;
if (input == NULL)
return NULL;
newstr = (char *)malloc(strlen(input) + 1);
if (newstr != NULL)
{
for (i = 0; input[i] != 0; i++)
newstr[i] = tolower((UINT8)input[i]);
newstr[i] = 0;
}
return newstr;
} | [
"static",
"const",
"char",
"*",
"copystring_lower",
"(",
"const",
"char",
"*",
"input",
")",
"{",
"char",
"*",
"newstr",
";",
"int",
"i",
";",
"if",
"(",
"input",
"==",
"NULL",
")",
"return",
"NULL",
";",
"newstr",
"=",
"(",
"char",
"*",
")",
"malloc",
"(",
"strlen",
"(",
"input",
")",
"+",
"1",
")",
";",
"if",
"(",
"newstr",
"!=",
"NULL",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"input",
"[",
"i",
"]",
"!=",
"0",
";",
"i",
"++",
")",
"newstr",
"[",
"i",
"]",
"=",
"tolower",
"(",
"(",
"UINT8",
")",
"input",
"[",
"i",
"]",
")",
";",
"newstr",
"[",
"i",
"]",
"=",
"0",
";",
"}",
"return",
"newstr",
";",
"}"
] | copystring_lower - make an allocated copy of
a string and convert it to lowercase along
the way | [
"copystring_lower",
"-",
"make",
"an",
"allocated",
"copy",
"of",
"a",
"string",
"and",
"convert",
"it",
"to",
"lowercase",
"along",
"the",
"way"
] | [
"/* NULL just passes through */",
"/* make a lower-case copy if the allocation worked */"
] | [
{
"param": "input",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3c46a328572438f4f9f64412947473c9d48299ab | lofunz/mieme | Reloaded/trunk/src/lib/util/xmlfile.c | [
"Unlicense"
] | C | xml_file_create | xml_data_node | xml_data_node *xml_file_create(void)
{
xml_data_node *rootnode;
/* create a root node */
rootnode = (xml_data_node *)malloc(sizeof(*rootnode));
if (rootnode == NULL)
return NULL;
memset(rootnode, 0, sizeof(*rootnode));
return rootnode;
} | /*-------------------------------------------------
xml_file_create - create a new xml file
object
-------------------------------------------------*/ | create a new xml file
object | [
"create",
"a",
"new",
"xml",
"file",
"object"
] | xml_data_node *xml_file_create(void)
{
xml_data_node *rootnode;
rootnode = (xml_data_node *)malloc(sizeof(*rootnode));
if (rootnode == NULL)
return NULL;
memset(rootnode, 0, sizeof(*rootnode));
return rootnode;
} | [
"xml_data_node",
"*",
"xml_file_create",
"(",
"void",
")",
"{",
"xml_data_node",
"*",
"rootnode",
";",
"rootnode",
"=",
"(",
"xml_data_node",
"*",
")",
"malloc",
"(",
"sizeof",
"(",
"*",
"rootnode",
")",
")",
";",
"if",
"(",
"rootnode",
"==",
"NULL",
")",
"return",
"NULL",
";",
"memset",
"(",
"rootnode",
",",
"0",
",",
"sizeof",
"(",
"*",
"rootnode",
")",
")",
";",
"return",
"rootnode",
";",
"}"
] | xml_file_create - create a new xml file
object | [
"xml_file_create",
"-",
"create",
"a",
"new",
"xml",
"file",
"object"
] | [
"/* create a root node */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3c46a328572438f4f9f64412947473c9d48299ab | lofunz/mieme | Reloaded/trunk/src/lib/util/xmlfile.c | [
"Unlicense"
] | C | xml_file_read | xml_data_node | xml_data_node *xml_file_read(core_file *file, xml_parse_options *opts)
{
xml_parse_info parse_info;
int done;
/* set up the parser */
if (!expat_setup_parser(&parse_info, opts))
return NULL;
/* loop through the file and parse it */
do
{
char tempbuf[TEMP_BUFFER_SIZE];
/* read as much as we can */
int bytes = core_fread(file, tempbuf, sizeof(tempbuf));
done = core_feof(file);
/* parse the data */
if (XML_Parse(parse_info.parser, tempbuf, bytes, done) == XML_STATUS_ERROR)
{
if (opts != NULL && opts->error != NULL)
{
opts->error->error_message = XML_ErrorString(XML_GetErrorCode(parse_info.parser));
opts->error->error_line = XML_GetCurrentLineNumber(parse_info.parser);
opts->error->error_column = XML_GetCurrentColumnNumber(parse_info.parser);
}
xml_file_free(parse_info.rootnode);
XML_ParserFree(parse_info.parser);
return NULL;
}
} while (!done);
/* free the parser */
XML_ParserFree(parse_info.parser);
/* return the root node */
return parse_info.rootnode;
} | /*-------------------------------------------------
xml_file_read - parse an XML file into its
nodes
-------------------------------------------------*/ | parse an XML file into its
nodes | [
"parse",
"an",
"XML",
"file",
"into",
"its",
"nodes"
] | xml_data_node *xml_file_read(core_file *file, xml_parse_options *opts)
{
xml_parse_info parse_info;
int done;
if (!expat_setup_parser(&parse_info, opts))
return NULL;
do
{
char tempbuf[TEMP_BUFFER_SIZE];
int bytes = core_fread(file, tempbuf, sizeof(tempbuf));
done = core_feof(file);
if (XML_Parse(parse_info.parser, tempbuf, bytes, done) == XML_STATUS_ERROR)
{
if (opts != NULL && opts->error != NULL)
{
opts->error->error_message = XML_ErrorString(XML_GetErrorCode(parse_info.parser));
opts->error->error_line = XML_GetCurrentLineNumber(parse_info.parser);
opts->error->error_column = XML_GetCurrentColumnNumber(parse_info.parser);
}
xml_file_free(parse_info.rootnode);
XML_ParserFree(parse_info.parser);
return NULL;
}
} while (!done);
XML_ParserFree(parse_info.parser);
return parse_info.rootnode;
} | [
"xml_data_node",
"*",
"xml_file_read",
"(",
"core_file",
"*",
"file",
",",
"xml_parse_options",
"*",
"opts",
")",
"{",
"xml_parse_info",
"parse_info",
";",
"int",
"done",
";",
"if",
"(",
"!",
"expat_setup_parser",
"(",
"&",
"parse_info",
",",
"opts",
")",
")",
"return",
"NULL",
";",
"do",
"{",
"char",
"tempbuf",
"[",
"TEMP_BUFFER_SIZE",
"]",
";",
"int",
"bytes",
"=",
"core_fread",
"(",
"file",
",",
"tempbuf",
",",
"sizeof",
"(",
"tempbuf",
")",
")",
";",
"done",
"=",
"core_feof",
"(",
"file",
")",
";",
"if",
"(",
"XML_Parse",
"(",
"parse_info",
".",
"parser",
",",
"tempbuf",
",",
"bytes",
",",
"done",
")",
"==",
"XML_STATUS_ERROR",
")",
"{",
"if",
"(",
"opts",
"!=",
"NULL",
"&&",
"opts",
"->",
"error",
"!=",
"NULL",
")",
"{",
"opts",
"->",
"error",
"->",
"error_message",
"=",
"XML_ErrorString",
"(",
"XML_GetErrorCode",
"(",
"parse_info",
".",
"parser",
")",
")",
";",
"opts",
"->",
"error",
"->",
"error_line",
"=",
"XML_GetCurrentLineNumber",
"(",
"parse_info",
".",
"parser",
")",
";",
"opts",
"->",
"error",
"->",
"error_column",
"=",
"XML_GetCurrentColumnNumber",
"(",
"parse_info",
".",
"parser",
")",
";",
"}",
"xml_file_free",
"(",
"parse_info",
".",
"rootnode",
")",
";",
"XML_ParserFree",
"(",
"parse_info",
".",
"parser",
")",
";",
"return",
"NULL",
";",
"}",
"}",
"while",
"(",
"!",
"done",
")",
";",
"XML_ParserFree",
"(",
"parse_info",
".",
"parser",
")",
";",
"return",
"parse_info",
".",
"rootnode",
";",
"}"
] | xml_file_read - parse an XML file into its
nodes | [
"xml_file_read",
"-",
"parse",
"an",
"XML",
"file",
"into",
"its",
"nodes"
] | [
"/* set up the parser */",
"/* loop through the file and parse it */",
"/* read as much as we can */",
"/* parse the data */",
"/* free the parser */",
"/* return the root node */"
] | [
{
"param": "file",
"type": "core_file"
},
{
"param": "opts",
"type": "xml_parse_options"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "core_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "opts",
"type": "xml_parse_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3c46a328572438f4f9f64412947473c9d48299ab | lofunz/mieme | Reloaded/trunk/src/lib/util/xmlfile.c | [
"Unlicense"
] | C | xml_string_read | xml_data_node | xml_data_node *xml_string_read(const char *string, xml_parse_options *opts)
{
xml_parse_info parse_info;
int length = (int)strlen(string);
/* set up the parser */
if (!expat_setup_parser(&parse_info, opts))
return NULL;
/* parse the data */
if (XML_Parse(parse_info.parser, string, length, TRUE) == XML_STATUS_ERROR)
{
if (opts != NULL && opts->error != NULL)
{
opts->error->error_message = XML_ErrorString(XML_GetErrorCode(parse_info.parser));
opts->error->error_line = XML_GetCurrentLineNumber(parse_info.parser);
opts->error->error_column = XML_GetCurrentColumnNumber(parse_info.parser);
}
xml_file_free(parse_info.rootnode);
XML_ParserFree(parse_info.parser);
return NULL;
}
/* free the parser */
XML_ParserFree(parse_info.parser);
/* return the root node */
return parse_info.rootnode;
} | /*-------------------------------------------------
xml_string_read - parse an XML string into its
nodes
-------------------------------------------------*/ | parse an XML string into its
nodes | [
"parse",
"an",
"XML",
"string",
"into",
"its",
"nodes"
] | xml_data_node *xml_string_read(const char *string, xml_parse_options *opts)
{
xml_parse_info parse_info;
int length = (int)strlen(string);
if (!expat_setup_parser(&parse_info, opts))
return NULL;
if (XML_Parse(parse_info.parser, string, length, TRUE) == XML_STATUS_ERROR)
{
if (opts != NULL && opts->error != NULL)
{
opts->error->error_message = XML_ErrorString(XML_GetErrorCode(parse_info.parser));
opts->error->error_line = XML_GetCurrentLineNumber(parse_info.parser);
opts->error->error_column = XML_GetCurrentColumnNumber(parse_info.parser);
}
xml_file_free(parse_info.rootnode);
XML_ParserFree(parse_info.parser);
return NULL;
}
XML_ParserFree(parse_info.parser);
return parse_info.rootnode;
} | [
"xml_data_node",
"*",
"xml_string_read",
"(",
"const",
"char",
"*",
"string",
",",
"xml_parse_options",
"*",
"opts",
")",
"{",
"xml_parse_info",
"parse_info",
";",
"int",
"length",
"=",
"(",
"int",
")",
"strlen",
"(",
"string",
")",
";",
"if",
"(",
"!",
"expat_setup_parser",
"(",
"&",
"parse_info",
",",
"opts",
")",
")",
"return",
"NULL",
";",
"if",
"(",
"XML_Parse",
"(",
"parse_info",
".",
"parser",
",",
"string",
",",
"length",
",",
"TRUE",
")",
"==",
"XML_STATUS_ERROR",
")",
"{",
"if",
"(",
"opts",
"!=",
"NULL",
"&&",
"opts",
"->",
"error",
"!=",
"NULL",
")",
"{",
"opts",
"->",
"error",
"->",
"error_message",
"=",
"XML_ErrorString",
"(",
"XML_GetErrorCode",
"(",
"parse_info",
".",
"parser",
")",
")",
";",
"opts",
"->",
"error",
"->",
"error_line",
"=",
"XML_GetCurrentLineNumber",
"(",
"parse_info",
".",
"parser",
")",
";",
"opts",
"->",
"error",
"->",
"error_column",
"=",
"XML_GetCurrentColumnNumber",
"(",
"parse_info",
".",
"parser",
")",
";",
"}",
"xml_file_free",
"(",
"parse_info",
".",
"rootnode",
")",
";",
"XML_ParserFree",
"(",
"parse_info",
".",
"parser",
")",
";",
"return",
"NULL",
";",
"}",
"XML_ParserFree",
"(",
"parse_info",
".",
"parser",
")",
";",
"return",
"parse_info",
".",
"rootnode",
";",
"}"
] | xml_string_read - parse an XML string into its
nodes | [
"xml_string_read",
"-",
"parse",
"an",
"XML",
"string",
"into",
"its",
"nodes"
] | [
"/* set up the parser */",
"/* parse the data */",
"/* free the parser */",
"/* return the root node */"
] | [
{
"param": "string",
"type": "char"
},
{
"param": "opts",
"type": "xml_parse_options"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "string",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "opts",
"type": "xml_parse_options",
"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.