Skip to content

Instantly share code, notes, and snippets.

@CTXz
Last active January 24, 2023 14:19
Show Gist options
  • Save CTXz/23042d54f8899a5271a0761aba3d898f to your computer and use it in GitHub Desktop.
Save CTXz/23042d54f8899a5271a0761aba3d898f to your computer and use it in GitHub Desktop.
Patches the local libQtGui.so.4 lib of the Gowin FPGA IDE to allow independent theming via a gowin_qt4.conf file instead of using ~/.config/Trolltech.conf. This can be used to fix akward theme related issues such as unreadable text etc.
00000000: 4253 4449 4646 3430 3600 0000 0000 0000 BSDIFF406.......
00000010: 4c00 0000 0000 0000 a0ac ae00 0000 0000 L...............
00000020: 425a 6839 3141 5926 5359 9f6a 31ce 0000 BZh91AY&SY.j1...
00000030: 0770 5040 2402 0000 2040 0040 0520 0031 .pP@$... @.@. .1
00000040: 064c 40d0 c468 a600 0a67 7a78 bb92 29c2 .L@..h...gzx..).
00000050: 8484 fb51 8e70 425a 6839 3141 5926 5359 ...Q.pBZh91AY&SY
00000060: 0bd6 5bb7 0057 ae64 15d0 4428 0001 0004 ..[..W.d..D(....
00000070: 0000 0400 0800 0a20 0050 81a0 6809 aaa0 ....... .P..h...
00000080: 184d 5029 4b3c 0228 58e8 4aa1 556e de37 .MP)K<.(X.J.Un.7
00000090: ddac f244 825a dfe2 ee48 a70a 1201 7acb ...D.Z...H....z.
000000a0: 76e0 425a 6839 1772 4538 5090 0000 0000 v.BZh9.rE8P.....
@CTXz
Copy link
Author

CTXz commented Jan 24, 2023

The patch works by replacing the Trolltech string in this line with gowin_qt4, thus forcing it to look for gowin_qt4.conf instead. This configuration file may then be provided in the local directory of the gwe_ide executable, or in the ~/.config/ folder.

To obtain a patch file, run xxd -r on this hex file. Then apply the patch onto your libQtGui.so.4 binary using bspatch:

$ curl https://gist.githubusercontent.com/CTXz/23042d54f8899a5271a0761aba3d898f/raw/4dc33b666cb94e5767695a5d48a35ea5caea08ce/gowin-ide-libQtGui-custom-conf.patch.hex | xxd -r > gowin-ide-libQtGui-custom-conf.patch
$ mv libQtGui.so.4 libQtGui.so.4.bak && bspatch libQtGui.so.4.bak libQtGui.so.4 gowin-ide-libQtGui-custom-conf.patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment