• Welcome to SC4 Devotion Forum Archives.
 

News:

The SC4 Devotion Forums are no longer active, but remain online in an archived, read-only "museum" state.  It is not possible for regular members to post or use the private messaging system, and no technical support will be provided for any issues pertaining to the forums in their current state.  Attachments (those that still work) are accessible without login.

The LEX has been replaced with SC4Evermore (SC4E), and SC4E maintains an active Discord server.  For traditional forums, we recommend Simtropolis.

Main Menu

Modding Cheats

Started by morcup, February 08, 2014, 05:59:32 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

morcup

Let me preface this by saying that I have not done any actual modding, but I understand the basics of it, and hope to one day contribute some useful mods.

For now though, my only contribution is ideas for mods, and maybe requests for information if anybody has any on the topic in question:

I was thinking about the usefulness of some of the cheats in gameplay (mainly the terrainquery and contour lines (i know that's not technically a cheat, but somewhat similar), and I began to wonder if there might be a way to create a simpler interface for turning on and off these options... ?

Adding a new button to the game's dashboard/hud would be nice, but probably impossible, so my next thought would be to see about creating a lot that would toggle the option... whether it would be by placing the lot and querying it, or just by clicking on the lot's menu icon.

At present, I have no idea if any of these things are possible, and if so, how to go about doing it.  Also, would anyone else in the community find this useful.  I would appreciate any input on these matters, and if you're willing to enlighten me in the relevant ways, I'd like to see about creating these mods myself.  That said, I have no qualms with a more experienced modder taking this idea and running with it, so long as I am kept in the loop on it's development.

Thanks,
Eric

droric

Quote from: morcup on February 08, 2014, 05:59:32 PM
Let me preface this by saying that I have not done any actual modding, but I understand the basics of it, and hope to one day contribute some useful mods.

For now though, my only contribution is ideas for mods, and maybe requests for information if anybody has any on the topic in question:

I was thinking about the usefulness of some of the cheats in gameplay (mainly the terrainquery and contour lines (i know that's not technically a cheat, but somewhat similar), and I began to wonder if there might be a way to create a simpler interface for turning on and off these options... ?

Adding a new button to the game's dashboard/hud would be nice, but probably impossible, so my next thought would be to see about creating a lot that would toggle the option... whether it would be by placing the lot and querying it, or just by clicking on the lot's menu icon.

At present, I have no idea if any of these things are possible, and if so, how to go about doing it.  Also, would anyone else in the community find this useful.  I would appreciate any input on these matters, and if you're willing to enlighten me in the relevant ways, I'd like to see about creating these mods myself.  That said, I have no qualms with a more experienced modder taking this idea and running with it, so long as I am kept in the loop on it's development.

Thanks,
Eric

Do you have programming knowledge and know how to disassemble a DLL and read the code?  The extracheats.dll enables the extra cheats but modding a DLL is not like modding other stuff in the game.  You would require programming experience and it's probably still not possible since you would most likely need some of the source code/intimate game knowledge to create anything useful.  If I am completely off base here sorry!

PC Specs: i2700k @ 4.9 Ghz, 16 GB @ 1600-8-9-8-16, 2X GTX 580 SLI, Gigabyte Z68XP-UD3R, 120 GB Vertex 3 SDD, 3 TB RAID1, 1200W SilentGold, Antec P180B case, Win 8 x64 Pro

morcup

No I have no programming knowledge at present.  I have ideas... which I guess is like a cave man who wants to communicate with people but knows no language in which to express the ideas.

So, I think this is likely beyond my scope if what you have said is correct.  And, from the little bit of further reading I have done, it does seem to be probably one of the most difficult areas to mod, even for pros.  I think that the collaborators on the release of extracheats had some assistance from the dev team.

Thanks for your input.  I think we have concluded here that, even if these ideas of mine are possible, their difficulty far outweighs their potential benefits, therefore rendering the whole endeavor as not worthwhile. 

Back to the drawing boards....

ACEfanatic02

This piqued my interest a bit, so I went nosing around for a few hours.

Some background: 
- a DLL, or Dynamic Linked Library, is essentially a big archive file full of code.  It doesn't do anything on its own, but it has a header containing a symbol table (kind of like the table of contents in a book) that marks where each function it exports lives in the archive.  Using that information, an executable can load the library and call functions within it.  However, the symbols are, for the most part, purely for the benefit of human readers, and they can be "stripped" and replaced with direct byte offsets.  This makes it extremely hard to reconstruct the flow of the code without running it.
- "Disassembly" is really a bit of a misnomer: when you disassemble a binary, you simply convert the binary machine instructions to their text representations.  Ex: `0xc20400` becomes `ret 4`.  It is *not* a magical process for recovering the original source code -- that's long gone, and a lot of the original structure has been optimized away.

Disassembling the DLL took about 5 minutes, most of which was figuring out how to get dumpbin to work (it apparently requires Visual Studio's special snowflake terminal.)  However, the binary has all symbols stripped, and dumpbin has no real way of knowing what parts are code and what parts are data.  (Normally, if we had symbols to work with, this wouldn't be a problem unless we intended to modify and reassemble the code, which isn't what we're after -- we're looking for the external API.)  Partly due to that, and partly because I don't really know x86 assembler all that well, I can pick out the general shape of some functions but I have no idea how they're called and what they do.  Someone who speaks ASM might do a better job here.

So the DLL itself is a bust.  The next approach would be to attach a debugger, set breakpoints within promising parts of the DLL and step through.  Unfortunately, Visual Studio refuses to attach to SimCity4.exe, claiming a debugger is already attached (attaching two debuggers is a Bad Idea, and therefore is not allowed.)  It appears that SC4 attaches a debugger to itself -- quite possibly to prevent exactly what I'm trying to do.  (My current theory is that the .tmp process spawned on startup attaches to SC4, though I'm not quite sure *why*.)

Conclusion:  this doesn't seem to be possible.  Unless the cheats are exposed to the Lua interface (and they might be, I haven't checked), there's no way to force access to them without modifying the binary.
日本語勉強中-最近読んだ本はこちらで見えます。
Python Enthusiast

JoeST

What you're trying to do has been tried before. I think sometime last year someone was successful in requesting the source code to the ExtraCheats DLL from its creator. There was some success in compiling and adding code to it but they eventually stopped and not a huge amount was done.
Copperminds and Cuddleswarms