Skip to content

Version box: tell the upscaler's DLL which version the player selected - #2

Merged
phantoslayer21 merged 3 commits into
wronggpu-editionfrom
wronggpu/host-selected-event
Nov 16, 2026
Merged

phantoslayer21 merged 3 commits into
wronggpu-editionfrom
wronggpu/host-selected-event

Conversation

@phantoslayer21

@phantoslayer21 phantoslayer21 commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

What

When the player selects a version in the version box, the upscaler's DLL is told first, through WrongGpuHostSelectedV1(versionId), if it exports that function. Its result decides what happens next (OnVersionSelected in OptiScaler/misc/WrongGpuHostEvent.h):

  • 1: the selected model is not the one the upscaler runs, so the upscaler is recreated and the selected model runs. This also happens when the entry was already selected, because the model that ran may have been chosen elsewhere (WrongGPU's launcher or menu plugin). Re-selecting the same entry must win.
  • 0: nothing changed for WrongGPU. As before, a new entry recreates the upscaler and the same entry does nothing.
  • Negative: not saved. Nothing changes (no new index, no recreate), and a notification says "Not saved, try again. The model that runs did not change."

Who calls it, and who doesn't:

  • WrongGPU's FFX DLL exports it, and records a selection of one of its models as the player's model choice.
  • The call is made only for a selection in the menu. The index read from OptiScaler.ini at start is never sent, so a stored index is never taken for a choice.
  • A DLL without the export is never called, and nothing changes for it: AMD's DLLs and other custom upscalers behave as before.

Entry order. The index OptiScaler stores is a position in the list the DLL returns. The order of WrongGPU's model entries in that list (Model M, then K, then L, as each build lists them) is defined on the WrongGPU side in clean/wgshared/include/wg_model_entries.h. This fork holds a byte-identical copy in OptiScaler/include/wronggpu/wg_model_entries.h:

  • WrongGpuHostEvent.h static-asserts the order it expects from it;
  • when a WrongGPU version list arrives in another order, the version box logs a warning once;
  • WrongGPU's CI checks that its header and this copy (at a pinned commit of this branch) are byte for byte the same.

The WrongGPU side is phantoslayer21/wronggpu#213: clean/fsr/include/wronggpu_host_event.h (the signature and result codes) and FrontEnd::HostSelected.

Files

  • OptiScaler/misc/WrongGpuHostEvent.h: the version-box logic (OnVersionSelected), the export call (CallHostSelected), and the list-order check (ListOrderMatches). It has no ImGui or Windows dependency, so it is unit tested.
  • OptiScaler/include/wronggpu/wg_model_entries.h: the copied header (excluded from the format check like the other included headers).
  • OptiScaler/menu/menu_common.cpp: NotifyHostSelected and the version box use the helper. The DLL is the custom upscaler's module, or, for the regular DX12 FFX list, FfxApiProxy::UpscalerModule(versionId).
  • wronggpu-edition-tests/host_event_test.cpp and .github/workflows/wronggpu-edition-tests.yml: the helper's tests, built with MSVC (/W4 /WX) and run on every push and pull request.
  • WRONGGPU-EDITION.md: item 6.

Tested

  • host_event_test: 23 checks pass. They cover:
    • 1 recreates also for the entry already selected;
    • 0 behaves as before;
    • negative changes nothing and asks for the notification;
    • a DLL without the export is never called and gives 0;
    • list order: in order, out of order, without Model K, and a list without WrongGPU entries.
  • clang-format 22, the version of the check: the new lines are clean.
    • The branch's check already fails on files from earlier edition changes: Util.cpp, hooks/D3D12_Hooks.cpp, inputs/NVNGX_DLSS_Dx12.cpp, plugins/PluginApi.cpp, and three older hunks in menu/menu_common.cpp.
    • Those lines are left alone here to keep the diff minimal, so the check stays red for them.
  • Release build (Build (No Signing), run by hand): it built the branch's first head; not run again for the later heads.
  • The WrongGPU side of the event is unit tested in Spoof optiscaler/OptiScaler#213. It covers:
    • 1 when the selection differs from the running model (also when the record changed underneath);
    • 0 when it doesn't;
    • not saved when there is no state folder, the lock is busy or the write fails;
    • refused at the end of the record's sequence numbers;
    • AMD entries.

Not tested yet

  • In game: select WrongGPU Model K and Model L in the WrongGPU box, and check that the upscaler is recreated with the new model and that the record says source=ffx. That game run follows after the merge.

When the player selects a version in the version box, the upscaler's DLL
is told first through WrongGpuHostSelectedV1(versionId), if it exports
it. WrongGPU's FFX DLL does, and records a selection of one of its models
as the player's model choice. The upscaler is then recreated as before,
so the choice runs at once.

If WrongGPU recorded the choice, selecting the entry that is already
selected recreates the upscaler too, because the model that ran may have
been chosen elsewhere (WrongGPU's launcher or menu plugin). A notification
says when WrongGPU could not save the choice.

The call is made only for a selection in the menu, never for the index
read from the ini. A DLL without the export is never called.
WRONGGPU-EDITION.md: item 6.

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…t saved)

The result of WrongGpuHostSelectedV1 decides:
- 1, the selected model runs from now on: the upscaler is recreated, also
  when the entry was already selected;
- 0, nothing changed for WrongGPU: as before, a new entry recreates the
  upscaler;
- negative, not saved: nothing changes (no new index, no recreate), and a
  notification says "Not saved, try again".

There is no "not saved yet" or session-only case any more.
WRONGGPU-EDITION.md item 6 is updated to match.

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…ed header

- OptiScaler/misc/WrongGpuHostEvent.h: OnVersionSelected (what the
  version box does with WrongGPU's result: 1 recreate, also for the entry
  already selected; 0 as before; negative "not saved", nothing changes),
  CallHostSelected (the export, or 0), and ListOrderMatches (WrongGPU's
  model entries in a version list against the copied header).
- OptiScaler/include/wronggpu/wg_model_entries.h: a byte-identical copy of
  WrongGPU's clean/wgshared/include/wg_model_entries.h (the order of its
  model entries); static_asserts on it; a list in another order is
  logged. WrongGPU's CI checks the copy's hash.
- wronggpu-edition-tests/host_event_test.cpp and the "WrongGPU edition
  tests" workflow build and run the header's tests.
- WRONGGPU-EDITION.md item 6 says so.

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
@phantoslayer21
phantoslayer21 marked this pull request as ready for review November 15, 2026 22:43
@phantoslayer21
phantoslayer21 merged commit aea31a7 into wronggpu-edition Nov 16, 2026
3 of 5 checks passed
phantoslayer21 added a commit to phantoslayer21/wronggpu that referenced this pull request Nov 16, 2026
…K) (#213)

On a hosted OptiScaler install with WrongGPU's menu plugin hooked, the launcher's Model L choice
was ignored: the plugin's saved state could only be M, K or AMD, and the front end took the
plugin's model unconditionally.

- One model choice record per game, model-choice.ini in the game's WrongGPU state folder
  (model, seq, source). The highest seq is the most recent choice, on every route.
- It is written only for a choice the player made: the launcher's Apply or set <game> model=,
  a selection in OptiScaler's list (WrongGpuHostSelectedV1, in the WrongGPU edition of
  OptiScaler, phantoslayer21/OptiScaler#2), or a click on one of the menu plugin's model entries.
  OptiScaler's stored index and wronggpu.ini's model item are never a choice.
- Every read and write holds the game's state lock (wg_state.h). A choice that can't be saved in
  time changes nothing and says "not saved, try again".
- CI checks that wg_model_entries.h and the fork's copy at a pinned commit are byte-identical.

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
Build — f31d091d Deployed Nov 15, 2026 by phantoslayer21 via build #3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant