MFG Unlocker as an F1 option: downloaded and loaded at start when on

F1, MFG UNLOCKER (MOD, RTX 20/30), off by default. When it is on, the
launcher fetches MFG Unlocker v1.7.2 from its author's GitHub release
into %LOCALAPPDATA%\victory\mfg-unlocker. The zip and MFGUnlocker.dll
are both checked against the SHA-256 the author published
(scripts\get-mfg-unlocker.ps1). victory.exe then loads the DLL under
its own name before the device is made or Streamline is loaded, so
nothing is renamed or put beside the game.

- RTX 20 and 30 cards with DLSS on are asked once at the first start
  (default No), unless the choice was made or a mod DLL is already
  beside victory.exe.
- `victory get-mfg` fetches it by hand.
- The menu explains the item while it is picked.
- The log records the load.
- README updated.

The download and the mod itself are not tested here (RTX 50 only). The
load path was tested with a Windows DLL in its place: loaded before
Streamline, game ran normally.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
trustno1-coderandClaude Opus 5.5 committed 2026-11-27 10:59:16 -08:00
1 parent 10862a6d87
commit 0cef07e9d7
6 files changed
+268 -9

No files matched your search

+21 -2
View File
@@ -49,6 +49,13 @@ const ABOUT_PRELOAD: [&str; 3] = [
"TAKES A WHILE: MAYBE A LONG TIME, DEPENDING ON HARDWARE.",
"A LATER UPDATE OF THIS BUILD MAY NEED A NEW PRELOAD.",
];
/// The setting that turns MFG Unlocker on, and what is said of it while it is picked.
const MFG: &str = "VICTORY_MFG_UNLOCKER";
const ABOUT_MFG: [&str; 3] = [
"A MOD, NOT OURS: DLSS FRAME GEN ON RTX 20 AND 30 CARDS.",
"ON: DOWNLOADED FROM ITS GITHUB AT THE NEXT START, THEN RUN.",
"NVIDIA DOES NOT SUPPORT IT. IF THE GAME FAILS, TURN IT OFF.",
];
/// The note after the first Enter on it: the second one does it.
const CONFIRM_PRELOAD: &str = "ENTER AGAIN: SAVE, CLOSE THE GAME AND PRELOAD";
/// The last line of the box: where this build comes from.
@@ -77,6 +84,8 @@ const ITEMS: &[Item] = &[
Item { var: "VICTORY_MENU_FRAMEGEN", label: "FRAME GENERATION", values: &[("0", "OFF"), ("2", "2X"), ("3", "3X"), ("4", "4X"), ("5", "5X"), ("6", "6X (MOST)")], live: false },
// DLSS Frame Generation where it runs (RTX 40 and later), else AMD's FSR 3 (2X only).
Item { var: "VICTORY_MENU_FG_TYPE", label: "FRAME GEN TYPE", values: &[("auto", "AUTO"), ("dlss", "DLSS"), ("fsr", "FSR 3 (OLDER CARDS)")], live: false },
// Someone else's mod (apps\victory\src\play.rs): downloaded at the next start, then loaded.
Item { var: MFG, label: "MFG UNLOCKER (MOD, RTX 20/30)", values: UNSET_ON, live: false },
Item { var: "VICTORY_MENU_FPS", label: "FRAME RATE CAP", values: &[("1000", "NONE"), ("120", "120"), ("60", "60"), ("30", "30 (THE GAME)")], live: false },
Item { var: "VICTORY_FPS_LINE", label: "FPS AT THE TOP", values: &[("1", "ON"), ("0", "OFF")], live: true },
Item { var: "VICTORY_PANEL", label: "STATS PANEL (F3)", values: &[("0", "OFF"), ("1", "ON")], live: true },
@@ -396,7 +405,13 @@ impl Menu {
out.push(String::new());
}
out.push(String::new());
let about = if self.at == ITEMS.len() + PRELOAD { ABOUT_PRELOAD } else { [""; 3] };
let about = if self.at == ITEMS.len() + PRELOAD {
ABOUT_PRELOAD
} else if ITEMS.get(self.at).is_some_and(|i| i.var == MFG) {
ABOUT_MFG
} else {
[""; 3]
};
out.extend(about.iter().map(|l| (*l).to_owned()));
out.push(if self.note.is_empty() { "* = CHANGED: APPLIES AT THE NEXT START UNLESS LIVE".to_owned() } else { self.note.clone() });
out.push(REPO.to_owned());
@@ -699,10 +714,12 @@ mod tests {
let n = lines.len();
assert!(lines[n - 2].starts_with("* = CHANGED") || lines[n - 2] == note, "{}", lines[n - 2]);
assert_eq!(lines[n - 1], REPO);
// What a preload costs is said while it is picked, and only then.
// What a preload costs, and what MFG Unlocker is, is said while it is picked, and only then.
let about = &lines[n - 5..n - 2];
if at == ITEMS.len() + PRELOAD {
assert_eq!(about, ABOUT_PRELOAD);
} else if at < ITEMS.len() && ITEMS[at].var == MFG {
assert_eq!(about, ABOUT_MFG);
} else {
assert!(about.iter().all(String::is_empty), "{about:?}");
}
@@ -710,6 +727,8 @@ mod tests {
}
assert_eq!(ACTIONS[PRELOAD], "PRELOAD SHADERS (RESTARTS THE GAME)");
assert!(CONFIRM_PRELOAD.len() <= COLUMNS as usize);
assert!(ABOUT_MFG.iter().all(|l| l.len() <= COLUMNS as usize));
assert_eq!(ITEMS.iter().filter(|i| i.var == MFG).count(), 1);
}
#[test]
+21
View File
@@ -711,6 +711,27 @@ pub fn d3d12_core_path() -> Option<PathBuf> {
}
}
/// Loads a mod's DLL into this process for good, logged as `what` (MFG Unlocker: it wraps
/// NVIDIA's frame generation, so it is loaded before a device is made or Streamline loaded).
/// `Err`: Windows' error code.
pub fn load_mod(what: &str, path: &Path) -> Result<(), u32> {
use windows_sys::Win32::Foundation::GetLastError;
use windows_sys::Win32::System::LibraryLoader::LoadLibraryW;
let name = wide(path);
// SAFETY: a NUL-terminated path; the module stays loaded for the life of the process.
let (module, code) = unsafe {
let module = LoadLibraryW(name.as_ptr());
(module, if module.is_null() { GetLastError() } else { 0 })
};
if module.is_null() {
tracing::warn!(dll = %path.display(), code, "{what}: did not load");
Err(code)
} else {
tracing::info!(dll = %path.display(), "{what}: loaded");
Ok(())
}
}
/// The Authenticode signature of `path` (NVIDIA signs its DLLs), checked
/// without going online.
fn verify_signature(path: &Path) -> Result<(), String> {