mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-24 04:15:01 +00:00
some work on pad emulation (WIP)
This commit is contained in:
parent
95f1c14dcf
commit
da9adf84c0
16 changed files with 255 additions and 71 deletions
24
src/Emulator/Util/singleton.h
Normal file
24
src/Emulator/Util/singleton.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
#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…
Add table
Add a link
Reference in a new issue