From 653bf3a0b5c78c7106ea8c9d48c3bb300c0481aa Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 1 Dec 2008 21:08:23 +0000 Subject: Don't try to read SDL events until initialised. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1394 --- src/i_video.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/i_video.c b/src/i_video.c index 0fe25736..a4129aba 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -20,7 +20,7 @@ // 02111-1307, USA. // // DESCRIPTION: -// DOOM graphics stuff for X11, UNIX. +// DOOM graphics stuff for SDL. // //----------------------------------------------------------------------------- @@ -588,6 +588,11 @@ static void I_ReadMouse(void) // void I_StartTic (void) { + if (!initialised) + { + return; + } + I_GetEvent(); if (usemouse && !nomouse) -- cgit v1.2.3 From 3fd9acf6e0d664858162ac369ae8670f40edea11 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 3 Dec 2008 22:09:22 +0000 Subject: Use FILE_MAP_COPY instead of FILE_MAP_ALL_ACCESS for mapping files (thanks to Christian Chech). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1407 --- src/w_file_win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/w_file_win32.c b/src/w_file_win32.c index 0ec6b56c..05d3c445 100644 --- a/src/w_file_win32.c +++ b/src/w_file_win32.c @@ -61,7 +61,7 @@ static void MapFile(win32_wad_file_t *wad, char *filename) } wad->wad.mapped = MapViewOfFile(wad->handle_map, - FILE_MAP_ALL_ACCESS, + FILE_MAP_COPY, 0, 0, 0); if (wad->wad.mapped == NULL) -- cgit v1.2.3 From a0062502d183d5d526c1f801b1206234b664898b Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Tue, 9 Dec 2008 19:56:43 +0000 Subject: Add SDL_CFLAGS, SDL_LDFLAGS to default compile flags, and check for SDL in configure before checking for libraries and headers, to fix Windows. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1412 --- src/Makefile.am | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index e43cb7f0..63ddc98f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,7 +3,7 @@ gamesdir = $(prefix)/games games_PROGRAMS = chocolate-doom chocolate-server -AM_CFLAGS = -I../textscreen -I../pcsound @SDL_CFLAGS@ @SDLMIXER_CFLAGS@ @SDLNET_CFLAGS@ +AM_CFLAGS = -I../textscreen -I../pcsound @SDLMIXER_CFLAGS@ @SDLNET_CFLAGS@ DEDSERV_FILES=\ d_dedicated.c \ @@ -21,7 +21,7 @@ net_structrw.c net_structrw.h \ z_native.c z_zone.h chocolate_server_SOURCES=$(DEDSERV_FILES) -chocolate_server_LDADD = @LDFLAGS@ @SDL_LIBS@ @SDLNET_LIBS@ +chocolate_server_LDADD = @LDFLAGS@ @SDLNET_LIBS@ MAIN_SOURCE_FILES=\ am_map.c am_map.h \ @@ -169,7 +169,12 @@ else chocolate_doom_SOURCES=$(SOURCE_FILES) endif -chocolate_doom_LDADD = ../textscreen/libtextscreen.a ../pcsound/libpcsound.a @LDFLAGS@ @SDL_LIBS@ @SDLMIXER_LIBS@ @SDLNET_LIBS@ +chocolate_doom_LDADD = \ + ../textscreen/libtextscreen.a \ + ../pcsound/libpcsound.a \ + @LDFLAGS@ \ + @SDLMIXER_LIBS@ \ + @SDLNET_LIBS@ EXTRA_DIST = \ icon.c \ -- cgit v1.2.3 From ca3844dc5b138b19259e8dc9daaa397867834a5f Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Tue, 9 Dec 2008 20:35:17 +0000 Subject: Add check for sched_setaffinity to configure and only use it if it is found. Display a message if we don't have any way to set processor affinity. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1413 --- src/i_main.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/i_main.c b/src/i_main.c index 74b164b1..c103296b 100644 --- a/src/i_main.c +++ b/src/i_main.c @@ -25,6 +25,8 @@ //----------------------------------------------------------------------------- +#include "config.h" + #include "SDL.h" #include @@ -32,7 +34,9 @@ #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include -#else +#endif + +#ifdef HAVE_SCHED_SETAFFINITY #include #include #endif @@ -42,25 +46,35 @@ #include "m_argv.h" #include "d_main.h" -int main(int argc, char **argv) -{ +#if !defined(_WIN32) && !defined(HAVE_SCHED_SETAFFINITY) +#warning No known way to set processor affinity on this platform. +#warning You may experience crashes due to SDL_mixer. +#endif + +int main(int argc, char **argv) +{ // save arguments - myargc = argc; - myargv = argv; + myargc = argc; + myargv = argv; + +#ifdef _WIN32 // Set the process affinity mask so that all threads - // run on the same processor. This is a workaround for a bug in + // run on the same processor. This is a workaround for a bug in // SDL_mixer that causes occasional crashes. -#ifdef _WIN32 if (!SetProcessAffinityMask(GetCurrentProcess(), 1)) { fprintf(stderr, "Failed to set process affinity mask (%d)\n", (int) GetLastError()); } -#else - // POSIX version: + +#endif + +#ifdef HAVE_SCHED_SETAFFINITY + + // Linux version: { cpu_set_t set; @@ -70,12 +84,13 @@ int main(int argc, char **argv) sched_setaffinity(getpid(), sizeof(set), &set); } + #endif // start doom - - D_DoomMain (); + + D_DoomMain (); return 0; -} +} -- cgit v1.2.3 From b00b65538a1f7a04fdd46d7c193a7c59733fde9b Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Tue, 9 Dec 2008 23:32:19 +0000 Subject: Make intermission screen work on MAP33, to be consistent with Vanilla Doom. Also, make levels after MAP33 trigger a V_DrawPatch error. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1414 --- src/wi_stuff.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/wi_stuff.c b/src/wi_stuff.c index 938d6915..238462de 100644 --- a/src/wi_stuff.c +++ b/src/wi_stuff.c @@ -427,13 +427,32 @@ void WI_drawLF(void) { int y = WI_TITLEY; - // draw - V_DrawPatch((SCREENWIDTH - SHORT(lnames[wbs->last]->width))/2, - y, FB, lnames[wbs->last]); + if (wbs->last < NUMCMAPS) + { + // draw + V_DrawPatch((SCREENWIDTH - SHORT(lnames[wbs->last]->width))/2, + y, FB, lnames[wbs->last]); + + // draw "Finished!" + y += (5*SHORT(lnames[wbs->last]->height))/4; + } + else if (wbs->last == NUMCMAPS) + { + // MAP33 - nothing is displayed! + } + else if (wbs->last > NUMCMAPS) + { + // > MAP33. Doom bombs out here with a Bad V_DrawPatch error. + // I'm pretty sure that doom2.exe is just reading into random + // bits of memory at this point, but let's try to be accurate + // anyway. This deliberately triggers a V_DrawPatch error. + + patch_t tmp = { SCREENWIDTH, SCREENHEIGHT, 1, 1, + { 0, 0, 0, 0, 0, 0, 0, 0 } }; + + V_DrawPatch(0, y, FB, &tmp); + } - // draw "Finished!" - y += (5*SHORT(lnames[wbs->last]->height))/4; - V_DrawPatch((SCREENWIDTH - SHORT(finished->width))/2, y, FB, finished); } -- cgit v1.2.3 From b22df6a13aedecce1818c41eb38b265b066f3eda Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 10 Dec 2008 00:00:55 +0000 Subject: Fix window icon/title under Windows XP Luna theme. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1415 --- src/i_video.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/i_video.c b/src/i_video.c index a4129aba..0ed4d716 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -1481,6 +1481,12 @@ void I_InitGraphics(void) } } + // Set up title and icon. Windows cares about the ordering; this + // has to be done before the call to SDL_SetVideoMode. + + I_SetWindowCaption(); + I_SetWindowIcon(); + // Set the video mode. flags |= SDL_SWSURFACE | SDL_HWPALETTE | SDL_DOUBLEBUF; @@ -1518,11 +1524,6 @@ void I_InitGraphics(void) I_SetPalette(doompal); SDL_SetColors(screen, palette, 0, 256); - // Setup title and icon - - I_SetWindowCaption(); - I_SetWindowIcon(); - CreateCursors(); UpdateFocus(); -- cgit v1.2.3 From aed280e13947099544f584077e9cd893ddeaf9e5 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 10 Dec 2008 00:42:49 +0000 Subject: Set icon before calling TXT_Init, for setup and ENDOOM screens. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1416 --- src/i_system.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/i_system.c b/src/i_system.c index fe596a60..282000ed 100644 --- a/src/i_system.c +++ b/src/i_system.c @@ -139,15 +139,15 @@ void I_Endoom(void) endoom_data = W_CacheLumpName(DEH_String("ENDOOM"), PU_STATIC); - // Set up text mode screen - - TXT_Init(); - // Make sure the new window has the right title and icon I_SetWindowCaption(); I_SetWindowIcon(); + // Set up text mode screen + + TXT_Init(); + // Write the data to the screen memory screendata = TXT_GetScreenData(); -- cgit v1.2.3 From 08522e4bcff0f552fa0392102e73591e58822524 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 10 Dec 2008 01:01:19 +0000 Subject: Undo previous change. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1417 --- src/i_system.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/i_system.c b/src/i_system.c index 282000ed..fe596a60 100644 --- a/src/i_system.c +++ b/src/i_system.c @@ -139,15 +139,15 @@ void I_Endoom(void) endoom_data = W_CacheLumpName(DEH_String("ENDOOM"), PU_STATIC); + // Set up text mode screen + + TXT_Init(); + // Make sure the new window has the right title and icon I_SetWindowCaption(); I_SetWindowIcon(); - // Set up text mode screen - - TXT_Init(); - // Write the data to the screen memory screendata = TXT_GetScreenData(); -- cgit v1.2.3 From baf0aa3a5356ea07956608ff43833d6cee6f85ae Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 10 Dec 2008 20:20:10 +0000 Subject: Fix crash when playing Doom 1 levels. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1420 --- src/wi_stuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/wi_stuff.c b/src/wi_stuff.c index 238462de..5e87069e 100644 --- a/src/wi_stuff.c +++ b/src/wi_stuff.c @@ -427,7 +427,7 @@ void WI_drawLF(void) { int y = WI_TITLEY; - if (wbs->last < NUMCMAPS) + if (gamemode != commercial || wbs->last < NUMCMAPS) { // draw V_DrawPatch((SCREENWIDTH - SHORT(lnames[wbs->last]->width))/2, -- cgit v1.2.3