Menu

LEX File Exchange
EA Support Files
SC4 Wikipedia
Network Addon Mod
Dependencies
Chat

Author Topic: Extra Cheats DLL source code.  (Read 7128 times)

0 Members and 1 Guest are viewing this topic.

Offline Buggi

Extra Cheats DLL source code.
« on: August 01, 2008, 11:17:17 AM »
This could be all or part of the source code to the Extra Cheats DLL file I let loose awhile ago. I'm trying to track down more source and knowledge to make more plugins to SC4. Stay tuned.

Code: [Select]
class cSC4ExtraCheatsPluginCOMDirector : public cRZCOMDllDirector{
public:
    GZGUID GetDirectorID() const{
      return kExtraCheatsPluginCOMDirectorDirectorID;
   }

   bool ShouldEnable(){
      // As of October 2006, we have decided to enable this plugin for all uses.

      /*
      bool bReturnValue(false);

      //Do a time check.
      if(cRZDate() < cRZDate(12, 25, 2003))
         bReturnValue = true;

      //Do a network address check.
      if(!bReturnValue){
         cRZINetSocketAddress socketAddress;

         if(cRZINetSocketAddress::GetThisMachinesAddressStatic(socketAddress)){
            cRZString sAddress((RZChar)0, 32);

            if(socketAddress.ConvertAddressToStringDottedDecimal(socketAddress.GetNetworkAddress(), &sAddress[0])){
               if(sAddress.find("10.24.") == 0) //All Maxis IP addresses start with this.
                  bReturnValue = true;
               if(sAddress.find("10.14.") == 0) //All Electronic Arts Redwood shores IP addresses start with this.
                  bReturnValue = true;
            }
         }
      }

      return bReturnValue;
      */
   }

   bool PreAppInit(){
      cIGZFramework* const pFramework = RZGetFrameWork();
      if(pFramework){
         cIGZApp* const pApp = pFramework->Application();
         if(pApp){
            cRZAutoRefCount<cISC4App> pISC4App;
            if(pApp->QueryInterface(kGZIID_cISC4App, pISC4App.AsPPVoidParam()))
               pISC4App->SetDebugFunctionalityEnabled(true);
         }
      }
      return true;
   }

    bool OnStart(cIGZCOM* pCOM){
      if(ShouldEnable()){
         cIGZFramework* const pFramework = RZGetFrameWork();
         if(pFramework){
            if(pFramework->GetState() < cIGZFramework::kStatePreAppInit)
                 pFramework->AddHook(this);
              else
               PreAppInit();
         }
         return true;
      }
      return false;
    }
};

Offline JoeST

  • Forums Guru
  • *
  • Posts: 2648
  • Total likes: 15
  • Reputation: 10
  • fbstj
  • CL: Not your average...
Re: Extra Cheats DLL source code.
« Reply #1 on: August 01, 2008, 12:37:37 PM »
Thanks buggi, lets hope someone can find some use for it :)

Joe
Copperminds and Cuddleswarms

Offline jeronij

Re: Extra Cheats DLL source code.
« Reply #2 on: August 02, 2008, 11:48:12 AM »
Interesting so far ...  :thumbsup:
I'll stay tuned  ;)
I am currently not active - Please, contact Tarkus for any site related matter. Thanks for enjoying SC4D :D


Autism Awareness;  A Father Shares
Mallorca My Mayor Diary


Offline Jonathan

  • NAM Team
  • Forums Guru
  • *
  • Posts: 2609
  • Total likes: 5
  • Reputation: 25
  • CL: Einstein, Jr. &scl()
Re: Extra Cheats DLL source code.
« Reply #3 on: August 06, 2008, 04:17:25 PM »
Does anyone remember the work GoaSkin was doing on submenus?

I don't know programming, but what Buggi posted looks similar to the bits Goaskin posted in his/her various threads. Could this code be used to make real submenus, mixed up with Goaskin's code?

Offline GoaSkin

  • NAM Team
  • Forums Mayor
  • *
  • Posts: 204
  • Total likes: 0
  • Reputation: 3
  • Kopyright Liberation Front
Re: Extra Cheats DLL source code.
« Reply #4 on: August 09, 2008, 11:33:48 AM »
For a new submenu, three functions have to be modified (four if the menu can handle utilities identified by a SubmenuKeyType parameter too).

At first:
Code: [Select]
cSC4View3DWin::HandleButtonActivated(cIGZWin*, cGZMessage&)
This function is called when any UI button has been pushed. Every button contains a button ID. This function calls the next functions if a specific button ID has been entered. Here, a new button ID has to be added (by pattern like the others) calling either

Code: [Select]
cSC4View3DWin::DoLandscapeMenu(cIGZWin*, cGZMessage&)
cSC4View3DWin::DoZoningMenu(cIGZWin*, cGZMessage&)
cSC4View3DWin::DoUtilitiesMenu(cIGZWin*, cGZMessage&)
cSC4View3DWin::DoTransportMenu(cIGZWin*, cGZMessage&)

if the menu can handle utilities (identified by SubMenuKeyType parameter in exemplar) and buildings (identified by occupantgroup)

In these functions, the button-click event is handled again. The button ID (from UI) is checked and for listed IDs, a submenu is opened listing all the tools with a specific submenuKeyType in it's exemplars).

These functions call at next

Code: [Select]
cSC4View3DWin::CreateBuildingMenu(unsigned long, std::set<unsigned long, std::less<unsigned long>, std::allocator<unsigned long> > const&, std::set<unsigned long, std::less<unsigned long>, std::allocator<unsigned long> > const&, unsigned long, long)

This function adds LOTs to the menu with specific occupant groups. For the button IDs of non-utility menus, this funtion is called by the function HandleButtonActivated directly.

At least, these functions are easy event-handling functions that call invokePrimaryMenu, invokeSecondaryMenu and InvokeTertiaryMenu. These functions handle the illustration of the menus.


Experimentally, I am playing with a modified program file where I added the assembler code to have one more transport submenu. It isn't possible to write a patch because the windows binary is safedisc-encrypted (the mac binary not and the cracked EXE also not...)

As far as I understand the binary, not every function can be replaced by a DLL. It seems like the replaceable functions are listed...



download SC4Config public BETA (RC1)

Offline Jonathan

  • NAM Team
  • Forums Guru
  • *
  • Posts: 2609
  • Total likes: 5
  • Reputation: 25
  • CL: Einstein, Jr. &scl()
Re: Extra Cheats DLL source code.
« Reply #5 on: August 09, 2008, 11:48:31 AM »
So in a basic answer for a basic person, does the code from Buggi change anything?

Sorry, but I only got a tiny bit of that post. :)

Offline GoaSkin

  • NAM Team
  • Forums Mayor
  • *
  • Posts: 204
  • Total likes: 0
  • Reputation: 3
  • Kopyright Liberation Front
Re: Extra Cheats DLL source code.
« Reply #6 on: August 09, 2008, 12:18:58 PM »
The post from buggi does not help until we have the c++ source of the original functions. And it cannot be compiled without having a kind of simcity-sdk.

download SC4Config public BETA (RC1)

Offline JoeST

  • Forums Guru
  • *
  • Posts: 2648
  • Total likes: 15
  • Reputation: 10
  • fbstj
  • CL: Not your average...
Re: Extra Cheats DLL source code.
« Reply #7 on: August 09, 2008, 12:21:22 PM »
so all in all its pretty useless without some other code/programs?

Joe
Copperminds and Cuddleswarms

Offline Andreas

  • Administrator
  • Forums Legend
  • *
  • Posts: 4775
  • Total likes: 987
  • Reputation: 33
    • SimCityPlaza
  • CL: ()bobby() Transit Controller
Re: Extra Cheats DLL source code.
« Reply #8 on: August 09, 2008, 01:50:49 PM »
Yes, I guess so. I'm not a programmer, but it appears that the source code that buggi posted is nothing more than a "proof" that you can unlock hidden functions in the game (which have been there before, but are not accessible without the DLL). After all, the new "cheats" are mostly debug functions that were used by the developers to test the game (and which can be used by the custom content creators to test their BATs or new NAM stuff, for instance).
Andreas

Offline GoaSkin

  • NAM Team
  • Forums Mayor
  • *
  • Posts: 204
  • Total likes: 0
  • Reputation: 3
  • Kopyright Liberation Front
Re: Extra Cheats DLL source code.
« Reply #9 on: August 09, 2008, 03:42:04 PM »
You can try to give yourself a private maxis IP and try out if the game shows another behavior. Maybe other decisions for unlocking things depend on the IP too.

download SC4Config public BETA (RC1)

Offline simmaster07

Re: Extra Cheats DLL source code.
« Reply #10 on: May 16, 2016, 02:44:35 PM »
Hey everyone,

Sorry to bump an eight-year-old thread but I think this is a pretty relevant and significant development. Using the original code here, the Aspyr port's symbols and some DLL-related code that Paul Pedriana gave me a while back, I reconstructed the extra cheats DLL.

This code here can be compiled from scratch to produce a DLL that functions identically to the extra cheats DLL:
https://github.com/nsgomez/gzcom-dll/tree/1.2-extracheat/gzcom-dll

The DLL I built from this code can be found here:
https://github.com/nsgomez/gzcom-dll/releases/tag/1.2-extracheat

Thanks buggi, lets hope someone can find some use for it :)

Joe

I know I certainly did :)

Offline JoeST

  • Forums Guru
  • *
  • Posts: 2648
  • Total likes: 15
  • Reputation: 10
  • fbstj
  • CL: Not your average...
Re: Extra Cheats DLL source code.
« Reply #11 on: May 17, 2016, 12:21:24 AM »
Heck yeah heck yeah congrats simmaster!!!!
Copperminds and Cuddleswarms

Offline FrankU

  • It's Frank, the U is just for the suspense
  • BeNeLux Team
  • Forums Guru
  • *
  • Posts: 3348
  • Total likes: 225
  • Reputation: 14
  • Dutch Housing Project
  • CL:
    U Grow It
Re: Extra Cheats DLL source code.
« Reply #12 on: May 17, 2016, 04:33:14 AM »
So, becasue I hardly understand what you are talking about I ask myself: should I replace the extra cheats by the gzcom2.dll? And what are the differences or advantages for a simple user like me?

Offline Andreas

  • Administrator
  • Forums Legend
  • *
  • Posts: 4775
  • Total likes: 987
  • Reputation: 33
    • SimCityPlaza
  • CL: ()bobby() Transit Controller
Re: Extra Cheats DLL source code.
« Reply #13 on: May 17, 2016, 05:03:18 AM »
Well, from what I understood, this DLL is identical to the "Extra Cheats DLL", so it's mainly a proof of concept, and for testing purposes. But unlike the previous "SC4 Fix DLL" that simmaster07 made to fix the puzzle piece crash bug, it's not created via "hacking" and reverse engineering, but actually using source code that was provided by the original programmers. This means that the source code is able to produce functional DLLs that interact with some internal game "API", so it might be possible to program other DLLs that provide new or improved features for the game. :)
« Last Edit: May 17, 2016, 05:05:43 AM by Andreas »
Andreas

Offline FrankU

  • It's Frank, the U is just for the suspense
  • BeNeLux Team
  • Forums Guru
  • *
  • Posts: 3348
  • Total likes: 225
  • Reputation: 14
  • Dutch Housing Project
  • CL:
    U Grow It
Re: Extra Cheats DLL source code.
« Reply #14 on: May 17, 2016, 07:02:53 AM »
OK, so we have new light at the end of one of the tunnels? Sounds like a good opportunity!

Offline simmaster07

Re: Extra Cheats DLL source code.
« Reply #15 on: May 17, 2016, 12:28:30 PM »
Andreas summarized the significance of the code pretty well.

It's worth noting that the API shown in my repo is far from complete. There are entire sections of the code like this:
Code: [Select]
virtual intptr_t GetDemolitionUtility(void) = 0;
virtual intptr_t GetHistoryWarehouse(void) = 0;
virtual intptr_t GetLotManager(void) = 0;
virtual intptr_t GetOccupantManager(void) = 0;
virtual intptr_t GetPropManager(void) = 0;
virtual intptr_t GetZoneManager(void) = 0;
virtual intptr_t GetLotConfigurationManager(void) = 0;
virtual intptr_t GetNetworkManager(void) = 0;
virtual intptr_t GetDispatchManager(void) = 0;
virtual intptr_t GetTrafficNetwork(void) = 0;
virtual intptr_t GetPropDeveloper(void) = 0;
virtual intptr_t GetNetworkLotManager(void) = 0;
virtual intptr_t GetVehicleManager(void) = 0;
virtual intptr_t GetPedestrianManager(void) = 0;
virtual intptr_t GetAircraftManager(void) = 0;
virtual intptr_t GetWatercraftManager(void) = 0;
virtual intptr_t GetAutomataControllerManager(void) = 0;
virtual intptr_t GetAutomataScriptSystem(void) = 0;
virtual intptr_t GetCitySituationManager(void) = 0;
virtual intptr_t GetSimulator(void) = 0;
virtual intptr_t GetAuraSimulator(void) = 0;
virtual intptr_t GetBudgetSimulator(void) = 0;
virtual intptr_t GetBuildingDevelopmentSimulator(void) = 0;
virtual intptr_t GetCommercialSimulator(void) = 0;
virtual intptr_t GetCrimeSimulator(void) = 0;
virtual intptr_t GetDemandSimulator(void) = 0;
virtual intptr_t GetFireProtectionSimulator(void) = 0;
virtual intptr_t GetFlammabilitySimulator(void) = 0;
virtual intptr_t GetFloraSimulator(void) = 0;
virtual intptr_t GetIndustrialSimulator(void) = 0;
virtual intptr_t GetLandValueSimulator(void) = 0;
virtual intptr_t GetNeighborsSimulator(void) = 0;
virtual intptr_t GetOrdinanceSimulator(void) = 0;
virtual intptr_t GetPlumbingSimulator(void) = 0;
virtual intptr_t GetPoliceSimulator(void) = 0;
virtual intptr_t GetPollutionSimulator(void) = 0;
virtual intptr_t GetPowerSimulator(void) = 0;
virtual intptr_t GetResidentialSimulator(void) = 0;
virtual intptr_t GetTrafficSimulator(void) = 0;
virtual intptr_t GetWeatherSimulator(void) = 0;
virtual intptr_t GetMySimAgentSimulator(void) = 0;

virtual intptr_t GetDisasterLayer(void) = 0;
virtual intptr_t GetCivicBuildingSimulator(void) = 0;
virtual intptr_t GetParkManager(void) = 0;
virtual intptr_t GetZoneDeveloper(void) = 0;
virtual intptr_t GetSeaportDeveloper(void) = 0;
virtual intptr_t GetAirportDeveloper(void) = 0;
virtual intptr_t GetLandfillDeveloper(void) = 0;
virtual intptr_t GetLotDeveloper(void) = 0;
virtual intptr_t GetTractDeveloper(void) = 0;

virtual intptr_t GetAdvisorSystem(void) = 0;
virtual intptr_t GetTutorialSystem(void) = 0;

virtual intptr_t GetSurfaceWater(void) = 0;
virtual intptr_t GetTerrain(void) = 0;

virtual intptr_t GetEffectsManager(void) = 0;

Where intptr_t is actually a reference to another class that I just haven't reconstructed yet, usually because there are a lot of functions in it. The game code is dense, so there's likely other things that could be accomplished with DLLs that I just haven't been able to uncover yet.

Offline vortext

  • Administrator
  • Forums Guru
  • *
  • Posts: 3364
  • Total likes: 576
  • Reputation: 23
  • CL:
    Street Smarts
Re: Extra Cheats DLL source code.
« Reply #16 on: May 18, 2016, 11:06:04 AM »
This is a pretty exciting step forwards!  &apls
time flies like a bird
fruit flies like a banana

Offline FlyHigh

  • Forums Citizen
  • *
  • Posts: 40
  • Total likes: 0
  • Reputation: 1
  • I think therefore I am
Re: Extra Cheats DLL source code.
« Reply #17 on: June 14, 2016, 04:40:33 PM »
Indeed it is! Seems like a promising discovery then  :thumbsup:
>>> Maxwell R. Black <<<
* * *

* * *