Skip to content

Commit

Permalink
UILetterboxing: allow enabling letterboxing while in-game
Browse files Browse the repository at this point in the history
  • Loading branch information
emoose committed Jul 2, 2024
1 parent 2b11a3f commit c2f1475
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 28 deletions.
13 changes: 9 additions & 4 deletions OutRun2006Tweaks.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,17 @@ VSync = 1
# Adjusts the UI scaling applied by the game
# 0 = game default, stretches to screen ratio
# 1 = 4:3 UI centered to middle of screen
# 2 = mostly fixed scaling without stretching, based on Outrun Online Arcade
#
# NOTE: these modes will enable 4:3 letterboxing during menus, but in-game won't have any letterboxing
# Outrun Online Arcade scaling required many manual code fixes, if you notice anything broken please let me know!
# 2 = fixed UI scaling without stretching, based on Outrun Online Arcade
# Outrun Online Arcade scaling required many manual code changes, please let me know if you notice anything broken!
UIScalingMode = 0

# Adds 4:3 letterboxing to game menus, to address some graphical issues outside of the menus 4:3 display
# 0 = disable all letterboxing
# 1 = letterbox menus only, disabled when in-game
# 2 = always letterbox (only recommended with UIScalingMode = 1)
# NOTE: this letterboxing setting is only used when UIScalingMode above is set to 1 or above
UILetterboxing = 1

# 1 - 16, 0 to leave it at games default.
AnisotropicFiltering = 16

Expand Down
37 changes: 18 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,36 @@ Latest builds can be found under the releases section: https://github.com/emoose

### Features
**Bugfixes:**
- Prevents the "DEST" save corruption bug when trying to remap controls while having many dinput devices connected
- Fixes C2C ranking scoreboards not updating on Steam and certain releases due to faulty anti-piracy checks
- Pegasus animation's clopping sound effect will now end properly, without looping through whole session
- Game can now load lens flare effect from correct path, restoring lens flare without needing to change game files
- UI can now scale to different aspect ratios properly without stretching (requires `UIScalingMode = 2` in INI)
- Prevents save corruption bug when remapping controls with many dinput devices connected
- Fixed C2C ranking scoreboards not updating on Steam and other releases due to faulty anti-piracy checks
- Pegasus animation's clopping sound effect will now end correctly
- Lens flare effect now loads from correct path, without needing to change game files
- Fixed Z-buffer precision issues that caused heavy z-fighting and distant object pop-in
- Stage objects such as traffic cones will now only disappear once they're actually off-screen
- Stage objects such as traffic cones now only disappear once they're actually off-screen
- Fixes certain effects like engine backfiring which failed to appear when using controllers
- Can hide text related to the now-defunct online service
- Text related to the now-defunct online service can be hidden

**Enhancements:**
- Adds a built-in framelimiter to prevent game from speeding up
- Textures for the UI and the game scene can be dumped & replaced
- Built-in framelimiter to prevent the game from speeding up
- FPS can now be partially unlocked, drawing at unlocked FPS while game runs at 60FPS tickrate
- UI and game scene textures can be dumped & replaced
- Allows disabling vehicle LODs, reducing the ugly pop-in as they get closer
- Restores XInput rumble code from the Xbox release, allowing gear shifts/drifts/crashes/etc to give feedback
- Restored XInput rumble code from the Xbox release, allowing gear shifts/drifts/crashes/etc to give feedback
- Xbox Series impulse triggers are supported and can be tweaked inside INI
- Can force anisotropic filtering & enable transparency supersampling, greatly reducing aliasing around the edges of the track
- Render resolution of reflections can be increased from the default 128x128
- Anisotropic filtering & transparency supersampling can be forced, greatly reducing aliasing around the edges of the track
- Reflection rendering resolution can be increased from the default 128x128
- Game can now run in borderless windowed mode; mouse cursor will now be hidden while game is active
- Automatically disables DPI scaling on the game window, fixing scaling issues with certain setups
- Heavily reduced load times by disabling framelimiter/vsync during load screens
- Allows skipping intro splash screens
- Automatically disables DPI scaling on the game window, fixing certain scaling issues
- Load times heavily reduced by disabling framelimiter/vsync during load screens
- Music can now be loaded from uncompressed WAV or lossless FLAC files, if they exist with the same filename
- Allows intro splash screens to be skipped
- Music track can be changed mid-race via Q and E buttons, or Back/RS+Back on controller (`CDSwitcher` must be enabled in INI first)

All the above can be toggled/customized via the OutRun2006Tweaks.ini file.
All the above can be customized via the OutRun2006Tweaks.ini file.

FPS can be partially unlocked by increasing the `FramerateLimit` setting above 60 (or disabling it), with `FramerateUnlockExperimental` enabled.
This will then lock the games tickrate to 60FPS while draw-rate itself is unlocked.
(some things like animated textures & menu text may speed up with this, but the game speed itself will remain the same)
This will then lock the games tickrate to 60FPS while draw-rate itself is unlocked, allowing game speed to stay consistent.

### Setup
Since Steam/DVD releases are packed with ancient DRM that doesn't play well with DLL wrappers, this pack includes a replacement game EXE to run the game with.
Expand All @@ -46,8 +47,6 @@ To set it up:
- Edit the `Outrun2006Tweaks.ini` to customize the tweaks to your liking (by default all tweaks are enabled)
- Run the game, your desktop resolution will be used by default if `outrun2006.ini` file isn't present.

**If you have framerate issues where game doesn't run at your full FramerateLimit setting**, try adding `DX/WINDOWED = 1` to your `outrun2006.ini` file and check if it helps.

Steam Deck/Linux users may need to run the game with `WINEDLLOVERRIDES="dinput8=n,b" %command%` launch parameters for the mod to load in.

### Building
Expand Down
3 changes: 1 addition & 2 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,8 @@ namespace Settings

UIScalingMode = ini.Get("Graphics", "UIScalingMode", std::move(UIScalingMode));
UIScalingMode = std::clamp(UIScalingMode, 0, 2);
// UILetterboxing won't be exposed in INI, but can be added there to disable it if needed
// (letterboxing will only be active if UIScalingMode is set)
UILetterboxing = ini.Get("Graphics", "UILetterboxing", std::move(UILetterboxing));
UILetterboxing = std::clamp(UILetterboxing, 0, 2);

AnisotropicFiltering = ini.Get("Graphics", "AnisotropicFiltering", std::move(AnisotropicFiltering));
AnisotropicFiltering = std::clamp(AnisotropicFiltering, 0, 16);
Expand Down
4 changes: 2 additions & 2 deletions src/hooks_graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ class UILetterboxing : public Hook
*Game::current_mode == GameState::STATE_SMPAUSEMENU ||
(*Game::current_mode == GameState::STATE_START && *Game::game_start_progress_code == 65);

if (isInGame)
if (Settings::UILetterboxing == 1 && isInGame)
return; // disable letterboxing while in-game

// Backup existing cullmode and set to none, otherwise we won't get drawn
Expand Down Expand Up @@ -1237,7 +1237,7 @@ class UILetterboxing : public Hook

bool validate() override
{
return Settings::UILetterboxing && Settings::UIScalingMode > 0;
return Settings::UILetterboxing > 0 && Settings::UIScalingMode > 0;
}

bool apply() override
Expand Down
2 changes: 1 addition & 1 deletion src/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace Settings
inline std::vector<std::pair<std::string, std::string>> CDTracks;

inline int UIScalingMode = 0;
inline bool UILetterboxing = true;
inline int UILetterboxing = 1;
inline int AnisotropicFiltering = 16;
inline int ReflectionResolution = 2048;
inline bool TransparencySupersampling = true;
Expand Down

0 comments on commit c2f1475

Please sign in to comment.