Decompile 70 functions in Source/Client/Browser/BrowserFactory.cpp, Source/Contents/Emblems/EmblemUpload.cpp, ...

Batch #1665 by ragnarok-clanker: 0 byte-identical, 70 confirmed by peer review.

- fn_10904 UIEditCtrl::UpdateLinks: logic confirmed by peer review
- fn_10905 EditViewport::Synchronize: logic confirmed by peer review
- fn_10950 UIBalloonText::SetText: logic confirmed by peer review
- fn_11216 ItemLinkDisplay::Convert: logic confirmed by peer review
- fn_11326 UIListBox::Slot15: logic confirmed by peer review (already on main)
- fn_11327 UIListBoxEx::Slot15: logic confirmed by peer review (already on main)
- fn_11366 UIListBox::Paint: logic confirmed by peer review
- fn_11367 UIListBoxEx::Paint: logic confirmed by peer review
- fn_11392 UITextButton::Paint: logic confirmed by peer review
- fn_11394 UITextViewer::Paint: logic confirmed by peer review
- fn_11445 UITextButton::Slot31: logic confirmed by peer review (already on main)
- fn_11471 UITextButton::Slot27: logic confirmed by peer review (already on main)
- fn_11494 UITextButton::Slot33: logic confirmed by peer review (already on main)
- fn_11562 UITextViewer::SendMsg: logic confirmed by peer review (already on main)
- fn_11721 UICntWnd::DrawBorder: logic confirmed by peer review (already on main)
- fn_11760 UIBank_NewWnd::Paint: logic confirmed by peer review (already on main)
- fn_11761 UIChatRoomWnd::Paint: logic confirmed by peer review (already on main)
- fn_11767 UIMerInfoWnd::Paint: logic confirmed by peer review (already on main)
- fn_12680 ShortcutPainting::Paint: logic confirmed by peer review
- fn_13829 WrapPlainText: logic confirmed by peer review
- fn_13833 WrapRichText: logic confirmed by peer review
- fn_16941 UIWindow::DrawAmount: logic confirmed by peer review
- fn_16971 UIWindow::TextHeight: logic confirmed by peer review
- fn_16972 UIWindow::VerticalTextHeight: logic confirmed by peer review
- fn_16973 UIWindow::TextSize: logic confirmed by peer review
- fn_16974 UIWindow::VerticalTextSize: logic confirmed by peer review
- fn_16975 UIWindow::TextWidth: logic confirmed by peer review
- fn_16993 WrapPixelText: logic confirmed by peer review
- fn_17007 FitText: logic confirmed by peer review
- fn_17009 UIWindow::DrawTextAt: logic confirmed by peer review
- fn_17013 DrawOutlinedColoredText: logic confirmed by peer review
- fn_17014 DrawStyledColoredText: logic confirmed by peer review
- fn_17015 DrawColoredText: logic confirmed by peer review
- fn_17016 DrawOutlinedText: logic confirmed by peer review
- fn_17136 BrowserFactory::Create: logic confirmed by peer review
- fn_18376 LookupMessage: logic confirmed by peer review
- fn_01934 TextContext::TextContext: logic confirmed by peer review
- fn_01957 TextContext::Marker: logic confirmed by peer review
- fn_01961 TextContext::Measure: logic confirmed by peer review
- fn_01966 TextContext::SetFont: logic confirmed by peer review
- fn_01970 TextContext::DrawPair: logic confirmed by peer review
- fn_01971 TextContext::Draw: logic confirmed by peer review
- fn_01983 TextContext::MeasurePart: logic confirmed by peer review
- fn_01984 TextContext::DrawPart: logic confirmed by peer review
- fn_21788 ReceivePartyJoinResult: logic confirmed by peer review
- fn_24191 EmotionHotkeys::LoadDefaults: logic confirmed by peer review
- fn_03664 CAdventurerAgencyMgr::CompletePartyInfo: logic confirmed by peer review
- fn_03666 CAdventurerAgencyMgr::CompleteRegistration: logic confirmed by peer review
- fn_03668 CAdventurerAgencyMgr::CompleteStopRecruiting: logic confirmed by peer review
- fn_03976 CEmblemDataMgr::CompleteUpload: logic confirmed by peer review
- fn_04239 CMCStoreInfoBackup::CompleteSave: logic confirmed by peer review
- fn_04262 CPlayerNameDictionary::Lookup: logic confirmed by peer review
- fn_06581 ItemNaming::DisplayName: logic confirmed by peer review (already on main)
- fn_06583 ItemNamingContext::Element: logic confirmed by peer review (already on main)
- fn_06584 ItemNamingContext::Star: logic confirmed by peer review (already on main)
- fn_06585 ItemNaming::Creator: logic confirmed by peer review (already on main)
- fn_06586 ItemNamingContext::Apprentice: logic confirmed by peer review (already on main)
- fn_06587 ItemNaming::Suffixes: logic confirmed by peer review (already on main)
- fn_06588 ItemNaming::Prefixes: logic confirmed by peer review (already on main)
- fn_09299 UIApplyForPartyWnd::Slot15: logic confirmed by peer review
- fn_09300 UIRegisterPartyWnd::Slot15: logic confirmed by peer review
- fn_09301 UIRequestJoinPartyWnd::Slot15: logic confirmed by peer review
- fn_09303 UIApplyForPartyWnd::Paint: logic confirmed by peer review
- fn_09304 UIPartyInfoWnd::Paint: logic confirmed by peer review
- fn_10748 UIEditCtrl::RemoveInvalidLink: logic confirmed by peer review
- fn_10758 UIEditCtrl::DrawSelectionAt: logic confirmed by peer review (already on main)
- fn_10759 UIEditCtrl::DrawSelection: logic confirmed by peer review (already on main)
- fn_10794 UIBasicButton::Paint: logic confirmed by peer review
- fn_10799 UIBmpTextButton::Paint: logic confirmed by peer review
- fn_10823 UITransBalloonText::Paint: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
This commit is contained in:
ragnarok-clanker 2026-10-28 19:35:29 +00:00
commit 838c0044d2
43 changed files with 125 additions and 124 deletions

View file

@ -1,6 +1,9 @@
#include "Render/DeviceContext/DeviceContext.h"
#include "Render/Text/FontCache.h"
#include "Render/Text/TextContext.h"
#include "Client/Input/InputCharset.h"
#include "Contents/Configuration/ServiceConfiguration.h"
#include "Utility/Text/TextTokens.h"
#include <algorithm>
#include <bit>
@ -40,7 +43,7 @@ namespace {
// OFFSET: 0x0054D4B0
// FUNCTION: fn_01934
TextContext::TextContext(CDC& surface, FontCache& fonts, const TextLocale& locale) : m_dc(nullptr), m_surface(&surface), m_fonts(&fonts), m_locale(&locale) {
TextContext::TextContext(CDC& surface) : m_dc(nullptr), m_surface(&surface) {
if (surface.GetDC(&this->m_dc)) {
this->m_previous = GetCurrentObject(this->m_dc, OBJ_FONT);
SetBkMode(this->m_dc, TRANSPARENT);
@ -60,18 +63,18 @@ TextContext::~TextContext() {
// FUNCTION: fn_01966
void TextContext::SetFont(int family, int height, unsigned char bold, unsigned char italic) {
if (family == 0) {
switch (this->m_locale->language) {
switch (g_language) {
case 1:
if (this->m_locale->service == 6) {
if (g_serviceType == 6) {
family = 8;
height = (height + 2);
} else {
height = (height + 3);
if (this->m_locale->service == 14) {
if (g_serviceType == 14) {
family = 9;
} else {
family = 1;
if (this->m_locale->serverLanguage && *this->m_locale->serverLanguage == 31) {
if (g_serverLanguage && g_serverLanguage->alternateLanguage == 31) {
family = 6;
}
}
@ -94,10 +97,10 @@ void TextContext::SetFont(int family, int height, unsigned char bold, unsigned c
case 8:
family = 7;
height = (height + 3);
if (this->m_locale->service == 12) {
if (g_serviceType == 12) {
height = (height - 2);
} else if (this->m_locale->service == 18) {
if (*this->m_locale->serverLanguage == 31) {
} else if (g_serviceType == 18) {
if (g_serverLanguage->alternateLanguage == 31) {
family = 6;
} else {
height = (height - 2);
@ -117,7 +120,7 @@ void TextContext::SetFont(int family, int height, unsigned char bold, unsigned c
this->m_family = family;
this->m_height = height;
this->m_charset = this->m_locale->language == 0 && family >= 20 ? charsets[0] : charsets[family];
this->m_charset = g_language == 0 && family >= 20 ? charsets[0] : charsets[family];
this->m_bold = bold;
this->m_italic = italic;
}
@ -182,8 +185,8 @@ unsigned TextContext::CodePage(unsigned charset) {
// OFFSET: 0x0054F2E0
// FUNCTION: fn_01957
unsigned TextContext::Marker(const char* text, unsigned bytes, bool enabled) {
if (!enabled) {
unsigned TextContext::Marker(const char* text, unsigned bytes) {
if (!g_inlineCharset) {
return bytes;
}
@ -238,7 +241,7 @@ SIZE TextContext::MeasurePart(const char* text, int bytes, unsigned charset) {
auto* wide = reinterpret_cast<WCHAR*>(static_cast<char*>(memory) + 8);
const int count = MultiByteToWideChar(CodePage(charset), 0, text, bytes, wide, static_cast<int>(extent));
SelectObject(this->m_dc, this->m_fonts->Get(this->m_family, this->m_height, charset, this->m_bold, this->m_italic));
SelectObject(this->m_dc, g_fontCache.Get(this->m_family, this->m_height, charset, this->m_bold, this->m_italic));
GetTextExtentPoint32W(this->m_dc, wide, count, &size);
if (this->m_italic == 1) {
@ -281,7 +284,7 @@ void TextContext::DrawPart(int x, int y, const char* text, int bytes, unsigned c
auto* wide = reinterpret_cast<WCHAR*>(static_cast<char*>(memory) + 8);
const int count = MultiByteToWideChar(CodePage(this->m_charset), 0, text, bytes, wide, static_cast<int>(extent));
SelectObject(this->m_dc, this->m_fonts->Get(this->m_family, this->m_height, charset, this->m_bold, this->m_italic));
SelectObject(this->m_dc, g_fontCache.Get(this->m_family, this->m_height, charset, this->m_bold, this->m_italic));
TextOutW(this->m_dc, x, y, wide, count);
if (allocation > 0x400) {
@ -292,7 +295,7 @@ void TextContext::DrawPart(int x, int y, const char* text, int bytes, unsigned c
// OFFSET: 0x0054FD00
// FUNCTION: fn_01961
SIZE TextContext::Measure(const char* text, int bytes) {
const int first = Marker(text, bytes, this->m_locale->inlineCharset);
const int first = Marker(text, bytes);
SIZE result = this->MeasurePart(text, first, this->m_charset);
if (first < bytes) {
SIZE second = this->MeasurePart(text + first + 3, bytes - first - 3, InlineCharset(text + first));
@ -306,7 +309,7 @@ SIZE TextContext::Measure(const char* text, int bytes) {
// OFFSET: 0x00550190
// FUNCTION: fn_01970
void TextContext::DrawPair(int x, int y, const char* text, int bytes) {
const int first = Marker(text, bytes, this->m_locale->inlineCharset);
const int first = Marker(text, bytes);
this->DrawPart(x, y, text, first, this->m_charset);
if (first < bytes) {
const SIZE size = this->MeasurePart(text, first, this->m_charset);
@ -317,7 +320,7 @@ void TextContext::DrawPair(int x, int y, const char* text, int bytes) {
// OFFSET: 0x00550220
// FUNCTION: fn_01971
void TextContext::Draw(int x, int y, const char* text, int bytes) {
if (!this->m_locale->inlineCharset) {
if (!g_inlineCharset) {
this->DrawPair(x, y, text, bytes);
return;
}
@ -326,7 +329,7 @@ void TextContext::Draw(int x, int y, const char* text, int bytes) {
int scanned = 0, remaining = bytes;
while (scanned < bytes) {
scanned = (scanned + Marker(text + scanned, remaining, true));
scanned = (scanned + Marker(text + scanned, remaining));
if (scanned >= bytes) {
this->DrawPair(x, y, current, scanned);
return;
@ -336,9 +339,9 @@ void TextContext::Draw(int x, int y, const char* text, int bytes) {
return;
}
const int segment = (Marker(text + scanned + 3, remaining - 3, true) + 3);
const int segment = (Marker(text + scanned + 3, remaining - 3) + 3);
this->DrawPair(x, y, current, segment);
const int first = Marker(current, segment, true);
const int first = Marker(current, segment);
int width = this->MeasurePart(current, first, this->m_charset).cx;
if (first < segment) {

View file

@ -4,7 +4,6 @@
#include <windows.h>
class CDC;
class FontCache;
struct TextLocale {
signed char language;
@ -15,7 +14,7 @@ struct TextLocale {
class TextContext {
public:
TextContext(CDC& surface, FontCache& fonts, const TextLocale& locale);
explicit TextContext(CDC& surface);
~TextContext();
void SetFont(int family, int height, unsigned char bold, unsigned char italic);
void SetColor(COLORREF color);
@ -25,19 +24,18 @@ public:
SIZE Measure(const char* text, int bytes);
void Draw(int x, int y, const char* text, int bytes);
static unsigned CodePage(unsigned charset);
static unsigned Marker(const char* text, unsigned bytes, bool enabled);
static unsigned Marker(const char* text, unsigned bytes);
private:
/* 0000 */ HDC m_dc;
/* 0004 */ HGDIOBJ m_previous;
/* 0008 */ CDC* m_surface;
FontCache* m_fonts;
const TextLocale* m_locale;
int m_family;
int m_height;
unsigned m_charset;
unsigned char m_bold;
unsigned char m_italic;
/* 000C */ int m_family;
/* 0010 */ int m_height;
/* 0014 */ unsigned m_charset;
/* 0018 */ unsigned char unknown_0018[5];
/* 001D */ unsigned char m_bold;
/* 001E */ unsigned char m_italic;
SIZE MeasurePart(const char* text, int bytes, unsigned charset);
void DrawPart(int x, int y, const char* text, int bytes, unsigned charset);
void DrawPair(int x, int y, const char* text, int bytes);