void TZF_InitCompatBlacklist (void) { TZF_CreateDLLHook ( L"kernel32.dll", "LoadLibraryA", LoadLibraryA_Detour, (LPVOID*)&LoadLibraryA_Original ); TZF_CreateDLLHook ( L"kernel32.dll", "LoadLibraryW", LoadLibraryW_Detour, (LPVOID*)&LoadLibraryW_Original ); TZF_CreateDLLHook ( L"kernel32.dll", "LoadLibraryExA", LoadLibraryExA_Detour, (LPVOID*)&LoadLibraryExA_Original ); TZF_CreateDLLHook ( L"kernel32.dll", "LoadLibraryExW", LoadLibraryExW_Detour, (LPVOID*)&LoadLibraryExW_Original ); }
void tzf::SteamFix::Init (void) { CommandProcessor* comm_proc = CommandProcessor::getInstance (); if (! config.steam.allow_broadcasts) return; steam_dll = LoadLibrary (L"steam_api.dll"); TZF_CreateDLLHook ( L"steam_api.dll", "SteamVideo", SteamVideo_Detour, (LPVOID *)&SteamVideo_Original, (LPVOID *)&SteamVideo ); TZF_EnableHook (SteamVideo); }
void tzf::KeyboardFix::Init (void) { // Don't even hook this stuff if no keyboard remapping is requested. if (config.keyboard.swap_keys.empty ()) return; wchar_t* pairs = wcsdup (config.keyboard.swap_keys.c_str ()); wchar_t* orig = pairs; size_t len = wcslen (pairs); size_t remaining = len; TZF_CreateDLLHook ( L"SDL2.dll", "SDL_GetKeyFromScancode", SDL_GetKeyFromScancode_Detour, (LPVOID *)&SDL_GetKeyFromScancode_Original ); TZF_CreateDLLHook ( L"SDL2.dll", "SDL_GetKeyboardState", SDL_GetKeyboardState_Detour, (LPVOID *)&SDL_GetKeyboardState_Original ); // Parse the swap pairs while (remaining > 0 && remaining <= len) { wchar_t* wszSwapPair = pairs; size_t pair_len = wcscspn (pairs, L","); remaining -= (pair_len + 1); pairs += (pair_len); *(pairs++) = L'\0'; size_t sep = wcscspn (wszSwapPair, L"-"); *(wszSwapPair + sep) = L'\0'; wchar_t* wszSwapFirst = wszSwapPair; int16_t first = _wtoi (wszSwapFirst); wchar_t* wszSwapSecond = (wszSwapPair + sep + 1); int16_t second = _wtoi (wszSwapSecond); if (remapped_scancodes.find (first) == remapped_scancodes.end () && remapped_scancodes.find (second) == remapped_scancodes.end ()) { remapped_scancodes.insert (first); remapped_scancodes.insert (second); swapped_keys.push_back (std::pair <uint16_t, uint16_t> (first, second)); dll_log.Log (L" # SDL Scancode Swap: (%i <-> %i)", first, second); } else { // Do not allow multiple remapping dll_log.Log ( L" @ SDL Scancode Remapped Multiple Times! -- (%i <-> %i)", first, second ); } } // Free the copied string free (orig); }