Merge pull request #80 from bunnei/fix-latest-libctru
Fixes Citra for the latest changes made to the "refactor" branch of libctru. - For reference, see: https://github.com/smealum/ctrulib/tree/refactor/libctru
This commit is contained in:
		| @@ -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()); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -27,7 +27,7 @@ ARM_Interpreter::ARM_Interpreter()  { | |||||||
|     // Reset the core to initial state |     // Reset the core to initial state | ||||||
|     ARMul_CoProInit(state);  |     ARMul_CoProInit(state);  | ||||||
|     ARMul_Reset(state); |     ARMul_Reset(state); | ||||||
|     state->NextInstr = RESUME; |     state->NextInstr = RESUME; // NOTE: This will be overwritten by LoadContext | ||||||
|     state->Emulate = 3; |     state->Emulate = 3; | ||||||
|  |  | ||||||
|     state->pc = state->Reg[15] = 0x00000000; |     state->pc = state->Reg[15] = 0x00000000; | ||||||
|   | |||||||
| @@ -117,6 +117,11 @@ void ResetThread(Thread* t, u32 arg, s32 lowest_priority) { | |||||||
|     t->context.sp = t->stack_top; |     t->context.sp = t->stack_top; | ||||||
|     t->context.cpsr = 0x1F; // Usermode |     t->context.cpsr = 0x1F; // Usermode | ||||||
|      |      | ||||||
|  |     // TODO(bunnei): This instructs the CPU core to start the execution as if it is "resuming" a | ||||||
|  |     // thread. This is somewhat Sky-Eye specific, and should be re-architected in the future to be | ||||||
|  |     // agnostic of the CPU core. | ||||||
|  |     t->context.mode = 8; | ||||||
|  |  | ||||||
|     if (t->current_priority < lowest_priority) { |     if (t->current_priority < lowest_priority) { | ||||||
|         t->current_priority = t->initial_priority; |         t->current_priority = t->initial_priority; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -16,6 +16,10 @@ Handle g_event_handle = 0; | |||||||
|  |  | ||||||
| void Initialize(Service::Interface* self) { | void Initialize(Service::Interface* self) { | ||||||
|     DEBUG_LOG(OSHLE, "called"); |     DEBUG_LOG(OSHLE, "called"); | ||||||
|  |  | ||||||
|  |     u32* cmd_buff = Service::GetCommandBuffer(); | ||||||
|  |  | ||||||
|  |     cmd_buff[1] = 0; // No error | ||||||
| } | } | ||||||
|  |  | ||||||
| void GetProcSemaphore(Service::Interface* self) { | void GetProcSemaphore(Service::Interface* self) { | ||||||
|   | |||||||
| @@ -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: | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user