Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 266ebbd31057
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 741154fb6033
Choose a head ref
  • 5 commits
  • 3 files changed
  • 2 contributors

Commits on Mar 12, 2017

  1. Copy the full SHA
    0eb4efe View commit details
  2. traces in the C#

    eggrobin committed Mar 12, 2017
    Copy the full SHA
    b869123 View commit details
  3. journalling in the GUI

    eggrobin committed Mar 12, 2017
    Copy the full SHA
    03867cf View commit details
  4. OED

    eggrobin committed Mar 12, 2017
    Copy the full SHA
    3cad007 View commit details
  5. Merge pull request #1250 from eggrobin/remove-noisy-traces

    Remove noisy traces
    pleroy authored Mar 12, 2017
    Copy the full SHA
    741154f View commit details
Showing with 21 additions and 14 deletions.
  1. +1 −1 journal/player_test.cpp
  2. +4 −3 ksp_plugin/interface.cpp
  3. +16 −10 ksp_plugin_adapter/ksp_plugin_adapter.cs
2 changes: 1 addition & 1 deletion journal/player_test.cpp
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ TEST_F(PlayerTest, Benchmarks) {
// This test is only run if the --gtest_filter flag names it explicitly.
TEST_F(PlayerTest, Debug) {
if (testing::FLAGS_gtest_filter == test_case_name_ + "." + test_name_) {
// An example of how journalling may be used for debugging. You must set
// An example of how journaling may be used for debugging. You must set
// |path| and fill the |method_in| and |method_out_return| protocol buffers.
std::string path =
R"(P:\Public Mockingbird\Principia\Journals\JOURNAL.20170307-163451)";
7 changes: 4 additions & 3 deletions ksp_plugin/interface.cpp
Original file line number Diff line number Diff line change
@@ -256,7 +256,6 @@ void principia__DeletePlugin(Plugin const** const plugin) {
// |**native_string|.
void principia__DeleteString(char const** const native_string) {
journal::Method<journal::DeleteString> m({native_string}, {native_string});
LOG(INFO) << __FUNCTION__;
// This is a bit convoluted, but a |std::uint8_t const*| and a |char const*|
// cannot be aliased.
auto unsigned_string = reinterpret_cast<std::uint8_t const*>(*native_string);
@@ -280,13 +279,13 @@ void principia__DeserializePlugin(char const* const serialization,
deserializer,
plugin},
{deserializer, plugin});
LOG(INFO) << __FUNCTION__;
CHECK_NOTNULL(serialization);
CHECK_NOTNULL(deserializer);
CHECK_NOTNULL(plugin);

// Create and start a deserializer if the caller didn't provide one.
if (*deserializer == nullptr) {
LOG(INFO) << "Begin plugin deserialization";
*deserializer = new PushDeserializer(chunk_size, number_of_chunks);
auto message = make_not_null_unique<serialization::Plugin>();
(*deserializer)->Start(
@@ -314,6 +313,7 @@ void principia__DeserializePlugin(char const* const serialization,
// If the data was empty, delete the deserializer. This ensures that
// |*plugin| is filled.
if (byte_size == 0) {
LOG(INFO) << "End plugin deserialization";
TakeOwnership(deserializer);
}
return m.Return();
@@ -786,12 +786,12 @@ char const* principia__SerializePlugin(Plugin const* const plugin,
PullSerializer** const serializer) {
journal::Method<journal::SerializePlugin> m({plugin, serializer},
{serializer});
LOG(INFO) << __FUNCTION__;
CHECK_NOTNULL(plugin);
CHECK_NOTNULL(serializer);

// Create and start a serializer if the caller didn't provide one.
if (*serializer == nullptr) {
LOG(INFO) << "Begin plugin seralization";
*serializer = new PullSerializer(chunk_size, number_of_chunks);
auto message = make_not_null_unique<serialization::Plugin>();
plugin->WriteToMessage(message.get());
@@ -805,6 +805,7 @@ char const* principia__SerializePlugin(Plugin const* const plugin,
// If this is the end of the serialization, delete the serializer and return a
// nullptr.
if (bytes.size == 0) {
LOG(INFO) << "End plugin seralization";
TakeOwnership(serializer);
return m.Return(nullptr);
}
26 changes: 16 additions & 10 deletions ksp_plugin_adapter/ksp_plugin_adapter.cs
Original file line number Diff line number Diff line change
@@ -79,8 +79,11 @@ public partial class PrincipiaPluginAdapter
[KSPField(isPersistant = true)]
private int buffered_logging_ = 0;

// Whether a journal will be recorded when the plugin is next constructed.
[KSPField(isPersistant = true)]
private bool must_record_journal_ = false;
// Whether a journal is currently being recorded.
private static bool journaling_;
#if CRASH_BUTTON
[KSPField(isPersistant = true)]
private bool show_crash_options_ = false;
@@ -373,6 +376,7 @@ public override void OnSave(ConfigNode node) {
public override void OnLoad(ConfigNode node) {
base.OnLoad(node);
if (must_record_journal_) {
journaling_ = true;
Log.ActivateRecorder(true);
}
if (node.HasValue(principia_key)) {
@@ -808,25 +812,16 @@ private System.Collections.IEnumerator
plugin_.GetPartActualDegreesOfFreedom(part.flightID, FlightGlobals.ActiveVessel.rootPart.flightID);
// TODO(egg): use the centre of mass. Here it's a bit tedious, some
// transform nonsense must probably be done.
Log.Error(
"q correction " +
((Vector3d)part_actual_degrees_of_freedom.q - part.rb.position));
Log.Error(
"v correction " +
((Vector3d)part_actual_degrees_of_freedom.p - part.rb.velocity));
part.rb.position = (Vector3d)part_actual_degrees_of_freedom.q;
part.rb.velocity = (Vector3d)part_actual_degrees_of_freedom.p;
}
}
QP main_body_dof = plugin_.CelestialWorldDegreesOfFreedom(
FlightGlobals.ActiveVessel.mainBody.flightGlobalsIndex,
FlightGlobals.ActiveVessel.rootPart.flightID);
Log.Error("change in framevel: " +
(-(Vector3d)main_body_dof.p - krakensbane.FrameVel));
krakensbane.FrameVel = -(Vector3d)main_body_dof.p;
Vector3d offset = (Vector3d)main_body_dof.q -
FlightGlobals.ActiveVessel.mainBody.position;
Log.Error("shifting the world by " + offset);
// We cannot use FloatingOrigin.SetOffset to move the world here, because
// as far as I can tell, that does not move the bubble relative to the
// rest of the universe.
@@ -872,7 +867,7 @@ private void ReportVesselsAndParts() {
Log.Info("Killing stock gravity");
PhysicsGlobals.GraviticForceMultiplier = 0;
}
} else {
} else if (PhysicsGlobals.GraviticForceMultiplier == 0) {
Log.Info("Reinstating stock gravity");
PhysicsGlobals.GraviticForceMultiplier = 1;
}
@@ -1435,6 +1430,17 @@ private void LoggingSettings() {
buffered_logging_ = Log.GetBufferedLogging();
}
UnityEngine.GUILayout.EndHorizontal();
UnityEngine.GUILayout.TextArea("Journalling is " +
(journaling_ ? "ON" : "OFF"));
must_record_journal_ = UnityEngine.GUILayout.Toggle(
value : must_record_journal_,
text : "Record journal (starts on load)");
if (journaling_ && !must_record_journal_) {
// We can deactivate a recorder at any time, but in order for replaying to
// work, we should only activate one before creating a plugin.
journaling_ = false;
Interface.ActivateRecorder(false);
}
}

private void ResetButton() {