[Video] Move res_x, res_y out of settings class
This commit is contained in:
parent
a8484268e1
commit
115f9f48b6
|
@ -16,6 +16,8 @@
|
|||
#include "TexCache.h"
|
||||
#include <Project64-video/trace.h>
|
||||
|
||||
extern int g_scr_res_x, g_scr_res_y;
|
||||
|
||||
static int SetupFBtoScreenCombiner(uint32_t texture_size, uint32_t opaque)
|
||||
{
|
||||
int tmu;
|
||||
|
@ -99,11 +101,11 @@ static int SetupFBtoScreenCombiner(uint32_t texture_size, uint32_t opaque)
|
|||
static void DrawRE2Video(FB_TO_SCREEN_INFO & fb_info, float scale)
|
||||
{
|
||||
float scale_y = (float)fb_info.width / rdp.vi_height;
|
||||
float height = g_settings->scr_res_x() / scale_y;
|
||||
float height = g_scr_res_x / scale_y;
|
||||
float ul_x = 0.5f;
|
||||
float ul_y = (g_settings->scr_res_y() - height) / 2.0f;
|
||||
float lr_y = g_settings->scr_res_y() - ul_y - 1.0f;
|
||||
float lr_x = g_settings->scr_res_x() - 1.0f;
|
||||
float ul_y = (g_scr_res_y - height) / 2.0f;
|
||||
float lr_y = g_scr_res_y - ul_y - 1.0f;
|
||||
float lr_x = g_scr_res_x - 1.0f;
|
||||
float lr_u = (fb_info.width - 1)*scale;
|
||||
float lr_v = (fb_info.height - 1)*scale;
|
||||
VERTEX v[4] = {
|
||||
|
@ -475,7 +477,7 @@ static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
|
|||
GrTexInfo t_info;
|
||||
float scale = 0.25f;
|
||||
GrLOD_t LOD = GR_LOD_LOG2_1024;
|
||||
if (g_settings->scr_res_x() > 1024)
|
||||
if (g_scr_res_x > 1024)
|
||||
{
|
||||
scale = 0.125f;
|
||||
LOD = GR_LOD_LOG2_2048;
|
||||
|
|
|
@ -100,80 +100,115 @@ static unsigned long g_windowedExStyle, g_windowedStyle;
|
|||
bool g_fullscreen;
|
||||
#endif // _WIN32
|
||||
|
||||
void _ChangeSize()
|
||||
{
|
||||
rdp.scale_1024 = g_settings->scr_res_x() / 1024.0f;
|
||||
rdp.scale_768 = g_settings->scr_res_y() / 768.0f;
|
||||
|
||||
// float res_scl_x = (float)g_settings->res_x / 320.0f;
|
||||
float res_scl_y = (float)g_settings->res_y() / 240.0f;
|
||||
|
||||
uint32_t scale_x = *gfx.VI_X_SCALE_REG & 0xFFF;
|
||||
if (!scale_x) return;
|
||||
uint32_t scale_y = *gfx.VI_Y_SCALE_REG & 0xFFF;
|
||||
if (!scale_y) return;
|
||||
|
||||
float fscale_x = (float)scale_x / 1024.0f;
|
||||
float fscale_y = (float)scale_y / 2048.0f;
|
||||
|
||||
uint32_t dwHStartReg = *gfx.VI_H_START_REG;
|
||||
uint32_t dwVStartReg = *gfx.VI_V_START_REG;
|
||||
|
||||
uint32_t hstart = dwHStartReg >> 16;
|
||||
uint32_t hend = dwHStartReg & 0xFFFF;
|
||||
|
||||
// dunno... but sometimes this happens
|
||||
if (hend == hstart) hend = (int)(*gfx.VI_WIDTH_REG / fscale_x);
|
||||
|
||||
uint32_t vstart = dwVStartReg >> 16;
|
||||
uint32_t vend = dwVStartReg & 0xFFFF;
|
||||
|
||||
rdp.vi_width = (hend - hstart) * fscale_x;
|
||||
rdp.vi_height = (vend - vstart) * fscale_y * 1.0126582f;
|
||||
float aspect = (g_settings->adjust_aspect() && (fscale_y > fscale_x) && (rdp.vi_width > rdp.vi_height)) ? fscale_x / fscale_y : 1.0f;
|
||||
|
||||
WriteTrace(TraceResolution, TraceDebug, "hstart: %d, hend: %d, vstart: %d, vend: %d", hstart, hend, vstart, vend);
|
||||
WriteTrace(TraceResolution, TraceDebug, "size: %d x %d", (int)rdp.vi_width, (int)rdp.vi_height);
|
||||
|
||||
rdp.scale_x = (float)g_settings->res_x() / rdp.vi_width;
|
||||
if (region > 0 && g_settings->pal230())
|
||||
{
|
||||
// odd... but pal games seem to want 230 as height...
|
||||
rdp.scale_y = res_scl_y * (230.0f / rdp.vi_height) * aspect;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdp.scale_y = (float)g_settings->res_y() / rdp.vi_height * aspect;
|
||||
}
|
||||
// rdp.offset_x = g_settings->offset_x * res_scl_x;
|
||||
// rdp.offset_y = g_settings->offset_y * res_scl_y;
|
||||
//rdp.offset_x = 0;
|
||||
// rdp.offset_y = 0;
|
||||
rdp.offset_y = ((float)g_settings->res_y() - rdp.vi_height * rdp.scale_y) * 0.5f;
|
||||
if (((uint32_t)rdp.vi_width <= (*gfx.VI_WIDTH_REG) / 2) && (rdp.vi_width > rdp.vi_height))
|
||||
rdp.scale_y *= 0.5f;
|
||||
|
||||
rdp.scissor_o.ul_x = 0;
|
||||
rdp.scissor_o.ul_y = 0;
|
||||
rdp.scissor_o.lr_x = (uint32_t)rdp.vi_width;
|
||||
rdp.scissor_o.lr_y = (uint32_t)rdp.vi_height;
|
||||
|
||||
rdp.update |= UPDATE_VIEWPORT | UPDATE_SCISSOR;
|
||||
}
|
||||
extern int g_scr_res_x, g_res_x, g_scr_res_y, g_res_y;
|
||||
|
||||
void ChangeSize()
|
||||
{
|
||||
g_settings->UpdateScreenSize(ev_fullscreen);
|
||||
_ChangeSize();
|
||||
rdp.offset_x = (g_settings->scr_res_x() - g_settings->res_x()) / 2.0f;
|
||||
float offset_y = (g_settings->scr_res_y() - g_settings->res_y()) / 2.0f;
|
||||
WriteTrace(TraceResolution, TraceDebug, "Start");
|
||||
#ifdef ANDROID
|
||||
g_width = g_ScreenWidth;
|
||||
g_height = g_ScreenHeight;
|
||||
#else
|
||||
g_width = ev_fullscreen ? GetFullScreenResWidth(g_settings->FullScreenRes()) : GetScreenResWidth(g_settings->ScreenRes());
|
||||
g_height = ev_fullscreen ? GetFullScreenResHeight(g_settings->FullScreenRes()) : GetScreenResHeight(g_settings->ScreenRes());
|
||||
#endif
|
||||
g_scr_res_x = g_res_x = g_width;
|
||||
g_scr_res_y = g_res_y = g_height;
|
||||
|
||||
switch (g_settings->aspectmode())
|
||||
{
|
||||
case CSettings::Aspect_4x3:
|
||||
if (g_scr_res_x >= g_scr_res_y * 4.0f / 3.0f)
|
||||
{
|
||||
g_res_y = g_scr_res_y;
|
||||
g_res_x = (uint32_t)(g_res_y * 4.0f / 3.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_res_x = g_scr_res_x;
|
||||
g_res_y = (uint32_t)(g_res_x / 4.0f * 3.0f);
|
||||
}
|
||||
break;
|
||||
case CSettings::Aspect_16x9:
|
||||
if (g_scr_res_x >= g_scr_res_y * 16.0f / 9.0f)
|
||||
{
|
||||
g_res_y = g_scr_res_y;
|
||||
g_res_x = (uint32_t)(g_res_y * 16.0f / 9.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_res_x = g_scr_res_x;
|
||||
g_res_y = (uint32_t)(g_res_x / 16.0f * 9.0f);
|
||||
}
|
||||
break;
|
||||
default: //stretch or original
|
||||
g_res_x = g_scr_res_x;
|
||||
g_res_y = g_scr_res_y;
|
||||
}
|
||||
|
||||
rdp.scale_1024 = g_scr_res_x / 1024.0f;
|
||||
rdp.scale_768 = g_scr_res_y / 768.0f;
|
||||
|
||||
float res_scl_y = (float)g_res_y / 240.0f;
|
||||
|
||||
uint32_t scale_x = *gfx.VI_X_SCALE_REG & 0xFFF;
|
||||
uint32_t scale_y = *gfx.VI_Y_SCALE_REG & 0xFFF;
|
||||
if (scale_x != 0 && scale_y != 0)
|
||||
{
|
||||
float fscale_x = (float)scale_x / 1024.0f;
|
||||
float fscale_y = (float)scale_y / 2048.0f;
|
||||
|
||||
uint32_t dwHStartReg = *gfx.VI_H_START_REG;
|
||||
uint32_t dwVStartReg = *gfx.VI_V_START_REG;
|
||||
|
||||
uint32_t hstart = dwHStartReg >> 16;
|
||||
uint32_t hend = dwHStartReg & 0xFFFF;
|
||||
|
||||
// dunno... but sometimes this happens
|
||||
if (hend == hstart) hend = (int)(*gfx.VI_WIDTH_REG / fscale_x);
|
||||
|
||||
uint32_t vstart = dwVStartReg >> 16;
|
||||
uint32_t vend = dwVStartReg & 0xFFFF;
|
||||
|
||||
rdp.vi_width = (hend - hstart) * fscale_x;
|
||||
rdp.vi_height = (vend - vstart) * fscale_y * 1.0126582f;
|
||||
float aspect = (g_settings->adjust_aspect() && (fscale_y > fscale_x) && (rdp.vi_width > rdp.vi_height)) ? fscale_x / fscale_y : 1.0f;
|
||||
|
||||
WriteTrace(TraceResolution, TraceDebug, "hstart: %d, hend: %d, vstart: %d, vend: %d", hstart, hend, vstart, vend);
|
||||
WriteTrace(TraceResolution, TraceDebug, "size: %d x %d", (int)rdp.vi_width, (int)rdp.vi_height);
|
||||
|
||||
rdp.scale_x = (float)g_res_x / rdp.vi_width;
|
||||
if (region > 0 && g_settings->pal230())
|
||||
{
|
||||
// odd... but pal games seem to want 230 as height...
|
||||
rdp.scale_y = res_scl_y * (230.0f / rdp.vi_height) * aspect;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdp.scale_y = (float)g_res_y / rdp.vi_height * aspect;
|
||||
}
|
||||
rdp.offset_y = ((float)g_res_y - rdp.vi_height * rdp.scale_y) * 0.5f;
|
||||
if (((uint32_t)rdp.vi_width <= (*gfx.VI_WIDTH_REG) / 2) && (rdp.vi_width > rdp.vi_height))
|
||||
rdp.scale_y *= 0.5f;
|
||||
|
||||
rdp.scissor_o.ul_x = 0;
|
||||
rdp.scissor_o.ul_y = 0;
|
||||
rdp.scissor_o.lr_x = (uint32_t)rdp.vi_width;
|
||||
rdp.scissor_o.lr_y = (uint32_t)rdp.vi_height;
|
||||
|
||||
rdp.update |= UPDATE_VIEWPORT | UPDATE_SCISSOR;
|
||||
}
|
||||
rdp.offset_x = (g_scr_res_x - g_res_x) / 2.0f;
|
||||
float offset_y = (g_scr_res_y - g_res_y) / 2.0f;
|
||||
rdp.offset_y += offset_y;
|
||||
if (g_settings->aspectmode() == CSettings::Aspect_Original)
|
||||
{
|
||||
rdp.scale_x = rdp.scale_y = 1.0f;
|
||||
rdp.offset_x = (g_settings->scr_res_x() - rdp.vi_width) / 2.0f;
|
||||
rdp.offset_y = (g_settings->scr_res_y() - rdp.vi_height) / 2.0f;
|
||||
rdp.offset_x = (g_scr_res_x - rdp.vi_width) / 2.0f;
|
||||
rdp.offset_y = (g_scr_res_y - rdp.vi_height) / 2.0f;
|
||||
}
|
||||
WriteTrace(TraceResolution, TraceDebug, "rdp.offset_x = %f rdp.offset_y = %f rdp.scale_x = %f, rdp.scale_y = %f", rdp.offset_x, rdp.offset_y, rdp.scale_x, rdp.scale_y);
|
||||
WriteTrace(TraceResolution, TraceDebug, "Done");
|
||||
}
|
||||
|
||||
void ConfigWrapper()
|
||||
|
@ -209,7 +244,7 @@ void guLoadTextures()
|
|||
tbuf_size = 8 * grTexCalcMemRequired(GR_LOD_LOG2_256, GR_LOD_LOG2_256,
|
||||
GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565);
|
||||
}
|
||||
else if (g_settings->scr_res_x() <= 1024)
|
||||
else if (g_scr_res_x <= 1024)
|
||||
{
|
||||
grTextureBufferExt(GR_TMU0, voodoo.tex_min_addr[GR_TMU0], GR_LOD_LOG2_1024, GR_LOD_LOG2_1024,
|
||||
GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
|
||||
|
@ -487,7 +522,7 @@ int InitGfx()
|
|||
WriteTrace(TraceGlide64, TraceDebug, "Using TEXUMA extension");
|
||||
}
|
||||
|
||||
g_settings->UpdateScreenSize(ev_fullscreen);
|
||||
ChangeSize();
|
||||
#ifndef ANDROID
|
||||
SetWindowDisplaySize((HWND)gfx.hWnd);
|
||||
#endif
|
||||
|
@ -614,7 +649,7 @@ int InitGfx()
|
|||
grTexFilterMode(1, GR_TEXTUREFILTER_BILINEAR, GR_TEXTUREFILTER_BILINEAR);
|
||||
grTexClampMode(0, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP);
|
||||
grTexClampMode(1, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP);
|
||||
grClipWindow(0, 0, g_settings->scr_res_x(), g_settings->scr_res_y());
|
||||
grClipWindow(0, 0, g_scr_res_x, g_scr_res_y);
|
||||
rdp.update |= UPDATE_SCISSOR | UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE;
|
||||
|
||||
if (!g_ghq_use)
|
||||
|
@ -734,9 +769,9 @@ extern "C" int WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID /*lpReser
|
|||
|
||||
void CALL ReadScreen(void **dest, int *width, int *height)
|
||||
{
|
||||
*width = g_settings->res_x();
|
||||
*height = g_settings->res_y();
|
||||
uint8_t * buff = (uint8_t*)malloc(g_settings->res_x() * g_settings->res_y() * 3);
|
||||
*width = g_res_x;
|
||||
*height = g_res_y;
|
||||
uint8_t * buff = (uint8_t*)malloc(g_res_x * g_res_y * 3);
|
||||
uint8_t * line = buff;
|
||||
*dest = (void*)buff;
|
||||
|
||||
|
@ -749,17 +784,17 @@ void CALL ReadScreen(void **dest, int *width, int *height)
|
|||
FXFALSE,
|
||||
&info))
|
||||
{
|
||||
uint32_t offset_src = info.strideInBytes*(g_settings->scr_res_y() - 1);
|
||||
uint32_t offset_src = info.strideInBytes*(g_scr_res_y - 1);
|
||||
|
||||
// Copy the screen
|
||||
uint8_t r, g, b;
|
||||
if (info.writeMode == GR_LFBWRITEMODE_8888)
|
||||
{
|
||||
uint32_t col;
|
||||
for (uint32_t y = 0; y < g_settings->res_y(); y++)
|
||||
for (uint32_t y = 0; y < g_res_y; y++)
|
||||
{
|
||||
uint32_t *ptr = (uint32_t*)((uint8_t*)info.lfbPtr + offset_src);
|
||||
for (uint32_t x = 0; x < g_settings->res_x(); x++)
|
||||
for (uint32_t x = 0; x < g_res_x; x++)
|
||||
{
|
||||
col = *(ptr++);
|
||||
r = (uint8_t)((col >> 16) & 0xFF);
|
||||
|
@ -769,17 +804,17 @@ void CALL ReadScreen(void **dest, int *width, int *height)
|
|||
line[x * 3 + 1] = g;
|
||||
line[x * 3 + 2] = r;
|
||||
}
|
||||
line += g_settings->res_x() * 3;
|
||||
line += g_res_x * 3;
|
||||
offset_src -= info.strideInBytes;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16_t col;
|
||||
for (uint32_t y = 0; y < g_settings->res_y(); y++)
|
||||
for (uint32_t y = 0; y < g_res_y; y++)
|
||||
{
|
||||
uint16_t *ptr = (uint16_t*)((uint8_t*)info.lfbPtr + offset_src);
|
||||
for (uint32_t x = 0; x < g_settings->res_x(); x++)
|
||||
for (uint32_t x = 0; x < g_res_x; x++)
|
||||
{
|
||||
col = *(ptr++);
|
||||
r = (uint8_t)((float)(col >> 11) / 31.0f * 255.0f);
|
||||
|
@ -789,7 +824,7 @@ void CALL ReadScreen(void **dest, int *width, int *height)
|
|||
line[x * 3 + 1] = g;
|
||||
line[x * 3 + 2] = r;
|
||||
}
|
||||
line += g_settings->res_x() * 3;
|
||||
line += g_res_x * 3;
|
||||
offset_src -= info.strideInBytes;
|
||||
}
|
||||
}
|
||||
|
@ -923,9 +958,9 @@ void CALL GetDllInfo(PLUGIN_INFO * PluginInfo)
|
|||
PluginInfo->Version = 0x0104; // Set to 0x0104
|
||||
PluginInfo->Type = PLUGIN_TYPE_GFX; // Set to PLUGIN_TYPE_GFX
|
||||
#ifdef _DEBUG
|
||||
sprintf(PluginInfo->Name, "Glide64 For PJ64 (Debug): %s", VER_FILE_VERSION_STR);
|
||||
sprintf(PluginInfo->Name, "Project64 Video Plugin (Debug): %s", VER_FILE_VERSION_STR);
|
||||
#else
|
||||
sprintf(PluginInfo->Name, "Glide64 For PJ64: %s", VER_FILE_VERSION_STR);
|
||||
sprintf(PluginInfo->Name, "Project64 Video Plugin: %s", VER_FILE_VERSION_STR);
|
||||
#endif
|
||||
|
||||
// If DLL supports memory these memory options then set them to TRUE or FALSE
|
||||
|
@ -1404,7 +1439,7 @@ void newSwapBuffers()
|
|||
WriteTrace(TraceRDP, TraceDebug, "swapped");
|
||||
|
||||
rdp.update |= UPDATE_SCISSOR | UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE;
|
||||
grClipWindow(0, 0, g_settings->scr_res_x(), g_settings->scr_res_y());
|
||||
grClipWindow(0, 0, g_scr_res_x, g_scr_res_y);
|
||||
grDepthBufferFunction(GR_CMP_ALWAYS);
|
||||
grDepthMask(FXFALSE);
|
||||
grCullMode(GR_CULL_DISABLE);
|
||||
|
@ -1432,8 +1467,8 @@ void newSwapBuffers()
|
|||
|
||||
const uint32_t offset_x = (uint32_t)rdp.offset_x;
|
||||
const uint32_t offset_y = (uint32_t)rdp.offset_y;
|
||||
const uint32_t image_width = g_settings->scr_res_x() - offset_x * 2;
|
||||
const uint32_t image_height = g_settings->scr_res_y() - offset_y * 2;
|
||||
const uint32_t image_width = g_scr_res_x - offset_x * 2;
|
||||
const uint32_t image_height = g_scr_res_y - offset_y * 2;
|
||||
|
||||
GrLfbInfo_t info;
|
||||
info.size = sizeof(GrLfbInfo_t);
|
||||
|
|
|
@ -139,7 +139,8 @@ typedef struct
|
|||
|
||||
int nbTextureUnits;
|
||||
int nbAuxBuffers, current_buffer;
|
||||
int g_width, widtho, heighto, g_height;
|
||||
int g_scr_res_x, g_width, widtho, heighto, g_scr_res_y, g_height;
|
||||
int g_res_x, g_res_y;
|
||||
int saved_width, saved_height;
|
||||
int blend_func_separate_support;
|
||||
int npot_support;
|
||||
|
|
|
@ -281,7 +281,8 @@ typedef struct
|
|||
|
||||
int nbTextureUnits;
|
||||
int nbAuxBuffers, current_buffer;
|
||||
int g_width, widtho, heighto, g_height;
|
||||
int g_scr_res_x, g_width, widtho, heighto, g_scr_res_y, g_height;
|
||||
int g_res_x, g_res_y;
|
||||
int saved_width, saved_height;
|
||||
int blend_func_separate_support;
|
||||
int npot_support;
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
#include "Gfx_1.3.h"
|
||||
#include "ScreenResolution.h"
|
||||
#include "SettingsID.h"
|
||||
|
||||
extern int g_width, g_height;
|
||||
#include "trace.h"
|
||||
|
||||
CSettings::CSettings() :
|
||||
m_Set_basic_mode(0),
|
||||
|
@ -24,10 +23,6 @@ CSettings::CSettings() :
|
|||
m_Set_log_dir(0),
|
||||
m_Set_log_flush(0),
|
||||
m_dirty(false),
|
||||
m_res_x(GetScreenResWidth(GetDefaultScreenRes())),
|
||||
m_scr_res_x(GetScreenResWidth(GetDefaultScreenRes())),
|
||||
m_res_y(GetScreenResHeight(GetDefaultScreenRes())),
|
||||
m_scr_res_y(GetScreenResHeight(GetDefaultScreenRes())),
|
||||
m_ScreenRes(GetDefaultScreenRes()),
|
||||
m_advanced_options(false),
|
||||
m_debugger_enabled(false),
|
||||
|
@ -265,33 +260,11 @@ void CSettings::SetScreenRes(uint32_t value)
|
|||
}
|
||||
}
|
||||
|
||||
void CSettings::UpdateScreenSize(bool fullscreen)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
if (fullscreen)
|
||||
{
|
||||
g_width = GetFullScreenResWidth(m_FullScreenRes);
|
||||
g_height = GetFullScreenResHeight(m_FullScreenRes);
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
g_width = GetScreenResWidth(m_ScreenRes);
|
||||
g_height = GetScreenResHeight(m_ScreenRes);
|
||||
#ifndef ANDROID
|
||||
}
|
||||
#endif
|
||||
m_scr_res_x = m_res_x = g_width;
|
||||
m_scr_res_y = m_res_y = g_height;
|
||||
UpdateAspectRatio();
|
||||
}
|
||||
|
||||
void CSettings::SetAspectmode(AspectMode_t value)
|
||||
{
|
||||
if (value != m_aspectmode)
|
||||
{
|
||||
m_aspectmode = value;
|
||||
UpdateAspectRatio();
|
||||
m_dirty = true;
|
||||
}
|
||||
}
|
||||
|
@ -563,42 +536,6 @@ void CSettings::SetFullScreenRes(uint32_t value)
|
|||
}
|
||||
#endif
|
||||
|
||||
void CSettings::UpdateAspectRatio(void)
|
||||
{
|
||||
switch (m_aspectmode)
|
||||
{
|
||||
case Aspect_4x3:
|
||||
if (m_scr_res_x >= m_scr_res_y * 4.0f / 3.0f) {
|
||||
m_res_y = m_scr_res_y;
|
||||
m_res_x = (uint32_t)(m_res_y * 4.0f / 3.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_res_x = m_scr_res_x;
|
||||
m_res_y = (uint32_t)(m_res_x / 4.0f * 3.0f);
|
||||
}
|
||||
break;
|
||||
case Aspect_16x9:
|
||||
if (m_scr_res_x >= m_scr_res_y * 16.0f / 9.0f)
|
||||
{
|
||||
m_res_y = m_scr_res_y;
|
||||
m_res_x = (uint32_t)(m_res_y * 16.0f / 9.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_res_x = m_scr_res_x;
|
||||
m_res_y = (uint32_t)(m_res_x / 16.0f * 9.0f);
|
||||
}
|
||||
break;
|
||||
default: //stretch or original
|
||||
m_res_x = m_scr_res_x;
|
||||
m_res_y = m_scr_res_y;
|
||||
}
|
||||
|
||||
m_res_x += (uint32_t)(m_scr_res_x - m_res_x) / 2.0f;
|
||||
m_res_y += (uint32_t)(m_scr_res_y - m_res_y) / 2.0f;
|
||||
}
|
||||
|
||||
void CSettings::ReadSettings()
|
||||
{
|
||||
SetScreenRes(GetSetting(Set_Resolution));
|
||||
|
|
|
@ -197,10 +197,6 @@ public:
|
|||
inline bool fb_optimize_texrect_enabled(void) const { return ((m_frame_buffer&fb_optimize_texrect) != 0); }
|
||||
|
||||
inline const char * log_dir(void) const { return m_log_dir; }
|
||||
inline uint32_t res_x(void) const { return m_res_x; }
|
||||
inline uint32_t res_y(void) const { return m_res_y; }
|
||||
inline uint32_t scr_res_x(void) const { return m_scr_res_x; }
|
||||
inline uint32_t scr_res_y(void) const { return m_scr_res_y; }
|
||||
inline uint32_t ScreenRes(void) const { return m_ScreenRes; }
|
||||
inline bool advanced_options(void) const { return m_advanced_options; }
|
||||
inline bool debugger_enabled(void) const { return m_debugger_enabled; }
|
||||
|
@ -314,7 +310,6 @@ public:
|
|||
void ReadSettings();
|
||||
void ReadGameSettings(const char * name);
|
||||
void WriteSettings(void);
|
||||
void UpdateScreenSize(bool fullscreen);
|
||||
|
||||
private:
|
||||
static void general_setting(short setting_ID, const char * name, unsigned int value);
|
||||
|
@ -322,7 +317,6 @@ private:
|
|||
static void game_setting_default(short setting_ID, const char * name, short default_setting);
|
||||
|
||||
void RegisterSettings(void);
|
||||
void UpdateAspectRatio(void);
|
||||
void SettingsChanged(void);
|
||||
void LogLevelChanged(void);
|
||||
|
||||
|
@ -352,8 +346,6 @@ private:
|
|||
bool m_FlushLogs;
|
||||
char m_log_dir[260];
|
||||
uint32_t m_ScreenRes;
|
||||
uint32_t m_res_x, m_scr_res_x;
|
||||
uint32_t m_res_y, m_scr_res_y;
|
||||
AspectMode_t m_aspectmode;
|
||||
uint32_t m_frame_buffer;
|
||||
FBCRCMODE_t m_fb_crc_mode;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#include "CRC.h"
|
||||
#include <Project64-video/trace.h>
|
||||
|
||||
extern int g_scr_res_x, g_res_x, g_scr_res_y, g_res_y;
|
||||
|
||||
static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage)
|
||||
{
|
||||
TBUFF_COLOR_IMAGE texbuf;
|
||||
|
@ -26,7 +28,7 @@ static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage)
|
|||
texbuf.height = cimage.height;
|
||||
texbuf.format = cimage.format;
|
||||
texbuf.size = cimage.size;
|
||||
texbuf.scr_width = minval(cimage.width * rdp.scale_x, g_settings->scr_res_x());
|
||||
texbuf.scr_width = minval(cimage.width * rdp.scale_x, g_scr_res_x);
|
||||
float height = minval(rdp.vi_height, cimage.height);
|
||||
if (cimage.status == ci_copy_self || (cimage.status == ci_copy && cimage.width == rdp.frame_buffers[rdp.main_ci_index].width))
|
||||
height = rdp.vi_height;
|
||||
|
@ -338,7 +340,7 @@ static GrTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE)
|
|||
GR_BLEND_ZERO,
|
||||
GR_BLEND_ONE,
|
||||
GR_BLEND_ZERO);
|
||||
grClipWindow(0, 0, g_settings->scr_res_x(), g_settings->scr_res_y());
|
||||
grClipWindow(0, 0, g_scr_res_x, g_scr_res_y);
|
||||
grDepthBufferFunction(GR_CMP_ALWAYS);
|
||||
grDepthMask(FXFALSE);
|
||||
grCullMode(GR_CULL_DISABLE);
|
||||
|
@ -426,7 +428,7 @@ int CloseTextureBuffer(int draw)
|
|||
};
|
||||
|
||||
grTexSource(rdp.tbuff_tex->tmu, rdp.tbuff_tex->tex_addr, GR_MIPMAPLEVELMASK_BOTH, &(rdp.tbuff_tex->info));
|
||||
grClipWindow(0, 0, g_settings->res_x(), g_settings->res_y());
|
||||
grClipWindow(0, 0, g_res_x, g_res_y);
|
||||
grDrawTriangle(&v[0], &v[2], &v[1]);
|
||||
grDrawTriangle(&v[2], &v[3], &v[1]);
|
||||
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE;
|
||||
|
@ -488,7 +490,7 @@ int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
|
|||
rdp.offset_y = rdp.offset_y_bak;
|
||||
rdp.offset_x_bak = rdp.offset_y_bak = 0;
|
||||
AddOffset(v, 4);
|
||||
grClipWindow(0, 0, g_settings->res_x(), g_settings->res_y());
|
||||
grClipWindow(0, 0, g_res_x, g_res_y);
|
||||
grDrawTriangle(&v[0], &v[2], &v[1]);
|
||||
grDrawTriangle(&v[2], &v[3], &v[1]);
|
||||
rdp.tbuff_tex->info.format = buf_format;
|
||||
|
@ -508,7 +510,7 @@ int CopyDepthBuffer()
|
|||
WriteTrace(TraceRDP, TraceDebug, "CopyDepthBuffer. ");
|
||||
float bound = 1024.0f;
|
||||
GrLOD_t LOD = GR_LOD_LOG2_1024;
|
||||
if (g_settings->scr_res_x() > 1024)
|
||||
if (g_scr_res_x > 1024)
|
||||
{
|
||||
bound = 2048.0f;
|
||||
LOD = GR_LOD_LOG2_2048;
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
VERTEX *vtx_list1[32]; // vertex indexing
|
||||
VERTEX *vtx_list2[32];
|
||||
|
||||
extern int g_scr_res_x, g_scr_res_y;
|
||||
|
||||
//
|
||||
// util_init - initialize data for the functions in this file
|
||||
//
|
||||
|
@ -1630,10 +1632,10 @@ void update_scissor()
|
|||
rdp.update ^= UPDATE_SCISSOR;
|
||||
|
||||
// KILL the floating point error with 0.01f
|
||||
rdp.scissor.ul_x = (uint32_t)maxval(minval((rdp.scissor_o.ul_x * rdp.scale_x + rdp.offset_x + 0.01f), g_settings->res_x()), 0);
|
||||
rdp.scissor.lr_x = (uint32_t)maxval(minval((rdp.scissor_o.lr_x * rdp.scale_x + rdp.offset_x + 0.01f), g_settings->res_x()), 0);
|
||||
rdp.scissor.ul_y = (uint32_t)maxval(minval((rdp.scissor_o.ul_y * rdp.scale_y + rdp.offset_y + 0.01f), g_settings->res_y()), 0);
|
||||
rdp.scissor.lr_y = (uint32_t)maxval(minval((rdp.scissor_o.lr_y * rdp.scale_y + rdp.offset_y + 0.01f), g_settings->res_y()), 0);
|
||||
rdp.scissor.ul_x = (uint32_t)maxval(minval((rdp.scissor_o.ul_x * rdp.scale_x + rdp.offset_x + 0.01f), g_scr_res_x), 0);
|
||||
rdp.scissor.lr_x = (uint32_t)maxval(minval((rdp.scissor_o.lr_x * rdp.scale_x + rdp.offset_x + 0.01f), g_scr_res_x), 0);
|
||||
rdp.scissor.ul_y = (uint32_t)maxval(minval((rdp.scissor_o.ul_y * rdp.scale_y + rdp.offset_y + 0.01f), g_scr_res_y), 0);
|
||||
rdp.scissor.lr_y = (uint32_t)maxval(minval((rdp.scissor_o.lr_y * rdp.scale_y + rdp.offset_y + 0.01f), g_scr_res_y), 0);
|
||||
//grClipWindow specifies the hardware clipping window. Any pixels outside the clipping window are rejected.
|
||||
//Values are inclusive for minimum x and y values and exclusive for maximum x and y values.
|
||||
// grClipWindow (rdp.scissor.ul_x?rdp.scissor.ul_x+1:0, rdp.scissor.ul_y?rdp.scissor.ul_y+1:0, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
|
@ -1942,8 +1944,8 @@ void update()
|
|||
|
||||
rdp.clip_min_x = maxval((rdp.view_trans[0] - scale_x + rdp.offset_x) / rdp.clip_ratio, 0.0f);
|
||||
rdp.clip_min_y = maxval((rdp.view_trans[1] - scale_y + rdp.offset_y) / rdp.clip_ratio, 0.0f);
|
||||
rdp.clip_max_x = minval((rdp.view_trans[0] + scale_x + rdp.offset_x) * rdp.clip_ratio, g_settings->res_x());
|
||||
rdp.clip_max_y = minval((rdp.view_trans[1] + scale_y + rdp.offset_y) * rdp.clip_ratio, g_settings->res_y());
|
||||
rdp.clip_max_x = minval((rdp.view_trans[0] + scale_x + rdp.offset_x) * rdp.clip_ratio, g_scr_res_x);
|
||||
rdp.clip_max_y = minval((rdp.view_trans[1] + scale_y + rdp.offset_y) * rdp.clip_ratio, g_scr_res_y);
|
||||
|
||||
WriteTrace(TraceRDP, TraceDebug, " |- viewport - (%d, %d, %d, %d)", (uint32_t)rdp.clip_min_x, (uint32_t)rdp.clip_min_y, (uint32_t)rdp.clip_max_x, (uint32_t)rdp.clip_max_y);
|
||||
if (!rdp.scissor_set)
|
||||
|
|
|
@ -447,8 +447,8 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GR_BUFFER_BACKBUFFER)
|
|||
}
|
||||
else
|
||||
{
|
||||
float scale_x = (g_settings->scr_res_x() - rdp.offset_x*2.0f) / maxval(width, rdp.vi_width);
|
||||
float scale_y = (g_settings->scr_res_y() - rdp.offset_y*2.0f) / maxval(height, rdp.vi_height);
|
||||
float scale_x = (g_scr_res_x - rdp.offset_x*2.0f) / maxval(width, rdp.vi_width);
|
||||
float scale_y = (g_scr_res_y - rdp.offset_y*2.0f) / maxval(height, rdp.vi_height);
|
||||
|
||||
WriteTrace(TraceRDP, TraceDebug, "width: %d, height: %d, ul_y: %d, lr_y: %d, scale_x: %f, scale_y: %f, ci_width: %d, ci_height: %d", width, height, rdp.ci_upper_bound, rdp.ci_lower_bound, scale_x, scale_y, rdp.ci_width, rdp.ci_height);
|
||||
GrLfbInfo_t info;
|
||||
|
@ -2267,8 +2267,8 @@ static void rdp_fillrect()
|
|||
|
||||
if (s_lr_x < 0) s_lr_x = 0;
|
||||
if (s_lr_y < 0) s_lr_y = 0;
|
||||
if ((uint32_t)s_ul_x > g_settings->res_x()) { s_ul_x = g_settings->res_x(); }
|
||||
if ((uint32_t)s_ul_y > g_settings->res_y()) { s_ul_y = g_settings->res_y(); }
|
||||
if ((uint32_t)s_ul_x > g_res_x) { s_ul_x = g_res_x; }
|
||||
if ((uint32_t)s_ul_y > g_res_y) { s_ul_y = g_res_y; }
|
||||
|
||||
WriteTrace(TraceRDP, TraceDebug, " - %d, %d, %d, %d", s_ul_x, s_ul_y, s_lr_x, s_lr_y);
|
||||
|
||||
|
@ -2706,7 +2706,7 @@ static void rdp_setcolorimage()
|
|||
{
|
||||
if (g_settings->fb_hwfbe_enabled() && !rdp.copy_ci_index && (rdp.copy_zi_index || g_settings->hacks(CSettings::hack_BAR)))
|
||||
{
|
||||
GrLOD_t LOD = g_settings->scr_res_x() > 1024 ? GR_LOD_LOG2_1024 : GR_LOD_LOG2_2048;
|
||||
GrLOD_t LOD = g_scr_res_x > 1024 ? GR_LOD_LOG2_1024 : GR_LOD_LOG2_2048;
|
||||
grTextureAuxBufferExt(rdp.texbufs[0].tmu, rdp.texbufs[0].begin, LOD, LOD,
|
||||
GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
|
||||
grAuxBufferExt(GR_BUFFER_TEXTUREAUXBUFFER_EXT);
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
extern int g_scr_res_x, g_res_x, g_scr_res_y, g_res_y;
|
||||
|
||||
static float set_sprite_combine_mode()
|
||||
{
|
||||
|
@ -183,7 +184,7 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
|
|||
grDepthBufferFunction(GR_CMP_ALWAYS);
|
||||
grDepthMask(FXFALSE);
|
||||
|
||||
GrLOD_t LOD = g_settings->scr_res_x() > 1024 ? GR_LOD_LOG2_2048 : GR_LOD_LOG2_1024;
|
||||
GrLOD_t LOD = g_scr_res_x > 1024 ? GR_LOD_LOG2_2048 : GR_LOD_LOG2_1024;
|
||||
|
||||
float lr_x = (float)d.imageW * rdp.scale_x;
|
||||
float lr_y = (float)d.imageH * rdp.scale_y;
|
||||
|
@ -233,8 +234,8 @@ void DrawDepthImage(const DRAWIMAGE & d)
|
|||
float scale_y_src = 1.0f / rdp.scale_y;
|
||||
int src_width = d.imageW;
|
||||
int src_height = d.imageH;
|
||||
int dst_width = minval(int(src_width*scale_x_dst), (int)g_settings->scr_res_x());
|
||||
int dst_height = minval(int(src_height*scale_y_dst), (int)g_settings->scr_res_y());
|
||||
int dst_width = minval(int(src_width*scale_x_dst), (int)g_scr_res_x);
|
||||
int dst_height = minval(int(src_height*scale_y_dst), (int)g_scr_res_y);
|
||||
uint16_t * src = (uint16_t*)(gfx.RDRAM + d.imagePtr);
|
||||
uint16_t * dst = new uint16_t[dst_width*dst_height];
|
||||
for (int y = 0; y < dst_height; y++)
|
||||
|
@ -420,7 +421,7 @@ void DrawImage(DRAWIMAGE & d)
|
|||
rdp.allow_combine = 0;
|
||||
|
||||
if (rdp.ci_width == 512 && !no_dlist)
|
||||
grClipWindow(0, 0, g_settings->scr_res_x(), g_settings->scr_res_y());
|
||||
grClipWindow(0, 0, g_scr_res_x, g_scr_res_y);
|
||||
else if (d.scaleX == 1.0f && d.scaleY == 1.0f)
|
||||
grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
else
|
||||
|
@ -572,7 +573,7 @@ void DrawHiresImage(DRAWIMAGE & d, int screensize = FALSE)
|
|||
setTBufTex(rdp.tbuff_tex->t_mem, rdp.tbuff_tex->width << rdp.tbuff_tex->size >> 1);
|
||||
|
||||
const float Z = set_sprite_combine_mode();
|
||||
grClipWindow(0, 0, g_settings->res_x(), g_settings->res_y());
|
||||
grClipWindow(0, 0, g_res_x, g_res_y);
|
||||
|
||||
if (d.imageW % 2 == 1) d.imageW -= 1;
|
||||
if (d.imageH % 2 == 1) d.imageH -= 1;
|
||||
|
|
Loading…
Reference in New Issue