Repository navigation
Expand file tree
/
Copy pathHACKING.txt
More file actions
105 lines (81 loc) · 3.86 KB
/
Copy pathHACKING.txt
File metadata and controls
105 lines (81 loc) · 3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
For those who want to hack PIME, here is a simple hacking guide.
PIME has a server/client architecture.
The client part is a text service dll file written in C++ and Windows TSF.
The server part can be written in any scripting language (currently python and node.js).
The text service dll is just a thin client and is only responsible for passing
key events to the server process, and then retrieve the composition results
of current input from the server.
Hence all input method modules are implemented in the server side.
When the user select an input method, Windows loads our dll in the app process.
Then, the client dll communicate with the server process via IPC.
The data sent over IPC are all in json format encoded in UTF-8.
------------------------------------------------------------------------------
The IPC (Inter-Process Communication) Architecture
<user input>
|
(via windows TSF)
|
PIMETextService.dll (client)
|
(via Windows named pipe)
|
PIMELauncher.exe (middleware)
|
(via stdin/stdout)
|
backend services (python or node.js)
------------------------------------------------------------------------------
Debugging
If you encounter issues, you can run PIMELauncher.exe with the following options:
* Open a console window with live debug logs:
PIMELauncher.exe /console
* Dump debug logs to a file (runs in the background without opening a console window):
PIMELauncher.exe /log-file C:\path\to\pime.log
(or: PIMELauncher.exe /log-file=C:\path\to\pime.log)
* Terminate any currently running PIMELauncher instance:
PIMELauncher.exe /quit
* Show available command-line options:
PIMELauncher.exe /help
(or: PIMELauncher.exe /?)
When neither /console nor /log-file is specified (normal background mode), all debug
logging is completely suppressed to avoid unnecessary I/O overhead.
Directory structure
* PIME:
The main TSF text service dll written in C++.
This will be loaded into every app process that uses PIME input methods.
Therefore the dll must support the same CPU architecture as the app processes.
So, you need to build both 64-bit and 32-bit versions of the dll.
Please refer to README.md for details about how to do it with cmake.
* PIMELauncher:
Launches and the backend server processes on demand and monitor their status.
If the backend servers crash, PIMELauncher is responsible for restarting them.
After installation, PIMELauncher will be launched automatically upon every login.
* cmake:
Contains some cmake rules used to override the default configurations.
* installer:
A nice GUI windows installer written with NSIS.
This will handle all the details of registering TSF input methods to Windows and
write some config values to the Windows registry.
* libIME:
A nice C++ wrapper library for TSF. If you want to implement a TSF input method,
consider using this library instead of do all the hard work yourself.
This is an independent library which can be used outside PIME.
* jsoncpp:
Third party library used to handle json data in C++.
* backends.json:
A list of supported backend engines and their parameters.
Currently only python and node.js are supported.
* python:
The python backend of PIME
* python/python3:
The embeddable version of python 3.15 32-bit (python315.dll).
We force the use of this version to avoid any potential conflicts with
existing python installations.
* python/input_methods:
All input method modules implemented using Python 3. If you're trying to implement your
own input method, you should put your module in this directory.
* node
node.js backend of PIME, including node.js 6.3 binaries.
* node/input_methods:
All input method modules implemented using node.js. If you're trying to implement your
own input method, you should put your module in this directory.