fix some VRAM_I mirroring and change sprite rendering to memory map per-pixel instead of per-scanline, fixing sprites going over the edge of vram. fixes a lens flare at the end of ff3. also do some housekeeping

This commit is contained in:
zeromus 2011-02-03 05:23:01 +00:00
parent dbcf7e675e
commit fd76bc0f6c
4 changed files with 77 additions and 41 deletions

View File

@ -1,4 +1,34 @@
0.9.6 -> 0.9.7 (r3493-r3654-r3812)
0.9.7 -> X (r3812-r3918-r????)
General/Core:
bug: fix more IPC FIFO errors
bug: import more save files correctly
bug: don't autopatch already-patched roms
enh: vfat support for slot-1 devices
enh: emulate temperature register
enh: add paddle emulation
Graphics:
bug: fix occasional crash from uninitialized blending table
bug: fix some 2d alpha blending cases resulting in white screens
bug: fix VRAM_I B_OBJ mirroring and fix sprites rendering across the end of vram
enh: better support for line segment "polys" by detection and special rendering logic
enh: opengl: support quad primitives
enh: opengl: support rear-plane/ClearImage emulation (fixes many graphics)
Windows:
bug: fix a long-standing loadstate crash
bug: fix lag frame accounting
enh: preliminary support for varying stylus pressure
enh: add [Display] Show Console=1 to ini file
enh: more graceful cheat parsing and add some hotkeys
enh: add 5x window size
enh: add big endian and 20.12 toggle to memview and ramwatch
enh: improve FPS throttle feedback and granularity
enh: add lua menu API
enh: hud font switching
0.9.6 -> 0.9.7 (r3493-r3812)
General/Core:
bug: fix a ton of old, broken cpu opcodes and CP15 logic

View File

@ -1,7 +1,7 @@
/* Copyright (C) 2006 yopyop
Copyright (C) 2006-2007 Theo Berkau
Copyright (C) 2007 shash
Copyright (C) 2008-2010 DeSmuME team
Copyright (C) 2008-2011 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -1291,13 +1291,13 @@ template<bool MOSAIC> void lineExtRot(GPU * gpu)
/* if i understand it correct, and it fixes some sprite problems in chameleon shot */
/* we have a 15 bit color, and should use the pal entry bits as alpha ?*/
/* http://nocash.emubase.de/gbatek.htm#dsvideoobjs */
INLINE void render_sprite_BMP (GPU * gpu, u8 spriteNum, u16 l, u8 * dst, u16 * src, u8 * dst_alpha, u8 * typeTab, u8 * prioTab,
u8 prio, int lg, int sprX, int x, int xdir, u8 alpha)
INLINE void render_sprite_BMP (GPU * gpu, u8 spriteNum, u16 l, u8 * dst, u32 srcadr, u8 * dst_alpha, u8 * typeTab, u8 * prioTab, u8 prio, int lg, int sprX, int x, int xdir, u8 alpha)
{
int i; u16 color;
for(i = 0; i < lg; i++, ++sprX, x+=xdir)
{
color = LE_TO_LOCAL_16(src[x]);
u16* src = (u16*)MMU_gpu_map(srcadr+(x<<1));
color = LE_TO_LOCAL_16(*src);
// alpha bit = invisible
if ((color&0x8000)&&(prio<prioTab[sprX]))
@ -1311,8 +1311,7 @@ INLINE void render_sprite_BMP (GPU * gpu, u8 spriteNum, u16 l, u8 * dst, u16 * s
}
}
INLINE void render_sprite_256 ( GPU * gpu, u8 spriteNum, u16 l, u8 * dst, u8 * src, u16 * pal,
u8 * dst_alpha, u8 * typeTab, u8 * prioTab, u8 prio, int lg, int sprX, int x, int xdir, u8 alpha)
INLINE void render_sprite_256(GPU * gpu, u8 spriteNum, u16 l, u8 * dst, u32 srcadr, u16 * pal, u8 * dst_alpha, u8 * typeTab, u8 * prioTab, u8 prio, int lg, int sprX, int x, int xdir, u8 alpha)
{
int i;
u8 palette_entry;
@ -1320,7 +1319,9 @@ INLINE void render_sprite_256 ( GPU * gpu, u8 spriteNum, u16 l, u8 * dst, u8 * s
for(i = 0; i < lg; i++, ++sprX, x+=xdir)
{
palette_entry = src[(x&0x7) + ((x&0xFFF8)<<3)];
u32 adr = srcadr + (x&0x7) + ((x&0xFFF8)<<3);
u8* src = (u8 *)MMU_gpu_map(adr);
palette_entry = *src;
color = LE_TO_LOCAL_16(pal[palette_entry]);
// palette entry = 0 means backdrop
@ -1335,8 +1336,7 @@ INLINE void render_sprite_256 ( GPU * gpu, u8 spriteNum, u16 l, u8 * dst, u8 * s
}
}
INLINE void render_sprite_16 ( GPU * gpu, u16 l, u8 * dst, u8 * src, u16 * pal,
u8 * dst_alpha, u8 * typeTab, u8 * prioTab, u8 prio, int lg, int sprX, int x, int xdir, u8 alpha)
INLINE void render_sprite_16 ( GPU * gpu, u16 l, u8 * dst, u32 srcadr, u16 * pal, u8 * dst_alpha, u8 * typeTab, u8 * prioTab, u8 prio, int lg, int sprX, int x, int xdir, u8 alpha)
{
int i;
u8 palette, palette_entry;
@ -1345,7 +1345,11 @@ INLINE void render_sprite_16 ( GPU * gpu, u16 l, u8 * dst, u8 * src, u16 * pal,
for(i = 0; i < lg; i++, ++sprX, x+=xdir)
{
x1 = x>>1;
palette = src[(x1&0x3) + ((x1&0xFFFC)<<3)];
u32 adr = srcadr + (x1&0x3) + ((x1&0xFFFC)<<3);
u8* src = (u8 *)MMU_gpu_map(adr);//
palette = *src;
if (x & 1) palette_entry = palette >> 4;
else palette_entry = palette & 0xF;
color = LE_TO_LOCAL_16(pal[palette_entry]);
@ -1441,15 +1445,15 @@ FORCEINLINE BOOL compute_sprite_vars(_OAM_ * spriteInfo, u16 l,
//TODO - refactor this so there isnt as much duped code between rotozoomed and non-rotozoomed versions
static u8* bmp_sprite_address(GPU* gpu, _OAM_ * spriteInfo, size sprSize, s32 y)
static u32 bmp_sprite_address(GPU* gpu, _OAM_ * spriteInfo, size sprSize, s32 y)
{
u8* src;
u32 src;
if (spriteInfo->Mode == 3) //sprite is in BMP format
{
if (gpu->dispCnt().OBJ_BMP_mapping)
{
//tested by buffy sacrifice damage blood splatters in corner
src = (u8 *)MMU_gpu_map(gpu->sprMem + (spriteInfo->TileIndex<<gpu->sprBMPBoundary) + (y*sprSize.x*2));
src = gpu->sprMem + (spriteInfo->TileIndex<<gpu->sprBMPBoundary) + (y*sprSize.x*2);
}
else
{
@ -1458,10 +1462,10 @@ static u8* bmp_sprite_address(GPU* gpu, _OAM_ * spriteInfo, size sprSize, s32 y)
if (gpu->dispCnt().OBJ_BMP_2D_dim)
//256*256, verified by heroes of mana FMV intro
src = (u8 *)MMU_gpu_map(gpu->sprMem + (((spriteInfo->TileIndex&0x3E0) * 64 + (spriteInfo->TileIndex&0x1F) *8 + ( y << 8)) << 1));
src = gpu->sprMem + (((spriteInfo->TileIndex&0x3E0) * 64 + (spriteInfo->TileIndex&0x1F) *8 + ( y << 8)) << 1);
else
//128*512, verified by harry potter and the order of the phoenix conversation portraits
src = (u8 *)MMU_gpu_map(gpu->sprMem + (((spriteInfo->TileIndex&0x3F0) * 64 + (spriteInfo->TileIndex&0x0F) *8 + ( y << 7)) << 1));
src = gpu->sprMem + (((spriteInfo->TileIndex&0x3F0) * 64 + (spriteInfo->TileIndex&0x0F) *8 + ( y << 7)) << 1);
}
}
@ -1515,6 +1519,7 @@ void GPU::_spriteRender(u8 * dst, u8 * dst_alpha, u8 * typeTab, u8 * prioTab)
s32 sprX, sprY, x, y, lg;
int xdir;
u8 prio, * src;
u32 srcadr;
u16 j;
// Check if sprite is disabled before everything
@ -1646,7 +1651,7 @@ void GPU::_spriteRender(u8 * dst, u8 * dst_alpha, u8 * typeTab, u8 * prioTab)
// Rotozoomed direct color
else if(spriteInfo->Mode == 3)
{
src = bmp_sprite_address(this,spriteInfo,sprSize,0);
srcadr = bmp_sprite_address(this,spriteInfo,sprSize,0);
for(j = 0; j < lg; ++j, ++sprX)
{
@ -1661,13 +1666,15 @@ void GPU::_spriteRender(u8 * dst, u8 * dst_alpha, u8 * typeTab, u8 * prioTab)
{
if(dispCnt->OBJ_BMP_2D_dim)
//tested by knights in the nightmare
offset = (bmp_sprite_address(this,spriteInfo,sprSize,auxY)-src)/2+auxX;
offset = (bmp_sprite_address(this,spriteInfo,sprSize,auxY)-srcadr)/2+auxX;
else //tested by lego indiana jones (somehow?)
//tested by buffy sacrifice damage blood splatters in corner
offset = auxX + (auxY*sprSize.x);
colour = T1ReadWord (src, offset<<1);
u16* mem = (u16*)MMU_gpu_map(srcadr + (offset<<1));
colour = T1ReadWord(mem,0);
if((colour&0x8000) && (prio<prioTab[sprX]))
{
@ -1774,48 +1781,48 @@ void GPU::_spriteRender(u8 * dst, u8 * dst_alpha, u8 * typeTab, u8 * prioTab)
if (spriteInfo->Mode == 3) //sprite is in BMP format
{
src = bmp_sprite_address(this,spriteInfo,sprSize, y);
srcadr = bmp_sprite_address(this,spriteInfo,sprSize, y);
//transparent (i think, dont bother to render?) if alpha is 0
if(spriteInfo->PaletteIndex == 0)
continue;
render_sprite_BMP (gpu, i, l, dst, (u16*)src, dst_alpha, typeTab, prioTab, prio, lg, sprX, x, xdir, spriteInfo->PaletteIndex);
render_sprite_BMP (gpu, i, l, dst, srcadr, dst_alpha, typeTab, prioTab, prio, lg, sprX, x, xdir, spriteInfo->PaletteIndex);
continue;
}
if(spriteInfo->Depth) /* 256 colors */
if(spriteInfo->Depth) //256 colors
{
if(MODE == SPRITE_2D)
src = (u8 *)MMU_gpu_map(gpu->sprMem + ((spriteInfo->TileIndex)<<5) + ((y>>3)<<10) + ((y&0x7)*8));
srcadr = gpu->sprMem + ((spriteInfo->TileIndex)<<5) + ((y>>3)<<10) + ((y&0x7)*8);
else
src = (u8 *)MMU_gpu_map(gpu->sprMem + (spriteInfo->TileIndex<<block) + ((y>>3)*sprSize.x*8) + ((y&0x7)*8));
srcadr = gpu->sprMem + (spriteInfo->TileIndex<<block) + ((y>>3)*sprSize.x*8) + ((y&0x7)*8);
if (dispCnt->ExOBJPalette_Enable)
pal = (u16*)(MMU.ObjExtPal[gpu->core][0]+(spriteInfo->PaletteIndex*0x200));
else
pal = (u16*)(MMU.ARM9_VMEM + 0x200 + gpu->core *0x400);
render_sprite_256 (gpu, i, l, dst, src, pal,
dst_alpha, typeTab, prioTab, prio, lg, sprX, x, xdir, spriteInfo->Mode == 1);
render_sprite_256(gpu, i, l, dst, srcadr, pal, dst_alpha, typeTab, prioTab, prio, lg, sprX, x, xdir, spriteInfo->Mode == 1);
continue;
}
// 16 colors
if(MODE == SPRITE_2D)
{
src = (u8 *)MMU_gpu_map(gpu->sprMem + ((spriteInfo->TileIndex)<<5) + ((y>>3)<<10) + ((y&0x7)*4));
srcadr = gpu->sprMem + ((spriteInfo->TileIndex)<<5) + ((y>>3)<<10) + ((y&0x7)*4);
}
else
{
src = (u8 *)MMU_gpu_map(gpu->sprMem + (spriteInfo->TileIndex<<block) + ((y>>3)*sprSize.x*4) + ((y&0x7)*4));
srcadr = gpu->sprMem + (spriteInfo->TileIndex<<block) + ((y>>3)*sprSize.x*4) + ((y&0x7)*4);
}
pal = (u16*)(MMU.ARM9_VMEM + 0x200 + gpu->core * 0x400);
pal += (spriteInfo->PaletteIndex<<4);
render_sprite_16 (gpu, l, dst, src, pal, dst_alpha, typeTab, prioTab, prio, lg, sprX, x, xdir, spriteInfo->Mode == 1);
render_sprite_16 (gpu, l, dst, srcadr, pal, dst_alpha, typeTab, prioTab, prio, lg, sprX, x, xdir, spriteInfo->Mode == 1);
}
}

View File

@ -1,6 +1,6 @@
/* Copyright (C) 2006 yopyop
Copyright (C) 2007 shash
Copyright (C) 2007-2010 DeSmuME team
Copyright (C) 2007-2011 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -661,6 +661,7 @@ static inline void MMU_VRAMmapRefreshBank(const int bank)
case 2: //BOBJ
vramConfiguration.banks[bank].purpose = VramConfiguration::BOBJ;
MMU_vram_arm9(bank,VRAM_PAGE_BOBJ);
MMU_vram_arm9(bank,VRAM_PAGE_BOBJ+1); //FF3 end scene (lens flare sprite) needs this as it renders a sprite off the end of the 16KB and back around
break;
case 3: //B OBJ extended palette
vramConfiguration.banks[bank].purpose = VramConfiguration::BOBJEXTPAL;

View File

@ -1,7 +1,7 @@
/* AboutBox.cpp
Copyright (C) 2008-2009 shash
Copyright (C) 2009 DeSmuME team
Copyright (C) 2009-2011 DeSmuME team
This file is part of DeSmuME
@ -15,9 +15,8 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
@ -35,16 +34,13 @@ const char *team[] = {
"------------",
"Guillaume Duhamel",
"Normmatt",
"Bernat Muñoz (shash)",
"Riccardo Magliocchetti",
"Max Tabachenko (CrazyMax)",
"zeromus",
"Luigi__",
"adelikat",
"matusz",
"pa__",
"gocha",
"nitsuja",
"",
"Contributors",
"------------",
@ -62,16 +58,18 @@ const char *team[] = {
"Pascal Giard (evilynux)",
"Ben Jaques (masscat)",
"Jeff Bland",
"Bernat Muñoz (shash)",
"matusz",
"nitsuja",
"dormito",
"WinterMute",
"",
"Honorary Nagmasters",
"(Thanks to our super testers for this release!)",
"(Thanks to our super testers!)",
"------------",
"nash679",
"pokefan999",
"dottorleo",
"",
"average time from bug checkin to bugreport:",
"23 seconds",
};
const int TEAM = ARRAY_SIZE(team);