summaryrefslogtreecommitdiffstats
path: root/src/citra_qt
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra_qt')
-rw-r--r--src/citra_qt/CMakeLists.txt13
-rw-r--r--src/citra_qt/bootmanager.cpp19
-rw-r--r--src/citra_qt/bootmanager.h12
-rw-r--r--src/citra_qt/debugger/callstack.cpp21
-rw-r--r--src/citra_qt/debugger/callstack.h6
-rw-r--r--src/citra_qt/debugger/disassembler.cpp8
-rw-r--r--src/citra_qt/debugger/disassembler.h3
-rw-r--r--src/citra_qt/debugger/graphics_cmdlists.cpp2
-rw-r--r--src/citra_qt/debugger/graphics_framebuffer.cpp8
-rw-r--r--src/citra_qt/debugger/graphics_framebuffer.h4
-rw-r--r--src/citra_qt/debugger/registers.cpp7
-rw-r--r--src/citra_qt/debugger/registers.h3
-rw-r--r--src/citra_qt/main.cpp14
13 files changed, 87 insertions, 33 deletions
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt
index a0ba252b3..bbc521f8a 100644
--- a/src/citra_qt/CMakeLists.txt
+++ b/src/citra_qt/CMakeLists.txt
@@ -60,17 +60,6 @@ endif()
add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS})
target_link_libraries(citra-qt core common video_core qhexedit)
target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS})
-
-if (UNIX)
- target_link_libraries(citra-qt -pthread)
-endif()
-
-if (APPLE)
- target_link_libraries(citra-qt iconv ${COREFOUNDATION_LIBRARY})
-elseif (WIN32)
- target_link_libraries(citra-qt winmm wsock32 ws2_32)
-else() # Unix
- target_link_libraries(citra-qt rt)
-endif()
+target_link_libraries(citra-qt ${PLATFORM_LIBRARIES})
#install(TARGETS citra-qt RUNTIME DESTINATION ${bindir})
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index 3e24da596..196380105 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -40,18 +40,35 @@ void EmuThread::SetFilename(std::string filename)
void EmuThread::run()
{
stop_run = false;
+
+ // holds whether the cpu was running during the last iteration,
+ // so that the DebugModeLeft signal can be emitted before the
+ // next execution step
+ bool was_active = false;
while (!stop_run)
{
if (cpu_running)
{
+ if (!was_active)
+ emit DebugModeLeft();
+
Core::RunLoop();
+
+ was_active = cpu_running || exec_cpu_step;
+ if (!was_active)
+ emit DebugModeEntered();
}
else if (exec_cpu_step)
{
+ if (!was_active)
+ emit DebugModeLeft();
+
exec_cpu_step = false;
Core::SingleStep();
- emit CPUStepped();
+ emit DebugModeEntered();
yieldCurrentThread();
+
+ was_active = false;
}
}
render_window->moveContext();
diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h
index 1c893384c..a55db682a 100644
--- a/src/citra_qt/bootmanager.h
+++ b/src/citra_qt/bootmanager.h
@@ -81,12 +81,18 @@ private:
signals:
/**
- * Emitted when CPU when we've finished processing a single Gekko instruction
+ * Emitted when the CPU has halted execution
*
- * @warning This will only be emitted when the CPU is not running (SetCpuRunning(false))
* @warning When connecting to this signal from other threads, make sure to specify either Qt::QueuedConnection (invoke slot within the destination object's message thread) or even Qt::BlockingQueuedConnection (additionally block source thread until slot returns)
*/
- void CPUStepped();
+ void DebugModeEntered();
+
+ /**
+ * Emitted right before the CPU continues execution
+ *
+ * @warning When connecting to this signal from other threads, make sure to specify either Qt::QueuedConnection (invoke slot within the destination object's message thread) or even Qt::BlockingQueuedConnection (additionally block source thread until slot returns)
+ */
+ void DebugModeLeft();
};
class GRenderWindow : public QWidget, public EmuWindow
diff --git a/src/citra_qt/debugger/callstack.cpp b/src/citra_qt/debugger/callstack.cpp
index bcc5d2143..9bb22ca2e 100644
--- a/src/citra_qt/debugger/callstack.cpp
+++ b/src/citra_qt/debugger/callstack.cpp
@@ -25,7 +25,7 @@ CallstackWidget::CallstackWidget(QWidget* parent): QDockWidget(parent)
ui.treeView->setModel(callstack_model);
}
-void CallstackWidget::OnCPUStepped()
+void CallstackWidget::OnDebugModeEntered()
{
ARM_Disasm* disasm = new ARM_Disasm();
ARM_Interface* app_core = Core::g_app_core;
@@ -33,11 +33,16 @@ void CallstackWidget::OnCPUStepped()
u32 sp = app_core->GetReg(13); //stack pointer
u32 ret_addr, call_addr, func_addr;
+ Clear();
+
int counter = 0;
for (u32 addr = 0x10000000; addr >= sp; addr -= 4)
{
ret_addr = Memory::Read32(addr);
call_addr = ret_addr - 4; //get call address???
+
+ if (Memory::GetPointer(call_addr) == nullptr)
+ break;
/* TODO (mattvail) clean me, move to debugger interface */
u32 insn = Memory::Read32(call_addr);
@@ -68,3 +73,17 @@ void CallstackWidget::OnCPUStepped()
}
}
}
+
+void CallstackWidget::OnDebugModeLeft()
+{
+
+}
+
+void CallstackWidget::Clear()
+{
+ for (int row = 0; row < callstack_model->rowCount(); row++) {
+ for (int column = 0; column < callstack_model->columnCount(); column++) {
+ callstack_model->setItem(row, column, new QStandardItem());
+ }
+ }
+}
diff --git a/src/citra_qt/debugger/callstack.h b/src/citra_qt/debugger/callstack.h
index 4f4f74823..1a9b6dc81 100644
--- a/src/citra_qt/debugger/callstack.h
+++ b/src/citra_qt/debugger/callstack.h
@@ -15,9 +15,13 @@ public:
CallstackWidget(QWidget* parent = 0);
public slots:
- void OnCPUStepped();
+ void OnDebugModeEntered();
+ void OnDebugModeLeft();
private:
Ui::CallStack ui;
QStandardItemModel* callstack_model;
+
+ /// Clears the callstack widget while keeping the column widths the same
+ void Clear();
};
diff --git a/src/citra_qt/debugger/disassembler.cpp b/src/citra_qt/debugger/disassembler.cpp
index 8db73752f..c61ace925 100644
--- a/src/citra_qt/debugger/disassembler.cpp
+++ b/src/citra_qt/debugger/disassembler.cpp
@@ -13,6 +13,7 @@
#include "core/core.h"
#include "common/break_points.h"
#include "common/symbols.h"
+#include "core/arm/arm_interface.h"
#include "core/arm/skyeye_common/armdefs.h"
#include "core/arm/disassembler/arm_disasm.h"
@@ -234,7 +235,7 @@ void DisassemblerWidget::OnToggleStartStop()
emu_thread.SetCpuRunning(!emu_thread.IsCpuRunning());
}
-void DisassemblerWidget::OnCPUStepped()
+void DisassemblerWidget::OnDebugModeEntered()
{
ARMword next_instr = Core::g_app_core->GetPC();
@@ -251,6 +252,11 @@ void DisassemblerWidget::OnCPUStepped()
disasm_ui.treeView->selectionModel()->setCurrentIndex(model_index, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
}
+void DisassemblerWidget::OnDebugModeLeft()
+{
+
+}
+
int DisassemblerWidget::SelectedRow()
{
QModelIndex index = disasm_ui.treeView->selectionModel()->currentIndex();
diff --git a/src/citra_qt/debugger/disassembler.h b/src/citra_qt/debugger/disassembler.h
index 6d3cef108..0deccc240 100644
--- a/src/citra_qt/debugger/disassembler.h
+++ b/src/citra_qt/debugger/disassembler.h
@@ -61,7 +61,8 @@ public slots:
void OnPause();
void OnToggleStartStop();
- void OnCPUStepped();
+ void OnDebugModeEntered();
+ void OnDebugModeLeft();
private:
// returns -1 if no row is selected
diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp
index 4a6159fdf..bd420f24a 100644
--- a/src/citra_qt/debugger/graphics_cmdlists.cpp
+++ b/src/citra_qt/debugger/graphics_cmdlists.cpp
@@ -76,6 +76,8 @@ TextureInfoDockWidget::TextureInfoDockWidget(const Pica::DebugUtils::TextureInfo
format_choice->addItem(tr("IA4"));
format_choice->addItem(tr("UNK10"));
format_choice->addItem(tr("A4"));
+ format_choice->addItem(tr("ETC1"));
+ format_choice->addItem(tr("ETC1A4"));
format_choice->setCurrentIndex(static_cast<int>(info.format));
connect(format_choice, SIGNAL(currentIndexChanged(int)), this, SLOT(OnFormatChanged(int)));
diff --git a/src/citra_qt/debugger/graphics_framebuffer.cpp b/src/citra_qt/debugger/graphics_framebuffer.cpp
index caa6896f9..a9423d6c7 100644
--- a/src/citra_qt/debugger/graphics_framebuffer.cpp
+++ b/src/citra_qt/debugger/graphics_framebuffer.cpp
@@ -158,17 +158,17 @@ void GraphicsFramebufferWidget::OnFramebufferAddressChanged(qint64 new_value)
}
}
-void GraphicsFramebufferWidget::OnFramebufferWidthChanged(unsigned int new_value)
+void GraphicsFramebufferWidget::OnFramebufferWidthChanged(int new_value)
{
- if (framebuffer_width != new_value) {
- framebuffer_width = new_value;
+ if (framebuffer_width != static_cast<unsigned>(new_value)) {
+ framebuffer_width = static_cast<unsigned>(new_value);
framebuffer_source_list->setCurrentIndex(static_cast<int>(Source::Custom));
emit Update();
}
}
-void GraphicsFramebufferWidget::OnFramebufferHeightChanged(unsigned int new_value)
+void GraphicsFramebufferWidget::OnFramebufferHeightChanged(int new_value)
{
if (framebuffer_height != new_value) {
framebuffer_height = new_value;
diff --git a/src/citra_qt/debugger/graphics_framebuffer.h b/src/citra_qt/debugger/graphics_framebuffer.h
index 02813525c..56215761e 100644
--- a/src/citra_qt/debugger/graphics_framebuffer.h
+++ b/src/citra_qt/debugger/graphics_framebuffer.h
@@ -62,8 +62,8 @@ public:
public slots:
void OnFramebufferSourceChanged(int new_value);
void OnFramebufferAddressChanged(qint64 new_value);
- void OnFramebufferWidthChanged(unsigned int new_value);
- void OnFramebufferHeightChanged(unsigned int new_value);
+ void OnFramebufferWidthChanged(int new_value);
+ void OnFramebufferHeightChanged(int new_value);
void OnFramebufferFormatChanged(int new_value);
void OnUpdate();
diff --git a/src/citra_qt/debugger/registers.cpp b/src/citra_qt/debugger/registers.cpp
index e982dfb3f..ab3666156 100644
--- a/src/citra_qt/debugger/registers.cpp
+++ b/src/citra_qt/debugger/registers.cpp
@@ -41,7 +41,7 @@ RegistersWidget::RegistersWidget(QWidget* parent) : QDockWidget(parent)
CSPR->addChild(new QTreeWidgetItem(QStringList("N")));
}
-void RegistersWidget::OnCPUStepped()
+void RegistersWidget::OnDebugModeEntered()
{
ARM_Interface* app_core = Core::g_app_core;
@@ -65,3 +65,8 @@ void RegistersWidget::OnCPUStepped()
CSPR->child(13)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 30) & 0x1)); // Z - Zero
CSPR->child(14)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 31) & 0x1)); // N - Negative/Less than
}
+
+void RegistersWidget::OnDebugModeLeft()
+{
+
+}
diff --git a/src/citra_qt/debugger/registers.h b/src/citra_qt/debugger/registers.h
index ac8429f2b..bf8955625 100644
--- a/src/citra_qt/debugger/registers.h
+++ b/src/citra_qt/debugger/registers.h
@@ -17,7 +17,8 @@ public:
RegistersWidget(QWidget* parent = NULL);
public slots:
- void OnCPUStepped();
+ void OnDebugModeEntered();
+ void OnDebugModeLeft();
private:
Ui::ARMRegisters cpu_regs_ui;
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 3e7b5ddfe..653ffec75 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -127,9 +127,13 @@ GMainWindow::GMainWindow()
connect(ui.action_Hotkeys, SIGNAL(triggered()), this, SLOT(OnOpenHotkeysDialog()));
// BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views before the CPU continues
- connect(&render_window->GetEmuThread(), SIGNAL(CPUStepped()), disasmWidget, SLOT(OnCPUStepped()), Qt::BlockingQueuedConnection);
- connect(&render_window->GetEmuThread(), SIGNAL(CPUStepped()), registersWidget, SLOT(OnCPUStepped()), Qt::BlockingQueuedConnection);
- connect(&render_window->GetEmuThread(), SIGNAL(CPUStepped()), callstackWidget, SLOT(OnCPUStepped()), Qt::BlockingQueuedConnection);
+ connect(&render_window->GetEmuThread(), SIGNAL(DebugModeEntered()), disasmWidget, SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection);
+ connect(&render_window->GetEmuThread(), SIGNAL(DebugModeEntered()), registersWidget, SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection);
+ connect(&render_window->GetEmuThread(), SIGNAL(DebugModeEntered()), callstackWidget, SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection);
+
+ connect(&render_window->GetEmuThread(), SIGNAL(DebugModeLeft()), disasmWidget, SLOT(OnDebugModeLeft()), Qt::BlockingQueuedConnection);
+ connect(&render_window->GetEmuThread(), SIGNAL(DebugModeLeft()), registersWidget, SLOT(OnDebugModeLeft()), Qt::BlockingQueuedConnection);
+ connect(&render_window->GetEmuThread(), SIGNAL(DebugModeLeft()), callstackWidget, SLOT(OnDebugModeLeft()), Qt::BlockingQueuedConnection);
// Setup hotkeys
RegisterHotkey("Main Window", "Load File", QKeySequence::Open);
@@ -191,8 +195,8 @@ void GMainWindow::BootGame(std::string filename)
}
disasmWidget->Init();
- registersWidget->OnCPUStepped();
- callstackWidget->OnCPUStepped();
+ registersWidget->OnDebugModeEntered();
+ callstackWidget->OnDebugModeEntered();
render_window->GetEmuThread().SetFilename(filename);
render_window->GetEmuThread().start();