• Welcome to SC4 Devotion Forum Archives.

Extra Cheats DLL source code.

Started by Buggi, August 01, 2008, 09:17:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Buggi

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.

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;
    }
};

JoeST

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

Joe
Copperminds and Cuddleswarms

jeronij

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


Jonathan

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?

GoaSkin

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:

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


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


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)

Jonathan

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. :)

GoaSkin

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)

JoeST

so all in all its pretty useless without some other code/programs?

Joe
Copperminds and Cuddleswarms

Andreas

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

GoaSkin

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)

simmaster07

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

Quote from: JoeST on August 01, 2008, 10:37:37 AM
Thanks buggi, lets hope someone can find some use for it :)

Joe

I know I certainly did :)

JoeST

Heck yeah heck yeah congrats simmaster!!!!
Copperminds and Cuddleswarms

FrankU

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?

Andreas

#13
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. :)
Andreas

FrankU

OK, so we have new light at the end of one of the tunnels? Sounds like a good opportunity!

simmaster07

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:

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.

vortext

This is a pretty exciting step forwards!  &apls
time flies like a bird
fruit flies like a banana

FlyHigh

Indeed it is! Seems like a promising discovery then  :thumbsup:
>>> Maxwell R. Black <<<
* * *

* * *