text.h
3.26 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
105
106
107
/* Copyright (C) 2010-2011 kaosu (qiupf2000@gmail.com)
* This file is part of the Interactive Text Hooker.
* Interactive Text Hooker is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "main.h"
#include "main_template.h"
class TextBuffer : public MyVector<BYTE, 0x800>
{
public:
TextBuffer();
virtual ~TextBuffer();
void AddText(BYTE* text,size_t len,bool);
void ReplaceSentence(BYTE* text, size_t len);
void Flush();
void ClearBuffer();
void SetUnicode(bool mode);
void SetLine();
void SetFlushTimer(UINT_PTR t);
private:
UINT_PTR timer;
bool line;
bool unicode;
};
struct RepeatCountNode
{
short repeat;
short count;
RepeatCountNode* next;
};
struct ThreadParameter
{
UINT_PTR pid;
UINT_PTR hook;
UINT_PTR retn;
UINT_PTR spl;
};
#define COUNT_PER_FOWARD 0x200
#define REPEAT_DETECT 0x10000
#define REPEAT_SUPPRESS 0x20000
#define REPEAT_NEWLINE 0x40000
class TextThread : public MyVector<BYTE, 0x200>
{
public:
TextThread(UINT_PTR pid, UINT_PTR hook, UINT_PTR retn, UINT_PTR spl, UINT_PTR num);
virtual ~TextThread();
void Reset();
void AddToStore(BYTE* con,size_t len, bool new_line=false, bool console=false);
void RemoveSingleRepeat(BYTE* con, size_t &len);
void RemoveCyclicRepeat(BYTE* &con, size_t &len);
void AddLineBreak();
void ResetEditText();
void ComboSelectCurrent();
void GetEntryString(LPWSTR str);
void CopyLastSentence(LPWSTR str);
void CopyLastToClipboard();
void AdjustPrevRepeat(UINT_PTR len);
void PrevRepeatLength(UINT_PTR &len);
void SetComment(LPWSTR);
void SetNewLineTimer();
bool AddToCombo();
bool RemoveFromCombo();
bool CheckCycle(TextThread* start);
inline UINT_PTR PID() const {return tp.pid;}
inline UINT_PTR Addr() const {return tp.hook;}
inline UINT_PTR& Status() {return status;}
inline UINT_PTR Number() const {return number;}
inline WORD& Last() {return last;}
inline UINT_PTR& LinkNumber() {return link_number;}
inline UINT_PTR& Timer() {return timer;}
inline ThreadParameter* GetThreadParameter() {return &tp;}
inline TextThread*& Link() {return link;}
inline void SetNewLineFlag();
inline void SetRepeatFlag();
inline void ClearNewLineFlag();
inline void ClearRepeatFlag();
inline LPWSTR GetComment() {return comment;}
private:
ThreadParameter tp;
UINT_PTR number,link_number;
WORD last,reserved;
WORD repeat_single;
WORD repeat_single_current;
WORD repeat_single_count;
WORD repeat_detect_count;
RepeatCountNode* head;
TextThread *link;
LPWSTR comment,thread_string;
UINT_PTR timer;
UINT_PTR status,last_time,repeat_detect_limit;
UINT_PTR last_sentence,prev_sentence,sentence_length,repeat_index;
};