i_system.c -> cpp, disable mumble

This commit is contained in:
Eidolon 2023-10-14 15:22:19 -05:00
parent 61a021ce4a
commit 2d614781eb
7 changed files with 48 additions and 15 deletions

View file

@ -32,6 +32,7 @@
#include "r_picformats.h"
#include "r_things.h" // R_Char2Frame
#include "r_sky.h"
#include "s_sound.h"
#include "fastcmp.h"
#include "lua_script.h" // Reluctantly included for LUA_EvalMath
#include "d_clisrv.h"

View file

@ -23,6 +23,7 @@
#include "k_menu.h" // gametype_cons_t
#include "r_things.h" // skins
#include "mserv.h" // cv_advertise
#include "s_sound.h"
#include "z_zone.h"
#include "byteptr.h"
#include "stun.h"

View file

@ -24,6 +24,7 @@
#include "p_local.h"
#include "p_mobj.h"
#include "r_textures.h"
#include "s_sound.h"
#include "w_wad.h"
#include "z_zone.h"

View file

@ -7,6 +7,7 @@
#include "../i_video.h" // I_UpdateNoBlit
#include "../m_misc.h" // NUMLOGIP
#include "../f_finale.h" // g_wipeskiprender
#include "../s_sound.h"
menuitem_t PLAY_MP_JoinIP[] =
{

View file

@ -30,6 +30,7 @@
#include "m_cond.h"
#include "k_kart.h"
#include "m_random.h"
#include "s_sound.h"
#if 0
#include "k_kart.h" // K_KartResetPlayerColor
#endif

View file

@ -7,7 +7,7 @@ target_sources(SRB2SDL2 PRIVATE
rhi_gl3_core_platform.hpp
i_threads.c
i_net.c
i_system.c
i_system.cpp
i_main.cpp
i_video.cpp
dosstr.c
@ -92,6 +92,9 @@ endif()
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXER -DSOUND=SOUND_MIXER)
target_compile_definitions(SRB2SDL2 PRIVATE -DDIRECTFULLSCREEN -DHAVE_SDL)
# NOMUMBLE till WRITE* macros are fixed for C++ or mumble integration is rewritten
target_compile_definitions(SRB2SDL2 PRIVATE -DNOMUMBLE)
#### Installation ####
if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin)
install(TARGETS SRB2SDL2

View file

@ -23,6 +23,8 @@
/// \file
/// \brief SRB2 system stuff for SDL
#include <thread>
#include <signal.h>
#ifdef _WIN32
@ -168,6 +170,8 @@ static char returnWadPath[256];
#include "../d_net.h"
#include "../g_game.h"
#include "../filesrch.h"
#include "../s_sound.h"
#include "../core/thread_pool.h"
#include "endtxt.h"
#include "sdlmain.h"
@ -194,6 +198,8 @@ static char returnWadPath[256];
#include "../byteptr.h"
#endif
static std::thread::id g_main_thread_id;
/** \brief SDL info about joysticks
*/
SDLJoyInfo_t JoyInfo[MAXSPLITSCREENPLAYERS];
@ -423,6 +429,14 @@ static void I_ReportSignal(int num, int coredumped)
#ifndef NEWSIGNALHANDLER
FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
{
if (g_main_thread_id != std::this_thread::get_id())
{
// Do not attempt any sort of recovery if this signal triggers off the main thread
signal(num, SIG_DFL);
raise(num);
exit(-2);
}
D_QuitNetGame(); // Fix server freezes
CL_AbortDownloadResume();
G_DirtyGameData();
@ -799,6 +813,8 @@ static inline void I_ShutdownConsole(void){}
//
static void I_RegisterSignals (void)
{
g_main_thread_id = std::this_thread::get_id();
#ifdef SIGINT
signal(SIGINT , quit_handler);
#endif
@ -910,7 +926,7 @@ void I_OutputMsg(const char *fmt, ...)
return;
}
ReadConsoleOutputCharacter(co, oldLines, oldLength, coordNextWrite, &bytesWritten);
ReadConsoleOutputCharacter(co, (LPSTR)oldLines, oldLength, coordNextWrite, &bytesWritten);
// Move to where we what to print - which is where we would've been,
// had console input not been in the way,
@ -1251,7 +1267,8 @@ const char *I_GetJoyName(INT32 joyindex)
tempname = SDL_JoystickNameForIndex(joyindex);
if (tempname)
{
strncpy(joyname, tempname, 255);
strncpy(joyname, tempname, 254);
joyname[254] = 0;
}
return joyname;
@ -1267,7 +1284,7 @@ const char *I_GetJoyName(INT32 joyindex)
#define DEG2RAD (0.017453292519943295769236907684883l) // TAU/360 or PI/180
#define MUMBLEUNIT (64.0f) // FRACUNITS in a Meter
static struct {
static struct mumble_s {
#ifdef WINMUMBLE
UINT32 uiVersion;
DWORD uiTick;
@ -1300,7 +1317,7 @@ static void I_SetupMumble(void)
if (!hMap)
return;
mumble = MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(*mumble));
mumble = static_cast<mumble_s*>(MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(*mumble)));
if (!mumble)
CloseHandle(hMap);
#elif defined (HAVE_SHM)
@ -1587,6 +1604,8 @@ INT32 I_StartupSystem(void)
#ifdef HAVE_THREADS
I_start_threads();
I_AddExitFunc(I_stop_threads);
I_ThreadPoolInit();
I_AddExitFunc(I_ThreadPoolShutdown);
#endif
I_StartupConsole();
#ifdef NEWSIGNALHANDLER
@ -1693,6 +1712,12 @@ void I_Error(const char *error, ...)
va_list argptr;
char buffer[8192];
if (std::this_thread::get_id() != g_main_thread_id)
{
// Do not attempt a graceful shutdown. Errors off the main thread are unresolvable.
exit(-2);
}
// recursive error detecting
if (shutdowning)
{
@ -2074,7 +2099,7 @@ const char *I_ClipboardPaste(void)
*/
static boolean isWadPathOk(const char *path)
{
char *wad3path = malloc(256);
char *wad3path = static_cast<char*>(malloc(256));
if (!wad3path)
return false;