loader: Clean up ctors and includes.

master
bunnei 2018-01-20 15:48:37 +07:00
parent e75aba3ed0
commit 386df282a3
10 changed files with 22 additions and 18 deletions

@ -4,6 +4,7 @@
#include "common/common_funcs.h" #include "common/common_funcs.h"
#include "common/common_paths.h" #include "common/common_paths.h"
#include "common/file_util.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
@ -14,6 +15,10 @@
namespace Loader { namespace Loader {
AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileUtil::IOFile&& file,
std::string filepath)
: AppLoader(std::move(file)), filepath(std::move(filepath)) {}
FileType AppLoader_DeconstructedRomDirectory::IdentifyType(FileUtil::IOFile& file, FileType AppLoader_DeconstructedRomDirectory::IdentifyType(FileUtil::IOFile& file,
const std::string& filepath) { const std::string& filepath) {
bool is_main_found{}; bool is_main_found{};

@ -6,7 +6,6 @@
#include <string> #include <string>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/file_util.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/loader/loader.h" #include "core/loader/loader.h"
@ -20,8 +19,7 @@ namespace Loader {
*/ */
class AppLoader_DeconstructedRomDirectory final : public AppLoader { class AppLoader_DeconstructedRomDirectory final : public AppLoader {
public: public:
AppLoader_DeconstructedRomDirectory(FileUtil::IOFile&& file, std::string filepath) AppLoader_DeconstructedRomDirectory(FileUtil::IOFile&& file, std::string filepath);
: AppLoader(std::move(file)), filepath(std::move(filepath)) {}
/** /**
* Returns the type of the file * Returns the type of the file

@ -364,6 +364,9 @@ SectionID ElfReader::GetSectionByName(const char* name, int firstSection) const
namespace Loader { namespace Loader {
AppLoader_ELF::AppLoader_ELF(FileUtil::IOFile&& file, std::string filename)
: AppLoader(std::move(file)), filename(std::move(filename)) {}
FileType AppLoader_ELF::IdentifyType(FileUtil::IOFile& file, const std::string&) { FileType AppLoader_ELF::IdentifyType(FileUtil::IOFile& file, const std::string&) {
static constexpr u16 ELF_MACHINE_ARM{0x28}; static constexpr u16 ELF_MACHINE_ARM{0x28};

@ -16,8 +16,7 @@ namespace Loader {
/// Loads an ELF/AXF file /// Loads an ELF/AXF file
class AppLoader_ELF final : public AppLoader { class AppLoader_ELF final : public AppLoader {
public: public:
AppLoader_ELF(FileUtil::IOFile&& file, std::string filename) AppLoader_ELF(FileUtil::IOFile&& file, std::string filename);
: AppLoader(std::move(file)), filename(std::move(filename)) {}
/** /**
* Returns the type of the file * Returns the type of the file

@ -1,4 +1,4 @@
// Copyright 2014 Citra Emulator Project // Copyright 2018 yuzu emulator team
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
@ -12,8 +12,6 @@
#include "core/loader/nro.h" #include "core/loader/nro.h"
#include "core/loader/nso.h" #include "core/loader/nso.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
namespace Loader { namespace Loader {
const std::initializer_list<Kernel::AddressMapping> default_address_mappings = { const std::initializer_list<Kernel::AddressMapping> default_address_mappings = {

@ -1,4 +1,4 @@
// Copyright 2014 Citra Emulator Project // Copyright 2018 yuzu emulator team
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
@ -20,9 +20,6 @@ struct AddressMapping;
class Process; class Process;
} // namespace Kernel } // namespace Kernel
////////////////////////////////////////////////////////////////////////////////////////////////////
// Loader namespace
namespace Loader { namespace Loader {
/// File types supported by CTR /// File types supported by CTR

@ -5,6 +5,7 @@
#include <vector> #include <vector>
#include "common/common_funcs.h" #include "common/common_funcs.h"
#include "common/file_util.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/swap.h" #include "common/swap.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
@ -45,6 +46,9 @@ struct ModHeader {
}; };
static_assert(sizeof(ModHeader) == 0x1c, "ModHeader has incorrect size."); static_assert(sizeof(ModHeader) == 0x1c, "ModHeader has incorrect size.");
AppLoader_NRO::AppLoader_NRO(FileUtil::IOFile&& file, std::string filepath)
: AppLoader(std::move(file)), filepath(std::move(filepath)) {}
FileType AppLoader_NRO::IdentifyType(FileUtil::IOFile& file, const std::string&) { FileType AppLoader_NRO::IdentifyType(FileUtil::IOFile& file, const std::string&) {
// Read NSO header // Read NSO header
NroHeader nro_header{}; NroHeader nro_header{};

@ -6,7 +6,6 @@
#include <string> #include <string>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/file_util.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/loader/linker.h" #include "core/loader/linker.h"
#include "core/loader/loader.h" #include "core/loader/loader.h"
@ -16,8 +15,7 @@ namespace Loader {
/// Loads an NRO file /// Loads an NRO file
class AppLoader_NRO final : public AppLoader, Linker { class AppLoader_NRO final : public AppLoader, Linker {
public: public:
AppLoader_NRO(FileUtil::IOFile&& file, std::string filepath) AppLoader_NRO(FileUtil::IOFile&& file, std::string filepath);
: AppLoader(std::move(file)), filepath(std::move(filepath)) {}
/** /**
* Returns the type of the file * Returns the type of the file

@ -5,6 +5,7 @@
#include <vector> #include <vector>
#include <lz4.h> #include <lz4.h>
#include "common/common_funcs.h" #include "common/common_funcs.h"
#include "common/file_util.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/swap.h" #include "common/swap.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
@ -46,6 +47,9 @@ struct ModHeader {
}; };
static_assert(sizeof(ModHeader) == 0x1c, "ModHeader has incorrect size."); static_assert(sizeof(ModHeader) == 0x1c, "ModHeader has incorrect size.");
AppLoader_NSO::AppLoader_NSO(FileUtil::IOFile&& file, std::string filepath)
: AppLoader(std::move(file)), filepath(std::move(filepath)) {}
FileType AppLoader_NSO::IdentifyType(FileUtil::IOFile& file, const std::string&) { FileType AppLoader_NSO::IdentifyType(FileUtil::IOFile& file, const std::string&) {
u32 magic = 0; u32 magic = 0;
file.Seek(0, SEEK_SET); file.Seek(0, SEEK_SET);

@ -6,7 +6,6 @@
#include <string> #include <string>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/file_util.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/loader/linker.h" #include "core/loader/linker.h"
#include "core/loader/loader.h" #include "core/loader/loader.h"
@ -16,8 +15,7 @@ namespace Loader {
/// Loads an NSO file /// Loads an NSO file
class AppLoader_NSO final : public AppLoader, Linker { class AppLoader_NSO final : public AppLoader, Linker {
public: public:
AppLoader_NSO(FileUtil::IOFile&& file, std::string filepath) AppLoader_NSO(FileUtil::IOFile&& file, std::string filepath);
: AppLoader(std::move(file)), filepath(std::move(filepath)) {}
/** /**
* Returns the type of the file * Returns the type of the file