Jump to content

48 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

Interesting idea, it is nice to have more people developing SC4 DLLs :). Other DLLs may also hook the middle click message in the city view, but there is no way to know if that would be a conflict.

From the Mac symbols, Maxis defined button up/down message codes for the middle mouse button, but they never got around to checking for those messages in the game's window procedure or adjusting the rest of the code to provide middle mouse button support. I find that a shame as you could do some fun things with a ViewInputControl that had middle click filtering, such as implement this type of mod. The city right click scrolling is implemented as a ViewInputControl.

Looking at the code I have a few notes:

  • Deriving from cRZMessage2COMDirector could have saved you the effort of reimplementing the QueryInterface/AddRef/Release logic.
  • SC4 has a built-in way of hooking window messages, the AddWinProcFilter function in the cIGZCanvasW32 interface.
    • My Region Census UI DLL uses that interface to implement a middle click hook in the region view.
  • Like 4

Share this post


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

    @Null 45 Cool! Thank you for the advice. I went ahead and tested this out and got a huge performance boost while dragging the camera around over the previous model. I'll merge the code and make a new release probably later today.

    EDIT: Okay, I've updated the plugin. It's still got the same glitches, strange behaviors etc (still alpha) - but the performance improvement is tangible.

    I'll work on it some more when I can. If anyone else wants to collaborate, or fork it, or whatever - feel free! Honestly, I'm kind of new at this (git/github) - but I'm trying to learn it quickly.


      Edited by robo_d  

    updated the progress
    • Like 3

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    8 hours ago, robo_d said:

    EDIT: Okay, I've updated the plugin. It's still got the same glitches, strange behaviors etc (still alpha) - but the performance improvement is tangible.

    You should be able to replace both the mouse and keyboard hooks with that filter function, and maybe rename it from HandleCanvasMouseMessage to something like CanvasMessageFilter. Although that would make the filter method more complex. It also looks like the keyboard filter is only used for debug logging, so perhaps that code could be removed from release builds or gated behind a debug logging switch in an INI file.

    The modern approach for SC4 DLLs is typically to reference the main gzcom-dll repository as a submodule without modifying its code, which allows you to easily update to new gzcom-dll versions. Git submodules also used for any simple dependencies that are header only (e.g. WIL - which greatly simplifies using various Windows APIs), with more complex libraries like boost being handled through a C++ package manager.

    I also have a repository of common SC4 DLL code that contains code for logging, INI reading, version detection, memory patching, etc.

    Also, it is customary for SC4 DLLs to list all dependencies and their licenses in the project's readme.

    • Like 2
    • Thanks 1

    Share this post


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

    I think the idea is fairly similar to the extension to memo's 3D camera DLL that I toyed with a few months ago. It was mostly for experimental reasons so I never really tied it in to the middle mouse movement, just a cheat code to open a dialog where all the view angles and zoom/magnification could be tweaked with sliders. But perhaps there's code here that you could re-use/integrate in your work.

     

    https://github.com/caspervg/sc4-render-services/tree/main/src/sample/camera-view-input

     

     

     

     

    • Like 7

    Share this post


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

    @CasperVg  @Null 45  Wow! Thanks for sharing your work - I've been working on the plugin and have released a major update. It no longer clips through the ground causing misrenders, no longer has trouble with vanished walls at odd angles, and has better overall performance. I've also updated my repo to try to better incorporate community standards as per Null45's recommendation.

    I still have more work to do before I complete the plugin - if you guys try it out and want to help - please try to break the camera using camera movement, if/when you do, please press F8, then exit the game. There should be a SC4-3DMouseCam.log file in the plugins folder. Please DM me with a quick summary of what you did and attach the .log file. TY!

    WARNING - Again - do not yet try on important cities/regions without backing them up!

    • Like 2

    Share this post


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

    I've released a new update. It completely overhauls the original camera. Please take a look and tell me what you guys think, the good the bad and the ugly.https://github.com/UncleUncleRj/SC4-ModernCamera/releases

    thank you!

    PS I changed the title of this thread to reflect what I hope this plugin is more closely resembling.

    • Like 2

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    On 6/19/2026 at 5:45 PM, Rj Simas said:

    Please take a look and tell me what you guys think, the good the bad and the ugly.

    It works for me, but since it is a Debug build it won't work for most people due to needing to have Visual Studio 2022 with the C++ tools installed to get those debug CRT DLLs. Even beta DLLs should be Release builds for public distribution because the Microsoft Visual C++ 2022 redistributable does not include the debug versions of the runtime.

    Is there a way to reset the camera to the Maxis defaults?

    • Like 2
    • Thanks 1

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    3 hours ago, Null 45 said:

    It works for me, but since it is a Debug build it won't work for most people due to needing to have Visual Studio 2022 with the C++ tools installed to get those debug CRT DLLs. Even beta DLLs should be Release builds for public distribution because the Microsoft Visual C++ 2022 redistributable does not include the debug versions of the runtime.

    Thank you, that's good to know.

    3 hours ago, Null 45 said:

    Is there a way to reset the camera to the Maxis defaults?

    I'm working on this currently.

    • Like 1

    Share this post


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

    This mod "in beta" is great! It makes using the 3D camera mod a lot easier. I also love being able to step in to so many different zoom levels! Feedback that I have is that it breaks mouse wheel scrolling through the UI. If you can't implement anything to fix that, that's okay.

    • Like 2

    Fun fact: Buffalo sauce contains the entire DNA sequence of buffalo, so you can clone buffalo while eating buffalo wings with buffalo sauce at Buffalo Wild Wings in Buffalo, New York. I've never tried it, though.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    4 hours ago, Turnstyled said:

    Feedback that I have is that it breaks mouse wheel scrolling through the UI

    That is due to the fact that it prevents the game from receiving mouse wheel messages as a brute force way to bypass the Maxis mouse wheel zooming behavior.

    That Maxis code could be jumped out with a memory patch that redirects to code the DLL provides, but that is more complex to implement due to the fact that it requires working directly with x86 assembly language. I found the location of the cSC4View3DWin_GZOnMouseWheel function in the v641 binary (0x007e6b50), and I also found what I think is a good hook inject point (offset 0x007e6c1a).

    I may have to try building the plugin and submitting a PR if I get the patch working.

    • Like 3

    Share this post


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

    This mod "in beta" is great! It makes using the 3D camera mod a lot easier. I also love being able to step in to so many different zoom levels! Feedback that I have is that it breaks mouse wheel scrolling through the UI. If you can't implement anything to fix that, that's okay.

     

    15 hours ago, Null 45 said:

    That is due to the fact that it prevents the game from receiving mouse wheel messages as a brute force way to bypass the Maxis mouse wheel zooming behavior.

    That Maxis code could be jumped out with a memory patch that redirects to code the DLL provides, but that is more complex to implement due to the fact that it requires working directly with x86 assembly language. I found the location of the cSC4View3DWin_GZOnMouseWheel function in the v641 binary (0x007e6b50), and I also found what I think is a good hook inject point (offset 0x007e6c1a).

    I may have to try building the plugin and submitting a PR if I get the patch working.

    Thank you both for pointing this out, and for the input. I will also look into this!

    • Like 2

    Share this post


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

    Okay, I managed to fix the scrolling problem, I had to log and debug what area IDs the plugin was treating as 3D world surfaces vs SC4 UI and just have it target world surfaces.

    Great! And with that 1.0 is officially released!

    Thank you to everyone!

    • Like 6

    Share this post


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

    I'll say it again here... this camera handling is top-notch. Modern! .. :ooh:*;) .. 
    But since I like the usual camera angle (I know, old habits die hard) - and to avoid 3D distortion -, I was wondering if you could suggest rotating the view, while keeping the base angle, by pressing a key while rotating with M3. >> [shift]+Mouse3 ??
    Or, an indicator (cursor change) that tells me the camera is in the Maxis angle...!??
    Yes, yes, you put in a "Reset" button... but, I'm a very, very lazy person... *:lol: 

    Thank you for this plugin.

    • Like 2

    What is good when you have nothing to say is that you can always pretend to listen. Anyway it does not prevent to think!

    >> My little plugins contribution << -- >> Depot | Fabrik | Testing <<

    Share this post


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

    @hugues aroux Forgive me, I'm trying to wrap my head around what you'd like - if I misunderstand please correct me.

    It sounds like you prefer the classic 4-angle rotation but still want to keep the smooth zoom. Because the "Pan & Tilt" feature essentially replaced the classic rotation, enabling the classic mode would mean disabling Pan & Tilt.

    Thinking this through, I see two potential solutions:

    1. A settings toggle: I could add an option to the settings menu to disable Pan & Tilt, effectively restoring the classic 4-angle rotation. However, I would need to test how this behaves at extreme high and low zoom levels. It might alter the "usual" camera angles and introduce a whole new set of variables.
    2. A modifier key: As you suggested, I could add a modifier (like the SHIFT key) to activate the classic 4-angle rotation on the fly. This is entirely possible, but again, it might create strange camera angles at the zoom extremes allowed by the modern camera.

    These are just my initial thoughts, and I haven't tested these interactions yet. Let me know what you think, and I'll start experimenting with this soon.

    • Like 1

    Share this post


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

    Perhaps I didn't express my idea very well... (google translate)
    The "modern" mode allows for rotation and tilt changes within a single mouse movement—which is great for generating different viewpoints—but by holding down a key like [Alt] or [Ctrl] (since [Shift] is used for movement speed), we could maintain the rotation (with the smooth motion you're proposing) without altering the elevation! This way, we would preserve the viewing angle intended for the current zoom level. (I don't remember exactly, but I think Maxis applied a 45° angle in Z5...!?! But this value might not make sense with your DLL.!?!)
    6a3ef387cfe0f_Capturedcran2026-06-26234708.jpg.dfb53d777502cfa78b05a4fa7f8fb283.jpg
    A little drawing might make it clearer... I hope so.  *:lol:

    • Like 3

    What is good when you have nothing to say is that you can always pretend to listen. Anyway it does not prevent to think!

    >> My little plugins contribution << -- >> Depot | Fabrik | Testing <<

    Share this post


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

    @hugues aroux Yes the drawing did help.

    You want a 'lock angle' modifier. So that wherever you're currently at, you can jump to a locked Maxis-camera to the nearest possible location but stay mobile.

    Yes I can work on that. In fact, the gears are already turning!

    • Like 2

    Share this post


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

    I came across something else. It's not the biggest deal when the SC4AutoRunCheats DLL cheat exists, but with version 1.0 of your camera mod, I cannot enter "a" in the moolah cheat because it's a part of WASD.

    Though by disabling WASD movement, I am able to enter the cheat. So, that would work as a workaround, too.

    Thank you for the update!

    • Like 2
    • Thanks 1

    Fun fact: Buffalo sauce contains the entire DNA sequence of buffalo, so you can clone buffalo while eating buffalo wings with buffalo sauce at Buffalo Wild Wings in Buffalo, New York. I've never tried it, though.

    Share this post


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

    @Turnstyled Thank you! I'll be entering this as a bug report. =)

    • Like 3

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
    Currently: Viewing Topic: Can't find it?... Ask here!
     
    6 minutes ago, Turnstyled said:

    I came across something else. It's not the biggest deal when the SC4AutoRunCheats DLL cheat exists, but with version 1.0 of your camera mod, I cannot enter "a" in the moolah cheat because it's a part of WASD.

    Though by disabling WASD movement, I am able to enter the cheat. So, that would work as a workaround, too.

    Thank you for the update!

    Ya any hotkey that uses WASD, just disable that function.

    Ex I wanted to take a screenshot- cntrl-shift-s. Could not. Also saving with the hotkey way is no good, until I disabled it.

    I would recommend it being disabled by default for a future version.

    • Like 2
    • Thanks 2

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    3 minutes ago, Haljackey said:

    Ya any hotkey that uses WASD, just disable that function.

    Ex I wanted to take a screenshot- cntrl-shift-s. Could not. Also saving with the hotkey way is no good, until I disabled it.

    I would recommend it being disabled by default for a future version.

    I'll work on this to get it fixed asap.

    • Like 3

    Share this post


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

    Your native UI research was an interesting read. :)A few notes on that:

    1. The game's UI typically uses PNG for icons, not FSH. The 0x856DDBAC type id is used for non-FSH images, it happens to work for FSH images because the game uses an EA library (known as Gimex) for all image formats.
    2. Calling conventions can vary depending on the type of function and the compiler. Class functions in a vtable typically use thiscall, and free functions typically use cdecl (in the Windows binary). But the compiler is free to invent other calling conventions, .e.g. the 32-bit Mac binaries often use various register calling conventions for non-vtable functions.
    3. The vtable layout can also change depending on the compiler, it is entirely possible that your cIGZWin::SetArea and cIGZWin::CenterWindowInRect problems were caused by the compiler placing the overloads in the opposite order on Windows (far from the first time that has happened). Most of the SDK headers are reverse engineered from the 32-bit Mac binaries (both PowerPC and x86), and there have been cases where vtable functions were deleted from the Mac version requiring function by function reverse engineering to make the interface work on Windows.
    4. The game's interfaces have typically been decoded on an as-needed basis, and you are the first to use the slider, spinner, text-edit, option-group, and scrollbar controls. If you want to, you could decode those headers from the x86 Mac binary available in the ST Maxis patches section using Ghidra or another other tool and contribute them to gzcom-dll. The reason the 32-bit Mac binaries are used is that Aspyr left in partial debug symbols that provide parts of the game's C++ class structure and interface layout.
    • Like 2

    Share this post


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

    @Haljackey While I'm working on this, you may actually get easier screenshots in any scenario by using WindowKey + G to invoke the Xbox Bar and clicking the camera widget, which can take screenshots.

    • Like 2

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    7 minutes ago, Rj Simas said:

    you may actually get easier screenshots in any scenario by using WindowKey + G to invoke the Xbox Bar and clicking the camera widget, which can take screenshots.

    The Print Screen should also work. The WASD key hook should probably check for modifiers and skip processing in that case, but that would still stomp the built-in keyboard shortcuts that use those keys.

    • Like 2

    Share this post


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

    I actually like ShareX as a utility for taking screenshots across Windows. I have a hotkey for screenshotting the active monitor. The game's screenshot tool remains useful for me, though, for file naming and organization.

    • Like 3

    Fun fact: Buffalo sauce contains the entire DNA sequence of buffalo, so you can clone buffalo while eating buffalo wings with buffalo sauce at Buffalo Wild Wings in Buffalo, New York. I've never tried it, though.

    Share this post


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

    It's late on a Friday for me, but before I forget, do you think that there could be an intuitive way of hiding the camera controls button? The button always being there isn't that great for screenshots. Thanks again!

    • Like 2
    • Yes 1

    Fun fact: Buffalo sauce contains the entire DNA sequence of buffalo, so you can clone buffalo while eating buffalo wings with buffalo sauce at Buffalo Wild Wings in Buffalo, New York. I've never tried it, though.

    Share this post


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

    @Turnstyled Yes, I saw in a YouTube video that there was that issue. I'm going to see about hiding it when the UI is minimized.

    • Like 3

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    11 hours ago, Rj Simas said:

    Yes I can work on that. In fact, the gears are already turning!

    Oh... already! How quick! :ooh:

    Regarding WASD (uh, w|a|s|d !)... This is just my opinion: at first ..  I'm not sure they're useful, since the arrow keys (which I never use *;)) already do the job, as does [M2] when moved laterally...! Furthermore, the WASD keys are assigned to various RCI zones (see the keyboard INI file)! And this also bypasses [ctrl]+!! 
    OK... However, if you point out in your Guide/notice/readme that this option interferes with the usual use of W|A|S|D, ... an alternative !? ...
    (I just tested it ->>) The solution is: a right-click (M2) + [a] which restores the use of the "Residence Zone $" tool, and the same for the use of the other 3 keys!! You have to finish with a [?] to hide the currently active tool! ... So ... w|a|s|d certainly a good option for some players !!

    Another point... when I try to open the UIs in Reader (0.9.3 or 1.5.4), it crashes immediately! Only the 3dc070[1|3|7] panels are accessible. Therefore, I won't be able to "adapt" your UI panels to make them compatible with my Carbon-skin interface (or Blue-skin), nor the next one in development!
    If Null45 understands the content of your "Native UI Research", I... don't *;) ! And yes, a good old PNG would be perfect for the buttons. yes yes yes... *:D
    Is there a way to make your files readable with older tools like Reader? So that a simple graphic designer can easily make changes. 

    • Like 2

    What is good when you have nothing to say is that you can always pretend to listen. Anyway it does not prevent to think!

    >> My little plugins contribution << -- >> Depot | Fabrik | Testing <<

    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