Files
ReSkate/Extension/Customization/item_origins.h
T
AyeZeeBB ab8c9dc6ae Customization: a mod's item card shows the mod, with its icon, inside the game's item card
A mod's item (or one of the game's own a mod changes) keeps three empty description lines, so
the game's item card, which grows upward from a fixed bottom edge, always has room in the same
place; the overlay draws the mod there: its icon (decoded off the render thread into a fourth
texture slot, the last 32 kept), a MOD or CHANGED BY MOD tag, its name, author, version and how
many items it has. The card is placed as the game places its own, measured at many window sizes:
by the smaller of its scales, a 21:9 frame centred on wider screens (the search bar follows it
too). The warning sign the game's focus script gives any description is taken off that notice
each tick while it shows the reserved lines.

The merge's item list records each mod's version and folder (an older list falls back to the mods
loaded at launch). The item grids now run every client tick instead of at the 500 ms
customization pace, follow the highlight between their 40 ms passes, and let go of a grid as soon
as its screen closes, so the card, the search bar and favorites keep up with the player.
2026-10-17 12:04:38 -05:00

27 lines
1.4 KiB
C++

#pragma once
#include <cstddef>
#include <filesystem>
#include <memory>
#include <string>
#include <string_view>
// Which mod each cosmetic item is from, as the last merge found (Engine/Vfs/mod_item_sources.h):
// the item catalogue's description line and the item card the overlay draws beside the game's.
namespace dingosdk::item_origins {
struct Origin {
std::string title, author, version; // title with spaces for underscores
std::string name; // "<title> by <author>"
std::filesystem::path icon; // the mod's icon.png (it may not exist)
std::size_t items{}; // how many items the mod adds or changes
};
// The mod the item with this key is from, or null. Reads the merge's file again when it changed,
// looking at most every two seconds; cheap otherwise. Any thread.
std::shared_ptr<const Origin> find(std::string_view key);
// Whether the game itself ships the item (a mod only changes it), by the content cache.
bool game_item(std::string_view key);
// A mod's item's description: three empty lines (no-break spaces, in UTF-8; plain spaces could
// be taken for no description), room at the bottom of the game's item card for the overlay to
// show the mod (UI/Overlay/item_browser_overlay.cpp, draw_mod_card).
inline constexpr std::string_view reserved_description = "\xc2\xa0\n\xc2\xa0\n\xc2\xa0";
} // namespace dingosdk::item_origins