MCPcopy Index your code
hub / github.com/AppleWin/AppleWin / LoadConfiguration

Function LoadConfiguration

source/Utilities.cpp:92–342  ·  view source on GitHub ↗

Reads configuration from the registry entries NB. loadImages=false if loading a save-state from cmd-line afterwards - Registry images may have been deleted from disk, so avoid the MessageBox

Source from the content-addressed store, hash-verified

90// NB. loadImages=false if loading a save-state from cmd-line afterwards
91// - Registry images may have been deleted from disk, so avoid the MessageBox
92void LoadConfiguration(bool loadImages)
93{
94 uint32_t dwComputerType = 0;
95 eApple2Type apple2Type = A2TYPE_APPLE2EENHANCED;
96
97 if (REGLOAD(REGVALUE_APPLE2_TYPE, &dwComputerType))
98 {
99 const uint32_t dwLoadedComputerType = dwComputerType;
100
101 if ( (dwComputerType >= A2TYPE_MAX) ||
102 (dwComputerType >= A2TYPE_UNDEFINED && dwComputerType < A2TYPE_CLONE) ||
103 (dwComputerType >= A2TYPE_CLONE_A2_MAX && dwComputerType < A2TYPE_CLONE_A2E) )
104 dwComputerType = A2TYPE_APPLE2EENHANCED;
105
106 // Remap the bad Pravets models (before AppleWin v1.26)
107 if (dwComputerType == A2TYPE_BAD_PRAVETS82) dwComputerType = A2TYPE_PRAVETS82;
108 if (dwComputerType == A2TYPE_BAD_PRAVETS8M) dwComputerType = A2TYPE_PRAVETS8M;
109
110 // Remap the bad Pravets models (at AppleWin v1.26) - GH#415
111 if (dwComputerType == A2TYPE_CLONE) dwComputerType = A2TYPE_PRAVETS82;
112
113 if (dwLoadedComputerType != dwComputerType)
114 {
115 std::string strText = StrFormat("Unsupported Apple2Type(%d). Changing to %d", dwLoadedComputerType, dwComputerType);
116
117 LogFileOutput("%s\n", strText.c_str());
118
119 GetFrame().FrameMessageBox(strText.c_str(),
120 "Load Configuration",
121 MB_ICONSTOP | MB_SETFOREGROUND);
122
123 GetPropertySheet().ConfigSaveApple2Type((eApple2Type)dwComputerType);
124 }
125
126 apple2Type = (eApple2Type) dwComputerType;
127 }
128 else if (REGLOAD(REGVALUE_OLD_APPLE2_TYPE, &dwComputerType)) // Support older AppleWin registry entries
129 {
130 switch (dwComputerType)
131 {
132 // NB. No A2TYPE_APPLE2E (this is correct)
133 case 0: apple2Type = A2TYPE_APPLE2; break;
134 case 1: apple2Type = A2TYPE_APPLE2PLUS; break;
135 case 2: apple2Type = A2TYPE_APPLE2EENHANCED; break;
136 default: apple2Type = A2TYPE_APPLE2EENHANCED; break;
137 }
138 }
139
140 SetApple2Type(apple2Type);
141
142 //
143
144 uint32_t dwMainCpuType;
145 REGLOAD_DEFAULT(REGVALUE_CPU_TYPE, &dwMainCpuType, CPU_65C02);
146 if (dwMainCpuType != CPU_6502 && dwMainCpuType != CPU_65C02)
147 dwMainCpuType = CPU_65C02;
148 SetMainCpu((eCpuType)dwMainCpuType);
149

Callers 1

RepeatInitializationFunction · 0.85

Calls 15

StrFormatFunction · 0.85
LogFileOutputFunction · 0.85
SetApple2TypeFunction · 0.85
SetMainCpuFunction · 0.85
JoySetJoyTypeFunction · 0.85
LoadConfigOldJoystick_v1Function · 0.85
RegGetConfigSlotSectionFunction · 0.85
RegLoadValueFunction · 0.85
SetCurrentCLK6502Function · 0.85
SetSaveStateOnExitFunction · 0.85
JoySetTrimFunction · 0.85

Tested by

no test coverage detected