treat string as full line
This commit is contained in:
parent
e896cb033f
commit
ad20ca360d
@ -49,6 +49,7 @@ void TextThread::Push(BYTE* data, int length)
|
||||
if (hp.type & USING_UNICODE) buffer.append((wchar_t*)data, length / sizeof(wchar_t));
|
||||
else if (auto converted = Util::StringToWideString(std::string((char*)data, length), hp.codepage ? hp.codepage : Host::defaultCodepage)) buffer.append(converted.value());
|
||||
else Host::AddConsoleOutput(INVALID_CODEPAGE);
|
||||
if (hp.type & FULL_STRING) buffer.push_back(L'\n');
|
||||
lastPushTime = GetTickCount();
|
||||
|
||||
if (filterRepetition)
|
||||
@ -62,7 +63,7 @@ void TextThread::Push(BYTE* data, int length)
|
||||
}
|
||||
}
|
||||
|
||||
if (flushDelay == 0 && hp.type & USING_STRING)
|
||||
if (flushDelay == 0 && hp.type & FULL_STRING)
|
||||
{
|
||||
AddSentence(std::move(buffer));
|
||||
buffer.clear();
|
||||
|
@ -102,11 +102,20 @@ namespace
|
||||
}
|
||||
HCode.erase(0, 1);
|
||||
|
||||
// [null_length<]
|
||||
if ((hp.type & USING_STRING) && std::regex_search(HCode, match, std::wregex(L"^([0-9]+)<")))
|
||||
if ((hp.type & USING_STRING))
|
||||
{
|
||||
hp.null_length = std::stoi(match[1]);
|
||||
HCode.erase(0, match[0].length());
|
||||
if (HCode[0] == L'F')
|
||||
{
|
||||
hp.type |= FULL_STRING;
|
||||
HCode.erase(0, 1);
|
||||
}
|
||||
|
||||
// [null_length<]
|
||||
if (std::regex_search(HCode, match, std::wregex(L"^([0-9]+)<")))
|
||||
{
|
||||
hp.null_length = std::stoi(match[1]);
|
||||
HCode.erase(0, match[0].length());
|
||||
}
|
||||
}
|
||||
|
||||
// [N]
|
||||
@ -226,6 +235,8 @@ namespace
|
||||
else HCode << "B";
|
||||
}
|
||||
|
||||
if (hp.type & FULL_STRING) HCode << "F";
|
||||
|
||||
if (hp.null_length != 0) HCode << hp.null_length << "<";
|
||||
|
||||
if (hp.type & NO_CONTEXT) HCode << "N";
|
||||
|
@ -27,6 +27,7 @@ enum HookParamType : unsigned
|
||||
HOOK_EMPTY = 0x800,
|
||||
FIXING_SPLIT = 0x1000,
|
||||
DIRECT_READ = 0x2000, // /R read code instead of classic /H hook code
|
||||
HOOK_ENGINE = 0x4000,
|
||||
HOOK_ADDITIONAL = 0x8000,
|
||||
FULL_STRING = 0x4000,
|
||||
HOOK_ENGINE = 0x8000,
|
||||
HOOK_ADDITIONAL = 0x10000,
|
||||
};
|
||||
|
3
text.cpp
3
text.cpp
@ -29,12 +29,13 @@ Enter read code
|
||||
R{S|Q|V}[null_length<][codepage#]@addr
|
||||
OR
|
||||
Enter hook code
|
||||
H{A|B|W|S|Q|V}[null_length<][N][codepage#][padding+]data_offset[*deref_offset][:split_offset[*deref_offset]]@addr[:module[:func]]
|
||||
H{A|B|W|S|Q|V}[F][null_length<][N][codepage#][padding+]data_offset[*deref_offset][:split_offset[*deref_offset]]@addr[:module[:func]]
|
||||
All numbers except codepage/null_length in hexadecimal
|
||||
Default codepage is 932 (Shift-JIS) but this can be changed in settings
|
||||
A/B: codepage char little/big endian
|
||||
W: UTF-16 char
|
||||
S/Q/V: codepage/UTF-16/UTF-8 string
|
||||
F: treat strings as full lines of text
|
||||
N: don't use context
|
||||
null_length: length of null terminator used for string
|
||||
padding: length of padding data before string (C struct { int64_t size; char string[500]; } needs padding = 8)
|
||||
|
Loading…
Reference in New Issue
Block a user