Skip to content

Commit 67deae1

Browse files
committed
Merge branch 'v2.0'
2 parents 354c434 + c111b5a commit 67deae1

File tree

97 files changed

+3424
-3092
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+3424
-3092
lines changed

Emulator/Agnus/Agnus.cpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,21 @@ Agnus::_reset(bool hard)
6060
if (insEvent) scheduleRel <SLOT_INS> (0, insEvent);
6161
}
6262

63-
AgnusConfig
64-
Agnus::getDefaultConfig()
63+
void
64+
Agnus::resetConfig()
6565
{
66-
AgnusConfig defaults;
66+
assert(isPoweredOff());
67+
auto &defaults = amiga.properties;
6768

68-
defaults.revision = AGNUS_ECS_1MB;
69-
defaults.slowRamMirror = true;
69+
std::vector <Option> options = {
7070

71-
return defaults;
72-
}
71+
OPT_AGNUS_REVISION,
72+
OPT_SLOW_RAM_MIRROR
73+
};
7374

74-
void
75-
Agnus::resetConfig()
76-
{
77-
auto defaults = getDefaultConfig();
78-
79-
setConfigItem(OPT_AGNUS_REVISION, defaults.revision);
80-
setConfigItem(OPT_SLOW_RAM_MIRROR, defaults.slowRamMirror);
75+
for (auto &option : options) {
76+
setConfigItem(option, defaults.get(option));
77+
}
8178
}
8279

8380
i64

Emulator/Agnus/Agnus.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ class Agnus : public SubComponent {
294294

295295
public:
296296

297-
static AgnusConfig getDefaultConfig();
298297
const AgnusConfig &getConfig() const { return config; }
299298
void resetConfig() override;
300299

Emulator/Agnus/Blitter/Blitter.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include "config.h"
1111
#include "Blitter.h"
12-
#include "Agnus.h"
12+
#include "Amiga.h"
1313
#include "Checksum.h"
1414
#include "IOUtils.h"
1515
#include "Thread.h"
@@ -69,22 +69,20 @@ Blitter::_run()
6969
}
7070
}
7171

72-
BlitterConfig
73-
Blitter::getDefaultConfig()
74-
{
75-
BlitterConfig defaults;
76-
77-
defaults.accuracy = 2;
78-
79-
return defaults;
80-
}
81-
8272
void
8373
Blitter::resetConfig()
8474
{
85-
auto defaults = getDefaultConfig();
86-
87-
setConfigItem(OPT_BLITTER_ACCURACY, defaults.accuracy);
75+
assert(isPoweredOff());
76+
auto &defaults = amiga.properties;
77+
78+
std::vector <Option> options = {
79+
80+
OPT_BLITTER_ACCURACY
81+
};
82+
83+
for (auto &option : options) {
84+
setConfigItem(option, defaults.get(option));
85+
}
8886
}
8987

9088
i64

Emulator/Agnus/Blitter/Blitter.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ class Blitter : public SubComponent
285285

286286
public:
287287

288-
static BlitterConfig getDefaultConfig();
289288
const BlitterConfig &getConfig() const { return config; }
290289
void resetConfig() override;
291290

Emulator/Agnus/DmaDebugger/DmaDebugger.cpp

Lines changed: 26 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -9,58 +9,39 @@
99

1010
#include "config.h"
1111
#include "DmaDebugger.h"
12-
#include "Agnus.h"
13-
#include "Denise.h"
14-
#include "MsgQueue.h"
15-
#include "PixelEngine.h"
12+
#include "Amiga.h"
1613

1714
DmaDebugger::DmaDebugger(Amiga &ref) : SubComponent(ref)
1815
{
1916
}
2017

21-
DmaDebuggerConfig
22-
DmaDebugger::getDefaultConfig()
23-
{
24-
DmaDebuggerConfig defaults;
25-
26-
defaults.enabled = false;
27-
defaults.displayMode = DMA_DISPLAY_MODE_FG_LAYER;
28-
defaults.opacity = 50;
29-
30-
defaults.visualize[DMA_CHANNEL_CPU] = false;
31-
defaults.visualize[DMA_CHANNEL_REFRESH] = true;
32-
defaults.visualize[DMA_CHANNEL_DISK] = true;
33-
defaults.visualize[DMA_CHANNEL_AUDIO] = true;
34-
defaults.visualize[DMA_CHANNEL_BITPLANE] = true;
35-
defaults.visualize[DMA_CHANNEL_SPRITE] = true;
36-
defaults.visualize[DMA_CHANNEL_COPPER] = true;
37-
defaults.visualize[DMA_CHANNEL_BLITTER] = true;
38-
39-
defaults.debugColor[DMA_CHANNEL_CPU] = 0xFFFFFF00;
40-
defaults.debugColor[DMA_CHANNEL_REFRESH] = 0xFF000000;
41-
defaults.debugColor[DMA_CHANNEL_DISK] = 0x00FF0000;
42-
defaults.debugColor[DMA_CHANNEL_AUDIO] = 0xFF00FF00;
43-
defaults.debugColor[DMA_CHANNEL_BITPLANE] = 0x00FFFF00;
44-
defaults.debugColor[DMA_CHANNEL_SPRITE] = 0x0088FF00;
45-
defaults.debugColor[DMA_CHANNEL_COPPER] = 0xFFFF0000;
46-
defaults.debugColor[DMA_CHANNEL_BLITTER] = 0xFFCC0000;
47-
48-
return defaults;
49-
}
50-
5118
void
5219
DmaDebugger::resetConfig()
5320
{
54-
auto defaults = getDefaultConfig();
55-
56-
setConfigItem(OPT_DMA_DEBUG_ENABLE, defaults.enabled);
57-
setConfigItem(OPT_DMA_DEBUG_MODE, defaults.displayMode);
58-
setConfigItem(OPT_DMA_DEBUG_OPACITY, defaults.opacity);
21+
assert(isPoweredOff());
22+
auto &defaults = amiga.properties;
23+
24+
std::vector <Option> options = {
25+
26+
OPT_DMA_DEBUG_ENABLE,
27+
OPT_DMA_DEBUG_MODE,
28+
OPT_DMA_DEBUG_OPACITY
29+
};
5930

60-
for (isize i = 0; DmaChannelEnum::isValid(i); i++) {
31+
for (auto &option : options) {
32+
setConfigItem(option, defaults.get(option));
33+
}
34+
35+
std::vector <Option> moreOptions = {
36+
37+
OPT_DMA_DEBUG_CHANNEL,
38+
OPT_DMA_DEBUG_COLOR
39+
};
6140

62-
setConfigItem(OPT_DMA_DEBUG_ENABLE, i, defaults.visualize[i]);
63-
setConfigItem(OPT_DMA_DEBUG_COLOR, i, defaults.debugColor[i]);
41+
for (auto &option : moreOptions) {
42+
for (isize i = 0; DmaChannelEnum::isValid(i); i++) {
43+
setConfigItem(option, i, defaults.get(option, i));
44+
}
6445
}
6546
}
6647

@@ -85,8 +66,8 @@ DmaDebugger::getConfigItem(Option option, long id) const
8566

8667
switch (option) {
8768

88-
case OPT_DMA_DEBUG_ENABLE: return config.visualize[id];
89-
case OPT_DMA_DEBUG_COLOR: return config.debugColor[id];
69+
case OPT_DMA_DEBUG_CHANNEL: return config.visualize[id];
70+
case OPT_DMA_DEBUG_COLOR: return config.debugColor[id];
9071

9172
default:
9273
fatalError;
@@ -132,7 +113,7 @@ DmaDebugger::setConfigItem(Option option, long id, i64 value)
132113

133114
switch (option) {
134115

135-
case OPT_DMA_DEBUG_ENABLE:
116+
case OPT_DMA_DEBUG_CHANNEL:
136117

137118
config.visualize[channel] = value;
138119

Emulator/Agnus/DmaDebugger/DmaDebugger.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ class DmaDebugger : public SubComponent {
5959

6060
public:
6161

62-
static DmaDebuggerConfig getDefaultConfig();
6362
const DmaDebuggerConfig &getConfig() const { return config; }
6463
void resetConfig() override;
6564

Emulator/Agnus/DmaDebugger/DmaDebuggerTypes.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ typedef DMA_CHANNEL DmaChannel;
6060
#ifdef __cplusplus
6161
struct DmaChannelEnum : util::Reflection<DmaChannelEnum, DmaChannel>
6262
{
63-
static long minVal() { return 0; }
64-
static long maxVal() { return DMA_CHANNEL_COUNT - 1; }
65-
static bool isValid(auto val) { return val >= minVal() && val <= maxVal(); }
63+
static constexpr long minVal = 0;
64+
static constexpr long maxVal = DMA_CHANNEL_COUNT - 1;
65+
static bool isValid(auto val) { return val >= minVal && val <= maxVal; }
6666

6767
static const char *prefix() { return "DMA_CHANNEL"; }
6868
static const char *key(DmaDisplayMode value)

Emulator/Amiga.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ static_assert(sizeof(u16) == 2, "u16 size mismatch");
2323
static_assert(sizeof(u32) == 4, "u32 size mismatch");
2424
static_assert(sizeof(u64) == 8, "u64 size mismatch");
2525

26+
Properties Amiga::properties;
27+
2628
string
2729
Amiga::version()
2830
{
@@ -288,7 +290,7 @@ Amiga::getConfigItem(Option option, long id) const
288290
{
289291
switch (option) {
290292

291-
case OPT_DMA_DEBUG_ENABLE:
293+
case OPT_DMA_DEBUG_CHANNEL:
292294
case OPT_DMA_DEBUG_COLOR:
293295

294296
return agnus.dmaDebugger.getConfigItem(option, id);
@@ -588,7 +590,7 @@ Amiga::configure(Option option, long id, i64 value)
588590

589591
switch (option) {
590592

591-
case OPT_DMA_DEBUG_ENABLE:
593+
case OPT_DMA_DEBUG_CHANNEL:
592594
case OPT_DMA_DEBUG_COLOR:
593595

594596
agnus.dmaDebugger.setConfigItem(option, id, value);
@@ -819,6 +821,11 @@ Amiga::_dump(Category category, std::ostream& os) const
819821
os << tab("Debug mode");
820822
os << bol(inDebugMode()) << std::endl;
821823
}
824+
825+
if (category == Category::Defaults) {
826+
827+
properties.dump(category, os);
828+
}
822829
}
823830

824831
void

Emulator/Amiga.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "MsgQueue.h"
2424
#include "OSDebugger.h"
2525
#include "Paula.h"
26+
#include "Properties.h"
2627
#include "RegressionTester.h"
2728
#include "RemoteManager.h"
2829
#include "RetroShell.h"
@@ -41,7 +42,7 @@
4142
* amiga.paula.
4243
*/
4344
class Amiga : public Thread {
44-
45+
4546
/* Result of the latest inspection. In order to update the GUI inspector
4647
* panels, the emulator schedules events in the inspector slot (SLOT_INS in
4748
* the secondary table) on a periodic basis. Inside the event handler, the
@@ -56,7 +57,10 @@ class Amiga : public Thread {
5657
//
5758

5859
public:
59-
60+
61+
// User settings
62+
static Properties properties;
63+
6064
// Core components
6165
CPU cpu = CPU(*this);
6266
CIAA ciaA = CIAA(*this);

Emulator/Base/AmigaComponent.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,17 @@
1414

1515
void
1616
AmigaComponent::initialize()
17-
{
18-
for (AmigaComponent *c : subComponents) { c->initialize(); }
19-
_initialize();
17+
{
18+
try {
19+
20+
for (AmigaComponent *c : subComponents) { c->initialize(); }
21+
_initialize();
22+
23+
} catch (std::exception &e) {
24+
25+
warn("Failed to initialize: %s\n", e.what());
26+
fatalError;
27+
}
2028
}
2129

2230
void

0 commit comments

Comments
 (0)