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:
parent
38e95d00b5
commit
b8501be38e
|
@ -1026,7 +1026,7 @@ bool CPUWriteGSASnapshot(const char *fileName,
|
||||||
utilPutDword(buffer, totalSize); // length of remainder of save - CRC
|
utilPutDword(buffer, totalSize); // length of remainder of save - CRC
|
||||||
fwrite(buffer, 1, 4, file);
|
fwrite(buffer, 1, 4, file);
|
||||||
|
|
||||||
char temp[0x2001c];
|
char *temp = new char[0x2001c];
|
||||||
memset(temp, 0, 28);
|
memset(temp, 0, 28);
|
||||||
memcpy(temp, &rom[0xa0], 16); // copy internal name
|
memcpy(temp, &rom[0xa0], 16); // copy internal name
|
||||||
temp[0x10] = rom[0xbe]; // reserved area (old checksum)
|
temp[0x10] = rom[0xbe]; // reserved area (old checksum)
|
||||||
|
@ -1046,6 +1046,7 @@ bool CPUWriteGSASnapshot(const char *fileName,
|
||||||
fwrite(buffer, 1, 4, file); // CRC?
|
fwrite(buffer, 1, 4, file); // CRC?
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
delete [] temp;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ extern u8 freezeVRAM[0x18000];
|
||||||
extern u8 freezeOAM[0x400];
|
extern u8 freezeOAM[0x400];
|
||||||
extern u8 freezePRAM[0x400];
|
extern u8 freezePRAM[0x400];
|
||||||
extern bool debugger_last;
|
extern bool debugger_last;
|
||||||
extern int oldreg[17];
|
extern int oldreg[18];
|
||||||
extern char oldbuffer[10];
|
extern char oldbuffer[10];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "GBA.h"
|
#include "GBA.h"
|
||||||
|
|
||||||
#ifdef BKPT_SUPPORT
|
#ifdef BKPT_SUPPORT
|
||||||
int oldreg[17];
|
int oldreg[18];
|
||||||
char oldbuffer[10];
|
char oldbuffer[10];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -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
|
// when either textureWidth or textureHeight is 0, last texture size will be used
|
||||||
void Direct3DDisplay::createTexture( unsigned int textureWidth, unsigned int textureHeight )
|
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
|
// calculate next possible square texture size
|
||||||
textureSize = 1;
|
textureSize = 1;
|
||||||
unsigned int reqSizeMin = ( textureWidth > textureHeight ) ? textureWidth : textureHeight;
|
unsigned int reqSizeMin = ( textureWidth > textureHeight ) ? textureWidth : textureHeight;
|
||||||
|
|
|
@ -1002,7 +1002,7 @@ void GBCheatList::OnNMDblclkCheatList(NMHDR *pNMHDR, LRESULT *pResult)
|
||||||
if( FALSE == m_list.GetItem( &item ) ) return;
|
if( FALSE == m_list.GetItem( &item ) ) return;
|
||||||
|
|
||||||
// modify code
|
// modify code
|
||||||
INT_PTR res;
|
INT_PTR res = IDABORT;
|
||||||
if( gbVerifyGsCode( gbCheatList[ item.lParam ].cheatCode ) ) {
|
if( gbVerifyGsCode( gbCheatList[ item.lParam ].cheatCode ) ) {
|
||||||
CString temp = winResLoadString(IDS_ADD_GS_CODE);
|
CString temp = winResLoadString(IDS_ADD_GS_CODE);
|
||||||
AddGBCode dlg( winGbCheatAddVerifyGs, 8, temp );
|
AddGBCode dlg( winGbCheatAddVerifyGs, 8, temp );
|
||||||
|
|
|
@ -26,6 +26,7 @@ static char THIS_FILE[] = __FILE__;
|
||||||
GBPrinterDlg::GBPrinterDlg(CWnd* pParent /*=NULL*/)
|
GBPrinterDlg::GBPrinterDlg(CWnd* pParent /*=NULL*/)
|
||||||
: CDialog(GBPrinterDlg::IDD, pParent)
|
: CDialog(GBPrinterDlg::IDD, pParent)
|
||||||
{
|
{
|
||||||
|
bitmapData = new u8[160*144];
|
||||||
//{{AFX_DATA_INIT(GBPrinterDlg)
|
//{{AFX_DATA_INIT(GBPrinterDlg)
|
||||||
m_scale = -1;
|
m_scale = -1;
|
||||||
//}}AFX_DATA_INIT
|
//}}AFX_DATA_INIT
|
||||||
|
@ -65,6 +66,12 @@ GBPrinterDlg::GBPrinterDlg(CWnd* pParent /*=NULL*/)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GBPrinterDlg::~GBPrinterDlg()
|
||||||
|
{
|
||||||
|
delete [] bitmapData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GBPrinterDlg::DoDataExchange(CDataExchange* pDX)
|
void GBPrinterDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
{
|
{
|
||||||
CDialog::DoDataExchange(pDX);
|
CDialog::DoDataExchange(pDX);
|
||||||
|
@ -211,7 +218,7 @@ void GBPrinterDlg::saveAsPNG(const char *name)
|
||||||
int sizeX = 160;
|
int sizeX = 160;
|
||||||
int sizeY = 144;
|
int sizeY = 144;
|
||||||
|
|
||||||
u8 *pixU8 = (u8 *)bitmapData;
|
u8 *pixU8 = bitmapData;
|
||||||
for(int y = 0; y < sizeY; y++) {
|
for(int y = 0; y < sizeY; y++) {
|
||||||
for(int x = 0; x < sizeX; x++) {
|
for(int x = 0; x < sizeX; x++) {
|
||||||
u8 c = *pixU8++;
|
u8 c = *pixU8++;
|
||||||
|
|
|
@ -15,7 +15,7 @@ class GBPrinterDlg : public CDialog
|
||||||
private:
|
private:
|
||||||
u8 bitmapHeader[sizeof(BITMAPINFO)+4*sizeof(RGBQUAD)];
|
u8 bitmapHeader[sizeof(BITMAPINFO)+4*sizeof(RGBQUAD)];
|
||||||
BITMAPINFO *bitmap;
|
BITMAPINFO *bitmap;
|
||||||
u8 bitmapData[160*144];
|
u8 *bitmapData;
|
||||||
int scale;
|
int scale;
|
||||||
// Construction
|
// Construction
|
||||||
public:
|
public:
|
||||||
|
@ -23,6 +23,7 @@ class GBPrinterDlg : public CDialog
|
||||||
void saveAsPNG(const char *name);
|
void saveAsPNG(const char *name);
|
||||||
void saveAsBMP(const char *name);
|
void saveAsBMP(const char *name);
|
||||||
GBPrinterDlg(CWnd* pParent = NULL); // standard constructor
|
GBPrinterDlg(CWnd* pParent = NULL); // standard constructor
|
||||||
|
~GBPrinterDlg();
|
||||||
|
|
||||||
// Dialog Data
|
// Dialog Data
|
||||||
//{{AFX_DATA(GBPrinterDlg)
|
//{{AFX_DATA(GBPrinterDlg)
|
||||||
|
|
Loading…
Reference in New Issue