diff --git a/.gitignore b/.gitignore index 7451ae6..a66d5e2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,35 @@ -# ignore visual studio directies and local files +# Ignore visual studio directies and local files .vscode -build/VS2019/x64/** -build/VS2019/.vs/** -build/VS2019/Release/** -build/VS2019/Debug/** -build/VS2019/GGPO/Release/** -build/VS2019/GGPO/Debug/** -build/VS2019/GGPO/x64/** -build/VS2019/GGPO/GGPO.vcxproj.user -build/VS2019/Vectorwar/Release/** -build/VS2019/Vectorwar/Debug/** -build/VS2019/Vectorwar/x64/** -build/VS2019/VectorWar/VectorWar.vcxproj.user +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..b23725e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,68 @@ +cmake_minimum_required(VERSION 3.2) + +# TODO: SDK Versioning. +project(ggpo VERSION 1.0.0) + +# What do we want to build? +option(BUILD_GGPO "Enable the build of the GGPO SDK" ON) +option(BUILD_VECTORWAR "Enable the build of the Vector War example app" ON) +option(BUILD_SHARED_LIBS "Enable the build of shared libraries (.dll/.so) instead of static ones (.lib/.a)" ON) + +set(GGPO_SDK + src/include/ggponet.h + src/lib/ggpo/main.cpp + src/lib/ggpo/bitvector.h + src/lib/ggpo/bitvector.cpp + src/lib/ggpo/game_input.h + src/lib/ggpo/game_input.cpp + src/lib/ggpo/input_queue.h + src/lib/ggpo/input_queue.cpp + src/lib/ggpo/log.h + src/lib/ggpo/log.cpp + src/lib/ggpo/poll.h + src/lib/ggpo/poll.cpp + src/lib/ggpo/ring_buffer.h + src/lib/ggpo/static_buffer.h + src/lib/ggpo/sync.h + src/lib/ggpo/sync.cpp + src/lib/ggpo/timesync.h + src/lib/ggpo/timesync.cpp + src/lib/ggpo/types.h + src/lib/ggpo/zconf.h + src/lib/ggpo/zlib.h + src/lib/ggpo/backends/backend.h + src/lib/ggpo/backends/p2p.h + src/lib/ggpo/backends/p2p.cpp + src/lib/ggpo/backends/spectator.h + src/lib/ggpo/backends/spectator.cpp + src/lib/ggpo/backends/synctest.h + src/lib/ggpo/backends/synctest.cpp + src/lib/ggpo/network/udp.h + src/lib/ggpo/network/udp.cpp + src/lib/ggpo/network/udp_msg.h + src/lib/ggpo/network/udp_proto.h + src/lib/ggpo/network/udp_proto.cpp +) + +if(BUILD_GGPO) + add_library(ggpo ${GGPO_SDK}) + + target_include_directories(ggpo PUBLIC src/include) + target_include_directories(ggpo PUBLIC src/lib/ggpo) + + if(WIN32 AND BUILD_SHARED_LIBS) + # Link to Multimedia API and Winsocks during a static build. + target_link_libraries(ggpo LINK_PUBLIC winmm.lib ws2_32.lib) + endif() + + set_target_properties(ggpo PROPERTIES VERSION ${PROJECT_VERSION}) +endif() + +if(BUILD_VECTORWAR) + # Vector War is windows only. + if(WIN32) + add_subdirectory(src/apps/vectorwar) + else() + message(WARNING "The Vector War app only supports windows, skipping...") + endif() +endif() \ No newline at end of file diff --git a/README.md b/README.md index d5e93a7..57245aa 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,16 @@ Traditional techniques account for network transmission time by adding delay to For more information about the history of GGPO, check out http://ggpo.net/ -This repository contains the code, documentation, and sample application for the Windows version of the SDK (requires Visual Studio 2019). +This repository contains the code, documentation, and sample applications for the SDK. + +## Building +Building GGPO is currently only available on Windows, however efforts are being made to port it to other platforms. To get started, clone the repository using either git or svn: +```git clone https://github.com/pond3r/ggpo.git``` +**OR** +```svn checkout https://github.com/pond3r/ggpo``` + +### Windows +On windows, it's recommended to use Visual Studio 2019 and cmake-gui (which can be downloaded [here](https://cmake.org/download/)). Once everything has been setup, open cmake-gui and select the root of the repository under ```Where is the source code:``` followed by the build folder under ```Where to build the binaries:```. Next, hit ```Configure``` and change any options that appear in the main window before hitting ```Generate``` which will generate the VS2019 solution. Once the solution has been generated, hit ```Open Project``` and build with the appropriate settings (Debug/Release). The built binaries can then be found where they were configured to be built. ## Licensing GGPO is available under The MIT License. This means GGPO is free for commercial and non-commercial use. Attribution is not required, but appreciated. diff --git a/build/.gitignore b/build/.gitignore new file mode 100644 index 0000000..a9b2856 --- /dev/null +++ b/build/.gitignore @@ -0,0 +1,3 @@ +# Track the build directory but not its contents. +* +!.gitignore \ No newline at end of file diff --git a/build/VS2019/GGPO.sln b/build/VS2019/GGPO.sln deleted file mode 100644 index d406fbe..0000000 --- a/build/VS2019/GGPO.sln +++ /dev/null @@ -1,44 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29326.143 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GGPO", "GGPO\GGPO.vcxproj", "{79A8B179-8CC3-4653-BD92-667FABA10B73}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VectorWar", "VectorWar\VectorWar.vcxproj", "{D253FCCB-21DD-4D82-B890-1622C570C615}" - ProjectSection(ProjectDependencies) = postProject - {79A8B179-8CC3-4653-BD92-667FABA10B73} = {79A8B179-8CC3-4653-BD92-667FABA10B73} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {79A8B179-8CC3-4653-BD92-667FABA10B73}.Debug|x64.ActiveCfg = Debug|x64 - {79A8B179-8CC3-4653-BD92-667FABA10B73}.Debug|x64.Build.0 = Debug|x64 - {79A8B179-8CC3-4653-BD92-667FABA10B73}.Debug|x86.ActiveCfg = Debug|Win32 - {79A8B179-8CC3-4653-BD92-667FABA10B73}.Debug|x86.Build.0 = Debug|Win32 - {79A8B179-8CC3-4653-BD92-667FABA10B73}.Release|x64.ActiveCfg = Release|x64 - {79A8B179-8CC3-4653-BD92-667FABA10B73}.Release|x64.Build.0 = Release|x64 - {79A8B179-8CC3-4653-BD92-667FABA10B73}.Release|x86.ActiveCfg = Release|Win32 - {79A8B179-8CC3-4653-BD92-667FABA10B73}.Release|x86.Build.0 = Release|Win32 - {D253FCCB-21DD-4D82-B890-1622C570C615}.Debug|x64.ActiveCfg = Debug|x64 - {D253FCCB-21DD-4D82-B890-1622C570C615}.Debug|x64.Build.0 = Debug|x64 - {D253FCCB-21DD-4D82-B890-1622C570C615}.Debug|x86.ActiveCfg = Debug|Win32 - {D253FCCB-21DD-4D82-B890-1622C570C615}.Debug|x86.Build.0 = Debug|Win32 - {D253FCCB-21DD-4D82-B890-1622C570C615}.Release|x64.ActiveCfg = Release|x64 - {D253FCCB-21DD-4D82-B890-1622C570C615}.Release|x64.Build.0 = Release|x64 - {D253FCCB-21DD-4D82-B890-1622C570C615}.Release|x86.ActiveCfg = Release|Win32 - {D253FCCB-21DD-4D82-B890-1622C570C615}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {65465B65-389D-4A65-A601-C122547725DC} - EndGlobalSection -EndGlobal diff --git a/build/VS2019/GGPO/GGPO.vcxproj b/build/VS2019/GGPO/GGPO.vcxproj deleted file mode 100644 index 82415fb..0000000 --- a/build/VS2019/GGPO/GGPO.vcxproj +++ /dev/null @@ -1,179 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - - - - - - - - - - - - - - - - 16.0 - {79A8B179-8CC3-4653-BD92-667FABA10B73} - Win32Proj - GGPO - 10.0 - - - - StaticLibrary - true - v142 - Unicode - - - StaticLibrary - false - v142 - true - Unicode - - - StaticLibrary - true - v142 - Unicode - - - StaticLibrary - false - v142 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - - - true - - - false - - - false - - - - NotUsing - Level3 - Disabled - true - _WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - - - $(MSBuildProjectDirectory)\..\..\..\src\include;$(MSBuildProjectDirectory)\..\..\..\src\lib\ggpo;%(AdditionalIncludeDirectories) - - - Windows - true - - - - - NotUsing - Level3 - Disabled - true - _WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - - - $(MSBuildProjectDirectory)\..\..\..\src\include;$(MSBuildProjectDirectory)\..\..\..\src\lib\ggpo;%(AdditionalIncludeDirectories) - - - Windows - true - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - _WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - - - $(MSBuildProjectDirectory)\..\..\..\src\include;$(MSBuildProjectDirectory)\..\..\..\src\lib\ggpo;%(AdditionalIncludeDirectories) - - - Windows - true - true - true - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - _WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - - - $(MSBuildProjectDirectory)\..\..\..\src\include;$(MSBuildProjectDirectory)\..\..\..\src\lib\ggpo;%(AdditionalIncludeDirectories) - - - Windows - true - true - true - - - - - - \ No newline at end of file diff --git a/build/VS2019/GGPO/GGPO.vcxproj.filters b/build/VS2019/GGPO/GGPO.vcxproj.filters deleted file mode 100644 index e485121..0000000 --- a/build/VS2019/GGPO/GGPO.vcxproj.filters +++ /dev/null @@ -1,55 +0,0 @@ - - - - - {0d94886c-28b3-4f14-b73e-8d63a5cbb2d9} - - - {1a8a935e-99ee-4739-95ca-07bd478c0e35} - - - {6556380c-b6f9-4bf5-a381-d43b9a78bc76} - - - - - Source Files\Backends - - - Source Files\Backends - - - Source Files\Backends - - - Source Files\Network - - - Source Files\Network - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/build/VS2019/VectorWar/VectorWar.vcxproj b/build/VS2019/VectorWar/VectorWar.vcxproj deleted file mode 100644 index 50cca57..0000000 --- a/build/VS2019/VectorWar/VectorWar.vcxproj +++ /dev/null @@ -1,184 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 16.0 - {D253FCCB-21DD-4D82-B890-1622C570C615} - Win32Proj - VectorWar - 10.0 - - - - Application - true - v142 - Unicode - - - Application - false - v142 - true - Unicode - - - Application - true - v142 - Unicode - - - Application - false - v142 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - - - true - - - false - - - false - - - - - - Level3 - Disabled - true - _WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - $(MSBuildProjectDirectory)\..\..\..\src\include - - - Windows - true - $(TargetDir)GGPO.lib;ws2_32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - - - - - Level3 - Disabled - true - _WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - $(MSBuildProjectDirectory)\..\..\..\src\include - - - Windows - true - $(TargetDir)GGPO.lib;ws2_32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - - - - - Level3 - MaxSpeed - true - true - true - _WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - $(MSBuildProjectDirectory)\..\..\..\src\include - - - Windows - true - true - true - $(TargetDir)GGPO.lib;ws2_32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - - - - - Level3 - MaxSpeed - true - true - true - _WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - $(MSBuildProjectDirectory)\..\..\..\src\include - - - Windows - true - true - true - $(TargetDir)GGPO.lib;ws2_32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/build/VS2019/VectorWar/VectorWar.vcxproj.filters b/build/VS2019/VectorWar/VectorWar.vcxproj.filters deleted file mode 100644 index cd2a7ec..0000000 --- a/build/VS2019/VectorWar/VectorWar.vcxproj.filters +++ /dev/null @@ -1,61 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Resource Files - - - Resource Files - - - - - Resource Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/src/apps/vectorwar/CMakeLists.txt b/src/apps/vectorwar/CMakeLists.txt new file mode 100644 index 0000000..f92dd0d --- /dev/null +++ b/src/apps/vectorwar/CMakeLists.txt @@ -0,0 +1,24 @@ +set(VECTORWAR_APP + main.cpp + gamestate.h + gamestate.cpp + gdi_renderer.h + gdi_renderer.cpp + ggpo_perfmon.h + ggpo_perfmon.cpp + nongamestate.h + renderer.h + Resource.h + targetver.h + vectorwar.h + vectorwar.cpp + VectorWar.rc +) + +add_executable(vectorwar WIN32 ${VECTORWAR_APP}) + +# Change the character set to unicode. +add_definitions(-D_UNICODE -DUNICODE) + +# Link against GGPO, winmm (Windows Multimedia API), and ws2_32 (Winsock). +target_link_libraries(vectorwar LINK_PUBLIC ggpo winmm.lib ws2_32.lib) \ No newline at end of file diff --git a/src/apps/vectorwar/VectorWar.aps b/src/apps/vectorwar/VectorWar.aps deleted file mode 100644 index c7e178a..0000000 Binary files a/src/apps/vectorwar/VectorWar.aps and /dev/null differ