-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
・[fix] windows7で起動しない問題をたぶん修正 (WindowsGraphicsCapture関連の処理を WindowsGr…
…aphicsCapture.dllに移動させて、動的にロードするようにした) ・[change] ウマ娘ウィンドウが横画面の時は、TextRecognizerを実行しないようにした (CPU負荷対策) ・[fix] 選択肢の候補が複数ある時、より類似度の高い方を選ぶようにした #90 ・[fix] イベント名末尾にある"①"や"(イベント進行①)"などの文字列を取り除いた (選択肢検出の精度を上げるため)
- Loading branch information
Showing
26 changed files
with
730 additions
and
211 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
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
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
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
#include <memory> | ||
|
||
#include <atlbase.h> | ||
#include <atlwin.h> | ||
#include <atltypes.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
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
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
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
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
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
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
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
#pragma once | ||
|
||
#include <Windows.h> | ||
#include <GdiPlus.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,78 @@ | ||
#pragma once | ||
|
||
#include "IScreenShotWindow.h" | ||
|
||
#include "Utility\Logger.h" | ||
#include "Utility\CommonUtility.h" | ||
|
||
class WindowsGraphicsCaptureWrapper | ||
{ | ||
public: | ||
|
||
static bool IsSupported() | ||
{ | ||
using fnRtlGetNtVersionNumbers = void (WINAPI*)(LPDWORD major, LPDWORD minor, LPDWORD build); | ||
auto RtlGetNtVersionNumbers = | ||
reinterpret_cast<fnRtlGetNtVersionNumbers>( | ||
GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "RtlGetNtVersionNumbers")); | ||
ATLASSERT(RtlGetNtVersionNumbers); | ||
DWORD major, minor, buildNumber; | ||
RtlGetNtVersionNumbers(&major, &minor, &buildNumber); | ||
buildNumber &= ~0xF0000000; | ||
if (major >= 10 && buildNumber >= 19041) { | ||
//bool b = winrt::GraphicsCaptureSession::IsSupported(); | ||
//return b; | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
static bool LoadLibrary() | ||
{ | ||
if (!IsSupported()) { | ||
return false; | ||
} | ||
|
||
ATLASSERT(!s_hDll); | ||
s_hDll = ::LoadLibrary((GetExeDirectory() / L"WindowsGraphicsCapture.dll").wstring().c_str()); | ||
ATLASSERT(s_hDll); | ||
if (!s_hDll) { | ||
ERROR_LOG << L"WindowsGraphicsCapture.dll の読み込みに失敗しました"; | ||
return false; | ||
|
||
} else { | ||
s_func_CreateWindowsGraphicsCapture = (func_CreateWindowsGraphicsCapture)::GetProcAddress(s_hDll, "CreateWindowsGraphicsCapture"); | ||
ATLASSERT(s_func_CreateWindowsGraphicsCapture); | ||
if (s_func_CreateWindowsGraphicsCapture) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
} | ||
|
||
static void FreeLibrary() | ||
{ | ||
ATLASSERT(IsDllLoaded()); | ||
s_func_CreateWindowsGraphicsCapture = nullptr; | ||
::FreeLibrary(s_hDll); | ||
s_hDll = NULL; | ||
} | ||
|
||
static bool IsDllLoaded() | ||
{ | ||
bool b = s_hDll && s_func_CreateWindowsGraphicsCapture; | ||
return b; | ||
} | ||
|
||
static IScreenShotWindow* CreateWindowsGraphicsCapture() | ||
{ | ||
ATLASSERT(s_func_CreateWindowsGraphicsCapture); | ||
return s_func_CreateWindowsGraphicsCapture(); | ||
} | ||
|
||
private: | ||
using func_CreateWindowsGraphicsCapture = IScreenShotWindow * (*)(); | ||
static inline func_CreateWindowsGraphicsCapture s_func_CreateWindowsGraphicsCapture = nullptr; | ||
static inline HMODULE s_hDll = NULL; | ||
}; |
Oops, something went wrong.