private void loadToolStripMenuItem_Click(object sender, EventArgs e) { //Mame.exit_pending = true; //if (TrackInfo.CurTrack != null) { //CPS1.StopDelegate(RomInfo.IStop); } if (Machine.bRom) { UI.cpurun(); Mame.mame_pause(true); } //bRunning = false; //pState = PlayState.PLAY_STOPPED; //OnPlaying(pState); //OnRunning(false); foreach (ListViewItem lvi in loadform.listView1.Items) { if (sSelect == lvi.SubItems[2].Text) { loadform.listView1.FocusedItem = lvi; lvi.Selected = true; loadform.listView1.TopItem = lvi; break; } } //StopTimer(); loadform.ShowDialog(); }
public static void LoadRom() { //this.Close(); Mame.exit_pending = true; Thread.Sleep(100); mame.Timer.lt = new List <mame.Timer.emu_timer>(); sSelect = RomInfo.Rom.Name; //Machine.FORM = this; Machine.rom = RomInfo.Rom; Machine.sName = Machine.rom.Name; Machine.sParent = Machine.rom.Parent; Machine.sBoard = Machine.rom.Board; Machine.sDirection = Machine.rom.Direction; Machine.sDescription = Machine.rom.Description; Machine.sManufacturer = Machine.rom.Manufacturer; Machine.bRom = true; Machine.lsParents = new List <String>(); Machine.lsParents.Add("ffight"); int i; switch (Machine.sBoard) { case "CPS-1": case "CPS-1(QSound)": case "CPS2": Video.nMode = 3; CPS.CPSInit(); break; } if (Machine.bRom) { Mame.init_machine(); Generic.nvram_load(); } else { MessageBox.Show("error rom"); } if (Machine.bRom) { Mame.exit_pending = false; t1 = new Thread(Mame.mame_execute); t1.Start(); } }
private void loadToolStripMenuItem_Click(object sender, EventArgs e) { if (Machine.bRom) { UI.cpurun(); Mame.mame_pause(true); } foreach (ListViewItem lvi in loadform.listView1.Items) { if (sSelect == lvi.SubItems[2].Text) { loadform.listView1.FocusedItem = lvi; lvi.Selected = true; loadform.listView1.TopItem = lvi; break; } } loadform.ShowDialog(); }
static void draw_sprites(Mame.osd_bitmap bitmap) { /* sprite information is scattered through memory */ /* and uses a portion of the text layer memory (outside the visible area) */ _BytePtr spriteram_area1 = new _BytePtr(Generic.spriteram, 0x28); _BytePtr spriteram_area2 = new _BytePtr(Generic.spriteram_2, 0x28); _BytePtr spriteram_area3 = new _BytePtr(driver_kyugo.kyugo_videoram, 0x28); for (int n = 0; n < 12 * 2; n++) { int offs = 2 * (n % 12) + 64 * (n / 12); int sx = spriteram_area3[offs + 1] + 256 * (spriteram_area2[offs + 1] & 1); if (sx > 320) sx -= 512; int sy = 255 - spriteram_area1[offs]; if (driver_kyugo.flipscreen != 0) sy = 240 - sy; int color = spriteram_area1[offs + 1] & 0x1f; for (int y = 0; y < 16; y++) { int attr2 = spriteram_area2[offs + 128 * y]; int code = spriteram_area3[offs + 128 * y]; if ((attr2 & 0x01) != 0) code += 512; if ((attr2 & 0x02) != 0) code += 256; bool flipx = (attr2 & 0x08) != 0; bool flipy = (attr2 & 0x04) != 0; if (driver_kyugo.flipscreen != 0) { flipx = !flipx; flipy = !flipy; } Mame.drawgfx(bitmap, Mame.Machine.gfx[1], (uint)code, (uint)color, flipx, flipy, sx, driver_kyugo.flipscreen != 0 ? sy - 16 * y : sy + 16 * y, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } } }
public namcos1_specific(int key_id_query, int key_id, Mame.mem_read_handler key_r, Mame.mem_write_handler key_w, namcos1_slice_timer[] slice_timer, int tilemap_use) { this.key_id_query = key_id_query; this.key_id = key_id; this.key_r = key_r; this.key_w = key_w; this.slice_timer = slice_timer; this.tilemap_use = tilemap_use; }
public override void vh_update(Mame.osd_bitmap bitmap, int full_refresh) { Mame.palette_init_used_colors(); for (int offs = Generic.videoram_size[0] - 1; offs >= 0; offs--) { int code, color; code = Mame.memory_region(Mame.REGION_GFX4)[0x1000 * bg_image + offs]; color = Mame.memory_region(Mame.REGION_GFX4)[0xc000 + 0x100 * bg_image + code]; for (int i = 0; i < 16; i++) Mame.palette_used_colors[i + 256 + 16 * color] = Mame.PALETTE_COLOR_USED; } for (int offs = 0; offs < 256; offs++) { int color; color = citycon_charlookup[offs]; Mame.palette_used_colors[512 + 4 * color] = Mame.PALETTE_COLOR_TRANSPARENT; for (int i = 0; i < 3; i++) Mame.palette_used_colors[i + 512 + 4 * color + 1] = Mame.PALETTE_COLOR_USED; ; } for (int offs = Generic.spriteram_size[0] - 4; offs >= 0; offs -= 4) { int color; color = Generic.spriteram[offs + 2] & 0x0f; for (int i = 0; i < 15; i++) Mame.palette_used_colors[i + 16 * color + 1] = Mame.PALETTE_COLOR_USED; } if (Mame.palette_recalc() != null) { Generic.SetDirtyBuffer(true); dirty_background = 1; } /* Create the background */ if (dirty_background != 0) { dirty_background = 0; for (int offs = Generic.videoram_size[0] - 1; offs >= 0; offs--) { int sx, sy, code; sy = offs / 32; sx = (offs % 32) + (sy & 0x60); sy = sy & 31; if (flipscreen != 0) { sx = 127 - sx; sy = 31 - sy; } code = Mame.memory_region(Mame.REGION_GFX4)[0x1000 * bg_image + offs]; Mame.drawgfx(tmpbitmap2, Mame.Machine.gfx[3 + bg_image], (uint)code, Mame.memory_region(Mame.REGION_GFX4)[0xc000 + 0x100 * bg_image + code], flipscreen != 0, flipscreen != 0, 8 * sx, 8 * sy, null, Mame.TRANSPARENCY_NONE, 0); } } /* copy the temporary bitmap to the screen */ { int scroll; if (flipscreen != 0) scroll = 256 + ((citycon_scroll[0] * 256 + citycon_scroll[1]) >> 1); else scroll = -((citycon_scroll[0] * 256 + citycon_scroll[1]) >> 1); Mame.copyscrollbitmap(bitmap, tmpbitmap2, 1, new int[] { scroll }, 0, null, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); } /* for every character in the Video RAM, check if it has been modified */ /* since last time and update it accordingly. */ for (int offs = Generic.videoram_size[0] - 1; offs >= 0; offs--) { int sx, sy; sy = offs / 32; sx = (offs % 32) + (sy & 0x60); sy = sy & 0x1f; if (Generic.dirtybuffer[offs] || dirtylookup[sy]) { int i; Mame.rectangle clip = new Mame.rectangle(); Generic.dirtybuffer[offs] = false; if (flipscreen != 0) { sx = 127 - sx; sy = 31 - sy; } clip.min_x = 8 * sx; clip.max_x = 8 * sx + 7; /* City Connection controls the color code for each _scanline_, not */ /* for each character as happens in most games. Therefore, we have to draw */ /* the character eight times, each time clipped to one line and using */ /* the color code for that scanline */ for (i = 0; i < 8; i++) { clip.min_y = 8 * sy + i; clip.max_y = 8 * sy + i; Mame.drawgfx(Generic.tmpbitmap, Mame.Machine.gfx[0], Generic.videoram[offs], citycon_charlookup[flipscreen != 0 ? (255 - 8 * sy - i) : 8 * sy + i], flipscreen!=0, flipscreen!=0, 8 * sx, 8 * sy, clip, Mame.TRANSPARENCY_NONE, 0); } } } /* copy the temporary bitmap to the screen */ { int i; int[] scroll = new int[32]; if (flipscreen != 0) { for (i = 0; i < 6; i++) scroll[31 - i] = 256; for (i = 6; i < 32; i++) scroll[31 - i] = 256 + (citycon_scroll[0] * 256 + citycon_scroll[1]); } else { for (i = 0; i < 6; i++) scroll[i] = 0; for (i = 6; i < 32; i++) scroll[i] = -(citycon_scroll[0] * 256 + citycon_scroll[1]); } Mame.copyscrollbitmap(bitmap, Generic.tmpbitmap, 32, scroll, 0, null, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, Mame.palette_transparent_pen); } for (int offs = Generic.spriteram_size[0] - 4; offs >= 0; offs -= 4) { int sx, sy; bool flipx; sx = Generic.spriteram[offs + 3]; sy = 239 - Generic.spriteram[offs]; flipx = (~Generic.spriteram[offs + 2] & 0x10) != 0; if (flipscreen != 0) { sx = 240 - sx; sy = 238 - sy; flipx = !flipx; } Mame.drawgfx(bitmap, Mame.Machine.gfx[(Generic.spriteram[offs + 1] & 0x80) != 0 ? 2 : 1], (uint)(Generic.spriteram[offs + 1] & 0x7f), (uint)(Generic.spriteram[offs + 2] & 0x0f), flipx, flipscreen != 0, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } for (int offs = 0; offs < 32; offs++) dirtylookup[offs] = false; }
public override void vh_update(Mame.osd_bitmap bitmap, int full_refresh) { draw_background(bitmap); draw_sprites(bitmap); }
static void draw_sprites(Mame.osd_bitmap bitmap, int pri_mask) { int offs, fx, fy, x, y, color, sprite; for (offs = 0x1000 - 8; offs >= 0; offs -= 8) { /* Don't draw empty sprite table entries */ if (Generic.buffered_spriteram[offs + 7] != 0xf) continue; if (Generic.buffered_spriteram[offs + 0] == 0x0f) continue; if ((pri_mask & Generic.buffered_spriteram[offs + 5]) == 0) continue; fx = Generic.buffered_spriteram[offs + 1] & 0x20; fy = Generic.buffered_spriteram[offs + 1] & 0x40; y = Generic.buffered_spriteram[offs + 0]; x = Generic.buffered_spriteram[offs + 4]; if ((Generic.buffered_spriteram[offs + 5] & 1) != 0) x = 0 - (0x100 - x); color = Generic.buffered_spriteram[offs + 1] & 0xf; sprite = Generic.buffered_spriteram[offs + 2] + (Generic.buffered_spriteram[offs + 3] << 8); sprite &= 0x0fff; if (flipscreen != 0) { x = 240 - x; y = 240 - y; if (fx != 0) fx = 0; else fx = 1; if (fy != 0) fy = 0; else fy = 1; } Mame.drawgfx(bitmap, Mame.Machine.gfx[3], (uint)sprite, (uint)color, fx != 0, fy != 0, x, y, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 15); } }
public static void tecmo_vh_screenrefresh(Mame.osd_bitmap bitmap, int full_refresh) { int offs; Mame.palette_init_used_colors(); { int color, code, i; int[] colmask = new int[16]; int pal_base; pal_base = Mame.Machine.drv.gfxdecodeinfo[5].color_codes_start; for (color = 0; color < 16; color++) colmask[color] = 0; for (offs = Generic.videoram_size[0] - 1; offs >= 0; offs--) { if (video_type == 2) /* Gemini Wing */ { code = Generic.videoram[offs] + 16 * (Generic.colorram[offs] & 0x70); color = Generic.colorram[offs] & 0x0f; } else { code = Generic.videoram[offs] + 256 * (Generic.colorram[offs] & 0x07); color = Generic.colorram[offs] >> 4; } colmask[color] |= (int)Mame.Machine.gfx[5].pen_usage[code]; } for (color = 0; color < 16; color++) { if ((colmask[color] & (1 << 0)) != 0) Mame.palette_used_colors[pal_base + 16 * color] = Mame.PALETTE_COLOR_TRANSPARENT; for (i = 1; i < 16; i++) { if ((colmask[color] & (1 << i)) != 0) Mame.palette_used_colors[pal_base + 16 * color + i] = Mame.PALETTE_COLOR_USED; } } pal_base = Mame.Machine.drv.gfxdecodeinfo[4].color_codes_start; for (color = 0; color < 16; color++) colmask[color] = 0; for (offs = Generic.videoram_size[0] - 1; offs >= 0; offs--) { if (video_type == 2) /* Gemini Wing */ { code = tecmo_videoram[offs] + 16 * (tecmo_colorram[offs] & 0x70); color = tecmo_colorram[offs] & 0x0f; } else { code = tecmo_videoram[offs] + 256 * (tecmo_colorram[offs] & 0x07); color = tecmo_colorram[offs] >> 4; } colmask[color] |= (int)Mame.Machine.gfx[4].pen_usage[code]; } for (color = 0; color < 16; color++) { if ((colmask[color] & (1 << 0)) != 0) Mame.palette_used_colors[pal_base + 16 * color] = Mame.PALETTE_COLOR_TRANSPARENT; for (i = 1; i < 16; i++) { if ((colmask[color] & (1 << i)) != 0) Mame.palette_used_colors[pal_base + 16 * color + i] = Mame.PALETTE_COLOR_USED; } } pal_base = Mame.Machine.drv.gfxdecodeinfo[1].color_codes_start; for (color = 0; color < 16; color++) colmask[color] = 0; for (offs = 0; offs < Generic.spriteram_size[0]; offs += 8) { int flags = Generic.spriteram[offs + 3]; int bank = Generic.spriteram[offs + 0]; if ((bank & 4) != 0) { /* visible */ int which = Generic.spriteram[offs + 1]; int size = (Generic.spriteram[offs + 2] & 3); /* 0 = 8x8 1 = 16x16 2 = 32x32 3 = 64x64 */ if (size == 3) continue; /* not used by these games */ if (video_type != 0) code = (which) + ((bank & 0xf8) << 5); /* silkworm */ else code = (which) + ((bank & 0xf0) << 4); /* rygar */ if (size == 1) code >>= 2; else if (size == 2) code >>= 4; color = flags & 0xf; colmask[color] |= (int)Mame.Machine.gfx[size + 1].pen_usage[code]; } } for (color = 0; color < 16; color++) { if ((colmask[color] & (1 << 0)) != 0) Mame.palette_used_colors[pal_base + 16 * color] = Mame.PALETTE_COLOR_TRANSPARENT; for (i = 1; i < 16; i++) { if ((colmask[color] & (1 << i)) != 0) Mame.palette_used_colors[pal_base + 16 * color + i] = Mame.PALETTE_COLOR_USED; } } pal_base = Mame.Machine.drv.gfxdecodeinfo[0].color_codes_start; for (color = 0; color < 16; color++) colmask[color] = 0; for (offs = tecmo_videoram2_size[0] - 1; offs >= 0; offs--) { code = tecmo_videoram2[offs] + ((tecmo_colorram2[offs] & 0x03) << 8); color = tecmo_colorram2[offs] >> 4; colmask[color] |= (int)Mame.Machine.gfx[0].pen_usage[code]; } for (color = 0; color < 16; color++) { for (i = 1; i < 16; i++) { if ((colmask[color] & (1 << i)) != 0) Mame.palette_used_colors[pal_base + 16 * color + i] = Mame.PALETTE_COLOR_USED; } } } if (Mame.palette_recalc() != null) { for (int i = 0; i < Generic.videoram_size[0]; i++) { Generic.dirtybuffer[i] = true; dirtybuffer2[i] = 1; } } /* draw the background. */ for (offs = Generic.videoram_size[0] - 1; offs >= 0; offs--) { if (Generic.dirtybuffer[offs]) { int code, color, sx, sy; if (video_type == 2) /* Gemini Wing */ { code = Generic.videoram[offs] + 16 * (Generic.colorram[offs] & 0x70); color = Generic.colorram[offs] & 0x0f; } else { code = Generic.videoram[offs] + 256 * (Generic.colorram[offs] & 0x07); color = Generic.colorram[offs] >> 4; } sx = offs % 32; sy = offs / 32; Mame.drawgfx(tmpbitmap2, Mame.Machine.gfx[5], (uint)code, (uint)color, false, false, 16 * sx, 16 * sy, null, Mame.TRANSPARENCY_NONE, 0); Generic.dirtybuffer[offs] = false; } if (dirtybuffer2[offs] != 0) { int code, color, sx, sy; if (video_type == 2) /* Gemini Wing */ { code = tecmo_videoram[offs] + 16 * (tecmo_colorram[offs] & 0x70); color = tecmo_colorram[offs] & 0x0f; } else { code = tecmo_videoram[offs] + 256 * (tecmo_colorram[offs] & 0x07); color = tecmo_colorram[offs] >> 4; } sx = offs % 32; sy = offs / 32; Mame.drawgfx(tmpbitmap3, Mame.Machine.gfx[4], (uint)code, (uint)color, false, false, 16 * sx, 16 * sy, null, Mame.TRANSPARENCY_NONE, 0); } dirtybuffer2[offs] = 0; } /* copy the temporary bitmap to the screen */ { int scrollx, scrolly; /* draw background tiles */ scrollx = -tecmo_scroll[3] - 256 * (tecmo_scroll[4] & 1) - 48; scrolly = -tecmo_scroll[5]; Mame.copyscrollbitmap(bitmap, tmpbitmap2, 1, new int[] { scrollx }, 1, new int[] { scrolly }, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); /* sprites will be drawn with TRANSPARENCY_THROUGH and appear behind the background */ tecmo_draw_sprites(bitmap, 3); /* this should never draw anything, but just in case... */ tecmo_draw_sprites(bitmap, 2); /* draw foreground tiles */ scrollx = -tecmo_scroll[0] - 256 * (tecmo_scroll[1] & 1) - 48; scrolly = -tecmo_scroll[2]; Mame.copyscrollbitmap(bitmap, tmpbitmap3, 1, new int[] { scrollx }, 1, new int[] { scrolly }, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, Mame.palette_transparent_pen); } tecmo_draw_sprites(bitmap, 1); /* draw the frontmost playfield. They are characters, but draw them as sprites */ for (offs = tecmo_videoram2_size[0] - 1; offs >= 0; offs--) { int sx = offs % 32; int sy = offs / 32; Mame.drawgfx(bitmap, Mame.Machine.gfx[0], (uint)(tecmo_videoram2[offs] + ((tecmo_colorram2[offs] & 0x03) << 8)), (uint)(tecmo_colorram2[offs] >> 4), false, false, 8 * sx, 8 * sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } tecmo_draw_sprites(bitmap, 0); }
public override void vh_update(Mame.osd_bitmap bitmap, int full_refresh) { if (Mame.palette_recalc() != null) { /* if we ran out of palette entries, rebuild the whole screen */ for (int y = 0; y < 256; y++) { for (int x = 0; x < 320; x += 2) { updatepixels(x, y); } } } Mame.copybitmap(bitmap, Generic.tmpbitmap, false, false, 0, 0, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); { int color = Mame.Machine.pens[512]; for (int y = 0; y < 256; y++) { for (int x = 0; x < 320; x += 8) { int d = blockout_frontvideoram.READ_WORD(y * 128 + (x / 4)); if (d != 0) { if ((d & 0x80) != 0) Mame.plot_pixel(bitmap, x, y, color); if ((d & 0x40) != 0) Mame.plot_pixel(bitmap, x + 1, y, color); if ((d & 0x20) != 0) Mame.plot_pixel(bitmap, x + 2, y, color); if ((d & 0x10) != 0) Mame.plot_pixel(bitmap, x + 3, y, color); if ((d & 0x08) != 0) Mame.plot_pixel(bitmap, x + 4, y, color); if ((d & 0x04) != 0) Mame.plot_pixel(bitmap, x + 5, y, color); if ((d & 0x02) != 0) Mame.plot_pixel(bitmap, x + 6, y, color); if ((d & 0x01) != 0) Mame.plot_pixel(bitmap, x + 7, y, color); } } } } }
public override void vh_update(Mame.osd_bitmap bitmap, int full_refresh) { Mame.tilemap_update(Mame.ALL_TILEMAPS); Mame.palette_init_used_colors(); mark_sprites_palette(); /* the following is required to make the colored background work */ for (int i = 15; i < Mame.Machine.drv.total_colors; i += 16) Mame.palette_used_colors[i] = Mame.PALETTE_COLOR_TRANSPARENT; if (Mame.palette_recalc() != null) Mame.tilemap_mark_all_pixels_dirty(Mame.ALL_TILEMAPS); Mame.tilemap_render(Mame.ALL_TILEMAPS); Mame.tilemap_draw(bitmap, driver_mitchell.bg_tilemap, 0); draw_sprites(bitmap); }
static void draw_background(Mame.osd_bitmap bitmap) { Mame.GfxElement gfx = Mame.Machine.gfx[0]; for (int offs = Generic.videoram_size[0] - 2; offs >= 0; offs -= 2) { if (Generic.dirtybuffer[offs] || Generic.dirtybuffer[offs + 1]) { Generic.dirtybuffer[offs] = Generic.dirtybuffer[offs + 1] = false; int sx = (offs / 2) % 32; int sy = (offs / 2) / 32; int attr = Generic.videoram[offs]; int code = Generic.videoram[offs + 1] + ((attr & 0xc0) << 2); bool flipx = (attr & 0x20) != 0; if (flipscreen != 0) { sx = 31 - sx; sy = 31 - sy; flipx = !flipx; } Mame.drawgfx(Generic.tmpbitmap, gfx, (uint)code, (uint)attr & 0x1f, flipx, flipscreen != 0, 8 * sx, 8 * sy, null, Mame.TRANSPARENCY_NONE, 0); } } { int[] xscroll = new int[256]; if (flipscreen != 0) { /* fixed */ for (int offs = 0; offs < 64; offs++) xscroll[255 - offs] = 0; /* scroll (wraps around) */ for (int offs = 64; offs < 128; offs++) xscroll[255 - offs] = troangel_scroll[64]; /* linescroll (no wrap) */ for (int offs = 128; offs < 256; offs++) xscroll[255 - offs] = troangel_scroll[offs]; } else { /* fixed */ for (int offs = 0; offs < 64; offs++) xscroll[offs] = 0; /* scroll (wraps around) */ for (int offs = 64; offs < 128; offs++) xscroll[offs] = -troangel_scroll[64]; /* linescroll (no wrap) */ for (int offs = 128; offs < 256; offs++) xscroll[offs] = -troangel_scroll[offs]; } Mame.copyscrollbitmap(bitmap, Generic.tmpbitmap, 256, xscroll, 0, null, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); } }
public override void vh_update(Mame.osd_bitmap bitmap, int full_refresh) { for (int offs = Generic.videoram_size[0] - 2; offs >= 0; offs -= 2) { int offs2; offs2 = offs / 2; if (Generic.dirtybuffer[offs] || Generic.dirtybuffer[offs + 1]) { int sx, sy, code; Generic.dirtybuffer[offs] = false; Generic.dirtybuffer[offs + 1] = false; sx = offs2 % 32; sy = offs2 / 32; if (flipscreen[0] != 0) sx = 31 - sx; if (flipscreen[1] != 0) sy = 31 - sy; code = Generic.videoram[offs + 1] + ((Generic.videoram[offs] & 0x07) << 8) + 2048 * gfxbank; Mame.drawgfx(Generic.tmpbitmap, Mame.Machine.gfx[0], (uint)code, (uint)(((Generic.videoram[offs] & 0xf8) >> 3) + 32 * palettebank), flipscreen[0] != 0, flipscreen[1] != 0, 8 * sx, 8 * sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); } } /* copy the temporary bitmap to the screen */ Mame.copybitmap(bitmap, Generic.tmpbitmap, false, false, 0, 0, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); /* Draw the sprites. */ for (int offs = 0; offs < Generic.spriteram_size[0]; offs += 4) { int sx, sy, code; sx = Generic.spriteram[offs]; sy = 248 - Generic.spriteram[offs + 1]; if (flipscreen[0] != 0) sx = 248 - sx; if (flipscreen[1] != 0) sy = 248 - sy; code = Generic.spriteram[offs + 3] + ((Generic.spriteram[offs + 2] & 0x03) << 8) + 1024 * gfxbank; Mame.drawgfx(bitmap, Mame.Machine.gfx[0], (uint)(2 * code), (uint)(((Generic.spriteram[offs + 2] & 0xf8) >> 3) + 32 * palettebank), flipscreen[0] != 0, flipscreen[1] != 0, sx, sy + (flipscreen[1] != 0 ? 8 : -8), Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[0], (uint)(2 * code + 1), (uint)(((Generic.spriteram[offs + 2] & 0xf8) >> 3) + 32 * palettebank), flipscreen[0] != 0, flipscreen[1] != 0, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } }
public override void vh_update(Mame.osd_bitmap bitmap, int full_refresh) { invaders_vh_screenrefresh(bitmap, full_refresh != 0); }
public static void vh_screenrefresh(Mame.osd_bitmap bitmap, bool full_refresh) { if (Mame.palette_recalc() != null || redraw_screen != 0 || (full_refresh && use_tmpbitmap == 0)) { int offs; for (offs = 0; offs < Generic.videoram_size[0]; offs++) videoram_w_p(offs, Generic.videoram[offs]); redraw_screen = 0; if (overlay != null) Mame.overlay_remap(overlay); } if (full_refresh && use_tmpbitmap != 0) /* copy the character mapped graphics */ Mame.copybitmap(bitmap, Generic.tmpbitmap, false, false, 0, 0, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); if (overlay != null) Mame.overlay_draw(bitmap, overlay); }
public static void invaders_vh_screenrefresh(Mame.osd_bitmap bitmap, bool full_refresh) { vh_screenrefresh_p(bitmap, full_refresh); }
public override void vh_update(Mame.osd_bitmap bitmap, int full_refresh) { int i, pwidth, pheight; float scale; Mame.osd_bitmap vector_bitmap=new Mame.osd_bitmap(); Mame.rectangle rect=new Mame.rectangle(); if (llander_panel == null) { AvgDvg.dvg_screenrefresh(bitmap,full_refresh); return; } pwidth = llander_panel._artwork.width; pheight = llander_panel._artwork.height; vector_bitmap.width = bitmap.width; vector_bitmap.height = bitmap.height - pheight; vector_bitmap._private = bitmap._private; vector_bitmap.line = bitmap.line; AvgDvg.dvg_screenrefresh(vector_bitmap,full_refresh); if (full_refresh!=0) { rect.min_x = 0; rect.max_x = pwidth-1; rect.min_y = bitmap.height - pheight; rect.max_y = bitmap.height - 1; Mame.copybitmap(bitmap,llander_panel._artwork,false,false,0, bitmap.height - pheight, rect, Mame.TRANSPARENCY_NONE, 0); Mame.osd_mark_dirty (rect.min_x,rect.min_y,rect.max_x,rect.max_y,0); } scale = pwidth/800.0f; for (i=0;i<NUM_LIGHTS;i++) { if (lights_changed[i] || full_refresh!=0) { rect.min_x = (int)(scale * light_areas[i].min_x); rect.max_x = (int)(scale * light_areas[i].max_x); rect.min_y = (int)(bitmap.height - pheight + scale * light_areas[i].min_y); rect.max_y = (int)(bitmap.height - pheight + scale * light_areas[i].max_y); if (lights[i]) Mame.copybitmap(bitmap, llander_lit_panel._artwork, false,false,0, bitmap.height - pheight, rect, Mame.TRANSPARENCY_NONE, 0); else Mame.copybitmap(bitmap, llander_panel._artwork, false,false,0, bitmap.height - pheight, rect, Mame.TRANSPARENCY_NONE, 0); Mame.osd_mark_dirty(rect.min_x, rect.min_y, rect.max_x, rect.max_y, 0); lights_changed[i] = false; } } }
public override void vh_update(Mame.osd_bitmap bitmap, int full_refresh) { _BytePtr sr, ss; int offs, i; _BytePtr RAM = (Mame.memory_region(Mame.REGION_CPU1)); if (Mame.palette_recalc() != null) { Generic.SetDirtyBuffer(true); //memset(dirtybuffer,1,videoram_size); } jackal_scrollram = new _BytePtr(RAM, 0x0020); Generic.colorram = new _BytePtr(RAM, 0x2000); Generic.videoram = new _BytePtr(RAM, 0x2400); Generic.spriteram_size[0] = 0x500; if ((jackal_videoctrl[0x03] & 0x08) != 0) { sr = new _BytePtr(RAM, 0x03800); // Sprite 2 ss = new _BytePtr(RAM, 0x13800); // Additional Sprite 2 } else { sr = new _BytePtr(RAM, 0x03000); // Sprite 1 ss = new _BytePtr(RAM, 0x13000); // Additional Sprite 1 } /* for every character in the Video RAM, check if it has been modified */ /* since last time and update it accordingly. */ for (offs = Generic.videoram_size[0] - 1; offs >= 0; offs--) { if (Generic.dirtybuffer[offs]) { int sx, sy; Generic.dirtybuffer[offs] = false; sx = offs % 32; sy = offs / 32; Mame.drawgfx(Generic.tmpbitmap, Mame.Machine.gfx[0], (uint)(Generic.videoram[offs] + ((Generic.colorram[offs] & 0xc0) << 2) + ((Generic.colorram[offs] & 0x30) << 6)), 0,//colorram[offs] & 0x0f, there must be a PROM like in Contra (Generic.colorram[offs] & 0x10) != 0, (Generic.colorram[offs] & 0x20) != 0, 8 * sx, 8 * sy, null, Mame.TRANSPARENCY_NONE, 0); } } /* copy the temporary bitmap to the screen */ { int h_scroll_num = 0, v_scroll_num = 0; int[] h_scroll = new int[32], v_scroll = new int[32]; if ((jackal_videoctrl[2] & 0x08) != 0) { h_scroll_num = 32; for (i = 0; i < 32; i++) h_scroll[i] = -(jackal_scrollram[i]); } if ((jackal_videoctrl[2] & 0x04) != 0) { v_scroll_num = 32; for (i = 0; i < 32; i++) v_scroll[i] = -(jackal_scrollram[i]); } if (jackal_videoctrl[0] != 0) { v_scroll_num = 1; v_scroll[0] = -(jackal_videoctrl[0]); } if (jackal_videoctrl[1] != 0) { h_scroll_num = 1; h_scroll[0] = -(jackal_videoctrl[1]); } if ((h_scroll_num == 0) && (v_scroll_num == 0)) Mame.copybitmap(bitmap, Generic.tmpbitmap, false, false, 0, 0, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); else Mame.copyscrollbitmap(bitmap, Generic.tmpbitmap, h_scroll_num, h_scroll, v_scroll_num, v_scroll, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); } /* Draw the sprites. */ { byte sr1, sr2, sr3, sr4, sr5; int spritenum, sx, sy, color; byte sn1, sn2, sp; bool flipx, flipy; for (offs = 0; offs < 0x0F5; /* offs += 5 */ ) { sn1 = ss[offs++]; // offs+0 sn2 = ss[offs++]; // offs+1 sy = ss[offs++]; // offs+2 sx = ss[offs++]; // offs+3 sp = ss[offs++]; // offs+4 flipx = (sp & 0x20) != 0; flipy = (sp & 0x40) != 0; color = ((sn2 & 0xf0) >> 4); if ((sp & 0xC) == 0) { spritenum = sn1 + ((sn2 & 0x3) << 8); if (sy > 0xF0) sy = sy - 256; if ((sp & 0x01) != 0) sx = sx - 256; if ((sp & 0x10) != 0) { if ((sx > -16) || (sx < 0xF0)) { Mame.drawgfx(bitmap, Mame.Machine.gfx[2], (uint)spritenum, (uint)color, flipx, flipy, flipx ? sx + 16 : sx, flipy ? sy + 16 : sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[2], (uint)spritenum + 1, (uint)color, flipx, flipy, flipx ? sx : sx + 16, flipy ? sy + 16 : sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[2], (uint)spritenum + 2, (uint)color, flipx, flipy, flipx ? sx + 16 : sx, flipy ? sy : sy + 16, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[2], (uint)spritenum + 3, (uint)color, flipx, flipy, flipx ? sx : sx + 16, flipy ? sy : sy + 16, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } } else { if ((sx > -8) || (sx < 0xF0)) { Mame.drawgfx(bitmap, Mame.Machine.gfx[2], (uint)spritenum, (uint)color, flipx, flipy, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } } } else if ((sx < 0xF0) && (sp & 0x01) == 0) { spritenum = sn1 * 4 + ((sn2 & (8 + 4)) >> 2) + ((sn2 & (2 + 1)) << 10); if ((sp & 0x0C) == 0x0C) { Mame.drawgfx(bitmap, Mame.Machine.gfx[4], (uint)spritenum, (uint)color, flipx, flipy, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } if ((sp & 0x0C) == 0x08) { Mame.drawgfx(bitmap, Mame.Machine.gfx[4], (uint)spritenum, (uint)color, flipx, flipy, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[4], (uint)spritenum - 2, (uint)color, flipx, flipy, sx, sy + 8, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } if ((sp & 0x0C) == 0x04) { Mame.drawgfx(bitmap, Mame.Machine.gfx[4], (uint)spritenum, (uint)color, flipx, flipy, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[4], (uint)spritenum + 1, (uint)color, flipx, flipy, sx + 8, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } } } for (offs = 0; offs < 0x11D; offs += 5) { if ((sr[offs + 2] < 0xF0) && (sr[offs + 4] & 0x01) == 0) { sr1 = sr[offs]; sr2 = sr[offs + 1]; sr3 = sr[offs + 2]; sr4 = sr[offs + 3]; sr5 = sr[offs + 4]; sy = sr3; sx = sr4; flipx = (sr5 & 0x20) != 0; flipy = (sr5 & 0x40) != 0; color = ((sr2 & 0xf0) >> 4); spritenum = sr1 + ((sr2 & 0x3) << 8); if ((sr5 & 0xC) != 0) /* half sized sprite */ { spritenum = sr1 * 4 + ((sr2 & (8 + 4)) >> 2) + ((sr2 & (2 + 1)) << 10); if ((sr5 & 0x0C) == 0x0C) { Mame.drawgfx(bitmap, Mame.Machine.gfx[3], (uint)spritenum, (uint)color, flipx, flipy, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } if ((sr5 & 0x0C) == 0x08) { Mame.drawgfx(bitmap, Mame.Machine.gfx[3], (uint)spritenum, (uint)color, flipx, flipy, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[3], (uint)spritenum - 2, (uint)color, flipx, flipy, sx, sy + 8, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } if ((sr5 & 0x0C) == 0x04) { Mame.drawgfx(bitmap, Mame.Machine.gfx[3], (uint)spritenum, (uint)color, flipx, flipy, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[3], (uint)spritenum + 1, (uint)color, flipx, flipy, sx + 8, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } } else { if ((sr5 & 0x10) != 0) { Mame.drawgfx(bitmap, Mame.Machine.gfx[1], (uint)spritenum, (uint)color, flipx, flipy, flipx ? sx + 16 : sx, flipy ? sy + 16 : sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[1], (uint)spritenum + 1, (uint)color, flipx, flipy, flipx ? sx : sx + 16, flipy ? sy + 16 : sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[1], (uint)spritenum + 2, (uint)color, flipx, flipy, flipx ? sx + 16 : sx, flipy ? sy : sy + 16, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[1], (uint)spritenum + 3, (uint)color, flipx, flipy, flipx ? sx : sx + 16, flipy ? sy : sy + 16, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } else Mame.drawgfx(bitmap, Mame.Machine.gfx[1], (uint)spritenum, (uint)color, flipx, flipy, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } } } for (offs = 0x4F1; offs >= 0x11D; offs -= 5) { if ((sr[offs + 2] < 0xF0) && (sr[offs + 4] & 0x01) == 0) { sr1 = sr[offs]; sr2 = sr[offs + 1]; sr3 = sr[offs + 2]; sr4 = sr[offs + 3]; sr5 = sr[offs + 4]; sy = sr3; sx = sr4; flipx = (sr5 & 0x20) != 0; flipy = (sr5 & 0x40) != 0; color = ((sr2 & 0xf0) >> 4); if ((sr[offs + 4] & 0xC) != 0) /* half sized sprite */ { spritenum = sr1 * 4 + ((sr2 & (8 + 4)) >> 2) + ((sr2 & (2 + 1)) << 10); if ((sr5 & 0x0C) == 0x0C) { Mame.drawgfx(bitmap, Mame.Machine.gfx[3], (uint)spritenum, (uint)color, flipx, flipy, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } if ((sr5 & 0x0C) == 0x08) { Mame.drawgfx(bitmap, Mame.Machine.gfx[3], (uint)spritenum, (uint)color, flipx, flipy, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[3], (uint)spritenum - 2, (uint)color, flipx, flipy, sx, sy + 8, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } if ((sr5 & 0x0C) == 0x04) { Mame.drawgfx(bitmap, Mame.Machine.gfx[3], (uint)spritenum, (uint)color, flipx, flipy, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[3], (uint)spritenum + 1, (uint)color, flipx, flipy, sx + 8, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } } else { spritenum = sr1 + ((sr2 & 0x3) << 8); if ((sr5 & 0x10) != 0) { Mame.drawgfx(bitmap, Mame.Machine.gfx[1], (uint)spritenum, (uint)color, flipx, flipy, flipx ? sx + 16 : sx, flipy ? sy + 16 : sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[1], (uint)(spritenum + 1), (uint)color, flipx, flipy, flipx ? sx : sx + 16, flipy ? sy + 16 : sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[1], (uint)(spritenum + 2), (uint)color, flipx, flipy, flipx ? sx + 16 : sx, flipy ? sy : sy + 16, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[1], (uint)(spritenum + 3), (uint)color, flipx, flipy, flipx ? sx : sx + 16, flipy ? sy : sy + 16, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } else Mame.drawgfx(bitmap, Mame.Machine.gfx[1], (uint)spritenum, (uint)color, flipx, flipy, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } } } } }
static void draw_sprites(Mame.osd_bitmap bitmap) { /* the last entry is not a sprite, we skip it otherwise spang shows a bubble */ /* moving diagonally across the screen */ for (int offs = 0x1000 - 0x40; offs >= 0; offs -= 0x20) { int code = driver_mitchell.pang_objram[offs]; int attr = driver_mitchell.pang_objram[offs + 1]; int color = attr & 0x0f; int sx = driver_mitchell.pang_objram[offs + 3] + ((attr & 0x10) << 4); int sy = ((driver_mitchell.pang_objram[offs + 2] + 8) & 0xff) - 8; code += (attr & 0xe0) << 3; if (driver_mitchell.flipscreen != 0) { sx = 496 - sx; sy = 240 - sy; } Mame.drawgfx(bitmap, Mame.Machine.gfx[1], (uint)code, (uint)color, driver_mitchell.flipscreen != 0, driver_mitchell.flipscreen != 0, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 15); } }
public override void vh_update(Mame.osd_bitmap bitmap, int full_refresh) { retofinv_draw_background(bitmap); retofinv_render_sprites(bitmap); retofinv_draw_foreground(bitmap); }
public override void vh_update(Mame.osd_bitmap bitmap, int full_refresh) { int color, offs, sprite; int[] colmask = new int[16]; int i, pal_base; /* Setup the tilemaps, alternate version has different scroll positions */ if (ALTERNATE == 0) { Mame.tilemap_set_scrollx(background_layer, 0, ((raiden_scroll_ram[1] << 8) + raiden_scroll_ram[0])); Mame.tilemap_set_scrolly(background_layer, 0, ((raiden_scroll_ram[3] << 8) + raiden_scroll_ram[2])); Mame.tilemap_set_scrollx(foreground_layer, 0, ((raiden_scroll_ram[5] << 8) + raiden_scroll_ram[4])); Mame.tilemap_set_scrolly(foreground_layer, 0, ((raiden_scroll_ram[7] << 8) + raiden_scroll_ram[6])); } else { Mame.tilemap_set_scrolly(background_layer, 0, ((raiden_scroll_ram[0x02] & 0x30) << 4) + ((raiden_scroll_ram[0x04] & 0x7f) << 1) + ((raiden_scroll_ram[0x04] & 0x80) >> 7)); Mame.tilemap_set_scrollx(background_layer, 0, ((raiden_scroll_ram[0x12] & 0x30) << 4) + ((raiden_scroll_ram[0x14] & 0x7f) << 1) + ((raiden_scroll_ram[0x14] & 0x80) >> 7)); Mame.tilemap_set_scrolly(foreground_layer, 0, ((raiden_scroll_ram[0x22] & 0x30) << 4) + ((raiden_scroll_ram[0x24] & 0x7f) << 1) + ((raiden_scroll_ram[0x24] & 0x80) >> 7)); Mame.tilemap_set_scrollx(foreground_layer, 0, ((raiden_scroll_ram[0x32] & 0x30) << 4) + ((raiden_scroll_ram[0x34] & 0x7f) << 1) + ((raiden_scroll_ram[0x34] & 0x80) >> 7)); } Mame.tilemap_update(Mame.ALL_TILEMAPS); /* Build the dynamic palette */ Mame.palette_init_used_colors(); /* Sprites */ pal_base = Mame.Machine.drv.gfxdecodeinfo[3].color_codes_start; for (color = 0; color < 16; color++) colmask[color] = 0; for (offs = 0; offs < 0x1000; offs += 8) { color = Generic.buffered_spriteram[offs + 1] & 0xf; sprite = Generic.buffered_spriteram[offs + 2] + (Generic.buffered_spriteram[offs + 3] << 8); sprite &= 0x0fff; colmask[color] |= (int)Mame.Machine.gfx[3].pen_usage[sprite]; } for (color = 0; color < 16; color++) { for (i = 0; i < 15; i++) { if ((colmask[color] & (1 << i)) != 0) Mame.palette_used_colors[pal_base + 16 * color + i] = Mame.PALETTE_COLOR_USED; } } if (Mame.palette_recalc() != null) Mame.tilemap_mark_all_pixels_dirty(Mame.ALL_TILEMAPS); Mame.tilemap_render(Mame.ALL_TILEMAPS); Mame.tilemap_draw(bitmap, background_layer, 0); /* Draw sprites underneath foreground */ draw_sprites(bitmap, 0x40); Mame.tilemap_draw(bitmap, foreground_layer, 0); /* Rest of sprites */ draw_sprites(bitmap, 0x80); /* Text layer */ Mame.tilemap_draw(bitmap, text_layer, 0); }
void retofinv_render_sprites(Mame.osd_bitmap bitmap) { int offs, sx, sy, flipx, flipy, tile, palette, size; int tileofs0, tileofs1, tileofs2, tileofs3; for (offs = 0; offs < 127; offs += 2) { { sx = 311 - (((retofinv_sprite_ram2[offs + 1] & 127) << 1) + ((retofinv_sprite_ram3[offs + 1] & 128) >> 7) + ((retofinv_sprite_ram2[offs + 1] & 128) << 1)); sy = ((retofinv_sprite_ram2[offs] & 127) << 1) + ((retofinv_sprite_ram3[offs] & 128) >> 7) + ((retofinv_sprite_ram2[offs] & 128) << 1); tile = retofinv_sprite_ram1[offs]; size = retofinv_sprite_ram3[offs]; palette = retofinv_sprite_ram1[offs + 1] & 0x3f; flipx = 0; flipy = 0; tileofs0 = 0; tileofs1 = 1; tileofs2 = 2; tileofs3 = 3; if (flipscreen != 0) { tileofs0 = 2; tileofs2 = 0; tileofs1 = 3; tileofs3 = 1; flipx = flipy = 1; } if ((size & 12) == 0) { /* Patch for disappearing invadres' missile, could it be Z80 bug ? */ if (tile == 0x98) tile--; Mame.drawgfx(bitmap, Mame.Machine.gfx[2], (uint)tile, (uint)palette, flipx != 0, flipy != 0, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } if ((size & 4) != 0) { if ((size & 8) != 0 && (flipscreen) != 0) sx -= 16; Mame.drawgfx(bitmap, Mame.Machine.gfx[2], (uint)(tile + tileofs0), (uint)palette, flipx != 0, flipy != 0, sx, sy + 16, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[2], (uint)(tile + tileofs2), (uint)palette, flipx != 0, flipy != 0, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } if ((size & 8) != 0) { if (flipscreen != 0) sx += 32; Mame.drawgfx(bitmap, Mame.Machine.gfx[2], (uint)(tile + tileofs1), (uint)palette, flipx != 0, flipy != 0, sx - 16, sy + 16, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); Mame.drawgfx(bitmap, Mame.Machine.gfx[2], (uint)(tile + tileofs3), (uint)palette, flipx != 0, flipy != 0, sx - 16, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } } } }
static void tecmo_draw_sprites(Mame.osd_bitmap bitmap, int priority) { /* draw all visible sprites of specified priority */ for (int offs = 0; offs < Generic.spriteram_size[0]; offs += 8) { int flags = Generic.spriteram[offs + 3]; if ((flags >> 6) == priority) { int bank = Generic.spriteram[offs + 0]; if ((bank & 4) != 0) { /* visible */ int which = Generic.spriteram[offs + 1]; int code; int size = (Generic.spriteram[offs + 2] & 3); /* 0 = 8x8 1 = 16x16 2 = 32x32 3 = 64x64 */ if (size == 3) continue; /* not used by these games */ if (video_type != 0) code = (which) + ((bank & 0xf8) << 5); /* silkworm */ else code = (which) + ((bank & 0xf0) << 4); /* rygar */ if (size == 1) code >>= 2; else if (size == 2) code >>= 4; Mame.drawgfx(bitmap, Mame.Machine.gfx[size + 1], (uint)code, (uint)flags & 0xf, /* color */ (bank & 1) != 0, /* flipx */ (bank & 2) != 0, /* flipy */ Generic.spriteram[offs + 5] - ((flags & 0x10) << 4), /* sx */ Generic.spriteram[offs + 4] - ((flags & 0x20) << 3), /* sy */ Mame.Machine.drv.visible_area, priority == 3 ? Mame.TRANSPARENCY_THROUGH : Mame.TRANSPARENCY_PEN, priority == 3 ? Mame.palette_transparent_pen : 0); } } } }
public void LoadRom() { mame.Timer.lt = new List <mame.Timer.emu_timer>(); sSelect = RomInfo.Rom.Name; Machine.FORM = this; Machine.rom = RomInfo.Rom; Machine.sName = Machine.rom.Name; Machine.sParent = Machine.rom.Parent; Machine.sBoard = Machine.rom.Board; Machine.sDirection = Machine.rom.Direction; Machine.sDescription = Machine.rom.Description; Machine.sManufacturer = Machine.rom.Manufacturer; Machine.lsParents = RomInfo.GetParents(Machine.sName); int i; switch (Machine.sBoard) { case "CPS-1": case "CPS-1(QSound)": case "CPS2": Video.nMode = 3; itemSize = new ToolStripMenuItem[Video.nMode]; for (i = 0; i < Video.nMode; i++) { itemSize[i] = new ToolStripMenuItem(); itemSize[i].Size = new Size(152, 22); itemSize[i].Click += new EventHandler(itemsizeToolStripMenuItem_Click); } itemSize[0].Text = "512x512"; itemSize[1].Text = "512x256"; itemSize[2].Text = "384x224"; resetToolStripMenuItem.DropDownItems.Clear(); resetToolStripMenuItem.DropDownItems.AddRange(itemSize); itemSelect(); cpsToolStripMenuItem.Enabled = true; neogeoToolStripMenuItem.Enabled = false; namcos1ToolStripMenuItem.Enabled = false; CPS.CPSInit(); CPS.GDIInit(); break; case "Neo Geo": Video.nMode = 1; itemSize = new ToolStripMenuItem[Video.nMode]; for (i = 0; i < Video.nMode; i++) { itemSize[i] = new ToolStripMenuItem(); itemSize[i].Size = new Size(152, 22); itemSize[i].Click += new EventHandler(itemsizeToolStripMenuItem_Click); } itemSize[0].Text = "320x224"; resetToolStripMenuItem.DropDownItems.Clear(); resetToolStripMenuItem.DropDownItems.AddRange(itemSize); Video.iMode = 0; itemSelect(); cpsToolStripMenuItem.Enabled = false; neogeoToolStripMenuItem.Enabled = true; namcos1ToolStripMenuItem.Enabled = false; Neogeo.NeogeoInit(); Neogeo.GDIInit(); break; case "Namco System 1": Video.nMode = 1; itemSize = new ToolStripMenuItem[Video.nMode]; for (i = 0; i < Video.nMode; i++) { itemSize[i] = new ToolStripMenuItem(); itemSize[i].Size = new Size(152, 22); itemSize[i].Click += new EventHandler(itemsizeToolStripMenuItem_Click); } itemSize[0].Text = "288x224"; resetToolStripMenuItem.DropDownItems.Clear(); resetToolStripMenuItem.DropDownItems.AddRange(itemSize); Video.iMode = 0; itemSelect(); cpsToolStripMenuItem.Enabled = false; neogeoToolStripMenuItem.Enabled = false; namcos1ToolStripMenuItem.Enabled = true; Namcos1.Namcos1Init(); Namcos1.GDIInit(); break; case "IGS011": Video.nMode = 1; itemSize = new ToolStripMenuItem[Video.nMode]; for (i = 0; i < Video.nMode; i++) { itemSize[i] = new ToolStripMenuItem(); itemSize[i].Size = new Size(152, 22); itemSize[i].Click += new EventHandler(itemsizeToolStripMenuItem_Click); } itemSize[0].Text = "512x240"; resetToolStripMenuItem.DropDownItems.Clear(); resetToolStripMenuItem.DropDownItems.AddRange(itemSize); Video.iMode = 0; itemSelect(); cpsToolStripMenuItem.Enabled = false; neogeoToolStripMenuItem.Enabled = false; namcos1ToolStripMenuItem.Enabled = false; IGS011.GDIInit(); IGS011.IGS011Init(); break; case "PGM": Video.nMode = 1; itemSize = new ToolStripMenuItem[Video.nMode]; for (i = 0; i < Video.nMode; i++) { itemSize[i] = new ToolStripMenuItem(); itemSize[i].Size = new Size(152, 22); itemSize[i].Click += new EventHandler(itemsizeToolStripMenuItem_Click); } itemSize[0].Text = "448x224"; resetToolStripMenuItem.DropDownItems.Clear(); resetToolStripMenuItem.DropDownItems.AddRange(itemSize); Video.iMode = 0; itemSelect(); cpsToolStripMenuItem.Enabled = false; neogeoToolStripMenuItem.Enabled = false; namcos1ToolStripMenuItem.Enabled = false; PGM.PGMInit(); PGM.GDIInit(); break; } if (Machine.bRom) { Mame.init_machine(); Generic.nvram_load(); } else { MessageBox.Show("error rom"); } }
public override void vh_update(Mame.osd_bitmap bitmap, int full_refresh) { tecmo_vh_screenrefresh(bitmap, full_refresh); }
public override void vh_update(Mame.osd_bitmap bitmap, int full_refresh) { /* for every character in the video RAM, check if it has been modified */ /* since last time and update it accordingly. */ for (int offs = Generic.videoram_size[0] - 1; offs >= 0; offs--) { if (Generic.dirtybuffer[offs]) { int sx, sy, mx, my; Generic.dirtybuffer[offs] = false; /* Even if Phozon screen is 28x36, the memory layout is 32x32. We therefore have to convert the memory coordinates into screen coordinates. Note that 32*32 = 1024, while 28*36 = 1008: therefore 16 bytes of Video RAM don't map to a screen position. We don't check that here, however: range checking is performed by drawgfx(). */ mx = offs % 32; my = offs / 32; if (my <= 1) { /* bottom screen characters */ sx = my + 34; sy = mx - 2; } else if (my >= 30) { /* top screen characters */ sx = my - 30; sy = mx - 2; } else { /* middle screen characters */ sx = mx + 2; sy = my - 2; } Mame.drawgfx(Generic.tmpbitmap, Mame.Machine.gfx[(Generic.colorram[offs] & 0x80) != 0 ? 1 : 0], Generic.videoram[offs], (uint)(Generic.colorram[offs] & 0x3f), false, false, 8 * sx, 8 * sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); } } Mame.copybitmap(bitmap, Generic.tmpbitmap, false, false, 0, 0, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); /* Draw the sprites. */ for (int offs = 0; offs < Generic.spriteram_size[0]; offs += 2) { /* is it on? */ if ((Generic.spriteram_3[offs + 1] & 2) == 0) { uint sprite = Generic.spriteram[offs]; uint color = Generic.spriteram[offs + 1]; int x = (Generic.spriteram_2[offs + 1] - 69) + 0x100 * (Generic.spriteram_3[offs + 1] & 1); int y = (Mame.Machine.drv.screen_height) - Generic.spriteram_2[offs] - 8; int flipx = Generic.spriteram_3[offs] & 1; int flipy = Generic.spriteram_3[offs] & 2; switch (Generic.spriteram_3[offs] & 0x3c) { case 0x00: /* 16x16 */ phozon_draw_sprite(bitmap, sprite, color, flipx, flipy, x, y); break; case 0x14: /* 8x8 */ sprite = (uint)((sprite << 2) | ((Generic.spriteram_3[offs] & 0xc0) >> 6)); phozon_draw_sprite8(bitmap, sprite, color, flipx, flipy, x, y + 8); break; case 0x04: /* 8x16 */ sprite = (uint)((sprite << 2) | ((Generic.spriteram_3[offs] & 0xc0) >> 6)); if (flipy == 0) { phozon_draw_sprite8(bitmap, 2 + sprite, color, flipx, flipy, x, y + 8); phozon_draw_sprite8(bitmap, sprite, color, flipx, flipy, x, y); } else { phozon_draw_sprite8(bitmap, 2 + sprite, color, flipx, flipy, x, y); phozon_draw_sprite8(bitmap, sprite, color, flipx, flipy, x, y + 8); } break; case 0x24: /* 8x32 */ sprite = (uint)((sprite << 2) | ((Generic.spriteram_3[offs] & 0xc0) >> 6)); if (flipy == 0) { phozon_draw_sprite8(bitmap, 10 + sprite, color, flipx, flipy, x, y + 8); phozon_draw_sprite8(bitmap, 8 + sprite, color, flipx, flipy, x, y); phozon_draw_sprite8(bitmap, 2 + sprite, color, flipx, flipy, x, y - 8); phozon_draw_sprite8(bitmap, sprite, color, flipx, flipy, x, y - 16); } else { phozon_draw_sprite8(bitmap, 10 + sprite, color, flipx, flipy, x, y - 16); phozon_draw_sprite8(bitmap, 8 + sprite, color, flipx, flipy, x, y - 8); phozon_draw_sprite8(bitmap, 2 + sprite, color, flipx, flipy, x, y); phozon_draw_sprite8(bitmap, sprite, color, flipx, flipy, x, y + 8); } break; default: phozon_draw_sprite(bitmap, (uint)Mame.rand(), color, flipx, flipy, x, y); break; } } } /* redraw high priority chars */ for (int offs = Generic.videoram_size[0] - 1; offs >= 0; offs--) { if ((Generic.colorram[offs] & 0x40) != 0) { int sx, sy, mx, my; /* Even if Phozon screen is 28x36, the memory layout is 32x32. We therefore have to convert the memory coordinates into screen coordinates. Note that 32*32 = 1024, while 28*36 = 1008: therefore 16 bytes of Video RAM don't map to a screen position. We don't check that here, however: range checking is performed by drawgfx(). */ mx = offs % 32; my = offs / 32; if (my <= 1) { /* bottom screen characters */ sx = my + 34; sy = mx - 2; } else if (my >= 30) { /* top screen characters */ sx = my - 30; sy = mx - 2; } else { /* middle screen characters */ sx = mx + 2; sy = my - 2; } Mame.drawgfx(bitmap, Mame.Machine.gfx[(Generic.colorram[offs] & 0x80) != 0 ? 1 : 0], Generic.videoram[offs], (uint)(Generic.colorram[offs] & 0x3f), false, false, 8 * sx, 8 * sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } } }
void retofinv_draw_background(Mame.osd_bitmap bitmap) { int x, y, offs; int sx, sy, tile, palette; bool bg_dirtybank; /* for every character in the Video RAM, check if it has been modified */ /* since last time and update it accordingly. */ /* if bank differ redraw all */ bg_dirtybank = ((retofinv_bg_char_bank[0] & 1) != bg_bank); /* save active bank */ bg_bank = (uint)(retofinv_bg_char_bank[0] & 1); for (y = 31; y >= 0; y--) { for (x = 31; x >= 0; x--) { offs = y * 32 + x; if (bg_dirtybank || bg_dirtybuffer[offs]) { sx = 31 - x; sy = 31 - y; if (flipscreen != 0) { sx = 31 - sx; sy = 31 - sy; } bg_dirtybuffer[offs] = false; tile = (int)(retofinv_bg_videoram[offs] + 256 * bg_bank); palette = retofinv_bg_colorram[offs] & 0x3f; Mame.drawgfx(bitmap_bg, Mame.Machine.gfx[1], (uint)tile, (uint)palette, flipscreen != 0, flipscreen != 0, 8 * sx + 16, 8 * sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); } } } Mame.copybitmap(bitmap, bitmap_bg, false, false, 0, 0, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); }
static void draw_sprites(Mame.osd_bitmap bitmap) { for (int offs = Generic.spriteram_size[0] - 4; offs >= 0; offs -= 4) { byte attributes = Generic.spriteram[offs + 1]; int sx = Generic.spriteram[offs + 3]; int sy = ((224 - Generic.spriteram[offs + 0] - 32) & 0xff) + 32; int code = Generic.spriteram[offs + 2]; int color = attributes & 0x1f; bool flipy = (attributes & 0x80) != 0; bool flipx = (attributes & 0x40) != 0; int tile_number = code & 0x3f; int bank = 0; if ((code & 0x80) != 0) bank += 1; if ((attributes & 0x20) != 0) bank += 2; if (flipscreen != 0) { sx = 240 - sx; sy = 224 - sy; flipx = !flipx; flipy = !flipy; } Mame.drawgfx(bitmap, Mame.Machine.gfx[1 + bank], (uint)tile_number, (uint)color, flipx, flipy, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } }
void phozon_draw_sprite8(Mame.osd_bitmap dest, uint code, uint color, int flipx, int flipy, int sx, int sy) { Mame.drawgfx(dest, Mame.Machine.gfx[3], code, color, flipx != 0, flipy != 0, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); }
void retofinv_draw_foreground(Mame.osd_bitmap bitmap) { int x, y, offs; int sx, sy, tile, palette, flipx, flipy; for (x = 0; x < 32; x++) { for (y = 30; y <= 31; y++) { offs = y * 32 + x; sx = ((62 - y) + 3) << 3; sy = (31 - x) << 3; flipx = flipy = 0; if (flipscreen != 0) { sx = 280 - sx; sy = 248 - sy; flipx = flipy = 1; } tile = retofinv_fg_videoram[offs] + (retofinv_fg_char_bank[0] * 256); palette = retofinv_fg_colorram[offs]; Mame.drawgfx(bitmap, Mame.Machine.gfx[0], (uint)tile, (uint)palette, flipx != 0, flipy != 0, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); } } for (x = 29; x >= 2; x--) { for (y = 31; y >= 0; y--) { offs = x * 32 + y; sy = ((31 - x) << 3); sx = ((33 - y)) << 3; flipx = flipy = 0; if (flipscreen != 0) { sx = 280 - sx; sy = 248 - sy; flipx = flipy = 1; } tile = retofinv_fg_videoram[offs] + (retofinv_fg_char_bank[0] * 256); palette = retofinv_fg_colorram[offs]; Mame.drawgfx(bitmap, Mame.Machine.gfx[0], (uint)tile, (uint)palette, flipx != 0, flipy != 0, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } } for (x = 0; x < 32; x++) { for (y = 1; y >= 0; y--) { offs = y * 32 + x; sx = (1 - y) << 3; sy = (31 - x) << 3; flipx = flipy = 0; if (flipscreen != 0) { sx = 280 - sx; sy = 248 - sy; flipx = flipy = 1; } tile = retofinv_fg_videoram[offs] + (retofinv_fg_char_bank[0] * 256); palette = retofinv_fg_colorram[offs]; Mame.drawgfx(bitmap, Mame.Machine.gfx[0], (uint)tile, (uint)palette, flipx != 0, flipy != 0, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); } } }
public override void vh_update(Mame.osd_bitmap bitmap, int full_refresh) { /* recalc the palette if necessary */ if (Mame.palette_recalc() != null) Generic.SetDirtyBuffer(true); /* for every character in the backround RAM, check if it has been modified */ /* since last time and update it accordingly. */ for (int offs = 0; offs < Generic.videoram_size[0]; offs += 2) { if (!Generic.dirtybuffer[offs] && !Generic.dirtybuffer[offs + 1]) continue; Generic.dirtybuffer[offs] = Generic.dirtybuffer[offs + 1] = false; int sy = 8 * (offs / 128); int sx = 4 * (offs % 128); if (sx >= 42 * 8) continue; int charcode = Generic.videoram[offs] | ((Generic.videoram[offs + 1] & 0x07) << 8); int color = ((Generic.videoram[offs + 1] & 0xf0) >> 4); Mame.drawgfx(Generic.tmpbitmap, Mame.Machine.gfx[0], (uint)charcode, (uint)color, false,false, sx, sy, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); } Mame.copybitmap(bitmap, Generic.tmpbitmap,false,false, 0, 0, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); }
public override void vh_update(Mame.osd_bitmap bitmap, int full_refresh) { /* for every character in the Video RAM, check if it has been modified */ /* since last time and update it accordingly. */ for (int offs = Generic.videoram_size[0] - 1; offs >= 0; offs--) { if (Generic.dirtybuffer[offs]) { int sx, sy, col; Generic.dirtybuffer[offs] = false; sx = offs % 32; sy = offs / 32; col = frogger_attributesram[2 * sx + 1] & 7; col = ((col >> 1) & 0x03) | ((col << 2) & 0x04); if (flipscreen != 0) { sx = 31 - sx; sy = 31 - sy; Mame.drawgfx(Generic.tmpbitmap, Mame.Machine.gfx[0], Generic.videoram[offs], (uint)(col + (sx >= 16 ? 8 : 0)), /* blue background in the lower 128 lines */ flipscreen != 0, flipscreen != 0, 8 * sx, 8 * sy, null, Mame.TRANSPARENCY_NONE, 0); } else { Mame.drawgfx(Generic.tmpbitmap, Mame.Machine.gfx[0], Generic.videoram[offs], (uint)(col + (sx <= 15 ? 8 : 0)), /* blue background in the upper 128 lines */ flipscreen != 0, flipscreen != 0, 8 * sx, 8 * sy, null, Mame.TRANSPARENCY_NONE, 0); } } } /* copy the temporary bitmap to the screen */ { int[] scroll = new int[32]; int s; for (int i = 0; i < 32; i++) { s = frogger_attributesram[2 * i]; if (flipscreen != 0) { scroll[31 - i] = (((s << 4) & 0xf0) | ((s >> 4) & 0x0f)); } else { scroll[i] = -(((s << 4) & 0xf0) | ((s >> 4) & 0x0f)); } } Mame.copyscrollbitmap(bitmap, Generic.tmpbitmap, 0, null, 32, scroll, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_NONE, 0); } /* Draw the sprites. Note that it is important to draw them exactly in this */ /* order, to have the correct priorities. */ for (int offs = Generic.spriteram_size[0] - 4; offs >= 0; offs -= 4) { if (Generic.spriteram[offs + 3] != 0) { int x, y, col; x = Generic.spriteram[offs + 3]; y = Generic.spriteram[offs]; y = ((y << 4) & 0xf0) | ((y >> 4) & 0x0f); col = Generic.spriteram[offs + 2] & 7; col = ((col >> 1) & 0x03) | ((col << 2) & 0x04); if (flipscreen != 0) { x = 242 - x; y = 240 - y; Mame.drawgfx(bitmap, Mame.Machine.gfx[1], (uint)(Generic.spriteram[offs + 1] & 0x3f), (uint)col, !((Generic.spriteram[offs + 1] & 0x40) != 0), !((Generic.spriteram[offs + 1] & 0x80) != 0), x, 30 * 8 - y, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } else { Mame.drawgfx(bitmap, Mame.Machine.gfx[1], (uint)(Generic.spriteram[offs + 1] & 0x3f), (uint)col, (Generic.spriteram[offs + 1] & 0x40) != 0, (Generic.spriteram[offs + 1] & 0x80) != 0, x, 30 * 8 - y, Mame.Machine.drv.visible_area, Mame.TRANSPARENCY_PEN, 0); } } } }
static _BytePtr get_gfx_pointer(Mame.GfxElement gfxelement, int c, int line) { return new _BytePtr(gfxelement.gfxdata, (c * gfxelement.height + line) * gfxelement.line_modulo); }
public override void vh_update(Mame.osd_bitmap bitmap, int full_refresh) { AvgDvg.dvg_screenrefresh(bitmap, full_refresh); }