diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b634715d..4ef2651d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,8 +37,6 @@ add_custom_target(misc-batch add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/projects/libtom") -#add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/projects/vsbc") - # Split the files into group for which project is likely # going to be used for both header and source files. # Then move only specific project files into their diff --git a/projects/vsbc/CMakeLists.txt b/projects/vsbc/CMakeLists.txt deleted file mode 100644 index 31794561c..000000000 --- a/projects/vsbc/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -cmake_minimum_required (VERSION 3.8) -project(vsbc) - -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_STANDARD 17) - -# Suppress extra stuff from generated solution -set(CMAKE_SUPPRESS_REGENERATION true) - -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - add_compile_definitions(_CRT_SECURE_NO_WARNINGS - ) -endif() - -add_compile_definitions(CXBXVSBC_EXPORTS -) - -file (GLOB HEADERS - "${CXBXR_ROOT_DIR}/src/vsbc/CxbxVSBC.h" - "${CXBXR_ROOT_DIR}/src/vsbc/DlgVirtualSBCFeedback.h" - "${CXBXR_ROOT_DIR}/src/vsbc/stdafx.h" - "${CXBXR_ROOT_DIR}/src/vsbc/targetver.h" -) - -file (GLOB SOURCES - "${CXBXR_ROOT_DIR}/src/vsbc/CxbxVSBC.cpp" - "${CXBXR_ROOT_DIR}/src/vsbc/DlgVirtualSBCFeedback.cpp" - "${CXBXR_ROOT_DIR}/src/vsbc/dllmain.cpp" - "${CXBXR_ROOT_DIR}/src/vsbc/stdafx.cpp" -) - -source_group(TREE ${CXBXR_ROOT_DIR}/src/vsbc PREFIX header FILES ${HEADERS}) - -source_group(TREE ${CXBXR_ROOT_DIR}/src/vsbc PREFIX source FILES ${SOURCES}) - -add_library(vsbc SHARED ${HEADERS} ${SOURCES}) - -set_target_properties(vsbc PROPERTIES - OUTPUT_NAME CxbxVSBC -) diff --git a/src/core/hle/XAPI/Xapi.cpp b/src/core/hle/XAPI/Xapi.cpp index 3486989c6..6fc653452 100644 --- a/src/core/hle/XAPI/Xapi.cpp +++ b/src/core/hle/XAPI/Xapi.cpp @@ -40,7 +40,6 @@ #include "core\kernel\support\EmuFile.h" #include "EmuShared.h" #include "core\hle\Intercept.hpp" -#include "vsbc\CxbxVSBC.h" #include "Windef.h" #include #include "core\hle\XAPI\Xapi.h" diff --git a/src/vsbc/CxbxVSBC.cpp b/src/vsbc/CxbxVSBC.cpp deleted file mode 100644 index 86ff30a14..000000000 --- a/src/vsbc/CxbxVSBC.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// CxbxVSBC.cpp : Defines the exported functions for the DLL application. -// - -#include "stdafx.h" - - -// MathFuncsDll.cpp : Defines the exported functions for the DLL application. -// - -#include "CxbxVSBC.h" -#include -#include "DlgVirtualSBCFeedback.h" - - -using namespace std; - -namespace CxbxVSBC -{ - - // Get input state - extern "C" __declspec(dllexport) int __stdcall WINAPI MyCxbxVSBC::VSBCGetState(UCHAR * pSBCGamepad) - { - return 0; - } - - // Set feedback state - extern "C" __declspec(dllexport) int __stdcall WINAPI MyCxbxVSBC::VSBCSetState(UCHAR * pSBCFeedback) - { - DlgVSBCFeedback::UpdateVirtualSBCFeedbackDlg(pSBCFeedback); - return 0; - } - - // open SBC, initialize virtual controller and dialog - extern "C" __declspec(dllexport) int __stdcall WINAPI MyCxbxVSBC::VSBCOpen(DWORD dwVSBCType) - { - if (dwVSBCType == X_XONTROLLER_HOST_BRIDGE_HOSTTYPE_VIRTUAL_SBC) { - //DlgVSBCFeedback::ShowVirtualSBCFeedback(NULL); - return 0; - } - else { - return -1; - } - - } - - - // Show the VSBC dialog - extern "C" __declspec(dllexport) int __stdcall WINAPI MyCxbxVSBC::VSBCShow(void) - { - return 0; - } - // Hide the VSBC dialog - extern "C" __declspec(dllexport) int __stdcall WINAPI MyCxbxVSBC::VSBCHide(void) - { - return 0; - } - - -} diff --git a/src/vsbc/CxbxVSBC.h b/src/vsbc/CxbxVSBC.h deleted file mode 100644 index 7def7099d..000000000 --- a/src/vsbc/CxbxVSBC.h +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#ifdef CXBXVSBC_EXPORTS -#define CXBXVSBC_API __declspec(dllexport) -#else -#define CXBXVSBC_API __declspec(dllimport) -#endif - -#ifndef X_XONTROLLER_HOST_BRIDGE_HOSTTYPE_VIRTUAL_SBC -#define X_XONTROLLER_HOST_BRIDGE_HOSTTYPE_VIRTUAL_SBC 0x80 -#endif -/* -extern "C" static CXBXVSBC_API DWORD VSBCGetState(UCHAR * pSBCGamepad); -extern "C" static CXBXVSBC_API DWORD VSBCSetState(UCHAR * pSBCFeedback); -extern "C" static CXBXVSBC_API DWORD VSBCOpen(DWORD dwVSBCType); -extern "C" static CXBXVSBC_API DWORD VSBCShow(void); -extern "C" static CXBXVSBC_API DWORD VSBCHide(void); -*/ -namespace CxbxVSBC -{ - // - class MyCxbxVSBC - { - public: - // Get input state - static __declspec(dllexport) int __stdcall WINAPI VSBCGetState(UCHAR * pSBCGamepad); - - // Set feedback state - static __declspec(dllexport) int __stdcall WINAPI VSBCSetState(UCHAR * pSBCFeedback); - - // open SBC, initialize virtual controller and dialog - - static __declspec(dllexport) int __stdcall WINAPI VSBCOpen(DWORD dwVSBCType); - - // open SBC, initialize virtual controller and dialog - // static CXBXVSBC_API DWORD VSBCOpen(DWORD dwVSBCType); - - // Show the VSBC dialog - static __declspec(dllexport) int __stdcall WINAPI VSBCShow(void); - - // Hide the VSBC dialog - static __declspec(dllexport) int __stdcall WINAPI VSBCHide(void); - - private: - HMODULE hCurrentModule = 0; - int dwVSBCOpened = 0; - int dwVSBCOpenType = 0; - }; -} diff --git a/src/vsbc/DlgVirtualSBCFeedback.cpp b/src/vsbc/DlgVirtualSBCFeedback.cpp deleted file mode 100644 index 15a1b746e..000000000 --- a/src/vsbc/DlgVirtualSBCFeedback.cpp +++ /dev/null @@ -1,220 +0,0 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check it. -// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com -// ****************************************************************** -// * -// * This file is part of the Cxbx project. -// * -// * Cxbx and Cxbe are free software; you can redistribute them -// * and/or modify them under the terms of the GNU General Public -// * License as published by the Free Software Foundation; either -// * version 2 of the license, or (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have recieved a copy of the GNU General Public License -// * along with this program; see the file COPYING. -// * If not, write to the Free Software Foundation, Inc., -// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. -// * -// * (c) 2002-2003 Aaron Robinson -// * -// * All rights reserved -// * -// ****************************************************************** -#include "stdafx.h" - -#include "DlgVirtualSBCFeedback.h" -#include "Winuser.h" -#include "Windowsx.h" -#include "Commctrl.h" -#include "../gui/resource/ResCxbx.h" - -#include - -#define X_SBC_FEEDBACK_MAX 38 - -namespace DlgVSBCFeedback -{ - /*! windows dialog procedure */ - static LRESULT CALLBACK DlgVirtualSBCFeedbackProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - - /*! changes flag */ - static BOOL g_bHasChanges = FALSE; - //handle for this dialog, one one dialog is available for visturl SteelBatallion controller. - static HWND g_hDlgVirtualSBCFeedback = 0; - - HWND GetDlgVirtualSBCFeedbackHandle(void) - { - return g_hDlgVirtualSBCFeedback; - } - - int DlgItemIDArray[] = { - IDC_PB_EJECT, - IDC_PB_COCKPIT_HATCH, - IDC_PB_IGNITION, - IDC_PB_START, - IDC_PB_OPEN_CLOSE, - IDC_PB_MAP_ZOOM_IN_OUT, - IDC_PB_MODE_SELECT, - IDC_PB_SUB_MONITOR_MODE_SELECT, - IDC_PB_ZOOM_IN, - IDC_PB_ZOOM_OUT, - IDC_PB_FSS, - IDC_PB_MANIPULATOR, - IDC_PB_LINE_COLOR_CHANGE, - IDC_PB_WASHING, - IDC_PB_EXTINGUISHER, - IDC_PB_CHAFF, - IDC_PB_TANK_DETACH, - IDC_PB_OVERRIDE, - IDC_PB_NIGHT_SCOPE, - IDC_PB_FUNC1, - IDC_PB_FUNC2, - IDC_PB_FUNC3, - IDC_PB_MAIN_WEAPON_CONTROL, - IDC_PB_SUB_WEAPON_CONTROL, - IDC_PB_MAGAZINE_CHANGE, - IDC_PB_COM1, - IDC_PB_COM2, - IDC_PB_COM3, - IDC_PB_COM4, - IDC_PB_COM5, - 0, - IDC_PB_GEARLEVER_R, - IDC_PB_GEARLEVER_N, - IDC_PB_GEARLEVER_1, - IDC_PB_GEARLEVER_2, - IDC_PB_GEARLEVER_3, - IDC_PB_GEARLEVER_4, - IDC_PB_GEARLEVER_5 - }; - - void UpdateVirtualSBCFeedbackDlg(UCHAR * pXboxSBCFeedback) { - DWORD NibbleIndex = 0, ByteIndex = 0, FeedbackStatus = 0; - for (NibbleIndex = 0; NibbleIndex < X_SBC_FEEDBACK_MAX; NibbleIndex++) { - ByteIndex = NibbleIndex >> 1; - //UCHAR temp=xbox::XboxSBCFeedbackNames[ByteIndex]; - UCHAR temp = pXboxSBCFeedback[ByteIndex]; - if (NibbleIndex % 2 > 0) { - FeedbackStatus = (temp & 0xF0) >> 4; - } - else - { - FeedbackStatus = (temp & 0x0F); - } - - if (DlgItemIDArray[NibbleIndex] == 0) { - continue; - } - //set progress bar current position 0 - SendDlgItemMessage( - g_hDlgVirtualSBCFeedback, //handle of this dialog - DlgItemIDArray[NibbleIndex], //Progress Bar ID - PBM_SETPOS, //Set current position, redraw. - FeedbackStatus, //position. it out of range, set to closest boundary. - 0 //not used, always 0 - ); - }; - } - - int ShowVirtualSBCFeedback(HWND hwnd) - { - - if (g_hDlgVirtualSBCFeedback != 0) { - printf("ShowVirtualSBCFeedback: Dialog already created! only one dialog allowed!\n"); - return -2; - } - /*! reset changes flag */ - g_bHasChanges = FALSE; - INT_PTR nResult = 1; - - if (!IsWindow(g_hDlgVirtualSBCFeedback)) - { - - //g_hDlgVirtualSBCFeedback = - nResult = DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_VIRTUAL_SBC_FEEDBACK), hwnd, (DLGPROC)DlgVirtualSBCFeedbackProc); - } - if (nResult == 0) { - printf("ShowVirtualSBCFeedback: DialogBox: failed! invalid hParent windowd handle!\n"); - return 0; - } - else - if (nResult == -1) { - printf("ShowVirtualSBCFeedback: DialogBox: failed! try GetLastError!\n"); - return -1; - } - return 1; - } - - LRESULT CALLBACK DlgVirtualSBCFeedbackProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) - { - switch (uMsg) - { - case WM_INITDIALOG: - { - //reserve dialog handle, only one dialog can be created at a time. - g_hDlgVirtualSBCFeedback = hWndDlg; - - /*! set window icon */ - SetClassLong(hWndDlg, GCL_HICON, (LONG)LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_CXBX))); - DWORD NibbleIndex = 0, ByteIndex = 0, FeedbackStatus = 0; - for (NibbleIndex = 0; NibbleIndex < X_SBC_FEEDBACK_MAX; NibbleIndex++) { - ByteIndex = NibbleIndex >> 1; - if (DlgItemIDArray[NibbleIndex] == 0) { - continue; - } - //set progress bar range 0~15 - SendDlgItemMessage( - hWndDlg, //handle of this dialog - DlgItemIDArray[NibbleIndex], //Progress Bar ID - PBM_SETRANGE32, //Set current position,with 32bit value; - 0, //Minimum range value.By default, the minimum value is zero. - 15 //Maximum range value.This value must be greater than wParam.By default, the maximum value is 100. - ); - //set progress bar current position 0 - SendDlgItemMessage( - hWndDlg, //handle of this dialog - DlgItemIDArray[NibbleIndex], //Progress Bar ID - PBM_SETPOS, //Set current position, redraw. - 0, //position. it out of range, set to closest boundary. - 0 //not used, always 0 - ); - } - break; - } - - case WM_DESTROY: - case WM_CLOSE: - { - //only need to destroy dialog itself when it's a modeless dialog. - //DestroyWindow(hWndDlg); - - //reset the dialog handle, redundant. - //g_hDlgVirtualSBCFeedback = 0; - break; - } - //return true; - - case WM_COMMAND: - { - HWND hWndButton = GetDlgItem(hWndDlg, LOWORD(wParam)); - -// switch (LOWORD(wParam)) - { - //case IDC_HOST_CANCEL: - // //EndDialog(hWndDlg, wParam); - //break; -// default: - return FALSE; - } - - //return true; - break; - } - } - return FALSE; - } -} diff --git a/src/vsbc/DlgVirtualSBCFeedback.h b/src/vsbc/DlgVirtualSBCFeedback.h deleted file mode 100644 index a61396169..000000000 --- a/src/vsbc/DlgVirtualSBCFeedback.h +++ /dev/null @@ -1,36 +0,0 @@ -// ****************************************************************** -// * -// * This file is part of the Cxbx project. -// * -// * Cxbx and Cxbe are free software; you can redistribute them -// * and/or modify them under the terms of the GNU General Public -// * License as published by the Free Software Foundation; either -// * version 2 of the license, or (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have recieved a copy of the GNU General Public License -// * along with this program; see the file COPYING. -// * If not, write to the Free Software Foundation, Inc., -// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. -// * -// * (c) 2002-2003 Aaron Robinson -// * -// * All rights reserved -// * -// ****************************************************************** -#ifndef DLGVIRTUALSBCFEEDBAC_H -#define DLGVIRTUALSBCFEEDBAC_H - -#include -namespace DlgVSBCFeedback -{ -/*! show controller configuration dialog */ -extern int ShowVirtualSBCFeedback(HWND hwnd); -extern void UpdateVirtualSBCFeedbackDlg(UCHAR * pXboxSBCFeedback); -extern HWND GetDlgVirtualSBCFeedbackHandle(void); -} -#endif diff --git a/src/vsbc/dllmain.cpp b/src/vsbc/dllmain.cpp deleted file mode 100644 index 7e23d4697..000000000 --- a/src/vsbc/dllmain.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// dllmain.cpp : Defines the entry point for the DLL application. -#include "stdafx.h" -#include "DlgVirtualSBCFeedback.h" - -#define MYMENU_EXIT (WM_APP + 101) -//#define MYMENU_MESSAGEBOX (WM_APP + 102) - -HINSTANCE inj_hModule; //Injected Modules Handle -HWND prnt_hWnd; //Parent Window Handle - - //WndProc for the new window -LRESULT CALLBACK DLLWindowProc(HWND, UINT, WPARAM, LPARAM); - -//Register our windows Class -BOOL RegisterDLLWindowClass()//wchar_t szClassName[]) -{ - WNDCLASSEX wc; - wc.hInstance = inj_hModule; - wc.lpszClassName = (LPCSTR)"CxbxVSBCClass"; - //wc.lpszClassName = (LPCWSTR)szClassName; - wc.lpfnWndProc = DLLWindowProc; - wc.style = CS_DBLCLKS; - wc.cbSize = sizeof(WNDCLASSEX); - wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); - wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.lpszMenuName = NULL; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hbrBackground = (HBRUSH)COLOR_BACKGROUND; - if (!RegisterClassEx(&wc)) - return 0; -} -//Creating our windows Menu -HMENU CreateDLLWindowMenu() -{ - HMENU hMenu; - hMenu = CreateMenu(); - HMENU hMenuPopup; - if (hMenu == NULL) - return FALSE; - hMenuPopup = CreatePopupMenu(); - AppendMenu(hMenuPopup, MF_STRING, MYMENU_EXIT, TEXT("Exit")); - AppendMenu(hMenu, MF_POPUP, (UINT_PTR)hMenuPopup, TEXT("File")); - - hMenuPopup = CreatePopupMenu(); - //AppendMenu(hMenuPopup, MF_STRING, MYMENU_MESSAGEBOX, TEXT("MessageBox")); - AppendMenu(hMenu, MF_POPUP, (UINT_PTR)hMenuPopup, TEXT("Test")); - return hMenu; -} - -//The new window thread -DWORD WINAPI ThreadProc(LPVOID lpParam) -{ - MSG messages; - wchar_t *pString = reinterpret_cast (lpParam); - HMENU hMenu = CreateDLLWindowMenu(); - RegisterDLLWindowClass(); - //prnt_hWnd = FindWindow("Window Injected Into ClassName", "Window Injected Into Caption"); - HWND hwnd = CreateWindowEx(0, (LPCSTR)"InjectedDLLWindowClass", (LPCSTR)pString, WS_EX_PALETTEWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 400, 300, prnt_hWnd, hMenu, inj_hModule, NULL); - //this window is only for bridging the dialog, so do not show it. - //ShowWindow(hwnd, SW_SHOWNORMAL); - //call function to creat the dialog, pass in the handle of the newly created window as parent handle. - DlgVSBCFeedback::ShowVirtualSBCFeedback(hwnd); - while (GetMessage(&messages, NULL, 0, 0)) - { - TranslateMessage(&messages); - DispatchMessage(&messages); - } - return 1; -} -//new windows proc -LRESULT CALLBACK DLLWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - case WM_COMMAND: - switch (wParam) - { - case MYMENU_EXIT: - SendMessage(hwnd, WM_CLOSE, 0, 0); - break; - } - break; - case WM_DESTROY: - PostQuitMessage(0); - break; - default: - return DefWindowProc(hwnd, message, wParam, lParam); - } - return 0; -} - -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - inj_hModule = hModule; - CreateThread(0, NULL, ThreadProc, (LPVOID)L"Window Title", NULL, NULL); - case DLL_THREAD_ATTACH: - //ShowVirtualSBCFeedback(NULL); - break; - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - - break; - } - return TRUE; -} - diff --git a/src/vsbc/stdafx.cpp b/src/vsbc/stdafx.cpp deleted file mode 100644 index 80d89b6fe..000000000 --- a/src/vsbc/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// CxbxVSBC.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/src/vsbc/stdafx.h b/src/vsbc/stdafx.h deleted file mode 100644 index f3a07375c..000000000 --- a/src/vsbc/stdafx.h +++ /dev/null @@ -1,16 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#include "targetver.h" - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#include - - - -// TODO: reference additional headers your program requires here diff --git a/src/vsbc/targetver.h b/src/vsbc/targetver.h deleted file mode 100644 index 87c0086de..000000000 --- a/src/vsbc/targetver.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include