From e485caa60559444da5fb5891c090c6a6015ead3c Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Tue, 20 Jul 2021 15:47:21 +0200 Subject: [PATCH] First modifications to make the engine code compile for PS4 (Orbis SDK). All the code compiles, but we're missing the FMOD linker libraries at the moment. --- engine/Quake/arch_def.h | 6 + engine/Quake/host_cmd.c | 16 ++- engine/Quake/net_sys.h | 20 +++ engine/Windows/VisualStudio/uniquake.sln | 9 ++ engine/Windows/VisualStudio/uniquake.vcxproj | 133 +++++++++++++++++++ 5 files changed, 178 insertions(+), 6 deletions(-) diff --git a/engine/Quake/arch_def.h b/engine/Quake/arch_def.h index 4a27d9a..3ae79af 100644 --- a/engine/Quake/arch_def.h +++ b/engine/Quake/arch_def.h @@ -72,6 +72,12 @@ # define PLATFORM_RISCOS 1 # endif +#elif defined(__ORBIS__) + +# if !defined(PLATFORM_ORBIS) +# define PLATFORM_ORBIS 1 +# endif + #else /* here goes the unix platforms */ #if defined(__unix) || defined(__unix__) || defined(unix) || \ diff --git a/engine/Quake/host_cmd.c b/engine/Quake/host_cmd.c index c7dae53..f0dba67 100644 --- a/engine/Quake/host_cmd.c +++ b/engine/Quake/host_cmd.c @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "quakedef.h" -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__ORBIS__) #include #endif @@ -119,7 +119,7 @@ void ExtraMaps_Init (void) #ifdef _WIN32 WIN32_FIND_DATA fdat; HANDLE fhnd; -#else +#elif defined(DIR) DIR *dir_p; struct dirent *dir_t; #endif @@ -149,7 +149,7 @@ void ExtraMaps_Init (void) ExtraMaps_Add (mapname); } while (FindNextFile(fhnd, &fdat)); FindClose(fhnd); -#else +#elif defined(DIR) q_snprintf (filestring, sizeof(filestring), "%s/maps/", search->filename); dir_p = opendir(filestring); if (dir_p == NULL) @@ -252,7 +252,7 @@ void Modlist_Init (void) FindClose(fhnd); } -#else +#elif defined(DIR) void Modlist_Init (void) { DIR *dir_p, *mod_dir_p; @@ -281,6 +281,10 @@ void Modlist_Init (void) closedir(dir_p); } +#else +void Modlist_Init(void) +{ +} #endif //============================================================================== @@ -306,7 +310,7 @@ void DemoList_Init (void) #ifdef _WIN32 WIN32_FIND_DATA fdat; HANDLE fhnd; -#else +#elif defined(DIR) DIR *dir_p; struct dirent *dir_t; #endif @@ -336,7 +340,7 @@ void DemoList_Init (void) FileList_Add (demname, &demolist); } while (FindNextFile(fhnd, &fdat)); FindClose(fhnd); -#else +#elif defined(DIR) q_snprintf (filestring, sizeof(filestring), "%s/", search->filename); dir_p = opendir(filestring); if (dir_p == NULL) diff --git a/engine/Quake/net_sys.h b/engine/Quake/net_sys.h index 77727e3..3ac8c4b 100644 --- a/engine/Quake/net_sys.h +++ b/engine/Quake/net_sys.h @@ -175,6 +175,26 @@ COMPILE_TIME_ASSERT(sockaddr, offsetof(struct sockaddr, sa_family) == SA_FAM_OFF #endif /* end of windows stuff */ +#if defined(PLATFORM_ORBIS) + +typedef int sys_socket_t; +#define INVALID_SOCKET (-1) +#define SOCKET_ERROR (-1) + +typedef int socklen_t; + +#define SOCKETERRNO errno +#define ioctlsocket ioctl +#define closesocket close +#define selectsocket select +#define IOCTLARG_P(x) /* (char *) */ x + +#define NET_EWOULDBLOCK EWOULDBLOCK +#define NET_ECONNREFUSED ECONNREFUSED + +#define socketerror(x) strerror((x)) + +#endif /* macros which may still be missing */ diff --git a/engine/Windows/VisualStudio/uniquake.sln b/engine/Windows/VisualStudio/uniquake.sln index 7d7b892..616ade4 100644 --- a/engine/Windows/VisualStudio/uniquake.sln +++ b/engine/Windows/VisualStudio/uniquake.sln @@ -7,22 +7,31 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "uniquake", "uniquake.vcxpro EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug Portable|ORBIS = Debug Portable|ORBIS Debug Portable|x64 = Debug Portable|x64 Debug Portable|x86 = Debug Portable|x86 + Debug|ORBIS = Debug|ORBIS Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|ORBIS = Release|ORBIS Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AE77266F-0A23-4F08-A491-369DE664B273}.Debug Portable|ORBIS.ActiveCfg = Debug Portable|ORBIS + {AE77266F-0A23-4F08-A491-369DE664B273}.Debug Portable|ORBIS.Build.0 = Debug Portable|ORBIS {AE77266F-0A23-4F08-A491-369DE664B273}.Debug Portable|x64.ActiveCfg = Debug Portable|x64 {AE77266F-0A23-4F08-A491-369DE664B273}.Debug Portable|x64.Build.0 = Debug Portable|x64 {AE77266F-0A23-4F08-A491-369DE664B273}.Debug Portable|x86.ActiveCfg = Debug Portable|Win32 {AE77266F-0A23-4F08-A491-369DE664B273}.Debug Portable|x86.Build.0 = Debug Portable|Win32 + {AE77266F-0A23-4F08-A491-369DE664B273}.Debug|ORBIS.ActiveCfg = Debug|ORBIS + {AE77266F-0A23-4F08-A491-369DE664B273}.Debug|ORBIS.Build.0 = Debug|ORBIS {AE77266F-0A23-4F08-A491-369DE664B273}.Debug|x64.ActiveCfg = Debug|x64 {AE77266F-0A23-4F08-A491-369DE664B273}.Debug|x64.Build.0 = Debug|x64 {AE77266F-0A23-4F08-A491-369DE664B273}.Debug|x86.ActiveCfg = Debug|Win32 {AE77266F-0A23-4F08-A491-369DE664B273}.Debug|x86.Build.0 = Debug|Win32 + {AE77266F-0A23-4F08-A491-369DE664B273}.Release|ORBIS.ActiveCfg = Release|ORBIS + {AE77266F-0A23-4F08-A491-369DE664B273}.Release|ORBIS.Build.0 = Release|ORBIS {AE77266F-0A23-4F08-A491-369DE664B273}.Release|x64.ActiveCfg = Release|x64 {AE77266F-0A23-4F08-A491-369DE664B273}.Release|x64.Build.0 = Release|x64 {AE77266F-0A23-4F08-A491-369DE664B273}.Release|x86.ActiveCfg = Release|Win32 diff --git a/engine/Windows/VisualStudio/uniquake.vcxproj b/engine/Windows/VisualStudio/uniquake.vcxproj index fdafb65..c391340 100644 --- a/engine/Windows/VisualStudio/uniquake.vcxproj +++ b/engine/Windows/VisualStudio/uniquake.vcxproj @@ -1,6 +1,10 @@ + + Debug Portable + ORBIS + Debug Portable Win32 @@ -9,6 +13,10 @@ Debug Portable x64 + + Debug + ORBIS + Debug Win32 @@ -17,6 +25,10 @@ Debug x64 + + Release + ORBIS + Release Win32 @@ -55,16 +67,32 @@ NotSet true + + Application + v141 + NotSet + true + DynamicLibrary v141 NotSet + + DynamicLibrary + v141 + NotSet + DynamicLibrary v141 NotSet + + DynamicLibrary + v141 + NotSet + @@ -80,12 +108,21 @@ + + + + + + + + + <_ProjectFileVersion>15.0.28307.799 @@ -110,16 +147,31 @@ Build-$(ProjectName)\$(Platform)\$(Configuration)\ true + + $(SolutionDir)Build-$(ProjectName)\$(Platform)\$(Configuration)\ + Build-$(ProjectName)\$(Platform)\$(Configuration)\ + true + $(SolutionDir)Build-$(ProjectName)\$(Platform)\$(Configuration)\ Build-$(ProjectName)\$(Platform)\$(Configuration)\ true + + $(SolutionDir)Build-$(ProjectName)\$(Platform)\$(Configuration)\ + Build-$(ProjectName)\$(Platform)\$(Configuration)\ + true + $(SolutionDir)Build-$(ProjectName)\$(Platform)\$(Configuration)\ Build-$(ProjectName)\$(Platform)\$(Configuration)\ false + + $(SolutionDir)Build-$(ProjectName)\$(Platform)\$(Configuration)\ + Build-$(ProjectName)\$(Platform)\$(Configuration)\ + false + Disabled @@ -226,6 +278,32 @@ copy "$(SolutionDir)\..\SDL2\lib\*.dll" "$(TargetDir)" copy $(TargetDir)$(TargetName).dll $(SolutionDir)..\..\..\Assets\Plugins\windows\x86_64\uniquake.dll + + + + Disabled + ..\SDL2\include;..\..\FMOD\inc;..\..\Quake;%(AdditionalIncludeDirectories) + UNIQUAKE_EXPORTS;USE_LIBSDL;USE_OPENGL;WIN32;_DEBUG;_WINDOWS;_USE_WINSOCK2;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_SDL2;USE_FMOD;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + CompileAsC + + + ws2_32.lib;opengl32.lib;winmm.lib;SDL2.lib;SDL2main.lib;fmodL_vc.lib;%(AdditionalDependencies) + ..\..\FMOD\lib\x64;..\SDL2\lib64;%(AdditionalLibraryDirectories) + msvcrt.lib;%(IgnoreSpecificDefaultLibraries) + true + Windows + + + copy $(TargetDir)$(TargetName).dll $(SolutionDir)..\..\..\Assets\Plugins\windows\x86_64\uniquake.dll + + X64 @@ -255,6 +333,33 @@ copy "$(SolutionDir)\..\SDL2\lib\*.dll" "$(TargetDir)" copy "$(TargetDir)$(TargetName).dll" $(SolutionDir)..\..\..\Assets\Plugins\windows\x86_64\uniquake.dll + + + + Disabled + ..\..\UniQuake\stub;..\..\FMOD\inc;..\..\Quake;%(AdditionalIncludeDirectories) + UNIQUAKE_EXPORTS;WIN32;_DEBUG;_WINDOWS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FMOD;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + CompileAsC + C11 + + + libScePosix_stub_weak.a;%(AdditionalDependencies) + ..\..\FMOD\lib\orbis;%(AdditionalLibraryDirectories) + msvcrt.lib;%(IgnoreSpecificDefaultLibraries) + true + Windows + + + copy "$(TargetDir)$(TargetName).prx" $(SolutionDir)..\..\..\Assets\Plugins\orbis\uniquake.prx + + X64 @@ -282,6 +387,34 @@ copy "$(SolutionDir)\..\SDL2\lib\*.dll" "$(TargetDir)" copy "$(SolutionDir)\..\codecs\x64\*.dll" "$(TargetDir)" +copy "$(SolutionDir)\..\SDL2\lib64\*.dll" "$(TargetDir)" + + + + + + MaxSpeed + true + ..\SDL2\include;..\codecs\include;..\misc\include;..\..\Quake;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USE_WINSOCK2;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_SDL2;USE_CODEC_MP3;USE_CODEC_VORBIS;USE_CODEC_WAVE;USE_CODEC_FLAC;USE_CODEC_OPUS;USE_CODEC_MIKMOD;USE_CODEC_UMX;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + CompileAsC + + + libvorbisfile.lib;libvorbis.lib;libopusfile.lib;libopus.lib;libFLAC.lib;libogg.lib;libmad.lib;libmikmod.lib;ws2_32.lib;opengl32.lib;winmm.lib;SDL2.lib;SDL2main.lib;%(AdditionalDependencies) + ..\codecs\x64;..\SDL2\lib64;%(AdditionalLibraryDirectories) + true + Windows + true + true + + + copy "$(SolutionDir)\..\codecs\x64\*.dll" "$(TargetDir)" copy "$(SolutionDir)\..\SDL2\lib64\*.dll" "$(TargetDir)"