mirror of
https://github.com/DxWnd/DxWnd.reloaded
synced 2024-12-30 09:25:35 +01:00
v2_04_16_src
Former-commit-id: 208a69bad39b49b740d61779b454ca3b8309c530
This commit is contained in:
parent
fb320c8ab3
commit
1f153bb853
@ -340,6 +340,15 @@ typedef struct TARGETMAP
|
||||
short ScanLine;
|
||||
}TARGETMAP;
|
||||
|
||||
// VJoyStatus flags
|
||||
#define VJOYPRESENT 0x00000001 // Virtual joystick configured for the program
|
||||
#define VJOYENABLED 0x00000002 // Virtual Joystick enabled and sending input coordinates
|
||||
#define CROSSENABLED 0x00000004 // Crossfire display enabled
|
||||
#define INVERTYAXIS 0x00000008 // Invert virtual joystick Y axis
|
||||
#define INVERTXAXIS 0x00000010 // Invert virtual joystick X axis
|
||||
#define B1AUTOFIRE 0x00000020 // Button 1 auto fire
|
||||
#define B2AUTOFIRE 0x00000040 // Button 2 auto fire
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short Status;
|
||||
@ -358,11 +367,14 @@ typedef struct
|
||||
short CursorX, CursorY;
|
||||
PALETTEENTRY Palette[256];
|
||||
BOOL AllowMultiTask;
|
||||
DWORD VJoyStatus;
|
||||
short joyposx;
|
||||
short joyposy;
|
||||
} DXWNDSTATUS;
|
||||
|
||||
extern DXWNDSTATUS DxWndStatus;
|
||||
|
||||
int SetTarget(TARGETMAP *);
|
||||
int SetTarget(DXWNDSTATUS *, TARGETMAP *);
|
||||
int StartHook(void);
|
||||
int EndHook(void);
|
||||
void GetDllVersion(char *);
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a6e3eed0ef40c5d67c9179b539a02e0d2044ede982322f019816d85db5694161
|
||||
oid sha256:7b2007119a0075012b9c97e2f0532e9c00393cd639510b97d7984683ad53776d
|
||||
size 793088
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b65ce7c723d642c6c753ab05c5e3e8eb4d50fc80592f0e333decdf7e77c0b00e
|
||||
size 677376
|
||||
oid sha256:2708b771a49673ae154fffa2cadaaefe2eab5b1fb497f35c84f14d1a4bde1701
|
||||
size 681472
|
||||
|
36
build/exports/Xwing vs. Tie-Fighter demo.dxw
Normal file
36
build/exports/Xwing vs. Tie-Fighter demo.dxw
Normal file
@ -0,0 +1,36 @@
|
||||
[target]
|
||||
title0=Xwing vs. Tie-Fighter demo
|
||||
path0=D:\Games\XwingTie Demo\z_xvt__.exe
|
||||
startfolder0=
|
||||
launchpath0=
|
||||
module0=
|
||||
opengllib0=
|
||||
notes0=
|
||||
registry0=
|
||||
ver0=0
|
||||
monitorid0=-1
|
||||
coord0=0
|
||||
flag0=673185846
|
||||
flagg0=1207959552
|
||||
flagh0=8212
|
||||
flagi0=138412036
|
||||
flagj0=1073746048
|
||||
flagk0=134283264
|
||||
flagl0=512
|
||||
flagm0=0
|
||||
tflag0=0
|
||||
dflag0=0
|
||||
posx0=50
|
||||
posy0=50
|
||||
sizx0=800
|
||||
sizy0=600
|
||||
maxfps0=0
|
||||
initts0=0
|
||||
winver0=0
|
||||
maxres0=0
|
||||
swapeffect0=0
|
||||
maxddinterface0=7
|
||||
slowratio0=2
|
||||
scanline0=0
|
||||
initresw0=800
|
||||
initresh0=600
|
@ -1559,3 +1559,7 @@ fix: in mciSendCommand using ANSI MCI_OVLY_WINDOW_PARMS instead of WIDECHAR vers
|
||||
fix: DirectDraw:GetCaps wrapper crash when setting SUPPRESSOVERLAY and the hw or sw caps pointer is NULL
|
||||
fix: exception when trying to use ddraw SetAppCompatData and LoadLibrary failed
|
||||
fix: error messages on LoadLibrary errors
|
||||
|
||||
v2.04.16
|
||||
add: improved virtual joystick with configuration and monitoring panel, invert axis options, show crossfire.
|
||||
fix: GetAttachedSurface now simulates also the primary surface as attach to backbuffer. Fixes GTA first episode windows version.
|
||||
|
@ -724,6 +724,7 @@ void InitScreenParameters(int dxversion)
|
||||
extern void FixPixelFormat(int , DDPIXELFORMAT *);
|
||||
DEVMODE CurrDevMode;
|
||||
static int DoOnce = FALSE;
|
||||
DWORD dwVJoyStatus;
|
||||
|
||||
if(DoOnce) return;
|
||||
DoOnce = TRUE;
|
||||
@ -736,6 +737,11 @@ void InitScreenParameters(int dxversion)
|
||||
GetHookInfo()->ColorDepth=0; // unknown
|
||||
GetHookInfo()->DXVersion=0; // unknown
|
||||
GetHookInfo()->isLogging=(dxw.dwTFlags & OUTTRACE);
|
||||
|
||||
dwVJoyStatus = GetHookInfo()->VJoyStatus;
|
||||
dwVJoyStatus &= ~VJOYPRESENT;
|
||||
if(dxw.dwFlags6 & VIRTUALJOYSTICK) dwVJoyStatus |= VJOYPRESENT;
|
||||
GetHookInfo()->VJoyStatus = dwVJoyStatus;
|
||||
|
||||
if(!(*pEnumDisplaySettings)(NULL, ENUM_CURRENT_SETTINGS, &CurrDevMode)){
|
||||
OutTraceE("EnumDisplaySettings: ERROR err=%d at %d\n", GetLastError(), __LINE__);
|
||||
@ -4607,9 +4613,10 @@ HRESULT WINAPI extGetColorKey7(LPDIRECTDRAWSURFACE lpdds, DWORD flags, LPDDCOLOR
|
||||
static HRESULT WINAPI extEnumAttachedSurfaces(EnumAttachedSurfaces_Type pEnumAttachedSurfaces, LPDIRECTDRAWSURFACE lpdds, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback)
|
||||
{
|
||||
HRESULT res;
|
||||
BOOL IsPrim;
|
||||
BOOL IsPrim, IsBack;
|
||||
|
||||
IsPrim=dxwss.IsAPrimarySurface(lpdds);
|
||||
IsBack=dxwss.IsABackBufferSurface(lpdds);
|
||||
|
||||
OutTraceDDRAW("EnumAttachedSurfaces: lpdds=%x%s Context=%x Callback=%x\n",
|
||||
lpdds, (IsPrim ? "(PRIM)":""), lpContext, lpEnumSurfacesCallback);
|
||||
@ -4635,13 +4642,35 @@ static HRESULT WINAPI extEnumAttachedSurfaces(EnumAttachedSurfaces_Type pEnumAtt
|
||||
res=(lpEnumSurfacesCallback)(lpDDSBack, (LPDDSURFACEDESC)&ddsd, lpContext);
|
||||
OutTraceDW("EnumSurfacesCallback: on DDSBack res=%x(%s)\n", res, ExplainDDError(res));
|
||||
}
|
||||
res=DD_OK; // for Black Dahlia
|
||||
return DD_OK; // for Black Dahlia
|
||||
}
|
||||
else {
|
||||
|
||||
if(IsBack){
|
||||
LPDIRECTDRAWSURFACE lpDDSPrim;
|
||||
// A Primary surface has not backbuffer attached surfaces actually,
|
||||
// so don't rely on ddraw and call the callback function directly.
|
||||
// Needed to make Nox working.
|
||||
DDSURFACEDESC2 ddsd;
|
||||
// first, call hooked function
|
||||
res=(*pEnumAttachedSurfaces)(lpdds, lpContext, lpEnumSurfacesCallback);
|
||||
if (res)
|
||||
OutTraceE("EnumAttachedSurfaces: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
if(lpDDSPrim = dxwss.GetPrimarySurface()){
|
||||
ddsd.dwSize=Set_dwSize_From_Surface();
|
||||
res=lpDDSPrim->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd);
|
||||
if(res){
|
||||
OutTraceE("EnumAttachedSurfaces: GetSurfaceDesc ERROR %x(%s)\n",
|
||||
res, ExplainDDError(res));
|
||||
return res;
|
||||
}
|
||||
res=(lpEnumSurfacesCallback)(lpDDSPrim, (LPDDSURFACEDESC)&ddsd, lpContext);
|
||||
OutTraceDW("EnumSurfacesCallback: on DDSPrim res=%x(%s)\n", res, ExplainDDError(res));
|
||||
}
|
||||
return DD_OK; // for GTA (first episode, window version "gtawin.exe")
|
||||
}
|
||||
res=(*pEnumAttachedSurfaces)(lpdds, lpContext, lpEnumSurfacesCallback);
|
||||
if (res)
|
||||
OutTraceE("EnumAttachedSurfaces: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "TlHelp32.h"
|
||||
|
||||
#define VERSION "2.04.15"
|
||||
#define VERSION "2.04.16"
|
||||
|
||||
#define DDTHREADLOCK 1
|
||||
|
||||
@ -108,7 +108,7 @@ static BOOL GetMultiTaskEnabling(){
|
||||
return GetPrivateProfileInt("window", "multiprocesshook", 0, inipath);
|
||||
}
|
||||
|
||||
int SetTarget(TARGETMAP *targets){
|
||||
int SetTarget(DXWNDSTATUS *statusmap, TARGETMAP *targets){
|
||||
int i;
|
||||
char path[MAX_PATH+1];
|
||||
|
||||
@ -122,6 +122,8 @@ int SetTarget(TARGETMAP *targets){
|
||||
pStatus->Height = pStatus->Width = 0;
|
||||
pStatus->DXVersion = 0;
|
||||
pStatus->AllowMultiTask=GetMultiTaskEnabling();
|
||||
//pStatus->VJoyStatus=VJOYENABLED|CROSSENABLED|INVERTYAXIS;
|
||||
if(statusmap) pStatus->VJoyStatus=statusmap->VJoyStatus;
|
||||
for(i = 0; targets[i].path[0]; i ++){
|
||||
char *c;
|
||||
pMapping[i] = targets[i];
|
||||
|
Binary file not shown.
@ -3707,16 +3707,6 @@ static HHOOK WINAPI extSetWindowsHookEx(SetWindowsHookEx_Type pSetWindowsHookEx,
|
||||
OutTraceDW("SetWindowsHookEx: fixing WH_CBT thread=0->%x\n", dwThreadId);
|
||||
}
|
||||
|
||||
// "Starsiege" .....
|
||||
//if((idHook == WH_MOUSE_LL) && (dwThreadId == NULL)) {
|
||||
// dwThreadId = GetCurrentThreadId();
|
||||
// OutTraceDW("SetWindowsHookEx: fixing WH_MOUSE_LL thread=0->%x\n", dwThreadId);
|
||||
//}
|
||||
//if((idHook == WH_KEYBOARD_LL) && (dwThreadId == NULL)) {
|
||||
// dwThreadId = GetCurrentThreadId();
|
||||
// OutTraceDW("SetWindowsHookEx: fixing WH_KEYBOARD_LL thread=0->%x\n", dwThreadId);
|
||||
//}
|
||||
|
||||
// v2.03.54: disable the disable Alt-Tab fix
|
||||
if((dxw.dwFlags7 & DISABLEDISABLEALTTAB) && (idHook == WH_KEYBOARD_LL)) {
|
||||
OutTraceDW("SetWindowsHookEx: DISABLEDISABLEALTTAB bypass active\n");
|
||||
|
@ -549,10 +549,22 @@ static MMRESULT GetJoy(char *apiname, DWORD uJoyID, LPJOYINFO lpj)
|
||||
DWORD dwButtons;
|
||||
static BOOL bJoyLock = FALSE;
|
||||
static DWORD dwLastClick = 0;
|
||||
extern DXWNDSTATUS *pStatus;
|
||||
DWORD dwVJoyStatus;
|
||||
|
||||
dwVJoyStatus = GetHookInfo()->VJoyStatus;
|
||||
if(!(dwVJoyStatus & VJOYENABLED)) {
|
||||
lpj->wXpos = 0;
|
||||
lpj->wYpos = 0;
|
||||
lpj->wZpos = 0;
|
||||
pStatus->joyposx = (short)0;
|
||||
pStatus->joyposy = (short)0;
|
||||
return JOYERR_NOERROR;
|
||||
}
|
||||
|
||||
dwButtons = 0;
|
||||
if (GetKeyState(VK_LBUTTON) < 0) dwButtons |= JOY_BUTTON1;
|
||||
if (GetKeyState(VK_RBUTTON) < 0) dwButtons |= JOY_BUTTON2;
|
||||
if ((GetKeyState(VK_LBUTTON) < 0) || (dwVJoyStatus & B1AUTOFIRE)) dwButtons |= JOY_BUTTON1;
|
||||
if ((GetKeyState(VK_RBUTTON) < 0) || (dwVJoyStatus & B2AUTOFIRE)) dwButtons |= JOY_BUTTON2;
|
||||
if (GetKeyState(VK_MBUTTON) < 0) dwButtons |= JOY_BUTTON3;
|
||||
OutTraceB("%s: Virtual Joystick buttons=%x\n", apiname, dwButtons);
|
||||
|
||||
@ -595,19 +607,21 @@ static MMRESULT GetJoy(char *apiname, DWORD uJoyID, LPJOYINFO lpj)
|
||||
if(pt.y > client.bottom) pt.y = client.bottom;
|
||||
CenterX = (client.right - client.left) >> 1;
|
||||
CenterY = (client.bottom - client.top) >> 1;
|
||||
|
||||
x = ((pt.x - CenterX) * XSPAN) / client.right;
|
||||
if(INVERTJOYAXIS)
|
||||
y = ((CenterY - pt.y) * YSPAN) / client.bottom; // inverted y axis
|
||||
else
|
||||
y = ((pt.y - CenterY) * YSPAN) / client.bottom;
|
||||
y = ((pt.y - CenterY) * YSPAN) / client.bottom;
|
||||
if(dwVJoyStatus & INVERTXAXIS) x = -x;
|
||||
if(dwVJoyStatus & INVERTYAXIS) y = -y;
|
||||
}
|
||||
ShowJoystick(pt.x, pt.y, dwButtons);
|
||||
if (dwVJoyStatus & CROSSENABLED) ShowJoystick(pt.x, pt.y, dwButtons);
|
||||
}
|
||||
lpj->wXpos = x;
|
||||
lpj->wYpos = y;
|
||||
lpj->wZpos = 0;
|
||||
lpj->wButtons = dwButtons;
|
||||
OutTraceC("%s: joyid=%d pos=(%d,%d)\n", apiname, uJoyID, lpj->wXpos, lpj->wYpos);
|
||||
pStatus->joyposx = (short)x;
|
||||
pStatus->joyposy = (short)y;
|
||||
return JOYERR_NOERROR;
|
||||
}
|
||||
|
||||
@ -632,7 +646,7 @@ MMRESULT WINAPI extjoyGetPosEx(DWORD uJoyID, LPJOYINFOEX pji)
|
||||
MMRESULT WINAPI extjoyGetPos(DWORD uJoyID, LPJOYINFO pji)
|
||||
{
|
||||
MMRESULT res;
|
||||
res=GetJoy("joyGetPosEx", uJoyID, pji);
|
||||
res=GetJoy("joyGetPos", uJoyID, pji);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -652,6 +666,8 @@ static void ShowJoystick(LONG x, LONG y, DWORD dwButtons)
|
||||
RECT win;
|
||||
POINT PrevViewPort;
|
||||
|
||||
//return;
|
||||
|
||||
// don't show when system cursor is visible
|
||||
CURSORINFO ci;
|
||||
ci.cbSize = sizeof(CURSORINFO);
|
||||
|
@ -376,7 +376,7 @@ void CTargetDlg::OnBnClickedTry()
|
||||
memset(&RestrictedMaps[1], 0, sizeof(TARGETMAP));
|
||||
strcpy_s(path, sizeof(path), m_FilePath.GetBuffer());
|
||||
PathRemoveFileSpec(path);
|
||||
SetTarget(RestrictedMaps);
|
||||
SetTarget(NULL, RestrictedMaps);
|
||||
iHookStatus=GetHookStatus(NULL);
|
||||
if(iHookStatus == DXW_IDLE) StartHook();
|
||||
switch(m_InjectionMode){
|
||||
|
145
host/VJoyDialog.cpp
Normal file
145
host/VJoyDialog.cpp
Normal file
@ -0,0 +1,145 @@
|
||||
// VJoyDialog.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "dxwndhost.h"
|
||||
#include "VJoyDialog.h"
|
||||
|
||||
#define XSPAN 128
|
||||
#define YSPAN 128
|
||||
#define PICWIDTH 140
|
||||
#define PICHEIGHT 140
|
||||
|
||||
// CVJoyDialog dialog
|
||||
|
||||
IMPLEMENT_DYNAMIC(CVJoyDialog, CDialog)
|
||||
|
||||
CVJoyDialog::CVJoyDialog(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CVJoyDialog::IDD, pParent)
|
||||
{
|
||||
//MessageBoxEx(0, "VJoy constructor", "Warning", MB_OK | MB_ICONEXCLAMATION, NULL);
|
||||
}
|
||||
|
||||
CVJoyDialog::~CVJoyDialog()
|
||||
{
|
||||
//MessageBoxEx(0, "VJoy destructor", "Warning", MB_OK | MB_ICONEXCLAMATION, NULL);
|
||||
//CVJoyDialog::OnOK(); // kill timer....
|
||||
}
|
||||
|
||||
void CVJoyDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CTargetDlg)
|
||||
DDX_Check(pDX, IDC_VJOYENABLED, this->m_VJoyEnabled);
|
||||
DDX_Check(pDX, IDC_CROSSENABLED, this->m_CrossEnabled);
|
||||
DDX_Check(pDX, IDC_INVERTXAXIS, this->m_InvertXAxis);
|
||||
DDX_Check(pDX, IDC_INVERTYAXIS, this->m_InvertYAxis);
|
||||
DDX_Check(pDX, IDC_B1AUTOFIRE, this->m_B1AutoFire);
|
||||
DDX_Check(pDX, IDC_B2AUTOFIRE, this->m_B2AutoFire);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CVJoyDialog, CDialog)
|
||||
ON_WM_TIMER()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
#define IDVJoyTIMER 3
|
||||
#define FINDERSIZE 5
|
||||
#define CROSSSIZE 20
|
||||
|
||||
// CVJoyDialog message handlers
|
||||
|
||||
void CVJoyDialog::OnTimer(UINT_PTR nIDEvent)
|
||||
{
|
||||
// IDC_VJOYPOSITION
|
||||
int x, y;
|
||||
DWORD dwVJoyStatus;
|
||||
CDialog::UpdateData(); // calls DoDataExchange
|
||||
dwVJoyStatus = GetHookInfo()->VJoyStatus;
|
||||
this->m_VJoyPresent = (dwVJoyStatus & VJOYPRESENT) ? 1 : 0;
|
||||
dwVJoyStatus &= VJOYPRESENT; // clear all BUT VJOYPRESENT!
|
||||
if(this->m_VJoyEnabled) dwVJoyStatus |= VJOYENABLED;
|
||||
if(this->m_CrossEnabled) dwVJoyStatus |= CROSSENABLED;
|
||||
if(this->m_InvertYAxis) dwVJoyStatus |= INVERTYAXIS;
|
||||
if(this->m_InvertXAxis) dwVJoyStatus |= INVERTXAXIS;
|
||||
if(this->m_B1AutoFire) dwVJoyStatus |= B1AUTOFIRE;
|
||||
if(this->m_B2AutoFire) dwVJoyStatus |= B2AUTOFIRE;
|
||||
if(this->m_VJoyEnabled && this->m_VJoyPresent){
|
||||
CWnd *JoyPos = this->GetDlgItem(IDC_VJOYPOSITION);
|
||||
CDC *dc = JoyPos->GetDC();
|
||||
RECT client;
|
||||
CString coord;
|
||||
JoyPos->GetClientRect(&client);
|
||||
x = (client.right/2) + ((GetHookInfo()->joyposx * client.right) / XSPAN);
|
||||
y = (client.bottom/2) + ((GetHookInfo()->joyposy * client.bottom) / YSPAN);
|
||||
dc->FillRect(&client, Background);
|
||||
dc->SelectObject(CenterPen);
|
||||
dc->MoveTo((client.right/2)-CROSSSIZE,(client.bottom/2));
|
||||
dc->LineTo((client.right/2)+CROSSSIZE,(client.bottom/2));
|
||||
dc->MoveTo((client.right/2),(client.bottom/2)-CROSSSIZE);
|
||||
dc->LineTo((client.right/2),(client.bottom/2)+CROSSSIZE);
|
||||
dc->SelectObject(FinderPen);
|
||||
int x0, y0;
|
||||
x0 = (x-FINDERSIZE)<client.left ? client.left : x-FINDERSIZE;
|
||||
dc->MoveTo(x0,y);
|
||||
x0 = (x+FINDERSIZE)>client.right ? client.right : x+FINDERSIZE;
|
||||
dc->LineTo(x0,y);
|
||||
y0 = (y-FINDERSIZE)<client.top ? client.top : y-FINDERSIZE;
|
||||
dc->MoveTo(x,y0);
|
||||
y0 = (y+FINDERSIZE)>client.bottom ? client.bottom : y+FINDERSIZE;
|
||||
dc->LineTo(x,y0);
|
||||
dc->MoveTo(20,20);
|
||||
coord.Format("%d,%d", GetHookInfo()->joyposx, GetHookInfo()->joyposy);
|
||||
dc->TextOutA(5, 5, coord);
|
||||
dc->DeleteDC();
|
||||
}
|
||||
GetHookInfo()->VJoyStatus = dwVJoyStatus;
|
||||
}
|
||||
|
||||
BOOL CVJoyDialog::OnInitDialog()
|
||||
{
|
||||
DWORD dwVJoyStatus;
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
Background = new(CBrush);
|
||||
Background->CreateSolidBrush(RGB(255, 255, 255)); // white
|
||||
CenterPen = new(CPen);
|
||||
CenterPen->CreatePen(PS_DOT, 1, RGB(255, 0, 0));
|
||||
FinderPen = new(CPen);
|
||||
FinderPen->CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
|
||||
dwVJoyStatus = GetHookInfo()->VJoyStatus;
|
||||
this->m_VJoyPresent = (dwVJoyStatus & VJOYPRESENT) ? 1 : 0;
|
||||
this->m_VJoyEnabled = (dwVJoyStatus & VJOYENABLED) ? 1 : 0;
|
||||
this->m_CrossEnabled= (dwVJoyStatus & CROSSENABLED) ? 1 : 0;
|
||||
this->m_InvertYAxis = (dwVJoyStatus & INVERTYAXIS) ? 1 : 0;
|
||||
this->m_InvertXAxis = (dwVJoyStatus & INVERTXAXIS) ? 1 : 0;
|
||||
this->m_B1AutoFire = (dwVJoyStatus & B1AUTOFIRE) ? 1 : 0;
|
||||
this->m_B2AutoFire = (dwVJoyStatus & B2AUTOFIRE) ? 1 : 0;
|
||||
CDialog::OnInitDialog();
|
||||
SetTimer(IDVJoyTIMER, 40, NULL);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
}
|
||||
|
||||
void CVJoyDialog::OnOK()
|
||||
{
|
||||
char val[80];
|
||||
DWORD dwVJoyStatus;
|
||||
// stop timer
|
||||
KillTimer(IDVJoyTIMER);
|
||||
// update joystick flags
|
||||
CDialog::UpdateData(); // calls DoDataExchange
|
||||
dwVJoyStatus = GetHookInfo()->VJoyStatus;
|
||||
dwVJoyStatus &= VJOYPRESENT; // clear all BUT VJOYPRESENT!
|
||||
if(this->m_VJoyEnabled) dwVJoyStatus |= VJOYENABLED;
|
||||
if(this->m_CrossEnabled) dwVJoyStatus |= CROSSENABLED;
|
||||
if(this->m_InvertYAxis) dwVJoyStatus |= INVERTYAXIS;
|
||||
if(this->m_InvertXAxis) dwVJoyStatus |= INVERTXAXIS;
|
||||
if(this->m_B1AutoFire) dwVJoyStatus |= B1AUTOFIRE;
|
||||
if(this->m_B2AutoFire) dwVJoyStatus |= B2AUTOFIRE;
|
||||
sprintf_s(val, sizeof(val), "%i", dwVJoyStatus);
|
||||
WritePrivateProfileString("joystick", "flags", val, gInitPath);
|
||||
GetHookInfo()->VJoyStatus = dwVJoyStatus;
|
||||
CDialog::OnOK();
|
||||
}
|
40
host/VJoyDialog.h
Normal file
40
host/VJoyDialog.h
Normal file
@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
// CTimeSlider dialog
|
||||
|
||||
class CVJoyDialog : public CDialog
|
||||
{
|
||||
DECLARE_DYNAMIC(CVJoyDialog)
|
||||
|
||||
public:
|
||||
CVJoyDialog(CWnd* pParent = NULL); // standard constructor
|
||||
virtual ~CVJoyDialog();
|
||||
//~VJoyDialog();
|
||||
|
||||
// Dialog Data
|
||||
enum { IDD = IDD_VJOYDIALOG };
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
public:
|
||||
virtual BOOL OnInitDialog();
|
||||
protected:
|
||||
virtual void OnOK();
|
||||
//virtual void OnCancel();
|
||||
private:
|
||||
BOOL m_VJoyPresent;
|
||||
BOOL m_VJoyEnabled;
|
||||
BOOL m_CrossEnabled;
|
||||
BOOL m_InvertYAxis;
|
||||
BOOL m_InvertXAxis;
|
||||
BOOL m_B1AutoFire;
|
||||
BOOL m_B2AutoFire;
|
||||
CBrush *Background;
|
||||
CPen *CenterPen;
|
||||
CPen *FinderPen;
|
||||
};
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -511,6 +511,10 @@
|
||||
RelativePath=".\ViewFlagsDialog.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\VJoyDialog.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
@ -648,6 +652,10 @@
|
||||
RelativePath=".\ViewFlagsDialog.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\VJoyDialog.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
@ -750,22 +758,22 @@
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\alt-ctrl-shift.png"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\res\alt-ctrl-shift.png"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\res\alt.png"
|
||||
RelativePath=".\alt-ctrl-shift.png"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\alt.png"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\res\alt.png"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\resource"
|
||||
>
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "DesktopDialog.h"
|
||||
#include "PaletteDialog.h"
|
||||
#include "TimeSliderDialog.h"
|
||||
#include "VJoyDialog.h"
|
||||
#include "ShimsDialog.h"
|
||||
#include "ViewFlagsDialog.h"
|
||||
#include "CGlobalSettings.h"
|
||||
@ -145,6 +146,7 @@ BEGIN_MESSAGE_MAP(CDxwndhostView, CListView)
|
||||
ON_COMMAND(ID_VIEW_DESKTOP, OnViewDesktop)
|
||||
ON_COMMAND(ID_VIEW_PALETTE, OnViewPalette)
|
||||
ON_COMMAND(ID_VIEW_TIMESLIDER, OnViewTimeSlider)
|
||||
ON_COMMAND(ID_VIEW_VIRTUALJOYSTICK, OnViewVirtualJoystick)
|
||||
ON_COMMAND(ID_DESKTOPCOLORDEPTH_8BPP, OnDesktopcolordepth8bpp)
|
||||
ON_COMMAND(ID_DESKTOPCOLORDEPTH_16BPP, OnDesktopcolordepth16bpp)
|
||||
ON_COMMAND(ID_DESKTOPCOLORDEPTH_24BPP, OnDesktopcolordepth24bpp)
|
||||
@ -1354,6 +1356,7 @@ void CDxwndhostView::OnInitialUpdate()
|
||||
LV_COLUMN listcol;
|
||||
LV_ITEM listitem;
|
||||
int i;
|
||||
DXWNDSTATUS StatusMap;
|
||||
typedef BOOL (WINAPI *ChangeWindowMessageFilter_Type)(UINT, DWORD);
|
||||
ChangeWindowMessageFilter_Type pChangeWindowMessageFilter;
|
||||
|
||||
@ -1398,6 +1401,8 @@ void CDxwndhostView::OnInitialUpdate()
|
||||
strcat_s(gInitPath, sizeof(gInitPath), m_ConfigFileName);
|
||||
listctrl.InsertColumn(0, &listcol);
|
||||
|
||||
StatusMap.VJoyStatus = GetPrivateProfileInt("joystick", "flags", VJOYENABLED|CROSSENABLED|INVERTYAXIS, gInitPath);
|
||||
|
||||
for(i = 0; i < MAXTARGETS; i ++){
|
||||
if (!LoadConfigItem(&TargetMaps[i], &PrivateMaps[i], i, gInitPath)) break;
|
||||
listitem.mask = LVIF_TEXT | LVIF_IMAGE;
|
||||
@ -1412,7 +1417,7 @@ void CDxwndhostView::OnInitialUpdate()
|
||||
PrivateMaps[i].title[0] = 0;
|
||||
}
|
||||
Resize();
|
||||
SetTarget(TargetMaps);
|
||||
SetTarget(&StatusMap, TargetMaps);
|
||||
if(m_InitialState == DXW_ACTIVE)
|
||||
this->OnHookStart();
|
||||
else
|
||||
@ -1522,7 +1527,7 @@ BOOL CDxwndhostView::OnImport(CString sFilePath)
|
||||
listctrl.InsertItem(&listitem);
|
||||
}
|
||||
Resize();
|
||||
SetTarget(TargetMaps);
|
||||
SetTarget(NULL, TargetMaps);
|
||||
this->isUpdated=TRUE;
|
||||
this->isRegistryUpdated=TRUE;
|
||||
return TRUE;
|
||||
@ -1602,7 +1607,7 @@ void CDxwndhostView::OnImport()
|
||||
}
|
||||
}
|
||||
Resize();
|
||||
SetTarget(TargetMaps);
|
||||
SetTarget(NULL, TargetMaps);
|
||||
this->isUpdated=TRUE;
|
||||
this->isRegistryUpdated=TRUE;
|
||||
}
|
||||
@ -1643,7 +1648,7 @@ void CDxwndhostView::OnModify()
|
||||
listitem.pszText = PrivateMaps[i].title;
|
||||
listctrl.SetItem(&listitem);
|
||||
Resize();
|
||||
SetTarget(TargetMaps);
|
||||
SetTarget(NULL, TargetMaps);
|
||||
this->isUpdated=TRUE;
|
||||
}
|
||||
}
|
||||
@ -1875,7 +1880,7 @@ void CDxwndhostView::OnSort()
|
||||
TargetMaps[i].index = i; // renumber
|
||||
}
|
||||
|
||||
SetTarget(TargetMaps);
|
||||
SetTarget(NULL, TargetMaps);
|
||||
this->isUpdated=TRUE;
|
||||
this->isRegistryUpdated=TRUE;
|
||||
}
|
||||
@ -2130,7 +2135,7 @@ void CDxwndhostView::OnAdd(char *sInitialPath)
|
||||
listitem.pszText = PrivateMaps[i].title;
|
||||
listctrl.InsertItem(&listitem);
|
||||
Resize();
|
||||
SetTarget(TargetMaps);
|
||||
SetTarget(NULL, TargetMaps);
|
||||
this->isUpdated=TRUE;
|
||||
this->isRegistryUpdated=TRUE;
|
||||
}
|
||||
@ -2165,7 +2170,7 @@ void CDxwndhostView::OnDuplicate()
|
||||
listctrl.InsertItem(&listitem);
|
||||
TargetMaps[i].index = i;
|
||||
}
|
||||
SetTarget(TargetMaps);
|
||||
SetTarget(NULL, TargetMaps);
|
||||
this->isUpdated=TRUE;
|
||||
this->isRegistryUpdated=TRUE;
|
||||
}
|
||||
@ -2202,7 +2207,7 @@ void CDxwndhostView::OnMoveTop()
|
||||
listctrl.SetItem(&listitem);
|
||||
listctrl.InsertItem(&listitem);
|
||||
}
|
||||
SetTarget(TargetMaps);
|
||||
SetTarget(NULL, TargetMaps);
|
||||
this->isUpdated=TRUE;
|
||||
this->isRegistryUpdated=TRUE;
|
||||
}
|
||||
@ -2237,7 +2242,7 @@ void CDxwndhostView::OnMoveUp()
|
||||
listctrl.SetItem(&listitem);
|
||||
listctrl.InsertItem(&listitem);
|
||||
}
|
||||
SetTarget(TargetMaps);
|
||||
SetTarget(NULL, TargetMaps);
|
||||
this->isUpdated=TRUE;
|
||||
this->isRegistryUpdated=TRUE;
|
||||
}
|
||||
@ -2272,7 +2277,7 @@ void CDxwndhostView::OnMoveDown()
|
||||
listctrl.SetItem(&listitem);
|
||||
listctrl.InsertItem(&listitem);
|
||||
}
|
||||
SetTarget(TargetMaps);
|
||||
SetTarget(NULL, TargetMaps);
|
||||
this->isUpdated=TRUE;
|
||||
this->isRegistryUpdated=TRUE;
|
||||
}
|
||||
@ -2310,7 +2315,7 @@ void CDxwndhostView::OnMoveBottom()
|
||||
listctrl.SetItem(&listitem);
|
||||
listctrl.InsertItem(&listitem);
|
||||
}
|
||||
SetTarget(TargetMaps);
|
||||
SetTarget(NULL, TargetMaps);
|
||||
this->isUpdated=TRUE;
|
||||
this->isRegistryUpdated=TRUE;
|
||||
}
|
||||
@ -2346,7 +2351,7 @@ void CDxwndhostView::OnDelete()
|
||||
}
|
||||
TargetMaps[i].path[0]=0; // clear last one, in case there were MAXTARGETS entries
|
||||
Resize();
|
||||
SetTarget(TargetMaps);
|
||||
SetTarget(NULL, TargetMaps);
|
||||
this->isUpdated=TRUE;
|
||||
this->isRegistryUpdated=TRUE;
|
||||
}
|
||||
@ -2616,6 +2621,13 @@ void CDxwndhostView::OnViewTimeSlider()
|
||||
pDlg->ShowWindow(SW_SHOW);
|
||||
}
|
||||
|
||||
void CDxwndhostView::OnViewVirtualJoystick()
|
||||
{
|
||||
CVJoyDialog *pDlg = new CVJoyDialog();
|
||||
BOOL ret = pDlg->Create(CVJoyDialog::IDD, this);
|
||||
pDlg->ShowWindow(SW_SHOW);
|
||||
}
|
||||
|
||||
void CDxwndhostView::Resize()
|
||||
{
|
||||
CListCtrl& listctrl = GetListCtrl();
|
||||
@ -3208,7 +3220,7 @@ void InjectSuspended(char *exepath, char *dirpath)
|
||||
DWORD RecoverTargetMaps(LPVOID TargetMaps)
|
||||
{
|
||||
Sleep(5000);
|
||||
SetTarget((TARGETMAP *)TargetMaps);
|
||||
SetTarget(NULL, (TARGETMAP *)TargetMaps);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3388,7 +3400,7 @@ void CDxwndhostView::OnRun(BOOL bForceNoHook)
|
||||
strncpy(RestrictedMaps[0].path, exepath, MAX_PATH);
|
||||
}
|
||||
if(bForceNoHook) RestrictedMaps[0].flags3 &= ~HOOKENABLED;
|
||||
SetTarget(RestrictedMaps);
|
||||
SetTarget(NULL, RestrictedMaps);
|
||||
OutTrace("OnRun idx=%d prog=\"%s\" unhooked=%x\n", i, TargetMaps[i].path, bForceNoHook);
|
||||
|
||||
if(TargetMaps[i].flags7 & HOOKNORUN){
|
||||
|
@ -106,6 +106,7 @@ protected:
|
||||
afx_msg void OnViewDesktop();
|
||||
afx_msg void OnViewPalette();
|
||||
afx_msg void OnViewTimeSlider();
|
||||
afx_msg void OnViewVirtualJoystick();
|
||||
afx_msg void OnExit();
|
||||
afx_msg void OnDesktopcolordepth8bpp();
|
||||
afx_msg void OnDesktopcolordepth16bpp();
|
||||
|
BIN
host/resource
BIN
host/resource
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user