VirtualC64 v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
Host.h
1// -----------------------------------------------------------------------------
2// This file is part of VirtualC64
3//
4// Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de
5// This FILE is dual-licensed. You are free to choose between:
6//
7// - The GNU General Public License v3 (or any later version)
8// - The Mozilla Public License v2
9//
10// SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0
11// -----------------------------------------------------------------------------
12
13#pragma once
14
15#include "CoreComponent.h"
16#include "IOUtils.h"
17
18typedef struct
19{
20 // Refresh rate of the host display
21 isize refreshRate;
22
23 // Audio sample rate of the host computer
24 isize sampleRate;
25
26 // Framebuffer dimensions
27 isize frameBufferWidth;
28 isize frameBufferHeight;
29}
30HostConfig;
31
32namespace vc64 {
33
34/* This class stores some information about the host system. The values have
35 * are set by the GUI on start and updated on-the-fly when a value changes.
36 */
37class Host final : public CoreComponent {
38
39 Descriptions descriptions = {{
40
41 .name = "Host",
42 .description = "Host Computer"
43 }};
44
45 ConfigOptions options = {
46
51 };
52
53 // Current configuration
54 HostConfig config = { };
55
56
57 //
58 // Methods
59 //
60
61public:
62
63 using CoreComponent::CoreComponent;
64
65 Host& operator= (const Host& other) {
66
67 CLONE(config)
68 return *this;
69 }
70
71
72 //
73 // Methods from Serializable
74 //
75
76public:
77
78 template <class T> void serialize(T& worker) { } SERIALIZERS(serialize);
79
80
81 //
82 // Methods from CoreComponent
83 //
84
85public:
86
87 const Descriptions &getDescriptions() const override { return descriptions; }
88
89private:
90
91 void _dump(Category category, std::ostream& os) const override;
92
93
94 //
95 // Configuring
96 //
97
98public:
99
100 const HostConfig &getConfig() const { return config; }
101 const ConfigOptions &getOptions() const override { return options; }
102 i64 getOption(Option opt) const override;
103 void checkOption(Option opt, i64 value) override;
104 void setOption(Option opt, i64 value) override;
105
106
107 //
108 // Working with temporary files and folders
109 //
110
111public:
112
113 // Returns a path to a temporary folder
114 fs::path tmp() const throws;
115
116 // Assembles a path to a temporary file
117 fs::path tmp(const string &name, bool unique = false) const throws;
118};
119
120}
121
VirtualC64 project namespace.
Definition CmdQueue.cpp:16
@ OPT_HOST_REFRESH_RATE
Refresh rate of the host display.
Definition OptionTypes.h:28
@ OPT_HOST_SAMPLE_RATE
Refresh rate of the host display.
Definition OptionTypes.h:29
@ OPT_HOST_FRAMEBUF_HEIGHT
Current height of the emulator window.
Definition OptionTypes.h:31
@ OPT_HOST_FRAMEBUF_WIDTH
Current width of the emulator window.
Definition OptionTypes.h:30