diff --git a/src/gba/GBA.cpp b/src/gba/GBA.cpp index db56ae11..1ade6998 100644 --- a/src/gba/GBA.cpp +++ b/src/gba/GBA.cpp @@ -1026,7 +1026,7 @@ bool CPUWriteGSASnapshot(const char *fileName, utilPutDword(buffer, totalSize); // length of remainder of save - CRC fwrite(buffer, 1, 4, file); - char temp[0x2001c]; + char *temp = new char[0x2001c]; memset(temp, 0, 28); memcpy(temp, &rom[0xa0], 16); // copy internal name temp[0x10] = rom[0xbe]; // reserved area (old checksum) @@ -1046,6 +1046,7 @@ bool CPUWriteGSASnapshot(const char *fileName, fwrite(buffer, 1, 4, file); // CRC? fclose(file); + delete [] temp; return true; } diff --git a/src/gba/GBA.h b/src/gba/GBA.h index f4da5c63..f66adb6c 100644 --- a/src/gba/GBA.h +++ b/src/gba/GBA.h @@ -73,7 +73,7 @@ extern u8 freezeVRAM[0x18000]; extern u8 freezeOAM[0x400]; extern u8 freezePRAM[0x400]; extern bool debugger_last; -extern int oldreg[17]; +extern int oldreg[18]; extern char oldbuffer[10]; #endif diff --git a/src/gba/Globals.cpp b/src/gba/Globals.cpp index 79f5308c..67bef6b8 100644 --- a/src/gba/Globals.cpp +++ b/src/gba/Globals.cpp @@ -1,7 +1,7 @@ #include "GBA.h" #ifdef BKPT_SUPPORT -int oldreg[17]; +int oldreg[18]; char oldbuffer[10]; #endif diff --git a/src/win32/Direct3D.cpp b/src/win32/Direct3D.cpp index 61df2a08..de692bc2 100644 --- a/src/win32/Direct3D.cpp +++ b/src/win32/Direct3D.cpp @@ -673,7 +673,7 @@ bool Direct3DDisplay::clearTexture( LPDIRECT3DTEXTURE9 texture, size_t textureHe // when either textureWidth or textureHeight is 0, last texture size will be used void Direct3DDisplay::createTexture( unsigned int textureWidth, unsigned int textureHeight ) { - if( ( textureWidth != 0 ) && ( textureWidth != 0 ) ) { + if( ( textureWidth != 0 ) && ( textureHeight != 0 ) ) { // calculate next possible square texture size textureSize = 1; unsigned int reqSizeMin = ( textureWidth > textureHeight ) ? textureWidth : textureHeight; diff --git a/src/win32/GBCheatsDlg.cpp b/src/win32/GBCheatsDlg.cpp index e2e0e9e5..404563b5 100644 --- a/src/win32/GBCheatsDlg.cpp +++ b/src/win32/GBCheatsDlg.cpp @@ -1002,7 +1002,7 @@ void GBCheatList::OnNMDblclkCheatList(NMHDR *pNMHDR, LRESULT *pResult) if( FALSE == m_list.GetItem( &item ) ) return; // modify code - INT_PTR res; + INT_PTR res = IDABORT; if( gbVerifyGsCode( gbCheatList[ item.lParam ].cheatCode ) ) { CString temp = winResLoadString(IDS_ADD_GS_CODE); AddGBCode dlg( winGbCheatAddVerifyGs, 8, temp ); diff --git a/src/win32/GBPrinterDlg.cpp b/src/win32/GBPrinterDlg.cpp index df9a3cf3..f9c91b41 100644 --- a/src/win32/GBPrinterDlg.cpp +++ b/src/win32/GBPrinterDlg.cpp @@ -26,6 +26,7 @@ static char THIS_FILE[] = __FILE__; GBPrinterDlg::GBPrinterDlg(CWnd* pParent /*=NULL*/) : CDialog(GBPrinterDlg::IDD, pParent) { + bitmapData = new u8[160*144]; //{{AFX_DATA_INIT(GBPrinterDlg) m_scale = -1; //}}AFX_DATA_INIT @@ -65,6 +66,12 @@ GBPrinterDlg::GBPrinterDlg(CWnd* pParent /*=NULL*/) } +GBPrinterDlg::~GBPrinterDlg() +{ + delete [] bitmapData; +} + + void GBPrinterDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); @@ -211,7 +218,7 @@ void GBPrinterDlg::saveAsPNG(const char *name) int sizeX = 160; int sizeY = 144; - u8 *pixU8 = (u8 *)bitmapData; + u8 *pixU8 = bitmapData; for(int y = 0; y < sizeY; y++) { for(int x = 0; x < sizeX; x++) { u8 c = *pixU8++; diff --git a/src/win32/GBPrinterDlg.h b/src/win32/GBPrinterDlg.h index 17071551..fd4261a3 100644 --- a/src/win32/GBPrinterDlg.h +++ b/src/win32/GBPrinterDlg.h @@ -15,7 +15,7 @@ class GBPrinterDlg : public CDialog private: u8 bitmapHeader[sizeof(BITMAPINFO)+4*sizeof(RGBQUAD)]; BITMAPINFO *bitmap; - u8 bitmapData[160*144]; + u8 *bitmapData; int scale; // Construction public: @@ -23,6 +23,7 @@ class GBPrinterDlg : public CDialog void saveAsPNG(const char *name); void saveAsBMP(const char *name); GBPrinterDlg(CWnd* pParent = NULL); // standard constructor + ~GBPrinterDlg(); // Dialog Data //{{AFX_DATA(GBPrinterDlg)