Note: I won't update this gist anymore, please see my dotfiles repo for future updates.
Here is a bash/GDB script to fix it (tested on GNU/Linux only):
#!/bin/bash
gdb /usr/bin/telegram-desktop << EOF
tbreak _ZN3App9initMediaEv
commands
set {char}_ZN3App9msgRadiusEv=0xB8
set {int}(_ZN3App9msgRadiusEv+1)=3
set {char}(_ZN3App9msgRadiusEv+5)=0xC3
set {char}_ZN13TextUtilities21ReplaceStringWithCharERK13QLatin1String5QCharR16TextWithEntitiesb = 0xC3
set {char}(_ZNK5Image10pixCircledEii+0) = 0x41
set {char}(_ZNK5Image10pixCircledEii+1) = 0xB8
set {int}(_ZNK5Image10pixCircledEii+2) = 0x0F
set {char}(_ZNK5Image10pixCircledEii+6) = 0xB9
set {int}(_ZNK5Image10pixCircledEii+7) = 0x01
set {char}(_ZNK5Image10pixCircledEii+11) = 0xE9
set {int}(_ZNK5Image10pixCircledEii+12) = (_ZNK5Image10pixRoundedEii16ImageRoundRadiusN4base5flagsI16ImageRoundCornerEE) - (_ZNK5Image10pixCircledEii + 16)
end
run
detach
quit
EOF
Just run it instead of the usual Telegram binary and you're set.
This replaces the start of App::msgRadius
with
mov $0x3, %eax
retq
In C++, that is return 3
;
The first instruction in replaceStringWithEntities
gets replacemed by a retq
, bypassing it.
pixCircled
's beginning is replaced with loading extra arguments (0x0F
for all corners rounded and 0x01
for big corner radius) and a jump to pixRounded
.
I'd like to note that this is forked (uncredited) from something I made: telegramdesktop/tdesktop#2235 (comment)