mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-26 20:31:41 +00:00
Handle real-time modifications of some video config values.
This commit is contained in:
parent
99b0cf3c31
commit
faa053cd77
2 changed files with 23 additions and 2 deletions
|
|
@ -1306,6 +1306,7 @@ static void BeginCommandList()
|
|||
g_pipelineState.renderTargetFormat = g_backBuffer->format;
|
||||
g_pipelineState.depthStencilFormat = RenderFormat::UNKNOWN;
|
||||
|
||||
g_swapChain->setVsyncEnabled(Config::VSync);
|
||||
g_swapChainValid &= !g_swapChain->needsResize();
|
||||
|
||||
if (!g_swapChainValid)
|
||||
|
|
@ -3746,8 +3747,8 @@ void SetShadowResolutionMidAsmHook(PPCRegister& r11)
|
|||
|
||||
static void SetResolution(be<uint32_t>* device)
|
||||
{
|
||||
uint32_t width = uint32_t(g_swapChain->getWidth() * Config::ResolutionScale);
|
||||
uint32_t height = uint32_t(g_swapChain->getHeight() * Config::ResolutionScale);
|
||||
uint32_t width = uint32_t(round(g_swapChain->getWidth() * Config::ResolutionScale));
|
||||
uint32_t height = uint32_t(round(g_swapChain->getHeight() * Config::ResolutionScale));
|
||||
device[46] = width == 0 ? 880 : width;
|
||||
device[47] = height == 0 ? 720 : height;
|
||||
}
|
||||
|
|
@ -3891,6 +3892,15 @@ void ParticleTestDrawIndexedPrimitiveMidAsmHook(PPCRegister& r7)
|
|||
r7.u64 = std::size(g_particleTestIndexBuffer);
|
||||
}
|
||||
|
||||
void VideoConfigValueChangedCallback(IConfigDef* config)
|
||||
{
|
||||
// Config options that require internal resolution resize
|
||||
g_needsResize |=
|
||||
config == &Config::ResolutionScale ||
|
||||
config == &Config::AntiAliasing ||
|
||||
config == &Config::ShadowResolution;
|
||||
}
|
||||
|
||||
GUEST_FUNCTION_HOOK(sub_82BD99B0, CreateDevice);
|
||||
|
||||
GUEST_FUNCTION_HOOK(sub_82BE6230, DestructResource);
|
||||
|
|
|
|||
|
|
@ -371,6 +371,9 @@ static void DrawCategories()
|
|||
drawList->PushClipRect({ clipRectMin.x, clipRectMin.y + gridSize * 6.0f }, { clipRectMax.x - gridSize, clipRectMax.y - gridSize });
|
||||
}
|
||||
|
||||
// extern definition to avoid including "video.h", the header is quite large
|
||||
extern void VideoConfigValueChangedCallback(IConfigDef* config);
|
||||
|
||||
template<typename T>
|
||||
static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* config, T valueMin = T(0), T valueCenter = T(0.5), T valueMax = T(1))
|
||||
{
|
||||
|
|
@ -417,6 +420,8 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
|
|||
|
||||
if (config->Callback)
|
||||
config->Callback(config);
|
||||
|
||||
VideoConfigValueChangedCallback(config);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -433,6 +438,12 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
|
|||
// remember value
|
||||
s_oldValue = config->Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
// released lock, call video callbacks if value is different
|
||||
if (config->Value != s_oldValue)
|
||||
VideoConfigValueChangedCallback(config);
|
||||
}
|
||||
}
|
||||
else if (padState.IsTapped(SWA::eKeyState_B))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue