AppleWin/source/linux/context.cpp
Andrea Odetti 7b09bacb01 Initialisation: some fixes.
Ensure log file is created before it is used the first time.
Only close the log file once at the end.

https://github.com/audetto/AppleWin/issues/30

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
2021-05-23 20:06:36 +01:00

65 lines
980 B
C++

#include "StdAfx.h"
#include "linux/context.h"
#include "linux/linuxframe.h"
#include "linux/registry.h"
#include "linux/paddle.h"
#include "linux/duplicates/PropertySheet.h"
#include "Interface.h"
#include "Log.h"
namespace
{
std::shared_ptr<FrameBase> sg_LinuxFrame;
}
IPropertySheet& GetPropertySheet()
{
static CPropertySheet sg_PropertySheet;
return sg_PropertySheet;
}
FrameBase& GetFrame()
{
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<FrameBase> & frame)
{
SetFrame(frame);
frame->Initialize();
}
Initialisation::~Initialisation()
{
GetFrame().Destroy();
SetFrame(std::shared_ptr<FrameBase>());
Paddle::instance.reset();
Registry::instance.reset();
}
Logger::Logger(const bool log)
{
if (log)
{
LogInit();
}
}
Logger::~Logger()
{
LogDone();
}