Jump to content

Resource Loading Hooks DLL for SimCity 4  2.0.1

   (1 Review)

1 Screenshot

About This File

A DLL Plugin for SimCity 4 that allows resources to be  to modified as the game loads them.

Exemplar Patching

Exemplar patching is a technique to change the behavior of Exemplar files on-the-fly at runtime, without altering the original DBPF files. An Exemplar Patch is a Cohort file with Group ID 0xb03697d1 (and arbitrary Instance ID) containing the property:

    Exemplar Patch Targets (property id 0x0062e78a): list of Exemplar files this patch applies to (format: Group ID 1, Instance ID 1, Group ID 2, Instance ID 2,…). The list must contain an even number of IDs.

All the other properties of the Cohort file (except for Exemplar Name) are injected into these target Exemplar files whenever the game loads an Exemplar file from this list. This allows to add or overwrite specific properties of Exemplar files without affecting any unrelated properties.

You can think of an Exemplar Patch as a "Child Cohort" file, mirroring the usual Parent Cohort structure. An Exemplar Patch can target multiple Exemplar files simultaneously. Conversely, multiple Exemplar Patches can be applied to the same Exemplar file.

            Parent Cohort
             /        \
            /          \
           /            \
          /              \
   Exemplar A          Exemplar B
       |   \_____       /   |
       |    _____\_____/    |
       |   /      \______   |
       |  /              \  |
Exemplar Patch 1     Exemplar Patch 2

If two Cohort files have the same Instance ID, only the one loading last has an effect. Therefore, you should usually change the Instance ID whenever you copy an existing Exemplar Patch Cohort file.

System Requirements

  • SimCity 4 version 641
  • Windows 10 or later

The plugin may work on Windows 7 or later with the Microsoft Visual C++ 2022 x86 Redistribute installed, but I do not have the ability to test that.

Installation

  1. Close SimCity 4.
  2. Copy SC4ResourceLoadingHooks.dll into the top level of either plugins folder (place it directly in <Documents>\SimCity 4\Plugins or <SC4 install folder>\Plugins, not in a subfolder).
  3. Start SimCity 4.

Command Line Arguments

Exemplar Load Logging

The plugin adds an -exemplar-log: command line argument that controls what data is logged, the argument supports the following values:

    error - Only exemplar load errors are logged.
    TGI - Logs the exemplar TGI.
    type - Logs the exemplar TGI and type (if present).
    debug - Logs the exemplar TGI, type (if present), and the name of the method used to load the exemplar.
    <exemplar type id> - Logs the TGI of exemplars matching <exemplar type id>, e.g. -exemplar-log:0x21 would log the TGI values of all 'Type 21' exemplars.

The log will be written to a SC4ExemplarLoad.log file in the same folder as the plugin. The logging will also slow down your game.

Exemplar Patch Debug Logging

The plugin adds an -exemplar-patch-debug-logging command line argument that enables more detailed logging of the exemplar patching process.
By default, the plugin will only log the number of exemplar patches and total number of exemplars that they target, e.g. 'Loaded 10 Exemplar patches targeting, in total, 41 Exemplar files.'.

The log will be written to a SC4ResourceLoadingHooks.log file in the same folder as the plugin.

Troubleshooting

The plugin should write a SC4ResourceLoadingHooks.log file in the same folder as the plugin.
The log contains status information for the most recent run of the plugin.

Source Code and Support

Plugin thread: https://community.simtropolis.com/forums/topic/763167-resource-loading-hooks-dll-for-SimCity-4/

The plugin's source code and issue tracker are located on GitHub: https://github.com/0xC0000054/sc4-resource-loading-hooks

If you would like to make voluntary contributions to support me in continuing to create more content for SimCity 4, I accept donations via PayPal: https://paypal.me/0xC0000054

Thanks to the few people who have donated to me.


What's New 2.0.1   View Changelog


Released

Fixed a crash that some users were encountering.

  • Like 17
  • Thanks 9



User Feedback

Recommended Comments

There are no comments to display.

Sign In or register to comment...

To comment in reply, you must be a community member

Sign In  

Already have an account? Sign in here.

Sign In Now

Create an Account  

Sign up to join our friendly community. It's easy!  

Register a New Account

×

Thank You for the Continued Support!

Simtropolis depends on donations to fund site maintenance costs.
Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

Make a Donation, Get a Gift!

Expand your city with the best from the Simtropolis Exchange.
Make a Donation and get one or all three discs today!

STEX Collections

By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

Each donation helps keep Simtropolis online, open and free!

Thank you for reading and enjoy the site!

More About STEX Collections