diff options
-rw-r--r-- | appveyor.yml | 17 | ||||
-rw-r--r-- | src/citra_qt/bootmanager.cpp | 19 | ||||
-rw-r--r-- | src/citra_qt/bootmanager.h | 12 | ||||
-rw-r--r-- | src/citra_qt/debugger/callstack.cpp | 7 | ||||
-rw-r--r-- | src/citra_qt/debugger/callstack.h | 3 | ||||
-rw-r--r-- | src/citra_qt/debugger/disassembler.cpp | 7 | ||||
-rw-r--r-- | src/citra_qt/debugger/disassembler.h | 3 | ||||
-rw-r--r-- | src/citra_qt/debugger/graphics_framebuffer.cpp | 8 | ||||
-rw-r--r-- | src/citra_qt/debugger/graphics_framebuffer.h | 4 | ||||
-rw-r--r-- | src/citra_qt/debugger/registers.cpp | 7 | ||||
-rw-r--r-- | src/citra_qt/debugger/registers.h | 3 | ||||
-rw-r--r-- | src/citra_qt/main.cpp | 14 | ||||
-rw-r--r-- | src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 60 | ||||
-rw-r--r-- | src/core/hle/kernel/thread.cpp | 3 |
14 files changed, 117 insertions, 50 deletions
diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 000000000..83d3b900e --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,17 @@ +# it seems that Qt is only installed by default on unstable os at the moment +os: unstable + +# shallow clone +clone_depth: 1 + +environment: + QTDIR: C:\Qt\5.4\msvc2013_opengl + +install: + - git submodule update --init --recursive + +before_build: + - mkdir build + - cd build + - cmake .. + - cd .. 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 274c5cccd..025a5896b 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; @@ -71,3 +71,8 @@ void CallstackWidget::OnCPUStepped() } } } + +void CallstackWidget::OnDebugModeLeft() +{ + +} diff --git a/src/citra_qt/debugger/callstack.h b/src/citra_qt/debugger/callstack.h index 4f4f74823..fb390f5c3 100644 --- a/src/citra_qt/debugger/callstack.h +++ b/src/citra_qt/debugger/callstack.h @@ -15,7 +15,8 @@ public: CallstackWidget(QWidget* parent = 0); public slots: - void OnCPUStepped(); + void OnDebugModeEntered(); + void OnDebugModeLeft(); private: Ui::CallStack ui; diff --git a/src/citra_qt/debugger/disassembler.cpp b/src/citra_qt/debugger/disassembler.cpp index da084ab24..c61ace925 100644 --- a/src/citra_qt/debugger/disassembler.cpp +++ b/src/citra_qt/debugger/disassembler.cpp @@ -235,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(); @@ -252,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_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 c6671bef1..ece593e5d 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -124,9 +124,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); @@ -167,8 +171,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(); diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index e3ca02e98..4759c7653 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp @@ -4964,39 +4964,41 @@ unsigned InterpreterMainLoop(ARMul_State* state) { } MSR_INST: { - msr_inst *inst_cream = (msr_inst *)inst_base->component; - const uint32_t UnallocMask = 0x06f0fc00, UserMask = 0xf80f0200, PrivMask = 0x000001df, StateMask = 0x01000020; - unsigned int inst = inst_cream->inst; - unsigned int operand; + if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { + msr_inst *inst_cream = (msr_inst *)inst_base->component; + const uint32_t UnallocMask = 0x06f0fc00, UserMask = 0xf80f0200, PrivMask = 0x000001df, StateMask = 0x01000020; + unsigned int inst = inst_cream->inst; + unsigned int operand; - if (BIT(inst, 25)) { - int rot_imm = BITS(inst, 8, 11) * 2; - operand = ROTATE_RIGHT_32(BITS(inst, 0, 7), rot_imm); - } else { - operand = cpu->Reg[BITS(inst, 0, 3)]; - } - uint32_t byte_mask = (BIT(inst, 16) ? 0xff : 0) | (BIT(inst, 17) ? 0xff00 : 0) - | (BIT(inst, 18) ? 0xff0000 : 0) | (BIT(inst, 19) ? 0xff000000 : 0); - uint32_t mask; - if (!inst_cream->R) { - if (InAPrivilegedMode(cpu)) { - if ((operand & StateMask) != 0) { - /// UNPREDICTABLE - DEBUG_MSG; - } else - mask = byte_mask & (UserMask | PrivMask); + if (BIT(inst, 25)) { + int rot_imm = BITS(inst, 8, 11) * 2; + operand = ROTATE_RIGHT_32(BITS(inst, 0, 7), rot_imm); } else { - mask = byte_mask & UserMask; + operand = cpu->Reg[BITS(inst, 0, 3)]; } - SAVE_NZCVT; + uint32_t byte_mask = (BIT(inst, 16) ? 0xff : 0) | (BIT(inst, 17) ? 0xff00 : 0) + | (BIT(inst, 18) ? 0xff0000 : 0) | (BIT(inst, 19) ? 0xff000000 : 0); + uint32_t mask; + if (!inst_cream->R) { + if (InAPrivilegedMode(cpu)) { + if ((operand & StateMask) != 0) { + /// UNPREDICTABLE + DEBUG_MSG; + } else + mask = byte_mask & (UserMask | PrivMask); + } else { + mask = byte_mask & UserMask; + } + SAVE_NZCVT; - cpu->Cpsr = (cpu->Cpsr & ~mask) | (operand & mask); - switch_mode(cpu, cpu->Cpsr & 0x1f); - LOAD_NZCVT; - } else { - if (CurrentModeHasSPSR) { - mask = byte_mask & (UserMask | PrivMask | StateMask); - cpu->Spsr_copy = (cpu->Spsr_copy & ~mask) | (operand & mask); + cpu->Cpsr = (cpu->Cpsr & ~mask) | (operand & mask); + switch_mode(cpu, cpu->Cpsr & 0x1f); + LOAD_NZCVT; + } else { + if (CurrentModeHasSPSR) { + mask = byte_mask & (UserMask | PrivMask | StateMask); + cpu->Spsr_copy = (cpu->Spsr_copy & ~mask) | (operand & mask); + } } } cpu->Reg[15] += GET_INST_SIZE(cpu); diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index dd20ca30e..bc86a7c59 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -263,6 +263,9 @@ void WakeThreadAfterDelay(Thread* thread, s64 nanoseconds) { /// Resumes a thread from waiting by marking it as "ready" void Thread::ResumeFromWait() { + // Cancel any outstanding wakeup events + CoreTiming::UnscheduleEvent(ThreadWakeupEventType, GetHandle()); + status &= ~THREADSTATUS_WAIT; wait_object = nullptr; wait_type = WAITTYPE_NONE; |