mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Fixed small buffer overruns and other minor bugs that were found by VS2008 code analysis
Added a check on both video plugins to prevent crashing when Memory_GetPtr retuns null pointer at ExecuteDisplayList (invalid address? Dave Mirra BMX 2 crashes there ...) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1179 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -54,23 +54,28 @@ static void ExecuteDisplayList(u32 address, u32 size)
|
||||
u8* old_pVideoData = g_pVideoData;
|
||||
|
||||
u8* startAddress = Memory_GetPtr(address);
|
||||
g_pVideoData = startAddress;
|
||||
|
||||
// temporarily swap dl and non-dl(small "hack" for the stats)
|
||||
Statistics::SwapDL();
|
||||
//Avoid the crash if Memory_GetPtr failed ..
|
||||
if (startAddress!=0)
|
||||
{
|
||||
g_pVideoData = startAddress;
|
||||
|
||||
while((u32)(g_pVideoData - startAddress) < size)
|
||||
{
|
||||
Decode();
|
||||
}
|
||||
INCSTAT(stats.numDListsCalled);
|
||||
INCSTAT(stats.thisFrame.numDListsCalled);
|
||||
// temporarily swap dl and non-dl(small "hack" for the stats)
|
||||
Statistics::SwapDL();
|
||||
|
||||
// un-swap
|
||||
Statistics::SwapDL();
|
||||
while((u32)(g_pVideoData - startAddress) < size)
|
||||
{
|
||||
Decode();
|
||||
}
|
||||
INCSTAT(stats.numDListsCalled);
|
||||
INCSTAT(stats.thisFrame.numDListsCalled);
|
||||
|
||||
// reset to the old pointer
|
||||
g_pVideoData = old_pVideoData;
|
||||
// un-swap
|
||||
Statistics::SwapDL();
|
||||
|
||||
// reset to the old pointer
|
||||
g_pVideoData = old_pVideoData;
|
||||
}
|
||||
}
|
||||
|
||||
bool FifoCommandRunnable()
|
||||
|
@ -200,7 +200,7 @@ void TextureCache::Load(int stage, u32 address, int width, int height, int forma
|
||||
{ // dump texture to file
|
||||
static int counter = 0;
|
||||
char szTemp[MAX_PATH];
|
||||
sprintf(szTemp, "%s\\txt_%04i_%i.png", g_Config.texDumpPath, counter++, format);
|
||||
sprintf(szTemp, "%s\\txt_%04i_%i.png", g_Config.texDumpPath.c_str(), counter++, format);
|
||||
|
||||
D3DXSaveTextureToFile(szTemp,D3DXIFF_BMP,entry.texture,0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user