Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/bugfix_release'
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlaux committed Dec 11, 2023
2 parents ea556e5 + d896eba commit 4431c27
Show file tree
Hide file tree
Showing 24 changed files with 572 additions and 331 deletions.
1 change: 1 addition & 0 deletions .github/workflows/win_msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
-DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET="${{ matrix.config.arch }}-windows-static-release" `
-DVCPKG_OVERLAY_TRIPLETS="cmake/triplets" `
-DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded `
-DCMAKE_IGNORE_PATH="C:/Strawberry/perl/bin;C:/Strawberry/c/lib"
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion setup/multiplayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ static void AddWADs(execute_context_t *exec)
have_wads = 1;
}

AddCmdLineParameter(exec, "\"%s\"", wads[i]);
AddCmdLineParameter(exec, "%s", wads[i]);
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,9 +688,11 @@ void D_AddFile(const char *file)
if (D_AddZipFile(path))
return;

if (numwadfiles >= numwadfiles_alloc)
wadfiles = I_Realloc(wadfiles, (numwadfiles_alloc = numwadfiles_alloc ?
numwadfiles_alloc * 2 : 8)*sizeof*wadfiles);
if (numwadfiles == numwadfiles_alloc - 1 || !numwadfiles_alloc)
{
numwadfiles_alloc = (numwadfiles_alloc ? numwadfiles_alloc * 2 : 8);
wadfiles = I_Realloc(wadfiles, numwadfiles_alloc * sizeof(*wadfiles));
}
// [FG] search for PWADs by their filename
wadfiles[numwadfiles++] = path;
wadfiles[numwadfiles] = NULL;
Expand Down
15 changes: 10 additions & 5 deletions src/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -2091,7 +2091,6 @@ static void G_DoLoadGame(void)
int length, i;
char vcheck[VERSIONSIZE];
uint64_t checksum;
byte saveg_complevel = 203;
int tmp_compat, tmp_skill, tmp_epi, tmp_map;

I_SetFastdemoTimer(false);
Expand Down Expand Up @@ -2138,7 +2137,11 @@ static void G_DoLoadGame(void)

if (saveg_compat > saveg_woof510)
{
saveg_complevel = *save_p++;
demo_version = *save_p++;
}
else
{
demo_version = 203;
}

// killough 2/14/98: load compatibility mode
Expand Down Expand Up @@ -2183,7 +2186,7 @@ static void G_DoLoadGame(void)
idmusnum = *(signed char *) save_p++;

/* cph 2001/05/23 - Must read options before we set up the level */
if (saveg_complevel == 221)
if (mbf21)
G_ReadOptionsMBF21(save_p);
else
G_ReadOptions(save_p);
Expand All @@ -2195,7 +2198,7 @@ static void G_DoLoadGame(void)
// killough 11/98: move down to here
/* cph - MBF needs to reread the savegame options because G_InitNew
* rereads the WAD options. The demo playback code does this too. */
if (saveg_complevel == 221)
if (mbf21)
save_p = G_ReadOptionsMBF21(save_p);
else
save_p = G_ReadOptions(save_p);
Expand Down Expand Up @@ -2239,7 +2242,9 @@ static void G_DoLoadGame(void)

if (lump[0] && i > 0)
{
memset(&musinfo, 0, sizeof(musinfo));
musinfo.mapthing = NULL;
musinfo.lastmapthing = NULL;
musinfo.tics = 0;
musinfo.current_item = i;
musinfo.from_savegame = true;
S_ChangeMusInfoMusic(i, true);
Expand Down
21 changes: 19 additions & 2 deletions src/i_flmusic.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "w_wad.h"
#include "z_zone.h"
#include "i_glob.h"
#include "d_iwad.h" // [FG] D_DoomExeDir()

char *soundfont_path = "";
char *soundfont_dir = "";
Expand Down Expand Up @@ -124,8 +125,19 @@ static void AddSoundFont(const char *path)

static void ScanDir(const char *dir)
{
glob_t *glob = I_StartMultiGlob(dir, GLOB_FLAG_NOCASE|GLOB_FLAG_SORTED,
"*.sf2", "*.sf3", NULL);
char *rel = NULL;
glob_t *glob;

// [FG] relative to the executable directory
if (dir[0] == '.')
{
rel = M_StringJoin(D_DoomExeDir(), DIR_SEPARATOR_S, dir, NULL);
dir = rel;
}

glob = I_StartMultiGlob(dir, GLOB_FLAG_NOCASE|GLOB_FLAG_SORTED,
"*.sf2", "*.sf3", NULL);

while(1)
{
const char *filename = I_NextGlob(glob);
Expand All @@ -139,6 +151,11 @@ static void ScanDir(const char *dir)
}

I_EndGlob(glob);

if (rel)
{
free(rel);
}
}

static void GetSoundFonts(void)
Expand Down
9 changes: 8 additions & 1 deletion src/i_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
//
//-----------------------------------------------------------------------------

#include <stdio.h>
#include "config.h"

#include "SDL.h" // haleyjd

#include "i_printf.h"
#include "i_system.h"
#include "m_argv.h"
#include "version.h"

Expand All @@ -34,6 +34,13 @@

void D_DoomMain(void);

#if defined(WIN_LAUNCHER)
__declspec(dllexport) void NuggetDoom_Exit(void)
{
I_SafeExit(0);
}
#endif

#if defined(WIN_LAUNCHER)
__declspec(dllexport) int NuggetDoom_Main(int argc, char **argv)
#else
Expand Down
2 changes: 1 addition & 1 deletion src/i_oalsound.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ boolean I_OAL_CacheSound(sfxinfo_t *sfx)
lumplen = W_LumpLength(lumpnum);

// Check the header, and ensure this is a valid sound
if (lumpdata[0] == 0x03 && lumpdata[1] == 0x00)
if (lumplen > DMXHDRSIZE && lumpdata[0] == 0x03 && lumpdata[1] == 0x00)
{
freq = (lumpdata[3] << 8) | lumpdata[2];
size = (lumpdata[7] << 24) | (lumpdata[6] << 16) |
Expand Down
16 changes: 10 additions & 6 deletions src/i_printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ verbosity_t cfg_verbosity;
#ifdef _WIN32
static HANDLE hConsole;
static DWORD OldMode;
static boolean restore_mode = false;
static boolean vt_mode_enabled = false;

static void EnableVTMode(void)
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
if (hConsole == INVALID_HANDLE_VALUE)
{
return;
Expand All @@ -74,17 +74,17 @@ static void EnableVTMode(void)
}

if (!SetConsoleMode(hConsole, ENABLE_PROCESSED_OUTPUT |
ENABLE_VIRTUAL_TERMINAL_PROCESSING));
ENABLE_VIRTUAL_TERMINAL_PROCESSING))
{
return;
}

restore_mode = true;
vt_mode_enabled = true;
}

static void RestoreOldMode(void)
{
if (!restore_mode)
if (!vt_mode_enabled)
{
return;
}
Expand Down Expand Up @@ -142,7 +142,11 @@ void I_Printf(verbosity_t prio, const char *msg, ...)
break;
}

if (I_ConsoleStdout())
if (I_ConsoleStdout()
#ifdef _WIN32
&& vt_mode_enabled
#endif
)
{
switch (prio)
{
Expand Down
Loading

0 comments on commit 4431c27

Please sign in to comment.