Skip to content

Instantly share code, notes, and snippets.

View Lisias's full-sized avatar
💣
Night will fall and the dark will rise.

Lisias Lisias

💣
Night will fall and the dark will rise.
View GitHub Profile
@Lisias
Lisias / ksp_debugging.md
Created December 14, 2022 19:29 — forked from gotmachine/ksp_debugging.md
Debugging and profiling KSP plugins

This guide applies only to KSP 1.8 and latter. It covers modifying a KSP installation to allow :

  • In IDE debugging of KSP plugins by using breakpoints, inspecting runtime variables, doing step-by-step execution, etc. Both Visual Studio (including VS for Mac) and JetBrains Rider support debugging Unity games, and by extension KSP plugins.
  • Using the Unity editor profiling tools, which include great tools to measure and analyze CPU/GPU usage and memory allocations.

This guide is extensively tested for a Windows / Visual Studio scenario. However, it is theoretically possible to make all that work under MacOS or Linux, either with the Rider IDE or Visual Studio for Mac. This guide has limited details about those scenarios. I encourage you to leave a comment if you have additional information / experience.

Modifying KSP for profiling/debugging

Downloading the Unity editor

@Lisias
Lisias / screwed-scaling.cfg
Last active September 12, 2022 21:09
Completely screw up scalings in order to have some fun on the game! :)
// This file is intended to be used on KSP and TweakScale.
//
// TweakScale is:
// © 2018-2022 LisiasT
// © 2015-2018 pellinor
// © 2014 Gaius Godspeed and Biotronic
//
// Kerbal Space Program is
// © 2011-2021 Take-Two Interactive Software, Inc.
// © 2011-2017 Squad;

As far as I can tell, you can't do it conveniently. That is, git-rebase does not give you an option to preserve the committer date. Unless you give the --ignore-date (or its alias, --reset-author-date) option, it will always preserve the author date. However, there is no way to make git-rebase preserve the committer date, unless some manual script is crafted.

The best you can do is to make the committer date equal to the author date. Recently (in 2020 Q4), git-rebase --interactive has gained the ability to use the --committer-date-is-author-date flag with the interactive rebase. Before that, there was no way of influencing the committer date at all with the interactive rebase. Note that this flag does not preserve the committer date. It merely makes the committer date equal to the author date.

You might be thinking "well, isn't that effectively preserving the committer date, since normally the committer date is always equal to the author date?". Normally, you would be correct. However, there

@Lisias
Lisias / KSPRecoveryFix.cs
Created March 22, 2021 16:16 — forked from gotmachine/KSPRecoveryFix.cs
Fix for KSP 1.11+ not accounting for modules implementing IPartCostModifier when refunding parts on vessel recovery
using System;
using KSP.Localization;
using KSP.UI.Screens;
using KSP.UI.Screens.SpaceCenter.MissionSummaryDialog;
using KSP.UI.Util;
using UnityEngine;
namespace TestPlugin
{
[KSPAddon(KSPAddon.Startup.AllGameScenes, false)]
This file has been truncated, but you can view the full file.
[LOG 12:29:50.031] ******* Log Initiated for Kerbal Space Program - 1.11.0.3045 (OSXPlayer) en-us *******
Kerbal Space Program - 1.11.0.3045 (OSXPlayer) en-us
OS: Mac OS X 10.14.6
CPU: Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz (8)
RAM: 16384
GPU: Intel HD Graphics 4000 OpenGL Engine (1536MB)
SM: 46 (OpenGL 4.1 INTEL-12.10.25)
RT Formats: ARGB32, Depth, ARGBHalf, Shadowmap, RGB565, ARGB4444, ARGB1555, Default, ARGB2101010, DefaultHDR, ARGB64, ARGBFloat, RGFloat, RGHalf, RFloat, RHalf, R8, BGRA32, RGB111110Float, RG32, RG16, BGRA10101010_XR, BGR101010_XR, R16
@Lisias
Lisias / disable.sh
Created November 7, 2018 15:54
Disable bunch of #$!@ in Sierra (Version 2.1)
#!/bin/bash
# IMPORTANT: You will need to disable SIP aka Rootless in order to fully execute this script, you can reenable it after.
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
# Agents to disable
TODISABLE=('com.apple.security.keychainsyncingoveridsproxy' 'com.apple.personad' 'com.apple.passd' 'com.apple.screensharing.MessagesAgent' 'com.apple.CommCenter-osx' 'com.apple.Maps.mapspushd' 'com.apple.Maps.pushdaemon' 'com.apple.photoanalysisd' 'com.apple.telephonyutilities.callservicesd' 'com.apple.AirPlayUIAgent' 'com.apple.AirPortBaseStationAgent' 'com.apple.CalendarAgent' 'com.apple.DictationIM' 'com.apple.iCloudUserNotifications' 'com.apple.familycircled' 'com.apple.familycontrols.useragent' 'com.apple.familynotificationd' 'com.apple.gamed' 'com.apple.icloud.findmydeviced.findmydevi
@Lisias
Lisias / KSP.log
Created May 7, 2018 13:35
PartWizard KSP.log
This file has been truncated, but you can view the full file.
[LOG 09:35:36.501] ******* Log Initiated for Kerbal Space Program - 1.4.3.2152 (OSXPlayer) en-us *******
Kerbal Space Program - 1.4.3.2152 (OSXPlayer) en-us
OS: Mac OS X 10.12.6
CPU: Intel(R) Core(TM) i5-2415M CPU @ 2.30GHz (4)
RAM: 16384
GPU: Intel HD Graphics 3000 OpenGL Engine (579MB)
SM: 40 (OpenGL 3.3 INTEL-10.2.37)
RT Formats: ARGB32, Depth, ARGBHalf, Shadowmap, RGB565, ARGB4444, ARGB1555, Default, ARGB2101010, DefaultHDR, ARGB64, ARGBFloat, RGFloat, RGHalf, RFloat, RHalf, R8, ARGBInt, RGInt, RInt, RGB111110Float, RG32, RGBAUShort, RG16
Initialize engine version: 2017.1.3p1 (02d73f71d3bd)
GfxDevice: creating device client; threaded=1
Renderer: Intel HD Graphics 3000 OpenGL Engine
Vendor: Intel Inc.
Version: 3.3 INTEL-10.2.37
GLES: 0
GL_ARB_blend_func_extended GL_ARB_ES2_compatibility GL_ARB_explicit_attrib_location GL_ARB_instanced_arrays GL_ARB_internalformat_query GL_ARB_occlusion_query2 GL_ARB_sampler_objects GL_ARB_separate_shader_objects GL_ARB_shader_bit_encoding GL_ARB_shading_language_include GL_ARB_texture_rgb10_a2ui GL_ARB_texture_storage GL_ARB_texture_swizzle GL_ARB_timer_query GL_ARB_vertex_type_2_10_10_10_rev GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_texture_compression_s3tc GL_EXT_texture_filter_anisotropic GL_EXT_texture_sRGB_decode GL_APPLE_client_storage GL_APPLE_container_object_shareable GL_APPLE_flush_render GL_APPLE_object_purgeable GL_APPLE_rgb_422 GL_APPLE_row_bytes GL_APPLE_texture_range GL_ATI_texture_mirror_once GL_NV_texture_barrier
OPENGL LOG: Creating OpenGL 3.3 graphics device ; Context level <Open
ship = Karman Crossing Challenge Mk1
version = 1.4.1
description =
type = VAB
size = 3.01188278,6.34958649,2.16683173
persistentId = 2612725331
rot = 0,0,0,0
missionFlag = Squad/Agencies/StrutCo
vesselType = Debris
PART
[LOG 21:36:17.114] ******* Log Initiated for Kerbal Space Program - 1.4.1.2089 (OSXPlayer) en-us *******
Kerbal Space Program - 1.4.1.2089 (OSXPlayer) en-us
OS: Mac OS X 10.12.6
CPU: Intel(R) Core(TM) i5-2415M CPU @ 2.30GHz (4)
RAM: 16384
GPU: Intel HD Graphics 3000 OpenGL Engine (579MB)
SM: 40 (OpenGL 3.3 INTEL-10.2.37)
RT Formats: ARGB32, Depth, ARGBHalf, Shadowmap, RGB565, ARGB4444, ARGB1555, Default, ARGB2101010, DefaultHDR, ARGB64, ARGBFloat, RGFloat, RGHalf, RFloat, RHalf, R8, ARGBInt, RGInt, RInt, RGB111110Float, RG32, RGBAUShort, RG16