1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

How to compile the DLL

Discussion in 'Civ5 - SDK / LUA' started by DaveMcW, Nov 2, 2012.

  1. DaveMcW

    DaveMcW Deity

    Joined:
    Oct 8, 2002
    Messages:
    6,489
    Here is how I was able to compile the DLL. Thanks to whoward69 and Gedemon for several hints.

    1.
    Download and run http://download.microsoft.com/.../vcsetup.exe.

    2.
    Start Steam and select Library -> Library -> Tools.
    Find "Sid Meier's Civilization V SDK", right-click it, and select Install Game.

    3.
    Copy "C:\Program Files (x86)\Steam\SteamApps\common\sid meier's civilization v sdk\CvGameCoreSource" to "My Documents\Visual Studio 2008\Projects\CvGameCoreSource".

    4.
    Open "CvGameCoreSource\CvGameCoreDLL \CvGameCoreDLL.rc" in notepad.
    On line 10, replace "afxres.h" with "windows.h"

    5.
    Open "CvGameCoreSource\CvGameCoreDLL_Expansion1 \CvGameCoreDLL.rc" in notepad.
    On line 10, replace "afxres.h" with "windows.h"

    6.
    Open "CvGameCoreSource\CvGameCoreDLL_Expansion2 \CvGameCoreDLL.rc" in notepad.
    On line 10, replace "afxres.h" with "windows.h"

    7.
    Start Visual C++ 2008 Express Edition.
    File -> Open -> Project/Solution.
    Open CvGameCoreSource\CvGameCoreDLL.vs2008.sln

    8.
    Right-click CvGameCoreDLL and select Properties -> Configuration Properties -> Linker.
    Change the Output File to: $(OutDir)\CvGameCoreDLLFinal Release.dll

    9.
    Right-click CvGameCoreDLL_Expansion1 and select Properties -> Configuration Properties -> Linker.
    Change the Output File to: $(OutDir)\CvGameCore_Expansion1.dll

    10.
    Right-click CvGameCoreDLL_Expansion2 and select Properties -> Configuration Properties -> Linker.
    Change the Output File to: $(OutDir)\CvGameCore_Expansion2.dll

    11.
    Save all.

    12.
    Build -> Build Solution. You could also right-click a single DLL and just build that one.

    13.
    Find the new DLL in "CvGameCoreSource\BuildOutput". Add it to the root directory of your mod, and set the "Import into VFS" property to true.
     
  2. Gedemon

    Gedemon Modder Super Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,673
    Location:
    France
    Rename the compiled DLL to CvGameCoreDLLFinal Release.dll or CvGameCore_Expansion1.dll (or rename directly the project, or change the target name...) and simply add them to your mod project with the VFS property set to true.
     
  3. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,526
    Location:
    Near Portsmouth, UK
    Only the first occurance in each file needs to be replaced, the second is part of how visual studio auto-generates files.

    And then only if you are using the free Express version, if you already own the full version there is no need to make these edits.
     
  4. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,526
    Location:
    Near Portsmouth, UK
    They must be added at the "root", do NOT create a sub-folder (eg DLL) and place them in there - it will not work (found that out the hard way :blush:)
     
  5. Gedemon

    Gedemon Modder Super Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,673
    Location:
    France
    this game is driving me crazy, it does not load the DLL anymore using the VFS property...
     
  6. Gedemon

    Gedemon Modder Super Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,673
    Location:
    France
    correction: it works with the G&K DLL, it doesn't with the Vanilla DLL.
     
  7. deanej

    deanej Deity

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    And with that we have something to start the modiki DLL reference with. Glad to know that they used VS 2008, and that it can still be downloaded. This makes it much less of a hassle than with civ4!
     
  8. Terradive

    Terradive Warlord

    Joined:
    Jun 4, 2009
    Messages:
    186
    Fantastic instructions guys. First time through! Hats off to you!
     
  9. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,526
    Location:
    Near Portsmouth, UK
    There is also a project for VS 2010 (but if you use that you still need to install VS 2008), so you can use either
     
  10. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,526
    Location:
    Near Portsmouth, UK
    Have you found the following in CvDllContext.cpp and made the required change?

    Code:
    // WARNING! This must be unique for each DLL!
    // If you are a modder and you are creating your own DLL from the original source, this must be changed to a unique GUID.
    // Use the Visual Studio Create GUID option in the Tools menu to create a new GUID.
    // {C3B2B6B3-439C-480b-8536-1CF39FCFC682}
    static const GUID CIV5_CORE_RELEASE_DLL_GUID =
    { 0xc3b2b6b3, 0x439c, 0x480b, { 0x85, 0x36, 0x1c, 0xf3, 0x9f, 0xcf, 0xc6, 0x82 } };
    
     
  11. Gedemon

    Gedemon Modder Super Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,673
    Location:
    France
    Thanks, done now, but still not loading via the mod :/

    (here's a link to a GUID Generator btw if someone need it)

    It works for you for both version ?

    Maybe it's because of the initialization method of the mod I'm using, it auto-deactivate GK in ModsMenu.Lua, and call again Modding.ActivateEnabledMods()... I'll try later with a simpler mod.
     
  12. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,526
    Location:
    Near Portsmouth, UK
    Only using G&K at the moment ... I wonder if vanilla needs the OnGetDLLPath stuff (as the G&K expansion effectively provides it's own version of that anyway)
     
  13. Genghis.Khan

    Genghis.Khan Person

    Joined:
    Jun 9, 2012
    Messages:
    934
    Location:
    Somewhere
  14. Gazebo

    Gazebo Lord of the Community Patch Supporter

    Joined:
    Sep 26, 2010
    Messages:
    18,079
    Gender:
    Male
    Location:
    Little Rock
    To be clear, this will, eventually, allow for mods (with custom DLLs) to be used over multiplayer without having to edit the original files, correct? Just curious, as I did not mess with Civ4 modding and have only been sporadically updating CSD for the past few months.

    G
     
  15. ww2commander

    ww2commander Emperor

    Joined:
    Aug 23, 2003
    Messages:
    1,243
    Location:
    Australia
    Sorry for asking an amateur question, but can any (new) DLL gurus probably provide some clear steps on how to deploy these modded DLL files. I noticed they are starting to appear on the forums but I gather many like me don't have a clue how to deploy them via Modbuddy.

    I have read some threads stating to replace files which sets alarm bells into motion and brings back memories of the Civ4 override days!

    Apologies if this is pointed out and I missed it :blush:
     
  16. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,526
    Location:
    Near Portsmouth, UK
    See post #2 and #4

    Basically you add the DLL as a file (in the root) to your ModBuddy project and set VFS=true, and then build your mod as usual

    BUT (and it's a very big but) you can only play with one mod that has it's own (new) DLL at a time - so if both IGE and CSD (say) start shipping with their own DLL you're going to have to make a choice, one or the other but not both at the same time. DLL modding is going to favour the "total conversions" ... it does rather destroy my "many small mods on the buffet table" approach :sad:
     
  17. ww2commander

    ww2commander Emperor

    Joined:
    Aug 23, 2003
    Messages:
    1,243
    Location:
    Australia
    Bingo...thats the info I was after...thanks for clarifying.

    How hard would it be for our DLL modders to come to some agreement on releasing a single 'community' DLL that includes bug fixes and performance improvements so that us non-DLL types can not have to worry about multiple DLLs that fix issues. Of course, game changing features should continue to be released separately as per normal mod approach.
     
  18. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,526
    Location:
    Near Portsmouth, UK
    IMHO impossible ... as it's impossible to define "bug fix".

    Look at CivUP, a lot of stuff in there was/is "bug fixes" ... but only if you believe the "feature" to be broken in the first place, which in a strategy game with players of very different skill levels will always be subjective. One player's "bug fix" will usually be another player's "bug"
     
  19. ww2commander

    ww2commander Emperor

    Joined:
    Aug 23, 2003
    Messages:
    1,243
    Location:
    Australia
    I knew you were going to say that!

    If I was to define bugs it would be:
    - Incorrect info ingame
    - Bugs reported to Firaxis but not resolved yet
    - UI issues
    - Possible CTD game issues

    Not game 'enhancements', stat changes or redefining how a game element should work. If it changes the game mechanics or feel then it is a new feature and not a big fix.

    As for performance improvements, it would be typical things like speeding up next turns.
     
  20. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,526
    Location:
    Near Portsmouth, UK
    So is the inability of a ship to enter a coastal fort a bug or an enhancement ... depends who you ask ;)
     

Share This Page