From 21fec0289113e48771ba938e969720f0f80f81b5 Mon Sep 17 00:00:00 2001 From: Julian Brehmer Date: Sat, 28 Jan 2023 12:25:51 +0100 Subject: [PATCH 1/2] Added Reset function --- .../Scripting/Python/Modules/eventmodule.cpp | 16 ++++++++++++++++ python-stubs/dolphin/event.pyi | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/Source/Core/Scripting/Python/Modules/eventmodule.cpp b/Source/Core/Scripting/Python/Modules/eventmodule.cpp index c251216adcc8..0b5467ca9db7 100644 --- a/Source/Core/Scripting/Python/Modules/eventmodule.cpp +++ b/Source/Core/Scripting/Python/Modules/eventmodule.cpp @@ -18,6 +18,12 @@ #include "Scripting/Python/Utils/object_wrapper.h" #include "Scripting/Python/PyScriptingBackend.h" +#include "Core/Core.h" +#include "Core/System.h" +#include "Core/HW/ProcessorInterface.h" +//#include "DolphinQt/MainWindow.h" +#include "Core/Movie.h" + namespace PyScripting { @@ -311,6 +317,15 @@ static PyObject* Reset(PyObject* module) Py_RETURN_NONE; } +static PyObject* SystemReset(PyObject* self) +{ + // Copy from DolphinQt/MainWindow.cpp: MainWindow::Reset() + if (Movie::IsRecordingInput()) + Movie::SetReset(true); + ProcessorInterface::ResetButton_Tap(); + Py_RETURN_NONE; +} + PyMODINIT_FUNC PyInit_event() { static PyMethodDef methods[] = { @@ -321,6 +336,7 @@ PyMODINIT_FUNC PyInit_event() Py::MakeMethodDef("on_codebreakpoint"), Py::MakeMethodDef("on_framedrawn"), Py::MakeMethodDef("_dolphin_reset"), + Py::MakeMethodDef("system_reset"), {nullptr, nullptr, 0, nullptr} // Sentinel }; diff --git a/python-stubs/dolphin/event.pyi b/python-stubs/dolphin/event.pyi index f04a513f1016..563c5029a21b 100644 --- a/python-stubs/dolphin/event.pyi +++ b/python-stubs/dolphin/event.pyi @@ -43,3 +43,9 @@ async def memorybreakpoint() -> (bool, int, int): """ Awaitable event that completes once a previously added memory breakpoint is hit. """ + + +def system_reset() -> None: + """ + Resets the emulation. + """ From 4e890059200f28a2c081a60d97c201d5f9fe9a10 Mon Sep 17 00:00:00 2001 From: Julian Brehmer Date: Sat, 28 Jan 2023 12:31:58 +0100 Subject: [PATCH 2/2] removed unnecessary includes --- Source/Core/Scripting/Python/Modules/eventmodule.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Source/Core/Scripting/Python/Modules/eventmodule.cpp b/Source/Core/Scripting/Python/Modules/eventmodule.cpp index 0b5467ca9db7..05ad5db944c1 100644 --- a/Source/Core/Scripting/Python/Modules/eventmodule.cpp +++ b/Source/Core/Scripting/Python/Modules/eventmodule.cpp @@ -10,6 +10,8 @@ #include "Common/Logging/Log.h" #include "Core/API/Events.h" +#include "Core/HW/ProcessorInterface.h" +#include "Core/Movie.h" #include "Scripting/Python/coroutine.h" #include "Scripting/Python/Utils/convert.h" @@ -18,12 +20,6 @@ #include "Scripting/Python/Utils/object_wrapper.h" #include "Scripting/Python/PyScriptingBackend.h" -#include "Core/Core.h" -#include "Core/System.h" -#include "Core/HW/ProcessorInterface.h" -//#include "DolphinQt/MainWindow.h" -#include "Core/Movie.h" - namespace PyScripting {