public static Bitmap GetSprite() { int i, x, x2, y, rows, zoom_x, zoom_y, scanline, attr_and_code_offs, code, gfx_offset; int sprite_y, tile, zoom_x_table_offset, line_pens_offset, sprite_line, zoom_line, x_inc; ushort y_control, zoom_control, attr, x_2, code_2; byte sprite_y_and_tile; bool invert; Machine.FORM.neogeoform.tbResult.Clear(); Bitmap bm1; bm1 = new Bitmap(384, 264); BitmapData bmData; bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); unsafe { byte *ptr = (byte *)(bmData.Scan0); byte *ptr2 = (byte *)0; y = 0; x = 0; rows = 0; zoom_y = 0; zoom_x = 0; foreach (int sprite_number in lSprite) { y_control = Neogeo.neogeo_videoram[0x8200 | sprite_number]; zoom_control = Neogeo.neogeo_videoram[0x8000 | sprite_number]; x_2 = Neogeo.neogeo_videoram[0x8400 | sprite_number]; code_2 = Neogeo.neogeo_videoram[sprite_number << 6]; if (sprite_number == 0x03 || sprite_number == 0xfa || sprite_number == 0x113 || sprite_number == 0x117 || sprite_number == 0x12b) { int i1 = 1; } if ((y_control & 0x40) != 0) { x = (x + zoom_x + 1) & 0x01ff; zoom_x = (zoom_control >> 8) & 0x0f; } else { y = 0x200 - (y_control >> 7); x = Neogeo.neogeo_videoram[0x8400 | sprite_number] >> 7; zoom_y = zoom_control & 0xff; zoom_x = (zoom_control >> 8) & 0x0f; rows = y_control & 0x3f; } Machine.FORM.neogeoform.tbResult.AppendText(sprite_number.ToString("X3") + " " + x_2.ToString("X4") + " " + y_control.ToString("X4") + " " + code_2.ToString("X4") + " " + zoom_control.ToString("X4") + "\r\n"); if (((x >= 0x140) && (x <= 0x1f0)) || rows == 0) { continue; } if (x == 0) { int i1 = 1; } for (scanline = 0; scanline < 264; scanline++) { if (Neogeo.sprite_on_scanline(scanline, y, rows)) { sprite_line = (scanline - y) & 0x1ff; zoom_line = sprite_line & 0xff; invert = ((sprite_line & 0x100) != 0) ? true : false; if (invert) { zoom_line ^= 0xff; } if (rows > 0x20) { zoom_line = zoom_line % ((zoom_y + 1) << 1); if (zoom_line > zoom_y) { zoom_line = ((zoom_y + 1) << 1) - 1 - zoom_line; invert = !invert; } } sprite_y_and_tile = Neogeo.zoomyrom[(zoom_y << 8) | zoom_line]; sprite_y = sprite_y_and_tile & 0x0f; tile = sprite_y_and_tile >> 4; if (invert) { sprite_y ^= 0x0f; tile ^= 0x1f; } attr_and_code_offs = (sprite_number << 6) | (tile << 1); attr = Neogeo.neogeo_videoram[attr_and_code_offs + 1]; code = ((attr << 12) & 0x70000) | Neogeo.neogeo_videoram[attr_and_code_offs]; if (Neogeo.auto_animation_disabled == 0) { if ((attr & 0x0008) != 0) { code = (code & ~0x07) | (Neogeo.auto_animation_counter & 0x07); } else if ((attr & 0x0004) != 0) { code = (code & ~0x03) | (Neogeo.auto_animation_counter & 0x03); } } if ((attr & 0x0002) != 0) { sprite_y ^= 0x0f; } zoom_x_table_offset = 0; gfx_offset = (int)(((code << 8) | (sprite_y << 4)) & Neogeo.sprite_gfx_address_mask); line_pens_offset = attr >> 8 << 4; if ((attr & 0x0001) != 0) { gfx_offset = gfx_offset + 0x0f; x_inc = -1; } else { x_inc = 1; } if (x <= 0x01f0) { x2 = x + 30; for (i = 0; i < 0x10; i++) { if (Neogeo.zoom_x_tables[zoom_x, zoom_x_table_offset] != 0) { if (Neogeo.sprite_gfx[gfx_offset] != 0) { ptr2 = ptr + (scanline * 384 + x2) * 4; *ptr2 = (byte)(Neogeo.pens[line_pens_offset + Neogeo.sprite_gfx[gfx_offset]] & 0xff); *(ptr2 + 1) = (byte)((Neogeo.pens[line_pens_offset + Neogeo.sprite_gfx[gfx_offset]] & 0xff00) >> 8); *(ptr2 + 2) = (byte)((Neogeo.pens[line_pens_offset + Neogeo.sprite_gfx[gfx_offset]] & 0xff0000) >> 16); *(ptr2 + 3) = 0xff; } x2++; } zoom_x_table_offset++; gfx_offset += x_inc; } } else { int i1 = 1; } } } } } bm1.UnlockBits(bmData); return(bm1); }