Skip to content

Commit

Permalink
ReflectionResolution: allow tweaking resolution of reflections
Browse files Browse the repository at this point in the history
  • Loading branch information
emoose committed Jun 22, 2024
1 parent 9a4f95c commit b682c18
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Outrun2006Tweaks.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ VSync = 1
# 1 = enable xbox vibration code
# 2 = ^ with L/R motors swapped
# 3 = ^ with L/R motors merged together
VibrationMode = 0
VibrationMode = 1

# XInput device to send vibration to, default should work fine in most cases, but if you don't notice any vibration you can try increasing this here
VibrationControllerId = 0
Expand All @@ -42,11 +42,11 @@ VibrationStrength = 10
# 1 = enable impulse triggers
# 2 = ^ with L/R motors swapped (recommended for impulse triggers)
# 3 = ^ with L/R motors merged together
ImpulseVibrationMode = 0
ImpulseVibrationMode = 2

# Multipliers of the trigger vibration, the normal controller motor vibration is multiplied by these to set trigger value
ImpulseVibrationLeftMultiplier = 0.25
ImpulseVibrationRightMultiplier = 0.25
ImpulseVibrationLeftMultiplier = 0.20
ImpulseVibrationRightMultiplier = 0.20

[Window]
# Forces windowed mode to become borderless. (requires "DX/WINDOWED = 1" inside outrun2006.ini)
Expand Down Expand Up @@ -97,6 +97,9 @@ TrackPrevious = RS+Back
# 1 - 16, 0 to leave it at games default.
AnisotropicFiltering = 16

# Resolution used for car reflections, games default is 128x128, 2048x2048 seems a reasonable improvement
ReflectionResolution = 2048

# Allows game to enable 4x transparency supersampling, heavily reducing aliasing on things like barriers or cloth around the track edge.
# For best results use this with "DX/ANTIALIASING = 2" inside outrun2006.ini
TransparencySupersampling = true
Expand Down
3 changes: 3 additions & 0 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ namespace Settings
spdlog::info(" - CDSwitcherTrackPrevious: {}", CDSwitcherTrackPrevious);

spdlog::info(" - AnisotropicFiltering: {}", AnisotropicFiltering);
spdlog::info(" - ReflectionResolution: {}", ReflectionResolution);
spdlog::info(" - TransparencySupersampling: {}", TransparencySupersampling);
spdlog::info(" - ScreenEdgeCullFix: {}", ScreenEdgeCullFix);
spdlog::info(" - DisableVehicleLODs: {}", DisableVehicleLODs);
Expand Down Expand Up @@ -139,6 +140,8 @@ namespace Settings

AnisotropicFiltering = ini.Get("Graphics", "AnisotropicFiltering", std::move(AnisotropicFiltering));
AnisotropicFiltering = std::clamp(AnisotropicFiltering, 0, 16);
ReflectionResolution = ini.Get("Graphics", "ReflectionResolution", std::move(ReflectionResolution));
ReflectionResolution = std::clamp(ReflectionResolution, 0, 8192);
TransparencySupersampling = ini.Get("Graphics", "TransparencySupersampling", std::move(TransparencySupersampling));
ScreenEdgeCullFix = ini.Get("Graphics", "ScreenEdgeCullFix", std::move(ScreenEdgeCullFix));
DisableVehicleLODs = ini.Get("Graphics", "DisableVehicleLODs", std::move(DisableVehicleLODs));
Expand Down
39 changes: 39 additions & 0 deletions src/hooks_graphics.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
#include "hook_mgr.hpp"
#include "plugin.hpp"
#include "game_addrs.hpp"
#include <array>

class ReflectionResolution : public Hook
{
inline static std::array<int, 6> ReflectionResolution_Addrs =
{
// Envmap_Init
0x13B50 + 1,
0x13BA1 + 1,
0x13BA6 + 1,
// D3D_CreateTemporaries
0x17A69 + 1,
0x17A88 + 1,
0x17A8D + 1,
};

public:
std::string_view description() override
{
return "ReflectionResolution";
}

bool validate() override
{
return Settings::ReflectionResolution >= 2;
}

bool apply() override
{
for (const int& addr : ReflectionResolution_Addrs)
{
Memory::VP::Patch(Module::exe_ptr<int>(addr), Settings::ReflectionResolution);
}
return true;
}

static ReflectionResolution instance;
};
ReflectionResolution ReflectionResolution::instance;

class DisableDPIScaling : public Hook
{
Expand Down
1 change: 1 addition & 0 deletions src/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ namespace Settings
inline std::vector<std::pair<std::string, std::string>> CDTracks;

inline int AnisotropicFiltering = 16;
inline int ReflectionResolution = 1024;
inline bool TransparencySupersampling = true;
inline bool ScreenEdgeCullFix = true;
inline bool DisableVehicleLODs = true;
Expand Down

0 comments on commit b682c18

Please sign in to comment.