diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index dddb4ee6..ae6bfe04 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -37,7 +37,7 @@ add_subdirectory(winsharedutils) add_subdirectory(hookmagpie) add_subdirectory(shareddllproxy) add_subdirectory(LunaOCR) -if(NOT WINXP) add_subdirectory(winrtutils) +if(NOT WINXP) add_subdirectory(wcocr) endif() \ No newline at end of file diff --git a/cpp/LunaOCR/OCR.cpp b/cpp/LunaOCR/OCR.cpp index d7726865..4bcc5d62 100644 --- a/cpp/LunaOCR/OCR.cpp +++ b/cpp/LunaOCR/OCR.cpp @@ -1,3 +1,11 @@ + +enum class Directional +{ + H, + V, + Auto +}; + #ifndef WINXP #include #include @@ -7,13 +15,6 @@ typedef std::vector TextBox; typedef std::string TextLine; typedef std::pair TextBlock; -enum class Directional -{ - H, - V, - Auto -}; - struct ScaleParam { int srcWidth; @@ -704,7 +705,8 @@ std::vector OcrLite::detect_internal(cv::Mat &src, cv::Rect &originRe return textBlocks; } - +#else +struct OcrLite; #endif struct ocrpoints { diff --git a/cpp/winrtutils/CMakeLists.txt b/cpp/winrtutils/CMakeLists.txt index 123ff2cf..081fd371 100644 --- a/cpp/winrtutils/CMakeLists.txt +++ b/cpp/winrtutils/CMakeLists.txt @@ -12,7 +12,9 @@ generate_product_version( add_library(winrtutils MODULE winrtsnapshot.cpp winrtocr.cpp livecaptions.cpp ${versioninfo}) target_precompile_headers(winrtutils REUSE_FROM pch) +if(NOT WINXP) target_link_libraries(winrtutils wil) +endif() if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) set_target_properties(winrtutils PROPERTIES OUTPUT_NAME "winrtutils64") else() diff --git a/cpp/winrtutils/livecaptions.cpp b/cpp/winrtutils/livecaptions.cpp index 16972646..6b412771 100644 --- a/cpp/winrtutils/livecaptions.cpp +++ b/cpp/winrtutils/livecaptions.cpp @@ -1,3 +1,4 @@ +#ifndef WINXP // https://github.com/corbamico/get-livecaptions-cpp/ #include #include @@ -60,8 +61,10 @@ public: return FindWindowW(L"LiveCaptionsDesktopWindow", nullptr) != NULL; } }; +#endif DECLARE_API HANDLE livecaption_start(void (*cb)(const wchar_t *)) { +#ifndef WINXP auto mutex = CreateSemaphoreW(NULL, 0, 1, NULL); auto flag = new int{1}; std::thread([=]() @@ -90,13 +93,21 @@ DECLARE_API HANDLE livecaption_start(void (*cb)(const wchar_t *)) delete flag; }) .detach(); return mutex; +#else + return NULL; +#endif } - DECLARE_API void livecaption_stop(HANDLE m) { +#ifndef WINXP ReleaseSemaphore(m, 1, NULL); +#endif } DECLARE_API bool livecaption_isrunning() { +#ifndef WINXP return Engine::is_livecaption_running(); +#else + return false; +#endif } \ No newline at end of file