diff --git a/CMakeLists.txt b/CMakeLists.txt index 88f87a7..1e7eaf3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,19 +14,18 @@ add_compile_options( if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x64) - set(LIBDIR x64libs) + link_directories(x64libs) else() set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x86) - set(LIBDIR x86libs) + link_directories(x86libs) endif() set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>) include_directories(include) -link_directories(${LIBDIR}) -file(GLOB LIBS ${LIBDIR}/*) -file(COPY ${LIBS} DESTINATION ${CMAKE_FINAL_OUTPUT_DIRECTORY}) +file(GLOB ASSETS assets/*) +file(COPY ${ASSETS} DESTINATION ${CMAKE_FINAL_OUTPUT_DIRECTORY}) add_library(text text.cpp) target_compile_definitions(text PRIVATE ${TEXT_LANGUAGE}) diff --git a/x64libs/LoaderDll.dll b/assets/LoaderDll.dll similarity index 100% rename from x64libs/LoaderDll.dll rename to assets/LoaderDll.dll diff --git a/x64libs/LocaleEmulator.dll b/assets/LocaleEmulator.dll similarity index 100% rename from x64libs/LocaleEmulator.dll rename to assets/LocaleEmulator.dll diff --git a/assets/StressTest.txt b/assets/StressTest.txt new file mode 100644 index 0000000..22bfac1 Binary files /dev/null and b/assets/StressTest.txt differ diff --git a/test/main.cpp b/test/main.cpp index 1a92384..14b5810 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -8,11 +8,12 @@ wchar_t buffer[1000] = {}; std::array vars = {}; +int& mode = vars.at(0); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int _) { QApplication a(_ = 0, DUMMY); - static std::vector>> extensions; + static std::vector, Functor>> extensions; for (auto file : std::filesystem::directory_iterator(std::filesystem::current_path())) if (file.path().extension() == L".dll" && (std::stringstream() << std::ifstream(file.path(), std::ios::binary).rdbuf()).str().find("OnNewSentence") != std::string::npos) @@ -39,7 +40,14 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int _) GetWindowTextW((HWND)lParam, buffer, std::size(buffer)); try { vars.at(LOWORD(wParam) - IDC_EDIT1) = std::stoi(buffer); } catch (...) {} - if (vars.at(1)) extensions.clear(); + //if (vars.at(1)) extensions.clear(); + if (LOWORD(wParam) - IDC_EDIT1 == 1 && mode == 1) + { + std::wstring buffer(vars.at(1), 0); + std::wifstream("StressTest.txt", std::ios::in | std::ios::binary).read(buffer.data(), vars.at(1)); + std::ignore = std::remove(buffer.begin(), buffer.end(), 0); + for (int i = 0; i < buffer.size(); i += 700) lstrlenW(buffer.c_str() + i); + } } } break; @@ -47,7 +55,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int _) return FALSE; }, 0), SW_SHOW); - std::thread([] { while (true) Sleep(vars.at(0)), lstrlenW(L"こんにちは\n (Hello)"); }).detach(); + std::thread([] { while (true) Sleep(vars.at(2)), mode == 2 && lstrlenW(L"こんにちは\n (Hello)"); }).detach(); STARTUPINFOW info = { sizeof(info) }; wchar_t commandLine[] = { L"Textractor -p\"Test.exe\"" }; diff --git a/test/resource.rc b/test/resource.rc index 0baf4fb..b0f9769 100644 Binary files a/test/resource.rc and b/test/resource.rc differ diff --git a/x86libs/LoaderDll.dll b/x86libs/LoaderDll.dll deleted file mode 100644 index f39bbee..0000000 Binary files a/x86libs/LoaderDll.dll and /dev/null differ diff --git a/x86libs/LocaleEmulator.dll b/x86libs/LocaleEmulator.dll deleted file mode 100644 index f13ef26..0000000 Binary files a/x86libs/LocaleEmulator.dll and /dev/null differ