EDIT: Doesn't work for newer version of telegram. (yet)
Credits goes to serveral people:
MrMetric - telegramdesktop/tdesktop#2235 (comment)
Afogal - https://gist.github.com/afogal/5ec200f46856b1b776a9a91601c00b87
SijmenSchoon - https://gist.github.com/SijmenSchoon/a24b453f001549bb14562de5078ae1bc
Streetwalrus - https://gist.github.com/Streetwalrus/bb2091bc5761a71e3b7c85d4e4a1ad99
Here is a bash/GDB script to patch telegram (tested on GNU/Linux only):
#/bin/bash
cp Telegram Telegram_backup
gdb --write ./Telegram << EOF
tbreak _ZN3App9initMediaEv
set {char}_ZN3App9msgRadiusEv=0xB8
set {int}(_ZN3App9msgRadiusEv+1)=3
set {char}(_ZN3App9msgRadiusEv+5)=0xC3
set {char}_Z25replaceStringWithEntitiesRK13QLatin1String5QCharR7QStringP5QListI12EntityInTextEb = 0xC3
set {char [5]}_ZNK5Image10pixCircledEii = { 0x89, 0xD1, 0x89, 0xF2, 0xBE }
set {int}(_ZNK5Image10pixCircledEii+5) = 0x02
set {char}(_ZNK5Image10pixCircledEii+9) = 0xE9
set {int}(_ZNK5Image10pixCircledEii+10) = (_ZNK5Image10pixRoundedE16ImageRoundRadiusii) - (_ZNK5Image10pixCircledEii + 14)
EOF
This replaces the start of App::msgRadius
with
mov $0x3, %eax
retq
In C++, that is return 3
;
Explanation: 0xB8
means mov
a number to %eax
, 3
is the border radius, and 0xC3
is retq
.
The first instruction in replaceStringWithEntities
gets replacemed by a retq
, bypassing it.
I'd like to note that this is forked (uncredited) from something I made: telegramdesktop/tdesktop#2235 (comment)