Merge commit '32bb0becc8' into chore/game-screen-extract

This commit is contained in:
Paul 2026-03-31 19:51:37 +03:00
commit 43aecab1ef
145 changed files with 3237 additions and 2849 deletions

View file

@ -48,7 +48,6 @@
#include "pipeline/dbc_layout.hpp"
#include <SDL2/SDL.h>
// GL/glew.h removed — Vulkan migration Phase 1
#include <cstdlib>
#include <climits>
#include <algorithm>
@ -256,7 +255,6 @@ bool Application::initialize() {
// Create subsystems
authHandler = std::make_unique<auth::AuthHandler>();
gameHandler = std::make_unique<game::GameHandler>();
world = std::make_unique<game::World>();
// Create and initialize expansion registry
@ -268,6 +266,14 @@ bool Application::initialize() {
// Create asset manager
assetManager = std::make_unique<pipeline::AssetManager>();
// Populate game services — all subsystems now available
gameServices_.renderer = renderer.get();
gameServices_.assetManager = assetManager.get();
gameServices_.expansionRegistry = expansionRegistry_.get();
// Create game handler with explicit service dependencies
gameHandler = std::make_unique<game::GameHandler>(gameServices_);
// Try to get WoW data path from environment variable
const char* dataPathEnv = std::getenv("WOW_DATA_PATH");
std::string dataPath = dataPathEnv ? dataPathEnv : "./Data";
@ -914,6 +920,7 @@ void Application::shutdown() {
world.reset();
LOG_WARNING("Resetting gameHandler...");
gameHandler.reset();
gameServices_ = {};
LOG_WARNING("Resetting authHandler...");
authHandler.reset();
LOG_WARNING("Resetting assetManager...");
@ -5657,6 +5664,8 @@ void Application::buildCreatureDisplayLookups() {
gryphonDisplayId_ = resolveDisplayIdForExactPath("Creature\\Gryphon\\Gryphon.m2");
wyvernDisplayId_ = resolveDisplayIdForExactPath("Creature\\Wyvern\\Wyvern.m2");
gameServices_.gryphonDisplayId = gryphonDisplayId_;
gameServices_.wyvernDisplayId = wyvernDisplayId_;
LOG_INFO("Taxi mount displayIds: gryphon=", gryphonDisplayId_, " wyvern=", wyvernDisplayId_);
// CharHairGeosets.dbc: maps (race, sex, hairStyleId) → skinSectionId for hair mesh

View file

@ -25,7 +25,10 @@ void Input::update() {
Uint32 mouseState = SDL_GetMouseState(&mouseX, &mouseY);
mousePosition = glm::vec2(static_cast<float>(mouseX), static_cast<float>(mouseY));
for (int i = 0; i < NUM_MOUSE_BUTTONS; ++i) {
// SDL_BUTTON(x) is defined as (1 << (x-1)), so button indices are 1-based.
// SDL_BUTTON(0) is undefined behavior (negative shift). Start at 1.
currentMouseState[0] = false;
for (int i = 1; i < NUM_MOUSE_BUTTONS; ++i) {
currentMouseState[i] = (mouseState & SDL_BUTTON(i)) != 0;
}

View file

@ -23,9 +23,10 @@ size_t readMemAvailableBytesFromProc() {
std::string line;
while (std::getline(meminfo, line)) {
// Format: "MemAvailable: 123456789 kB"
// /proc/meminfo format: "MemAvailable: 123456789 kB"
static constexpr size_t kFieldPrefixLen = 13; // strlen("MemAvailable:")
if (line.rfind("MemAvailable:", 0) != 0) continue;
std::istringstream iss(line.substr(13));
std::istringstream iss(line.substr(kFieldPrefixLen));
size_t kb = 0;
iss >> kb;
if (kb > 0) return kb * 1024ull;
@ -42,13 +43,18 @@ MemoryMonitor& MemoryMonitor::getInstance() {
}
void MemoryMonitor::initialize() {
constexpr size_t kOneGB = 1024ull * 1024 * 1024;
// Fallback if OS API unavailable — 16 GB is a safe conservative estimate
// that prevents over-aggressive asset caching on unknown hardware.
constexpr size_t kFallbackRAM = 16 * kOneGB;
#ifdef _WIN32
ULONGLONG totalKB = 0;
if (GetPhysicallyInstalledSystemMemory(&totalKB)) {
totalRAM_ = static_cast<size_t>(totalKB) * 1024ull;
LOG_INFO("System RAM detected: ", totalRAM_ / (1024 * 1024 * 1024), " GB");
LOG_INFO("System RAM detected: ", totalRAM_ / kOneGB, " GB");
} else {
totalRAM_ = 16ull * 1024 * 1024 * 1024;
totalRAM_ = kFallbackRAM;
LOG_WARNING("Could not detect system RAM, assuming 16GB");
}
#elif defined(__APPLE__)
@ -56,19 +62,18 @@ void MemoryMonitor::initialize() {
size_t len = sizeof(physmem);
if (sysctlbyname("hw.memsize", &physmem, &len, nullptr, 0) == 0) {
totalRAM_ = static_cast<size_t>(physmem);
LOG_INFO("System RAM detected: ", totalRAM_ / (1024 * 1024 * 1024), " GB");
LOG_INFO("System RAM detected: ", totalRAM_ / kOneGB, " GB");
} else {
totalRAM_ = 16ull * 1024 * 1024 * 1024;
totalRAM_ = kFallbackRAM;
LOG_WARNING("Could not detect system RAM, assuming 16GB");
}
#else
struct sysinfo info;
if (sysinfo(&info) == 0) {
totalRAM_ = static_cast<size_t>(info.totalram) * info.mem_unit;
LOG_INFO("System RAM detected: ", totalRAM_ / (1024 * 1024 * 1024), " GB");
LOG_INFO("System RAM detected: ", totalRAM_ / kOneGB, " GB");
} else {
// Fallback: assume 16GB
totalRAM_ = 16ull * 1024 * 1024 * 1024;
totalRAM_ = kFallbackRAM;
LOG_WARNING("Could not detect system RAM, assuming 16GB");
}
#endif

View file

@ -103,6 +103,8 @@ bool Window::initialize() {
return true;
}
// Shutdown progress uses LOG_WARNING so these messages are always visible even at
// default log levels — useful for diagnosing hangs or crashes during teardown.
void Window::shutdown() {
LOG_WARNING("Window::shutdown - vkContext...");
if (vkContext) {