Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Design docs live in `docs/`. Read the one(s) covering whatever you are about to
- `docs/compatibility.md` - the scripting compatibility-flag system: the `CompatibilityFlags` registry, the framework flag catalog, the `game::GetCompatibilityFlags()` extension point, the `Compatibility` JS object, the per-flag gating sites, and why the BOM strip and `delay` wrapper stay un-flagged.
- `docs/realms.md` - custom Battle.net gateways: the `RealmRegistry` store, the `-realm` launch option, in-memory injection into D2's gateway list by detouring the Storm registry read/write helpers (no registry persistence), realm enumeration (`game::GetRealms`) exposed as the global `getRealms()`.
- `docs/stash_tabs.md` - stash tabs: the game-agnostic `game::StashTab` identity handle (`game/StashTab.h`; backend-implemented `Type` / `Name` / `Gold` / `GetItems` / `Click` / `DepositGold` / `WithdrawGold`, `game::GetStashTabs`, `Unit::StashTab`), exposed 1:1 as the `StashTab` JS class via `getStashTabs()` and `Unit.stashTab`, the per-tab gold attribution rule, why there is no "select tab", the character-state `pages` feed, and the `GoldActionMode` dialog codes.
- `docs/plugy_stash.md` - PlugY's multi-page stash on 1.14d, the backend behind `docs/stash_tabs.md` when PlugY is present: how PlugY pages the stash (only the shown page lives in the inventory; the rest hang off a `PYPlayerData` tail appended to the player data, parked items are stored-mode with no parent inventory), the version-allowlisted detection in `backends/lod114d/game/PlugY.cpp`, running PlugY's `Init` from `Bridge::Init` when PlugY.dll was injected without PlugY.exe, the patch-site overlap check against d2bs's hooks, the blocking swap-in / click / ack-wait / swap-back sequence over PlugY's 0x3A channel, the shared gold pool, and how to remove the PlugY code again.
- `docs/code_cache.md` - the script code cache: why per-script isolates make V8's own compilation cache useless across scripts, the memory + opt-in disk tiers of `js::script::CodeCache`, how it hooks into `CompileSource` (eager on a miss / consume on a hit / drop on a rejected blob), the key (post-transform source + origin + V8 build tag), the header-less on-disk entries and cross-instance sharing, and the `CodeCachePath` / `CodeCacheMemoryLimit` / `CodeCacheDiskLimit` settings.
- `docs/analytics.md` - anonymous usage analytics (Aptabase): the `Analytics` component, the `session_start` / `profile_active` events (the latter carrying a per-install `profileHash`, never the profile name) and exactly what they do / do not collect, the compile-time app key (build-time only; the project key is the committed default in `Directory.Build.props`, overridable per-build via `-p:D2bsAnalyticsKey` / gitignored `d2bs.local.props` / `D2BS_ANALYTICS_KEY`, and an empty value compiles analytics out), the per-launch opt-out (`-noanalytics`/`D2BS_ANALYTICS_DISABLE`), the backend-agnostic `features` tag list via `game::GetActiveFeatures()`, the anonymous `installId` (derived per launch, never stored), and the `game::GetAnalyticsLaunchOptions()` / `game::GetBackendVersion()` contract accessors.

Expand Down
276 changes: 276 additions & 0 deletions docs/plugy_stash.md

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion docs/stash_tabs.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ through the tab API.
One personal tab, index 0, whose `GetItems()` is the inventory walk filtered to
`ItemLocation::Stash`, whose `Gold()` is the character's stash gold, and whose
`Click` is `ClickContainerSlot(Left, cell, Stash)`. Implemented in
`backends/lod114d/game/Stash.cpp`.
`backends/lod114d/game/Stash.cpp`. When PlugY's multi-page stash is active,
every member delegates to `plugy::` (`backends/lod114d/game/PlugY.h`) instead;
`docs/plugy_stash.md` covers that path, and the vanilla one is the fallback
whenever PlugY is absent, disabled, or inactive (Battle.net).

## JS surface

Expand Down
3 changes: 3 additions & 0 deletions src/backends/lod114d/game/Bridge.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "game/Bridge.h"

#include "PlugY.h"
#include "asm_thunks/asm_thunks.h"
#include "hooks/Intercepts.h"
#include "hooks/Realms.h"
Expand Down Expand Up @@ -38,6 +39,8 @@ bool Bridge::Init() {
return false;
}

plugy::InstallInitHook();

imports::Registry::Get().ResolveAll(base);

// Seed the naked-asm thunk jump targets. Hook lifecycle is owned by GameCallbacks::InstallHooks.
Expand Down
8 changes: 8 additions & 0 deletions src/backends/lod114d/game/GameHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <vector>

#include "DrlgHelpers.h"
#include "PlugY.h"
#include "RoomData.h"
#include "asm_thunks/asm_thunks.h"
#include "game/Bridge.h"
Expand Down Expand Up @@ -1067,6 +1068,10 @@ ClickResult ClickItem(ClickButton button, const Unit& item) {
const auto gridX = itemPtr->pStaticPath->tGameCoords.nX;
const auto gridY = itemPtr->pStaticPath->tGameCoords.nY;

if (plugy::IsParkedItem(itemPtr)) {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Should this have IsActive && HasStashTAbs check?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Done in d4e59d9: the call site checks plugy::IsActive() && plugy::HasStashTabs() first, and IsParkedItem is now only the signature test.

return plugy::ClickParkedItem(button, item);
}

d2client::gCursorHover->x = gridX;
d2client::gCursorHover->y = gridY;
auto guard = Bridge::Lock();
Expand Down Expand Up @@ -2107,6 +2112,9 @@ std::vector<std::string> GetActiveFeatures() {
if (opts.randomizeBnetCache) {
features.emplace_back("bnetCacheFix");
}
if (plugy::IsActive()) {
features.emplace_back("plugy");
}
return features;
}

Expand Down
Loading
Loading