start executing
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
#include <loaders/dol.hpp>
|
||||
#include <mem.hpp>
|
||||
#include <broadway.hpp>
|
||||
#include <ircolib/file.hpp>
|
||||
#include <ircolib/mem_access.hpp>
|
||||
#include <array>
|
||||
#include <print>
|
||||
|
||||
namespace weee::core {
|
||||
bool load_dol(const std::string &path, mem &mem) {
|
||||
bool load_dol(const std::string &path, mem &mem, broadway &broadway) {
|
||||
auto bin = ircolib::read_file_binary(path);
|
||||
if (bin.size() <= 0)
|
||||
return false;
|
||||
@@ -45,6 +46,7 @@ bool load_dol(const std::string &path, mem &mem) {
|
||||
mem.set(0, hdr.bss_size, hdr.bss_address & 0x0FFFFFFF);
|
||||
|
||||
hdr.entry_point = std::byteswap(ircolib::read_access<ircolib::u32>(bin, 0xE0));
|
||||
broadway.set_pc(hdr.entry_point);
|
||||
|
||||
for (const auto §ion : hdr.text) {
|
||||
if (section.offset == 0)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
namespace weee::core {
|
||||
struct mem;
|
||||
struct broadway;
|
||||
|
||||
bool load_dol(const std::string &, mem &);
|
||||
bool load_dol(const std::string &, mem &, broadway &);
|
||||
} // namespace weee::core
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#include <loaders/elf.hpp>
|
||||
#include <mem.hpp>
|
||||
#include <broadway.hpp>
|
||||
#include <elfio/elfio.hpp>
|
||||
#include <print>
|
||||
|
||||
namespace weee::core {
|
||||
bool load_elf(const std::string &path, mem &mem) {
|
||||
bool load_elf(const std::string &path, mem &mem, broadway &broadway) {
|
||||
ELFIO::elfio reader;
|
||||
if (!reader.load(path))
|
||||
return false;
|
||||
@@ -39,10 +40,12 @@ bool load_elf(const std::string &path, mem &mem) {
|
||||
continue;
|
||||
}
|
||||
|
||||
mem.copy((const ircolib::u8 *)segment->get_data(), segment->get_file_size(),
|
||||
mem.copy((ircolib::u8 *)segment->get_data(), segment->get_file_size(),
|
||||
segment->get_virtual_address() & 0x0FFFFFFF);
|
||||
}
|
||||
|
||||
broadway.set_pc(reader.get_entry());
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace weee::core
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
namespace weee::core {
|
||||
struct mem;
|
||||
struct broadway;
|
||||
|
||||
bool load_elf(const std::string &, mem &);
|
||||
bool load_elf(const std::string &, mem &, broadway &);
|
||||
} // namespace weee::core
|
||||
|
||||
Reference in New Issue
Block a user