mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 08:03:50 +00:00
Fix Windows build errors in warden and CharCreateResult
warden_emulator.cpp: guard unicorn include + entire implementation with HAVE_UNICORN; provide stub implementations for platforms without Unicorn (Windows ARM64 which has no unicorn MSYS2 package) warden_module.cpp: include <windows.h> for VirtualAlloc/HMODULE/etc on Windows; always include warden_emulator.hpp so unique_ptr destructor compiles regardless of HAVE_UNICORN world_packets.hpp + game_handler.cpp: rename CharCreateResult::ERROR to CharCreateResult::CHAR_ERROR to avoid wingdi.h #define ERROR 0 collision
This commit is contained in:
parent
5040740171
commit
8185c29648
4 changed files with 40 additions and 6 deletions
|
|
@ -187,7 +187,7 @@ enum class CharCreateResult : uint8_t {
|
|||
|
||||
// CHAR_CREATE error codes
|
||||
IN_PROGRESS = 0x2E, // CHAR_CREATE_IN_PROGRESS
|
||||
ERROR = 0x30, // CHAR_CREATE_ERROR
|
||||
CHAR_ERROR = 0x30, // CHAR_CREATE_ERROR
|
||||
FAILED = 0x31, // CHAR_CREATE_FAILED
|
||||
NAME_IN_USE = 0x32, // CHAR_CREATE_NAME_IN_USE
|
||||
DISABLED = 0x33, // CHAR_CREATE_DISABLED
|
||||
|
|
|
|||
|
|
@ -2065,7 +2065,7 @@ void GameHandler::handleCharCreateResponse(network::Packet& packet) {
|
|||
} else {
|
||||
std::string msg;
|
||||
switch (data.result) {
|
||||
case CharCreateResult::ERROR: msg = "Server error"; break;
|
||||
case CharCreateResult::CHAR_ERROR: msg = "Server error"; break;
|
||||
case CharCreateResult::FAILED: msg = "Creation failed"; break;
|
||||
case CharCreateResult::NAME_IN_USE: msg = "Name already in use"; break;
|
||||
case CharCreateResult::DISABLED: msg = "Character creation disabled"; break;
|
||||
|
|
|
|||
|
|
@ -3,12 +3,16 @@
|
|||
#include <cstring>
|
||||
#include <chrono>
|
||||
|
||||
#ifdef HAVE_UNICORN
|
||||
// Unicorn Engine headers
|
||||
#include <unicorn/unicorn.h>
|
||||
#endif
|
||||
|
||||
namespace wowee {
|
||||
namespace game {
|
||||
|
||||
#ifdef HAVE_UNICORN
|
||||
|
||||
// Memory layout for emulated environment
|
||||
constexpr uint32_t STACK_BASE = 0x00100000; // 1MB
|
||||
constexpr uint32_t STACK_SIZE = 0x00100000; // 1MB stack
|
||||
|
|
@ -396,5 +400,31 @@ void WardenEmulator::hookMemInvalid(uc_engine* uc, int type, uint64_t address, i
|
|||
<< " (size=" << size << ")" << std::endl;
|
||||
}
|
||||
|
||||
#else // !HAVE_UNICORN
|
||||
// Stub implementations — Unicorn Engine not available on this platform.
|
||||
WardenEmulator::WardenEmulator()
|
||||
: uc_(nullptr), moduleBase_(0), moduleSize_(0)
|
||||
, stackBase_(0), stackSize_(0)
|
||||
, heapBase_(0), heapSize_(0)
|
||||
, apiStubBase_(0), nextHeapAddr_(0) {}
|
||||
WardenEmulator::~WardenEmulator() {}
|
||||
bool WardenEmulator::initialize(const void*, size_t, uint32_t) { return false; }
|
||||
uint32_t WardenEmulator::hookAPI(const std::string&, const std::string&,
|
||||
std::function<uint32_t(WardenEmulator&, const std::vector<uint32_t>&)>) { return 0; }
|
||||
uint32_t WardenEmulator::callFunction(uint32_t, const std::vector<uint32_t>&) { return 0; }
|
||||
bool WardenEmulator::readMemory(uint32_t, void*, size_t) { return false; }
|
||||
bool WardenEmulator::writeMemory(uint32_t, const void*, size_t) { return false; }
|
||||
std::string WardenEmulator::readString(uint32_t, size_t) { return {}; }
|
||||
uint32_t WardenEmulator::allocateMemory(size_t, uint32_t) { return 0; }
|
||||
bool WardenEmulator::freeMemory(uint32_t) { return false; }
|
||||
uint32_t WardenEmulator::getRegister(int) { return 0; }
|
||||
void WardenEmulator::setRegister(int, uint32_t) {}
|
||||
void WardenEmulator::setupCommonAPIHooks() {}
|
||||
uint32_t WardenEmulator::writeData(const void*, size_t) { return 0; }
|
||||
std::vector<uint8_t> WardenEmulator::readData(uint32_t, size_t) { return {}; }
|
||||
void WardenEmulator::hookCode(uc_engine*, uint64_t, uint32_t, void*) {}
|
||||
void WardenEmulator::hookMemInvalid(uc_engine*, int, uint64_t, int, int64_t, void*) {}
|
||||
#endif // HAVE_UNICORN
|
||||
|
||||
} // namespace game
|
||||
} // namespace wowee
|
||||
|
|
|
|||
|
|
@ -9,14 +9,18 @@
|
|||
#include <openssl/bn.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifdef _WIN32
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/mman.h>
|
||||
#include <cerrno>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNICORN
|
||||
#include "game/warden_emulator.hpp"
|
||||
#endif
|
||||
// Always include the full definition so unique_ptr<WardenEmulator> destructor compiles
|
||||
#include "game/warden_emulator.hpp"
|
||||
|
||||
namespace wowee {
|
||||
namespace game {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue