diff options
author | aliaspider | 2015-11-13 19:55:34 +0100 |
---|---|---|
committer | aliaspider | 2015-11-13 19:55:34 +0100 |
commit | 99a024a26cf9cd3f4fbe4812bd68177f0822fd2e (patch) | |
tree | fd51af8b3e903de6acb24c6f68003ab1c5d36b35 | |
parent | af430c24dc29310d20fc41ba71946fc90990a087 (diff) | |
download | snes9x2002-99a024a26cf9cd3f4fbe4812bd68177f0822fd2e.tar.gz snes9x2002-99a024a26cf9cd3f4fbe4812bd68177f0822fd2e.tar.bz2 snes9x2002-99a024a26cf9cd3f4fbe4812bd68177f0822fd2e.zip |
fix gfx for non ARM targets.
-rw-r--r-- | Makefile.common | 2 | ||||
-rw-r--r-- | src/gfx.c | 11 | ||||
-rw-r--r-- | src/tile.c | 195 |
3 files changed, 9 insertions, 199 deletions
diff --git a/Makefile.common b/Makefile.common index 3098178..e77748a 100644 --- a/Makefile.common +++ b/Makefile.common @@ -82,7 +82,7 @@ endif #DEFINES += -DVAR_CYCLES #DEFINES += -D_C_GW_ #DEFINES += -DUSE_SA1 -# -DFAST_LSB_WORD_ACCESS +#DEFINES += -DFAST_LSB_WORD_ACCESS DEFINES += -ffast-math #DEFINES += -msoft-float DEFINES += -finline -finline-functions -fexpensive-optimizations @@ -160,8 +160,6 @@ void DrawLargePixel(uint32 Tile, int32 Offset, void DrawTile16(uint32 Tile, int32 Offset, uint32 StartLine, uint32 LineCount); -void DrawTile16_OBJ(uint32 Tile, int32 Offset, uint32 StartLine, - uint32 LineCount); void DrawClippedTile16(uint32 Tile, int32 Offset, uint32 StartPixel, uint32 Width, uint32 StartLine, uint32 LineCount); @@ -829,8 +827,6 @@ void DrawOBJS(bool8_32 OnMain, uint8 D) GFX.Z1 = D + 2; - if (DrawTilePtr == DrawTile16) - DrawTilePtr = DrawTile16_OBJ; int I = 0; for (int S = GFX.OBJList [I++]; S >= 0; S = GFX.OBJList [I++]) { @@ -843,11 +839,7 @@ void DrawOBJS(bool8_32 OnMain, uint8 D) continue; if (OnMain && SUB_OR_ADD(4)) - { SelectTileRenderer(!GFX.Pseudo && PPU.OBJ [S].Palette < 4, false); - if (DrawTilePtr == DrawTile16) - DrawTilePtr = DrawTile16_OBJ; - } BaseTile = PPU.OBJ[S].Name | (PPU.OBJ[S].Palette << 10); @@ -2096,9 +2088,6 @@ static inline void DrawBackground(uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2) BG.DirectColourMode = (BGMode == 3 || BGMode == 4) && bg == 0 && (GFX.r2130 & 1); - if (DrawTilePtr == DrawTile16_OBJ) - DrawTilePtr = DrawTile16; - if (PPU.BGMosaic [bg] && PPU.Mosaic > 1) { DrawBackgroundMosaic(BGMode, bg, Z1, Z2); @@ -552,116 +552,11 @@ static INLINE void WRITE_4PIXELS16_FLIPPEDx2x2(int32 Offset, uint8* Pixels) #undef FN } -void DrawTile16_OBJ(uint32 Tile, int32 Offset, uint32 StartLine, uint32 LineCount) -{ - // TILE_PREAMBLE - - uint8* pCache; - uint32 TileAddr = BG.TileAddress + ((Tile & 0x3ff) << 5); - if (Tile & 0x100) - TileAddr += BG.NameSelect; - - TileAddr &= 0xffff; - - uint32 TileNumber; - pCache = &BG.Buffer[(TileNumber = (TileAddr >> 5)) << 6]; - - if (!BG.Buffered [TileNumber]) - BG.Buffered[TileNumber] = ConvertTile(pCache, TileAddr); - - if (BG.Buffered [TileNumber] == BLANK_TILE) - { - TileBlank = Tile & 0xFFFFFFFF; - return; - } - - GFX.ScreenColors = &IPPU.ScreenColors [(((Tile >> 10) & 7) << 4) + 128]; - - register uint8* bp; - register int inc; - - if (Tile & V_FLIP) - { - bp = pCache + 56 - StartLine; - inc = -8; - } - else - { - bp = pCache + StartLine; - inc = 8; - } - - uint16* Screen = (uint16*) GFX.S + Offset; - uint16* Colors = GFX.ScreenColors; - uint8* Depth = GFX.DB + Offset; - int GFX_Z1 = GFX.Z1; - int GFX_Z2 = GFX.Z2; - - if (!(Tile & H_FLIP)) - { -#define FN(N) \ - if (GFX_Z1 > Depth[N] && bp[N]){ \ - Screen[N] = Colors[bp[N]]; \ - Depth[N] = GFX_Z2; \ - } - while (LineCount--) - { - if (*(uint32*)bp) - { - FN(0); - FN(1); - FN(2); - FN(3); - } - - if (*(uint32*)(bp + 4)) - { - FN(4); - FN(5); - FN(6); - FN(7); - } - bp += inc; - Screen += GFX_PPL; - Depth += GFX_PPL; - } -#undef FN - } - else - { -#define FN(N, B) \ - if (GFX_Z1 > Depth[N] && bp[B]){ \ - Screen[N] = Colors[bp[B]]; \ - Depth[N] = GFX_Z2; \ - } - while (LineCount--) - { - if (*(uint32*)(bp + 4)) - { - FN(0, 7); - FN(1, 6); - FN(2, 5); - FN(3, 4); - } - - if (*(uint32*)bp) - { - FN(4, 3); - FN(5, 2); - FN(6, 1); - FN(7, 0); - } - bp += inc; - Screen += GFX_PPL; - Depth += GFX_PPL; - } -#undef FN - } -} - void DrawTile16(uint32 Tile, int32 Offset, uint32 StartLine, uint32 LineCount) { - // TILE_PREAMBLE +#if 1 + TILE_PREAMBLE +#else uint8* pCache; uint32 TileAddr = BG.TileAddress + ((Tile & 0x3ff) << BG.TileShift); @@ -689,86 +584,12 @@ void DrawTile16(uint32 Tile, int32 Offset, uint32 StartLine, uint32 LineCount) else GFX.ScreenColors = &IPPU.ScreenColors [(((Tile >> 10) & BG.PaletteMask) << BG.PaletteShift) + BG.StartPalette]; - register uint8* bp; - register int inc; +// GFX.ScreenColors = &GFX.ScreenColorsPre[(Tile & GFX.PaletteMask) >> GFX.PaletteShift]; - if (Tile & V_FLIP) - { - bp = pCache + 56 - StartLine; - inc = -8; - } - else - { - bp = pCache + StartLine; - inc = 8; - } - - uint16* Screen = (uint16*) GFX.S + Offset; - uint16* Colors = GFX.ScreenColors; - uint8* Depth = GFX.DB + Offset; - int GFX_Z1 = GFX.Z1; - // int GFX_Z2 = GFX.Z2; - - if (!(Tile & H_FLIP)) - { -#define FN(N) \ - if (GFX_Z1 > Depth[N] && bp[N]){ \ - Screen[N] = Colors[bp[N]]; \ - Depth[N] = GFX_Z1; \ - } - while (LineCount--) - { - if (*(uint32*)bp) - { - FN(0); - FN(1); - FN(2); - FN(3); - } - - if (*(uint32*)(bp + 4)) - { - FN(4); - FN(5); - FN(6); - FN(7); - } - bp += inc; - Screen += GFX_PPL; - Depth += GFX_PPL; - } -#undef FN - } - else - { -#define FN(N, B) \ - if (GFX_Z1 > Depth[N] && bp[B]){ \ - Screen[N] = Colors[bp[B]]; \ - Depth[N] = GFX_Z1; \ - } - while (LineCount--) - { - if (*(uint32*)(bp + 4)) - { - FN(0, 7); - FN(1, 6); - FN(2, 5); - FN(3, 4); - } - - if (*(uint32*)bp) - { - FN(4, 3); - FN(5, 2); - FN(6, 1); - FN(7, 0); - } - bp += inc; - Screen += GFX_PPL; - Depth += GFX_PPL; - } -#undef FN - } + register uint32 l; +#endif + register uint8* bp; + RENDER_TILE(WRITE_4PIXELS16, WRITE_4PIXELS16_FLIPPED, 4) } void DrawClippedTile16(uint32 Tile, int32 Offset, |