Jump to content
simmaster07

Game framework compatible DLL loading (and other modding discoveries)

93 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

The interesting thing about the behavior of this mod so far is that with the City Hall Unlock removed, and with the Reward Unlock still installed, the upgrade works as intended with the 2nd city hall appearing in the reward menu, and it does so automatically without any messaging.

  • Like 4

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
Currently: Viewing Forums Index
 
8 hours ago, simmaster07 said:

Nice work! I'm bumping this for the peeps who'd already read your post but wouldn't know about your edit. I wouldn't have known except I got beeped when @MushyMushy liked my post here and I clicked the link to find this new info.


Chance favors the prepared mind. ― Louis Pasteur  
Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

Are you new here? Check out the Introduction and Guide to Simtropolis.

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    For what it's worth, after getting city hall upgrades to work I also managed to fix a pesky CTD-on-exit in the DLL I made to demonstrate adding custom cheat codes:

    https://github.com/nsgomez/gzcom-dll/releases/tag/poc-newcheats

    Again, that DLL adds the cheats "Chernobyl" and "SievertBeGone" which makes the map fully radioactive or non-radioactive, respectively. The latter also has the interesting side effect of removing radiation from lots that generate it, such as the Advanced Research Center. I'm not entirely sure about uploading it to the STEX though since it seems underwhelming to only have two new cheats that are pretty niche.

    • Like 6

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    5 hours ago, simmaster07 said:

    I'm not entirely sure about uploading it to the STEX though since it seems underwhelming to only have two new cheats that are pretty niche.

    Pffft. I'm sure some users will find it handy over having to use a cheat lot that sends their radiation skyward if they accidentally bulldoze it. This way you can blow up cities with Nuclear powerplants with indemnity, especially if you accidentally saved the city and don't want to scrap it entirely after the explosion.


    My MD on SC4Devotion (updated first)
    And Here on Simtropolis
    NAM Associate

    "My mother always told me, 'Elwood, you can be two things in this world...you can either be Oh So Smart, or Oh So Pleasant.'

    Well, for years I was smart. I recommend pleasant."
    -Elwood P. Dowd, Harvey

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    I'd say go ahead and upload it. The ability of the second one to remove radiation from lots actually sounds handy for those who "play" the game.


    N0icqd8.jpg

    “The deeper I go into myself the more I realize that I am my own enemy.”  ― Floriano Martins         Member of the NAM Team

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    UpdateCityHall shows up in the cheat window so can be applied at any time.  I couldn't resist the temptation so I went and got the nuke dll.  I just nuked a large city tile.  All the stats immediately went red, the advisors screaming, the whole tile irradiated.  Good thing we have virtual reality to play with. 

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    heck!! this is such a groundbreaking and incredible improvement to the game I am really loving how much time you're putting into all this thank you for sharing your progress and making such cool things!!! 

    • Like 2

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Re: uploading the DLL with the radiation cheats to the STEX, I'll get on that once I've finished a couple of additions to it. In the code repository I have for this project, I already added a couple of cheat codes for spawning riots and toxic spills at will. Right now this only tries in random locations, though, so I'm currently trying to make it so that they spawn on the tile that the mouse is pointed at. I'd be content with uploading it once that's done.

    • Like 9

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Exciting stuff! Great job with your continued progress.

    Given this is uncharted territory for SC4 modding, we'd all appreciate any new 'bonuses' which might result from this, however big or small. ;)


      Edited by Cyclone Boom  

    Topic pinned & featured.
    • Like 3

    Quick Links

    “SimCity 4 is not just a game, but a tool driven by our own imagination and creativity.”

    Buy me a coffee

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
    Currently: Viewing Forums Index
     
    8 hours ago, simmaster07 said:

    cGZWinLuaScriptConsole that appears to provide a debugging interface for Lua scripts.

    When I was poking around I found a few which might be related to debugging:

    • SetDebugLevel
    • SetGZLogLevel
    • GZLog
    • CreateGZLog

    Then after some Googling I found that "CreateGZLog filename" would create a zero byte file outside of the game. I wonder if "GZLog message" might be how to write to said file, but I didn't experiment with it.

    I'm sure you already know all this and more tho. ;)

    There was also FX_00_SkyWriting somewhere. Perhaps that would also accept a message and then maybe an airplane would write said message in game? Thing is, I wrote myself limited notes and when I realized it was more involved than I would pursue, I just moved on to things I could actually do something with. :lol:

    • Like 4

    Chance favors the prepared mind. ― Louis Pasteur  
    Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

    Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

    Are you new here? Check out the Introduction and Guide to Simtropolis.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    11 hours ago, Buggi said:

    I've always had the source to the extra cheats DLL. I thought I posted it when I sent out the DLL file.

    Anyway, it's attached.

     

    extracheats.cpp

    I did use that source code as a reference, but it's incomplete since it requires a declaration for the cRZCOMDllDirector class, as well as the interfaces for cISC4App and cIGZFramework, so it wouldn't compile. The main breakthrough is the reconstruction of those interfaces.

    • Like 3

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    I don't know what your plans are for further enhancements, but I do wonder if there is any way to make TAB-Rings, used in the NAM work without the NAM.

    To clarify what I mean, with a Tab-Ring you can have multiple pieces that are cycled between with the TAB key. But, in order for them to work, RUL code must be included in the NAM controller. I'm not even sure if it technically works with lots right now, but that's a moot point, because adding third party objects like this to the NAM codebase is pretty much a non-starter.

    But, if we had a way to enable such Tab-Rings without the main RUL code having to be used, perhaps we could apply it to other menus for groups of lots and modular sets? It doesn't matter if it had to remain RUL-based, just that the RUL could be read from a file independent of the main RUL files in the NAM controller. I'm thinking of some system that would enable anyone to make it work for existing and new content. Much like how I could make an MML for a set of existing lots and distribute it for others to make use of. There just needs to be a way for the game to interact with some sort of configuration file/additional RUL file and actually enable the Tab-Rings themselves.

    This could be a killer blow to the problem of highly-congested menus. Whilst MMLs and DAMN are two potential solutions, I still don't feel either of them are really ideal. Since we have Tab Ring functionality, it would be great if we could better utilise it. Does this sound remotely possible @simmaster07? Its still hard to wrap ones head around what will and won't be possible utilising your breakthroughs with DLLs. I find myself wishing I'd paid more attention to C programing and it's derivatives like C++ now.

    • Like 6

    Head over to my Lot and Mod Shack to keep abreast of my latest developments.

    Do you like custom textures, but don't like all the work involved creating them?, take a look at the Texture Automation options here. Change the look and feel of your transit networks, with the minimum of effort, for example customised versions of my Sidewalk NAM (SWN) and Terrain Grass NAM (TGN) mods, and much more besides.

    New to the NAM? Check out my tutorials on YouTube. Latest upload: How to: RHW - MHO Roundabout Interchanges. (Nov 25).

    p.s. - I'm MGB over on SC4D and a member of the NAM team.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    19 hours ago, rsc204 said:

    This could be a killer blow to the problem of highly-congested menus. Whilst MMLs and DAMN are two potential solutions, I still don't feel either of them are really ideal. Since we have Tab Ring functionality, it would be great if we could better utilise it. Does this sound remotely possible @simmaster07? Its still hard to wrap ones head around what will and won't be possible utilising your breakthroughs with DLLs. I find myself wishing I'd paid more attention to C programing and it's derivatives like C++ now.

    It's honestly too soon to tell. I don't think I've gotten through even a quarter of the game's interfaces so it's hard to say if the game's behavior can be modified to that extent.

    • Like 5

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
    Currently: Viewing Forums Index
     
    3 hours ago, simmaster07 said:

    "SimCity 4.ini" allows you to load custom graphics drivers if you know their unique identifiers (and they exist and implement the graphics interface).

    Whoa! That could be extremely useful. *:thumb:

     

    On a related note of DLL overrides here's a couple ideas that may not be possible. I'll suggest them so you can shoot them down.

    1. Override the code that causes the save file to be compressed. (The routine that quits working when the save file reaches a certain size.) My reasoning is that if it isn't compressed from the beginning then the sudden appearance of a poxed city would not occur.
    2. Override the addition of the checksum to the save file or override the reading of same when loading a city. Here that'd then give us the possibility of editing the save game files directly and still being able to load them.

     

    • Like 4
    • Yes 1

    Chance favors the prepared mind. ― Louis Pasteur  
    Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

    Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

    Are you new here? Check out the Introduction and Guide to Simtropolis.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    On 8/1/2017 at 11:29 PM, simmaster07 said:

    What's more interesting is that "SimCity 4.ini" allows you to load custom graphics drivers if you know their unique identifiers

    I think some of us have been doing something like that using  "Graphics Rules.sgr" according to the modern hardware thread, but the process can be daunting to non-power-users.

    On 8/2/2017 at 2:36 AM, CorinaMarie said:

    ...here's a couple ideas that may not be possible.

    Ditto:

    • Enable larger screen resolution without messing up the region view.
    • Debug the "Save & Exit" command to do what careful players always do: Save first, and then exit without saving.
    • Override the disk-check so that the disk version can launch in Win-10 (keep this separate so we XP users can skip it).

    -- Jeff Fisher ><> Vancouver WA
    "I may be pissing into the wind, but if I keep my enemies behind me and aim carefully, I can still rain on their parade."

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    3 minutes ago, jeffryfisher said:

    Override the disk-check so that the disk version can launch in Win-10 (keep this separate so we XP users can skip it).

    I think this one is illegal if done by a third party, but I'm not sure


    matias93's Unexpected Mod Workshop (dev thread)             Ciudad del Lago in the making (dev City Journal)

    "Let us be scientists and as such, remember always that the purpose of politics
    is not freedom, nor authority, nor is any principle of abstract character,
    but it is to meet the social needs of man and the development of the society"

    — Valentín Letelier, 1895

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    Just now, matias93 said:
    4 minutes ago, jeffryfisher said:

    Override the disk-check so that the disk version can launch in Win-10 (keep this separate so we XP users can skip it).

    I think this one is illegal if done by a third party, but I'm not sure

    Cracking the program to skip the check might be illegal, but it should be okay to repair the disk-check so it works as intended. Right now, the program calls some ancient system command that Win-10 doesn't support. An override would call a more modern replacement function (if one exists).

    I see it as an adapter, not as a security crack. As long as we just call the the right function and don't poke our heads inside, then we should be OK.


    -- Jeff Fisher ><> Vancouver WA
    "I may be pissing into the wind, but if I keep my enemies behind me and aim carefully, I can still rain on their parade."

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    1 hour ago, jeffryfisher said:

    Override the disk-check so that the disk version can launch in Win-10 (keep this separate so we XP users can skip it).

    1 hour ago, jeffryfisher said:

    Cracking the program to skip the check might be illegal, but it should be okay to repair the disk-check so it works as intended. Right now, the program calls some ancient system command that Win-10 doesn't support. An override would call a more modern replacement function (if one exists).

    Actually since this requires modifying the executable, it's totally verboten and is well outside the scope of .dll modding.

    In fact it's even less simple, since the O/S handles such DRM systems, allowing the disk to be read, you'd need to either modify the .exe akin to a NoCD crack that skips looking for the disk or modify the disk itself to remove the protection from it. Both acts are pretty much explicitly illegal, more than just simply a violation of the EULA.

    There is already a solution, since this is simply DRM handled by having a system file installed/running, which verifies the encryption allowing the disk to run. Simply find the original SecDrv.sys file from a previous version of Windows and manually Digitally Sign it to work on Windows 10. Then make a script that calls the file starting the service, runs SC4 and once it's past the check, stops the service once more. Of course this could potentially cause all sorts of security problems, but it would work. There is really no need to resort to more drastic solutions, it's just by default Win Vista-8.1 systems now have this file removed. Windows 10 never had one, hence the need to digitally sign it before the O/S will allow it to run.

     

    • Like 3

    Head over to my Lot and Mod Shack to keep abreast of my latest developments.

    Do you like custom textures, but don't like all the work involved creating them?, take a look at the Texture Automation options here. Change the look and feel of your transit networks, with the minimum of effort, for example customised versions of my Sidewalk NAM (SWN) and Terrain Grass NAM (TGN) mods, and much more besides.

    New to the NAM? Check out my tutorials on YouTube. Latest upload: How to: RHW - MHO Roundabout Interchanges. (Nov 25).

    p.s. - I'm MGB over on SC4D and a member of the NAM team.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    It's always like Christmas when there's news in this thread--thanks for continuing to boldly go where no one has gone before here!

    If we are talking about DLL possibilities, before he disappeared, @OrSpeeder had apparently found the key to making it such that the RHW network could actually have a proper monthly cost.  

    -Tarkus

     


      Edited by Tarkus  

    Darn autocorrect
    • Like 4

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    21 hours ago, rsc204 said:

    Actually since this requires modifying the executable, it's totally verboten

    If indeed it must change the EXE, then it would be off limits. But I don't know enough about how disk verification works. I thought Win-10 had a new way to do that, and that a DLL could provide an interface to an obsolete function and map it to a new function. Such a DLL would be a compatibility interface for Win-10, which would help any and all old programs with this problem. It would not be a "crack".

    21 hours ago, rsc204 said:

    There is already a solution, since this is simply DRM handled by having a system file installed/running, which verifies the encryption allowing the disk to run. Simply find the original SecDrv.sys file from a previous version of Windows and manually Digitally Sign it to work on Windows 10. Then make a script that calls the file starting the service, runs SC4 and once it's past the check, stops the service once more.

    OK, Though it has more steps than just dropping a DLL into a system folder, that's close enough to what I had in mind. As XP - Win7 machines die, eventually every SC4 on-disk player will need to get over this compatibility hump. To wrap it up with a bow, maybe someone could write an installer for it so the right files go to the right places.

    I'll search for threads discussing the details (like where the SecDrv.sys file lives in a Win-10 machine, and can one signed copy be passed around, or does each computer need to do its own signing?) I want to bookmark the solution against the day I eventually need it.

     

     

    • Like 1

    -- Jeff Fisher ><> Vancouver WA
    "I may be pissing into the wind, but if I keep my enemies behind me and aim carefully, I can still rain on their parade."

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    1 hour ago, jeffryfisher said:

    To wrap it up with a bow, maybe someone could write an installer for it so the right files go to the right places.

    Honestly, if you don't know how to do what I listed here, you probably shouldn't be doing it in the first place. Because the key changes in Windows 10 designed to keep the OS more secure are basically those things you are fighting here.

    1 hour ago, jeffryfisher said:

    I'll search for threads discussing the details (like where the SecDrv.sys file lives in a Win-10 machine, and can one signed copy be passed around, or does each computer need to do its own signing?) I want to bookmark the solution against the day I eventually need it.

    Another reason why an installer won't work, you must sign it for your own machine/OS, to sign it for every machine requires a different process and maybe even MS certification, which is simply not going to happen for this particular file.

    Note also this issue is in no way unique to SC4, but covers all disks using Safe Disc 2 DRM. All of this was explained here:

    and here:

     

    • Thanks 1

    Head over to my Lot and Mod Shack to keep abreast of my latest developments.

    Do you like custom textures, but don't like all the work involved creating them?, take a look at the Texture Automation options here. Change the look and feel of your transit networks, with the minimum of effort, for example customised versions of my Sidewalk NAM (SWN) and Terrain Grass NAM (TGN) mods, and much more besides.

    New to the NAM? Check out my tutorials on YouTube. Latest upload: How to: RHW - MHO Roundabout Interchanges. (Nov 25).

    p.s. - I'm MGB over on SC4D and a member of the NAM team.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Just out of curiosity, would it be possible for someone to use a DLL to reimplement all of the game's simulators to use multithreading properly? At this point, quad-core CPUs are pretty much standard, so the game's inability to use more than one core without destabilizing seems... inefficient. In addition, the DLL could add hooks into certain parts of the simulator, like freight, so others could expand the simulator's capabilities, using other DLLs. (At least, I get the impression that's possible from the documentation @simmaster07 has made.)

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Multithreading would require to rewrite the entire executable and surely many DLL libraries, which is highly illegal and also a huge task. So that's a big no, at least until the game becomes legally abandonware.

    About hooks, I also remember having read @simmaster07 saying that it is possible to do. The tiny detail there is that he's the only member of the community that knows how to write DLL files for the game, so we are dependent exclusively on his work to see more functionalities added.

    • Like 2

    matias93's Unexpected Mod Workshop (dev thread)             Ciudad del Lago in the making (dev City Journal)

    "Let us be scientists and as such, remember always that the purpose of politics
    is not freedom, nor authority, nor is any principle of abstract character,
    but it is to meet the social needs of man and the development of the society"

    — Valentín Letelier, 1895

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

     

    2 hours ago, matias93 said:

    Multithreading would require to rewrite the entire executable and surely many DLL libraries, which is highly illegal and also a huge task. So that's a big no, at least until the game becomes legally abandonware.

    About hooks, I also remember having read @simmaster07 saying that it is possible to do. The tiny detail there is that he's the only member of the community that knows how to write DLL files for the game, so we are dependent exclusively on his work to see more functionalities added.

    The multithreading idea was based on the fact that according to simmaster, you can override default game behavior with a DLL.

    On 8/2/2017 at 2:29 AM, simmaster07 said:

    A couple of quick new notes:

    First, I figured out that you can actually override game behavior completely by changing a single parameter in the DLL source code to indicate you have a more recent version of whatever you're trying to override. However, you can't override individual functions — you have to reimplement and override the entire class containing what you're trying to modify, from top to bottom. For complex interfaces like the lot developer this is somewhat of a nightmare.

    So if I'm right, you would not actually have to modify any game code. Also, he does have a GitHub repo, under the Source Code link in the first post, which could be used by anyone as a base. Since DLLs are actually separate executables, there's nothing stopping one from running its task in a separate thread. I could be wrong, though; I'm not an expert programmer, merely a hobbyist. So if I'm truly wrong in what I'm saying, please correct me.

    • Like 1

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    On 9/25/2017 at 2:57 PM, narukaze said:

    would it be possible for someone to use a DLL to reimplement all of the game's simulators to use multithreading properly?

    Multi-threading requires synchronization between processes that prep data and processes that use that data. Since we probably can't rewrite the whole game to synchronize its data consumption, multi-threading is almost certainly beyond us.

    That said, I must agree that it would be super-cool to have an independent path-finding thread running full time on its own processor whenever a city's clock was running. Then we'd have both perfect path-finding and short turn-around times. I'm tired of seeing new houses labeled with no-road zots for a year or more before they notice the road they've always been facing.

    • Like 3

    -- Jeff Fisher ><> Vancouver WA
    "I may be pissing into the wind, but if I keep my enemies behind me and aim carefully, I can still rain on their parade."

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    On 9/27/2017 at 3:08 PM, jeffryfisher said:

    Multi-threading requires synchronization between processes that prep data and processes that use that data. Since we probably can't rewrite the whole game to synchronize its data consumption, multi-threading is almost certainly beyond us.

    Fair point. But if all we're talking about is simulators, it might be possible. Based on what @simmaster07 has said, it appears that in order to override any part of a simulator, you would have to reimplement the whole thing. If that's already necessary, then it shouldn't be a problem to implement multithreading in the "preparing data" phase. Again, though, it's just a thought I, an amateur programmer, had, so take it with a grain of salt. (Also, that says nothing as to the feasibility of someone actually doing it.)

    On 9/27/2017 at 3:08 PM, jeffryfisher said:

    That said, I must agree that it would be super-cool to have an independent path-finding thread running full time on its own processor whenever a city's clock was running. Then we'd have both perfect path-finding and short turn-around times. I'm tired of seeing new houses labeled with no-road zots for a year or more before they notice the road they've always been facing.

    Oh yeah, that is SO annoying. Seriously, just... I dunno, maybe check more than once per decade? It'd also be nice to have residential zoning rotate to face the road, so if you place a bus stop you don't accidentally cut the thing off. (I've done that a number of times. So aggravating...)

    Share this post


    Link to post
    Share on other sites

    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