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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f08d4faea9078af6cfe316fec86d7cdea6e9e3ab | lofunz/mieme | Reloaded/trunk/src/emu/render.c | [
"Unlicense"
] | C | render_container_set_user_settings | void | void render_container_set_user_settings(render_container *container, const render_container_user_settings *settings)
{
container->orientation = settings->orientation;
container->brightness = settings->brightness;
container->contrast = settings->contrast;
container->gamma = settings->gamma;
container->xscale = settings->xscale;
container->yscale = settings->yscale;
container->xoffset = settings->xoffset;
container->yoffset = settings->yoffset;
render_container_recompute_lookups(container);
} | /*-------------------------------------------------
render_container_set_user_settings - set the
current user settings for a container
-------------------------------------------------*/ | set the
current user settings for a container | [
"set",
"the",
"current",
"user",
"settings",
"for",
"a",
"container"
] | void render_container_set_user_settings(render_container *container, const render_container_user_settings *settings)
{
container->orientation = settings->orientation;
container->brightness = settings->brightness;
container->contrast = settings->contrast;
container->gamma = settings->gamma;
container->xscale = settings->xscale;
container->yscale = settings->yscale;
container->xoffset = settings->xoffset;
container->yoffset = settings->yoffset;
render_container_recompute_lookups(container);
} | [
"void",
"render_container_set_user_settings",
"(",
"render_container",
"*",
"container",
",",
"const",
"render_container_user_settings",
"*",
"settings",
")",
"{",
"container",
"->",
"orientation",
"=",
"settings",
"->",
"orientation",
";",
"container",
"->",
"brightness",
"=",
"settings",
"->",
"brightness",
";",
"container",
"->",
"contrast",
"=",
"settings",
"->",
"contrast",
";",
"container",
"->",
"gamma",
"=",
"settings",
"->",
"gamma",
";",
"container",
"->",
"xscale",
"=",
"settings",
"->",
"xscale",
";",
"container",
"->",
"yscale",
"=",
"settings",
"->",
"yscale",
";",
"container",
"->",
"xoffset",
"=",
"settings",
"->",
"xoffset",
";",
"container",
"->",
"yoffset",
"=",
"settings",
"->",
"yoffset",
";",
"render_container_recompute_lookups",
"(",
"container",
")",
";",
"}"
] | render_container_set_user_settings - set the
current user settings for a container | [
"render_container_set_user_settings",
"-",
"set",
"the",
"current",
"user",
"settings",
"for",
"a",
"container"
] | [] | [
{
"param": "container",
"type": "render_container"
},
{
"param": "settings",
"type": "render_container_user_settings"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "container",
"type": "render_container",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "settings",
"type": "render_container_user_settings",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f08d4faea9078af6cfe316fec86d7cdea6e9e3ab | lofunz/mieme | Reloaded/trunk/src/emu/render.c | [
"Unlicense"
] | C | render_container_set_overlay | void | void render_container_set_overlay(render_container *container, bitmap_t *bitmap)
{
/* free any existing texture */
if (container->overlaytexture != NULL)
render_texture_free(container->overlaytexture);
/* set the new data and allocate the texture */
container->overlaybitmap = bitmap;
if (container->overlaybitmap != NULL)
{
container->overlaytexture = render_texture_alloc(render_container_overlay_scale, NULL);
render_texture_set_bitmap(container->overlaytexture, bitmap, NULL, TEXFORMAT_ARGB32, NULL);
}
} | /*-------------------------------------------------
render_container_set_overlay - set the
overlay bitmap for the container
-------------------------------------------------*/ | set the
overlay bitmap for the container | [
"set",
"the",
"overlay",
"bitmap",
"for",
"the",
"container"
] | void render_container_set_overlay(render_container *container, bitmap_t *bitmap)
{
if (container->overlaytexture != NULL)
render_texture_free(container->overlaytexture);
container->overlaybitmap = bitmap;
if (container->overlaybitmap != NULL)
{
container->overlaytexture = render_texture_alloc(render_container_overlay_scale, NULL);
render_texture_set_bitmap(container->overlaytexture, bitmap, NULL, TEXFORMAT_ARGB32, NULL);
}
} | [
"void",
"render_container_set_overlay",
"(",
"render_container",
"*",
"container",
",",
"bitmap_t",
"*",
"bitmap",
")",
"{",
"if",
"(",
"container",
"->",
"overlaytexture",
"!=",
"NULL",
")",
"render_texture_free",
"(",
"container",
"->",
"overlaytexture",
")",
";",
"container",
"->",
"overlaybitmap",
"=",
"bitmap",
";",
"if",
"(",
"container",
"->",
"overlaybitmap",
"!=",
"NULL",
")",
"{",
"container",
"->",
"overlaytexture",
"=",
"render_texture_alloc",
"(",
"render_container_overlay_scale",
",",
"NULL",
")",
";",
"render_texture_set_bitmap",
"(",
"container",
"->",
"overlaytexture",
",",
"bitmap",
",",
"NULL",
",",
"TEXFORMAT_ARGB32",
",",
"NULL",
")",
";",
"}",
"}"
] | render_container_set_overlay - set the
overlay bitmap for the container | [
"render_container_set_overlay",
"-",
"set",
"the",
"overlay",
"bitmap",
"for",
"the",
"container"
] | [
"/* free any existing texture */",
"/* set the new data and allocate the texture */"
] | [
{
"param": "container",
"type": "render_container"
},
{
"param": "bitmap",
"type": "bitmap_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "container",
"type": "render_container",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f08d4faea9078af6cfe316fec86d7cdea6e9e3ab | lofunz/mieme | Reloaded/trunk/src/emu/render.c | [
"Unlicense"
] | C | render_container_get_screen | render_container | render_container *render_container_get_screen(screen_device *screen)
{
render_container *container;
assert(screen != NULL);
/* get the container for the screen device */
for (container = screen_container_list; container != NULL; container = container->next)
if (container->screen == screen)
break;
assert(container != NULL);
return container;
} | /*-------------------------------------------------
render_container_get_screen - return a pointer
to the screen container for this device
-------------------------------------------------*/ | return a pointer
to the screen container for this device | [
"return",
"a",
"pointer",
"to",
"the",
"screen",
"container",
"for",
"this",
"device"
] | render_container *render_container_get_screen(screen_device *screen)
{
render_container *container;
assert(screen != NULL);
for (container = screen_container_list; container != NULL; container = container->next)
if (container->screen == screen)
break;
assert(container != NULL);
return container;
} | [
"render_container",
"*",
"render_container_get_screen",
"(",
"screen_device",
"*",
"screen",
")",
"{",
"render_container",
"*",
"container",
";",
"assert",
"(",
"screen",
"!=",
"NULL",
")",
";",
"for",
"(",
"container",
"=",
"screen_container_list",
";",
"container",
"!=",
"NULL",
";",
"container",
"=",
"container",
"->",
"next",
")",
"if",
"(",
"container",
"->",
"screen",
"==",
"screen",
")",
"break",
";",
"assert",
"(",
"container",
"!=",
"NULL",
")",
";",
"return",
"container",
";",
"}"
] | render_container_get_screen - return a pointer
to the screen container for this device | [
"render_container_get_screen",
"-",
"return",
"a",
"pointer",
"to",
"the",
"screen",
"container",
"for",
"this",
"device"
] | [
"/* get the container for the screen device */"
] | [
{
"param": "screen",
"type": "screen_device"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "screen",
"type": "screen_device",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f08d4faea9078af6cfe316fec86d7cdea6e9e3ab | lofunz/mieme | Reloaded/trunk/src/emu/render.c | [
"Unlicense"
] | C | render_container_add_char | void | void render_container_add_char(render_container *container, float x0, float y0, float height, float aspect, rgb_t argb, render_font *font, UINT16 ch)
{
render_texture *texture;
render_bounds bounds;
container_item *item;
/* compute the bounds of the character cell and get the texture */
bounds.x0 = x0;
bounds.y0 = y0;
texture = render_font_get_char_texture_and_bounds(font, height, aspect, ch, &bounds);
/* add it like a quad */
item = render_container_item_add_generic(container, CONTAINER_ITEM_QUAD, bounds.x0, bounds.y0, bounds.x1, bounds.y1, argb);
item->texture = texture;
item->flags = PRIMFLAG_TEXORIENT(ROT0) | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA);
item->internal = INTERNAL_FLAG_CHAR;
} | /*-------------------------------------------------
render_container_add_char - add a char item
to the specified container
-------------------------------------------------*/ | add a char item
to the specified container | [
"add",
"a",
"char",
"item",
"to",
"the",
"specified",
"container"
] | void render_container_add_char(render_container *container, float x0, float y0, float height, float aspect, rgb_t argb, render_font *font, UINT16 ch)
{
render_texture *texture;
render_bounds bounds;
container_item *item;
bounds.x0 = x0;
bounds.y0 = y0;
texture = render_font_get_char_texture_and_bounds(font, height, aspect, ch, &bounds);
item = render_container_item_add_generic(container, CONTAINER_ITEM_QUAD, bounds.x0, bounds.y0, bounds.x1, bounds.y1, argb);
item->texture = texture;
item->flags = PRIMFLAG_TEXORIENT(ROT0) | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA);
item->internal = INTERNAL_FLAG_CHAR;
} | [
"void",
"render_container_add_char",
"(",
"render_container",
"*",
"container",
",",
"float",
"x0",
",",
"float",
"y0",
",",
"float",
"height",
",",
"float",
"aspect",
",",
"rgb_t",
"argb",
",",
"render_font",
"*",
"font",
",",
"UINT16",
"ch",
")",
"{",
"render_texture",
"*",
"texture",
";",
"render_bounds",
"bounds",
";",
"container_item",
"*",
"item",
";",
"bounds",
".",
"x0",
"=",
"x0",
";",
"bounds",
".",
"y0",
"=",
"y0",
";",
"texture",
"=",
"render_font_get_char_texture_and_bounds",
"(",
"font",
",",
"height",
",",
"aspect",
",",
"ch",
",",
"&",
"bounds",
")",
";",
"item",
"=",
"render_container_item_add_generic",
"(",
"container",
",",
"CONTAINER_ITEM_QUAD",
",",
"bounds",
".",
"x0",
",",
"bounds",
".",
"y0",
",",
"bounds",
".",
"x1",
",",
"bounds",
".",
"y1",
",",
"argb",
")",
";",
"item",
"->",
"texture",
"=",
"texture",
";",
"item",
"->",
"flags",
"=",
"PRIMFLAG_TEXORIENT",
"(",
"ROT0",
")",
"|",
"PRIMFLAG_BLENDMODE",
"(",
"BLENDMODE_ALPHA",
")",
";",
"item",
"->",
"internal",
"=",
"INTERNAL_FLAG_CHAR",
";",
"}"
] | render_container_add_char - add a char item
to the specified container | [
"render_container_add_char",
"-",
"add",
"a",
"char",
"item",
"to",
"the",
"specified",
"container"
] | [
"/* compute the bounds of the character cell and get the texture */",
"/* add it like a quad */"
] | [
{
"param": "container",
"type": "render_container"
},
{
"param": "x0",
"type": "float"
},
{
"param": "y0",
"type": "float"
},
{
"param": "height",
"type": "float"
},
{
"param": "aspect",
"type": "float"
},
{
"param": "argb",
"type": "rgb_t"
},
{
"param": "font",
"type": "render_font"
},
{
"param": "ch",
"type": "UINT16"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "container",
"type": "render_container",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x0",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y0",
"type": "float",
"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": "argb",
"type": "rgb_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "font",
"type": "render_font",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ch",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f08d4faea9078af6cfe316fec86d7cdea6e9e3ab | lofunz/mieme | Reloaded/trunk/src/emu/render.c | [
"Unlicense"
] | C | render_container_recompute_lookups | void | static void render_container_recompute_lookups(render_container *container)
{
int i;
/* recompute the 256 entry lookup table */
for (i = 0; i < 0x100; i++)
{
UINT8 adjustedval = apply_brightness_contrast_gamma(i, container->brightness, container->contrast, container->gamma);
container->bcglookup256[i + 0x000] = adjustedval << 0;
container->bcglookup256[i + 0x100] = adjustedval << 8;
container->bcglookup256[i + 0x200] = adjustedval << 16;
container->bcglookup256[i + 0x300] = adjustedval << 24;
}
/* recompute the 32 entry lookup table */
for (i = 0; i < 0x20; i++)
{
UINT8 adjustedval = apply_brightness_contrast_gamma(pal5bit(i), container->brightness, container->contrast, container->gamma);
container->bcglookup32[i + 0x000] = adjustedval << 0;
container->bcglookup32[i + 0x020] = adjustedval << 8;
container->bcglookup32[i + 0x040] = adjustedval << 16;
container->bcglookup32[i + 0x060] = adjustedval << 24;
}
/* recompute the palette entries */
if (container->palclient != NULL)
{
palette_t *palette = palette_client_get_palette(container->palclient);
const pen_t *adjusted_palette = palette_entry_list_adjusted(palette);
int colors = palette_get_num_colors(palette) * palette_get_num_groups(palette);
for (i = 0; i < colors; i++)
{
pen_t newval = adjusted_palette[i];
container->bcglookup[i] = (newval & 0xff000000) |
container->bcglookup256[0x200 + RGB_RED(newval)] |
container->bcglookup256[0x100 + RGB_GREEN(newval)] |
container->bcglookup256[0x000 + RGB_BLUE(newval)];
}
}
} | /*-------------------------------------------------
render_container_recompute_lookups - recompute
the lookup table for the render container
-------------------------------------------------*/ | recompute
the lookup table for the render container | [
"recompute",
"the",
"lookup",
"table",
"for",
"the",
"render",
"container"
] | static void render_container_recompute_lookups(render_container *container)
{
int i;
for (i = 0; i < 0x100; i++)
{
UINT8 adjustedval = apply_brightness_contrast_gamma(i, container->brightness, container->contrast, container->gamma);
container->bcglookup256[i + 0x000] = adjustedval << 0;
container->bcglookup256[i + 0x100] = adjustedval << 8;
container->bcglookup256[i + 0x200] = adjustedval << 16;
container->bcglookup256[i + 0x300] = adjustedval << 24;
}
for (i = 0; i < 0x20; i++)
{
UINT8 adjustedval = apply_brightness_contrast_gamma(pal5bit(i), container->brightness, container->contrast, container->gamma);
container->bcglookup32[i + 0x000] = adjustedval << 0;
container->bcglookup32[i + 0x020] = adjustedval << 8;
container->bcglookup32[i + 0x040] = adjustedval << 16;
container->bcglookup32[i + 0x060] = adjustedval << 24;
}
if (container->palclient != NULL)
{
palette_t *palette = palette_client_get_palette(container->palclient);
const pen_t *adjusted_palette = palette_entry_list_adjusted(palette);
int colors = palette_get_num_colors(palette) * palette_get_num_groups(palette);
for (i = 0; i < colors; i++)
{
pen_t newval = adjusted_palette[i];
container->bcglookup[i] = (newval & 0xff000000) |
container->bcglookup256[0x200 + RGB_RED(newval)] |
container->bcglookup256[0x100 + RGB_GREEN(newval)] |
container->bcglookup256[0x000 + RGB_BLUE(newval)];
}
}
} | [
"static",
"void",
"render_container_recompute_lookups",
"(",
"render_container",
"*",
"container",
")",
"{",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"0x100",
";",
"i",
"++",
")",
"{",
"UINT8",
"adjustedval",
"=",
"apply_brightness_contrast_gamma",
"(",
"i",
",",
"container",
"->",
"brightness",
",",
"container",
"->",
"contrast",
",",
"container",
"->",
"gamma",
")",
";",
"container",
"->",
"bcglookup256",
"[",
"i",
"+",
"0x000",
"]",
"=",
"adjustedval",
"<<",
"0",
";",
"container",
"->",
"bcglookup256",
"[",
"i",
"+",
"0x100",
"]",
"=",
"adjustedval",
"<<",
"8",
";",
"container",
"->",
"bcglookup256",
"[",
"i",
"+",
"0x200",
"]",
"=",
"adjustedval",
"<<",
"16",
";",
"container",
"->",
"bcglookup256",
"[",
"i",
"+",
"0x300",
"]",
"=",
"adjustedval",
"<<",
"24",
";",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"0x20",
";",
"i",
"++",
")",
"{",
"UINT8",
"adjustedval",
"=",
"apply_brightness_contrast_gamma",
"(",
"pal5bit",
"(",
"i",
")",
",",
"container",
"->",
"brightness",
",",
"container",
"->",
"contrast",
",",
"container",
"->",
"gamma",
")",
";",
"container",
"->",
"bcglookup32",
"[",
"i",
"+",
"0x000",
"]",
"=",
"adjustedval",
"<<",
"0",
";",
"container",
"->",
"bcglookup32",
"[",
"i",
"+",
"0x020",
"]",
"=",
"adjustedval",
"<<",
"8",
";",
"container",
"->",
"bcglookup32",
"[",
"i",
"+",
"0x040",
"]",
"=",
"adjustedval",
"<<",
"16",
";",
"container",
"->",
"bcglookup32",
"[",
"i",
"+",
"0x060",
"]",
"=",
"adjustedval",
"<<",
"24",
";",
"}",
"if",
"(",
"container",
"->",
"palclient",
"!=",
"NULL",
")",
"{",
"palette_t",
"*",
"palette",
"=",
"palette_client_get_palette",
"(",
"container",
"->",
"palclient",
")",
";",
"const",
"pen_t",
"*",
"adjusted_palette",
"=",
"palette_entry_list_adjusted",
"(",
"palette",
")",
";",
"int",
"colors",
"=",
"palette_get_num_colors",
"(",
"palette",
")",
"*",
"palette_get_num_groups",
"(",
"palette",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"colors",
";",
"i",
"++",
")",
"{",
"pen_t",
"newval",
"=",
"adjusted_palette",
"[",
"i",
"]",
";",
"container",
"->",
"bcglookup",
"[",
"i",
"]",
"=",
"(",
"newval",
"&",
"0xff000000",
")",
"|",
"container",
"->",
"bcglookup256",
"[",
"0x200",
"+",
"RGB_RED",
"(",
"newval",
")",
"]",
"|",
"container",
"->",
"bcglookup256",
"[",
"0x100",
"+",
"RGB_GREEN",
"(",
"newval",
")",
"]",
"|",
"container",
"->",
"bcglookup256",
"[",
"0x000",
"+",
"RGB_BLUE",
"(",
"newval",
")",
"]",
";",
"}",
"}",
"}"
] | render_container_recompute_lookups - recompute
the lookup table for the render container | [
"render_container_recompute_lookups",
"-",
"recompute",
"the",
"lookup",
"table",
"for",
"the",
"render",
"container"
] | [
"/* recompute the 256 entry lookup table */",
"/* recompute the 32 entry lookup table */",
"/* recompute the palette entries */"
] | [
{
"param": "container",
"type": "render_container"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "container",
"type": "render_container",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5be55518c9e5e00d7ab424bb7e0192aad1090818 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/machine/rtc65271.c | [
"Unlicense"
] | C | rtc65271_file_load | int | int rtc65271_file_load(running_machine *machine, mame_file *file)
{
UINT8 buf;
/* version flag */
if (mame_fread(file, & buf, 1) != 1)
return 1;
if (buf != 0)
return 1;
/* control registers */
if (mame_fread(file, &buf, 1) != 1)
return 1;
rtc.regs[reg_A] = buf & (reg_A_DV /*| reg_A_RS*/);
if (mame_fread(file, &buf, 1) != 1)
return 1;
rtc.regs[reg_B] = buf & (reg_B_SET | reg_B_DM | reg_B_24h | reg_B_DSE);
/* alarm registers */
if (mame_fread(file, &rtc.regs[reg_alarm_second], 1) != 1)
return 1;
if (mame_fread(file, &rtc.regs[reg_alarm_minute], 1) != 1)
return 1;
if (mame_fread(file, &rtc.regs[reg_alarm_hour], 1) != 1)
return 1;
/* user RAM */
if (mame_fread(file, rtc.regs+14, 50) != 50)
return 1;
/* extended RAM */
if (mame_fread(file, rtc.xram, 4096) != 4096)
return 1;
rtc.regs[reg_D] |= reg_D_VRT; /* the data was backed up successfully */
/*rtc.dirty = FALSE;*/
{
mame_system_time systime;
/* get the current date/time from the core */
mame_get_current_datetime(machine, &systime);
/* set clock registers */
rtc.regs[reg_second] = systime.local_time.second;
rtc.regs[reg_minute] = systime.local_time.minute;
if (rtc.regs[reg_B] & reg_B_24h)
/* 24-hour mode */
rtc.regs[reg_hour] = systime.local_time.hour;
else
{ /* 12-hour mode */
if (systime.local_time.hour >= 12)
{
rtc.regs[reg_hour] = 0x80;
systime.local_time.hour -= 12;
}
else
rtc.regs[reg_hour] = 0;
rtc.regs[reg_hour] |= systime.local_time.hour ? systime.local_time.hour : 12;
}
rtc.regs[reg_weekday] = systime.local_time.weekday + 1;
rtc.regs[reg_monthday] = systime.local_time.mday;
rtc.regs[reg_month] = systime.local_time.month + 1;
rtc.regs[reg_year] = systime.local_time.year % 100;
if (! (rtc.regs[reg_B] & reg_B_DM))
{ /* BCD mode */
rtc.regs[reg_second] = binary_to_BCD(rtc.regs[reg_second]);
rtc.regs[reg_minute] = binary_to_BCD(rtc.regs[reg_minute]);
rtc.regs[reg_hour] = (rtc.regs[reg_hour] & 0x80) | binary_to_BCD(rtc.regs[reg_hour] & 0x7f);
/*rtc.regs[reg_weekday] = binary_to_BCD(rtc.regs[reg_weekday]);*/
rtc.regs[reg_monthday] = binary_to_BCD(rtc.regs[reg_monthday]);
rtc.regs[reg_month] = binary_to_BCD(rtc.regs[reg_month]);
rtc.regs[reg_year] = binary_to_BCD(rtc.regs[reg_year]);
}
}
return 0;
} | /*
load the SRAM and register contents from file
*/ | load the SRAM and register contents from file | [
"load",
"the",
"SRAM",
"and",
"register",
"contents",
"from",
"file"
] | int rtc65271_file_load(running_machine *machine, mame_file *file)
{
UINT8 buf;
if (mame_fread(file, & buf, 1) != 1)
return 1;
if (buf != 0)
return 1;
if (mame_fread(file, &buf, 1) != 1)
return 1;
rtc.regs[reg_A] = buf & (reg_A_DV );
if (mame_fread(file, &buf, 1) != 1)
return 1;
rtc.regs[reg_B] = buf & (reg_B_SET | reg_B_DM | reg_B_24h | reg_B_DSE);
if (mame_fread(file, &rtc.regs[reg_alarm_second], 1) != 1)
return 1;
if (mame_fread(file, &rtc.regs[reg_alarm_minute], 1) != 1)
return 1;
if (mame_fread(file, &rtc.regs[reg_alarm_hour], 1) != 1)
return 1;
if (mame_fread(file, rtc.regs+14, 50) != 50)
return 1;
if (mame_fread(file, rtc.xram, 4096) != 4096)
return 1;
rtc.regs[reg_D] |= reg_D_VRT;
{
mame_system_time systime;
mame_get_current_datetime(machine, &systime);
rtc.regs[reg_second] = systime.local_time.second;
rtc.regs[reg_minute] = systime.local_time.minute;
if (rtc.regs[reg_B] & reg_B_24h)
rtc.regs[reg_hour] = systime.local_time.hour;
else
{
if (systime.local_time.hour >= 12)
{
rtc.regs[reg_hour] = 0x80;
systime.local_time.hour -= 12;
}
else
rtc.regs[reg_hour] = 0;
rtc.regs[reg_hour] |= systime.local_time.hour ? systime.local_time.hour : 12;
}
rtc.regs[reg_weekday] = systime.local_time.weekday + 1;
rtc.regs[reg_monthday] = systime.local_time.mday;
rtc.regs[reg_month] = systime.local_time.month + 1;
rtc.regs[reg_year] = systime.local_time.year % 100;
if (! (rtc.regs[reg_B] & reg_B_DM))
{
rtc.regs[reg_second] = binary_to_BCD(rtc.regs[reg_second]);
rtc.regs[reg_minute] = binary_to_BCD(rtc.regs[reg_minute]);
rtc.regs[reg_hour] = (rtc.regs[reg_hour] & 0x80) | binary_to_BCD(rtc.regs[reg_hour] & 0x7f);
rtc.regs[reg_monthday] = binary_to_BCD(rtc.regs[reg_monthday]);
rtc.regs[reg_month] = binary_to_BCD(rtc.regs[reg_month]);
rtc.regs[reg_year] = binary_to_BCD(rtc.regs[reg_year]);
}
}
return 0;
} | [
"int",
"rtc65271_file_load",
"(",
"running_machine",
"*",
"machine",
",",
"mame_file",
"*",
"file",
")",
"{",
"UINT8",
"buf",
";",
"if",
"(",
"mame_fread",
"(",
"file",
",",
"&",
"buf",
",",
"1",
")",
"!=",
"1",
")",
"return",
"1",
";",
"if",
"(",
"buf",
"!=",
"0",
")",
"return",
"1",
";",
"if",
"(",
"mame_fread",
"(",
"file",
",",
"&",
"buf",
",",
"1",
")",
"!=",
"1",
")",
"return",
"1",
";",
"rtc",
".",
"regs",
"[",
"reg_A",
"]",
"=",
"buf",
"&",
"(",
"reg_A_DV",
")",
";",
"if",
"(",
"mame_fread",
"(",
"file",
",",
"&",
"buf",
",",
"1",
")",
"!=",
"1",
")",
"return",
"1",
";",
"rtc",
".",
"regs",
"[",
"reg_B",
"]",
"=",
"buf",
"&",
"(",
"reg_B_SET",
"|",
"reg_B_DM",
"|",
"reg_B_24h",
"|",
"reg_B_DSE",
")",
";",
"if",
"(",
"mame_fread",
"(",
"file",
",",
"&",
"rtc",
".",
"regs",
"[",
"reg_alarm_second",
"]",
",",
"1",
")",
"!=",
"1",
")",
"return",
"1",
";",
"if",
"(",
"mame_fread",
"(",
"file",
",",
"&",
"rtc",
".",
"regs",
"[",
"reg_alarm_minute",
"]",
",",
"1",
")",
"!=",
"1",
")",
"return",
"1",
";",
"if",
"(",
"mame_fread",
"(",
"file",
",",
"&",
"rtc",
".",
"regs",
"[",
"reg_alarm_hour",
"]",
",",
"1",
")",
"!=",
"1",
")",
"return",
"1",
";",
"if",
"(",
"mame_fread",
"(",
"file",
",",
"rtc",
".",
"regs",
"+",
"14",
",",
"50",
")",
"!=",
"50",
")",
"return",
"1",
";",
"if",
"(",
"mame_fread",
"(",
"file",
",",
"rtc",
".",
"xram",
",",
"4096",
")",
"!=",
"4096",
")",
"return",
"1",
";",
"rtc",
".",
"regs",
"[",
"reg_D",
"]",
"|=",
"reg_D_VRT",
";",
"{",
"mame_system_time",
"systime",
";",
"mame_get_current_datetime",
"(",
"machine",
",",
"&",
"systime",
")",
";",
"rtc",
".",
"regs",
"[",
"reg_second",
"]",
"=",
"systime",
".",
"local_time",
".",
"second",
";",
"rtc",
".",
"regs",
"[",
"reg_minute",
"]",
"=",
"systime",
".",
"local_time",
".",
"minute",
";",
"if",
"(",
"rtc",
".",
"regs",
"[",
"reg_B",
"]",
"&",
"reg_B_24h",
")",
"rtc",
".",
"regs",
"[",
"reg_hour",
"]",
"=",
"systime",
".",
"local_time",
".",
"hour",
";",
"else",
"{",
"if",
"(",
"systime",
".",
"local_time",
".",
"hour",
">=",
"12",
")",
"{",
"rtc",
".",
"regs",
"[",
"reg_hour",
"]",
"=",
"0x80",
";",
"systime",
".",
"local_time",
".",
"hour",
"-=",
"12",
";",
"}",
"else",
"rtc",
".",
"regs",
"[",
"reg_hour",
"]",
"=",
"0",
";",
"rtc",
".",
"regs",
"[",
"reg_hour",
"]",
"|=",
"systime",
".",
"local_time",
".",
"hour",
"?",
"systime",
".",
"local_time",
".",
"hour",
":",
"12",
";",
"}",
"rtc",
".",
"regs",
"[",
"reg_weekday",
"]",
"=",
"systime",
".",
"local_time",
".",
"weekday",
"+",
"1",
";",
"rtc",
".",
"regs",
"[",
"reg_monthday",
"]",
"=",
"systime",
".",
"local_time",
".",
"mday",
";",
"rtc",
".",
"regs",
"[",
"reg_month",
"]",
"=",
"systime",
".",
"local_time",
".",
"month",
"+",
"1",
";",
"rtc",
".",
"regs",
"[",
"reg_year",
"]",
"=",
"systime",
".",
"local_time",
".",
"year",
"%",
"100",
";",
"if",
"(",
"!",
"(",
"rtc",
".",
"regs",
"[",
"reg_B",
"]",
"&",
"reg_B_DM",
")",
")",
"{",
"rtc",
".",
"regs",
"[",
"reg_second",
"]",
"=",
"binary_to_BCD",
"(",
"rtc",
".",
"regs",
"[",
"reg_second",
"]",
")",
";",
"rtc",
".",
"regs",
"[",
"reg_minute",
"]",
"=",
"binary_to_BCD",
"(",
"rtc",
".",
"regs",
"[",
"reg_minute",
"]",
")",
";",
"rtc",
".",
"regs",
"[",
"reg_hour",
"]",
"=",
"(",
"rtc",
".",
"regs",
"[",
"reg_hour",
"]",
"&",
"0x80",
")",
"|",
"binary_to_BCD",
"(",
"rtc",
".",
"regs",
"[",
"reg_hour",
"]",
"&",
"0x7f",
")",
";",
"rtc",
".",
"regs",
"[",
"reg_monthday",
"]",
"=",
"binary_to_BCD",
"(",
"rtc",
".",
"regs",
"[",
"reg_monthday",
"]",
")",
";",
"rtc",
".",
"regs",
"[",
"reg_month",
"]",
"=",
"binary_to_BCD",
"(",
"rtc",
".",
"regs",
"[",
"reg_month",
"]",
")",
";",
"rtc",
".",
"regs",
"[",
"reg_year",
"]",
"=",
"binary_to_BCD",
"(",
"rtc",
".",
"regs",
"[",
"reg_year",
"]",
")",
";",
"}",
"}",
"return",
"0",
";",
"}"
] | load the SRAM and register contents from file | [
"load",
"the",
"SRAM",
"and",
"register",
"contents",
"from",
"file"
] | [
"/* version flag */",
"/* control registers */",
"/*| reg_A_RS*/",
"/* alarm registers */",
"/* user RAM */",
"/* extended RAM */",
"/* the data was backed up successfully */",
"/*rtc.dirty = FALSE;*/",
"/* get the current date/time from the core */",
"/* set clock registers */",
"/* 24-hour mode */",
"/* 12-hour mode */",
"/* BCD mode */",
"/*rtc.regs[reg_weekday] = binary_to_BCD(rtc.regs[reg_weekday]);*/"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "file",
"type": "mame_file"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file",
"type": "mame_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5be55518c9e5e00d7ab424bb7e0192aad1090818 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/machine/rtc65271.c | [
"Unlicense"
] | C | rtc65271_init | void | void rtc65271_init(running_machine *machine, UINT8 *xram, void (*interrupt_callback)(running_machine *machine, int state))
{
memset(&rtc, 0, sizeof(rtc));
rtc.machine = machine;
rtc.xram = xram;
rtc.update_timer = timer_alloc(machine, rtc_begin_update_callback, NULL);
timer_adjust_periodic(rtc.update_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1));
rtc.SQW_timer = timer_alloc(machine, rtc_SQW_callback, NULL);
rtc.interrupt_callback = interrupt_callback;
} | /*
Initialize clock
xram: pointer to 4kb RAM area
interrupt_callback: callback called when interrupt pin state changes (may
be NULL)
*/ | Initialize clock
xram: pointer to 4kb RAM area
interrupt_callback: callback called when interrupt pin state changes (may
be NULL) | [
"Initialize",
"clock",
"xram",
":",
"pointer",
"to",
"4kb",
"RAM",
"area",
"interrupt_callback",
":",
"callback",
"called",
"when",
"interrupt",
"pin",
"state",
"changes",
"(",
"may",
"be",
"NULL",
")"
] | void rtc65271_init(running_machine *machine, UINT8 *xram, void (*interrupt_callback)(running_machine *machine, int state))
{
memset(&rtc, 0, sizeof(rtc));
rtc.machine = machine;
rtc.xram = xram;
rtc.update_timer = timer_alloc(machine, rtc_begin_update_callback, NULL);
timer_adjust_periodic(rtc.update_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1));
rtc.SQW_timer = timer_alloc(machine, rtc_SQW_callback, NULL);
rtc.interrupt_callback = interrupt_callback;
} | [
"void",
"rtc65271_init",
"(",
"running_machine",
"*",
"machine",
",",
"UINT8",
"*",
"xram",
",",
"void",
"(",
"*",
"interrupt_callback",
")",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"state",
")",
")",
"{",
"memset",
"(",
"&",
"rtc",
",",
"0",
",",
"sizeof",
"(",
"rtc",
")",
")",
";",
"rtc",
".",
"machine",
"=",
"machine",
";",
"rtc",
".",
"xram",
"=",
"xram",
";",
"rtc",
".",
"update_timer",
"=",
"timer_alloc",
"(",
"machine",
",",
"rtc_begin_update_callback",
",",
"NULL",
")",
";",
"timer_adjust_periodic",
"(",
"rtc",
".",
"update_timer",
",",
"ATTOTIME_IN_SEC",
"(",
"1",
")",
",",
"0",
",",
"ATTOTIME_IN_SEC",
"(",
"1",
")",
")",
";",
"rtc",
".",
"SQW_timer",
"=",
"timer_alloc",
"(",
"machine",
",",
"rtc_SQW_callback",
",",
"NULL",
")",
";",
"rtc",
".",
"interrupt_callback",
"=",
"interrupt_callback",
";",
"}"
] | Initialize clock
xram: pointer to 4kb RAM area
interrupt_callback: callback called when interrupt pin state changes (may
be NULL) | [
"Initialize",
"clock",
"xram",
":",
"pointer",
"to",
"4kb",
"RAM",
"area",
"interrupt_callback",
":",
"callback",
"called",
"when",
"interrupt",
"pin",
"state",
"changes",
"(",
"may",
"be",
"NULL",
")"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "xram",
"type": "UINT8"
},
{
"param": "interrupt_callback",
"type": "void"
},
{
"param": "state",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xram",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "interrupt_callback",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
195b0a827b2da0718e5a061fc0902a23eac7a812 | lofunz/mieme | Reloaded/trunk/src/mame/drivers/ddenlovr.c | [
"Unlicense"
] | C | blit_horiz_line | void | static void blit_horiz_line( running_machine *machine )
{
dynax_state *state = machine->driver_data<dynax_state>();
int i;
#ifdef MAME_DEBUG
popmessage("LINE X");
if (state->ddenlovr_clip_ctrl != 0x0f)
popmessage("LINE X clipx=%03x clipy=%03x ctrl=%x", state->ddenlovr_clip_x, state->ddenlovr_clip_y, state->ddenlovr_clip_ctrl);
if (state->ddenlovr_blit_flip)
popmessage("LINE X flip=%x", state->ddenlovr_blit_flip);
#endif
for (i = 0; i <= state->ddenlovr_line_length; i++)
do_plot(machine, state->ddenlovr_blit_x++, state->ddenlovr_blit_y, state->ddenlovr_blit_pen);
} | /* Draw horizontal line
initialized arguments are
00 dest layer
05 unknown, related to layer
14 X
02 Y
0c line length
04 blit_pen
ddenlovr_blit_x and ddenlovr_blit_y are left pointing to the last pixel at the end of the command
*/ | Draw horizontal line
initialized arguments are
00 dest layer
05 unknown, related to layer
14 X
02 Y
0c line length
04 blit_pen
ddenlovr_blit_x and ddenlovr_blit_y are left pointing to the last pixel at the end of the command | [
"Draw",
"horizontal",
"line",
"initialized",
"arguments",
"are",
"00",
"dest",
"layer",
"05",
"unknown",
"related",
"to",
"layer",
"14",
"X",
"02",
"Y",
"0c",
"line",
"length",
"04",
"blit_pen",
"ddenlovr_blit_x",
"and",
"ddenlovr_blit_y",
"are",
"left",
"pointing",
"to",
"the",
"last",
"pixel",
"at",
"the",
"end",
"of",
"the",
"command"
] | static void blit_horiz_line( running_machine *machine )
{
dynax_state *state = machine->driver_data<dynax_state>();
int i;
#ifdef MAME_DEBUG
popmessage("LINE X");
if (state->ddenlovr_clip_ctrl != 0x0f)
popmessage("LINE X clipx=%03x clipy=%03x ctrl=%x", state->ddenlovr_clip_x, state->ddenlovr_clip_y, state->ddenlovr_clip_ctrl);
if (state->ddenlovr_blit_flip)
popmessage("LINE X flip=%x", state->ddenlovr_blit_flip);
#endif
for (i = 0; i <= state->ddenlovr_line_length; i++)
do_plot(machine, state->ddenlovr_blit_x++, state->ddenlovr_blit_y, state->ddenlovr_blit_pen);
} | [
"static",
"void",
"blit_horiz_line",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"dynax_state",
"*",
"state",
"=",
"machine",
"->",
"driver_data",
"<",
"dynax_state",
">",
"(",
"",
")",
";",
"int",
"i",
";",
"#ifdef",
"MAME_DEBUG",
"popmessage",
"(",
"\"",
"\"",
")",
";",
"if",
"(",
"state",
"->",
"ddenlovr_clip_ctrl",
"!=",
"0x0f",
")",
"popmessage",
"(",
"\"",
"\"",
",",
"state",
"->",
"ddenlovr_clip_x",
",",
"state",
"->",
"ddenlovr_clip_y",
",",
"state",
"->",
"ddenlovr_clip_ctrl",
")",
";",
"if",
"(",
"state",
"->",
"ddenlovr_blit_flip",
")",
"popmessage",
"(",
"\"",
"\"",
",",
"state",
"->",
"ddenlovr_blit_flip",
")",
";",
"#endif",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<=",
"state",
"->",
"ddenlovr_line_length",
";",
"i",
"++",
")",
"do_plot",
"(",
"machine",
",",
"state",
"->",
"ddenlovr_blit_x",
"++",
",",
"state",
"->",
"ddenlovr_blit_y",
",",
"state",
"->",
"ddenlovr_blit_pen",
")",
";",
"}"
] | Draw horizontal line
initialized arguments are
00 dest layer
05 unknown, related to layer
14 X
02 Y
0c line length
04 blit_pen
ddenlovr_blit_x and ddenlovr_blit_y are left pointing to the last pixel at the end of the command | [
"Draw",
"horizontal",
"line",
"initialized",
"arguments",
"are",
"00",
"dest",
"layer",
"05",
"unknown",
"related",
"to",
"layer",
"14",
"X",
"02",
"Y",
"0c",
"line",
"length",
"04",
"blit_pen",
"ddenlovr_blit_x",
"and",
"ddenlovr_blit_y",
"are",
"left",
"pointing",
"to",
"the",
"last",
"pixel",
"at",
"the",
"end",
"of",
"the",
"command"
] | [] | [
{
"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": []
} |
195b0a827b2da0718e5a061fc0902a23eac7a812 | lofunz/mieme | Reloaded/trunk/src/mame/drivers/ddenlovr.c | [
"Unlicense"
] | C | blit_vert_line | void | static void blit_vert_line( running_machine *machine )
{
dynax_state *state = machine->driver_data<dynax_state>();
int i;
#ifdef MAME_DEBUG
popmessage("LINE Y");
if (state->ddenlovr_clip_ctrl != 0x0f)
popmessage("LINE Y clipx=%03x clipy=%03x ctrl=%x", state->ddenlovr_clip_x, state->ddenlovr_clip_y, state->ddenlovr_clip_ctrl);
#endif
for (i = 0; i <= state->ddenlovr_line_length; i++)
do_plot(machine, state->ddenlovr_blit_x, state->ddenlovr_blit_y++, state->ddenlovr_blit_pen);
} | /* Draw vertical line
initialized arguments are
00 dest layer
05 unknown, related to layer
14 X
02 Y
0c line length
04 blit_pen
ddenlovr_blit_x and ddenlovr_blit_y are left pointing to the last pixel at the end of the command
*/ | Draw vertical line
initialized arguments are
00 dest layer
05 unknown, related to layer
14 X
02 Y
0c line length
04 blit_pen
ddenlovr_blit_x and ddenlovr_blit_y are left pointing to the last pixel at the end of the command | [
"Draw",
"vertical",
"line",
"initialized",
"arguments",
"are",
"00",
"dest",
"layer",
"05",
"unknown",
"related",
"to",
"layer",
"14",
"X",
"02",
"Y",
"0c",
"line",
"length",
"04",
"blit_pen",
"ddenlovr_blit_x",
"and",
"ddenlovr_blit_y",
"are",
"left",
"pointing",
"to",
"the",
"last",
"pixel",
"at",
"the",
"end",
"of",
"the",
"command"
] | static void blit_vert_line( running_machine *machine )
{
dynax_state *state = machine->driver_data<dynax_state>();
int i;
#ifdef MAME_DEBUG
popmessage("LINE Y");
if (state->ddenlovr_clip_ctrl != 0x0f)
popmessage("LINE Y clipx=%03x clipy=%03x ctrl=%x", state->ddenlovr_clip_x, state->ddenlovr_clip_y, state->ddenlovr_clip_ctrl);
#endif
for (i = 0; i <= state->ddenlovr_line_length; i++)
do_plot(machine, state->ddenlovr_blit_x, state->ddenlovr_blit_y++, state->ddenlovr_blit_pen);
} | [
"static",
"void",
"blit_vert_line",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"dynax_state",
"*",
"state",
"=",
"machine",
"->",
"driver_data",
"<",
"dynax_state",
">",
"(",
"",
")",
";",
"int",
"i",
";",
"#ifdef",
"MAME_DEBUG",
"popmessage",
"(",
"\"",
"\"",
")",
";",
"if",
"(",
"state",
"->",
"ddenlovr_clip_ctrl",
"!=",
"0x0f",
")",
"popmessage",
"(",
"\"",
"\"",
",",
"state",
"->",
"ddenlovr_clip_x",
",",
"state",
"->",
"ddenlovr_clip_y",
",",
"state",
"->",
"ddenlovr_clip_ctrl",
")",
";",
"#endif",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<=",
"state",
"->",
"ddenlovr_line_length",
";",
"i",
"++",
")",
"do_plot",
"(",
"machine",
",",
"state",
"->",
"ddenlovr_blit_x",
",",
"state",
"->",
"ddenlovr_blit_y",
"++",
",",
"state",
"->",
"ddenlovr_blit_pen",
")",
";",
"}"
] | Draw vertical line
initialized arguments are
00 dest layer
05 unknown, related to layer
14 X
02 Y
0c line length
04 blit_pen
ddenlovr_blit_x and ddenlovr_blit_y are left pointing to the last pixel at the end of the command | [
"Draw",
"vertical",
"line",
"initialized",
"arguments",
"are",
"00",
"dest",
"layer",
"05",
"unknown",
"related",
"to",
"layer",
"14",
"X",
"02",
"Y",
"0c",
"line",
"length",
"04",
"blit_pen",
"ddenlovr_blit_x",
"and",
"ddenlovr_blit_y",
"are",
"left",
"pointing",
"to",
"the",
"last",
"pixel",
"at",
"the",
"end",
"of",
"the",
"command"
] | [] | [
{
"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": []
} |
195b0a827b2da0718e5a061fc0902a23eac7a812 | lofunz/mieme | Reloaded/trunk/src/mame/drivers/ddenlovr.c | [
"Unlicense"
] | C | blitter_w_funkyfig | void | static void blitter_w_funkyfig( running_machine *machine, int blitter, offs_t offset, UINT8 data, int irq_vector )
{
dynax_state *state = machine->driver_data<dynax_state>();
int hi_bits;
profiler_mark_start(PROFILER_VIDEO);
switch(offset)
{
case 0:
state->ddenlovr_blit_regs[blitter] = data;
break;
case 1:
hi_bits = (state->ddenlovr_blit_regs[blitter] & 0xc0) << 2;
switch (state->ddenlovr_blit_regs[blitter] & 0x3f)
{
case 0x00:
if (blitter) state->ddenlovr_dest_layer = (state->ddenlovr_dest_layer & 0x00ff) | (data << 8);
else state->ddenlovr_dest_layer = (state->ddenlovr_dest_layer & 0xff00) | (data << 0);
break;
case 0x01:
ddenlovr_flipscreen_w(data);
break;
case 0x02:
state->ddenlovr_blit_y = data | hi_bits;
break;
case 0x03:
ddenlovr_blit_flip_w(machine, data);
break;
case 0x04:
state->ddenlovr_blit_pen = data;
break;
case 0x05:
state->ddenlovr_blit_pen_mask = data;
break;
case 0x06:
// related to pen, can be 0 or 1 for 0x10 blitter command
// 0 = only bits 7-4 of ddenlovr_blit_pen contain data
// 1 = bits 3-0 contain data as well
state->ddenlovr_blit_pen_mode = data;
break;
case 0x0a:
state->ddenlovr_rect_width = data | hi_bits;
break;
case 0x0b:
state->ddenlovr_rect_height = data | hi_bits;
break;
case 0x0c:
state->ddenlovr_line_length = data | hi_bits;
break;
case 0x0d:
state->ddenlovr_blit_address = (state->ddenlovr_blit_address & 0xffff00) | (data << 0);
break;
case 0x0e:
state->ddenlovr_blit_address = (state->ddenlovr_blit_address & 0xff00ff) | (data << 8);
break;
case 0x0f:
state->ddenlovr_blit_address = (state->ddenlovr_blit_address & 0x00ffff) | (data << 16);
break;
case 0x14:
state->ddenlovr_blit_x = data | hi_bits;
break;
case 0x16:
state->ddenlovr_clip_x = data | hi_bits;
break;
case 0x17:
state->ddenlovr_clip_y = data | hi_bits;
break;
case 0x18:
case 0x19:
case 0x1a:
case 0x1b:
case 0x1c:
case 0x1d:
case 0x1e:
case 0x1f:
state->ddenlovr_scroll[blitter * 8 + (state->ddenlovr_blit_regs[blitter] & 7)] = data | hi_bits;
break;
case 0x20:
state->ddenlovr_clip_ctrl = data;
break;
case 0x24:
log_blit(machine, data);
switch (data)
{
case 0x84: // same as 04?
case 0x04: blit_fill_xy(machine, 0, 0);
break;
// unused?
// case 0x14: blit_fill_xy(machine, state->ddenlovr_blit_x, state->ddenlovr_blit_y);
// break;
case 0x00/*0x10*/: state->ddenlovr_blit_address = blit_draw(machine, state->ddenlovr_blit_address, state->ddenlovr_blit_x);
break;
case 0x0b: // same as 03? see the drawing of the R in "cRoss hatch" (key test)
case 0x03/*0x13*/: blit_horiz_line(machine);
break;
// unused?
// case 0x1b: blit_vert_line(machine);
// break;
case 0x0c/*0x1c*/: blit_rect_xywh(machine);
break;
// These two are issued one after the other (43 then 8c)
// 8c is issued immediately after 43 has finished, without
// changing any argument
case 0x43: break;
case 0x8c: blit_rect_yh(machine);
break;
default:
;
#ifdef MAME_DEBUG
popmessage("unknown blitter command %02x", data);
logerror("%s: unknown blitter command %02x\n", cpuexec_describe_context(machine), data);
#endif
}
cpu_set_input_line_and_vector(state->maincpu, 0, HOLD_LINE, irq_vector);
break;
default:
logerror("%s: Blitter %d reg %02x = %02x\n", cpuexec_describe_context(machine), blitter, state->ddenlovr_blit_regs[blitter], data);
break;
}
}
profiler_mark_end();
} | // differences wrt blitter_data_w: slightly different blitter commands
| differences wrt blitter_data_w: slightly different blitter commands | [
"differences",
"wrt",
"blitter_data_w",
":",
"slightly",
"different",
"blitter",
"commands"
] | static void blitter_w_funkyfig( running_machine *machine, int blitter, offs_t offset, UINT8 data, int irq_vector )
{
dynax_state *state = machine->driver_data<dynax_state>();
int hi_bits;
profiler_mark_start(PROFILER_VIDEO);
switch(offset)
{
case 0:
state->ddenlovr_blit_regs[blitter] = data;
break;
case 1:
hi_bits = (state->ddenlovr_blit_regs[blitter] & 0xc0) << 2;
switch (state->ddenlovr_blit_regs[blitter] & 0x3f)
{
case 0x00:
if (blitter) state->ddenlovr_dest_layer = (state->ddenlovr_dest_layer & 0x00ff) | (data << 8);
else state->ddenlovr_dest_layer = (state->ddenlovr_dest_layer & 0xff00) | (data << 0);
break;
case 0x01:
ddenlovr_flipscreen_w(data);
break;
case 0x02:
state->ddenlovr_blit_y = data | hi_bits;
break;
case 0x03:
ddenlovr_blit_flip_w(machine, data);
break;
case 0x04:
state->ddenlovr_blit_pen = data;
break;
case 0x05:
state->ddenlovr_blit_pen_mask = data;
break;
case 0x06:
state->ddenlovr_blit_pen_mode = data;
break;
case 0x0a:
state->ddenlovr_rect_width = data | hi_bits;
break;
case 0x0b:
state->ddenlovr_rect_height = data | hi_bits;
break;
case 0x0c:
state->ddenlovr_line_length = data | hi_bits;
break;
case 0x0d:
state->ddenlovr_blit_address = (state->ddenlovr_blit_address & 0xffff00) | (data << 0);
break;
case 0x0e:
state->ddenlovr_blit_address = (state->ddenlovr_blit_address & 0xff00ff) | (data << 8);
break;
case 0x0f:
state->ddenlovr_blit_address = (state->ddenlovr_blit_address & 0x00ffff) | (data << 16);
break;
case 0x14:
state->ddenlovr_blit_x = data | hi_bits;
break;
case 0x16:
state->ddenlovr_clip_x = data | hi_bits;
break;
case 0x17:
state->ddenlovr_clip_y = data | hi_bits;
break;
case 0x18:
case 0x19:
case 0x1a:
case 0x1b:
case 0x1c:
case 0x1d:
case 0x1e:
case 0x1f:
state->ddenlovr_scroll[blitter * 8 + (state->ddenlovr_blit_regs[blitter] & 7)] = data | hi_bits;
break;
case 0x20:
state->ddenlovr_clip_ctrl = data;
break;
case 0x24:
log_blit(machine, data);
switch (data)
{
case 0x84:
case 0x04: blit_fill_xy(machine, 0, 0);
break;
case 0x00: state->ddenlovr_blit_address = blit_draw(machine, state->ddenlovr_blit_address, state->ddenlovr_blit_x);
break;
case 0x0b:
case 0x03: blit_horiz_line(machine);
break;
case 0x0c: blit_rect_xywh(machine);
break;
case 0x43: break;
case 0x8c: blit_rect_yh(machine);
break;
default:
;
#ifdef MAME_DEBUG
popmessage("unknown blitter command %02x", data);
logerror("%s: unknown blitter command %02x\n", cpuexec_describe_context(machine), data);
#endif
}
cpu_set_input_line_and_vector(state->maincpu, 0, HOLD_LINE, irq_vector);
break;
default:
logerror("%s: Blitter %d reg %02x = %02x\n", cpuexec_describe_context(machine), blitter, state->ddenlovr_blit_regs[blitter], data);
break;
}
}
profiler_mark_end();
} | [
"static",
"void",
"blitter_w_funkyfig",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"blitter",
",",
"offs_t",
"offset",
",",
"UINT8",
"data",
",",
"int",
"irq_vector",
")",
"{",
"dynax_state",
"*",
"state",
"=",
"machine",
"->",
"driver_data",
"<",
"dynax_state",
">",
"(",
"",
")",
";",
"int",
"hi_bits",
";",
"profiler_mark_start",
"(",
"PROFILER_VIDEO",
")",
";",
"switch",
"(",
"offset",
")",
"{",
"case",
"0",
":",
"state",
"->",
"ddenlovr_blit_regs",
"[",
"blitter",
"]",
"=",
"data",
";",
"break",
";",
"case",
"1",
":",
"hi_bits",
"=",
"(",
"state",
"->",
"ddenlovr_blit_regs",
"[",
"blitter",
"]",
"&",
"0xc0",
")",
"<<",
"2",
";",
"switch",
"(",
"state",
"->",
"ddenlovr_blit_regs",
"[",
"blitter",
"]",
"&",
"0x3f",
")",
"{",
"case",
"0x00",
":",
"if",
"(",
"blitter",
")",
"state",
"->",
"ddenlovr_dest_layer",
"=",
"(",
"state",
"->",
"ddenlovr_dest_layer",
"&",
"0x00ff",
")",
"|",
"(",
"data",
"<<",
"8",
")",
";",
"else",
"state",
"->",
"ddenlovr_dest_layer",
"=",
"(",
"state",
"->",
"ddenlovr_dest_layer",
"&",
"0xff00",
")",
"|",
"(",
"data",
"<<",
"0",
")",
";",
"break",
";",
"case",
"0x01",
":",
"ddenlovr_flipscreen_w",
"(",
"data",
")",
";",
"break",
";",
"case",
"0x02",
":",
"state",
"->",
"ddenlovr_blit_y",
"=",
"data",
"|",
"hi_bits",
";",
"break",
";",
"case",
"0x03",
":",
"ddenlovr_blit_flip_w",
"(",
"machine",
",",
"data",
")",
";",
"break",
";",
"case",
"0x04",
":",
"state",
"->",
"ddenlovr_blit_pen",
"=",
"data",
";",
"break",
";",
"case",
"0x05",
":",
"state",
"->",
"ddenlovr_blit_pen_mask",
"=",
"data",
";",
"break",
";",
"case",
"0x06",
":",
"state",
"->",
"ddenlovr_blit_pen_mode",
"=",
"data",
";",
"break",
";",
"case",
"0x0a",
":",
"state",
"->",
"ddenlovr_rect_width",
"=",
"data",
"|",
"hi_bits",
";",
"break",
";",
"case",
"0x0b",
":",
"state",
"->",
"ddenlovr_rect_height",
"=",
"data",
"|",
"hi_bits",
";",
"break",
";",
"case",
"0x0c",
":",
"state",
"->",
"ddenlovr_line_length",
"=",
"data",
"|",
"hi_bits",
";",
"break",
";",
"case",
"0x0d",
":",
"state",
"->",
"ddenlovr_blit_address",
"=",
"(",
"state",
"->",
"ddenlovr_blit_address",
"&",
"0xffff00",
")",
"|",
"(",
"data",
"<<",
"0",
")",
";",
"break",
";",
"case",
"0x0e",
":",
"state",
"->",
"ddenlovr_blit_address",
"=",
"(",
"state",
"->",
"ddenlovr_blit_address",
"&",
"0xff00ff",
")",
"|",
"(",
"data",
"<<",
"8",
")",
";",
"break",
";",
"case",
"0x0f",
":",
"state",
"->",
"ddenlovr_blit_address",
"=",
"(",
"state",
"->",
"ddenlovr_blit_address",
"&",
"0x00ffff",
")",
"|",
"(",
"data",
"<<",
"16",
")",
";",
"break",
";",
"case",
"0x14",
":",
"state",
"->",
"ddenlovr_blit_x",
"=",
"data",
"|",
"hi_bits",
";",
"break",
";",
"case",
"0x16",
":",
"state",
"->",
"ddenlovr_clip_x",
"=",
"data",
"|",
"hi_bits",
";",
"break",
";",
"case",
"0x17",
":",
"state",
"->",
"ddenlovr_clip_y",
"=",
"data",
"|",
"hi_bits",
";",
"break",
";",
"case",
"0x18",
":",
"case",
"0x19",
":",
"case",
"0x1a",
":",
"case",
"0x1b",
":",
"case",
"0x1c",
":",
"case",
"0x1d",
":",
"case",
"0x1e",
":",
"case",
"0x1f",
":",
"state",
"->",
"ddenlovr_scroll",
"[",
"blitter",
"*",
"8",
"+",
"(",
"state",
"->",
"ddenlovr_blit_regs",
"[",
"blitter",
"]",
"&",
"7",
")",
"]",
"=",
"data",
"|",
"hi_bits",
";",
"break",
";",
"case",
"0x20",
":",
"state",
"->",
"ddenlovr_clip_ctrl",
"=",
"data",
";",
"break",
";",
"case",
"0x24",
":",
"log_blit",
"(",
"machine",
",",
"data",
")",
";",
"switch",
"(",
"data",
")",
"{",
"case",
"0x84",
":",
"case",
"0x04",
":",
"blit_fill_xy",
"(",
"machine",
",",
"0",
",",
"0",
")",
";",
"break",
";",
"case",
"0x00",
":",
"state",
"->",
"ddenlovr_blit_address",
"=",
"blit_draw",
"(",
"machine",
",",
"state",
"->",
"ddenlovr_blit_address",
",",
"state",
"->",
"ddenlovr_blit_x",
")",
";",
"break",
";",
"case",
"0x0b",
":",
"case",
"0x03",
":",
"blit_horiz_line",
"(",
"machine",
")",
";",
"break",
";",
"case",
"0x0c",
":",
"blit_rect_xywh",
"(",
"machine",
")",
";",
"break",
";",
"case",
"0x43",
":",
"break",
";",
"case",
"0x8c",
":",
"blit_rect_yh",
"(",
"machine",
")",
";",
"break",
";",
"default",
":",
";",
"#ifdef",
"MAME_DEBUG",
"popmessage",
"(",
"\"",
"\"",
",",
"data",
")",
";",
"logerror",
"(",
"\"",
"\\n",
"\"",
",",
"cpuexec_describe_context",
"(",
"machine",
")",
",",
"data",
")",
";",
"#endif",
"}",
"cpu_set_input_line_and_vector",
"(",
"state",
"->",
"maincpu",
",",
"0",
",",
"HOLD_LINE",
",",
"irq_vector",
")",
";",
"break",
";",
"default",
":",
"logerror",
"(",
"\"",
"\\n",
"\"",
",",
"cpuexec_describe_context",
"(",
"machine",
")",
",",
"blitter",
",",
"state",
"->",
"ddenlovr_blit_regs",
"[",
"blitter",
"]",
",",
"data",
")",
";",
"break",
";",
"}",
"}",
"profiler_mark_end",
"(",
")",
";",
"}"
] | differences wrt blitter_data_w: slightly different blitter commands | [
"differences",
"wrt",
"blitter_data_w",
":",
"slightly",
"different",
"blitter",
"commands"
] | [
"// related to pen, can be 0 or 1 for 0x10 blitter command\r",
"// 0 = only bits 7-4 of ddenlovr_blit_pen contain data\r",
"// 1 = bits 3-0 contain data as well\r",
"// same as 04?\r",
"// unused?\r",
"// case 0x14: blit_fill_xy(machine, state->ddenlovr_blit_x, state->ddenlovr_blit_y);\r",
"// break;\r",
"/*0x10*/",
"// same as 03? see the drawing of the R in \"cRoss hatch\" (key test)\r",
"/*0x13*/",
"// unused?\r",
"// case 0x1b: blit_vert_line(machine);\r",
"// break;\r",
"/*0x1c*/",
"// These two are issued one after the other (43 then 8c)\r",
"// 8c is issued immediately after 43 has finished, without\r",
"// changing any argument\r"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "blitter",
"type": "int"
},
{
"param": "offset",
"type": "offs_t"
},
{
"param": "data",
"type": "UINT8"
},
{
"param": "irq_vector",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "blitter",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset",
"type": "offs_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "irq_vector",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e3ca06cbd3c9bc34e9638fbefd587b30b62b57ae | lofunz/mieme | Reloaded/trunk/src/mame/video/atarimo.c | [
"Unlicense"
] | C | atarimo_init | void | void atarimo_init(running_machine *machine, int map, const atarimo_desc *desc)
{
gfx_element *gfx = machine->gfx[desc->gfxindex];
atarimo_data *mo = &atarimo[map];
int i;
assert_always(map >= 0 && map < ATARIMO_MAX, "atarimo_init: map out of range");
/* determine the masks first */
convert_mask(&desc->linkmask, &mo->linkmask);
convert_mask(&desc->gfxmask, &mo->gfxmask);
convert_mask(&desc->codemask, &mo->codemask);
convert_mask(&desc->codehighmask, &mo->codehighmask);
convert_mask(&desc->colormask, &mo->colormask);
convert_mask(&desc->xposmask, &mo->xposmask);
convert_mask(&desc->yposmask, &mo->yposmask);
convert_mask(&desc->widthmask, &mo->widthmask);
convert_mask(&desc->heightmask, &mo->heightmask);
convert_mask(&desc->hflipmask, &mo->hflipmask);
convert_mask(&desc->vflipmask, &mo->vflipmask);
convert_mask(&desc->prioritymask, &mo->prioritymask);
convert_mask(&desc->neighbormask, &mo->neighbormask);
convert_mask(&desc->absolutemask, &mo->absolutemask);
/* copy in the basic data */
mo->machine = machine;
mo->gfxchanged = FALSE;
mo->linked = desc->linked;
mo->split = desc->split;
mo->reverse = desc->reverse;
mo->swapxy = desc->swapxy;
mo->nextneighbor = desc->nextneighbor;
mo->slipshift = desc->slipheight ? compute_log(desc->slipheight) : 0;
mo->slipoffset = desc->slipoffset;
mo->entrycount = round_to_powerof2(mo->linkmask.mask);
mo->entrybits = compute_log(mo->entrycount);
mo->bankcount = desc->banks;
mo->tilewidth = gfx->width;
mo->tileheight = gfx->height;
mo->tilexshift = compute_log(mo->tilewidth);
mo->tileyshift = compute_log(mo->tileheight);
mo->bitmapwidth = round_to_powerof2(mo->xposmask.mask);
mo->bitmapheight = round_to_powerof2(mo->yposmask.mask);
mo->bitmapxmask = mo->bitmapwidth - 1;
mo->bitmapymask = mo->bitmapheight - 1;
mo->spriteramsize = mo->bankcount * mo->entrycount;
mo->spriterammask = mo->spriteramsize - 1;
mo->slipramsize = mo->bitmapheight >> mo->slipshift;
mo->sliprammask = mo->slipramsize - 1;
mo->palettebase = desc->palettebase;
mo->maxcolors = desc->maxcolors / gfx->color_granularity;
mo->transpen = desc->transpen;
mo->bank = 0;
mo->xscroll = 0;
mo->yscroll = 0;
mo->maxperline = desc->maxlinks ? desc->maxlinks : 0x400;
convert_mask(&desc->specialmask, &mo->specialmask);
mo->specialvalue = desc->specialvalue;
mo->specialcb = desc->specialcb;
mo->codehighshift = compute_log(round_to_powerof2(mo->codemask.mask));
mo->slipram = (map == 0) ? &atarimo_0_slipram : &atarimo_1_slipram;
/* allocate the temp bitmap */
mo->bitmap = auto_bitmap_alloc(machine, machine->primary_screen->width(), machine->primary_screen->height(), BITMAP_FORMAT_INDEXED16);
bitmap_fill(mo->bitmap, NULL, desc->transpen);
/* allocate the spriteram */
mo->spriteram = auto_alloc_array_clear(machine, atarimo_entry, mo->spriteramsize);
/* allocate the code lookup */
mo->codelookup = auto_alloc_array(machine, UINT16, round_to_powerof2(mo->codemask.mask));
/* initialize it 1:1 */
for (i = 0; i < round_to_powerof2(mo->codemask.mask); i++)
mo->codelookup[i] = i;
/* allocate the color lookup */
mo->colorlookup = auto_alloc_array(machine, UINT8, round_to_powerof2(mo->colormask.mask));
/* initialize it 1:1 */
for (i = 0; i < round_to_powerof2(mo->colormask.mask); i++)
mo->colorlookup[i] = i;
/* allocate dirty grid */
mo->dirtywidth = (machine->primary_screen->width() >> mo->tilexshift) + 2;
mo->dirtyheight = (machine->primary_screen->height() >> mo->tileyshift) + 2;
mo->dirtygrid = auto_alloc_array(machine, UINT8, mo->dirtywidth * mo->dirtyheight);
/* allocate the gfx lookup */
mo->gfxlookup = auto_alloc_array(machine, UINT8, round_to_powerof2(mo->gfxmask.mask));
/* initialize it with the gfxindex we were passed in */
for (i = 0; i < round_to_powerof2(mo->gfxmask.mask); i++)
mo->gfxlookup[i] = desc->gfxindex;
/* initialize the gfx elements so we have full control over colors */
init_gfxelement(mo, desc->gfxindex);
/* start a timer to update a few times during refresh */
force_update_timer = timer_alloc(machine, force_update, NULL);
timer_adjust_oneshot(force_update_timer,machine->primary_screen->time_until_pos(0), 0);
init_savestate(machine, map, mo);
logerror("atarimo_init:\n");
logerror(" width=%d (shift=%d), height=%d (shift=%d)\n", mo->tilewidth, mo->tilexshift, mo->tileheight, mo->tileyshift);
logerror(" spriteram mask=%X, size=%d\n", mo->spriterammask, mo->spriteramsize);
logerror(" slipram mask=%X, size=%d\n", mo->sliprammask, mo->slipramsize);
logerror(" bitmap size=%dx%d\n", mo->bitmapwidth, mo->bitmapheight);
} | /*---------------------------------------------------------------
atarimo_init: Configures the motion objects using the input
description. Allocates all memory necessary and generates
the attribute lookup table.
---------------------------------------------------------------*/ | Configures the motion objects using the input
description. Allocates all memory necessary and generates
the attribute lookup table. | [
"Configures",
"the",
"motion",
"objects",
"using",
"the",
"input",
"description",
".",
"Allocates",
"all",
"memory",
"necessary",
"and",
"generates",
"the",
"attribute",
"lookup",
"table",
"."
] | void atarimo_init(running_machine *machine, int map, const atarimo_desc *desc)
{
gfx_element *gfx = machine->gfx[desc->gfxindex];
atarimo_data *mo = &atarimo[map];
int i;
assert_always(map >= 0 && map < ATARIMO_MAX, "atarimo_init: map out of range");
convert_mask(&desc->linkmask, &mo->linkmask);
convert_mask(&desc->gfxmask, &mo->gfxmask);
convert_mask(&desc->codemask, &mo->codemask);
convert_mask(&desc->codehighmask, &mo->codehighmask);
convert_mask(&desc->colormask, &mo->colormask);
convert_mask(&desc->xposmask, &mo->xposmask);
convert_mask(&desc->yposmask, &mo->yposmask);
convert_mask(&desc->widthmask, &mo->widthmask);
convert_mask(&desc->heightmask, &mo->heightmask);
convert_mask(&desc->hflipmask, &mo->hflipmask);
convert_mask(&desc->vflipmask, &mo->vflipmask);
convert_mask(&desc->prioritymask, &mo->prioritymask);
convert_mask(&desc->neighbormask, &mo->neighbormask);
convert_mask(&desc->absolutemask, &mo->absolutemask);
mo->machine = machine;
mo->gfxchanged = FALSE;
mo->linked = desc->linked;
mo->split = desc->split;
mo->reverse = desc->reverse;
mo->swapxy = desc->swapxy;
mo->nextneighbor = desc->nextneighbor;
mo->slipshift = desc->slipheight ? compute_log(desc->slipheight) : 0;
mo->slipoffset = desc->slipoffset;
mo->entrycount = round_to_powerof2(mo->linkmask.mask);
mo->entrybits = compute_log(mo->entrycount);
mo->bankcount = desc->banks;
mo->tilewidth = gfx->width;
mo->tileheight = gfx->height;
mo->tilexshift = compute_log(mo->tilewidth);
mo->tileyshift = compute_log(mo->tileheight);
mo->bitmapwidth = round_to_powerof2(mo->xposmask.mask);
mo->bitmapheight = round_to_powerof2(mo->yposmask.mask);
mo->bitmapxmask = mo->bitmapwidth - 1;
mo->bitmapymask = mo->bitmapheight - 1;
mo->spriteramsize = mo->bankcount * mo->entrycount;
mo->spriterammask = mo->spriteramsize - 1;
mo->slipramsize = mo->bitmapheight >> mo->slipshift;
mo->sliprammask = mo->slipramsize - 1;
mo->palettebase = desc->palettebase;
mo->maxcolors = desc->maxcolors / gfx->color_granularity;
mo->transpen = desc->transpen;
mo->bank = 0;
mo->xscroll = 0;
mo->yscroll = 0;
mo->maxperline = desc->maxlinks ? desc->maxlinks : 0x400;
convert_mask(&desc->specialmask, &mo->specialmask);
mo->specialvalue = desc->specialvalue;
mo->specialcb = desc->specialcb;
mo->codehighshift = compute_log(round_to_powerof2(mo->codemask.mask));
mo->slipram = (map == 0) ? &atarimo_0_slipram : &atarimo_1_slipram;
mo->bitmap = auto_bitmap_alloc(machine, machine->primary_screen->width(), machine->primary_screen->height(), BITMAP_FORMAT_INDEXED16);
bitmap_fill(mo->bitmap, NULL, desc->transpen);
mo->spriteram = auto_alloc_array_clear(machine, atarimo_entry, mo->spriteramsize);
mo->codelookup = auto_alloc_array(machine, UINT16, round_to_powerof2(mo->codemask.mask));
for (i = 0; i < round_to_powerof2(mo->codemask.mask); i++)
mo->codelookup[i] = i;
mo->colorlookup = auto_alloc_array(machine, UINT8, round_to_powerof2(mo->colormask.mask));
for (i = 0; i < round_to_powerof2(mo->colormask.mask); i++)
mo->colorlookup[i] = i;
mo->dirtywidth = (machine->primary_screen->width() >> mo->tilexshift) + 2;
mo->dirtyheight = (machine->primary_screen->height() >> mo->tileyshift) + 2;
mo->dirtygrid = auto_alloc_array(machine, UINT8, mo->dirtywidth * mo->dirtyheight);
mo->gfxlookup = auto_alloc_array(machine, UINT8, round_to_powerof2(mo->gfxmask.mask));
for (i = 0; i < round_to_powerof2(mo->gfxmask.mask); i++)
mo->gfxlookup[i] = desc->gfxindex;
init_gfxelement(mo, desc->gfxindex);
force_update_timer = timer_alloc(machine, force_update, NULL);
timer_adjust_oneshot(force_update_timer,machine->primary_screen->time_until_pos(0), 0);
init_savestate(machine, map, mo);
logerror("atarimo_init:\n");
logerror(" width=%d (shift=%d), height=%d (shift=%d)\n", mo->tilewidth, mo->tilexshift, mo->tileheight, mo->tileyshift);
logerror(" spriteram mask=%X, size=%d\n", mo->spriterammask, mo->spriteramsize);
logerror(" slipram mask=%X, size=%d\n", mo->sliprammask, mo->slipramsize);
logerror(" bitmap size=%dx%d\n", mo->bitmapwidth, mo->bitmapheight);
} | [
"void",
"atarimo_init",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"map",
",",
"const",
"atarimo_desc",
"*",
"desc",
")",
"{",
"gfx_element",
"*",
"gfx",
"=",
"machine",
"->",
"gfx",
"[",
"desc",
"->",
"gfxindex",
"]",
";",
"atarimo_data",
"*",
"mo",
"=",
"&",
"atarimo",
"[",
"map",
"]",
";",
"int",
"i",
";",
"assert_always",
"(",
"map",
">=",
"0",
"&&",
"map",
"<",
"ATARIMO_MAX",
",",
"\"",
"\"",
")",
";",
"convert_mask",
"(",
"&",
"desc",
"->",
"linkmask",
",",
"&",
"mo",
"->",
"linkmask",
")",
";",
"convert_mask",
"(",
"&",
"desc",
"->",
"gfxmask",
",",
"&",
"mo",
"->",
"gfxmask",
")",
";",
"convert_mask",
"(",
"&",
"desc",
"->",
"codemask",
",",
"&",
"mo",
"->",
"codemask",
")",
";",
"convert_mask",
"(",
"&",
"desc",
"->",
"codehighmask",
",",
"&",
"mo",
"->",
"codehighmask",
")",
";",
"convert_mask",
"(",
"&",
"desc",
"->",
"colormask",
",",
"&",
"mo",
"->",
"colormask",
")",
";",
"convert_mask",
"(",
"&",
"desc",
"->",
"xposmask",
",",
"&",
"mo",
"->",
"xposmask",
")",
";",
"convert_mask",
"(",
"&",
"desc",
"->",
"yposmask",
",",
"&",
"mo",
"->",
"yposmask",
")",
";",
"convert_mask",
"(",
"&",
"desc",
"->",
"widthmask",
",",
"&",
"mo",
"->",
"widthmask",
")",
";",
"convert_mask",
"(",
"&",
"desc",
"->",
"heightmask",
",",
"&",
"mo",
"->",
"heightmask",
")",
";",
"convert_mask",
"(",
"&",
"desc",
"->",
"hflipmask",
",",
"&",
"mo",
"->",
"hflipmask",
")",
";",
"convert_mask",
"(",
"&",
"desc",
"->",
"vflipmask",
",",
"&",
"mo",
"->",
"vflipmask",
")",
";",
"convert_mask",
"(",
"&",
"desc",
"->",
"prioritymask",
",",
"&",
"mo",
"->",
"prioritymask",
")",
";",
"convert_mask",
"(",
"&",
"desc",
"->",
"neighbormask",
",",
"&",
"mo",
"->",
"neighbormask",
")",
";",
"convert_mask",
"(",
"&",
"desc",
"->",
"absolutemask",
",",
"&",
"mo",
"->",
"absolutemask",
")",
";",
"mo",
"->",
"machine",
"=",
"machine",
";",
"mo",
"->",
"gfxchanged",
"=",
"FALSE",
";",
"mo",
"->",
"linked",
"=",
"desc",
"->",
"linked",
";",
"mo",
"->",
"split",
"=",
"desc",
"->",
"split",
";",
"mo",
"->",
"reverse",
"=",
"desc",
"->",
"reverse",
";",
"mo",
"->",
"swapxy",
"=",
"desc",
"->",
"swapxy",
";",
"mo",
"->",
"nextneighbor",
"=",
"desc",
"->",
"nextneighbor",
";",
"mo",
"->",
"slipshift",
"=",
"desc",
"->",
"slipheight",
"?",
"compute_log",
"(",
"desc",
"->",
"slipheight",
")",
":",
"0",
";",
"mo",
"->",
"slipoffset",
"=",
"desc",
"->",
"slipoffset",
";",
"mo",
"->",
"entrycount",
"=",
"round_to_powerof2",
"(",
"mo",
"->",
"linkmask",
".",
"mask",
")",
";",
"mo",
"->",
"entrybits",
"=",
"compute_log",
"(",
"mo",
"->",
"entrycount",
")",
";",
"mo",
"->",
"bankcount",
"=",
"desc",
"->",
"banks",
";",
"mo",
"->",
"tilewidth",
"=",
"gfx",
"->",
"width",
";",
"mo",
"->",
"tileheight",
"=",
"gfx",
"->",
"height",
";",
"mo",
"->",
"tilexshift",
"=",
"compute_log",
"(",
"mo",
"->",
"tilewidth",
")",
";",
"mo",
"->",
"tileyshift",
"=",
"compute_log",
"(",
"mo",
"->",
"tileheight",
")",
";",
"mo",
"->",
"bitmapwidth",
"=",
"round_to_powerof2",
"(",
"mo",
"->",
"xposmask",
".",
"mask",
")",
";",
"mo",
"->",
"bitmapheight",
"=",
"round_to_powerof2",
"(",
"mo",
"->",
"yposmask",
".",
"mask",
")",
";",
"mo",
"->",
"bitmapxmask",
"=",
"mo",
"->",
"bitmapwidth",
"-",
"1",
";",
"mo",
"->",
"bitmapymask",
"=",
"mo",
"->",
"bitmapheight",
"-",
"1",
";",
"mo",
"->",
"spriteramsize",
"=",
"mo",
"->",
"bankcount",
"*",
"mo",
"->",
"entrycount",
";",
"mo",
"->",
"spriterammask",
"=",
"mo",
"->",
"spriteramsize",
"-",
"1",
";",
"mo",
"->",
"slipramsize",
"=",
"mo",
"->",
"bitmapheight",
">>",
"mo",
"->",
"slipshift",
";",
"mo",
"->",
"sliprammask",
"=",
"mo",
"->",
"slipramsize",
"-",
"1",
";",
"mo",
"->",
"palettebase",
"=",
"desc",
"->",
"palettebase",
";",
"mo",
"->",
"maxcolors",
"=",
"desc",
"->",
"maxcolors",
"/",
"gfx",
"->",
"color_granularity",
";",
"mo",
"->",
"transpen",
"=",
"desc",
"->",
"transpen",
";",
"mo",
"->",
"bank",
"=",
"0",
";",
"mo",
"->",
"xscroll",
"=",
"0",
";",
"mo",
"->",
"yscroll",
"=",
"0",
";",
"mo",
"->",
"maxperline",
"=",
"desc",
"->",
"maxlinks",
"?",
"desc",
"->",
"maxlinks",
":",
"0x400",
";",
"convert_mask",
"(",
"&",
"desc",
"->",
"specialmask",
",",
"&",
"mo",
"->",
"specialmask",
")",
";",
"mo",
"->",
"specialvalue",
"=",
"desc",
"->",
"specialvalue",
";",
"mo",
"->",
"specialcb",
"=",
"desc",
"->",
"specialcb",
";",
"mo",
"->",
"codehighshift",
"=",
"compute_log",
"(",
"round_to_powerof2",
"(",
"mo",
"->",
"codemask",
".",
"mask",
")",
")",
";",
"mo",
"->",
"slipram",
"=",
"(",
"map",
"==",
"0",
")",
"?",
"&",
"atarimo_0_slipram",
":",
"&",
"atarimo_1_slipram",
";",
"mo",
"->",
"bitmap",
"=",
"auto_bitmap_alloc",
"(",
"machine",
",",
"machine",
"->",
"primary_screen",
"->",
"width",
"(",
")",
",",
"machine",
"->",
"primary_screen",
"->",
"height",
"(",
")",
",",
"BITMAP_FORMAT_INDEXED16",
")",
";",
"bitmap_fill",
"(",
"mo",
"->",
"bitmap",
",",
"NULL",
",",
"desc",
"->",
"transpen",
")",
";",
"mo",
"->",
"spriteram",
"=",
"auto_alloc_array_clear",
"(",
"machine",
",",
"atarimo_entry",
",",
"mo",
"->",
"spriteramsize",
")",
";",
"mo",
"->",
"codelookup",
"=",
"auto_alloc_array",
"(",
"machine",
",",
"UINT16",
",",
"round_to_powerof2",
"(",
"mo",
"->",
"codemask",
".",
"mask",
")",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"round_to_powerof2",
"(",
"mo",
"->",
"codemask",
".",
"mask",
")",
";",
"i",
"++",
")",
"mo",
"->",
"codelookup",
"[",
"i",
"]",
"=",
"i",
";",
"mo",
"->",
"colorlookup",
"=",
"auto_alloc_array",
"(",
"machine",
",",
"UINT8",
",",
"round_to_powerof2",
"(",
"mo",
"->",
"colormask",
".",
"mask",
")",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"round_to_powerof2",
"(",
"mo",
"->",
"colormask",
".",
"mask",
")",
";",
"i",
"++",
")",
"mo",
"->",
"colorlookup",
"[",
"i",
"]",
"=",
"i",
";",
"mo",
"->",
"dirtywidth",
"=",
"(",
"machine",
"->",
"primary_screen",
"->",
"width",
"(",
")",
">>",
"mo",
"->",
"tilexshift",
")",
"+",
"2",
";",
"mo",
"->",
"dirtyheight",
"=",
"(",
"machine",
"->",
"primary_screen",
"->",
"height",
"(",
")",
">>",
"mo",
"->",
"tileyshift",
")",
"+",
"2",
";",
"mo",
"->",
"dirtygrid",
"=",
"auto_alloc_array",
"(",
"machine",
",",
"UINT8",
",",
"mo",
"->",
"dirtywidth",
"*",
"mo",
"->",
"dirtyheight",
")",
";",
"mo",
"->",
"gfxlookup",
"=",
"auto_alloc_array",
"(",
"machine",
",",
"UINT8",
",",
"round_to_powerof2",
"(",
"mo",
"->",
"gfxmask",
".",
"mask",
")",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"round_to_powerof2",
"(",
"mo",
"->",
"gfxmask",
".",
"mask",
")",
";",
"i",
"++",
")",
"mo",
"->",
"gfxlookup",
"[",
"i",
"]",
"=",
"desc",
"->",
"gfxindex",
";",
"init_gfxelement",
"(",
"mo",
",",
"desc",
"->",
"gfxindex",
")",
";",
"force_update_timer",
"=",
"timer_alloc",
"(",
"machine",
",",
"force_update",
",",
"NULL",
")",
";",
"timer_adjust_oneshot",
"(",
"force_update_timer",
",",
"machine",
"->",
"primary_screen",
"->",
"time_until_pos",
"(",
"0",
")",
",",
"0",
")",
";",
"init_savestate",
"(",
"machine",
",",
"map",
",",
"mo",
")",
";",
"logerror",
"(",
"\"",
"\\n",
"\"",
")",
";",
"logerror",
"(",
"\"",
"\\n",
"\"",
",",
"mo",
"->",
"tilewidth",
",",
"mo",
"->",
"tilexshift",
",",
"mo",
"->",
"tileheight",
",",
"mo",
"->",
"tileyshift",
")",
";",
"logerror",
"(",
"\"",
"\\n",
"\"",
",",
"mo",
"->",
"spriterammask",
",",
"mo",
"->",
"spriteramsize",
")",
";",
"logerror",
"(",
"\"",
"\\n",
"\"",
",",
"mo",
"->",
"sliprammask",
",",
"mo",
"->",
"slipramsize",
")",
";",
"logerror",
"(",
"\"",
"\\n",
"\"",
",",
"mo",
"->",
"bitmapwidth",
",",
"mo",
"->",
"bitmapheight",
")",
";",
"}"
] | atarimo_init: Configures the motion objects using the input
description. | [
"atarimo_init",
":",
"Configures",
"the",
"motion",
"objects",
"using",
"the",
"input",
"description",
"."
] | [
"/* determine the masks first */",
"/* copy in the basic data */",
"/* allocate the temp bitmap */",
"/* allocate the spriteram */",
"/* allocate the code lookup */",
"/* initialize it 1:1 */",
"/* allocate the color lookup */",
"/* initialize it 1:1 */",
"/* allocate dirty grid */",
"/* allocate the gfx lookup */",
"/* initialize it with the gfxindex we were passed in */",
"/* initialize the gfx elements so we have full control over colors */",
"/* start a timer to update a few times during refresh */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "map",
"type": "int"
},
{
"param": "desc",
"type": "atarimo_desc"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "map",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desc",
"type": "atarimo_desc",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e3ca06cbd3c9bc34e9638fbefd587b30b62b57ae | lofunz/mieme | Reloaded/trunk/src/mame/video/atarimo.c | [
"Unlicense"
] | C | atarimo_get_code_lookup | UINT16 | UINT16 *atarimo_get_code_lookup(int map, int *size)
{
atarimo_data *mo = &atarimo[map];
if (size)
*size = round_to_powerof2(mo->codemask.mask);
return mo->codelookup;
} | /*---------------------------------------------------------------
atarimo_get_code_lookup: Returns a pointer to the code
lookup table.
---------------------------------------------------------------*/ | Returns a pointer to the code
lookup table. | [
"Returns",
"a",
"pointer",
"to",
"the",
"code",
"lookup",
"table",
"."
] | UINT16 *atarimo_get_code_lookup(int map, int *size)
{
atarimo_data *mo = &atarimo[map];
if (size)
*size = round_to_powerof2(mo->codemask.mask);
return mo->codelookup;
} | [
"UINT16",
"*",
"atarimo_get_code_lookup",
"(",
"int",
"map",
",",
"int",
"*",
"size",
")",
"{",
"atarimo_data",
"*",
"mo",
"=",
"&",
"atarimo",
"[",
"map",
"]",
";",
"if",
"(",
"size",
")",
"*",
"size",
"=",
"round_to_powerof2",
"(",
"mo",
"->",
"codemask",
".",
"mask",
")",
";",
"return",
"mo",
"->",
"codelookup",
";",
"}"
] | atarimo_get_code_lookup: Returns a pointer to the code
lookup table. | [
"atarimo_get_code_lookup",
":",
"Returns",
"a",
"pointer",
"to",
"the",
"code",
"lookup",
"table",
"."
] | [] | [
{
"param": "map",
"type": "int"
},
{
"param": "size",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "map",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "size",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e3ca06cbd3c9bc34e9638fbefd587b30b62b57ae | lofunz/mieme | Reloaded/trunk/src/mame/video/atarimo.c | [
"Unlicense"
] | C | atarimo_get_color_lookup | UINT8 | UINT8 *atarimo_get_color_lookup(int map, int *size)
{
atarimo_data *mo = &atarimo[map];
if (size)
*size = round_to_powerof2(mo->colormask.mask);
return mo->colorlookup;
} | /*---------------------------------------------------------------
atarimo_get_color_lookup: Returns a pointer to the color
lookup table.
---------------------------------------------------------------*/ | Returns a pointer to the color
lookup table. | [
"Returns",
"a",
"pointer",
"to",
"the",
"color",
"lookup",
"table",
"."
] | UINT8 *atarimo_get_color_lookup(int map, int *size)
{
atarimo_data *mo = &atarimo[map];
if (size)
*size = round_to_powerof2(mo->colormask.mask);
return mo->colorlookup;
} | [
"UINT8",
"*",
"atarimo_get_color_lookup",
"(",
"int",
"map",
",",
"int",
"*",
"size",
")",
"{",
"atarimo_data",
"*",
"mo",
"=",
"&",
"atarimo",
"[",
"map",
"]",
";",
"if",
"(",
"size",
")",
"*",
"size",
"=",
"round_to_powerof2",
"(",
"mo",
"->",
"colormask",
".",
"mask",
")",
";",
"return",
"mo",
"->",
"colorlookup",
";",
"}"
] | atarimo_get_color_lookup: Returns a pointer to the color
lookup table. | [
"atarimo_get_color_lookup",
":",
"Returns",
"a",
"pointer",
"to",
"the",
"color",
"lookup",
"table",
"."
] | [] | [
{
"param": "map",
"type": "int"
},
{
"param": "size",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "map",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "size",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e3ca06cbd3c9bc34e9638fbefd587b30b62b57ae | lofunz/mieme | Reloaded/trunk/src/mame/video/atarimo.c | [
"Unlicense"
] | C | atarimo_get_gfx_lookup | UINT8 | UINT8 *atarimo_get_gfx_lookup(int map, int *size)
{
atarimo_data *mo = &atarimo[map];
mo->gfxchanged = TRUE;
if (size)
*size = round_to_powerof2(mo->gfxmask.mask);
return mo->gfxlookup;
} | /*---------------------------------------------------------------
atarimo_get_gfx_lookup: Returns a pointer to the graphics
lookup table.
---------------------------------------------------------------*/ | Returns a pointer to the graphics
lookup table. | [
"Returns",
"a",
"pointer",
"to",
"the",
"graphics",
"lookup",
"table",
"."
] | UINT8 *atarimo_get_gfx_lookup(int map, int *size)
{
atarimo_data *mo = &atarimo[map];
mo->gfxchanged = TRUE;
if (size)
*size = round_to_powerof2(mo->gfxmask.mask);
return mo->gfxlookup;
} | [
"UINT8",
"*",
"atarimo_get_gfx_lookup",
"(",
"int",
"map",
",",
"int",
"*",
"size",
")",
"{",
"atarimo_data",
"*",
"mo",
"=",
"&",
"atarimo",
"[",
"map",
"]",
";",
"mo",
"->",
"gfxchanged",
"=",
"TRUE",
";",
"if",
"(",
"size",
")",
"*",
"size",
"=",
"round_to_powerof2",
"(",
"mo",
"->",
"gfxmask",
".",
"mask",
")",
";",
"return",
"mo",
"->",
"gfxlookup",
";",
"}"
] | atarimo_get_gfx_lookup: Returns a pointer to the graphics
lookup table. | [
"atarimo_get_gfx_lookup",
":",
"Returns",
"a",
"pointer",
"to",
"the",
"graphics",
"lookup",
"table",
"."
] | [] | [
{
"param": "map",
"type": "int"
},
{
"param": "size",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "map",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "size",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e3ca06cbd3c9bc34e9638fbefd587b30b62b57ae | lofunz/mieme | Reloaded/trunk/src/mame/video/atarimo.c | [
"Unlicense"
] | C | build_active_list | void | static void build_active_list(atarimo_data *mo, int link)
{
atarimo_entry *bankbase = &mo->spriteram[mo->bank << mo->entrybits];
UINT8 movisit[ATARIMO_MAXPERBANK];
atarimo_entry **current;
int i;
/* reset the visit map */
memset(movisit, 0, mo->entrycount);
/* visit all the motion objects and copy their data into the display list */
for (i = 0, current = mo->activelist; i < mo->maxperline && !movisit[link]; i++)
{
atarimo_entry *modata = &bankbase[link];
/* copy the current entry into the list */
*current++ = modata;
/* link to the next object */
movisit[link] = 1;
if (mo->linked)
link = EXTRACT_DATA(modata, mo->linkmask);
else
link = (link + 1) & mo->linkmask.mask;
}
/* note the last entry */
mo->activelast = current;
} | /*---------------------------------------------------------------
build_active_list: Build a list of active objects.
---------------------------------------------------------------*/ | Build a list of active objects. | [
"Build",
"a",
"list",
"of",
"active",
"objects",
"."
] | static void build_active_list(atarimo_data *mo, int link)
{
atarimo_entry *bankbase = &mo->spriteram[mo->bank << mo->entrybits];
UINT8 movisit[ATARIMO_MAXPERBANK];
atarimo_entry **current;
int i;
memset(movisit, 0, mo->entrycount);
for (i = 0, current = mo->activelist; i < mo->maxperline && !movisit[link]; i++)
{
atarimo_entry *modata = &bankbase[link];
*current++ = modata;
movisit[link] = 1;
if (mo->linked)
link = EXTRACT_DATA(modata, mo->linkmask);
else
link = (link + 1) & mo->linkmask.mask;
}
mo->activelast = current;
} | [
"static",
"void",
"build_active_list",
"(",
"atarimo_data",
"*",
"mo",
",",
"int",
"link",
")",
"{",
"atarimo_entry",
"*",
"bankbase",
"=",
"&",
"mo",
"->",
"spriteram",
"[",
"mo",
"->",
"bank",
"<<",
"mo",
"->",
"entrybits",
"]",
";",
"UINT8",
"movisit",
"[",
"ATARIMO_MAXPERBANK",
"]",
";",
"atarimo_entry",
"*",
"*",
"current",
";",
"int",
"i",
";",
"memset",
"(",
"movisit",
",",
"0",
",",
"mo",
"->",
"entrycount",
")",
";",
"for",
"(",
"i",
"=",
"0",
",",
"current",
"=",
"mo",
"->",
"activelist",
";",
"i",
"<",
"mo",
"->",
"maxperline",
"&&",
"!",
"movisit",
"[",
"link",
"]",
";",
"i",
"++",
")",
"{",
"atarimo_entry",
"*",
"modata",
"=",
"&",
"bankbase",
"[",
"link",
"]",
";",
"*",
"current",
"++",
"=",
"modata",
";",
"movisit",
"[",
"link",
"]",
"=",
"1",
";",
"if",
"(",
"mo",
"->",
"linked",
")",
"link",
"=",
"EXTRACT_DATA",
"(",
"modata",
",",
"mo",
"->",
"linkmask",
")",
";",
"else",
"link",
"=",
"(",
"link",
"+",
"1",
")",
"&",
"mo",
"->",
"linkmask",
".",
"mask",
";",
"}",
"mo",
"->",
"activelast",
"=",
"current",
";",
"}"
] | build_active_list: Build a list of active objects. | [
"build_active_list",
":",
"Build",
"a",
"list",
"of",
"active",
"objects",
"."
] | [
"/* reset the visit map */",
"/* visit all the motion objects and copy their data into the display list */",
"/* copy the current entry into the list */",
"/* link to the next object */",
"/* note the last entry */"
] | [
{
"param": "mo",
"type": "atarimo_data"
},
{
"param": "link",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mo",
"type": "atarimo_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "link",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e3ca06cbd3c9bc34e9638fbefd587b30b62b57ae | lofunz/mieme | Reloaded/trunk/src/mame/video/atarimo.c | [
"Unlicense"
] | C | erase_dirty_grid | void | static void erase_dirty_grid(atarimo_data *mo, const rectangle *cliprect)
{
int sx = cliprect->min_x >> mo->tilexshift;
int ex = cliprect->max_x >> mo->tilexshift;
int sy = cliprect->min_y >> mo->tileyshift;
int ey = cliprect->max_y >> mo->tileyshift;
int y;
/* loop over all grid rows that intersect our cliprect */
for (y = sy; y <= ey; y++)
{
/* get the base pointer and memset the row */
UINT8 *dirtybase = get_dirty_base(mo, cliprect->min_x, y << mo->tileyshift);
memset(dirtybase, 0, ex - sx + 1);
}
} | /*---------------------------------------------------------------
erase_dirty_grid: Erases the dirty grid within a given
cliprect.
---------------------------------------------------------------*/ | Erases the dirty grid within a given
cliprect. | [
"Erases",
"the",
"dirty",
"grid",
"within",
"a",
"given",
"cliprect",
"."
] | static void erase_dirty_grid(atarimo_data *mo, const rectangle *cliprect)
{
int sx = cliprect->min_x >> mo->tilexshift;
int ex = cliprect->max_x >> mo->tilexshift;
int sy = cliprect->min_y >> mo->tileyshift;
int ey = cliprect->max_y >> mo->tileyshift;
int y;
for (y = sy; y <= ey; y++)
{
UINT8 *dirtybase = get_dirty_base(mo, cliprect->min_x, y << mo->tileyshift);
memset(dirtybase, 0, ex - sx + 1);
}
} | [
"static",
"void",
"erase_dirty_grid",
"(",
"atarimo_data",
"*",
"mo",
",",
"const",
"rectangle",
"*",
"cliprect",
")",
"{",
"int",
"sx",
"=",
"cliprect",
"->",
"min_x",
">>",
"mo",
"->",
"tilexshift",
";",
"int",
"ex",
"=",
"cliprect",
"->",
"max_x",
">>",
"mo",
"->",
"tilexshift",
";",
"int",
"sy",
"=",
"cliprect",
"->",
"min_y",
">>",
"mo",
"->",
"tileyshift",
";",
"int",
"ey",
"=",
"cliprect",
"->",
"max_y",
">>",
"mo",
"->",
"tileyshift",
";",
"int",
"y",
";",
"for",
"(",
"y",
"=",
"sy",
";",
"y",
"<=",
"ey",
";",
"y",
"++",
")",
"{",
"UINT8",
"*",
"dirtybase",
"=",
"get_dirty_base",
"(",
"mo",
",",
"cliprect",
"->",
"min_x",
",",
"y",
"<<",
"mo",
"->",
"tileyshift",
")",
";",
"memset",
"(",
"dirtybase",
",",
"0",
",",
"ex",
"-",
"sx",
"+",
"1",
")",
";",
"}",
"}"
] | erase_dirty_grid: Erases the dirty grid within a given
cliprect. | [
"erase_dirty_grid",
":",
"Erases",
"the",
"dirty",
"grid",
"within",
"a",
"given",
"cliprect",
"."
] | [
"/* loop over all grid rows that intersect our cliprect */",
"/* get the base pointer and memset the row */"
] | [
{
"param": "mo",
"type": "atarimo_data"
},
{
"param": "cliprect",
"type": "rectangle"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mo",
"type": "atarimo_data",
"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": []
} |
e3ca06cbd3c9bc34e9638fbefd587b30b62b57ae | lofunz/mieme | Reloaded/trunk/src/mame/video/atarimo.c | [
"Unlicense"
] | C | convert_dirty_grid_to_rects | void | static void convert_dirty_grid_to_rects(atarimo_data *mo, const rectangle *cliprect, atarimo_rect_list *rectlist)
{
int sx = cliprect->min_x >> mo->tilexshift;
int ex = cliprect->max_x >> mo->tilexshift;
int sy = cliprect->min_y >> mo->tileyshift;
int ey = cliprect->max_y >> mo->tileyshift;
int tilewidth = 1 << mo->tilexshift;
int tileheight = 1 << mo->tileyshift;
rectangle *rect;
int x, y;
/* initialize the rect list */
rectlist->numrects = 0;
rectlist->rect = mo->rectlist;
rect = &mo->rectlist[-1];
/* loop over all grid rows that intersect our cliprect */
for (y = sy; y <= ey; y++)
{
UINT8 *dirtybase = get_dirty_base(mo, cliprect->min_x, y << mo->tileyshift);
int can_add_to_existing = 0;
/* loop over all grid columns that intersect our cliprect */
for (x = sx; x <= ex; x++)
{
/* if this tile is dirty, add that to our rectlist */
if (*dirtybase++)
{
/* if we can't add to an existing rect, create a new one */
if (!can_add_to_existing)
{
/* advance pointers */
rectlist->numrects++;
rect++;
/* make a rect describing this grid square */
rect->min_x = x << mo->tilexshift;
rect->max_x = rect->min_x + tilewidth - 1;
rect->min_y = y << mo->tileyshift;
rect->max_y = rect->min_y + tileheight - 1;
/* neighboring grid squares can add to this one */
can_add_to_existing = 1;
}
/* if we can add to the previous rect, just expand its width */
else
rect->max_x += tilewidth;
}
/* once we hit a non-dirty square, we can no longer add on */
else
can_add_to_existing = 0;
}
}
} | /*---------------------------------------------------------------
convert_dirty_grid_to_rects: Converts a dirty grid into a
series of cliprects.
---------------------------------------------------------------*/ | Converts a dirty grid into a
series of cliprects. | [
"Converts",
"a",
"dirty",
"grid",
"into",
"a",
"series",
"of",
"cliprects",
"."
] | static void convert_dirty_grid_to_rects(atarimo_data *mo, const rectangle *cliprect, atarimo_rect_list *rectlist)
{
int sx = cliprect->min_x >> mo->tilexshift;
int ex = cliprect->max_x >> mo->tilexshift;
int sy = cliprect->min_y >> mo->tileyshift;
int ey = cliprect->max_y >> mo->tileyshift;
int tilewidth = 1 << mo->tilexshift;
int tileheight = 1 << mo->tileyshift;
rectangle *rect;
int x, y;
rectlist->numrects = 0;
rectlist->rect = mo->rectlist;
rect = &mo->rectlist[-1];
for (y = sy; y <= ey; y++)
{
UINT8 *dirtybase = get_dirty_base(mo, cliprect->min_x, y << mo->tileyshift);
int can_add_to_existing = 0;
for (x = sx; x <= ex; x++)
{
if (*dirtybase++)
{
if (!can_add_to_existing)
{
rectlist->numrects++;
rect++;
rect->min_x = x << mo->tilexshift;
rect->max_x = rect->min_x + tilewidth - 1;
rect->min_y = y << mo->tileyshift;
rect->max_y = rect->min_y + tileheight - 1;
can_add_to_existing = 1;
}
else
rect->max_x += tilewidth;
}
else
can_add_to_existing = 0;
}
}
} | [
"static",
"void",
"convert_dirty_grid_to_rects",
"(",
"atarimo_data",
"*",
"mo",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"atarimo_rect_list",
"*",
"rectlist",
")",
"{",
"int",
"sx",
"=",
"cliprect",
"->",
"min_x",
">>",
"mo",
"->",
"tilexshift",
";",
"int",
"ex",
"=",
"cliprect",
"->",
"max_x",
">>",
"mo",
"->",
"tilexshift",
";",
"int",
"sy",
"=",
"cliprect",
"->",
"min_y",
">>",
"mo",
"->",
"tileyshift",
";",
"int",
"ey",
"=",
"cliprect",
"->",
"max_y",
">>",
"mo",
"->",
"tileyshift",
";",
"int",
"tilewidth",
"=",
"1",
"<<",
"mo",
"->",
"tilexshift",
";",
"int",
"tileheight",
"=",
"1",
"<<",
"mo",
"->",
"tileyshift",
";",
"rectangle",
"*",
"rect",
";",
"int",
"x",
",",
"y",
";",
"rectlist",
"->",
"numrects",
"=",
"0",
";",
"rectlist",
"->",
"rect",
"=",
"mo",
"->",
"rectlist",
";",
"rect",
"=",
"&",
"mo",
"->",
"rectlist",
"[",
"-1",
"]",
";",
"for",
"(",
"y",
"=",
"sy",
";",
"y",
"<=",
"ey",
";",
"y",
"++",
")",
"{",
"UINT8",
"*",
"dirtybase",
"=",
"get_dirty_base",
"(",
"mo",
",",
"cliprect",
"->",
"min_x",
",",
"y",
"<<",
"mo",
"->",
"tileyshift",
")",
";",
"int",
"can_add_to_existing",
"=",
"0",
";",
"for",
"(",
"x",
"=",
"sx",
";",
"x",
"<=",
"ex",
";",
"x",
"++",
")",
"{",
"if",
"(",
"*",
"dirtybase",
"++",
")",
"{",
"if",
"(",
"!",
"can_add_to_existing",
")",
"{",
"rectlist",
"->",
"numrects",
"++",
";",
"rect",
"++",
";",
"rect",
"->",
"min_x",
"=",
"x",
"<<",
"mo",
"->",
"tilexshift",
";",
"rect",
"->",
"max_x",
"=",
"rect",
"->",
"min_x",
"+",
"tilewidth",
"-",
"1",
";",
"rect",
"->",
"min_y",
"=",
"y",
"<<",
"mo",
"->",
"tileyshift",
";",
"rect",
"->",
"max_y",
"=",
"rect",
"->",
"min_y",
"+",
"tileheight",
"-",
"1",
";",
"can_add_to_existing",
"=",
"1",
";",
"}",
"else",
"rect",
"->",
"max_x",
"+=",
"tilewidth",
";",
"}",
"else",
"can_add_to_existing",
"=",
"0",
";",
"}",
"}",
"}"
] | convert_dirty_grid_to_rects: Converts a dirty grid into a
series of cliprects. | [
"convert_dirty_grid_to_rects",
":",
"Converts",
"a",
"dirty",
"grid",
"into",
"a",
"series",
"of",
"cliprects",
"."
] | [
"/* initialize the rect list */",
"/* loop over all grid rows that intersect our cliprect */",
"/* loop over all grid columns that intersect our cliprect */",
"/* if this tile is dirty, add that to our rectlist */",
"/* if we can't add to an existing rect, create a new one */",
"/* advance pointers */",
"/* make a rect describing this grid square */",
"/* neighboring grid squares can add to this one */",
"/* if we can add to the previous rect, just expand its width */",
"/* once we hit a non-dirty square, we can no longer add on */"
] | [
{
"param": "mo",
"type": "atarimo_data"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "rectlist",
"type": "atarimo_rect_list"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mo",
"type": "atarimo_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rectlist",
"type": "atarimo_rect_list",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e3ca06cbd3c9bc34e9638fbefd587b30b62b57ae | lofunz/mieme | Reloaded/trunk/src/mame/video/atarimo.c | [
"Unlicense"
] | C | atarimo_render | bitmap_t | bitmap_t *atarimo_render(int map, const rectangle *cliprect, atarimo_rect_list *rectlist)
{
atarimo_data *mo = &atarimo[map];
int startband, stopband, band, i;
rectangle *rect;
/* if the graphics info has changed, recompute */
if (mo->gfxchanged)
{
mo->gfxchanged = FALSE;
for (i = 0; i < round_to_powerof2(mo->gfxmask.mask); i++)
init_gfxelement(mo, mo->gfxlookup[i]);
}
/* compute start/stop bands */
startband = ((cliprect->min_y + mo->yscroll - mo->slipoffset) & mo->bitmapymask) >> mo->slipshift;
stopband = ((cliprect->max_y + mo->yscroll - mo->slipoffset) & mo->bitmapymask) >> mo->slipshift;
if (startband > stopband)
startband -= mo->bitmapheight >> mo->slipshift;
if (!mo->slipshift)
stopband = startband;
/* erase the dirty grid */
erase_dirty_grid(mo, cliprect);
/* loop over SLIP bands */
for (band = startband; band <= stopband; band++)
{
atarimo_entry **first, **current, **last;
rectangle bandclip;
int link, step;
/* if we don't use SLIPs, just recapture from 0 */
if (!mo->slipshift)
{
link = 0;
bandclip = *cliprect;
}
/* otherwise, grab the SLIP and compute the bandrect */
else
{
int slipentry = band & mo->sliprammask;
link = ((*mo->slipram)[slipentry] >> mo->linkmask.shift) & mo->linkmask.mask;
/* start with the cliprect */
bandclip = *cliprect;
/* compute minimum Y and wrap around if necessary */
bandclip.min_y = ((band << mo->slipshift) - mo->yscroll + mo->slipoffset) & mo->bitmapymask;
if (bandclip.min_y > mo->machine->primary_screen->visible_area().max_y)
bandclip.min_y -= mo->bitmapheight;
/* maximum Y is based on the minimum */
bandclip.max_y = bandclip.min_y + (1 << mo->slipshift) - 1;
/* keep within the cliprect */
sect_rect(&bandclip, cliprect);
}
/* if this matches the last link, we don't need to re-process the list */
build_active_list(mo, link);
/* set the start and end points */
if (mo->reverse)
{
first = mo->activelast - 1;
last = mo->activelist - 1;
step = -1;
}
else
{
first = mo->activelist;
last = mo->activelast;
step = 1;
}
/* initialize the parameters */
mo->next_xpos = 123456;
/* render the mos */
for (current = first; current != last; current += step)
mo_render_object(mo, *current, &bandclip);
}
/* convert the dirty grid to a rectlist */
convert_dirty_grid_to_rects(mo, cliprect, rectlist);
/* clip the rectlist */
for (i = 0, rect = rectlist->rect; i < rectlist->numrects; i++, rect++)
sect_rect(rect, cliprect);
/* return the bitmap */
return mo->bitmap;
} | /*---------------------------------------------------------------
atarimo_render: Render the motion objects to the
destination bitmap.
---------------------------------------------------------------*/ | Render the motion objects to the
destination bitmap. | [
"Render",
"the",
"motion",
"objects",
"to",
"the",
"destination",
"bitmap",
"."
] | bitmap_t *atarimo_render(int map, const rectangle *cliprect, atarimo_rect_list *rectlist)
{
atarimo_data *mo = &atarimo[map];
int startband, stopband, band, i;
rectangle *rect;
if (mo->gfxchanged)
{
mo->gfxchanged = FALSE;
for (i = 0; i < round_to_powerof2(mo->gfxmask.mask); i++)
init_gfxelement(mo, mo->gfxlookup[i]);
}
startband = ((cliprect->min_y + mo->yscroll - mo->slipoffset) & mo->bitmapymask) >> mo->slipshift;
stopband = ((cliprect->max_y + mo->yscroll - mo->slipoffset) & mo->bitmapymask) >> mo->slipshift;
if (startband > stopband)
startband -= mo->bitmapheight >> mo->slipshift;
if (!mo->slipshift)
stopband = startband;
erase_dirty_grid(mo, cliprect);
for (band = startband; band <= stopband; band++)
{
atarimo_entry **first, **current, **last;
rectangle bandclip;
int link, step;
if (!mo->slipshift)
{
link = 0;
bandclip = *cliprect;
}
else
{
int slipentry = band & mo->sliprammask;
link = ((*mo->slipram)[slipentry] >> mo->linkmask.shift) & mo->linkmask.mask;
bandclip = *cliprect;
bandclip.min_y = ((band << mo->slipshift) - mo->yscroll + mo->slipoffset) & mo->bitmapymask;
if (bandclip.min_y > mo->machine->primary_screen->visible_area().max_y)
bandclip.min_y -= mo->bitmapheight;
bandclip.max_y = bandclip.min_y + (1 << mo->slipshift) - 1;
sect_rect(&bandclip, cliprect);
}
build_active_list(mo, link);
if (mo->reverse)
{
first = mo->activelast - 1;
last = mo->activelist - 1;
step = -1;
}
else
{
first = mo->activelist;
last = mo->activelast;
step = 1;
}
mo->next_xpos = 123456;
for (current = first; current != last; current += step)
mo_render_object(mo, *current, &bandclip);
}
convert_dirty_grid_to_rects(mo, cliprect, rectlist);
for (i = 0, rect = rectlist->rect; i < rectlist->numrects; i++, rect++)
sect_rect(rect, cliprect);
return mo->bitmap;
} | [
"bitmap_t",
"*",
"atarimo_render",
"(",
"int",
"map",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"atarimo_rect_list",
"*",
"rectlist",
")",
"{",
"atarimo_data",
"*",
"mo",
"=",
"&",
"atarimo",
"[",
"map",
"]",
";",
"int",
"startband",
",",
"stopband",
",",
"band",
",",
"i",
";",
"rectangle",
"*",
"rect",
";",
"if",
"(",
"mo",
"->",
"gfxchanged",
")",
"{",
"mo",
"->",
"gfxchanged",
"=",
"FALSE",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"round_to_powerof2",
"(",
"mo",
"->",
"gfxmask",
".",
"mask",
")",
";",
"i",
"++",
")",
"init_gfxelement",
"(",
"mo",
",",
"mo",
"->",
"gfxlookup",
"[",
"i",
"]",
")",
";",
"}",
"startband",
"=",
"(",
"(",
"cliprect",
"->",
"min_y",
"+",
"mo",
"->",
"yscroll",
"-",
"mo",
"->",
"slipoffset",
")",
"&",
"mo",
"->",
"bitmapymask",
")",
">>",
"mo",
"->",
"slipshift",
";",
"stopband",
"=",
"(",
"(",
"cliprect",
"->",
"max_y",
"+",
"mo",
"->",
"yscroll",
"-",
"mo",
"->",
"slipoffset",
")",
"&",
"mo",
"->",
"bitmapymask",
")",
">>",
"mo",
"->",
"slipshift",
";",
"if",
"(",
"startband",
">",
"stopband",
")",
"startband",
"-=",
"mo",
"->",
"bitmapheight",
">>",
"mo",
"->",
"slipshift",
";",
"if",
"(",
"!",
"mo",
"->",
"slipshift",
")",
"stopband",
"=",
"startband",
";",
"erase_dirty_grid",
"(",
"mo",
",",
"cliprect",
")",
";",
"for",
"(",
"band",
"=",
"startband",
";",
"band",
"<=",
"stopband",
";",
"band",
"++",
")",
"{",
"atarimo_entry",
"*",
"*",
"first",
",",
"*",
"*",
"current",
",",
"*",
"*",
"last",
";",
"rectangle",
"bandclip",
";",
"int",
"link",
",",
"step",
";",
"if",
"(",
"!",
"mo",
"->",
"slipshift",
")",
"{",
"link",
"=",
"0",
";",
"bandclip",
"=",
"*",
"cliprect",
";",
"}",
"else",
"{",
"int",
"slipentry",
"=",
"band",
"&",
"mo",
"->",
"sliprammask",
";",
"link",
"=",
"(",
"(",
"*",
"mo",
"->",
"slipram",
")",
"[",
"slipentry",
"]",
">>",
"mo",
"->",
"linkmask",
".",
"shift",
")",
"&",
"mo",
"->",
"linkmask",
".",
"mask",
";",
"bandclip",
"=",
"*",
"cliprect",
";",
"bandclip",
".",
"min_y",
"=",
"(",
"(",
"band",
"<<",
"mo",
"->",
"slipshift",
")",
"-",
"mo",
"->",
"yscroll",
"+",
"mo",
"->",
"slipoffset",
")",
"&",
"mo",
"->",
"bitmapymask",
";",
"if",
"(",
"bandclip",
".",
"min_y",
">",
"mo",
"->",
"machine",
"->",
"primary_screen",
"->",
"visible_area",
"(",
")",
".",
"max_y",
")",
"bandclip",
".",
"min_y",
"-=",
"mo",
"->",
"bitmapheight",
";",
"bandclip",
".",
"max_y",
"=",
"bandclip",
".",
"min_y",
"+",
"(",
"1",
"<<",
"mo",
"->",
"slipshift",
")",
"-",
"1",
";",
"sect_rect",
"(",
"&",
"bandclip",
",",
"cliprect",
")",
";",
"}",
"build_active_list",
"(",
"mo",
",",
"link",
")",
";",
"if",
"(",
"mo",
"->",
"reverse",
")",
"{",
"first",
"=",
"mo",
"->",
"activelast",
"-",
"1",
";",
"last",
"=",
"mo",
"->",
"activelist",
"-",
"1",
";",
"step",
"=",
"-1",
";",
"}",
"else",
"{",
"first",
"=",
"mo",
"->",
"activelist",
";",
"last",
"=",
"mo",
"->",
"activelast",
";",
"step",
"=",
"1",
";",
"}",
"mo",
"->",
"next_xpos",
"=",
"123456",
";",
"for",
"(",
"current",
"=",
"first",
";",
"current",
"!=",
"last",
";",
"current",
"+=",
"step",
")",
"mo_render_object",
"(",
"mo",
",",
"*",
"current",
",",
"&",
"bandclip",
")",
";",
"}",
"convert_dirty_grid_to_rects",
"(",
"mo",
",",
"cliprect",
",",
"rectlist",
")",
";",
"for",
"(",
"i",
"=",
"0",
",",
"rect",
"=",
"rectlist",
"->",
"rect",
";",
"i",
"<",
"rectlist",
"->",
"numrects",
";",
"i",
"++",
",",
"rect",
"++",
")",
"sect_rect",
"(",
"rect",
",",
"cliprect",
")",
";",
"return",
"mo",
"->",
"bitmap",
";",
"}"
] | atarimo_render: Render the motion objects to the
destination bitmap. | [
"atarimo_render",
":",
"Render",
"the",
"motion",
"objects",
"to",
"the",
"destination",
"bitmap",
"."
] | [
"/* if the graphics info has changed, recompute */",
"/* compute start/stop bands */",
"/* erase the dirty grid */",
"/* loop over SLIP bands */",
"/* if we don't use SLIPs, just recapture from 0 */",
"/* otherwise, grab the SLIP and compute the bandrect */",
"/* start with the cliprect */",
"/* compute minimum Y and wrap around if necessary */",
"/* maximum Y is based on the minimum */",
"/* keep within the cliprect */",
"/* if this matches the last link, we don't need to re-process the list */",
"/* set the start and end points */",
"/* initialize the parameters */",
"/* render the mos */",
"/* convert the dirty grid to a rectlist */",
"/* clip the rectlist */",
"/* return the bitmap */"
] | [
{
"param": "map",
"type": "int"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "rectlist",
"type": "atarimo_rect_list"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "map",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rectlist",
"type": "atarimo_rect_list",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e3ca06cbd3c9bc34e9638fbefd587b30b62b57ae | lofunz/mieme | Reloaded/trunk/src/mame/video/atarimo.c | [
"Unlicense"
] | C | mo_render_object | int | static int mo_render_object(atarimo_data *mo, const atarimo_entry *entry, const rectangle *cliprect)
{
int gfxindex = mo->gfxlookup[EXTRACT_DATA(entry, mo->gfxmask)];
const gfx_element *gfx = &mo->gfxelement[gfxindex];
bitmap_t *bitmap = mo->bitmap;
int x, y, sx, sy;
/* extract data from the various words */
int code = mo->codelookup[EXTRACT_DATA(entry, mo->codemask)] | (EXTRACT_DATA(entry, mo->codehighmask) << mo->codehighshift);
int color = mo->colorlookup[EXTRACT_DATA(entry, mo->colormask)];
int xpos = EXTRACT_DATA(entry, mo->xposmask);
int ypos = -EXTRACT_DATA(entry, mo->yposmask);
int hflip = EXTRACT_DATA(entry, mo->hflipmask);
int vflip = EXTRACT_DATA(entry, mo->vflipmask);
int width = EXTRACT_DATA(entry, mo->widthmask) + 1;
int height = EXTRACT_DATA(entry, mo->heightmask) + 1;
int priority = EXTRACT_DATA(entry, mo->prioritymask);
int xadv, yadv, rendered = 0;
UINT8 *dirtybase;
#ifdef TEMPDEBUG
int temp = EXTRACT_DATA(entry, mo->codemask);
if ((temp & 0xff00) == 0xc800)
{
static UINT8 hits[256];
if (!hits[temp & 0xff])
{
fprintf(stderr, "code = %04X\n", temp);
hits[temp & 0xff] = 1;
}
}
#endif
/* compute the effective color, merging in priority */
color = (color * mo->gfxgranularity[gfxindex]) | (priority << ATARIMO_PRIORITY_SHIFT);
color += mo->palettebase;
/* add in the scroll positions if we're not in absolute coordinates */
if (!EXTRACT_DATA(entry, mo->absolutemask))
{
xpos -= mo->xscroll;
ypos -= mo->yscroll;
}
/* adjust for height */
ypos -= height << mo->tileyshift;
/* handle previous hold bits */
if (mo->next_xpos != 123456)
xpos = mo->next_xpos;
mo->next_xpos = 123456;
/* check for the hold bit */
if (EXTRACT_DATA(entry, mo->neighbormask))
{
if (!mo->nextneighbor)
xpos = mo->last_xpos + mo->tilewidth;
else
mo->next_xpos = xpos + mo->tilewidth;
}
mo->last_xpos = xpos;
/* adjust the final coordinates */
xpos &= mo->bitmapxmask;
ypos &= mo->bitmapymask;
if (xpos > mo->machine->primary_screen->visible_area().max_x) xpos -= mo->bitmapwidth;
if (ypos > mo->machine->primary_screen->visible_area().max_y) ypos -= mo->bitmapheight;
/* is this one special? */
if (mo->specialmask.mask != 0 && EXTRACT_DATA(entry, mo->specialmask) == mo->specialvalue)
{
if (mo->specialcb)
return (*mo->specialcb)(bitmap, cliprect, code, color, xpos, ypos, NULL);
return 0;
}
/* adjust for h flip */
xadv = mo->tilewidth;
if (hflip)
{
xpos += (width - 1) << mo->tilexshift;
xadv = -xadv;
}
/* adjust for v flip */
yadv = mo->tileheight;
if (vflip)
{
ypos += (height - 1) << mo->tileyshift;
yadv = -yadv;
}
/* standard order is: loop over Y first, then X */
if (!mo->swapxy)
{
/* loop over the height */
for (y = 0, sy = ypos; y < height; y++, sy += yadv)
{
/* clip the Y coordinate */
if (sy <= cliprect->min_y - mo->tileheight)
{
code += width;
continue;
}
else if (sy > cliprect->max_y)
break;
/* loop over the width */
for (x = 0, sx = xpos; x < width; x++, sx += xadv, code++)
{
/* clip the X coordinate */
if (sx <= -cliprect->min_x - mo->tilewidth || sx > cliprect->max_x)
continue;
/* draw the sprite */
drawgfx_transpen_raw(bitmap, cliprect, gfx, code, color, hflip, vflip, sx, sy, mo->transpen);
rendered = 1;
/* mark the grid dirty */
dirtybase = get_dirty_base(mo, sx, sy);
dirtybase[0] = 1;
dirtybase[1] = 1;
dirtybase[mo->dirtywidth] = 1;
dirtybase[mo->dirtywidth + 1] = 1;
}
}
}
/* alternative order is swapped */
else
{
/* loop over the width */
for (x = 0, sx = xpos; x < width; x++, sx += xadv)
{
/* clip the X coordinate */
if (sx <= cliprect->min_x - mo->tilewidth)
{
code += height;
continue;
}
else if (sx > cliprect->max_x)
break;
/* loop over the height */
dirtybase = get_dirty_base(mo, sx, ypos);
for (y = 0, sy = ypos; y < height; y++, sy += yadv, code++)
{
/* clip the X coordinate */
if (sy <= -cliprect->min_y - mo->tileheight || sy > cliprect->max_y)
continue;
/* draw the sprite */
drawgfx_transpen_raw(bitmap, cliprect, gfx, code, color, hflip, vflip, sx, sy, mo->transpen);
rendered = 1;
/* mark the grid dirty */
dirtybase = get_dirty_base(mo, sx, sy);
dirtybase[0] = 1;
dirtybase[1] = 1;
dirtybase[mo->dirtywidth] = 1;
dirtybase[mo->dirtywidth + 1] = 1;
}
}
}
return rendered;
} | /*---------------------------------------------------------------
mo_render_object: Internal processing callback that
renders to the backing bitmap and then copies the result
to the destination.
---------------------------------------------------------------*/ | Internal processing callback that
renders to the backing bitmap and then copies the result
to the destination. | [
"Internal",
"processing",
"callback",
"that",
"renders",
"to",
"the",
"backing",
"bitmap",
"and",
"then",
"copies",
"the",
"result",
"to",
"the",
"destination",
"."
] | static int mo_render_object(atarimo_data *mo, const atarimo_entry *entry, const rectangle *cliprect)
{
int gfxindex = mo->gfxlookup[EXTRACT_DATA(entry, mo->gfxmask)];
const gfx_element *gfx = &mo->gfxelement[gfxindex];
bitmap_t *bitmap = mo->bitmap;
int x, y, sx, sy;
int code = mo->codelookup[EXTRACT_DATA(entry, mo->codemask)] | (EXTRACT_DATA(entry, mo->codehighmask) << mo->codehighshift);
int color = mo->colorlookup[EXTRACT_DATA(entry, mo->colormask)];
int xpos = EXTRACT_DATA(entry, mo->xposmask);
int ypos = -EXTRACT_DATA(entry, mo->yposmask);
int hflip = EXTRACT_DATA(entry, mo->hflipmask);
int vflip = EXTRACT_DATA(entry, mo->vflipmask);
int width = EXTRACT_DATA(entry, mo->widthmask) + 1;
int height = EXTRACT_DATA(entry, mo->heightmask) + 1;
int priority = EXTRACT_DATA(entry, mo->prioritymask);
int xadv, yadv, rendered = 0;
UINT8 *dirtybase;
#ifdef TEMPDEBUG
int temp = EXTRACT_DATA(entry, mo->codemask);
if ((temp & 0xff00) == 0xc800)
{
static UINT8 hits[256];
if (!hits[temp & 0xff])
{
fprintf(stderr, "code = %04X\n", temp);
hits[temp & 0xff] = 1;
}
}
#endif
color = (color * mo->gfxgranularity[gfxindex]) | (priority << ATARIMO_PRIORITY_SHIFT);
color += mo->palettebase;
if (!EXTRACT_DATA(entry, mo->absolutemask))
{
xpos -= mo->xscroll;
ypos -= mo->yscroll;
}
ypos -= height << mo->tileyshift;
if (mo->next_xpos != 123456)
xpos = mo->next_xpos;
mo->next_xpos = 123456;
if (EXTRACT_DATA(entry, mo->neighbormask))
{
if (!mo->nextneighbor)
xpos = mo->last_xpos + mo->tilewidth;
else
mo->next_xpos = xpos + mo->tilewidth;
}
mo->last_xpos = xpos;
xpos &= mo->bitmapxmask;
ypos &= mo->bitmapymask;
if (xpos > mo->machine->primary_screen->visible_area().max_x) xpos -= mo->bitmapwidth;
if (ypos > mo->machine->primary_screen->visible_area().max_y) ypos -= mo->bitmapheight;
if (mo->specialmask.mask != 0 && EXTRACT_DATA(entry, mo->specialmask) == mo->specialvalue)
{
if (mo->specialcb)
return (*mo->specialcb)(bitmap, cliprect, code, color, xpos, ypos, NULL);
return 0;
}
xadv = mo->tilewidth;
if (hflip)
{
xpos += (width - 1) << mo->tilexshift;
xadv = -xadv;
}
yadv = mo->tileheight;
if (vflip)
{
ypos += (height - 1) << mo->tileyshift;
yadv = -yadv;
}
if (!mo->swapxy)
{
for (y = 0, sy = ypos; y < height; y++, sy += yadv)
{
if (sy <= cliprect->min_y - mo->tileheight)
{
code += width;
continue;
}
else if (sy > cliprect->max_y)
break;
for (x = 0, sx = xpos; x < width; x++, sx += xadv, code++)
{
if (sx <= -cliprect->min_x - mo->tilewidth || sx > cliprect->max_x)
continue;
drawgfx_transpen_raw(bitmap, cliprect, gfx, code, color, hflip, vflip, sx, sy, mo->transpen);
rendered = 1;
dirtybase = get_dirty_base(mo, sx, sy);
dirtybase[0] = 1;
dirtybase[1] = 1;
dirtybase[mo->dirtywidth] = 1;
dirtybase[mo->dirtywidth + 1] = 1;
}
}
}
else
{
for (x = 0, sx = xpos; x < width; x++, sx += xadv)
{
if (sx <= cliprect->min_x - mo->tilewidth)
{
code += height;
continue;
}
else if (sx > cliprect->max_x)
break;
dirtybase = get_dirty_base(mo, sx, ypos);
for (y = 0, sy = ypos; y < height; y++, sy += yadv, code++)
{
if (sy <= -cliprect->min_y - mo->tileheight || sy > cliprect->max_y)
continue;
drawgfx_transpen_raw(bitmap, cliprect, gfx, code, color, hflip, vflip, sx, sy, mo->transpen);
rendered = 1;
dirtybase = get_dirty_base(mo, sx, sy);
dirtybase[0] = 1;
dirtybase[1] = 1;
dirtybase[mo->dirtywidth] = 1;
dirtybase[mo->dirtywidth + 1] = 1;
}
}
}
return rendered;
} | [
"static",
"int",
"mo_render_object",
"(",
"atarimo_data",
"*",
"mo",
",",
"const",
"atarimo_entry",
"*",
"entry",
",",
"const",
"rectangle",
"*",
"cliprect",
")",
"{",
"int",
"gfxindex",
"=",
"mo",
"->",
"gfxlookup",
"[",
"EXTRACT_DATA",
"(",
"entry",
",",
"mo",
"->",
"gfxmask",
")",
"]",
";",
"const",
"gfx_element",
"*",
"gfx",
"=",
"&",
"mo",
"->",
"gfxelement",
"[",
"gfxindex",
"]",
";",
"bitmap_t",
"*",
"bitmap",
"=",
"mo",
"->",
"bitmap",
";",
"int",
"x",
",",
"y",
",",
"sx",
",",
"sy",
";",
"int",
"code",
"=",
"mo",
"->",
"codelookup",
"[",
"EXTRACT_DATA",
"(",
"entry",
",",
"mo",
"->",
"codemask",
")",
"]",
"|",
"(",
"EXTRACT_DATA",
"(",
"entry",
",",
"mo",
"->",
"codehighmask",
")",
"<<",
"mo",
"->",
"codehighshift",
")",
";",
"int",
"color",
"=",
"mo",
"->",
"colorlookup",
"[",
"EXTRACT_DATA",
"(",
"entry",
",",
"mo",
"->",
"colormask",
")",
"]",
";",
"int",
"xpos",
"=",
"EXTRACT_DATA",
"(",
"entry",
",",
"mo",
"->",
"xposmask",
")",
";",
"int",
"ypos",
"=",
"-",
"EXTRACT_DATA",
"(",
"entry",
",",
"mo",
"->",
"yposmask",
")",
";",
"int",
"hflip",
"=",
"EXTRACT_DATA",
"(",
"entry",
",",
"mo",
"->",
"hflipmask",
")",
";",
"int",
"vflip",
"=",
"EXTRACT_DATA",
"(",
"entry",
",",
"mo",
"->",
"vflipmask",
")",
";",
"int",
"width",
"=",
"EXTRACT_DATA",
"(",
"entry",
",",
"mo",
"->",
"widthmask",
")",
"+",
"1",
";",
"int",
"height",
"=",
"EXTRACT_DATA",
"(",
"entry",
",",
"mo",
"->",
"heightmask",
")",
"+",
"1",
";",
"int",
"priority",
"=",
"EXTRACT_DATA",
"(",
"entry",
",",
"mo",
"->",
"prioritymask",
")",
";",
"int",
"xadv",
",",
"yadv",
",",
"rendered",
"=",
"0",
";",
"UINT8",
"*",
"dirtybase",
";",
"#ifdef",
"TEMPDEBUG",
"int",
"temp",
"=",
"EXTRACT_DATA",
"(",
"entry",
",",
"mo",
"->",
"codemask",
")",
";",
"if",
"(",
"(",
"temp",
"&",
"0xff00",
")",
"==",
"0xc800",
")",
"{",
"static",
"UINT8",
"hits",
"[",
"256",
"]",
";",
"if",
"(",
"!",
"hits",
"[",
"temp",
"&",
"0xff",
"]",
")",
"{",
"fprintf",
"(",
"stderr",
",",
"\"",
"\\n",
"\"",
",",
"temp",
")",
";",
"hits",
"[",
"temp",
"&",
"0xff",
"]",
"=",
"1",
";",
"}",
"}",
"#endif",
"color",
"=",
"(",
"color",
"*",
"mo",
"->",
"gfxgranularity",
"[",
"gfxindex",
"]",
")",
"|",
"(",
"priority",
"<<",
"ATARIMO_PRIORITY_SHIFT",
")",
";",
"color",
"+=",
"mo",
"->",
"palettebase",
";",
"if",
"(",
"!",
"EXTRACT_DATA",
"(",
"entry",
",",
"mo",
"->",
"absolutemask",
")",
")",
"{",
"xpos",
"-=",
"mo",
"->",
"xscroll",
";",
"ypos",
"-=",
"mo",
"->",
"yscroll",
";",
"}",
"ypos",
"-=",
"height",
"<<",
"mo",
"->",
"tileyshift",
";",
"if",
"(",
"mo",
"->",
"next_xpos",
"!=",
"123456",
")",
"xpos",
"=",
"mo",
"->",
"next_xpos",
";",
"mo",
"->",
"next_xpos",
"=",
"123456",
";",
"if",
"(",
"EXTRACT_DATA",
"(",
"entry",
",",
"mo",
"->",
"neighbormask",
")",
")",
"{",
"if",
"(",
"!",
"mo",
"->",
"nextneighbor",
")",
"xpos",
"=",
"mo",
"->",
"last_xpos",
"+",
"mo",
"->",
"tilewidth",
";",
"else",
"mo",
"->",
"next_xpos",
"=",
"xpos",
"+",
"mo",
"->",
"tilewidth",
";",
"}",
"mo",
"->",
"last_xpos",
"=",
"xpos",
";",
"xpos",
"&=",
"mo",
"->",
"bitmapxmask",
";",
"ypos",
"&=",
"mo",
"->",
"bitmapymask",
";",
"if",
"(",
"xpos",
">",
"mo",
"->",
"machine",
"->",
"primary_screen",
"->",
"visible_area",
"(",
")",
".",
"max_x",
")",
"xpos",
"-=",
"mo",
"->",
"bitmapwidth",
";",
"if",
"(",
"ypos",
">",
"mo",
"->",
"machine",
"->",
"primary_screen",
"->",
"visible_area",
"(",
")",
".",
"max_y",
")",
"ypos",
"-=",
"mo",
"->",
"bitmapheight",
";",
"if",
"(",
"mo",
"->",
"specialmask",
".",
"mask",
"!=",
"0",
"&&",
"EXTRACT_DATA",
"(",
"entry",
",",
"mo",
"->",
"specialmask",
")",
"==",
"mo",
"->",
"specialvalue",
")",
"{",
"if",
"(",
"mo",
"->",
"specialcb",
")",
"return",
"(",
"*",
"mo",
"->",
"specialcb",
")",
"(",
"bitmap",
",",
"cliprect",
",",
"code",
",",
"color",
",",
"xpos",
",",
"ypos",
",",
"NULL",
")",
";",
"return",
"0",
";",
"}",
"xadv",
"=",
"mo",
"->",
"tilewidth",
";",
"if",
"(",
"hflip",
")",
"{",
"xpos",
"+=",
"(",
"width",
"-",
"1",
")",
"<<",
"mo",
"->",
"tilexshift",
";",
"xadv",
"=",
"-",
"xadv",
";",
"}",
"yadv",
"=",
"mo",
"->",
"tileheight",
";",
"if",
"(",
"vflip",
")",
"{",
"ypos",
"+=",
"(",
"height",
"-",
"1",
")",
"<<",
"mo",
"->",
"tileyshift",
";",
"yadv",
"=",
"-",
"yadv",
";",
"}",
"if",
"(",
"!",
"mo",
"->",
"swapxy",
")",
"{",
"for",
"(",
"y",
"=",
"0",
",",
"sy",
"=",
"ypos",
";",
"y",
"<",
"height",
";",
"y",
"++",
",",
"sy",
"+=",
"yadv",
")",
"{",
"if",
"(",
"sy",
"<=",
"cliprect",
"->",
"min_y",
"-",
"mo",
"->",
"tileheight",
")",
"{",
"code",
"+=",
"width",
";",
"continue",
";",
"}",
"else",
"if",
"(",
"sy",
">",
"cliprect",
"->",
"max_y",
")",
"break",
";",
"for",
"(",
"x",
"=",
"0",
",",
"sx",
"=",
"xpos",
";",
"x",
"<",
"width",
";",
"x",
"++",
",",
"sx",
"+=",
"xadv",
",",
"code",
"++",
")",
"{",
"if",
"(",
"sx",
"<=",
"-",
"cliprect",
"->",
"min_x",
"-",
"mo",
"->",
"tilewidth",
"||",
"sx",
">",
"cliprect",
"->",
"max_x",
")",
"continue",
";",
"drawgfx_transpen_raw",
"(",
"bitmap",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"hflip",
",",
"vflip",
",",
"sx",
",",
"sy",
",",
"mo",
"->",
"transpen",
")",
";",
"rendered",
"=",
"1",
";",
"dirtybase",
"=",
"get_dirty_base",
"(",
"mo",
",",
"sx",
",",
"sy",
")",
";",
"dirtybase",
"[",
"0",
"]",
"=",
"1",
";",
"dirtybase",
"[",
"1",
"]",
"=",
"1",
";",
"dirtybase",
"[",
"mo",
"->",
"dirtywidth",
"]",
"=",
"1",
";",
"dirtybase",
"[",
"mo",
"->",
"dirtywidth",
"+",
"1",
"]",
"=",
"1",
";",
"}",
"}",
"}",
"else",
"{",
"for",
"(",
"x",
"=",
"0",
",",
"sx",
"=",
"xpos",
";",
"x",
"<",
"width",
";",
"x",
"++",
",",
"sx",
"+=",
"xadv",
")",
"{",
"if",
"(",
"sx",
"<=",
"cliprect",
"->",
"min_x",
"-",
"mo",
"->",
"tilewidth",
")",
"{",
"code",
"+=",
"height",
";",
"continue",
";",
"}",
"else",
"if",
"(",
"sx",
">",
"cliprect",
"->",
"max_x",
")",
"break",
";",
"dirtybase",
"=",
"get_dirty_base",
"(",
"mo",
",",
"sx",
",",
"ypos",
")",
";",
"for",
"(",
"y",
"=",
"0",
",",
"sy",
"=",
"ypos",
";",
"y",
"<",
"height",
";",
"y",
"++",
",",
"sy",
"+=",
"yadv",
",",
"code",
"++",
")",
"{",
"if",
"(",
"sy",
"<=",
"-",
"cliprect",
"->",
"min_y",
"-",
"mo",
"->",
"tileheight",
"||",
"sy",
">",
"cliprect",
"->",
"max_y",
")",
"continue",
";",
"drawgfx_transpen_raw",
"(",
"bitmap",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"hflip",
",",
"vflip",
",",
"sx",
",",
"sy",
",",
"mo",
"->",
"transpen",
")",
";",
"rendered",
"=",
"1",
";",
"dirtybase",
"=",
"get_dirty_base",
"(",
"mo",
",",
"sx",
",",
"sy",
")",
";",
"dirtybase",
"[",
"0",
"]",
"=",
"1",
";",
"dirtybase",
"[",
"1",
"]",
"=",
"1",
";",
"dirtybase",
"[",
"mo",
"->",
"dirtywidth",
"]",
"=",
"1",
";",
"dirtybase",
"[",
"mo",
"->",
"dirtywidth",
"+",
"1",
"]",
"=",
"1",
";",
"}",
"}",
"}",
"return",
"rendered",
";",
"}"
] | mo_render_object: Internal processing callback that
renders to the backing bitmap and then copies the result
to the destination. | [
"mo_render_object",
":",
"Internal",
"processing",
"callback",
"that",
"renders",
"to",
"the",
"backing",
"bitmap",
"and",
"then",
"copies",
"the",
"result",
"to",
"the",
"destination",
"."
] | [
"/* extract data from the various words */",
"/* compute the effective color, merging in priority */",
"/* add in the scroll positions if we're not in absolute coordinates */",
"/* adjust for height */",
"/* handle previous hold bits */",
"/* check for the hold bit */",
"/* adjust the final coordinates */",
"/* is this one special? */",
"/* adjust for h flip */",
"/* adjust for v flip */",
"/* standard order is: loop over Y first, then X */",
"/* loop over the height */",
"/* clip the Y coordinate */",
"/* loop over the width */",
"/* clip the X coordinate */",
"/* draw the sprite */",
"/* mark the grid dirty */",
"/* alternative order is swapped */",
"/* loop over the width */",
"/* clip the X coordinate */",
"/* loop over the height */",
"/* clip the X coordinate */",
"/* draw the sprite */",
"/* mark the grid dirty */"
] | [
{
"param": "mo",
"type": "atarimo_data"
},
{
"param": "entry",
"type": "atarimo_entry"
},
{
"param": "cliprect",
"type": "rectangle"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mo",
"type": "atarimo_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entry",
"type": "atarimo_entry",
"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": []
} |
e3ca06cbd3c9bc34e9638fbefd587b30b62b57ae | lofunz/mieme | Reloaded/trunk/src/mame/video/atarimo.c | [
"Unlicense"
] | C | atarimo_set_bank | void | void atarimo_set_bank(int map, int bank)
{
atarimo_data *mo = &atarimo[map];
mo->bank = bank;
} | /*---------------------------------------------------------------
atarimo_set_bank: Set the banking value for
the motion objects.
---------------------------------------------------------------*/ | Set the banking value for
the motion objects. | [
"Set",
"the",
"banking",
"value",
"for",
"the",
"motion",
"objects",
"."
] | void atarimo_set_bank(int map, int bank)
{
atarimo_data *mo = &atarimo[map];
mo->bank = bank;
} | [
"void",
"atarimo_set_bank",
"(",
"int",
"map",
",",
"int",
"bank",
")",
"{",
"atarimo_data",
"*",
"mo",
"=",
"&",
"atarimo",
"[",
"map",
"]",
";",
"mo",
"->",
"bank",
"=",
"bank",
";",
"}"
] | atarimo_set_bank: Set the banking value for
the motion objects. | [
"atarimo_set_bank",
":",
"Set",
"the",
"banking",
"value",
"for",
"the",
"motion",
"objects",
"."
] | [] | [
{
"param": "map",
"type": "int"
},
{
"param": "bank",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "map",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bank",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e3ca06cbd3c9bc34e9638fbefd587b30b62b57ae | lofunz/mieme | Reloaded/trunk/src/mame/video/atarimo.c | [
"Unlicense"
] | C | atarimo_set_xscroll | void | void atarimo_set_xscroll(int map, int xscroll)
{
atarimo_data *mo = &atarimo[map];
mo->xscroll = xscroll;
} | /*---------------------------------------------------------------
atarimo_set_xscroll: Set the horizontal scroll value for
the motion objects.
---------------------------------------------------------------*/ | Set the horizontal scroll value for
the motion objects. | [
"Set",
"the",
"horizontal",
"scroll",
"value",
"for",
"the",
"motion",
"objects",
"."
] | void atarimo_set_xscroll(int map, int xscroll)
{
atarimo_data *mo = &atarimo[map];
mo->xscroll = xscroll;
} | [
"void",
"atarimo_set_xscroll",
"(",
"int",
"map",
",",
"int",
"xscroll",
")",
"{",
"atarimo_data",
"*",
"mo",
"=",
"&",
"atarimo",
"[",
"map",
"]",
";",
"mo",
"->",
"xscroll",
"=",
"xscroll",
";",
"}"
] | atarimo_set_xscroll: Set the horizontal scroll value for
the motion objects. | [
"atarimo_set_xscroll",
":",
"Set",
"the",
"horizontal",
"scroll",
"value",
"for",
"the",
"motion",
"objects",
"."
] | [] | [
{
"param": "map",
"type": "int"
},
{
"param": "xscroll",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "map",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xscroll",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e3ca06cbd3c9bc34e9638fbefd587b30b62b57ae | lofunz/mieme | Reloaded/trunk/src/mame/video/atarimo.c | [
"Unlicense"
] | C | atarimo_set_yscroll | void | void atarimo_set_yscroll(int map, int yscroll)
{
atarimo_data *mo = &atarimo[map];
mo->yscroll = yscroll;
} | /*---------------------------------------------------------------
atarimo_set_yscroll: Set the vertical scroll value for
the motion objects.
---------------------------------------------------------------*/ | Set the vertical scroll value for
the motion objects. | [
"Set",
"the",
"vertical",
"scroll",
"value",
"for",
"the",
"motion",
"objects",
"."
] | void atarimo_set_yscroll(int map, int yscroll)
{
atarimo_data *mo = &atarimo[map];
mo->yscroll = yscroll;
} | [
"void",
"atarimo_set_yscroll",
"(",
"int",
"map",
",",
"int",
"yscroll",
")",
"{",
"atarimo_data",
"*",
"mo",
"=",
"&",
"atarimo",
"[",
"map",
"]",
";",
"mo",
"->",
"yscroll",
"=",
"yscroll",
";",
"}"
] | atarimo_set_yscroll: Set the vertical scroll value for
the motion objects. | [
"atarimo_set_yscroll",
":",
"Set",
"the",
"vertical",
"scroll",
"value",
"for",
"the",
"motion",
"objects",
"."
] | [] | [
{
"param": "map",
"type": "int"
},
{
"param": "yscroll",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "map",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "yscroll",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
99bed30e36e635fb67bd297a602ca6ff54d9bc9a | lofunz/mieme | Reloaded/trunk/src/mame/video/cischeat.c | [
"Unlicense"
] | C | cischeat_draw_road | void | static void cischeat_draw_road(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int road_num, int priority1, int priority2, int transparency)
{
int curr_code,sx,sy;
int min_priority, max_priority;
rectangle rect = *cliprect;
gfx_element *gfx = machine->gfx[(road_num & 1)?5:4];
UINT16 *roadram = cischeat_roadram[road_num & 1];
int min_y = rect.min_y;
int max_y = rect.max_y;
int max_x = rect.max_x;
if (priority1 < priority2) { min_priority = priority1; max_priority = priority2; }
else { min_priority = priority2; max_priority = priority1; }
/* Move the priority values in place */
min_priority = (min_priority & 7) * 0x100;
max_priority = (max_priority & 7) * 0x100;
/* Let's draw from the top to the bottom of the visible screen */
for (sy = min_y ; sy <= max_y ; sy ++)
{
int code = roadram[ sy * 4 + 0 ];
int xscroll = roadram[ sy * 4 + 1 ];
int attr = roadram[ sy * 4 + 2 ];
/* high byte is a priority information */
if ( ((attr & 0x700) < min_priority) || ((attr & 0x700) > max_priority) )
continue;
/* line number converted to tile number (each tile is TILE_SIZE x 1) */
code = code * (X_SIZE/TILE_SIZE);
xscroll %= X_SIZE;
curr_code = code + xscroll/TILE_SIZE;
for (sx = -(xscroll%TILE_SIZE) ; sx <= max_x ; sx +=TILE_SIZE)
{
drawgfx_transpen(bitmap,&rect,gfx,
curr_code++,
attr,
0,0,
sx,sy,
transparency ? 15 : -1);
/* wrap around */
if (curr_code%(X_SIZE/TILE_SIZE)==0) curr_code = code;
}
}
} | /* Draw the road in the given bitmap. The priority1 and priority2 parameters
specify the range of lines to draw */ | Draw the road in the given bitmap. The priority1 and priority2 parameters
specify the range of lines to draw | [
"Draw",
"the",
"road",
"in",
"the",
"given",
"bitmap",
".",
"The",
"priority1",
"and",
"priority2",
"parameters",
"specify",
"the",
"range",
"of",
"lines",
"to",
"draw"
] | static void cischeat_draw_road(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int road_num, int priority1, int priority2, int transparency)
{
int curr_code,sx,sy;
int min_priority, max_priority;
rectangle rect = *cliprect;
gfx_element *gfx = machine->gfx[(road_num & 1)?5:4];
UINT16 *roadram = cischeat_roadram[road_num & 1];
int min_y = rect.min_y;
int max_y = rect.max_y;
int max_x = rect.max_x;
if (priority1 < priority2) { min_priority = priority1; max_priority = priority2; }
else { min_priority = priority2; max_priority = priority1; }
min_priority = (min_priority & 7) * 0x100;
max_priority = (max_priority & 7) * 0x100;
for (sy = min_y ; sy <= max_y ; sy ++)
{
int code = roadram[ sy * 4 + 0 ];
int xscroll = roadram[ sy * 4 + 1 ];
int attr = roadram[ sy * 4 + 2 ];
if ( ((attr & 0x700) < min_priority) || ((attr & 0x700) > max_priority) )
continue;
code = code * (X_SIZE/TILE_SIZE);
xscroll %= X_SIZE;
curr_code = code + xscroll/TILE_SIZE;
for (sx = -(xscroll%TILE_SIZE) ; sx <= max_x ; sx +=TILE_SIZE)
{
drawgfx_transpen(bitmap,&rect,gfx,
curr_code++,
attr,
0,0,
sx,sy,
transparency ? 15 : -1);
if (curr_code%(X_SIZE/TILE_SIZE)==0) curr_code = code;
}
}
} | [
"static",
"void",
"cischeat_draw_road",
"(",
"running_machine",
"*",
"machine",
",",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"int",
"road_num",
",",
"int",
"priority1",
",",
"int",
"priority2",
",",
"int",
"transparency",
")",
"{",
"int",
"curr_code",
",",
"sx",
",",
"sy",
";",
"int",
"min_priority",
",",
"max_priority",
";",
"rectangle",
"rect",
"=",
"*",
"cliprect",
";",
"gfx_element",
"*",
"gfx",
"=",
"machine",
"->",
"gfx",
"[",
"(",
"road_num",
"&",
"1",
")",
"?",
"5",
":",
"4",
"]",
";",
"UINT16",
"*",
"roadram",
"=",
"cischeat_roadram",
"[",
"road_num",
"&",
"1",
"]",
";",
"int",
"min_y",
"=",
"rect",
".",
"min_y",
";",
"int",
"max_y",
"=",
"rect",
".",
"max_y",
";",
"int",
"max_x",
"=",
"rect",
".",
"max_x",
";",
"if",
"(",
"priority1",
"<",
"priority2",
")",
"{",
"min_priority",
"=",
"priority1",
";",
"max_priority",
"=",
"priority2",
";",
"}",
"else",
"{",
"min_priority",
"=",
"priority2",
";",
"max_priority",
"=",
"priority1",
";",
"}",
"min_priority",
"=",
"(",
"min_priority",
"&",
"7",
")",
"*",
"0x100",
";",
"max_priority",
"=",
"(",
"max_priority",
"&",
"7",
")",
"*",
"0x100",
";",
"for",
"(",
"sy",
"=",
"min_y",
";",
"sy",
"<=",
"max_y",
";",
"sy",
"++",
")",
"{",
"int",
"code",
"=",
"roadram",
"[",
"sy",
"*",
"4",
"+",
"0",
"]",
";",
"int",
"xscroll",
"=",
"roadram",
"[",
"sy",
"*",
"4",
"+",
"1",
"]",
";",
"int",
"attr",
"=",
"roadram",
"[",
"sy",
"*",
"4",
"+",
"2",
"]",
";",
"if",
"(",
"(",
"(",
"attr",
"&",
"0x700",
")",
"<",
"min_priority",
")",
"||",
"(",
"(",
"attr",
"&",
"0x700",
")",
">",
"max_priority",
")",
")",
"continue",
";",
"code",
"=",
"code",
"*",
"(",
"X_SIZE",
"/",
"TILE_SIZE",
")",
";",
"xscroll",
"%=",
"X_SIZE",
";",
"curr_code",
"=",
"code",
"+",
"xscroll",
"/",
"TILE_SIZE",
";",
"for",
"(",
"sx",
"=",
"-",
"(",
"xscroll",
"%",
"TILE_SIZE",
")",
";",
"sx",
"<=",
"max_x",
";",
"sx",
"+=",
"TILE_SIZE",
")",
"{",
"drawgfx_transpen",
"(",
"bitmap",
",",
"&",
"rect",
",",
"gfx",
",",
"curr_code",
"++",
",",
"attr",
",",
"0",
",",
"0",
",",
"sx",
",",
"sy",
",",
"transparency",
"?",
"15",
":",
"-1",
")",
";",
"if",
"(",
"curr_code",
"%",
"(",
"X_SIZE",
"/",
"TILE_SIZE",
")",
"==",
"0",
")",
"curr_code",
"=",
"code",
";",
"}",
"}",
"}"
] | Draw the road in the given bitmap. | [
"Draw",
"the",
"road",
"in",
"the",
"given",
"bitmap",
"."
] | [
"/* Move the priority values in place */",
"/* Let's draw from the top to the bottom of the visible screen */",
"/* high byte is a priority information */",
"/* line number converted to tile number (each tile is TILE_SIZE x 1) */",
"/* wrap around */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "road_num",
"type": "int"
},
{
"param": "priority1",
"type": "int"
},
{
"param": "priority2",
"type": "int"
},
{
"param": "transparency",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "road_num",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority1",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority2",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transparency",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
99bed30e36e635fb67bd297a602ca6ff54d9bc9a | lofunz/mieme | Reloaded/trunk/src/mame/video/cischeat.c | [
"Unlicense"
] | C | f1gpstar_draw_road | void | static void f1gpstar_draw_road(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int road_num, int priority1, int priority2, int transparency)
{
int sx,sy;
int xstart;
int min_priority, max_priority;
rectangle rect = *cliprect;
gfx_element *gfx = machine->gfx[(road_num & 1)?5:4];
UINT16 *roadram = cischeat_roadram[road_num & 1];
int min_y = rect.min_y;
int max_y = rect.max_y;
int max_x = rect.max_x << 16; // use fixed point values (16.16), for accuracy
if (priority1 < priority2) { min_priority = priority1; max_priority = priority2; }
else { min_priority = priority2; max_priority = priority1; }
/* Move the priority values in place */
min_priority = (min_priority & 7) * 0x1000;
max_priority = (max_priority & 7) * 0x1000;
/* Let's draw from the top to the bottom of the visible screen */
for (sy = min_y ; sy <= max_y ; sy ++)
{
int xscale, xdim;
int xscroll = roadram[ sy * 4 + 0 ];
int xzoom = roadram[ sy * 4 + 1 ];
int attr = roadram[ sy * 4 + 2 ];
int code = roadram[ sy * 4 + 3 ];
/* highest nibble is a priority information */
if ( ((xscroll & 0x7000) < min_priority) || ((xscroll & 0x7000) > max_priority) )
continue;
/* zoom code range: 000-3ff scale range: 0.0-2.0 */
xscale = ( ((xzoom & 0x3ff)+1) << (16+1) ) / 0x400;
/* line number converted to tile number (each tile is TILE_SIZE x 1) */
code = code * (X_SIZE/TILE_SIZE);
/* dimension of a tile after zoom */
xdim = TILE_SIZE * xscale;
xscroll %= 2 * X_SIZE;
xstart = (X_SIZE - xscroll) * 0x10000;
xstart -= (X_SIZE * xscale) / 2;
/* let's approximate to the nearest greater integer value
to avoid holes in between tiles */
xscale += (1<<16)/TILE_SIZE;
/* Draw the line */
for (sx = xstart ; sx <= max_x ; sx += xdim)
{
drawgfxzoom_transpen(bitmap,&rect,gfx,
code++,
attr >> 8,
0,0,
sx / 0x10000, sy,
xscale, 1 << 16,
transparency ? 15 : -1);
/* stop when the end of the line of gfx is reached */
if ((code % (X_SIZE/TILE_SIZE)) == 0) break;
}
}
} | /* Draw the road in the given bitmap. The priority1 and priority2 parameters
specify the range of lines to draw */ | Draw the road in the given bitmap. The priority1 and priority2 parameters
specify the range of lines to draw | [
"Draw",
"the",
"road",
"in",
"the",
"given",
"bitmap",
".",
"The",
"priority1",
"and",
"priority2",
"parameters",
"specify",
"the",
"range",
"of",
"lines",
"to",
"draw"
] | static void f1gpstar_draw_road(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int road_num, int priority1, int priority2, int transparency)
{
int sx,sy;
int xstart;
int min_priority, max_priority;
rectangle rect = *cliprect;
gfx_element *gfx = machine->gfx[(road_num & 1)?5:4];
UINT16 *roadram = cischeat_roadram[road_num & 1];
int min_y = rect.min_y;
int max_y = rect.max_y;
int max_x = rect.max_x << 16;
if (priority1 < priority2) { min_priority = priority1; max_priority = priority2; }
else { min_priority = priority2; max_priority = priority1; }
min_priority = (min_priority & 7) * 0x1000;
max_priority = (max_priority & 7) * 0x1000;
for (sy = min_y ; sy <= max_y ; sy ++)
{
int xscale, xdim;
int xscroll = roadram[ sy * 4 + 0 ];
int xzoom = roadram[ sy * 4 + 1 ];
int attr = roadram[ sy * 4 + 2 ];
int code = roadram[ sy * 4 + 3 ];
if ( ((xscroll & 0x7000) < min_priority) || ((xscroll & 0x7000) > max_priority) )
continue;
xscale = ( ((xzoom & 0x3ff)+1) << (16+1) ) / 0x400;
code = code * (X_SIZE/TILE_SIZE);
xdim = TILE_SIZE * xscale;
xscroll %= 2 * X_SIZE;
xstart = (X_SIZE - xscroll) * 0x10000;
xstart -= (X_SIZE * xscale) / 2;
xscale += (1<<16)/TILE_SIZE;
for (sx = xstart ; sx <= max_x ; sx += xdim)
{
drawgfxzoom_transpen(bitmap,&rect,gfx,
code++,
attr >> 8,
0,0,
sx / 0x10000, sy,
xscale, 1 << 16,
transparency ? 15 : -1);
if ((code % (X_SIZE/TILE_SIZE)) == 0) break;
}
}
} | [
"static",
"void",
"f1gpstar_draw_road",
"(",
"running_machine",
"*",
"machine",
",",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"int",
"road_num",
",",
"int",
"priority1",
",",
"int",
"priority2",
",",
"int",
"transparency",
")",
"{",
"int",
"sx",
",",
"sy",
";",
"int",
"xstart",
";",
"int",
"min_priority",
",",
"max_priority",
";",
"rectangle",
"rect",
"=",
"*",
"cliprect",
";",
"gfx_element",
"*",
"gfx",
"=",
"machine",
"->",
"gfx",
"[",
"(",
"road_num",
"&",
"1",
")",
"?",
"5",
":",
"4",
"]",
";",
"UINT16",
"*",
"roadram",
"=",
"cischeat_roadram",
"[",
"road_num",
"&",
"1",
"]",
";",
"int",
"min_y",
"=",
"rect",
".",
"min_y",
";",
"int",
"max_y",
"=",
"rect",
".",
"max_y",
";",
"int",
"max_x",
"=",
"rect",
".",
"max_x",
"<<",
"16",
";",
"if",
"(",
"priority1",
"<",
"priority2",
")",
"{",
"min_priority",
"=",
"priority1",
";",
"max_priority",
"=",
"priority2",
";",
"}",
"else",
"{",
"min_priority",
"=",
"priority2",
";",
"max_priority",
"=",
"priority1",
";",
"}",
"min_priority",
"=",
"(",
"min_priority",
"&",
"7",
")",
"*",
"0x1000",
";",
"max_priority",
"=",
"(",
"max_priority",
"&",
"7",
")",
"*",
"0x1000",
";",
"for",
"(",
"sy",
"=",
"min_y",
";",
"sy",
"<=",
"max_y",
";",
"sy",
"++",
")",
"{",
"int",
"xscale",
",",
"xdim",
";",
"int",
"xscroll",
"=",
"roadram",
"[",
"sy",
"*",
"4",
"+",
"0",
"]",
";",
"int",
"xzoom",
"=",
"roadram",
"[",
"sy",
"*",
"4",
"+",
"1",
"]",
";",
"int",
"attr",
"=",
"roadram",
"[",
"sy",
"*",
"4",
"+",
"2",
"]",
";",
"int",
"code",
"=",
"roadram",
"[",
"sy",
"*",
"4",
"+",
"3",
"]",
";",
"if",
"(",
"(",
"(",
"xscroll",
"&",
"0x7000",
")",
"<",
"min_priority",
")",
"||",
"(",
"(",
"xscroll",
"&",
"0x7000",
")",
">",
"max_priority",
")",
")",
"continue",
";",
"xscale",
"=",
"(",
"(",
"(",
"xzoom",
"&",
"0x3ff",
")",
"+",
"1",
")",
"<<",
"(",
"16",
"+",
"1",
")",
")",
"/",
"0x400",
";",
"code",
"=",
"code",
"*",
"(",
"X_SIZE",
"/",
"TILE_SIZE",
")",
";",
"xdim",
"=",
"TILE_SIZE",
"*",
"xscale",
";",
"xscroll",
"%=",
"2",
"*",
"X_SIZE",
";",
"xstart",
"=",
"(",
"X_SIZE",
"-",
"xscroll",
")",
"*",
"0x10000",
";",
"xstart",
"-=",
"(",
"X_SIZE",
"*",
"xscale",
")",
"/",
"2",
";",
"xscale",
"+=",
"(",
"1",
"<<",
"16",
")",
"/",
"TILE_SIZE",
";",
"for",
"(",
"sx",
"=",
"xstart",
";",
"sx",
"<=",
"max_x",
";",
"sx",
"+=",
"xdim",
")",
"{",
"drawgfxzoom_transpen",
"(",
"bitmap",
",",
"&",
"rect",
",",
"gfx",
",",
"code",
"++",
",",
"attr",
">>",
"8",
",",
"0",
",",
"0",
",",
"sx",
"/",
"0x10000",
",",
"sy",
",",
"xscale",
",",
"1",
"<<",
"16",
",",
"transparency",
"?",
"15",
":",
"-1",
")",
";",
"if",
"(",
"(",
"code",
"%",
"(",
"X_SIZE",
"/",
"TILE_SIZE",
")",
")",
"==",
"0",
")",
"break",
";",
"}",
"}",
"}"
] | Draw the road in the given bitmap. | [
"Draw",
"the",
"road",
"in",
"the",
"given",
"bitmap",
"."
] | [
"// use fixed point values (16.16), for accuracy\r",
"/* Move the priority values in place */",
"/* Let's draw from the top to the bottom of the visible screen */",
"/* highest nibble is a priority information */",
"/* zoom code range: 000-3ff scale range: 0.0-2.0 */",
"/* line number converted to tile number (each tile is TILE_SIZE x 1) */",
"/* dimension of a tile after zoom */",
"/* let's approximate to the nearest greater integer value\r\n to avoid holes in between tiles */",
"/* Draw the line */",
"/* stop when the end of the line of gfx is reached */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "road_num",
"type": "int"
},
{
"param": "priority1",
"type": "int"
},
{
"param": "priority2",
"type": "int"
},
{
"param": "transparency",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "road_num",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority1",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority2",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transparency",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
caaa9b13e1d0e4c51eb46817a70e145c7c4e3633 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/dsp56k/dsp56k.c | [
"Unlicense"
] | C | execute_one_new | size_t | static size_t execute_one_new(dsp56k_core* cpustate)
{
// For MAME
cpustate->op = ROPCODE(ADDRESS(PC));
debugger_instruction_hook(cpustate->device, PC);
UINT16 w0 = ROPCODE(ADDRESS(PC));
UINT16 w1 = ROPCODE(ADDRESS(PC) + ADDRESS(1));
Opcode op(w0, w1);
op.evaluate(cpustate);
PC += op.evalSize(); // Special size function needed to handle jmps, etc.
// TODO: Currently all operations take up 4 cycles (inst->cycles()).
return 4;
} | // Execute a single opcode and return how many cycles it took.
| Execute a single opcode and return how many cycles it took. | [
"Execute",
"a",
"single",
"opcode",
"and",
"return",
"how",
"many",
"cycles",
"it",
"took",
"."
] | static size_t execute_one_new(dsp56k_core* cpustate)
{
cpustate->op = ROPCODE(ADDRESS(PC));
debugger_instruction_hook(cpustate->device, PC);
UINT16 w0 = ROPCODE(ADDRESS(PC));
UINT16 w1 = ROPCODE(ADDRESS(PC) + ADDRESS(1));
Opcode op(w0, w1);
op.evaluate(cpustate);
PC += op.evalSize();
return 4;
} | [
"static",
"size_t",
"execute_one_new",
"(",
"dsp56k_core",
"*",
"cpustate",
")",
"{",
"cpustate",
"->",
"op",
"=",
"ROPCODE",
"(",
"ADDRESS",
"(",
"PC",
")",
")",
";",
"debugger_instruction_hook",
"(",
"cpustate",
"->",
"device",
",",
"PC",
")",
";",
"UINT16",
"w0",
"=",
"ROPCODE",
"(",
"ADDRESS",
"(",
"PC",
")",
")",
";",
"UINT16",
"w1",
"=",
"ROPCODE",
"(",
"ADDRESS",
"(",
"PC",
")",
"+",
"ADDRESS",
"(",
"1",
")",
")",
";",
"Opcode",
"op",
"(",
"w0",
",",
"w1",
")",
";",
"op",
".",
"evaluate",
"(",
"cpustate",
")",
";",
"PC",
"+=",
"op",
".",
"evalSize",
"(",
")",
";",
"return",
"4",
";",
"}"
] | Execute a single opcode and return how many cycles it took. | [
"Execute",
"a",
"single",
"opcode",
"and",
"return",
"how",
"many",
"cycles",
"it",
"took",
"."
] | [
"// For MAME\r",
"// Special size function needed to handle jmps, etc.\r",
"// TODO: Currently all operations take up 4 cycles (inst->cycles()).\r"
] | [
{
"param": "cpustate",
"type": "dsp56k_core"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "dsp56k_core",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dac3653b0acfa994bde90719185f0d74610b646 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/validity.c | [
"Unlicense"
] | C | quark_table_alloc | quark_table | static quark_table *quark_table_alloc(UINT32 entries, UINT32 hashsize)
{
quark_table *table;
UINT32 total_bytes;
/* determine how many total bytes we need */
total_bytes = sizeof(*table) + entries * sizeof(table->entry[0]) + hashsize * sizeof(table->hash[0]);
table = (quark_table *)alloc_array_or_die(UINT8, total_bytes);
/* fill in the details */
table->entries = entries;
table->hashsize = hashsize;
/* compute the pointers */
table->entry = (quark_entry *)((UINT8 *)table + sizeof(*table));
table->hash = (quark_entry **)((UINT8 *)table->entry + entries * sizeof(table->entry[0]));
/* reset the hash table */
memset(table->hash, 0, hashsize * sizeof(table->hash[0]));
return table;
} | /*-------------------------------------------------
quark_table_alloc - allocate an array of
quark entries and a hash table
-------------------------------------------------*/ | allocate an array of
quark entries and a hash table | [
"allocate",
"an",
"array",
"of",
"quark",
"entries",
"and",
"a",
"hash",
"table"
] | static quark_table *quark_table_alloc(UINT32 entries, UINT32 hashsize)
{
quark_table *table;
UINT32 total_bytes;
total_bytes = sizeof(*table) + entries * sizeof(table->entry[0]) + hashsize * sizeof(table->hash[0]);
table = (quark_table *)alloc_array_or_die(UINT8, total_bytes);
table->entries = entries;
table->hashsize = hashsize;
table->entry = (quark_entry *)((UINT8 *)table + sizeof(*table));
table->hash = (quark_entry **)((UINT8 *)table->entry + entries * sizeof(table->entry[0]));
memset(table->hash, 0, hashsize * sizeof(table->hash[0]));
return table;
} | [
"static",
"quark_table",
"*",
"quark_table_alloc",
"(",
"UINT32",
"entries",
",",
"UINT32",
"hashsize",
")",
"{",
"quark_table",
"*",
"table",
";",
"UINT32",
"total_bytes",
";",
"total_bytes",
"=",
"sizeof",
"(",
"*",
"table",
")",
"+",
"entries",
"*",
"sizeof",
"(",
"table",
"->",
"entry",
"[",
"0",
"]",
")",
"+",
"hashsize",
"*",
"sizeof",
"(",
"table",
"->",
"hash",
"[",
"0",
"]",
")",
";",
"table",
"=",
"(",
"quark_table",
"*",
")",
"alloc_array_or_die",
"(",
"UINT8",
",",
"total_bytes",
")",
";",
"table",
"->",
"entries",
"=",
"entries",
";",
"table",
"->",
"hashsize",
"=",
"hashsize",
";",
"table",
"->",
"entry",
"=",
"(",
"quark_entry",
"*",
")",
"(",
"(",
"UINT8",
"*",
")",
"table",
"+",
"sizeof",
"(",
"*",
"table",
")",
")",
";",
"table",
"->",
"hash",
"=",
"(",
"quark_entry",
"*",
"*",
")",
"(",
"(",
"UINT8",
"*",
")",
"table",
"->",
"entry",
"+",
"entries",
"*",
"sizeof",
"(",
"table",
"->",
"entry",
"[",
"0",
"]",
")",
")",
";",
"memset",
"(",
"table",
"->",
"hash",
",",
"0",
",",
"hashsize",
"*",
"sizeof",
"(",
"table",
"->",
"hash",
"[",
"0",
"]",
")",
")",
";",
"return",
"table",
";",
"}"
] | quark_table_alloc - allocate an array of
quark entries and a hash table | [
"quark_table_alloc",
"-",
"allocate",
"an",
"array",
"of",
"quark",
"entries",
"and",
"a",
"hash",
"table"
] | [
"/* determine how many total bytes we need */",
"/* fill in the details */",
"/* compute the pointers */",
"/* reset the hash table */"
] | [
{
"param": "entries",
"type": "UINT32"
},
{
"param": "hashsize",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "entries",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "hashsize",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dac3653b0acfa994bde90719185f0d74610b646 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/validity.c | [
"Unlicense"
] | C | quark_tables_create | void | static void quark_tables_create(quark_tables *tables)
{
int drivnum = driver_list_get_count(drivers), strnum;
/* allocate memory for the quark tables */
tables->source = quark_table_alloc(drivnum, QUARK_HASH_SIZE);
tables->name = quark_table_alloc(drivnum, QUARK_HASH_SIZE);
tables->description = quark_table_alloc(drivnum, QUARK_HASH_SIZE);
tables->roms = quark_table_alloc(drivnum, QUARK_HASH_SIZE);
/* build the quarks and the hash tables */
for (drivnum = 0; drivers[drivnum]; drivnum++)
{
const game_driver *driver = drivers[drivnum];
/* fill in the quark with hashes of the strings */
quark_add(tables->source, drivnum, quark_string_crc(driver->source_file));
quark_add(tables->name, drivnum, quark_string_crc(driver->name));
quark_add(tables->description, drivnum, quark_string_crc(driver->description));
/* only track actual driver ROM entries */
if (driver->rom && (driver->flags & GAME_NO_STANDALONE) == 0)
quark_add(tables->roms, drivnum, (FPTR)driver->rom);
}
/* allocate memory for a quark table of strings */
tables->defstr = quark_table_alloc(INPUT_STRING_COUNT, 97);
/* add all the default strings */
for (strnum = 1; strnum < INPUT_STRING_COUNT; strnum++)
{
const char *string = input_port_string_from_index(strnum);
if (string != NULL)
quark_add(tables->defstr, strnum, quark_string_crc(string));
}
} | /*-------------------------------------------------
quark_tables_create - build "quarks" for fast
string operations
-------------------------------------------------*/ | build "quarks" for fast
string operations | [
"build",
"\"",
"quarks",
"\"",
"for",
"fast",
"string",
"operations"
] | static void quark_tables_create(quark_tables *tables)
{
int drivnum = driver_list_get_count(drivers), strnum;
tables->source = quark_table_alloc(drivnum, QUARK_HASH_SIZE);
tables->name = quark_table_alloc(drivnum, QUARK_HASH_SIZE);
tables->description = quark_table_alloc(drivnum, QUARK_HASH_SIZE);
tables->roms = quark_table_alloc(drivnum, QUARK_HASH_SIZE);
for (drivnum = 0; drivers[drivnum]; drivnum++)
{
const game_driver *driver = drivers[drivnum];
quark_add(tables->source, drivnum, quark_string_crc(driver->source_file));
quark_add(tables->name, drivnum, quark_string_crc(driver->name));
quark_add(tables->description, drivnum, quark_string_crc(driver->description));
if (driver->rom && (driver->flags & GAME_NO_STANDALONE) == 0)
quark_add(tables->roms, drivnum, (FPTR)driver->rom);
}
tables->defstr = quark_table_alloc(INPUT_STRING_COUNT, 97);
for (strnum = 1; strnum < INPUT_STRING_COUNT; strnum++)
{
const char *string = input_port_string_from_index(strnum);
if (string != NULL)
quark_add(tables->defstr, strnum, quark_string_crc(string));
}
} | [
"static",
"void",
"quark_tables_create",
"(",
"quark_tables",
"*",
"tables",
")",
"{",
"int",
"drivnum",
"=",
"driver_list_get_count",
"(",
"drivers",
")",
",",
"strnum",
";",
"tables",
"->",
"source",
"=",
"quark_table_alloc",
"(",
"drivnum",
",",
"QUARK_HASH_SIZE",
")",
";",
"tables",
"->",
"name",
"=",
"quark_table_alloc",
"(",
"drivnum",
",",
"QUARK_HASH_SIZE",
")",
";",
"tables",
"->",
"description",
"=",
"quark_table_alloc",
"(",
"drivnum",
",",
"QUARK_HASH_SIZE",
")",
";",
"tables",
"->",
"roms",
"=",
"quark_table_alloc",
"(",
"drivnum",
",",
"QUARK_HASH_SIZE",
")",
";",
"for",
"(",
"drivnum",
"=",
"0",
";",
"drivers",
"[",
"drivnum",
"]",
";",
"drivnum",
"++",
")",
"{",
"const",
"game_driver",
"*",
"driver",
"=",
"drivers",
"[",
"drivnum",
"]",
";",
"quark_add",
"(",
"tables",
"->",
"source",
",",
"drivnum",
",",
"quark_string_crc",
"(",
"driver",
"->",
"source_file",
")",
")",
";",
"quark_add",
"(",
"tables",
"->",
"name",
",",
"drivnum",
",",
"quark_string_crc",
"(",
"driver",
"->",
"name",
")",
")",
";",
"quark_add",
"(",
"tables",
"->",
"description",
",",
"drivnum",
",",
"quark_string_crc",
"(",
"driver",
"->",
"description",
")",
")",
";",
"if",
"(",
"driver",
"->",
"rom",
"&&",
"(",
"driver",
"->",
"flags",
"&",
"GAME_NO_STANDALONE",
")",
"==",
"0",
")",
"quark_add",
"(",
"tables",
"->",
"roms",
",",
"drivnum",
",",
"(",
"FPTR",
")",
"driver",
"->",
"rom",
")",
";",
"}",
"tables",
"->",
"defstr",
"=",
"quark_table_alloc",
"(",
"INPUT_STRING_COUNT",
",",
"97",
")",
";",
"for",
"(",
"strnum",
"=",
"1",
";",
"strnum",
"<",
"INPUT_STRING_COUNT",
";",
"strnum",
"++",
")",
"{",
"const",
"char",
"*",
"string",
"=",
"input_port_string_from_index",
"(",
"strnum",
")",
";",
"if",
"(",
"string",
"!=",
"NULL",
")",
"quark_add",
"(",
"tables",
"->",
"defstr",
",",
"strnum",
",",
"quark_string_crc",
"(",
"string",
")",
")",
";",
"}",
"}"
] | quark_tables_create - build "quarks" for fast
string operations | [
"quark_tables_create",
"-",
"build",
"\"",
"quarks",
"\"",
"for",
"fast",
"string",
"operations"
] | [
"/* allocate memory for the quark tables */",
"/* build the quarks and the hash tables */",
"/* fill in the quark with hashes of the strings */",
"/* only track actual driver ROM entries */",
"/* allocate memory for a quark table of strings */",
"/* add all the default strings */"
] | [
{
"param": "tables",
"type": "quark_tables"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tables",
"type": "quark_tables",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9dac3653b0acfa994bde90719185f0d74610b646 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/validity.c | [
"Unlicense"
] | C | validate_devices | int | static int validate_devices(int drivnum, const machine_config *config, const input_port_config *portlist, region_info *rgninfo)
{
int error = FALSE;
const game_driver *driver = drivers[drivnum];
const device_config *device;
for (device = device_list_first(config->devicelist, DEVICE_TYPE_WILDCARD); device != NULL; device = device_list_next(device, DEVICE_TYPE_WILDCARD))
{
device_validity_check_func validity_check = (device_validity_check_func) device_get_info_fct(device, DEVINFO_FCT_VALIDITY_CHECK);
const device_config *scandevice;
int spacenum;
/* validate the device tag */
error |= validate_tag(driver, device_get_info_string(device, DEVINFO_STR_NAME), device->tag);
/* look for duplicates */
for (scandevice = device_list_first(config->devicelist, DEVICE_TYPE_WILDCARD); scandevice != device; scandevice = device_list_next(scandevice, DEVICE_TYPE_WILDCARD))
if (strcmp(scandevice->tag, device->tag) == 0)
{
mame_printf_warning("%s: %s has multiple devices with the tag '%s'\n", driver->source_file, driver->name, device->tag);
break;
}
/* call the device-specific validity check */
if (validity_check != NULL && (*validity_check)(driver, device))
error = TRUE;
/* loop over all address spaces */
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
{
#define SPACE_SHIFT(a) ((addr_shift < 0) ? ((a) << -addr_shift) : ((a) >> addr_shift))
#define SPACE_SHIFT_END(a) ((addr_shift < 0) ? (((a) << -addr_shift) | ((1 << -addr_shift) - 1)) : ((a) >> addr_shift))
int databus_width = device_get_databus_width(device, spacenum);
int addr_shift = device_get_addrbus_shift(device, spacenum);
int alignunit = databus_width/8;
address_map_entry *entry;
address_map *map;
/* construct the maps */
map = address_map_alloc(device, driver, spacenum);
/* if this is an empty map, just skip it */
if (map->entrylist == NULL)
{
address_map_free(map);
continue;
}
/* validate the global map parameters */
if (map->spacenum != spacenum)
{
mame_printf_error("%s: %s device '%s' space %d has address space %d handlers!\n", driver->source_file, driver->name, device->tag, spacenum, map->spacenum);
error = TRUE;
}
if (map->databits != databus_width)
{
mame_printf_error("%s: %s device '%s' uses wrong memory handlers for %s space! (width = %d, memory = %08x)\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], databus_width, map->databits);
error = TRUE;
}
/* loop over entries and look for errors */
for (entry = map->entrylist; entry != NULL; entry = entry->next)
{
UINT32 bytestart = SPACE_SHIFT(entry->addrstart);
UINT32 byteend = SPACE_SHIFT_END(entry->addrend);
/* look for inverted start/end pairs */
if (byteend < bytestart)
{
mame_printf_error("%s: %s wrong %s memory read handler start = %08x > end = %08x\n", driver->source_file, driver->name, address_space_names[spacenum], entry->addrstart, entry->addrend);
error = TRUE;
}
/* look for misaligned entries */
if ((bytestart & (alignunit - 1)) != 0 || (byteend & (alignunit - 1)) != (alignunit - 1))
{
mame_printf_error("%s: %s wrong %s memory read handler start = %08x, end = %08x ALIGN = %d\n", driver->source_file, driver->name, address_space_names[spacenum], entry->addrstart, entry->addrend, alignunit);
error = TRUE;
}
/* if this is a program space, auto-assign implicit ROM entries */
if ((FPTR)entry->read.generic == STATIC_ROM && entry->region == NULL)
{
entry->region = device->tag;
entry->rgnoffs = entry->addrstart;
}
/* if this entry references a memory region, validate it */
if (entry->region != NULL && entry->share == 0)
{
int rgnnum;
/* loop over entries in the class */
for (rgnnum = 0; rgnnum < ARRAY_LENGTH(rgninfo->entries); rgnnum++)
{
/* stop if we hit an empty */
if (rgninfo->entries[rgnnum].tag == NULL)
{
mame_printf_error("%s: %s device '%s' %s space memory map entry %X-%X references non-existant region '%s'\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->addrstart, entry->addrend, entry->region);
error = TRUE;
break;
}
/* if we hit a match, check against the length */
if (astring_cmpc(rgninfo->entries[rgnnum].tag, entry->region) == 0)
{
offs_t length = rgninfo->entries[rgnnum].length;
if (entry->rgnoffs + (byteend - bytestart + 1) > length)
{
mame_printf_error("%s: %s device '%s' %s space memory map entry %X-%X extends beyond region '%s' size (%X)\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->addrstart, entry->addrend, entry->region, length);
error = TRUE;
}
break;
}
}
}
/* make sure all devices exist */
if (entry->read_devtag != NULL && device_list_find_by_tag(config->devicelist, entry->read_devtag) == NULL)
{
mame_printf_error("%s: %s device '%s' %s space memory map entry references nonexistant device '%s'\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->read_devtag);
error = TRUE;
}
if (entry->write_devtag != NULL && device_list_find_by_tag(config->devicelist, entry->write_devtag) == NULL)
{
mame_printf_error("%s: %s device '%s' %s space memory map entry references nonexistant device '%s'\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->write_devtag);
error = TRUE;
}
/* make sure ports exist */
if (entry->read_porttag != NULL && input_port_by_tag(portlist, entry->read_porttag) == NULL)
{
mame_printf_error("%s: %s device '%s' %s space memory map entry references nonexistant port tag '%s'\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->read_porttag);
error = TRUE;
}
}
/* release the address map */
address_map_free(map);
}
}
return error;
} | /*-------------------------------------------------
validate_devices - run per-device validity
checks
-------------------------------------------------*/ | run per-device validity
checks | [
"run",
"per",
"-",
"device",
"validity",
"checks"
] | static int validate_devices(int drivnum, const machine_config *config, const input_port_config *portlist, region_info *rgninfo)
{
int error = FALSE;
const game_driver *driver = drivers[drivnum];
const device_config *device;
for (device = device_list_first(config->devicelist, DEVICE_TYPE_WILDCARD); device != NULL; device = device_list_next(device, DEVICE_TYPE_WILDCARD))
{
device_validity_check_func validity_check = (device_validity_check_func) device_get_info_fct(device, DEVINFO_FCT_VALIDITY_CHECK);
const device_config *scandevice;
int spacenum;
error |= validate_tag(driver, device_get_info_string(device, DEVINFO_STR_NAME), device->tag);
for (scandevice = device_list_first(config->devicelist, DEVICE_TYPE_WILDCARD); scandevice != device; scandevice = device_list_next(scandevice, DEVICE_TYPE_WILDCARD))
if (strcmp(scandevice->tag, device->tag) == 0)
{
mame_printf_warning("%s: %s has multiple devices with the tag '%s'\n", driver->source_file, driver->name, device->tag);
break;
}
if (validity_check != NULL && (*validity_check)(driver, device))
error = TRUE;
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
{
#define SPACE_SHIFT(a) ((addr_shift < 0) ? ((a) << -addr_shift) : ((a) >> addr_shift))
#define SPACE_SHIFT_END(a) ((addr_shift < 0) ? (((a) << -addr_shift) | ((1 << -addr_shift) - 1)) : ((a) >> addr_shift))
int databus_width = device_get_databus_width(device, spacenum);
int addr_shift = device_get_addrbus_shift(device, spacenum);
int alignunit = databus_width/8;
address_map_entry *entry;
address_map *map;
map = address_map_alloc(device, driver, spacenum);
if (map->entrylist == NULL)
{
address_map_free(map);
continue;
}
if (map->spacenum != spacenum)
{
mame_printf_error("%s: %s device '%s' space %d has address space %d handlers!\n", driver->source_file, driver->name, device->tag, spacenum, map->spacenum);
error = TRUE;
}
if (map->databits != databus_width)
{
mame_printf_error("%s: %s device '%s' uses wrong memory handlers for %s space! (width = %d, memory = %08x)\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], databus_width, map->databits);
error = TRUE;
}
for (entry = map->entrylist; entry != NULL; entry = entry->next)
{
UINT32 bytestart = SPACE_SHIFT(entry->addrstart);
UINT32 byteend = SPACE_SHIFT_END(entry->addrend);
if (byteend < bytestart)
{
mame_printf_error("%s: %s wrong %s memory read handler start = %08x > end = %08x\n", driver->source_file, driver->name, address_space_names[spacenum], entry->addrstart, entry->addrend);
error = TRUE;
}
if ((bytestart & (alignunit - 1)) != 0 || (byteend & (alignunit - 1)) != (alignunit - 1))
{
mame_printf_error("%s: %s wrong %s memory read handler start = %08x, end = %08x ALIGN = %d\n", driver->source_file, driver->name, address_space_names[spacenum], entry->addrstart, entry->addrend, alignunit);
error = TRUE;
}
if ((FPTR)entry->read.generic == STATIC_ROM && entry->region == NULL)
{
entry->region = device->tag;
entry->rgnoffs = entry->addrstart;
}
if (entry->region != NULL && entry->share == 0)
{
int rgnnum;
for (rgnnum = 0; rgnnum < ARRAY_LENGTH(rgninfo->entries); rgnnum++)
{
if (rgninfo->entries[rgnnum].tag == NULL)
{
mame_printf_error("%s: %s device '%s' %s space memory map entry %X-%X references non-existant region '%s'\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->addrstart, entry->addrend, entry->region);
error = TRUE;
break;
}
if (astring_cmpc(rgninfo->entries[rgnnum].tag, entry->region) == 0)
{
offs_t length = rgninfo->entries[rgnnum].length;
if (entry->rgnoffs + (byteend - bytestart + 1) > length)
{
mame_printf_error("%s: %s device '%s' %s space memory map entry %X-%X extends beyond region '%s' size (%X)\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->addrstart, entry->addrend, entry->region, length);
error = TRUE;
}
break;
}
}
}
if (entry->read_devtag != NULL && device_list_find_by_tag(config->devicelist, entry->read_devtag) == NULL)
{
mame_printf_error("%s: %s device '%s' %s space memory map entry references nonexistant device '%s'\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->read_devtag);
error = TRUE;
}
if (entry->write_devtag != NULL && device_list_find_by_tag(config->devicelist, entry->write_devtag) == NULL)
{
mame_printf_error("%s: %s device '%s' %s space memory map entry references nonexistant device '%s'\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->write_devtag);
error = TRUE;
}
if (entry->read_porttag != NULL && input_port_by_tag(portlist, entry->read_porttag) == NULL)
{
mame_printf_error("%s: %s device '%s' %s space memory map entry references nonexistant port tag '%s'\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->read_porttag);
error = TRUE;
}
}
address_map_free(map);
}
}
return error;
} | [
"static",
"int",
"validate_devices",
"(",
"int",
"drivnum",
",",
"const",
"machine_config",
"*",
"config",
",",
"const",
"input_port_config",
"*",
"portlist",
",",
"region_info",
"*",
"rgninfo",
")",
"{",
"int",
"error",
"=",
"FALSE",
";",
"const",
"game_driver",
"*",
"driver",
"=",
"drivers",
"[",
"drivnum",
"]",
";",
"const",
"device_config",
"*",
"device",
";",
"for",
"(",
"device",
"=",
"device_list_first",
"(",
"config",
"->",
"devicelist",
",",
"DEVICE_TYPE_WILDCARD",
")",
";",
"device",
"!=",
"NULL",
";",
"device",
"=",
"device_list_next",
"(",
"device",
",",
"DEVICE_TYPE_WILDCARD",
")",
")",
"{",
"device_validity_check_func",
"validity_check",
"=",
"(",
"device_validity_check_func",
")",
"device_get_info_fct",
"(",
"device",
",",
"DEVINFO_FCT_VALIDITY_CHECK",
")",
";",
"const",
"device_config",
"*",
"scandevice",
";",
"int",
"spacenum",
";",
"error",
"|=",
"validate_tag",
"(",
"driver",
",",
"device_get_info_string",
"(",
"device",
",",
"DEVINFO_STR_NAME",
")",
",",
"device",
"->",
"tag",
")",
";",
"for",
"(",
"scandevice",
"=",
"device_list_first",
"(",
"config",
"->",
"devicelist",
",",
"DEVICE_TYPE_WILDCARD",
")",
";",
"scandevice",
"!=",
"device",
";",
"scandevice",
"=",
"device_list_next",
"(",
"scandevice",
",",
"DEVICE_TYPE_WILDCARD",
")",
")",
"if",
"(",
"strcmp",
"(",
"scandevice",
"->",
"tag",
",",
"device",
"->",
"tag",
")",
"==",
"0",
")",
"{",
"mame_printf_warning",
"(",
"\"",
"\\n",
"\"",
",",
"driver",
"->",
"source_file",
",",
"driver",
"->",
"name",
",",
"device",
"->",
"tag",
")",
";",
"break",
";",
"}",
"if",
"(",
"validity_check",
"!=",
"NULL",
"&&",
"(",
"*",
"validity_check",
")",
"(",
"driver",
",",
"device",
")",
")",
"error",
"=",
"TRUE",
";",
"for",
"(",
"spacenum",
"=",
"0",
";",
"spacenum",
"<",
"ADDRESS_SPACES",
";",
"spacenum",
"++",
")",
"{",
"#define",
"SPACE_SHIFT",
"(",
"a",
")",
"\t\t((addr_shift < 0) ? ((a) << -addr_shift) : ((a) >> addr_shift))",
"\n",
"#define",
"SPACE_SHIFT_END",
"(",
"a",
")",
"\t((addr_shift < 0) ? (((a) << -addr_shift) | ((1 << -addr_shift) - 1)) : ((a) >> addr_shift))",
"\n",
"int",
"databus_width",
"=",
"device_get_databus_width",
"(",
"device",
",",
"spacenum",
")",
";",
"int",
"addr_shift",
"=",
"device_get_addrbus_shift",
"(",
"device",
",",
"spacenum",
")",
";",
"int",
"alignunit",
"=",
"databus_width",
"/",
"8",
";",
"address_map_entry",
"*",
"entry",
";",
"address_map",
"*",
"map",
";",
"map",
"=",
"address_map_alloc",
"(",
"device",
",",
"driver",
",",
"spacenum",
")",
";",
"if",
"(",
"map",
"->",
"entrylist",
"==",
"NULL",
")",
"{",
"address_map_free",
"(",
"map",
")",
";",
"continue",
";",
"}",
"if",
"(",
"map",
"->",
"spacenum",
"!=",
"spacenum",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"driver",
"->",
"source_file",
",",
"driver",
"->",
"name",
",",
"device",
"->",
"tag",
",",
"spacenum",
",",
"map",
"->",
"spacenum",
")",
";",
"error",
"=",
"TRUE",
";",
"}",
"if",
"(",
"map",
"->",
"databits",
"!=",
"databus_width",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"driver",
"->",
"source_file",
",",
"driver",
"->",
"name",
",",
"device",
"->",
"tag",
",",
"address_space_names",
"[",
"spacenum",
"]",
",",
"databus_width",
",",
"map",
"->",
"databits",
")",
";",
"error",
"=",
"TRUE",
";",
"}",
"for",
"(",
"entry",
"=",
"map",
"->",
"entrylist",
";",
"entry",
"!=",
"NULL",
";",
"entry",
"=",
"entry",
"->",
"next",
")",
"{",
"UINT32",
"bytestart",
"=",
"SPACE_SHIFT",
"(",
"entry",
"->",
"addrstart",
")",
";",
"UINT32",
"byteend",
"=",
"SPACE_SHIFT_END",
"(",
"entry",
"->",
"addrend",
")",
";",
"if",
"(",
"byteend",
"<",
"bytestart",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"driver",
"->",
"source_file",
",",
"driver",
"->",
"name",
",",
"address_space_names",
"[",
"spacenum",
"]",
",",
"entry",
"->",
"addrstart",
",",
"entry",
"->",
"addrend",
")",
";",
"error",
"=",
"TRUE",
";",
"}",
"if",
"(",
"(",
"bytestart",
"&",
"(",
"alignunit",
"-",
"1",
")",
")",
"!=",
"0",
"||",
"(",
"byteend",
"&",
"(",
"alignunit",
"-",
"1",
")",
")",
"!=",
"(",
"alignunit",
"-",
"1",
")",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"driver",
"->",
"source_file",
",",
"driver",
"->",
"name",
",",
"address_space_names",
"[",
"spacenum",
"]",
",",
"entry",
"->",
"addrstart",
",",
"entry",
"->",
"addrend",
",",
"alignunit",
")",
";",
"error",
"=",
"TRUE",
";",
"}",
"if",
"(",
"(",
"FPTR",
")",
"entry",
"->",
"read",
".",
"generic",
"==",
"STATIC_ROM",
"&&",
"entry",
"->",
"region",
"==",
"NULL",
")",
"{",
"entry",
"->",
"region",
"=",
"device",
"->",
"tag",
";",
"entry",
"->",
"rgnoffs",
"=",
"entry",
"->",
"addrstart",
";",
"}",
"if",
"(",
"entry",
"->",
"region",
"!=",
"NULL",
"&&",
"entry",
"->",
"share",
"==",
"0",
")",
"{",
"int",
"rgnnum",
";",
"for",
"(",
"rgnnum",
"=",
"0",
";",
"rgnnum",
"<",
"ARRAY_LENGTH",
"(",
"rgninfo",
"->",
"entries",
")",
";",
"rgnnum",
"++",
")",
"{",
"if",
"(",
"rgninfo",
"->",
"entries",
"[",
"rgnnum",
"]",
".",
"tag",
"==",
"NULL",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"driver",
"->",
"source_file",
",",
"driver",
"->",
"name",
",",
"device",
"->",
"tag",
",",
"address_space_names",
"[",
"spacenum",
"]",
",",
"entry",
"->",
"addrstart",
",",
"entry",
"->",
"addrend",
",",
"entry",
"->",
"region",
")",
";",
"error",
"=",
"TRUE",
";",
"break",
";",
"}",
"if",
"(",
"astring_cmpc",
"(",
"rgninfo",
"->",
"entries",
"[",
"rgnnum",
"]",
".",
"tag",
",",
"entry",
"->",
"region",
")",
"==",
"0",
")",
"{",
"offs_t",
"length",
"=",
"rgninfo",
"->",
"entries",
"[",
"rgnnum",
"]",
".",
"length",
";",
"if",
"(",
"entry",
"->",
"rgnoffs",
"+",
"(",
"byteend",
"-",
"bytestart",
"+",
"1",
")",
">",
"length",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"driver",
"->",
"source_file",
",",
"driver",
"->",
"name",
",",
"device",
"->",
"tag",
",",
"address_space_names",
"[",
"spacenum",
"]",
",",
"entry",
"->",
"addrstart",
",",
"entry",
"->",
"addrend",
",",
"entry",
"->",
"region",
",",
"length",
")",
";",
"error",
"=",
"TRUE",
";",
"}",
"break",
";",
"}",
"}",
"}",
"if",
"(",
"entry",
"->",
"read_devtag",
"!=",
"NULL",
"&&",
"device_list_find_by_tag",
"(",
"config",
"->",
"devicelist",
",",
"entry",
"->",
"read_devtag",
")",
"==",
"NULL",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"driver",
"->",
"source_file",
",",
"driver",
"->",
"name",
",",
"device",
"->",
"tag",
",",
"address_space_names",
"[",
"spacenum",
"]",
",",
"entry",
"->",
"read_devtag",
")",
";",
"error",
"=",
"TRUE",
";",
"}",
"if",
"(",
"entry",
"->",
"write_devtag",
"!=",
"NULL",
"&&",
"device_list_find_by_tag",
"(",
"config",
"->",
"devicelist",
",",
"entry",
"->",
"write_devtag",
")",
"==",
"NULL",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"driver",
"->",
"source_file",
",",
"driver",
"->",
"name",
",",
"device",
"->",
"tag",
",",
"address_space_names",
"[",
"spacenum",
"]",
",",
"entry",
"->",
"write_devtag",
")",
";",
"error",
"=",
"TRUE",
";",
"}",
"if",
"(",
"entry",
"->",
"read_porttag",
"!=",
"NULL",
"&&",
"input_port_by_tag",
"(",
"portlist",
",",
"entry",
"->",
"read_porttag",
")",
"==",
"NULL",
")",
"{",
"mame_printf_error",
"(",
"\"",
"\\n",
"\"",
",",
"driver",
"->",
"source_file",
",",
"driver",
"->",
"name",
",",
"device",
"->",
"tag",
",",
"address_space_names",
"[",
"spacenum",
"]",
",",
"entry",
"->",
"read_porttag",
")",
";",
"error",
"=",
"TRUE",
";",
"}",
"}",
"address_map_free",
"(",
"map",
")",
";",
"}",
"}",
"return",
"error",
";",
"}"
] | validate_devices - run per-device validity
checks | [
"validate_devices",
"-",
"run",
"per",
"-",
"device",
"validity",
"checks"
] | [
"/* validate the device tag */",
"/* look for duplicates */",
"/* call the device-specific validity check */",
"/* loop over all address spaces */",
"/* construct the maps */",
"/* if this is an empty map, just skip it */",
"/* validate the global map parameters */",
"/* loop over entries and look for errors */",
"/* look for inverted start/end pairs */",
"/* look for misaligned entries */",
"/* if this is a program space, auto-assign implicit ROM entries */",
"/* if this entry references a memory region, validate it */",
"/* loop over entries in the class */",
"/* stop if we hit an empty */",
"/* if we hit a match, check against the length */",
"/* make sure all devices exist */",
"/* make sure ports exist */",
"/* release the address map */"
] | [
{
"param": "drivnum",
"type": "int"
},
{
"param": "config",
"type": "machine_config"
},
{
"param": "portlist",
"type": "input_port_config"
},
{
"param": "rgninfo",
"type": "region_info"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drivnum",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config",
"type": "machine_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "portlist",
"type": "input_port_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rgninfo",
"type": "region_info",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ca62c6fd80ff6a8129aed99a40b3757968cde7b4 | lofunz/mieme | Reloaded/trunk/src/mame/video/ms32.c | [
"Unlicense"
] | C | draw_roz | void | static void draw_roz(bitmap_t *bitmap, const rectangle *cliprect,int priority)
{
/* TODO: registers 0x40/4 / 0x44/4 and 0x50/4 / 0x54/4 are used, meaning unknown */
if (ms32_roz_ctrl[0x5c/4] & 1) /* "super" mode */
{
rectangle my_clip;
int y,maxy;
my_clip.min_x = cliprect->min_x;
my_clip.max_x = cliprect->max_x;
y = cliprect->min_y;
maxy = cliprect->max_y;
while (y <= maxy)
{
UINT16 *lineaddr = ms32_lineram_16 + 8 * (y & 0xff);
int start2x = (lineaddr[0x00/4] & 0xffff) | ((lineaddr[0x04/4] & 3) << 16);
int start2y = (lineaddr[0x08/4] & 0xffff) | ((lineaddr[0x0c/4] & 3) << 16);
int incxx = (lineaddr[0x10/4] & 0xffff) | ((lineaddr[0x14/4] & 1) << 16);
int incxy = (lineaddr[0x18/4] & 0xffff) | ((lineaddr[0x1c/4] & 1) << 16);
int startx = (ms32_roz_ctrl[0x00/4] & 0xffff) | ((ms32_roz_ctrl[0x04/4] & 3) << 16);
int starty = (ms32_roz_ctrl[0x08/4] & 0xffff) | ((ms32_roz_ctrl[0x0c/4] & 3) << 16);
int offsx = ms32_roz_ctrl[0x30/4];
int offsy = ms32_roz_ctrl[0x34/4];
my_clip.min_y = my_clip.max_y = y;
offsx += (ms32_roz_ctrl[0x38/4] & 1) * 0x400; // ??? gratia, hayaosi1...
offsy += (ms32_roz_ctrl[0x3c/4] & 1) * 0x400; // ??? gratia, hayaosi1...
/* extend sign */
if (start2x & 0x20000) start2x |= ~0x3ffff;
if (start2y & 0x20000) start2y |= ~0x3ffff;
if (startx & 0x20000) startx |= ~0x3ffff;
if (starty & 0x20000) starty |= ~0x3ffff;
if (incxx & 0x10000) incxx |= ~0x1ffff;
if (incxy & 0x10000) incxy |= ~0x1ffff;
tilemap_draw_roz(bitmap, &my_clip, ms32_roz_tilemap,
(start2x+startx+offsx)<<16, (start2y+starty+offsy)<<16,
incxx<<8, incxy<<8, 0, 0,
1, // Wrap
0, priority);
y++;
}
}
else /* "simple" mode */
{
int startx = (ms32_roz_ctrl[0x00/4] & 0xffff) | ((ms32_roz_ctrl[0x04/4] & 3) << 16);
int starty = (ms32_roz_ctrl[0x08/4] & 0xffff) | ((ms32_roz_ctrl[0x0c/4] & 3) << 16);
int incxx = (ms32_roz_ctrl[0x10/4] & 0xffff) | ((ms32_roz_ctrl[0x14/4] & 1) << 16);
int incxy = (ms32_roz_ctrl[0x18/4] & 0xffff) | ((ms32_roz_ctrl[0x1c/4] & 1) << 16);
int incyy = (ms32_roz_ctrl[0x20/4] & 0xffff) | ((ms32_roz_ctrl[0x24/4] & 1) << 16);
int incyx = (ms32_roz_ctrl[0x28/4] & 0xffff) | ((ms32_roz_ctrl[0x2c/4] & 1) << 16);
int offsx = ms32_roz_ctrl[0x30/4];
int offsy = ms32_roz_ctrl[0x34/4];
offsx += (ms32_roz_ctrl[0x38/4] & 1) * 0x400; // ??? gratia, hayaosi1...
offsy += (ms32_roz_ctrl[0x3c/4] & 1) * 0x400; // ??? gratia, hayaosi1...
/* extend sign */
if (startx & 0x20000) startx |= ~0x3ffff;
if (starty & 0x20000) starty |= ~0x3ffff;
if (incxx & 0x10000) incxx |= ~0x1ffff;
if (incxy & 0x10000) incxy |= ~0x1ffff;
if (incyy & 0x10000) incyy |= ~0x1ffff;
if (incyx & 0x10000) incyx |= ~0x1ffff;
tilemap_draw_roz(bitmap, cliprect, ms32_roz_tilemap,
(startx+offsx)<<16, (starty+offsy)<<16,
incxx<<8, incxy<<8, incyx<<8, incyy<<8,
1, // Wrap
0, priority);
}
} | /* SPRITES based on tetrisp2 for now, readd priority bits later */
/* now using function in tetrisp2.c */ | SPRITES based on tetrisp2 for now, readd priority bits later
now using function in tetrisp2.c | [
"SPRITES",
"based",
"on",
"tetrisp2",
"for",
"now",
"readd",
"priority",
"bits",
"later",
"now",
"using",
"function",
"in",
"tetrisp2",
".",
"c"
] | static void draw_roz(bitmap_t *bitmap, const rectangle *cliprect,int priority)
{
if (ms32_roz_ctrl[0x5c/4] & 1)
{
rectangle my_clip;
int y,maxy;
my_clip.min_x = cliprect->min_x;
my_clip.max_x = cliprect->max_x;
y = cliprect->min_y;
maxy = cliprect->max_y;
while (y <= maxy)
{
UINT16 *lineaddr = ms32_lineram_16 + 8 * (y & 0xff);
int start2x = (lineaddr[0x00/4] & 0xffff) | ((lineaddr[0x04/4] & 3) << 16);
int start2y = (lineaddr[0x08/4] & 0xffff) | ((lineaddr[0x0c/4] & 3) << 16);
int incxx = (lineaddr[0x10/4] & 0xffff) | ((lineaddr[0x14/4] & 1) << 16);
int incxy = (lineaddr[0x18/4] & 0xffff) | ((lineaddr[0x1c/4] & 1) << 16);
int startx = (ms32_roz_ctrl[0x00/4] & 0xffff) | ((ms32_roz_ctrl[0x04/4] & 3) << 16);
int starty = (ms32_roz_ctrl[0x08/4] & 0xffff) | ((ms32_roz_ctrl[0x0c/4] & 3) << 16);
int offsx = ms32_roz_ctrl[0x30/4];
int offsy = ms32_roz_ctrl[0x34/4];
my_clip.min_y = my_clip.max_y = y;
offsx += (ms32_roz_ctrl[0x38/4] & 1) * 0x400;
offsy += (ms32_roz_ctrl[0x3c/4] & 1) * 0x400;
if (start2x & 0x20000) start2x |= ~0x3ffff;
if (start2y & 0x20000) start2y |= ~0x3ffff;
if (startx & 0x20000) startx |= ~0x3ffff;
if (starty & 0x20000) starty |= ~0x3ffff;
if (incxx & 0x10000) incxx |= ~0x1ffff;
if (incxy & 0x10000) incxy |= ~0x1ffff;
tilemap_draw_roz(bitmap, &my_clip, ms32_roz_tilemap,
(start2x+startx+offsx)<<16, (start2y+starty+offsy)<<16,
incxx<<8, incxy<<8, 0, 0,
1,
0, priority);
y++;
}
}
else
{
int startx = (ms32_roz_ctrl[0x00/4] & 0xffff) | ((ms32_roz_ctrl[0x04/4] & 3) << 16);
int starty = (ms32_roz_ctrl[0x08/4] & 0xffff) | ((ms32_roz_ctrl[0x0c/4] & 3) << 16);
int incxx = (ms32_roz_ctrl[0x10/4] & 0xffff) | ((ms32_roz_ctrl[0x14/4] & 1) << 16);
int incxy = (ms32_roz_ctrl[0x18/4] & 0xffff) | ((ms32_roz_ctrl[0x1c/4] & 1) << 16);
int incyy = (ms32_roz_ctrl[0x20/4] & 0xffff) | ((ms32_roz_ctrl[0x24/4] & 1) << 16);
int incyx = (ms32_roz_ctrl[0x28/4] & 0xffff) | ((ms32_roz_ctrl[0x2c/4] & 1) << 16);
int offsx = ms32_roz_ctrl[0x30/4];
int offsy = ms32_roz_ctrl[0x34/4];
offsx += (ms32_roz_ctrl[0x38/4] & 1) * 0x400;
offsy += (ms32_roz_ctrl[0x3c/4] & 1) * 0x400;
if (startx & 0x20000) startx |= ~0x3ffff;
if (starty & 0x20000) starty |= ~0x3ffff;
if (incxx & 0x10000) incxx |= ~0x1ffff;
if (incxy & 0x10000) incxy |= ~0x1ffff;
if (incyy & 0x10000) incyy |= ~0x1ffff;
if (incyx & 0x10000) incyx |= ~0x1ffff;
tilemap_draw_roz(bitmap, cliprect, ms32_roz_tilemap,
(startx+offsx)<<16, (starty+offsy)<<16,
incxx<<8, incxy<<8, incyx<<8, incyy<<8,
1,
0, priority);
}
} | [
"static",
"void",
"draw_roz",
"(",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"int",
"priority",
")",
"{",
"if",
"(",
"ms32_roz_ctrl",
"[",
"0x5c",
"/",
"4",
"]",
"&",
"1",
")",
"{",
"rectangle",
"my_clip",
";",
"int",
"y",
",",
"maxy",
";",
"my_clip",
".",
"min_x",
"=",
"cliprect",
"->",
"min_x",
";",
"my_clip",
".",
"max_x",
"=",
"cliprect",
"->",
"max_x",
";",
"y",
"=",
"cliprect",
"->",
"min_y",
";",
"maxy",
"=",
"cliprect",
"->",
"max_y",
";",
"while",
"(",
"y",
"<=",
"maxy",
")",
"{",
"UINT16",
"*",
"lineaddr",
"=",
"ms32_lineram_16",
"+",
"8",
"*",
"(",
"y",
"&",
"0xff",
")",
";",
"int",
"start2x",
"=",
"(",
"lineaddr",
"[",
"0x00",
"/",
"4",
"]",
"&",
"0xffff",
")",
"|",
"(",
"(",
"lineaddr",
"[",
"0x04",
"/",
"4",
"]",
"&",
"3",
")",
"<<",
"16",
")",
";",
"int",
"start2y",
"=",
"(",
"lineaddr",
"[",
"0x08",
"/",
"4",
"]",
"&",
"0xffff",
")",
"|",
"(",
"(",
"lineaddr",
"[",
"0x0c",
"/",
"4",
"]",
"&",
"3",
")",
"<<",
"16",
")",
";",
"int",
"incxx",
"=",
"(",
"lineaddr",
"[",
"0x10",
"/",
"4",
"]",
"&",
"0xffff",
")",
"|",
"(",
"(",
"lineaddr",
"[",
"0x14",
"/",
"4",
"]",
"&",
"1",
")",
"<<",
"16",
")",
";",
"int",
"incxy",
"=",
"(",
"lineaddr",
"[",
"0x18",
"/",
"4",
"]",
"&",
"0xffff",
")",
"|",
"(",
"(",
"lineaddr",
"[",
"0x1c",
"/",
"4",
"]",
"&",
"1",
")",
"<<",
"16",
")",
";",
"int",
"startx",
"=",
"(",
"ms32_roz_ctrl",
"[",
"0x00",
"/",
"4",
"]",
"&",
"0xffff",
")",
"|",
"(",
"(",
"ms32_roz_ctrl",
"[",
"0x04",
"/",
"4",
"]",
"&",
"3",
")",
"<<",
"16",
")",
";",
"int",
"starty",
"=",
"(",
"ms32_roz_ctrl",
"[",
"0x08",
"/",
"4",
"]",
"&",
"0xffff",
")",
"|",
"(",
"(",
"ms32_roz_ctrl",
"[",
"0x0c",
"/",
"4",
"]",
"&",
"3",
")",
"<<",
"16",
")",
";",
"int",
"offsx",
"=",
"ms32_roz_ctrl",
"[",
"0x30",
"/",
"4",
"]",
";",
"int",
"offsy",
"=",
"ms32_roz_ctrl",
"[",
"0x34",
"/",
"4",
"]",
";",
"my_clip",
".",
"min_y",
"=",
"my_clip",
".",
"max_y",
"=",
"y",
";",
"offsx",
"+=",
"(",
"ms32_roz_ctrl",
"[",
"0x38",
"/",
"4",
"]",
"&",
"1",
")",
"*",
"0x400",
";",
"offsy",
"+=",
"(",
"ms32_roz_ctrl",
"[",
"0x3c",
"/",
"4",
"]",
"&",
"1",
")",
"*",
"0x400",
";",
"if",
"(",
"start2x",
"&",
"0x20000",
")",
"start2x",
"|=",
"~",
"0x3ffff",
";",
"if",
"(",
"start2y",
"&",
"0x20000",
")",
"start2y",
"|=",
"~",
"0x3ffff",
";",
"if",
"(",
"startx",
"&",
"0x20000",
")",
"startx",
"|=",
"~",
"0x3ffff",
";",
"if",
"(",
"starty",
"&",
"0x20000",
")",
"starty",
"|=",
"~",
"0x3ffff",
";",
"if",
"(",
"incxx",
"&",
"0x10000",
")",
"incxx",
"|=",
"~",
"0x1ffff",
";",
"if",
"(",
"incxy",
"&",
"0x10000",
")",
"incxy",
"|=",
"~",
"0x1ffff",
";",
"tilemap_draw_roz",
"(",
"bitmap",
",",
"&",
"my_clip",
",",
"ms32_roz_tilemap",
",",
"(",
"start2x",
"+",
"startx",
"+",
"offsx",
")",
"<<",
"16",
",",
"(",
"start2y",
"+",
"starty",
"+",
"offsy",
")",
"<<",
"16",
",",
"incxx",
"<<",
"8",
",",
"incxy",
"<<",
"8",
",",
"0",
",",
"0",
",",
"1",
",",
"0",
",",
"priority",
")",
";",
"y",
"++",
";",
"}",
"}",
"else",
"{",
"int",
"startx",
"=",
"(",
"ms32_roz_ctrl",
"[",
"0x00",
"/",
"4",
"]",
"&",
"0xffff",
")",
"|",
"(",
"(",
"ms32_roz_ctrl",
"[",
"0x04",
"/",
"4",
"]",
"&",
"3",
")",
"<<",
"16",
")",
";",
"int",
"starty",
"=",
"(",
"ms32_roz_ctrl",
"[",
"0x08",
"/",
"4",
"]",
"&",
"0xffff",
")",
"|",
"(",
"(",
"ms32_roz_ctrl",
"[",
"0x0c",
"/",
"4",
"]",
"&",
"3",
")",
"<<",
"16",
")",
";",
"int",
"incxx",
"=",
"(",
"ms32_roz_ctrl",
"[",
"0x10",
"/",
"4",
"]",
"&",
"0xffff",
")",
"|",
"(",
"(",
"ms32_roz_ctrl",
"[",
"0x14",
"/",
"4",
"]",
"&",
"1",
")",
"<<",
"16",
")",
";",
"int",
"incxy",
"=",
"(",
"ms32_roz_ctrl",
"[",
"0x18",
"/",
"4",
"]",
"&",
"0xffff",
")",
"|",
"(",
"(",
"ms32_roz_ctrl",
"[",
"0x1c",
"/",
"4",
"]",
"&",
"1",
")",
"<<",
"16",
")",
";",
"int",
"incyy",
"=",
"(",
"ms32_roz_ctrl",
"[",
"0x20",
"/",
"4",
"]",
"&",
"0xffff",
")",
"|",
"(",
"(",
"ms32_roz_ctrl",
"[",
"0x24",
"/",
"4",
"]",
"&",
"1",
")",
"<<",
"16",
")",
";",
"int",
"incyx",
"=",
"(",
"ms32_roz_ctrl",
"[",
"0x28",
"/",
"4",
"]",
"&",
"0xffff",
")",
"|",
"(",
"(",
"ms32_roz_ctrl",
"[",
"0x2c",
"/",
"4",
"]",
"&",
"1",
")",
"<<",
"16",
")",
";",
"int",
"offsx",
"=",
"ms32_roz_ctrl",
"[",
"0x30",
"/",
"4",
"]",
";",
"int",
"offsy",
"=",
"ms32_roz_ctrl",
"[",
"0x34",
"/",
"4",
"]",
";",
"offsx",
"+=",
"(",
"ms32_roz_ctrl",
"[",
"0x38",
"/",
"4",
"]",
"&",
"1",
")",
"*",
"0x400",
";",
"offsy",
"+=",
"(",
"ms32_roz_ctrl",
"[",
"0x3c",
"/",
"4",
"]",
"&",
"1",
")",
"*",
"0x400",
";",
"if",
"(",
"startx",
"&",
"0x20000",
")",
"startx",
"|=",
"~",
"0x3ffff",
";",
"if",
"(",
"starty",
"&",
"0x20000",
")",
"starty",
"|=",
"~",
"0x3ffff",
";",
"if",
"(",
"incxx",
"&",
"0x10000",
")",
"incxx",
"|=",
"~",
"0x1ffff",
";",
"if",
"(",
"incxy",
"&",
"0x10000",
")",
"incxy",
"|=",
"~",
"0x1ffff",
";",
"if",
"(",
"incyy",
"&",
"0x10000",
")",
"incyy",
"|=",
"~",
"0x1ffff",
";",
"if",
"(",
"incyx",
"&",
"0x10000",
")",
"incyx",
"|=",
"~",
"0x1ffff",
";",
"tilemap_draw_roz",
"(",
"bitmap",
",",
"cliprect",
",",
"ms32_roz_tilemap",
",",
"(",
"startx",
"+",
"offsx",
")",
"<<",
"16",
",",
"(",
"starty",
"+",
"offsy",
")",
"<<",
"16",
",",
"incxx",
"<<",
"8",
",",
"incxy",
"<<",
"8",
",",
"incyx",
"<<",
"8",
",",
"incyy",
"<<",
"8",
",",
"1",
",",
"0",
",",
"priority",
")",
";",
"}",
"}"
] | SPRITES based on tetrisp2 for now, readd priority bits later
now using function in tetrisp2.c | [
"SPRITES",
"based",
"on",
"tetrisp2",
"for",
"now",
"readd",
"priority",
"bits",
"later",
"now",
"using",
"function",
"in",
"tetrisp2",
".",
"c"
] | [
"/* TODO: registers 0x40/4 / 0x44/4 and 0x50/4 / 0x54/4 are used, meaning unknown */",
"/* \"super\" mode */",
"// ??? gratia, hayaosi1...\r",
"// ??? gratia, hayaosi1...\r",
"/* extend sign */",
"// Wrap\r",
"/* \"simple\" mode */",
"// ??? gratia, hayaosi1...\r",
"// ??? gratia, hayaosi1...\r",
"/* extend sign */",
"// Wrap\r"
] | [
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "priority",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a9c1b790f538b8b8a7c15f26e2a47b045b886dd7 | lofunz/mieme | Reloaded/tags/MAME4iOS 1.5 Reloaded/src/emu/ui.c | [
"Unlicense"
] | C | ui_set_startup_text | void | void ui_set_startup_text(running_machine *machine, const char *text, int force)
{
static osd_ticks_t lastupdatetime = 0;
osd_ticks_t curtime = osd_ticks();
/* copy in the new text */
messagebox_text.cpy(text);
messagebox_backcolor = UI_BACKGROUND_COLOR;
/* don't update more than 4 times/second */
if (force || (curtime - lastupdatetime) > osd_ticks_per_second() / 4)
{
lastupdatetime = curtime;
video_frame_update(machine, FALSE);
}
} | /*-------------------------------------------------
ui_set_startup_text - set the text to display
at startup
-------------------------------------------------*/ | set the text to display
at startup | [
"set",
"the",
"text",
"to",
"display",
"at",
"startup"
] | void ui_set_startup_text(running_machine *machine, const char *text, int force)
{
static osd_ticks_t lastupdatetime = 0;
osd_ticks_t curtime = osd_ticks();
messagebox_text.cpy(text);
messagebox_backcolor = UI_BACKGROUND_COLOR;
if (force || (curtime - lastupdatetime) > osd_ticks_per_second() / 4)
{
lastupdatetime = curtime;
video_frame_update(machine, FALSE);
}
} | [
"void",
"ui_set_startup_text",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"text",
",",
"int",
"force",
")",
"{",
"static",
"osd_ticks_t",
"lastupdatetime",
"=",
"0",
";",
"osd_ticks_t",
"curtime",
"=",
"osd_ticks",
"(",
")",
";",
"messagebox_text",
".",
"cpy",
"(",
"text",
")",
";",
"messagebox_backcolor",
"=",
"UI_BACKGROUND_COLOR",
";",
"if",
"(",
"force",
"||",
"(",
"curtime",
"-",
"lastupdatetime",
")",
">",
"osd_ticks_per_second",
"(",
")",
"/",
"4",
")",
"{",
"lastupdatetime",
"=",
"curtime",
";",
"video_frame_update",
"(",
"machine",
",",
"FALSE",
")",
";",
"}",
"}"
] | ui_set_startup_text - set the text to display
at startup | [
"ui_set_startup_text",
"-",
"set",
"the",
"text",
"to",
"display",
"at",
"startup"
] | [
"/* copy in the new text */",
"/* don't update more than 4 times/second */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "text",
"type": "char"
},
{
"param": "force",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "text",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "force",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a9c1b790f538b8b8a7c15f26e2a47b045b886dd7 | lofunz/mieme | Reloaded/tags/MAME4iOS 1.5 Reloaded/src/emu/ui.c | [
"Unlicense"
] | C | ui_update_and_render | void | void ui_update_and_render(running_machine *machine, render_container *container)
{
myosd_in_menu = ui_handler_callback!= handler_ingame;
/* always start clean */
render_container_empty(container);
/* if we're paused, dim the whole screen */
if (machine->phase() >= MACHINE_PHASE_RESET && (single_step || machine->paused()))
{
int alpha = (1.0f - options_get_float(machine->options(), OPTION_PAUSE_BRIGHTNESS)) * 255.0f;
if (ui_menu_is_force_game_select())
alpha = 255;
if (alpha > 255)
alpha = 255;
if (alpha >= 0)
render_container_add_rect(container, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(alpha,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
/* render any cheat stuff at the bottom */
cheat_render_text(machine, container);
/* call the current UI handler */
assert(ui_handler_callback != NULL);
ui_handler_param = (*ui_handler_callback)(machine, container, ui_handler_param);
/* display any popup messages */
if (osd_ticks() < popup_text_end)
ui_draw_text_box(container, messagebox_text, JUSTIFY_CENTER, 0.5f, 0.9f, messagebox_backcolor);
else
popup_text_end = 0;
/* cancel takes us back to the ingame handler */
if (ui_handler_param == UI_HANDLER_CANCEL)
ui_set_handler(handler_ingame, 0);
} | /*-------------------------------------------------
ui_update_and_render - update the UI and
render it; called by video.c
-------------------------------------------------*/ | update the UI and
render it; called by video.c | [
"update",
"the",
"UI",
"and",
"render",
"it",
";",
"called",
"by",
"video",
".",
"c"
] | void ui_update_and_render(running_machine *machine, render_container *container)
{
myosd_in_menu = ui_handler_callback!= handler_ingame;
render_container_empty(container);
if (machine->phase() >= MACHINE_PHASE_RESET && (single_step || machine->paused()))
{
int alpha = (1.0f - options_get_float(machine->options(), OPTION_PAUSE_BRIGHTNESS)) * 255.0f;
if (ui_menu_is_force_game_select())
alpha = 255;
if (alpha > 255)
alpha = 255;
if (alpha >= 0)
render_container_add_rect(container, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(alpha,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
cheat_render_text(machine, container);
assert(ui_handler_callback != NULL);
ui_handler_param = (*ui_handler_callback)(machine, container, ui_handler_param);
if (osd_ticks() < popup_text_end)
ui_draw_text_box(container, messagebox_text, JUSTIFY_CENTER, 0.5f, 0.9f, messagebox_backcolor);
else
popup_text_end = 0;
if (ui_handler_param == UI_HANDLER_CANCEL)
ui_set_handler(handler_ingame, 0);
} | [
"void",
"ui_update_and_render",
"(",
"running_machine",
"*",
"machine",
",",
"render_container",
"*",
"container",
")",
"{",
"myosd_in_menu",
"=",
"ui_handler_callback",
"!=",
"handler_ingame",
";",
"render_container_empty",
"(",
"container",
")",
";",
"if",
"(",
"machine",
"->",
"phase",
"(",
")",
">=",
"MACHINE_PHASE_RESET",
"&&",
"(",
"single_step",
"||",
"machine",
"->",
"paused",
"(",
")",
")",
")",
"{",
"int",
"alpha",
"=",
"(",
"1.0f",
"-",
"options_get_float",
"(",
"machine",
"->",
"options",
"(",
")",
",",
"OPTION_PAUSE_BRIGHTNESS",
")",
")",
"*",
"255.0f",
";",
"if",
"(",
"ui_menu_is_force_game_select",
"(",
")",
")",
"alpha",
"=",
"255",
";",
"if",
"(",
"alpha",
">",
"255",
")",
"alpha",
"=",
"255",
";",
"if",
"(",
"alpha",
">=",
"0",
")",
"render_container_add_rect",
"(",
"container",
",",
"0.0f",
",",
"0.0f",
",",
"1.0f",
",",
"1.0f",
",",
"MAKE_ARGB",
"(",
"alpha",
",",
"0x00",
",",
"0x00",
",",
"0x00",
")",
",",
"PRIMFLAG_BLENDMODE",
"(",
"BLENDMODE_ALPHA",
")",
")",
";",
"}",
"cheat_render_text",
"(",
"machine",
",",
"container",
")",
";",
"assert",
"(",
"ui_handler_callback",
"!=",
"NULL",
")",
";",
"ui_handler_param",
"=",
"(",
"*",
"ui_handler_callback",
")",
"(",
"machine",
",",
"container",
",",
"ui_handler_param",
")",
";",
"if",
"(",
"osd_ticks",
"(",
")",
"<",
"popup_text_end",
")",
"ui_draw_text_box",
"(",
"container",
",",
"messagebox_text",
",",
"JUSTIFY_CENTER",
",",
"0.5f",
",",
"0.9f",
",",
"messagebox_backcolor",
")",
";",
"else",
"popup_text_end",
"=",
"0",
";",
"if",
"(",
"ui_handler_param",
"==",
"UI_HANDLER_CANCEL",
")",
"ui_set_handler",
"(",
"handler_ingame",
",",
"0",
")",
";",
"}"
] | ui_update_and_render - update the UI and
render it; called by video.c | [
"ui_update_and_render",
"-",
"update",
"the",
"UI",
"and",
"render",
"it",
";",
"called",
"by",
"video",
".",
"c"
] | [
"/* always start clean */",
"/* if we're paused, dim the whole screen */",
"/* render any cheat stuff at the bottom */",
"/* call the current UI handler */",
"/* display any popup messages */",
"/* cancel takes us back to the ingame handler */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "container",
"type": "render_container"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "container",
"type": "render_container",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a9c1b790f538b8b8a7c15f26e2a47b045b886dd7 | lofunz/mieme | Reloaded/tags/MAME4iOS 1.5 Reloaded/src/emu/ui.c | [
"Unlicense"
] | C | ui_draw_outlined_box | void | void ui_draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor)
{
render_container_add_rect(container, x0, y0, x1, y1, backcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_container_add_line(container, x0, y0, x1, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_container_add_line(container, x1, y0, x1, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_container_add_line(container, x1, y1, x0, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_container_add_line(container, x0, y1, x0, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
} | /*-------------------------------------------------
ui_draw_outlined_box - add primitives to draw
an outlined box with the given background
color
-------------------------------------------------*/ | add primitives to draw
an outlined box with the given background
color | [
"add",
"primitives",
"to",
"draw",
"an",
"outlined",
"box",
"with",
"the",
"given",
"background",
"color"
] | void ui_draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor)
{
render_container_add_rect(container, x0, y0, x1, y1, backcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_container_add_line(container, x0, y0, x1, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_container_add_line(container, x1, y0, x1, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_container_add_line(container, x1, y1, x0, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_container_add_line(container, x0, y1, x0, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
} | [
"void",
"ui_draw_outlined_box",
"(",
"render_container",
"*",
"container",
",",
"float",
"x0",
",",
"float",
"y0",
",",
"float",
"x1",
",",
"float",
"y1",
",",
"rgb_t",
"backcolor",
")",
"{",
"render_container_add_rect",
"(",
"container",
",",
"x0",
",",
"y0",
",",
"x1",
",",
"y1",
",",
"backcolor",
",",
"PRIMFLAG_BLENDMODE",
"(",
"BLENDMODE_ALPHA",
")",
")",
";",
"render_container_add_line",
"(",
"container",
",",
"x0",
",",
"y0",
",",
"x1",
",",
"y0",
",",
"UI_LINE_WIDTH",
",",
"UI_BORDER_COLOR",
",",
"PRIMFLAG_BLENDMODE",
"(",
"BLENDMODE_ALPHA",
")",
")",
";",
"render_container_add_line",
"(",
"container",
",",
"x1",
",",
"y0",
",",
"x1",
",",
"y1",
",",
"UI_LINE_WIDTH",
",",
"UI_BORDER_COLOR",
",",
"PRIMFLAG_BLENDMODE",
"(",
"BLENDMODE_ALPHA",
")",
")",
";",
"render_container_add_line",
"(",
"container",
",",
"x1",
",",
"y1",
",",
"x0",
",",
"y1",
",",
"UI_LINE_WIDTH",
",",
"UI_BORDER_COLOR",
",",
"PRIMFLAG_BLENDMODE",
"(",
"BLENDMODE_ALPHA",
")",
")",
";",
"render_container_add_line",
"(",
"container",
",",
"x0",
",",
"y1",
",",
"x0",
",",
"y0",
",",
"UI_LINE_WIDTH",
",",
"UI_BORDER_COLOR",
",",
"PRIMFLAG_BLENDMODE",
"(",
"BLENDMODE_ALPHA",
")",
")",
";",
"}"
] | ui_draw_outlined_box - add primitives to draw
an outlined box with the given background
color | [
"ui_draw_outlined_box",
"-",
"add",
"primitives",
"to",
"draw",
"an",
"outlined",
"box",
"with",
"the",
"given",
"background",
"color"
] | [] | [
{
"param": "container",
"type": "render_container"
},
{
"param": "x0",
"type": "float"
},
{
"param": "y0",
"type": "float"
},
{
"param": "x1",
"type": "float"
},
{
"param": "y1",
"type": "float"
},
{
"param": "backcolor",
"type": "rgb_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "container",
"type": "render_container",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x0",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y0",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x1",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y1",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "backcolor",
"type": "rgb_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a9c1b790f538b8b8a7c15f26e2a47b045b886dd7 | lofunz/mieme | Reloaded/tags/MAME4iOS 1.5 Reloaded/src/emu/ui.c | [
"Unlicense"
] | C | ui_draw_text_full | void | void ui_draw_text_full(render_container *container, const char *origs, float x, float y, float origwrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight)
{
float lineheight = ui_get_line_height();
const char *ends = origs + strlen(origs);
float wrapwidth = origwrapwidth;
const char *s = origs;
const char *linestart;
float cury = y;
float maxwidth = 0;
/* if we don't want wrapping, guarantee a huge wrapwidth */
if (wrap == WRAP_NEVER)
wrapwidth = 1000000.0f;
if (wrapwidth <= 0)
return;
/* loop over lines */
while (*s != 0)
{
const char *lastbreak = NULL;
int line_justify = justify;
unicode_char schar;
int scharcount;
float lastbreak_width = 0;
float curwidth = 0;
float curx = x;
/* get the current character */
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
/* if the line starts with a tab character, center it regardless */
if (schar == '\t')
{
s += scharcount;
line_justify = JUSTIFY_CENTER;
}
/* remember the starting position of the line */
linestart = s;
/* loop while we have characters and are less than the wrapwidth */
while (*s != 0 && curwidth <= wrapwidth)
{
float chwidth;
/* get the current chcaracter */
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
/* if we hit a newline, stop immediately */
if (schar == '\n')
break;
/* get the width of this character */
chwidth = ui_get_char_width(schar);
/* if we hit a space, remember the location and width *without* the space */
if (schar == ' ')
{
lastbreak = s;
lastbreak_width = curwidth;
}
/* add the width of this character and advance */
curwidth += chwidth;
s += scharcount;
/* if we hit any non-space breakable character, remember the location and width
*with* the breakable character */
if (schar != ' ' && is_breakable_char(schar) && curwidth <= wrapwidth)
{
lastbreak = s;
lastbreak_width = curwidth;
}
}
/* if we accumulated too much for the current width, we need to back off */
if (curwidth > wrapwidth)
{
/* if we're word wrapping, back up to the last break if we can */
if (wrap == WRAP_WORD)
{
/* if we hit a break, back up to there with the appropriate width */
if (lastbreak != NULL)
{
s = lastbreak;
curwidth = lastbreak_width;
}
/* if we didn't hit a break, back up one character */
else if (s > linestart)
{
/* get the previous character */
s = (const char *)utf8_previous_char(s);
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
curwidth -= ui_get_char_width(schar);
}
}
/* if we're truncating, make sure we have enough space for the ... */
else if (wrap == WRAP_TRUNCATE)
{
/* add in the width of the ... */
curwidth += 3.0f * ui_get_char_width('.');
/* while we are above the wrap width, back up one character */
while (curwidth > wrapwidth && s > linestart)
{
/* get the previous character */
s = (const char *)utf8_previous_char(s);
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
curwidth -= ui_get_char_width(schar);
}
}
}
/* align according to the justfication */
if (line_justify == JUSTIFY_CENTER)
curx += (origwrapwidth - curwidth) * 0.5f;
else if (line_justify == JUSTIFY_RIGHT)
curx += origwrapwidth - curwidth;
/* track the maximum width of any given line */
if (curwidth > maxwidth)
maxwidth = curwidth;
/* if opaque, add a black box */
if (draw == DRAW_OPAQUE)
render_container_add_rect(container, curx, cury, curx + curwidth, cury + lineheight, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
/* loop from the line start and add the characters */
while (linestart < s)
{
/* get the current character */
unicode_char linechar;
int linecharcount = uchar_from_utf8(&linechar, linestart, ends - linestart);
if (linecharcount == -1)
break;
if (draw != DRAW_NONE)
{
render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, linechar);
curx += ui_get_char_width(linechar);
}
linestart += linecharcount;
}
/* append ellipses if needed */
if (wrap == WRAP_TRUNCATE && *s != 0 && draw != DRAW_NONE)
{
render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.');
curx += ui_get_char_width('.');
render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.');
curx += ui_get_char_width('.');
render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.');
curx += ui_get_char_width('.');
}
/* if we're not word-wrapping, we're done */
if (wrap != WRAP_WORD)
break;
/* advance by a row */
cury += lineheight;
/* skip past any spaces at the beginning of the next line */
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
if (schar == '\n')
s += scharcount;
else
while (*s && isspace(schar))
{
s += scharcount;
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
}
}
/* report the width and height of the resulting space */
if (totalwidth)
*totalwidth = maxwidth;
if (totalheight)
*totalheight = cury - y;
} | /*-------------------------------------------------
ui_draw_text_full - full featured text
renderer with word wrapping, justification,
and full size computation
-------------------------------------------------*/ | full featured text
renderer with word wrapping, justification,
and full size computation | [
"full",
"featured",
"text",
"renderer",
"with",
"word",
"wrapping",
"justification",
"and",
"full",
"size",
"computation"
] | void ui_draw_text_full(render_container *container, const char *origs, float x, float y, float origwrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight)
{
float lineheight = ui_get_line_height();
const char *ends = origs + strlen(origs);
float wrapwidth = origwrapwidth;
const char *s = origs;
const char *linestart;
float cury = y;
float maxwidth = 0;
if (wrap == WRAP_NEVER)
wrapwidth = 1000000.0f;
if (wrapwidth <= 0)
return;
while (*s != 0)
{
const char *lastbreak = NULL;
int line_justify = justify;
unicode_char schar;
int scharcount;
float lastbreak_width = 0;
float curwidth = 0;
float curx = x;
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
if (schar == '\t')
{
s += scharcount;
line_justify = JUSTIFY_CENTER;
}
linestart = s;
while (*s != 0 && curwidth <= wrapwidth)
{
float chwidth;
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
if (schar == '\n')
break;
chwidth = ui_get_char_width(schar);
if (schar == ' ')
{
lastbreak = s;
lastbreak_width = curwidth;
}
curwidth += chwidth;
s += scharcount;
if (schar != ' ' && is_breakable_char(schar) && curwidth <= wrapwidth)
{
lastbreak = s;
lastbreak_width = curwidth;
}
}
if (curwidth > wrapwidth)
{
if (wrap == WRAP_WORD)
{
if (lastbreak != NULL)
{
s = lastbreak;
curwidth = lastbreak_width;
}
else if (s > linestart)
{
s = (const char *)utf8_previous_char(s);
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
curwidth -= ui_get_char_width(schar);
}
}
else if (wrap == WRAP_TRUNCATE)
{
curwidth += 3.0f * ui_get_char_width('.');
while (curwidth > wrapwidth && s > linestart)
{
s = (const char *)utf8_previous_char(s);
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
curwidth -= ui_get_char_width(schar);
}
}
}
if (line_justify == JUSTIFY_CENTER)
curx += (origwrapwidth - curwidth) * 0.5f;
else if (line_justify == JUSTIFY_RIGHT)
curx += origwrapwidth - curwidth;
if (curwidth > maxwidth)
maxwidth = curwidth;
if (draw == DRAW_OPAQUE)
render_container_add_rect(container, curx, cury, curx + curwidth, cury + lineheight, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
while (linestart < s)
{
unicode_char linechar;
int linecharcount = uchar_from_utf8(&linechar, linestart, ends - linestart);
if (linecharcount == -1)
break;
if (draw != DRAW_NONE)
{
render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, linechar);
curx += ui_get_char_width(linechar);
}
linestart += linecharcount;
}
if (wrap == WRAP_TRUNCATE && *s != 0 && draw != DRAW_NONE)
{
render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.');
curx += ui_get_char_width('.');
render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.');
curx += ui_get_char_width('.');
render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.');
curx += ui_get_char_width('.');
}
if (wrap != WRAP_WORD)
break;
cury += lineheight;
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
if (schar == '\n')
s += scharcount;
else
while (*s && isspace(schar))
{
s += scharcount;
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
}
}
if (totalwidth)
*totalwidth = maxwidth;
if (totalheight)
*totalheight = cury - y;
} | [
"void",
"ui_draw_text_full",
"(",
"render_container",
"*",
"container",
",",
"const",
"char",
"*",
"origs",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"origwrapwidth",
",",
"int",
"justify",
",",
"int",
"wrap",
",",
"int",
"draw",
",",
"rgb_t",
"fgcolor",
",",
"rgb_t",
"bgcolor",
",",
"float",
"*",
"totalwidth",
",",
"float",
"*",
"totalheight",
")",
"{",
"float",
"lineheight",
"=",
"ui_get_line_height",
"(",
")",
";",
"const",
"char",
"*",
"ends",
"=",
"origs",
"+",
"strlen",
"(",
"origs",
")",
";",
"float",
"wrapwidth",
"=",
"origwrapwidth",
";",
"const",
"char",
"*",
"s",
"=",
"origs",
";",
"const",
"char",
"*",
"linestart",
";",
"float",
"cury",
"=",
"y",
";",
"float",
"maxwidth",
"=",
"0",
";",
"if",
"(",
"wrap",
"==",
"WRAP_NEVER",
")",
"wrapwidth",
"=",
"1000000.0f",
";",
"if",
"(",
"wrapwidth",
"<=",
"0",
")",
"return",
";",
"while",
"(",
"*",
"s",
"!=",
"0",
")",
"{",
"const",
"char",
"*",
"lastbreak",
"=",
"NULL",
";",
"int",
"line_justify",
"=",
"justify",
";",
"unicode_char",
"schar",
";",
"int",
"scharcount",
";",
"float",
"lastbreak_width",
"=",
"0",
";",
"float",
"curwidth",
"=",
"0",
";",
"float",
"curx",
"=",
"x",
";",
"scharcount",
"=",
"uchar_from_utf8",
"(",
"&",
"schar",
",",
"s",
",",
"ends",
"-",
"s",
")",
";",
"if",
"(",
"scharcount",
"==",
"-1",
")",
"break",
";",
"if",
"(",
"schar",
"==",
"'",
"\\t",
"'",
")",
"{",
"s",
"+=",
"scharcount",
";",
"line_justify",
"=",
"JUSTIFY_CENTER",
";",
"}",
"linestart",
"=",
"s",
";",
"while",
"(",
"*",
"s",
"!=",
"0",
"&&",
"curwidth",
"<=",
"wrapwidth",
")",
"{",
"float",
"chwidth",
";",
"scharcount",
"=",
"uchar_from_utf8",
"(",
"&",
"schar",
",",
"s",
",",
"ends",
"-",
"s",
")",
";",
"if",
"(",
"scharcount",
"==",
"-1",
")",
"break",
";",
"if",
"(",
"schar",
"==",
"'",
"\\n",
"'",
")",
"break",
";",
"chwidth",
"=",
"ui_get_char_width",
"(",
"schar",
")",
";",
"if",
"(",
"schar",
"==",
"'",
"'",
")",
"{",
"lastbreak",
"=",
"s",
";",
"lastbreak_width",
"=",
"curwidth",
";",
"}",
"curwidth",
"+=",
"chwidth",
";",
"s",
"+=",
"scharcount",
";",
"if",
"(",
"schar",
"!=",
"'",
"'",
"&&",
"is_breakable_char",
"(",
"schar",
")",
"&&",
"curwidth",
"<=",
"wrapwidth",
")",
"{",
"lastbreak",
"=",
"s",
";",
"lastbreak_width",
"=",
"curwidth",
";",
"}",
"}",
"if",
"(",
"curwidth",
">",
"wrapwidth",
")",
"{",
"if",
"(",
"wrap",
"==",
"WRAP_WORD",
")",
"{",
"if",
"(",
"lastbreak",
"!=",
"NULL",
")",
"{",
"s",
"=",
"lastbreak",
";",
"curwidth",
"=",
"lastbreak_width",
";",
"}",
"else",
"if",
"(",
"s",
">",
"linestart",
")",
"{",
"s",
"=",
"(",
"const",
"char",
"*",
")",
"utf8_previous_char",
"(",
"s",
")",
";",
"scharcount",
"=",
"uchar_from_utf8",
"(",
"&",
"schar",
",",
"s",
",",
"ends",
"-",
"s",
")",
";",
"if",
"(",
"scharcount",
"==",
"-1",
")",
"break",
";",
"curwidth",
"-=",
"ui_get_char_width",
"(",
"schar",
")",
";",
"}",
"}",
"else",
"if",
"(",
"wrap",
"==",
"WRAP_TRUNCATE",
")",
"{",
"curwidth",
"+=",
"3.0f",
"*",
"ui_get_char_width",
"(",
"'",
"'",
")",
";",
"while",
"(",
"curwidth",
">",
"wrapwidth",
"&&",
"s",
">",
"linestart",
")",
"{",
"s",
"=",
"(",
"const",
"char",
"*",
")",
"utf8_previous_char",
"(",
"s",
")",
";",
"scharcount",
"=",
"uchar_from_utf8",
"(",
"&",
"schar",
",",
"s",
",",
"ends",
"-",
"s",
")",
";",
"if",
"(",
"scharcount",
"==",
"-1",
")",
"break",
";",
"curwidth",
"-=",
"ui_get_char_width",
"(",
"schar",
")",
";",
"}",
"}",
"}",
"if",
"(",
"line_justify",
"==",
"JUSTIFY_CENTER",
")",
"curx",
"+=",
"(",
"origwrapwidth",
"-",
"curwidth",
")",
"*",
"0.5f",
";",
"else",
"if",
"(",
"line_justify",
"==",
"JUSTIFY_RIGHT",
")",
"curx",
"+=",
"origwrapwidth",
"-",
"curwidth",
";",
"if",
"(",
"curwidth",
">",
"maxwidth",
")",
"maxwidth",
"=",
"curwidth",
";",
"if",
"(",
"draw",
"==",
"DRAW_OPAQUE",
")",
"render_container_add_rect",
"(",
"container",
",",
"curx",
",",
"cury",
",",
"curx",
"+",
"curwidth",
",",
"cury",
"+",
"lineheight",
",",
"bgcolor",
",",
"PRIMFLAG_BLENDMODE",
"(",
"BLENDMODE_ALPHA",
")",
")",
";",
"while",
"(",
"linestart",
"<",
"s",
")",
"{",
"unicode_char",
"linechar",
";",
"int",
"linecharcount",
"=",
"uchar_from_utf8",
"(",
"&",
"linechar",
",",
"linestart",
",",
"ends",
"-",
"linestart",
")",
";",
"if",
"(",
"linecharcount",
"==",
"-1",
")",
"break",
";",
"if",
"(",
"draw",
"!=",
"DRAW_NONE",
")",
"{",
"render_container_add_char",
"(",
"container",
",",
"curx",
",",
"cury",
",",
"lineheight",
",",
"render_get_ui_aspect",
"(",
")",
",",
"fgcolor",
",",
"ui_font",
",",
"linechar",
")",
";",
"curx",
"+=",
"ui_get_char_width",
"(",
"linechar",
")",
";",
"}",
"linestart",
"+=",
"linecharcount",
";",
"}",
"if",
"(",
"wrap",
"==",
"WRAP_TRUNCATE",
"&&",
"*",
"s",
"!=",
"0",
"&&",
"draw",
"!=",
"DRAW_NONE",
")",
"{",
"render_container_add_char",
"(",
"container",
",",
"curx",
",",
"cury",
",",
"lineheight",
",",
"render_get_ui_aspect",
"(",
")",
",",
"fgcolor",
",",
"ui_font",
",",
"'",
"'",
")",
";",
"curx",
"+=",
"ui_get_char_width",
"(",
"'",
"'",
")",
";",
"render_container_add_char",
"(",
"container",
",",
"curx",
",",
"cury",
",",
"lineheight",
",",
"render_get_ui_aspect",
"(",
")",
",",
"fgcolor",
",",
"ui_font",
",",
"'",
"'",
")",
";",
"curx",
"+=",
"ui_get_char_width",
"(",
"'",
"'",
")",
";",
"render_container_add_char",
"(",
"container",
",",
"curx",
",",
"cury",
",",
"lineheight",
",",
"render_get_ui_aspect",
"(",
")",
",",
"fgcolor",
",",
"ui_font",
",",
"'",
"'",
")",
";",
"curx",
"+=",
"ui_get_char_width",
"(",
"'",
"'",
")",
";",
"}",
"if",
"(",
"wrap",
"!=",
"WRAP_WORD",
")",
"break",
";",
"cury",
"+=",
"lineheight",
";",
"scharcount",
"=",
"uchar_from_utf8",
"(",
"&",
"schar",
",",
"s",
",",
"ends",
"-",
"s",
")",
";",
"if",
"(",
"scharcount",
"==",
"-1",
")",
"break",
";",
"if",
"(",
"schar",
"==",
"'",
"\\n",
"'",
")",
"s",
"+=",
"scharcount",
";",
"else",
"while",
"(",
"*",
"s",
"&&",
"isspace",
"(",
"schar",
")",
")",
"{",
"s",
"+=",
"scharcount",
";",
"scharcount",
"=",
"uchar_from_utf8",
"(",
"&",
"schar",
",",
"s",
",",
"ends",
"-",
"s",
")",
";",
"if",
"(",
"scharcount",
"==",
"-1",
")",
"break",
";",
"}",
"}",
"if",
"(",
"totalwidth",
")",
"*",
"totalwidth",
"=",
"maxwidth",
";",
"if",
"(",
"totalheight",
")",
"*",
"totalheight",
"=",
"cury",
"-",
"y",
";",
"}"
] | ui_draw_text_full - full featured text
renderer with word wrapping, justification,
and full size computation | [
"ui_draw_text_full",
"-",
"full",
"featured",
"text",
"renderer",
"with",
"word",
"wrapping",
"justification",
"and",
"full",
"size",
"computation"
] | [
"/* if we don't want wrapping, guarantee a huge wrapwidth */",
"/* loop over lines */",
"/* get the current character */",
"/* if the line starts with a tab character, center it regardless */",
"/* remember the starting position of the line */",
"/* loop while we have characters and are less than the wrapwidth */",
"/* get the current chcaracter */",
"/* if we hit a newline, stop immediately */",
"/* get the width of this character */",
"/* if we hit a space, remember the location and width *without* the space */",
"/* add the width of this character and advance */",
"/* if we hit any non-space breakable character, remember the location and width\r\n *with* the breakable character */",
"/* if we accumulated too much for the current width, we need to back off */",
"/* if we're word wrapping, back up to the last break if we can */",
"/* if we hit a break, back up to there with the appropriate width */",
"/* if we didn't hit a break, back up one character */",
"/* get the previous character */",
"/* if we're truncating, make sure we have enough space for the ... */",
"/* add in the width of the ... */",
"/* while we are above the wrap width, back up one character */",
"/* get the previous character */",
"/* align according to the justfication */",
"/* track the maximum width of any given line */",
"/* if opaque, add a black box */",
"/* loop from the line start and add the characters */",
"/* get the current character */",
"/* append ellipses if needed */",
"/* if we're not word-wrapping, we're done */",
"/* advance by a row */",
"/* skip past any spaces at the beginning of the next line */",
"/* report the width and height of the resulting space */"
] | [
{
"param": "container",
"type": "render_container"
},
{
"param": "origs",
"type": "char"
},
{
"param": "x",
"type": "float"
},
{
"param": "y",
"type": "float"
},
{
"param": "origwrapwidth",
"type": "float"
},
{
"param": "justify",
"type": "int"
},
{
"param": "wrap",
"type": "int"
},
{
"param": "draw",
"type": "int"
},
{
"param": "fgcolor",
"type": "rgb_t"
},
{
"param": "bgcolor",
"type": "rgb_t"
},
{
"param": "totalwidth",
"type": "float"
},
{
"param": "totalheight",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "container",
"type": "render_container",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "origs",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "origwrapwidth",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "justify",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wrap",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "draw",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fgcolor",
"type": "rgb_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bgcolor",
"type": "rgb_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "totalwidth",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "totalheight",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a9c1b790f538b8b8a7c15f26e2a47b045b886dd7 | lofunz/mieme | Reloaded/tags/MAME4iOS 1.5 Reloaded/src/emu/ui.c | [
"Unlicense"
] | C | ui_draw_text_box | void | void ui_draw_text_box(render_container *container, const char *text, int justify, float xpos, float ypos, rgb_t backcolor)
{
float target_width, target_height;
float target_x, target_y;
/* compute the multi-line target width/height */
ui_draw_text_full(container, text, 0, 0, 1.0f - 2.0f * UI_BOX_LR_BORDER,
justify, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height);
if (target_height > 1.0f - 2.0f * UI_BOX_TB_BORDER)
target_height = floor((1.0f - 2.0f * UI_BOX_TB_BORDER) / ui_get_line_height()) * ui_get_line_height();
/* determine the target location */
target_x = xpos - 0.5f * target_width;
target_y = ypos - 0.5f * target_height;
/* make sure we stay on-screen */
if (target_x < UI_BOX_LR_BORDER)
target_x = UI_BOX_LR_BORDER;
if (target_x + target_width + UI_BOX_LR_BORDER > 1.0f)
target_x = 1.0f - UI_BOX_LR_BORDER - target_width;
if (target_y < UI_BOX_TB_BORDER)
target_y = UI_BOX_TB_BORDER;
if (target_y + target_height + UI_BOX_TB_BORDER > 1.0f)
target_y = 1.0f - UI_BOX_TB_BORDER - target_height;
/* add a box around that */
ui_draw_outlined_box(container, target_x - UI_BOX_LR_BORDER,
target_y - UI_BOX_TB_BORDER,
target_x + target_width + UI_BOX_LR_BORDER,
target_y + target_height + UI_BOX_TB_BORDER, backcolor);
ui_draw_text_full(container, text, target_x, target_y, target_width,
justify, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
} | /*-------------------------------------------------
ui_draw_text_box - draw a multiline text
message with a box around it
-------------------------------------------------*/ | draw a multiline text
message with a box around it | [
"draw",
"a",
"multiline",
"text",
"message",
"with",
"a",
"box",
"around",
"it"
] | void ui_draw_text_box(render_container *container, const char *text, int justify, float xpos, float ypos, rgb_t backcolor)
{
float target_width, target_height;
float target_x, target_y;
ui_draw_text_full(container, text, 0, 0, 1.0f - 2.0f * UI_BOX_LR_BORDER,
justify, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height);
if (target_height > 1.0f - 2.0f * UI_BOX_TB_BORDER)
target_height = floor((1.0f - 2.0f * UI_BOX_TB_BORDER) / ui_get_line_height()) * ui_get_line_height();
target_x = xpos - 0.5f * target_width;
target_y = ypos - 0.5f * target_height;
if (target_x < UI_BOX_LR_BORDER)
target_x = UI_BOX_LR_BORDER;
if (target_x + target_width + UI_BOX_LR_BORDER > 1.0f)
target_x = 1.0f - UI_BOX_LR_BORDER - target_width;
if (target_y < UI_BOX_TB_BORDER)
target_y = UI_BOX_TB_BORDER;
if (target_y + target_height + UI_BOX_TB_BORDER > 1.0f)
target_y = 1.0f - UI_BOX_TB_BORDER - target_height;
ui_draw_outlined_box(container, target_x - UI_BOX_LR_BORDER,
target_y - UI_BOX_TB_BORDER,
target_x + target_width + UI_BOX_LR_BORDER,
target_y + target_height + UI_BOX_TB_BORDER, backcolor);
ui_draw_text_full(container, text, target_x, target_y, target_width,
justify, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
} | [
"void",
"ui_draw_text_box",
"(",
"render_container",
"*",
"container",
",",
"const",
"char",
"*",
"text",
",",
"int",
"justify",
",",
"float",
"xpos",
",",
"float",
"ypos",
",",
"rgb_t",
"backcolor",
")",
"{",
"float",
"target_width",
",",
"target_height",
";",
"float",
"target_x",
",",
"target_y",
";",
"ui_draw_text_full",
"(",
"container",
",",
"text",
",",
"0",
",",
"0",
",",
"1.0f",
"-",
"2.0f",
"*",
"UI_BOX_LR_BORDER",
",",
"justify",
",",
"WRAP_WORD",
",",
"DRAW_NONE",
",",
"ARGB_WHITE",
",",
"ARGB_BLACK",
",",
"&",
"target_width",
",",
"&",
"target_height",
")",
";",
"if",
"(",
"target_height",
">",
"1.0f",
"-",
"2.0f",
"*",
"UI_BOX_TB_BORDER",
")",
"target_height",
"=",
"floor",
"(",
"(",
"1.0f",
"-",
"2.0f",
"*",
"UI_BOX_TB_BORDER",
")",
"/",
"ui_get_line_height",
"(",
")",
")",
"*",
"ui_get_line_height",
"(",
")",
";",
"target_x",
"=",
"xpos",
"-",
"0.5f",
"*",
"target_width",
";",
"target_y",
"=",
"ypos",
"-",
"0.5f",
"*",
"target_height",
";",
"if",
"(",
"target_x",
"<",
"UI_BOX_LR_BORDER",
")",
"target_x",
"=",
"UI_BOX_LR_BORDER",
";",
"if",
"(",
"target_x",
"+",
"target_width",
"+",
"UI_BOX_LR_BORDER",
">",
"1.0f",
")",
"target_x",
"=",
"1.0f",
"-",
"UI_BOX_LR_BORDER",
"-",
"target_width",
";",
"if",
"(",
"target_y",
"<",
"UI_BOX_TB_BORDER",
")",
"target_y",
"=",
"UI_BOX_TB_BORDER",
";",
"if",
"(",
"target_y",
"+",
"target_height",
"+",
"UI_BOX_TB_BORDER",
">",
"1.0f",
")",
"target_y",
"=",
"1.0f",
"-",
"UI_BOX_TB_BORDER",
"-",
"target_height",
";",
"ui_draw_outlined_box",
"(",
"container",
",",
"target_x",
"-",
"UI_BOX_LR_BORDER",
",",
"target_y",
"-",
"UI_BOX_TB_BORDER",
",",
"target_x",
"+",
"target_width",
"+",
"UI_BOX_LR_BORDER",
",",
"target_y",
"+",
"target_height",
"+",
"UI_BOX_TB_BORDER",
",",
"backcolor",
")",
";",
"ui_draw_text_full",
"(",
"container",
",",
"text",
",",
"target_x",
",",
"target_y",
",",
"target_width",
",",
"justify",
",",
"WRAP_WORD",
",",
"DRAW_NORMAL",
",",
"UI_TEXT_COLOR",
",",
"UI_TEXT_BG_COLOR",
",",
"NULL",
",",
"NULL",
")",
";",
"}"
] | ui_draw_text_box - draw a multiline text
message with a box around it | [
"ui_draw_text_box",
"-",
"draw",
"a",
"multiline",
"text",
"message",
"with",
"a",
"box",
"around",
"it"
] | [
"/* compute the multi-line target width/height */",
"/* determine the target location */",
"/* make sure we stay on-screen */",
"/* add a box around that */"
] | [
{
"param": "container",
"type": "render_container"
},
{
"param": "text",
"type": "char"
},
{
"param": "justify",
"type": "int"
},
{
"param": "xpos",
"type": "float"
},
{
"param": "ypos",
"type": "float"
},
{
"param": "backcolor",
"type": "rgb_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "container",
"type": "render_container",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "text",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "justify",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xpos",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ypos",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "backcolor",
"type": "rgb_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a9c1b790f538b8b8a7c15f26e2a47b045b886dd7 | lofunz/mieme | Reloaded/tags/MAME4iOS 1.5 Reloaded/src/emu/ui.c | [
"Unlicense"
] | C | handler_messagebox | UINT32 | static UINT32 handler_messagebox(running_machine *machine, render_container *container, UINT32 state)
{
ui_draw_text_box(container, messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
return 0;
} | /*-------------------------------------------------
handler_messagebox - displays the current
messagebox_text string but handles no input
-------------------------------------------------*/ | displays the current
messagebox_text string but handles no input | [
"displays",
"the",
"current",
"messagebox_text",
"string",
"but",
"handles",
"no",
"input"
] | static UINT32 handler_messagebox(running_machine *machine, render_container *container, UINT32 state)
{
ui_draw_text_box(container, messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
return 0;
} | [
"static",
"UINT32",
"handler_messagebox",
"(",
"running_machine",
"*",
"machine",
",",
"render_container",
"*",
"container",
",",
"UINT32",
"state",
")",
"{",
"ui_draw_text_box",
"(",
"container",
",",
"messagebox_text",
",",
"JUSTIFY_LEFT",
",",
"0.5f",
",",
"0.5f",
",",
"messagebox_backcolor",
")",
";",
"return",
"0",
";",
"}"
] | handler_messagebox - displays the current
messagebox_text string but handles no input | [
"handler_messagebox",
"-",
"displays",
"the",
"current",
"messagebox_text",
"string",
"but",
"handles",
"no",
"input"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "container",
"type": "render_container"
},
{
"param": "state",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "container",
"type": "render_container",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a9c1b790f538b8b8a7c15f26e2a47b045b886dd7 | lofunz/mieme | Reloaded/tags/MAME4iOS 1.5 Reloaded/src/emu/ui.c | [
"Unlicense"
] | C | handler_messagebox_ok | UINT32 | static UINT32 handler_messagebox_ok(running_machine *machine, render_container *container, UINT32 state)
{
/* draw a standard message window */
ui_draw_text_box(container, messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
/* an 'O' or left joystick kicks us to the next state */
if (state == 0 && (input_code_pressed_once(machine, KEYCODE_O) || ui_input_pressed(machine, IPT_UI_LEFT)))
state++;
/* a 'K' or right joystick exits the state */
else if (state == 1 && (input_code_pressed_once(machine, KEYCODE_K) || ui_input_pressed(machine, IPT_UI_RIGHT)))
state = UI_HANDLER_CANCEL;
/* if the user cancels, exit out completely */
else if (ui_input_pressed(machine, IPT_UI_CANCEL))
{
machine->schedule_exit();
state = UI_HANDLER_CANCEL;
}
return state;
} | /*-------------------------------------------------
handler_messagebox_ok - displays the current
messagebox_text string and waits for an OK
-------------------------------------------------*/ | displays the current
messagebox_text string and waits for an OK | [
"displays",
"the",
"current",
"messagebox_text",
"string",
"and",
"waits",
"for",
"an",
"OK"
] | static UINT32 handler_messagebox_ok(running_machine *machine, render_container *container, UINT32 state)
{
ui_draw_text_box(container, messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
if (state == 0 && (input_code_pressed_once(machine, KEYCODE_O) || ui_input_pressed(machine, IPT_UI_LEFT)))
state++;
else if (state == 1 && (input_code_pressed_once(machine, KEYCODE_K) || ui_input_pressed(machine, IPT_UI_RIGHT)))
state = UI_HANDLER_CANCEL;
else if (ui_input_pressed(machine, IPT_UI_CANCEL))
{
machine->schedule_exit();
state = UI_HANDLER_CANCEL;
}
return state;
} | [
"static",
"UINT32",
"handler_messagebox_ok",
"(",
"running_machine",
"*",
"machine",
",",
"render_container",
"*",
"container",
",",
"UINT32",
"state",
")",
"{",
"ui_draw_text_box",
"(",
"container",
",",
"messagebox_text",
",",
"JUSTIFY_LEFT",
",",
"0.5f",
",",
"0.5f",
",",
"messagebox_backcolor",
")",
";",
"if",
"(",
"state",
"==",
"0",
"&&",
"(",
"input_code_pressed_once",
"(",
"machine",
",",
"KEYCODE_O",
")",
"||",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_LEFT",
")",
")",
")",
"state",
"++",
";",
"else",
"if",
"(",
"state",
"==",
"1",
"&&",
"(",
"input_code_pressed_once",
"(",
"machine",
",",
"KEYCODE_K",
")",
"||",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_RIGHT",
")",
")",
")",
"state",
"=",
"UI_HANDLER_CANCEL",
";",
"else",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_CANCEL",
")",
")",
"{",
"machine",
"->",
"schedule_exit",
"(",
")",
";",
"state",
"=",
"UI_HANDLER_CANCEL",
";",
"}",
"return",
"state",
";",
"}"
] | handler_messagebox_ok - displays the current
messagebox_text string and waits for an OK | [
"handler_messagebox_ok",
"-",
"displays",
"the",
"current",
"messagebox_text",
"string",
"and",
"waits",
"for",
"an",
"OK"
] | [
"/* draw a standard message window */",
"/* an 'O' or left joystick kicks us to the next state */",
"/* a 'K' or right joystick exits the state */",
"/* if the user cancels, exit out completely */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "container",
"type": "render_container"
},
{
"param": "state",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "container",
"type": "render_container",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a9c1b790f538b8b8a7c15f26e2a47b045b886dd7 | lofunz/mieme | Reloaded/tags/MAME4iOS 1.5 Reloaded/src/emu/ui.c | [
"Unlicense"
] | C | handler_messagebox_anykey | UINT32 | static UINT32 handler_messagebox_anykey(running_machine *machine, render_container *container, UINT32 state)
{
/* draw a standard message window */
ui_draw_text_box(container, messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
/* if the user cancels, exit out completely */
if (ui_input_pressed(machine, IPT_UI_CANCEL))
{
machine->schedule_exit();
state = UI_HANDLER_CANCEL;
}
/* if any key is pressed, just exit */
else if (input_code_poll_switches(machine, FALSE) != INPUT_CODE_INVALID)
state = UI_HANDLER_CANCEL;
return state;
} | /*-------------------------------------------------
handler_messagebox_anykey - displays the
current messagebox_text string and waits for
any keypress
-------------------------------------------------*/ | displays the
current messagebox_text string and waits for
any keypress | [
"displays",
"the",
"current",
"messagebox_text",
"string",
"and",
"waits",
"for",
"any",
"keypress"
] | static UINT32 handler_messagebox_anykey(running_machine *machine, render_container *container, UINT32 state)
{
ui_draw_text_box(container, messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
if (ui_input_pressed(machine, IPT_UI_CANCEL))
{
machine->schedule_exit();
state = UI_HANDLER_CANCEL;
}
else if (input_code_poll_switches(machine, FALSE) != INPUT_CODE_INVALID)
state = UI_HANDLER_CANCEL;
return state;
} | [
"static",
"UINT32",
"handler_messagebox_anykey",
"(",
"running_machine",
"*",
"machine",
",",
"render_container",
"*",
"container",
",",
"UINT32",
"state",
")",
"{",
"ui_draw_text_box",
"(",
"container",
",",
"messagebox_text",
",",
"JUSTIFY_LEFT",
",",
"0.5f",
",",
"0.5f",
",",
"messagebox_backcolor",
")",
";",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_CANCEL",
")",
")",
"{",
"machine",
"->",
"schedule_exit",
"(",
")",
";",
"state",
"=",
"UI_HANDLER_CANCEL",
";",
"}",
"else",
"if",
"(",
"input_code_poll_switches",
"(",
"machine",
",",
"FALSE",
")",
"!=",
"INPUT_CODE_INVALID",
")",
"state",
"=",
"UI_HANDLER_CANCEL",
";",
"return",
"state",
";",
"}"
] | handler_messagebox_anykey - displays the
current messagebox_text string and waits for
any keypress | [
"handler_messagebox_anykey",
"-",
"displays",
"the",
"current",
"messagebox_text",
"string",
"and",
"waits",
"for",
"any",
"keypress"
] | [
"/* draw a standard message window */",
"/* if the user cancels, exit out completely */",
"/* if any key is pressed, just exit */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "container",
"type": "render_container"
},
{
"param": "state",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "container",
"type": "render_container",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a9c1b790f538b8b8a7c15f26e2a47b045b886dd7 | lofunz/mieme | Reloaded/tags/MAME4iOS 1.5 Reloaded/src/emu/ui.c | [
"Unlicense"
] | C | ui_use_newui | int | int ui_use_newui( void )
{
#ifdef MESS
#if (defined(WIN32) || defined(_MSC_VER)) && !defined(SDLMAME_WIN32)
if (options_get_bool(mame_options(), "newui"))
return TRUE;
#endif
#endif
return FALSE;
} | /*-------------------------------------------------
ui_use_newui - determines if "newui" is in use
-------------------------------------------------*/ | determines if "newui" is in use | [
"determines",
"if",
"\"",
"newui",
"\"",
"is",
"in",
"use"
] | int ui_use_newui( void )
{
#ifdef MESS
#if (defined(WIN32) || defined(_MSC_VER)) && !defined(SDLMAME_WIN32)
if (options_get_bool(mame_options(), "newui"))
return TRUE;
#endif
#endif
return FALSE;
} | [
"int",
"ui_use_newui",
"(",
"void",
")",
"{",
"#ifdef",
"MESS",
"#if",
"(",
"defined",
"(",
"WIN32",
")",
"||",
"defined",
"(",
"_MSC_VER",
")",
")",
"&&",
"!",
"defined",
"(",
"SDLMAME_WIN32",
")",
"\n",
"if",
"(",
"options_get_bool",
"(",
"mame_options",
"(",
")",
",",
"\"",
"\"",
")",
")",
"return",
"TRUE",
";",
"#endif",
"#endif",
"return",
"FALSE",
";",
"}"
] | ui_use_newui - determines if "newui" is in use | [
"ui_use_newui",
"-",
"determines",
"if",
"\"",
"newui",
"\"",
"is",
"in",
"use"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
a9c1b790f538b8b8a7c15f26e2a47b045b886dd7 | lofunz/mieme | Reloaded/tags/MAME4iOS 1.5 Reloaded/src/emu/ui.c | [
"Unlicense"
] | C | ui_paste | void | void ui_paste(running_machine *machine)
{
/* retrieve the clipboard text */
char *text = osd_get_clipboard_text();
/* was a result returned? */
if (text != NULL)
{
/* post the text */
inputx_post_utf8(machine, text);
/* free the string */
osd_free(text);
}
} | /*-------------------------------------------------
ui_paste - does a paste from the keyboard
-------------------------------------------------*/ | does a paste from the keyboard | [
"does",
"a",
"paste",
"from",
"the",
"keyboard"
] | void ui_paste(running_machine *machine)
{
char *text = osd_get_clipboard_text();
if (text != NULL)
{
inputx_post_utf8(machine, text);
osd_free(text);
}
} | [
"void",
"ui_paste",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"char",
"*",
"text",
"=",
"osd_get_clipboard_text",
"(",
")",
";",
"if",
"(",
"text",
"!=",
"NULL",
")",
"{",
"inputx_post_utf8",
"(",
"machine",
",",
"text",
")",
";",
"osd_free",
"(",
"text",
")",
";",
"}",
"}"
] | ui_paste - does a paste from the keyboard | [
"ui_paste",
"-",
"does",
"a",
"paste",
"from",
"the",
"keyboard"
] | [
"/* retrieve the clipboard text */",
"/* was a result returned? */",
"/* post the text */",
"/* free the string */"
] | [
{
"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": []
} |
a9c1b790f538b8b8a7c15f26e2a47b045b886dd7 | lofunz/mieme | Reloaded/tags/MAME4iOS 1.5 Reloaded/src/emu/ui.c | [
"Unlicense"
] | C | ui_image_handler_ingame | void | void ui_image_handler_ingame(running_machine *machine)
{
device_image_interface *image = NULL;
/* run display routine for devices */
if (machine->phase() == MACHINE_PHASE_RUNNING)
{
for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image))
{
image->call_display();
}
}
} | /*-------------------------------------------------
ui_image_handler_ingame - execute display
callback function for each image device
-------------------------------------------------*/ | execute display
callback function for each image device | [
"execute",
"display",
"callback",
"function",
"for",
"each",
"image",
"device"
] | void ui_image_handler_ingame(running_machine *machine)
{
device_image_interface *image = NULL;
if (machine->phase() == MACHINE_PHASE_RUNNING)
{
for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image))
{
image->call_display();
}
}
} | [
"void",
"ui_image_handler_ingame",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"device_image_interface",
"*",
"image",
"=",
"NULL",
";",
"if",
"(",
"machine",
"->",
"phase",
"(",
")",
"==",
"MACHINE_PHASE_RUNNING",
")",
"{",
"for",
"(",
"bool",
"gotone",
"=",
"machine",
"->",
"m_devicelist",
".",
"first",
"(",
"image",
")",
";",
"gotone",
";",
"gotone",
"=",
"image",
"->",
"next",
"(",
"image",
")",
")",
"{",
"image",
"->",
"call_display",
"(",
")",
";",
"}",
"}",
"}"
] | ui_image_handler_ingame - execute display
callback function for each image device | [
"ui_image_handler_ingame",
"-",
"execute",
"display",
"callback",
"function",
"for",
"each",
"image",
"device"
] | [
"/* run display routine for devices */"
] | [
{
"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": []
} |
a9c1b790f538b8b8a7c15f26e2a47b045b886dd7 | lofunz/mieme | Reloaded/tags/MAME4iOS 1.5 Reloaded/src/emu/ui.c | [
"Unlicense"
] | C | handler_ingame | UINT32 | static UINT32 handler_ingame(running_machine *machine, render_container *container, UINT32 state)
{
bool is_paused = machine->paused();
/* first draw the FPS counter */
if (showfps || myosd_fps || osd_ticks() < showfps_end)
{
ui_draw_text_full(container, video_get_speed_text(machine), 0.0f, 0.0f, 1.0f,
JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
}
else
showfps_end = 0;
/* draw the profiler if visible */
if (show_profiler)
{
astring profilertext;
profiler_get_text(machine, profilertext);
ui_draw_text_full(container, profilertext, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
}
/* if we're single-stepping, pause now */
if (single_step)
{
machine->pause();
single_step = FALSE;
}
/* determine if we should disable the rest of the UI */
int ui_disabled = (input_machine_has_keyboard(machine) && !machine->ui_active);
/* is ScrLk UI toggling applicable here? */
if (input_machine_has_keyboard(machine))
{
/* are we toggling the UI with ScrLk? */
if (ui_input_pressed(machine, IPT_UI_TOGGLE_UI))
{
/* toggle the UI */
machine->ui_active = !machine->ui_active;
/* display a popup indicating the new status */
if (machine->ui_active)
{
ui_popup_time(2, "%s\n%s\n%s\n%s\n%s\n%s\n",
"Keyboard Emulation Status",
"-------------------------",
"Mode: PARTIAL Emulation",
"UI: Enabled",
"-------------------------",
"**Use ScrLock to toggle**");
}
else
{
ui_popup_time(2, "%s\n%s\n%s\n%s\n%s\n%s\n",
"Keyboard Emulation Status",
"-------------------------",
"Mode: FULL Emulation",
"UI: Disabled",
"-------------------------",
"**Use ScrLock to toggle**");
}
}
}
/* is the natural keyboard enabled? */
if (ui_get_use_natural_keyboard(machine) && (machine->phase() == MACHINE_PHASE_RUNNING))
process_natural_keyboard(machine);
if (!ui_disabled)
{
/* paste command */
if (ui_input_pressed(machine, IPT_UI_PASTE))
ui_paste(machine);
}
ui_image_handler_ingame(machine);
if (ui_disabled) return ui_disabled;
/* if the user pressed ESC, stop the emulation (except in MESS with newui, where ESC toggles the menubar) */
if (ui_input_pressed(machine, IPT_UI_CANCEL) && !ui_use_newui())
machine->schedule_exit();
/* turn on menus if requested */
if (ui_input_pressed(machine, IPT_UI_CONFIGURE) && !ui_use_newui())
return ui_set_handler(ui_menu_ui_handler, 0);
/* if the on-screen display isn't up and the user has toggled it, turn it on */
if ((machine->debug_flags & DEBUG_FLAG_ENABLED) == 0 && ui_input_pressed(machine, IPT_UI_ON_SCREEN_DISPLAY))
return ui_set_handler(ui_slider_ui_handler, 1);
/* handle a reset request */
if (ui_input_pressed(machine, IPT_UI_RESET_MACHINE))
machine->schedule_hard_reset();
if (ui_input_pressed(machine, IPT_UI_SOFT_RESET))
machine->schedule_soft_reset();
/* handle a request to display graphics/palette */
if (ui_input_pressed(machine, IPT_UI_SHOW_GFX))
{
if (!is_paused)
machine->pause();
return ui_set_handler(ui_gfx_ui_handler, is_paused);
}
/* handle a save state request */
if (ui_input_pressed(machine, IPT_UI_SAVE_STATE))
{
machine->pause();
return ui_set_handler(handler_load_save, LOADSAVE_SAVE);
}
/* handle a load state request */
if (ui_input_pressed(machine, IPT_UI_LOAD_STATE))
{
machine->pause();
return ui_set_handler(handler_load_save, LOADSAVE_LOAD);
}
/* handle a save snapshot request */
if (ui_input_pressed(machine, IPT_UI_SNAPSHOT))
video_save_active_screen_snapshots(machine);
/* toggle pause */
if (ui_input_pressed(machine, IPT_UI_PAUSE))
{
/* with a shift key, it is single step */
if (is_paused && (input_code_pressed(machine, KEYCODE_LSHIFT) || input_code_pressed(machine, KEYCODE_RSHIFT)))
{
single_step = TRUE;
machine->resume();
}
else if (machine->paused())
machine->resume();
else
machine->pause();
}
/* handle a toggle cheats request */
if (ui_input_pressed(machine, IPT_UI_TOGGLE_CHEAT))
cheat_set_global_enable(machine, !cheat_get_global_enable(machine));
/* toggle movie recording */
if (ui_input_pressed(machine, IPT_UI_RECORD_MOVIE))
{
if (!video_mng_is_movie_active(machine))
{
video_mng_begin_recording(machine, NULL);
popmessage("REC START");
}
else
{
video_mng_end_recording(machine);
popmessage("REC STOP");
}
}
/* toggle profiler display */
if (ui_input_pressed(machine, IPT_UI_SHOW_PROFILER))
ui_set_show_profiler(!ui_get_show_profiler());
/* toggle FPS display */
if (ui_input_pressed(machine, IPT_UI_SHOW_FPS))
ui_set_show_fps(!ui_get_show_fps());
/* increment frameskip? */
if (ui_input_pressed(machine, IPT_UI_FRAMESKIP_INC))
{
/* get the current value and increment it */
int newframeskip = video_get_frameskip() + 1;
if (newframeskip > MAX_FRAMESKIP)
newframeskip = -1;
video_set_frameskip(newframeskip);
/* display the FPS counter for 2 seconds */
ui_show_fps_temp(2.0);
}
/* decrement frameskip? */
if (ui_input_pressed(machine, IPT_UI_FRAMESKIP_DEC))
{
/* get the current value and decrement it */
int newframeskip = video_get_frameskip() - 1;
if (newframeskip < -1)
newframeskip = MAX_FRAMESKIP;
video_set_frameskip(newframeskip);
/* display the FPS counter for 2 seconds */
ui_show_fps_temp(2.0);
}
/* toggle throttle? */
if (ui_input_pressed(machine, IPT_UI_THROTTLE))
video_set_throttle(!video_get_throttle());
/* check for fast forward */
if (input_type_pressed(machine, IPT_UI_FAST_FORWARD, 0))
{
video_set_fastforward(TRUE);
ui_show_fps_temp(0.5);
}
else
video_set_fastforward(FALSE);
return 0;
} | /*-------------------------------------------------
handler_ingame - in-game handler takes care
of the standard keypresses
-------------------------------------------------*/ | in-game handler takes care
of the standard keypresses | [
"in",
"-",
"game",
"handler",
"takes",
"care",
"of",
"the",
"standard",
"keypresses"
] | static UINT32 handler_ingame(running_machine *machine, render_container *container, UINT32 state)
{
bool is_paused = machine->paused();
if (showfps || myosd_fps || osd_ticks() < showfps_end)
{
ui_draw_text_full(container, video_get_speed_text(machine), 0.0f, 0.0f, 1.0f,
JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
}
else
showfps_end = 0;
if (show_profiler)
{
astring profilertext;
profiler_get_text(machine, profilertext);
ui_draw_text_full(container, profilertext, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
}
if (single_step)
{
machine->pause();
single_step = FALSE;
}
int ui_disabled = (input_machine_has_keyboard(machine) && !machine->ui_active);
if (input_machine_has_keyboard(machine))
{
if (ui_input_pressed(machine, IPT_UI_TOGGLE_UI))
{
machine->ui_active = !machine->ui_active;
if (machine->ui_active)
{
ui_popup_time(2, "%s\n%s\n%s\n%s\n%s\n%s\n",
"Keyboard Emulation Status",
"-------------------------",
"Mode: PARTIAL Emulation",
"UI: Enabled",
"-------------------------",
"**Use ScrLock to toggle**");
}
else
{
ui_popup_time(2, "%s\n%s\n%s\n%s\n%s\n%s\n",
"Keyboard Emulation Status",
"-------------------------",
"Mode: FULL Emulation",
"UI: Disabled",
"-------------------------",
"**Use ScrLock to toggle**");
}
}
}
if (ui_get_use_natural_keyboard(machine) && (machine->phase() == MACHINE_PHASE_RUNNING))
process_natural_keyboard(machine);
if (!ui_disabled)
{
if (ui_input_pressed(machine, IPT_UI_PASTE))
ui_paste(machine);
}
ui_image_handler_ingame(machine);
if (ui_disabled) return ui_disabled;
if (ui_input_pressed(machine, IPT_UI_CANCEL) && !ui_use_newui())
machine->schedule_exit();
if (ui_input_pressed(machine, IPT_UI_CONFIGURE) && !ui_use_newui())
return ui_set_handler(ui_menu_ui_handler, 0);
if ((machine->debug_flags & DEBUG_FLAG_ENABLED) == 0 && ui_input_pressed(machine, IPT_UI_ON_SCREEN_DISPLAY))
return ui_set_handler(ui_slider_ui_handler, 1);
if (ui_input_pressed(machine, IPT_UI_RESET_MACHINE))
machine->schedule_hard_reset();
if (ui_input_pressed(machine, IPT_UI_SOFT_RESET))
machine->schedule_soft_reset();
if (ui_input_pressed(machine, IPT_UI_SHOW_GFX))
{
if (!is_paused)
machine->pause();
return ui_set_handler(ui_gfx_ui_handler, is_paused);
}
if (ui_input_pressed(machine, IPT_UI_SAVE_STATE))
{
machine->pause();
return ui_set_handler(handler_load_save, LOADSAVE_SAVE);
}
if (ui_input_pressed(machine, IPT_UI_LOAD_STATE))
{
machine->pause();
return ui_set_handler(handler_load_save, LOADSAVE_LOAD);
}
if (ui_input_pressed(machine, IPT_UI_SNAPSHOT))
video_save_active_screen_snapshots(machine);
if (ui_input_pressed(machine, IPT_UI_PAUSE))
{
if (is_paused && (input_code_pressed(machine, KEYCODE_LSHIFT) || input_code_pressed(machine, KEYCODE_RSHIFT)))
{
single_step = TRUE;
machine->resume();
}
else if (machine->paused())
machine->resume();
else
machine->pause();
}
if (ui_input_pressed(machine, IPT_UI_TOGGLE_CHEAT))
cheat_set_global_enable(machine, !cheat_get_global_enable(machine));
if (ui_input_pressed(machine, IPT_UI_RECORD_MOVIE))
{
if (!video_mng_is_movie_active(machine))
{
video_mng_begin_recording(machine, NULL);
popmessage("REC START");
}
else
{
video_mng_end_recording(machine);
popmessage("REC STOP");
}
}
if (ui_input_pressed(machine, IPT_UI_SHOW_PROFILER))
ui_set_show_profiler(!ui_get_show_profiler());
if (ui_input_pressed(machine, IPT_UI_SHOW_FPS))
ui_set_show_fps(!ui_get_show_fps());
if (ui_input_pressed(machine, IPT_UI_FRAMESKIP_INC))
{
int newframeskip = video_get_frameskip() + 1;
if (newframeskip > MAX_FRAMESKIP)
newframeskip = -1;
video_set_frameskip(newframeskip);
ui_show_fps_temp(2.0);
}
if (ui_input_pressed(machine, IPT_UI_FRAMESKIP_DEC))
{
int newframeskip = video_get_frameskip() - 1;
if (newframeskip < -1)
newframeskip = MAX_FRAMESKIP;
video_set_frameskip(newframeskip);
ui_show_fps_temp(2.0);
}
if (ui_input_pressed(machine, IPT_UI_THROTTLE))
video_set_throttle(!video_get_throttle());
if (input_type_pressed(machine, IPT_UI_FAST_FORWARD, 0))
{
video_set_fastforward(TRUE);
ui_show_fps_temp(0.5);
}
else
video_set_fastforward(FALSE);
return 0;
} | [
"static",
"UINT32",
"handler_ingame",
"(",
"running_machine",
"*",
"machine",
",",
"render_container",
"*",
"container",
",",
"UINT32",
"state",
")",
"{",
"bool",
"is_paused",
"=",
"machine",
"->",
"paused",
"(",
")",
";",
"if",
"(",
"showfps",
"||",
"myosd_fps",
"||",
"osd_ticks",
"(",
")",
"<",
"showfps_end",
")",
"{",
"ui_draw_text_full",
"(",
"container",
",",
"video_get_speed_text",
"(",
"machine",
")",
",",
"0.0f",
",",
"0.0f",
",",
"1.0f",
",",
"JUSTIFY_RIGHT",
",",
"WRAP_WORD",
",",
"DRAW_OPAQUE",
",",
"ARGB_WHITE",
",",
"ARGB_BLACK",
",",
"NULL",
",",
"NULL",
")",
";",
"}",
"else",
"showfps_end",
"=",
"0",
";",
"if",
"(",
"show_profiler",
")",
"{",
"astring",
"profilertext",
";",
"profiler_get_text",
"(",
"machine",
",",
"profilertext",
")",
";",
"ui_draw_text_full",
"(",
"container",
",",
"profilertext",
",",
"0.0f",
",",
"0.0f",
",",
"1.0f",
",",
"JUSTIFY_LEFT",
",",
"WRAP_WORD",
",",
"DRAW_OPAQUE",
",",
"ARGB_WHITE",
",",
"ARGB_BLACK",
",",
"NULL",
",",
"NULL",
")",
";",
"}",
"if",
"(",
"single_step",
")",
"{",
"machine",
"->",
"pause",
"(",
")",
";",
"single_step",
"=",
"FALSE",
";",
"}",
"int",
"ui_disabled",
"=",
"(",
"input_machine_has_keyboard",
"(",
"machine",
")",
"&&",
"!",
"machine",
"->",
"ui_active",
")",
";",
"if",
"(",
"input_machine_has_keyboard",
"(",
"machine",
")",
")",
"{",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_TOGGLE_UI",
")",
")",
"{",
"machine",
"->",
"ui_active",
"=",
"!",
"machine",
"->",
"ui_active",
";",
"if",
"(",
"machine",
"->",
"ui_active",
")",
"{",
"ui_popup_time",
"(",
"2",
",",
"\"",
"\\n",
"\\n",
"\\n",
"\\n",
"\\n",
"\\n",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"}",
"else",
"{",
"ui_popup_time",
"(",
"2",
",",
"\"",
"\\n",
"\\n",
"\\n",
"\\n",
"\\n",
"\\n",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"}",
"}",
"}",
"if",
"(",
"ui_get_use_natural_keyboard",
"(",
"machine",
")",
"&&",
"(",
"machine",
"->",
"phase",
"(",
")",
"==",
"MACHINE_PHASE_RUNNING",
")",
")",
"process_natural_keyboard",
"(",
"machine",
")",
";",
"if",
"(",
"!",
"ui_disabled",
")",
"{",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_PASTE",
")",
")",
"ui_paste",
"(",
"machine",
")",
";",
"}",
"ui_image_handler_ingame",
"(",
"machine",
")",
";",
"if",
"(",
"ui_disabled",
")",
"return",
"ui_disabled",
";",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_CANCEL",
")",
"&&",
"!",
"ui_use_newui",
"(",
")",
")",
"machine",
"->",
"schedule_exit",
"(",
")",
";",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_CONFIGURE",
")",
"&&",
"!",
"ui_use_newui",
"(",
")",
")",
"return",
"ui_set_handler",
"(",
"ui_menu_ui_handler",
",",
"0",
")",
";",
"if",
"(",
"(",
"machine",
"->",
"debug_flags",
"&",
"DEBUG_FLAG_ENABLED",
")",
"==",
"0",
"&&",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_ON_SCREEN_DISPLAY",
")",
")",
"return",
"ui_set_handler",
"(",
"ui_slider_ui_handler",
",",
"1",
")",
";",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_RESET_MACHINE",
")",
")",
"machine",
"->",
"schedule_hard_reset",
"(",
")",
";",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_SOFT_RESET",
")",
")",
"machine",
"->",
"schedule_soft_reset",
"(",
")",
";",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_SHOW_GFX",
")",
")",
"{",
"if",
"(",
"!",
"is_paused",
")",
"machine",
"->",
"pause",
"(",
")",
";",
"return",
"ui_set_handler",
"(",
"ui_gfx_ui_handler",
",",
"is_paused",
")",
";",
"}",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_SAVE_STATE",
")",
")",
"{",
"machine",
"->",
"pause",
"(",
")",
";",
"return",
"ui_set_handler",
"(",
"handler_load_save",
",",
"LOADSAVE_SAVE",
")",
";",
"}",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_LOAD_STATE",
")",
")",
"{",
"machine",
"->",
"pause",
"(",
")",
";",
"return",
"ui_set_handler",
"(",
"handler_load_save",
",",
"LOADSAVE_LOAD",
")",
";",
"}",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_SNAPSHOT",
")",
")",
"video_save_active_screen_snapshots",
"(",
"machine",
")",
";",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_PAUSE",
")",
")",
"{",
"if",
"(",
"is_paused",
"&&",
"(",
"input_code_pressed",
"(",
"machine",
",",
"KEYCODE_LSHIFT",
")",
"||",
"input_code_pressed",
"(",
"machine",
",",
"KEYCODE_RSHIFT",
")",
")",
")",
"{",
"single_step",
"=",
"TRUE",
";",
"machine",
"->",
"resume",
"(",
")",
";",
"}",
"else",
"if",
"(",
"machine",
"->",
"paused",
"(",
")",
")",
"machine",
"->",
"resume",
"(",
")",
";",
"else",
"machine",
"->",
"pause",
"(",
")",
";",
"}",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_TOGGLE_CHEAT",
")",
")",
"cheat_set_global_enable",
"(",
"machine",
",",
"!",
"cheat_get_global_enable",
"(",
"machine",
")",
")",
";",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_RECORD_MOVIE",
")",
")",
"{",
"if",
"(",
"!",
"video_mng_is_movie_active",
"(",
"machine",
")",
")",
"{",
"video_mng_begin_recording",
"(",
"machine",
",",
"NULL",
")",
";",
"popmessage",
"(",
"\"",
"\"",
")",
";",
"}",
"else",
"{",
"video_mng_end_recording",
"(",
"machine",
")",
";",
"popmessage",
"(",
"\"",
"\"",
")",
";",
"}",
"}",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_SHOW_PROFILER",
")",
")",
"ui_set_show_profiler",
"(",
"!",
"ui_get_show_profiler",
"(",
")",
")",
";",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_SHOW_FPS",
")",
")",
"ui_set_show_fps",
"(",
"!",
"ui_get_show_fps",
"(",
")",
")",
";",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_FRAMESKIP_INC",
")",
")",
"{",
"int",
"newframeskip",
"=",
"video_get_frameskip",
"(",
")",
"+",
"1",
";",
"if",
"(",
"newframeskip",
">",
"MAX_FRAMESKIP",
")",
"newframeskip",
"=",
"-1",
";",
"video_set_frameskip",
"(",
"newframeskip",
")",
";",
"ui_show_fps_temp",
"(",
"2.0",
")",
";",
"}",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_FRAMESKIP_DEC",
")",
")",
"{",
"int",
"newframeskip",
"=",
"video_get_frameskip",
"(",
")",
"-",
"1",
";",
"if",
"(",
"newframeskip",
"<",
"-1",
")",
"newframeskip",
"=",
"MAX_FRAMESKIP",
";",
"video_set_frameskip",
"(",
"newframeskip",
")",
";",
"ui_show_fps_temp",
"(",
"2.0",
")",
";",
"}",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_THROTTLE",
")",
")",
"video_set_throttle",
"(",
"!",
"video_get_throttle",
"(",
")",
")",
";",
"if",
"(",
"input_type_pressed",
"(",
"machine",
",",
"IPT_UI_FAST_FORWARD",
",",
"0",
")",
")",
"{",
"video_set_fastforward",
"(",
"TRUE",
")",
";",
"ui_show_fps_temp",
"(",
"0.5",
")",
";",
"}",
"else",
"video_set_fastforward",
"(",
"FALSE",
")",
";",
"return",
"0",
";",
"}"
] | handler_ingame - in-game handler takes care
of the standard keypresses | [
"handler_ingame",
"-",
"in",
"-",
"game",
"handler",
"takes",
"care",
"of",
"the",
"standard",
"keypresses"
] | [
"/* first draw the FPS counter */",
"/* draw the profiler if visible */",
"/* if we're single-stepping, pause now */",
"/* determine if we should disable the rest of the UI */",
"/* is ScrLk UI toggling applicable here? */",
"/* are we toggling the UI with ScrLk? */",
"/* toggle the UI */",
"/* display a popup indicating the new status */",
"/* is the natural keyboard enabled? */",
"/* paste command */",
"/* if the user pressed ESC, stop the emulation (except in MESS with newui, where ESC toggles the menubar) */",
"/* turn on menus if requested */",
"/* if the on-screen display isn't up and the user has toggled it, turn it on */",
"/* handle a reset request */",
"/* handle a request to display graphics/palette */",
"/* handle a save state request */",
"/* handle a load state request */",
"/* handle a save snapshot request */",
"/* toggle pause */",
"/* with a shift key, it is single step */",
"/* handle a toggle cheats request */",
"/* toggle movie recording */",
"/* toggle profiler display */",
"/* toggle FPS display */",
"/* increment frameskip? */",
"/* get the current value and increment it */",
"/* display the FPS counter for 2 seconds */",
"/* decrement frameskip? */",
"/* get the current value and decrement it */",
"/* display the FPS counter for 2 seconds */",
"/* toggle throttle? */",
"/* check for fast forward */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "container",
"type": "render_container"
},
{
"param": "state",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "container",
"type": "render_container",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a9c1b790f538b8b8a7c15f26e2a47b045b886dd7 | lofunz/mieme | Reloaded/tags/MAME4iOS 1.5 Reloaded/src/emu/ui.c | [
"Unlicense"
] | C | handler_load_save | UINT32 | static UINT32 handler_load_save(running_machine *machine, render_container *container, UINT32 state)
{
char filename[20];
input_code code;
char file = 0;
/* if we're not in the middle of anything, skip */
if (state == LOADSAVE_NONE)
return 0;
/* okay, we're waiting for a key to select a slot; display a message */
if (state == LOADSAVE_SAVE)
ui_draw_message_window(container, "Select position to save to");
else
ui_draw_message_window(container, "Select position to load from");
/* check for cancel key */
if (ui_input_pressed(machine, IPT_UI_CANCEL))
{
/* display a popup indicating things were cancelled */
if (state == LOADSAVE_SAVE)
popmessage("Save cancelled");
else
popmessage("Load cancelled");
/* reset the state */
machine->resume();
return UI_HANDLER_CANCEL;
}
/* check for A-Z or 0-9 */
for (code = KEYCODE_A; code <= (input_code)KEYCODE_Z; code++)
if (input_code_pressed_once(machine, code))
file = code - KEYCODE_A + 'a';
if (file == 0)
for (code = KEYCODE_0; code <= (input_code)KEYCODE_9; code++)
if (input_code_pressed_once(machine, code))
file = code - KEYCODE_0 + '0';
if (file == 0)
for (code = KEYCODE_0_PAD; code <= (input_code)KEYCODE_9_PAD; code++)
if (input_code_pressed_once(machine, code))
file = code - KEYCODE_0_PAD + '0';
if (file == 0)
return state;
/* display a popup indicating that the save will proceed */
sprintf(filename, "%c", file);
if (state == LOADSAVE_SAVE)
{
popmessage("Save to position %c", file);
machine->schedule_save(filename);
}
else
{
popmessage("Load from position %c", file);
machine->schedule_load(filename);
}
/* remove the pause and reset the state */
machine->resume();
return UI_HANDLER_CANCEL;
} | /*-------------------------------------------------
handler_load_save - leads the user through
specifying a game to save or load
-------------------------------------------------*/ | leads the user through
specifying a game to save or load | [
"leads",
"the",
"user",
"through",
"specifying",
"a",
"game",
"to",
"save",
"or",
"load"
] | static UINT32 handler_load_save(running_machine *machine, render_container *container, UINT32 state)
{
char filename[20];
input_code code;
char file = 0;
if (state == LOADSAVE_NONE)
return 0;
if (state == LOADSAVE_SAVE)
ui_draw_message_window(container, "Select position to save to");
else
ui_draw_message_window(container, "Select position to load from");
if (ui_input_pressed(machine, IPT_UI_CANCEL))
{
if (state == LOADSAVE_SAVE)
popmessage("Save cancelled");
else
popmessage("Load cancelled");
machine->resume();
return UI_HANDLER_CANCEL;
}
for (code = KEYCODE_A; code <= (input_code)KEYCODE_Z; code++)
if (input_code_pressed_once(machine, code))
file = code - KEYCODE_A + 'a';
if (file == 0)
for (code = KEYCODE_0; code <= (input_code)KEYCODE_9; code++)
if (input_code_pressed_once(machine, code))
file = code - KEYCODE_0 + '0';
if (file == 0)
for (code = KEYCODE_0_PAD; code <= (input_code)KEYCODE_9_PAD; code++)
if (input_code_pressed_once(machine, code))
file = code - KEYCODE_0_PAD + '0';
if (file == 0)
return state;
sprintf(filename, "%c", file);
if (state == LOADSAVE_SAVE)
{
popmessage("Save to position %c", file);
machine->schedule_save(filename);
}
else
{
popmessage("Load from position %c", file);
machine->schedule_load(filename);
}
machine->resume();
return UI_HANDLER_CANCEL;
} | [
"static",
"UINT32",
"handler_load_save",
"(",
"running_machine",
"*",
"machine",
",",
"render_container",
"*",
"container",
",",
"UINT32",
"state",
")",
"{",
"char",
"filename",
"[",
"20",
"]",
";",
"input_code",
"code",
";",
"char",
"file",
"=",
"0",
";",
"if",
"(",
"state",
"==",
"LOADSAVE_NONE",
")",
"return",
"0",
";",
"if",
"(",
"state",
"==",
"LOADSAVE_SAVE",
")",
"ui_draw_message_window",
"(",
"container",
",",
"\"",
"\"",
")",
";",
"else",
"ui_draw_message_window",
"(",
"container",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"ui_input_pressed",
"(",
"machine",
",",
"IPT_UI_CANCEL",
")",
")",
"{",
"if",
"(",
"state",
"==",
"LOADSAVE_SAVE",
")",
"popmessage",
"(",
"\"",
"\"",
")",
";",
"else",
"popmessage",
"(",
"\"",
"\"",
")",
";",
"machine",
"->",
"resume",
"(",
")",
";",
"return",
"UI_HANDLER_CANCEL",
";",
"}",
"for",
"(",
"code",
"=",
"KEYCODE_A",
";",
"code",
"<=",
"(",
"input_code",
")",
"KEYCODE_Z",
";",
"code",
"++",
")",
"if",
"(",
"input_code_pressed_once",
"(",
"machine",
",",
"code",
")",
")",
"file",
"=",
"code",
"-",
"KEYCODE_A",
"+",
"'",
"'",
";",
"if",
"(",
"file",
"==",
"0",
")",
"for",
"(",
"code",
"=",
"KEYCODE_0",
";",
"code",
"<=",
"(",
"input_code",
")",
"KEYCODE_9",
";",
"code",
"++",
")",
"if",
"(",
"input_code_pressed_once",
"(",
"machine",
",",
"code",
")",
")",
"file",
"=",
"code",
"-",
"KEYCODE_0",
"+",
"'",
"'",
";",
"if",
"(",
"file",
"==",
"0",
")",
"for",
"(",
"code",
"=",
"KEYCODE_0_PAD",
";",
"code",
"<=",
"(",
"input_code",
")",
"KEYCODE_9_PAD",
";",
"code",
"++",
")",
"if",
"(",
"input_code_pressed_once",
"(",
"machine",
",",
"code",
")",
")",
"file",
"=",
"code",
"-",
"KEYCODE_0_PAD",
"+",
"'",
"'",
";",
"if",
"(",
"file",
"==",
"0",
")",
"return",
"state",
";",
"sprintf",
"(",
"filename",
",",
"\"",
"\"",
",",
"file",
")",
";",
"if",
"(",
"state",
"==",
"LOADSAVE_SAVE",
")",
"{",
"popmessage",
"(",
"\"",
"\"",
",",
"file",
")",
";",
"machine",
"->",
"schedule_save",
"(",
"filename",
")",
";",
"}",
"else",
"{",
"popmessage",
"(",
"\"",
"\"",
",",
"file",
")",
";",
"machine",
"->",
"schedule_load",
"(",
"filename",
")",
";",
"}",
"machine",
"->",
"resume",
"(",
")",
";",
"return",
"UI_HANDLER_CANCEL",
";",
"}"
] | handler_load_save - leads the user through
specifying a game to save or load | [
"handler_load_save",
"-",
"leads",
"the",
"user",
"through",
"specifying",
"a",
"game",
"to",
"save",
"or",
"load"
] | [
"/* if we're not in the middle of anything, skip */",
"/* okay, we're waiting for a key to select a slot; display a message */",
"/* check for cancel key */",
"/* display a popup indicating things were cancelled */",
"/* reset the state */",
"/* check for A-Z or 0-9 */",
"/* display a popup indicating that the save will proceed */",
"/* remove the pause and reset the state */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "container",
"type": "render_container"
},
{
"param": "state",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "container",
"type": "render_container",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a9c1b790f538b8b8a7c15f26e2a47b045b886dd7 | lofunz/mieme | Reloaded/tags/MAME4iOS 1.5 Reloaded/src/emu/ui.c | [
"Unlicense"
] | C | slider_get_laserdisc_desc | char | static char *slider_get_laserdisc_desc(device_t *laserdisc)
{
int ldcount = laserdisc->machine->m_devicelist.count(LASERDISC);
static char descbuf[256];
if (ldcount > 1)
sprintf(descbuf, "Laserdisc '%s'", laserdisc->tag());
else
strcpy(descbuf, "Laserdisc");
return descbuf;
} | /*-------------------------------------------------
slider_get_laserdisc_desc - returns the
description for a given laseridsc
-------------------------------------------------*/ | returns the
description for a given laseridsc | [
"returns",
"the",
"description",
"for",
"a",
"given",
"laseridsc"
] | static char *slider_get_laserdisc_desc(device_t *laserdisc)
{
int ldcount = laserdisc->machine->m_devicelist.count(LASERDISC);
static char descbuf[256];
if (ldcount > 1)
sprintf(descbuf, "Laserdisc '%s'", laserdisc->tag());
else
strcpy(descbuf, "Laserdisc");
return descbuf;
} | [
"static",
"char",
"*",
"slider_get_laserdisc_desc",
"(",
"device_t",
"*",
"laserdisc",
")",
"{",
"int",
"ldcount",
"=",
"laserdisc",
"->",
"machine",
"->",
"m_devicelist",
".",
"count",
"(",
"LASERDISC",
")",
";",
"static",
"char",
"descbuf",
"[",
"256",
"]",
";",
"if",
"(",
"ldcount",
">",
"1",
")",
"sprintf",
"(",
"descbuf",
",",
"\"",
"\"",
",",
"laserdisc",
"->",
"tag",
"(",
")",
")",
";",
"else",
"strcpy",
"(",
"descbuf",
",",
"\"",
"\"",
")",
";",
"return",
"descbuf",
";",
"}"
] | slider_get_laserdisc_desc - returns the
description for a given laseridsc | [
"slider_get_laserdisc_desc",
"-",
"returns",
"the",
"description",
"for",
"a",
"given",
"laseridsc"
] | [] | [
{
"param": "laserdisc",
"type": "device_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "laserdisc",
"type": "device_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a9c1b790f538b8b8a7c15f26e2a47b045b886dd7 | lofunz/mieme | Reloaded/tags/MAME4iOS 1.5 Reloaded/src/emu/ui.c | [
"Unlicense"
] | C | ui_set_use_natural_keyboard | void | void ui_set_use_natural_keyboard(running_machine *machine, int use_natural_keyboard)
{
ui_use_natural_keyboard = use_natural_keyboard;
options_set_bool(machine->options(), OPTION_NATURAL_KEYBOARD, use_natural_keyboard, OPTION_PRIORITY_CMDLINE);
} | /*-------------------------------------------------
ui_set_use_natural_keyboard - specifies
whether the natural keyboard is active
-------------------------------------------------*/ | specifies
whether the natural keyboard is active | [
"specifies",
"whether",
"the",
"natural",
"keyboard",
"is",
"active"
] | void ui_set_use_natural_keyboard(running_machine *machine, int use_natural_keyboard)
{
ui_use_natural_keyboard = use_natural_keyboard;
options_set_bool(machine->options(), OPTION_NATURAL_KEYBOARD, use_natural_keyboard, OPTION_PRIORITY_CMDLINE);
} | [
"void",
"ui_set_use_natural_keyboard",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"use_natural_keyboard",
")",
"{",
"ui_use_natural_keyboard",
"=",
"use_natural_keyboard",
";",
"options_set_bool",
"(",
"machine",
"->",
"options",
"(",
")",
",",
"OPTION_NATURAL_KEYBOARD",
",",
"use_natural_keyboard",
",",
"OPTION_PRIORITY_CMDLINE",
")",
";",
"}"
] | ui_set_use_natural_keyboard - specifies
whether the natural keyboard is active | [
"ui_set_use_natural_keyboard",
"-",
"specifies",
"whether",
"the",
"natural",
"keyboard",
"is",
"active"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "use_natural_keyboard",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "use_natural_keyboard",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bfbb1ae0fba5cbc543385aef6999df24c67dbf2a | lofunz/mieme | Reloaded/trunk/src/mame/video/segaic24.c | [
"Unlicense"
] | C | sys24_tile_draw_rect_rgb | void | static void sys24_tile_draw_rect_rgb(running_machine *machine, bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2)
{
int y;
const UINT16 *source = ((UINT16 *)bm->base) + sx + sy*bm->rowpixels;
const UINT8 *trans = ((UINT8 *) tm->base) + sx + sy*tm->rowpixels;
UINT16 *dest = (UINT16 *)dm->base;
const pen_t *pens = machine->pens;
tpri |= TILEMAP_PIXEL_LAYER0;
dest += yy1*dm->rowpixels + xx1;
mask += yy1*4;
yy2 -= yy1;
while(xx1 >= 128) {
xx1 -= 128;
xx2 -= 128;
mask++;
}
for(y=0; y<yy2; y++) {
const UINT16 *src = source;
const UINT8 *srct = trans;
UINT16 *dst = dest;
const UINT16 *mask1 = mask;
int llx = xx2;
int cur_x = xx1;
while(llx > 0) {
UINT16 m = *mask1++;
if(win)
m = ~m;
if(!cur_x && llx>=128) {
// Fast paths for the 128-pixels without side clipping case
if(!m) {
// 1- 128 pixels from this layer
int x;
for(x=0; x<128; x++) {
if(*srct++ == tpri)
*dst = pens[*src];
src++;
dst++;
}
} else if(m == 0xffff) {
// 2- 128 pixels from the other layer
src += 128;
srct += 128;
dst += 128;
} else {
// 3- 128 pixels from both layers
int x;
for(x=0; x<128; x+=8) {
if(!(m & 0x8000)) {
int xx;
for(xx=0; xx<8; xx++)
if(srct[xx] == tpri)
dst[xx] = pens[src[xx]];
}
src += 8;
srct += 8;
dst += 8;
m <<= 1;
}
}
} else {
// Clipped path
int llx1 = llx >= 128 ? 128 : llx;
if(!m) {
// 1- 128 pixels from this layer
int x;
for(x = cur_x; x<llx1; x++) {
if(*srct++ == tpri)
*dst = pens[*src];
src++;
dst++;
}
} else if(m == 0xffff) {
// 2- 128 pixels from the other layer
src += 128 - cur_x;
srct += 128 - cur_x;
dst += 128 - cur_x;
} else {
// 3- 128 pixels from both layers
int x;
for(x=cur_x; x<llx1; x++) {
if(*srct++ == tpri && !(m & (0x8000 >> (x >> 3))))
*dst = pens[*src];
src++;
dst++;
}
}
}
llx -= 128;
cur_x = 0;
}
source += bm->rowpixels;
trans += tm->rowpixels;
dest += dm->rowpixels;
mask += 4;
}
} | // The rgb version is used by model 1 & 2 which do not need to care
// about sprite priority hence the lack of support for the
// machine->priority_bitmap
| The rgb version is used by model 1 & 2 which do not need to care
about sprite priority hence the lack of support for the
machine->priority_bitmap | [
"The",
"rgb",
"version",
"is",
"used",
"by",
"model",
"1",
"&",
"2",
"which",
"do",
"not",
"need",
"to",
"care",
"about",
"sprite",
"priority",
"hence",
"the",
"lack",
"of",
"support",
"for",
"the",
"machine",
"-",
">",
"priority_bitmap"
] | static void sys24_tile_draw_rect_rgb(running_machine *machine, bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2)
{
int y;
const UINT16 *source = ((UINT16 *)bm->base) + sx + sy*bm->rowpixels;
const UINT8 *trans = ((UINT8 *) tm->base) + sx + sy*tm->rowpixels;
UINT16 *dest = (UINT16 *)dm->base;
const pen_t *pens = machine->pens;
tpri |= TILEMAP_PIXEL_LAYER0;
dest += yy1*dm->rowpixels + xx1;
mask += yy1*4;
yy2 -= yy1;
while(xx1 >= 128) {
xx1 -= 128;
xx2 -= 128;
mask++;
}
for(y=0; y<yy2; y++) {
const UINT16 *src = source;
const UINT8 *srct = trans;
UINT16 *dst = dest;
const UINT16 *mask1 = mask;
int llx = xx2;
int cur_x = xx1;
while(llx > 0) {
UINT16 m = *mask1++;
if(win)
m = ~m;
if(!cur_x && llx>=128) {
if(!m) {
int x;
for(x=0; x<128; x++) {
if(*srct++ == tpri)
*dst = pens[*src];
src++;
dst++;
}
} else if(m == 0xffff) {
src += 128;
srct += 128;
dst += 128;
} else {
int x;
for(x=0; x<128; x+=8) {
if(!(m & 0x8000)) {
int xx;
for(xx=0; xx<8; xx++)
if(srct[xx] == tpri)
dst[xx] = pens[src[xx]];
}
src += 8;
srct += 8;
dst += 8;
m <<= 1;
}
}
} else {
int llx1 = llx >= 128 ? 128 : llx;
if(!m) {
int x;
for(x = cur_x; x<llx1; x++) {
if(*srct++ == tpri)
*dst = pens[*src];
src++;
dst++;
}
} else if(m == 0xffff) {
src += 128 - cur_x;
srct += 128 - cur_x;
dst += 128 - cur_x;
} else {
int x;
for(x=cur_x; x<llx1; x++) {
if(*srct++ == tpri && !(m & (0x8000 >> (x >> 3))))
*dst = pens[*src];
src++;
dst++;
}
}
}
llx -= 128;
cur_x = 0;
}
source += bm->rowpixels;
trans += tm->rowpixels;
dest += dm->rowpixels;
mask += 4;
}
} | [
"static",
"void",
"sys24_tile_draw_rect_rgb",
"(",
"running_machine",
"*",
"machine",
",",
"bitmap_t",
"*",
"bm",
",",
"bitmap_t",
"*",
"tm",
",",
"bitmap_t",
"*",
"dm",
",",
"const",
"UINT16",
"*",
"mask",
",",
"UINT16",
"tpri",
",",
"UINT8",
"lpri",
",",
"int",
"win",
",",
"int",
"sx",
",",
"int",
"sy",
",",
"int",
"xx1",
",",
"int",
"yy1",
",",
"int",
"xx2",
",",
"int",
"yy2",
")",
"{",
"int",
"y",
";",
"const",
"UINT16",
"*",
"source",
"=",
"(",
"(",
"UINT16",
"*",
")",
"bm",
"->",
"base",
")",
"+",
"sx",
"+",
"sy",
"*",
"bm",
"->",
"rowpixels",
";",
"const",
"UINT8",
"*",
"trans",
"=",
"(",
"(",
"UINT8",
"*",
")",
"tm",
"->",
"base",
")",
"+",
"sx",
"+",
"sy",
"*",
"tm",
"->",
"rowpixels",
";",
"UINT16",
"*",
"dest",
"=",
"(",
"UINT16",
"*",
")",
"dm",
"->",
"base",
";",
"const",
"pen_t",
"*",
"pens",
"=",
"machine",
"->",
"pens",
";",
"tpri",
"|=",
"TILEMAP_PIXEL_LAYER0",
";",
"dest",
"+=",
"yy1",
"*",
"dm",
"->",
"rowpixels",
"+",
"xx1",
";",
"mask",
"+=",
"yy1",
"*",
"4",
";",
"yy2",
"-=",
"yy1",
";",
"while",
"(",
"xx1",
">=",
"128",
")",
"{",
"xx1",
"-=",
"128",
";",
"xx2",
"-=",
"128",
";",
"mask",
"++",
";",
"}",
"for",
"(",
"y",
"=",
"0",
";",
"y",
"<",
"yy2",
";",
"y",
"++",
")",
"{",
"const",
"UINT16",
"*",
"src",
"=",
"source",
";",
"const",
"UINT8",
"*",
"srct",
"=",
"trans",
";",
"UINT16",
"*",
"dst",
"=",
"dest",
";",
"const",
"UINT16",
"*",
"mask1",
"=",
"mask",
";",
"int",
"llx",
"=",
"xx2",
";",
"int",
"cur_x",
"=",
"xx1",
";",
"while",
"(",
"llx",
">",
"0",
")",
"{",
"UINT16",
"m",
"=",
"*",
"mask1",
"++",
";",
"if",
"(",
"win",
")",
"m",
"=",
"~",
"m",
";",
"if",
"(",
"!",
"cur_x",
"&&",
"llx",
">=",
"128",
")",
"{",
"if",
"(",
"!",
"m",
")",
"{",
"int",
"x",
";",
"for",
"(",
"x",
"=",
"0",
";",
"x",
"<",
"128",
";",
"x",
"++",
")",
"{",
"if",
"(",
"*",
"srct",
"++",
"==",
"tpri",
")",
"*",
"dst",
"=",
"pens",
"[",
"*",
"src",
"]",
";",
"src",
"++",
";",
"dst",
"++",
";",
"}",
"}",
"else",
"if",
"(",
"m",
"==",
"0xffff",
")",
"{",
"src",
"+=",
"128",
";",
"srct",
"+=",
"128",
";",
"dst",
"+=",
"128",
";",
"}",
"else",
"{",
"int",
"x",
";",
"for",
"(",
"x",
"=",
"0",
";",
"x",
"<",
"128",
";",
"x",
"+=",
"8",
")",
"{",
"if",
"(",
"!",
"(",
"m",
"&",
"0x8000",
")",
")",
"{",
"int",
"xx",
";",
"for",
"(",
"xx",
"=",
"0",
";",
"xx",
"<",
"8",
";",
"xx",
"++",
")",
"if",
"(",
"srct",
"[",
"xx",
"]",
"==",
"tpri",
")",
"dst",
"[",
"xx",
"]",
"=",
"pens",
"[",
"src",
"[",
"xx",
"]",
"]",
";",
"}",
"src",
"+=",
"8",
";",
"srct",
"+=",
"8",
";",
"dst",
"+=",
"8",
";",
"m",
"<<=",
"1",
";",
"}",
"}",
"}",
"else",
"{",
"int",
"llx1",
"=",
"llx",
">=",
"128",
"?",
"128",
":",
"llx",
";",
"if",
"(",
"!",
"m",
")",
"{",
"int",
"x",
";",
"for",
"(",
"x",
"=",
"cur_x",
";",
"x",
"<",
"llx1",
";",
"x",
"++",
")",
"{",
"if",
"(",
"*",
"srct",
"++",
"==",
"tpri",
")",
"*",
"dst",
"=",
"pens",
"[",
"*",
"src",
"]",
";",
"src",
"++",
";",
"dst",
"++",
";",
"}",
"}",
"else",
"if",
"(",
"m",
"==",
"0xffff",
")",
"{",
"src",
"+=",
"128",
"-",
"cur_x",
";",
"srct",
"+=",
"128",
"-",
"cur_x",
";",
"dst",
"+=",
"128",
"-",
"cur_x",
";",
"}",
"else",
"{",
"int",
"x",
";",
"for",
"(",
"x",
"=",
"cur_x",
";",
"x",
"<",
"llx1",
";",
"x",
"++",
")",
"{",
"if",
"(",
"*",
"srct",
"++",
"==",
"tpri",
"&&",
"!",
"(",
"m",
"&",
"(",
"0x8000",
">>",
"(",
"x",
">>",
"3",
")",
")",
")",
")",
"*",
"dst",
"=",
"pens",
"[",
"*",
"src",
"]",
";",
"src",
"++",
";",
"dst",
"++",
";",
"}",
"}",
"}",
"llx",
"-=",
"128",
";",
"cur_x",
"=",
"0",
";",
"}",
"source",
"+=",
"bm",
"->",
"rowpixels",
";",
"trans",
"+=",
"tm",
"->",
"rowpixels",
";",
"dest",
"+=",
"dm",
"->",
"rowpixels",
";",
"mask",
"+=",
"4",
";",
"}",
"}"
] | The rgb version is used by model 1 & 2 which do not need to care
about sprite priority hence the lack of support for the
machine->priority_bitmap | [
"The",
"rgb",
"version",
"is",
"used",
"by",
"model",
"1",
"&",
"2",
"which",
"do",
"not",
"need",
"to",
"care",
"about",
"sprite",
"priority",
"hence",
"the",
"lack",
"of",
"support",
"for",
"the",
"machine",
"-",
">",
"priority_bitmap"
] | [
"// Fast paths for the 128-pixels without side clipping case\r",
"// 1- 128 pixels from this layer\r",
"// 2- 128 pixels from the other layer\r",
"// 3- 128 pixels from both layers\r",
"// Clipped path\r",
"// 1- 128 pixels from this layer\r",
"// 2- 128 pixels from the other layer\r",
"// 3- 128 pixels from both layers\r"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "bm",
"type": "bitmap_t"
},
{
"param": "tm",
"type": "bitmap_t"
},
{
"param": "dm",
"type": "bitmap_t"
},
{
"param": "mask",
"type": "UINT16"
},
{
"param": "tpri",
"type": "UINT16"
},
{
"param": "lpri",
"type": "UINT8"
},
{
"param": "win",
"type": "int"
},
{
"param": "sx",
"type": "int"
},
{
"param": "sy",
"type": "int"
},
{
"param": "xx1",
"type": "int"
},
{
"param": "yy1",
"type": "int"
},
{
"param": "xx2",
"type": "int"
},
{
"param": "yy2",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bm",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tm",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dm",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mask",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tpri",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lpri",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "win",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xx1",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "yy1",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xx2",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "yy2",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bf58d114bbd6d8aa1441a16b966d8dc37b8331a6 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/audio/seibu.c | [
"Unlicense"
] | C | seibu_adpcm_decrypt | void | void seibu_adpcm_decrypt(running_machine *machine, const char *region)
{
UINT8 *ROM = memory_region(machine, region);
int len = memory_region_length(machine, region);
int i;
for (i = 0; i < len; i++)
{
ROM[i] = BITSWAP8(ROM[i], 7, 5, 3, 1, 6, 4, 2, 0);
}
} | // "decrypt" is a bit flowery here, as it's probably just line-swapping to
// simplify PCB layout/routing rather than intentional protection, but it
// still fits, especially since the Z80s for all these games are truly encrypted. | "decrypt" is a bit flowery here, as it's probably just line-swapping to
simplify PCB layout/routing rather than intentional protection, but it
still fits, especially since the Z80s for all these games are truly encrypted. | [
"\"",
"decrypt",
"\"",
"is",
"a",
"bit",
"flowery",
"here",
"as",
"it",
"'",
"s",
"probably",
"just",
"line",
"-",
"swapping",
"to",
"simplify",
"PCB",
"layout",
"/",
"routing",
"rather",
"than",
"intentional",
"protection",
"but",
"it",
"still",
"fits",
"especially",
"since",
"the",
"Z80s",
"for",
"all",
"these",
"games",
"are",
"truly",
"encrypted",
"."
] | void seibu_adpcm_decrypt(running_machine *machine, const char *region)
{
UINT8 *ROM = memory_region(machine, region);
int len = memory_region_length(machine, region);
int i;
for (i = 0; i < len; i++)
{
ROM[i] = BITSWAP8(ROM[i], 7, 5, 3, 1, 6, 4, 2, 0);
}
} | [
"void",
"seibu_adpcm_decrypt",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"region",
")",
"{",
"UINT8",
"*",
"ROM",
"=",
"memory_region",
"(",
"machine",
",",
"region",
")",
";",
"int",
"len",
"=",
"memory_region_length",
"(",
"machine",
",",
"region",
")",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"ROM",
"[",
"i",
"]",
"=",
"BITSWAP8",
"(",
"ROM",
"[",
"i",
"]",
",",
"7",
",",
"5",
",",
"3",
",",
"1",
",",
"6",
",",
"4",
",",
"2",
",",
"0",
")",
";",
"}",
"}"
] | "decrypt" is a bit flowery here, as it's probably just line-swapping to
simplify PCB layout/routing rather than intentional protection, but it
still fits, especially since the Z80s for all these games are truly encrypted. | [
"\"",
"decrypt",
"\"",
"is",
"a",
"bit",
"flowery",
"here",
"as",
"it",
"'",
"s",
"probably",
"just",
"line",
"-",
"swapping",
"to",
"simplify",
"PCB",
"layout",
"/",
"routing",
"rather",
"than",
"intentional",
"protection",
"but",
"it",
"still",
"fits",
"especially",
"since",
"the",
"Z80s",
"for",
"all",
"these",
"games",
"are",
"truly",
"encrypted",
"."
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "region",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "region",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860b4a9733bb8979ba3156d258bf5b44ad6494dd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/romload.c | [
"Unlicense"
] | C | rom_first_source | rom_source | const rom_source *rom_first_source(const game_driver *drv, const machine_config *config)
{
const device_config *device;
/* if the driver has a ROM pointer, that's what we want */
if (drv->rom != NULL)
return (rom_source *)drv;
/* otherwise, look through devices */
if (config != NULL)
for (device = config->devicelist; device != NULL; device = device->next)
{
const rom_entry *devromp = (const rom_entry *)device_get_info_ptr(device, DEVINFO_PTR_ROM_REGION);
if (devromp != NULL)
return (rom_source *)device;
}
return NULL;
} | /*-------------------------------------------------
rom_first_source - return pointer to first ROM
source
-------------------------------------------------*/ | return pointer to first ROM
source | [
"return",
"pointer",
"to",
"first",
"ROM",
"source"
] | const rom_source *rom_first_source(const game_driver *drv, const machine_config *config)
{
const device_config *device;
if (drv->rom != NULL)
return (rom_source *)drv;
if (config != NULL)
for (device = config->devicelist; device != NULL; device = device->next)
{
const rom_entry *devromp = (const rom_entry *)device_get_info_ptr(device, DEVINFO_PTR_ROM_REGION);
if (devromp != NULL)
return (rom_source *)device;
}
return NULL;
} | [
"const",
"rom_source",
"*",
"rom_first_source",
"(",
"const",
"game_driver",
"*",
"drv",
",",
"const",
"machine_config",
"*",
"config",
")",
"{",
"const",
"device_config",
"*",
"device",
";",
"if",
"(",
"drv",
"->",
"rom",
"!=",
"NULL",
")",
"return",
"(",
"rom_source",
"*",
")",
"drv",
";",
"if",
"(",
"config",
"!=",
"NULL",
")",
"for",
"(",
"device",
"=",
"config",
"->",
"devicelist",
";",
"device",
"!=",
"NULL",
";",
"device",
"=",
"device",
"->",
"next",
")",
"{",
"const",
"rom_entry",
"*",
"devromp",
"=",
"(",
"const",
"rom_entry",
"*",
")",
"device_get_info_ptr",
"(",
"device",
",",
"DEVINFO_PTR_ROM_REGION",
")",
";",
"if",
"(",
"devromp",
"!=",
"NULL",
")",
"return",
"(",
"rom_source",
"*",
")",
"device",
";",
"}",
"return",
"NULL",
";",
"}"
] | rom_first_source - return pointer to first ROM
source | [
"rom_first_source",
"-",
"return",
"pointer",
"to",
"first",
"ROM",
"source"
] | [
"/* if the driver has a ROM pointer, that's what we want */",
"/* otherwise, look through devices */"
] | [
{
"param": "drv",
"type": "game_driver"
},
{
"param": "config",
"type": "machine_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drv",
"type": "game_driver",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config",
"type": "machine_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860b4a9733bb8979ba3156d258bf5b44ad6494dd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/romload.c | [
"Unlicense"
] | C | rom_next_source | rom_source | const rom_source *rom_next_source(const game_driver *drv, const machine_config *config, const rom_source *previous)
{
const device_config *device;
/* if the previous was the driver, we want the first device */
if (rom_source_is_gamedrv(drv, previous))
device = (config != NULL) ? config->devicelist : NULL;
else
device = ((const device_config *)previous)->next;
/* look for further devices with ROM definitions */
for ( ; device != NULL; device = device->next)
{
const rom_entry *devromp = (const rom_entry *)device_get_info_ptr(device, DEVINFO_PTR_ROM_REGION);
if (devromp != NULL)
return (rom_source *)device;
}
return NULL;
} | /*-------------------------------------------------
rom_next_source - return pointer to next ROM
source
-------------------------------------------------*/ | return pointer to next ROM
source | [
"return",
"pointer",
"to",
"next",
"ROM",
"source"
] | const rom_source *rom_next_source(const game_driver *drv, const machine_config *config, const rom_source *previous)
{
const device_config *device;
if (rom_source_is_gamedrv(drv, previous))
device = (config != NULL) ? config->devicelist : NULL;
else
device = ((const device_config *)previous)->next;
for ( ; device != NULL; device = device->next)
{
const rom_entry *devromp = (const rom_entry *)device_get_info_ptr(device, DEVINFO_PTR_ROM_REGION);
if (devromp != NULL)
return (rom_source *)device;
}
return NULL;
} | [
"const",
"rom_source",
"*",
"rom_next_source",
"(",
"const",
"game_driver",
"*",
"drv",
",",
"const",
"machine_config",
"*",
"config",
",",
"const",
"rom_source",
"*",
"previous",
")",
"{",
"const",
"device_config",
"*",
"device",
";",
"if",
"(",
"rom_source_is_gamedrv",
"(",
"drv",
",",
"previous",
")",
")",
"device",
"=",
"(",
"config",
"!=",
"NULL",
")",
"?",
"config",
"->",
"devicelist",
":",
"NULL",
";",
"else",
"device",
"=",
"(",
"(",
"const",
"device_config",
"*",
")",
"previous",
")",
"->",
"next",
";",
"for",
"(",
";",
"device",
"!=",
"NULL",
";",
"device",
"=",
"device",
"->",
"next",
")",
"{",
"const",
"rom_entry",
"*",
"devromp",
"=",
"(",
"const",
"rom_entry",
"*",
")",
"device_get_info_ptr",
"(",
"device",
",",
"DEVINFO_PTR_ROM_REGION",
")",
";",
"if",
"(",
"devromp",
"!=",
"NULL",
")",
"return",
"(",
"rom_source",
"*",
")",
"device",
";",
"}",
"return",
"NULL",
";",
"}"
] | rom_next_source - return pointer to next ROM
source | [
"rom_next_source",
"-",
"return",
"pointer",
"to",
"next",
"ROM",
"source"
] | [
"/* if the previous was the driver, we want the first device */",
"/* look for further devices with ROM definitions */"
] | [
{
"param": "drv",
"type": "game_driver"
},
{
"param": "config",
"type": "machine_config"
},
{
"param": "previous",
"type": "rom_source"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drv",
"type": "game_driver",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config",
"type": "machine_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "previous",
"type": "rom_source",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860b4a9733bb8979ba3156d258bf5b44ad6494dd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/romload.c | [
"Unlicense"
] | C | rom_first_region | rom_entry | const rom_entry *rom_first_region(const game_driver *drv, const rom_source *source)
{
const rom_entry *romp;
if (source == NULL || rom_source_is_gamedrv(drv, source))
romp = drv->rom;
else
romp = (const rom_entry *)device_get_info_ptr((const device_config *)source, DEVINFO_PTR_ROM_REGION);
return (romp != NULL && !ROMENTRY_ISEND(romp)) ? romp : NULL;
} | /*-------------------------------------------------
rom_first_region - return pointer to first ROM
region
-------------------------------------------------*/ | return pointer to first ROM
region | [
"return",
"pointer",
"to",
"first",
"ROM",
"region"
] | const rom_entry *rom_first_region(const game_driver *drv, const rom_source *source)
{
const rom_entry *romp;
if (source == NULL || rom_source_is_gamedrv(drv, source))
romp = drv->rom;
else
romp = (const rom_entry *)device_get_info_ptr((const device_config *)source, DEVINFO_PTR_ROM_REGION);
return (romp != NULL && !ROMENTRY_ISEND(romp)) ? romp : NULL;
} | [
"const",
"rom_entry",
"*",
"rom_first_region",
"(",
"const",
"game_driver",
"*",
"drv",
",",
"const",
"rom_source",
"*",
"source",
")",
"{",
"const",
"rom_entry",
"*",
"romp",
";",
"if",
"(",
"source",
"==",
"NULL",
"||",
"rom_source_is_gamedrv",
"(",
"drv",
",",
"source",
")",
")",
"romp",
"=",
"drv",
"->",
"rom",
";",
"else",
"romp",
"=",
"(",
"const",
"rom_entry",
"*",
")",
"device_get_info_ptr",
"(",
"(",
"const",
"device_config",
"*",
")",
"source",
",",
"DEVINFO_PTR_ROM_REGION",
")",
";",
"return",
"(",
"romp",
"!=",
"NULL",
"&&",
"!",
"ROMENTRY_ISEND",
"(",
"romp",
")",
")",
"?",
"romp",
":",
"NULL",
";",
"}"
] | rom_first_region - return pointer to first ROM
region | [
"rom_first_region",
"-",
"return",
"pointer",
"to",
"first",
"ROM",
"region"
] | [] | [
{
"param": "drv",
"type": "game_driver"
},
{
"param": "source",
"type": "rom_source"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drv",
"type": "game_driver",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "source",
"type": "rom_source",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860b4a9733bb8979ba3156d258bf5b44ad6494dd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/romload.c | [
"Unlicense"
] | C | rom_region_name | astring | astring *rom_region_name(astring *result, const game_driver *drv, const rom_source *source, const rom_entry *romp)
{
if (rom_source_is_gamedrv(drv, source))
astring_cpyc(result, ROMREGION_GETTAG(romp));
else
{
const device_config *device = (const device_config *)source;
astring_printf(result, "%s:%s", device->tag, ROMREGION_GETTAG(romp));
}
return result;
} | /*-------------------------------------------------
rom_region_name - return the appropriate name
for a rom region
-------------------------------------------------*/ | return the appropriate name
for a rom region | [
"return",
"the",
"appropriate",
"name",
"for",
"a",
"rom",
"region"
] | astring *rom_region_name(astring *result, const game_driver *drv, const rom_source *source, const rom_entry *romp)
{
if (rom_source_is_gamedrv(drv, source))
astring_cpyc(result, ROMREGION_GETTAG(romp));
else
{
const device_config *device = (const device_config *)source;
astring_printf(result, "%s:%s", device->tag, ROMREGION_GETTAG(romp));
}
return result;
} | [
"astring",
"*",
"rom_region_name",
"(",
"astring",
"*",
"result",
",",
"const",
"game_driver",
"*",
"drv",
",",
"const",
"rom_source",
"*",
"source",
",",
"const",
"rom_entry",
"*",
"romp",
")",
"{",
"if",
"(",
"rom_source_is_gamedrv",
"(",
"drv",
",",
"source",
")",
")",
"astring_cpyc",
"(",
"result",
",",
"ROMREGION_GETTAG",
"(",
"romp",
")",
")",
";",
"else",
"{",
"const",
"device_config",
"*",
"device",
"=",
"(",
"const",
"device_config",
"*",
")",
"source",
";",
"astring_printf",
"(",
"result",
",",
"\"",
"\"",
",",
"device",
"->",
"tag",
",",
"ROMREGION_GETTAG",
"(",
"romp",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] | rom_region_name - return the appropriate name
for a rom region | [
"rom_region_name",
"-",
"return",
"the",
"appropriate",
"name",
"for",
"a",
"rom",
"region"
] | [] | [
{
"param": "result",
"type": "astring"
},
{
"param": "drv",
"type": "game_driver"
},
{
"param": "source",
"type": "rom_source"
},
{
"param": "romp",
"type": "rom_entry"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "result",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "drv",
"type": "game_driver",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "source",
"type": "rom_source",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "romp",
"type": "rom_entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860b4a9733bb8979ba3156d258bf5b44ad6494dd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/romload.c | [
"Unlicense"
] | C | handle_missing_file | void | static void handle_missing_file(rom_load_data *romdata, const rom_entry *romp)
{
/* optional files are okay */
if (ROM_ISOPTIONAL(romp))
{
astring_catprintf(romdata->errorstring, "OPTIONAL %s NOT FOUND\n", ROM_GETNAME(romp));
romdata->warnings++;
}
/* no good dumps are okay */
else if (ROM_NOGOODDUMP(romp))
{
astring_catprintf(romdata->errorstring, "%s NOT FOUND (NO GOOD DUMP KNOWN)\n", ROM_GETNAME(romp));
romdata->warnings++;
}
/* anything else is bad */
else
{
astring_catprintf(romdata->errorstring, "%s NOT FOUND\n", ROM_GETNAME(romp));
romdata->errors++;
}
} | /*-------------------------------------------------
handle_missing_file - handles error generation
for missing files
-------------------------------------------------*/ | handles error generation
for missing files | [
"handles",
"error",
"generation",
"for",
"missing",
"files"
] | static void handle_missing_file(rom_load_data *romdata, const rom_entry *romp)
{
if (ROM_ISOPTIONAL(romp))
{
astring_catprintf(romdata->errorstring, "OPTIONAL %s NOT FOUND\n", ROM_GETNAME(romp));
romdata->warnings++;
}
else if (ROM_NOGOODDUMP(romp))
{
astring_catprintf(romdata->errorstring, "%s NOT FOUND (NO GOOD DUMP KNOWN)\n", ROM_GETNAME(romp));
romdata->warnings++;
}
else
{
astring_catprintf(romdata->errorstring, "%s NOT FOUND\n", ROM_GETNAME(romp));
romdata->errors++;
}
} | [
"static",
"void",
"handle_missing_file",
"(",
"rom_load_data",
"*",
"romdata",
",",
"const",
"rom_entry",
"*",
"romp",
")",
"{",
"if",
"(",
"ROM_ISOPTIONAL",
"(",
"romp",
")",
")",
"{",
"astring_catprintf",
"(",
"romdata",
"->",
"errorstring",
",",
"\"",
"\\n",
"\"",
",",
"ROM_GETNAME",
"(",
"romp",
")",
")",
";",
"romdata",
"->",
"warnings",
"++",
";",
"}",
"else",
"if",
"(",
"ROM_NOGOODDUMP",
"(",
"romp",
")",
")",
"{",
"astring_catprintf",
"(",
"romdata",
"->",
"errorstring",
",",
"\"",
"\\n",
"\"",
",",
"ROM_GETNAME",
"(",
"romp",
")",
")",
";",
"romdata",
"->",
"warnings",
"++",
";",
"}",
"else",
"{",
"astring_catprintf",
"(",
"romdata",
"->",
"errorstring",
",",
"\"",
"\\n",
"\"",
",",
"ROM_GETNAME",
"(",
"romp",
")",
")",
";",
"romdata",
"->",
"errors",
"++",
";",
"}",
"}"
] | handle_missing_file - handles error generation
for missing files | [
"handle_missing_file",
"-",
"handles",
"error",
"generation",
"for",
"missing",
"files"
] | [
"/* optional files are okay */",
"/* no good dumps are okay */",
"/* anything else is bad */"
] | [
{
"param": "romdata",
"type": "rom_load_data"
},
{
"param": "romp",
"type": "rom_entry"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "romdata",
"type": "rom_load_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "romp",
"type": "rom_entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860b4a9733bb8979ba3156d258bf5b44ad6494dd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/romload.c | [
"Unlicense"
] | C | dump_wrong_and_correct_checksums | void | static void dump_wrong_and_correct_checksums(rom_load_data *romdata, const char *hash, const char *acthash)
{
unsigned i;
char chksum[256];
unsigned found_functions;
unsigned wrong_functions;
found_functions = hash_data_used_functions(hash) & hash_data_used_functions(acthash);
hash_data_print(hash, found_functions, chksum);
astring_catprintf(romdata->errorstring, " EXPECTED: %s\n", chksum);
/* We dump informations only of the functions for which MAME provided
a correct checksum. Other functions we might have calculated are
useless here */
hash_data_print(acthash, found_functions, chksum);
astring_catprintf(romdata->errorstring, " FOUND: %s\n", chksum);
/* For debugging purposes, we check if the checksums available in the
driver are correctly specified or not. This can be done by checking
the return value of one of the extract functions. Maybe we want to
activate this only in debug buils, but many developers only use
release builds, so I keep it as is for now. */
wrong_functions = 0;
for (i = 0; i < HASH_NUM_FUNCTIONS; i++)
if (hash_data_extract_printable_checksum(hash, 1 << i, chksum) == 2)
wrong_functions |= 1 << i;
if (wrong_functions)
{
for (i = 0; i < HASH_NUM_FUNCTIONS; i++)
if (wrong_functions & (1 << i))
{
astring_catprintf(romdata->errorstring,
"\tInvalid %s checksum treated as 0 (check leading zeros)\n",
hash_function_name(1 << i));
romdata->warnings++;
}
}
} | /*-------------------------------------------------
dump_wrong_and_correct_checksums - dump an
error message containing the wrong and the
correct checksums for a given ROM
-------------------------------------------------*/ | dump an
error message containing the wrong and the
correct checksums for a given ROM | [
"dump",
"an",
"error",
"message",
"containing",
"the",
"wrong",
"and",
"the",
"correct",
"checksums",
"for",
"a",
"given",
"ROM"
] | static void dump_wrong_and_correct_checksums(rom_load_data *romdata, const char *hash, const char *acthash)
{
unsigned i;
char chksum[256];
unsigned found_functions;
unsigned wrong_functions;
found_functions = hash_data_used_functions(hash) & hash_data_used_functions(acthash);
hash_data_print(hash, found_functions, chksum);
astring_catprintf(romdata->errorstring, " EXPECTED: %s\n", chksum);
hash_data_print(acthash, found_functions, chksum);
astring_catprintf(romdata->errorstring, " FOUND: %s\n", chksum);
wrong_functions = 0;
for (i = 0; i < HASH_NUM_FUNCTIONS; i++)
if (hash_data_extract_printable_checksum(hash, 1 << i, chksum) == 2)
wrong_functions |= 1 << i;
if (wrong_functions)
{
for (i = 0; i < HASH_NUM_FUNCTIONS; i++)
if (wrong_functions & (1 << i))
{
astring_catprintf(romdata->errorstring,
"\tInvalid %s checksum treated as 0 (check leading zeros)\n",
hash_function_name(1 << i));
romdata->warnings++;
}
}
} | [
"static",
"void",
"dump_wrong_and_correct_checksums",
"(",
"rom_load_data",
"*",
"romdata",
",",
"const",
"char",
"*",
"hash",
",",
"const",
"char",
"*",
"acthash",
")",
"{",
"unsigned",
"i",
";",
"char",
"chksum",
"[",
"256",
"]",
";",
"unsigned",
"found_functions",
";",
"unsigned",
"wrong_functions",
";",
"found_functions",
"=",
"hash_data_used_functions",
"(",
"hash",
")",
"&",
"hash_data_used_functions",
"(",
"acthash",
")",
";",
"hash_data_print",
"(",
"hash",
",",
"found_functions",
",",
"chksum",
")",
";",
"astring_catprintf",
"(",
"romdata",
"->",
"errorstring",
",",
"\"",
"\\n",
"\"",
",",
"chksum",
")",
";",
"hash_data_print",
"(",
"acthash",
",",
"found_functions",
",",
"chksum",
")",
";",
"astring_catprintf",
"(",
"romdata",
"->",
"errorstring",
",",
"\"",
"\\n",
"\"",
",",
"chksum",
")",
";",
"wrong_functions",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"HASH_NUM_FUNCTIONS",
";",
"i",
"++",
")",
"if",
"(",
"hash_data_extract_printable_checksum",
"(",
"hash",
",",
"1",
"<<",
"i",
",",
"chksum",
")",
"==",
"2",
")",
"wrong_functions",
"|=",
"1",
"<<",
"i",
";",
"if",
"(",
"wrong_functions",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"HASH_NUM_FUNCTIONS",
";",
"i",
"++",
")",
"if",
"(",
"wrong_functions",
"&",
"(",
"1",
"<<",
"i",
")",
")",
"{",
"astring_catprintf",
"(",
"romdata",
"->",
"errorstring",
",",
"\"",
"\\t",
"\\n",
"\"",
",",
"hash_function_name",
"(",
"1",
"<<",
"i",
")",
")",
";",
"romdata",
"->",
"warnings",
"++",
";",
"}",
"}",
"}"
] | dump_wrong_and_correct_checksums - dump an
error message containing the wrong and the
correct checksums for a given ROM | [
"dump_wrong_and_correct_checksums",
"-",
"dump",
"an",
"error",
"message",
"containing",
"the",
"wrong",
"and",
"the",
"correct",
"checksums",
"for",
"a",
"given",
"ROM"
] | [
"/* We dump informations only of the functions for which MAME provided\n a correct checksum. Other functions we might have calculated are\n useless here */",
"/* For debugging purposes, we check if the checksums available in the\n driver are correctly specified or not. This can be done by checking\n the return value of one of the extract functions. Maybe we want to\n activate this only in debug buils, but many developers only use\n release builds, so I keep it as is for now. */"
] | [
{
"param": "romdata",
"type": "rom_load_data"
},
{
"param": "hash",
"type": "char"
},
{
"param": "acthash",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "romdata",
"type": "rom_load_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "hash",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "acthash",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860b4a9733bb8979ba3156d258bf5b44ad6494dd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/romload.c | [
"Unlicense"
] | C | verify_length_and_hash | void | static void verify_length_and_hash(rom_load_data *romdata, const char *name, UINT32 explength, const char *hash)
{
UINT32 actlength;
const char* acthash;
/* we've already complained if there is no file */
if (romdata->file == NULL)
return;
/* get the length and CRC from the file */
actlength = mame_fsize(romdata->file);
acthash = mame_fhash(romdata->file, hash_data_used_functions(hash));
/* verify length */
if (explength != actlength)
{
astring_catprintf(romdata->errorstring, "%s WRONG LENGTH (expected: %08x found: %08x)\n", name, explength, actlength);
romdata->warnings++;
}
/* If there is no good dump known, write it */
if (hash_data_has_info(hash, HASH_INFO_NO_DUMP))
{
astring_catprintf(romdata->errorstring, "%s NO GOOD DUMP KNOWN\n", name);
romdata->warnings++;
}
/* verify checksums */
else if (!hash_data_is_equal(hash, acthash, 0))
{
/* otherwise, it's just bad */
astring_catprintf(romdata->errorstring, "%s WRONG CHECKSUMS:\n", name);
dump_wrong_and_correct_checksums(romdata, hash, acthash);
romdata->warnings++;
}
/* If it matches, but it is actually a bad dump, write it */
else if (hash_data_has_info(hash, HASH_INFO_BAD_DUMP))
{
astring_catprintf(romdata->errorstring, "%s ROM NEEDS REDUMP\n",name);
romdata->warnings++;
}
} | /*-------------------------------------------------
verify_length_and_hash - verify the length
and hash signatures of a file
-------------------------------------------------*/ | verify the length
and hash signatures of a file | [
"verify",
"the",
"length",
"and",
"hash",
"signatures",
"of",
"a",
"file"
] | static void verify_length_and_hash(rom_load_data *romdata, const char *name, UINT32 explength, const char *hash)
{
UINT32 actlength;
const char* acthash;
if (romdata->file == NULL)
return;
actlength = mame_fsize(romdata->file);
acthash = mame_fhash(romdata->file, hash_data_used_functions(hash));
if (explength != actlength)
{
astring_catprintf(romdata->errorstring, "%s WRONG LENGTH (expected: %08x found: %08x)\n", name, explength, actlength);
romdata->warnings++;
}
if (hash_data_has_info(hash, HASH_INFO_NO_DUMP))
{
astring_catprintf(romdata->errorstring, "%s NO GOOD DUMP KNOWN\n", name);
romdata->warnings++;
}
else if (!hash_data_is_equal(hash, acthash, 0))
{
astring_catprintf(romdata->errorstring, "%s WRONG CHECKSUMS:\n", name);
dump_wrong_and_correct_checksums(romdata, hash, acthash);
romdata->warnings++;
}
else if (hash_data_has_info(hash, HASH_INFO_BAD_DUMP))
{
astring_catprintf(romdata->errorstring, "%s ROM NEEDS REDUMP\n",name);
romdata->warnings++;
}
} | [
"static",
"void",
"verify_length_and_hash",
"(",
"rom_load_data",
"*",
"romdata",
",",
"const",
"char",
"*",
"name",
",",
"UINT32",
"explength",
",",
"const",
"char",
"*",
"hash",
")",
"{",
"UINT32",
"actlength",
";",
"const",
"char",
"*",
"acthash",
";",
"if",
"(",
"romdata",
"->",
"file",
"==",
"NULL",
")",
"return",
";",
"actlength",
"=",
"mame_fsize",
"(",
"romdata",
"->",
"file",
")",
";",
"acthash",
"=",
"mame_fhash",
"(",
"romdata",
"->",
"file",
",",
"hash_data_used_functions",
"(",
"hash",
")",
")",
";",
"if",
"(",
"explength",
"!=",
"actlength",
")",
"{",
"astring_catprintf",
"(",
"romdata",
"->",
"errorstring",
",",
"\"",
"\\n",
"\"",
",",
"name",
",",
"explength",
",",
"actlength",
")",
";",
"romdata",
"->",
"warnings",
"++",
";",
"}",
"if",
"(",
"hash_data_has_info",
"(",
"hash",
",",
"HASH_INFO_NO_DUMP",
")",
")",
"{",
"astring_catprintf",
"(",
"romdata",
"->",
"errorstring",
",",
"\"",
"\\n",
"\"",
",",
"name",
")",
";",
"romdata",
"->",
"warnings",
"++",
";",
"}",
"else",
"if",
"(",
"!",
"hash_data_is_equal",
"(",
"hash",
",",
"acthash",
",",
"0",
")",
")",
"{",
"astring_catprintf",
"(",
"romdata",
"->",
"errorstring",
",",
"\"",
"\\n",
"\"",
",",
"name",
")",
";",
"dump_wrong_and_correct_checksums",
"(",
"romdata",
",",
"hash",
",",
"acthash",
")",
";",
"romdata",
"->",
"warnings",
"++",
";",
"}",
"else",
"if",
"(",
"hash_data_has_info",
"(",
"hash",
",",
"HASH_INFO_BAD_DUMP",
")",
")",
"{",
"astring_catprintf",
"(",
"romdata",
"->",
"errorstring",
",",
"\"",
"\\n",
"\"",
",",
"name",
")",
";",
"romdata",
"->",
"warnings",
"++",
";",
"}",
"}"
] | verify_length_and_hash - verify the length
and hash signatures of a file | [
"verify_length_and_hash",
"-",
"verify",
"the",
"length",
"and",
"hash",
"signatures",
"of",
"a",
"file"
] | [
"/* we've already complained if there is no file */",
"/* get the length and CRC from the file */",
"/* verify length */",
"/* If there is no good dump known, write it */",
"/* verify checksums */",
"/* otherwise, it's just bad */",
"/* If it matches, but it is actually a bad dump, write it */"
] | [
{
"param": "romdata",
"type": "rom_load_data"
},
{
"param": "name",
"type": "char"
},
{
"param": "explength",
"type": "UINT32"
},
{
"param": "hash",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "romdata",
"type": "rom_load_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "explength",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "hash",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860b4a9733bb8979ba3156d258bf5b44ad6494dd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/romload.c | [
"Unlicense"
] | C | display_loading_rom_message | void | static void display_loading_rom_message(rom_load_data *romdata, const char *name)
{
char buffer[200];
if (name != NULL)
sprintf(buffer, "Loading (%d%%)", (UINT32)(100 * (UINT64)romdata->romsloadedsize / (UINT64)romdata->romstotalsize));
else
sprintf(buffer, "Loading Complete");
ui_set_startup_text(romdata->machine, buffer, FALSE);
} | /*-------------------------------------------------
display_loading_rom_message - display
messages about ROM loading to the user
-------------------------------------------------*/ | display
messages about ROM loading to the user | [
"display",
"messages",
"about",
"ROM",
"loading",
"to",
"the",
"user"
] | static void display_loading_rom_message(rom_load_data *romdata, const char *name)
{
char buffer[200];
if (name != NULL)
sprintf(buffer, "Loading (%d%%)", (UINT32)(100 * (UINT64)romdata->romsloadedsize / (UINT64)romdata->romstotalsize));
else
sprintf(buffer, "Loading Complete");
ui_set_startup_text(romdata->machine, buffer, FALSE);
} | [
"static",
"void",
"display_loading_rom_message",
"(",
"rom_load_data",
"*",
"romdata",
",",
"const",
"char",
"*",
"name",
")",
"{",
"char",
"buffer",
"[",
"200",
"]",
";",
"if",
"(",
"name",
"!=",
"NULL",
")",
"sprintf",
"(",
"buffer",
",",
"\"",
"\"",
",",
"(",
"UINT32",
")",
"(",
"100",
"*",
"(",
"UINT64",
")",
"romdata",
"->",
"romsloadedsize",
"/",
"(",
"UINT64",
")",
"romdata",
"->",
"romstotalsize",
")",
")",
";",
"else",
"sprintf",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"ui_set_startup_text",
"(",
"romdata",
"->",
"machine",
",",
"buffer",
",",
"FALSE",
")",
";",
"}"
] | display_loading_rom_message - display
messages about ROM loading to the user | [
"display_loading_rom_message",
"-",
"display",
"messages",
"about",
"ROM",
"loading",
"to",
"the",
"user"
] | [] | [
{
"param": "romdata",
"type": "rom_load_data"
},
{
"param": "name",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "romdata",
"type": "rom_load_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860b4a9733bb8979ba3156d258bf5b44ad6494dd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/romload.c | [
"Unlicense"
] | C | region_post_process | void | static void region_post_process(rom_load_data *romdata, const char *rgntag)
{
UINT32 regionlength = memory_region_length(romdata->machine, rgntag);
UINT32 regionflags = memory_region_flags(romdata->machine, rgntag);
UINT8 *regionbase = memory_region(romdata->machine, rgntag);
int endianness = ((regionflags & ROMREGION_ENDIANMASK) == ROMREGION_LE) ? ENDIANNESS_LITTLE : ENDIANNESS_BIG;
int datawidth = 1 << ((regionflags & ROMREGION_WIDTHMASK) >> 8);
UINT8 *base;
int i, j;
LOG(("+ datawidth=%d little=%d\n", datawidth, endianness == ENDIANNESS_LITTLE));
/* if the region is inverted, do that now */
if (regionflags & ROMREGION_INVERTMASK)
{
LOG(("+ Inverting region\n"));
for (i = 0, base = regionbase; i < regionlength; i++)
*base++ ^= 0xff;
}
/* swap the endianness if we need to */
if (datawidth > 1 && endianness != ENDIANNESS_NATIVE)
{
LOG(("+ Byte swapping region\n"));
for (i = 0, base = regionbase; i < regionlength; i += datawidth)
{
UINT8 temp[8];
memcpy(temp, base, datawidth);
for (j = datawidth - 1; j >= 0; j--)
*base++ = temp[j];
}
}
} | /*-------------------------------------------------
region_post_process - post-process a region,
byte swapping and inverting data as necessary
-------------------------------------------------*/ | post-process a region,
byte swapping and inverting data as necessary | [
"post",
"-",
"process",
"a",
"region",
"byte",
"swapping",
"and",
"inverting",
"data",
"as",
"necessary"
] | static void region_post_process(rom_load_data *romdata, const char *rgntag)
{
UINT32 regionlength = memory_region_length(romdata->machine, rgntag);
UINT32 regionflags = memory_region_flags(romdata->machine, rgntag);
UINT8 *regionbase = memory_region(romdata->machine, rgntag);
int endianness = ((regionflags & ROMREGION_ENDIANMASK) == ROMREGION_LE) ? ENDIANNESS_LITTLE : ENDIANNESS_BIG;
int datawidth = 1 << ((regionflags & ROMREGION_WIDTHMASK) >> 8);
UINT8 *base;
int i, j;
LOG(("+ datawidth=%d little=%d\n", datawidth, endianness == ENDIANNESS_LITTLE));
if (regionflags & ROMREGION_INVERTMASK)
{
LOG(("+ Inverting region\n"));
for (i = 0, base = regionbase; i < regionlength; i++)
*base++ ^= 0xff;
}
if (datawidth > 1 && endianness != ENDIANNESS_NATIVE)
{
LOG(("+ Byte swapping region\n"));
for (i = 0, base = regionbase; i < regionlength; i += datawidth)
{
UINT8 temp[8];
memcpy(temp, base, datawidth);
for (j = datawidth - 1; j >= 0; j--)
*base++ = temp[j];
}
}
} | [
"static",
"void",
"region_post_process",
"(",
"rom_load_data",
"*",
"romdata",
",",
"const",
"char",
"*",
"rgntag",
")",
"{",
"UINT32",
"regionlength",
"=",
"memory_region_length",
"(",
"romdata",
"->",
"machine",
",",
"rgntag",
")",
";",
"UINT32",
"regionflags",
"=",
"memory_region_flags",
"(",
"romdata",
"->",
"machine",
",",
"rgntag",
")",
";",
"UINT8",
"*",
"regionbase",
"=",
"memory_region",
"(",
"romdata",
"->",
"machine",
",",
"rgntag",
")",
";",
"int",
"endianness",
"=",
"(",
"(",
"regionflags",
"&",
"ROMREGION_ENDIANMASK",
")",
"==",
"ROMREGION_LE",
")",
"?",
"ENDIANNESS_LITTLE",
":",
"ENDIANNESS_BIG",
";",
"int",
"datawidth",
"=",
"1",
"<<",
"(",
"(",
"regionflags",
"&",
"ROMREGION_WIDTHMASK",
")",
">>",
"8",
")",
";",
"UINT8",
"*",
"base",
";",
"int",
"i",
",",
"j",
";",
"LOG",
"(",
"(",
"\"",
"\\n",
"\"",
",",
"datawidth",
",",
"endianness",
"==",
"ENDIANNESS_LITTLE",
")",
")",
";",
"if",
"(",
"regionflags",
"&",
"ROMREGION_INVERTMASK",
")",
"{",
"LOG",
"(",
"(",
"\"",
"\\n",
"\"",
")",
")",
";",
"for",
"(",
"i",
"=",
"0",
",",
"base",
"=",
"regionbase",
";",
"i",
"<",
"regionlength",
";",
"i",
"++",
")",
"*",
"base",
"++",
"^=",
"0xff",
";",
"}",
"if",
"(",
"datawidth",
">",
"1",
"&&",
"endianness",
"!=",
"ENDIANNESS_NATIVE",
")",
"{",
"LOG",
"(",
"(",
"\"",
"\\n",
"\"",
")",
")",
";",
"for",
"(",
"i",
"=",
"0",
",",
"base",
"=",
"regionbase",
";",
"i",
"<",
"regionlength",
";",
"i",
"+=",
"datawidth",
")",
"{",
"UINT8",
"temp",
"[",
"8",
"]",
";",
"memcpy",
"(",
"temp",
",",
"base",
",",
"datawidth",
")",
";",
"for",
"(",
"j",
"=",
"datawidth",
"-",
"1",
";",
"j",
">=",
"0",
";",
"j",
"--",
")",
"*",
"base",
"++",
"=",
"temp",
"[",
"j",
"]",
";",
"}",
"}",
"}"
] | region_post_process - post-process a region,
byte swapping and inverting data as necessary | [
"region_post_process",
"-",
"post",
"-",
"process",
"a",
"region",
"byte",
"swapping",
"and",
"inverting",
"data",
"as",
"necessary"
] | [
"/* if the region is inverted, do that now */",
"/* swap the endianness if we need to */"
] | [
{
"param": "romdata",
"type": "rom_load_data"
},
{
"param": "rgntag",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "romdata",
"type": "rom_load_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rgntag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860b4a9733bb8979ba3156d258bf5b44ad6494dd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/romload.c | [
"Unlicense"
] | C | open_rom_file | int | static int open_rom_file(rom_load_data *romdata, const char *regiontag, const rom_entry *romp)
{
file_error filerr = FILERR_NOT_FOUND;
UINT32 romsize = rom_file_size(romp);
const game_driver *drv;
int has_crc = FALSE;
UINT8 crcbytes[4];
UINT32 crc = 0;
/* update status display */
display_loading_rom_message(romdata, ROM_GETNAME(romp));
/* extract CRC to use for searching */
has_crc = hash_data_extract_binary_checksum(ROM_GETHASHDATA(romp), HASH_CRC, crcbytes);
if (has_crc)
crc = (crcbytes[0] << 24) | (crcbytes[1] << 16) | (crcbytes[2] << 8) | crcbytes[3];
/* attempt reading up the chain through the parents. It automatically also
attempts any kind of load by checksum supported by the archives. */
romdata->file = NULL;
for (drv = romdata->machine->gamedrv; romdata->file == NULL && drv != NULL; drv = driver_get_clone(drv))
if (drv->name != NULL && *drv->name != 0)
{
astring *fname = astring_assemble_3(astring_alloc(), drv->name, PATH_SEPARATOR, ROM_GETNAME(romp));
if (has_crc)
filerr = mame_fopen_crc(SEARCHPATH_ROM, astring_c(fname), crc, OPEN_FLAG_READ, &romdata->file);
else
filerr = mame_fopen(SEARCHPATH_ROM, astring_c(fname), OPEN_FLAG_READ, &romdata->file);
astring_free(fname);
}
/* if the region is load by name, load the ROM from there */
if (romdata->file == NULL && regiontag != NULL)
{
astring *fname = astring_assemble_3(astring_alloc(), regiontag, PATH_SEPARATOR, ROM_GETNAME(romp));
if (has_crc)
filerr = mame_fopen_crc(SEARCHPATH_ROM, astring_c(fname), crc, OPEN_FLAG_READ, &romdata->file);
else
filerr = mame_fopen(SEARCHPATH_ROM, astring_c(fname), OPEN_FLAG_READ, &romdata->file);
astring_free(fname);
}
/* update counters */
romdata->romsloaded++;
romdata->romsloadedsize += romsize;
/* return the result */
return (filerr == FILERR_NONE);
} | /*-------------------------------------------------
open_rom_file - open a ROM file, searching
up the parent and loading by checksum
-------------------------------------------------*/ | open a ROM file, searching
up the parent and loading by checksum | [
"open",
"a",
"ROM",
"file",
"searching",
"up",
"the",
"parent",
"and",
"loading",
"by",
"checksum"
] | static int open_rom_file(rom_load_data *romdata, const char *regiontag, const rom_entry *romp)
{
file_error filerr = FILERR_NOT_FOUND;
UINT32 romsize = rom_file_size(romp);
const game_driver *drv;
int has_crc = FALSE;
UINT8 crcbytes[4];
UINT32 crc = 0;
display_loading_rom_message(romdata, ROM_GETNAME(romp));
has_crc = hash_data_extract_binary_checksum(ROM_GETHASHDATA(romp), HASH_CRC, crcbytes);
if (has_crc)
crc = (crcbytes[0] << 24) | (crcbytes[1] << 16) | (crcbytes[2] << 8) | crcbytes[3];
romdata->file = NULL;
for (drv = romdata->machine->gamedrv; romdata->file == NULL && drv != NULL; drv = driver_get_clone(drv))
if (drv->name != NULL && *drv->name != 0)
{
astring *fname = astring_assemble_3(astring_alloc(), drv->name, PATH_SEPARATOR, ROM_GETNAME(romp));
if (has_crc)
filerr = mame_fopen_crc(SEARCHPATH_ROM, astring_c(fname), crc, OPEN_FLAG_READ, &romdata->file);
else
filerr = mame_fopen(SEARCHPATH_ROM, astring_c(fname), OPEN_FLAG_READ, &romdata->file);
astring_free(fname);
}
if (romdata->file == NULL && regiontag != NULL)
{
astring *fname = astring_assemble_3(astring_alloc(), regiontag, PATH_SEPARATOR, ROM_GETNAME(romp));
if (has_crc)
filerr = mame_fopen_crc(SEARCHPATH_ROM, astring_c(fname), crc, OPEN_FLAG_READ, &romdata->file);
else
filerr = mame_fopen(SEARCHPATH_ROM, astring_c(fname), OPEN_FLAG_READ, &romdata->file);
astring_free(fname);
}
romdata->romsloaded++;
romdata->romsloadedsize += romsize;
return (filerr == FILERR_NONE);
} | [
"static",
"int",
"open_rom_file",
"(",
"rom_load_data",
"*",
"romdata",
",",
"const",
"char",
"*",
"regiontag",
",",
"const",
"rom_entry",
"*",
"romp",
")",
"{",
"file_error",
"filerr",
"=",
"FILERR_NOT_FOUND",
";",
"UINT32",
"romsize",
"=",
"rom_file_size",
"(",
"romp",
")",
";",
"const",
"game_driver",
"*",
"drv",
";",
"int",
"has_crc",
"=",
"FALSE",
";",
"UINT8",
"crcbytes",
"[",
"4",
"]",
";",
"UINT32",
"crc",
"=",
"0",
";",
"display_loading_rom_message",
"(",
"romdata",
",",
"ROM_GETNAME",
"(",
"romp",
")",
")",
";",
"has_crc",
"=",
"hash_data_extract_binary_checksum",
"(",
"ROM_GETHASHDATA",
"(",
"romp",
")",
",",
"HASH_CRC",
",",
"crcbytes",
")",
";",
"if",
"(",
"has_crc",
")",
"crc",
"=",
"(",
"crcbytes",
"[",
"0",
"]",
"<<",
"24",
")",
"|",
"(",
"crcbytes",
"[",
"1",
"]",
"<<",
"16",
")",
"|",
"(",
"crcbytes",
"[",
"2",
"]",
"<<",
"8",
")",
"|",
"crcbytes",
"[",
"3",
"]",
";",
"romdata",
"->",
"file",
"=",
"NULL",
";",
"for",
"(",
"drv",
"=",
"romdata",
"->",
"machine",
"->",
"gamedrv",
";",
"romdata",
"->",
"file",
"==",
"NULL",
"&&",
"drv",
"!=",
"NULL",
";",
"drv",
"=",
"driver_get_clone",
"(",
"drv",
")",
")",
"if",
"(",
"drv",
"->",
"name",
"!=",
"NULL",
"&&",
"*",
"drv",
"->",
"name",
"!=",
"0",
")",
"{",
"astring",
"*",
"fname",
"=",
"astring_assemble_3",
"(",
"astring_alloc",
"(",
")",
",",
"drv",
"->",
"name",
",",
"PATH_SEPARATOR",
",",
"ROM_GETNAME",
"(",
"romp",
")",
")",
";",
"if",
"(",
"has_crc",
")",
"filerr",
"=",
"mame_fopen_crc",
"(",
"SEARCHPATH_ROM",
",",
"astring_c",
"(",
"fname",
")",
",",
"crc",
",",
"OPEN_FLAG_READ",
",",
"&",
"romdata",
"->",
"file",
")",
";",
"else",
"filerr",
"=",
"mame_fopen",
"(",
"SEARCHPATH_ROM",
",",
"astring_c",
"(",
"fname",
")",
",",
"OPEN_FLAG_READ",
",",
"&",
"romdata",
"->",
"file",
")",
";",
"astring_free",
"(",
"fname",
")",
";",
"}",
"if",
"(",
"romdata",
"->",
"file",
"==",
"NULL",
"&&",
"regiontag",
"!=",
"NULL",
")",
"{",
"astring",
"*",
"fname",
"=",
"astring_assemble_3",
"(",
"astring_alloc",
"(",
")",
",",
"regiontag",
",",
"PATH_SEPARATOR",
",",
"ROM_GETNAME",
"(",
"romp",
")",
")",
";",
"if",
"(",
"has_crc",
")",
"filerr",
"=",
"mame_fopen_crc",
"(",
"SEARCHPATH_ROM",
",",
"astring_c",
"(",
"fname",
")",
",",
"crc",
",",
"OPEN_FLAG_READ",
",",
"&",
"romdata",
"->",
"file",
")",
";",
"else",
"filerr",
"=",
"mame_fopen",
"(",
"SEARCHPATH_ROM",
",",
"astring_c",
"(",
"fname",
")",
",",
"OPEN_FLAG_READ",
",",
"&",
"romdata",
"->",
"file",
")",
";",
"astring_free",
"(",
"fname",
")",
";",
"}",
"romdata",
"->",
"romsloaded",
"++",
";",
"romdata",
"->",
"romsloadedsize",
"+=",
"romsize",
";",
"return",
"(",
"filerr",
"==",
"FILERR_NONE",
")",
";",
"}"
] | open_rom_file - open a ROM file, searching
up the parent and loading by checksum | [
"open_rom_file",
"-",
"open",
"a",
"ROM",
"file",
"searching",
"up",
"the",
"parent",
"and",
"loading",
"by",
"checksum"
] | [
"/* update status display */",
"/* extract CRC to use for searching */",
"/* attempt reading up the chain through the parents. It automatically also\n attempts any kind of load by checksum supported by the archives. */",
"/* if the region is load by name, load the ROM from there */",
"/* update counters */",
"/* return the result */"
] | [
{
"param": "romdata",
"type": "rom_load_data"
},
{
"param": "regiontag",
"type": "char"
},
{
"param": "romp",
"type": "rom_entry"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "romdata",
"type": "rom_load_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "regiontag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "romp",
"type": "rom_entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860b4a9733bb8979ba3156d258bf5b44ad6494dd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/romload.c | [
"Unlicense"
] | C | read_rom_data | int | static int read_rom_data(rom_load_data *romdata, const rom_entry *romp)
{
int datashift = ROM_GETBITSHIFT(romp);
int datamask = ((1 << ROM_GETBITWIDTH(romp)) - 1) << datashift;
int numbytes = ROM_GETLENGTH(romp);
int groupsize = ROM_GETGROUPSIZE(romp);
int skip = ROM_GETSKIPCOUNT(romp);
int reversed = ROM_ISREVERSED(romp);
int numgroups = (numbytes + groupsize - 1) / groupsize;
UINT8 *base = romdata->regionbase + ROM_GETOFFSET(romp);
UINT32 tempbufsize;
UINT8 *tempbuf;
int i;
LOG(("Loading ROM data: offs=%X len=%X mask=%02X group=%d skip=%d reverse=%d\n", ROM_GETOFFSET(romp), numbytes, datamask, groupsize, skip, reversed));
/* make sure the length was an even multiple of the group size */
if (numbytes % groupsize != 0)
fatalerror("Error in RomModule definition: %s length not an even multiple of group size\n", ROM_GETNAME(romp));
/* make sure we only fill within the region space */
if (ROM_GETOFFSET(romp) + numgroups * groupsize + (numgroups - 1) * skip > romdata->regionlength)
fatalerror("Error in RomModule definition: %s out of memory region space\n", ROM_GETNAME(romp));
/* make sure the length was valid */
if (numbytes == 0)
fatalerror("Error in RomModule definition: %s has an invalid length\n", ROM_GETNAME(romp));
/* special case for simple loads */
if (datamask == 0xff && (groupsize == 1 || !reversed) && skip == 0)
return rom_fread(romdata, base, numbytes);
/* use a temporary buffer for complex loads */
tempbufsize = MIN(TEMPBUFFER_MAX_SIZE, numbytes);
tempbuf = alloc_array_or_die(UINT8, tempbufsize);
/* chunky reads for complex loads */
skip += groupsize;
while (numbytes > 0)
{
int evengroupcount = (tempbufsize / groupsize) * groupsize;
int bytesleft = (numbytes > evengroupcount) ? evengroupcount : numbytes;
UINT8 *bufptr = tempbuf;
/* read as much as we can */
LOG((" Reading %X bytes into buffer\n", bytesleft));
if (rom_fread(romdata, bufptr, bytesleft) != bytesleft)
{
free(tempbuf);
return 0;
}
numbytes -= bytesleft;
LOG((" Copying to %p\n", base));
/* unmasked cases */
if (datamask == 0xff)
{
/* non-grouped data */
if (groupsize == 1)
for (i = 0; i < bytesleft; i++, base += skip)
*base = *bufptr++;
/* grouped data -- non-reversed case */
else if (!reversed)
while (bytesleft)
{
for (i = 0; i < groupsize && bytesleft; i++, bytesleft--)
base[i] = *bufptr++;
base += skip;
}
/* grouped data -- reversed case */
else
while (bytesleft)
{
for (i = groupsize - 1; i >= 0 && bytesleft; i--, bytesleft--)
base[i] = *bufptr++;
base += skip;
}
}
/* masked cases */
else
{
/* non-grouped data */
if (groupsize == 1)
for (i = 0; i < bytesleft; i++, base += skip)
*base = (*base & ~datamask) | ((*bufptr++ << datashift) & datamask);
/* grouped data -- non-reversed case */
else if (!reversed)
while (bytesleft)
{
for (i = 0; i < groupsize && bytesleft; i++, bytesleft--)
base[i] = (base[i] & ~datamask) | ((*bufptr++ << datashift) & datamask);
base += skip;
}
/* grouped data -- reversed case */
else
while (bytesleft)
{
for (i = groupsize - 1; i >= 0 && bytesleft; i--, bytesleft--)
base[i] = (base[i] & ~datamask) | ((*bufptr++ << datashift) & datamask);
base += skip;
}
}
}
free(tempbuf);
LOG((" All done\n"));
return ROM_GETLENGTH(romp);
} | /*-------------------------------------------------
read_rom_data - read ROM data for a single
entry
-------------------------------------------------*/ | read ROM data for a single
entry | [
"read",
"ROM",
"data",
"for",
"a",
"single",
"entry"
] | static int read_rom_data(rom_load_data *romdata, const rom_entry *romp)
{
int datashift = ROM_GETBITSHIFT(romp);
int datamask = ((1 << ROM_GETBITWIDTH(romp)) - 1) << datashift;
int numbytes = ROM_GETLENGTH(romp);
int groupsize = ROM_GETGROUPSIZE(romp);
int skip = ROM_GETSKIPCOUNT(romp);
int reversed = ROM_ISREVERSED(romp);
int numgroups = (numbytes + groupsize - 1) / groupsize;
UINT8 *base = romdata->regionbase + ROM_GETOFFSET(romp);
UINT32 tempbufsize;
UINT8 *tempbuf;
int i;
LOG(("Loading ROM data: offs=%X len=%X mask=%02X group=%d skip=%d reverse=%d\n", ROM_GETOFFSET(romp), numbytes, datamask, groupsize, skip, reversed));
if (numbytes % groupsize != 0)
fatalerror("Error in RomModule definition: %s length not an even multiple of group size\n", ROM_GETNAME(romp));
if (ROM_GETOFFSET(romp) + numgroups * groupsize + (numgroups - 1) * skip > romdata->regionlength)
fatalerror("Error in RomModule definition: %s out of memory region space\n", ROM_GETNAME(romp));
if (numbytes == 0)
fatalerror("Error in RomModule definition: %s has an invalid length\n", ROM_GETNAME(romp));
if (datamask == 0xff && (groupsize == 1 || !reversed) && skip == 0)
return rom_fread(romdata, base, numbytes);
tempbufsize = MIN(TEMPBUFFER_MAX_SIZE, numbytes);
tempbuf = alloc_array_or_die(UINT8, tempbufsize);
skip += groupsize;
while (numbytes > 0)
{
int evengroupcount = (tempbufsize / groupsize) * groupsize;
int bytesleft = (numbytes > evengroupcount) ? evengroupcount : numbytes;
UINT8 *bufptr = tempbuf;
LOG((" Reading %X bytes into buffer\n", bytesleft));
if (rom_fread(romdata, bufptr, bytesleft) != bytesleft)
{
free(tempbuf);
return 0;
}
numbytes -= bytesleft;
LOG((" Copying to %p\n", base));
if (datamask == 0xff)
{
if (groupsize == 1)
for (i = 0; i < bytesleft; i++, base += skip)
*base = *bufptr++;
else if (!reversed)
while (bytesleft)
{
for (i = 0; i < groupsize && bytesleft; i++, bytesleft--)
base[i] = *bufptr++;
base += skip;
}
else
while (bytesleft)
{
for (i = groupsize - 1; i >= 0 && bytesleft; i--, bytesleft--)
base[i] = *bufptr++;
base += skip;
}
}
else
{
if (groupsize == 1)
for (i = 0; i < bytesleft; i++, base += skip)
*base = (*base & ~datamask) | ((*bufptr++ << datashift) & datamask);
else if (!reversed)
while (bytesleft)
{
for (i = 0; i < groupsize && bytesleft; i++, bytesleft--)
base[i] = (base[i] & ~datamask) | ((*bufptr++ << datashift) & datamask);
base += skip;
}
else
while (bytesleft)
{
for (i = groupsize - 1; i >= 0 && bytesleft; i--, bytesleft--)
base[i] = (base[i] & ~datamask) | ((*bufptr++ << datashift) & datamask);
base += skip;
}
}
}
free(tempbuf);
LOG((" All done\n"));
return ROM_GETLENGTH(romp);
} | [
"static",
"int",
"read_rom_data",
"(",
"rom_load_data",
"*",
"romdata",
",",
"const",
"rom_entry",
"*",
"romp",
")",
"{",
"int",
"datashift",
"=",
"ROM_GETBITSHIFT",
"(",
"romp",
")",
";",
"int",
"datamask",
"=",
"(",
"(",
"1",
"<<",
"ROM_GETBITWIDTH",
"(",
"romp",
")",
")",
"-",
"1",
")",
"<<",
"datashift",
";",
"int",
"numbytes",
"=",
"ROM_GETLENGTH",
"(",
"romp",
")",
";",
"int",
"groupsize",
"=",
"ROM_GETGROUPSIZE",
"(",
"romp",
")",
";",
"int",
"skip",
"=",
"ROM_GETSKIPCOUNT",
"(",
"romp",
")",
";",
"int",
"reversed",
"=",
"ROM_ISREVERSED",
"(",
"romp",
")",
";",
"int",
"numgroups",
"=",
"(",
"numbytes",
"+",
"groupsize",
"-",
"1",
")",
"/",
"groupsize",
";",
"UINT8",
"*",
"base",
"=",
"romdata",
"->",
"regionbase",
"+",
"ROM_GETOFFSET",
"(",
"romp",
")",
";",
"UINT32",
"tempbufsize",
";",
"UINT8",
"*",
"tempbuf",
";",
"int",
"i",
";",
"LOG",
"(",
"(",
"\"",
"\\n",
"\"",
",",
"ROM_GETOFFSET",
"(",
"romp",
")",
",",
"numbytes",
",",
"datamask",
",",
"groupsize",
",",
"skip",
",",
"reversed",
")",
")",
";",
"if",
"(",
"numbytes",
"%",
"groupsize",
"!=",
"0",
")",
"fatalerror",
"(",
"\"",
"\\n",
"\"",
",",
"ROM_GETNAME",
"(",
"romp",
")",
")",
";",
"if",
"(",
"ROM_GETOFFSET",
"(",
"romp",
")",
"+",
"numgroups",
"*",
"groupsize",
"+",
"(",
"numgroups",
"-",
"1",
")",
"*",
"skip",
">",
"romdata",
"->",
"regionlength",
")",
"fatalerror",
"(",
"\"",
"\\n",
"\"",
",",
"ROM_GETNAME",
"(",
"romp",
")",
")",
";",
"if",
"(",
"numbytes",
"==",
"0",
")",
"fatalerror",
"(",
"\"",
"\\n",
"\"",
",",
"ROM_GETNAME",
"(",
"romp",
")",
")",
";",
"if",
"(",
"datamask",
"==",
"0xff",
"&&",
"(",
"groupsize",
"==",
"1",
"||",
"!",
"reversed",
")",
"&&",
"skip",
"==",
"0",
")",
"return",
"rom_fread",
"(",
"romdata",
",",
"base",
",",
"numbytes",
")",
";",
"tempbufsize",
"=",
"MIN",
"(",
"TEMPBUFFER_MAX_SIZE",
",",
"numbytes",
")",
";",
"tempbuf",
"=",
"alloc_array_or_die",
"(",
"UINT8",
",",
"tempbufsize",
")",
";",
"skip",
"+=",
"groupsize",
";",
"while",
"(",
"numbytes",
">",
"0",
")",
"{",
"int",
"evengroupcount",
"=",
"(",
"tempbufsize",
"/",
"groupsize",
")",
"*",
"groupsize",
";",
"int",
"bytesleft",
"=",
"(",
"numbytes",
">",
"evengroupcount",
")",
"?",
"evengroupcount",
":",
"numbytes",
";",
"UINT8",
"*",
"bufptr",
"=",
"tempbuf",
";",
"LOG",
"(",
"(",
"\"",
"\\n",
"\"",
",",
"bytesleft",
")",
")",
";",
"if",
"(",
"rom_fread",
"(",
"romdata",
",",
"bufptr",
",",
"bytesleft",
")",
"!=",
"bytesleft",
")",
"{",
"free",
"(",
"tempbuf",
")",
";",
"return",
"0",
";",
"}",
"numbytes",
"-=",
"bytesleft",
";",
"LOG",
"(",
"(",
"\"",
"\\n",
"\"",
",",
"base",
")",
")",
";",
"if",
"(",
"datamask",
"==",
"0xff",
")",
"{",
"if",
"(",
"groupsize",
"==",
"1",
")",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"bytesleft",
";",
"i",
"++",
",",
"base",
"+=",
"skip",
")",
"*",
"base",
"=",
"*",
"bufptr",
"++",
";",
"else",
"if",
"(",
"!",
"reversed",
")",
"while",
"(",
"bytesleft",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"groupsize",
"&&",
"bytesleft",
";",
"i",
"++",
",",
"bytesleft",
"--",
")",
"base",
"[",
"i",
"]",
"=",
"*",
"bufptr",
"++",
";",
"base",
"+=",
"skip",
";",
"}",
"else",
"while",
"(",
"bytesleft",
")",
"{",
"for",
"(",
"i",
"=",
"groupsize",
"-",
"1",
";",
"i",
">=",
"0",
"&&",
"bytesleft",
";",
"i",
"--",
",",
"bytesleft",
"--",
")",
"base",
"[",
"i",
"]",
"=",
"*",
"bufptr",
"++",
";",
"base",
"+=",
"skip",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"groupsize",
"==",
"1",
")",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"bytesleft",
";",
"i",
"++",
",",
"base",
"+=",
"skip",
")",
"*",
"base",
"=",
"(",
"*",
"base",
"&",
"~",
"datamask",
")",
"|",
"(",
"(",
"*",
"bufptr",
"++",
"<<",
"datashift",
")",
"&",
"datamask",
")",
";",
"else",
"if",
"(",
"!",
"reversed",
")",
"while",
"(",
"bytesleft",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"groupsize",
"&&",
"bytesleft",
";",
"i",
"++",
",",
"bytesleft",
"--",
")",
"base",
"[",
"i",
"]",
"=",
"(",
"base",
"[",
"i",
"]",
"&",
"~",
"datamask",
")",
"|",
"(",
"(",
"*",
"bufptr",
"++",
"<<",
"datashift",
")",
"&",
"datamask",
")",
";",
"base",
"+=",
"skip",
";",
"}",
"else",
"while",
"(",
"bytesleft",
")",
"{",
"for",
"(",
"i",
"=",
"groupsize",
"-",
"1",
";",
"i",
">=",
"0",
"&&",
"bytesleft",
";",
"i",
"--",
",",
"bytesleft",
"--",
")",
"base",
"[",
"i",
"]",
"=",
"(",
"base",
"[",
"i",
"]",
"&",
"~",
"datamask",
")",
"|",
"(",
"(",
"*",
"bufptr",
"++",
"<<",
"datashift",
")",
"&",
"datamask",
")",
";",
"base",
"+=",
"skip",
";",
"}",
"}",
"}",
"free",
"(",
"tempbuf",
")",
";",
"LOG",
"(",
"(",
"\"",
"\\n",
"\"",
")",
")",
";",
"return",
"ROM_GETLENGTH",
"(",
"romp",
")",
";",
"}"
] | read_rom_data - read ROM data for a single
entry | [
"read_rom_data",
"-",
"read",
"ROM",
"data",
"for",
"a",
"single",
"entry"
] | [
"/* make sure the length was an even multiple of the group size */",
"/* make sure we only fill within the region space */",
"/* make sure the length was valid */",
"/* special case for simple loads */",
"/* use a temporary buffer for complex loads */",
"/* chunky reads for complex loads */",
"/* read as much as we can */",
"/* unmasked cases */",
"/* non-grouped data */",
"/* grouped data -- non-reversed case */",
"/* grouped data -- reversed case */",
"/* masked cases */",
"/* non-grouped data */",
"/* grouped data -- non-reversed case */",
"/* grouped data -- reversed case */"
] | [
{
"param": "romdata",
"type": "rom_load_data"
},
{
"param": "romp",
"type": "rom_entry"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "romdata",
"type": "rom_load_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "romp",
"type": "rom_entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860b4a9733bb8979ba3156d258bf5b44ad6494dd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/romload.c | [
"Unlicense"
] | C | copy_rom_data | void | static void copy_rom_data(rom_load_data *romdata, const rom_entry *romp)
{
UINT8 *base = romdata->regionbase + ROM_GETOFFSET(romp);
const char *srcrgntag = ROM_GETNAME(romp);
UINT32 numbytes = ROM_GETLENGTH(romp);
UINT32 srcoffs = (FPTR)ROM_GETHASHDATA(romp); /* srcoffset in place of hashdata */
UINT8 *srcbase;
/* make sure we copy within the region space */
if (ROM_GETOFFSET(romp) + numbytes > romdata->regionlength)
fatalerror("Error in RomModule definition: COPY out of target memory region space\n");
/* make sure the length was valid */
if (numbytes == 0)
fatalerror("Error in RomModule definition: COPY has an invalid length\n");
/* make sure the source was valid */
srcbase = memory_region(romdata->machine, srcrgntag);
if (srcbase == NULL)
fatalerror("Error in RomModule definition: COPY from an invalid region\n");
/* make sure we find within the region space */
if (srcoffs + numbytes > memory_region_length(romdata->machine, srcrgntag))
fatalerror("Error in RomModule definition: COPY out of source memory region space\n");
/* fill the data */
memcpy(base, srcbase + srcoffs, numbytes);
} | /*-------------------------------------------------
copy_rom_data - copy a region of ROM space
-------------------------------------------------*/ | copy a region of ROM space | [
"copy",
"a",
"region",
"of",
"ROM",
"space"
] | static void copy_rom_data(rom_load_data *romdata, const rom_entry *romp)
{
UINT8 *base = romdata->regionbase + ROM_GETOFFSET(romp);
const char *srcrgntag = ROM_GETNAME(romp);
UINT32 numbytes = ROM_GETLENGTH(romp);
UINT32 srcoffs = (FPTR)ROM_GETHASHDATA(romp);
UINT8 *srcbase;
if (ROM_GETOFFSET(romp) + numbytes > romdata->regionlength)
fatalerror("Error in RomModule definition: COPY out of target memory region space\n");
if (numbytes == 0)
fatalerror("Error in RomModule definition: COPY has an invalid length\n");
srcbase = memory_region(romdata->machine, srcrgntag);
if (srcbase == NULL)
fatalerror("Error in RomModule definition: COPY from an invalid region\n");
if (srcoffs + numbytes > memory_region_length(romdata->machine, srcrgntag))
fatalerror("Error in RomModule definition: COPY out of source memory region space\n");
memcpy(base, srcbase + srcoffs, numbytes);
} | [
"static",
"void",
"copy_rom_data",
"(",
"rom_load_data",
"*",
"romdata",
",",
"const",
"rom_entry",
"*",
"romp",
")",
"{",
"UINT8",
"*",
"base",
"=",
"romdata",
"->",
"regionbase",
"+",
"ROM_GETOFFSET",
"(",
"romp",
")",
";",
"const",
"char",
"*",
"srcrgntag",
"=",
"ROM_GETNAME",
"(",
"romp",
")",
";",
"UINT32",
"numbytes",
"=",
"ROM_GETLENGTH",
"(",
"romp",
")",
";",
"UINT32",
"srcoffs",
"=",
"(",
"FPTR",
")",
"ROM_GETHASHDATA",
"(",
"romp",
")",
";",
"UINT8",
"*",
"srcbase",
";",
"if",
"(",
"ROM_GETOFFSET",
"(",
"romp",
")",
"+",
"numbytes",
">",
"romdata",
"->",
"regionlength",
")",
"fatalerror",
"(",
"\"",
"\\n",
"\"",
")",
";",
"if",
"(",
"numbytes",
"==",
"0",
")",
"fatalerror",
"(",
"\"",
"\\n",
"\"",
")",
";",
"srcbase",
"=",
"memory_region",
"(",
"romdata",
"->",
"machine",
",",
"srcrgntag",
")",
";",
"if",
"(",
"srcbase",
"==",
"NULL",
")",
"fatalerror",
"(",
"\"",
"\\n",
"\"",
")",
";",
"if",
"(",
"srcoffs",
"+",
"numbytes",
">",
"memory_region_length",
"(",
"romdata",
"->",
"machine",
",",
"srcrgntag",
")",
")",
"fatalerror",
"(",
"\"",
"\\n",
"\"",
")",
";",
"memcpy",
"(",
"base",
",",
"srcbase",
"+",
"srcoffs",
",",
"numbytes",
")",
";",
"}"
] | copy_rom_data - copy a region of ROM space | [
"copy_rom_data",
"-",
"copy",
"a",
"region",
"of",
"ROM",
"space"
] | [
"/* srcoffset in place of hashdata */",
"/* make sure we copy within the region space */",
"/* make sure the length was valid */",
"/* make sure the source was valid */",
"/* make sure we find within the region space */",
"/* fill the data */"
] | [
{
"param": "romdata",
"type": "rom_load_data"
},
{
"param": "romp",
"type": "rom_entry"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "romdata",
"type": "rom_load_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "romp",
"type": "rom_entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860b4a9733bb8979ba3156d258bf5b44ad6494dd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/romload.c | [
"Unlicense"
] | C | process_rom_entries | void | static void process_rom_entries(rom_load_data *romdata, const char *regiontag, const rom_entry *romp)
{
UINT32 lastflags = 0;
/* loop until we hit the end of this region */
while (!ROMENTRY_ISREGIONEND(romp))
{
/* if this is a continue entry, it's invalid */
if (ROMENTRY_ISCONTINUE(romp))
fatalerror("Error in RomModule definition: ROM_CONTINUE not preceded by ROM_LOAD\n");
/* if this is an ignore entry, it's invalid */
if (ROMENTRY_ISIGNORE(romp))
fatalerror("Error in RomModule definition: ROM_IGNORE not preceded by ROM_LOAD\n");
/* if this is a reload entry, it's invalid */
if (ROMENTRY_ISRELOAD(romp))
fatalerror("Error in RomModule definition: ROM_RELOAD not preceded by ROM_LOAD\n");
/* handle fills */
if (ROMENTRY_ISFILL(romp))
fill_rom_data(romdata, romp++);
/* handle copies */
else if (ROMENTRY_ISCOPY(romp))
copy_rom_data(romdata, romp++);
/* handle files */
else if (ROMENTRY_ISFILE(romp))
{
int irrelevantbios = (ROM_GETBIOSFLAGS(romp) != 0 && ROM_GETBIOSFLAGS(romp) != romdata->system_bios);
const rom_entry *baserom = romp;
int explength = 0;
/* open the file if it is a non-BIOS or matches the current BIOS */
LOG(("Opening ROM file: %s\n", ROM_GETNAME(romp)));
if (!irrelevantbios && !open_rom_file(romdata, regiontag, romp))
handle_missing_file(romdata, romp);
/* loop until we run out of reloads */
do
{
/* loop until we run out of continues/ignores */
do
{
rom_entry modified_romp = *romp++;
int readresult;
/* handle flag inheritance */
if (!ROM_INHERITSFLAGS(&modified_romp))
lastflags = modified_romp._flags;
else
modified_romp._flags = (modified_romp._flags & ~ROM_INHERITEDFLAGS) | lastflags;
explength += ROM_GETLENGTH(&modified_romp);
/* attempt to read using the modified entry */
if (!ROMENTRY_ISIGNORE(&modified_romp) && !irrelevantbios)
readresult = read_rom_data(romdata, &modified_romp);
}
while (ROMENTRY_ISCONTINUE(romp) || ROMENTRY_ISIGNORE(romp));
/* if this was the first use of this file, verify the length and CRC */
if (baserom)
{
LOG(("Verifying length (%X) and checksums\n", explength));
verify_length_and_hash(romdata, ROM_GETNAME(baserom), explength, ROM_GETHASHDATA(baserom));
LOG(("Verify finished\n"));
}
/* reseek to the start and clear the baserom so we don't reverify */
if (romdata->file != NULL)
mame_fseek(romdata->file, 0, SEEK_SET);
baserom = NULL;
explength = 0;
}
while (ROMENTRY_ISRELOAD(romp));
/* close the file */
if (romdata->file != NULL)
{
LOG(("Closing ROM file\n"));
mame_fclose(romdata->file);
romdata->file = NULL;
}
}
else
{
romp++; /* something else; skip */
}
}
} | /*-------------------------------------------------
process_rom_entries - process all ROM entries
for a region
-------------------------------------------------*/ | process all ROM entries
for a region | [
"process",
"all",
"ROM",
"entries",
"for",
"a",
"region"
] | static void process_rom_entries(rom_load_data *romdata, const char *regiontag, const rom_entry *romp)
{
UINT32 lastflags = 0;
while (!ROMENTRY_ISREGIONEND(romp))
{
if (ROMENTRY_ISCONTINUE(romp))
fatalerror("Error in RomModule definition: ROM_CONTINUE not preceded by ROM_LOAD\n");
if (ROMENTRY_ISIGNORE(romp))
fatalerror("Error in RomModule definition: ROM_IGNORE not preceded by ROM_LOAD\n");
if (ROMENTRY_ISRELOAD(romp))
fatalerror("Error in RomModule definition: ROM_RELOAD not preceded by ROM_LOAD\n");
if (ROMENTRY_ISFILL(romp))
fill_rom_data(romdata, romp++);
else if (ROMENTRY_ISCOPY(romp))
copy_rom_data(romdata, romp++);
else if (ROMENTRY_ISFILE(romp))
{
int irrelevantbios = (ROM_GETBIOSFLAGS(romp) != 0 && ROM_GETBIOSFLAGS(romp) != romdata->system_bios);
const rom_entry *baserom = romp;
int explength = 0;
LOG(("Opening ROM file: %s\n", ROM_GETNAME(romp)));
if (!irrelevantbios && !open_rom_file(romdata, regiontag, romp))
handle_missing_file(romdata, romp);
do
{
do
{
rom_entry modified_romp = *romp++;
int readresult;
if (!ROM_INHERITSFLAGS(&modified_romp))
lastflags = modified_romp._flags;
else
modified_romp._flags = (modified_romp._flags & ~ROM_INHERITEDFLAGS) | lastflags;
explength += ROM_GETLENGTH(&modified_romp);
if (!ROMENTRY_ISIGNORE(&modified_romp) && !irrelevantbios)
readresult = read_rom_data(romdata, &modified_romp);
}
while (ROMENTRY_ISCONTINUE(romp) || ROMENTRY_ISIGNORE(romp));
if (baserom)
{
LOG(("Verifying length (%X) and checksums\n", explength));
verify_length_and_hash(romdata, ROM_GETNAME(baserom), explength, ROM_GETHASHDATA(baserom));
LOG(("Verify finished\n"));
}
if (romdata->file != NULL)
mame_fseek(romdata->file, 0, SEEK_SET);
baserom = NULL;
explength = 0;
}
while (ROMENTRY_ISRELOAD(romp));
if (romdata->file != NULL)
{
LOG(("Closing ROM file\n"));
mame_fclose(romdata->file);
romdata->file = NULL;
}
}
else
{
romp++;
}
}
} | [
"static",
"void",
"process_rom_entries",
"(",
"rom_load_data",
"*",
"romdata",
",",
"const",
"char",
"*",
"regiontag",
",",
"const",
"rom_entry",
"*",
"romp",
")",
"{",
"UINT32",
"lastflags",
"=",
"0",
";",
"while",
"(",
"!",
"ROMENTRY_ISREGIONEND",
"(",
"romp",
")",
")",
"{",
"if",
"(",
"ROMENTRY_ISCONTINUE",
"(",
"romp",
")",
")",
"fatalerror",
"(",
"\"",
"\\n",
"\"",
")",
";",
"if",
"(",
"ROMENTRY_ISIGNORE",
"(",
"romp",
")",
")",
"fatalerror",
"(",
"\"",
"\\n",
"\"",
")",
";",
"if",
"(",
"ROMENTRY_ISRELOAD",
"(",
"romp",
")",
")",
"fatalerror",
"(",
"\"",
"\\n",
"\"",
")",
";",
"if",
"(",
"ROMENTRY_ISFILL",
"(",
"romp",
")",
")",
"fill_rom_data",
"(",
"romdata",
",",
"romp",
"++",
")",
";",
"else",
"if",
"(",
"ROMENTRY_ISCOPY",
"(",
"romp",
")",
")",
"copy_rom_data",
"(",
"romdata",
",",
"romp",
"++",
")",
";",
"else",
"if",
"(",
"ROMENTRY_ISFILE",
"(",
"romp",
")",
")",
"{",
"int",
"irrelevantbios",
"=",
"(",
"ROM_GETBIOSFLAGS",
"(",
"romp",
")",
"!=",
"0",
"&&",
"ROM_GETBIOSFLAGS",
"(",
"romp",
")",
"!=",
"romdata",
"->",
"system_bios",
")",
";",
"const",
"rom_entry",
"*",
"baserom",
"=",
"romp",
";",
"int",
"explength",
"=",
"0",
";",
"LOG",
"(",
"(",
"\"",
"\\n",
"\"",
",",
"ROM_GETNAME",
"(",
"romp",
")",
")",
")",
";",
"if",
"(",
"!",
"irrelevantbios",
"&&",
"!",
"open_rom_file",
"(",
"romdata",
",",
"regiontag",
",",
"romp",
")",
")",
"handle_missing_file",
"(",
"romdata",
",",
"romp",
")",
";",
"do",
"{",
"do",
"{",
"rom_entry",
"modified_romp",
"=",
"*",
"romp",
"++",
";",
"int",
"readresult",
";",
"if",
"(",
"!",
"ROM_INHERITSFLAGS",
"(",
"&",
"modified_romp",
")",
")",
"lastflags",
"=",
"modified_romp",
".",
"_flags",
";",
"else",
"modified_romp",
".",
"_flags",
"=",
"(",
"modified_romp",
".",
"_flags",
"&",
"~",
"ROM_INHERITEDFLAGS",
")",
"|",
"lastflags",
";",
"explength",
"+=",
"ROM_GETLENGTH",
"(",
"&",
"modified_romp",
")",
";",
"if",
"(",
"!",
"ROMENTRY_ISIGNORE",
"(",
"&",
"modified_romp",
")",
"&&",
"!",
"irrelevantbios",
")",
"readresult",
"=",
"read_rom_data",
"(",
"romdata",
",",
"&",
"modified_romp",
")",
";",
"}",
"while",
"(",
"ROMENTRY_ISCONTINUE",
"(",
"romp",
")",
"||",
"ROMENTRY_ISIGNORE",
"(",
"romp",
")",
")",
";",
"if",
"(",
"baserom",
")",
"{",
"LOG",
"(",
"(",
"\"",
"\\n",
"\"",
",",
"explength",
")",
")",
";",
"verify_length_and_hash",
"(",
"romdata",
",",
"ROM_GETNAME",
"(",
"baserom",
")",
",",
"explength",
",",
"ROM_GETHASHDATA",
"(",
"baserom",
")",
")",
";",
"LOG",
"(",
"(",
"\"",
"\\n",
"\"",
")",
")",
";",
"}",
"if",
"(",
"romdata",
"->",
"file",
"!=",
"NULL",
")",
"mame_fseek",
"(",
"romdata",
"->",
"file",
",",
"0",
",",
"SEEK_SET",
")",
";",
"baserom",
"=",
"NULL",
";",
"explength",
"=",
"0",
";",
"}",
"while",
"(",
"ROMENTRY_ISRELOAD",
"(",
"romp",
")",
")",
";",
"if",
"(",
"romdata",
"->",
"file",
"!=",
"NULL",
")",
"{",
"LOG",
"(",
"(",
"\"",
"\\n",
"\"",
")",
")",
";",
"mame_fclose",
"(",
"romdata",
"->",
"file",
")",
";",
"romdata",
"->",
"file",
"=",
"NULL",
";",
"}",
"}",
"else",
"{",
"romp",
"++",
";",
"}",
"}",
"}"
] | process_rom_entries - process all ROM entries
for a region | [
"process_rom_entries",
"-",
"process",
"all",
"ROM",
"entries",
"for",
"a",
"region"
] | [
"/* loop until we hit the end of this region */",
"/* if this is a continue entry, it's invalid */",
"/* if this is an ignore entry, it's invalid */",
"/* if this is a reload entry, it's invalid */",
"/* handle fills */",
"/* handle copies */",
"/* handle files */",
"/* open the file if it is a non-BIOS or matches the current BIOS */",
"/* loop until we run out of reloads */",
"/* loop until we run out of continues/ignores */",
"/* handle flag inheritance */",
"/* attempt to read using the modified entry */",
"/* if this was the first use of this file, verify the length and CRC */",
"/* reseek to the start and clear the baserom so we don't reverify */",
"/* close the file */",
"/* something else; skip */"
] | [
{
"param": "romdata",
"type": "rom_load_data"
},
{
"param": "regiontag",
"type": "char"
},
{
"param": "romp",
"type": "rom_entry"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "romdata",
"type": "rom_load_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "regiontag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "romp",
"type": "rom_entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860b4a9733bb8979ba3156d258bf5b44ad6494dd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/romload.c | [
"Unlicense"
] | C | open_disk_image_options | chd_error | chd_error open_disk_image_options(core_options *options, const game_driver *gamedrv, const rom_entry *romp, mame_file **image_file, chd_file **image_chd)
{
const game_driver *drv, *searchdrv;
const rom_entry *region, *rom;
const rom_source *source;
file_error filerr;
chd_error err;
*image_file = NULL;
*image_chd = NULL;
/* attempt to open the properly named file, scanning up through parent directories */
filerr = FILERR_NOT_FOUND;
for (searchdrv = gamedrv; searchdrv != NULL && filerr != FILERR_NONE; searchdrv = driver_get_clone(searchdrv))
{
astring *fname = astring_assemble_4(astring_alloc(), searchdrv->name, PATH_SEPARATOR, ROM_GETNAME(romp), ".chd");
filerr = mame_fopen_options(options, SEARCHPATH_IMAGE, astring_c(fname), OPEN_FLAG_READ, image_file);
astring_free(fname);
}
if (filerr != FILERR_NONE)
{
astring *fname = astring_assemble_2(astring_alloc(), ROM_GETNAME(romp), ".chd");
filerr = mame_fopen_options(options, SEARCHPATH_IMAGE, astring_c(fname), OPEN_FLAG_READ, image_file);
astring_free(fname);
}
/* did the file open succeed? */
if (filerr == FILERR_NONE)
{
/* try to open the CHD */
err = chd_open_file(mame_core_file(*image_file), CHD_OPEN_READ, NULL, image_chd);
if (err == CHDERR_NONE)
return err;
/* close the file on failure */
mame_fclose(*image_file);
*image_file = NULL;
}
else
err = CHDERR_FILE_NOT_FOUND;
/* otherwise, look at our parents for a CHD with an identical checksum */
/* and try to open that */
for (drv = gamedrv; drv != NULL; drv = driver_get_clone(drv))
for (source = rom_first_source(drv, NULL); source != NULL; source = rom_next_source(drv, NULL, source))
for (region = rom_first_region(drv, source); region != NULL; region = rom_next_region(region))
if (ROMREGION_ISDISKDATA(region))
for (rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom))
/* look for a differing name but with the same hash data */
if (strcmp(ROM_GETNAME(romp), ROM_GETNAME(rom)) != 0 &&
hash_data_is_equal(ROM_GETHASHDATA(romp), ROM_GETHASHDATA(rom), 0))
{
/* attempt to open the properly named file, scanning up through parent directories */
filerr = FILERR_NOT_FOUND;
for (searchdrv = drv; searchdrv != NULL && filerr != FILERR_NONE; searchdrv = driver_get_clone(searchdrv))
{
astring *fname = astring_assemble_4(astring_alloc(), searchdrv->name, PATH_SEPARATOR, ROM_GETNAME(rom), ".chd");
filerr = mame_fopen_options(options, SEARCHPATH_IMAGE, astring_c(fname), OPEN_FLAG_READ, image_file);
astring_free(fname);
}
if (filerr != FILERR_NONE)
{
astring *fname = astring_assemble_2(astring_alloc(), ROM_GETNAME(rom), ".chd");
filerr = mame_fopen_options(options, SEARCHPATH_IMAGE, astring_c(fname), OPEN_FLAG_READ, image_file);
astring_free(fname);
}
/* did the file open succeed? */
if (filerr == FILERR_NONE)
{
/* try to open the CHD */
err = chd_open_file(mame_core_file(*image_file), CHD_OPEN_READ, NULL, image_chd);
if (err == CHDERR_NONE)
return err;
/* close the file on failure */
mame_fclose(*image_file);
*image_file = NULL;
}
}
return err;
} | /*-------------------------------------------------
open_disk_image_options - open a disk image,
searching up the parent and loading by
checksum
-------------------------------------------------*/ | open a disk image,
searching up the parent and loading by
checksum | [
"open",
"a",
"disk",
"image",
"searching",
"up",
"the",
"parent",
"and",
"loading",
"by",
"checksum"
] | chd_error open_disk_image_options(core_options *options, const game_driver *gamedrv, const rom_entry *romp, mame_file **image_file, chd_file **image_chd)
{
const game_driver *drv, *searchdrv;
const rom_entry *region, *rom;
const rom_source *source;
file_error filerr;
chd_error err;
*image_file = NULL;
*image_chd = NULL;
filerr = FILERR_NOT_FOUND;
for (searchdrv = gamedrv; searchdrv != NULL && filerr != FILERR_NONE; searchdrv = driver_get_clone(searchdrv))
{
astring *fname = astring_assemble_4(astring_alloc(), searchdrv->name, PATH_SEPARATOR, ROM_GETNAME(romp), ".chd");
filerr = mame_fopen_options(options, SEARCHPATH_IMAGE, astring_c(fname), OPEN_FLAG_READ, image_file);
astring_free(fname);
}
if (filerr != FILERR_NONE)
{
astring *fname = astring_assemble_2(astring_alloc(), ROM_GETNAME(romp), ".chd");
filerr = mame_fopen_options(options, SEARCHPATH_IMAGE, astring_c(fname), OPEN_FLAG_READ, image_file);
astring_free(fname);
}
if (filerr == FILERR_NONE)
{
err = chd_open_file(mame_core_file(*image_file), CHD_OPEN_READ, NULL, image_chd);
if (err == CHDERR_NONE)
return err;
mame_fclose(*image_file);
*image_file = NULL;
}
else
err = CHDERR_FILE_NOT_FOUND;
for (drv = gamedrv; drv != NULL; drv = driver_get_clone(drv))
for (source = rom_first_source(drv, NULL); source != NULL; source = rom_next_source(drv, NULL, source))
for (region = rom_first_region(drv, source); region != NULL; region = rom_next_region(region))
if (ROMREGION_ISDISKDATA(region))
for (rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom))
if (strcmp(ROM_GETNAME(romp), ROM_GETNAME(rom)) != 0 &&
hash_data_is_equal(ROM_GETHASHDATA(romp), ROM_GETHASHDATA(rom), 0))
{
filerr = FILERR_NOT_FOUND;
for (searchdrv = drv; searchdrv != NULL && filerr != FILERR_NONE; searchdrv = driver_get_clone(searchdrv))
{
astring *fname = astring_assemble_4(astring_alloc(), searchdrv->name, PATH_SEPARATOR, ROM_GETNAME(rom), ".chd");
filerr = mame_fopen_options(options, SEARCHPATH_IMAGE, astring_c(fname), OPEN_FLAG_READ, image_file);
astring_free(fname);
}
if (filerr != FILERR_NONE)
{
astring *fname = astring_assemble_2(astring_alloc(), ROM_GETNAME(rom), ".chd");
filerr = mame_fopen_options(options, SEARCHPATH_IMAGE, astring_c(fname), OPEN_FLAG_READ, image_file);
astring_free(fname);
}
if (filerr == FILERR_NONE)
{
err = chd_open_file(mame_core_file(*image_file), CHD_OPEN_READ, NULL, image_chd);
if (err == CHDERR_NONE)
return err;
mame_fclose(*image_file);
*image_file = NULL;
}
}
return err;
} | [
"chd_error",
"open_disk_image_options",
"(",
"core_options",
"*",
"options",
",",
"const",
"game_driver",
"*",
"gamedrv",
",",
"const",
"rom_entry",
"*",
"romp",
",",
"mame_file",
"*",
"*",
"image_file",
",",
"chd_file",
"*",
"*",
"image_chd",
")",
"{",
"const",
"game_driver",
"*",
"drv",
",",
"*",
"searchdrv",
";",
"const",
"rom_entry",
"*",
"region",
",",
"*",
"rom",
";",
"const",
"rom_source",
"*",
"source",
";",
"file_error",
"filerr",
";",
"chd_error",
"err",
";",
"*",
"image_file",
"=",
"NULL",
";",
"*",
"image_chd",
"=",
"NULL",
";",
"filerr",
"=",
"FILERR_NOT_FOUND",
";",
"for",
"(",
"searchdrv",
"=",
"gamedrv",
";",
"searchdrv",
"!=",
"NULL",
"&&",
"filerr",
"!=",
"FILERR_NONE",
";",
"searchdrv",
"=",
"driver_get_clone",
"(",
"searchdrv",
")",
")",
"{",
"astring",
"*",
"fname",
"=",
"astring_assemble_4",
"(",
"astring_alloc",
"(",
")",
",",
"searchdrv",
"->",
"name",
",",
"PATH_SEPARATOR",
",",
"ROM_GETNAME",
"(",
"romp",
")",
",",
"\"",
"\"",
")",
";",
"filerr",
"=",
"mame_fopen_options",
"(",
"options",
",",
"SEARCHPATH_IMAGE",
",",
"astring_c",
"(",
"fname",
")",
",",
"OPEN_FLAG_READ",
",",
"image_file",
")",
";",
"astring_free",
"(",
"fname",
")",
";",
"}",
"if",
"(",
"filerr",
"!=",
"FILERR_NONE",
")",
"{",
"astring",
"*",
"fname",
"=",
"astring_assemble_2",
"(",
"astring_alloc",
"(",
")",
",",
"ROM_GETNAME",
"(",
"romp",
")",
",",
"\"",
"\"",
")",
";",
"filerr",
"=",
"mame_fopen_options",
"(",
"options",
",",
"SEARCHPATH_IMAGE",
",",
"astring_c",
"(",
"fname",
")",
",",
"OPEN_FLAG_READ",
",",
"image_file",
")",
";",
"astring_free",
"(",
"fname",
")",
";",
"}",
"if",
"(",
"filerr",
"==",
"FILERR_NONE",
")",
"{",
"err",
"=",
"chd_open_file",
"(",
"mame_core_file",
"(",
"*",
"image_file",
")",
",",
"CHD_OPEN_READ",
",",
"NULL",
",",
"image_chd",
")",
";",
"if",
"(",
"err",
"==",
"CHDERR_NONE",
")",
"return",
"err",
";",
"mame_fclose",
"(",
"*",
"image_file",
")",
";",
"*",
"image_file",
"=",
"NULL",
";",
"}",
"else",
"err",
"=",
"CHDERR_FILE_NOT_FOUND",
";",
"for",
"(",
"drv",
"=",
"gamedrv",
";",
"drv",
"!=",
"NULL",
";",
"drv",
"=",
"driver_get_clone",
"(",
"drv",
")",
")",
"for",
"(",
"source",
"=",
"rom_first_source",
"(",
"drv",
",",
"NULL",
")",
";",
"source",
"!=",
"NULL",
";",
"source",
"=",
"rom_next_source",
"(",
"drv",
",",
"NULL",
",",
"source",
")",
")",
"for",
"(",
"region",
"=",
"rom_first_region",
"(",
"drv",
",",
"source",
")",
";",
"region",
"!=",
"NULL",
";",
"region",
"=",
"rom_next_region",
"(",
"region",
")",
")",
"if",
"(",
"ROMREGION_ISDISKDATA",
"(",
"region",
")",
")",
"for",
"(",
"rom",
"=",
"rom_first_file",
"(",
"region",
")",
";",
"rom",
"!=",
"NULL",
";",
"rom",
"=",
"rom_next_file",
"(",
"rom",
")",
")",
"if",
"(",
"strcmp",
"(",
"ROM_GETNAME",
"(",
"romp",
")",
",",
"ROM_GETNAME",
"(",
"rom",
")",
")",
"!=",
"0",
"&&",
"hash_data_is_equal",
"(",
"ROM_GETHASHDATA",
"(",
"romp",
")",
",",
"ROM_GETHASHDATA",
"(",
"rom",
")",
",",
"0",
")",
")",
"{",
"filerr",
"=",
"FILERR_NOT_FOUND",
";",
"for",
"(",
"searchdrv",
"=",
"drv",
";",
"searchdrv",
"!=",
"NULL",
"&&",
"filerr",
"!=",
"FILERR_NONE",
";",
"searchdrv",
"=",
"driver_get_clone",
"(",
"searchdrv",
")",
")",
"{",
"astring",
"*",
"fname",
"=",
"astring_assemble_4",
"(",
"astring_alloc",
"(",
")",
",",
"searchdrv",
"->",
"name",
",",
"PATH_SEPARATOR",
",",
"ROM_GETNAME",
"(",
"rom",
")",
",",
"\"",
"\"",
")",
";",
"filerr",
"=",
"mame_fopen_options",
"(",
"options",
",",
"SEARCHPATH_IMAGE",
",",
"astring_c",
"(",
"fname",
")",
",",
"OPEN_FLAG_READ",
",",
"image_file",
")",
";",
"astring_free",
"(",
"fname",
")",
";",
"}",
"if",
"(",
"filerr",
"!=",
"FILERR_NONE",
")",
"{",
"astring",
"*",
"fname",
"=",
"astring_assemble_2",
"(",
"astring_alloc",
"(",
")",
",",
"ROM_GETNAME",
"(",
"rom",
")",
",",
"\"",
"\"",
")",
";",
"filerr",
"=",
"mame_fopen_options",
"(",
"options",
",",
"SEARCHPATH_IMAGE",
",",
"astring_c",
"(",
"fname",
")",
",",
"OPEN_FLAG_READ",
",",
"image_file",
")",
";",
"astring_free",
"(",
"fname",
")",
";",
"}",
"if",
"(",
"filerr",
"==",
"FILERR_NONE",
")",
"{",
"err",
"=",
"chd_open_file",
"(",
"mame_core_file",
"(",
"*",
"image_file",
")",
",",
"CHD_OPEN_READ",
",",
"NULL",
",",
"image_chd",
")",
";",
"if",
"(",
"err",
"==",
"CHDERR_NONE",
")",
"return",
"err",
";",
"mame_fclose",
"(",
"*",
"image_file",
")",
";",
"*",
"image_file",
"=",
"NULL",
";",
"}",
"}",
"return",
"err",
";",
"}"
] | open_disk_image_options - open a disk image,
searching up the parent and loading by
checksum | [
"open_disk_image_options",
"-",
"open",
"a",
"disk",
"image",
"searching",
"up",
"the",
"parent",
"and",
"loading",
"by",
"checksum"
] | [
"/* attempt to open the properly named file, scanning up through parent directories */",
"/* did the file open succeed? */",
"/* try to open the CHD */",
"/* close the file on failure */",
"/* otherwise, look at our parents for a CHD with an identical checksum */",
"/* and try to open that */",
"/* look for a differing name but with the same hash data */",
"/* attempt to open the properly named file, scanning up through parent directories */",
"/* did the file open succeed? */",
"/* try to open the CHD */",
"/* close the file on failure */"
] | [
{
"param": "options",
"type": "core_options"
},
{
"param": "gamedrv",
"type": "game_driver"
},
{
"param": "romp",
"type": "rom_entry"
},
{
"param": "image_file",
"type": "mame_file"
},
{
"param": "image_chd",
"type": "chd_file"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "options",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gamedrv",
"type": "game_driver",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "romp",
"type": "rom_entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "image_file",
"type": "mame_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "image_chd",
"type": "chd_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860b4a9733bb8979ba3156d258bf5b44ad6494dd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/romload.c | [
"Unlicense"
] | C | process_disk_entries | void | static void process_disk_entries(rom_load_data *romdata, const char *regiontag, const rom_entry *romp)
{
astring *filename = astring_alloc();
/* loop until we hit the end of this region */
for ( ; !ROMENTRY_ISREGIONEND(romp); romp++)
{
/* handle files */
if (ROMENTRY_ISFILE(romp))
{
char acthash[HASH_BUF_SIZE];
open_chd chd = { 0 };
chd_header header;
chd_error err;
/* note the region we are in */
chd.region = regiontag;
/* make the filename of the source */
filename = astring_assemble_2(filename, ROM_GETNAME(romp), ".chd");
/* first open the source drive */
LOG(("Opening disk image: %s\n", astring_c(filename)));
err = open_disk_image(romdata->machine->gamedrv, romp, &chd.origfile, &chd.origchd);
if (err != CHDERR_NONE)
{
if (err == CHDERR_FILE_NOT_FOUND)
astring_catprintf(romdata->errorstring, "%s NOT FOUND\n", astring_c(filename));
else
astring_catprintf(romdata->errorstring, "%s CHD ERROR: %s\n", astring_c(filename), chd_error_string(err));
/* if this is NO_DUMP, keep going, though the system may not be able to handle it */
if (hash_data_has_info(ROM_GETHASHDATA(romp), HASH_INFO_NO_DUMP) || DISK_ISOPTIONAL(romp))
romdata->warnings++;
else
romdata->errors++;
continue;
}
/* get the header and extract the MD5/SHA1 */
header = *chd_get_header(chd.origchd);
hash_data_clear(acthash);
hash_data_insert_binary_checksum(acthash, HASH_SHA1, header.sha1);
/* verify the hash */
if (!hash_data_is_equal(ROM_GETHASHDATA(romp), acthash, 0))
{
astring_catprintf(romdata->errorstring, "%s WRONG CHECKSUMS:\n", astring_c(filename));
dump_wrong_and_correct_checksums(romdata, ROM_GETHASHDATA(romp), acthash);
romdata->warnings++;
}
else if (hash_data_has_info(ROM_GETHASHDATA(romp), HASH_INFO_BAD_DUMP))
{
astring_catprintf(romdata->errorstring, "%s CHD NEEDS REDUMP\n", astring_c(filename));
romdata->warnings++;
}
/* if not read-only, make the diff file */
if (!DISK_ISREADONLY(romp))
{
/* try to open or create the diff */
err = open_disk_diff(romdata->machine->gamedrv, romp, chd.origchd, &chd.difffile, &chd.diffchd);
if (err != CHDERR_NONE)
{
astring_catprintf(romdata->errorstring, "%s DIFF CHD ERROR: %s\n", astring_c(filename), chd_error_string(err));
romdata->errors++;
continue;
}
}
/* we're okay, add to the list of disks */
LOG(("Assigning to handle %d\n", DISK_GETINDEX(romp)));
add_disk_handle(romdata->machine, &chd);
}
}
astring_free(filename);
} | /*-------------------------------------------------
process_disk_entries - process all disk entries
for a region
-------------------------------------------------*/ | process all disk entries
for a region | [
"process",
"all",
"disk",
"entries",
"for",
"a",
"region"
] | static void process_disk_entries(rom_load_data *romdata, const char *regiontag, const rom_entry *romp)
{
astring *filename = astring_alloc();
for ( ; !ROMENTRY_ISREGIONEND(romp); romp++)
{
if (ROMENTRY_ISFILE(romp))
{
char acthash[HASH_BUF_SIZE];
open_chd chd = { 0 };
chd_header header;
chd_error err;
chd.region = regiontag;
filename = astring_assemble_2(filename, ROM_GETNAME(romp), ".chd");
LOG(("Opening disk image: %s\n", astring_c(filename)));
err = open_disk_image(romdata->machine->gamedrv, romp, &chd.origfile, &chd.origchd);
if (err != CHDERR_NONE)
{
if (err == CHDERR_FILE_NOT_FOUND)
astring_catprintf(romdata->errorstring, "%s NOT FOUND\n", astring_c(filename));
else
astring_catprintf(romdata->errorstring, "%s CHD ERROR: %s\n", astring_c(filename), chd_error_string(err));
if (hash_data_has_info(ROM_GETHASHDATA(romp), HASH_INFO_NO_DUMP) || DISK_ISOPTIONAL(romp))
romdata->warnings++;
else
romdata->errors++;
continue;
}
header = *chd_get_header(chd.origchd);
hash_data_clear(acthash);
hash_data_insert_binary_checksum(acthash, HASH_SHA1, header.sha1);
if (!hash_data_is_equal(ROM_GETHASHDATA(romp), acthash, 0))
{
astring_catprintf(romdata->errorstring, "%s WRONG CHECKSUMS:\n", astring_c(filename));
dump_wrong_and_correct_checksums(romdata, ROM_GETHASHDATA(romp), acthash);
romdata->warnings++;
}
else if (hash_data_has_info(ROM_GETHASHDATA(romp), HASH_INFO_BAD_DUMP))
{
astring_catprintf(romdata->errorstring, "%s CHD NEEDS REDUMP\n", astring_c(filename));
romdata->warnings++;
}
if (!DISK_ISREADONLY(romp))
{
err = open_disk_diff(romdata->machine->gamedrv, romp, chd.origchd, &chd.difffile, &chd.diffchd);
if (err != CHDERR_NONE)
{
astring_catprintf(romdata->errorstring, "%s DIFF CHD ERROR: %s\n", astring_c(filename), chd_error_string(err));
romdata->errors++;
continue;
}
}
LOG(("Assigning to handle %d\n", DISK_GETINDEX(romp)));
add_disk_handle(romdata->machine, &chd);
}
}
astring_free(filename);
} | [
"static",
"void",
"process_disk_entries",
"(",
"rom_load_data",
"*",
"romdata",
",",
"const",
"char",
"*",
"regiontag",
",",
"const",
"rom_entry",
"*",
"romp",
")",
"{",
"astring",
"*",
"filename",
"=",
"astring_alloc",
"(",
")",
";",
"for",
"(",
";",
"!",
"ROMENTRY_ISREGIONEND",
"(",
"romp",
")",
";",
"romp",
"++",
")",
"{",
"if",
"(",
"ROMENTRY_ISFILE",
"(",
"romp",
")",
")",
"{",
"char",
"acthash",
"[",
"HASH_BUF_SIZE",
"]",
";",
"open_chd",
"chd",
"=",
"{",
"0",
"}",
";",
"chd_header",
"header",
";",
"chd_error",
"err",
";",
"chd",
".",
"region",
"=",
"regiontag",
";",
"filename",
"=",
"astring_assemble_2",
"(",
"filename",
",",
"ROM_GETNAME",
"(",
"romp",
")",
",",
"\"",
"\"",
")",
";",
"LOG",
"(",
"(",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"filename",
")",
")",
")",
";",
"err",
"=",
"open_disk_image",
"(",
"romdata",
"->",
"machine",
"->",
"gamedrv",
",",
"romp",
",",
"&",
"chd",
".",
"origfile",
",",
"&",
"chd",
".",
"origchd",
")",
";",
"if",
"(",
"err",
"!=",
"CHDERR_NONE",
")",
"{",
"if",
"(",
"err",
"==",
"CHDERR_FILE_NOT_FOUND",
")",
"astring_catprintf",
"(",
"romdata",
"->",
"errorstring",
",",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"filename",
")",
")",
";",
"else",
"astring_catprintf",
"(",
"romdata",
"->",
"errorstring",
",",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"filename",
")",
",",
"chd_error_string",
"(",
"err",
")",
")",
";",
"if",
"(",
"hash_data_has_info",
"(",
"ROM_GETHASHDATA",
"(",
"romp",
")",
",",
"HASH_INFO_NO_DUMP",
")",
"||",
"DISK_ISOPTIONAL",
"(",
"romp",
")",
")",
"romdata",
"->",
"warnings",
"++",
";",
"else",
"romdata",
"->",
"errors",
"++",
";",
"continue",
";",
"}",
"header",
"=",
"*",
"chd_get_header",
"(",
"chd",
".",
"origchd",
")",
";",
"hash_data_clear",
"(",
"acthash",
")",
";",
"hash_data_insert_binary_checksum",
"(",
"acthash",
",",
"HASH_SHA1",
",",
"header",
".",
"sha1",
")",
";",
"if",
"(",
"!",
"hash_data_is_equal",
"(",
"ROM_GETHASHDATA",
"(",
"romp",
")",
",",
"acthash",
",",
"0",
")",
")",
"{",
"astring_catprintf",
"(",
"romdata",
"->",
"errorstring",
",",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"filename",
")",
")",
";",
"dump_wrong_and_correct_checksums",
"(",
"romdata",
",",
"ROM_GETHASHDATA",
"(",
"romp",
")",
",",
"acthash",
")",
";",
"romdata",
"->",
"warnings",
"++",
";",
"}",
"else",
"if",
"(",
"hash_data_has_info",
"(",
"ROM_GETHASHDATA",
"(",
"romp",
")",
",",
"HASH_INFO_BAD_DUMP",
")",
")",
"{",
"astring_catprintf",
"(",
"romdata",
"->",
"errorstring",
",",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"filename",
")",
")",
";",
"romdata",
"->",
"warnings",
"++",
";",
"}",
"if",
"(",
"!",
"DISK_ISREADONLY",
"(",
"romp",
")",
")",
"{",
"err",
"=",
"open_disk_diff",
"(",
"romdata",
"->",
"machine",
"->",
"gamedrv",
",",
"romp",
",",
"chd",
".",
"origchd",
",",
"&",
"chd",
".",
"difffile",
",",
"&",
"chd",
".",
"diffchd",
")",
";",
"if",
"(",
"err",
"!=",
"CHDERR_NONE",
")",
"{",
"astring_catprintf",
"(",
"romdata",
"->",
"errorstring",
",",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"filename",
")",
",",
"chd_error_string",
"(",
"err",
")",
")",
";",
"romdata",
"->",
"errors",
"++",
";",
"continue",
";",
"}",
"}",
"LOG",
"(",
"(",
"\"",
"\\n",
"\"",
",",
"DISK_GETINDEX",
"(",
"romp",
")",
")",
")",
";",
"add_disk_handle",
"(",
"romdata",
"->",
"machine",
",",
"&",
"chd",
")",
";",
"}",
"}",
"astring_free",
"(",
"filename",
")",
";",
"}"
] | process_disk_entries - process all disk entries
for a region | [
"process_disk_entries",
"-",
"process",
"all",
"disk",
"entries",
"for",
"a",
"region"
] | [
"/* loop until we hit the end of this region */",
"/* handle files */",
"/* note the region we are in */",
"/* make the filename of the source */",
"/* first open the source drive */",
"/* if this is NO_DUMP, keep going, though the system may not be able to handle it */",
"/* get the header and extract the MD5/SHA1 */",
"/* verify the hash */",
"/* if not read-only, make the diff file */",
"/* try to open or create the diff */",
"/* we're okay, add to the list of disks */"
] | [
{
"param": "romdata",
"type": "rom_load_data"
},
{
"param": "regiontag",
"type": "char"
},
{
"param": "romp",
"type": "rom_entry"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "romdata",
"type": "rom_load_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "regiontag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "romp",
"type": "rom_entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860b4a9733bb8979ba3156d258bf5b44ad6494dd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/romload.c | [
"Unlicense"
] | C | normalize_flags_for_cpu | UINT32 | static UINT32 normalize_flags_for_cpu(running_machine *machine, UINT32 startflags, const char *rgntag)
{
const device_config *device = cputag_get_cpu(machine, rgntag);
if (device != NULL)
{
int buswidth;
/* set the endianness */
startflags &= ~ROMREGION_ENDIANMASK;
if (cpu_get_endianness(device) == ENDIANNESS_LITTLE)
startflags |= ROMREGION_LE;
else
startflags |= ROMREGION_BE;
/* set the width */
startflags &= ~ROMREGION_WIDTHMASK;
buswidth = cpu_get_databus_width(device, ADDRESS_SPACE_PROGRAM);
if (buswidth <= 8)
startflags |= ROMREGION_8BIT;
else if (buswidth <= 16)
startflags |= ROMREGION_16BIT;
else if (buswidth <= 32)
startflags |= ROMREGION_32BIT;
else
startflags |= ROMREGION_64BIT;
}
return startflags;
} | /*-------------------------------------------------
normalize_flags_for_cpu - modify the region
flags for the given CPU index
-------------------------------------------------*/ | modify the region
flags for the given CPU index | [
"modify",
"the",
"region",
"flags",
"for",
"the",
"given",
"CPU",
"index"
] | static UINT32 normalize_flags_for_cpu(running_machine *machine, UINT32 startflags, const char *rgntag)
{
const device_config *device = cputag_get_cpu(machine, rgntag);
if (device != NULL)
{
int buswidth;
startflags &= ~ROMREGION_ENDIANMASK;
if (cpu_get_endianness(device) == ENDIANNESS_LITTLE)
startflags |= ROMREGION_LE;
else
startflags |= ROMREGION_BE;
startflags &= ~ROMREGION_WIDTHMASK;
buswidth = cpu_get_databus_width(device, ADDRESS_SPACE_PROGRAM);
if (buswidth <= 8)
startflags |= ROMREGION_8BIT;
else if (buswidth <= 16)
startflags |= ROMREGION_16BIT;
else if (buswidth <= 32)
startflags |= ROMREGION_32BIT;
else
startflags |= ROMREGION_64BIT;
}
return startflags;
} | [
"static",
"UINT32",
"normalize_flags_for_cpu",
"(",
"running_machine",
"*",
"machine",
",",
"UINT32",
"startflags",
",",
"const",
"char",
"*",
"rgntag",
")",
"{",
"const",
"device_config",
"*",
"device",
"=",
"cputag_get_cpu",
"(",
"machine",
",",
"rgntag",
")",
";",
"if",
"(",
"device",
"!=",
"NULL",
")",
"{",
"int",
"buswidth",
";",
"startflags",
"&=",
"~",
"ROMREGION_ENDIANMASK",
";",
"if",
"(",
"cpu_get_endianness",
"(",
"device",
")",
"==",
"ENDIANNESS_LITTLE",
")",
"startflags",
"|=",
"ROMREGION_LE",
";",
"else",
"startflags",
"|=",
"ROMREGION_BE",
";",
"startflags",
"&=",
"~",
"ROMREGION_WIDTHMASK",
";",
"buswidth",
"=",
"cpu_get_databus_width",
"(",
"device",
",",
"ADDRESS_SPACE_PROGRAM",
")",
";",
"if",
"(",
"buswidth",
"<=",
"8",
")",
"startflags",
"|=",
"ROMREGION_8BIT",
";",
"else",
"if",
"(",
"buswidth",
"<=",
"16",
")",
"startflags",
"|=",
"ROMREGION_16BIT",
";",
"else",
"if",
"(",
"buswidth",
"<=",
"32",
")",
"startflags",
"|=",
"ROMREGION_32BIT",
";",
"else",
"startflags",
"|=",
"ROMREGION_64BIT",
";",
"}",
"return",
"startflags",
";",
"}"
] | normalize_flags_for_cpu - modify the region
flags for the given CPU index | [
"normalize_flags_for_cpu",
"-",
"modify",
"the",
"region",
"flags",
"for",
"the",
"given",
"CPU",
"index"
] | [
"/* set the endianness */",
"/* set the width */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "startflags",
"type": "UINT32"
},
{
"param": "rgntag",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "startflags",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rgntag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860b4a9733bb8979ba3156d258bf5b44ad6494dd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/romload.c | [
"Unlicense"
] | C | rom_init | void | void rom_init(running_machine *machine)
{
rom_load_data *romdata;
/* allocate private data */
machine->romload_data = romdata = auto_alloc_clear(machine, romload_private);
/* make sure we get called back on the way out */
add_exit_callback(machine, rom_exit);
/* reset the romdata struct */
romdata->machine = machine;
romdata->errorstring = astring_alloc();
/* figure out which BIOS we are using */
determine_bios_rom(romdata);
/* count the total number of ROMs */
count_roms(romdata);
/* reset the disk list */
romdata->chd_list = NULL;
romdata->chd_list_tailptr = &machine->romload_data->chd_list;
/* process the ROM entries we were passed */
process_region_list(romdata);
/* display the results and exit */
display_rom_load_results(romdata);
astring_free(romdata->errorstring);
} | /*-------------------------------------------------
rom_init - load the ROMs and open the disk
images associated with the given machine
-------------------------------------------------*/ | load the ROMs and open the disk
images associated with the given machine | [
"load",
"the",
"ROMs",
"and",
"open",
"the",
"disk",
"images",
"associated",
"with",
"the",
"given",
"machine"
] | void rom_init(running_machine *machine)
{
rom_load_data *romdata;
machine->romload_data = romdata = auto_alloc_clear(machine, romload_private);
add_exit_callback(machine, rom_exit);
romdata->machine = machine;
romdata->errorstring = astring_alloc();
determine_bios_rom(romdata);
count_roms(romdata);
romdata->chd_list = NULL;
romdata->chd_list_tailptr = &machine->romload_data->chd_list;
process_region_list(romdata);
display_rom_load_results(romdata);
astring_free(romdata->errorstring);
} | [
"void",
"rom_init",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"rom_load_data",
"*",
"romdata",
";",
"machine",
"->",
"romload_data",
"=",
"romdata",
"=",
"auto_alloc_clear",
"(",
"machine",
",",
"romload_private",
")",
";",
"add_exit_callback",
"(",
"machine",
",",
"rom_exit",
")",
";",
"romdata",
"->",
"machine",
"=",
"machine",
";",
"romdata",
"->",
"errorstring",
"=",
"astring_alloc",
"(",
")",
";",
"determine_bios_rom",
"(",
"romdata",
")",
";",
"count_roms",
"(",
"romdata",
")",
";",
"romdata",
"->",
"chd_list",
"=",
"NULL",
";",
"romdata",
"->",
"chd_list_tailptr",
"=",
"&",
"machine",
"->",
"romload_data",
"->",
"chd_list",
";",
"process_region_list",
"(",
"romdata",
")",
";",
"display_rom_load_results",
"(",
"romdata",
")",
";",
"astring_free",
"(",
"romdata",
"->",
"errorstring",
")",
";",
"}"
] | rom_init - load the ROMs and open the disk
images associated with the given machine | [
"rom_init",
"-",
"load",
"the",
"ROMs",
"and",
"open",
"the",
"disk",
"images",
"associated",
"with",
"the",
"given",
"machine"
] | [
"/* allocate private data */",
"/* make sure we get called back on the way out */",
"/* reset the romdata struct */",
"/* figure out which BIOS we are using */",
"/* count the total number of ROMs */",
"/* reset the disk list */",
"/* process the ROM entries we were passed */",
"/* display the results and exit */"
] | [
{
"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": []
} |
c0207e97de80fe8a31e0bad58d030736cc69aa5c | lofunz/mieme | Reloaded/trunk/src/emu/machine/pit8253.c | [
"Unlicense"
] | C | decrease_counter_value | void | static void decrease_counter_value(struct pit8253_timer *timer,UINT64 cycles)
{
UINT16 value;
int units, tens, hundreds, thousands;
if (CTRL_BCD(timer->control) == 0)
{
timer->value -= (cycles & 0xFFFF);
return;
}
value = timer->value;
units = value & 0xF;
tens = (value >> 4) & 0xF;
hundreds = (value >> 8) & 0xF;
thousands = (value >> 12) & 0xF;
if (cycles <= units)
{
units -= cycles;
}
else
{
cycles -= units;
units = (10 - cycles%10)%10;
cycles =(cycles+9)/10; /* the +9 is so we get a carry if cycles%10 wasn't 0 */
if (cycles <= tens)
{
tens -= cycles;
}
else
{
cycles -= tens;
tens = (10 - cycles%10) % 10;
cycles = (cycles+9) / 10;
if (cycles <= hundreds)
{
hundreds -= cycles;
}
else
{
cycles -= hundreds;
hundreds = (10 - cycles%10)%10;
cycles=(cycles+9)/10;
thousands = (10 + thousands - cycles%10)%10;
}
}
}
timer->value = (thousands << 12) | (hundreds << 8) | (tens << 4) | units;
} | /* This function subtracts 1 from timer->value "cycles" times, taking into
account binary or BCD operation, and wrapping around from 0 to 0xFFFF or
0x9999 as necessary. */ | This function subtracts 1 from timer->value "cycles" times, taking into
account binary or BCD operation, and wrapping around from 0 to 0xFFFF or
0x9999 as necessary. | [
"This",
"function",
"subtracts",
"1",
"from",
"timer",
"-",
">",
"value",
"\"",
"cycles",
"\"",
"times",
"taking",
"into",
"account",
"binary",
"or",
"BCD",
"operation",
"and",
"wrapping",
"around",
"from",
"0",
"to",
"0xFFFF",
"or",
"0x9999",
"as",
"necessary",
"."
] | static void decrease_counter_value(struct pit8253_timer *timer,UINT64 cycles)
{
UINT16 value;
int units, tens, hundreds, thousands;
if (CTRL_BCD(timer->control) == 0)
{
timer->value -= (cycles & 0xFFFF);
return;
}
value = timer->value;
units = value & 0xF;
tens = (value >> 4) & 0xF;
hundreds = (value >> 8) & 0xF;
thousands = (value >> 12) & 0xF;
if (cycles <= units)
{
units -= cycles;
}
else
{
cycles -= units;
units = (10 - cycles%10)%10;
cycles =(cycles+9)/10;
if (cycles <= tens)
{
tens -= cycles;
}
else
{
cycles -= tens;
tens = (10 - cycles%10) % 10;
cycles = (cycles+9) / 10;
if (cycles <= hundreds)
{
hundreds -= cycles;
}
else
{
cycles -= hundreds;
hundreds = (10 - cycles%10)%10;
cycles=(cycles+9)/10;
thousands = (10 + thousands - cycles%10)%10;
}
}
}
timer->value = (thousands << 12) | (hundreds << 8) | (tens << 4) | units;
} | [
"static",
"void",
"decrease_counter_value",
"(",
"struct",
"pit8253_timer",
"*",
"timer",
",",
"UINT64",
"cycles",
")",
"{",
"UINT16",
"value",
";",
"int",
"units",
",",
"tens",
",",
"hundreds",
",",
"thousands",
";",
"if",
"(",
"CTRL_BCD",
"(",
"timer",
"->",
"control",
")",
"==",
"0",
")",
"{",
"timer",
"->",
"value",
"-=",
"(",
"cycles",
"&",
"0xFFFF",
")",
";",
"return",
";",
"}",
"value",
"=",
"timer",
"->",
"value",
";",
"units",
"=",
"value",
"&",
"0xF",
";",
"tens",
"=",
"(",
"value",
">>",
"4",
")",
"&",
"0xF",
";",
"hundreds",
"=",
"(",
"value",
">>",
"8",
")",
"&",
"0xF",
";",
"thousands",
"=",
"(",
"value",
">>",
"12",
")",
"&",
"0xF",
";",
"if",
"(",
"cycles",
"<=",
"units",
")",
"{",
"units",
"-=",
"cycles",
";",
"}",
"else",
"{",
"cycles",
"-=",
"units",
";",
"units",
"=",
"(",
"10",
"-",
"cycles",
"%",
"10",
")",
"%",
"10",
";",
"cycles",
"=",
"(",
"cycles",
"+",
"9",
")",
"/",
"10",
";",
"if",
"(",
"cycles",
"<=",
"tens",
")",
"{",
"tens",
"-=",
"cycles",
";",
"}",
"else",
"{",
"cycles",
"-=",
"tens",
";",
"tens",
"=",
"(",
"10",
"-",
"cycles",
"%",
"10",
")",
"%",
"10",
";",
"cycles",
"=",
"(",
"cycles",
"+",
"9",
")",
"/",
"10",
";",
"if",
"(",
"cycles",
"<=",
"hundreds",
")",
"{",
"hundreds",
"-=",
"cycles",
";",
"}",
"else",
"{",
"cycles",
"-=",
"hundreds",
";",
"hundreds",
"=",
"(",
"10",
"-",
"cycles",
"%",
"10",
")",
"%",
"10",
";",
"cycles",
"=",
"(",
"cycles",
"+",
"9",
")",
"/",
"10",
";",
"thousands",
"=",
"(",
"10",
"+",
"thousands",
"-",
"cycles",
"%",
"10",
")",
"%",
"10",
";",
"}",
"}",
"}",
"timer",
"->",
"value",
"=",
"(",
"thousands",
"<<",
"12",
")",
"|",
"(",
"hundreds",
"<<",
"8",
")",
"|",
"(",
"tens",
"<<",
"4",
")",
"|",
"units",
";",
"}"
] | This function subtracts 1 from timer->value "cycles" times, taking into
account binary or BCD operation, and wrapping around from 0 to 0xFFFF or
0x9999 as necessary. | [
"This",
"function",
"subtracts",
"1",
"from",
"timer",
"-",
">",
"value",
"\"",
"cycles",
"\"",
"times",
"taking",
"into",
"account",
"binary",
"or",
"BCD",
"operation",
"and",
"wrapping",
"around",
"from",
"0",
"to",
"0xFFFF",
"or",
"0x9999",
"as",
"necessary",
"."
] | [
"/* the +9 is so we get a carry if cycles%10 wasn't 0 */"
] | [
{
"param": "timer",
"type": "struct pit8253_timer"
},
{
"param": "cycles",
"type": "UINT64"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "timer",
"type": "struct pit8253_timer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cycles",
"type": "UINT64",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c0207e97de80fe8a31e0bad58d030736cc69aa5c | lofunz/mieme | Reloaded/trunk/src/emu/machine/pit8253.c | [
"Unlicense"
] | C | load_counter_value | void | static void load_counter_value(running_device *device, struct pit8253_timer *timer)
{
timer->value = timer->count;
timer->null_count = 1;
if ( CTRL_MODE(timer->control) == 3 && timer->output == 0)
timer->value &= 0xfffe;
} | /* Counter loading: transfer of a count from the CR to the CE */ | Counter loading: transfer of a count from the CR to the CE | [
"Counter",
"loading",
":",
"transfer",
"of",
"a",
"count",
"from",
"the",
"CR",
"to",
"the",
"CE"
] | static void load_counter_value(running_device *device, struct pit8253_timer *timer)
{
timer->value = timer->count;
timer->null_count = 1;
if ( CTRL_MODE(timer->control) == 3 && timer->output == 0)
timer->value &= 0xfffe;
} | [
"static",
"void",
"load_counter_value",
"(",
"running_device",
"*",
"device",
",",
"struct",
"pit8253_timer",
"*",
"timer",
")",
"{",
"timer",
"->",
"value",
"=",
"timer",
"->",
"count",
";",
"timer",
"->",
"null_count",
"=",
"1",
";",
"if",
"(",
"CTRL_MODE",
"(",
"timer",
"->",
"control",
")",
"==",
"3",
"&&",
"timer",
"->",
"output",
"==",
"0",
")",
"timer",
"->",
"value",
"&=",
"0xfffe",
";",
"}"
] | Counter loading: transfer of a count from the CR to the CE | [
"Counter",
"loading",
":",
"transfer",
"of",
"a",
"count",
"from",
"the",
"CR",
"to",
"the",
"CE"
] | [] | [
{
"param": "device",
"type": "running_device"
},
{
"param": "timer",
"type": "struct pit8253_timer"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "running_device",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "timer",
"type": "struct pit8253_timer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c0207e97de80fe8a31e0bad58d030736cc69aa5c | lofunz/mieme | Reloaded/trunk/src/emu/machine/pit8253.c | [
"Unlicense"
] | C | simulate | void | static void simulate(running_device *device, struct pit8253_timer *timer, INT64 elapsed_cycles)
{
if ( elapsed_cycles > 0 )
simulate2(device, timer, elapsed_cycles);
else
if ( timer->clockin )
timer_adjust_oneshot(timer->updatetimer, double_to_attotime( 1 / timer->clockin ), timer->index );
} | /* This emulates timer "timer" for "elapsed_cycles" cycles, broken down into
sections punctuated by callbacks.
The loop technically should never execute even once. It's here to eliminate
the following potential bug:
1) The mame timer isn't perfectly accurate.
2) The output callback is executed too late, after an update which
brings the timer's local time past the callback time.
3) A short pulse is skipped.
4) That short pulse would have triggered an interrupt. The interrupt is
skipped.
This is a loop instead of an "if" statement in case the mame timer is
inaccurate by more than one cycle, and the output changed multiple
times during the discrepancy. In practice updates should still be O(1).
*/ | This emulates timer "timer" for "elapsed_cycles" cycles, broken down into
sections punctuated by callbacks.
The loop technically should never execute even once. It's here to eliminate
the following potential bug.
1) The mame timer isn't perfectly accurate.
2) The output callback is executed too late, after an update which
brings the timer's local time past the callback time.
3) A short pulse is skipped.
4) That short pulse would have triggered an interrupt. The interrupt is
skipped.
This is a loop instead of an "if" statement in case the mame timer is
inaccurate by more than one cycle, and the output changed multiple
times during the discrepancy. In practice updates should still be O(1). | [
"This",
"emulates",
"timer",
"\"",
"timer",
"\"",
"for",
"\"",
"elapsed_cycles",
"\"",
"cycles",
"broken",
"down",
"into",
"sections",
"punctuated",
"by",
"callbacks",
".",
"The",
"loop",
"technically",
"should",
"never",
"execute",
"even",
"once",
".",
"It",
"'",
"s",
"here",
"to",
"eliminate",
"the",
"following",
"potential",
"bug",
".",
"1",
")",
"The",
"mame",
"timer",
"isn",
"'",
"t",
"perfectly",
"accurate",
".",
"2",
")",
"The",
"output",
"callback",
"is",
"executed",
"too",
"late",
"after",
"an",
"update",
"which",
"brings",
"the",
"timer",
"'",
"s",
"local",
"time",
"past",
"the",
"callback",
"time",
".",
"3",
")",
"A",
"short",
"pulse",
"is",
"skipped",
".",
"4",
")",
"That",
"short",
"pulse",
"would",
"have",
"triggered",
"an",
"interrupt",
".",
"The",
"interrupt",
"is",
"skipped",
".",
"This",
"is",
"a",
"loop",
"instead",
"of",
"an",
"\"",
"if",
"\"",
"statement",
"in",
"case",
"the",
"mame",
"timer",
"is",
"inaccurate",
"by",
"more",
"than",
"one",
"cycle",
"and",
"the",
"output",
"changed",
"multiple",
"times",
"during",
"the",
"discrepancy",
".",
"In",
"practice",
"updates",
"should",
"still",
"be",
"O",
"(",
"1",
")",
"."
] | static void simulate(running_device *device, struct pit8253_timer *timer, INT64 elapsed_cycles)
{
if ( elapsed_cycles > 0 )
simulate2(device, timer, elapsed_cycles);
else
if ( timer->clockin )
timer_adjust_oneshot(timer->updatetimer, double_to_attotime( 1 / timer->clockin ), timer->index );
} | [
"static",
"void",
"simulate",
"(",
"running_device",
"*",
"device",
",",
"struct",
"pit8253_timer",
"*",
"timer",
",",
"INT64",
"elapsed_cycles",
")",
"{",
"if",
"(",
"elapsed_cycles",
">",
"0",
")",
"simulate2",
"(",
"device",
",",
"timer",
",",
"elapsed_cycles",
")",
";",
"else",
"if",
"(",
"timer",
"->",
"clockin",
")",
"timer_adjust_oneshot",
"(",
"timer",
"->",
"updatetimer",
",",
"double_to_attotime",
"(",
"1",
"/",
"timer",
"->",
"clockin",
")",
",",
"timer",
"->",
"index",
")",
";",
"}"
] | This emulates timer "timer" for "elapsed_cycles" cycles, broken down into
sections punctuated by callbacks. | [
"This",
"emulates",
"timer",
"\"",
"timer",
"\"",
"for",
"\"",
"elapsed_cycles",
"\"",
"cycles",
"broken",
"down",
"into",
"sections",
"punctuated",
"by",
"callbacks",
"."
] | [] | [
{
"param": "device",
"type": "running_device"
},
{
"param": "timer",
"type": "struct pit8253_timer"
},
{
"param": "elapsed_cycles",
"type": "INT64"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "running_device",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "timer",
"type": "struct pit8253_timer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "elapsed_cycles",
"type": "INT64",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c0207e97de80fe8a31e0bad58d030736cc69aa5c | lofunz/mieme | Reloaded/trunk/src/emu/machine/pit8253.c | [
"Unlicense"
] | C | masked_value | UINT16 | static UINT16 masked_value(struct pit8253_timer *timer)
{
LOG2(("pit8253: masked_value\n"));
if (CTRL_MODE(timer->control) == 3)
return timer->value & 0xfffe;
return timer->value;
} | /* We recycle bit 0 of timer->value to hold the phase in mode 3 when count is
odd. Since read commands in mode 3 always return even numbers, we need to
mask this bit off. */ | We recycle bit 0 of timer->value to hold the phase in mode 3 when count is
odd. Since read commands in mode 3 always return even numbers, we need to
mask this bit off. | [
"We",
"recycle",
"bit",
"0",
"of",
"timer",
"-",
">",
"value",
"to",
"hold",
"the",
"phase",
"in",
"mode",
"3",
"when",
"count",
"is",
"odd",
".",
"Since",
"read",
"commands",
"in",
"mode",
"3",
"always",
"return",
"even",
"numbers",
"we",
"need",
"to",
"mask",
"this",
"bit",
"off",
"."
] | static UINT16 masked_value(struct pit8253_timer *timer)
{
LOG2(("pit8253: masked_value\n"));
if (CTRL_MODE(timer->control) == 3)
return timer->value & 0xfffe;
return timer->value;
} | [
"static",
"UINT16",
"masked_value",
"(",
"struct",
"pit8253_timer",
"*",
"timer",
")",
"{",
"LOG2",
"(",
"(",
"\"",
"\\n",
"\"",
")",
")",
";",
"if",
"(",
"CTRL_MODE",
"(",
"timer",
"->",
"control",
")",
"==",
"3",
")",
"return",
"timer",
"->",
"value",
"&",
"0xfffe",
";",
"return",
"timer",
"->",
"value",
";",
"}"
] | We recycle bit 0 of timer->value to hold the phase in mode 3 when count is
odd. | [
"We",
"recycle",
"bit",
"0",
"of",
"timer",
"-",
">",
"value",
"to",
"hold",
"the",
"phase",
"in",
"mode",
"3",
"when",
"count",
"is",
"odd",
"."
] | [] | [
{
"param": "timer",
"type": "struct pit8253_timer"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "timer",
"type": "struct pit8253_timer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c0207e97de80fe8a31e0bad58d030736cc69aa5c | lofunz/mieme | Reloaded/trunk/src/emu/machine/pit8253.c | [
"Unlicense"
] | C | load_count | void | static void load_count(running_device *device, struct pit8253_timer *timer, UINT16 newcount)
{
int mode = CTRL_MODE(timer->control);
LOG1(("pit8253: load_count(): %04x\n",newcount));
if (newcount == 1)
{
/* Count of 1 is illegal in modes 2 and 3. What happens here was
determined experimentally. */
if (mode == 2)
newcount = 2;
if (mode == 3)
newcount = 0;
}
timer->count = newcount;
if (mode == 2 || mode == 3)
{
if (timer->phase == 0)
{
timer->phase = 1;
}
}
else
{
if (mode == 0 || mode == 4)
{
timer->phase = 1;
}
}
} | /* Loads a new value from the bus to the count register (CR) */ | Loads a new value from the bus to the count register (CR) | [
"Loads",
"a",
"new",
"value",
"from",
"the",
"bus",
"to",
"the",
"count",
"register",
"(",
"CR",
")"
] | static void load_count(running_device *device, struct pit8253_timer *timer, UINT16 newcount)
{
int mode = CTRL_MODE(timer->control);
LOG1(("pit8253: load_count(): %04x\n",newcount));
if (newcount == 1)
{
if (mode == 2)
newcount = 2;
if (mode == 3)
newcount = 0;
}
timer->count = newcount;
if (mode == 2 || mode == 3)
{
if (timer->phase == 0)
{
timer->phase = 1;
}
}
else
{
if (mode == 0 || mode == 4)
{
timer->phase = 1;
}
}
} | [
"static",
"void",
"load_count",
"(",
"running_device",
"*",
"device",
",",
"struct",
"pit8253_timer",
"*",
"timer",
",",
"UINT16",
"newcount",
")",
"{",
"int",
"mode",
"=",
"CTRL_MODE",
"(",
"timer",
"->",
"control",
")",
";",
"LOG1",
"(",
"(",
"\"",
"\\n",
"\"",
",",
"newcount",
")",
")",
";",
"if",
"(",
"newcount",
"==",
"1",
")",
"{",
"if",
"(",
"mode",
"==",
"2",
")",
"newcount",
"=",
"2",
";",
"if",
"(",
"mode",
"==",
"3",
")",
"newcount",
"=",
"0",
";",
"}",
"timer",
"->",
"count",
"=",
"newcount",
";",
"if",
"(",
"mode",
"==",
"2",
"||",
"mode",
"==",
"3",
")",
"{",
"if",
"(",
"timer",
"->",
"phase",
"==",
"0",
")",
"{",
"timer",
"->",
"phase",
"=",
"1",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"mode",
"==",
"0",
"||",
"mode",
"==",
"4",
")",
"{",
"timer",
"->",
"phase",
"=",
"1",
";",
"}",
"}",
"}"
] | Loads a new value from the bus to the count register (CR) | [
"Loads",
"a",
"new",
"value",
"from",
"the",
"bus",
"to",
"the",
"count",
"register",
"(",
"CR",
")"
] | [
"/* Count of 1 is illegal in modes 2 and 3. What happens here was\r\n determined experimentally. */"
] | [
{
"param": "device",
"type": "running_device"
},
{
"param": "timer",
"type": "struct pit8253_timer"
},
{
"param": "newcount",
"type": "UINT16"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "running_device",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "timer",
"type": "struct pit8253_timer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "newcount",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
820785435326f98c82ad72b2ba96c5d323bbcc47 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/video/angelkds.c | [
"Unlicense"
] | C | draw_sprites | void | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int enable_n)
{
const UINT8 *source = spriteram+0x100-4;
const UINT8 *finish = spriteram;
const gfx_element *gfx = machine->gfx[3];
while( source>=finish )
{
/*
nnnn nnnn - EeFf B?cc - yyyy yyyy - xxxx xxxx
n = sprite number
E = Sprite Enabled in Top Half of Screen
e = Sprite Enabled in Bottom Half of Screen
F = Flip Y
f = Flip X
B = Tile Bank
? = unknown, nothing / unused? recheck
c = color
y = Y position
x = X position
*/
UINT16 tile_no = source[0];
UINT8 attr = source[1];
UINT8 ypos = source[2];
UINT8 xpos = source[3];
UINT8 enable = attr & 0xc0;
UINT8 flipx = (attr & 0x10) >> 4;
UINT8 flipy = (attr & 0x20) >> 5;
UINT8 bank = attr & 0x08;
UINT8 color = attr & 0x03;
if (bank) tile_no +=0x100;
ypos= 0xff-ypos;
if (enable & enable_n)
{
drawgfx_transpen(
bitmap,
cliprect,
gfx,
tile_no,
color*4,
flipx,flipy,
xpos,ypos,15
);
/* wraparound */
if (xpos > 240)
drawgfx_transpen(
bitmap,
cliprect,
gfx,
tile_no,
color*4,
flipx,flipy,
xpos-256,ypos,15
);
/* wraparound */
if (ypos > 240)
{
drawgfx_transpen(
bitmap,
cliprect,
gfx,
tile_no,
color*4,
flipx,flipy,
xpos,ypos-256,15
);
/* wraparound */
if (xpos > 240)
drawgfx_transpen(
bitmap,
cliprect,
gfx,
tile_no,
color*4,
flipx,flipy,
xpos-256,ypos-256,15
);
}
}
source-=0x04;
}
} | /*** Sprites
the sprites are similar to the tilemaps in the sense that there is
a split down the middle of the screen
*/ | Sprites
the sprites are similar to the tilemaps in the sense that there is
a split down the middle of the screen | [
"Sprites",
"the",
"sprites",
"are",
"similar",
"to",
"the",
"tilemaps",
"in",
"the",
"sense",
"that",
"there",
"is",
"a",
"split",
"down",
"the",
"middle",
"of",
"the",
"screen"
] | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int enable_n)
{
const UINT8 *source = spriteram+0x100-4;
const UINT8 *finish = spriteram;
const gfx_element *gfx = machine->gfx[3];
while( source>=finish )
{
UINT16 tile_no = source[0];
UINT8 attr = source[1];
UINT8 ypos = source[2];
UINT8 xpos = source[3];
UINT8 enable = attr & 0xc0;
UINT8 flipx = (attr & 0x10) >> 4;
UINT8 flipy = (attr & 0x20) >> 5;
UINT8 bank = attr & 0x08;
UINT8 color = attr & 0x03;
if (bank) tile_no +=0x100;
ypos= 0xff-ypos;
if (enable & enable_n)
{
drawgfx_transpen(
bitmap,
cliprect,
gfx,
tile_no,
color*4,
flipx,flipy,
xpos,ypos,15
);
if (xpos > 240)
drawgfx_transpen(
bitmap,
cliprect,
gfx,
tile_no,
color*4,
flipx,flipy,
xpos-256,ypos,15
);
if (ypos > 240)
{
drawgfx_transpen(
bitmap,
cliprect,
gfx,
tile_no,
color*4,
flipx,flipy,
xpos,ypos-256,15
);
if (xpos > 240)
drawgfx_transpen(
bitmap,
cliprect,
gfx,
tile_no,
color*4,
flipx,flipy,
xpos-256,ypos-256,15
);
}
}
source-=0x04;
}
} | [
"static",
"void",
"draw_sprites",
"(",
"running_machine",
"*",
"machine",
",",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"int",
"enable_n",
")",
"{",
"const",
"UINT8",
"*",
"source",
"=",
"spriteram",
"+",
"0x100",
"-",
"4",
";",
"const",
"UINT8",
"*",
"finish",
"=",
"spriteram",
";",
"const",
"gfx_element",
"*",
"gfx",
"=",
"machine",
"->",
"gfx",
"[",
"3",
"]",
";",
"while",
"(",
"source",
">=",
"finish",
")",
"{",
"UINT16",
"tile_no",
"=",
"source",
"[",
"0",
"]",
";",
"UINT8",
"attr",
"=",
"source",
"[",
"1",
"]",
";",
"UINT8",
"ypos",
"=",
"source",
"[",
"2",
"]",
";",
"UINT8",
"xpos",
"=",
"source",
"[",
"3",
"]",
";",
"UINT8",
"enable",
"=",
"attr",
"&",
"0xc0",
";",
"UINT8",
"flipx",
"=",
"(",
"attr",
"&",
"0x10",
")",
">>",
"4",
";",
"UINT8",
"flipy",
"=",
"(",
"attr",
"&",
"0x20",
")",
">>",
"5",
";",
"UINT8",
"bank",
"=",
"attr",
"&",
"0x08",
";",
"UINT8",
"color",
"=",
"attr",
"&",
"0x03",
";",
"if",
"(",
"bank",
")",
"tile_no",
"+=",
"0x100",
";",
"ypos",
"=",
"0xff",
"-",
"ypos",
";",
"if",
"(",
"enable",
"&",
"enable_n",
")",
"{",
"drawgfx_transpen",
"(",
"bitmap",
",",
"cliprect",
",",
"gfx",
",",
"tile_no",
",",
"color",
"*",
"4",
",",
"flipx",
",",
"flipy",
",",
"xpos",
",",
"ypos",
",",
"15",
")",
";",
"if",
"(",
"xpos",
">",
"240",
")",
"drawgfx_transpen",
"(",
"bitmap",
",",
"cliprect",
",",
"gfx",
",",
"tile_no",
",",
"color",
"*",
"4",
",",
"flipx",
",",
"flipy",
",",
"xpos",
"-",
"256",
",",
"ypos",
",",
"15",
")",
";",
"if",
"(",
"ypos",
">",
"240",
")",
"{",
"drawgfx_transpen",
"(",
"bitmap",
",",
"cliprect",
",",
"gfx",
",",
"tile_no",
",",
"color",
"*",
"4",
",",
"flipx",
",",
"flipy",
",",
"xpos",
",",
"ypos",
"-",
"256",
",",
"15",
")",
";",
"if",
"(",
"xpos",
">",
"240",
")",
"drawgfx_transpen",
"(",
"bitmap",
",",
"cliprect",
",",
"gfx",
",",
"tile_no",
",",
"color",
"*",
"4",
",",
"flipx",
",",
"flipy",
",",
"xpos",
"-",
"256",
",",
"ypos",
"-",
"256",
",",
"15",
")",
";",
"}",
"}",
"source",
"-=",
"0x04",
";",
"}",
"}"
] | Sprites
the sprites are similar to the tilemaps in the sense that there is
a split down the middle of the screen | [
"Sprites",
"the",
"sprites",
"are",
"similar",
"to",
"the",
"tilemaps",
"in",
"the",
"sense",
"that",
"there",
"is",
"a",
"split",
"down",
"the",
"middle",
"of",
"the",
"screen"
] | [
"/*\n\n nnnn nnnn - EeFf B?cc - yyyy yyyy - xxxx xxxx\n\n n = sprite number\n E = Sprite Enabled in Top Half of Screen\n e = Sprite Enabled in Bottom Half of Screen\n F = Flip Y\n f = Flip X\n B = Tile Bank\n ? = unknown, nothing / unused? recheck\n c = color\n y = Y position\n x = X position\n\n */",
"/* wraparound */",
"/* wraparound */",
"/* wraparound */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "enable_n",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "enable_n",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
46d3ee1ac46774fb6344b157ea885f78db8de09a | lofunz/mieme | Reloaded/trunk/src/mame/video/spbactn.c | [
"Unlicense"
] | C | draw_sprites | int | static int draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
{
static const UINT8 layout[8][8] =
{
{ 0, 1, 4, 5,16,17,20,21},
{ 2, 3, 6, 7,18,19,22,23},
{ 8, 9,12,13,24,25,28,29},
{10,11,14,15,26,27,30,31},
{32,33,36,37,48,49,52,53},
{34,35,38,39,50,51,54,55},
{40,41,44,45,56,57,60,61},
{42,43,46,47,58,59,62,63}
};
spbactn_state *state = machine->driver_data<spbactn_state>();
int count = 0;
int offs;
for (offs = (0x1000 - 16) / 2; offs >= 0; offs -= 8)
{
int sx, sy, code, color, size, attr, flipx, flipy;
int col, row;
attr = state->spvideoram[offs];
if ((attr & 0x0004) &&
((attr & 0x0030) >> 4) == priority)
{
flipx = attr & 0x0001;
flipy = attr & 0x0002;
code = state->spvideoram[offs + 1];
color = state->spvideoram[offs + 2];
size = 1 << (color & 0x0003); /* 1,2,4,8 */
color = (color & 0x00f0) >> 4;
sx = state->spvideoram[offs + 4];
sy = state->spvideoram[offs + 3];
attr &= ~0x0040; /* !!! */
if (attr & 0x0040)
color |= 0x0180;
else
color |= 0x0080;
for (row = 0; row < size; row++)
{
for (col = 0; col < size; col++)
{
int x = sx + 8 * (flipx ? (size - 1 - col) : col);
int y = sy + 8 * (flipy ? (size - 1 - row) : row);
drawgfx_transpen_raw(bitmap, cliprect, machine->gfx[2],
code + layout[row][col],
machine->gfx[2]->color_base + color * machine->gfx[2]->color_granularity,
flipx, flipy,
x, y,
0);
}
}
count++;
}
}
return count;
} | /* from gals pinball (which was in turn from ninja gaiden) */ | from gals pinball (which was in turn from ninja gaiden) | [
"from",
"gals",
"pinball",
"(",
"which",
"was",
"in",
"turn",
"from",
"ninja",
"gaiden",
")"
] | static int draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
{
static const UINT8 layout[8][8] =
{
{ 0, 1, 4, 5,16,17,20,21},
{ 2, 3, 6, 7,18,19,22,23},
{ 8, 9,12,13,24,25,28,29},
{10,11,14,15,26,27,30,31},
{32,33,36,37,48,49,52,53},
{34,35,38,39,50,51,54,55},
{40,41,44,45,56,57,60,61},
{42,43,46,47,58,59,62,63}
};
spbactn_state *state = machine->driver_data<spbactn_state>();
int count = 0;
int offs;
for (offs = (0x1000 - 16) / 2; offs >= 0; offs -= 8)
{
int sx, sy, code, color, size, attr, flipx, flipy;
int col, row;
attr = state->spvideoram[offs];
if ((attr & 0x0004) &&
((attr & 0x0030) >> 4) == priority)
{
flipx = attr & 0x0001;
flipy = attr & 0x0002;
code = state->spvideoram[offs + 1];
color = state->spvideoram[offs + 2];
size = 1 << (color & 0x0003);
color = (color & 0x00f0) >> 4;
sx = state->spvideoram[offs + 4];
sy = state->spvideoram[offs + 3];
attr &= ~0x0040;
if (attr & 0x0040)
color |= 0x0180;
else
color |= 0x0080;
for (row = 0; row < size; row++)
{
for (col = 0; col < size; col++)
{
int x = sx + 8 * (flipx ? (size - 1 - col) : col);
int y = sy + 8 * (flipy ? (size - 1 - row) : row);
drawgfx_transpen_raw(bitmap, cliprect, machine->gfx[2],
code + layout[row][col],
machine->gfx[2]->color_base + color * machine->gfx[2]->color_granularity,
flipx, flipy,
x, y,
0);
}
}
count++;
}
}
return count;
} | [
"static",
"int",
"draw_sprites",
"(",
"running_machine",
"*",
"machine",
",",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"int",
"priority",
")",
"{",
"static",
"const",
"UINT8",
"layout",
"[",
"8",
"]",
"[",
"8",
"]",
"=",
"{",
"{",
"0",
",",
"1",
",",
"4",
",",
"5",
",",
"16",
",",
"17",
",",
"20",
",",
"21",
"}",
",",
"{",
"2",
",",
"3",
",",
"6",
",",
"7",
",",
"18",
",",
"19",
",",
"22",
",",
"23",
"}",
",",
"{",
"8",
",",
"9",
",",
"12",
",",
"13",
",",
"24",
",",
"25",
",",
"28",
",",
"29",
"}",
",",
"{",
"10",
",",
"11",
",",
"14",
",",
"15",
",",
"26",
",",
"27",
",",
"30",
",",
"31",
"}",
",",
"{",
"32",
",",
"33",
",",
"36",
",",
"37",
",",
"48",
",",
"49",
",",
"52",
",",
"53",
"}",
",",
"{",
"34",
",",
"35",
",",
"38",
",",
"39",
",",
"50",
",",
"51",
",",
"54",
",",
"55",
"}",
",",
"{",
"40",
",",
"41",
",",
"44",
",",
"45",
",",
"56",
",",
"57",
",",
"60",
",",
"61",
"}",
",",
"{",
"42",
",",
"43",
",",
"46",
",",
"47",
",",
"58",
",",
"59",
",",
"62",
",",
"63",
"}",
"}",
";",
"spbactn_state",
"*",
"state",
"=",
"machine",
"->",
"driver_data",
"<",
"spbactn_state",
">",
"(",
"",
")",
";",
"int",
"count",
"=",
"0",
";",
"int",
"offs",
";",
"for",
"(",
"offs",
"=",
"(",
"0x1000",
"-",
"16",
")",
"/",
"2",
";",
"offs",
">=",
"0",
";",
"offs",
"-=",
"8",
")",
"{",
"int",
"sx",
",",
"sy",
",",
"code",
",",
"color",
",",
"size",
",",
"attr",
",",
"flipx",
",",
"flipy",
";",
"int",
"col",
",",
"row",
";",
"attr",
"=",
"state",
"->",
"spvideoram",
"[",
"offs",
"]",
";",
"if",
"(",
"(",
"attr",
"&",
"0x0004",
")",
"&&",
"(",
"(",
"attr",
"&",
"0x0030",
")",
">>",
"4",
")",
"==",
"priority",
")",
"{",
"flipx",
"=",
"attr",
"&",
"0x0001",
";",
"flipy",
"=",
"attr",
"&",
"0x0002",
";",
"code",
"=",
"state",
"->",
"spvideoram",
"[",
"offs",
"+",
"1",
"]",
";",
"color",
"=",
"state",
"->",
"spvideoram",
"[",
"offs",
"+",
"2",
"]",
";",
"size",
"=",
"1",
"<<",
"(",
"color",
"&",
"0x0003",
")",
";",
"color",
"=",
"(",
"color",
"&",
"0x00f0",
")",
">>",
"4",
";",
"sx",
"=",
"state",
"->",
"spvideoram",
"[",
"offs",
"+",
"4",
"]",
";",
"sy",
"=",
"state",
"->",
"spvideoram",
"[",
"offs",
"+",
"3",
"]",
";",
"attr",
"&=",
"~",
"0x0040",
";",
"if",
"(",
"attr",
"&",
"0x0040",
")",
"color",
"|=",
"0x0180",
";",
"else",
"color",
"|=",
"0x0080",
";",
"for",
"(",
"row",
"=",
"0",
";",
"row",
"<",
"size",
";",
"row",
"++",
")",
"{",
"for",
"(",
"col",
"=",
"0",
";",
"col",
"<",
"size",
";",
"col",
"++",
")",
"{",
"int",
"x",
"=",
"sx",
"+",
"8",
"*",
"(",
"flipx",
"?",
"(",
"size",
"-",
"1",
"-",
"col",
")",
":",
"col",
")",
";",
"int",
"y",
"=",
"sy",
"+",
"8",
"*",
"(",
"flipy",
"?",
"(",
"size",
"-",
"1",
"-",
"row",
")",
":",
"row",
")",
";",
"drawgfx_transpen_raw",
"(",
"bitmap",
",",
"cliprect",
",",
"machine",
"->",
"gfx",
"[",
"2",
"]",
",",
"code",
"+",
"layout",
"[",
"row",
"]",
"[",
"col",
"]",
",",
"machine",
"->",
"gfx",
"[",
"2",
"]",
"->",
"color_base",
"+",
"color",
"*",
"machine",
"->",
"gfx",
"[",
"2",
"]",
"->",
"color_granularity",
",",
"flipx",
",",
"flipy",
",",
"x",
",",
"y",
",",
"0",
")",
";",
"}",
"}",
"count",
"++",
";",
"}",
"}",
"return",
"count",
";",
"}"
] | from gals pinball (which was in turn from ninja gaiden) | [
"from",
"gals",
"pinball",
"(",
"which",
"was",
"in",
"turn",
"from",
"ninja",
"gaiden",
")"
] | [
"/* 1,2,4,8 */",
"/* !!! */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "priority",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f5a0ce342341e09de82326c28d3b7ccdc298cb62 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/i960/i960.c | [
"Unlicense"
] | C | i960_noburst | void | void i960_noburst(running_device *device)
{
i960_state_t *i960 = get_safe_token(device);
i960->bursting = 0;
} | // call from any read/write handler for a memory area that can't be bursted
// on the real hardware (e.g. Model 2's interrupt control registers)
| call from any read/write handler for a memory area that can't be bursted
on the real hardware | [
"call",
"from",
"any",
"read",
"/",
"write",
"handler",
"for",
"a",
"memory",
"area",
"that",
"can",
"'",
"t",
"be",
"bursted",
"on",
"the",
"real",
"hardware"
] | void i960_noburst(running_device *device)
{
i960_state_t *i960 = get_safe_token(device);
i960->bursting = 0;
} | [
"void",
"i960_noburst",
"(",
"running_device",
"*",
"device",
")",
"{",
"i960_state_t",
"*",
"i960",
"=",
"get_safe_token",
"(",
"device",
")",
";",
"i960",
"->",
"bursting",
"=",
"0",
";",
"}"
] | call from any read/write handler for a memory area that can't be bursted
on the real hardware (e.g. | [
"call",
"from",
"any",
"read",
"/",
"write",
"handler",
"for",
"a",
"memory",
"area",
"that",
"can",
"'",
"t",
"be",
"bursted",
"on",
"the",
"real",
"hardware",
"(",
"e",
".",
"g",
"."
] | [] | [
{
"param": "device",
"type": "running_device"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "running_device",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3ac0d1c29a68c448cd80eb529ffa7cb7e6b4419b | lofunz/mieme | Reloaded/trunk/src/mame/video/cps1.c | [
"Unlicense"
] | C | cps1_build_palette | void | static void cps1_build_palette( running_machine *machine, const UINT16* const palette_base )
{
cps_state *state = machine->driver_data<cps_state>();
int offset, page;
const UINT16 *palette_ram = palette_base;
int ctrl = state->cps_b_regs[state->game_config->palette_control/2];
/*
The palette is copied only for pages that are enabled in the ctrl
register. Note that if the first palette pages are skipped, all
the following pages are scaled down.
*/
for (page = 0; page < 6; ++page)
{
if (BIT(ctrl, page))
{
for (offset = 0; offset < 0x200; ++offset)
{
int palette = *(palette_ram++);
int r, g, b, bright;
// from my understanding of the schematics, when the 'brightness'
// component is set to 0 it should reduce brightness to 1/3
bright = 0x0f + ((palette >> 12) << 1);
r = ((palette >> 8) & 0x0f) * 0x11 * bright / 0x2d;
g = ((palette >> 4) & 0x0f) * 0x11 * bright / 0x2d;
b = ((palette >> 0) & 0x0f) * 0x11 * bright / 0x2d;
palette_set_color (machine, 0x200 * page + offset, MAKE_RGB(r, g, b));
}
}
else
{
// skip page in gfxram, but only if we have already copied at least one page
if (palette_ram != palette_base)
palette_ram += 0x200;
}
}
} | /***************************************************************************
Build palette from palette RAM
12 bit RGB with a 4 bit brightness value.
***************************************************************************/ | Build palette from palette RAM
12 bit RGB with a 4 bit brightness value. | [
"Build",
"palette",
"from",
"palette",
"RAM",
"12",
"bit",
"RGB",
"with",
"a",
"4",
"bit",
"brightness",
"value",
"."
] | static void cps1_build_palette( running_machine *machine, const UINT16* const palette_base )
{
cps_state *state = machine->driver_data<cps_state>();
int offset, page;
const UINT16 *palette_ram = palette_base;
int ctrl = state->cps_b_regs[state->game_config->palette_control/2];
for (page = 0; page < 6; ++page)
{
if (BIT(ctrl, page))
{
for (offset = 0; offset < 0x200; ++offset)
{
int palette = *(palette_ram++);
int r, g, b, bright;
bright = 0x0f + ((palette >> 12) << 1);
r = ((palette >> 8) & 0x0f) * 0x11 * bright / 0x2d;
g = ((palette >> 4) & 0x0f) * 0x11 * bright / 0x2d;
b = ((palette >> 0) & 0x0f) * 0x11 * bright / 0x2d;
palette_set_color (machine, 0x200 * page + offset, MAKE_RGB(r, g, b));
}
}
else
{
if (palette_ram != palette_base)
palette_ram += 0x200;
}
}
} | [
"static",
"void",
"cps1_build_palette",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"UINT16",
"*",
"const",
"palette_base",
")",
"{",
"cps_state",
"*",
"state",
"=",
"machine",
"->",
"driver_data",
"<",
"cps_state",
">",
"(",
"",
")",
";",
"int",
"offset",
",",
"page",
";",
"const",
"UINT16",
"*",
"palette_ram",
"=",
"palette_base",
";",
"int",
"ctrl",
"=",
"state",
"->",
"cps_b_regs",
"[",
"state",
"->",
"game_config",
"->",
"palette_control",
"/",
"2",
"]",
";",
"for",
"(",
"page",
"=",
"0",
";",
"page",
"<",
"6",
";",
"++",
"page",
")",
"{",
"if",
"(",
"BIT",
"(",
"ctrl",
",",
"page",
")",
")",
"{",
"for",
"(",
"offset",
"=",
"0",
";",
"offset",
"<",
"0x200",
";",
"++",
"offset",
")",
"{",
"int",
"palette",
"=",
"*",
"(",
"palette_ram",
"++",
")",
";",
"int",
"r",
",",
"g",
",",
"b",
",",
"bright",
";",
"bright",
"=",
"0x0f",
"+",
"(",
"(",
"palette",
">>",
"12",
")",
"<<",
"1",
")",
";",
"r",
"=",
"(",
"(",
"palette",
">>",
"8",
")",
"&",
"0x0f",
")",
"*",
"0x11",
"*",
"bright",
"/",
"0x2d",
";",
"g",
"=",
"(",
"(",
"palette",
">>",
"4",
")",
"&",
"0x0f",
")",
"*",
"0x11",
"*",
"bright",
"/",
"0x2d",
";",
"b",
"=",
"(",
"(",
"palette",
">>",
"0",
")",
"&",
"0x0f",
")",
"*",
"0x11",
"*",
"bright",
"/",
"0x2d",
";",
"palette_set_color",
"(",
"machine",
",",
"0x200",
"*",
"page",
"+",
"offset",
",",
"MAKE_RGB",
"(",
"r",
",",
"g",
",",
"b",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"palette_ram",
"!=",
"palette_base",
")",
"palette_ram",
"+=",
"0x200",
";",
"}",
"}",
"}"
] | Build palette from palette RAM
12 bit RGB with a 4 bit brightness value. | [
"Build",
"palette",
"from",
"palette",
"RAM",
"12",
"bit",
"RGB",
"with",
"a",
"4",
"bit",
"brightness",
"value",
"."
] | [
"/*\r\n The palette is copied only for pages that are enabled in the ctrl\r\n register. Note that if the first palette pages are skipped, all\r\n the following pages are scaled down.\r\n */",
"// from my understanding of the schematics, when the 'brightness'\r",
"// component is set to 0 it should reduce brightness to 1/3\r",
"// skip page in gfxram, but only if we have already copied at least one page\r"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "palette_base",
"type": "UINT16"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "palette_base",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3ac0d1c29a68c448cd80eb529ffa7cb7e6b4419b | lofunz/mieme | Reloaded/trunk/src/mame/video/cps1.c | [
"Unlicense"
] | C | cps1_find_last_sprite | void | static void cps1_find_last_sprite( running_machine *machine ) /* Find the offset of last sprite */
{
cps_state *state = machine->driver_data<cps_state>();
int offset = 0;
/* Locate the end of table marker */
while (offset < state->obj_size / 2)
{
int colour = state->buffered_obj[offset + 3];
if ((colour & 0xff00) == 0xff00)
{
/* Marker found. This is the last sprite. */
state->last_sprite_offset = offset - 4;
return;
}
offset += 4;
}
/* Sprites must use full sprite RAM */
state->last_sprite_offset = state->obj_size / 2 - 4;
} | /***************************************************************************
Sprites
=======
Sprites are represented by a number of 8 byte values
xx xx yy yy nn nn aa aa
where xxxx = x position
yyyy = y position
nnnn = tile number
aaaa = attribute word
0x0001 colour
0x0002 colour
0x0004 colour
0x0008 colour
0x0010 colour
0x0020 X Flip
0x0040 Y Flip
0x0080 X & Y offset toggle (used in Marvel vs. Capcom.)
0x0100 X block size (in sprites)
0x0200 X block size
0x0400 X block size
0x0800 X block size
0x1000 Y block size (in sprites)
0x2000 Y block size
0x4000 Y block size
0x8000 Y block size
The end of the table (may) be marked by an attribute value of 0xff00.
***************************************************************************/ | Sprites
Sprites are represented by a number of 8 byte values
xx xx yy yy nn nn aa aa
The end of the table (may) be marked by an attribute value of 0xff00. | [
"Sprites",
"Sprites",
"are",
"represented",
"by",
"a",
"number",
"of",
"8",
"byte",
"values",
"xx",
"xx",
"yy",
"yy",
"nn",
"nn",
"aa",
"aa",
"The",
"end",
"of",
"the",
"table",
"(",
"may",
")",
"be",
"marked",
"by",
"an",
"attribute",
"value",
"of",
"0xff00",
"."
] | static void cps1_find_last_sprite( running_machine *machine )
{
cps_state *state = machine->driver_data<cps_state>();
int offset = 0;
while (offset < state->obj_size / 2)
{
int colour = state->buffered_obj[offset + 3];
if ((colour & 0xff00) == 0xff00)
{
state->last_sprite_offset = offset - 4;
return;
}
offset += 4;
}
state->last_sprite_offset = state->obj_size / 2 - 4;
} | [
"static",
"void",
"cps1_find_last_sprite",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"cps_state",
"*",
"state",
"=",
"machine",
"->",
"driver_data",
"<",
"cps_state",
">",
"(",
"",
")",
";",
"int",
"offset",
"=",
"0",
";",
"while",
"(",
"offset",
"<",
"state",
"->",
"obj_size",
"/",
"2",
")",
"{",
"int",
"colour",
"=",
"state",
"->",
"buffered_obj",
"[",
"offset",
"+",
"3",
"]",
";",
"if",
"(",
"(",
"colour",
"&",
"0xff00",
")",
"==",
"0xff00",
")",
"{",
"state",
"->",
"last_sprite_offset",
"=",
"offset",
"-",
"4",
";",
"return",
";",
"}",
"offset",
"+=",
"4",
";",
"}",
"state",
"->",
"last_sprite_offset",
"=",
"state",
"->",
"obj_size",
"/",
"2",
"-",
"4",
";",
"}"
] | Sprites | [
"Sprites"
] | [
"/* Find the offset of last sprite */",
"/* Locate the end of table marker */",
"/* Marker found. This is the last sprite. */",
"/* Sprites must use full sprite RAM */"
] | [
{
"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": []
} |
3ad15b1b15942f172d553ebf2caa0b51c7e5da9f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/textbuf.c | [
"Unlicense"
] | C | text_buffer_free | void | void text_buffer_free(text_buffer *text)
{
if (text->lineoffs)
free(text->lineoffs);
if (text->buffer)
free(text->buffer);
free(text);
} | /*-------------------------------------------------
text_buffer_free - free a previously allocated
text buffer
-------------------------------------------------*/ | free a previously allocated
text buffer | [
"free",
"a",
"previously",
"allocated",
"text",
"buffer"
] | void text_buffer_free(text_buffer *text)
{
if (text->lineoffs)
free(text->lineoffs);
if (text->buffer)
free(text->buffer);
free(text);
} | [
"void",
"text_buffer_free",
"(",
"text_buffer",
"*",
"text",
")",
"{",
"if",
"(",
"text",
"->",
"lineoffs",
")",
"free",
"(",
"text",
"->",
"lineoffs",
")",
";",
"if",
"(",
"text",
"->",
"buffer",
")",
"free",
"(",
"text",
"->",
"buffer",
")",
";",
"free",
"(",
"text",
")",
";",
"}"
] | text_buffer_free - free a previously allocated
text buffer | [
"text_buffer_free",
"-",
"free",
"a",
"previously",
"allocated",
"text",
"buffer"
] | [] | [
{
"param": "text",
"type": "text_buffer"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "text",
"type": "text_buffer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3ad15b1b15942f172d553ebf2caa0b51c7e5da9f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/textbuf.c | [
"Unlicense"
] | C | text_buffer_print_wrap | void | void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol)
{
INT32 stopcol = (wrapcol < MAX_LINE_LENGTH) ? wrapcol : MAX_LINE_LENGTH;
INT32 needed_space;
/* we need to ensure there is enough space for this string plus enough for the max line length */
needed_space = (INT32)strlen(data) + MAX_LINE_LENGTH;
/* make space in the buffer if we need to */
while (buffer_space(text) < needed_space && text->linestart != text->lineend)
{
text->linestartseq++;
if (++text->linestart >= text->linesize)
text->linestart = 0;
text->bufstart = text->lineoffs[text->linestart];
}
/* now add the data */
for ( ; *data; data++)
{
int ch = *data;
int linelen;
/* a CR resets our position */
if (ch == '\r')
text->bufend = text->lineoffs[text->lineend];
/* non-CR data is just characters */
else if (ch != '\n')
text->buffer[text->bufend++] = ch;
/* an explicit newline or line-too-long condition inserts a newline */
linelen = text->bufend - text->lineoffs[text->lineend];
if (ch == '\n' || linelen >= stopcol)
{
int overflow = 0;
/* if we're wrapping, back off until we hit a space */
if (linelen >= wrapcol)
{
/* scan backwards, removing characters along the way */
overflow = 1;
while (overflow < linelen && text->buffer[text->bufend - overflow] != ' ')
overflow++;
/* if we found a space, take it; otherwise, reset and pretend we didn't try */
if (overflow < linelen)
linelen -= overflow;
else
overflow = 0;
}
/* did we beat the max width */
if (linelen > text->maxwidth)
text->maxwidth = linelen;
/* append a terminator */
if (overflow == 0)
text->buffer[text->bufend++] = 0;
else
text->buffer[text->bufend - overflow] = 0;
/* determine what the next line will be */
if (++text->lineend >= text->linesize)
text->lineend = 0;
/* if we're out of lines, consume the next one */
if (text->lineend == text->linestart)
{
text->linestartseq++;
if (++text->linestart >= text->linesize)
text->linestart = 0;
text->bufstart = text->lineoffs[text->linestart];
}
/* if we don't have enough room in the buffer for a max line, wrap to the start */
if (text->bufend + MAX_LINE_LENGTH + 1 >= text->bufsize)
text->bufend = 0;
/* create a new empty line */
text->lineoffs[text->lineend] = text->bufend - (overflow ? (overflow - 1) : 0);
}
}
/* NULL terminate what we have on this line */
text->buffer[text->bufend] = 0;
} | /*-------------------------------------------------
text_buffer_print_wrap - print data to the
text buffer with word wrapping to a given
column
-------------------------------------------------*/ | print data to the
text buffer with word wrapping to a given
column | [
"print",
"data",
"to",
"the",
"text",
"buffer",
"with",
"word",
"wrapping",
"to",
"a",
"given",
"column"
] | void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol)
{
INT32 stopcol = (wrapcol < MAX_LINE_LENGTH) ? wrapcol : MAX_LINE_LENGTH;
INT32 needed_space;
needed_space = (INT32)strlen(data) + MAX_LINE_LENGTH;
while (buffer_space(text) < needed_space && text->linestart != text->lineend)
{
text->linestartseq++;
if (++text->linestart >= text->linesize)
text->linestart = 0;
text->bufstart = text->lineoffs[text->linestart];
}
for ( ; *data; data++)
{
int ch = *data;
int linelen;
if (ch == '\r')
text->bufend = text->lineoffs[text->lineend];
else if (ch != '\n')
text->buffer[text->bufend++] = ch;
linelen = text->bufend - text->lineoffs[text->lineend];
if (ch == '\n' || linelen >= stopcol)
{
int overflow = 0;
if (linelen >= wrapcol)
{
overflow = 1;
while (overflow < linelen && text->buffer[text->bufend - overflow] != ' ')
overflow++;
if (overflow < linelen)
linelen -= overflow;
else
overflow = 0;
}
if (linelen > text->maxwidth)
text->maxwidth = linelen;
if (overflow == 0)
text->buffer[text->bufend++] = 0;
else
text->buffer[text->bufend - overflow] = 0;
if (++text->lineend >= text->linesize)
text->lineend = 0;
if (text->lineend == text->linestart)
{
text->linestartseq++;
if (++text->linestart >= text->linesize)
text->linestart = 0;
text->bufstart = text->lineoffs[text->linestart];
}
if (text->bufend + MAX_LINE_LENGTH + 1 >= text->bufsize)
text->bufend = 0;
text->lineoffs[text->lineend] = text->bufend - (overflow ? (overflow - 1) : 0);
}
}
text->buffer[text->bufend] = 0;
} | [
"void",
"text_buffer_print_wrap",
"(",
"text_buffer",
"*",
"text",
",",
"const",
"char",
"*",
"data",
",",
"int",
"wrapcol",
")",
"{",
"INT32",
"stopcol",
"=",
"(",
"wrapcol",
"<",
"MAX_LINE_LENGTH",
")",
"?",
"wrapcol",
":",
"MAX_LINE_LENGTH",
";",
"INT32",
"needed_space",
";",
"needed_space",
"=",
"(",
"INT32",
")",
"strlen",
"(",
"data",
")",
"+",
"MAX_LINE_LENGTH",
";",
"while",
"(",
"buffer_space",
"(",
"text",
")",
"<",
"needed_space",
"&&",
"text",
"->",
"linestart",
"!=",
"text",
"->",
"lineend",
")",
"{",
"text",
"->",
"linestartseq",
"++",
";",
"if",
"(",
"++",
"text",
"->",
"linestart",
">=",
"text",
"->",
"linesize",
")",
"text",
"->",
"linestart",
"=",
"0",
";",
"text",
"->",
"bufstart",
"=",
"text",
"->",
"lineoffs",
"[",
"text",
"->",
"linestart",
"]",
";",
"}",
"for",
"(",
";",
"*",
"data",
";",
"data",
"++",
")",
"{",
"int",
"ch",
"=",
"*",
"data",
";",
"int",
"linelen",
";",
"if",
"(",
"ch",
"==",
"'",
"\\r",
"'",
")",
"text",
"->",
"bufend",
"=",
"text",
"->",
"lineoffs",
"[",
"text",
"->",
"lineend",
"]",
";",
"else",
"if",
"(",
"ch",
"!=",
"'",
"\\n",
"'",
")",
"text",
"->",
"buffer",
"[",
"text",
"->",
"bufend",
"++",
"]",
"=",
"ch",
";",
"linelen",
"=",
"text",
"->",
"bufend",
"-",
"text",
"->",
"lineoffs",
"[",
"text",
"->",
"lineend",
"]",
";",
"if",
"(",
"ch",
"==",
"'",
"\\n",
"'",
"||",
"linelen",
">=",
"stopcol",
")",
"{",
"int",
"overflow",
"=",
"0",
";",
"if",
"(",
"linelen",
">=",
"wrapcol",
")",
"{",
"overflow",
"=",
"1",
";",
"while",
"(",
"overflow",
"<",
"linelen",
"&&",
"text",
"->",
"buffer",
"[",
"text",
"->",
"bufend",
"-",
"overflow",
"]",
"!=",
"'",
"'",
")",
"overflow",
"++",
";",
"if",
"(",
"overflow",
"<",
"linelen",
")",
"linelen",
"-=",
"overflow",
";",
"else",
"overflow",
"=",
"0",
";",
"}",
"if",
"(",
"linelen",
">",
"text",
"->",
"maxwidth",
")",
"text",
"->",
"maxwidth",
"=",
"linelen",
";",
"if",
"(",
"overflow",
"==",
"0",
")",
"text",
"->",
"buffer",
"[",
"text",
"->",
"bufend",
"++",
"]",
"=",
"0",
";",
"else",
"text",
"->",
"buffer",
"[",
"text",
"->",
"bufend",
"-",
"overflow",
"]",
"=",
"0",
";",
"if",
"(",
"++",
"text",
"->",
"lineend",
">=",
"text",
"->",
"linesize",
")",
"text",
"->",
"lineend",
"=",
"0",
";",
"if",
"(",
"text",
"->",
"lineend",
"==",
"text",
"->",
"linestart",
")",
"{",
"text",
"->",
"linestartseq",
"++",
";",
"if",
"(",
"++",
"text",
"->",
"linestart",
">=",
"text",
"->",
"linesize",
")",
"text",
"->",
"linestart",
"=",
"0",
";",
"text",
"->",
"bufstart",
"=",
"text",
"->",
"lineoffs",
"[",
"text",
"->",
"linestart",
"]",
";",
"}",
"if",
"(",
"text",
"->",
"bufend",
"+",
"MAX_LINE_LENGTH",
"+",
"1",
">=",
"text",
"->",
"bufsize",
")",
"text",
"->",
"bufend",
"=",
"0",
";",
"text",
"->",
"lineoffs",
"[",
"text",
"->",
"lineend",
"]",
"=",
"text",
"->",
"bufend",
"-",
"(",
"overflow",
"?",
"(",
"overflow",
"-",
"1",
")",
":",
"0",
")",
";",
"}",
"}",
"text",
"->",
"buffer",
"[",
"text",
"->",
"bufend",
"]",
"=",
"0",
";",
"}"
] | text_buffer_print_wrap - print data to the
text buffer with word wrapping to a given
column | [
"text_buffer_print_wrap",
"-",
"print",
"data",
"to",
"the",
"text",
"buffer",
"with",
"word",
"wrapping",
"to",
"a",
"given",
"column"
] | [
"/* we need to ensure there is enough space for this string plus enough for the max line length */",
"/* make space in the buffer if we need to */",
"/* now add the data */",
"/* a CR resets our position */",
"/* non-CR data is just characters */",
"/* an explicit newline or line-too-long condition inserts a newline */",
"/* if we're wrapping, back off until we hit a space */",
"/* scan backwards, removing characters along the way */",
"/* if we found a space, take it; otherwise, reset and pretend we didn't try */",
"/* did we beat the max width */",
"/* append a terminator */",
"/* determine what the next line will be */",
"/* if we're out of lines, consume the next one */",
"/* if we don't have enough room in the buffer for a max line, wrap to the start */",
"/* create a new empty line */",
"/* NULL terminate what we have on this line */"
] | [
{
"param": "text",
"type": "text_buffer"
},
{
"param": "data",
"type": "char"
},
{
"param": "wrapcol",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "text",
"type": "text_buffer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wrapcol",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3ad15b1b15942f172d553ebf2caa0b51c7e5da9f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/textbuf.c | [
"Unlicense"
] | C | text_buffer_num_lines | UINT32 | UINT32 text_buffer_num_lines(text_buffer *text)
{
INT32 lines = text->lineend + 1 - text->linestart;
if (lines <= 0)
lines += text->linesize;
return lines;
} | /*-------------------------------------------------
text_buffer_num_lines - return the number of
lines in the text buffer
-------------------------------------------------*/ | return the number of
lines in the text buffer | [
"return",
"the",
"number",
"of",
"lines",
"in",
"the",
"text",
"buffer"
] | UINT32 text_buffer_num_lines(text_buffer *text)
{
INT32 lines = text->lineend + 1 - text->linestart;
if (lines <= 0)
lines += text->linesize;
return lines;
} | [
"UINT32",
"text_buffer_num_lines",
"(",
"text_buffer",
"*",
"text",
")",
"{",
"INT32",
"lines",
"=",
"text",
"->",
"lineend",
"+",
"1",
"-",
"text",
"->",
"linestart",
";",
"if",
"(",
"lines",
"<=",
"0",
")",
"lines",
"+=",
"text",
"->",
"linesize",
";",
"return",
"lines",
";",
"}"
] | text_buffer_num_lines - return the number of
lines in the text buffer | [
"text_buffer_num_lines",
"-",
"return",
"the",
"number",
"of",
"lines",
"in",
"the",
"text",
"buffer"
] | [] | [
{
"param": "text",
"type": "text_buffer"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "text",
"type": "text_buffer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3ad15b1b15942f172d553ebf2caa0b51c7e5da9f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/textbuf.c | [
"Unlicense"
] | C | text_buffer_get_seqnum_line | char | const char *text_buffer_get_seqnum_line(text_buffer *text, UINT32 seqnum)
{
UINT32 numlines = text_buffer_num_lines(text);
UINT32 index = seqnum - text->linestartseq;
if (index >= numlines)
return NULL;
return &text->buffer[text->lineoffs[(text->linestart + index) % text->linesize]];
} | /*-------------------------------------------------
text_buffer_get_seqnum_line - get a pointer to
an indexed line in the buffer
-------------------------------------------------*/ | get a pointer to
an indexed line in the buffer | [
"get",
"a",
"pointer",
"to",
"an",
"indexed",
"line",
"in",
"the",
"buffer"
] | const char *text_buffer_get_seqnum_line(text_buffer *text, UINT32 seqnum)
{
UINT32 numlines = text_buffer_num_lines(text);
UINT32 index = seqnum - text->linestartseq;
if (index >= numlines)
return NULL;
return &text->buffer[text->lineoffs[(text->linestart + index) % text->linesize]];
} | [
"const",
"char",
"*",
"text_buffer_get_seqnum_line",
"(",
"text_buffer",
"*",
"text",
",",
"UINT32",
"seqnum",
")",
"{",
"UINT32",
"numlines",
"=",
"text_buffer_num_lines",
"(",
"text",
")",
";",
"UINT32",
"index",
"=",
"seqnum",
"-",
"text",
"->",
"linestartseq",
";",
"if",
"(",
"index",
">=",
"numlines",
")",
"return",
"NULL",
";",
"return",
"&",
"text",
"->",
"buffer",
"[",
"text",
"->",
"lineoffs",
"[",
"(",
"text",
"->",
"linestart",
"+",
"index",
")",
"%",
"text",
"->",
"linesize",
"]",
"]",
";",
"}"
] | text_buffer_get_seqnum_line - get a pointer to
an indexed line in the buffer | [
"text_buffer_get_seqnum_line",
"-",
"get",
"a",
"pointer",
"to",
"an",
"indexed",
"line",
"in",
"the",
"buffer"
] | [] | [
{
"param": "text",
"type": "text_buffer"
},
{
"param": "seqnum",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "text",
"type": "text_buffer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seqnum",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c4618554f2ca2ddc120f62a31a38f1f9ccc56d2b | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/audio/generic.c | [
"Unlicense"
] | C | generic_sound_init | int | int generic_sound_init(running_machine *machine)
{
/* reset latches */
latch_clear_value = 0;
memset(latched_value, 0, sizeof(latched_value));
memset(latch_read, 0, sizeof(latch_read));
/* register globals with the save state system */
state_save_register_global_array(machine, latched_value);
state_save_register_global_array(machine, latch_read);
return 0;
} | /*-------------------------------------------------
generic_sound_init - initialize globals and
register for save states
-------------------------------------------------*/ | initialize globals and
register for save states | [
"initialize",
"globals",
"and",
"register",
"for",
"save",
"states"
] | int generic_sound_init(running_machine *machine)
{
latch_clear_value = 0;
memset(latched_value, 0, sizeof(latched_value));
memset(latch_read, 0, sizeof(latch_read));
state_save_register_global_array(machine, latched_value);
state_save_register_global_array(machine, latch_read);
return 0;
} | [
"int",
"generic_sound_init",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"latch_clear_value",
"=",
"0",
";",
"memset",
"(",
"latched_value",
",",
"0",
",",
"sizeof",
"(",
"latched_value",
")",
")",
";",
"memset",
"(",
"latch_read",
",",
"0",
",",
"sizeof",
"(",
"latch_read",
")",
")",
";",
"state_save_register_global_array",
"(",
"machine",
",",
"latched_value",
")",
";",
"state_save_register_global_array",
"(",
"machine",
",",
"latch_read",
")",
";",
"return",
"0",
";",
"}"
] | generic_sound_init - initialize globals and
register for save states | [
"generic_sound_init",
"-",
"initialize",
"globals",
"and",
"register",
"for",
"save",
"states"
] | [
"/* reset latches */",
"/* register globals with the save state system */"
] | [
{
"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": []
} |
c4618554f2ca2ddc120f62a31a38f1f9ccc56d2b | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/audio/generic.c | [
"Unlicense"
] | C | soundlatch_setclearedvalue | void | void soundlatch_setclearedvalue(running_machine *machine, int value)
{
assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call soundlatch_setclearedvalue at init time!");
latch_clear_value = value;
} | /*-------------------------------------------------
soundlatch_setclearedvalue - set the "clear"
value for all sound latches
-------------------------------------------------*/ | set the "clear"
value for all sound latches | [
"set",
"the",
"\"",
"clear",
"\"",
"value",
"for",
"all",
"sound",
"latches"
] | void soundlatch_setclearedvalue(running_machine *machine, int value)
{
assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call soundlatch_setclearedvalue at init time!");
latch_clear_value = value;
} | [
"void",
"soundlatch_setclearedvalue",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"value",
")",
"{",
"assert_always",
"(",
"mame_get_phase",
"(",
"machine",
")",
"==",
"MAME_PHASE_INIT",
",",
"\"",
"\"",
")",
";",
"latch_clear_value",
"=",
"value",
";",
"}"
] | soundlatch_setclearedvalue - set the "clear"
value for all sound latches | [
"soundlatch_setclearedvalue",
"-",
"set",
"the",
"\"",
"clear",
"\"",
"value",
"for",
"all",
"sound",
"latches"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "value",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f50b1474ac9d35fba60b42e20eafb7f17000efa6 | lofunz/mieme | Reloaded/trunk/src/mame/drivers/karnov.c | [
"Unlicense"
] | C | karnov_i8751_w | void | static void karnov_i8751_w( running_machine *machine, int data )
{
karnov_state *state = machine->driver_data<karnov_state>();
/* Pending coin operations may cause protection commands to be queued */
if (state->i8751_needs_ack)
{
state->i8751_command_queue = data;
return;
}
state->i8751_return = 0;
if (data == 0x100 && state->microcontroller_id == KARNOVJ) /* Japan version */
state->i8751_return = 0x56a;
if (data == 0x100 && state->microcontroller_id == KARNOV) /* USA version */
state->i8751_return = 0x56b;
if ((data & 0xf00) == 0x300)
state->i8751_return = (data & 0xff) * 0x12; /* Player sprite mapping */
/* I'm not sure the ones marked ^ appear in the right order */
if (data == 0x400) state->i8751_return = 0x4000; /* Get The Map... */
if (data == 0x402) state->i8751_return = 0x40a6; /* Ancient Ruins */
if (data == 0x403) state->i8751_return = 0x4054; /* Forest... */
if (data == 0x404) state->i8751_return = 0x40de; /* ^Rocky hills */
if (data == 0x405) state->i8751_return = 0x4182; /* Sea */
if (data == 0x406) state->i8751_return = 0x41ca; /* Town */
if (data == 0x407) state->i8751_return = 0x421e; /* Desert */
if (data == 0x401) state->i8751_return = 0x4138; /* ^Whistling wind */
if (data == 0x408) state->i8751_return = 0x4276; /* ^Heavy Gates */
// if (!state->i8751_return && data != 0x300) logerror("%s - Unknown Write %02x intel\n", cpuexec_describe_context(machine), data);
cpu_set_input_line(state->maincpu, 6, HOLD_LINE); /* Signal main cpu task is complete */
state->i8751_needs_ack = 1;
} | /* Emulation of the protected microcontroller - for coins & general protection */ | Emulation of the protected microcontroller - for coins & general protection | [
"Emulation",
"of",
"the",
"protected",
"microcontroller",
"-",
"for",
"coins",
"&",
"general",
"protection"
] | static void karnov_i8751_w( running_machine *machine, int data )
{
karnov_state *state = machine->driver_data<karnov_state>();
if (state->i8751_needs_ack)
{
state->i8751_command_queue = data;
return;
}
state->i8751_return = 0;
if (data == 0x100 && state->microcontroller_id == KARNOVJ)
state->i8751_return = 0x56a;
if (data == 0x100 && state->microcontroller_id == KARNOV)
state->i8751_return = 0x56b;
if ((data & 0xf00) == 0x300)
state->i8751_return = (data & 0xff) * 0x12;
if (data == 0x400) state->i8751_return = 0x4000;
if (data == 0x402) state->i8751_return = 0x40a6;
if (data == 0x403) state->i8751_return = 0x4054;
if (data == 0x404) state->i8751_return = 0x40de;
if (data == 0x405) state->i8751_return = 0x4182;
if (data == 0x406) state->i8751_return = 0x41ca;
if (data == 0x407) state->i8751_return = 0x421e;
if (data == 0x401) state->i8751_return = 0x4138;
if (data == 0x408) state->i8751_return = 0x4276;
cpu_set_input_line(state->maincpu, 6, HOLD_LINE);
state->i8751_needs_ack = 1;
} | [
"static",
"void",
"karnov_i8751_w",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"data",
")",
"{",
"karnov_state",
"*",
"state",
"=",
"machine",
"->",
"driver_data",
"<",
"karnov_state",
">",
"(",
"",
")",
";",
"if",
"(",
"state",
"->",
"i8751_needs_ack",
")",
"{",
"state",
"->",
"i8751_command_queue",
"=",
"data",
";",
"return",
";",
"}",
"state",
"->",
"i8751_return",
"=",
"0",
";",
"if",
"(",
"data",
"==",
"0x100",
"&&",
"state",
"->",
"microcontroller_id",
"==",
"KARNOVJ",
")",
"state",
"->",
"i8751_return",
"=",
"0x56a",
";",
"if",
"(",
"data",
"==",
"0x100",
"&&",
"state",
"->",
"microcontroller_id",
"==",
"KARNOV",
")",
"state",
"->",
"i8751_return",
"=",
"0x56b",
";",
"if",
"(",
"(",
"data",
"&",
"0xf00",
")",
"==",
"0x300",
")",
"state",
"->",
"i8751_return",
"=",
"(",
"data",
"&",
"0xff",
")",
"*",
"0x12",
";",
"if",
"(",
"data",
"==",
"0x400",
")",
"state",
"->",
"i8751_return",
"=",
"0x4000",
";",
"if",
"(",
"data",
"==",
"0x402",
")",
"state",
"->",
"i8751_return",
"=",
"0x40a6",
";",
"if",
"(",
"data",
"==",
"0x403",
")",
"state",
"->",
"i8751_return",
"=",
"0x4054",
";",
"if",
"(",
"data",
"==",
"0x404",
")",
"state",
"->",
"i8751_return",
"=",
"0x40de",
";",
"if",
"(",
"data",
"==",
"0x405",
")",
"state",
"->",
"i8751_return",
"=",
"0x4182",
";",
"if",
"(",
"data",
"==",
"0x406",
")",
"state",
"->",
"i8751_return",
"=",
"0x41ca",
";",
"if",
"(",
"data",
"==",
"0x407",
")",
"state",
"->",
"i8751_return",
"=",
"0x421e",
";",
"if",
"(",
"data",
"==",
"0x401",
")",
"state",
"->",
"i8751_return",
"=",
"0x4138",
";",
"if",
"(",
"data",
"==",
"0x408",
")",
"state",
"->",
"i8751_return",
"=",
"0x4276",
";",
"cpu_set_input_line",
"(",
"state",
"->",
"maincpu",
",",
"6",
",",
"HOLD_LINE",
")",
";",
"state",
"->",
"i8751_needs_ack",
"=",
"1",
";",
"}"
] | Emulation of the protected microcontroller - for coins & general protection | [
"Emulation",
"of",
"the",
"protected",
"microcontroller",
"-",
"for",
"coins",
"&",
"general",
"protection"
] | [
"/* Pending coin operations may cause protection commands to be queued */",
"/* Japan version */",
"/* USA version */",
"/* Player sprite mapping */",
"/* I'm not sure the ones marked ^ appear in the right order */",
"/* Get The Map... */",
"/* Ancient Ruins */",
"/* Forest... */",
"/* ^Rocky hills */",
"/* Sea */",
"/* Town */",
"/* Desert */",
"/* ^Whistling wind */",
"/* ^Heavy Gates */",
"// if (!state->i8751_return && data != 0x300) logerror(\"%s - Unknown Write %02x intel\\n\", cpuexec_describe_context(machine), data);\r",
"/* Signal main cpu task is complete */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "data",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
be64c3d6a3d2cde0a545f6d94fb0f5bf0d3b6ae2 | lofunz/mieme | Reloaded/trunk/src/mame/video/psikyosh.c | [
"Unlicense"
] | C | draw_scanline32_alpha | void | static void draw_scanline32_alpha(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr, int alpha)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
UINT32 transpen = BG_TRANSPEN;
assert(bitmap != NULL);
assert(bitmap->bpp == 32);
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_COPY_TRANSPEN_ALPHARENDER32, NO_PRIORITY);
} | /*-------------------------------------------------
draw_scanline32_alpha - take an RGB-encoded UINT32
scanline and alpha-blend it into the destination bitmap
-------------------------------------------------*/ | take an RGB-encoded UINT32
scanline and alpha-blend it into the destination bitmap | [
"take",
"an",
"RGB",
"-",
"encoded",
"UINT32",
"scanline",
"and",
"alpha",
"-",
"blend",
"it",
"into",
"the",
"destination",
"bitmap"
] | static void draw_scanline32_alpha(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr, int alpha)
{
bitmap_t *priority = NULL;
UINT32 transpen = BG_TRANSPEN;
assert(bitmap != NULL);
assert(bitmap->bpp == 32);
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_COPY_TRANSPEN_ALPHARENDER32, NO_PRIORITY);
} | [
"static",
"void",
"draw_scanline32_alpha",
"(",
"bitmap_t",
"*",
"bitmap",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"INT32",
"length",
",",
"const",
"UINT32",
"*",
"srcptr",
",",
"int",
"alpha",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"UINT32",
"transpen",
"=",
"BG_TRANSPEN",
";",
"assert",
"(",
"bitmap",
"!=",
"NULL",
")",
";",
"assert",
"(",
"bitmap",
"->",
"bpp",
"==",
"32",
")",
";",
"DRAWSCANLINE_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_COPY_TRANSPEN_ALPHARENDER32",
",",
"NO_PRIORITY",
")",
";",
"}"
] | draw_scanline32_alpha - take an RGB-encoded UINT32
scanline and alpha-blend it into the destination bitmap | [
"draw_scanline32_alpha",
"-",
"take",
"an",
"RGB",
"-",
"encoded",
"UINT32",
"scanline",
"and",
"alpha",
"-",
"blend",
"it",
"into",
"the",
"destination",
"bitmap"
] | [
"/* dummy, no priority in this case */"
] | [
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "length",
"type": "INT32"
},
{
"param": "srcptr",
"type": "UINT32"
},
{
"param": "alpha",
"type": "int"
}
] | {
"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": "alpha",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
be64c3d6a3d2cde0a545f6d94fb0f5bf0d3b6ae2 | lofunz/mieme | Reloaded/trunk/src/mame/video/psikyosh.c | [
"Unlicense"
] | C | draw_scanline32_argb | void | static void draw_scanline32_argb(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
UINT32 transpen = BG_TRANSPEN;
assert(bitmap != NULL);
assert(bitmap->bpp == 32);
assert(bitmap->format == BITMAP_FORMAT_ARGB32);
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_COPY_TRANSPEN_ARGBRENDER32, NO_PRIORITY);
} | /*-------------------------------------------------
draw_scanline32_argb - take an ARGB-encoded UINT32
scanline and alpha-blend it into the destination bitmap
-------------------------------------------------*/ | take an ARGB-encoded UINT32
scanline and alpha-blend it into the destination bitmap | [
"take",
"an",
"ARGB",
"-",
"encoded",
"UINT32",
"scanline",
"and",
"alpha",
"-",
"blend",
"it",
"into",
"the",
"destination",
"bitmap"
] | static void draw_scanline32_argb(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr)
{
bitmap_t *priority = NULL;
UINT32 transpen = BG_TRANSPEN;
assert(bitmap != NULL);
assert(bitmap->bpp == 32);
assert(bitmap->format == BITMAP_FORMAT_ARGB32);
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_COPY_TRANSPEN_ARGBRENDER32, NO_PRIORITY);
} | [
"static",
"void",
"draw_scanline32_argb",
"(",
"bitmap_t",
"*",
"bitmap",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"INT32",
"length",
",",
"const",
"UINT32",
"*",
"srcptr",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"UINT32",
"transpen",
"=",
"BG_TRANSPEN",
";",
"assert",
"(",
"bitmap",
"!=",
"NULL",
")",
";",
"assert",
"(",
"bitmap",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"bitmap",
"->",
"format",
"==",
"BITMAP_FORMAT_ARGB32",
")",
";",
"DRAWSCANLINE_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_COPY_TRANSPEN_ARGBRENDER32",
",",
"NO_PRIORITY",
")",
";",
"}"
] | draw_scanline32_argb - take an ARGB-encoded UINT32
scanline and alpha-blend it into the destination bitmap | [
"draw_scanline32_argb",
"-",
"take",
"an",
"ARGB",
"-",
"encoded",
"UINT32",
"scanline",
"and",
"alpha",
"-",
"blend",
"it",
"into",
"the",
"destination",
"bitmap"
] | [
"/* dummy, no priority in this case */"
] | [
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "length",
"type": "INT32"
},
{
"param": "srcptr",
"type": "UINT32"
}
] | {
"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
}
],
"outlier_params": [],
"others": []
} |
be64c3d6a3d2cde0a545f6d94fb0f5bf0d3b6ae2 | lofunz/mieme | Reloaded/trunk/src/mame/video/psikyosh.c | [
"Unlicense"
] | C | draw_scanline32_transpen | void | static void draw_scanline32_transpen(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
UINT32 transpen = BG_TRANSPEN;
assert(bitmap != NULL);
assert(bitmap->bpp == 32);
assert(bitmap->format == BITMAP_FORMAT_ARGB32);
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_COPY_TRANSPEN_RENDER32, NO_PRIORITY);
} | /*-------------------------------------------------
draw_scanline32_tranpens - take an RGB-encoded UINT32
scanline and copy it into the destination bitmap, testing for the special ARGB transpen
-------------------------------------------------*/ | take an RGB-encoded UINT32
scanline and copy it into the destination bitmap, testing for the special ARGB transpen | [
"take",
"an",
"RGB",
"-",
"encoded",
"UINT32",
"scanline",
"and",
"copy",
"it",
"into",
"the",
"destination",
"bitmap",
"testing",
"for",
"the",
"special",
"ARGB",
"transpen"
] | static void draw_scanline32_transpen(bitmap_t *bitmap, INT32 destx, INT32 desty, INT32 length, const UINT32 *srcptr)
{
bitmap_t *priority = NULL;
UINT32 transpen = BG_TRANSPEN;
assert(bitmap != NULL);
assert(bitmap->bpp == 32);
assert(bitmap->format == BITMAP_FORMAT_ARGB32);
DRAWSCANLINE_CORE(UINT32, PIXEL_OP_COPY_TRANSPEN_RENDER32, NO_PRIORITY);
} | [
"static",
"void",
"draw_scanline32_transpen",
"(",
"bitmap_t",
"*",
"bitmap",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"INT32",
"length",
",",
"const",
"UINT32",
"*",
"srcptr",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"UINT32",
"transpen",
"=",
"BG_TRANSPEN",
";",
"assert",
"(",
"bitmap",
"!=",
"NULL",
")",
";",
"assert",
"(",
"bitmap",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"bitmap",
"->",
"format",
"==",
"BITMAP_FORMAT_ARGB32",
")",
";",
"DRAWSCANLINE_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_COPY_TRANSPEN_RENDER32",
",",
"NO_PRIORITY",
")",
";",
"}"
] | draw_scanline32_tranpens - take an RGB-encoded UINT32
scanline and copy it into the destination bitmap, testing for the special ARGB transpen | [
"draw_scanline32_tranpens",
"-",
"take",
"an",
"RGB",
"-",
"encoded",
"UINT32",
"scanline",
"and",
"copy",
"it",
"into",
"the",
"destination",
"bitmap",
"testing",
"for",
"the",
"special",
"ARGB",
"transpen"
] | [
"/* dummy, no priority in this case */"
] | [
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "destx",
"type": "INT32"
},
{
"param": "desty",
"type": "INT32"
},
{
"param": "length",
"type": "INT32"
},
{
"param": "srcptr",
"type": "UINT32"
}
] | {
"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
}
],
"outlier_params": [],
"others": []
} |
be64c3d6a3d2cde0a545f6d94fb0f5bf0d3b6ae2 | lofunz/mieme | Reloaded/trunk/src/mame/video/psikyosh.c | [
"Unlicense"
] | C | drawgfx_alphastore | void | static void drawgfx_alphastore(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
int fixedalpha)
{
bitmap_t *priority = NULL; /* dummy, no priority in this case */
const pen_t *paldata;
assert(dest != NULL);
assert(dest->bpp == 32);
assert(dest->format == BITMAP_FORMAT_ARGB32);
assert(gfx != NULL);
assert(alphatable != NULL);
/* if we have a fixed alpha, call the standard drawgfx_transpen */
if (fixedalpha == 0xff)
{
drawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, 0);
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->pen_usage[code] & ~(1 << 0)) == 0)
return;
if (fixedalpha >= 0)
{
UINT8 alpha = fixedalpha;
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANS0_ALPHASTORE32, NO_PRIORITY);
}
else
{
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANS0_ALPHATABLESTORE32, NO_PRIORITY);
}
} | /*-------------------------------------------------
drawgfx_alphastore - render a gfx element with
a single transparent pen, storing the alpha value
in alpha field of ARGB32, negative alpha implies alphatable
-------------------------------------------------*/ | render a gfx element with
a single transparent pen, storing the alpha value
in alpha field of ARGB32, negative alpha implies alphatable | [
"render",
"a",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"storing",
"the",
"alpha",
"value",
"in",
"alpha",
"field",
"of",
"ARGB32",
"negative",
"alpha",
"implies",
"alphatable"
] | static void drawgfx_alphastore(bitmap_t *dest, const rectangle *cliprect, const gfx_element *gfx,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
int fixedalpha)
{
bitmap_t *priority = NULL;
const pen_t *paldata;
assert(dest != NULL);
assert(dest->bpp == 32);
assert(dest->format == BITMAP_FORMAT_ARGB32);
assert(gfx != NULL);
assert(alphatable != NULL);
if (fixedalpha == 0xff)
{
drawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, 0);
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->pen_usage[code] & ~(1 << 0)) == 0)
return;
if (fixedalpha >= 0)
{
UINT8 alpha = fixedalpha;
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANS0_ALPHASTORE32, NO_PRIORITY);
}
else
{
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANS0_ALPHATABLESTORE32, NO_PRIORITY);
}
} | [
"static",
"void",
"drawgfx_alphastore",
"(",
"bitmap_t",
"*",
"dest",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"INT32",
"destx",
",",
"INT32",
"desty",
",",
"int",
"fixedalpha",
")",
"{",
"bitmap_t",
"*",
"priority",
"=",
"NULL",
";",
"const",
"pen_t",
"*",
"paldata",
";",
"assert",
"(",
"dest",
"!=",
"NULL",
")",
";",
"assert",
"(",
"dest",
"->",
"bpp",
"==",
"32",
")",
";",
"assert",
"(",
"dest",
"->",
"format",
"==",
"BITMAP_FORMAT_ARGB32",
")",
";",
"assert",
"(",
"gfx",
"!=",
"NULL",
")",
";",
"assert",
"(",
"alphatable",
"!=",
"NULL",
")",
";",
"if",
"(",
"fixedalpha",
"==",
"0xff",
")",
"{",
"drawgfx_transpen",
"(",
"dest",
",",
"cliprect",
",",
"gfx",
",",
"code",
",",
"color",
",",
"flipx",
",",
"flipy",
",",
"destx",
",",
"desty",
",",
"0",
")",
";",
"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",
"->",
"pen_usage",
"[",
"code",
"]",
"&",
"~",
"(",
"1",
"<<",
"0",
")",
")",
"==",
"0",
")",
"return",
";",
"if",
"(",
"fixedalpha",
">=",
"0",
")",
"{",
"UINT8",
"alpha",
"=",
"fixedalpha",
";",
"DRAWGFX_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANS0_ALPHASTORE32",
",",
"NO_PRIORITY",
")",
";",
"}",
"else",
"{",
"DRAWGFX_CORE",
"(",
"UINT32",
",",
"PIXEL_OP_REMAP_TRANS0_ALPHATABLESTORE32",
",",
"NO_PRIORITY",
")",
";",
"}",
"}"
] | drawgfx_alphastore - render a gfx element with
a single transparent pen, storing the alpha value
in alpha field of ARGB32, negative alpha implies alphatable | [
"drawgfx_alphastore",
"-",
"render",
"a",
"gfx",
"element",
"with",
"a",
"single",
"transparent",
"pen",
"storing",
"the",
"alpha",
"value",
"in",
"alpha",
"field",
"of",
"ARGB32",
"negative",
"alpha",
"implies",
"alphatable"
] | [
"/* dummy, no priority in this case */",
"/* if we have a fixed alpha, call the standard drawgfx_transpen */",
"/* get final code and color, and grab lookup tables */",
"/* early out if completely transparent */"
] | [
{
"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": "fixedalpha",
"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": "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": "fixedalpha",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
be64c3d6a3d2cde0a545f6d94fb0f5bf0d3b6ae2 | lofunz/mieme | Reloaded/trunk/src/mame/video/psikyosh.c | [
"Unlicense"
] | C | draw_bglayer | void | static void draw_bglayer( running_machine *machine, int layer, bitmap_t *bitmap, const rectangle *cliprect, UINT8 req_pri )
{
psikyosh_state *state = machine->driver_data<psikyosh_state>();
gfx_element *gfx;
int offs = 0, sx, sy;
int scrollx, scrolly, regbank, tilebank, alpha, alphamap, zoom, pri, size, width;
assert(!BG_LINE(layer));
gfx = BG_DEPTH_8BPP(layer) ? machine->gfx[1] : machine->gfx[0];
size = BG_LARGE(layer) ? 32 : 16;
width = 16 * size;
regbank = BG_TYPE(layer);
scrollx = (state->bgram[(regbank * 0x800) / 4 + 0x3f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x000001ff) >> 0;
scrolly = (state->bgram[(regbank * 0x800) / 4 + 0x3f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x03ff0000) >> 16;
tilebank = (state->bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x000000ff) >> 0;
alpha = (state->bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x00003f00) >> 8;
alphamap = (state->bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x00008000) >> 15;
zoom = (state->bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x00ff0000) >> 16;
pri = (state->bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0xff000000) >> 24;
if(pri != req_pri) return;
if (alphamap) /* alpha values are per-pen */
alpha = -1;
else
alpha = pal6bit(0x3f - alpha); /* 0x3f-0x00 maps to 0x00-0xff */
if(zoom) {
popmessage("draw_bglayer() zoom not implemented\nContact MAMEDEV");
}
if ((tilebank >= 0x0a) && (tilebank <= 0x1f)) /* 20 banks of 0x800 bytes. filter garbage. */
{
for (sy = 0; sy < size; sy++)
{
for (sx = 0; sx < 32; sx++)
{
int tileno, colour;
tileno = (state->bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0x0007ffff); /* seems to take into account spriteram, hence -0x4000 */
colour = (state->bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0xff000000) >> 24;
drawgfx_alphatable(bitmap, cliprect, gfx, tileno, colour, 0, 0, (16 * sx + scrollx) & 0x1ff, ((16 * sy + scrolly) & (width - 1)), alpha); /* normal */
if (scrollx)
drawgfx_alphatable(bitmap, cliprect, gfx, tileno, colour, 0, 0, ((16 * sx + scrollx) & 0x1ff) - 0x200, ((16 * sy + scrolly) & (width - 1)), alpha); /* wrap x */
if (scrolly)
drawgfx_alphatable(bitmap, cliprect, gfx, tileno, colour, 0, 0, (16 * sx + scrollx) & 0x1ff, ((16 * sy + scrolly) & (width - 1)) - width, alpha); /* wrap y */
if (scrollx && scrolly)
drawgfx_alphatable(bitmap, cliprect, gfx, tileno, colour, 0, 0, ((16 * sx + scrollx) & 0x1ff) - 0x200, ((16 * sy + scrolly) & (width - 1)) - width, alpha); /* wrap xy */
offs++;
}
}
}
} | /* 'Normal' layers, no line/columnscroll. No per-line effects.
Zooming isn't supported just because it's not used and it would be slow */ | 'Normal' layers, no line/columnscroll. No per-line effects.
Zooming isn't supported just because it's not used and it would be slow | [
"'",
"Normal",
"'",
"layers",
"no",
"line",
"/",
"columnscroll",
".",
"No",
"per",
"-",
"line",
"effects",
".",
"Zooming",
"isn",
"'",
"t",
"supported",
"just",
"because",
"it",
"'",
"s",
"not",
"used",
"and",
"it",
"would",
"be",
"slow"
] | static void draw_bglayer( running_machine *machine, int layer, bitmap_t *bitmap, const rectangle *cliprect, UINT8 req_pri )
{
psikyosh_state *state = machine->driver_data<psikyosh_state>();
gfx_element *gfx;
int offs = 0, sx, sy;
int scrollx, scrolly, regbank, tilebank, alpha, alphamap, zoom, pri, size, width;
assert(!BG_LINE(layer));
gfx = BG_DEPTH_8BPP(layer) ? machine->gfx[1] : machine->gfx[0];
size = BG_LARGE(layer) ? 32 : 16;
width = 16 * size;
regbank = BG_TYPE(layer);
scrollx = (state->bgram[(regbank * 0x800) / 4 + 0x3f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x000001ff) >> 0;
scrolly = (state->bgram[(regbank * 0x800) / 4 + 0x3f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x03ff0000) >> 16;
tilebank = (state->bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x000000ff) >> 0;
alpha = (state->bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x00003f00) >> 8;
alphamap = (state->bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x00008000) >> 15;
zoom = (state->bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x00ff0000) >> 16;
pri = (state->bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0xff000000) >> 24;
if(pri != req_pri) return;
if (alphamap)
alpha = -1;
else
alpha = pal6bit(0x3f - alpha);
if(zoom) {
popmessage("draw_bglayer() zoom not implemented\nContact MAMEDEV");
}
if ((tilebank >= 0x0a) && (tilebank <= 0x1f))
{
for (sy = 0; sy < size; sy++)
{
for (sx = 0; sx < 32; sx++)
{
int tileno, colour;
tileno = (state->bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0x0007ffff);
colour = (state->bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0xff000000) >> 24;
drawgfx_alphatable(bitmap, cliprect, gfx, tileno, colour, 0, 0, (16 * sx + scrollx) & 0x1ff, ((16 * sy + scrolly) & (width - 1)), alpha);
if (scrollx)
drawgfx_alphatable(bitmap, cliprect, gfx, tileno, colour, 0, 0, ((16 * sx + scrollx) & 0x1ff) - 0x200, ((16 * sy + scrolly) & (width - 1)), alpha);
if (scrolly)
drawgfx_alphatable(bitmap, cliprect, gfx, tileno, colour, 0, 0, (16 * sx + scrollx) & 0x1ff, ((16 * sy + scrolly) & (width - 1)) - width, alpha);
if (scrollx && scrolly)
drawgfx_alphatable(bitmap, cliprect, gfx, tileno, colour, 0, 0, ((16 * sx + scrollx) & 0x1ff) - 0x200, ((16 * sy + scrolly) & (width - 1)) - width, alpha);
offs++;
}
}
}
} | [
"static",
"void",
"draw_bglayer",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"layer",
",",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"UINT8",
"req_pri",
")",
"{",
"psikyosh_state",
"*",
"state",
"=",
"machine",
"->",
"driver_data",
"<",
"psikyosh_state",
">",
"(",
"",
")",
";",
"gfx_element",
"*",
"gfx",
";",
"int",
"offs",
"=",
"0",
",",
"sx",
",",
"sy",
";",
"int",
"scrollx",
",",
"scrolly",
",",
"regbank",
",",
"tilebank",
",",
"alpha",
",",
"alphamap",
",",
"zoom",
",",
"pri",
",",
"size",
",",
"width",
";",
"assert",
"(",
"!",
"BG_LINE",
"(",
"layer",
")",
")",
";",
"gfx",
"=",
"BG_DEPTH_8BPP",
"(",
"layer",
")",
"?",
"machine",
"->",
"gfx",
"[",
"1",
"]",
":",
"machine",
"->",
"gfx",
"[",
"0",
"]",
";",
"size",
"=",
"BG_LARGE",
"(",
"layer",
")",
"?",
"32",
":",
"16",
";",
"width",
"=",
"16",
"*",
"size",
";",
"regbank",
"=",
"BG_TYPE",
"(",
"layer",
")",
";",
"scrollx",
"=",
"(",
"state",
"->",
"bgram",
"[",
"(",
"regbank",
"*",
"0x800",
")",
"/",
"4",
"+",
"0x3f0",
"/",
"4",
"+",
"(",
"layer",
"*",
"0x04",
")",
"/",
"4",
"-",
"0x4000",
"/",
"4",
"]",
"&",
"0x000001ff",
")",
">>",
"0",
";",
"scrolly",
"=",
"(",
"state",
"->",
"bgram",
"[",
"(",
"regbank",
"*",
"0x800",
")",
"/",
"4",
"+",
"0x3f0",
"/",
"4",
"+",
"(",
"layer",
"*",
"0x04",
")",
"/",
"4",
"-",
"0x4000",
"/",
"4",
"]",
"&",
"0x03ff0000",
")",
">>",
"16",
";",
"tilebank",
"=",
"(",
"state",
"->",
"bgram",
"[",
"(",
"regbank",
"*",
"0x800",
")",
"/",
"4",
"+",
"0x7f0",
"/",
"4",
"+",
"(",
"layer",
"*",
"0x04",
")",
"/",
"4",
"-",
"0x4000",
"/",
"4",
"]",
"&",
"0x000000ff",
")",
">>",
"0",
";",
"alpha",
"=",
"(",
"state",
"->",
"bgram",
"[",
"(",
"regbank",
"*",
"0x800",
")",
"/",
"4",
"+",
"0x7f0",
"/",
"4",
"+",
"(",
"layer",
"*",
"0x04",
")",
"/",
"4",
"-",
"0x4000",
"/",
"4",
"]",
"&",
"0x00003f00",
")",
">>",
"8",
";",
"alphamap",
"=",
"(",
"state",
"->",
"bgram",
"[",
"(",
"regbank",
"*",
"0x800",
")",
"/",
"4",
"+",
"0x7f0",
"/",
"4",
"+",
"(",
"layer",
"*",
"0x04",
")",
"/",
"4",
"-",
"0x4000",
"/",
"4",
"]",
"&",
"0x00008000",
")",
">>",
"15",
";",
"zoom",
"=",
"(",
"state",
"->",
"bgram",
"[",
"(",
"regbank",
"*",
"0x800",
")",
"/",
"4",
"+",
"0x7f0",
"/",
"4",
"+",
"(",
"layer",
"*",
"0x04",
")",
"/",
"4",
"-",
"0x4000",
"/",
"4",
"]",
"&",
"0x00ff0000",
")",
">>",
"16",
";",
"pri",
"=",
"(",
"state",
"->",
"bgram",
"[",
"(",
"regbank",
"*",
"0x800",
")",
"/",
"4",
"+",
"0x7f0",
"/",
"4",
"+",
"(",
"layer",
"*",
"0x04",
")",
"/",
"4",
"-",
"0x4000",
"/",
"4",
"]",
"&",
"0xff000000",
")",
">>",
"24",
";",
"if",
"(",
"pri",
"!=",
"req_pri",
")",
"return",
";",
"if",
"(",
"alphamap",
")",
"alpha",
"=",
"-1",
";",
"else",
"alpha",
"=",
"pal6bit",
"(",
"0x3f",
"-",
"alpha",
")",
";",
"if",
"(",
"zoom",
")",
"{",
"popmessage",
"(",
"\"",
"\\n",
"\"",
")",
";",
"}",
"if",
"(",
"(",
"tilebank",
">=",
"0x0a",
")",
"&&",
"(",
"tilebank",
"<=",
"0x1f",
")",
")",
"{",
"for",
"(",
"sy",
"=",
"0",
";",
"sy",
"<",
"size",
";",
"sy",
"++",
")",
"{",
"for",
"(",
"sx",
"=",
"0",
";",
"sx",
"<",
"32",
";",
"sx",
"++",
")",
"{",
"int",
"tileno",
",",
"colour",
";",
"tileno",
"=",
"(",
"state",
"->",
"bgram",
"[",
"(",
"tilebank",
"*",
"0x800",
")",
"/",
"4",
"+",
"offs",
"-",
"0x4000",
"/",
"4",
"]",
"&",
"0x0007ffff",
")",
";",
"colour",
"=",
"(",
"state",
"->",
"bgram",
"[",
"(",
"tilebank",
"*",
"0x800",
")",
"/",
"4",
"+",
"offs",
"-",
"0x4000",
"/",
"4",
"]",
"&",
"0xff000000",
")",
">>",
"24",
";",
"drawgfx_alphatable",
"(",
"bitmap",
",",
"cliprect",
",",
"gfx",
",",
"tileno",
",",
"colour",
",",
"0",
",",
"0",
",",
"(",
"16",
"*",
"sx",
"+",
"scrollx",
")",
"&",
"0x1ff",
",",
"(",
"(",
"16",
"*",
"sy",
"+",
"scrolly",
")",
"&",
"(",
"width",
"-",
"1",
")",
")",
",",
"alpha",
")",
";",
"if",
"(",
"scrollx",
")",
"drawgfx_alphatable",
"(",
"bitmap",
",",
"cliprect",
",",
"gfx",
",",
"tileno",
",",
"colour",
",",
"0",
",",
"0",
",",
"(",
"(",
"16",
"*",
"sx",
"+",
"scrollx",
")",
"&",
"0x1ff",
")",
"-",
"0x200",
",",
"(",
"(",
"16",
"*",
"sy",
"+",
"scrolly",
")",
"&",
"(",
"width",
"-",
"1",
")",
")",
",",
"alpha",
")",
";",
"if",
"(",
"scrolly",
")",
"drawgfx_alphatable",
"(",
"bitmap",
",",
"cliprect",
",",
"gfx",
",",
"tileno",
",",
"colour",
",",
"0",
",",
"0",
",",
"(",
"16",
"*",
"sx",
"+",
"scrollx",
")",
"&",
"0x1ff",
",",
"(",
"(",
"16",
"*",
"sy",
"+",
"scrolly",
")",
"&",
"(",
"width",
"-",
"1",
")",
")",
"-",
"width",
",",
"alpha",
")",
";",
"if",
"(",
"scrollx",
"&&",
"scrolly",
")",
"drawgfx_alphatable",
"(",
"bitmap",
",",
"cliprect",
",",
"gfx",
",",
"tileno",
",",
"colour",
",",
"0",
",",
"0",
",",
"(",
"(",
"16",
"*",
"sx",
"+",
"scrollx",
")",
"&",
"0x1ff",
")",
"-",
"0x200",
",",
"(",
"(",
"16",
"*",
"sy",
"+",
"scrolly",
")",
"&",
"(",
"width",
"-",
"1",
")",
")",
"-",
"width",
",",
"alpha",
")",
";",
"offs",
"++",
";",
"}",
"}",
"}",
"}"
] | 'Normal' layers, no line/columnscroll. | [
"'",
"Normal",
"'",
"layers",
"no",
"line",
"/",
"columnscroll",
"."
] | [
"/* alpha values are per-pen */",
"/* 0x3f-0x00 maps to 0x00-0xff */",
"/* 20 banks of 0x800 bytes. filter garbage. */",
"/* seems to take into account spriteram, hence -0x4000 */",
"/* normal */",
"/* wrap x */",
"/* wrap y */",
"/* wrap xy */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "layer",
"type": "int"
},
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "req_pri",
"type": "UINT8"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "layer",
"type": "int",
"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": "req_pri",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
be64c3d6a3d2cde0a545f6d94fb0f5bf0d3b6ae2 | lofunz/mieme | Reloaded/trunk/src/mame/video/psikyosh.c | [
"Unlicense"
] | C | cache_bitmap | void | static void cache_bitmap(int scanline, psikyosh_state *state, gfx_element *gfx, int size, int tilebank, int alpha, int *last_bank)
{
// test if the tile row is the cached one or not
int sy = scanline / 16;
assert(sy > 0 && sy < 32);
if(tilebank != last_bank[sy])
{
rectangle cliprect;
cliprect.min_x = 0;
cliprect.max_x = state->bg_bitmap->width - 1;
cliprect.min_y = sy * 16;
cliprect.max_y = cliprect.min_y + 16 - 1;
bitmap_fill(state->bg_bitmap, &cliprect, BG_TRANSPEN);
int width = size * 16;
int offs = size * sy;
int sx;
for (sx = 0; sx < 32; sx++)
{
int tileno, colour;
tileno = (state->bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0x0007ffff); /* seems to take into account spriteram, hence -0x4000 */
colour = (state->bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0xff000000) >> 24;
int need_alpha = alpha < 0 ? -1 : 0xff; // store per-pen alpha in bitmap, otherwise don't since we'll need it per-line
if(tileno) { // valid tile, but blank in all games?
drawgfx_alphastore(state->bg_bitmap, NULL, gfx, tileno, colour, 0, 0, (16 * sx) & 0x1ff, ((16 * sy) & (width - 1)), need_alpha);
}
offs++;
}
last_bank[sy] = tilebank;
}
} | /* populate state->bg_bitmap for the given bank if it's not already */ | populate state->bg_bitmap for the given bank if it's not already | [
"populate",
"state",
"-",
">",
"bg_bitmap",
"for",
"the",
"given",
"bank",
"if",
"it",
"'",
"s",
"not",
"already"
] | static void cache_bitmap(int scanline, psikyosh_state *state, gfx_element *gfx, int size, int tilebank, int alpha, int *last_bank)
{
int sy = scanline / 16;
assert(sy > 0 && sy < 32);
if(tilebank != last_bank[sy])
{
rectangle cliprect;
cliprect.min_x = 0;
cliprect.max_x = state->bg_bitmap->width - 1;
cliprect.min_y = sy * 16;
cliprect.max_y = cliprect.min_y + 16 - 1;
bitmap_fill(state->bg_bitmap, &cliprect, BG_TRANSPEN);
int width = size * 16;
int offs = size * sy;
int sx;
for (sx = 0; sx < 32; sx++)
{
int tileno, colour;
tileno = (state->bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0x0007ffff);
colour = (state->bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0xff000000) >> 24;
int need_alpha = alpha < 0 ? -1 : 0xff;
if(tileno) {
drawgfx_alphastore(state->bg_bitmap, NULL, gfx, tileno, colour, 0, 0, (16 * sx) & 0x1ff, ((16 * sy) & (width - 1)), need_alpha);
}
offs++;
}
last_bank[sy] = tilebank;
}
} | [
"static",
"void",
"cache_bitmap",
"(",
"int",
"scanline",
",",
"psikyosh_state",
"*",
"state",
",",
"gfx_element",
"*",
"gfx",
",",
"int",
"size",
",",
"int",
"tilebank",
",",
"int",
"alpha",
",",
"int",
"*",
"last_bank",
")",
"{",
"int",
"sy",
"=",
"scanline",
"/",
"16",
";",
"assert",
"(",
"sy",
">",
"0",
"&&",
"sy",
"<",
"32",
")",
";",
"if",
"(",
"tilebank",
"!=",
"last_bank",
"[",
"sy",
"]",
")",
"{",
"rectangle",
"cliprect",
";",
"cliprect",
".",
"min_x",
"=",
"0",
";",
"cliprect",
".",
"max_x",
"=",
"state",
"->",
"bg_bitmap",
"->",
"width",
"-",
"1",
";",
"cliprect",
".",
"min_y",
"=",
"sy",
"*",
"16",
";",
"cliprect",
".",
"max_y",
"=",
"cliprect",
".",
"min_y",
"+",
"16",
"-",
"1",
";",
"bitmap_fill",
"(",
"state",
"->",
"bg_bitmap",
",",
"&",
"cliprect",
",",
"BG_TRANSPEN",
")",
";",
"int",
"width",
"=",
"size",
"*",
"16",
";",
"int",
"offs",
"=",
"size",
"*",
"sy",
";",
"int",
"sx",
";",
"for",
"(",
"sx",
"=",
"0",
";",
"sx",
"<",
"32",
";",
"sx",
"++",
")",
"{",
"int",
"tileno",
",",
"colour",
";",
"tileno",
"=",
"(",
"state",
"->",
"bgram",
"[",
"(",
"tilebank",
"*",
"0x800",
")",
"/",
"4",
"+",
"offs",
"-",
"0x4000",
"/",
"4",
"]",
"&",
"0x0007ffff",
")",
";",
"colour",
"=",
"(",
"state",
"->",
"bgram",
"[",
"(",
"tilebank",
"*",
"0x800",
")",
"/",
"4",
"+",
"offs",
"-",
"0x4000",
"/",
"4",
"]",
"&",
"0xff000000",
")",
">>",
"24",
";",
"int",
"need_alpha",
"=",
"alpha",
"<",
"0",
"?",
"-1",
":",
"0xff",
";",
"if",
"(",
"tileno",
")",
"{",
"drawgfx_alphastore",
"(",
"state",
"->",
"bg_bitmap",
",",
"NULL",
",",
"gfx",
",",
"tileno",
",",
"colour",
",",
"0",
",",
"0",
",",
"(",
"16",
"*",
"sx",
")",
"&",
"0x1ff",
",",
"(",
"(",
"16",
"*",
"sy",
")",
"&",
"(",
"width",
"-",
"1",
")",
")",
",",
"need_alpha",
")",
";",
"}",
"offs",
"++",
";",
"}",
"last_bank",
"[",
"sy",
"]",
"=",
"tilebank",
";",
"}",
"}"
] | populate state->bg_bitmap for the given bank if it's not already | [
"populate",
"state",
"-",
">",
"bg_bitmap",
"for",
"the",
"given",
"bank",
"if",
"it",
"'",
"s",
"not",
"already"
] | [
"// test if the tile row is the cached one or not\r",
"/* seems to take into account spriteram, hence -0x4000 */",
"// store per-pen alpha in bitmap, otherwise don't since we'll need it per-line\r",
"// valid tile, but blank in all games?\r"
] | [
{
"param": "scanline",
"type": "int"
},
{
"param": "state",
"type": "psikyosh_state"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "size",
"type": "int"
},
{
"param": "tilebank",
"type": "int"
},
{
"param": "alpha",
"type": "int"
},
{
"param": "last_bank",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "scanline",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "psikyosh_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "size",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tilebank",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "alpha",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "last_bank",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
be64c3d6a3d2cde0a545f6d94fb0f5bf0d3b6ae2 | lofunz/mieme | Reloaded/trunk/src/mame/video/psikyosh.c | [
"Unlicense"
] | C | draw_bglayerscroll | void | static void draw_bglayerscroll( running_machine *machine, int layer, bitmap_t *bitmap, const rectangle *cliprect, UINT8 req_pri )
{
psikyosh_state *state = machine->driver_data<psikyosh_state>();
assert(BG_LINE(layer));
gfx_element *gfx = BG_DEPTH_8BPP(layer) ? machine->gfx[1] : machine->gfx[0];
int size = BG_LARGE(layer) ? 32 : 16;
int width = size * 16;
int linebank = BG_TYPE(layer);
/* cache rendered bitmap */
int last_bank[32]; // corresponds to bank of bitmap in state->bg_bitmap. bg_bitmap is split into 16/32-rows of one-tile high each
for(int ii = 0; ii < 32; ii++) last_bank[ii] = -1;
int scr_width = (cliprect->max_x-cliprect->min_x + 1);
int scr_height = (cliprect->max_y-cliprect->min_y + 1);
UINT32 *scroll_reg = &state->bgram[(linebank * 0x800) / 4 - 0x4000 / 4];
UINT32 *pzab_reg = &state->bgram[(linebank * 0x800) / 4 - 0x4000 / 4 + 0x400 / 4]; // pri, zoom, alpha, bank
// now, for each scanline, check priority,
// extract the relevant scanline from the bitmap, after applying per-scanline vscroll,
// stretch it and scroll it into another buffer
// write it with alpha
for(int scanline = 0; scanline < scr_height; scanline++)
{
int pri = (*pzab_reg & 0xff000000) >> 24;
if(pri == req_pri)
{
int scrollx = (*scroll_reg & 0x000001ff) >> 0;
int scrolly = (*scroll_reg & 0x03ff0000) >> 16;
int zoom = (*pzab_reg & 0x00ff0000) >> 16;
int alphamap = (*pzab_reg & 0x00008000) >> 15;
int alpha = (*pzab_reg & 0x00003f00) >> 8;
int tilebank = (*pzab_reg & 0x000000ff) >> 0;
if(alphamap) /* alpha values are per-pen */
alpha = -1;
else
alpha = pal6bit(0x3f - alpha);
if ((tilebank >= 0x0a) && (tilebank <= 0x1f)) /* 20 banks of 0x800 bytes. filter garbage. */
{
int tilemap_scanline = (scanline - scrolly + 0x400) % 0x200;
// render reelvant tiles to temp bitmap, assume bank changes infrequently/never. render alpha as per-pen
cache_bitmap(tilemap_scanline, state, gfx, size, tilebank, alpha, last_bank);
/* zoomy and 'wibbly' effects - extract an entire row from tilemap */
profiler_mark_start(PROFILER_USER2);
UINT32 tilemap_line[32 * 16];
UINT32 scr_line[64 * 8];
extract_scanline32(state->bg_bitmap, 0, tilemap_scanline, width, tilemap_line);
profiler_mark_end();
/* slow bit, needs optimising. apply scrollx and zoomx by assembling scanline from row */
profiler_mark_start(PROFILER_USER3);
if(zoom) {
int step = state->bg_zoom[zoom];
int jj = 0x400 << 10; // ensure +ve for mod
for(int ii = 0; ii < scr_width; ii++) {
scr_line[ii] = tilemap_line[((jj>>10) - scrollx) % width];
jj += step;
}
}
else {
for(int ii = 0; ii < scr_width; ii++) {
scr_line[ii] = tilemap_line[(ii - scrollx + 0x400) % width];
}
}
profiler_mark_end();
/* blend line into output */
profiler_mark_start(PROFILER_USER4);
if(alpha == 0xff) {
draw_scanline32_transpen(bitmap, 0, scanline, scr_width, scr_line);
}
else if (alpha > 0) {
draw_scanline32_alpha(bitmap, 0, scanline, scr_width, scr_line, alpha);
}
else if (alpha < 0) {
draw_scanline32_argb(bitmap, 0, scanline, scr_width, scr_line);
}
profiler_mark_end();
}
}
scroll_reg++;
pzab_reg++;
}
} | /* Row Scroll/Zoom and/or Column Zoom, has per-column Alpha/Bank/Priority
Bitmap is first rendered to an ARGB image, taking into account the per-pen alpha (if used).
From there we extract data as we compose the image, one scanline at a time, blending the ARGB pixels
into the RGB32 bitmap (with either the alpha information from the ARGB, or per-line alpha */ | Row Scroll/Zoom and/or Column Zoom, has per-column Alpha/Bank/Priority
Bitmap is first rendered to an ARGB image, taking into account the per-pen alpha (if used).
From there we extract data as we compose the image, one scanline at a time, blending the ARGB pixels
into the RGB32 bitmap (with either the alpha information from the ARGB, or per-line alpha | [
"Row",
"Scroll",
"/",
"Zoom",
"and",
"/",
"or",
"Column",
"Zoom",
"has",
"per",
"-",
"column",
"Alpha",
"/",
"Bank",
"/",
"Priority",
"Bitmap",
"is",
"first",
"rendered",
"to",
"an",
"ARGB",
"image",
"taking",
"into",
"account",
"the",
"per",
"-",
"pen",
"alpha",
"(",
"if",
"used",
")",
".",
"From",
"there",
"we",
"extract",
"data",
"as",
"we",
"compose",
"the",
"image",
"one",
"scanline",
"at",
"a",
"time",
"blending",
"the",
"ARGB",
"pixels",
"into",
"the",
"RGB32",
"bitmap",
"(",
"with",
"either",
"the",
"alpha",
"information",
"from",
"the",
"ARGB",
"or",
"per",
"-",
"line",
"alpha"
] | static void draw_bglayerscroll( running_machine *machine, int layer, bitmap_t *bitmap, const rectangle *cliprect, UINT8 req_pri )
{
psikyosh_state *state = machine->driver_data<psikyosh_state>();
assert(BG_LINE(layer));
gfx_element *gfx = BG_DEPTH_8BPP(layer) ? machine->gfx[1] : machine->gfx[0];
int size = BG_LARGE(layer) ? 32 : 16;
int width = size * 16;
int linebank = BG_TYPE(layer);
int last_bank[32];
for(int ii = 0; ii < 32; ii++) last_bank[ii] = -1;
int scr_width = (cliprect->max_x-cliprect->min_x + 1);
int scr_height = (cliprect->max_y-cliprect->min_y + 1);
UINT32 *scroll_reg = &state->bgram[(linebank * 0x800) / 4 - 0x4000 / 4];
UINT32 *pzab_reg = &state->bgram[(linebank * 0x800) / 4 - 0x4000 / 4 + 0x400 / 4];
for(int scanline = 0; scanline < scr_height; scanline++)
{
int pri = (*pzab_reg & 0xff000000) >> 24;
if(pri == req_pri)
{
int scrollx = (*scroll_reg & 0x000001ff) >> 0;
int scrolly = (*scroll_reg & 0x03ff0000) >> 16;
int zoom = (*pzab_reg & 0x00ff0000) >> 16;
int alphamap = (*pzab_reg & 0x00008000) >> 15;
int alpha = (*pzab_reg & 0x00003f00) >> 8;
int tilebank = (*pzab_reg & 0x000000ff) >> 0;
if(alphamap)
alpha = -1;
else
alpha = pal6bit(0x3f - alpha);
if ((tilebank >= 0x0a) && (tilebank <= 0x1f))
{
int tilemap_scanline = (scanline - scrolly + 0x400) % 0x200;
cache_bitmap(tilemap_scanline, state, gfx, size, tilebank, alpha, last_bank);
profiler_mark_start(PROFILER_USER2);
UINT32 tilemap_line[32 * 16];
UINT32 scr_line[64 * 8];
extract_scanline32(state->bg_bitmap, 0, tilemap_scanline, width, tilemap_line);
profiler_mark_end();
profiler_mark_start(PROFILER_USER3);
if(zoom) {
int step = state->bg_zoom[zoom];
int jj = 0x400 << 10;
for(int ii = 0; ii < scr_width; ii++) {
scr_line[ii] = tilemap_line[((jj>>10) - scrollx) % width];
jj += step;
}
}
else {
for(int ii = 0; ii < scr_width; ii++) {
scr_line[ii] = tilemap_line[(ii - scrollx + 0x400) % width];
}
}
profiler_mark_end();
profiler_mark_start(PROFILER_USER4);
if(alpha == 0xff) {
draw_scanline32_transpen(bitmap, 0, scanline, scr_width, scr_line);
}
else if (alpha > 0) {
draw_scanline32_alpha(bitmap, 0, scanline, scr_width, scr_line, alpha);
}
else if (alpha < 0) {
draw_scanline32_argb(bitmap, 0, scanline, scr_width, scr_line);
}
profiler_mark_end();
}
}
scroll_reg++;
pzab_reg++;
}
} | [
"static",
"void",
"draw_bglayerscroll",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"layer",
",",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"UINT8",
"req_pri",
")",
"{",
"psikyosh_state",
"*",
"state",
"=",
"machine",
"->",
"driver_data",
"<",
"psikyosh_state",
">",
"(",
"",
")",
";",
"assert",
"(",
"BG_LINE",
"(",
"layer",
")",
")",
";",
"gfx_element",
"*",
"gfx",
"=",
"BG_DEPTH_8BPP",
"(",
"layer",
")",
"?",
"machine",
"->",
"gfx",
"[",
"1",
"]",
":",
"machine",
"->",
"gfx",
"[",
"0",
"]",
";",
"int",
"size",
"=",
"BG_LARGE",
"(",
"layer",
")",
"?",
"32",
":",
"16",
";",
"int",
"width",
"=",
"size",
"*",
"16",
";",
"int",
"linebank",
"=",
"BG_TYPE",
"(",
"layer",
")",
";",
"int",
"last_bank",
"[",
"32",
"]",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"32",
";",
"ii",
"++",
")",
"last_bank",
"[",
"ii",
"]",
"=",
"-1",
";",
"int",
"scr_width",
"=",
"(",
"cliprect",
"->",
"max_x",
"-",
"cliprect",
"->",
"min_x",
"+",
"1",
")",
";",
"int",
"scr_height",
"=",
"(",
"cliprect",
"->",
"max_y",
"-",
"cliprect",
"->",
"min_y",
"+",
"1",
")",
";",
"UINT32",
"*",
"scroll_reg",
"=",
"&",
"state",
"->",
"bgram",
"[",
"(",
"linebank",
"*",
"0x800",
")",
"/",
"4",
"-",
"0x4000",
"/",
"4",
"]",
";",
"UINT32",
"*",
"pzab_reg",
"=",
"&",
"state",
"->",
"bgram",
"[",
"(",
"linebank",
"*",
"0x800",
")",
"/",
"4",
"-",
"0x4000",
"/",
"4",
"+",
"0x400",
"/",
"4",
"]",
";",
"for",
"(",
"int",
"scanline",
"=",
"0",
";",
"scanline",
"<",
"scr_height",
";",
"scanline",
"++",
")",
"{",
"int",
"pri",
"=",
"(",
"*",
"pzab_reg",
"&",
"0xff000000",
")",
">>",
"24",
";",
"if",
"(",
"pri",
"==",
"req_pri",
")",
"{",
"int",
"scrollx",
"=",
"(",
"*",
"scroll_reg",
"&",
"0x000001ff",
")",
">>",
"0",
";",
"int",
"scrolly",
"=",
"(",
"*",
"scroll_reg",
"&",
"0x03ff0000",
")",
">>",
"16",
";",
"int",
"zoom",
"=",
"(",
"*",
"pzab_reg",
"&",
"0x00ff0000",
")",
">>",
"16",
";",
"int",
"alphamap",
"=",
"(",
"*",
"pzab_reg",
"&",
"0x00008000",
")",
">>",
"15",
";",
"int",
"alpha",
"=",
"(",
"*",
"pzab_reg",
"&",
"0x00003f00",
")",
">>",
"8",
";",
"int",
"tilebank",
"=",
"(",
"*",
"pzab_reg",
"&",
"0x000000ff",
")",
">>",
"0",
";",
"if",
"(",
"alphamap",
")",
"alpha",
"=",
"-1",
";",
"else",
"alpha",
"=",
"pal6bit",
"(",
"0x3f",
"-",
"alpha",
")",
";",
"if",
"(",
"(",
"tilebank",
">=",
"0x0a",
")",
"&&",
"(",
"tilebank",
"<=",
"0x1f",
")",
")",
"{",
"int",
"tilemap_scanline",
"=",
"(",
"scanline",
"-",
"scrolly",
"+",
"0x400",
")",
"%",
"0x200",
";",
"cache_bitmap",
"(",
"tilemap_scanline",
",",
"state",
",",
"gfx",
",",
"size",
",",
"tilebank",
",",
"alpha",
",",
"last_bank",
")",
";",
"profiler_mark_start",
"(",
"PROFILER_USER2",
")",
";",
"UINT32",
"tilemap_line",
"[",
"32",
"*",
"16",
"]",
";",
"UINT32",
"scr_line",
"[",
"64",
"*",
"8",
"]",
";",
"extract_scanline32",
"(",
"state",
"->",
"bg_bitmap",
",",
"0",
",",
"tilemap_scanline",
",",
"width",
",",
"tilemap_line",
")",
";",
"profiler_mark_end",
"(",
")",
";",
"profiler_mark_start",
"(",
"PROFILER_USER3",
")",
";",
"if",
"(",
"zoom",
")",
"{",
"int",
"step",
"=",
"state",
"->",
"bg_zoom",
"[",
"zoom",
"]",
";",
"int",
"jj",
"=",
"0x400",
"<<",
"10",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"scr_width",
";",
"ii",
"++",
")",
"{",
"scr_line",
"[",
"ii",
"]",
"=",
"tilemap_line",
"[",
"(",
"(",
"jj",
">>",
"10",
")",
"-",
"scrollx",
")",
"%",
"width",
"]",
";",
"jj",
"+=",
"step",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"scr_width",
";",
"ii",
"++",
")",
"{",
"scr_line",
"[",
"ii",
"]",
"=",
"tilemap_line",
"[",
"(",
"ii",
"-",
"scrollx",
"+",
"0x400",
")",
"%",
"width",
"]",
";",
"}",
"}",
"profiler_mark_end",
"(",
")",
";",
"profiler_mark_start",
"(",
"PROFILER_USER4",
")",
";",
"if",
"(",
"alpha",
"==",
"0xff",
")",
"{",
"draw_scanline32_transpen",
"(",
"bitmap",
",",
"0",
",",
"scanline",
",",
"scr_width",
",",
"scr_line",
")",
";",
"}",
"else",
"if",
"(",
"alpha",
">",
"0",
")",
"{",
"draw_scanline32_alpha",
"(",
"bitmap",
",",
"0",
",",
"scanline",
",",
"scr_width",
",",
"scr_line",
",",
"alpha",
")",
";",
"}",
"else",
"if",
"(",
"alpha",
"<",
"0",
")",
"{",
"draw_scanline32_argb",
"(",
"bitmap",
",",
"0",
",",
"scanline",
",",
"scr_width",
",",
"scr_line",
")",
";",
"}",
"profiler_mark_end",
"(",
")",
";",
"}",
"}",
"scroll_reg",
"++",
";",
"pzab_reg",
"++",
";",
"}",
"}"
] | Row Scroll/Zoom and/or Column Zoom, has per-column Alpha/Bank/Priority
Bitmap is first rendered to an ARGB image, taking into account the per-pen alpha (if used). | [
"Row",
"Scroll",
"/",
"Zoom",
"and",
"/",
"or",
"Column",
"Zoom",
"has",
"per",
"-",
"column",
"Alpha",
"/",
"Bank",
"/",
"Priority",
"Bitmap",
"is",
"first",
"rendered",
"to",
"an",
"ARGB",
"image",
"taking",
"into",
"account",
"the",
"per",
"-",
"pen",
"alpha",
"(",
"if",
"used",
")",
"."
] | [
"/* cache rendered bitmap */",
"// corresponds to bank of bitmap in state->bg_bitmap. bg_bitmap is split into 16/32-rows of one-tile high each\r",
"// pri, zoom, alpha, bank\r",
"// now, for each scanline, check priority,\r",
"// extract the relevant scanline from the bitmap, after applying per-scanline vscroll,\r",
"// stretch it and scroll it into another buffer\r",
"// write it with alpha\r",
"/* alpha values are per-pen */",
"/* 20 banks of 0x800 bytes. filter garbage. */",
"// render reelvant tiles to temp bitmap, assume bank changes infrequently/never. render alpha as per-pen\r",
"/* zoomy and 'wibbly' effects - extract an entire row from tilemap */",
"/* slow bit, needs optimising. apply scrollx and zoomx by assembling scanline from row */",
"// ensure +ve for mod\r",
"/* blend line into output */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "layer",
"type": "int"
},
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "req_pri",
"type": "UINT8"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "layer",
"type": "int",
"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": "req_pri",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f908a3f197e2d52340bebac300d7c93292c7a4c5 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/palette.c | [
"Unlicense"
] | C | palette_alloc | palette_t | palette_t *palette_alloc(UINT32 numcolors, UINT32 numgroups)
{
palette_t *palette;
UINT32 index;
/* allocate memory */
palette = (palette_t *)malloc(sizeof(*palette));
if (palette == NULL)
goto error;
memset(palette, 0, sizeof(*palette));
/* initialize overall controls */
palette->brightness = 0.0f;
palette->contrast = 1.0f;
palette->gamma = 1.0f;
for (index = 0; index < 256; index++)
palette->gamma_map[index] = index;
/* allocate an array of palette entries and individual contrasts for each */
palette->entry_color = (rgb_t *)malloc(sizeof(*palette->entry_color) * numcolors);
palette->entry_contrast = (float *)malloc(sizeof(*palette->entry_contrast) * numcolors);
if (palette->entry_color == NULL || palette->entry_contrast == NULL)
goto error;
/* initialize the entries */
for (index = 0; index < numcolors; index++)
{
palette->entry_color[index] = RGB_BLACK;
palette->entry_contrast[index] = 1.0f;
}
/* allocate an array of brightness and contrast for each group */
palette->group_bright = (float *)malloc(sizeof(*palette->group_bright) * numgroups);
palette->group_contrast = (float *)malloc(sizeof(*palette->group_contrast) * numgroups);
if (palette->group_bright == NULL || palette->group_contrast == NULL)
goto error;
/* initialize the entries */
for (index = 0; index < numgroups; index++)
{
palette->group_bright[index] = 0.0f;
palette->group_contrast[index] = 1.0f;
}
/* allocate arrays for the adjusted colors */
palette->adjusted_color = (rgb_t *)malloc(sizeof(*palette->adjusted_color) * (numcolors * numgroups + 2));
palette->adjusted_rgb15 = (rgb_t *)malloc(sizeof(*palette->adjusted_rgb15) * (numcolors * numgroups + 2));
if (palette->adjusted_color == NULL || palette->adjusted_rgb15 == NULL)
goto error;
/* initialize the arrays */
for (index = 0; index < numcolors * numgroups; index++)
{
palette->adjusted_color[index] = RGB_BLACK;
palette->adjusted_rgb15[index] = rgb_to_rgb15(RGB_BLACK);
}
/* add black and white as the last two colors */
palette->adjusted_color[index] = RGB_BLACK;
palette->adjusted_rgb15[index++] = rgb_to_rgb15(RGB_BLACK);
palette->adjusted_color[index] = RGB_WHITE;
palette->adjusted_rgb15[index++] = rgb_to_rgb15(RGB_WHITE);
/* initialize the remainder of the structure */
palette->refcount = 1;
palette->numcolors = numcolors;
palette->numgroups = numgroups;
return palette;
error:
if (palette != NULL)
internal_palette_free(palette);
return NULL;
} | /*-------------------------------------------------
palette_alloc - allocate a new palette object
and take a single reference on it
-------------------------------------------------*/ | allocate a new palette object
and take a single reference on it | [
"allocate",
"a",
"new",
"palette",
"object",
"and",
"take",
"a",
"single",
"reference",
"on",
"it"
] | palette_t *palette_alloc(UINT32 numcolors, UINT32 numgroups)
{
palette_t *palette;
UINT32 index;
palette = (palette_t *)malloc(sizeof(*palette));
if (palette == NULL)
goto error;
memset(palette, 0, sizeof(*palette));
palette->brightness = 0.0f;
palette->contrast = 1.0f;
palette->gamma = 1.0f;
for (index = 0; index < 256; index++)
palette->gamma_map[index] = index;
palette->entry_color = (rgb_t *)malloc(sizeof(*palette->entry_color) * numcolors);
palette->entry_contrast = (float *)malloc(sizeof(*palette->entry_contrast) * numcolors);
if (palette->entry_color == NULL || palette->entry_contrast == NULL)
goto error;
for (index = 0; index < numcolors; index++)
{
palette->entry_color[index] = RGB_BLACK;
palette->entry_contrast[index] = 1.0f;
}
palette->group_bright = (float *)malloc(sizeof(*palette->group_bright) * numgroups);
palette->group_contrast = (float *)malloc(sizeof(*palette->group_contrast) * numgroups);
if (palette->group_bright == NULL || palette->group_contrast == NULL)
goto error;
for (index = 0; index < numgroups; index++)
{
palette->group_bright[index] = 0.0f;
palette->group_contrast[index] = 1.0f;
}
palette->adjusted_color = (rgb_t *)malloc(sizeof(*palette->adjusted_color) * (numcolors * numgroups + 2));
palette->adjusted_rgb15 = (rgb_t *)malloc(sizeof(*palette->adjusted_rgb15) * (numcolors * numgroups + 2));
if (palette->adjusted_color == NULL || palette->adjusted_rgb15 == NULL)
goto error;
for (index = 0; index < numcolors * numgroups; index++)
{
palette->adjusted_color[index] = RGB_BLACK;
palette->adjusted_rgb15[index] = rgb_to_rgb15(RGB_BLACK);
}
palette->adjusted_color[index] = RGB_BLACK;
palette->adjusted_rgb15[index++] = rgb_to_rgb15(RGB_BLACK);
palette->adjusted_color[index] = RGB_WHITE;
palette->adjusted_rgb15[index++] = rgb_to_rgb15(RGB_WHITE);
palette->refcount = 1;
palette->numcolors = numcolors;
palette->numgroups = numgroups;
return palette;
error:
if (palette != NULL)
internal_palette_free(palette);
return NULL;
} | [
"palette_t",
"*",
"palette_alloc",
"(",
"UINT32",
"numcolors",
",",
"UINT32",
"numgroups",
")",
"{",
"palette_t",
"*",
"palette",
";",
"UINT32",
"index",
";",
"palette",
"=",
"(",
"palette_t",
"*",
")",
"malloc",
"(",
"sizeof",
"(",
"*",
"palette",
")",
")",
";",
"if",
"(",
"palette",
"==",
"NULL",
")",
"goto",
"error",
";",
"memset",
"(",
"palette",
",",
"0",
",",
"sizeof",
"(",
"*",
"palette",
")",
")",
";",
"palette",
"->",
"brightness",
"=",
"0.0f",
";",
"palette",
"->",
"contrast",
"=",
"1.0f",
";",
"palette",
"->",
"gamma",
"=",
"1.0f",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"256",
";",
"index",
"++",
")",
"palette",
"->",
"gamma_map",
"[",
"index",
"]",
"=",
"index",
";",
"palette",
"->",
"entry_color",
"=",
"(",
"rgb_t",
"*",
")",
"malloc",
"(",
"sizeof",
"(",
"*",
"palette",
"->",
"entry_color",
")",
"*",
"numcolors",
")",
";",
"palette",
"->",
"entry_contrast",
"=",
"(",
"float",
"*",
")",
"malloc",
"(",
"sizeof",
"(",
"*",
"palette",
"->",
"entry_contrast",
")",
"*",
"numcolors",
")",
";",
"if",
"(",
"palette",
"->",
"entry_color",
"==",
"NULL",
"||",
"palette",
"->",
"entry_contrast",
"==",
"NULL",
")",
"goto",
"error",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"numcolors",
";",
"index",
"++",
")",
"{",
"palette",
"->",
"entry_color",
"[",
"index",
"]",
"=",
"RGB_BLACK",
";",
"palette",
"->",
"entry_contrast",
"[",
"index",
"]",
"=",
"1.0f",
";",
"}",
"palette",
"->",
"group_bright",
"=",
"(",
"float",
"*",
")",
"malloc",
"(",
"sizeof",
"(",
"*",
"palette",
"->",
"group_bright",
")",
"*",
"numgroups",
")",
";",
"palette",
"->",
"group_contrast",
"=",
"(",
"float",
"*",
")",
"malloc",
"(",
"sizeof",
"(",
"*",
"palette",
"->",
"group_contrast",
")",
"*",
"numgroups",
")",
";",
"if",
"(",
"palette",
"->",
"group_bright",
"==",
"NULL",
"||",
"palette",
"->",
"group_contrast",
"==",
"NULL",
")",
"goto",
"error",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"numgroups",
";",
"index",
"++",
")",
"{",
"palette",
"->",
"group_bright",
"[",
"index",
"]",
"=",
"0.0f",
";",
"palette",
"->",
"group_contrast",
"[",
"index",
"]",
"=",
"1.0f",
";",
"}",
"palette",
"->",
"adjusted_color",
"=",
"(",
"rgb_t",
"*",
")",
"malloc",
"(",
"sizeof",
"(",
"*",
"palette",
"->",
"adjusted_color",
")",
"*",
"(",
"numcolors",
"*",
"numgroups",
"+",
"2",
")",
")",
";",
"palette",
"->",
"adjusted_rgb15",
"=",
"(",
"rgb_t",
"*",
")",
"malloc",
"(",
"sizeof",
"(",
"*",
"palette",
"->",
"adjusted_rgb15",
")",
"*",
"(",
"numcolors",
"*",
"numgroups",
"+",
"2",
")",
")",
";",
"if",
"(",
"palette",
"->",
"adjusted_color",
"==",
"NULL",
"||",
"palette",
"->",
"adjusted_rgb15",
"==",
"NULL",
")",
"goto",
"error",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"numcolors",
"*",
"numgroups",
";",
"index",
"++",
")",
"{",
"palette",
"->",
"adjusted_color",
"[",
"index",
"]",
"=",
"RGB_BLACK",
";",
"palette",
"->",
"adjusted_rgb15",
"[",
"index",
"]",
"=",
"rgb_to_rgb15",
"(",
"RGB_BLACK",
")",
";",
"}",
"palette",
"->",
"adjusted_color",
"[",
"index",
"]",
"=",
"RGB_BLACK",
";",
"palette",
"->",
"adjusted_rgb15",
"[",
"index",
"++",
"]",
"=",
"rgb_to_rgb15",
"(",
"RGB_BLACK",
")",
";",
"palette",
"->",
"adjusted_color",
"[",
"index",
"]",
"=",
"RGB_WHITE",
";",
"palette",
"->",
"adjusted_rgb15",
"[",
"index",
"++",
"]",
"=",
"rgb_to_rgb15",
"(",
"RGB_WHITE",
")",
";",
"palette",
"->",
"refcount",
"=",
"1",
";",
"palette",
"->",
"numcolors",
"=",
"numcolors",
";",
"palette",
"->",
"numgroups",
"=",
"numgroups",
";",
"return",
"palette",
";",
"error",
":",
"if",
"(",
"palette",
"!=",
"NULL",
")",
"internal_palette_free",
"(",
"palette",
")",
";",
"return",
"NULL",
";",
"}"
] | palette_alloc - allocate a new palette object
and take a single reference on it | [
"palette_alloc",
"-",
"allocate",
"a",
"new",
"palette",
"object",
"and",
"take",
"a",
"single",
"reference",
"on",
"it"
] | [
"/* allocate memory */",
"/* initialize overall controls */",
"/* allocate an array of palette entries and individual contrasts for each */",
"/* initialize the entries */",
"/* allocate an array of brightness and contrast for each group */",
"/* initialize the entries */",
"/* allocate arrays for the adjusted colors */",
"/* initialize the arrays */",
"/* add black and white as the last two colors */",
"/* initialize the remainder of the structure */"
] | [
{
"param": "numcolors",
"type": "UINT32"
},
{
"param": "numgroups",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "numcolors",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "numgroups",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f908a3f197e2d52340bebac300d7c93292c7a4c5 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/palette.c | [
"Unlicense"
] | C | palette_client_alloc | palette_client | palette_client *palette_client_alloc(palette_t *palette)
{
UINT32 total_colors = palette->numcolors * palette->numgroups;
UINT32 dirty_dwords = (total_colors + 31) / 32;
palette_client *client;
/* allocate memory for the client */
client = (palette_client *)malloc(sizeof(*client));
if (client == NULL)
goto error;
memset(client, 0, sizeof(*client));
/* allocate dirty lists */
client->live.dirty = (UINT32 *)malloc(dirty_dwords * sizeof(UINT32));
client->previous.dirty = (UINT32 *)malloc(dirty_dwords * sizeof(UINT32));
if (client->live.dirty == NULL || client->previous.dirty == NULL)
goto error;
/* mark everything dirty to start with */
memset(client->live.dirty, 0xff, dirty_dwords * sizeof(UINT32));
memset(client->previous.dirty, 0xff, dirty_dwords * sizeof(UINT32));
client->live.dirty[dirty_dwords - 1] &= (1 << (total_colors % 32)) - 1;
client->previous.dirty[dirty_dwords - 1] &= (1 << (total_colors % 32)) - 1;
/* initialize the rest of the structure and add a reference to a palette */
client->palette = palette;
palette_ref(palette);
client->live.mindirty = 0;
client->live.maxdirty = total_colors - 1;
/* now add us to the list of clients */
client->next = palette->client_list;
palette->client_list = client;
return client;
error:
if (client != NULL)
{
if (client->live.dirty != NULL)
free(client->live.dirty);
if (client->previous.dirty != NULL)
free(client->previous.dirty);
free(client);
}
return NULL;
} | /*-------------------------------------------------
palette_client_alloc - add a new client to a
palette
-------------------------------------------------*/ | add a new client to a
palette | [
"add",
"a",
"new",
"client",
"to",
"a",
"palette"
] | palette_client *palette_client_alloc(palette_t *palette)
{
UINT32 total_colors = palette->numcolors * palette->numgroups;
UINT32 dirty_dwords = (total_colors + 31) / 32;
palette_client *client;
client = (palette_client *)malloc(sizeof(*client));
if (client == NULL)
goto error;
memset(client, 0, sizeof(*client));
client->live.dirty = (UINT32 *)malloc(dirty_dwords * sizeof(UINT32));
client->previous.dirty = (UINT32 *)malloc(dirty_dwords * sizeof(UINT32));
if (client->live.dirty == NULL || client->previous.dirty == NULL)
goto error;
memset(client->live.dirty, 0xff, dirty_dwords * sizeof(UINT32));
memset(client->previous.dirty, 0xff, dirty_dwords * sizeof(UINT32));
client->live.dirty[dirty_dwords - 1] &= (1 << (total_colors % 32)) - 1;
client->previous.dirty[dirty_dwords - 1] &= (1 << (total_colors % 32)) - 1;
client->palette = palette;
palette_ref(palette);
client->live.mindirty = 0;
client->live.maxdirty = total_colors - 1;
client->next = palette->client_list;
palette->client_list = client;
return client;
error:
if (client != NULL)
{
if (client->live.dirty != NULL)
free(client->live.dirty);
if (client->previous.dirty != NULL)
free(client->previous.dirty);
free(client);
}
return NULL;
} | [
"palette_client",
"*",
"palette_client_alloc",
"(",
"palette_t",
"*",
"palette",
")",
"{",
"UINT32",
"total_colors",
"=",
"palette",
"->",
"numcolors",
"*",
"palette",
"->",
"numgroups",
";",
"UINT32",
"dirty_dwords",
"=",
"(",
"total_colors",
"+",
"31",
")",
"/",
"32",
";",
"palette_client",
"*",
"client",
";",
"client",
"=",
"(",
"palette_client",
"*",
")",
"malloc",
"(",
"sizeof",
"(",
"*",
"client",
")",
")",
";",
"if",
"(",
"client",
"==",
"NULL",
")",
"goto",
"error",
";",
"memset",
"(",
"client",
",",
"0",
",",
"sizeof",
"(",
"*",
"client",
")",
")",
";",
"client",
"->",
"live",
".",
"dirty",
"=",
"(",
"UINT32",
"*",
")",
"malloc",
"(",
"dirty_dwords",
"*",
"sizeof",
"(",
"UINT32",
")",
")",
";",
"client",
"->",
"previous",
".",
"dirty",
"=",
"(",
"UINT32",
"*",
")",
"malloc",
"(",
"dirty_dwords",
"*",
"sizeof",
"(",
"UINT32",
")",
")",
";",
"if",
"(",
"client",
"->",
"live",
".",
"dirty",
"==",
"NULL",
"||",
"client",
"->",
"previous",
".",
"dirty",
"==",
"NULL",
")",
"goto",
"error",
";",
"memset",
"(",
"client",
"->",
"live",
".",
"dirty",
",",
"0xff",
",",
"dirty_dwords",
"*",
"sizeof",
"(",
"UINT32",
")",
")",
";",
"memset",
"(",
"client",
"->",
"previous",
".",
"dirty",
",",
"0xff",
",",
"dirty_dwords",
"*",
"sizeof",
"(",
"UINT32",
")",
")",
";",
"client",
"->",
"live",
".",
"dirty",
"[",
"dirty_dwords",
"-",
"1",
"]",
"&=",
"(",
"1",
"<<",
"(",
"total_colors",
"%",
"32",
")",
")",
"-",
"1",
";",
"client",
"->",
"previous",
".",
"dirty",
"[",
"dirty_dwords",
"-",
"1",
"]",
"&=",
"(",
"1",
"<<",
"(",
"total_colors",
"%",
"32",
")",
")",
"-",
"1",
";",
"client",
"->",
"palette",
"=",
"palette",
";",
"palette_ref",
"(",
"palette",
")",
";",
"client",
"->",
"live",
".",
"mindirty",
"=",
"0",
";",
"client",
"->",
"live",
".",
"maxdirty",
"=",
"total_colors",
"-",
"1",
";",
"client",
"->",
"next",
"=",
"palette",
"->",
"client_list",
";",
"palette",
"->",
"client_list",
"=",
"client",
";",
"return",
"client",
";",
"error",
":",
"if",
"(",
"client",
"!=",
"NULL",
")",
"{",
"if",
"(",
"client",
"->",
"live",
".",
"dirty",
"!=",
"NULL",
")",
"free",
"(",
"client",
"->",
"live",
".",
"dirty",
")",
";",
"if",
"(",
"client",
"->",
"previous",
".",
"dirty",
"!=",
"NULL",
")",
"free",
"(",
"client",
"->",
"previous",
".",
"dirty",
")",
";",
"free",
"(",
"client",
")",
";",
"}",
"return",
"NULL",
";",
"}"
] | palette_client_alloc - add a new client to a
palette | [
"palette_client_alloc",
"-",
"add",
"a",
"new",
"client",
"to",
"a",
"palette"
] | [
"/* allocate memory for the client */",
"/* allocate dirty lists */",
"/* mark everything dirty to start with */",
"/* initialize the rest of the structure and add a reference to a palette */",
"/* now add us to the list of clients */"
] | [
{
"param": "palette",
"type": "palette_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "palette",
"type": "palette_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f908a3f197e2d52340bebac300d7c93292c7a4c5 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/palette.c | [
"Unlicense"
] | C | palette_set_brightness | void | void palette_set_brightness(palette_t *palette, float brightness)
{
int groupnum, index;
/* convert incoming value to normalized result */
brightness = (brightness - 1.0f) * 256.0f;
/* set the global brightness if changed */
if (palette->brightness == brightness)
return;
palette->brightness = brightness;
/* update across all indices in all groups */
for (groupnum = 0; groupnum < palette->numgroups; groupnum++)
for (index = 0; index < palette->numcolors; index++)
update_adjusted_color(palette, groupnum, index);
} | /*-------------------------------------------------
palette_set_brightness - set the overall
brightness for the palette
-------------------------------------------------*/ | set the overall
brightness for the palette | [
"set",
"the",
"overall",
"brightness",
"for",
"the",
"palette"
] | void palette_set_brightness(palette_t *palette, float brightness)
{
int groupnum, index;
brightness = (brightness - 1.0f) * 256.0f;
if (palette->brightness == brightness)
return;
palette->brightness = brightness;
for (groupnum = 0; groupnum < palette->numgroups; groupnum++)
for (index = 0; index < palette->numcolors; index++)
update_adjusted_color(palette, groupnum, index);
} | [
"void",
"palette_set_brightness",
"(",
"palette_t",
"*",
"palette",
",",
"float",
"brightness",
")",
"{",
"int",
"groupnum",
",",
"index",
";",
"brightness",
"=",
"(",
"brightness",
"-",
"1.0f",
")",
"*",
"256.0f",
";",
"if",
"(",
"palette",
"->",
"brightness",
"==",
"brightness",
")",
"return",
";",
"palette",
"->",
"brightness",
"=",
"brightness",
";",
"for",
"(",
"groupnum",
"=",
"0",
";",
"groupnum",
"<",
"palette",
"->",
"numgroups",
";",
"groupnum",
"++",
")",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"palette",
"->",
"numcolors",
";",
"index",
"++",
")",
"update_adjusted_color",
"(",
"palette",
",",
"groupnum",
",",
"index",
")",
";",
"}"
] | palette_set_brightness - set the overall
brightness for the palette | [
"palette_set_brightness",
"-",
"set",
"the",
"overall",
"brightness",
"for",
"the",
"palette"
] | [
"/* convert incoming value to normalized result */",
"/* set the global brightness if changed */",
"/* update across all indices in all groups */"
] | [
{
"param": "palette",
"type": "palette_t"
},
{
"param": "brightness",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "palette",
"type": "palette_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "brightness",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f908a3f197e2d52340bebac300d7c93292c7a4c5 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/palette.c | [
"Unlicense"
] | C | palette_set_contrast | void | void palette_set_contrast(palette_t *palette, float contrast)
{
int groupnum, index;
/* set the global contrast if changed */
if (palette->contrast == contrast)
return;
palette->contrast = contrast;
/* update across all indices in all groups */
for (groupnum = 0; groupnum < palette->numgroups; groupnum++)
for (index = 0; index < palette->numcolors; index++)
update_adjusted_color(palette, groupnum, index);
} | /*-------------------------------------------------
palette_set_contrast - set the overall
contrast for the palette
-------------------------------------------------*/ | set the overall
contrast for the palette | [
"set",
"the",
"overall",
"contrast",
"for",
"the",
"palette"
] | void palette_set_contrast(palette_t *palette, float contrast)
{
int groupnum, index;
if (palette->contrast == contrast)
return;
palette->contrast = contrast;
for (groupnum = 0; groupnum < palette->numgroups; groupnum++)
for (index = 0; index < palette->numcolors; index++)
update_adjusted_color(palette, groupnum, index);
} | [
"void",
"palette_set_contrast",
"(",
"palette_t",
"*",
"palette",
",",
"float",
"contrast",
")",
"{",
"int",
"groupnum",
",",
"index",
";",
"if",
"(",
"palette",
"->",
"contrast",
"==",
"contrast",
")",
"return",
";",
"palette",
"->",
"contrast",
"=",
"contrast",
";",
"for",
"(",
"groupnum",
"=",
"0",
";",
"groupnum",
"<",
"palette",
"->",
"numgroups",
";",
"groupnum",
"++",
")",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"palette",
"->",
"numcolors",
";",
"index",
"++",
")",
"update_adjusted_color",
"(",
"palette",
",",
"groupnum",
",",
"index",
")",
";",
"}"
] | palette_set_contrast - set the overall
contrast for the palette | [
"palette_set_contrast",
"-",
"set",
"the",
"overall",
"contrast",
"for",
"the",
"palette"
] | [
"/* set the global contrast if changed */",
"/* update across all indices in all groups */"
] | [
{
"param": "palette",
"type": "palette_t"
},
{
"param": "contrast",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "palette",
"type": "palette_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "contrast",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f908a3f197e2d52340bebac300d7c93292c7a4c5 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/palette.c | [
"Unlicense"
] | C | palette_set_gamma | void | void palette_set_gamma(palette_t *palette, float gamma)
{
int groupnum, index;
/* set the global gamma if changed */
if (palette->gamma == gamma)
return;
palette->gamma = gamma;
/* recompute the gamma map */
gamma = 1.0f / gamma;
for (index = 0; index < 256; index++)
{
float fval = (float)index * (1.0f / 255.0f);
float fresult = pow(fval, gamma);
palette->gamma_map[index] = rgb_clamp(255.0f * fresult);
}
/* update across all indices in all groups */
for (groupnum = 0; groupnum < palette->numgroups; groupnum++)
for (index = 0; index < palette->numcolors; index++)
update_adjusted_color(palette, groupnum, index);
} | /*-------------------------------------------------
palette_set_gamma - set the overall
gamma for the palette
-------------------------------------------------*/ | set the overall
gamma for the palette | [
"set",
"the",
"overall",
"gamma",
"for",
"the",
"palette"
] | void palette_set_gamma(palette_t *palette, float gamma)
{
int groupnum, index;
if (palette->gamma == gamma)
return;
palette->gamma = gamma;
gamma = 1.0f / gamma;
for (index = 0; index < 256; index++)
{
float fval = (float)index * (1.0f / 255.0f);
float fresult = pow(fval, gamma);
palette->gamma_map[index] = rgb_clamp(255.0f * fresult);
}
for (groupnum = 0; groupnum < palette->numgroups; groupnum++)
for (index = 0; index < palette->numcolors; index++)
update_adjusted_color(palette, groupnum, index);
} | [
"void",
"palette_set_gamma",
"(",
"palette_t",
"*",
"palette",
",",
"float",
"gamma",
")",
"{",
"int",
"groupnum",
",",
"index",
";",
"if",
"(",
"palette",
"->",
"gamma",
"==",
"gamma",
")",
"return",
";",
"palette",
"->",
"gamma",
"=",
"gamma",
";",
"gamma",
"=",
"1.0f",
"/",
"gamma",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"256",
";",
"index",
"++",
")",
"{",
"float",
"fval",
"=",
"(",
"float",
")",
"index",
"*",
"(",
"1.0f",
"/",
"255.0f",
")",
";",
"float",
"fresult",
"=",
"pow",
"(",
"fval",
",",
"gamma",
")",
";",
"palette",
"->",
"gamma_map",
"[",
"index",
"]",
"=",
"rgb_clamp",
"(",
"255.0f",
"*",
"fresult",
")",
";",
"}",
"for",
"(",
"groupnum",
"=",
"0",
";",
"groupnum",
"<",
"palette",
"->",
"numgroups",
";",
"groupnum",
"++",
")",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"palette",
"->",
"numcolors",
";",
"index",
"++",
")",
"update_adjusted_color",
"(",
"palette",
",",
"groupnum",
",",
"index",
")",
";",
"}"
] | palette_set_gamma - set the overall
gamma for the palette | [
"palette_set_gamma",
"-",
"set",
"the",
"overall",
"gamma",
"for",
"the",
"palette"
] | [
"/* set the global gamma if changed */",
"/* recompute the gamma map */",
"/* update across all indices in all groups */"
] | [
{
"param": "palette",
"type": "palette_t"
},
{
"param": "gamma",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "palette",
"type": "palette_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gamma",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f908a3f197e2d52340bebac300d7c93292c7a4c5 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/palette.c | [
"Unlicense"
] | C | palette_group_set_brightness | void | void palette_group_set_brightness(palette_t *palette, UINT32 group, float brightness)
{
int index;
/* convert incoming value to normalized result */
brightness = (brightness - 1.0f) * 256.0f;
/* if out of range, or unchanged, ignore */
if (group >= palette->numgroups || palette->group_bright[group] == brightness)
return;
/* set the contrast */
palette->group_bright[group] = brightness;
/* update across all colors */
for (index = 0; index < palette->numcolors; index++)
update_adjusted_color(palette, group, index);
} | /*-------------------------------------------------
palette_group_set_brightness - configure
overall brightness for a palette group
-------------------------------------------------*/ | configure
overall brightness for a palette group | [
"configure",
"overall",
"brightness",
"for",
"a",
"palette",
"group"
] | void palette_group_set_brightness(palette_t *palette, UINT32 group, float brightness)
{
int index;
brightness = (brightness - 1.0f) * 256.0f;
if (group >= palette->numgroups || palette->group_bright[group] == brightness)
return;
palette->group_bright[group] = brightness;
for (index = 0; index < palette->numcolors; index++)
update_adjusted_color(palette, group, index);
} | [
"void",
"palette_group_set_brightness",
"(",
"palette_t",
"*",
"palette",
",",
"UINT32",
"group",
",",
"float",
"brightness",
")",
"{",
"int",
"index",
";",
"brightness",
"=",
"(",
"brightness",
"-",
"1.0f",
")",
"*",
"256.0f",
";",
"if",
"(",
"group",
">=",
"palette",
"->",
"numgroups",
"||",
"palette",
"->",
"group_bright",
"[",
"group",
"]",
"==",
"brightness",
")",
"return",
";",
"palette",
"->",
"group_bright",
"[",
"group",
"]",
"=",
"brightness",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"palette",
"->",
"numcolors",
";",
"index",
"++",
")",
"update_adjusted_color",
"(",
"palette",
",",
"group",
",",
"index",
")",
";",
"}"
] | palette_group_set_brightness - configure
overall brightness for a palette group | [
"palette_group_set_brightness",
"-",
"configure",
"overall",
"brightness",
"for",
"a",
"palette",
"group"
] | [
"/* convert incoming value to normalized result */",
"/* if out of range, or unchanged, ignore */",
"/* set the contrast */",
"/* update across all colors */"
] | [
{
"param": "palette",
"type": "palette_t"
},
{
"param": "group",
"type": "UINT32"
},
{
"param": "brightness",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "palette",
"type": "palette_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "group",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "brightness",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f908a3f197e2d52340bebac300d7c93292c7a4c5 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/palette.c | [
"Unlicense"
] | C | update_adjusted_color | void | static void update_adjusted_color(palette_t *palette, UINT32 group, UINT32 index)
{
UINT32 finalindex = group * palette->numcolors + index;
palette_client *client;
rgb_t adjusted;
/* compute the adjusted value */
adjusted = adjust_palette_entry(palette->entry_color[index],
palette->group_bright[group] + palette->brightness,
palette->group_contrast[group] * palette->entry_contrast[index] * palette->contrast,
palette->gamma_map);
/* if not different, ignore */
if (palette->adjusted_color[finalindex] == adjusted)
return;
/* otherwise, modify the adjusted color array */
palette->adjusted_color[finalindex] = adjusted;
palette->adjusted_rgb15[finalindex] = rgb_to_rgb15(adjusted);
/* mark dirty in all clients */
for (client = palette->client_list; client != NULL; client = client->next)
{
client->live.dirty[finalindex / 32] |= 1 << (finalindex % 32);
client->live.mindirty = MIN(client->live.mindirty, finalindex);
client->live.maxdirty = MAX(client->live.maxdirty, finalindex);
}
} | /*-------------------------------------------------
update_adjusted_color - update a color index
by group and index pair
-------------------------------------------------*/ | update a color index
by group and index pair | [
"update",
"a",
"color",
"index",
"by",
"group",
"and",
"index",
"pair"
] | static void update_adjusted_color(palette_t *palette, UINT32 group, UINT32 index)
{
UINT32 finalindex = group * palette->numcolors + index;
palette_client *client;
rgb_t adjusted;
adjusted = adjust_palette_entry(palette->entry_color[index],
palette->group_bright[group] + palette->brightness,
palette->group_contrast[group] * palette->entry_contrast[index] * palette->contrast,
palette->gamma_map);
if (palette->adjusted_color[finalindex] == adjusted)
return;
palette->adjusted_color[finalindex] = adjusted;
palette->adjusted_rgb15[finalindex] = rgb_to_rgb15(adjusted);
for (client = palette->client_list; client != NULL; client = client->next)
{
client->live.dirty[finalindex / 32] |= 1 << (finalindex % 32);
client->live.mindirty = MIN(client->live.mindirty, finalindex);
client->live.maxdirty = MAX(client->live.maxdirty, finalindex);
}
} | [
"static",
"void",
"update_adjusted_color",
"(",
"palette_t",
"*",
"palette",
",",
"UINT32",
"group",
",",
"UINT32",
"index",
")",
"{",
"UINT32",
"finalindex",
"=",
"group",
"*",
"palette",
"->",
"numcolors",
"+",
"index",
";",
"palette_client",
"*",
"client",
";",
"rgb_t",
"adjusted",
";",
"adjusted",
"=",
"adjust_palette_entry",
"(",
"palette",
"->",
"entry_color",
"[",
"index",
"]",
",",
"palette",
"->",
"group_bright",
"[",
"group",
"]",
"+",
"palette",
"->",
"brightness",
",",
"palette",
"->",
"group_contrast",
"[",
"group",
"]",
"*",
"palette",
"->",
"entry_contrast",
"[",
"index",
"]",
"*",
"palette",
"->",
"contrast",
",",
"palette",
"->",
"gamma_map",
")",
";",
"if",
"(",
"palette",
"->",
"adjusted_color",
"[",
"finalindex",
"]",
"==",
"adjusted",
")",
"return",
";",
"palette",
"->",
"adjusted_color",
"[",
"finalindex",
"]",
"=",
"adjusted",
";",
"palette",
"->",
"adjusted_rgb15",
"[",
"finalindex",
"]",
"=",
"rgb_to_rgb15",
"(",
"adjusted",
")",
";",
"for",
"(",
"client",
"=",
"palette",
"->",
"client_list",
";",
"client",
"!=",
"NULL",
";",
"client",
"=",
"client",
"->",
"next",
")",
"{",
"client",
"->",
"live",
".",
"dirty",
"[",
"finalindex",
"/",
"32",
"]",
"|=",
"1",
"<<",
"(",
"finalindex",
"%",
"32",
")",
";",
"client",
"->",
"live",
".",
"mindirty",
"=",
"MIN",
"(",
"client",
"->",
"live",
".",
"mindirty",
",",
"finalindex",
")",
";",
"client",
"->",
"live",
".",
"maxdirty",
"=",
"MAX",
"(",
"client",
"->",
"live",
".",
"maxdirty",
",",
"finalindex",
")",
";",
"}",
"}"
] | update_adjusted_color - update a color index
by group and index pair | [
"update_adjusted_color",
"-",
"update",
"a",
"color",
"index",
"by",
"group",
"and",
"index",
"pair"
] | [
"/* compute the adjusted value */",
"/* if not different, ignore */",
"/* otherwise, modify the adjusted color array */",
"/* mark dirty in all clients */"
] | [
{
"param": "palette",
"type": "palette_t"
},
{
"param": "group",
"type": "UINT32"
},
{
"param": "index",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "palette",
"type": "palette_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "group",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "index",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
be9a609005eb490cb070ebef949295c8c030aa58 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/ui.c | [
"Unlicense"
] | C | ui_set_startup_text | void | void ui_set_startup_text(running_machine *machine, const char *text, int force)
{
static osd_ticks_t lastupdatetime = 0;
osd_ticks_t curtime = osd_ticks();
/* copy in the new text */
astring_cpyc(messagebox_text, text);
messagebox_backcolor = UI_BACKGROUND_COLOR;
/* don't update more than 4 times/second */
if (force || (curtime - lastupdatetime) > osd_ticks_per_second() / 4)
{
lastupdatetime = curtime;
video_frame_update(machine, FALSE);
}
} | /*-------------------------------------------------
ui_set_startup_text - set the text to display
at startup
-------------------------------------------------*/ | set the text to display
at startup | [
"set",
"the",
"text",
"to",
"display",
"at",
"startup"
] | void ui_set_startup_text(running_machine *machine, const char *text, int force)
{
static osd_ticks_t lastupdatetime = 0;
osd_ticks_t curtime = osd_ticks();
astring_cpyc(messagebox_text, text);
messagebox_backcolor = UI_BACKGROUND_COLOR;
if (force || (curtime - lastupdatetime) > osd_ticks_per_second() / 4)
{
lastupdatetime = curtime;
video_frame_update(machine, FALSE);
}
} | [
"void",
"ui_set_startup_text",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"text",
",",
"int",
"force",
")",
"{",
"static",
"osd_ticks_t",
"lastupdatetime",
"=",
"0",
";",
"osd_ticks_t",
"curtime",
"=",
"osd_ticks",
"(",
")",
";",
"astring_cpyc",
"(",
"messagebox_text",
",",
"text",
")",
";",
"messagebox_backcolor",
"=",
"UI_BACKGROUND_COLOR",
";",
"if",
"(",
"force",
"||",
"(",
"curtime",
"-",
"lastupdatetime",
")",
">",
"osd_ticks_per_second",
"(",
")",
"/",
"4",
")",
"{",
"lastupdatetime",
"=",
"curtime",
";",
"video_frame_update",
"(",
"machine",
",",
"FALSE",
")",
";",
"}",
"}"
] | ui_set_startup_text - set the text to display
at startup | [
"ui_set_startup_text",
"-",
"set",
"the",
"text",
"to",
"display",
"at",
"startup"
] | [
"/* copy in the new text */",
"/* don't update more than 4 times/second */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "text",
"type": "char"
},
{
"param": "force",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "text",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "force",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
be9a609005eb490cb070ebef949295c8c030aa58 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/ui.c | [
"Unlicense"
] | C | ui_update_and_render | void | void ui_update_and_render(running_machine *machine)
{
/* always start clean */
render_container_empty(render_container_get_ui());
/* if we're paused, dim the whole screen */
if (mame_get_phase(machine) >= MAME_PHASE_RESET && (single_step || mame_is_paused(machine)))
{
int alpha = (1.0f - options_get_float(mame_options(), OPTION_PAUSE_BRIGHTNESS)) * 255.0f;
if (ui_menu_is_force_game_select())
alpha = 255;
if (alpha > 255)
alpha = 255;
if (alpha >= 0)
render_ui_add_rect(0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(alpha,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
/* render any cheat stuff at the bottom */
cheat_render_text(machine);
/* call the current UI handler */
assert(ui_handler_callback != NULL);
ui_handler_param = (*ui_handler_callback)(machine, ui_handler_param);
/* display any popup messages */
if (osd_ticks() < popup_text_end)
ui_draw_text_box(astring_c(messagebox_text), JUSTIFY_CENTER, 0.5f, 0.9f, messagebox_backcolor);
else
popup_text_end = 0;
/* cancel takes us back to the ingame handler */
if (ui_handler_param == UI_HANDLER_CANCEL)
ui_set_handler(handler_ingame, 0);
} | /*-------------------------------------------------
ui_update_and_render - update the UI and
render it; called by video.c
-------------------------------------------------*/ | update the UI and
render it; called by video.c | [
"update",
"the",
"UI",
"and",
"render",
"it",
";",
"called",
"by",
"video",
".",
"c"
] | void ui_update_and_render(running_machine *machine)
{
render_container_empty(render_container_get_ui());
if (mame_get_phase(machine) >= MAME_PHASE_RESET && (single_step || mame_is_paused(machine)))
{
int alpha = (1.0f - options_get_float(mame_options(), OPTION_PAUSE_BRIGHTNESS)) * 255.0f;
if (ui_menu_is_force_game_select())
alpha = 255;
if (alpha > 255)
alpha = 255;
if (alpha >= 0)
render_ui_add_rect(0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(alpha,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
cheat_render_text(machine);
assert(ui_handler_callback != NULL);
ui_handler_param = (*ui_handler_callback)(machine, ui_handler_param);
if (osd_ticks() < popup_text_end)
ui_draw_text_box(astring_c(messagebox_text), JUSTIFY_CENTER, 0.5f, 0.9f, messagebox_backcolor);
else
popup_text_end = 0;
if (ui_handler_param == UI_HANDLER_CANCEL)
ui_set_handler(handler_ingame, 0);
} | [
"void",
"ui_update_and_render",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"render_container_empty",
"(",
"render_container_get_ui",
"(",
")",
")",
";",
"if",
"(",
"mame_get_phase",
"(",
"machine",
")",
">=",
"MAME_PHASE_RESET",
"&&",
"(",
"single_step",
"||",
"mame_is_paused",
"(",
"machine",
")",
")",
")",
"{",
"int",
"alpha",
"=",
"(",
"1.0f",
"-",
"options_get_float",
"(",
"mame_options",
"(",
")",
",",
"OPTION_PAUSE_BRIGHTNESS",
")",
")",
"*",
"255.0f",
";",
"if",
"(",
"ui_menu_is_force_game_select",
"(",
")",
")",
"alpha",
"=",
"255",
";",
"if",
"(",
"alpha",
">",
"255",
")",
"alpha",
"=",
"255",
";",
"if",
"(",
"alpha",
">=",
"0",
")",
"render_ui_add_rect",
"(",
"0.0f",
",",
"0.0f",
",",
"1.0f",
",",
"1.0f",
",",
"MAKE_ARGB",
"(",
"alpha",
",",
"0x00",
",",
"0x00",
",",
"0x00",
")",
",",
"PRIMFLAG_BLENDMODE",
"(",
"BLENDMODE_ALPHA",
")",
")",
";",
"}",
"cheat_render_text",
"(",
"machine",
")",
";",
"assert",
"(",
"ui_handler_callback",
"!=",
"NULL",
")",
";",
"ui_handler_param",
"=",
"(",
"*",
"ui_handler_callback",
")",
"(",
"machine",
",",
"ui_handler_param",
")",
";",
"if",
"(",
"osd_ticks",
"(",
")",
"<",
"popup_text_end",
")",
"ui_draw_text_box",
"(",
"astring_c",
"(",
"messagebox_text",
")",
",",
"JUSTIFY_CENTER",
",",
"0.5f",
",",
"0.9f",
",",
"messagebox_backcolor",
")",
";",
"else",
"popup_text_end",
"=",
"0",
";",
"if",
"(",
"ui_handler_param",
"==",
"UI_HANDLER_CANCEL",
")",
"ui_set_handler",
"(",
"handler_ingame",
",",
"0",
")",
";",
"}"
] | ui_update_and_render - update the UI and
render it; called by video.c | [
"ui_update_and_render",
"-",
"update",
"the",
"UI",
"and",
"render",
"it",
";",
"called",
"by",
"video",
".",
"c"
] | [
"/* always start clean */",
"/* if we're paused, dim the whole screen */",
"/* render any cheat stuff at the bottom */",
"/* call the current UI handler */",
"/* display any popup messages */",
"/* cancel takes us back to the ingame handler */"
] | [
{
"param": "machine",
"type": "running_machine"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
be9a609005eb490cb070ebef949295c8c030aa58 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/ui.c | [
"Unlicense"
] | C | ui_draw_outlined_box | void | void ui_draw_outlined_box(float x0, float y0, float x1, float y1, rgb_t backcolor)
{
render_ui_add_rect(x0, y0, x1, y1, backcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_ui_add_line(x0, y0, x1, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_ui_add_line(x1, y0, x1, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_ui_add_line(x1, y1, x0, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_ui_add_line(x0, y1, x0, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
} | /*-------------------------------------------------
ui_draw_outlined_box - add primitives to draw
an outlined box with the given background
color
-------------------------------------------------*/ | add primitives to draw
an outlined box with the given background
color | [
"add",
"primitives",
"to",
"draw",
"an",
"outlined",
"box",
"with",
"the",
"given",
"background",
"color"
] | void ui_draw_outlined_box(float x0, float y0, float x1, float y1, rgb_t backcolor)
{
render_ui_add_rect(x0, y0, x1, y1, backcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_ui_add_line(x0, y0, x1, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_ui_add_line(x1, y0, x1, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_ui_add_line(x1, y1, x0, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_ui_add_line(x0, y1, x0, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
} | [
"void",
"ui_draw_outlined_box",
"(",
"float",
"x0",
",",
"float",
"y0",
",",
"float",
"x1",
",",
"float",
"y1",
",",
"rgb_t",
"backcolor",
")",
"{",
"render_ui_add_rect",
"(",
"x0",
",",
"y0",
",",
"x1",
",",
"y1",
",",
"backcolor",
",",
"PRIMFLAG_BLENDMODE",
"(",
"BLENDMODE_ALPHA",
")",
")",
";",
"render_ui_add_line",
"(",
"x0",
",",
"y0",
",",
"x1",
",",
"y0",
",",
"UI_LINE_WIDTH",
",",
"UI_BORDER_COLOR",
",",
"PRIMFLAG_BLENDMODE",
"(",
"BLENDMODE_ALPHA",
")",
")",
";",
"render_ui_add_line",
"(",
"x1",
",",
"y0",
",",
"x1",
",",
"y1",
",",
"UI_LINE_WIDTH",
",",
"UI_BORDER_COLOR",
",",
"PRIMFLAG_BLENDMODE",
"(",
"BLENDMODE_ALPHA",
")",
")",
";",
"render_ui_add_line",
"(",
"x1",
",",
"y1",
",",
"x0",
",",
"y1",
",",
"UI_LINE_WIDTH",
",",
"UI_BORDER_COLOR",
",",
"PRIMFLAG_BLENDMODE",
"(",
"BLENDMODE_ALPHA",
")",
")",
";",
"render_ui_add_line",
"(",
"x0",
",",
"y1",
",",
"x0",
",",
"y0",
",",
"UI_LINE_WIDTH",
",",
"UI_BORDER_COLOR",
",",
"PRIMFLAG_BLENDMODE",
"(",
"BLENDMODE_ALPHA",
")",
")",
";",
"}"
] | ui_draw_outlined_box - add primitives to draw
an outlined box with the given background
color | [
"ui_draw_outlined_box",
"-",
"add",
"primitives",
"to",
"draw",
"an",
"outlined",
"box",
"with",
"the",
"given",
"background",
"color"
] | [] | [
{
"param": "x0",
"type": "float"
},
{
"param": "y0",
"type": "float"
},
{
"param": "x1",
"type": "float"
},
{
"param": "y1",
"type": "float"
},
{
"param": "backcolor",
"type": "rgb_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x0",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y0",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x1",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y1",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "backcolor",
"type": "rgb_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
be9a609005eb490cb070ebef949295c8c030aa58 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/ui.c | [
"Unlicense"
] | C | ui_draw_text_full | void | void ui_draw_text_full(const char *origs, float x, float y, float origwrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight)
{
float lineheight = ui_get_line_height();
const char *ends = origs + strlen(origs);
float wrapwidth = origwrapwidth;
const char *s = origs;
const char *linestart;
float cury = y;
float maxwidth = 0;
/* if we don't want wrapping, guarantee a huge wrapwidth */
if (wrap == WRAP_NEVER)
wrapwidth = 1000000.0f;
if (wrapwidth <= 0)
return;
/* loop over lines */
while (*s != 0)
{
const char *lastbreak = NULL;
int line_justify = justify;
unicode_char schar;
int scharcount;
float lastbreak_width = 0;
float curwidth = 0;
float curx = x;
/* get the current character */
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
/* if the line starts with a tab character, center it regardless */
if (schar == '\t')
{
s += scharcount;
line_justify = JUSTIFY_CENTER;
}
/* remember the starting position of the line */
linestart = s;
/* loop while we have characters and are less than the wrapwidth */
while (*s != 0 && curwidth <= wrapwidth)
{
float chwidth;
/* get the current chcaracter */
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
/* if we hit a newline, stop immediately */
if (schar == '\n')
break;
/* get the width of this character */
chwidth = ui_get_char_width(schar);
/* if we hit a space, remember the location and width *without* the space */
if (schar == ' ')
{
lastbreak = s;
lastbreak_width = curwidth;
}
/* add the width of this character and advance */
curwidth += chwidth;
s += scharcount;
/* if we hit any non-space breakable character, remember the location and width
*with* the breakable character */
if (schar != ' ' && is_breakable_char(schar) && curwidth <= wrapwidth)
{
lastbreak = s;
lastbreak_width = curwidth;
}
}
/* if we accumulated too much for the current width, we need to back off */
if (curwidth > wrapwidth)
{
/* if we're word wrapping, back up to the last break if we can */
if (wrap == WRAP_WORD)
{
/* if we hit a break, back up to there with the appropriate width */
if (lastbreak != NULL)
{
s = lastbreak;
curwidth = lastbreak_width;
}
/* if we didn't hit a break, back up one character */
else if (s > linestart)
{
/* get the previous character */
s = (const char *)utf8_previous_char(s);
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
curwidth -= ui_get_char_width(schar);
}
}
/* if we're truncating, make sure we have enough space for the ... */
else if (wrap == WRAP_TRUNCATE)
{
/* add in the width of the ... */
curwidth += 3.0f * ui_get_char_width('.');
/* while we are above the wrap width, back up one character */
while (curwidth > wrapwidth && s > linestart)
{
/* get the previous character */
s = (const char *)utf8_previous_char(s);
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
curwidth -= ui_get_char_width(schar);
}
}
}
/* align according to the justfication */
if (line_justify == JUSTIFY_CENTER)
curx += (origwrapwidth - curwidth) * 0.5f;
else if (line_justify == JUSTIFY_RIGHT)
curx += origwrapwidth - curwidth;
/* track the maximum width of any given line */
if (curwidth > maxwidth)
maxwidth = curwidth;
/* if opaque, add a black box */
if (draw == DRAW_OPAQUE)
render_ui_add_rect(curx, cury, curx + curwidth, cury + lineheight, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
/* loop from the line start and add the characters */
while (linestart < s)
{
/* get the current character */
unicode_char linechar;
int linecharcount = uchar_from_utf8(&linechar, linestart, ends - linestart);
if (linecharcount == -1)
break;
if (draw != DRAW_NONE)
{
render_ui_add_char(curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, linechar);
curx += ui_get_char_width(linechar);
}
linestart += linecharcount;
}
/* append ellipses if needed */
if (wrap == WRAP_TRUNCATE && *s != 0 && draw != DRAW_NONE)
{
render_ui_add_char(curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.');
curx += ui_get_char_width('.');
render_ui_add_char(curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.');
curx += ui_get_char_width('.');
render_ui_add_char(curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.');
curx += ui_get_char_width('.');
}
/* if we're not word-wrapping, we're done */
if (wrap != WRAP_WORD)
break;
/* advance by a row */
cury += lineheight;
/* skip past any spaces at the beginning of the next line */
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
if (schar == '\n')
s += scharcount;
else
while (*s && isspace(schar))
{
s += scharcount;
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
}
}
/* report the width and height of the resulting space */
if (totalwidth)
*totalwidth = maxwidth;
if (totalheight)
*totalheight = cury - y;
} | /*-------------------------------------------------
ui_draw_text_full - full featured text
renderer with word wrapping, justification,
and full size computation
-------------------------------------------------*/ | full featured text
renderer with word wrapping, justification,
and full size computation | [
"full",
"featured",
"text",
"renderer",
"with",
"word",
"wrapping",
"justification",
"and",
"full",
"size",
"computation"
] | void ui_draw_text_full(const char *origs, float x, float y, float origwrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight)
{
float lineheight = ui_get_line_height();
const char *ends = origs + strlen(origs);
float wrapwidth = origwrapwidth;
const char *s = origs;
const char *linestart;
float cury = y;
float maxwidth = 0;
if (wrap == WRAP_NEVER)
wrapwidth = 1000000.0f;
if (wrapwidth <= 0)
return;
while (*s != 0)
{
const char *lastbreak = NULL;
int line_justify = justify;
unicode_char schar;
int scharcount;
float lastbreak_width = 0;
float curwidth = 0;
float curx = x;
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
if (schar == '\t')
{
s += scharcount;
line_justify = JUSTIFY_CENTER;
}
linestart = s;
while (*s != 0 && curwidth <= wrapwidth)
{
float chwidth;
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
if (schar == '\n')
break;
chwidth = ui_get_char_width(schar);
if (schar == ' ')
{
lastbreak = s;
lastbreak_width = curwidth;
}
curwidth += chwidth;
s += scharcount;
if (schar != ' ' && is_breakable_char(schar) && curwidth <= wrapwidth)
{
lastbreak = s;
lastbreak_width = curwidth;
}
}
if (curwidth > wrapwidth)
{
if (wrap == WRAP_WORD)
{
if (lastbreak != NULL)
{
s = lastbreak;
curwidth = lastbreak_width;
}
else if (s > linestart)
{
s = (const char *)utf8_previous_char(s);
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
curwidth -= ui_get_char_width(schar);
}
}
else if (wrap == WRAP_TRUNCATE)
{
curwidth += 3.0f * ui_get_char_width('.');
while (curwidth > wrapwidth && s > linestart)
{
s = (const char *)utf8_previous_char(s);
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
curwidth -= ui_get_char_width(schar);
}
}
}
if (line_justify == JUSTIFY_CENTER)
curx += (origwrapwidth - curwidth) * 0.5f;
else if (line_justify == JUSTIFY_RIGHT)
curx += origwrapwidth - curwidth;
if (curwidth > maxwidth)
maxwidth = curwidth;
if (draw == DRAW_OPAQUE)
render_ui_add_rect(curx, cury, curx + curwidth, cury + lineheight, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
while (linestart < s)
{
unicode_char linechar;
int linecharcount = uchar_from_utf8(&linechar, linestart, ends - linestart);
if (linecharcount == -1)
break;
if (draw != DRAW_NONE)
{
render_ui_add_char(curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, linechar);
curx += ui_get_char_width(linechar);
}
linestart += linecharcount;
}
if (wrap == WRAP_TRUNCATE && *s != 0 && draw != DRAW_NONE)
{
render_ui_add_char(curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.');
curx += ui_get_char_width('.');
render_ui_add_char(curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.');
curx += ui_get_char_width('.');
render_ui_add_char(curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.');
curx += ui_get_char_width('.');
}
if (wrap != WRAP_WORD)
break;
cury += lineheight;
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
if (schar == '\n')
s += scharcount;
else
while (*s && isspace(schar))
{
s += scharcount;
scharcount = uchar_from_utf8(&schar, s, ends - s);
if (scharcount == -1)
break;
}
}
if (totalwidth)
*totalwidth = maxwidth;
if (totalheight)
*totalheight = cury - y;
} | [
"void",
"ui_draw_text_full",
"(",
"const",
"char",
"*",
"origs",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"origwrapwidth",
",",
"int",
"justify",
",",
"int",
"wrap",
",",
"int",
"draw",
",",
"rgb_t",
"fgcolor",
",",
"rgb_t",
"bgcolor",
",",
"float",
"*",
"totalwidth",
",",
"float",
"*",
"totalheight",
")",
"{",
"float",
"lineheight",
"=",
"ui_get_line_height",
"(",
")",
";",
"const",
"char",
"*",
"ends",
"=",
"origs",
"+",
"strlen",
"(",
"origs",
")",
";",
"float",
"wrapwidth",
"=",
"origwrapwidth",
";",
"const",
"char",
"*",
"s",
"=",
"origs",
";",
"const",
"char",
"*",
"linestart",
";",
"float",
"cury",
"=",
"y",
";",
"float",
"maxwidth",
"=",
"0",
";",
"if",
"(",
"wrap",
"==",
"WRAP_NEVER",
")",
"wrapwidth",
"=",
"1000000.0f",
";",
"if",
"(",
"wrapwidth",
"<=",
"0",
")",
"return",
";",
"while",
"(",
"*",
"s",
"!=",
"0",
")",
"{",
"const",
"char",
"*",
"lastbreak",
"=",
"NULL",
";",
"int",
"line_justify",
"=",
"justify",
";",
"unicode_char",
"schar",
";",
"int",
"scharcount",
";",
"float",
"lastbreak_width",
"=",
"0",
";",
"float",
"curwidth",
"=",
"0",
";",
"float",
"curx",
"=",
"x",
";",
"scharcount",
"=",
"uchar_from_utf8",
"(",
"&",
"schar",
",",
"s",
",",
"ends",
"-",
"s",
")",
";",
"if",
"(",
"scharcount",
"==",
"-1",
")",
"break",
";",
"if",
"(",
"schar",
"==",
"'",
"\\t",
"'",
")",
"{",
"s",
"+=",
"scharcount",
";",
"line_justify",
"=",
"JUSTIFY_CENTER",
";",
"}",
"linestart",
"=",
"s",
";",
"while",
"(",
"*",
"s",
"!=",
"0",
"&&",
"curwidth",
"<=",
"wrapwidth",
")",
"{",
"float",
"chwidth",
";",
"scharcount",
"=",
"uchar_from_utf8",
"(",
"&",
"schar",
",",
"s",
",",
"ends",
"-",
"s",
")",
";",
"if",
"(",
"scharcount",
"==",
"-1",
")",
"break",
";",
"if",
"(",
"schar",
"==",
"'",
"\\n",
"'",
")",
"break",
";",
"chwidth",
"=",
"ui_get_char_width",
"(",
"schar",
")",
";",
"if",
"(",
"schar",
"==",
"'",
"'",
")",
"{",
"lastbreak",
"=",
"s",
";",
"lastbreak_width",
"=",
"curwidth",
";",
"}",
"curwidth",
"+=",
"chwidth",
";",
"s",
"+=",
"scharcount",
";",
"if",
"(",
"schar",
"!=",
"'",
"'",
"&&",
"is_breakable_char",
"(",
"schar",
")",
"&&",
"curwidth",
"<=",
"wrapwidth",
")",
"{",
"lastbreak",
"=",
"s",
";",
"lastbreak_width",
"=",
"curwidth",
";",
"}",
"}",
"if",
"(",
"curwidth",
">",
"wrapwidth",
")",
"{",
"if",
"(",
"wrap",
"==",
"WRAP_WORD",
")",
"{",
"if",
"(",
"lastbreak",
"!=",
"NULL",
")",
"{",
"s",
"=",
"lastbreak",
";",
"curwidth",
"=",
"lastbreak_width",
";",
"}",
"else",
"if",
"(",
"s",
">",
"linestart",
")",
"{",
"s",
"=",
"(",
"const",
"char",
"*",
")",
"utf8_previous_char",
"(",
"s",
")",
";",
"scharcount",
"=",
"uchar_from_utf8",
"(",
"&",
"schar",
",",
"s",
",",
"ends",
"-",
"s",
")",
";",
"if",
"(",
"scharcount",
"==",
"-1",
")",
"break",
";",
"curwidth",
"-=",
"ui_get_char_width",
"(",
"schar",
")",
";",
"}",
"}",
"else",
"if",
"(",
"wrap",
"==",
"WRAP_TRUNCATE",
")",
"{",
"curwidth",
"+=",
"3.0f",
"*",
"ui_get_char_width",
"(",
"'",
"'",
")",
";",
"while",
"(",
"curwidth",
">",
"wrapwidth",
"&&",
"s",
">",
"linestart",
")",
"{",
"s",
"=",
"(",
"const",
"char",
"*",
")",
"utf8_previous_char",
"(",
"s",
")",
";",
"scharcount",
"=",
"uchar_from_utf8",
"(",
"&",
"schar",
",",
"s",
",",
"ends",
"-",
"s",
")",
";",
"if",
"(",
"scharcount",
"==",
"-1",
")",
"break",
";",
"curwidth",
"-=",
"ui_get_char_width",
"(",
"schar",
")",
";",
"}",
"}",
"}",
"if",
"(",
"line_justify",
"==",
"JUSTIFY_CENTER",
")",
"curx",
"+=",
"(",
"origwrapwidth",
"-",
"curwidth",
")",
"*",
"0.5f",
";",
"else",
"if",
"(",
"line_justify",
"==",
"JUSTIFY_RIGHT",
")",
"curx",
"+=",
"origwrapwidth",
"-",
"curwidth",
";",
"if",
"(",
"curwidth",
">",
"maxwidth",
")",
"maxwidth",
"=",
"curwidth",
";",
"if",
"(",
"draw",
"==",
"DRAW_OPAQUE",
")",
"render_ui_add_rect",
"(",
"curx",
",",
"cury",
",",
"curx",
"+",
"curwidth",
",",
"cury",
"+",
"lineheight",
",",
"bgcolor",
",",
"PRIMFLAG_BLENDMODE",
"(",
"BLENDMODE_ALPHA",
")",
")",
";",
"while",
"(",
"linestart",
"<",
"s",
")",
"{",
"unicode_char",
"linechar",
";",
"int",
"linecharcount",
"=",
"uchar_from_utf8",
"(",
"&",
"linechar",
",",
"linestart",
",",
"ends",
"-",
"linestart",
")",
";",
"if",
"(",
"linecharcount",
"==",
"-1",
")",
"break",
";",
"if",
"(",
"draw",
"!=",
"DRAW_NONE",
")",
"{",
"render_ui_add_char",
"(",
"curx",
",",
"cury",
",",
"lineheight",
",",
"render_get_ui_aspect",
"(",
")",
",",
"fgcolor",
",",
"ui_font",
",",
"linechar",
")",
";",
"curx",
"+=",
"ui_get_char_width",
"(",
"linechar",
")",
";",
"}",
"linestart",
"+=",
"linecharcount",
";",
"}",
"if",
"(",
"wrap",
"==",
"WRAP_TRUNCATE",
"&&",
"*",
"s",
"!=",
"0",
"&&",
"draw",
"!=",
"DRAW_NONE",
")",
"{",
"render_ui_add_char",
"(",
"curx",
",",
"cury",
",",
"lineheight",
",",
"render_get_ui_aspect",
"(",
")",
",",
"fgcolor",
",",
"ui_font",
",",
"'",
"'",
")",
";",
"curx",
"+=",
"ui_get_char_width",
"(",
"'",
"'",
")",
";",
"render_ui_add_char",
"(",
"curx",
",",
"cury",
",",
"lineheight",
",",
"render_get_ui_aspect",
"(",
")",
",",
"fgcolor",
",",
"ui_font",
",",
"'",
"'",
")",
";",
"curx",
"+=",
"ui_get_char_width",
"(",
"'",
"'",
")",
";",
"render_ui_add_char",
"(",
"curx",
",",
"cury",
",",
"lineheight",
",",
"render_get_ui_aspect",
"(",
")",
",",
"fgcolor",
",",
"ui_font",
",",
"'",
"'",
")",
";",
"curx",
"+=",
"ui_get_char_width",
"(",
"'",
"'",
")",
";",
"}",
"if",
"(",
"wrap",
"!=",
"WRAP_WORD",
")",
"break",
";",
"cury",
"+=",
"lineheight",
";",
"scharcount",
"=",
"uchar_from_utf8",
"(",
"&",
"schar",
",",
"s",
",",
"ends",
"-",
"s",
")",
";",
"if",
"(",
"scharcount",
"==",
"-1",
")",
"break",
";",
"if",
"(",
"schar",
"==",
"'",
"\\n",
"'",
")",
"s",
"+=",
"scharcount",
";",
"else",
"while",
"(",
"*",
"s",
"&&",
"isspace",
"(",
"schar",
")",
")",
"{",
"s",
"+=",
"scharcount",
";",
"scharcount",
"=",
"uchar_from_utf8",
"(",
"&",
"schar",
",",
"s",
",",
"ends",
"-",
"s",
")",
";",
"if",
"(",
"scharcount",
"==",
"-1",
")",
"break",
";",
"}",
"}",
"if",
"(",
"totalwidth",
")",
"*",
"totalwidth",
"=",
"maxwidth",
";",
"if",
"(",
"totalheight",
")",
"*",
"totalheight",
"=",
"cury",
"-",
"y",
";",
"}"
] | ui_draw_text_full - full featured text
renderer with word wrapping, justification,
and full size computation | [
"ui_draw_text_full",
"-",
"full",
"featured",
"text",
"renderer",
"with",
"word",
"wrapping",
"justification",
"and",
"full",
"size",
"computation"
] | [
"/* if we don't want wrapping, guarantee a huge wrapwidth */",
"/* loop over lines */",
"/* get the current character */",
"/* if the line starts with a tab character, center it regardless */",
"/* remember the starting position of the line */",
"/* loop while we have characters and are less than the wrapwidth */",
"/* get the current chcaracter */",
"/* if we hit a newline, stop immediately */",
"/* get the width of this character */",
"/* if we hit a space, remember the location and width *without* the space */",
"/* add the width of this character and advance */",
"/* if we hit any non-space breakable character, remember the location and width\n *with* the breakable character */",
"/* if we accumulated too much for the current width, we need to back off */",
"/* if we're word wrapping, back up to the last break if we can */",
"/* if we hit a break, back up to there with the appropriate width */",
"/* if we didn't hit a break, back up one character */",
"/* get the previous character */",
"/* if we're truncating, make sure we have enough space for the ... */",
"/* add in the width of the ... */",
"/* while we are above the wrap width, back up one character */",
"/* get the previous character */",
"/* align according to the justfication */",
"/* track the maximum width of any given line */",
"/* if opaque, add a black box */",
"/* loop from the line start and add the characters */",
"/* get the current character */",
"/* append ellipses if needed */",
"/* if we're not word-wrapping, we're done */",
"/* advance by a row */",
"/* skip past any spaces at the beginning of the next line */",
"/* report the width and height of the resulting space */"
] | [
{
"param": "origs",
"type": "char"
},
{
"param": "x",
"type": "float"
},
{
"param": "y",
"type": "float"
},
{
"param": "origwrapwidth",
"type": "float"
},
{
"param": "justify",
"type": "int"
},
{
"param": "wrap",
"type": "int"
},
{
"param": "draw",
"type": "int"
},
{
"param": "fgcolor",
"type": "rgb_t"
},
{
"param": "bgcolor",
"type": "rgb_t"
},
{
"param": "totalwidth",
"type": "float"
},
{
"param": "totalheight",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "origs",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "origwrapwidth",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "justify",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wrap",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "draw",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fgcolor",
"type": "rgb_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bgcolor",
"type": "rgb_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "totalwidth",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "totalheight",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
be9a609005eb490cb070ebef949295c8c030aa58 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/ui.c | [
"Unlicense"
] | C | ui_draw_text_box | void | void ui_draw_text_box(const char *text, int justify, float xpos, float ypos, rgb_t backcolor)
{
float target_width, target_height;
float target_x, target_y;
/* compute the multi-line target width/height */
ui_draw_text_full(text, 0, 0, 1.0f - 2.0f * UI_BOX_LR_BORDER,
justify, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height);
if (target_height > 1.0f - 2.0f * UI_BOX_TB_BORDER)
target_height = floor((1.0f - 2.0f * UI_BOX_TB_BORDER) / ui_get_line_height()) * ui_get_line_height();
/* determine the target location */
target_x = xpos - 0.5f * target_width;
target_y = ypos - 0.5f * target_height;
/* make sure we stay on-screen */
if (target_x < UI_BOX_LR_BORDER)
target_x = UI_BOX_LR_BORDER;
if (target_x + target_width + UI_BOX_LR_BORDER > 1.0f)
target_x = 1.0f - UI_BOX_LR_BORDER - target_width;
if (target_y < UI_BOX_TB_BORDER)
target_y = UI_BOX_TB_BORDER;
if (target_y + target_height + UI_BOX_TB_BORDER > 1.0f)
target_y = 1.0f - UI_BOX_TB_BORDER - target_height;
/* add a box around that */
ui_draw_outlined_box(target_x - UI_BOX_LR_BORDER,
target_y - UI_BOX_TB_BORDER,
target_x + target_width + UI_BOX_LR_BORDER,
target_y + target_height + UI_BOX_TB_BORDER, backcolor);
ui_draw_text_full(text, target_x, target_y, target_width,
justify, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
} | /*-------------------------------------------------
ui_draw_text_box - draw a multiline text
message with a box around it
-------------------------------------------------*/ | draw a multiline text
message with a box around it | [
"draw",
"a",
"multiline",
"text",
"message",
"with",
"a",
"box",
"around",
"it"
] | void ui_draw_text_box(const char *text, int justify, float xpos, float ypos, rgb_t backcolor)
{
float target_width, target_height;
float target_x, target_y;
ui_draw_text_full(text, 0, 0, 1.0f - 2.0f * UI_BOX_LR_BORDER,
justify, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height);
if (target_height > 1.0f - 2.0f * UI_BOX_TB_BORDER)
target_height = floor((1.0f - 2.0f * UI_BOX_TB_BORDER) / ui_get_line_height()) * ui_get_line_height();
target_x = xpos - 0.5f * target_width;
target_y = ypos - 0.5f * target_height;
if (target_x < UI_BOX_LR_BORDER)
target_x = UI_BOX_LR_BORDER;
if (target_x + target_width + UI_BOX_LR_BORDER > 1.0f)
target_x = 1.0f - UI_BOX_LR_BORDER - target_width;
if (target_y < UI_BOX_TB_BORDER)
target_y = UI_BOX_TB_BORDER;
if (target_y + target_height + UI_BOX_TB_BORDER > 1.0f)
target_y = 1.0f - UI_BOX_TB_BORDER - target_height;
ui_draw_outlined_box(target_x - UI_BOX_LR_BORDER,
target_y - UI_BOX_TB_BORDER,
target_x + target_width + UI_BOX_LR_BORDER,
target_y + target_height + UI_BOX_TB_BORDER, backcolor);
ui_draw_text_full(text, target_x, target_y, target_width,
justify, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
} | [
"void",
"ui_draw_text_box",
"(",
"const",
"char",
"*",
"text",
",",
"int",
"justify",
",",
"float",
"xpos",
",",
"float",
"ypos",
",",
"rgb_t",
"backcolor",
")",
"{",
"float",
"target_width",
",",
"target_height",
";",
"float",
"target_x",
",",
"target_y",
";",
"ui_draw_text_full",
"(",
"text",
",",
"0",
",",
"0",
",",
"1.0f",
"-",
"2.0f",
"*",
"UI_BOX_LR_BORDER",
",",
"justify",
",",
"WRAP_WORD",
",",
"DRAW_NONE",
",",
"ARGB_WHITE",
",",
"ARGB_BLACK",
",",
"&",
"target_width",
",",
"&",
"target_height",
")",
";",
"if",
"(",
"target_height",
">",
"1.0f",
"-",
"2.0f",
"*",
"UI_BOX_TB_BORDER",
")",
"target_height",
"=",
"floor",
"(",
"(",
"1.0f",
"-",
"2.0f",
"*",
"UI_BOX_TB_BORDER",
")",
"/",
"ui_get_line_height",
"(",
")",
")",
"*",
"ui_get_line_height",
"(",
")",
";",
"target_x",
"=",
"xpos",
"-",
"0.5f",
"*",
"target_width",
";",
"target_y",
"=",
"ypos",
"-",
"0.5f",
"*",
"target_height",
";",
"if",
"(",
"target_x",
"<",
"UI_BOX_LR_BORDER",
")",
"target_x",
"=",
"UI_BOX_LR_BORDER",
";",
"if",
"(",
"target_x",
"+",
"target_width",
"+",
"UI_BOX_LR_BORDER",
">",
"1.0f",
")",
"target_x",
"=",
"1.0f",
"-",
"UI_BOX_LR_BORDER",
"-",
"target_width",
";",
"if",
"(",
"target_y",
"<",
"UI_BOX_TB_BORDER",
")",
"target_y",
"=",
"UI_BOX_TB_BORDER",
";",
"if",
"(",
"target_y",
"+",
"target_height",
"+",
"UI_BOX_TB_BORDER",
">",
"1.0f",
")",
"target_y",
"=",
"1.0f",
"-",
"UI_BOX_TB_BORDER",
"-",
"target_height",
";",
"ui_draw_outlined_box",
"(",
"target_x",
"-",
"UI_BOX_LR_BORDER",
",",
"target_y",
"-",
"UI_BOX_TB_BORDER",
",",
"target_x",
"+",
"target_width",
"+",
"UI_BOX_LR_BORDER",
",",
"target_y",
"+",
"target_height",
"+",
"UI_BOX_TB_BORDER",
",",
"backcolor",
")",
";",
"ui_draw_text_full",
"(",
"text",
",",
"target_x",
",",
"target_y",
",",
"target_width",
",",
"justify",
",",
"WRAP_WORD",
",",
"DRAW_NORMAL",
",",
"UI_TEXT_COLOR",
",",
"UI_TEXT_BG_COLOR",
",",
"NULL",
",",
"NULL",
")",
";",
"}"
] | ui_draw_text_box - draw a multiline text
message with a box around it | [
"ui_draw_text_box",
"-",
"draw",
"a",
"multiline",
"text",
"message",
"with",
"a",
"box",
"around",
"it"
] | [
"/* compute the multi-line target width/height */",
"/* determine the target location */",
"/* make sure we stay on-screen */",
"/* add a box around that */"
] | [
{
"param": "text",
"type": "char"
},
{
"param": "justify",
"type": "int"
},
{
"param": "xpos",
"type": "float"
},
{
"param": "ypos",
"type": "float"
},
{
"param": "backcolor",
"type": "rgb_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "text",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "justify",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xpos",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ypos",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "backcolor",
"type": "rgb_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
be9a609005eb490cb070ebef949295c8c030aa58 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/ui.c | [
"Unlicense"
] | C | disclaimer_string | astring | static astring *disclaimer_string(running_machine *machine, astring *string)
{
astring_cpyc(string, "Usage of emulators in conjunction with ROMs you don't own is forbidden by copyright law.\n\n");
astring_catprintf(string, "IF YOU ARE NOT LEGALLY ENTITLED TO PLAY \"%s\" ON THIS EMULATOR, PRESS ESC.\n\n", machine->gamedrv->description);
astring_catc(string, "Otherwise, type OK or move the joystick left then right to continue");
return string;
} | /*-------------------------------------------------
disclaimer_string - print the disclaimer
text to the given buffer
-------------------------------------------------*/ | print the disclaimer
text to the given buffer | [
"print",
"the",
"disclaimer",
"text",
"to",
"the",
"given",
"buffer"
] | static astring *disclaimer_string(running_machine *machine, astring *string)
{
astring_cpyc(string, "Usage of emulators in conjunction with ROMs you don't own is forbidden by copyright law.\n\n");
astring_catprintf(string, "IF YOU ARE NOT LEGALLY ENTITLED TO PLAY \"%s\" ON THIS EMULATOR, PRESS ESC.\n\n", machine->gamedrv->description);
astring_catc(string, "Otherwise, type OK or move the joystick left then right to continue");
return string;
} | [
"static",
"astring",
"*",
"disclaimer_string",
"(",
"running_machine",
"*",
"machine",
",",
"astring",
"*",
"string",
")",
"{",
"astring_cpyc",
"(",
"string",
",",
"\"",
"\\n",
"\\n",
"\"",
")",
";",
"astring_catprintf",
"(",
"string",
",",
"\"",
"\\\"",
"\\\"",
"\\n",
"\\n",
"\"",
",",
"machine",
"->",
"gamedrv",
"->",
"description",
")",
";",
"astring_catc",
"(",
"string",
",",
"\"",
"\"",
")",
";",
"return",
"string",
";",
"}"
] | disclaimer_string - print the disclaimer
text to the given buffer | [
"disclaimer_string",
"-",
"print",
"the",
"disclaimer",
"text",
"to",
"the",
"given",
"buffer"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "string",
"type": "astring"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "string",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits