mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
make mapster slightly less cpu-hungry under linux. Also a (temporary?) fix for a crash
git-svn-id: https://svn.eduke32.com/eduke32@1486 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
53418727e9
commit
b2e2ba8868
7 changed files with 41 additions and 17 deletions
|
@ -95,6 +95,7 @@ void debugprintf(const char *,...);
|
||||||
|
|
||||||
int32_t handleevents(void);
|
int32_t handleevents(void);
|
||||||
extern inline void idle(void);
|
extern inline void idle(void);
|
||||||
|
extern inline void idle_waitevent(void);
|
||||||
|
|
||||||
typedef void (*KeyPressCallback)(int32_t,int32_t);
|
typedef void (*KeyPressCallback)(int32_t,int32_t);
|
||||||
typedef void (*MousePressCallback)(int32_t,int32_t);
|
typedef void (*MousePressCallback)(int32_t,int32_t);
|
||||||
|
|
|
@ -541,6 +541,7 @@ CANCEL:
|
||||||
|
|
||||||
while ((keystatus[1]|keystatus[0x1c]|keystatus[0x39]|keystatus[0x31]) == 0)
|
while ((keystatus[1]|keystatus[0x1c]|keystatus[0x39]|keystatus[0x31]) == 0)
|
||||||
{
|
{
|
||||||
|
idle_waitevent();
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
{
|
{
|
||||||
if (quitevent)
|
if (quitevent)
|
||||||
|
@ -549,7 +550,6 @@ CANCEL:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
idle();
|
|
||||||
|
|
||||||
if (keystatus[0x15]||keystatus[0x1c]) // Y or ENTER
|
if (keystatus[0x15]||keystatus[0x1c]) // Y or ENTER
|
||||||
{
|
{
|
||||||
|
@ -575,8 +575,8 @@ CANCEL:
|
||||||
|
|
||||||
while ((keystatus[1]|keystatus[0x1c]|keystatus[0x39]|keystatus[0x31]|keystatus[0x2e]) == 0)
|
while ((keystatus[1]|keystatus[0x1c]|keystatus[0x39]|keystatus[0x31]|keystatus[0x2e]) == 0)
|
||||||
{
|
{
|
||||||
|
idle_waitevent();
|
||||||
if (handleevents()) { if (quitevent) break; } // like saying no
|
if (handleevents()) { if (quitevent) break; } // like saying no
|
||||||
idle();
|
|
||||||
|
|
||||||
if (keystatus[0x15] || keystatus[0x1c]) // Y or ENTER
|
if (keystatus[0x15] || keystatus[0x1c]) // Y or ENTER
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,6 +56,7 @@ static int32_t readconfig(BFILE *fp, const char *key, char *value, uint32_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int16_t brightness;
|
extern int16_t brightness;
|
||||||
|
extern int32_t vsync;
|
||||||
extern char game_executable[BMAX_PATH];
|
extern char game_executable[BMAX_PATH];
|
||||||
extern int32_t fullscreen;
|
extern int32_t fullscreen;
|
||||||
extern char option[8];
|
extern char option[8];
|
||||||
|
@ -136,6 +137,7 @@ int32_t loadsetup(const char *fn)
|
||||||
if (readconfig(fp, "music", val, VL) > 0) { if (Batoi(val) != 0) option[2] = 1; else option[2] = 0; }
|
if (readconfig(fp, "music", val, VL) > 0) { if (Batoi(val) != 0) option[2] = 1; else option[2] = 0; }
|
||||||
if (readconfig(fp, "mouse", val, VL) > 0) { if (Batoi(val) != 0) option[3] = 1; else option[3] = 0; }
|
if (readconfig(fp, "mouse", val, VL) > 0) { if (Batoi(val) != 0) option[3] = 1; else option[3] = 0; }
|
||||||
if (readconfig(fp, "bpp", val, VL) > 0) bppgame = Batoi(val);
|
if (readconfig(fp, "bpp", val, VL) > 0) bppgame = Batoi(val);
|
||||||
|
if (readconfig(fp, "vsync", val, VL) > 0) vsync = Batoi(val)?1:0;
|
||||||
if (readconfig(fp, "editorgridextent", val, VL) > 0) editorgridextent = max(min(524288,Batoi(val)),65536);
|
if (readconfig(fp, "editorgridextent", val, VL) > 0) editorgridextent = max(min(524288,Batoi(val)),65536);
|
||||||
#ifdef POLYMER
|
#ifdef POLYMER
|
||||||
if (readconfig(fp, "rendmode", val, VL) > 0) { i = Batoi(val); glrendmode = i; }
|
if (readconfig(fp, "rendmode", val, VL) > 0) { i = Batoi(val); glrendmode = i; }
|
||||||
|
@ -298,6 +300,8 @@ int32_t writesetup(const char *fn)
|
||||||
"; 3D-mode colour depth\n"
|
"; 3D-mode colour depth\n"
|
||||||
"bpp = %d\n"
|
"bpp = %d\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
"vsync = %d\n"
|
||||||
|
"\n"
|
||||||
#ifdef POLYMER
|
#ifdef POLYMER
|
||||||
"; Rendering mode\n"
|
"; Rendering mode\n"
|
||||||
"rendmode = %d\n"
|
"rendmode = %d\n"
|
||||||
|
@ -447,7 +451,7 @@ int32_t writesetup(const char *fn)
|
||||||
"; remap = 10-3A,52-4C,53-B8\n"
|
"; remap = 10-3A,52-4C,53-B8\n"
|
||||||
"remap = ",
|
"remap = ",
|
||||||
|
|
||||||
forcesetup, fullscreen, xdim2d, ydim2d, xdimgame, ydimgame, bppgame,
|
forcesetup, fullscreen, xdim2d, ydim2d, xdimgame, ydimgame, bppgame, vsync,
|
||||||
#ifdef POLYMER
|
#ifdef POLYMER
|
||||||
glrendmode,
|
glrendmode,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1809,7 +1809,12 @@ int32_t handleevents(void)
|
||||||
|
|
||||||
inline void idle(void)
|
inline void idle(void)
|
||||||
{
|
{
|
||||||
usleep(1);
|
usleep(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void idle_waitevent(void)
|
||||||
|
{
|
||||||
|
SDL_WaitEvent(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2
|
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2
|
||||||
|
|
|
@ -695,6 +695,10 @@ inline void idle(void)
|
||||||
Sleep(1);
|
Sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void idle_waitevent(void)
|
||||||
|
{
|
||||||
|
Sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -1682,11 +1682,11 @@ static void IntegratedHelp()
|
||||||
|
|
||||||
while (keystatus[KEYSC_ESC]==0 && keystatus[KEYSC_Q]==0 && keystatus[KEYSC_F1]==0)
|
while (keystatus[KEYSC_ESC]==0 && keystatus[KEYSC_Q]==0 && keystatus[KEYSC_F1]==0)
|
||||||
{
|
{
|
||||||
|
idle_waitevent();
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
{
|
{
|
||||||
if (quitevent) quitevent = 0;
|
if (quitevent) quitevent = 0;
|
||||||
}
|
}
|
||||||
idle();
|
|
||||||
// printmessage16("Help mode, press <Esc> to exit");
|
// printmessage16("Help mode, press <Esc> to exit");
|
||||||
|
|
||||||
if (keystatus[KEYSC_T]) // goto table of contents
|
if (keystatus[KEYSC_T]) // goto table of contents
|
||||||
|
@ -1796,11 +1796,11 @@ static void IntegratedHelp()
|
||||||
_printmessage16(tempbuf);
|
_printmessage16(tempbuf);
|
||||||
showframe(1);
|
showframe(1);
|
||||||
|
|
||||||
|
idle_waitevent();
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
{
|
{
|
||||||
if (quitevent) quitevent = 0;
|
if (quitevent) quitevent = 0;
|
||||||
}
|
}
|
||||||
idle();
|
|
||||||
|
|
||||||
ch = bgetchar();
|
ch = bgetchar();
|
||||||
|
|
||||||
|
@ -2077,11 +2077,11 @@ static void SoundDisplay()
|
||||||
while (keystatus[KEYSC_ESC]==0 && keystatus[KEYSC_Q]==0 && keystatus[KEYSC_F2]==0
|
while (keystatus[KEYSC_ESC]==0 && keystatus[KEYSC_Q]==0 && keystatus[KEYSC_F2]==0
|
||||||
&& keystatus[buildkeys[BK_MODE2D_3D]]==0) // quickjump to 3d mode
|
&& keystatus[buildkeys[BK_MODE2D_3D]]==0) // quickjump to 3d mode
|
||||||
{
|
{
|
||||||
|
idle_waitevent();
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
{
|
{
|
||||||
if (quitevent) quitevent = 0;
|
if (quitevent) quitevent = 0;
|
||||||
}
|
}
|
||||||
idle();
|
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t col = whitecol-21;
|
int32_t col = whitecol-21;
|
||||||
|
@ -2195,11 +2195,11 @@ static void SoundDisplay()
|
||||||
_printmessage16(tempbuf);
|
_printmessage16(tempbuf);
|
||||||
showframe(1);
|
showframe(1);
|
||||||
|
|
||||||
|
idle_waitevent();
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
{
|
{
|
||||||
if (quitevent) quitevent = 0;
|
if (quitevent) quitevent = 0;
|
||||||
}
|
}
|
||||||
idle();
|
|
||||||
|
|
||||||
ch = bgetchar();
|
ch = bgetchar();
|
||||||
|
|
||||||
|
@ -3197,11 +3197,14 @@ static int32_t m32gettile(int32_t idInitialTile)
|
||||||
mtile=iTile;
|
mtile=iTile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bpp==8) // no idea why, but it breaks the mousewheel else :/
|
||||||
|
idle_waitevent();
|
||||||
|
else
|
||||||
|
idle();
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
{
|
{
|
||||||
if (quitevent) quitevent = 0;
|
if (quitevent) quitevent = 0;
|
||||||
}
|
}
|
||||||
idle();
|
|
||||||
|
|
||||||
// These two lines are so obvious I don't need to comment them ...;-)
|
// These two lines are so obvious I don't need to comment them ...;-)
|
||||||
synctics = totalclock-lockclock;
|
synctics = totalclock-lockclock;
|
||||||
|
@ -10791,11 +10794,12 @@ static void EditSectorData(int16_t sectnum)
|
||||||
begindrawing();
|
begindrawing();
|
||||||
while (keystatus[KEYSC_ESC] == 0)
|
while (keystatus[KEYSC_ESC] == 0)
|
||||||
{
|
{
|
||||||
|
idle_waitevent();
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
{
|
{
|
||||||
if (quitevent) quitevent = 0;
|
if (quitevent) quitevent = 0;
|
||||||
}
|
}
|
||||||
idle();
|
|
||||||
_printmessage16("Edit mode, press <Esc> to exit");
|
_printmessage16("Edit mode, press <Esc> to exit");
|
||||||
if (keystatus[KEYSC_DOWN])
|
if (keystatus[KEYSC_DOWN])
|
||||||
{
|
{
|
||||||
|
@ -11043,11 +11047,12 @@ static void EditWallData(int16_t wallnum)
|
||||||
begindrawing();
|
begindrawing();
|
||||||
while (keystatus[KEYSC_ESC] == 0)
|
while (keystatus[KEYSC_ESC] == 0)
|
||||||
{
|
{
|
||||||
|
idle_waitevent();
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
{
|
{
|
||||||
if (quitevent) quitevent = 0;
|
if (quitevent) quitevent = 0;
|
||||||
}
|
}
|
||||||
idle();
|
|
||||||
_printmessage16("Edit mode, press <Esc> to exit");
|
_printmessage16("Edit mode, press <Esc> to exit");
|
||||||
if (keystatus[KEYSC_DOWN])
|
if (keystatus[KEYSC_DOWN])
|
||||||
{
|
{
|
||||||
|
@ -11194,12 +11199,13 @@ static void EditSpriteData(int16_t spritenum)
|
||||||
|
|
||||||
while (keystatus[KEYSC_ESC] == 0)
|
while (keystatus[KEYSC_ESC] == 0)
|
||||||
{
|
{
|
||||||
|
idle_waitevent();
|
||||||
begindrawing();
|
begindrawing();
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
{
|
{
|
||||||
if (quitevent) quitevent = 0;
|
if (quitevent) quitevent = 0;
|
||||||
}
|
}
|
||||||
idle();
|
|
||||||
_printmessage16("Edit mode, press <Esc> to exit");
|
_printmessage16("Edit mode, press <Esc> to exit");
|
||||||
if (keystatus[KEYSC_DOWN])
|
if (keystatus[KEYSC_DOWN])
|
||||||
{
|
{
|
||||||
|
@ -11609,12 +11615,13 @@ static void GenSearchSprite()
|
||||||
|
|
||||||
while (keystatus[KEYSC_ESC] == 0)
|
while (keystatus[KEYSC_ESC] == 0)
|
||||||
{
|
{
|
||||||
begindrawing();
|
idle_waitevent();
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
{
|
{
|
||||||
if (quitevent) quitevent = 0;
|
if (quitevent) quitevent = 0;
|
||||||
}
|
}
|
||||||
idle();
|
|
||||||
|
begindrawing();
|
||||||
printmessage16("Sprite search, press <Esc> to exit");
|
printmessage16("Sprite search, press <Esc> to exit");
|
||||||
|
|
||||||
if (keystatus[KEYSC_DOWN])
|
if (keystatus[KEYSC_DOWN])
|
||||||
|
@ -11781,12 +11788,13 @@ static void FuncMenu(void)
|
||||||
|
|
||||||
while (!editval && keystatus[KEYSC_ESC] == 0)
|
while (!editval && keystatus[KEYSC_ESC] == 0)
|
||||||
{
|
{
|
||||||
begindrawing();
|
idle_waitevent();
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
{
|
{
|
||||||
if (quitevent) quitevent = 0;
|
if (quitevent) quitevent = 0;
|
||||||
}
|
}
|
||||||
idle();
|
|
||||||
|
begindrawing();
|
||||||
_printmessage16("Select an option, press <Esc> to exit");
|
_printmessage16("Select an option, press <Esc> to exit");
|
||||||
if (keystatus[KEYSC_DOWN])
|
if (keystatus[KEYSC_DOWN])
|
||||||
{
|
{
|
||||||
|
|
|
@ -278,7 +278,9 @@ static void MV_Mix
|
||||||
uint32_t rate;
|
uint32_t rate;
|
||||||
uint32_t FixedPointBufferSize;
|
uint32_t FixedPointBufferSize;
|
||||||
|
|
||||||
if ((voice->length == 0) && (voice->GetSound(voice) != KeepPlaying))
|
// cheap fix for a crash under 64-bit linux --\
|
||||||
|
// v
|
||||||
|
if ((voice->length == 0) && ((voice->GetSound == NULL) || (voice->GetSound(voice) != KeepPlaying)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue