From c4fa4ca075c4f890a36e07916723542e6e3c3a1a Mon Sep 17 00:00:00 2001 From: DJRobX Date: Wed, 31 Oct 2007 00:23:38 +0000 Subject: [PATCH] Fixed debug mode compiler build errors in vcproj. AccelEditor and UniVideoModeDlg had some trivial scope problems that strangely compile in release mode but don't in debug mode. Network code was crashing in Link.cpp. Added check for null linkmem pointer to allow the code to run but need to investigate why linkmem is not initialized. git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@4 a31d4220-a93d-0410-bf67-fe4944624d44 --- VBA.suo | Bin 53248 -> 53248 bytes VBA.vcproj | 78 ++++++++++++++++++++++++++++++++-- src/Link.cpp | 4 +- src/hq3x32.cpp | 35 +++++++++++++-- src/win32/AccelEditor.cpp | 5 ++- src/win32/UniVideoModeDlg.cpp | 61 +++++++++++++------------- src/win32/VBA.cpp | 7 ++- 7 files changed, 148 insertions(+), 42 deletions(-) diff --git a/VBA.suo b/VBA.suo index 8a28adcf92d3bce76df72493398d151a60dfb80a..b5cff28b3707ef7bd1218c38253709ea586deaea 100644 GIT binary patch delta 639 zcmZozz}&Eac|#5h>jjspYXO@JS^hJz{QLj^|Kt+(9s&DVQEhoCydIl9-P`%!Nqm|- zaf88T2aY3htU3$~3_+78=1Gd?GQ=>HFcdMAGUPF21KD7(*<4+ajnQcGK~CYx37is} zOLWf*voTr&<+KoDjsaq<20$T2xX_nye-R|Z4A8S-3{DJ=40;S@49N@y zz(B}n$O4)Qw1NSu1I;YWblG%1hG3w&QlRQ&hE$+R5RgL=i(znM$YjU?25Tx%RWU>f zg9=_XF$^9Ifl!qU3_e(W(x0xod0BcN$K)ji29r|?Y$k@B*_=~&g_)a;ff3~96d>O0 zUHX%eRR+k?gNIE?dB9|sCIjvpK+$C&g$xXn4Rd8T%T%ayO+K7xJGr6h2q=m+mo#7D cWK@Oe+g#FnMSxKo!JT(ShEWH>-Q6Ps0OdTcN&o-= delta 753 zcmZozz}&Eac|#5hYr^&CDaxA*S^hJzXfQG`OfF&X5incdc1ke6#l7vQ7_DgJDXMnEO1FeR*-K##Leu1xi2lmi(#`Ae#Rdl9Mr1cpEs(8pyANeqcV zIu{%^sgrfnjNRj?WY+mKNpGN28K`HTtS1A|)g;C!4xh^Ni%*`AF1C43dIiVC5QE7n z1vZln3QQ&@%-Eb$c!impfx(u68R&Wj2J6k zF&gH|ZkDM~=bC)D+;DP9(*;&7pr|%X>E@E=E1Zn#2yX8c0Y)7Jcit75$v&Jqn@e{0 GhyVa#Ny%0K diff --git a/VBA.vcproj b/VBA.vcproj index 4a45c764..e790f475 100644 --- a/VBA.vcproj +++ b/VBA.vcproj @@ -83,11 +83,12 @@ /> @@ -514,6 +517,7 @@ > @@ -523,6 +527,7 @@ > @@ -536,6 +541,7 @@ > @@ -545,6 +551,7 @@ > @@ -554,14 +561,79 @@ > + + + + + + + + + + + + + + + + + + + + =linkmem->lastlinktime&&linkmem->numtransfers){ + // ** CRASH ** linkmem is NULL, todo investigate why, added null check + if(linkid&&!transfer&&linkmem&&linktime>=linkmem->lastlinktime&&linkmem->numtransfers){ linkmem->linkdata[linkid] = READ16LE(&ioMem[0x12a]); if(linkmem->numtransfers==1){ diff --git a/src/hq3x32.cpp b/src/hq3x32.cpp index 4b05eff1..492225b1 100644 --- a/src/hq3x32.cpp +++ b/src/hq3x32.cpp @@ -25,6 +25,9 @@ extern "C" { void hq3x_16(unsigned char*, unsigned char*, DWORD, DWORD, DWORD, DWORD); void hq3x_32(unsigned char*, unsigned char*, DWORD, DWORD, DWORD, DWORD); +void hq4x_16(unsigned char*, unsigned char*, DWORD, DWORD, DWORD, DWORD); +void hq4x_32(unsigned char*, unsigned char*, DWORD, DWORD, DWORD, DWORD); + unsigned int LUT16to32[65536]; unsigned int RGBtoYUV[65536]; } @@ -64,8 +67,6 @@ int InitLUTs(void) int hq3xinited=0; -#include - void hq3x32(unsigned char * pIn, unsigned int srcPitch, unsigned char *, unsigned char * pOut, unsigned int dstPitch, @@ -80,7 +81,6 @@ void hq3x32(unsigned char * pIn, unsigned int srcPitch, } hq3x_32( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2) ); } -#include void hq3x16(unsigned char * pIn, unsigned int srcPitch, unsigned char *, @@ -94,3 +94,32 @@ void hq3x16(unsigned char * pIn, unsigned int srcPitch, } hq3x_16( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2)); } + + +void hq4x16(unsigned char * pIn, unsigned int srcPitch, + unsigned char *, + unsigned char * pOut, unsigned int dstPitch, + int Xres, int Yres) +{ + if (!hq3xinited) + { + InitLUTs(); + hq3xinited=1; + } + hq4x_16( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2)); +} + +void hq4x32(unsigned char * pIn, unsigned int srcPitch, + unsigned char *, + unsigned char * pOut, unsigned int dstPitch, + int Xres, int Yres) +{ + // NOTICE! This driver wants 16 bit, not 32 bit input! + + if (!hq3xinited) + { + InitLUTs(); + hq3xinited=1; + } + hq4x_32( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2)); +} diff --git a/src/win32/AccelEditor.cpp b/src/win32/AccelEditor.cpp index 19076e95..0747e26e 100644 --- a/src/win32/AccelEditor.cpp +++ b/src/win32/AccelEditor.cpp @@ -180,12 +180,13 @@ void AccelEditor::OnAssign() WORD wKey; bool bCtrl, bAlt, bShift; - + int index; + if (!m_key.GetAccelKey(wKey, bCtrl, bAlt, bShift)) return; // no valid key, abort int count = m_commands.GetCount(); - for (int index = 0; index < count; index++) { + for (index = 0; index < count; index++) { wIDCommand = LOWORD(m_commands.GetItemData(index)); mgr.m_mapAccelTable.Lookup(wIDCommand, pCmdAccel); diff --git a/src/win32/UniVideoModeDlg.cpp b/src/win32/UniVideoModeDlg.cpp index a7ba3569..9dc521d0 100644 --- a/src/win32/UniVideoModeDlg.cpp +++ b/src/win32/UniVideoModeDlg.cpp @@ -18,8 +18,8 @@ UniVideoModeDlg::UniVideoModeDlg(CWnd* pParent /*=NULL*/, int *width, int *heigh SelectedHeight = height; SelectedBPP = BPP; SelectedFreq = freq; - SelectedAdapter = adapt; - pD3D = NULL; + SelectedAdapter = adapt; + pD3D = NULL; d3dDLL = NULL; nAdapters = 1; } @@ -89,7 +89,8 @@ BOOL UniVideoModeDlg::OnInitDialog() dm.dmSize = sizeof(DEVMODE); dm.dmDriverExtra = 0; DWORD maxMode; - for (DWORD i=0; 0 != EnumDisplaySettings(dd.DeviceName, i, &dm); i++) {} + DWORD i; + for (i=0; 0 != EnumDisplaySettings(dd.DeviceName, i, &dm); i++) {} maxMode = i-1; listmodes->InitStorage(i, 25); if (WidthList!=0) delete [] WidthList; @@ -122,19 +123,19 @@ BOOL UniVideoModeDlg::OnInitDialog() case DIRECT_DRAW: apiname->SetWindowText("DirectDraw 7"); break; - - - case DIRECT_3D: + + + case DIRECT_3D: apiname->SetWindowText("Direct3D 9"); - // Load DirectX DLL - d3dDLL = LoadLibrary("D3D9.DLL"); - LPDIRECT3D9 (WINAPI *D3DCreate)(UINT); - D3DCreate = (LPDIRECT3D9 (WINAPI *)(UINT)) - GetProcAddress(d3dDLL, "Direct3DCreate9"); + // Load DirectX DLL + d3dDLL = LoadLibrary("D3D9.DLL"); + LPDIRECT3D9 (WINAPI *D3DCreate)(UINT); + D3DCreate = (LPDIRECT3D9 (WINAPI *)(UINT)) + GetProcAddress(d3dDLL, "Direct3DCreate9"); pD3D = D3DCreate(D3D_SDK_VERSION); nAdapters = pD3D->GetAdapterCount(); D3DADAPTER_IDENTIFIER9 id; - pD3D->GetAdapterIdentifier(iDisplayDevice, 0, &id); + pD3D->GetAdapterIdentifier(iDisplayDevice, 0, &id); devicename->SetWindowText(id.Description); D3DDISPLAYMODE d3ddm; @@ -186,15 +187,15 @@ BOOL UniVideoModeDlg::OnInitDialog() BPPList[i+nModes16] = b; FreqList[i+nModes16] = f; } - - // Clean up - pD3D->Release(); - pD3D = NULL; - if(d3dDLL != NULL) - { - FreeLibrary(d3dDLL); - d3dDLL = NULL; - } + + // Clean up + pD3D->Release(); + pD3D = NULL; + if(d3dDLL != NULL) + { + FreeLibrary(d3dDLL); + d3dDLL = NULL; + } break; @@ -244,9 +245,9 @@ void UniVideoModeDlg::OnStnClickedDisplaydevice() case DIRECT_DRAW: - break; - - + break; + + case DIRECT_3D: iDisplayDevice++; if (iDisplayDevice == nAdapters) iDisplayDevice = 0; @@ -262,17 +263,17 @@ void UniVideoModeDlg::OnStnClickedDisplaydevice() } void UniVideoModeDlg::OnBnClickedButtonMaxscale() -{ - MaxScale dlg; - theApp.winCheckFullscreen(); +{ + MaxScale dlg; + theApp.winCheckFullscreen(); dlg.DoModal(); } void UniVideoModeDlg::OnBnClickedCheckStretchtofit() { - theApp.fullScreenStretch = !theApp.fullScreenStretch; - theApp.updateWindowSize(theApp.videoOption); - if(theApp.display) + theApp.fullScreenStretch = !theApp.fullScreenStretch; + theApp.updateWindowSize(theApp.videoOption); + if(theApp.display) theApp.display->clear(); this->SetFocus(); } diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp index 109e4aea..9ab16c22 100644 --- a/src/win32/VBA.cpp +++ b/src/win32/VBA.cpp @@ -85,6 +85,8 @@ extern void Simple4x32(u8*,u32,u8*,u8*,u32,int,int); extern void hq3x32(u8*,u32,u8*,u8*,u32,int,int); extern void hq3x16(u8*,u32,u8*,u8*,u32,int,int); +extern void hq4x32(u8*,u32,u8*,u8*,u32,int,int); +extern void hq4x16(u8*,u32,u8*,u8*,u32,int,int); extern void SmartIB(u8*,u32,int,int); extern void SmartIB32(u8*,u32,int,int); @@ -699,7 +701,7 @@ void VBA::updateFilter() filterMagnification = 3; break; case FILTER_HQ4X: - //filterFunction = lq2x; + filterFunction = hq4x16; filterMagnification = 4; break; } @@ -776,8 +778,9 @@ void VBA::updateFilter() b16to32Video=true; break; case FILTER_HQ4X: - //filterFunction = lq2x; + filterFunction = hq4x32; filterMagnification = 4; + b16to32Video=true; break; } }