mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-11-14 12:13:00 +00:00
Merge pull request #393 from lioncash/loader
loader: Move old logging macros over to new fmt-capable ones
This commit is contained in:
commit
6c9ca8cbca
|
@ -132,7 +132,7 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(
|
|||
const VAddr load_addr = next_load_addr;
|
||||
next_load_addr = AppLoader_NSO::LoadModule(path, load_addr);
|
||||
if (next_load_addr) {
|
||||
LOG_DEBUG(Loader, "loaded module %s @ 0x%" PRIx64, module, load_addr);
|
||||
NGLOG_DEBUG(Loader, "loaded module {} @ {:#X}", module, load_addr);
|
||||
} else {
|
||||
next_load_addr = load_addr;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ ResultStatus AppLoader_DeconstructedRomDirectory::ReadRomFS(
|
|||
std::shared_ptr<FileUtil::IOFile>& romfs_file, u64& offset, u64& size) {
|
||||
|
||||
if (filepath_romfs.empty()) {
|
||||
LOG_DEBUG(Loader, "No RomFS available");
|
||||
NGLOG_DEBUG(Loader, "No RomFS available");
|
||||
return ResultStatus::ErrorNotUsed;
|
||||
}
|
||||
|
||||
|
@ -176,8 +176,8 @@ ResultStatus AppLoader_DeconstructedRomDirectory::ReadRomFS(
|
|||
offset = 0;
|
||||
size = romfs_file->GetSize();
|
||||
|
||||
LOG_DEBUG(Loader, "RomFS offset: 0x%016" PRIX64, offset);
|
||||
LOG_DEBUG(Loader, "RomFS size: 0x%016" PRIX64, size);
|
||||
NGLOG_DEBUG(Loader, "RomFS offset: {:#018X}", offset);
|
||||
NGLOG_DEBUG(Loader, "RomFS size: {:#018X}", size);
|
||||
|
||||
// Reset read pointer
|
||||
file.Seek(0, SEEK_SET);
|
||||
|
|
|
@ -273,18 +273,18 @@ const char* ElfReader::GetSectionName(int section) const {
|
|||
}
|
||||
|
||||
SharedPtr<CodeSet> ElfReader::LoadInto(u32 vaddr) {
|
||||
LOG_DEBUG(Loader, "String section: %i", header->e_shstrndx);
|
||||
NGLOG_DEBUG(Loader, "String section: {}", header->e_shstrndx);
|
||||
|
||||
// Should we relocate?
|
||||
relocate = (header->e_type != ET_EXEC);
|
||||
|
||||
if (relocate) {
|
||||
LOG_DEBUG(Loader, "Relocatable module");
|
||||
NGLOG_DEBUG(Loader, "Relocatable module");
|
||||
entryPoint += vaddr;
|
||||
} else {
|
||||
LOG_DEBUG(Loader, "Prerelocated executable");
|
||||
NGLOG_DEBUG(Loader, "Prerelocated executable");
|
||||
}
|
||||
LOG_DEBUG(Loader, "%i segments:", header->e_phnum);
|
||||
NGLOG_DEBUG(Loader, "{} segments:", header->e_phnum);
|
||||
|
||||
// First pass : Get the bits into RAM
|
||||
u32 base_addr = relocate ? vaddr : 0;
|
||||
|
@ -304,8 +304,8 @@ SharedPtr<CodeSet> ElfReader::LoadInto(u32 vaddr) {
|
|||
|
||||
for (unsigned int i = 0; i < header->e_phnum; ++i) {
|
||||
Elf32_Phdr* p = &segments[i];
|
||||
LOG_DEBUG(Loader, "Type: %i Vaddr: %08X Filesz: %8X Memsz: %8X ", p->p_type, p->p_vaddr,
|
||||
p->p_filesz, p->p_memsz);
|
||||
NGLOG_DEBUG(Loader, "Type: {} Vaddr: {:08X} Filesz: {:08X} Memsz: {:08X} ", p->p_type,
|
||||
p->p_vaddr, p->p_filesz, p->p_memsz);
|
||||
|
||||
if (p->p_type == PT_LOAD) {
|
||||
CodeSet::Segment* codeset_segment;
|
||||
|
@ -317,15 +317,15 @@ SharedPtr<CodeSet> ElfReader::LoadInto(u32 vaddr) {
|
|||
} else if (permission_flags == (PF_R | PF_W)) {
|
||||
codeset_segment = &codeset->data;
|
||||
} else {
|
||||
LOG_ERROR(Loader, "Unexpected ELF PT_LOAD segment id %u with flags %X", i,
|
||||
NGLOG_ERROR(Loader, "Unexpected ELF PT_LOAD segment id {} with flags {:X}", i,
|
||||
p->p_flags);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (codeset_segment->size != 0) {
|
||||
LOG_ERROR(Loader,
|
||||
NGLOG_ERROR(Loader,
|
||||
"ELF has more than one segment of the same type. Skipping extra "
|
||||
"segment (id %i)",
|
||||
"segment (id {})",
|
||||
i);
|
||||
continue;
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ SharedPtr<CodeSet> ElfReader::LoadInto(u32 vaddr) {
|
|||
codeset->entrypoint = base_addr + header->e_entry;
|
||||
codeset->memory = std::make_shared<std::vector<u8>>(std::move(program_image));
|
||||
|
||||
LOG_DEBUG(Loader, "Done loading.");
|
||||
NGLOG_DEBUG(Loader, "Done loading.");
|
||||
|
||||
return codeset;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ void Linker::WriteRelocations(std::vector<u8>& program_image, const std::vector<
|
|||
}
|
||||
break;
|
||||
default:
|
||||
LOG_CRITICAL(Loader, "Unknown relocation type: %d", static_cast<int>(rela.type));
|
||||
NGLOG_CRITICAL(Loader, "Unknown relocation type: {}", static_cast<int>(rela.type));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ void Linker::ResolveImports() {
|
|||
if (search != exports.end()) {
|
||||
Memory::Write64(import.second.ea, search->second + import.second.addend);
|
||||
} else {
|
||||
LOG_ERROR(Loader, "Unresolved import: %s", import.first.c_str());
|
||||
NGLOG_ERROR(Loader, "Unresolved import: {}", import.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ FileType IdentifyFile(FileUtil::IOFile& file, const std::string& filepath) {
|
|||
FileType IdentifyFile(const std::string& file_name) {
|
||||
FileUtil::IOFile file(file_name, "rb");
|
||||
if (!file.IsOpen()) {
|
||||
LOG_ERROR(Loader, "Failed to load file %s", file_name.c_str());
|
||||
NGLOG_ERROR(Loader, "Failed to load file {}", file_name);
|
||||
return FileType::Unknown;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ static std::unique_ptr<AppLoader> GetFileLoader(FileUtil::IOFile&& file, FileTyp
|
|||
std::unique_ptr<AppLoader> GetLoader(const std::string& filename) {
|
||||
FileUtil::IOFile file(filename, "rb");
|
||||
if (!file.IsOpen()) {
|
||||
LOG_ERROR(Loader, "Failed to load file %s", filename.c_str());
|
||||
NGLOG_ERROR(Loader, "Failed to load file {}", filename);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -127,12 +127,12 @@ std::unique_ptr<AppLoader> GetLoader(const std::string& filename) {
|
|||
FileType filename_type = GuessFromExtension(filename_extension);
|
||||
|
||||
if (type != filename_type) {
|
||||
LOG_WARNING(Loader, "File %s has a different type than its extension.", filename.c_str());
|
||||
NGLOG_WARNING(Loader, "File {} has a different type than its extension.", filename);
|
||||
if (FileType::Unknown == type)
|
||||
type = filename_type;
|
||||
}
|
||||
|
||||
LOG_DEBUG(Loader, "Loading file %s as %s...", filename.c_str(), GetFileTypeString(type));
|
||||
NGLOG_DEBUG(Loader, "Loading file {} as {}...", filename, GetFileTypeString(type));
|
||||
|
||||
return GetFileLoader(std::move(file), type, filename_filename, filename);
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ static std::vector<u8> ReadSegment(FileUtil::IOFile& file, const NsoSegmentHeade
|
|||
|
||||
file.Seek(header.offset, SEEK_SET);
|
||||
if (compressed_size != file.ReadBytes(compressed_data.data(), compressed_size)) {
|
||||
LOG_CRITICAL(Loader, "Failed to read %d NSO LZ4 compressed bytes", compressed_size);
|
||||
NGLOG_CRITICAL(Loader, "Failed to read {} NSO LZ4 compressed bytes", compressed_size);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -158,8 +158,7 @@ ResultStatus AppLoader_NSO::Load(Kernel::SharedPtr<Kernel::Process>& process) {
|
|||
|
||||
// Load module
|
||||
LoadModule(filepath, Memory::PROCESS_IMAGE_VADDR);
|
||||
LOG_DEBUG(Loader, "loaded module %s @ 0x%" PRIx64, filepath.c_str(),
|
||||
Memory::PROCESS_IMAGE_VADDR);
|
||||
NGLOG_DEBUG(Loader, "loaded module {} @ {:#X}", filepath, Memory::PROCESS_IMAGE_VADDR);
|
||||
|
||||
process->svc_access_mask.set();
|
||||
process->address_mappings = default_address_mappings;
|
||||
|
|
Loading…
Reference in a new issue