Stability fixes.

This commit is contained in:
jaynus 2015-05-11 16:40:15 -07:00
parent 3c84db9051
commit ac1ae6c596
4 changed files with 35 additions and 5 deletions

View File

@ -35,7 +35,8 @@ _vehicleId = _vehicle getVariable[QGVAR(id), -1];
_command = format["hit:%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18", _command = format["hit:%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18",
_vehicleId, // vehicle id registered _vehicleId, // vehicle id registered
_model, _selection, // _model, _selection,
_model, "BALLS",
VECTOR_TEXT(vectorDir _vehicle), VECTOR_TEXT(vectorDir _vehicle),
VECTOR_TEXT(vectorUp _vehicle), VECTOR_TEXT(vectorUp _vehicle),
_projectileType, //projectile type id _projectileType, //projectile type id

View File

@ -18,4 +18,4 @@
#define DEBUG_EXTENSION_DYNLOAD #define DEBUG_EXTENSION_DYNLOAD
#define DEBUG_LOG_EXTENSION #define DEBUG_LOG_EXTENSION
//#define DEBUG_EXTENSION_DYNLOAD_RELOAD //#define DEBUG_EXTENSION_DYNLOAD_RELOAD
//#define DEBUG_VEHICLEDAMAGE_RENDER #define DEBUG_VEHICLEDAMAGE_RENDER

View File

@ -82,6 +82,6 @@ namespace ace {
protected: protected:
std::vector<std::string> _args; std::vector<std::string> _args;
const std::string &_original; const std::string _original;
}; };
} }

View File

@ -3,12 +3,36 @@
#include "shared.hpp" #include "shared.hpp"
#include "d3d_display.hpp" #include "d3d_display.hpp"
#include <TlHelp32.h>
#include <thread> #include <thread>
using namespace DirectX; using namespace DirectX;
namespace ace { namespace ace {
namespace debug { namespace debug {
DWORD GetMainThreadId() {
const std::shared_ptr<void> hThreadSnapshot(
CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0), CloseHandle);
if (hThreadSnapshot.get() == INVALID_HANDLE_VALUE) {
throw std::runtime_error("GetMainThreadId failed");
}
THREADENTRY32 tEntry;
tEntry.dwSize = sizeof(THREADENTRY32);
DWORD result = 0;
DWORD currentPID = GetCurrentProcessId();
for (BOOL success = Thread32First(hThreadSnapshot.get(), &tEntry);
!result && success && GetLastError() != ERROR_NO_MORE_FILES;
success = Thread32Next(hThreadSnapshot.get(), &tEntry))
{
if (tEntry.th32OwnerProcessID == currentPID) {
result = tEntry.th32ThreadID;
}
}
return result;
}
d3d_display::d3d_display() : _fullscreen(false) {} d3d_display::d3d_display() : _fullscreen(false) {}
d3d_display::~d3d_display() {} d3d_display::~d3d_display() {}
@ -210,6 +234,9 @@ namespace ace {
return false; return false;
} }
// Attach our input to the master input
//AttachThreadInput(GetCurrentThreadId(), GetMainThraedId());
SetWindowLongPtr(_hWnd, GWLP_USERDATA, (LONG)this); SetWindowLongPtr(_hWnd, GWLP_USERDATA, (LONG)this);
ShowWindow(_hWnd, 5); ShowWindow(_hWnd, 5);
@ -307,11 +334,13 @@ namespace ace {
LRESULT CALLBACK d3d_display::_wndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { LRESULT CALLBACK d3d_display::_wndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hdc; HDC hdc;
switch (message) { switch (message) {
case WM_INPUT: { case WM_INPUT: {
UINT dwSize; UINT dwSize;
if (GetActiveWindow() != _hWnd) {
return DefWindowProc(hWnd, message, wParam, lParam);
}
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize,
sizeof(RAWINPUTHEADER)); sizeof(RAWINPUTHEADER));
LPBYTE lpb = new BYTE[dwSize]; LPBYTE lpb = new BYTE[dwSize];