Files
ReSkate/Runtime/bootstrap.cpp
T
AyeZeeBB 86aa8d38fb Music: local files, online radio, equaliser, queue, and a Music page in the menu
Sources
- Local Files: add a folder of music from the setup page (MP3, M4A, AAC, Ogg,
  FLAC, WAV; up to 200 songs a folder, 12 folders). Names and covers come from
  the files' tags. Each folder is a tile in its own row.
- Online Radio: find stations by name (radio-browser.info) or add a stream's
  address (MP3, AAC, .pls, .m3u; no HLS). Each station is a tile in its own
  row; the track name follows what the station sends. Up to 24.
- Both are decoded by the library built into the DLL (SpotifyHelper), which
  now plays files and HTTP streams as well as a program's output, reads tags
  and embedded pictures, and accepts MPEG-2 ADTS from AAC stations.

Sound
- Five-band equaliser (60 Hz, 250 Hz, 1 kHz, 4 kHz, 12 kHz) and loudness
  levelling, applied to every source on its way into the game.
- Loudness, the speakers option, the equaliser and levelling are now kept in
  music-settings.json between sessions.

Setup page
- Remade in the mod's own colours and type, with numbered steps per source.
- Queue pinned to the right: now playing, the playlist's songs with covers,
  find, and press to jump. Spotify's own queue shows once signed in.
- Cards for Local files and Online radio; equaliser and levelling under Sound.

In game
- MUSIC page in the menu: player and queue, sound settings, source status and
  a button for the setup page.
- "Loading song..." notice in the corner for songs that take a moment, with a
  switch to hide it. Presses made while a song is loading no longer restart it.
- The Spotify row is hidden when Spotify is not in use.
- Console: "spotify ..." is now "music ..." (music, music setup, music gain,
  music through, music spotify client|login|logout).

Logs
- The music sources' working lines (traces, per-song and per-bind lines,
  librespot's own) are debug only; stack captures are skipped unless debug
  logging is on. Grind exits: the per-pop line is debug only too.
- A "Pace:" line when the game takes the sound faster or slower than real
  time, to find why music sounds fast after tabbing back in.

Chat filter
- A run of digits is a number, not a word spelled with look-alikes: a race
  time such as 2:55.0 is no longer masked.
2026-10-12 16:03:35 -05:00

79 lines
4.7 KiB
C++

#include "bootstrap.h"
#include "Engine/Core/Log/logging.h"
#include "Engine/Core/Hooks/hooks.h"
#include "Engine/Core/Platform/launcher_support.h"
#include "Extension/Boot/startup_interventions.h"
#include "Extension/Boot/steam_restart_guard.h"
#include "Extension/Boot/user_data_redirect.h"
#include "Extension/Boot/ea_app_block.h"
#include "Extension/Boot/ea_service_block.h"
#include "Extension/Assets/native_patch_support.h"
#include "Extension/Assets/mod_layers.h"
#include "Extension/Assets/loose_files.h"
#include "Extension/Scripting/custom_script_loader.h"
#include "Extension/Scripting/lua_native_block.h"
#include "Extension/Assets/morph_memory_pool.h"
#include "Extension/Assets/native_render_resource_pool.h"
#include "Extension/Rendering/display_startup.h"
#include "Extension/World/native_route_lookahead.h"
#include "Extension/World/native_entity_pages.h"
#include "Extension/World/physics_world_size.h"
#include <string>
namespace dingosdk::runtime {
namespace {
bool stage(logging::Channel channel, const char* name, bool ready, const std::string& error) {
logging::log(ready ? logging::Level::info : logging::Level::error, channel,
"{}: {}{}", name, ready ? "ready" : "failed", error.empty() ? "" : " - " + error);
return ready;
}
}
bool initialize_bootstrap(std::uintptr_t base) {
if (!base) return false;
using logging::Channel;
std::string error;
bool ready = start_startup_interventions(base, error);
if (!stage(Channel::runtime, "Startup interventions", ready, error)) return false;
const auto hooks = hook_initialize();
if (hooks != HookOk && hooks != HookAlreadyInitialized) {
logging::log(logging::Level::error, Channel::hooks, "Hook service failed: {} ({})", hook_status_string(hooks), static_cast<long>(hooks));
return false;
}
logging::write(logging::Level::info, Channel::hooks, "Microsoft Detours hook service ready.");
error.clear(); ready = start_native_patch_support(base, error);
if (!stage(Channel::assets, "Native InitFS/package support", ready, error)) return false;
error.clear(); ready = start_mod_layers(base, error);
if (!stage(Channel::assets, "Mod layout layers", ready, error)) return false;
// Before anything that lets a script of the player's own into the game's Lua.
error.clear(); ready = start_lua_native_block(base, error);
if (!stage(Channel::assets, "Lua kept to Lua (no DLLs, programs, file writes or bytecode)", ready, error)) return false;
error.clear(); ready = start_loose_files(base, error);
if (!stage(Channel::assets, "Loose Lua/config files", ready, error)) return false;
error.clear(); ready = start_custom_script_loader(base, error);
if (!stage(Channel::assets, "Custom Lua scripts", ready, error)) return false;
error.clear(); ready = start_morph_memory_pool(base, error);
if (!stage(Channel::assets, "Morph memory pools", ready, error)) return false;
error.clear(); ready = start_native_render_resource_pool(base, error);
if (!stage(Channel::assets, "Native render-resource pools", ready, error)) return false;
error.clear(); ready = start_native_entity_pages(base, error);
if (!stage(Channel::world, "Native entity pages (524288 entity/update slots, 1048576 render slots, 16384 spatial blocks/bucket, 128 MiB arena minimum)", ready, error)) return false;
error.clear(); ready = start_physics_world_size(base, error);
if (!stage(Channel::world, "Physics world pools (65000 static bodies)", ready, error)) return false;
error.clear(); ready = start_native_route_lookahead(base, error);
if (!stage(Channel::world, "NPC route cycle and endpoint guards", ready, error)) return false;
// The level unload guard (unload_guard.h) is not installed: stepping over an entry with no
// asset stopped the crash, but that entry had been registered when the level loaded, and
// left registered it kept the level from ever finishing its unload (a map change that never
// ends, which is worse than the crash). It goes back in once it can release what it skips.
if (!stage(Channel::graphics, "Display startup settings", start_display_settings(base), {})) return false;
error.clear(); ready = start_user_data_redirect(error);
if (!stage(Channel::runtime, "Separate game user data", ready, error)) return false;
error.clear(); ready = start_ea_app_block(error);
if (!stage(Channel::runtime, "EA app launch block", ready, error)) return false;
error.clear(); ready = start_ea_service_block(error);
if (!stage(Channel::runtime, "EA online services block", ready, error)) return false;
error.clear(); ready = start_steam_restart_guard(error);
return stage(Channel::runtime, launcher::offline_mode() ? "Offline Steam" : "Steam restart guard", ready, error);
}
}