diff --git a/Source/Core/DebuggerWX/DebuggerWX.vcproj b/Source/Core/DebuggerWX/DebuggerWX.vcproj index c550bb320a..27572e7aa6 100644 --- a/Source/Core/DebuggerWX/DebuggerWX.vcproj +++ b/Source/Core/DebuggerWX/DebuggerWX.vcproj @@ -51,9 +51,10 @@ MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" - UsePrecompiledHeader="0" + UsePrecompiledHeader="2" WarningLevel="3" DebugInformationFormat="4" + ForcedIncludeFiles="stdafx.h" /> + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/Core/DebuggerWX/Src/stdafx.cpp b/Source/Core/DebuggerWX/Src/stdafx.cpp new file mode 100644 index 0000000000..428bdfaf8b --- /dev/null +++ b/Source/Core/DebuggerWX/Src/stdafx.cpp @@ -0,0 +1,18 @@ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program 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, version 2.0. + +// This program 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 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#include "stdafx.h" diff --git a/Source/Core/DebuggerWX/Src/stdafx.h b/Source/Core/DebuggerWX/Src/stdafx.h new file mode 100644 index 0000000000..1080184e73 --- /dev/null +++ b/Source/Core/DebuggerWX/Src/stdafx.h @@ -0,0 +1,33 @@ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program 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, version 2.0. + +// This program 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 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __STDAFX_H_ +#define __STDAFX_H_ + +#ifdef _WIN32 + +// Change these values to use different versions +#define WINVER 0x0400 +#define _WIN32_WINNT 0x0501 +#define _WIN32_IE 0x0500 +#define _RICHEDIT_VER 0x0100 + +#include // wxWidgets + +#endif + +#endif // __STDAFX_H__ diff --git a/Source/Core/DolphinWX/DolphinWX.vcproj b/Source/Core/DolphinWX/DolphinWX.vcproj index bd2914e005..85a54b561d 100644 --- a/Source/Core/DolphinWX/DolphinWX.vcproj +++ b/Source/Core/DolphinWX/DolphinWX.vcproj @@ -64,7 +64,7 @@ EnableEnhancedInstructionSet="2" FloatingPointModel="0" RuntimeTypeInfo="false" - UsePrecompiledHeader="0" + UsePrecompiledHeader="2" PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch" AssemblerListingLocation="$(IntDir)\" ObjectFile="$(IntDir)\" @@ -73,7 +73,7 @@ WarnAsError="false" SuppressStartupBanner="true" DebugInformationFormat="3" - ForcedIncludeFiles="" + ForcedIncludeFiles="stdafx.h" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/Core/DolphinWX/Src/NetEvent.cpp b/Source/Core/DolphinWX/Src/NetEvent.cpp index 6fc7280b1e..b3bed38878 100644 --- a/Source/Core/DolphinWX/Src/NetEvent.cpp +++ b/Source/Core/DolphinWX/Src/NetEvent.cpp @@ -15,6 +15,7 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ +#include "NetSockets.h" #include "NetWindow.h" void ClientSide::OnClientData(unsigned char data) diff --git a/Source/Core/DolphinWX/Src/NetFunctions.cpp b/Source/Core/DolphinWX/Src/NetFunctions.cpp index 5c544970b7..08d514d8f3 100644 --- a/Source/Core/DolphinWX/Src/NetFunctions.cpp +++ b/Source/Core/DolphinWX/Src/NetFunctions.cpp @@ -15,6 +15,7 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ +#include "NetSockets.h" #include "NetWindow.h" #include "HW/SI_DeviceGCController.h" diff --git a/Source/Core/DolphinWX/Src/NetSockets.cpp b/Source/Core/DolphinWX/Src/NetSockets.cpp index fe9d065d36..7653e4406a 100644 --- a/Source/Core/DolphinWX/Src/NetSockets.cpp +++ b/Source/Core/DolphinWX/Src/NetSockets.cpp @@ -15,6 +15,7 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ +#include "NetSockets.h" #include "NetWindow.h" //-------------------------------- diff --git a/Source/Core/DolphinWX/Src/NetSockets.h b/Source/Core/DolphinWX/Src/NetSockets.h new file mode 100644 index 0000000000..74dc322f20 --- /dev/null +++ b/Source/Core/DolphinWX/Src/NetSockets.h @@ -0,0 +1,128 @@ +// Copyright (C) 2003-2009 Dolphin Project. + +// This program 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, version 2.0. + +// This program 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 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _NETSOCKETS_H_ +#define _NETSOCKETS_H_ + +#include + +class NetPlay; + +#include "Common.h" +#include "NetStructs.h" + +#include + + +struct Clients { + std::string nick; + sf::SocketTCP socket; + unsigned short port; + sf::IPAddress address; + bool ready; +}; + +class NetEvent +{ + public: + NetEvent(NetPlay* netptr) { m_netptr = netptr; } + ~NetEvent() {}; + + void SendEvent(int EventType, std::string="NULL", int=NULL); + void AppendText(const wxString text); + + private: + NetPlay *m_netptr; +}; + +class ServerSide : public wxThread +{ + public: + ServerSide(NetPlay* netptr, sf::SocketTCP, sf::SocketUDP, int netmodel, std::string nick); + ~ServerSide() {}; + + virtual void *Entry(); + + void Write(int socknb, const char *data, size_t size, long *ping=NULL); + void WriteUDP(int socknb, const char *data, size_t size); + bool isNewPadData(u32 *netValues, bool current, int client=0); + + private: + bool SyncValues(unsigned char, sf::IPAddress); + bool RecvT(sf::SocketUDP Socket, char * Data, size_t Max, size_t& Recvd, float Time = 0); + char GetSocket(sf::SocketTCP Socket); + void OnServerData(int sock, unsigned char data); + void IsEveryoneReady(); + + NetPlay *m_netptr; + NetEvent *Event; + + u32 m_netvalues[3][3]; + bool m_data_received; // New Pad data received ? + + unsigned char m_numplayers; + int m_netmodel; + std::string m_nick; + + Clients m_client[3]; // Connected client objects + sf::SelectorTCP m_selector; + sf::SocketTCP m_socket; // Server 'listening' socket + sf::SocketUDP m_socketUDP; + + wxCriticalSection m_CriticalSection; +}; + +class ClientSide : public wxThread +{ + public: + ClientSide(NetPlay* netptr, sf::SocketTCP, sf::SocketUDP, std::string addr, std::string nick); + ~ClientSide() {} + + virtual void *Entry(); + + void Write(const char *data, size_t size, long *ping=NULL); + void WriteUDP(const char *data, size_t size); + bool isNewPadData(u32 *netValues, bool current, bool isVersus=true); + + private: + bool SyncValues(); + void CheckGameFound(); + void OnClientData(unsigned char data); + bool RecvT(sf::SocketUDP Socket, char * Data, size_t Max, size_t& Recvd, float Time=0); + + NetPlay *m_netptr; + NetEvent *Event; + + u32 m_netvalues[3][3]; + bool m_data_received; // New Pad data received ? + + unsigned char m_numplayers; + int m_netmodel; + std::string m_nick; + std::string m_hostnick; + std::string m_selectedgame; + + sf::SelectorTCP m_selector; + sf::SocketTCP m_socket; // Client I/O socket + sf::SocketUDP m_socketUDP; + unsigned short m_port; + std::string m_addr; // Contains the server addr + + wxCriticalSection m_CriticalSection; +}; + +#endif diff --git a/Source/Core/DolphinWX/Src/NetStructs.h b/Source/Core/DolphinWX/Src/NetStructs.h new file mode 100644 index 0000000000..a65b638a25 --- /dev/null +++ b/Source/Core/DolphinWX/Src/NetStructs.h @@ -0,0 +1,26 @@ +// Copyright (C) 2003-2009 Dolphin Project. + +// This program 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, version 2.0. + +// This program 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 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _NETSTRUCTS_H +#define _NETSTRUCTS_H + +struct Netpads { + int nHi[128]; + int nLow[128]; +}; + +#endif // _NETSTRUCTS_H \ No newline at end of file diff --git a/Source/Core/DolphinWX/Src/NetWindow.cpp b/Source/Core/DolphinWX/Src/NetWindow.cpp index 01e5436da8..7d01bb0a64 100644 --- a/Source/Core/DolphinWX/Src/NetWindow.cpp +++ b/Source/Core/DolphinWX/Src/NetWindow.cpp @@ -15,6 +15,7 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ +#include "NetSockets.h" #include "NetWindow.h" /////////////////////// diff --git a/Source/Core/DolphinWX/Src/NetWindow.h b/Source/Core/DolphinWX/Src/NetWindow.h index c64a97ca15..bed64ebb17 100644 --- a/Source/Core/DolphinWX/Src/NetWindow.h +++ b/Source/Core/DolphinWX/Src/NetWindow.h @@ -18,7 +18,6 @@ #ifndef _NETWINDOW_H_ #define _NETWINDOW_H_ -#include #include #include #include @@ -32,6 +31,7 @@ #include "Globals.h" #include "BootManager.h" #include "Common.h" +#include "NetStructs.h" #include "Core.h" #include "pluginspecs_pad.h" #include "HW/SI.h" @@ -47,109 +47,8 @@ // Unrealistic for Internet netplay, unless you have an uberfast connexion (<10ms ping) // #define USE_TCP -class NetPlay; - -struct Netpads { - int nHi[128]; - int nLow[128]; -}; - -struct Clients { - std::string nick; - sf::SocketTCP socket; - unsigned short port; - sf::IPAddress address; - bool ready; -}; - -class NetEvent -{ - public: - NetEvent(NetPlay* netptr) { m_netptr = netptr; } - ~NetEvent() {}; - - void SendEvent(int EventType, std::string="NULL", int=NULL); - void AppendText(const wxString text); - - private: - NetPlay *m_netptr; -}; - -class ServerSide : public wxThread -{ - public: - ServerSide(NetPlay* netptr, sf::SocketTCP, sf::SocketUDP, int netmodel, std::string nick); - ~ServerSide() {}; - - virtual void *Entry(); - - void Write(int socknb, const char *data, size_t size, long *ping=NULL); - void WriteUDP(int socknb, const char *data, size_t size); - bool isNewPadData(u32 *netValues, bool current, int client=0); - - private: - bool SyncValues(unsigned char, sf::IPAddress); - bool RecvT(sf::SocketUDP Socket, char * Data, size_t Max, size_t& Recvd, float Time = 0); - char GetSocket(sf::SocketTCP Socket); - void OnServerData(int sock, unsigned char data); - void IsEveryoneReady(); - - NetPlay *m_netptr; - NetEvent *Event; - - u32 m_netvalues[3][3]; - bool m_data_received; // New Pad data received ? - - unsigned char m_numplayers; - int m_netmodel; - std::string m_nick; - - Clients m_client[3]; // Connected client objects - sf::SelectorTCP m_selector; - sf::SocketTCP m_socket; // Server 'listening' socket - sf::SocketUDP m_socketUDP; - - wxCriticalSection m_CriticalSection; -}; - -class ClientSide : public wxThread -{ - public: - ClientSide(NetPlay* netptr, sf::SocketTCP, sf::SocketUDP, std::string addr, std::string nick); - ~ClientSide() {} - - virtual void *Entry(); - - void Write(const char *data, size_t size, long *ping=NULL); - void WriteUDP(const char *data, size_t size); - bool isNewPadData(u32 *netValues, bool current, bool isVersus=true); - - private: - bool SyncValues(); - void CheckGameFound(); - void OnClientData(unsigned char data); - bool RecvT(sf::SocketUDP Socket, char * Data, size_t Max, size_t& Recvd, float Time=0); - - NetPlay *m_netptr; - NetEvent *Event; - - u32 m_netvalues[3][3]; - bool m_data_received; // New Pad data received ? - - unsigned char m_numplayers; - int m_netmodel; - std::string m_nick; - std::string m_hostnick; - std::string m_selectedgame; - - sf::SelectorTCP m_selector; - sf::SocketTCP m_socket; // Client I/O socket - sf::SocketUDP m_socketUDP; - unsigned short m_port; - std::string m_addr; // Contains the server addr - - wxCriticalSection m_CriticalSection; -}; +class ServerSide; +class ClientSide; class NetPlay : public wxFrame { diff --git a/Source/Core/DolphinWX/Src/stdafx.h b/Source/Core/DolphinWX/Src/stdafx.h index fd5beae06d..dca152beae 100644 --- a/Source/Core/DolphinWX/Src/stdafx.h +++ b/Source/Core/DolphinWX/Src/stdafx.h @@ -26,6 +26,7 @@ #define _WIN32_IE 0x0500 #define _RICHEDIT_VER 0x0100 +#include // wxWidgets #if defined _M_IX86 diff --git a/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.cpp b/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.cpp index d41175811e..7f5328b077 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.cpp @@ -132,11 +132,14 @@ RasterFont::RasterFont() glBitmap(8, 13, 0.0f, 2.0f, 10.0f, 0.0f, rasters[i - 32]); glEndList(); } + + temp_buffer = new char[TEMP_BUFFER_SIZE]; } RasterFont::~RasterFont() { glDeleteLists(fontOffset, 128); + delete [] temp_buffer; } void RasterFont::printString(const char *s, double x, double y, double z) @@ -144,10 +147,13 @@ void RasterFont::printString(const char *s, double x, double y, double z) int length = (int)strlen(s); if (!length) return; + if (length >= TEMP_BUFFER_SIZE) + length = TEMP_BUFFER_SIZE - 1; // Sanitize string to avoid GL errors. - char *s2 = new char[length + 1]; - strcpy(s2, s); + char *s2 = temp_buffer; + memcpy(s2, s, length); + s2[length] = 0; for (int i = 0; i < length; i++) { if (s2[i] < 32 || s2[i] > 126) s2[i] = '!'; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.h b/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.h index 3e50691253..1e34ffe9f6 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.h @@ -19,9 +19,6 @@ #define _RASTERFONT_H_ class RasterFont { -protected: - int fontOffset; - public: RasterFont(); ~RasterFont(void); @@ -36,6 +33,10 @@ public: void printCenteredString(const char *s, double y, int screen_width, double z=0.0); void printMultilineText(const char *text, double x, double y, double z, int bbWidth, int bbHeight); +private: + int fontOffset; + char *temp_buffer; + enum {TEMP_BUFFER_SIZE = 64 * 1024}; }; #endif // _RASTERFONT_H_