Update to share what functions and classes @finnethen and I have worked out so far outside of the budget stuff. Finn has done a lot more than I have in this area while I'm focused on other bits of the API. I like to share this because I still think it would be cool to attract anyone else that might have experience with C++ RE and would like to help. Maybe a prospective programmer would also like to learn :) And who knows, maybe some people might find this interesting!
Note: I ripped the commentary from our project Discord. It's important to know that the original context behind how we talk about these functions is by denoting them with their address in virtual memory, so something like 0x00028F38 or something. All of the names given to functions or classes are what we have given these addresses as we slowly translate the game into an API.
ZTApp (class)
ZTAIMgr (class)
ZTWorldMgr (class)
ZTScenarioMgr (class)
ZTResearchMgr (class)
ZTMarketingMgr (class)
ZTGameMgr (class)
ZTHabitatMgr (class)
ZTMapView (class)
ZTAIMgr (class)
ZTMapView (class)
ZTMessageQueue (class)
UIButton (class)
UIText (class)
UIGraph (class)
Commentary by Finn regarding these classes: "There's this class called `BFRegistry` which essentially contains a mapping between class names as strings and some constructor functions. I need to do a proper write up of this but essentially when I was tracing how this worked through the code there were two groups of very similar code, one was for `ZTAIMgr`, `ZTHabitatMgr` etc and another was mostly `UIText`, `UIButton`, `UIGraph` but it also had `ZTMiniMap`, `ZTMessageQueue`, `ZTMapView`. `ZTMapView` and `ZTMiniMap` all seem obviously `UI` related so I assume `ZTMessageQueue` is too."
Functions within these classes:
Note: Just for readability, I 'redacted' (didn't know what other word to use lol) the assembly stuff in his commentary in square brackets. This isn't top secret stuff, it's mostly because it makes sense to us, but maybe not others:
ZTMarketingMgr::update() (function): Finn says "Looks like it does some kind of calculation to figure out what the marketing cost is and then calls [a function] with the result, which @goosifer previously identified as a function to subtract from the budget."
ZTApp::updategame() (function): Finn says "Managed to match up the ZTApp::updateGame in the beta to ZTCC. Each [constant variable in this function] represents a pointer to each class that is called as part of the core game update loop. For example [one of the constant variables] is `ZTResearchMgr`."
Other classes/functions we have sort of figured out:
GuestManager? (function): Not sure exactly what this does exactly but I traced the guest number counter to this function. It's the only function that uses the guest counter so I have to assume this is how guest names are assigned, plus a bunch of other guest-related functionality. It uses the _cdecl calling convention so it doesn't seem to be a part of a greater class, but I could be wrong.
Cheat/Easter Egg (function): By looking for the function that calls the Jonathan Gilmour function, I found the one that calls all of the other cheats in the game (at least ones that involve naming a guest something to get something cool in return). The coolest thing about this is it might show us how guests are getting named. The graph tree for this is massive btw.
AI Action Factory? (class): Finn says "This class contains two virtual methods (0x413a23, 0x413acd) that contain massive switch statements where each case initialises a different class. There's no overlap between the classes that the two functions can return, but all classes in both functions are 24 bytes. Only seems to be used when an AI actor is present on the map and the game is unpaused, which is what leads me to believe it's related to AI actions."
An assortment of other functions discovered by Finn and I that seem more utility in nature or are just older (everything above is new):
Note: if it sounds silly that our commentary speculates on the purpose behind a function despite the name sounding definitive, just remember that the names given to these functions are speculative until we can absolutely guarantee their purpose. Until we can test all of the functions in-game like I have extensively done the addToBudget, they will remain speculative:
jonathanGilmour() (function): In 2002, Jonathan Gilmour won the Ultimate Zookeeper award from Microsoft. Blue Fang then decided to put him in the game as a tribute. Rename any male zookeeper 'Jonathan Gilmour' and you get $20,000. That triggers this function.
recalcBudget() (function): The idea that it's recalculating the budget is an educated guess, and honestly probably not an accurate name. More like an event listener? One of the things that I know this function is doing is taking action whenever the budget goes down to 0. It's a little more complicated than that though because the $10,000 you get when budget goes down lives somewhere else I believe.
main() (function): I think this might actually be the main message loop. It's looking likely that the game combined the message loop with the main loop. It makes sense since this isn't an input-heavy game and mostly relies on left clicking objects or menu presses.
jonathanGilmourCFGParse() (function): In order for the Gilmour cheat to work, you need a .cfg in the root Zoo Tycoon folder. I believe that this function parses that file.
addToBudget() (function): Adds funds to zoo budget. I have described this one to death in this thread lol.
subtractFromBudget() (function): Same as addToBudget but, well, the opposite actually.
logging() (function): Finn says "This function performs logging. I believe [parameters] 4, 5 and 6 are potential values for substituting into the log message via `sprintf`, but this doesn't seem to happen in ZTCC, only in the vanilla beta."
An important note is that we still have our work cut out for us in order to contextualize a lot of these classes found. Many of them have been mapped to virtual memory locations and that's why they're in this post, which means that as a result we laid the groundwork to get them into the API. I also say this because we still need to figure out what the methods/functions within the classes mentioned above actually do and potentially rewrite them to C++ so that they're usable.