diff --git a/SPP4/trunk/Spp/SppConsole/SppControl.cpp b/SPP4/trunk/Spp/SppConsole/SppControl.cpp index 1eaf0e7..1d90f1c 100644 --- a/SPP4/trunk/Spp/SppConsole/SppControl.cpp +++ b/SPP4/trunk/Spp/SppConsole/SppControl.cpp @@ -270,7 +270,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, // Display the version of vJoy driver vJoyDevicesVersion(hDialog); - // TODO: Test functions - remove later + // Monitor vJoy Device if (MonitorOk) StartPollingDevice(vJoyDevice); @@ -1280,7 +1280,7 @@ void SetMonitoring(HWND hDlg) HINSTANCE FilterPopulate(HWND hDlg) { - HINSTANCE h; + HINSTANCE h, hTmp; //LPCTSTR * names; //long filter_ver; UINT (CALLBACK * GetDllVersion)(void); @@ -1294,7 +1294,7 @@ HINSTANCE FilterPopulate(HWND hDlg) - // TODO: Release former library + hTmp = hDllFilters; // Get filter file name from config file wstring wsFileName(Conf->FilterFile()); @@ -1338,12 +1338,6 @@ HINSTANCE FilterPopulate(HWND hDlg) return NULL; }; - //filter_ver = GetDllVersion(); - //if (filter_ver < 0x30100) // TODO: Newer DLLs support wide characters - //{ - // SendMessage(hDlg, FILTER_VER, false, filter_ver); - // return NULL; - //}; //// Build the list in the GUI // Get the number of filters @@ -1366,8 +1360,8 @@ HINSTANCE FilterPopulate(HWND hDlg) UINT idSel = Conf->GetSelectedFilter(); // Get interface functions - pGetFilterNameByIndexA = (const char * (CALLBACK *)(const int iFilter))GetProcAddress(h,"GetFilterNameByIndex"); // TODO: Add support to WCHAR - pGetFilterNameByIndexW = (LPCWSTR (CALLBACK *)(const int iFilter))GetProcAddress(h,"GetFilterNameByIndexW"); // TODO: Add support to WCHAR + pGetFilterNameByIndexA = (const char * (CALLBACK *)(const int iFilter))GetProcAddress(h,"GetFilterNameByIndex"); + pGetFilterNameByIndexW = (LPCWSTR (CALLBACK *)(const int iFilter))GetProcAddress(h,"GetFilterNameByIndexW"); pGetFilterIdByIndex = (const int (CALLBACK *)(const int iFilter))GetProcAddress(h,"GetFilterIdByIndex"); pSelectFilterByIndex = (const int (CALLBACK *)(const int iFilter))GetProcAddress(h,"SelectFilterByIndex"); pGetIndexOfSelectedFilter = (const int (CALLBACK *)(void))GetProcAddress(h,"GetIndexOfSelectedFilter"); @@ -1409,6 +1403,13 @@ HINSTANCE FilterPopulate(HWND hDlg) } }; + // Release former library + if (hTmp) + { + FreeLibrary(hTmp); + hTmp = NULL; + } + LogMessage(INFO, IDS_I_FILTERDLLOK); return h; } @@ -1467,8 +1468,8 @@ void SelectFilter(int FilterId) pGetFilterIdByIndex = (const int (CALLBACK *)(const int iFilter))GetProcAddress(hDllFilters,"GetFilterIdByIndex"); pSelectFilterByIndex = (const int (WINAPI *)(const int iFilter))GetProcAddress(hDllFilters,"SelectFilterByIndex"); pProcessChannels = (PJS_CHANNELS (WINAPI * )(PJS_CHANNELS, int max, int min))GetProcAddress(hDllFilters,"ProcessChannels"); - pGetFilterNameByIndexA = (const char * (CALLBACK *)(const int i))GetProcAddress(hDllFilters,"GetFilterNameByIndex"); // TODO: Add support to WCHAR - pGetFilterNameByIndexW = (LPCWSTR (CALLBACK *)(const int iFilter))GetProcAddress(hDllFilters,"GetFilterNameByIndexW"); // TODO: Add support to WCHAR + pGetFilterNameByIndexA = (const char * (CALLBACK *)(const int i))GetProcAddress(hDllFilters,"GetFilterNameByIndex"); + pGetFilterNameByIndexW = (LPCWSTR (CALLBACK *)(const int iFilter))GetProcAddress(hDllFilters,"GetFilterNameByIndexW"); int nFilters; @@ -1711,7 +1712,7 @@ void thMonitor(bool * KeepAlive) // Compute the state of the Operation state machine and inform GUI - ComputeOperatState(); // TODO: Much tweeking + ComputeOperatState(); // Inform GUI of changes in the Start/Stop conditions if (OperatStateMachine != oState) @@ -2098,11 +2099,12 @@ bool isUnique(void) else { config.pszVerificationText = CN_NO_UNIQUE_CB; - ::TaskDialogIndirect(&config, &selectedButtonId, &selectedRadioButtonId, &verificationChecked); + HRESULT hr = ::TaskDialogIndirect(&config, &selectedButtonId, &selectedRadioButtonId, &verificationChecked); ::PostMessage(HWND_BROADCAST, WM_INTERSPPCONSOLE, 0, 0); // Instuct the existing process to change "Don't show again" option in the configuration file - res = SendMessageTimeout(hOtherWin, WM_INTERSPPAPPSGETUNIQ, 1, verificationChecked, SMTO_ABORTIFHUNG | SMTO_ERRORONEXIT, 100, NULL); + if (hr == S_OK) + res = SendMessageTimeout(hOtherWin, WM_INTERSPPAPPSGETUNIQ, 1, verificationChecked, SMTO_ABORTIFHUNG | SMTO_ERRORONEXIT, 100, NULL); } return false; @@ -2127,9 +2129,8 @@ bool isUnique(void) return true; } -// TODO: Remove pragma and solve problem -#pragma warning( push ) -#pragma warning( disable : 4996 ) +//#pragma warning( push ) +//#pragma warning( disable : 4996 ) bool isAboveVistaSp1() { @@ -2161,7 +2162,7 @@ bool isAboveVistaSp1() #endif // 0 } -#pragma warning( pop ) +//#pragma warning( pop ) #ifdef _DEBUG const DWORD MS_VC_EXCEPTION=0x406D1388; diff --git a/SPP4/trunk/Spp/SppProcess/SppProcess.cpp b/SPP4/trunk/Spp/SppProcess/SppProcess.cpp index a8bf449..9c9a659 100644 --- a/SPP4/trunk/Spp/SppProcess/SppProcess.cpp +++ b/SPP4/trunk/Spp/SppProcess/SppProcess.cpp @@ -328,8 +328,11 @@ SPPMAIN_API int CSppProcess::GetJoystickCommQuality(void) SPPMAIN_API void CSppProcess::SetDecoderScanning(BOOL Start, BOOL Forever, int Timeout) { // It is assumed that PollChannels() is running - if (!m_chMonitor) // TODO: Warning message + if (!m_chMonitor) + { + LogMessage(WARN, IDS_W_NO_MONITOR); return; + } // Stop? if (!Start && m_DecoderStruct.running) @@ -404,7 +407,7 @@ inline void CSppProcess::GetEncoding(void) // Stop if not to run forever if (res == S_OK) { - SendMessage(m_hParentWnd, WMSPP_PRCS_DCDR, (WPARAM)Decoder, 0); + SendMessageTimeout(m_hParentWnd, WMSPP_PRCS_DCDR, (WPARAM)Decoder, 0, SMTO_NORMAL, 100, NULL); if (m_DecoderStruct.forever) m_DecoderStruct.rstbuf = TRUE; else @@ -728,7 +731,6 @@ void CSppProcess::MonitorCapture(void) LogMessage(ERR, IDS_E_STREAMFAIL); else { - // TODO: ReportChange(); m_tCapture = new thread(CaptureAudioStatic, this); if (!m_tCapture) LogMessage(ERR, IDS_E_STREAMTHRDFAIL); @@ -749,7 +751,7 @@ void CSppProcess::CaptureAudio(void) PBYTE buffer=NULL; UINT bSize=0; HRESULT hr = S_OK; - UINT bMax = 8000; // TODO: Change to dynamic size + UINT bMax = 8000; buffer = new BYTE[bMax]; @@ -1007,8 +1009,7 @@ HRESULT CSppProcess::ProcessWave(BYTE * pWavePacket, UINT32 packetLength) #endif // If valid pulse the process the pulse - // TODO (?): Very short pulses are ignored (Glitch) - if (PulseLength/*>3*/) + if (PulseLength) { lock_guard lock_Decode(m_mx_Decode); @@ -2556,7 +2557,7 @@ _inline double CSppProcess::CalcThreshold(int value) return(threthold); } -// TODO: Normalize the calling functions to the range 0-32K + void CSppProcess::Send2vJoy(int nChannels, int * Channel) { BOOL writeOk; @@ -2594,11 +2595,11 @@ void CSppProcess::Send2vJoy(int nChannels, int * Channel) continue; if ((iMapped>MAX_JS_CH)||(ch[iMapped-1]<0)) // Test value - if (-1) value is illegal return; - writeOk = SetAxisDelayed(32*ch[iMapped-1], HID_USAGE_X+i); // TODO: the normalization to default values should be done in the calling functions + writeOk = SetAxisDelayed(32*ch[iMapped-1], HID_USAGE_X+i); // Normalization to default values } for (k=0; k511,k+1); // TODO: Replace 511 with some constant definition + writeOk = SetBtnDelayed(ch[m_BtnMapping[k]-1]>BUTTON_TRIG_VAL,k+1); // Feed structure to vJoy device rID BOOL updated = UpdateVJD(rID, &m_vJoyPosition); diff --git a/SPP4/trunk/Spp/SppProcess/SppProcess.h b/SPP4/trunk/Spp/SppProcess/SppProcess.h index 7dcd1a3..c5d8151 100644 --- a/SPP4/trunk/Spp/SppProcess/SppProcess.h +++ b/SPP4/trunk/Spp/SppProcess/SppProcess.h @@ -98,6 +98,7 @@ typedef struct _DECODER_DETECT #define MAX_JS_CH 12 #define MUTEX_STOP_START _T("WaveIn Stopping and Starting are mutually exclusive") #define MAX_BUF_SIZE 1000 +#define BUTTON_TRIG_VAL 511 diff --git a/SPP4/trunk/Spp/SppUI/Resource.h b/SPP4/trunk/Spp/SppUI/Resource.h index d613e87..fd52142 100644 --- a/SPP4/trunk/Spp/SppUI/Resource.h +++ b/SPP4/trunk/Spp/SppUI/Resource.h @@ -401,6 +401,7 @@ #define IDS_I_CONF_CREATED 40212 #define IDS_E_CONF_NOFOLDER 40213 #define IDS_I_CONF_CREATEFOLDER 40214 +#define IDS_W_NO_MONITOR 40215 // Next default values for new objects // diff --git a/SPP4/trunk/Spp/SppUI/SppDlg.cpp b/SPP4/trunk/Spp/SppUI/SppDlg.cpp index 1eb0fbd..bff49d8 100644 --- a/SPP4/trunk/Spp/SppUI/SppDlg.cpp +++ b/SPP4/trunk/Spp/SppUI/SppDlg.cpp @@ -105,8 +105,8 @@ bool SppDlg::MsgLoop(void) return false; } - else if (!IsWindow(m_hDlg)) - return true; + //else if (!IsWindow(m_hDlg)) + // return true; else if (!IsDialogMessage(m_hDlg, &msg)) { @@ -1912,7 +1912,7 @@ INT_PTR CALLBACK MsgHndlDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPara case WM_DESTROY: DestroyWindow(hDlg); hDlg = NULL; -// PostQuitMessage(0); + PostQuitMessage(0); return (INT_PTR)TRUE; case WM_NOTIFY: diff --git a/SPP4/trunk/Spp/SppUI/SppUI.rc b/SPP4/trunk/Spp/SppUI/SppUI.rc index 162b6b0..db3d019 100644 --- a/SPP4/trunk/Spp/SppUI/SppUI.rc +++ b/SPP4/trunk/Spp/SppUI/SppUI.rc @@ -221,6 +221,7 @@ BEGIN 40093 "Audio Input" 40094 "SmartPropoPlus is currently paused - Press to activate" 40095 "SmartPropoPlus is currently active - Press to deactivate" + 40215 "Cannot scan input - Channel polling thread is inactive" END STRINGTABLE