mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-28 02:26:07 +00:00
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)
|
||||
|
||||
|
|
16
src/Core/PS4/Linker.cpp
Normal file
16
src/Core/PS4/Linker.cpp
Normal file
|
@ -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;
|
||||
}
|
17
src/Core/PS4/Linker.h
Normal file
17
src/Core/PS4/Linker.h
Normal file
|
@ -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);
|
||||
};
|
27
src/Util/Singleton.h
Normal file
27
src/Util/Singleton.h
Normal file
|
@ -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 a new issue