initial work on linker
This commit is contained in:
parent
76987fb932
commit
a09e2eb65a
|
@ -26,7 +26,14 @@ add_executable(shadps4
|
|||
src/Loader/Elf.cpp
|
||||
src/Loader/Elf.h
|
||||
src/GUI/ElfViewer.cpp
|
||||
src/GUI/ElfViewer.h "src/Util/Log.h" "src/Util/Log.cpp" "src/Core/Memory.cpp" "src/Core/Memory.h")
|
||||
src/GUI/ElfViewer.h
|
||||
src/Util/Log.h
|
||||
src/Util/Log.cpp
|
||||
src/Core/Memory.cpp
|
||||
src/Core/Memory.h
|
||||
src/Core/PS4/Linker.cpp
|
||||
src/Core/PS4/Linker.h
|
||||
"src/Util/Singleton.h")
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#include "Linker.h"
|
||||
|
||||
Linker::Linker()
|
||||
{
|
||||
}
|
||||
|
||||
Linker::~Linker()
|
||||
{
|
||||
}
|
||||
|
||||
Module* Linker::LoadModule(const std::string& elf_name)
|
||||
{
|
||||
auto* m = new Module;
|
||||
|
||||
return m;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
#pragma once
|
||||
#include "../../Loader/Elf.h"
|
||||
|
||||
/*this struct keeps neccesary info about loaded modules.Main executeable is included too as well*/
|
||||
struct Module
|
||||
{
|
||||
Elf* elf = nullptr;
|
||||
};
|
||||
|
||||
class Linker
|
||||
{
|
||||
public:
|
||||
Linker();
|
||||
virtual ~Linker();
|
||||
|
||||
Module* LoadModule(const std::string& elf_name);
|
||||
};
|
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdlib>
|
||||
#include <new>
|
||||
|
||||
template <class T>
|
||||
class Singleton
|
||||
{
|
||||
public:
|
||||
static T* Instance()
|
||||
{
|
||||
if (!m_instance)
|
||||
{
|
||||
m_instance = static_cast<T*>(std::malloc(sizeof(T)));
|
||||
new (m_instance) T;
|
||||
}
|
||||
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
protected:
|
||||
Singleton();
|
||||
~Singleton();
|
||||
|
||||
private:
|
||||
static inline T* m_instance = nullptr;
|
||||
};
|
Loading…
Reference in New Issue