diff --git a/src/xdb/sources.gypi b/src/xdb/sources.gypi index 4cf583f01..7e08a9fc7 100644 --- a/src/xdb/sources.gypi +++ b/src/xdb/sources.gypi @@ -4,8 +4,11 @@ 'protocol.h', 'xdb.cc', 'xdb.h', + 'xdb_app.cc', + 'xdb_app.h', ], 'includes': [ + 'ui/sources.gypi', ], } diff --git a/src/xdb/ui/main_frame.cc b/src/xdb/ui/main_frame.cc new file mode 100644 index 000000000..606da3f44 --- /dev/null +++ b/src/xdb/ui/main_frame.cc @@ -0,0 +1,18 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2014 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include + +namespace xdb { +namespace ui { + +MainFrame::MainFrame() : MainFrameBase(nullptr) {} + +} // namespace ui +} // namespace xdb diff --git a/src/xdb/ui/main_frame.h b/src/xdb/ui/main_frame.h new file mode 100644 index 000000000..9f6ba8ffd --- /dev/null +++ b/src/xdb/ui/main_frame.h @@ -0,0 +1,30 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2014 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XDB_UI_MAIN_FRAME_H_ +#define XDB_UI_MAIN_FRAME_H_ + +#include + +#include + +namespace xdb { +namespace ui { + +class MainFrame : public MainFrameBase { + public: + MainFrame(); + protected: + // +}; + +} // namespace ui +} // namespace xdb + +#endif // XDB_UI_MAIN_FRAME_H_ diff --git a/src/xdb/ui/sources.gypi b/src/xdb/ui/sources.gypi new file mode 100644 index 000000000..3673fcf7a --- /dev/null +++ b/src/xdb/ui/sources.gypi @@ -0,0 +1,12 @@ +# Copyright 2014 Ben Vanik. All Rights Reserved. +{ + 'sources': [ + 'main_frame.cc', + 'main_frame.h', + 'xdb_ui.cpp', + 'xdb_ui.h', + ], + + 'includes': [ + ], +} diff --git a/src/xdb/ui/xdb-ui.fbp b/src/xdb/ui/xdb-ui.fbp new file mode 100644 index 000000000..4a40d2e42 --- /dev/null +++ b/src/xdb/ui/xdb-ui.fbp @@ -0,0 +1,540 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + + 1000 + none + 0 + xdb + "xdb" "ui" + . + + 1 + 1 + 1 + 1 + UI + 1 + 0 + + 1 + wxAUI_MGR_DEFAULT|wxAUI_MGR_LIVE_RESIZE + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + MainFrameBase + + 1024,768 + wxDEFAULT_FRAME_STYLE + + xenia debugger + + + + wxTAB_TRAVERSAL + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 1 + + + 0 + wxID_ANY + Main Menu + + + menu_bar_ + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + File + file + protected + + + + 0 + 0 + 0 + 1 + 10 + + + + + + + + 0 + 0 + 0 + + 1 + 0 + Dock + 0 + Top + 1 + + 1 + + 0 + 0 + wxID_ANY + 0 + + + 0 + + + 0 + + 1 + tool_bar_ + 1 + 1 + + + protected + 0 + + Resizable + 5 + 1 + + wxAUI_TB_HORZ_LAYOUT + + label + 1 + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + wxID_ANY + wxITEM_NORMAL + tool + tool_test_ + protected + + + + + + + + + + + + + + + + + + 1 + 1 + + 1 + + 0 + wxID_ANY + + + status_bar_ + protected + + + wxST_SIZEGRIP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 0 + 0 + + + + + + + + 0 + 0 + 0 + + 1 + 0 + Dock + 0 + Center + 1 + + 0 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 0 + notebook_ + 0 + + + protected + 0 + + Resizable + 1 + + wxAUI_NB_TAB_EXTERNAL_MOVE|wxAUI_NB_TAB_MOVE|wxAUI_NB_TAB_SPLIT|wxAUI_NB_TOP|wxAUI_NB_WINDOWLIST_BUTTON + + -1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a page + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_panel3 + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + a page + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 1 + 1 + + 1 + 0 + Dock + 0 + Center + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_panel4 + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/xdb/ui/xdb_ui.cpp b/src/xdb/ui/xdb_ui.cpp new file mode 100644 index 000000000..c537f8f6a --- /dev/null +++ b/src/xdb/ui/xdb_ui.cpp @@ -0,0 +1,49 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "xdb_ui.h" + +/////////////////////////////////////////////////////////////////////////// +using namespace xdb::ui; + +MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + m_mgr.SetManagedWindow(this); + m_mgr.SetFlags(wxAUI_MGR_DEFAULT|wxAUI_MGR_LIVE_RESIZE); + + menu_bar_ = new wxMenuBar( 0 ); + file = new wxMenu(); + menu_bar_->Append( file, wxT("File") ); + + this->SetMenuBar( menu_bar_ ); + + tool_bar_ = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_HORZ_LAYOUT ); + tool_test_ = tool_bar_->AddTool( wxID_ANY, wxT("tool"), wxNullBitmap, wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL ); + + tool_bar_->Realize(); + m_mgr.AddPane( tool_bar_, wxAuiPaneInfo().Top().CaptionVisible( false ).CloseButton( false ).Dock().Resizable().FloatingSize( wxDefaultSize ).DockFixed( false ).BottomDockable( false ).LeftDockable( false ).RightDockable( false ).Layer( 10 ).ToolbarPane() ); + + status_bar_ = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY ); + notebook_ = new wxAuiNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TAB_EXTERNAL_MOVE|wxAUI_NB_TAB_MOVE|wxAUI_NB_TAB_SPLIT|wxAUI_NB_TOP|wxAUI_NB_WINDOWLIST_BUTTON ); + m_mgr.AddPane( notebook_, wxAuiPaneInfo() .Center() .CaptionVisible( false ).CloseButton( false ).PaneBorder( false ).Movable( false ).Dock().Resizable().FloatingSize( wxDefaultSize ).DockFixed( false ).BottomDockable( false ).TopDockable( false ).LeftDockable( false ).RightDockable( false ).Floatable( false ) ); + + m_panel3 = new wxPanel( notebook_, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + notebook_->AddPage( m_panel3, wxT("a page"), false, wxNullBitmap ); + m_panel4 = new wxPanel( notebook_, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + notebook_->AddPage( m_panel4, wxT("a page"), true, wxNullBitmap ); + + + m_mgr.Update(); + this->Centre( wxBOTH ); +} + +MainFrameBase::~MainFrameBase() +{ + m_mgr.UnInit(); + +} diff --git a/src/xdb/ui/xdb_ui.h b/src/xdb/ui/xdb_ui.h new file mode 100644 index 000000000..421f89942 --- /dev/null +++ b/src/xdb/ui/xdb_ui.h @@ -0,0 +1,64 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __XDB_UI_H__ +#define __XDB_UI_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +namespace xdb +{ + namespace ui + { + /////////////////////////////////////////////////////////////////////////////// + /// Class MainFrameBase + /////////////////////////////////////////////////////////////////////////////// + class MainFrameBase : public wxFrame + { + private: + + protected: + wxMenuBar* menu_bar_; + wxMenu* file; + wxAuiToolBar* tool_bar_; + wxAuiToolBarItem* tool_test_; + wxStatusBar* status_bar_; + wxAuiNotebook* notebook_; + wxPanel* m_panel3; + wxPanel* m_panel4; + + public: + + MainFrameBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("xenia debugger"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 1024,768 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + wxAuiManager m_mgr; + + ~MainFrameBase(); + + }; + + } // namespace ui +} // namespace xdb + +#endif //__XDB_UI_H__ diff --git a/src/xdb/xdb_app.cc b/src/xdb/xdb_app.cc new file mode 100644 index 000000000..b91672189 --- /dev/null +++ b/src/xdb/xdb_app.cc @@ -0,0 +1,29 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2014 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include + +namespace xdb { + +IMPLEMENT_APP(XdbApp); + +bool XdbApp::OnInit() { + main_frame_.reset(new ui::MainFrame()); + + main_frame_->Show(); + return true; +} + +int XdbApp::OnExit() { + // Top level windows are deleted by wx automatically. + main_frame_.release(); + return 0; +} + +} // namespace xdb diff --git a/src/xdb/xdb_app.h b/src/xdb/xdb_app.h new file mode 100644 index 000000000..b373ab7fe --- /dev/null +++ b/src/xdb/xdb_app.h @@ -0,0 +1,31 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2014 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XDB_XDB_APP_H_ +#define XDB_XDB_APP_H_ + +#include + +#include +#include + +namespace xdb { + +class XdbApp : public wxApp { + public: + bool OnInit() override; + int OnExit() override; + + private: + std::unique_ptr main_frame_; +}; + +} // namespace xdb + +#endif // XDB_XDB_APP_H_ diff --git a/tools/xenia-debug/xenia-debug.cc b/tools/xenia-debug/xenia-debug.cc index 630491c20..6fc239eb6 100644 --- a/tools/xenia-debug/xenia-debug.cc +++ b/tools/xenia-debug/xenia-debug.cc @@ -9,26 +9,49 @@ #include +#include + #include +#include +#include +#include +namespace xdb { -//using namespace xdb; - - -int xenia_debug(int argc, xechar_t** argv) { - int result_code = 1; - +int main(int argc, xechar_t** argv) { // Create platform abstraction layer. xe_pal_options_t pal_options; xe_zero_struct(&pal_options, sizeof(pal_options)); - XEEXPECTZERO(xe_pal_init(pal_options)); - - - result_code = 0; -XECLEANUP: - if (result_code) { - XEFATAL("Failed to launch debugger: %d", result_code); + if (xe_pal_init(pal_options)) { + XEFATAL("Failed to initialize PAL"); + return 1; } + + wxInitializer init; + if (!init.IsOk()) { + XEFATAL("Failed to initialize wxWidgets"); + return 1; + } + + // App is auto-freed by wx. + auto app = new XdbApp(); + wxApp::SetInstance(app); + if (!wxEntryStart(0, nullptr)) { + XEFATAL("Failed to enter wxWidgets app"); + return 1; + } + if (!app->OnInit()) { + XEFATAL("Failed to init app"); + return 1; + } + app->OnRun(); + int result_code = app->OnExit(); + wxEntryCleanup(); return result_code; } -XE_MAIN_WINDOW_THUNK(xenia_debug, XETEXT("xenia-debug"), "xenia-debug"); + +} // namespace xdb + +// TODO(benvanik): move main thunk into poly +// ehhh +XE_MAIN_WINDOW_THUNK(xdb::main, L"xenia-debug", "xenia-debug"); diff --git a/xenia.gyp b/xenia.gyp index ea353f570..736900825 100644 --- a/xenia.gyp +++ b/xenia.gyp @@ -96,6 +96,7 @@ #'LinkIncremental': '1', # 1 = NO, 2 = YES 'TargetMachine': '17', # x86 - 64 'AdditionalLibraryDirectories': [ + '..\\..\\third_party\\wxWidgets\\lib\\vc_x64_lib\\', ], }, }, @@ -463,6 +464,7 @@ 'include_dirs': [ 'src/', 'third_party/wxWidgets/include/', + 'third_party/wxWidgets/include/msvc/', ], 'target_conditions': [ @@ -480,11 +482,11 @@ 'wsock32', 'Ws2_32', 'Shell32', - # TODO(benvanik): root dir - '../../third_party/wxWidgets/lib/vc_x64_lib/wxbase31u', - '../../third_party/wxWidgets/lib/vc_x64_lib/wxmsw31u_core', - '../../third_party/wxWidgets/lib/vc_x64_lib/wxmsw31u_aui', - '../../third_party/wxWidgets/lib/vc_x64_lib/wxmsw31u_stc', + 'Msimg32', + 'wxbase31u', + 'wxmsw31u_core', + 'wxmsw31u_aui', + 'wxmsw31u_stc', ], }], ['OS == "mac"', { @@ -511,6 +513,7 @@ '.', 'src/', 'third_party/wxWidgets/include/', + 'third_party/wxWidgets/include/msvc/', ], 'includes': [