コード例 #1
0
        private static void cps1_build_palette(int palette_offset)
        {
            int offset, page;
            int pallete_offset1 = palette_offset;
            int ctrl            = cps_b_regs[palette_control / 2];

            for (page = 0; page < 6; ++page)
            {
                if (((ctrl >> page) & 1) != 0)
                {
                    for (offset = 0; offset < 0x200; ++offset)
                    {
                        int palette = gfxram[pallete_offset1 * 2] * 0x100 + gfxram[pallete_offset1 * 2 + 1];
                        pallete_offset1++;
                        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.palette_entry_set_color(0x200 * page + offset, Palette.make_rgb(r, g, b));
                    }
                }
                else
                {
                    if (pallete_offset1 != palette_offset)
                    {
                        pallete_offset1 += 0x200;
                    }
                }
            }
        }
コード例 #2
0
ファイル: Video.cs プロジェクト: beginor/mame.net
 public static void namcos1_paletteram_w(int offset, byte data)
 {
     if (namcos1_paletteram[offset] == data)
     {
         return;
     }
     if ((offset & 0x1800) != 0x1800)
     {
         int r, g, b;
         int color = ((offset & 0x6000) >> 2) | (offset & 0x7ff);
         namcos1_paletteram[offset] = data;
         offset &= ~0x1800;
         r       = namcos1_paletteram[offset];
         g       = namcos1_paletteram[offset + 0x0800];
         b       = namcos1_paletteram[offset + 0x1000];
         Palette.palette_entry_set_color(color, Palette.make_rgb(r, g, b));
     }
     else
     {
         int i, j;
         namcos1_cus116[offset & 0x0f] = data;
         for (i = 0x1800; i < 0x8000; i += 0x2000)
         {
             offset = (offset & 0x0f) | i;
             for (j = 0; j < 0x80; j++, offset += 0x10)
             {
                 namcos1_paletteram[offset] = data;
             }
         }
     }
 }
コード例 #3
0
ファイル: Video.cs プロジェクト: beginor/mame.net
        public static void video_start_namcos1()
        {
            int i;

            namcos1_videoram          = new byte[0x8000];
            namcos1_cus116            = new byte[0x10];
            namcos1_spriteram         = new byte[0x1000];
            namcos1_playfield_control = new byte[0x20];
            Array.Clear(namcos1_videoram, 0, 0x8000);
            Array.Clear(namcos1_paletteram, 0, 0x8000);
            Array.Clear(namcos1_cus116, 0, 0x10);
            Array.Clear(namcos1_playfield_control, 0, 0x20);
            uu1FFF = new ushort[0x200 * 0x200];
            for (i = 0; i < 0x40000; i++)
            {
                uu1FFF[i] = 0x1fff;
            }
            Tmap.ttmap[4].tilemap_set_scrolldx(73, 512 - 73);
            Tmap.ttmap[5].tilemap_set_scrolldx(73, 512 - 73);
            Tmap.ttmap[4].tilemap_set_scrolldy(0x10, 0x110);
            Tmap.ttmap[5].tilemap_set_scrolldy(0x10, 0x110);
            for (i = 0; i < 0x2000; i++)
            {
                Palette.palette_entry_set_color(i, Palette.make_rgb(0, 0, 0));
            }
            copy_sprites = 0;
        }
コード例 #4
0
        public static void video_start_cps()
        {
            int i;

            Tmap.ttmap[0].enable          = true;
            Tmap.ttmap[1].enable          = true;
            Tmap.ttmap[2].enable          = true;
            Tmap.ttmap[0].all_tiles_dirty = true;
            Tmap.ttmap[1].all_tiles_dirty = true;
            Tmap.ttmap[2].all_tiles_dirty = true;
            Array.Clear(Tmap.ttmap[0].pen_to_flags, 0, 0x40);
            Array.Clear(Tmap.ttmap[1].pen_to_flags, 0, 0x40);
            Array.Clear(Tmap.ttmap[2].pen_to_flags, 0, 0x40);
            cps1_update_transmasks();
            for (i = 0; i < 0xc00; i++)
            {
                Palette.palette_entry_set_color(i, Palette.make_rgb(0, 0, 0));
            }
            primasks           = new uint[8];
            cps1_stars_enabled = new int[2];
            cps1_buffered_obj  = new ushort[0x400];
            cps2_buffered_obj  = new ushort[0x1000];
            cps2_objram1       = new ushort[0x1000];
            cps2_objram2       = new ushort[0x1000];

            uuBFF = new ushort[0x200 * 0x200];
            for (i = 0; i < 0x40000; i++)
            {
                uuBFF[i] = 0xbff;
            }
            Array.Clear(cps1_buffered_obj, 0, 0x400);
            Array.Clear(cps2_buffered_obj, 0, 0x1000);

            Array.Clear(gfxram, 0, 0x30000);
            Array.Clear(cps_a_regs, 0, 0x20);
            Array.Clear(cps_b_regs, 0, 0x20);
            Array.Clear(cps2_objram1, 0, 0x1000);
            Array.Clear(cps2_objram2, 0, 0x1000);

            cps_a_regs[CPS1_OBJ_BASE]     = 0x9200;
            cps_a_regs[CPS1_SCROLL1_BASE] = 0x9000;
            cps_a_regs[CPS1_SCROLL2_BASE] = 0x9040;
            cps_a_regs[CPS1_SCROLL3_BASE] = 0x9080;
            cps_a_regs[CPS1_OTHER_BASE]   = 0x9100;
            if (bootleg_kludge == 0)
            {
                scroll1xoff = 0;
                scroll2xoff = 0;
                scroll3xoff = 0;
            }
            else if (bootleg_kludge == 1)
            {
                scroll1xoff = -0x0c;
                scroll2xoff = -0x0e;
                scroll3xoff = -0x10;
            }
            else if (bootleg_kludge == 2)
            {
                scroll1xoff = -0x0c;
                scroll2xoff = -0x10;
                scroll3xoff = -0x10;
            }
            else if (bootleg_kludge == 3)
            {
                scroll1xoff = -0x08;
                scroll2xoff = -0x0b;
                scroll3xoff = -0x0c;
            }
            else if (bootleg_kludge == 0x88)
            {
                scroll1xoff = 0x4;
                scroll2xoff = 0x6;
                scroll3xoff = 0xa;
            }
            cps1_get_video_base();   /* Calculate base pointers */
            cps1_get_video_base();   /* Calculate old base pointers */
        }
コード例 #5
0
 public static void changecolor(int color, int r, int g, int b)
 {
     Palette.palette_entry_set_color(color, Palette.make_rgb(Palette.pal5bit((byte)r), Palette.pal5bit((byte)g), Palette.pal5bit((byte)b)));
 }
コード例 #6
0
 public static void set_color_555(int color, int rshift, int gshift, int bshift, ushort data)
 {
     Palette.palette_entry_set_color2(color, Palette.make_rgb(Palette.pal5bit((byte)(data >> rshift)), Palette.pal5bit((byte)(data >> gshift)), (int)Palette.pal5bit((byte)(data >> bshift))));
 }