2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Loader: Added support for loading raw BIN executables.

- Useful for debugging homebrew

Qt: Updated GUI to support loading .bin files.
This commit is contained in:
bunnei 2014-08-27 00:04:26 -04:00
parent 3ade84cb7b
commit 738b88293c
3 changed files with 22 additions and 1 deletions

View file

@ -150,7 +150,7 @@ void GMainWindow::BootGame(std::string filename)
void GMainWindow::OnMenuLoadFile() void GMainWindow::OnMenuLoadFile()
{ {
QString filename = QFileDialog::getOpenFileName(this, tr("Load file"), QString(), tr("3DS executable (*.elf *.axf *.cci *.cxi)")); QString filename = QFileDialog::getOpenFileName(this, tr("Load file"), QString(), tr("3DS executable (*.elf *.axf *.bin *.cci *.cxi)"));
if (filename.size()) if (filename.size())
BootGame(filename.toLatin1().data()); BootGame(filename.toLatin1().data());
} }

View file

@ -9,6 +9,7 @@
#include "core/loader/elf.h" #include "core/loader/elf.h"
#include "core/loader/ncch.h" #include "core/loader/ncch.h"
#include "core/hle/kernel/archive.h" #include "core/hle/kernel/archive.h"
#include "core/mem_map.h"
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
@ -39,6 +40,9 @@ FileType IdentifyFile(const std::string &filename) {
else if (!strcasecmp(extension.c_str(), ".cci")) { else if (!strcasecmp(extension.c_str(), ".cci")) {
return FileType::CCI; // TODO(bunnei): Do some filetype checking :p return FileType::CCI; // TODO(bunnei): Do some filetype checking :p
} }
else if (!strcasecmp(extension.c_str(), ".bin")) {
return FileType::BIN; // TODO(bunnei): Do some filetype checking :p
}
return FileType::Unknown; return FileType::Unknown;
} }
@ -69,6 +73,22 @@ ResultStatus LoadFile(const std::string& filename) {
break; break;
} }
// Raw BIN file format...
case FileType::BIN:
{
INFO_LOG(LOADER, "Loading BIN file %s...", filename.c_str());
File::IOFile file(filename, "rb");
if (file.IsOpen()) {
file.ReadBytes(Memory::GetPointer(Memory::EXEFS_CODE_VADDR), (size_t)file.GetSize());
Kernel::LoadExec(Memory::EXEFS_CODE_VADDR);
} else {
return ResultStatus::Error;
}
return ResultStatus::Success;
}
// Error occurred durring IdentifyFile... // Error occurred durring IdentifyFile...
case FileType::Error: case FileType::Error:

View file

@ -21,6 +21,7 @@ enum class FileType {
CXI, CXI,
CIA, CIA,
ELF, ELF,
BIN,
}; };
/// Return type for functions in Loader namespace /// Return type for functions in Loader namespace