Simple hold-to-zoom feature for Starfield
Overview • Features • Installation • Usage • Configuration • Building • License
StarZoom is a native SFSE plugin for Starfield, built on CommonLibSF. Hold a key (keyboard or gamepad) in first-person view and the camera's FOV smoothly zooms in; release it and the FOV eases back to normal.
It drives the game's own fFPWorldFOV:Camera setting (via
RE::INIPrefSettingCollection/RE::INISettingCollection) — the same value
the renderer itself reads for first-person FOV — rather than touching any
camera/scene-graph memory directly. See How it works below.
By using this project you agree to comply with the CommonLibSF license, which is GPL-3.0-or-later WITH Modding Exception AND GPL-3.0 Linking Exception (with Corresponding Source). In short: if you distribute a compiled binary linked against CommonLibSF, you must also make the corresponding source available.
- Smooth ease in/out — a smoothstep transition (zero velocity at both ends) instead of an abrupt cut, so the zoom never jolts when the hotkey is pressed, released, or tapped quickly mid-transition.
- Keyboard hotkey — any virtual-key code, configurable.
- Gamepad support — any XInput button bitmask also triggers the zoom (default: Right Shoulder / RB), independently of the keyboard hotkey.
- Config-driven — target FOV and transition speed are both adjustable without recompiling.
- Hot reload — press a key (default F3) in-game to apply
StarZoom.iniedits without restarting.
- Install SFSE and Address Library for SFSE Plugins.
- Copy
StarZoom.dllandStarZoom.iniintoData\SFSE\Plugins\in your Starfield install folder. - Launch the game via
sfse_loader.exe.
Hold the configured hotkey (default: C on keyboard, RB/Right Shoulder on
an XInput gamepad) in first-person view to zoom in. Release it to ease back
to the normal FOV.
Edit StarZoom.ini next to the DLL (created with defaults on first launch if
missing):
| Key | Default | Description |
|---|---|---|
Hotkey |
67 |
Virtual-key code of the hold-to-zoom key (67 = C) |
GamepadButton |
512 |
XInput button bitmask that also holds-to-zoom (512 = Right Shoulder / RB; 0 disables) |
ZoomFOV |
60.0 |
FOV in degrees while the hotkey is held |
SmoothSpeed |
8.0 |
Ease-in/ease-out speed for the zoom transition (higher = snappier) |
ReloadKey |
114 |
Virtual-key code that reloads this file without restarting the game (114 = F3) |
Press the reload key (default F3) in-game after editing StarZoom.ini to
apply changes immediately — no restart needed.
For a full list of decimal keyboard and gamepad (XInput) codes, see the Key Codes PDF in the Files tab on this mod's Nexus page.
- XMake 3.0.0+
- C++23 compiler: MSVC (Build Tools for Visual Studio, no full IDE required) or Clang-CL
lib/commonlibsf (and its own nested lib/commonlib-shared dependency) is a
git submodule. Fetch it with:
git submodule update --init --recursivexmake buildThis produces StarZoom.dll under build/windows/x64/....
xmake project -k vsxmakegenerates a vsxmakeXXXX/ solution if you'd rather build/debug from the
Visual Studio IDE.
├── src/
│ ├── PCH.h Precompiled header (CommonLibSF + STL includes)
│ ├── Plugin.cpp SFSE entry point (SFSE_PLUGIN_LOAD)
│ ├── Config.h / .cpp StarZoom.ini load / defaults
│ ├── Hooks.h / .cpp DXGI swapchain Present hook install
│ ├── Input.h / .cpp Keyboard + XInput hotkey polling
│ └── FOVController.h / .cpp Per-frame FOV transition + INI setting write
├── dist/StarZoom.ini Default config, shipped alongside the DLL
└── lib/commonlibsf/ CommonLibSF (git submodule)StarZoom gets a per-frame callback by waiting for the game's real DXGI
factory to exist, hooking IDXGIFactory2::CreateSwapChainForHwnd on it to
catch the game's real swapchain the moment it's created, then hooking that
swapchain's Present. See the comments at the top of Hooks.cpp and
FOVController.cpp for the two approaches that were tried and discarded
before landing on this one (a D3D11 dummy-device Present hook, and reading
TESCamera/NiCamera memory directly) and why they didn't work for this
specific Starfield build.
This project is licensed under GPL-3.0-or-later WITH Modding Exception AND GPL-3.0 Linking Exception (with Corresponding Source).
