Index: cfgmgr/cfgmgr.c |
— | — | @@ -530,6 +530,8 @@ |
531 | 531 | else cfgmask = &defaultmask;
|
532 | 532 | memset(&defaultmask,1,sizeof(DXGLCFG));
|
533 | 533 | defaultmask.aspect = 1.0f;
|
| 534 | + defaultmask.firstscalex = 1.0f;
|
| 535 | + defaultmask.firstscaley = 1.0f;
|
534 | 536 | WriteDWORD(hKey,cfg->scaler,cfgmask->scaler,_T("ScalingMode"));
|
535 | 537 | WriteDWORD(hKey, cfg->fullmode, cfgmask->fullmode, _T("FullscreenWindowMode"));
|
536 | 538 | WriteBool(hKey,cfg->colormode,cfgmask->colormode,_T("ChangeColorDepth"));
|
Index: ddraw/glDirectDraw.cpp |
— | — | @@ -1627,7 +1627,7 @@ |
1628 | 1628 | DEBUG("IDirectDraw::SetDisplayMode: implement multiple monitors\n");
|
1629 | 1629 | DEVMODE newmode,newmode2;
|
1630 | 1630 | DEVMODE currmode;
|
1631 | | - float aspect,xmul,ymul;
|
| 1631 | + float aspect,xmul,ymul,xscale,yscale;
|
1632 | 1632 | LONG error;
|
1633 | 1633 | DWORD flags;
|
1634 | 1634 | if(!oldmode.dmSize)
|
— | — | @@ -1638,6 +1638,19 @@ |
1639 | 1639 | currmode.dmSize = sizeof(DEVMODE);
|
1640 | 1640 | EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&currmode);
|
1641 | 1641 | this->currmode.dmSize = 0;
|
| 1642 | + if (_isnan(dxglcfg.firstscalex) || _isnan(dxglcfg.firstscaley) ||
|
| 1643 | + (dxglcfg.firstscalex < 0.25f) || (dxglcfg.firstscaley < 0.25f))
|
| 1644 | + {
|
| 1645 | + if (dwWidth <= 400) xscale = 2;
|
| 1646 | + else xscale = 1;
|
| 1647 | + if (dwHeight <= 240) yscale = 2;
|
| 1648 | + else yscale = 1;
|
| 1649 | + }
|
| 1650 | + else
|
| 1651 | + {
|
| 1652 | + xscale = dxglcfg.firstscalex;
|
| 1653 | + yscale = dxglcfg.firstscaley;
|
| 1654 | + }
|
1642 | 1655 | switch (dxglcfg.fullmode)
|
1643 | 1656 | {
|
1644 | 1657 | case 0:
|
— | — | @@ -1650,8 +1663,8 @@ |
1651 | 1664 | default:
|
1652 | 1665 | newmode.dmSize = sizeof(DEVMODE);
|
1653 | 1666 | newmode.dmDriverExtra = 0;
|
1654 | | - newmode.dmPelsWidth = dwWidth;
|
1655 | | - newmode.dmPelsHeight = dwHeight;
|
| 1667 | + newmode.dmPelsWidth = dwWidth * xscale;
|
| 1668 | + newmode.dmPelsHeight = dwHeight * yscale;
|
1656 | 1669 | if (dxglcfg.colormode)
|
1657 | 1670 | newmode.dmBitsPerPel = dwBPP;
|
1658 | 1671 | else newmode.dmBitsPerPel = currmode.dmBitsPerPel;
|
— | — | @@ -1665,8 +1678,10 @@ |
1666 | 1679 | {
|
1667 | 1680 | case DISP_CHANGE_SUCCESSFUL:
|
1668 | 1681 | if (fullscreen) this->currmode = newmode;
|
1669 | | - internalx = primaryx = screenx = newmode.dmPelsWidth;
|
1670 | | - internaly = primaryy = screeny = newmode.dmPelsHeight;
|
| 1682 | + primaryx = screenx = newmode.dmPelsWidth;
|
| 1683 | + primaryy = screeny = newmode.dmPelsHeight;
|
| 1684 | + internalx = newmode.dmPelsWidth * xscale;
|
| 1685 | + internaly = newmode.dmPelsHeight * yscale;
|
1671 | 1686 | internalbpp = screenbpp = newmode.dmBitsPerPel;
|
1672 | 1687 | primarybpp = dwBPP;
|
1673 | 1688 | if (dwRefreshRate) internalrefresh = primaryrefresh = screenrefresh = dwRefreshRate;
|
Index: ddraw/glRenderer.cpp |
— | — | @@ -2790,6 +2790,19 @@ |
2791 | 2791 | //glRenderer__InitCommandBuffer(This, &This->cmd2, width * height * (NextMultipleOf8(bpp) / 8));
|
2792 | 2792 | //BufferObject_Map(This->cmd1.vertices, GL_ARRAY_BUFFER, GL_WRITE_ONLY);
|
2793 | 2793 | //BufferObject_Map(This->cmd1.indices, GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY);
|
| 2794 | + if (_isnan(dxglcfg.firstscalex) || _isnan(dxglcfg.firstscaley) ||
|
| 2795 | + (dxglcfg.firstscalex < 0.25f) || (dxglcfg.firstscaley < 0.25f))
|
| 2796 | + {
|
| 2797 | + if (width <= 400) This->firstscalex = 2.0f;
|
| 2798 | + else This->firstscaley = 1.0f;
|
| 2799 | + if (height <= 240) This->firstscaley = 2;
|
| 2800 | + else This->firstscaley = 1;
|
| 2801 | + }
|
| 2802 | + else
|
| 2803 | + {
|
| 2804 | + This->firstscalex = dxglcfg.firstscalex;
|
| 2805 | + This->firstscaley = dxglcfg.firstscaley;
|
| 2806 | + }
|
2794 | 2807 | TRACE_SYSINFO();
|
2795 | 2808 | return TRUE;
|
2796 | 2809 | }
|
— | — | @@ -3197,44 +3210,50 @@ |
3198 | 3211 | glTexture__FinishCreate(texture);
|
3199 | 3212 | }
|
3200 | 3213 |
|
3201 | | -void glRenderer__DrawBackbuffer(glRenderer *This, glTexture **texture, int x, int y, int progtype)
|
| 3214 | +void glRenderer__DrawBackbuffer(glRenderer *This, glTexture **texture, int x, int y, int progtype, BOOL paletted)
|
3202 | 3215 | {
|
3203 | 3216 | GLfloat view[4];
|
3204 | 3217 | DDSURFACEDESC2 ddsd;
|
| 3218 | + DWORD x2, y2;
|
| 3219 | + x2 = x * This->firstscalex;
|
| 3220 | + y2 = y * This->firstscaley;
|
3205 | 3221 | glUtil_SetActiveTexture(This->util,0);
|
3206 | 3222 | if(!This->backbuffer)
|
3207 | 3223 | {
|
3208 | 3224 | ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
|
3209 | 3225 | memcpy(&ddsd, &ddsdbackbuffer, sizeof(DDSURFACEDESC2));
|
3210 | | - ddsd.dwWidth = x;
|
3211 | | - ddsd.lPitch = x * 4;
|
3212 | | - ddsd.dwHeight = y;
|
3213 | | - glTexture_Create(&ddsd, &This->backbuffer, This, x, y, FALSE, TRUE);
|
| 3226 | + ddsd.dwWidth = x2;
|
| 3227 | + ddsd.lPitch = x2 * 4;
|
| 3228 | + ddsd.dwHeight = y2;
|
| 3229 | + glTexture_Create(&ddsd, &This->backbuffer, This, x2, y2, FALSE, TRUE);
|
3214 | 3230 | }
|
3215 | | - if((This->backbuffer->levels[0].ddsd.dwWidth != x) || (This->backbuffer->levels[0].ddsd.dwHeight != y))
|
| 3231 | + if((This->backbuffer->levels[0].ddsd.dwWidth != x2) || (This->backbuffer->levels[0].ddsd.dwHeight != y2))
|
3216 | 3232 | {
|
3217 | 3233 | ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
|
3218 | 3234 | ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
3219 | | - ddsd.dwWidth = x;
|
3220 | | - ddsd.dwHeight = y;
|
| 3235 | + ddsd.dwWidth = x2;
|
| 3236 | + ddsd.dwHeight = y2;
|
3221 | 3237 | ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT;
|
3222 | 3238 | glTexture__SetSurfaceDesc(This->backbuffer, &ddsd);
|
3223 | 3239 | }
|
3224 | 3240 | glUtil_SetFBOTextures(This->util,&This->fbo,This->backbuffer,NULL,0,0,FALSE);
|
3225 | 3241 | view[0] = view[2] = 0;
|
3226 | | - view[1] = (GLfloat)x;
|
3227 | | - view[3] = (GLfloat)y;
|
3228 | | - glUtil_SetViewport(This->util,0,0,x,y);
|
| 3242 | + view[1] = (GLfloat)x2;
|
| 3243 | + view[3] = (GLfloat)y2;
|
| 3244 | + glUtil_SetViewport(This->util,0,0,x2,y2);
|
3229 | 3245 | glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
3230 | 3246 | glUtil_SetTexture(This->util,0,*texture);
|
3231 | 3247 | *texture = This->backbuffer;
|
| 3248 | + if (!paletted && dxglcfg.firstscalefilter == 1)
|
| 3249 | + glTexture__SetFilter(*texture, 0, GL_LINEAR, GL_LINEAR, This);
|
| 3250 | + else glTexture__SetFilter(*texture, 0, GL_NEAREST, GL_NEAREST, This);
|
3232 | 3251 | if(This->ext->GLEXT_ARB_sampler_objects) glTexture__SetFilter(NULL,0,GL_LINEAR,GL_LINEAR, This);
|
3233 | 3252 | This->ext->glUniform4f(This->shaders->shaders[progtype].view,view[0],view[1],view[2],view[3]);
|
3234 | 3253 | This->bltvertices[0].s = This->bltvertices[0].t = This->bltvertices[1].t = This->bltvertices[2].s = 1.;
|
3235 | 3254 | This->bltvertices[1].s = This->bltvertices[2].t = This->bltvertices[3].s = This->bltvertices[3].t = 0.;
|
3236 | 3255 | This->bltvertices[0].y = This->bltvertices[1].y = This->bltvertices[1].x = This->bltvertices[3].x = 0.;
|
3237 | | - This->bltvertices[0].x = This->bltvertices[2].x = (float)x;
|
3238 | | - This->bltvertices[2].y = This->bltvertices[3].y = (float)y;
|
| 3256 | + This->bltvertices[0].x = This->bltvertices[2].x = (float)x2;
|
| 3257 | + This->bltvertices[2].y = This->bltvertices[3].y = (float)y2;
|
3239 | 3258 | glUtil_EnableArray(This->util,This->shaders->shaders[progtype].pos,TRUE);
|
3240 | 3259 | This->ext->glVertexAttribPointer(This->shaders->shaders[progtype].pos,2,GL_FLOAT,GL_FALSE,sizeof(BltVertex),&This->bltvertices[0].x);
|
3241 | 3260 | glUtil_EnableArray(This->util,This->shaders->shaders[progtype].texcoord,TRUE);
|
— | — | @@ -3365,13 +3384,13 @@ |
3366 | 3385 | This->ext->glUniform1i(This->shaders->shaders[progtype].pal,9);
|
3367 | 3386 | glUtil_SetTexture(This->util,8,texture);
|
3368 | 3387 | glUtil_SetTexture(This->util,9,paltex);
|
3369 | | - if(dxglcfg.scalingfilter)
|
| 3388 | + if(dxglcfg.scalingfilter || (This->firstscalex != 1.0f) || (This->firstscaley != 1.0f))
|
3370 | 3389 | {
|
3371 | | - glRenderer__DrawBackbuffer(This,&texture,texture->bigwidth,texture->bigheight,progtype);
|
| 3390 | + glRenderer__DrawBackbuffer(This,&texture,texture->bigwidth,texture->bigheight,progtype,TRUE);
|
3372 | 3391 | ShaderManager_SetShader(This->shaders,PROG_TEXTURE,NULL,0);
|
3373 | 3392 | progtype = PROG_TEXTURE;
|
3374 | | - glUtil_SetTexture(This->util,0,texture);
|
3375 | | - This->ext->glUniform1i(This->shaders->shaders[progtype].tex0,0);
|
| 3393 | + glUtil_SetTexture(This->util,8,texture);
|
| 3394 | + This->ext->glUniform1i(This->shaders->shaders[progtype].tex0,8);
|
3376 | 3395 | }
|
3377 | 3396 | if(This->ext->GLEXT_ARB_sampler_objects)
|
3378 | 3397 | {
|
— | — | @@ -3381,6 +3400,14 @@ |
3382 | 3401 | }
|
3383 | 3402 | else
|
3384 | 3403 | {
|
| 3404 | + if ((This->firstscalex != 1.0f) || (This->firstscaley != 1.0f))
|
| 3405 | + {
|
| 3406 | + glRenderer__DrawBackbuffer(This, &texture, texture->bigwidth, texture->bigheight, progtype, FALSE);
|
| 3407 | + ShaderManager_SetShader(This->shaders, PROG_TEXTURE, NULL, 0);
|
| 3408 | + progtype = PROG_TEXTURE;
|
| 3409 | + glUtil_SetTexture(This->util, 8, texture);
|
| 3410 | + This->ext->glUniform1i(This->shaders->shaders[progtype].tex0, 0);
|
| 3411 | + }
|
3385 | 3412 | ShaderManager_SetShader(This->shaders,PROG_TEXTURE,NULL,0);
|
3386 | 3413 | progtype = PROG_TEXTURE;
|
3387 | 3414 | glUtil_SetTexture(This->util,8,texture);
|
— | — | @@ -3702,7 +3729,19 @@ |
3703 | 3730 | glRenderer__SetSwap(This,0);
|
3704 | 3731 | glUtil_SetViewport(This->util, 0, 0, width, height);
|
3705 | 3732 | }
|
3706 | | -
|
| 3733 | + if (_isnan(dxglcfg.firstscalex) || _isnan(dxglcfg.firstscaley) ||
|
| 3734 | + (dxglcfg.firstscalex < 0.25f) || (dxglcfg.firstscaley < 0.25f))
|
| 3735 | + {
|
| 3736 | + if (width <= 400) This->firstscalex = 2.0f;
|
| 3737 | + else This->firstscaley = 1.0f;
|
| 3738 | + if (height <= 240) This->firstscaley = 2;
|
| 3739 | + else This->firstscaley = 1;
|
| 3740 | + }
|
| 3741 | + else
|
| 3742 | + {
|
| 3743 | + This->firstscalex = dxglcfg.firstscalex;
|
| 3744 | + This->firstscaley = dxglcfg.firstscaley;
|
| 3745 | + }
|
3707 | 3746 | SetEvent(This->busy);
|
3708 | 3747 | }
|
3709 | 3748 |
|
Index: ddraw/glRenderer.h |
— | — | @@ -159,6 +159,7 @@ |
160 | 160 | DWORD last_fvf;
|
161 | 161 | GLsizei fvf_stride;
|
162 | 162 | BOOL mode_3d;
|
| 163 | + float firstscalex, firstscaley;
|
163 | 164 | } glRenderer;
|
164 | 165 |
|
165 | 166 | HRESULT glRenderer_AddCommand(glRenderer *This, QueueCmd *cmd, BOOL inner, BOOL wait);
|
— | — | @@ -206,7 +207,7 @@ |
207 | 208 | void glRenderer__MakeTexture(glRenderer *This, glTexture *texture);
|
208 | 209 | void glRenderer__DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync, glTexture *previous, BOOL setsync);
|
209 | 210 | void glRenderer__DeleteTexture(glRenderer *This, glTexture *texture);
|
210 | | -void glRenderer__DrawBackbuffer(glRenderer *This, glTexture **texture, int x, int y, int progtype);
|
| 211 | +void glRenderer__DrawBackbuffer(glRenderer *This, glTexture **texture, int x, int y, int progtype, BOOL paletted);
|
211 | 212 | void glRenderer__DrawBackbufferRect(glRenderer *This, glTexture *texture, RECT srcrect, int progtype);
|
212 | 213 | void glRenderer__InitD3D(glRenderer *This, int zbuffer, int x, int y);
|
213 | 214 | void glRenderer__Clear(glRenderer *This, ClearCommand *cmd);
|
Index: dxglcfg/dxglcfg.c |
— | — | @@ -469,6 +469,7 @@ |
470 | 470 | *ptr = 0;
|
471 | 471 | *x = _ttof(buffer);
|
472 | 472 | *y = _ttof(ptr + 1);
|
| 473 | + if ((*x >= 0.25f) && (*y < 0.25f)) *y = *x;
|
473 | 474 | return;
|
474 | 475 | }
|
475 | 476 | else
|
Index: dxglcfg2/dxglcfg2.c |
— | — | @@ -523,6 +523,7 @@ |
524 | 524 | *ptr = 0;
|
525 | 525 | *x = _ttof(buffer);
|
526 | 526 | *y = _ttof(ptr + 1);
|
| 527 | + if ((*x >= 0.25f) && (*y < 0.25f)) *y = *x;
|
527 | 528 | return;
|
528 | 529 | }
|
529 | 530 | else
|