Build list window after "work complete", size extendable via python modification for less need of scrolling?

moppelg

Chieftain
Joined
Mar 17, 2009
Messages
8
Hello together,

everyone knows the pop up window which appears after a city "work complete". Unfortunately it scales not in its size like in Civ5 for large resolutions, so it remains tiny despite lot of screen place. If you have a lot of cities it becomes later very cumpersome to often always scroll down in the list to select the new desired unit or building.

Do you know the entry point for adapting its size in pixel? "Kathy" in the german Civ forum mentioned its possible definition in a python file. However, couldn't name the specific one. I searched as well in the assets and couldn't find it.

Does anybody know the location of the file needed for the modification?

Best regards

Markus
 

Nightinggale

Deity
Joined
Feb 2, 2009
Messages
5,162
Popup windows are written in the DLL with the size being set by the exe file. Since we can't mod the exe itself, changing the size is problematic. It's possible that there is a setting for it in Resource\Themes or somewhere like that, but I have never been able to find it. To be honest I haven't looked that hard so it's entirely possible that I just missed it.

It is indeed very high on the wishlist as it is a major issue with modern resolutions. The game engine came out in 2005 and it seems to be optimized for 1024x768. Vanilla even struggles with 16:9 resolutions at times because it's a stretched 4:3. Lots of those issues are fixable, but the size of popup windows still eludes the modding community.
 

moppelg

Chieftain
Joined
Mar 17, 2009
Messages
8
Hello Nightlinggale,

thank you for your fast reply. I can confirm your statement of the assembly in the DLL. I even found its position in the *.cpp file of BTS. But as you mention, its size seems to be defined elsewhere.
Your hint with the Themes seemed hot to me, however, I couldn't find a likely spot for a definition of the popup size. To be honest I played with some could-be-spots, but couldn't not find any change in the game. Probably it needs more to commit the change, or I played with the wrong lines.
If one could resolve the large amount of constants used to define the sizes I could try again. Because the size of the popup window is constant with WxH to be 400x~476, so I could search for any of these two numbers. But as I said, I could not find their declaration (hidden in the *.exe?).

Best regards

Markus
 

Nightinggale

Deity
Joined
Feb 2, 2009
Messages
5,162
Could you point me at the .cpp file in question
CvDLLButtonPopup.cpp
The same issue applies to every single popup window, but since the choose production is mentioned, let's stick to that one. It's declared in CvDLLButtonPopup::launchProductionPopup.
The important parts are populating the window details, like
gDLL->getInterfaceIFace()->popupSetHeaderString
gDLL->getInterfaceIFace()->popupAddGenericButton
gDLL->getInterfaceIFace()->popupSetPopupType
and at the end it calls
gDLL->getInterfaceIFace()->popupLaunch

I highly suspect the last one to be the interesting one here.
 

PPQ_Purple

Purple Cube
Joined
Oct 11, 2008
Messages
5,225
Yea, it's no use. I thought when you said that the exe set those sizes that they were constants defined in the exe that get referenced in functions that are available to us. But what's actually happening is that the exe is providing the interface an we are just calling its functions. So we can't access any of that code short of memory hacking or decompilation both of which are very bad ideas.
 

moppelg

Chieftain
Joined
Mar 17, 2009
Messages
8
I just got an idea, okay, we can't change the size. But it is probably possible to modify the window content to be more useful.
What about the additional buttons at the top: [Build 1more][Build 5 more][Build infinite]? (one could remove the "recommendations" to save space).
That would sure require a recompilation of the BTS *.dll right?
Would that *.dll work with most mods (like AdvCiv) or not? It would be unattractive if not ...
 

f1rpo

plastics
Joined
May 22, 2014
Messages
1,588
Location
Germany
[...] So we can't access any of that code short of memory hacking or decompilation both of which are very bad ideas.
I did look at the binary data behind the CvPopup pointer that the EXE passes to the DLL. If there were some values that evidently store the dimensions, then I would have no qualms changing those dimensions through a blind write. But there were no such values to be spotted.
I just got an idea, okay, we can't change the size. But it is probably possible to modify the window content to be more useful. [...] Would that *.dll work with most mods (like AdvCiv) or not? It would be unattractive if not ...
The recommendations are easy to remove in the DLL. All the contents of the popup are added by CvDLLButtonPopup::launchProductionPopup through this interface (part of which Nightinggale already copy-pasted):
CvDLLInterfaceIFaceBase.h#L176
Looks like radio buttons can be added, but their status can probably only be checked in CvDLLButtonPopup::OnOkClicked. I guess clicks on the individual production buttons could be handled there, but, currently, they're handled by CvDLLWidgetData::executeAction. Would be easier to check for modifier keys (Shift, Ctrl, Alt) in that function. On the city screen, Alt-click already produces an item forever, so Alt could also be given that effect on the choose-production popup. Getting this to work in network games may take extra effort – will probably need to inform the other participants that Alt was held.

I don't see a way to make the buttons smaller or to arrange them in two columns.

A recompiled BtS DLL will only be usable for mods that don't have their own DLL (e.g. BUG without BULL). For AdvCiv and other DLL mods, you'd have to obtain the DLL source of the mod, make your changes in there and recompile.
 

moppelg

Chieftain
Joined
Mar 17, 2009
Messages
8
Wow, thanks for your in deep examination of the idea. Doesn't sound like though, that I can handle this. The compatibility disadvantage with other mods can't be dismissed as well. Okay, at least the idea is out there :)
I will keep look from time to time what you great modders are doing out there. Thank you very much for polishing up this fine old game.
 
Top Bottom