Skip to content

feat(controller): support Cloud (GeForce NOW) controller type - #284

Open
zeejaytan wants to merge 1 commit into
MistEO:mainfrom
zeejaytan:feat/cloud-gfn-controller
Open

feat(controller): support Cloud (GeForce NOW) controller type#284
zeejaytan wants to merge 1 commit into
MistEO:mainfrom
zeejaytan:feat/cloud-gfn-controller

Conversation

@zeejaytan

@zeejaytan zeejaytan commented Jul 15, 2026

Copy link
Copy Markdown

What

Adds a Cloud controller type to MXU, so a downstream project can offer a cloud-streaming target with minimal config:

{ "name": "GFN", "type": "Cloud",
  "cloud": { "provider": "geforce_now", "game_title": "Endfield" } }

instead of hand-writing the CEF window class / title / PrintWindow / Seize. Mirrors the MaaFramework-side Cloud preset (MaaXYZ/MaaFramework#1400).

How

Pure front-end desugaring — no Rust changes; all downstream paths (window selection, connection, platform filter) keep treating it as a normal Win32 controller.

  • src/types/interface.ts: 'Cloud' in ControllerType; new CloudConfig { provider, game_title }; optional cloud on ControllerItem.
  • src/services/cloudProviders.ts (new): built-in provider registry (geforce_nowCEFCLIENT / {game}.*on GeForce NOW / PrintWindow / Seize) + cloudToWin32Config desugar helper.
  • src/services/interfaceLoader.ts: expandCloudControllers() runs in the existing platform-filter choke point, desugaring CloudWin32 at load time (game title substituted into the title template). Cloud is marked Windows-only.

Testing

Verified end-to-end on Windows against a real GeForce NOW session running Arknights: Endfield: the GFN controller resolves the client window and connects through MXU, driving it via PrintWindow + Seize. Confirmed the desugared controller flows through window selection + connection unchanged.

Note: requires a MaaFramework runtime with the companion preset (MaaXYZ/MaaFramework#1400) in the maafw/ folder.

Related

🤖 Generated with Claude Code

由 Sourcery 提供的摘要

添加一种 Cloud 控制器类型,在加载时将其解糖(desugar)为 Win32 控制器,以支持 GeForce NOW 等云串流客户端。

新特性:

  • 引入 Cloud 控制器类型以及控制器上的对应 CloudConfig。
  • 添加 cloudProviders 注册表,内建 GeForce NOW 提供程序,用于将 Cloud 配置映射到 Win32 窗口签名和 IO 方法。

增强项:

  • 在接口加载期间,将 Cloud 控制器展开为等效的 Win32 配置,从而使下游逻辑继续仅基于 Win32 运行。
  • 扩展平台过滤,将 Cloud 控制器视为仅支持 Windows。
Original summary in English

Summary by Sourcery

Add a Cloud controller type that is desugared into a Win32 controller at load time to support cloud-streaming clients like GeForce NOW.

New Features:

  • Introduce a Cloud controller type and corresponding CloudConfig on controllers.
  • Add a cloudProviders registry with a built-in GeForce NOW provider mapping Cloud configs to Win32 window signatures and IO methods.

Enhancements:

  • Expand Cloud controllers into equivalent Win32 configurations during interface loading so downstream logic continues to operate on Win32 only.
  • Extend platform filtering to treat Cloud controllers as Windows-only.

Adds the `Cloud` controller type so downstream projects can declare a
cloud-streaming controller with just a provider + game title, e.g.:

  { "name": "GFN", "type": "Cloud",
    "cloud": { "provider": "geforce_now", "game_title": "Endfield" } }

instead of hand-writing the CEFCLIENT class / title / PrintWindow / Seize
config. Mirrors the MaaFramework-side Cloud preset.

- types/interface.ts: add 'Cloud' to ControllerType + CloudConfig{provider,
  game_title} + cloud? on ControllerItem.
- services/cloudProviders.ts: built-in provider registry (geforce_now =>
  CEFCLIENT / "{game}.*on GeForce NOW" / PrintWindow / Seize) + desugar helper.
- services/interfaceLoader.ts: expand Cloud controllers to Win32 at load time
  (game_title substituted into the title template), so all downstream logic —
  window selection, connection, platform filtering — treats it as a normal
  Win32 controller with no further changes. Cloud is Windows-only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我给了一些整体性的反馈:

  • 目前,当 Cloud 提供商是未知时,控制器会被保留为类型 Cloud(可能还没有 cloud 配置),这和我们希望下游逻辑只看到 Win32 的意图相冲突;建议要么把这类控制器过滤掉,要么仍然将它们归一化为一个安全的 Win32 结构,这样下游使用方就不需要处理 Cloud 分支。
  • CloudConfig.providerCLOUD_PROVIDERS 映射目前都以普通字符串作为键;如果能把它们收紧为字符串字面量联合类型(例如 'geforce_now'),或者从 CLOUD_PROVIDERS 推断键类型,会更容易发现拼写错误,并保持注册表和类型定义的一致。
  • cloudProviders.ts 中,screencapinput 被声明为普通字符串类型;如果 Win32Config 已经把这些字段限制为特定取值,可以通过 Win32Config 来派生它们的类型(例如 Win32Config['screencap']),以避免和实际的 Win32 配置选项产生偏差。
给 AI Agent 的提示词
Please address the comments from this code review:

## Overall Comments
- Right now an unknown Cloud provider leaves the controller as type 'Cloud' (possibly without a `cloud` config), which conflicts with the intent that all downstream logic only sees Win32; consider either filtering such controllers out or still normalizing them into a safe Win32 shape so no consumer has to handle a 'Cloud' branch.
- CloudConfig.provider and the CLOUD_PROVIDERS map are both keyed as plain strings; tightening these to a string literal union (e.g. `'geforce_now'`) or inferring keys from CLOUD_PROVIDERS would make it easier to catch typos and keep the registry and type definition in sync.
- In `cloudProviders.ts`, `screencap` and `input` are typed as generic strings; if `Win32Config` already constrains these to specific values, you could derive their types from `Win32Config` (e.g. `Win32Config['screencap']`) to avoid drifting from the actual Win32 configuration options.

Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English

Hey - I've left some high level feedback:

  • Right now an unknown Cloud provider leaves the controller as type 'Cloud' (possibly without a cloud config), which conflicts with the intent that all downstream logic only sees Win32; consider either filtering such controllers out or still normalizing them into a safe Win32 shape so no consumer has to handle a 'Cloud' branch.
  • CloudConfig.provider and the CLOUD_PROVIDERS map are both keyed as plain strings; tightening these to a string literal union (e.g. 'geforce_now') or inferring keys from CLOUD_PROVIDERS would make it easier to catch typos and keep the registry and type definition in sync.
  • In cloudProviders.ts, screencap and input are typed as generic strings; if Win32Config already constrains these to specific values, you could derive their types from Win32Config (e.g. Win32Config['screencap']) to avoid drifting from the actual Win32 configuration options.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Right now an unknown Cloud provider leaves the controller as type 'Cloud' (possibly without a `cloud` config), which conflicts with the intent that all downstream logic only sees Win32; consider either filtering such controllers out or still normalizing them into a safe Win32 shape so no consumer has to handle a 'Cloud' branch.
- CloudConfig.provider and the CLOUD_PROVIDERS map are both keyed as plain strings; tightening these to a string literal union (e.g. `'geforce_now'`) or inferring keys from CLOUD_PROVIDERS would make it easier to catch typos and keep the registry and type definition in sync.
- In `cloudProviders.ts`, `screencap` and `input` are typed as generic strings; if `Win32Config` already constrains these to specific values, you could derive their types from `Win32Config` (e.g. `Win32Config['screencap']`) to avoid drifting from the actual Win32 configuration options.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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