AppleWin/source/linux/context.cpp

76 lines
1.2 KiB
C++
Raw Normal View History

#include "StdAfx.h"
2021-01-10 11:47:44 +00:00
#include "linux/context.h"
#include "linux/linuxframe.h"
#include "linux/registry.h"
#include "linux/paddle.h"
#include "linux/duplicates/PropertySheet.h"
2021-01-10 11:47:44 +00:00
#include "Interface.h"
#include "Log.h"
2021-01-10 11:47:44 +00:00
namespace
{
std::shared_ptr<FrameBase> sg_LinuxFrame;
}
IPropertySheet& GetPropertySheet()
{
static CPropertySheet sg_PropertySheet;
return sg_PropertySheet;
}
FrameBase& GetFrame()
{
2021-01-10 11:47:44 +00:00
return *sg_LinuxFrame;
}
void SetFrame(const std::shared_ptr<FrameBase> & frame)
{
sg_LinuxFrame = frame;
}
Video& GetVideo()
{
static Video sg_Video;
return sg_Video;
}
Initialisation::Initialisation(
const std::shared_ptr<Registry> & registry,
const std::shared_ptr<FrameBase> & frame,
const std::shared_ptr<Paddle> & paddle
)
{
Registry::instance = registry;
SetFrame(frame);
Paddle::instance = paddle;
}
Initialisation::~Initialisation()
{
GetFrame().Destroy();
SetFrame(std::shared_ptr<FrameBase>());
Paddle::instance.reset();
Registry::instance.reset();
CloseHandle(g_hCustomRomF8);
g_hCustomRomF8 = INVALID_HANDLE_VALUE;
CloseHandle(g_hCustomRom);
g_hCustomRom = INVALID_HANDLE_VALUE;
}
Logger::Logger(const bool log)
{
if (log)
{
LogInit();
}
}
Logger::~Logger()
{
LogDone();
}