Files
ReSkate/Extension/Trainer/trainer_view.cpp
T
andrewnakasandClaude Opus 5.5 8eedd0a5c4 Add the ReSkate Trainer: a TRAINER page with live physics tuning, presets, practice tools and jump telemetry
All new code is in Extension/Trainer. The game thread owns the trainer's state; the menu
page only queues `trainer ...` console commands and reads two snapshots.

- physics_tuning_model keeps the field and curve names the game's EBX carries, so the
  editable table is built at run time from the player's own data.
- physics_tuning exports game_tuning / read_live / write_live / refresh_skater, with the
  same field whitelist and curve rules as the session sync.
- no_bail publishes the physics state the local skater's selector last chose (air time,
  wipeouts).
- A guest under host tuning cannot edit; teleports follow the host's noclip permission.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-03 09:49:58 -06:00

40 lines
1005 B
C++

#include "trainer.h"
#include <mutex>
// The snapshots the menu and HUD read. Kept apart from trainer.cpp so the overlay library
// links without the game-facing half.
namespace dingosdk::trainer {
namespace {
struct Feed {
std::mutex mutex;
std::shared_ptr<const View> view = std::make_shared<const View>();
Telemetry telemetry;
};
Feed &feed() {
static auto *value = new Feed;
return *value;
}
} // namespace
std::shared_ptr<const View> view() noexcept {
auto &f = feed();
std::lock_guard lock(f.mutex);
return f.view;
}
Telemetry telemetry() noexcept {
auto &f = feed();
std::lock_guard lock(f.mutex);
return f.telemetry;
}
void publish(std::shared_ptr<const View> next) noexcept {
if (!next) return;
auto &f = feed();
std::lock_guard lock(f.mutex);
f.view = std::move(next);
}
void publish(const Telemetry &next) noexcept {
auto &f = feed();
std::lock_guard lock(f.mutex);
f.telemetry = next;
}
} // namespace dingosdk::trainer