This commit is contained in:
恍兮惚兮 2024-01-29 03:24:33 +08:00
parent 26875c6421
commit 0c0d6c0132
21 changed files with 145 additions and 124 deletions

31
.gitignore vendored
View File

@ -1,4 +1,3 @@
LunaTranslator/transkiroku
LunaTranslator/userconfig LunaTranslator/userconfig
lunatranslator/cache lunatranslator/cache
@ -21,38 +20,14 @@ Thumbs.db
*.recipe *.recipe
*.wav *.wav
build/ build/
LunaTranslator/testapi.py
plugins/winsharedutils/Release plugins/builds
plugins/winsharedutils/x64 plugins/build
plugins/winsharedutils/.vs
plugins/winsharedutils/builds
plugins/winsharedutils/build
plugins/winrtutils/builds
plugins/winrtutils/build
LunaTranslator/files/plugins/Magpie_v0.9.1/cache
plugins/exec/.vs
plugins/exec/out
plugins/exec/builds
plugins/shareddllproxy/Release
plugins/shareddllproxy/out
plugins/shareddllproxy/builds
plugins/shareddllproxy/.vs
plugins/winxp_proxy_host/build
plugins/winxp_proxy_host/builds
LunaTranslator/files/plugins LunaTranslator/files/plugins
LunaTranslator/files/ocr LunaTranslator/files/ocr
LunaTranslator/files/data LunaTranslator/files/data
LunaTranslator/chrome_cache LunaTranslator/chrome_cache
plugins/.vscode/settings.json
plugins/winrtsnapshot/Release
plugins/winrtsnapshot/x64
plugins/winrtsnapshot/.vs

View File

@ -10,7 +10,7 @@ import os
import gobject import gobject
class ocrwrapper: class ocrwrapper:
def __init__(self) -> None: def __init__(self) -> None:
self.dll=CDLL(gobject.GetDllpath(('ocr32.dll','ocr64.dll'))) self.dll=CDLL(gobject.GetDllpath(('LunaOCR32.dll','LunaOCR64.dll')))
def _OcrInit(self,szDetModel, szRecModel, szKeyPath,szClsModel='', nThreads=4): def _OcrInit(self,szDetModel, szRecModel, szKeyPath,szClsModel='', nThreads=4):
_OcrInit=self.dll.OcrInit _OcrInit=self.dll.OcrInit

View File

@ -282,7 +282,7 @@
"64":[ "64":[
"./files/plugins/DLL64/winsharedutils64.dll", "./files/plugins/DLL64/winsharedutils64.dll",
"./files/plugins/DLL64/winrtutils64.dll", "./files/plugins/DLL64/winrtutils64.dll",
"./files/plugins/DLL64/ocr64.dll", "./files/plugins/DLL64/LunaOCR64.dll",
"./files/plugins/DLL64/libmecab.dll", "./files/plugins/DLL64/libmecab.dll",
"./files/plugins/DLL64/libcurl-x64.dll", "./files/plugins/DLL64/libcurl-x64.dll",
"./files/plugins/DLL64/LunaHost64.dll" "./files/plugins/DLL64/LunaHost64.dll"
@ -290,7 +290,7 @@
"32":[ "32":[
"./files/plugins/DLL32/winsharedutils32.dll", "./files/plugins/DLL32/winsharedutils32.dll",
"./files/plugins/DLL32/winrtutils32.dll", "./files/plugins/DLL32/winrtutils32.dll",
"./files/plugins/DLL32/ocr32.dll", "./files/plugins/DLL32/LunaOCR32.dll",
"./files/plugins/DLL32/libmecab.dll", "./files/plugins/DLL32/libmecab.dll",
"./files/plugins/DLL32/libcurl.dll", "./files/plugins/DLL32/libcurl.dll",
"./files/plugins/DLL32/LunaHost32.dll" "./files/plugins/DLL32/LunaHost32.dll"

View File

@ -5,14 +5,14 @@ x86=int(sys.argv[1])
if x86: if x86:
nuitkadist=r'..\build\x86\LunaTranslator_main.dist' nuitkadist=r'..\build\x86\LunaTranslator_main.dist'
targetdir=r'..\build\LunaTranslator_x86' targetdir=r'..\build\LunaTranslator_x86'
launch=r'..\plugins\exec\builds\_x86' launch=r'..\plugins\builds\_x86'
downlevel=f'C:\Windows\SysWOW64\downlevel' downlevel=f'C:\Windows\SysWOW64\downlevel'
target='LunaTranslator_x86.zip' target='LunaTranslator_x86.zip'
baddll='DLL64' baddll='DLL64'
else: else:
baddll='DLL32' baddll='DLL32'
target='LunaTranslator.zip' target='LunaTranslator.zip'
launch=r'..\plugins\exec\builds\_x64' launch=r'..\plugins\builds\_x64'
nuitkadist=r'..\build\x64\LunaTranslator_main.dist' nuitkadist=r'..\build\x64\LunaTranslator_main.dist'
targetdir=r'..\build\LunaTranslator' targetdir=r'..\build\LunaTranslator'
downlevel=f'C:\Windows\system32\downlevel' downlevel=f'C:\Windows\system32\downlevel'
@ -30,7 +30,8 @@ def get_import_table(file_path):
if os.path.exists(targetdir): if os.path.exists(targetdir):
shutil.rmtree(targetdir) shutil.rmtree(targetdir)
shutil.copytree(nuitkadist,targetdir_in) shutil.copytree(nuitkadist,targetdir_in)
shutil.copytree(launch,targetdir,dirs_exist_ok=True) for f in ['LunaTranslator_admin.exe','LunaTranslator.exe']:
shutil.copy(os.path.join(launch,f),targetdir)
shutil.copytree(r'.\files',rf'{targetdir}\files') shutil.copytree(r'.\files',rf'{targetdir}\files')
shutil.copy(r'..\LICENSE',targetdir) shutil.copy(r'..\LICENSE',targetdir)

31
plugins/CMakeLists.txt Normal file
View File

@ -0,0 +1,31 @@
cmake_minimum_required(VERSION 3.16)
project(LunaPlugins)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
add_compile_options(
/std:c++17
/MP
/wd4018
/DUNICODE
/D_UNICODE
)
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x64)
else()
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x86)
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(libs/libs.cmake)
add_subdirectory(exec)
add_subdirectory(shareddllproxy)
add_subdirectory(winrtutils)
add_subdirectory(winsharedutils)

View File

@ -1,26 +1,6 @@
cmake_minimum_required(VERSION 3.16)
project(LUNA) project(LUNA)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
add_compile_options(
/std:c++17
/MP
/wd4018
/DUNICODE
/D_UNICODE
)
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x64)
else()
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x86)
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}>)
add_executable(LunaTranslator luna.cpp luna.rc) add_executable(LunaTranslator luna.cpp luna.rc)
#target_link_options(LunaTranslator PRIVATE /MANIFESTUAC:level="asInvoker") #target_link_options(LunaTranslator PRIVATE /MANIFESTUAC:level="asInvoker")

View File

@ -1,2 +0,0 @@
cmake ./CMakeLists.txt -G "Visual Studio 15 2017" -A win32 -T v141_xp -B ./build
cmake --build ./build --config Release --target ALL_BUILD -j 14

View File

@ -0,0 +1,88 @@
cmake_minimum_required(VERSION 3.5.2)
#
# VC-LTL使VC-LTL
#
# 使
# 1. CMakeLists.txt include("VC-LTL helper for cmake.cmake")
#
# VC-LTL
# 1. VC-LTL helper for cmake.cmake ${CMAKE_CURRENT_LIST_DIR}
# 2. CMake ${CMAKE_CURRENT_SOURCE_DIR}/VC-LTL
# 3. ${PROJECT_SOURCE_DIR}/VC-LTL
# 4. CMake ${CMAKE_CURRENT_SOURCE_DIR}/../VC-LTL
# 5. ${PROJECT_SOURCE_DIR}/../VC-LTL
# 6. HKEY_CURRENT_USER\Code\VC-LTL@Root
#
# VC-LTLVC-LTL
#
# ${VC_LTL_Root}VC-LTL
#
#####################################################################VC-LTL#####################################################################
#TargetPlatform5.1.2600.0 6.0.6000.0 6.2.9200.0 10.0.10240.0 10.0.19041.0
#set(WindowsTargetPlatformMinVersion "10.0.10240.0")
# ucrt apiset(api-ms-win-crt-time-l1-1-0.dll)
#set(CleanImport "true")
####################################################################################################################################################
if(NOT VC_LTL_Root)
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/_msvcrt.h)
set(VC_LTL_Root ${CMAKE_CURRENT_LIST_DIR})
endif()
endif()
if(NOT VC_LTL_Root)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/VC-LTL/_msvcrt.h)
set(VC_LTL_Root ${CMAKE_CURRENT_SOURCE_DIR}/VC-LTL)
endif()
endif()
if(NOT VC_LTL_Root)
if(EXISTS ${PROJECT_SOURCE_DIR}/VC-LTL/_msvcrt.h)
set(VC_LTL_Root ${PROJECT_SOURCE_DIR}/VC-LTL)
endif()
endif()
if(NOT VC_LTL_Root)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../VC-LTL/_msvcrt.h)
set(VC_LTL_Root ${CMAKE_CURRENT_SOURCE_DIR}/../VC-LTL)
endif()
endif()
if(NOT VC_LTL_Root)
if(EXISTS ${PROJECT_SOURCE_DIR}/../VC-LTL/_msvcrt.h)
set(VC_LTL_Root ${PROJECT_SOURCE_DIR}/../VC-LTL)
endif()
endif()
if(NOT VC_LTL_Root)
EXECUTE_PROCESS(COMMAND reg query "HKEY_CURRENT_USER\\Code\\VC-LTL" -v "Root"
OUTPUT_VARIABLE FOUND_FILE
ERROR_VARIABLE ERROR_INFO
)
string(REGEX MATCH "[a-zA-Z]:\\\\.+\\\\"
FOUND_LTL
${FOUND_FILE})
if (NOT ${FOUND_LTL} STREQUAL "")
set(VC_LTL_Root ${FOUND_LTL})
endif()
if(NOT DEFINED VC_LTL_Root)
string(REGEX MATCH "\\\\\\\\.+\\\\" FOUND_LTL ${FOUND_FILE})
if (NOT ${FOUND_LTL} STREQUAL "")
set(VC_LTL_Root ${FOUND_LTL})
endif()
endif()
endif()
if(VC_LTL_Root)
include("${VC_LTL_Root}\\config\\config.cmake")
endif()

14
plugins/libs/libs.cmake Normal file
View File

@ -0,0 +1,14 @@
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(Detours ${CMAKE_CURRENT_LIST_DIR}/Detours-4.0.1/lib.X64/detours.lib)
else()
set(Detours ${CMAKE_CURRENT_LIST_DIR}/Detours-4.0.1/lib.X86/detours.lib)
endif()
include_directories(${CMAKE_CURRENT_LIST_DIR})
include_directories(${CMAKE_CURRENT_LIST_DIR}/Detours-4.0.1/include)
if(${CMAKE_SIZEOF_VOID_P} EQUAL 4)
set(LTLPlatform "Win32")
endif()
include("${CMAKE_CURRENT_LIST_DIR}/VC-LTL helper for cmake.cmake")

View File

@ -1,38 +1,16 @@
cmake_minimum_required(VERSION 3.16)
project(shareddllproxy) project(shareddllproxy)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
add_compile_options(
/std:c++17
/MP
/wd4018
/DUNICODE
/D_UNICODE
)
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x64)
else()
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x86)
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(Detours-4.0.1/include)
add_executable(shareddllproxy shareddllproxy.cpp dllinject.cpp ntleas.cpp) add_executable(shareddllproxy shareddllproxy.cpp dllinject.cpp ntleas.cpp)
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
add_library(x64lib magpie.cpp lossless.cpp) add_library(x64lib magpie.cpp lossless.cpp)
target_link_libraries(shareddllproxy x64lib ${CMAKE_SOURCE_DIR}/Detours-4.0.1/lib.X64/detours.lib) target_link_libraries(shareddllproxy x64lib ${Detours})
set_target_properties(shareddllproxy PROPERTIES OUTPUT_NAME "shareddllproxy64") set_target_properties(shareddllproxy PROPERTIES OUTPUT_NAME "shareddllproxy64")
else() else()
add_subdirectory(voiceroid2) add_subdirectory(voiceroid2)
add_library(x86lib dreye.cpp jbj7.cpp kingsoft.cpp le.cpp neospeech.cpp LR.cpp) add_library(x86lib dreye.cpp jbj7.cpp kingsoft.cpp le.cpp neospeech.cpp LR.cpp)
target_link_libraries(shareddllproxy x86lib voiceroid2 ${CMAKE_SOURCE_DIR}/Detours-4.0.1/lib.X86/detours.lib) target_link_libraries(shareddllproxy x86lib voiceroid2 ${Detours})
set_target_properties(shareddllproxy PROPERTIES OUTPUT_NAME "shareddllproxy32") set_target_properties(shareddllproxy PROPERTIES OUTPUT_NAME "shareddllproxy32")
endif() endif()

View File

@ -1,2 +0,0 @@
cmake ./CMakeLists.txt -G "Visual Studio 15 2017" -A win32 -T v141_xp -B ./build/_xp
cmake --build ./build/_xp --config Release --target ALL_BUILD -j 14

View File

@ -1,26 +1,6 @@
cmake_minimum_required(VERSION 3.16)
project(winrtutils) project(winrtutils)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
add_compile_options(
/std:c++17
/MP
/wd4018
/DUNICODE
/D_UNICODE
)
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x64)
else()
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x86)
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}>)
add_library(winrtutils MODULE winrtsnapshot.cpp cinterface.cpp dllmain.cpp pch.cpp winrtocr.cpp ) add_library(winrtutils MODULE winrtsnapshot.cpp cinterface.cpp dllmain.cpp pch.cpp winrtocr.cpp )

View File

@ -1,26 +1,6 @@
cmake_minimum_required(VERSION 3.16)
project(winsharedutils) project(winsharedutils)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
add_compile_options(
/std:c++17
/MP
/wd4018
/DUNICODE
/D_UNICODE
)
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x64)
else()
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x86)
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}>)
add_library(winsharedutils MODULE otsu.cpp cinterface.cpp clipboard.cpp lnk.cpp dllmain.cpp levenshtein.cpp muteprocess.cpp sapi_dll.cpp simplemecab.cpp SimpleBrowser.cpp MWebBrowser.cpp icon.cpp) add_library(winsharedutils MODULE otsu.cpp cinterface.cpp clipboard.cpp lnk.cpp dllmain.cpp levenshtein.cpp muteprocess.cpp sapi_dll.cpp simplemecab.cpp SimpleBrowser.cpp MWebBrowser.cpp icon.cpp)

View File

@ -1,2 +0,0 @@
cmake ./CMakeLists.txt -G "Visual Studio 15 2017" -A win32 -T v141_xp -B ./build/_xp
cmake --build ./build/_xp --config Release --target ALL_BUILD -j 14