Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: What does Dwarf Fortress actually use GTK for?  (Read 2053 times)

agregate

  • Bay Watcher
    • View Profile
What does Dwarf Fortress actually use GTK for?
« on: January 26, 2021, 11:39:41 am »

Hello everyone!
Linux player here, and a bit frustrated that I would like to install dwarf fortress on my gentoo setup like I've done on arch and ubuntu.
The problem I'm facing is that GTK requires librsvg which for some reason the devs have decided to start using rust to develop. To install rust on gentoo requires up to 10gb to compile and takes hours every update. This is not supportable for me.

I'm trying right now to work around this by forcing GTK to install without SVG support (idk if this will work) but my question to the devs or the knowledgeable people of this forum, is why does dwarf fortress even need GTK?

I mean, the game uses OpenGL/SDL/OpenAL and whatnot to do the rendering and sound. SDL windows don't have any dependency on GTK. (I for one write my own games in SDL and have never needed GTK)

Is there some hidden feature that I'm not aware of that means I just have to have this framework installed to be able to play one of my favourite games?
Logged

Clément

  • Bay Watcher
    • View Profile
Re: What does Dwarf Fortress actually use GTK for?
« Reply #1 on: January 26, 2021, 07:25:57 pm »

In libgraphics, it is used for displaying a message box (in win32_compat.cpp). I don't know if it is used in the closed source parts of DF. You may try to tweak libgraphics and replace that message box implementation with something else.

There are existing forks: https://github.com/svenstaro/dwarf_fortress_unfuck, https://github.com/rofl0r/df-libgraphics. The second one has removed gtk dependency but it may be outdated.
« Last Edit: January 26, 2021, 07:32:58 pm by Clément »
Logged

agregate

  • Bay Watcher
    • View Profile
Re: What does Dwarf Fortress actually use GTK for?
« Reply #2 on: February 01, 2021, 10:36:45 am »

That's exactly what I was looking for. Thank you very much! The fact the only thing it is used for is creating dialogs is the windowed/fullscreen prompt is overkill!
« Last Edit: February 01, 2021, 11:09:53 am by agregate »
Logged

agregate

  • Bay Watcher
    • View Profile
Re: What does Dwarf Fortress actually use GTK for?
« Reply #3 on: February 01, 2021, 01:26:35 pm »

For future reference, if anybody else wants to play Dwarf Fortress without GTK being installed, you can use my fork of svenstaro's 'unfucker' at https://github.com/frayment/dwarf_fortress_unfuck which is basically an up to date version of rofl0r's repo and uses cmake instead of scons.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: What does Dwarf Fortress actually use GTK for?
« Reply #4 on: February 02, 2021, 07:08:24 pm »

That's exactly what I was looking for. Thank you very much! The fact the only thing it is used for is creating dialogs is the windowed/fullscreen prompt is overkill!
It also displays other message boxes, e.g. fatal errors.

Regarding your changes, it looks like there's already support for falling back to an ncurses-based dialog if the DISPLAY environment variable isn't set - does this work for you, or is ncurses hard to build? You might be able to just use the existing fallback if that works.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Clément

  • Bay Watcher
    • View Profile
Re: What does Dwarf Fortress actually use GTK for?
« Reply #5 on: February 03, 2021, 05:45:13 am »

The DISPLAY check is a run-time one, it won't remove the dependency. You will still need GTK to run even if the functions are not used. Anyway DISPLAY is required by SDL to create its window.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: What does Dwarf Fortress actually use GTK for?
« Reply #6 on: February 03, 2021, 06:54:47 pm »

Yes, I know - I worded my question poorly. I intended to ask if the existing ncurses dialog implementation worked for on Gentoo without excessive difficulty building dependencies. (From what I remember with dealing with fixing ncurses support on macOS, it's at least partly a runtime-only dependency, so just because it builds as-is might not necessarily mean that it works at runtime.)

If the ncurses dialog implementation does work, my suggestion (or what I intended) was to change the runtime-only check you mentioned to a compile-time check, i.e. always fall back to the ncurses implementation if GTK isn't available at build time.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

agregate

  • Bay Watcher
    • View Profile
Re: What does Dwarf Fortress actually use GTK for?
« Reply #7 on: February 08, 2021, 03:07:33 pm »

Basically what Clément said.

I didn't try to explicitly compile against ncurses because I like to launch it via. my own script which opens a terminal, asks me for my choice via. direct stdin/stdout and launches the game, short and sweet.

Now ncurses is compiled into it, this means that in my game settings I can swap to it, but if I keep it as 2D/GL renderer or whatnot, it will default to stdout. It seems to be a little finickey as it needs to initialise the ncurses renderer before it can display any information which I didn't find worth my time messing with, I don't know enough about the product and the little change is more than enough to get the game working without GTK. I compiled it for the new update that came out and it works beautifully so I have no complaints.

PS: Unless you're asking because that is what you want to achieve for yourself? If so, I could maybe go digging for you.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: What does Dwarf Fortress actually use GTK for?
« Reply #8 on: February 08, 2021, 07:58:11 pm »

No, I'm not looking to achieve anything (but thanks for asking!). I was pointing out that the ncurses dialog implementation should work if you have ncurses available (it even initializes ncurses, so it should work regardless of whether you're using the ncurses or SDL renderer for the game itself), so the separate stdout implementation may not be necessary. Glad it works, though, and I'll stop suggesting things if you're happy with it. :)
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

agregate

  • Bay Watcher
    • View Profile
Re: What does Dwarf Fortress actually use GTK for?
« Reply #9 on: February 09, 2021, 08:15:20 am »

(it even initializes ncurses, so it should work regardless of whether you're using the ncurses or SDL renderer for the game itself)

Damnit you! Now you make me want to go back and experiment with it again... I confess that ncurses would look so much better than what I currently have... I'll post if I end up doing anything during the week. :)
Logged

spinnylights

  • Bay Watcher
  • Wolf Leather Dress
    • View Profile
Re: What does Dwarf Fortress actually use GTK for?
« Reply #10 on: February 27, 2021, 11:50:30 am »

To install rust on gentoo requires up to 10gb to compile and takes hours every update.

By now this is probably a digression, but you can use the rust-bin package if you don't want to compile it. You can also install the virtual rust package and mask out dev-lang/rust to help ensure that nothing brings in the source-based package as a dependency.
Logged
Our little Kinsmen — after Rain / In plenty may be seen, / A Cross and Grumbly multitude / The soiled Ground upon // A needless life, it seemed to me / Until a little Roc / As to a Tavern saucily / Advanced and breakfasted. // As I of He, so Armok, me / I pondered, may have judged, / And left the little Mountain-folk / With Wariness enlarged. —–Emily the Poetic Thorns