mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-23 15:16:02 +02:00
Pull request 326 split into general plugin APIs and contrib/plugins/fit-check: - reskate.capture (start, stop, discard, state, compare, kept, save): the screen recorded before the overlay draws, cut out by the game's depth or by colour, saved as GIF, APNG, PNG or WebM with an optional card; the "capture" permission. - reskate.room.turn: a stand-in pad's stick held over to turn the menu's preview. - reskate.menu.game and reskate.menu.grid: what the game's menu and its item grid show. - reskate.outfit.worn, board and title: what the skater wears, by name. - reskate.files.reveal: a data folder opened in Explorer. The plugin finds where the turn comes round, eases the stick off, picks evenly spaced frames and saves them with the board's parts or the outfit on the card.
49 lines
2.0 KiB
C++
49 lines
2.0 KiB
C++
#include "Extension/Console/commands.h"
|
|
#include "Extension/UI/Overlay/overlay.h"
|
|
#include <Windows.h>
|
|
#include <filesystem>
|
|
#include <sstream>
|
|
#include <string>
|
|
|
|
namespace dingosdk::console {
|
|
namespace {
|
|
std::filesystem::path game_folder() {
|
|
std::wstring path(MAX_PATH, L'\0');
|
|
for (;;) {
|
|
const auto length = GetModuleFileNameW(nullptr, path.data(), static_cast<DWORD>(path.size()));
|
|
if (length < path.size()) {
|
|
path.resize(length);
|
|
break;
|
|
}
|
|
path.resize(path.size() * 2);
|
|
}
|
|
return std::filesystem::path(path).parent_path();
|
|
}
|
|
} // namespace
|
|
|
|
// Research aids for screen captures (reskate.capture), from Fit Check's `fitcheck depth`.
|
|
void register_capture_commands(Commands& registry) {
|
|
auto arguments = argument("verb", Type::text, true);
|
|
arguments.complete = [](const Model&, auto) { return std::vector<std::string>{"depth"}; };
|
|
auto command = action("capture",
|
|
"Research aids for plugins' screen captures (reskate.capture): depth (the game's depth buffers over the next frames, "
|
|
"as pictures with depth-probe.txt in Captures\\depth beside Skate.exe). Answers go to the log.",
|
|
Group::console, {std::move(arguments)});
|
|
command.run = [](const Model&, const Values& values, const Output& out) {
|
|
std::istringstream words(values.empty() ? std::string{} : std::get<std::string>(values[0]));
|
|
std::string verb;
|
|
words >> verb;
|
|
if (verb == "depth") {
|
|
const auto folder = game_folder() / L"Captures" / L"depth";
|
|
std::error_code error;
|
|
std::filesystem::create_directories(folder, error);
|
|
overlay::request_depth_probe(folder.c_str());
|
|
out("Taking the game's depth buffers over the next frames: depth-probe.txt and depth-*.pgm go to Captures\\depth.");
|
|
} else {
|
|
out("capture depth");
|
|
}
|
|
};
|
|
registry.add(std::move(command));
|
|
}
|
|
} // namespace dingosdk::console
|