Fix for plugin console logging via stdout/stderr, which stopped working when we switched to the shared msvcrt dlls.

mVU: Quick fix to zero out some memory/pointers; fixes assertion failures when running debug mode builds.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1452 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-07-02 19:45:49 +00:00
parent ba5823b144
commit fba2e4519d
2 changed files with 20 additions and 4 deletions

View File

@ -21,9 +21,13 @@
#include "System.h"
#include "DebugTools/Debug.h"
#include <fcntl.h>
#include <io.h>
namespace Console
{
static HANDLE hConsole = NULL;
static int hCrt;
static const int tbl_color_codes[] =
{
@ -50,24 +54,34 @@ namespace Console
SMALL_RECT srect;
if( hConsole ) return;
AllocConsole();
SetConsoleTitle(_("Ps2 Output"));
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
hCrt = _open_osfhandle( (intptr_t)hConsole, _O_TEXT );
FILE* hfp = _fdopen( hCrt, "w" );
*stdout = *hfp;
*stderr = *hfp;
setvbuf( stdout, NULL, _IONBF, 0 );
setvbuf( stderr, NULL, _IONBF, 0 );
csize.X = 100;
csize.Y = 2048;
SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), csize);
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbiInfo);
SetConsoleScreenBufferSize(hConsole, csize);
GetConsoleScreenBufferInfo(hConsole, &csbiInfo);
srect = csbiInfo.srWindow;
srect.Right = srect.Left + 99;
srect.Bottom = srect.Top + 64;
SetConsoleWindowInfo(GetStdHandle(STD_OUTPUT_HANDLE), TRUE, &srect);
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleWindowInfo(hConsole, TRUE, &srect);
}
void Close()
{
if( hConsole == NULL ) return;
_close( hCrt );
FreeConsole();
hConsole = NULL;
}

View File

@ -83,6 +83,8 @@ microVUt(void) mVUreset(mV) {
mVU->prog.max = mMaxProg - 1;
mVU->prog.prog = (microProgram*)_aligned_malloc(sizeof(microProgram)*(mVU->prog.max+1), 64);
memset( mVU->prog.prog, 0, sizeof(microProgram)*(mVU->prog.max+1) );
// Setup Dynarec Cache Limits for Each Program
u8* z = (mVU->cache + 0x1000); // Dispatcher Code is in first page of cache
for (int i = 0; i <= mVU->prog.max; i++) {