Skip to content

Commit

Permalink
Fixed SR settings (#1030)
Browse files Browse the repository at this point in the history
  • Loading branch information
mercury501 authored Sep 4, 2024
1 parent 87be30f commit dce8ece
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 41 deletions.
8 changes: 4 additions & 4 deletions Launcher/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,8 @@
<Title>Chainsaw only spawns on New Game+</Title>
<Description>Prevents the chainsaw from spawning on a first playthrough, which is a developer-intended design choice.</Description>
<Choices type="check">
<Value name="Disable">0</Value>
<Value name="Enable" default="true" speedrun-default="true">1</Value>
<Value name="Disable" speedrun-default="true">0</Value>
<Value name="Enable" default="true">1</Value>
</Choices>
</Feature>

Expand Down Expand Up @@ -1347,11 +1347,11 @@
</Choices>
</Feature>

<Feature name="LegacyFixGPUAntiAliasing">
<Feature name="LegacyFixGPUAntiAliasing" speedrun="true">
<Title>Fix GPU anti-aliasing</Title>
<Description>Fixes issues for Nvidia graphics cards, such as missing/incorrect shadows, when force-enabling anti-aliasing through of your GPU's control panel.</Description>
<Choices type="check">
<Value name="Disable" default="true">0</Value>
<Value name="Disable" default="true" speedrun-default="true">0</Value>
<Value name="Enable">1</Value>
</Choices>
</Feature>
Expand Down
8 changes: 4 additions & 4 deletions Launcher/config_br.xml
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,8 @@
<Title>Motosserra apenas em Novo Jogo+</Title>
<Description>Impede que a motosserra apareça na primeira jogada, que é uma escolha de design pretendida pela desenvolvedora.</Description>
<Choices type="check">
<Value name="Desativar">0</Value>
<Value name="Ativar" default="true" speedrun-default="true">1</Value>
<Value name="Desativar" speedrun-default="true">0</Value>
<Value name="Ativar" default="true">1</Value>
</Choices>
</Feature>

Expand Down Expand Up @@ -1347,11 +1347,11 @@
</Choices>
</Feature>

<Feature name="LegacyFixGPUAntiAliasing">
<Feature name="LegacyFixGPUAntiAliasing" speedrun="true">
<Title>Corrigir anti-aliasing de GPU</Title>
<Description>Corrige problemas para placas de vídeo Nvidia, como sombras ausentes/incorretas, ao ativar o anti-aliasing por meio do painel de controle da GPU.</Description>
<Choices type="check">
<Value name="Desativar" default="true">0</Value>
<Value name="Desativar" default="true" speedrun-default="true">0</Value>
<Value name="Ativar">1</Value>
</Choices>
</Feature>
Expand Down
8 changes: 4 additions & 4 deletions Launcher/config_es.xml
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,8 @@
<Title>Activar la motosierra solo en una Nueva partida+</Title>
<Description>Evita que aparezca la motosierra en una partida inicial, lo que es una decisión de diseño intencionada de los desarrolladores.</Description>
<Choices type="check">
<Value name="No">0</Value>
<Value name="" default="true" speedrun-default="true">1</Value>
<Value name="No" speedrun-default="true">0</Value>
<Value name="" default="true">1</Value>
</Choices>
</Feature>

Expand Down Expand Up @@ -1356,11 +1356,11 @@
</Choices>
</Feature>

<Feature name="LegacyFixGPUAntiAliasing">
<Feature name="LegacyFixGPUAntiAliasing" speedrun="true">
<Title>Corregir el suavizado de bordes por GPU</Title>
<Description>Corrige problemas en las tarjetas gráficas de Nvidia, tales como sombras que falten o incorrectas, al forzar el uso del suavizado de bordes a través del panel de control de la GPU.</Description>
<Choices type="check">
<Value name="No" default="true">0</Value>
<Value name="No" default="true" speedrun-default="true">0</Value>
<Value name="">1</Value>
</Choices>
</Feature>
Expand Down
8 changes: 4 additions & 4 deletions Launcher/config_it.xml
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,8 @@
<Title>La motosega compare soltanto in New Game+</Title>
<Description>Impedisce alla motosega di comparire durante la prima giocata, che è una scelta di design degli sviluppatori originali.</Description>
<Choices type="check">
<Value name="Disabilitato">0</Value>
<Value name="Abilitato" default="true" speedrun-default="true">1</Value>
<Value name="Disabilitato" speedrun-default="true">0</Value>
<Value name="Abilitato" default="true">1</Value>
</Choices>
</Feature>

Expand Down Expand Up @@ -1347,11 +1347,11 @@
</Choices>
</Feature>

<Feature name="LegacyFixGPUAntiAliasing">
<Feature name="LegacyFixGPUAntiAliasing" speedrun="true">
<Title>Correggi anti-aliasing tramite GPU</Title>
<Description>Corregge problemi per schede grafiche Nvidia, come ombre mancanti/errate, quando viene abilitato forzatamente l'anti-aliasing attraverso il pannello di controllo Nvidia.</Description>
<Choices type="check">
<Value name="Disabilitato" default="true">0</Value>
<Value name="Disabilitato" default="true" speedrun-default="true">0</Value>
<Value name="Abilitato">1</Value>
</Choices>
</Feature>
Expand Down
2 changes: 1 addition & 1 deletion Resources/BuildNo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_NUMBER 2200
#define BUILD_NUMBER 2201
26 changes: 9 additions & 17 deletions Wrappers/d3d8/IDirect3DDevice8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1311,12 +1311,6 @@ HRESULT m_IDirect3DDevice8::DrawScaledSurface()
D3DSURFACE_DESC Desc = {};
pAutoRenderTarget->GetDesc(&Desc);

// Call function
RunPresentCode(ProxyInterface, Desc.Width, Desc.Height);

// Draw Overlays
OverlayRef.DrawOverlays(ProxyInterface, Desc.Width, Desc.Height);

// Set the render target texture (pRenderTexture) back to nullptr
ProxyInterface->SetTexture(0, nullptr);

Expand Down Expand Up @@ -1408,6 +1402,15 @@ HRESULT m_IDirect3DDevice8::Present(CONST RECT* pSourceRect, CONST RECT* pDestRe
OverlayRef.RenderMouseCursor();
}

// Call function
RunPresentCode(ProxyInterface, BufferWidth, BufferHeight);

// Draw Overlays
if (IsScaledResolutionsEnabled() || GetEventIndex() != EVENT_PAUSE_MENU)
{
OverlayRef.DrawOverlays(ProxyInterface, BufferWidth, BufferHeight);
}

bool PauseMenuFlag = false;
if (IsScaledResolutionsEnabled())
{
Expand All @@ -1417,17 +1420,6 @@ HRESULT m_IDirect3DDevice8::Present(CONST RECT* pSourceRect, CONST RECT* pDestRe
// Draw scaled surface, inlcuding Overalys
DrawScaledSurface();
}
else
{
// Call function
RunPresentCode(ProxyInterface, BufferWidth, BufferHeight);

// Draw Overlays
if (GetEventIndex() != EVENT_PAUSE_MENU)
{
OverlayRef.DrawOverlays(ProxyInterface, BufferWidth, BufferHeight);
}
}

// Endscene
isInScene = false;
Expand Down
24 changes: 19 additions & 5 deletions Wrappers/d3d8/Overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@ bool ControllerConnectedFlag = false;
int JoystickX = 0;
int JoystickY = 0;

int DebugFontSize = 16;
int DebugFontCurrentSize = 16;

void Overlay::DrawOverlays(LPDIRECT3DDEVICE8 ProxyInterface, LONG Width, LONG Height)
{
if (LastWidth != Width || LastHeight != Height)
{
LastWidth = Width;
LastHeight = Height;
InitializeDataStructs();
InitializeDataStructs(Width);
InputTweaksRef.InitializeHitboxes((float)Width / (float)Height);

DebugFontCurrentSize = (Width * DebugFontSize) / 1600;
}

// Nvidia fix
Expand Down Expand Up @@ -244,11 +249,13 @@ void Overlay::DrawDebugText(LPDIRECT3DDEVICE8 ProxyInterface, Overlay::D3D8TEXT
{
ResetDebugFontFlag = false;
DebugFont->OnResetDevice();
DebugFont->Release();
DebugFont = NULL;
}

if (ProxyInterface != nullptr && DebugFont == nullptr)
{
HFONT FontCharacteristics = CreateFontA(16, 0, 0, 0, FW_BOLD, 0, 0, 0, 0, 0, 0, ANTIALIASED_QUALITY, 0, FontName);
HFONT FontCharacteristics = CreateFontA(DebugFontCurrentSize, 0, 0, 0, FW_BOLD, 0, 0, 0, 0, 0, 0, ANTIALIASED_QUALITY, 0, FontName);
if (FontCharacteristics != NULL)
{
Logging::LogDebug() << __FUNCTION__ << " Creating Debug font: " << FontName;
Expand Down Expand Up @@ -353,12 +360,19 @@ int Overlay::bitCount(uint8_t num)
return count;
}

void Overlay::InitializeDataStructs()
int Overlay::ScaleOffsetsWidth(LONG Width, int offset) {

return (Width * offset) / 1600;
}

void Overlay::InitializeDataStructs(LONG Width)
{
Logging::LogDebug() << __FUNCTION__ << " Initializing Overlay Text Structs...";

int rectOffset = this->ScaleOffsetsWidth(Width, BaseRectOffset);

InfoOverlayTextStruct.Format = DT_NOCLIP | DT_LEFT;
InfoOverlayTextStruct.Rect.left = LastWidth - 205;
InfoOverlayTextStruct.Rect.left = LastWidth - this->ScaleOffsetsWidth(Width, 205);
InfoOverlayTextStruct.Rect.top = rectOffset;
InfoOverlayTextStruct.Rect.right = LastWidth;
InfoOverlayTextStruct.Rect.bottom = rectOffset + 15;
Expand All @@ -367,7 +381,7 @@ void Overlay::InitializeDataStructs()
DebugOverlayTextStruct.Format = DT_NOCLIP | DT_LEFT;
DebugOverlayTextStruct.Rect.left = rectOffset;
DebugOverlayTextStruct.Rect.top = rectOffset;
DebugOverlayTextStruct.Rect.right = rectOffset + 300;
DebugOverlayTextStruct.Rect.right = rectOffset + this->ScaleOffsetsWidth(Width, 300);
DebugOverlayTextStruct.Rect.bottom = rectOffset + 15;
DebugOverlayTextStruct.Color = TextColors.Green;
}
Expand Down
5 changes: 3 additions & 2 deletions Wrappers/d3d8/Overlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ class Overlay
std::string GetIGTString();
int bitCount(uint8_t num);

void InitializeDataStructs();
void InitializeDataStructs(LONG Width);
int ScaleOffsetsWidth(LONG Width, int offset);

const int rectOffset = 40;
const int BaseRectOffset = 40;
const int FloatPrecision = 4;
const int FPSFloatPrecision = 2;
const int KMConstant = 500000;
Expand Down

0 comments on commit dce8ece

Please sign in to comment.