From c87c49c17d1bac767e9789d9f293fca86ff1176f Mon Sep 17 00:00:00 2001 From: zeromus Date: Mon, 14 Nov 2011 08:12:36 +0000 Subject: [PATCH] someone decides to check for null before deleting. someone else thinks its an error to do that. removing them to make ticket #3413784 go away. --- desmume/src/GPU.cpp | 34 ++++++++----------- desmume/src/windows/cheatsWin.cpp | 2 +- desmume/src/windows/disView.cpp | 52 +++++++++++++----------------- desmume/src/windows/lightView.cpp | 8 ++--- desmume/src/windows/mapView.cpp | 36 +++++++++------------ desmume/src/windows/matrixView.cpp | 34 +++++++++---------- desmume/src/windows/memView.cpp | 39 +++++++++++----------- desmume/src/windows/oamView.cpp | 37 +++++++++------------ desmume/src/windows/palView.cpp | 37 +++++++++------------ desmume/src/windows/tileView.cpp | 38 +++++++++------------- 10 files changed, 134 insertions(+), 183 deletions(-) diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp index c0adb2eac..3bcc0a831 100644 --- a/desmume/src/GPU.cpp +++ b/desmume/src/GPU.cpp @@ -1449,29 +1449,23 @@ FORCEINLINE BOOL compute_sprite_vars(_OAM_ * spriteInfo, u16 l, static u32 bmp_sprite_address(GPU* gpu, _OAM_ * spriteInfo, size sprSize, s32 y) { - u32 src; - if (spriteInfo->Mode == 3) //sprite is in BMP format + if (gpu->dispCnt().OBJ_BMP_mapping) { - if (gpu->dispCnt().OBJ_BMP_mapping) - { - //tested by buffy sacrifice damage blood splatters in corner - src = gpu->sprMem + (spriteInfo->TileIndex<sprBMPBoundary) + (y*sprSize.x*2); - } - else - { - //2d mapping: - //verified in rotozoomed mode by knights in the nightmare intro - - if (gpu->dispCnt().OBJ_BMP_2D_dim) - //256*256, verified by heroes of mana FMV intro - src = gpu->sprMem + (((spriteInfo->TileIndex&0x3E0) * 64 + (spriteInfo->TileIndex&0x1F) *8 + ( y << 8)) << 1); - else - //128*512, verified by harry potter and the order of the phoenix conversation portraits - src = gpu->sprMem + (((spriteInfo->TileIndex&0x3F0) * 64 + (spriteInfo->TileIndex&0x0F) *8 + ( y << 7)) << 1); - } + //tested by buffy sacrifice damage blood splatters in corner + return gpu->sprMem + (spriteInfo->TileIndex<sprBMPBoundary) + (y*sprSize.x*2); } + else + { + //2d mapping: + //verified in rotozoomed mode by knights in the nightmare intro - return src; + if (gpu->dispCnt().OBJ_BMP_2D_dim) + //256*256, verified by heroes of mana FMV intro + return gpu->sprMem + (((spriteInfo->TileIndex&0x3E0) * 64 + (spriteInfo->TileIndex&0x1F) *8 + ( y << 8)) << 1); + else + //128*512, verified by harry potter and the order of the phoenix conversation portraits + return gpu->sprMem + (((spriteInfo->TileIndex&0x3F0) * 64 + (spriteInfo->TileIndex&0x0F) *8 + ( y << 7)) << 1); + } } diff --git a/desmume/src/windows/cheatsWin.cpp b/desmume/src/windows/cheatsWin.cpp index 6a172f5bf..4c071027e 100644 --- a/desmume/src/windows/cheatsWin.cpp +++ b/desmume/src/windows/cheatsWin.cpp @@ -92,7 +92,7 @@ void generateAR(HWND dialog, u32 addr, u32 val, u8 size) { // Action Replay code generate if (size > 3) size = 3; - char buf[17] = {0}; + char buf[64] = {0}; sprintf(buf, "%X%07X %08X", 3-size, addr | 0x02000000, val); SetWindowText(GetDlgItem(dialog, IDC_AR_CODE), buf); } diff --git a/desmume/src/windows/disView.cpp b/desmume/src/windows/disView.cpp index 3b7bf1fef..15ae8835a 100644 --- a/desmume/src/windows/disView.cpp +++ b/desmume/src/windows/disView.cpp @@ -1,21 +1,19 @@ -/* Copyright (C) 2006 yopyop - Copyright (C) 2006-2010 DeSmuME team +/* + Copyright (C) 2006 yopyop + Copyright (C) 2006-2011 DeSmuME team - This file is part of DeSmuME + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. - DeSmuME is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - DeSmuME is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DeSmuME; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + You should have received a copy of the GNU General Public License + along with the this software. If not, see . */ #include @@ -290,8 +288,8 @@ BOOL CALLBACK ViewDisasm_ARM7Proc (HWND hwnd, UINT message, WPARAM wParam, LPARA return false; switch (message) - { - case WM_INITDIALOG : + { + case WM_INITDIALOG : { SetWindowText(hwnd, "ARM7 Disassembler"); SetDlgItemInt(hwnd, IDC_SETPNUM, 1, FALSE); @@ -307,7 +305,7 @@ BOOL CALLBACK ViewDisasm_ARM7Proc (HWND hwnd, UINT message, WPARAM wParam, LPARA DisViewWnd[1] = NULL; return 1; } - case WM_CLOSE : + case WM_CLOSE : { EndDialog(hwnd,0); if(DisView7->autoup) @@ -315,16 +313,13 @@ BOOL CALLBACK ViewDisasm_ARM7Proc (HWND hwnd, UINT message, WPARAM wParam, LPARA KillTimer(hwnd, IDT_VIEW_DISASM7); DisView7->autoup = false; } - if (DisView7!=NULL) - { - delete DisView7; - DisView7 = NULL; - } + delete DisView7; + DisView7 = NULL; DisViewWnd[1] = NULL; //INFO("Close ARM7 disassembler\n"); return 1; } - case WM_PAINT: + case WM_PAINT: DisViewDialog_OnPaint(hwnd, DisView7, wParam, lParam); return 1; case WM_TIMER: @@ -555,7 +550,7 @@ BOOL CALLBACK ViewDisasm_ARM9Proc (HWND hwnd, UINT message, WPARAM wParam, LPARA DisViewWnd[0] = NULL; return 1; } - case WM_CLOSE : + case WM_CLOSE : { EndDialog(hwnd,0); if(DisView9->autoup) @@ -563,11 +558,8 @@ BOOL CALLBACK ViewDisasm_ARM9Proc (HWND hwnd, UINT message, WPARAM wParam, LPARA KillTimer(hwnd, IDT_VIEW_DISASM9); DisView9->autoup = false; } - if (DisView9!=NULL) - { - delete DisView9; - DisView9 = NULL; - } + delete DisView9; + DisView9 = NULL; DisViewWnd[0] = NULL; //INFO("Close ARM9 disassembler\n"); return 1; diff --git a/desmume/src/windows/lightView.cpp b/desmume/src/windows/lightView.cpp index 0f04ec817..4e859fa31 100644 --- a/desmume/src/windows/lightView.cpp +++ b/desmume/src/windows/lightView.cpp @@ -121,12 +121,8 @@ BOOL CALLBACK ViewLightsProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa KillTimer(hwnd, IDT_VIEW_LIGHTS); LightsView->autoup = false; } - - if (LightsView!=NULL) - { - delete LightsView; - LightsView = NULL; - } + delete LightsView; + LightsView = NULL; //INFO("Close lights viewer dialog\n"); PostQuitMessage(0); break; diff --git a/desmume/src/windows/mapView.cpp b/desmume/src/windows/mapView.cpp index ad791a289..0f09b98f2 100644 --- a/desmume/src/windows/mapView.cpp +++ b/desmume/src/windows/mapView.cpp @@ -1,22 +1,19 @@ -/* Copyright (C) 2006 yopyop -yopyop156@ifrance.com -yopyop156.ifrance.com +/* + Copyright (C) 2006 yopyop + Copyright (C) 2006-2011 DeSmuME team -This file is part of DeSmuME + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. -DeSmuME is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -DeSmuME is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with DeSmuME; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + You should have received a copy of the GNU General Public License + along with the this software. If not, see . */ #include "mapView.h" @@ -232,11 +229,8 @@ BOOL CALLBACK ViewMapsProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPara KillTimer(hwnd, IDT_VIEW_MAP); MapView->autoup = false; } - if (MapView!=NULL) - { - delete MapView; - MapView = NULL; - } + delete MapView; + MapView = NULL; //INFO("Close Map view dialog\n"); PostQuitMessage(0); return 0; diff --git a/desmume/src/windows/matrixView.cpp b/desmume/src/windows/matrixView.cpp index b8c442d80..ceeb2076d 100644 --- a/desmume/src/windows/matrixView.cpp +++ b/desmume/src/windows/matrixView.cpp @@ -1,20 +1,19 @@ -/* Copyright (C) 2007 Acid Burn +/* + Copyright (C) 2007 Acid Burn + Copyright (C) 2007-2011 DeSmuME team - This file is part of DeSmuME + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. - DeSmuME is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - DeSmuME is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DeSmuME; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + You should have received a copy of the GNU General Public License + along with the this software. If not, see . */ #include "matrixView.h" @@ -187,11 +186,8 @@ BOOL CALLBACK ViewMatricesProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM l MatrixView->autoup = false; } - if (MatrixView!=NULL) - { - delete MatrixView; - MatrixView = NULL; - } + delete MatrixView; + MatrixView = NULL; //INFO("Close Matrix view dialog\n"); PostQuitMessage(0); return 0; diff --git a/desmume/src/windows/memView.cpp b/desmume/src/windows/memView.cpp index 3d1712aa4..b7e6b2c8e 100644 --- a/desmume/src/windows/memView.cpp +++ b/desmume/src/windows/memView.cpp @@ -1,22 +1,19 @@ -/* Copyright (C) 2006 yopyop - yopyop156@ifrance.com - yopyop156.ifrance.com +/* + Copyright (C) 2006 yopyop + Copyright (C) 2006-2011 DeSmuME team - This file is part of DeSmuME + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. - DeSmuME is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - DeSmuME is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DeSmuME; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + You should have received a copy of the GNU General Public License + along with the this software. If not, see . */ #include "CWindow.h" @@ -220,7 +217,8 @@ INT_PTR CALLBACK MemView_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa u8 memory[0x100]; int line; - MMU_DumpMemBlock(wnd->cpu, wnd->address, 0x100, memory); + //MMU_DumpMemBlock(wnd->cpu, wnd->address, 0x100, memory); + for(int i=0;i<0x100;i++) memory[i] = MMU.ARM9_LCD[wnd->address+i]; f = fopen(fileName, "a"); @@ -376,7 +374,8 @@ LRESULT MemView_ViewBoxPaint(CMemView* wnd, HWND hCtl, WPARAM wParam, LPARAM lPa } TextOut(mem_hdc, startx, 0, text, strlen(text)); - MMU_DumpMemBlock(wnd->cpu, wnd->address, 0x100, memory); + //MMU_DumpMemBlock(wnd->cpu, wnd->address, 0x100, memory); + for(int i=0;i<0x100;i++) memory[i] = MMU.ARM9_LCD[wnd->address+i]; for(line = 0; line < 16; line++, addr += 0x10) { @@ -675,7 +674,9 @@ LRESULT CALLBACK MemView_ViewBoxProc(HWND hCtl, UINT uMsg, WPARAM wParam, LPARAM switch(wnd->viewMode) { case 0: MMU_write8(wnd->cpu, wnd->selAddress, (u8)wnd->selNewVal); wnd->selAddress++; break; - case 1: MMU_write16(wnd->cpu, wnd->selAddress, (u16)wnd->selNewVal); wnd->selAddress += 2; break; + //case 1: MMU_write16(wnd->cpu, wnd->selAddress, (u16)wnd->selNewVal); wnd->selAddress += 2; break; + //case 1: MMU_write16(wnd->cpu, wnd->selAddress, (u16)wnd->selNewVal); wnd->selAddress += 2; break; + case 1: MMU.ARM9_LCD[wnd->selAddress] = wnd->selNewVal; break; case 2: MMU_write32(wnd->cpu, wnd->selAddress, wnd->selNewVal); wnd->selAddress += 4; break; } wnd->selPart = 0; diff --git a/desmume/src/windows/oamView.cpp b/desmume/src/windows/oamView.cpp index 54e294242..b10c20589 100644 --- a/desmume/src/windows/oamView.cpp +++ b/desmume/src/windows/oamView.cpp @@ -1,22 +1,19 @@ -/* Copyright (C) 2006 yopyop - yopyop156@ifrance.com - yopyop156.ifrance.com +/* + Copyright (C) 2006 yopyop + Copyright (C) 2006-2011 DeSmuME team - This file is part of DeSmuME + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. - DeSmuME is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - DeSmuME is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DeSmuME; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + You should have received a copy of the GNU General Public License + along with the this software. If not, see . */ #include "oamView.h" @@ -299,12 +296,8 @@ BOOL CALLBACK ViewOAMProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam KillTimer(hwnd, IDT_VIEW_OAM); OAMView->autoup = false; } - - if (OAMView!=NULL) - { - delete OAMView; - OAMView = NULL; - } + delete OAMView; + OAMView = NULL; DeleteObject(bhScyx); DeleteObject(bhBack); //INFO("Close OAM viewer dialog\n"); diff --git a/desmume/src/windows/palView.cpp b/desmume/src/windows/palView.cpp index 838477fec..9b007fff0 100644 --- a/desmume/src/windows/palView.cpp +++ b/desmume/src/windows/palView.cpp @@ -1,22 +1,19 @@ -/* Copyright (C) 2006 yopyop - yopyop156@ifrance.com - yopyop156.ifrance.com +/* + Copyright (C) 2006 yopyop + Copyright (C) 2006-2011 DeSmuME team - This file is part of DeSmuME + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. - DeSmuME is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - DeSmuME is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DeSmuME; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + You should have received a copy of the GNU General Public License + along with the this software. If not, see . */ #include "palView.h" @@ -136,12 +133,8 @@ BOOL CALLBACK ViewPalProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam KillTimer(hwnd, IDT_VIEW_DISASM7); PalView->autoup = false; } - - if (PalView!=NULL) - { - delete PalView; - PalView = NULL; - } + delete PalView; + PalView = NULL; //INFO("Close Palette view dialog\n"); PostQuitMessage(0); return 0; diff --git a/desmume/src/windows/tileView.cpp b/desmume/src/windows/tileView.cpp index 733801302..31bbe151e 100644 --- a/desmume/src/windows/tileView.cpp +++ b/desmume/src/windows/tileView.cpp @@ -1,22 +1,19 @@ -/* Copyright (C) 2006 yopyop - yopyop156@ifrance.com - yopyop156.ifrance.com +/* + Copyright (C) 2006 yopyop + Copyright (C) 2006-2011 DeSmuME team - This file is part of DeSmuME + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. - DeSmuME is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - DeSmuME is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DeSmuME; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + You should have received a copy of the GNU General Public License + along with the this software. If not, see . */ #include "tileView.h" @@ -117,7 +114,6 @@ LRESULT TileViewBox_Pal256(HWND hwnd, tileview_struct * win, WPARAM wParam, LPAR HDC hdc; PAINTSTRUCT ps; // SIZE fontsize; - TCHAR text[80]; u16 bitmap[256*256]; u16 * pal = ((u16 *)win->pal) + win->palnum*256; BITMAPV4HEADER bmi; @@ -188,7 +184,6 @@ LRESULT TileViewBox_Pal16(HWND hwnd, tileview_struct * win, WPARAM wParam, LPARA HDC hdc; PAINTSTRUCT ps; // SIZE fontsize; - TCHAR text[80]; u16 bitmap[512*512]; u16 * pal = ((u16 *)win->pal) + win->palnum*16; BITMAPV4HEADER bmi; @@ -429,11 +424,8 @@ BOOL CALLBACK ViewTilesProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar KillTimer(hwnd, IDT_VIEW_TILE); TileView->autoup = false; } - if (TileView!=NULL) - { - delete TileView; - TileView = NULL; - } + delete TileView; + TileView = NULL; //INFO("Close Tile view dialog\n"); PostQuitMessage(0); return 1;