improve code quality

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@903 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
spacy51 2009-08-30 21:35:16 +00:00
parent 38e95d00b5
commit b8501be38e
7 changed files with 16 additions and 7 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -1,7 +1,7 @@
#include "GBA.h"
#ifdef BKPT_SUPPORT
int oldreg[17];
int oldreg[18];
char oldbuffer[10];
#endif

View File

@ -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;

View File

@ -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 );

View File

@ -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++;

View File

@ -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)