Decompile fn_17793 (CLanguageBase::Message)
Batch #16516 by SapitoSucio: 0 byte-identical, 1 confirmed by peer review. - fn_17793 CLanguageBase::Message: logic confirmed by peer review Peer-reviewed-by: eAthena, Yommy Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
08ecf72bb6
commit
56b685eefc
1 changed files with 17 additions and 15 deletions
|
|
@ -12,13 +12,13 @@
|
|||
// OFFSET: 0x00ACEF00
|
||||
// FUNCTION: fn_17793
|
||||
LRESULT CLanguageBase::Message(HWND, UINT message, WPARAM value, LPARAM flags, std::uint8_t& handled) {
|
||||
const auto options = static_cast<std::uint16_t>(flags);
|
||||
|
||||
switch (message) {
|
||||
case WM_INPUTLANGCHANGE:
|
||||
this->language = options;
|
||||
this->codePage = g_inlineCharset ? LanguageCodePage(options) : g_textCodePage;
|
||||
case WM_INPUTLANGCHANGE: {
|
||||
const auto language = static_cast<std::uint16_t>(flags);
|
||||
this->language = language;
|
||||
this->codePage = g_inlineCharset ? LanguageCodePage(language) : g_textCodePage;
|
||||
break;
|
||||
}
|
||||
case WM_IME_STARTCOMPOSITION:
|
||||
this->ResetState();
|
||||
this->DeleteSelection();
|
||||
|
|
@ -27,13 +27,13 @@ LRESULT CLanguageBase::Message(HWND, UINT message, WPARAM value, LPARAM flags, s
|
|||
this->EndComposition();
|
||||
this->candidate.assign("", 0);
|
||||
break;
|
||||
case WM_IME_COMPOSITION:
|
||||
if (options & GCS_COMPSTR) {
|
||||
case WM_IME_COMPOSITION: {
|
||||
if (flags & GCS_COMPSTR) {
|
||||
this->RefreshComposition();
|
||||
this->ResetCandidate();
|
||||
}
|
||||
|
||||
if (options & GCS_CURSORPOS) {
|
||||
if (flags & GCS_CURSORPOS) {
|
||||
HIMC context = ImmGetContext(hWnd);
|
||||
if (context) {
|
||||
ImmGetCompositionStringA(context, GCS_CURSORPOS, &this->compositionCursor, sizeof(this->compositionCursor));
|
||||
|
|
@ -43,7 +43,7 @@ LRESULT CLanguageBase::Message(HWND, UINT message, WPARAM value, LPARAM flags, s
|
|||
}
|
||||
}
|
||||
|
||||
if (options & GCS_RESULTSTR) {
|
||||
if (flags & GCS_RESULTSTR) {
|
||||
HIMC context = ImmGetContext(hWnd);
|
||||
if (context) {
|
||||
WCHAR wide[256];
|
||||
|
|
@ -51,10 +51,6 @@ LRESULT CLanguageBase::Message(HWND, UINT message, WPARAM value, LPARAM flags, s
|
|||
const auto bytes = static_cast<std::uint32_t>(ImmGetCompositionStringW(context, GCS_RESULTSTR, wide, sizeof(wide)));
|
||||
const unsigned size = WideCharToMultiByte(this->codePage, 0, wide, bytes >> 1, converted, sizeof(converted), nullptr, nullptr);
|
||||
|
||||
if (size >= sizeof(converted)) {
|
||||
__fastfail(FAST_FAIL_RANGE_CHECK_FAILURE);
|
||||
}
|
||||
|
||||
converted[size] = 0;
|
||||
ImmReleaseContext(hWnd, context);
|
||||
this->Insert(converted);
|
||||
|
|
@ -63,8 +59,11 @@ LRESULT CLanguageBase::Message(HWND, UINT message, WPARAM value, LPARAM flags, s
|
|||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_IME_NOTIFY:
|
||||
if (value == IMN_OPENCANDIDATE || value == IMN_CHANGECANDIDATE) {
|
||||
switch (value) {
|
||||
case IMN_CHANGECANDIDATE:
|
||||
case IMN_OPENCANDIDATE: {
|
||||
HIMC context = ImmGetContext(hWnd);
|
||||
if (context) {
|
||||
const auto bytes = ImmGetCandidateListW(context, 0, nullptr, 0);
|
||||
|
|
@ -83,8 +82,11 @@ LRESULT CLanguageBase::Message(HWND, UINT message, WPARAM value, LPARAM flags, s
|
|||
} else {
|
||||
this->candidateCount = 0;
|
||||
}
|
||||
} else if (value == IMN_CLOSECANDIDATE) {
|
||||
break;
|
||||
}
|
||||
case IMN_CLOSECANDIDATE:
|
||||
this->candidateCount = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue