예제 #1
0
		unsafe static void DrawNameTable(LibGPGX.VDPNameTable NT, ushort* vram, byte* tiles, int* pal, BmpView bv)
		{
			ushort* nametable = vram + NT.Baseaddr / 2;
			int tilew = NT.Width;
			int tileh = NT.Height;

			Size pixsize = new Size(tilew * 8, tileh * 8);
			bv.Size = pixsize;
			bv.ChangeBitmapSize(pixsize);

			var lockdata = bv.bmp.LockBits(new Rectangle(Point.Empty, pixsize), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
			int pitch = lockdata.Stride / sizeof(int);
			int* dest = (int*)lockdata.Scan0;

			for (int tiley = 0; tiley < tileh; tiley++)
			{
				for (int tilex = 0; tilex < tilew; tilex++)
				{
					ushort bgent = *nametable++;
					int palidx = bgent >> 9 & 0x30;
					int tileent = bgent & 0x1fff; // h and v flip are stored separately in cache
					DrawTile(dest, pitch, tiles + tileent * 64, pal + palidx);
					dest += 8;
				}
				dest -= 8 * tilew;
				dest += 8 * pitch;
			}
			bv.bmp.UnlockBits(lockdata);
			bv.Refresh();
		}
예제 #2
0
        private static unsafe void DrawNameTable(LibGPGX.VDPNameTable nt, ushort *vram, byte *tiles, int *pal, BmpView bv)
        {
            ushort *nametable = vram + nt.Baseaddr / 2;
            int     tileW     = nt.Width;
            int     tileH     = nt.Height;

            Size pixSize = new Size(tileW * 8, tileH * 8);

            bv.Size = pixSize;
            bv.ChangeBitmapSize(pixSize);

            var  lockData = bv.BMP.LockBits(new Rectangle(Point.Empty, pixSize), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
            int  pitch    = lockData.Stride / sizeof(int);
            int *dest     = (int *)lockData.Scan0;

            for (int tileY = 0; tileY < tileH; tileY++)
            {
                for (int tileX = 0; tileX < tileW; tileX++)
                {
                    ushort bgent   = *nametable++;
                    int    palidx  = bgent >> 9 & 0x30;
                    int    tileent = bgent & 0x1fff;                  // h and v flip are stored separately in cache
                    DrawTile(dest, pitch, tiles + tileent * 64, pal + palidx);
                    dest += 8;
                }
                dest -= 8 * tileW;
                dest += 8 * pitch;
            }
            bv.BMP.UnlockBits(lockData);
            bv.Refresh();
        }
예제 #3
0
        unsafe static void DrawNameTable(LibGPGX.VDPNameTable NT, ushort *vram, byte *tiles, int *pal, BmpView bv)
        {
            ushort *nametable = vram + NT.Baseaddr / 2;
            int     tilew     = NT.Width;
            int     tileh     = NT.Height;

            Size pixsize = new Size(tilew * 8, tileh * 8);

            bv.Size = pixsize;
            bv.ChangeBitmapSize(pixsize);

            var  lockdata = bv.bmp.LockBits(new Rectangle(Point.Empty, pixsize), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
            int  pitch    = lockdata.Stride / sizeof(int);
            int *dest     = (int *)lockdata.Scan0;

            for (int tiley = 0; tiley < tileh; tiley++)
            {
                for (int tilex = 0; tilex < tilew; tilex++)
                {
                    ushort bgent   = *nametable++;
                    int    palidx  = bgent >> 9 & 0x30;
                    int    tileent = bgent & 0x1fff;                  // h and v flip are stored separately in cache
                    DrawTile(dest, pitch, tiles + tileent * 64, pal + palidx);
                    dest += 8;
                }
                dest -= 8 * tilew;
                dest += 8 * pitch;
            }
            bv.bmp.UnlockBits(lockdata);
            bv.Refresh();
        }