Previous 15994 Revisions Next

r9384 Thursday 14th October, 2010 at 20:26:27 UTC by Tafoid
Haze: Fixed use of the sign bits on the SegaCD Roz parameters, improves the SegaCD intro rotations etc. which now appear correct.
[src/mame/drivers]megadriv.c

src/mame/drivers/megadriv.c
r9383r9384
46644664
46654665// non-tilemap functions to get a pixel from a 'tilemap' based on the above, but looking up each pixel, as to avoid the heavy cache bitmap
46664666
4667INLINE UINT8 get_stampmap_16x16_1x1_tile_info_pixel(running_machine* machine, UINT16 xpos, UINT16 ypos)
4667INLINE UINT8 get_stampmap_16x16_1x1_tile_info_pixel(running_machine* machine, int xpos, int ypos)
46684668{
46694669   const int tilesize = 4; // 0xf pixels
46704670   const int tilemapsize = 0x0f;
46714671   
46724672   int wraparound = segacd_stampsize&1;
4673   wraparound = 1;
46744673   
46754674   int xtile = xpos / (1<<tilesize);
46764675   int ytile = ypos / (1<<tilesize);
r9383r9384
47014700   return srcdata[((ypos&((1<<tilesize)-1))*(1<<tilesize))+(xpos&((1<<tilesize)-1))];
47024701}
47034702
4704INLINE UINT8 get_stampmap_32x32_1x1_tile_info_pixel(running_machine* machine, UINT16 xpos, UINT16 ypos)
4703INLINE UINT8 get_stampmap_32x32_1x1_tile_info_pixel(running_machine* machine, int xpos, int ypos)
47054704{
47064705   const int tilesize = 5; // 0x1f pixels
47074706   const int tilemapsize = 0x07;
47084707   
47094708   int wraparound = segacd_stampsize&1;
4710   wraparound = 1;
47114709   
47124710   int xtile = xpos / (1<<tilesize);
47134711   int ytile = ypos / (1<<tilesize);
r9383r9384
47384736   return srcdata[((ypos&((1<<tilesize)-1))*(1<<tilesize))+(xpos&((1<<tilesize)-1))];
47394737}
47404738
4741INLINE UINT8 get_stampmap_16x16_16x16_tile_info_pixel(running_machine* machine, UINT16 xpos, UINT16 ypos)
4739INLINE UINT8 get_stampmap_16x16_16x16_tile_info_pixel(running_machine* machine, int xpos, int ypos)
47424740{
47434741   const int tilesize = 4; // 0xf pixels
47444742   const int tilemapsize = 0xff;
47454743   
47464744   int wraparound = segacd_stampsize&1;
4747   wraparound = 1;
47484745   
47494746   int xtile = xpos / (1<<tilesize);
47504747   int ytile = ypos / (1<<tilesize);
r9383r9384
47754772   return srcdata[((ypos&((1<<tilesize)-1))*(1<<tilesize))+(xpos&((1<<tilesize)-1))];
47764773}
47774774
4778INLINE UINT8 get_stampmap_32x32_16x16_tile_info_pixel(running_machine* machine, UINT16 xpos, UINT16 ypos)
4775INLINE UINT8 get_stampmap_32x32_16x16_tile_info_pixel(running_machine* machine, int xpos, int ypos)
47794776{
47804777   const int tilesize = 5; // 0x1f pixels
47814778   const int tilemapsize = 0x7f;
47824779   
47834780   int wraparound = segacd_stampsize&1;
4784   wraparound = 1;
47854781   
47864782   int xtile = xpos / (1<<tilesize);
47874783   int ytile = ypos / (1<<tilesize);
r9383r9384
52905286// the lower 3 bits of segacd_imagebuffer_hdot_size are set
52915287
52925288// this really needs to be doing it's own lookups rather than depending on the inefficient MAME cache..
5293INLINE UINT8 read_pixel_from_stampmap( running_machine* machine, bitmap_t* srcbitmap, UINT16 x, UINT16 y)
5289INLINE UINT8 read_pixel_from_stampmap( running_machine* machine, bitmap_t* srcbitmap, int x, int y)
52945290{
52955291/*
52965292   if (!srcbitmap)
r9383r9384
53885384   {
53895385      int base = (data & 0xfffe) * 4;
53905386
5391      logerror("actual base = %06x\n", base + 0x80000);
5387      //printf("actual base = %06x\n", base + 0x80000);
53925388
53935389      // nasty nasty nasty
53945390      //segacd_mark_stampmaps_dirty();
r9383r9384
54065402      for (line=0;line<segacd_imagebuffer_vdot_size;line++)
54075403      {
54085404         int currbase = base + line * 0x8;
5409         UINT16 param1,param2,param3,param4;
54105405         
5411         param1 = segacd_dataram[(currbase+0x0)>>1];
5412         param2 = segacd_dataram[(currbase+0x2)>>1];
5413         param3 = segacd_dataram[(currbase+0x4)>>1];
5414         param4 = segacd_dataram[(currbase+0x6)>>1];
5406         // are the 256x256 tile modes using the same sign bits?
5407         INT16 tilemapxoffs,tilemapyoffs;
5408         INT16 deltax,deltay;
5409         
5410         tilemapxoffs = segacd_dataram[(currbase+0x0)>>1];
5411         tilemapyoffs = segacd_dataram[(currbase+0x2)>>1];
5412         deltax = segacd_dataram[(currbase+0x4)>>1]; // x-zoom
5413         deltay = segacd_dataram[(currbase+0x6)>>1]; // rotation
54155414
5415         //printf("%06x:  %04x (%d) %04x (%d) %04x %04x\n", currbase, tilemapxoffs, tilemapxoffs>>3, tilemapyoffs, tilemapyoffs>>3, deltax, deltay);
54165416
5417         //printf("%06x:  %04x (%d) %04x (%d) %04x %04x\n", currbase, param1, param1>>3, param2, param2>>3, param3, param4);
5418
5419         int xbase = param1 << 8;
5420         int ybase = param2 << 8;
5417         int xbase = tilemapxoffs * 256;
5418         int ybase = tilemapyoffs * 256;
54215419         int count;
54225420                 
54235421         for (count=0;count<(segacd_imagebuffer_hdot_size>>3);count++)
r9383r9384
54285426            {   
54295427               pixblock |= read_pixel_from_stampmap(space->machine, srcbitmap, xbase>>(3+8), ybase>>(3+8)) << (i);
54305428               
5431               if (param3&0x8000)
5432                  xbase -= param3&0x7fff;
5433               else
5434                  xbase += param3&0x7fff;
5435                 
5436               if (param4&0x8000)
5437                  ybase -= param4&0x7fff;
5438               else
5439                  ybase += param4&0x7fff;
54405429               
5430               xbase += deltax;
5431               ybase += deltay;
5432               
54415433
54425434            }
54435435           

Previous 15994 Revisions Next


© 1998-2018 The MESS Team