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
- Close SimCity 4.
- 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).
- 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.
-
17
-
9

Supported

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 NowCreate an Account
Sign up to join our friendly community. It's easy!
Register a New Account