1//============================================================================
2//
3// SSSS tt lll lll
4// SS SS tt ll ll
5// SS tttttt eeee ll ll aaaa
6// SSSS tt ee ee ll ll aa
7// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8// SS SS tt ee ll ll aa aa
9// SSSS ttt eeeee llll llll aaaaa
10//
11// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
12// and the Stella Team
13//
14// See the file "License.txt" for information on usage and redistribution of
15// this file, and for a DISCLAIMER OF ALL WARRANTIES.
16//============================================================================
17
18#include "LauncherDialog.hxx"
19#include "Version.hxx"
20#include "OSystem.hxx"
21#include "Settings.hxx"
22#include "FSNode.hxx"
23#include "FrameBuffer.hxx"
24#include "bspf.hxx"
25
26#include "Launcher.hxx"
27
28// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
29Launcher::Launcher(OSystem& osystem)
30 : DialogContainer(osystem),
31 myBaseDialog(nullptr)
32{
33 const Common::Size& s = myOSystem.settings().getSize("launcherres");
34 const Common::Size& d = myOSystem.frameBuffer().desktopSize();
35 double overscan = 1 - myOSystem.settings().getInt("tia.fs_overscan") / 100.0;
36 myWidth = s.w; myHeight = s.h;
37
38 // The launcher dialog is resizable, within certain bounds
39 // We check those bounds now
40 myWidth = std::max(myWidth, FBMinimum::Width);
41 myHeight = std::max(myHeight, FBMinimum::Height);
42 myWidth = std::min(myWidth, uInt32(d.w * overscan));
43 myHeight = std::min(myHeight, uInt32(d.h * overscan));
44
45 myOSystem.settings().setValue("launcherres", Common::Size(myWidth, myHeight));
46
47 myBaseDialog = new LauncherDialog(myOSystem, *this, 0, 0, myWidth, myHeight);
48}
49
50// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
51Launcher::~Launcher()
52{
53 delete myBaseDialog; myBaseDialog = nullptr;
54}
55
56// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
57FBInitStatus Launcher::initializeVideo()
58{
59 string title = string("Stella ") + STELLA_VERSION;
60 return myOSystem.frameBuffer().createDisplay(title, myWidth, myHeight);
61}
62
63// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
64const string& Launcher::selectedRom()
65{
66 return (static_cast<LauncherDialog*>(myBaseDialog))->selectedRom();
67}
68
69// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
70const string& Launcher::selectedRomMD5()
71{
72 return (static_cast<LauncherDialog*>(myBaseDialog))->selectedRomMD5();
73}
74
75// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
76const FilesystemNode& Launcher::currentNode() const
77{
78 return (static_cast<LauncherDialog*>(myBaseDialog))->currentNode();
79}
80
81// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
82void Launcher::reload()
83{
84 (static_cast<LauncherDialog*>(myBaseDialog))->reload();
85}
86
87// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
88Dialog* Launcher::baseDialog()
89{
90 return myBaseDialog;
91}
92