mirror of
https://github.com/libretro/Mu.git
synced 2026-09-24 23:56:23 +00:00
Fix reset button crashing when pressed before the emu is started
This commit is contained in:
@@ -14,10 +14,6 @@
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
#include "emuwrapper.h"
|
||||
#include "../../src/emulator.h"
|
||||
|
||||
@@ -36,9 +32,6 @@ char* frontendDebugString;
|
||||
|
||||
|
||||
void frontendHandleDebugPrint(){
|
||||
#if defined(Q_OS_ANDROID)
|
||||
__android_log_print(ANDROID_LOG_DEBUG, "MuDebug", "%s", frontendDebugString);
|
||||
#else
|
||||
QString newDebugString = frontendDebugString;
|
||||
|
||||
//this debug handler doesnt need the \n
|
||||
@@ -55,7 +48,6 @@ void frontendHandleDebugPrint(){
|
||||
debugStrings.push_back(newDebugString);
|
||||
duplicateCallCount.push_back(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -263,19 +255,20 @@ void EmuWrapper::resume(){
|
||||
}
|
||||
|
||||
void EmuWrapper::reset(bool hard){
|
||||
bool wasPaused = isPaused();
|
||||
if(emuInited){
|
||||
bool wasPaused = isPaused();
|
||||
|
||||
if(!wasPaused)
|
||||
pause();
|
||||
if(!wasPaused)
|
||||
pause();
|
||||
|
||||
//save here
|
||||
if(hard)
|
||||
emulatorHardReset();
|
||||
else
|
||||
emulatorSoftReset();
|
||||
if(hard)
|
||||
emulatorHardReset();
|
||||
else
|
||||
emulatorSoftReset();
|
||||
|
||||
if(!wasPaused)
|
||||
resume();
|
||||
if(!wasPaused)
|
||||
resume();
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t EmuWrapper::saveState(const QString& path){
|
||||
|
||||
@@ -23,33 +23,6 @@
|
||||
#include "statemanager.h"
|
||||
|
||||
|
||||
/*
|
||||
#if defined(Q_OS_ANDROID)
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
void printLastRun(){
|
||||
static int64_t lastTime = 0;
|
||||
struct timespec tms;
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &tms);
|
||||
|
||||
int64_t micros = tms.tv_sec * 1000000;
|
||||
micros += tms.tv_nsec / 1000;
|
||||
if(tms.tv_nsec % 1000 >= 500)
|
||||
micros++;
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
__android_log_print(ANDROID_LOG_DEBUG, "Mu", "Microseconds:%lld\n", micros - lastTime);
|
||||
#else
|
||||
printf("Microseconds:%lld\n", micros - lastTime);
|
||||
#endif
|
||||
|
||||
lastTime = micros;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow){
|
||||
@@ -213,8 +186,6 @@ void MainWindow::updateDisplay(){
|
||||
ui->display->repaint();
|
||||
ui->powerButtonLed->repaint();
|
||||
}
|
||||
|
||||
//printLastRun();
|
||||
}
|
||||
|
||||
//Palm buttons
|
||||
@@ -319,6 +290,7 @@ void MainWindow::on_ctrlBtn_clicked(){
|
||||
ui->install->setEnabled(true);
|
||||
ui->stateManager->setEnabled(true);
|
||||
ui->debugger->setEnabled(true);
|
||||
ui->reset->setEnabled(true);
|
||||
|
||||
ui->ctrlBtn->setIcon(QIcon(":/buttons/images/pause.svg"));
|
||||
}
|
||||
|
||||
@@ -379,6 +379,9 @@
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="reset">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
|
||||
Reference in New Issue
Block a user