YY Storage Box: Running Games Locally on the DSH Panel

Introduction

DeepSeek Harness (DSH) follows a “everything is a plugin” philosophy, mounting various capabilities onto a unified framework. For the scenario of playing local games directly within DSH, common approaches include streaming (e.g., Parsec, Sunshine) or embedding a game window via Electron. The former adds network latency, while the latter runs into rendering compatibility issues. tlxqgj/dsh-yy-gamebox (author: 莫若知秋) offers an alternative: using a native engine to “adopt” a game window as an owned window of the DSH main window, running it inside the panel as a viewport with latency close to that of running the game locally.

What It Is

dsh-yy-gamebox is a DSH plugin that runs on Windows, using the Win32 Window API and .NET Framework’s csc.exe to achieve native window rendering and embedding. It pulls a local game window into the DSH panel, positions it to a viewport rectangle, and removes the title bar. It does not appear in the taskbar or in Alt+Tab. When the page is zoomed or the window is dragged, the game display adjusts accordingly.

Core Features

  • Game Library: Scans the Steam library for automatic import, and also supports manually adding any exe or game directory.
  • In-Panel Execution: The game window is adopted by the native engine as an owned window of the Harness main window, precisely positioned to the panel viewport rectangle (client-area ratio frac=[x,y,w,h]), with the title bar removed.
  • Custom Viewport Size: Supports 16:9 / 16:10 / 4:3 / 21:9 / full fill, or direct width × height input; after page zoom or window drag, the game display follows.
  • On-Demand Cropping: For games that accept resizing, the engine stretches them directly to the viewport size (the display fully fills the viewport). For a small number of older games that refuse resizing, it falls back to “position 1:1 at its own size + viewport clipping.”
  • No Windows Window Occupancy: The window is marked as WS_EX_TOOLWINDOW, with WS_EX_APPWINDOW removed, so neither the taskbar nor Alt+Tab gains an extra entry. It is only visible when the panel is showing and Harness is in the foreground; switching to another application or another plugin page hides it immediately.
  • Stop Button on Top: A red “Stop Game” button on the right side of the page header is never obscured by the game window.
  • One-Time Elevation Confirmation: Games requiring administrator privileges are launched directly by the already-elevated native engine, avoiding a second UAC prompt.

Architecture

Browser (client.js)
   │  React page: Game Library / Stage / Viewport Settings
   │  POST /yy-gamebox/api/*      ── viewport frac, launch, stop, scan
   ▼
Host (index.js + lib/*.js, running inside DSH)
   │  Game library games.json, routing, utilities, session state
   │  TCP JSON line protocol (token auth, 127.0.0.1 only)
   ▼
Native Engine (native/yybox.cs → <data_dir>/bin/yybox.exe, persistent as admin)
      SetWindowLongPtr(GWLP_HWNDPARENT) adopt + SetWindowPos position + Watch loop
  • Regular games: Host launches via spawn(detached) → engine track finds the window → attach adopts and positions.
  • Games requiring admin: Handled directly by the engine’s launch (the engine is already High integrity); the Host only keeps records.

Installation & Activation

Install from the repository (recommended):

dsh plugin add https://github.com/tlxqgj/dsh-yy-gamebox

For local development, you can also add the directory directly to your profile: the plugin package ships with a cordis.patch.yml; enable it via the plugin manager:

plugin_manager install_bundle target=<absolute_path_to_this_directory>

Or add "@local/yy-gamebox": "link:<this_directory>" to the profile’s package.json and restart.

On first engine launch, the plugin compiles native/yybox.cs into <DSH_HOME>/yy-gamebox/bin/yybox.exe using the system’s built-in csc.exe. No Node dependencies or pre-built artifacts are required.

Typical Usage

  • Click “Stash Box” in the sidebar to enter the page.
  • Click “Scan Steam Library” → check the games to include → Add.
  • Click “Launch” on a card, and the game appears in the central stage; the red button on the right side of the header stops the game at any time.
  • The stage size is the game display size; on the right side you can switch aspect ratios / set custom width × height, and check “Hide game title bar.”
  • Click “Stop” to end the game and restore the window style.

Available model-side tools:

  • yy_game_list
  • yy_game_scan (add:true adds directly to the library)
  • yy_game_add
  • yy_game_launch
  • yy_game_stop
  • yy_game_status

Data & Logs

All data and logs reside in <DSH_HOME>/yy-gamebox/ (on this machine: E:\dsh\yy-gamebox):

File Content
games.json Game library, viewport settings
engine.json Engine port and token
engine.log Native engine log
plugin.log Plugin (Host) log
bin/yybox.exe Compiled from native/yybox.cs on first launch

After modifying the engine source (compares the sha1 of native/yybox.cs with bin/build.sha1), the next launch will automatically recompile using csc.exe.

Real-World Testing & Known Limitations

  • Romance of the Three Kingdoms: Strategic Edition (S3Client, EJOY2DX emulator): It re-shows its own window on its own, so hiding relies on holding it with an “empty window region” (SetWindowRgn to 0×0) rather than just calling ShowWindow; it accepts resizing (tested: SetWindowPos requesting 1442×812 gets exactly 1442×812), so it takes the “stretch to fill viewport” path with a complete, unclipped display.
  • KOF‘97 (fixed-size legacy game): It refuses window style changes (its own WndProc rejects WM_STYLECHANGING, logged as strip refused), and does not accept external resizing either. The engine gives up after 3 consecutive failed attempts and marks it FixedSize, then retries every 12 seconds. Once identified as fixed-size, it uses SetWindowRgn to clip to the viewport rectangle — the title bar is thus clipped away while the display remains within the panel.
  • For windows that refuse style changes, the engine tries only once and remembers (StyleRefused): cross-process SetWindowLongPtr is a synchronous message; repeated retries would block the game’s message loop and could even crash it.
  • Cropping mode cuts off part of the display (no scaling applied); for a full display, switch to a resizable window or set the viewport to the same aspect ratio as the game.
  • Plugin reload (toggling via plugin_manager) does not kill the engine, so under normal circumstances a reload does not require re-confirming UAC. However, in-memory running sessions are lost after a reload, requiring a game restart. To force recompilation of the engine, use “Stop Engine” on the engine card and then restart (one UAC prompt will appear).

Notes

  • The first engine launch triggers one UAC prompt (Start-Process -Verb RunAs); after confirmation the engine persists; subsequent game launches will not interrupt you.
  • Why the engine needs administrator privileges: The Harness main process runs at Medium integrity; a lower-privilege process cannot modify its window handle (SetParent / CreateWindowEx both return err=5). Higher integrity can operate on lower-integrity windows, but not vice versa.
  • The engine listens only on 127.0.0.1, and every connection must first pass an auth with a valid token.
  • Uninstalling the plugin does not automatically close a running game — click “Stop” first.

Use Cases & Considerations

Suitable for developers who want to run local Windows games directly inside the DSH panel without additional network latency or window management overhead. The plugin runs with the current DSH process privileges; source code and license should be reviewed before installation. This plugin currently supports Windows only, and depends on the Win32 Window API and .NET Framework’s csc.exe.

Brief Closing

yy Stash Box lets local games “grow” natively within the DSH panel, with latency close to local execution while avoiding extra window management overhead. See the project homepage for more details and source code.

  • Directory page: https://www.skillhub.cn/plugins/tlxqgj/dsh-yy-gamebox
  • GitHub: https://github.com/tlxqgj/dsh-yy-gamebox
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye