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",
_vehicleId, // vehicle id registered
_model, _selection,
// _model, _selection,
_model, "BALLS",
VECTOR_TEXT(vectorDir _vehicle),
VECTOR_TEXT(vectorUp _vehicle),
_projectileType, //projectile type id

View File

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

View File

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

View File

@ -3,12 +3,36 @@
#include "shared.hpp"
#include "d3d_display.hpp"
#include <TlHelp32.h>
#include <thread>
using namespace DirectX;
namespace ace {
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() {}
@ -210,6 +234,9 @@ namespace ace {
return false;
}
// Attach our input to the master input
//AttachThreadInput(GetCurrentThreadId(), GetMainThraedId());
SetWindowLongPtr(_hWnd, GWLP_USERDATA, (LONG)this);
ShowWindow(_hWnd, 5);
@ -311,7 +338,9 @@ namespace ace {
switch (message) {
case WM_INPUT: {
UINT dwSize;
if (GetActiveWindow() != _hWnd) {
return DefWindowProc(hWnd, message, wParam, lParam);
}
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize,
sizeof(RAWINPUTHEADER));
LPBYTE lpb = new BYTE[dwSize];