mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 21:37:42 -07:00
hey look, it runs shit now!
This commit is contained in:
parent
931da1c66f
commit
3c883a2152
@ -42,7 +42,7 @@ void Init_ROM();
|
||||
|
||||
// load a ROM file to the specified cart slot
|
||||
// note: loading a ROM to the NDS slot resets emulation
|
||||
bool LoadROM(char* file, int slot);
|
||||
bool LoadROM(const char* file, int slot);
|
||||
|
||||
// get the filename associated with the given savestate slot
|
||||
void GetSavestateName(int slot, char* filename, int len);
|
||||
|
@ -57,7 +57,7 @@ void SetupSRAMPath(int slot)
|
||||
strncpy(SRAMPath[slot] + strlen(ROMPath[slot]) - 3, "sav", 3);
|
||||
}
|
||||
|
||||
bool LoadROM(char* file, int slot)
|
||||
bool LoadROM(const char* file, int slot)
|
||||
{
|
||||
char oldpath[1024];
|
||||
char oldsram[1024];
|
||||
|
@ -35,13 +35,15 @@
|
||||
#include "types.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "FrontendUtil.h"
|
||||
|
||||
#include "NDS.h"
|
||||
#include "GBACart.h"
|
||||
#include "GPU.h"
|
||||
#include "SPU.h"
|
||||
#include "Wifi.h"
|
||||
#include "Platform.h"
|
||||
#include "Config.h"
|
||||
#include "PlatformConfig.h"
|
||||
|
||||
#include "Savestate.h"
|
||||
|
||||
@ -102,7 +104,7 @@ void EmuThread::run()
|
||||
char melontitle[100];
|
||||
SDL_mutex* titlemutex = SDL_CreateMutex();
|
||||
void* titledata[2] = {melontitle, titlemutex};
|
||||
printf("emu thread start: %d\n", EmuRunning);
|
||||
|
||||
while (EmuRunning != 0)
|
||||
{
|
||||
/*ProcessInput();
|
||||
@ -389,8 +391,56 @@ MainWindow::~MainWindow()
|
||||
|
||||
void MainWindow::onOpenFile()
|
||||
{
|
||||
QString filename = QFileDialog::getOpenFileName(this, "Open ROM", "", "DS ROMs (*.nds *.srl);;Any file (*.*)");
|
||||
printf("fark: %p %d %s\n", filename, filename.isEmpty(), filename.toStdString().c_str());
|
||||
emuThread->emuPause(true);
|
||||
|
||||
QString filename = QFileDialog::getOpenFileName(this,
|
||||
"Open ROM",
|
||||
Config::LastROMFolder,
|
||||
"DS ROMs (*.nds *.srl);;GBA ROMs (*.gba);;Any file (*.*)");
|
||||
if (filename.isEmpty())
|
||||
{
|
||||
emuThread->emuUnpause();
|
||||
return;
|
||||
}
|
||||
|
||||
// this shit is stupid
|
||||
char file[1024];
|
||||
strncpy(file, filename.toStdString().c_str(), 1023); file[1023] = '\0';
|
||||
|
||||
int pos = strlen(file)-1;
|
||||
while (file[pos] != '/' && file[pos] != '\\' && pos > 0) pos--;
|
||||
strncpy(Config::LastROMFolder, file, pos);
|
||||
Config::LastROMFolder[pos] = '\0';
|
||||
char* ext = &file[strlen(file)-3];
|
||||
|
||||
int slot; bool res;
|
||||
if (!strcasecmp(ext, "gba"))
|
||||
{
|
||||
slot = 1;
|
||||
res = Frontend::LoadROM(file, Frontend::ROMSlot_GBA);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot = 0;
|
||||
res = Frontend::LoadROM(file, Frontend::ROMSlot_NDS);
|
||||
}
|
||||
|
||||
if (!res)
|
||||
{
|
||||
QMessageBox::critical(this,
|
||||
"melonDS",
|
||||
"Failed to load the ROM.\n\nMake sure the file is accessible and isn't used by another application.");
|
||||
emuThread->emuUnpause();
|
||||
}
|
||||
else if (slot == 1)
|
||||
{
|
||||
// checkme
|
||||
emuThread->emuUnpause();
|
||||
}
|
||||
else
|
||||
{
|
||||
emuThread->emuRun();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -557,6 +607,8 @@ int main(int argc, char** argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
RunningSomething = false;
|
||||
|
||||
mainWindow = new MainWindow();
|
||||
mainWindow->show();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user