From 9b95c134a766995dbb90a38fcad618384c3170df Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 9 Apr 2015 09:14:53 +0200 Subject: [PATCH 1/5] - fixed: Lumps from a directory need to store the full file path so that they still can be accessed when the internal path is changed due to a filter directory. --- src/resourcefiles/file_directory.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/resourcefiles/file_directory.cpp b/src/resourcefiles/file_directory.cpp index f6adf0723..2be8da1b1 100644 --- a/src/resourcefiles/file_directory.cpp +++ b/src/resourcefiles/file_directory.cpp @@ -72,7 +72,7 @@ struct FDirectoryLump : public FResourceLump virtual FileReader *NewReader(); virtual int FillCache(); -private: + FString mFullPath; }; @@ -300,6 +300,8 @@ void FDirectory::AddEntry(const char *fullpath, int size) { FDirectoryLump *lump_p = &Lumps[Lumps.Reserve(1)]; + // Store the full path here so that we can access the file later, even if it is from a filter directory. + lump_p->mFullPath = fullpath; // The lump's name is only the part relative to the main directory lump_p->LumpNameSetup(fullpath + strlen(Filename)); lump_p->LumpSize = size; @@ -319,9 +321,7 @@ FileReader *FDirectoryLump::NewReader() { try { - FString fullpath = Owner->Filename; - fullpath += FullName; - return new FileReader(fullpath); + return new FileReader(mFullPath); } catch (CRecoverableError &) { @@ -339,6 +339,11 @@ int FDirectoryLump::FillCache() { Cache = new char[LumpSize]; FileReader *reader = NewReader(); + if (reader == NULL) + { + memset(Cache, 0, sizeof(Cache)); + return 0; + } reader->Read(Cache, LumpSize); delete reader; RefCount = 1; From 0c5d55d0a3f35889d9f51fc3dd8317eea7cbd5d4 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Thu, 9 Apr 2015 21:16:59 +0200 Subject: [PATCH 2/5] - More GAMENAME replacements in strings. These changes will change only some displayed messages. --- src/g_game.cpp | 8 ++++---- src/g_shared/shared_sbar.cpp | 2 +- src/posix/i_system.cpp | 4 ++-- src/sound/music_midi_timidity.cpp | 4 ++-- src/win32/i_cd.cpp | 4 ++-- src/win32/i_crash.cpp | 5 +---- src/win32/i_main.cpp | 4 ++-- src/win32/win32video.cpp | 2 +- 8 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/g_game.cpp b/src/g_game.cpp index c442ee875..8101ca23d 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -2516,7 +2516,7 @@ bool G_ProcessIFFDemo (FString &mapname) id = ReadLong (&demo_p); if (id != ZDEM_ID) { - Printf ("Not a ZDoom demo file!\n"); + Printf ("Not a " GAMENAME " demo file!\n"); return true; } @@ -2541,12 +2541,12 @@ bool G_ProcessIFFDemo (FString &mapname) demover = ReadWord (&demo_p); // ZDoom version demo was created with if (demover < MINDEMOVERSION) { - Printf ("Demo requires an older version of ZDoom!\n"); + Printf ("Demo requires an older version of " GAMENAME "!\n"); //return true; } if (ReadWord (&demo_p) > DEMOGAMEVERSION) // Minimum ZDoom version { - Printf ("Demo requires a newer version of ZDoom!\n"); + Printf ("Demo requires a newer version of " GAMENAME "!\n"); return true; } if (demover >= 0x21a) @@ -2673,7 +2673,7 @@ void G_DoPlayDemo (void) if (ReadLong (&demo_p) != FORM_ID) { - const char *eek = "Cannot play non-ZDoom demos.\n"; + const char *eek = "Cannot play non-" GAMENAME " demos.\n"; C_ForgetCVars(); M_Free(demobuffer); diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index d8e113824..c0442fc74 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -1502,7 +1502,7 @@ void DBaseStatusBar::DrawTopStuff (EHudState state) { screen->DrawText (SmallFont, CR_TAN, 0, ST_Y - 40 * CleanYfac, "Demo was recorded with a different version\n" - "of ZDoom. Expect it to go out of sync.", + "of " GAMENAME ". Expect it to go out of sync.", DTA_CleanNoMove, true, TAG_DONE); } diff --git a/src/posix/i_system.cpp b/src/posix/i_system.cpp index 0a1b2f69a..fd6bb4c0c 100644 --- a/src/posix/i_system.cpp +++ b/src/posix/i_system.cpp @@ -331,7 +331,7 @@ int I_PickIWad_Gtk (WadStuff *wads, int numwads, bool showwin, int defaultiwad) gtk_container_add (GTK_CONTAINER(window), vbox); // Create the top label. - widget = gtk_label_new ("ZDoom found more than one IWAD\nSelect from the list below to determine which one to use:"); + widget = gtk_label_new (GAMENAME " found more than one IWAD\nSelect from the list below to determine which one to use:"); gtk_box_pack_start (GTK_BOX(vbox), widget, false, false, 0); gtk_misc_set_alignment (GTK_MISC(widget), 0, 0); @@ -450,7 +450,7 @@ int I_PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad) { FString cmd("kdialog --title \"" GAMESIG " "); cmd << GetVersionString() << ": Select an IWAD to use\"" - " --menu \"ZDoom found more than one IWAD\n" + " --menu \"" GAMENAME " found more than one IWAD\n" "Select from the list below to determine which one to use:\""; for(i = 0; i < numwads; ++i) diff --git a/src/sound/music_midi_timidity.cpp b/src/sound/music_midi_timidity.cpp index 38ba8557e..3ce8d89d3 100644 --- a/src/sound/music_midi_timidity.cpp +++ b/src/sound/music_midi_timidity.cpp @@ -22,7 +22,7 @@ void ChildSigHandler (int signum) #ifdef _WIN32 BOOL SafeTerminateProcess(HANDLE hProcess, UINT uExitCode); -static char TimidityTitle[] = "TiMidity (ZDoom Launched)"; +static char TimidityTitle[] = "TiMidity (" GAMENAME " Launched)"; const char TimidityPPMIDIDevice::EventName[] = "TiMidity Killer"; CVAR (String, timidity_exe, "timidity.exe", CVAR_ARCHIVE|CVAR_GLOBALCONFIG) @@ -347,7 +347,7 @@ bool TimidityPPMIDIDevice::ValidateTimidity() } if (!good) { - Printf(PRINT_BOLD, "ZDoom requires a special version of TiMidity++\n"); + Printf(PRINT_BOLD, GAMENAME " requires a special version of TiMidity++\n"); } UnmapViewOfFile((LPVOID)exeBase); diff --git a/src/win32/i_cd.cpp b/src/win32/i_cd.cpp index b4982b865..32477f2dd 100644 --- a/src/win32/i_cd.cpp +++ b/src/win32/i_cd.cpp @@ -175,7 +175,7 @@ bool FCDThread::Init () CD_WindowClass.style = CS_NOCLOSE; CD_WindowClass.lpfnWndProc = CD_WndProc; CD_WindowClass.hInstance = g_hInst; - CD_WindowClass.lpszClassName = "ZDoom CD Player"; + CD_WindowClass.lpszClassName = GAMENAME " CD Player"; CD_WindowAtom = RegisterClass (&CD_WindowClass); if (CD_WindowAtom == 0) @@ -183,7 +183,7 @@ bool FCDThread::Init () CD_Window = CreateWindow ( (LPCTSTR)(INT_PTR)(int)CD_WindowAtom, - "ZDoom CD Player", + GAMENAME " CD Player", 0, 0, 0, 10, 10, NULL, diff --git a/src/win32/i_crash.cpp b/src/win32/i_crash.cpp index 453549ab7..0735e3553 100644 --- a/src/win32/i_crash.cpp +++ b/src/win32/i_crash.cpp @@ -125,10 +125,7 @@ RtlVirtualUnwind ( #define UPLOAD_BOUNDARY "Von-DnrNbJl0 P9d_BD;cEEsQVWpYMq0pbZ6NUmYHus;yIbFbkgB?.N=YC5O=BGZm+Rab5" #define DBGHELP_URI "/msredist/dbghelp.dl_" -// If you are working on your own modified version of ZDoom, change -// the last part of the UPLOAD_AGENT (between parentheses) to your -// own program's name. e.g. (Skulltag) or (ZDaemon) or (ZDoomFu) -#define UPLOAD_AGENT "ZDoom/" VERSIONSTR " (" GAMESIG ")" +#define UPLOAD_AGENT GAMENAME "/" VERSIONSTR " (" GAMESIG ")" // Time, in milliseconds, to wait for a send() or recv() to complete. #define TIMEOUT 60000 diff --git a/src/win32/i_main.cpp b/src/win32/i_main.cpp index c63e7bc1c..ea167428f 100644 --- a/src/win32/i_main.cpp +++ b/src/win32/i_main.cpp @@ -143,7 +143,7 @@ LONG ErrorIconChar; // PRIVATE DATA DEFINITIONS ------------------------------------------------ -static const char WinClassName[] = "ZDoomMainWindow"; +static const char WinClassName[] = GAMENAME "MainWindow"; static HMODULE hwtsapi32; // handle to wtsapi32.dll static void (*TermFuncs[MAX_TERMS])(void); static int NumTerms; @@ -1224,7 +1224,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE nothing, LPSTR cmdline, int n // This should only happen on basic Windows 95 installations, but since we // don't support Windows 95, we have no obligation to provide assistance in // getting it installed. - MessageBoxA(NULL, "Could not load riched20.dll", "ZDoom Error", MB_OK | MB_ICONSTOP); + MessageBoxA(NULL, "Could not load riched20.dll", GAMENAME " Error", MB_OK | MB_ICONSTOP); exit(0); } diff --git a/src/win32/win32video.cpp b/src/win32/win32video.cpp index b6d6d670e..3420ec0da 100644 --- a/src/win32/win32video.cpp +++ b/src/win32/win32video.cpp @@ -301,7 +301,7 @@ void Win32Video::InitDDraw () DDraw->Release (); DDraw = NULL; I_FatalError ("DirectDraw returned no display modes.\n\n" - "If you started ZDoom from a fullscreen DOS box, run it from " + "If you started " GAMENAME " from a fullscreen DOS box, run it from " "a DOS window instead. If that does not work, you may need to reboot."); } if (Args->CheckParm ("-2")) From a81dd798a82acc12ec1c561964b46ec30672e29d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 11 Apr 2015 14:35:32 +0200 Subject: [PATCH 3/5] - fixed incorrect memset argument. --- src/resourcefiles/file_directory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resourcefiles/file_directory.cpp b/src/resourcefiles/file_directory.cpp index 2be8da1b1..8b85425f1 100644 --- a/src/resourcefiles/file_directory.cpp +++ b/src/resourcefiles/file_directory.cpp @@ -341,7 +341,7 @@ int FDirectoryLump::FillCache() FileReader *reader = NewReader(); if (reader == NULL) { - memset(Cache, 0, sizeof(Cache)); + memset(Cache, 0, LumpSize); return 0; } reader->Read(Cache, LumpSize); From 0a1d1db0ba4e4f23c655b9b1a84da56324683495 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 11 Apr 2015 17:40:26 +0200 Subject: [PATCH 4/5] =?UTF-8?q?-=20fixed=20missing=20#inc=C3=B6udes=20of?= =?UTF-8?q?=20version.h=20for=20GAMENAME.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sound/music_midi_timidity.cpp | 3 +++ src/win32/i_cd.cpp | 1 + src/win32/win32video.cpp | 1 + 3 files changed, 5 insertions(+) diff --git a/src/sound/music_midi_timidity.cpp b/src/sound/music_midi_timidity.cpp index 3ce8d89d3..a8c099d52 100644 --- a/src/sound/music_midi_timidity.cpp +++ b/src/sound/music_midi_timidity.cpp @@ -2,6 +2,7 @@ #include "c_cvars.h" #include "cmdlib.h" #include "templates.h" +#include "version.h" #ifndef _WIN32 #include @@ -20,6 +21,8 @@ void ChildSigHandler (int signum) #endif #ifdef _WIN32 + + BOOL SafeTerminateProcess(HANDLE hProcess, UINT uExitCode); static char TimidityTitle[] = "TiMidity (" GAMENAME " Launched)"; diff --git a/src/win32/i_cd.cpp b/src/win32/i_cd.cpp index 32477f2dd..29167f276 100644 --- a/src/win32/i_cd.cpp +++ b/src/win32/i_cd.cpp @@ -45,6 +45,7 @@ #include "c_dispatch.h" #include "m_argv.h" #include "i_system.h" +#include "version.h" #include "i_cd.h" #include "helperthread.h" diff --git a/src/win32/win32video.cpp b/src/win32/win32video.cpp index 3420ec0da..3071ae8e7 100644 --- a/src/win32/win32video.cpp +++ b/src/win32/win32video.cpp @@ -70,6 +70,7 @@ #include "r_defs.h" #include "v_text.h" #include "r_swrenderer.h" +#include "version.h" #include "win32iface.h" From 9f2b3efd13c513d06ad7a647766d6618d64deb82 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 11 Apr 2015 18:09:18 +0200 Subject: [PATCH 5/5] - fixed: The terrain types array needs to be extended if a texture outside its bounds is processed - this can happen for textures with long names. --- src/p_terrain.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/p_terrain.h b/src/p_terrain.h index 9f00d07bc..482c66b00 100644 --- a/src/p_terrain.h +++ b/src/p_terrain.h @@ -69,6 +69,12 @@ public: } void Set(int index, int value) { + if ((unsigned)index >= Types.Size()) + { + int oldsize = Types.Size(); + Resize(index + 1); + memset(&Types[oldsize], 0xff, (index + 1 - oldsize)*sizeof(WORD)); + } Types[index] = value; } };