win32: clean up experimental wifi building to work in fastcall and run correctly without winpcap.dll etc on all build types in vs2005 and vs2008

This commit is contained in:
zeromus 2009-04-08 08:01:47 +00:00
parent c83531b12c
commit ba967c8fda
6 changed files with 53 additions and 51 deletions

View File

@ -1149,27 +1149,27 @@ int WIFI_SoftAP_Init(wifimac_t *wifi)
SoftAP_CRC32Table[i] = reflect(SoftAP_CRC32Table[i], 32);
}
if(pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1)
if(PCAP::pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1)
{
printf("SoftAP: PCAP error with pcap_findalldevs_ex(): %s\n", errbuf);
return 0;
}
wifi->SoftAP.bridge = pcap_open(WIFI_index_device(alldevs,CommonSettings.wifiBridgeAdapterNum)->name, PACKET_SIZE, 0, 1, NULL, errbuf);
wifi->SoftAP.bridge = PCAP::pcap_open(WIFI_index_device(alldevs,CommonSettings.wifiBridgeAdapterNum)->name, PACKET_SIZE, 0, 1, NULL, errbuf);
if(wifi->SoftAP.bridge == NULL)
{
printf("SoftAP: PCAP error with pcap_open(): %s\n", errbuf);
return 0;
}
pcap_freealldevs(alldevs);
PCAP::pcap_freealldevs(alldevs);
return 1;
}
void WIFI_SoftAP_Shutdown(wifimac_t *wifi)
{
pcap_close(wifi->SoftAP.bridge);
PCAP::pcap_close(wifi->SoftAP.bridge);
}
void WIFI_SoftAP_RecvPacketFromDS(wifimac_t *wifi, u8 *packet, int len)
@ -1327,7 +1327,7 @@ void WIFI_SoftAP_RecvPacketFromDS(wifimac_t *wifi, u8 *packet, int len)
/* Checksum */
/* TODO ? */
pcap_sendpacket(wifi->SoftAP.bridge, ethernetframe, eflen);
PCAP::pcap_sendpacket(wifi->SoftAP.bridge, ethernetframe, eflen);
delete ethernetframe;
}

View File

@ -31,6 +31,7 @@
#include <winsock2.h>
#define socket_t SOCKET
#define sockaddr_t SOCKADDR
#include "windriver.h"
#else
#include <unistd.h>
#include <stdlib.h>
@ -51,8 +52,6 @@
#define PACKET_SIZE 65535
#define _INC_STDIO
#include <pcap.h>
#include <remote-ext.h> //uh?
#define REG_WIFI_ID 0x000
#define REG_WIFI_MODE 0x004

View File

@ -141,7 +141,7 @@
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\winpcap"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX;NDEBUG"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX;NDEBUG;EXPERIMENTAL_WIFI"
StringPooling="true"
ExceptionHandling="1"
BufferSecurityCheck="false"
@ -163,7 +163,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib shlwapi.lib"
AdditionalDependencies="vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib shlwapi.lib winpcap\wpcap.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
DelayLoadDLLs="wpcap.dll"
@ -231,7 +231,7 @@
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\winpcap"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX;NDEBUG"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX;NDEBUG;EXPERIMENTAL_WIFI"
StringPooling="true"
ExceptionHandling="1"
StructMemberAlignment="0"
@ -318,7 +318,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\winpcap"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SPU_INTERPOLATE;NOMINMAX;NDEBUG;RELEASE"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SPU_INTERPOLATE;NOMINMAX;NDEBUG;RELEASE;EXPERIMENTAL_WIFI"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@ -331,7 +331,8 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib shlwapi.lib"
AdditionalDependencies="vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib shlwapi.lib winpcap\wpcap.lib"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
DelayLoadDLLs="wpcap.dll"
/>
<Tool
@ -395,7 +396,7 @@
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\winpcap"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;SPU_INTERPOLATE;NOMINMAX;NDEBUG;RELEASE"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;SPU_INTERPOLATE;NOMINMAX;NDEBUG;RELEASE;EXPERIMENTAL_WIFI"
StringPooling="true"
ExceptionHandling="1"
StructMemberAlignment="0"
@ -420,7 +421,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib shlwapi.lib"
AdditionalDependencies="vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib shlwapi.lib winpcap\wpcap.lib"
OutputFile="$(OutDir)\$(ProjectName)_sse2.exe"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
DelayLoadDLLs="wpcap.dll"
@ -790,44 +791,19 @@
RelativePath="..\matrix_sse2-x64.asm"
>
<FileConfiguration
Name="Debug|Win32"
Name="Release (public)|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="MASM"
/>
</FileConfiguration>
<FileConfiguration
Name="Interim|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling..."
CommandLine="ml64 /nologo /c /Zi /Fo&quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Interim SSE2|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling..."
CommandLine="ml64 /nologo /c /Zi /Fo&quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName).obj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release SSE2 (public)|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling..."
CommandLine="ml64 /nologo /c /Zi /Fo&quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="$(IntDir)\$(InputName).obj"
Name="MASM"
/>
</FileConfiguration>
</File>
@ -850,6 +826,14 @@
Name="MASM"
/>
</FileConfiguration>
<FileConfiguration
Name="Release (public)|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="MASM"
/>
</FileConfiguration>
</File>
</Filter>
<Filter

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="shift_jis"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="9.00"
Name="DeSmuME_VS2008"
ProjectGUID="{9F5F72A1-D3A5-4918-B460-E076B16D10A9}"
RootNamespace="DeSmuME"
@ -140,7 +140,7 @@
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\winpcap"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX;EXPERIMENTAL_WIFI"
StringPooling="true"
ExceptionHandling="1"
StructMemberAlignment="0"
@ -231,7 +231,7 @@
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\winpcap"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX;EXPERIMENTAL_WIFI"
StringPooling="true"
ExceptionHandling="1"
BufferSecurityCheck="false"
@ -321,7 +321,7 @@
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\winpcap"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SPU_INTERPOLATE;NOMINMAX;RELEASE"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SPU_INTERPOLATE;NOMINMAX;RELEASE;EXPERIMENTAL_WIFI"
StringPooling="true"
ExceptionHandling="1"
BufferSecurityCheck="false"
@ -411,7 +411,7 @@
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\winpcap"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;SPU_INTERPOLATE;NOMINMAX;RELEASE"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;SPU_INTERPOLATE;NOMINMAX;RELEASE;EXPERIMENTAL_WIFI"
StringPooling="true"
ExceptionHandling="1"
StructMemberAlignment="0"

View File

@ -34,9 +34,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <vector>
#include <sstream>
#include <tchar.h>
#ifdef EXPERIMENTAL_WIFI
#include <pcap.h>
#endif
#include "CWindow.h"
#include "../MMU.h"
#include "../armcpu.h"
@ -2149,16 +2146,20 @@ void RunConfig(CONFIGSCREEN which)
break;
case CONFIGSCREEN_EMULATION:
DialogBox(hAppInst, MAKEINTRESOURCE(IDD_EMULATIONSETTINGS), hwnd, (DLGPROC)EmulationSettingsDlgProc);
break;
break;
case CONFIGSCREEN_WIFI:
#ifdef EXPERIMENTAL_WIFI
if(wifiMac.netEnabled)
{
DialogBox(hAppInst,MAKEINTRESOURCE(IDD_WIFISETTINGS), hwnd, (DLGPROC) WifiSettingsDlgProc);
}
else
{
#endif
MessageBox(MainWindow->getHWnd(),"winpcap failed to initialize, and so wifi cannot be configured.","wifi system failure",0);
#ifdef EXPERIMENTAL_WIFI
}
#endif
break;
}
@ -3295,7 +3296,7 @@ LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
int i;
HWND cur;
if(pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1)
if(PCAP::pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1)
{
EndDialog(hDlg, TRUE);
return TRUE;

View File

@ -5,6 +5,24 @@
#include "../common.h"
#include "CWindow.h"
#ifdef EXPERIMENTAL_WIFI
#include <pcap.h>
#include <remote-ext.h> //uh?
//because the pcap headers are written poorly, we need to declare these as cdecl
//this may cause the code to fail to compile on non-windows platforms;
//we may have to use a macro to call these functions which chooses whether to call them
//through the namespace
namespace PCAP {
extern "C" __declspec(dllexport) int __cdecl pcap_findalldevs_ex(char *source, struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf);
extern "C" __declspec(dllexport) int __cdecl pcap_sendpacket(pcap_t *, const u_char *, int);
extern "C" __declspec(dllexport) void __cdecl pcap_close(pcap_t *);
extern "C" __declspec(dllexport) pcap_t* __cdecl pcap_open(const char *source, int snaplen, int flags, int read_timeout, struct pcap_rmtauth *auth, char *errbuf);
extern "C" __declspec(dllexport) void __cdecl pcap_freealldevs(pcap_if_t *);
}
#endif
extern WINCLASS *MainWindow;
class Lock {