Hello, new progress update!
I finally figured out how to always get the correct memory location of my target values. Sadly not much time to get into detail this time (midterms tomorrow!), but it's probably best for everyone's sanity. š I am not kidding when I say I have been obsessing over this project, it's so much fun! Not great for my grades though...
Anyway, first two API functions complete: getBudgetValue(..) and setBudgetValue(..). They're pretty easy to understand.
Here's some screenshots (keep track of the budget!):
My API code that runs the mod:
// read the value and pointer to budget location
DWORD budgetPointer = getBudgetValue(ptr, 0x08, 4, bytes_read, budget);
// write new value to budget location
bool success = setBudgetValue(zooHandle, budgetPointer, floatToUint(100000.0), oldprotect, bytes_written);
// error handling
if (success == FALSE)
{
std::cerr << "Failed to write process memory. Error code: " << GetLastError() << std::endl;
return 1;
}
else
{
std::cout << "SUCCESS: You have set the zoo's budget from " << uintToFloat(budget) << " to " << uintToFloat(newBudget) << "\n";
}
*beep boop, robot noises*
Success screenshot:
Zoo right after budget update:
I mentioned before that I haven't looked for other values yet, and that's because I want to make sure that I test everything out first and make sure I understand how APIs are made. Here is that list again:
Stretch Goals
Short term in order of priority:
Translate the first two functions I found into C++ (almost done!)
Create a .dll wrapper that will allow my API to hook onto the zoo.exe file when it runs
Test, test, test. Any volunteers? Highly recommend a virtual machine setup. I can show you how.
Start pushing code to Github and share repository with community
Discover more functions
Long term:
Figure out why there are ID limitations for some objects/buildings. Is there a way to expand capacity?
Create functionality in my dll that looks for a separate mod folder from the usual one in Zoo Tycoon. That way mods that use the API are separate.
Next goal is to find a way to hook a .dll wrapper that will let people use my API. Mods using my API would require running an exe otherwise, and I'd rather it just be a dll file to copy/paste. Maybe I'll make a few mods afterward as proof-of-concept, I got a few ideas!
Speaking of which, I think I accidentally found the bit of code responsible for automatically naming guests ("Guest 1, 2, 3, 4..."). I happen to use a library often that generates synthetic data for things like data sets (statistics and data science nerds love this stuff). I think it would be cool to use it to make random, original names for our guests. I'll see if I can probe the assembly code and figure it out! Actually, I think Iām the nerdā¦š¤
Question for you guys: what API calls would be interesting to probe for? In other words: I found the budget and made it modifiable (I reckon it already was though). Anyone have a wishlist?
Alright, bedtime. Considering my pace, see you guys in two weeks lol.