Files
ReSkate/Extension/UI/NativeMenu/native_join_context.h
T
AyeZeeBB 8444553402 Throwdowns: the throwdown kit, so a mode is a plugin and the SDK knows no particular mode
Plugins register modes (card, replaces, order, flag, players) and publish documents through
reskate.throwdowns.ui: the setup page, the waiting card, HUD slots themed on the game's HUD_<theme>_*
widgets, the match panel, flags and match restrictions. SmokeyDawg58's native plumbing
(throwdown_menu.cpp and its .inl files) renders them and posts throwdown_ui events back. kit::flag
is the one native flag registration. General services added for it: reskate.files, reskate.ui.dialog,
reskate.skater push/hold/bone_cam, reskate.camera.pad_flight, reskate.physics competition,
reskate.session.world, reskate.tricks feed/gesture, and world entities.

His ten modes are now Lua in his plugin: the rules, referee and wire (td/rules, referee, wire), and
every page and HUD document (td/ui*.lua). Extension/Modes and reskate.modes are gone, along with
every race and 1-UP branch in the SDK. The plugin test drives each mode through kit events.

A native setup page is never written to while it closes into flag placement: its rows are not
republished, the stock page is put back once the exit is over, and the stock Players slider is left
alone while a plugin flag is out. This fixes the crashes on the Deathrace button and on 1-UP's
Confirm.
2026-10-20 01:04:54 -05:00

38 lines
2.0 KiB
C++

#pragma once
#include <array>
#include <cstdint>
#include <optional>
namespace dingosdk::multiplayer::menu_data {
// Captured ThrowdownDetailsMenuRule.FillContent: its Instance input is a
// reference to the native rule which owns MMId. Class fields use +38 (struct
// fields use +60); never infer the selected registration from a donor title.
template<class Read> std::optional<std::uint32_t> native_join_mmid(std::uintptr_t vm,Read read) {
using P=std::uintptr_t;
const auto pointer=[&](P at) {P v{};return read(at,&v,sizeof(v))?v:P{};};
const auto word=[&](P at) {std::uint32_t v{};return read(at,&v,sizeof(v))?v:0U;};
const auto resource=pointer(vm+0x38),instance=pointer(vm+0x30);
constexpr std::array<std::uint32_t,10> expected{624,40656,76600,21866,312,0,292,8520953,54067355,17437442};
std::array<std::uint32_t,10> layout{};
if(!resource || !instance || pointer(instance)!=resource || word(resource+0x10)!=0xebb4ab69 ||
!read(resource+0x20,layout.data(),sizeof(layout)) || layout!=expected)return {};
const auto constants=pointer(instance+624),ports=pointer(instance+632);
const auto type=constants?pointer(constants+27912):0,meta=type?pointer(type):0;
std::uint16_t flags{},size{},count{};
if(!meta || word(meta)!=1847693693U || !read(meta+4,&flags,2) || ((flags>>5)&31)!=3 ||
!read(meta+6,&size,2) || size!=352 || !read(meta+0x2a,&count,2) || count!=4)return {};
const auto fields=pointer(meta+0x38);std::optional<unsigned> offset;
for(unsigned i=0;fields && i<count;++i)if(word(fields+i*24)==0x66ba7ea4) {
std::uint16_t at{};
if(read(fields+i*24+8,&at,2) && at==0x150)offset=at;
}
if(!offset || !ports)return {};
auto object=pointer(ports+168);
for(unsigned depth=0;object && depth<3;++depth) {
if(object!=type && (pointer(object)==type || pointer(object+8)==type))return word(object+*offset);
object=pointer(object);
}
return {};
}
} // namespace dingosdk::multiplayer::menu_data