sarbian Posted December 20, 2018 Author Share Posted December 20, 2018 11 hours ago, NermNermNerm said: you get pdb2mdb with your unity installation I have not tested it in a long time but that one used to not properly work on Roslyn generated dlls. Quote Link to comment Share on other sites More sharing options...
NermNermNerm Posted December 23, 2018 Share Posted December 23, 2018 On 12/20/2018 at 11:10 AM, sarbian said: I have not tested it in a long time but that one used to not properly work on Roslyn generated dlls. Just did - doesn't work. WTH. These are grownups making Unity right? Stick with your version. Quote Link to comment Share on other sites More sharing options...
Gavin786 Posted March 22, 2019 Share Posted March 22, 2019 On 3/30/2015 at 12:01 AM, Teknoman117 said: Okay, so, just my luck it doesn't work for me... Did everything you said, got the "development version" watermark in the KSP window and everything. However, nothing happens when I try to attach to the process (I'm guessing it failed to attach). However, it sometimes opens the developer console with a long list of the same message about failing to wait on a semaphore (something which seemed to be mentioned in angavrilov's commit log for his debugger. If i try to set a breakpoint anywhere, a couple seconds later mono pops up a dialog with "Debug operation failed." I verfied that in this case I hit attach before the connection timed out. This is what the executable spits out for me as well. Set current directory to /home/nathaniel/Projects/ksp/0.90.0 Found path: /home/nathaniel/Projects/ksp/0.90.0/KSP.x86_64 Mono path[0] = '/home/nathaniel/Projects/ksp/0.90.0/KSP_Data/Managed' Mono path[1] = '/home/nathaniel/Projects/ksp/0.90.0/KSP_Data/Mono' Mono config path = '/home/nathaniel/Projects/ksp/0.90.0/KSP_Data/Mono/etc' PlayerConnection initialized from /home/nathaniel/Projects/ksp/0.90.0/KSP_Data (debug = 0) PlayerConnection initialized network socket : 0.0.0.0 55502 Multi-casting "[IP] 192.168.1.69 [Port] 55502 [Flags] 3 [Guid] 661409256 [EditorId] 803286173 [Version] 1048832 [Id] LinuxPlayer(192.168.1.69) [Debug] 1" to [225.0.0.222:54997]... Waiting for connection from host on [192.168.1.69:55502]... Timed out. Continuing without host connection. Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,defer=y,address=0.0.0.0:56256 PlayerConnection already initialized - listening to [192.168.1.69:55502] I did have a similar problem to this. For anyone who is having the problem of clicking on "Attach Unity Debugger" and not having any unity instances listed and not being able to attach. You need to press on "Open Log File". Then you need to look for the line : Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,defer=y,address=0.0.0.0:56900 The last value on that line in this case 56900 is the port you need to connect to. Please be aware that so far the port changes from run to run. Perhaps there is a way to stabilize it that some of the ppl more familiar with Unity have found out? Anyway if you go to "Attach Unity Debugger", and then "Input IP", specify your PC's IP then use the port 56900 in this case, whatever the port number in the log file specifies. You can then debug your KSP mod. I hope this saves someone some time and ball ache. Gavin786 Quote Link to comment Share on other sites More sharing options...
whitespacekilla Posted July 1, 2019 Share Posted July 1, 2019 (edited) I decided I want to be able to develop on Mac OSX as well as Windows (for whatever reason) so I figured out how to make this tutorial work for Mac. I'm posting this here as much so I can find it if I need to figure it out again as for someone else's use but here goes anyway. Some items of note: KSP's files are arranged very differently in Mac OSX vs Windows and in fact they are a little "quirky", you will also be browsing inside multiple ".app" files, rendering the finder window less than useful. As a consequence, if you are not comfortable with the Mac OS terminal and paths, this tutorial is not for you and you will not succeed at it. Also, pdb2mdb does not work for PDBs produced in a portable format, which your Mac OSX compiler will almost certainly produce. You will need to either select a compiler that create its own mdb or use a debugger that can decompile on it's own (like JetBrains Rider), because so few plugin developers use Mac OSX, you won't get a lot of help navigating this issue, so besides the steps, paths, and advice I lay out here, you are probably on your own. Install the correct version of Unity (down to the patch). The current correct version for KSP 1.7.2 is 2017.1.3p1; patch releases are available here -> https://unity3d.com/unity/qa/patch-releases; non-patch releases are available here -> https://unity3d.com/get-unity/download/archive (NOT what you need at time of writing) Determine your KSP install path (for me, it's "~/Library/Application Support/Steam/steamapps/common/Kerbal Space Program/") and the correct Unity version install path (for me, it's "/Applications/Unity/") Copy the debug UnityPlayer from your Unity install to your KSP install; As far as I know, this must be done from the command line `cp "[YOUR CORRECT VERSION UNITY INSTALL PATH ]/Unity.app/Contents/PlaybackEngines/MacStandaloneSupport/Variations/universal_development_mono/UnityPlayer.app/Contents/MacOS/UnityPlayer" "[YOUR KSP INSTALL PATH]/KSP.app/Contents/MacOS", for me, this command was: cp "/Applications/Unity/Unity.app/Contents/PlaybackEngines/MacStandaloneSupport/Variations/universal_development_mono/UnityPlayer.app/Contents/MacOS/UnityPlayer" "~/Library/Application Support/Steam/steamapps/common/Kerbal Space Program/KSP.app/Contents/MacOS" Go ahead and rename the UnityPlayer you copied, as far as I can tell, this has no impact on whether it will work or not but it will help you differentiate the process you need to attach to, I ran the following command: mv "~/Library/Application Support/Steam/steamapps/common/Kerbal Space Program/KSP.app/Contents/MacOS/UnityPlayer" "~/Library/Application Support/Steam/steamapps/common/Kerbal Space Program/KSP.app/Contents/MacOS/KSP_dbg" Get this file (it's just a file named PlayerConnectionConfig with contents "listen 3247424759 1 1" if it ever stops being hosted) sarbian provided and put it in the Data directory (it makes the mono debugger starts its listening port, otherwise when you are browsing unity processes to attach to, you will see KSP but it will tell you it's not accepting debug connections); for me, this copy command was: cp "~/Downloads/PlayerConnectionConfigFile" "~/Library/Application Support/Steam/steamapps/common/Kerbal Space Program/KSP.app/Contents/Resources/Data/" Ensure your toolchain will create an MDB for your plugin or select an IDE that doesn't require MDBs; this article from the team at JetBrains helped me understand what I needed to get an MDB file when compiling on Mac OS; if you use monodevelop , the mono included with your unity install will be used so this will be automatic, if you use rider or some other IDE, you will need to set your Mono executable path to the one provided by Unity, I do not know how to do this for VS on Mac and will probably not learn, it's easier to solve than any of the other items of information in this post though so, if you give up before figuring that out, you were probably going to give up anyway *shrug* Launch the debug unity player, the command for me was: cd /Library/Application Support/Steam/steamapps/common/Kerbal Space Program/KSP.app/Contents/MacOS && open KSP_dbg Run whatever command your IDE uses to attach to a Unity process. i.e. in MonoDevelop, supposedly it's "Run" > "Attach to Process", Select "Unity Debugger", find the process, in Rider (what I currently use) it's "Attached to Unity Process...". Select the KSP process and attach. Edited July 1, 2019 by whitespacekilla Quote Link to comment Share on other sites More sharing options...
sarbian Posted July 1, 2019 Author Share Posted July 1, 2019 2 minutes ago, whitespacekilla said: I figured out how to make this tutorial work for Mac Awesome. Linked in the first post. Quote Link to comment Share on other sites More sharing options...
whitespacekilla Posted July 1, 2019 Share Posted July 1, 2019 @sarbian happy to be helpful. Your original post helped me out on Windows (to such an extent that I probably wouldn't have contributed to any mods if it weren't for your post) and steered me in the right direction for Mac. Just building on Mac OS is a little different challenge that will probably invite more questions, unfortunately. For example, I have to maintain a macos.targets file that I import into my projects only if the platform is mac. That's outside of the scope of debugging so I left it out but I really don't know how many modders will be able to put it all together. If I didn't already know a lot about msbuild, I probably would have bailed on Mac OS before I even got anything to compile. Also, this method on Mac OS seems to fail to contact the SteamAPI. I'm generally okay with that (I've never used the steam features even when playing, let alone debugging a mod) but maybe that will present a challenge for someone? Quote Link to comment Share on other sites More sharing options...
sarbian Posted October 16, 2019 Author Share Posted October 16, 2019 @JPLRepo was kind enough to provide me with updated instruction for KSP 1.8. I ll paste them here and will update the OP later Quote Install 2019.2.2f1 you need these two exe's to convert the pdb to mdb: <install directory>\Editor\Editor\Data\MonoBleedingEdge\bin\mono.exe <install directory>\Editor\Editor\Data\MonoBleedingEdge\lib\mono\4.5\pdb2mdb.exe Unity No longer uses PlayerConnectionConfigFile instead you edit boot.config file (in the data directory where this file used to go) and add the line: player-connection-debug=1 For the game exe. You must copy the WindowsPlayer.exe (rename if you want) UnityPlayer.dll and WinPixEventRuntime.dll into the KSP install directory. Quote Link to comment Share on other sites More sharing options...
micha Posted October 20, 2019 Share Posted October 20, 2019 On 10/17/2019 at 6:04 AM, sarbian said: @JPLRepo was kind enough to provide me with updated instruction for KSP 1.8. I ll paste them here and will update the OP later Hmm, so I can't get this working properly. the new pdb2mdb just returns: Mono pdb to mdb debug symbol store converter Usage: pdb2mdb assembly And yes, I provide the fully-qualified name to the DLL. I've also tried running it via mono.exe (fully-qualified names for all paths) and then it returns: Fatal error: Microsoft.Cci.Pdb.PdbDebugException: Unknown custom metadata item kind: 6 at Microsoft.Cci.Pdb.PdbFunction.ReadCustomMetadata (Microsoft.Cci.Pdb.BitAccess bits) [0x000bf] in <f671d8dd00dc40a1a91abc0ef8451f08>:0 at Microsoft.Cci.Pdb.PdbFunction..ctor (System.String module, Microsoft.Cci.Pdb.ManProcSym proc, Microsoft.Cci.Pdb.BitAccess bits) [0x00213] in <f671d8dd00dc40a1a91abc0ef8451f08>:0 at Microsoft.Cci.Pdb.PdbFunction.LoadManagedFunctions (System.String module, Microsoft.Cci.Pdb.BitAccess bits, System.UInt32 limit, System.Boolean readStrings) [0x001e7] in <f671d8dd00dc40a1a91abc0ef8451f08>:0 at Microsoft.Cci.Pdb.PdbFile.LoadFuncsFromDbiModule (Microsoft.Cci.Pdb.BitAccess bits, Microsoft.Cci.Pdb.DbiModuleInfo info, Microsoft.Cci.Pdb.IntHashTable names, System.Collections.ArrayList funcList, System.Boolean readStrings, Microsoft.Cci.Pdb.MsfDirectory dir, System.Collections.Generic.Dictionary`2[TKey,TValue] nameIndex, Microsoft.Cci.Pdb.PdbReader reader) [0x00039] in <f671d8dd00dc40a1a91abc0ef8451f08>:0 at Microsoft.Cci.Pdb.PdbFile.LoadFunctions (System.IO.Stream read, Microsoft.Cci.Pdb.BitAccess bits, System.Boolean readAllStrings) [0x000c8] in <f671d8dd00dc40a1a91abc0ef8451f08>:0 at Microsoft.Cci.Pdb.PdbFile.LoadFunctions (System.IO.Stream read, System.Boolean readAllStrings) [0x0000b] in <f671d8dd00dc40a1a91abc0ef8451f08>:0 at Pdb2Mdb.Driver.Convert (Mono.Cecil.AssemblyDefinition assembly, System.IO.Stream pdb, Mono.CompilerServices.SymbolWriter.MonoSymbolWriter mdb) [0x00000] in <f671d8dd00dc40a1a91abc0ef8451f08>:0 There's some very old information about this error but nothing current. All suggestions seem to be to use a standalone pdb2mdb program (which is the one I was using up to now). But using that one I can't set breakpoints so I'm guessing something has changed. I eventually had some luck creating an MDB with this tool: https://github.com/shravan2x/Pdb2Mdb-GUI/releases Looking at the code, it should be easy enough to create a command-line utility based on it. However, it is now ridiculously slow to attach/debug, with pauses up to 10+ minutes. Not sure if others are seeing this, if not, any suggestions on what I should look at? I have tried both VS2017 and 2019. PS. for the game exe, you must rename WindowsPlayer.exe and/or rename/symlink KSP_x64_Data appropriately as before. Quote Link to comment Share on other sites More sharing options...
JPLRepo Posted October 20, 2019 Share Posted October 20, 2019 38 minutes ago, micha said: Hmm, so I can't get this working properly. the new pdb2mdb just returns: Mono pdb to mdb debug symbol store converter Usage: pdb2mdb assembly And yes, I provide the fully-qualified name to the DLL. I've also tried running it via mono.exe (fully-qualified names for all paths) and then it returns: Fatal error: Microsoft.Cci.Pdb.PdbDebugException: Unknown custom metadata item kind: 6 at Microsoft.Cci.Pdb.PdbFunction.ReadCustomMetadata (Microsoft.Cci.Pdb.BitAccess bits) [0x000bf] in <f671d8dd00dc40a1a91abc0ef8451f08>:0 at Microsoft.Cci.Pdb.PdbFunction..ctor (System.String module, Microsoft.Cci.Pdb.ManProcSym proc, Microsoft.Cci.Pdb.BitAccess bits) [0x00213] in <f671d8dd00dc40a1a91abc0ef8451f08>:0 at Microsoft.Cci.Pdb.PdbFunction.LoadManagedFunctions (System.String module, Microsoft.Cci.Pdb.BitAccess bits, System.UInt32 limit, System.Boolean readStrings) [0x001e7] in <f671d8dd00dc40a1a91abc0ef8451f08>:0 at Microsoft.Cci.Pdb.PdbFile.LoadFuncsFromDbiModule (Microsoft.Cci.Pdb.BitAccess bits, Microsoft.Cci.Pdb.DbiModuleInfo info, Microsoft.Cci.Pdb.IntHashTable names, System.Collections.ArrayList funcList, System.Boolean readStrings, Microsoft.Cci.Pdb.MsfDirectory dir, System.Collections.Generic.Dictionary`2[TKey,TValue] nameIndex, Microsoft.Cci.Pdb.PdbReader reader) [0x00039] in <f671d8dd00dc40a1a91abc0ef8451f08>:0 at Microsoft.Cci.Pdb.PdbFile.LoadFunctions (System.IO.Stream read, Microsoft.Cci.Pdb.BitAccess bits, System.Boolean readAllStrings) [0x000c8] in <f671d8dd00dc40a1a91abc0ef8451f08>:0 at Microsoft.Cci.Pdb.PdbFile.LoadFunctions (System.IO.Stream read, System.Boolean readAllStrings) [0x0000b] in <f671d8dd00dc40a1a91abc0ef8451f08>:0 at Pdb2Mdb.Driver.Convert (Mono.Cecil.AssemblyDefinition assembly, System.IO.Stream pdb, Mono.CompilerServices.SymbolWriter.MonoSymbolWriter mdb) [0x00000] in <f671d8dd00dc40a1a91abc0ef8451f08>:0 There's some very old information about this error but nothing current. All suggestions seem to be to use a standalone pdb2mdb program (which is the one I was using up to now). But using that one I can't set breakpoints so I'm guessing something has changed. I eventually had some luck creating an MDB with this tool: https://github.com/shravan2x/Pdb2Mdb-GUI/releases Looking at the code, it should be easy enough to create a command-line utility based on it. However, it is now ridiculously slow to attach/debug, with pauses up to 10+ minutes. Not sure if others are seeing this, if not, any suggestions on what I should look at? I have tried both VS2017 and 2019. PS. for the game exe, you must rename WindowsPlayer.exe and/or rename/symlink KSP_x64_Data appropriately as before. Can assure you it works using the mono.exe pdb2mdb.exe <assembly> run the fully qualified ones as per the directories Listed above (from Unity 2019.2.2f1) in the folder your assembly and pdb files are in. you must be using the bleeding edge ones as specified. Quote Link to comment Share on other sites More sharing options...
micha Posted October 20, 2019 Share Posted October 20, 2019 31 minutes ago, JPLRepo said: Can assure you it works using the mono.exe pdb2mdb.exe <assembly> run the fully qualified ones as per the directories Listed above (from Unity 2019.2.2f1) in the folder your assembly and pdb files are in. you must be using the bleeding edge ones as specified. That's what I do: S:\KSP\NEOS\OrbitalMaterialScience\Plugin\NE_Science\bin\Debug>"C:\Program Files\Unity_2019.2.2f1\Editor\Data\MonoBleedingEdge\bin\mono.exe" "C:\Program Files\Unity_2019.2.2f1\Editor\Data\Mono\lib\mono\2.0\pdb2mdb.exe" "S:\KSP\NEOS\OrbitalMaterialScience\Plugin\NE_Science\bin\Debug\NE_Science.dll" S:\KSP\NEOS\OrbitalMaterialScience\Plugin\NE_Science\bin\Debug>dir Volume in drive S is Data Volume Serial Number is B4D4-1AFF Directory of S:\KSP\NEOS\OrbitalMaterialScience\Plugin\NE_Science\bin\Debug 20/10/2019 21:34 <DIR> . 20/10/2019 21:34 <DIR> .. 20/10/2019 19:28 173,568 NE_Science.dll 20/10/2019 19:28 448,000 NE_Science.pdb 2 File(s) 621,568 bytes 2 Dir(s) 68,200,980,480 bytes free Quote Link to comment Share on other sites More sharing options...
sarbian Posted October 20, 2019 Author Share Posted October 20, 2019 15 minutes ago, micha said: Unity_2019.2.2f1\Editor\Data\Mono\lib\mono\2.0\pdb2mdb.exe You are using the mono 2.0 old one. You need the Unity_2019.2.2f1\Editor\Data\MonoBleedingEdge\lib\mono\4.5\pdb2mdb.exe Quote Link to comment Share on other sites More sharing options...
micha Posted October 20, 2019 Share Posted October 20, 2019 1 hour ago, sarbian said: You are using the mono 2.0 old one. You need the Unity_2019.2.2f1\Editor\Data\MonoBleedingEdge\lib\mono\4.5\pdb2mdb.exe *sigh* Thank you! No idea how I did that / didn't pick up on that when I was double-checking. Obviously in need of moar kawfee! Confirm that one is working now. Quote Link to comment Share on other sites More sharing options...
micha Posted October 20, 2019 Share Posted October 20, 2019 PS. It still takes _forever_ (easily 10+ minutes) to proceed when attaching the debugger though. Any ideas what might be causing this? No such issues with previous versions of KSP. Quote Link to comment Share on other sites More sharing options...
Gotmachine Posted November 1, 2019 Share Posted November 1, 2019 (edited) Urgh... guys, pdb2mdb isn't needed anymore. Since 1.8, we have finally emerged from the dark ages of mono. Just change your *.csproj to generate "portable" debug symbols instead of the old and depreciated "full" format. The generated *.pdb file will be usable without any conversion using the Unity debugger for VS (and extra bonus, it should work on the VS for mac / monodevelop unity debugger plugin on OSX/linux) Either edit directly your *.csproj and change : <DebugType>full</DebugType> to : <DebugType>portable</DebugType> or in VS, go to your "project properties" > "Build" tab > "Advanced" button > "Debugging information" > "Portable" : Edited November 1, 2019 by Gotmachine Quote Link to comment Share on other sites More sharing options...
Papa_Joe Posted November 12, 2019 Share Posted November 12, 2019 (edited) for those that would like, I have created a batch script that automates the update and distribution of a new game to my development environment. It makes the process very painless. The batch script is menu driven, so you can perform all actions, or only one at a time. Also it pauses between steps, so you can see what is going on. This script is specific to my environment, but it uses txt files for folder locations, so you should be able to adapt it for your needs and your environment. @echo off rem This file sets up a fresh Development mode install of KSP from a Steam installation rem This script assumes that an existing development copy exist somewhere on your system besides steam. rem The script uses text files containing locations of various components needed for the script to work. rem Change Log: rem v2.0 add support for unity 2019. cd %~dp0 set LCL_DIR=%~dp0 set VERSION="" set space = " " set /p GIT_DIR=<"%LCL_DIR%\git_dir.txt" set /p STEAM_DIR=<"%GIT_DIR%\_LocalDev\steam_dir.txt" set /p KSP_DIR=<"%GIT_DIR%\_LocalDev\ksp_dir.txt" @echo: @echo Path tokens: @echo - LCL_DIR: %LCL_DIR% @echo - STEAM_DIR: %STEAM_DIR% @echo - GIT_DIR: %GIT_DIR% @echo - KSP_DIR: %KSP_DIR% @echo: @echo Let's get the version of the existing game... rem get_versions set steamVer = "" for /F "usebackq skip=13 delims=" %%V in ("%STEAM_DIR%\readme.txt") do set "steamVer=%%V" & goto Steamvalue :Steamvalue set thisVer = "" for /F "usebackq skip=13 delims=" %%V in ("%KSP_DIR%\readme.txt") do set "thisVer=%%V" & goto Hasvalue :Hasvalue call set VERSION=%%thisVer:Version =%word%%% @echo - Steam Version found is: %steamVer% @echo - Dev Version found is: %thisVer% set /p quit= " - Do you wish to continue? (Y/N): " if /i "%quit%" == "N" ( @echo - Terminating batch operation without executing Dev Setup... goto end ) :menu @echo: @echo: @echo ==================================================== @echo Main Menu: @echo: @echo 1 - Perform all steps... @echo 2 - Backup existing game folder... @echo 3 - Remove existing game folder... @echo 4 - Create new game folder... @echo 5 - Copy Steam game folder... @echo 6 - Copy new KSP assemblies to Dev... @echo 7 - Copy Dev Debug files to Game folder... @echo 8 - Copy Game Save and Ships to Game folder... @echo 9 - Create linked folder... @echo X - Quit script (Do nothing!) @echo ==================================================== @echo: set /p optn= "---> Select option (1 - 9, X): " @echo: @echo Choice made: "%optn%" @echo: if "%optn%" == "1" ( goto backupGame ) if "%optn%" == "2" ( goto backupGame ) if "%optn%" == "3" ( goto removeGame ) if "%optn%" == "4" ( goto createFolder ) if "%optn%" == "5" ( goto copyGame ) if "%optn%" == "6" ( goto copyAssemblies ) if "%optn%" == "7" ( goto copyDebugFiles ) if "%optn%" == "8" ( goto copyGameSaves ) if "%optn%" == "9" ( goto createLinkedFolder ) if /I "%optn%" == "X" ( goto end ) goto end :backupGame @echo: @echo - Backup existing game folder... @echo: pause @echo: @echo - Backup in progress, please wait... xcopy /E /Y /Q "%KSP_DIR%\*.*" "%KSP_DIR%_%VERSION%_old\" @echo - Backup complete... @echo: if not "%optn%" == "1" ( goto end ) :removeGame @echo - Removing existing game folder... pause rmdir /s /q "%KSP_DIR%" @echo - Removal complete... @echo: if not "%optn%" == "1" ( goto end ) :createFolder @echo - Creating new game folder... pause if not exist "%KSP_DIR%" ( mkdir "%KSP_DIR%" @echo - Game folder created... ) else ( @echo - Game folder exists. Skipping... ) @echo: if not "%optn%" == "1" ( goto end ) :copyGame @echo - Ready to Copy Steam Game to local Game folder... @echo from: "%STEAM_DIR%" @echo to: "%KSP_DIR%" pause xcopy /E /Y "%STEAM_DIR%\*.*" "%KSP_DIR%\" @echo - Copy complete... @echo: if not "%optn%" == "1" ( goto end ) :copyAssemblies @echo - Ready to Copy KSP and unity assemblies @echo from: "%KSP_DIR%\KSP_x64_Data\Managed" @echo to: "%GIT_DIR%\_LocalDev\KSPRefs\" folder... pause xcopy /E /Y "%KSP_DIR%\KSP_x64_Data\Managed\Assembly-CSharp.dll" "%GIT_DIR%\_LocalDev\KSPRefs\" xcopy /E /Y "%KSP_DIR%\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll" "%GIT_DIR%\_LocalDev\KSPRefs\" xcopy /E /Y "%KSP_DIR%\KSP_x64_Data\Managed\KSPAssets.dll" "%GIT_DIR%\_LocalDev\KSPRefs\" xcopy /E /Y "%KSP_DIR%\KSP_x64_Data\Managed\UnityEngine.dll" "%GIT_DIR%\_LocalDev\KSPRefs\" xcopy /E /Y "%KSP_DIR%\KSP_x64_Data\Managed\UnityEngine.*.dll" "%GIT_DIR%\_LocalDev\KSPRefs\" xcopy /Y "%KSP_DIR%\readme.txt" "%GIT_DIR%\_LocalDev\KSPRefs\" @echo - Copy complete... @echo: if not "%optn%" == "1" ( goto end ) :copyDebugFiles @echo - Ready to Copy unity debug files to game folder and set debug mode... pause @echo player-connection-debug=1 >> "%KSP_DIR%\KSP_x64_Data\boot.config copy /Y "%LCL_DIR%\WindowsPlayer.exe" "%KSP_DIR%\ksp_x64_dbg.exe" copy /Y "%LCL_DIR%\UnityPlayer.dll" "%KSP_DIR%" copy /Y "%LCL_DIR%\WinPixEventRuntime.dll" "%KSP_DIR%" @echo - Copy complete... @echo: if not "%optn%" == "1" ( goto end ) :copyGameSaves @echo - Ready to Copy ships, Saves and mods to the new game folder. pause xcopy /E /Y /D "%KSP_DIR%_%VERSION%_old\GameData\*.*" "%KSP_DIR%\GameData\" xcopy /E /Y /D "%KSP_DIR%_%VERSION%_old\ships\*.*" "%KSP_DIR%\Ships\" xcopy /E /Y /D "%KSP_DIR%_%VERSION%_old\saves\*.*" "%KSP_DIR%\saves\" @echo - Copy complete... @echo: if not "%optn%" == "1" ( goto end ) :createLinkedFolder @echo - Ready to create the linked folder for debugging... @echo: pause REM cd /d "%KSP_DIR%" REM @echo - Curr Dir: "%cd%" REM @echo - Game Directory: "%KSP_DIR%"... REM @echo: REM pause mklink /J "%KSP_DIR%"\KSP_x64_Dbg_Data "%KSP_DIR%"\KSP_x64_Data @echo - Linked folder created... @echo: :end cd %~dp0 @echo - %~dp0 @echo: @echo - script complete... @echo: pause The script performs the following actions: 1. checks to see if a new version of the game exists in Steam, compared to the latest copy of your development version of the game. It checks the readme.txt to get the version information. 2. Backs up the existing dev game folder for archival needs. 3. deletes the existing dev game folder 4. Copies all files from the steam installation into a new game folder. 5. copies all the KSP and unity assemblies needed for development into a location of your choice. I do this to ensure I have the latest assemblies, and they are not tied to my steam installation. Keeps them in sync. Makes multi developer easier, as the assemblies are in a common location for all KSP mods I supported. 6. Copies the debug files ( WIndowsPLayer.exe, UnityPlayer.dll and WinPixEventRuntime.dll into the dev game root folder It also sets the flag in Boot.config. 7 Copies any existing saves, ships, and mods from the previous dev game installation over to the new Dev Game installation. 8. Creates the linked Folder, and finally lets you know it is done. I hope this is helpful. The paths in the .txt files are one line only. This is assumed by the command reading from the file. It will only retrieve the first line. You could add all paths to a single file if you wish and simply read each line and assign to your vars using a different file handling technique. If you have any questions, let me know. This script has been tested, and I use it regularly. It should work both by executing the script as a .bat, or by running it in power shell. Edited November 12, 2019 by Papa_Joe Quote Link to comment Share on other sites More sharing options...
micha Posted November 15, 2019 Share Posted November 15, 2019 On 11/12/2019 at 4:48 PM, Papa_Joe said: 5. copies all the KSP and unity assemblies needed for development into a location of your choice. I do this to ensure I have the latest assemblies, and they are not tied to my steam installation. Keeps them in sync. Makes multi developer easier, as the assemblies are in a common location for all KSP mods I supported. Great script, thanks for sharing! My personal approach to Step #5 though is to set a "KSP_Dir" variable in a project file (or props, or project.user) and use that to reference the Assemblies. Of course that is pointed at my current "KSP_Dev" directory, never at my Steam install or play-through install. This way I ensure whatever version I'm testing was also the version I used to compile, and there's no need to keep the Assemblies in multiple locations and remember to keep them in sync. With this approach all another developer (or myself on another machine which has a different directory layout) has to do is update that one variable and all assemblies are referenced correctly. If using the .user file approach (which shouldn't be committed to GIT) it's also very easy for multiple developers to work on a project without constantly having issues with spurious updates to the project files. Horses for courses On 11/1/2019 at 10:32 PM, Gotmachine said: Urgh... guys, pdb2mdb isn't needed anymore. Since 1.8, we have finally emerged from the dark ages of mono. Thank you!!! Quote Link to comment Share on other sites More sharing options...
fatcargo Posted December 15, 2019 Share Posted December 15, 2019 (edited) I had a problem with breakpoints not being hit while debugging code. On a line with breakpoint i had a yellow circle with an exclamation mark and a popup text saying "The breakpoint will not currently be hit. Unable to find a corresponding location.". After some struggle i found a solution at https://stackoverflow.com/a/46720817. Basically i did the same but instead using Net 2.0 i switched from original 4.5 to 4.0 and back to 4.5. Each time VS informed to re-save the project. After that i followed instructions with a clean and rebuild and it worked. My breakpoints work again. It may be worth mentioning i had OS and VS on a SSD while project files and game itself are on another HDD. It appears that VS is not properly flushing cached files, causing .pdb to be out of sync with plugin .dll. It also explains why new project had no problems and as time went on it started to misbehave. Cycling between 4.0 and 4.5 may be an overkill but i mention it just in case. Edited December 15, 2019 by fatcargo Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted December 16, 2019 Share Posted December 16, 2019 On 11/12/2019 at 2:48 AM, Papa_Joe said: for those that would like, I have created a batch script that automates the update and distribution of a new game to my development environment. It makes the process very painless. The batch script is menu driven, so you can perform all actions, or only one at a time. Also it pauses between steps, so you can see what is going on. This script is specific to my environment, but it uses txt files for folder locations, so you should be able to adapt it for your needs and your environment. @echo off rem This file sets up a fresh Development mode install of KSP from a Steam installation rem This script assumes that an existing development copy exist somewhere on your system besides steam. rem The script uses text files containing locations of various components needed for the script to work. rem Change Log: rem v2.0 add support for unity 2019. cd %~dp0 set LCL_DIR=%~dp0 set VERSION="" set space = " " set /p GIT_DIR=<"%LCL_DIR%\git_dir.txt" set /p STEAM_DIR=<"%GIT_DIR%\_LocalDev\steam_dir.txt" set /p KSP_DIR=<"%GIT_DIR%\_LocalDev\ksp_dir.txt" @echo: @echo Path tokens: @echo - LCL_DIR: %LCL_DIR% @echo - STEAM_DIR: %STEAM_DIR% @echo - GIT_DIR: %GIT_DIR% @echo - KSP_DIR: %KSP_DIR% @echo: @echo Let's get the version of the existing game... rem get_versions set steamVer = "" for /F "usebackq skip=13 delims=" %%V in ("%STEAM_DIR%\readme.txt") do set "steamVer=%%V" & goto Steamvalue :Steamvalue set thisVer = "" for /F "usebackq skip=13 delims=" %%V in ("%KSP_DIR%\readme.txt") do set "thisVer=%%V" & goto Hasvalue :Hasvalue call set VERSION=%%thisVer:Version =%word%%% @echo - Steam Version found is: %steamVer% @echo - Dev Version found is: %thisVer% set /p quit= " - Do you wish to continue? (Y/N): " if /i "%quit%" == "N" ( @echo - Terminating batch operation without executing Dev Setup... goto end ) :menu @echo: @echo: @echo ==================================================== @echo Main Menu: @echo: @echo 1 - Perform all steps... @echo 2 - Backup existing game folder... @echo 3 - Remove existing game folder... @echo 4 - Create new game folder... @echo 5 - Copy Steam game folder... @echo 6 - Copy new KSP assemblies to Dev... @echo 7 - Copy Dev Debug files to Game folder... @echo 8 - Copy Game Save and Ships to Game folder... @echo 9 - Create linked folder... @echo X - Quit script (Do nothing!) @echo ==================================================== @echo: set /p optn= "---> Select option (1 - 9, X): " @echo: @echo Choice made: "%optn%" @echo: if "%optn%" == "1" ( goto backupGame ) if "%optn%" == "2" ( goto backupGame ) if "%optn%" == "3" ( goto removeGame ) if "%optn%" == "4" ( goto createFolder ) if "%optn%" == "5" ( goto copyGame ) if "%optn%" == "6" ( goto copyAssemblies ) if "%optn%" == "7" ( goto copyDebugFiles ) if "%optn%" == "8" ( goto copyGameSaves ) if "%optn%" == "9" ( goto createLinkedFolder ) if /I "%optn%" == "X" ( goto end ) goto end :backupGame @echo: @echo - Backup existing game folder... @echo: pause @echo: @echo - Backup in progress, please wait... xcopy /E /Y /Q "%KSP_DIR%\*.*" "%KSP_DIR%_%VERSION%_old\" @echo - Backup complete... @echo: if not "%optn%" == "1" ( goto end ) :removeGame @echo - Removing existing game folder... pause rmdir /s /q "%KSP_DIR%" @echo - Removal complete... @echo: if not "%optn%" == "1" ( goto end ) :createFolder @echo - Creating new game folder... pause if not exist "%KSP_DIR%" ( mkdir "%KSP_DIR%" @echo - Game folder created... ) else ( @echo - Game folder exists. Skipping... ) @echo: if not "%optn%" == "1" ( goto end ) :copyGame @echo - Ready to Copy Steam Game to local Game folder... @echo from: "%STEAM_DIR%" @echo to: "%KSP_DIR%" pause xcopy /E /Y "%STEAM_DIR%\*.*" "%KSP_DIR%\" @echo - Copy complete... @echo: if not "%optn%" == "1" ( goto end ) :copyAssemblies @echo - Ready to Copy KSP and unity assemblies @echo from: "%KSP_DIR%\KSP_x64_Data\Managed" @echo to: "%GIT_DIR%\_LocalDev\KSPRefs\" folder... pause xcopy /E /Y "%KSP_DIR%\KSP_x64_Data\Managed\Assembly-CSharp.dll" "%GIT_DIR%\_LocalDev\KSPRefs\" xcopy /E /Y "%KSP_DIR%\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll" "%GIT_DIR%\_LocalDev\KSPRefs\" xcopy /E /Y "%KSP_DIR%\KSP_x64_Data\Managed\KSPAssets.dll" "%GIT_DIR%\_LocalDev\KSPRefs\" xcopy /E /Y "%KSP_DIR%\KSP_x64_Data\Managed\UnityEngine.dll" "%GIT_DIR%\_LocalDev\KSPRefs\" xcopy /E /Y "%KSP_DIR%\KSP_x64_Data\Managed\UnityEngine.*.dll" "%GIT_DIR%\_LocalDev\KSPRefs\" xcopy /Y "%KSP_DIR%\readme.txt" "%GIT_DIR%\_LocalDev\KSPRefs\" @echo - Copy complete... @echo: if not "%optn%" == "1" ( goto end ) :copyDebugFiles @echo - Ready to Copy unity debug files to game folder and set debug mode... pause @echo player-connection-debug=1 >> "%KSP_DIR%\KSP_x64_Data\boot.config copy /Y "%LCL_DIR%\WindowsPlayer.exe" "%KSP_DIR%\ksp_x64_dbg.exe" copy /Y "%LCL_DIR%\UnityPlayer.dll" "%KSP_DIR%" copy /Y "%LCL_DIR%\WinPixEventRuntime.dll" "%KSP_DIR%" @echo - Copy complete... @echo: if not "%optn%" == "1" ( goto end ) :copyGameSaves @echo - Ready to Copy ships, Saves and mods to the new game folder. pause xcopy /E /Y /D "%KSP_DIR%_%VERSION%_old\GameData\*.*" "%KSP_DIR%\GameData\" xcopy /E /Y /D "%KSP_DIR%_%VERSION%_old\ships\*.*" "%KSP_DIR%\Ships\" xcopy /E /Y /D "%KSP_DIR%_%VERSION%_old\saves\*.*" "%KSP_DIR%\saves\" @echo - Copy complete... @echo: if not "%optn%" == "1" ( goto end ) :createLinkedFolder @echo - Ready to create the linked folder for debugging... @echo: pause REM cd /d "%KSP_DIR%" REM @echo - Curr Dir: "%cd%" REM @echo - Game Directory: "%KSP_DIR%"... REM @echo: REM pause mklink /J "%KSP_DIR%"\KSP_x64_Dbg_Data "%KSP_DIR%"\KSP_x64_Data @echo - Linked folder created... @echo: :end cd %~dp0 @echo - %~dp0 @echo: @echo - script complete... @echo: pause The script performs the following actions: 1. checks to see if a new version of the game exists in Steam, compared to the latest copy of your development version of the game. It checks the readme.txt to get the version information. 2. Backs up the existing dev game folder for archival needs. 3. deletes the existing dev game folder 4. Copies all files from the steam installation into a new game folder. 5. copies all the KSP and unity assemblies needed for development into a location of your choice. I do this to ensure I have the latest assemblies, and they are not tied to my steam installation. Keeps them in sync. Makes multi developer easier, as the assemblies are in a common location for all KSP mods I supported. 6. Copies the debug files ( WIndowsPLayer.exe, UnityPlayer.dll and WinPixEventRuntime.dll into the dev game root folder It also sets the flag in Boot.config. 7 Copies any existing saves, ships, and mods from the previous dev game installation over to the new Dev Game installation. 8. Creates the linked Folder, and finally lets you know it is done. I hope this is helpful. The paths in the .txt files are one line only. This is assumed by the command reading from the file. It will only retrieve the first line. You could add all paths to a single file if you wish and simply read each line and assign to your vars using a different file handling technique. If you have any questions, let me know. This script has been tested, and I use it regularly. It should work both by executing the script as a .bat, or by running it in power shell. A few questions: Can you please explain the differences between the following. I've listed them with what I think you are doing: LCL_DIR the main debug directory STEAM_DIR The source directory for the game itself GIT_DIR unknown. KSP_DIR The directory where the game is copied to and changes made Without an examples of what you are doing, the GIT_DIR and KSP_DIr are somewhat of a mystery. What I don't' understand is what the KSPRefs directory is used for, it's not part of KSP, and other than copying files there, I don't see the script doing anything with it. In fact, I can run the script and leave out the "copyAssemblies" step, and it will works. Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted December 22, 2019 Share Posted December 22, 2019 (edited) @Papa_Joe's script makes it easier to set up a debug build, once you can figure it out. I've rewritten it in bash, targeted at CygWin on Windows. While I haven't tested it yet on Linux, there are only a few places in the code which are Windows-specific, and I've hopefully been able to surround them with if/else/fi I provide it here for free, any license which may apply would be the UnLicense. While not an official mod per se, I'll answer questions about it and update it if necessary #!/bin/bash # detailed information located here: https://forum.kerbalspaceprogram.com/index.php?/topic/102909-*/ # This file sets up a fresh Development mode install of KSP from a specified KSP installation. # If CKAN is installed, it will present a list of all installs in CKAN to choose from. # Change Log: # v2.0 add support for unity 2019. # v3.0 Converted to bash shell, tested in Cygwin # Now accesses CKAN if installed and specified to get list of installs # # This script was written for use on CygWin on Windows # While untested, setting the variable WINDOWS to false should disable the Windows-specific code # It also assumes that all the # # # The script currently is set up for KSP 1.8. For earlier versions of the game # you will have to update where the correct version of UNITY for that version of KSP is installed # clear # # The following lines need to be customized for each environment # WINDOWS=true CKAN_EXE=/d/KerbalInstalls/ckan/ckan.exe KSP_EXE=ksp_x64_dbg.exe GAME_DIR=/r/KSP_1.8.1_Career # source game directory LCL_DIR=/r/dp0 # source directory for Unity debug finish # # Specify the desired window size here # WIDTH=1600 HEIGHT=1024 # # The location where the correct version of Unity is installed # UNITY="/e/Program Files/Unity524f1" ##### End of customizable lines ############################ # ##### You should not need to change any of the lines below UNITYDIR="${UNITY}/Editor/Data/PlaybackEngines/windowsstandalonesupport/Variations/win64_development_mono" WINDOWSPLAYER="${UNITYDIR}"/WindowsPlayer.exe UNITYPLAYER="${UNITYDIR}"/UnityPlayer.dll EVENTRUNTIME="${UNITYDIR}"/WinPixEventRuntime.dll if [ ! -f "${WINDOWSPLAYER}" ]; then echo -e "\nMissing WindowsPlayer exe: $WINDOWSPLAYER" exit fi IFS=$oIFS KSP_DIR=${LCL_DIR}/kspdev # destination for the debug install tmpfile=tmp.$$ oIFS=$IFS doallsteps=false # ########### Functions ################ # function GetKspInstalls { [ "$CKAN_EXE" = "" ] && return [ ! -f $CKAN_EXE ] && return $CKAN_EXE ksp list > $tmpfile cnt=-1 IFS= while read line; do if [ $cnt -le 0 ]; then echo " $line" else printf "%4d " $cnt echo $line arr[$cnt]=$line fi cnt=$((cnt+1)) done < $tmpfile rm $tmpfile echo -ne "\nEnter number of install to copy, press <return> for default ($GAME_DIR): " read n } # # Display a prompt, if supplied and wait for user entry # function prompt { echo $1 [ $doallsteps = false ] && read -p "Press <return> to continue" } # # Do all steps to set up the dev install # function DoAll() { doallsteps=true backupGame removeGame createFolder copyGame copyDebugFiles createLinkedFolder resetResolution finish } # # Make a backup of the current dev build # function backupGame { if [ ! -d $KSP_DIR ]; then echo "No game directory available to backup" else prompt "- Backup existing game folder..." echo echo - Backup in progress, please wait... #xcopy /E /Y /Q ""${KSP_DIR}"/*.*" ""${KSP_DIR}"_%VERSION%_old/" rm -fr "${KSP_DIR}"_${VERSION}_old mkdir "${KSP_DIR}"_${VERSION}_old cp -a "${KSP_DIR}" "${KSP_DIR}"_${VERSION}_old echo - Backup complete... echo fi } # # Remove the current dev build # function removeGame { if [ ! -d $KSP_DIR ]; then echo "No game directory available to remove" else prompt " - Removing existing game folder..." pause #rmdir /s /q ""${KSP_DIR}"" rm -fr "${KSP_DIR}" echo - Removal complete... echo fi } # # Create new game folder # function createFolder { prompt " - Creating new game folder..." pause if [ ! -f ""${KSP_DIR}"" ]; then mkdir "${KSP_DIR}" echo - Game folder created... else echo - Game folder exists. Skipping... fi echo } # # Copy the entire game from the $GAME_DIR # function copyGame { echo - Ready to Copy specified KSP Game to local Game folder... echo from: ""${GAME_DIR}"" echo to: ""${KSP_DIR}"" prompt "" cp -a "${GAME_DIR}"/* "${KSP_DIR}"/ echo - Copy complete... echo } # # Copy the files needed to setup the install as a debug build # function copyDebugFiles { prompt " - Ready to Copy unity debug files to game folder and set debug mode..." echo player-connection-debug=1 >> ""${KSP_DIR}"/KSP_x64_Data/boot.config" cp "${WINDOWSPLAYER}" "${KSP_DIR}"/ksp_x64_dbg.exe cp "${UNITYPLAYER}" "${KSP_DIR}" cp "${EVENTRUNTIME}" "${KSP_DIR}" echo - Copy complete... echo } # # Copy the Game savefiles, not called when doing all # function copyGameSaves { prompt " - Ready to Copy ships, Saves and mods to the new game folder." pause #xcopy /E /Y /D ""${KSP_DIR}"_%VERSION%_old/GameData/*.*" ""${KSP_DIR}"/GameData/" #xcopy /E /Y /D ""${KSP_DIR}"_%VERSION%_old/ships/*.*" ""${KSP_DIR}"/Ships/" #xcopy /E /Y /D ""${KSP_DIR}"_%VERSION%_old/saves/*.*" ""${KSP_DIR}"/saves/" cp -a "${KSP_DIR}"_${VERSION}_old/GameData/* "${KSP_DIR}"/GameData/ if [ -d "${KSP_DIR}"_${VERSION}_old/ships ]; then cp -a "${KSP_DIR}"_${VERSION}_old/ships/* "${KSP_DIR}"/Ships/ else [ ! -d "${KSP_DIR}"/Ships } && mkdir "${KSP_DIR}"/Ships fi if [ -d "${KSP_DIR}"_${VERSION}_old/saves ]; then cp -a "${KSP_DIR}"_${VERSION}_old/saves/* "${KSP_DIR}"/saves/ else [ ! -d "${KSP_DIR}"/saves ] && mkdir "${KSP_DIR}"/saves fi echo - Copy complete... echo } # # Create the link needed for debugging # function createLinkedFolder { prompt " - Ready to create the linked folder for debugging..." pause #REM cd /d ""${KSP_DIR}"" #REM @echo - Curr Dir: "%cd%" #REM @echo - Game Directory: ""${KSP_DIR}""... #REM @echo: #REM pause #rem mklink /J ""${KSP_DIR}""/KSP_x64_Dbg_Data ""${KSP_DIR}""/KSP_x64_Data ln -s "${KSP_DIR}"/KSP_x64_Data "${KSP_DIR}"/KSP_x64_Dbg_Data echo - Linked folder created... echo } # # Set the resolution to the predetermined values. This will overwrite # whatever is set in the settings.cfg # function resetResolution { sed -i "s/^SCREEN_RESOLUTION_WIDTH.*/SCREEN_RESOLUTION_WIDTH = ${WIDTH}/" ${KSP_DIR}/settings.cfg sed -i "s/^SCREEN_RESOLUTION_HEIGHT.*/SCREEN_RESOLUTION_HEIGHT = ${HEIGHT}/" ${KSP_DIR}/settings.cfg sed -i "s/^FULLSCREEN.*/FULLSCREEN = False/" ${KSP_DIR}/settings.cfg } function finish { echo echo - script complete... echo } GetKspInstalls if [ "$n" != "" -a $cnt -gt -1 ]; then if [ "$n" -ge 0 -a "$n" -le $cnt ] 2>/dev/null; then echo ok selected=`echo ${arr[n]} | cut -c59- | sed 's/://g' ` if [ $WINDOWS = true ]; then selected=`echo "${selected,}"` selected="/$selected" fi else echo Invalid number entered, exiting exit fi fi [ "$selected" != "" ] && GAME_DIR=$selected echo -e "\n\n\nSource game directory: $GAME_DIR" echo read -p "Press <return> to use default or enter the source directory: " sd [ "$selected" != "" ] && GAME_DIR=`echo $selected` GAME_DIR=`echo $GAME_DIR | sed 's/ *$//g'` echo "Selected game directory: '$GAME_DIR'" if [ ! -d "${GAME_DIR}" ]; then echo "Source game directory not found, exiting" exit fi VERSION="" # will contain the version number only cat <<__EOF__ Path tokens: LCL_DIR: "${LCL_DIR}" GAME_DIR: "${GAME_DIR}" KSP_DIR: "${KSP_DIR}" Let's get the version of the existing game... __EOF__ # get_versions steamVer=`grep ^Version "${GAME_DIR}"/readme.txt` [ -d "${KSP_DIR}" ] && thisVer=`grep ^Version "${KSP_DIR}"/readme.txt` VERSION="$thisVer" echo $thisVer VERSION=`echo $thisVer | cut -f2 -d' '` echo - Game Version found is: $steamVer [ "$thisVer" != "" ] && echo " Dev Version found is: $thisVer" echo read -p " - Do you wish to continue? (Y/N): " quit if [ "$quit" == "n" -o "$quit" == "N" ]; then echo "Terminating batch operation without executing Dev Setup..." exit fi while [ "$optn" != 'X' -a "$optn" != 'x' -a "$optn" != 'Q' -a "$optn" != 'q' ]; do cat <<_EOF_ ==================================================== Main Menu: 1 - Perform all steps 2 - Backup existing game folder 3 - Remove existing game folder 4 - Create new game folder 5 - Copy source game folder 7 - Copy Dev Debug files to Game folder 8 - Copy Game Save and Ships to Game folder 9 - Create linked folder 10 - Reset screen resolution R - Run the copied game Q | X - Quit script ==================================================== _EOF_ read -p "Select option (1 - 9, X): " optn echo echo Choice made: "$optn" echo case $optn in 1) DoAll ;; 2) backupGame ;; 3) removeGame ;; 4) createFolder ;; 5) copyGame ;; 7) copyDebugFiles ;; 8) copyGameSaves ;; 9) createLinkedFolder ;; 10) resetResolution ;; r|R) cd kspdev ./${KSP_EXE}& echo "Starting ${KSP_EXE}\n" sleep 5 cd .. echo -e "\n\n" ;; esac done Edited December 22, 2019 by linuxgurugamer Quote Link to comment Share on other sites More sharing options...
severedsolo Posted December 25, 2019 Share Posted December 25, 2019 (edited) I figured out how to get this working on KSP 1.8.1 and Linux Mint 19.3 (and therefore by extension Ubuntu 18.04) by mashing together the various instructions. Unity don't offer a way (that I could find) to download the Linux version without installing Unity Hub, and the Windows version no longer offers the Linux Player so download Unity Hub from here: https://unity3d.com/get-unity/download Once you've downloaded the appimage make it executable and run it. You'll need a Unity account, but the personal licenses are free. Once you've got Unity Hub set up, you'll need to download the right version of Unity. Unity Hub doesn't offer Unity 2019.2.2f by default, so you'll have to download it from here: https://unity3d.com/get-unity/download/archive - select the Unity 2019.2.2 "Unity Hub" option and it will install the right version. After that the instructions are more or less as in the OP: Insert player-connection-debug=1 into your boot.config copy the LinuxPlayer into your KSP directory from: <Your Unity Installation folder as set in Unity Hub>/2019.2.2f1/Editor/Data/PlaybackEngines/LinuxStandaloneSupport/Variations/linux64_withgfx_development_mono to the KSP directory. Rename it to KSP.x86_64 and make it executable Disable UFW (wouldn't work for me without this) sudo ufw disable Edit your csproj file so DebugType shows as follows: <DebugType>portable</DebugType> Move the dll and pdb file however you normally would (post build events etc) Start KSP Attach the Unity Debugger from your IDE as normal (I've only tested this in Rider). Edited December 25, 2019 by severedsolo Quote Link to comment Share on other sites More sharing options...
mattssheep4 Posted February 21, 2020 Share Posted February 21, 2020 On 11/12/2019 at 2:48 AM, Papa_Joe said: 1. checks to see if a new version of the game exists in Steam Does this require the game to be in steam then, or is it just checking if you have the latest released version? I go through the KSP Store. Quote Link to comment Share on other sites More sharing options...
sarbian Posted March 31, 2020 Author Share Posted March 31, 2020 New simplified method! Only 1 file to copy. Get this mono-2.0-bdwgc.dll and replace the one in <KSP>\MonoBleedingEdge\EmbedRuntime with it. Launch Game in Visual Studio go Debug -> Attach Unity Debugger. Press Input IP and set the port to 55555 The dll is built with those instructions. The source with the proper Unity version are here Windows only for now but the source should have everything needed to build the dll for Linux and OSX in the unity-2019.2.2-mbe directory. If you compile I will add the file on my server I ll update the OP after other have confirmed it work for them If someone want to have a look at the code and change the default port to 56000 they are welcome. I did not have the will ( look in around unity-2019.2.2-mbe\mono\mini\debug-mini.c ) Quote Link to comment Share on other sites More sharing options...
sarbian Posted April 2, 2020 Author Share Posted April 2, 2020 @Thomas P. built the lib for Linux : libmonobdwgc-2.0.so Still waiting on some feedback. Quote Link to comment Share on other sites More sharing options...
Sephiroth_018 Posted April 3, 2020 Share Posted April 3, 2020 On 3/31/2020 at 7:41 PM, sarbian said: New simplified method! Only 1 file to copy. Get this mono-2.0-bdwgc.dll and replace the one in <KSP>\MonoBleedingEdge\EmbedRuntime with it. Launch Game in Visual Studio go Debug -> Attach Unity Debugger. Press Input IP and set the port to 55555 The dll is built with those instructions. The source with the proper Unity version are here Windows only for now but the source should have everything needed to build the dll for Linux and OSX in the unity-2019.2.2-mbe directory. If you compile I will add the file on my server I ll update the OP after other have confirmed it work for them If someone want to have a look at the code and change the default port to 56000 they are welcome. I did not have the will ( look in around unity-2019.2.2-mbe\mono\mini\debug-mini.c ) I can confirm that it works (at least for me), currently using it to try and find out what's wrong with TCA in 1.9. This method helped me avoiding some work, thanks a lot. Used it with Visual Studio 2019 and KSP 1.9.1. Quote Link to comment Share on other sites More sharing options...
LucidDan Posted April 24, 2020 Share Posted April 24, 2020 On 7/2/2019 at 7:28 AM, whitespacekilla said: I decided I want to be able to develop on Mac OSX as well as Windows (for whatever reason) so I figured out how to make this tutorial work for Mac. I'm posting this here as much so I can find it if I need to figure it out again as for someone else's use but here goes anyway. Some items of note: KSP's files are arranged very differently in Mac OSX vs Windows and in fact they are a little "quirky", you will also be browsing inside multiple ".app" files, rendering the finder window less than useful. As a consequence, if you are not comfortable with the Mac OS terminal and paths, this tutorial is not for you and you will not succeed at it. Also, pdb2mdb does not work for PDBs produced in a portable format, which your Mac OSX compiler will almost certainly produce. You will need to either select a compiler that create its own mdb or use a debugger that can decompile on it's own (like JetBrains Rider), because so few plugin developers use Mac OSX, you won't get a lot of help navigating this issue, so besides the steps, paths, and advice I lay out here, you are probably on your own. Install the correct version of Unity (down to the patch). The current correct version for KSP 1.7.2 is 2017.1.3p1; patch releases are available here -> https://unity3d.com/unity/qa/patch-releases; non-patch releases are available here -> https://unity3d.com/get-unity/download/archive (NOT what you need at time of writing) Determine your KSP install path (for me, it's "~/Library/Application Support/Steam/steamapps/common/Kerbal Space Program/") and the correct Unity version install path (for me, it's "/Applications/Unity/") Copy the debug UnityPlayer from your Unity install to your KSP install; As far as I know, this must be done from the command line `cp "[YOUR CORRECT VERSION UNITY INSTALL PATH ]/Unity.app/Contents/PlaybackEngines/MacStandaloneSupport/Variations/universal_development_mono/UnityPlayer.app/Contents/MacOS/UnityPlayer" "[YOUR KSP INSTALL PATH]/KSP.app/Contents/MacOS", for me, this command was: cp "/Applications/Unity/Unity.app/Contents/PlaybackEngines/MacStandaloneSupport/Variations/universal_development_mono/UnityPlayer.app/Contents/MacOS/UnityPlayer" "~/Library/Application Support/Steam/steamapps/common/Kerbal Space Program/KSP.app/Contents/MacOS" Go ahead and rename the UnityPlayer you copied, as far as I can tell, this has no impact on whether it will work or not but it will help you differentiate the process you need to attach to, I ran the following command: mv "~/Library/Application Support/Steam/steamapps/common/Kerbal Space Program/KSP.app/Contents/MacOS/UnityPlayer" "~/Library/Application Support/Steam/steamapps/common/Kerbal Space Program/KSP.app/Contents/MacOS/KSP_dbg" Get this file (it's just a file named PlayerConnectionConfig with contents "listen 3247424759 1 1" if it ever stops being hosted) sarbian provided and put it in the Data directory (it makes the mono debugger starts its listening port, otherwise when you are browsing unity processes to attach to, you will see KSP but it will tell you it's not accepting debug connections); for me, this copy command was: cp "~/Downloads/PlayerConnectionConfigFile" "~/Library/Application Support/Steam/steamapps/common/Kerbal Space Program/KSP.app/Contents/Resources/Data/" Ensure your toolchain will create an MDB for your plugin or select an IDE that doesn't require MDBs; this article from the team at JetBrains helped me understand what I needed to get an MDB file when compiling on Mac OS; if you use monodevelop , the mono included with your unity install will be used so this will be automatic, if you use rider or some other IDE, you will need to set your Mono executable path to the one provided by Unity, I do not know how to do this for VS on Mac and will probably not learn, it's easier to solve than any of the other items of information in this post though so, if you give up before figuring that out, you were probably going to give up anyway *shrug* Launch the debug unity player, the command for me was: cd /Library/Application Support/Steam/steamapps/common/Kerbal Space Program/KSP.app/Contents/MacOS && open KSP_dbg Run whatever command your IDE uses to attach to a Unity process. i.e. in MonoDevelop, supposedly it's "Run" > "Attach to Process", Select "Unity Debugger", find the process, in Rider (what I currently use) it's "Attached to Unity Process...". Select the KSP process and attach. I used this to great success in 1.9.1 as well, thanks @whitespacekilla! Additional steps for 1.9.1: the naming of the development build from Unity 2019.2.2 is slightly different (macosx64_development_mono), and you need the UnityPlayer.dylib as well as (or possibly instead of?) the UnityPlayer binary. Quote cp "/Applications/Unity/Unity.app/Contents/PlaybackEngines/MacStandaloneSupport/Variations/macosx64_development_mono/UnityPlayer.app/Contents/Frameworks/UnityPlayer.dylib" "~/Library/Application Support/Steam/steamapps/common/Kerbal Space Program/KSP.app/Contents/Frameworks/" Also as noted by others for Linux and Windows, instead of PlayerConnectionConfigFile, this is now an entry in boot.config, which on the Mac app is stored in Contents/Resources/Data/, so: Quote echo "player-connection-debug=1" >> "~/Library/Application Support/Steam/steamapps/common/Kerbal Space Program/KSP.app/Contents/Resources/Data/boot.config" I tested with both Visual Studio for Mac (with Unity Tools) and JetBrains Rider, and I was able to attach a Unity debugger to the KSP process. I had mixed success with VS for Mac, but Rider worked perfectly - compiled and installed a copy of HyperEdit, set a breakpoint. Portable debug symbols worked out of the box, no pdb2mdb magic required. CPU load was through the roof for some reason, especially on the Main Menu, but otherwise, it worked quite well. Will definitely be keeping this around as a backup dev/debug setup for when I'm not at the desktop Windows rig. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.