mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
When issuing "setrendmode" OSD command with mismatched vidmode, auto-switch.
git-svn-id: https://svn.eduke32.com/eduke32@4015 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
4b44063853
commit
7a9e9fada4
4 changed files with 39 additions and 7 deletions
|
@ -38,6 +38,8 @@ extern char offscreenrendering;
|
|||
void calc_ylookup(int32_t bpl, int32_t lastyidx);
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
int32_t (*baselayer_osdcmd_vidmode_func)(const osdfuncparm_t *parm);
|
||||
|
||||
void fullscreen_tint_gl(uint8_t r, uint8_t g, uint8_t b, uint8_t f);
|
||||
extern int32_t osdcmd_glinfo(const osdfuncparm_t *parm);
|
||||
|
||||
|
|
|
@ -207,19 +207,49 @@ struct glinfo_t glinfo =
|
|||
int32_t flushlogwindow = 1;
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
// Used to register the game's / editor's osdcmd_vidmode() functions here.
|
||||
int32_t (*baselayer_osdcmd_vidmode_func)(const osdfuncparm_t *parm);
|
||||
|
||||
static int32_t osdfunc_setrendermode(const osdfuncparm_t *parm)
|
||||
{
|
||||
int32_t m;
|
||||
char *p;
|
||||
|
||||
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
|
||||
if (parm->numparms != 1)
|
||||
return OSDCMD_SHOWHELP;
|
||||
|
||||
m = Bstrtol(parm->parms[0], &p, 10);
|
||||
|
||||
if (m < REND_CLASSIC || m > REND_POLYMER) return OSDCMD_SHOWHELP;
|
||||
if (m != REND_CLASSIC && m != REND_POLYMOST && m != REND_POLYMER)
|
||||
return OSDCMD_SHOWHELP;
|
||||
|
||||
if ((m==REND_CLASSIC) != (bpp==8) && baselayer_osdcmd_vidmode_func)
|
||||
{
|
||||
// Mismatch between video mode and requested renderer, do auto switch.
|
||||
osdfuncparm_t parm;
|
||||
char arg[4];
|
||||
|
||||
const char *ptrptr[1];
|
||||
ptrptr[0] = arg;
|
||||
|
||||
Bmemset(&parm, 0, sizeof(parm));
|
||||
|
||||
if (m==REND_CLASSIC)
|
||||
Bmemcpy(&arg, "8", 2);
|
||||
else
|
||||
Bmemcpy(&arg, "32", 3);
|
||||
|
||||
// CAUTION: we assume that the osdcmd_vidmode function doesn't use any
|
||||
// other member!
|
||||
parm.numparms = 1;
|
||||
parm.parms = ptrptr;
|
||||
|
||||
baselayer_osdcmd_vidmode_func(&parm);
|
||||
}
|
||||
|
||||
setrendermode(m);
|
||||
|
||||
switch(getrendermode())
|
||||
switch (getrendermode())
|
||||
{
|
||||
case REND_CLASSIC:
|
||||
p = "classic software";
|
||||
|
|
|
@ -512,9 +512,11 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
#ifdef USE_OPENGL
|
||||
OSD_RegisterFunction("restartvid","restartvid: reinitialize the video mode",osdcmd_restartvid);
|
||||
OSD_RegisterFunction("vidmode","vidmode <xdim> <ydim> <bpp> <fullscreen>: immediately change the video mode",osdcmd_vidmode);
|
||||
baselayer_osdcmd_vidmode_func = osdcmd_vidmode;
|
||||
#else
|
||||
OSD_RegisterFunction("vidmode","vidmode <xdim> <ydim>: immediately change the video mode",osdcmd_vidmode);
|
||||
#endif
|
||||
|
||||
wm_setapptitle("Mapster32");
|
||||
|
||||
editstatus = 1;
|
||||
|
|
|
@ -1604,11 +1604,9 @@ int32_t registerosdcommands(void)
|
|||
OSD_RegisterFunction("unbindall","unbindall: unbinds all keys", osdcmd_unbindall);
|
||||
|
||||
OSD_RegisterFunction("vidmode","vidmode <xdim> <ydim> <bpp> <fullscreen>: change the video mode",osdcmd_vidmode);
|
||||
#if 0
|
||||
OSD_RegisterFunction("savestate","",osdcmd_savestate);
|
||||
OSD_RegisterFunction("restorestate","",osdcmd_restorestate);
|
||||
#ifdef USE_OPENGL
|
||||
baselayer_osdcmd_vidmode_func = osdcmd_vidmode;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue