-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bcc6e59
Showing
14 changed files
with
517 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30907.101 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kuffix", "kuffix\kuffix.vcxproj", "{22A53769-F926-42F2-969D-337C3D257CC8}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|x86 = Debug|x86 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{22A53769-F926-42F2-969D-337C3D257CC8}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{22A53769-F926-42F2-969D-337C3D257CC8}.Debug|x86.Build.0 = Debug|Win32 | ||
{22A53769-F926-42F2-969D-337C3D257CC8}.Release|x86.ActiveCfg = Release|Win32 | ||
{22A53769-F926-42F2-969D-337C3D257CC8}.Release|x86.Build.0 = Release|Win32 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {397FC045-611B-415B-AD8D-7516974F702B} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2016 jeonghun | ||
|
||
#include "code_patcher.h" | ||
|
||
bool code_patcher::apply(void *addr_ptr, const void *code_ptr, uint32_t length) { | ||
bool apply = false; | ||
|
||
if (addr_ptr != nullptr && code_ptr != nullptr && length > 0) { | ||
DWORD protect_flag = 0; | ||
if (VirtualProtect(addr_ptr, length, PAGE_EXECUTE_READWRITE, &protect_flag) != FALSE) { | ||
protect_flag_ = protect_flag; | ||
addr_ptr_ = addr_ptr; | ||
backup_.resize(length); | ||
memcpy(backup_.data(), addr_ptr_, length); | ||
memcpy(addr_ptr, code_ptr, length); | ||
apply = true; | ||
} | ||
} | ||
|
||
return apply; | ||
} | ||
|
||
bool code_patcher::undo() { | ||
bool undo = false; | ||
|
||
if (protect_flag_ != 0) { | ||
memcpy(addr_ptr_, backup_.data(), backup_.size()); | ||
DWORD protect_flag = 0; | ||
if (VirtualProtect(addr_ptr_, backup_.size(), protect_flag_, &protect_flag) != FALSE) { | ||
backup_.clear(); | ||
addr_ptr_ = nullptr; | ||
protect_flag_ = 0; | ||
undo = true; | ||
} | ||
} | ||
|
||
return undo; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2016 jeonghun | ||
|
||
#ifndef CODE_PATCHER_H_ | ||
#define CODE_PATCHER_H_ | ||
|
||
#include <cstdint> | ||
#include <vector> | ||
|
||
class code_patcher final { | ||
public: | ||
code_patcher() = default; | ||
~code_patcher() = default; | ||
|
||
bool apply(void *addr_ptr, const void *code_ptr, uint32_t length); | ||
bool undo(); | ||
|
||
private: | ||
std::vector<uint8_t> backup_; | ||
void *addr_ptr_ = nullptr; | ||
uint32_t protect_flag_ = 0; | ||
}; | ||
|
||
#endif // CODE_PATCHER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
LIBRARY DINPUT8 | ||
EXPORTS | ||
DirectInput8Create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright 2015 jeonghun | ||
#ifndef DLL_LOADER_H_ | ||
#define DLL_LOADER_H_ | ||
|
||
#include <windows.h> | ||
#include <shlwapi.h> | ||
#include <cassert> | ||
#include <type_traits> | ||
|
||
#pragma comment(lib, "shlwapi") | ||
|
||
class dll_loader final { | ||
public: | ||
explicit dll_loader(const wchar_t *dll_name, bool load_from_system = false) { | ||
module_ = load_from_system ? NULL : GetModuleHandle(dll_name); | ||
if (module_ == NULL) { | ||
if (load_from_system) { | ||
wchar_t sys_path[MAX_PATH] = { 0 }; | ||
GetSystemDirectory(sys_path, _countof(sys_path)); | ||
PathCombine(sys_path, sys_path, dll_name); | ||
module_ = LoadLibrary(sys_path); | ||
} else { | ||
module_ = LoadLibrary(dll_name); | ||
} | ||
use_loadlib = module_ != NULL; | ||
} | ||
assert(module_ != NULL); | ||
} | ||
|
||
~dll_loader() { | ||
if (use_loadlib) { | ||
FreeLibrary(module_); | ||
} | ||
} | ||
|
||
dll_loader(const dll_loader&) = delete; | ||
void operator=(const dll_loader&) = delete; | ||
|
||
template <typename T = FARPROC> | ||
inline T get_func_ptr(const char* api_name) const { | ||
assert(api_name != nullptr); | ||
return reinterpret_cast<T>(GetProcAddress(module_, api_name)); | ||
} | ||
|
||
template <typename T, typename... ARGS> | ||
inline std::result_of_t<T(ARGS...)> call(const char *api_name, ARGS ...args) const { | ||
auto func_ptr = get_func_ptr<T>(api_name); | ||
assert(func_ptr != nullptr); | ||
return func_ptr(args...); | ||
} | ||
|
||
private: | ||
HMODULE module_ = NULL; | ||
bool use_loadlib = false; | ||
}; | ||
|
||
#endif // DLL_LOADER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2020 jeonghun | ||
|
||
#include "fps_unlock.h" | ||
#include "code_patcher.h" | ||
|
||
namespace fps_unlock { | ||
|
||
code_patcher skip_delay; | ||
code_patcher skip_eval; | ||
|
||
void apply() { | ||
DWORD hinst = reinterpret_cast<DWORD>(GetModuleHandle(NULL)); | ||
const unsigned char nop_5[] = { 0x90, 0x90, 0x90, 0x90, 0x90 }; // NOP NOP NOP NOP NOP | ||
|
||
void* skip_delay_addr = reinterpret_cast<void*>(0x001C2239 + hinst); | ||
skip_delay.apply(skip_delay_addr, nop_5, sizeof(nop_5)); | ||
|
||
void* skip_eval_addr = reinterpret_cast<void*>(0x001C2241 + hinst); | ||
skip_eval.apply(skip_eval_addr, nop_5, sizeof(nop_5)); | ||
} | ||
|
||
void undo() { | ||
skip_delay.undo(); | ||
skip_eval.undo(); | ||
} | ||
|
||
} // namespace fps_unlock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2020 jeonghun | ||
|
||
#ifndef KUFFIX_FPS_UNLOCK_H_ | ||
#define KUFFIX_FPS_UNLOCK_H_ | ||
|
||
namespace fps_unlock { | ||
|
||
void apply(); | ||
void undo(); | ||
|
||
} // namespace fps_unlock | ||
|
||
#endif // KUFFIX_FPS_UNLOCK_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// Microsoft Visual C++ generated resource script. | ||
// | ||
#include "resource.h" | ||
|
||
#define APSTUDIO_READONLY_SYMBOLS | ||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Generated from the TEXTINCLUDE 2 resource. | ||
// | ||
#include "winres.h" | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
#undef APSTUDIO_READONLY_SYMBOLS | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// Korean (Korea) resources | ||
|
||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR) | ||
LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT | ||
#pragma code_page(949) | ||
|
||
#ifdef APSTUDIO_INVOKED | ||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// TEXTINCLUDE | ||
// | ||
|
||
1 TEXTINCLUDE | ||
BEGIN | ||
"resource.h\0" | ||
END | ||
|
||
2 TEXTINCLUDE | ||
BEGIN | ||
"#include ""winres.h""\r\n" | ||
"\0" | ||
END | ||
|
||
3 TEXTINCLUDE | ||
BEGIN | ||
"\r\n" | ||
"\0" | ||
END | ||
|
||
#endif // APSTUDIO_INVOKED | ||
|
||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Version | ||
// | ||
|
||
VS_VERSION_INFO VERSIONINFO | ||
FILEVERSION 0,0,1,0 | ||
PRODUCTVERSION 0,0,1,0 | ||
FILEFLAGSMASK 0x3fL | ||
#ifdef _DEBUG | ||
FILEFLAGS 0x1L | ||
#else | ||
FILEFLAGS 0x0L | ||
#endif | ||
FILEOS 0x40004L | ||
FILETYPE 0x2L | ||
FILESUBTYPE 0x0L | ||
BEGIN | ||
BLOCK "StringFileInfo" | ||
BEGIN | ||
BLOCK "041204b0" | ||
BEGIN | ||
VALUE "FileVersion", "0.0.1.0" | ||
VALUE "LegalCopyright", "Copyright (C) 2020" | ||
VALUE "OriginalFilename", "kuffix.dll" | ||
VALUE "ProductName", "kuffix" | ||
VALUE "ProductVersion", "0.0.1.0" | ||
END | ||
END | ||
BLOCK "VarFileInfo" | ||
BEGIN | ||
VALUE "Translation", 0x412, 1200 | ||
END | ||
END | ||
|
||
#endif // Korean (Korea) resources | ||
///////////////////////////////////////////////////////////////////////////// | ||
|
||
|
||
|
||
#ifndef APSTUDIO_INVOKED | ||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Generated from the TEXTINCLUDE 3 resource. | ||
// | ||
|
||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
#endif // not APSTUDIO_INVOKED | ||
|
Oops, something went wrong.