diff --git a/src/xenia/debug/ui/views/cpu/call_stack_control.cc b/src/xenia/debug/ui/views/cpu/call_stack_control.cc index 807cf3cd6..cdd6368ea 100644 --- a/src/xenia/debug/ui/views/cpu/call_stack_control.cc +++ b/src/xenia/debug/ui/views/cpu/call_stack_control.cc @@ -7,9 +7,10 @@ ****************************************************************************** */ +#include "xenia/debug/ui/views/cpu/call_stack_control.h" + #include "el/animation_manager.h" #include "xenia/base/string_buffer.h" -#include "xenia/debug/ui/views/cpu/call_stack_control.h" namespace xe { namespace debug { diff --git a/src/xenia/debug/ui/views/cpu/cpu_view.cc b/src/xenia/debug/ui/views/cpu/cpu_view.cc index 51b5d86c7..c4f05a8d4 100644 --- a/src/xenia/debug/ui/views/cpu/cpu_view.cc +++ b/src/xenia/debug/ui/views/cpu/cpu_view.cc @@ -7,9 +7,10 @@ ****************************************************************************** */ +#include "xenia/debug/ui/views/cpu/cpu_view.h" + #include "el/animation_manager.h" #include "xenia/base/string_buffer.h" -#include "xenia/debug/ui/views/cpu/cpu_view.h" namespace xe { namespace debug { @@ -50,24 +51,6 @@ el::Element* CpuView::BuildUI() { .type(EditType::kSearch) .placeholder("Filter"))); - auto source_code_node = - LayoutBoxNode() - .gravity(Gravity::kAll) - .distribution(LayoutDistribution::kAvailable) - .axis(Axis::kY) - .child( - LayoutBoxNode() - .gravity(Gravity::kTop | Gravity::kLeftRight) - .distribution(LayoutDistribution::kGravity) - .distribution_position(LayoutDistributionPosition::kLeftTop) - .axis(Axis::kX) - .child(ButtonNode("A"))) - .child(TextBoxNode("source!") - .id("source_textbox") - .gravity(Gravity::kAll) - .is_multiline(true) - .is_read_only(true)); - auto register_list_node = ListBoxNode() .gravity(Gravity::kAll) .item("A") @@ -121,7 +104,8 @@ el::Element* CpuView::BuildUI() { .axis(Axis::kY) .fixed_pane(FixedPane::kSecond) .value(240) - .pane(source_code_node) + .pane(LabelNode("") + .id("source_placeholder")) .pane(source_registers_node)) .pane(source_tools_node))); @@ -145,18 +129,23 @@ el::Element* CpuView::BuildUI() { root_element_.set_layout_distribution(LayoutDistribution::kAvailable); root_element_.LoadNodeTree(node); + el::Label* source_placeholder; el::Label* gr_registers_placeholder; el::Label* fr_registers_placeholder; el::Label* vr_registers_placeholder; el::Label* host_registers_placeholder; el::Label* call_stack_placeholder; root_element_.GetElementsById({ + {TBIDC("source_placeholder"), &source_placeholder}, {TBIDC("gr_registers_placeholder"), &gr_registers_placeholder}, {TBIDC("fr_registers_placeholder"), &fr_registers_placeholder}, {TBIDC("vr_registers_placeholder"), &vr_registers_placeholder}, {TBIDC("host_registers_placeholder"), &host_registers_placeholder}, {TBIDC("call_stack_placeholder"), &call_stack_placeholder}, }); + source_placeholder->parent()->ReplaceChild(source_placeholder, + source_control_.BuildUI()); + source_control_.Setup(client_); gr_registers_placeholder->parent()->ReplaceChild( gr_registers_placeholder, gr_registers_control_.BuildUI()); gr_registers_control_.Setup(client_); @@ -274,6 +263,7 @@ void CpuView::UpdateThreadList() { void CpuView::SwitchCurrentThread(model::Thread* thread) { current_thread_ = thread; + source_control_.set_thread(thread); gr_registers_control_.set_thread(thread); fr_registers_control_.set_thread(thread); vr_registers_control_.set_thread(thread); diff --git a/src/xenia/debug/ui/views/cpu/cpu_view.h b/src/xenia/debug/ui/views/cpu/cpu_view.h index 2805be9a1..1e70bcbbc 100644 --- a/src/xenia/debug/ui/views/cpu/cpu_view.h +++ b/src/xenia/debug/ui/views/cpu/cpu_view.h @@ -16,6 +16,7 @@ #include "xenia/debug/ui/view.h" #include "xenia/debug/ui/views/cpu/call_stack_control.h" #include "xenia/debug/ui/views/cpu/register_list_control.h" +#include "xenia/debug/ui/views/cpu/source_control.h" namespace xe { namespace debug { @@ -43,6 +44,7 @@ class CpuView : public View { // TODO(benvanik): better state machine. model::Thread* current_thread_ = nullptr; + SourceControl source_control_; RegisterListControl gr_registers_control_; RegisterListControl fr_registers_control_; RegisterListControl vr_registers_control_; diff --git a/src/xenia/debug/ui/views/cpu/register_list_control.cc b/src/xenia/debug/ui/views/cpu/register_list_control.cc index 2bc863c1e..9726de17a 100644 --- a/src/xenia/debug/ui/views/cpu/register_list_control.cc +++ b/src/xenia/debug/ui/views/cpu/register_list_control.cc @@ -7,6 +7,8 @@ ****************************************************************************** */ +#include "xenia/debug/ui/views/cpu/register_list_control.h" + #include #include @@ -14,7 +16,6 @@ #include "xenia/base/string_buffer.h" #include "xenia/base/string_util.h" #include "xenia/cpu/x64_context.h" -#include "xenia/debug/ui/views/cpu/register_list_control.h" namespace xe { namespace debug { diff --git a/src/xenia/debug/ui/views/cpu/source_control.cc b/src/xenia/debug/ui/views/cpu/source_control.cc new file mode 100644 index 000000000..d9dec3232 --- /dev/null +++ b/src/xenia/debug/ui/views/cpu/source_control.cc @@ -0,0 +1,75 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2015 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include "xenia/debug/ui/views/cpu/source_control.h" + +#include "el/animation_manager.h" +#include "xenia/base/string_buffer.h" + +namespace xe { +namespace debug { +namespace ui { +namespace views { +namespace cpu { + +SourceControl::SourceControl() = default; + +SourceControl::~SourceControl() = default; + +el::Element* SourceControl::BuildUI() { + using namespace el::dsl; // NOLINT(build/namespaces) + el::AnimationBlocker animation_blocker; + + auto node = LayoutBoxNode() + .gravity(Gravity::kAll) + .distribution(LayoutDistribution::kAvailable) + .axis(Axis::kY) + .child(LayoutBoxNode() + .gravity(Gravity::kTop | Gravity::kLeftRight) + .distribution(LayoutDistribution::kGravity) + .distribution_position( + LayoutDistributionPosition::kLeftTop) + .axis(Axis::kX) + .child(ButtonNode("A"))) + .child(TextBoxNode("source!") + .id("source_textbox") + .gravity(Gravity::kAll) + .is_multiline(true) + .is_read_only(true)); + + root_element_.set_gravity(Gravity::kAll); + root_element_.set_layout_distribution(LayoutDistribution::kAvailable); + root_element_.LoadNodeTree(node); + + handler_ = std::make_unique(&root_element_); + + return &root_element_; +} + +void SourceControl::Setup(DebugClient* client) { + client_ = client; + + // system()->on_thread_state_updated.AddListener([this](model::Thread* thread) + // { + // if (thread == thread_) { + // InvalidateCallStack(); + // } + //}); +} + +void SourceControl::set_thread(model::Thread* thread) { + thread_ = thread; + // InvalidateCallStack(); +} + +} // namespace cpu +} // namespace views +} // namespace ui +} // namespace debug +} // namespace xe diff --git a/src/xenia/debug/ui/views/cpu/source_control.h b/src/xenia/debug/ui/views/cpu/source_control.h new file mode 100644 index 000000000..d49a57c8c --- /dev/null +++ b/src/xenia/debug/ui/views/cpu/source_control.h @@ -0,0 +1,46 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2015 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_DEBUG_UI_VIEWS_CPU_SOURCE_CONTROL_H_ +#define XENIA_DEBUG_UI_VIEWS_CPU_SOURCE_CONTROL_H_ + +#include +#include + +#include "xenia/debug/ui/control.h" + +namespace xe { +namespace debug { +namespace ui { +namespace views { +namespace cpu { + +class SourceControl : public Control { + public: + SourceControl(); + ~SourceControl() override; + + el::Element* BuildUI() override; + + void Setup(xe::debug::DebugClient* client) override; + + model::Thread* thread() const { return thread_; } + void set_thread(model::Thread* thread); + + private: + model::Thread* thread_ = nullptr; +}; + +} // namespace cpu +} // namespace views +} // namespace ui +} // namespace debug +} // namespace xe + +#endif // XENIA_DEBUG_UI_VIEWS_CPU_SOURCE_CONTROL_H_