Merge branch 'master' into feature/zip-support

This commit is contained in:
WaluigiWare64
2020-08-05 15:06:15 +01:00
committed by GitHub
54 changed files with 3342 additions and 2970 deletions

View File

@ -46,7 +46,9 @@ set(CMAKE_AUTORCC ON)
find_package(Threads REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(Iconv REQUIRED)
pkg_check_modules(SDL2 REQUIRED sdl2)
pkg_check_modules(SLIRP REQUIRED slirp)
pkg_check_modules(LIBZIP REQUIRED libzip)
if (WIN32 AND (CMAKE_BUILD_TYPE STREQUAL Release))
@ -58,6 +60,7 @@ endif()
target_link_libraries(melonDS ${CMAKE_THREAD_LIBS_INIT})
target_include_directories(melonDS PRIVATE ${SDL2_INCLUDE_DIRS})
target_include_directories(melonDS PRIVATE ${SLIRP_INCLUDE_DIRS})
target_include_directories(melonDS PRIVATE ${LIBZIP_INCLUDE_DIRS})
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
@ -65,9 +68,13 @@ target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../..")
target_link_libraries(melonDS core)
if (BUILD_STATIC)
target_link_libraries(melonDS -static ${SDL2_LIBRARIES} ${LIBZIP_STATIC_LIBRARIES})
target_link_libraries(melonDS -static ${SDL2_STATIC_LIBRARIES} ${SLIRP_STATIC_LIBRARIES} ${LIBZIP_STATIC_LIBRARIES})
else()
target_link_libraries(melonDS ${SDL2_LIBRARIES} ${LIBZIP_LIBRARIES})
target_link_libraries(melonDS ${SDL2_LIBRARIES} ${SLIRP_LIBRARIES} ${LIBZIP_LIBRARIES})
endif()
if (NOT Iconv_IS_BUILT_IN)
target_link_libraries(melonDS iconv)
endif()
if (UNIX)

View File

@ -98,6 +98,7 @@ void EmuSettingsDialog::verifyFirmware()
char filename[1024];
strncpy(filename, ui->txtFirmwarePath->text().toStdString().c_str(), 1023); filename[1023] = '\0';
FILE* f = Platform::OpenLocalFile(filename, "rb");
if (!f) return;
u8 chk1[0x180], chk2[0x180];
fseek(f, 0, SEEK_SET);
@ -163,9 +164,9 @@ void EmuSettingsDialog::done(int r)
|| strcmp(Config::DSiNANDPath, dsiNANDPath.c_str()) != 0)
{
if (RunningSomething
&& QMessageBox::warning(this, "Reset necessary to apply changes",
"The emulation will be reset for the changes to take place",
QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes)
&& QMessageBox::warning(this, "Reset necessary to apply changes",
"The emulation will be reset for the changes to take place.",
QMessageBox::Ok, QMessageBox::Cancel) != QMessageBox::Ok)
return;
strncpy(Config::BIOS9Path, bios9Path.c_str(), 1023); Config::BIOS9Path[1023] = '\0';
@ -290,4 +291,4 @@ void EmuSettingsDialog::on_chkEnableJIT_toggled()
ui->chkJITLiteralOptimisations->setDisabled(disabled);
ui->chkJITFastMemory->setDisabled(disabled);
ui->spnJITMaximumBlockSize->setDisabled(disabled);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -111,6 +111,7 @@ void Init(int argc, char** argv)
confdir = config.absolutePath() + "/melonDS/";
EmuDirectory = new char[confdir.length() + 1];
memcpy(EmuDirectory, confdir.toUtf8().data(), confdir.length());
EmuDirectory[confdir.length()] = '\0';
#endif
}

View File

@ -259,6 +259,7 @@ EmuThread::EmuThread(QObject* parent) : QThread(parent)
{
EmuStatus = 0;
EmuRunning = 2;
EmuPause = 0;
RunningSomething = false;
connect(this, SIGNAL(windowUpdate()), mainWindow->panel, SLOT(update()));
@ -568,6 +569,7 @@ void EmuThread::changeWindowTitle(char* title)
void EmuThread::emuRun()
{
EmuRunning = 1;
EmuPause = 0;
RunningSomething = true;
// checkme
@ -578,6 +580,9 @@ void EmuThread::emuRun()
void EmuThread::emuPause()
{
EmuPause++;
if (EmuPause > 1) return;
PrevEmuStatus = EmuRunning;
EmuRunning = 2;
while (EmuStatus != 2);
@ -588,6 +593,11 @@ void EmuThread::emuPause()
void EmuThread::emuUnpause()
{
if (EmuPause < 1) return;
EmuPause--;
if (EmuPause > 0) return;
EmuRunning = PrevEmuStatus;
if (audioDevice) SDL_PauseAudioDevice(audioDevice, 0);
@ -597,6 +607,7 @@ void EmuThread::emuUnpause()
void EmuThread::emuStop()
{
EmuRunning = 0;
EmuPause = 0;
if (audioDevice) SDL_PauseAudioDevice(audioDevice, 1);
if (micDevice) SDL_PauseAudioDevice(micDevice, 1);
@ -1289,6 +1300,8 @@ void MainWindow::keyPressEvent(QKeyEvent* event)
{
if (event->isAutoRepeat()) return;
if (event->key() == Qt::Key_F11) NDS::debug(0);
Input::KeyPress(event);
}
@ -1694,11 +1707,10 @@ void MainWindow::onOpenEmuSettings()
void MainWindow::onEmuSettingsDialogFinished(int res)
{
emuThread->emuUnpause();
if (EmuSettingsDialog::needsReset)
{
emuThread->emuUnpause();
onReset();
}
}
void MainWindow::onOpenInputConfig()
@ -2128,12 +2140,12 @@ int CALLBACK WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int cmdsho
if (argv_w) LocalFree(argv_w);
if (AttachConsole(ATTACH_PARENT_PROCESS))
/*if (AttachConsole(ATTACH_PARENT_PROCESS))
{
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
printf("\n");
}
}*/
int ret = main(argc, argv);

View File

@ -74,6 +74,7 @@ private:
volatile int EmuStatus;
int PrevEmuStatus;
int EmuRunning;
int EmuPause;
QOffscreenSurface* oglSurface;
QOpenGLContext* oglContext;