mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-25 16:30:15 +00:00
Add mount system and crash mouse-release handler
Render mount M2 model under player with seated animation, apply creature skin textures, server-driven speed via SMSG_FORCE_RUN_SPEED_CHANGE, and /dismount command. X11 XUngrabPointer on crash/hang to always release mouse.
This commit is contained in:
parent
4a932dd8cd
commit
643611ee79
13 changed files with 363 additions and 3 deletions
27
src/main.cpp
27
src/main.cpp
|
|
@ -1,8 +1,33 @@
|
|||
#include "core/application.hpp"
|
||||
#include "core/logger.hpp"
|
||||
#include <exception>
|
||||
#include <csignal>
|
||||
#include <SDL2/SDL.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
static void releaseMouseGrab() {
|
||||
// Bypass SDL — talk to X11 directly (signal-safe enough for our purposes)
|
||||
Display* dpy = XOpenDisplay(nullptr);
|
||||
if (dpy) {
|
||||
XUngrabPointer(dpy, CurrentTime);
|
||||
XUngrabKeyboard(dpy, CurrentTime);
|
||||
XFlush(dpy);
|
||||
XCloseDisplay(dpy);
|
||||
}
|
||||
}
|
||||
|
||||
static void crashHandler(int sig) {
|
||||
releaseMouseGrab();
|
||||
std::signal(sig, SIG_DFL);
|
||||
std::raise(sig);
|
||||
}
|
||||
|
||||
int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) {
|
||||
std::signal(SIGSEGV, crashHandler);
|
||||
std::signal(SIGABRT, crashHandler);
|
||||
std::signal(SIGFPE, crashHandler);
|
||||
std::signal(SIGTERM, crashHandler);
|
||||
std::signal(SIGINT, crashHandler);
|
||||
try {
|
||||
wowee::core::Logger::getInstance().setLogLevel(wowee::core::LogLevel::DEBUG);
|
||||
LOG_INFO("=== Wowee Native Client ===");
|
||||
|
|
@ -22,10 +47,12 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) {
|
|||
return 0;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
releaseMouseGrab();
|
||||
LOG_FATAL("Unhandled exception: ", e.what());
|
||||
return 1;
|
||||
}
|
||||
catch (...) {
|
||||
releaseMouseGrab();
|
||||
LOG_FATAL("Unknown exception occurred");
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue