Jump to content

[WIN] KML - Persistence file editor


Mythos

Recommended Posts

KML - Kerbal Markup Lister v0.9.4 - 2023-04-21

Download: GitHub

Do you face a problem with broken docking ports or need just a little fuel-cheating? Do you got tired of editing save games in a text editor with long loading time and so much scrolling to compare different parts and vessels? So did I and decided to make a more helpful external editor to display the XML-like structure (the "KML" - Kerbal Markup Language) in a tree view and pick out vessels, kerbals and parts to be displayed in more eye-candy way.

The current version is almost feature-complete and functional, and already helps with quite a few problems (or some cheating if you choose to do so).

Any feedback, more testing, bug reports and suggestions are very welcome.

 

Screenshots

KML-Tree.png?raw=true

KML-Vessels.png?raw=true

KML-Kerbals.png?raw=true

 

NEW Features in v0.9.4

  • CLI selected warning like "-ws=0" shows source node - for @darthgently
  • CLI shows all sources nodes for each warning with multiselect "-wm=*"
  • GUI and CLI always name 2 nodes in warning message, even if it is about an attribute

(full changelog below)

Features

  • open SFS and CRAFT files
  • save files edited or exactly as loaded
  • backup of overwritten files
  • display file structure in a "KML" tree
  • display all vessels in a sorted and filtered list
  • display all kerbals in a sorted and filtered list
  • display vessel's part attachment structure
  • display warnings about structural problems
  • search for nodes, attributes and their content
  • adding, inserting and deleting nodes and attributes
  • change position of nodes (except parts) and attributes
  • copy & paste of nodes and attributes
  • deletion of parts will fix part indices and connections
  • deletion of kerbals and vessels will fix crew assignment
  • support renaming kerbals when assigned
  • send kerbal home to astronaut complex
  • send vessel to low kerbin orbit
  • repair broken docking ports and grappling devices
  • repair broken ID references in contracts
  • refill part resources
  • change vessel flag in all its parts - for @Enceos
  • list all GameData dirs used by vessel parts - for @TheCardinal
  • CLI mode for basic editing and repairs
  • tested with KSP 1.0 to 1.12

(newest KML version should still work with at least all these KSP versions)

TODO

  • identify add-on part connections (only a little KAS support for now)
  • more testing (uncommon vessel builds I didn't think of?)
  • support multiple docking ports per part
  • documentation
  • a lot of source code TODOs

Install

Windows

  • download KML_Windows.zip and extract anywhere you want
  • run the KML.exe and open your save file
  • or choose "open with" on your save file and select KML.exe (command-line arguments supported)

Linux, Mac

  • need to have Mono installed
  • download KML_Mono.zip and extract anywhere you want
  • run the KML.exe command-line from the terminal of your choice

Instructions, Hints, FAQ

  • Don't find your vessel in the tree (ordered by in-game creation)? Switch to the "vessels" tab to have a sorted list and the possibility to filter by type (debris, ship, etc.)
  • Don't find your kerbal in the tree? There's also a sorted and filtered list in the "kerbals" tab.
  • Want to see how the parts of your vessel are connected? Have a look on the graph displayed in the "vessels" tab.
  • What do the colored lines in that part graph mean?
    • Dark green line is a node attachment in top/down direction
    • Light green is a node attachment in front/back or left/right direction
    • Yellow line is a surface attachment
    • Blue line is a docking connection
  • If parts are arranged in a way you can't see where the connections go, mouse over the part and they are drawn thicker
  • After you found your vessel, kerbal or part in the list you want to see it in the tree? Just make a double click.
  • Sometimes there appears a warnings tab, what do these warnings mean? Some KML elements are more heavily inspected than others, like vessel parts and especially docking or grappling devices. If something is not as expected there is a warning generated.
  • There is a warning but my save game works fine! If the problem is related to stock parts please send me feedback about this problem. If KML has warnings about add-on parts not connected (e.g. KAS): That's ok for now, KML does not support that add-on and can't understand what it has written to the save file. KML just expects all parts to be somehow connected and gives a warning otherwise.
  • Don't fear about saving a file with warnings, unknown add-ons, missing part-connections, etc. KML will save the file as it was read and only apply the changes you made. All unknown data will be kept as it was.

Command Line Interface

When you download the KML_Mono.zip, you will get no graphical user interface (GUI), but only a command line interface (CLI). The benefit of this version is that it runs on Windows, Linux and Mac. The latter need to have Mono installed.

The full Windows version KML_Windows.zip includes the GUI and a CLI. To access the CLI, you just call it with any dashed argument.

$ ./KML.exe --help
KML: Kerbal Markup Lister 0.9 © 2021 Oliver Pola (Mythos)
Use: KML [Opt] <save-file>
Opt: --tree             | -t : List tree
     --vessels          | -v : List vessels
     --kerbals          | -k : List kerbals
     --warnings         | -w : Show warnings
     --repair           | -r : Repair docking and contract problems, includes -w
     --select           | -s : Show numbers, select one by -s=<Sel>
     --multiselect      | -m : Select all occurences by tag/name, includes -s
     --version               : Show version and check online for updates
     Actions on selection, need -s=<Sel> or -m=<Sel>, only one of:
     --export=<file>         : Export selection, no -m, defaults <file> to stdout
     --import-replace=<file> : Import file to replace selection, no -m
     --import-before=<file>  : Import file as new before selection, no -m
     --import-after=<file>   : Import file as new after selection, no -m
     --delete                : Delete selection, -m is allowed
Sel: < number | tag-start | name-start >[/Sel]
     Only in tree you can select by tag or go deep into hierarchy

What most users need, is to check for warnings (change path to KML.exe and *.sfs to your situation)

$ ./KML.exe saves/test/persistent.sfs --warnings

and then repair docking and contract problems automatically.

$ ./KML.exe saves/test/persistent.sfs --repair

To learn more, check the COMMANDLINE.md introduction.

Developers

  • Mythos (initiator, maintainer)
  • pamidur (contributor)

 

Download: GitHub

License: GPL

Source: GitHub

Changelog:

Spoiler

Version 0.9.4 - 2023-04-21
- CLI selected warning "-ws=0" shows source node - for darthgently
- CLI shows all sources nodes for each warning with multiselect "-wm=*"
- GUI and CLI always name 2 nodes in warning message, even if it is about an attribute

Version 0.9.3 - 2023-03-03
- bugfix stack overflow in part graph for vessels with cyclic attachments - thanks to Dryratt

Version 0.9.2 - 2022-02-13
- show total line count in node context menu - for flart

Version 0.9.1 - 2021-08-29
- show discovery state for space objects - for Krazy1
- CLI agrument support for "-vm=Debris" or "-vm=StoppedTracking" (only vessel, not tree view)

Version 0.9 - 2021-03-05
- CLI mode for basic editing and repairs
- regular executable with GUI and CLI on demand (Windows)
- separate executable with only CLI but Mono compatible (Linux, Mac)
- check and repair contracts
- change position of nodes (except parts) and attributes
- no warning when kerbal EVA uses external command seat - thanks to Krazy1
- fixed scrolling in filtered lists and other minor GUI issues
- open/save file with [Ctrl+O]/[Ctrl+S] (additional to [F9]/[F5])
- tested with KSP 1.11.1

Version 0.8.2 - 2019-08-04

- list all GameData dirs used by a vessel's / all vessels' parts - thanks to TheCardinal
- online check for updates (orange link may appear bottom right)
- small visual enhancements
- bugfix when having a collider as third parameter to srfN attribs - thanks to Bruce the Loon
- tested with KSP 1.7.3 - thanks to Bruce the Loon

Version 0.8.1 - 2019-05-09

- copy & paste attributes
- more keyboard controls - thanks to Geowil
  - insert [Ins], delete [Del], copy [Ctrl-C] & paste [Ctrl+V]
  - switch view on vessels/kerbals [Ctrl+Enter]
  - from tree to attributes [Enter]
  - from attribute to edit value [Enter]
  - navigate attribute remaining in edit mode [Up]/[Down]
  - from edit value back to attributes [Enter]
  - from edit value back to attributes with undo [Esc]
  - from attributes back to tree [Esc]/Left
  - tooltip mentions that you were always able switch tabs [Ctrl+Tab]
- attributes in kerbals tab now with same functionality as in tree
- reduced warning noise on node attachments (e.g. my own giant ship)
- bugfix about paste command checking for clipboard content
- bugfix about duplicate attributes like name, type (testing copy & paste)
- tested with KSP 1.7.0 (just a quick test since I'm personally stuck at 1.3.1)

Version 0.8 - 2018-05-05

- copy & paste nodes in the tree - thanks alot to pamidur's contribution
- delete parts that aren't parent of any other part - thanks to Kobymaru
- support KAS CPort parts as dock type (no repair abilities yet)
- additional sanity check for symmetry attributes pointing to invalid indices
- test for program files dir and being admin - thanks to EwingKang
- improved highlighting of list items
- minimal delay on part graph drawing (still freezes app on large vessels)
- vessel / kerbal list filter right click (incl. un-single-select on second right click)
- search dialog can now load further items (only 100 are loaded first)
- bugfix in search dialog
- previous and next buttons navigate through search results
- more key bindings, see tooltips
- tested with KSP 1.3.1 and 1.4.1 (pretty sure it'll work with 1.4.3)

Version 0.7.2 - 2017-01-15

- new vessel types plane and relay
- tested with KSP 1.2.2

Version 0.7.1 - 2016 preview, never released

- reset docking on one-sided same vessel docking errors - thanks to schneida
- request bug report when actions return neither warning nor success - thanks to schneida
- report only crew assignment problems for kerbals from roster

Version 0.7 - 2016-04-28

- send vessel to low kerbin orbit
- send kerbal home to astronaut complex
- show kerbal state and assigned vessel
- select assigned vessel / part from kerbal
- support renaming kerbals when assigned
- deleting kerbals, including send home
- deleting vessels, incl. send home all crew
- search for nodes
- search for attributes
- insert nodes
- insert attributes
- add attributes always before child nodes
- rebuild part structure when repaired
- bugfix selecting root nodes
- bugfix setting dialog size when main window maximized
- vessel / kerbal lists display name in bold
- fixed input textbox height (older windows) - thanks to Enceos
- show message for unhandled exceptions
- no multiselect on lists, wasn't interpreted anyway
- some keyboard usage improvements
- fix for debug messages "binding reference" in context menu creation
- tested with KSP 1.1.0

Version 0.6.2 - 2016-03-31

- bugfix about loading dds flags on older OS - thanks to Enceos

Version 0.6.1 - 2016-03-31

- bugfix finding KSP directory - thanks to Enceos

Version 0.6 - 2016-03-31

- repair dock / grapple: create missing items
- display vessel flag
- change vessel flag in all its parts - for Enceos
- adding attributes
- deleting attributes
- adding child nodes
- deleting nodes, restricted to not delete in this version
  - vessels (need to check crew and return home)
  - parts (need to rebuild index numbers and attachments)
  - kerbals (need to check if they are in any vessel's crew)
- custom dialogs
- supress vessels, kerbals and warnings for CRAFT files
- read "part" attribute as name for CRAFT files
- save with loaded file extension only
- link to KSP forum thread

Version 0.5 - 2016-03-11

- open SFS files
- open CRAFT files
- check and identify SFS files
- save SFS files edited or exactly as loaded
- save CRAFT files edited or exactly as loaded
- backup of overwritten files
- display file structure in a "KML" tree
- display all vessels in a sorted and filtered list
- display all kerbals in a sorted and filtered list
- display vessel's part attachment structure
- display warnings about structural problems
- refill part resources
- repair broken docking ports
- repair broken grappling devices
- tested with KSP 1.0.5

If you are interested in progress after latest release have a look at GitHub:

Changelog: GitHub

 

Edited by Mythos
Release v0.9.4
Link to comment
Share on other sites

Tried your program today. I must say, I absolutely love your grouping and sorting features! The vessel part tree visualization is very useful. That's quite a handy tool you're working on.

Little report: The program gets confused when parts are attached via KAS pipes.

Spoiler

 

Says something like:

VESSEL (Dimension Rift, Base, LANDED) -> PART[4] (WBI.Mineshaft):

Part not attached to parent part: PART [3] -> (WBI.Mineshaft)

 

 

Link to comment
Share on other sites

12 hours ago, Enceos said:

The program gets confused when parts are attached via KAS pipes

Thanks for your feedback. Yes, KAS (or any other add-on) connections are a thing KML can't recognize yet. There are some KAS constellations in my own savegame and in my special-cases-scenario, so KAS will be a topic later. I still think its better to warn about missing connections, even if everything is fine because its a add-on connection. If there is a warning about an add-on part, you should read it like "KML doesn't know what's going on" and ignore it. There still is no problem using KML for tweaking anything else.

Link to comment
Share on other sites

@Mythos I wonder if you'll be able to add a flag switcher option. Since it's a savegame editor the flag switching option might come handy for many users. Stock game does not have an option to switch the mission flag once you launched the vessel. Simple "Open Flag" dialog window with constraints to GameData directory will be enough, smart users will find their flag themselves.

There's a mod out there for this thing, but it adds another unnecessary [MODULE] to all "command" parts in the game, which is unwanted.

If you're interested in adding this feature, some code from this mod might help: https://github.com/iPeer/InFlightFlagSwitcher

I don't know if changing the flag on the root part in editor will automatically change in the game all the flags on other parts with flagDecals as well.

EDIT: Looks like each part of the VESSEL needs its flag changed for the full effect. Otherwise kerbals from different modules of the station have different flags.

Edited by Enceos
Link to comment
Share on other sites

3 hours ago, Enceos said:

I wonder if you'll be able to add a flag switcher option. Since it's a savegame editor the flag switching option might come handy for many users.

Sounds like a nice idea :) I might consider adding such a thing after more urgent things are done. You said this to be a per vessel option. I agree and don't think a savegame-wide exchange would be useful.

3 hours ago, Enceos said:

I don't know if changing the flag on the root part in editor will automatically change in the game all the flags on other parts with flagDecals as well.

You should think about docked or grappled vessels with other flags, like rescued pods. A quick look into my savegame reveals the flag to be saved in any part. So I think it could be changed per part. Maybe it would be useful to exchange any part's flag only if it has the same flag as the root part? This would keep flag of rescued pods etc. There is more such thinking to do if I start adding such a feature. The actual search and replace would be pretty easy to do.

Edited by Mythos
Link to comment
Share on other sites

I decided to make my progress public. You now have access to the most actual build via GitHub. OP will be changed on release. Maybe the build is a little behind the changelog, because build is only uploaded on release compilation, changelog reflects latest changes also if they were only tested in debug compilations. Also be aware that the version number of the preview build is set to the upcoming release, but will of course be different. :D

CHANGELOG

PREVIEW BUILD ZIP

Link to comment
Share on other sites

@Enceos I can make it crash on my side, if I have the save outside of KSP directory. If it is where it belongs, it does work. To be more exact: The problem only occurs if the outside directory does not have three directories above, like if it's in your root. Can you confirm?

Link to comment
Share on other sites

@Mythos The original KSP install is D:\Games\Steam\ etc. I'm playing from C:\Games\Kerbal Space Program\

KML.exe is in KSP directory. I'm trying to open a savefile from the saves folder. Surprisingly enough KML managed to open my week old backup savefile from the "backup" folder in KSP root.

EDIT: Ok, I copied the persistent.sfs from the "saves" folder into one of the "backup" folders and it opened in KML. Looks like its a pathing issue.

The folder structure of my backups is "Kerbal Space Program\backup\Wolderstein\20160322-002802\persistent.sfs"

Edited by Enceos
Link to comment
Share on other sites

5 minutes ago, Mythos said:

@Enceos Try new preview build. By the way, that problem came from getting KSP dir to load flags. Some guy wanted something about flags... :D

Looks like the save file needs to be one folder deeper. The preview build crashed when I tried to open it from the " saves/SaveName/persistent.sfs " but opened when I moved the file one step deeper into " saves/SaveName/Ships/persistent.sfs "

How does flags preloading work? is it necessary?

Link to comment
Share on other sites

Released 0.6.2 with bugfixes for these flag problems. KML 0.6.2 doesn't crash, but maybe this happens:

49 minutes ago, Enceos said:

DDS flags are greyed out

This seams to be an issue with win 7 (and below) only. DDS flags do work on Win 10. Maybe it does not depend on window version, but .NET framework version instead.

On my Win 10 / .NET 4.5 the DDS flags Enceos gave me are loaded:

7y4Fe84.png

More feedback needed.

Edited by Mythos
Tested DDS flags from Enceos
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...