Skip to content

Commit 8fba701

Browse files
committed
New parameters override by code.
New BOOSTED Machine Preset.
1 parent ae0bb83 commit 8fba701

File tree

5 files changed

+41
-26
lines changed

5 files changed

+41
-26
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ https://webmsx.org?MACHINE=MSX1E&DISK=https://basicmuseum.org/Demos.dsk&BASIC_RU
227227

228228
| Preset | Description
229229
| --- | ---
230+
| `BOOSTED` | Boosted Machine with HardDisk and CPU/VDP 3x Turbo
230231
| `ALTSLOTCONFIG` | Alternate Slot Configuration. RAM at Primary Slot 3
231232
| `HARDDISK`, `HARDDISKC`, `NOHARDDISK` | Hard Drive Extension
232233
| `DISK`, `DISKA`, `NODISK` | Floppy Drives Extension

doc/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ https://webmsx.org?MACHINE=MSX1E&DISK=https://basicmuseum.org/Demos.dsk&BASIC_RU
227227

228228
| Preset | Description
229229
| --- | ---
230+
| `BOOSTED` | Boosted Machine with HardDisk and CPU/VDP 3x Turbo
230231
| `ALTSLOTCONFIG` | Alternate Slot Configuration. RAM at Primary Slot 3
231232
| `HARDDISK`, `HARDDISKC`, `NOHARDDISK` | Hard Drive Extension
232233
| `DISK`, `DISKA`, `NODISK` | Floppy Drives Extension

src/main/Configurator.js

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ wmsx.Configurator = {
55
applyConfig: function(then) {
66
this.backupOriginalConfig();
77

8-
// Read URL parameters
9-
if (WMSX.ALLOW_URL_PARAMETERS) this.parseURLParams();
8+
// Process parameter overrides (including URL parameters)
9+
this.parseParams();
1010

1111
// Process Config file if asked
12-
if (this.parameters.CONFIG_URL) this.applyParam("CONFIG_URL", this.parameters.CONFIG_URL);
12+
if (WMSX.params.CONFIG_URL) this.applyParam("CONFIG_URL", WMSX.params.CONFIG_URL);
1313
if (WMSX.CONFIG_URL) this.readThenApplyConfigFile(then);
1414
else this.applyConfigDetails(then);
1515
},
@@ -32,11 +32,11 @@ wmsx.Configurator = {
3232
this.applyPresetsConfigModifications();
3333

3434
// Define Machine
35-
if (this.parameters.MACHINE) this.applyParam("MACHINE", this.parameters.MACHINE);
35+
if (WMSX.params.MACHINE) this.applyParam("MACHINE", WMSX.params.MACHINE);
3636
WMSX.MACHINE = WMSX.MACHINE.trim().toUpperCase();
3737
if (WMSX.MACHINE && !WMSX.MACHINES_CONFIG[WMSX.MACHINE]) return wmsx.Util.message("Invalid Machine: " + WMSX.MACHINE);
3838
if (!WMSX.MACHINES_CONFIG[WMSX.MACHINE] || WMSX.MACHINES_CONFIG[WMSX.MACHINE].AUTO_TYPE) WMSX.MACHINE = this.detectDefaultMachine();
39-
delete this.parameters.MACHINE;
39+
delete WMSX.params.MACHINE;
4040

4141
// Apply all parameters from Machine, Presets and Single Parameters from URL
4242
this.applyFinalConfig();
@@ -58,8 +58,8 @@ wmsx.Configurator = {
5858
this.applyPresets(WMSX.MACHINES_CONFIG[WMSX.MACHINE].PRESETS);
5959
// Apply additional Presets over Machine configuration
6060
this.applyPresets(WMSX.PRESETS);
61-
// Apply additional Single Parameters from URL
62-
for (var par in this.parameters) this.applyParam(par, this.parameters[par]);
61+
// Apply additional Single Parameters overrides (including URL parameters)
62+
for (var par in WMSX.params) this.applyParam(par, WMSX.params[par]);
6363
// Ensure the correct types of the parameters after all settings applied
6464
this.normalizeParameterTypes();
6565
},
@@ -97,11 +97,11 @@ wmsx.Configurator = {
9797
},
9898

9999
applyPresetsConfigModifications: function() {
100-
if (this.parameters.PRESETS) this.applyParam("PRESETS", this.parameters.PRESETS);
101-
delete this.parameters.PRESETS;
100+
if (WMSX.params.PRESETS) this.applyParam("PRESETS", WMSX.params.PRESETS);
101+
delete WMSX.params.PRESETS;
102102

103103
// Apply Presets modifications
104-
for (var p in this.parameters) if (wmsx.Util.stringStartsWith(p, "PRESETS_CONFIG")) this.applyParam(p, this.parameters[p]);
104+
for (var p in WMSX.params) if (wmsx.Util.stringStartsWith(p, "PRESETS_CONFIG")) this.applyParam(p, WMSX.params[p]);
105105

106106
// Apply Alternate Slot Config Preset if asked (special case, also modifies other presets)
107107
if ((WMSX.PRESETS || "").toUpperCase().indexOf("ALTSLOTCONFIG") < 0) return;
@@ -121,14 +121,21 @@ wmsx.Configurator = {
121121
this.applyConfigDetails(then);
122122
},
123123

124-
parseURLParams: function() {
125-
var search = (window.location.search || "").split('+').join(' ');
126-
var reg = /[?&]?([^=]+)=([^&]*)/g;
127-
var tokens;
128-
while (tokens = reg.exec(search)) {
129-
var parName = decodeURIComponent(tokens[1]).trim().toUpperCase();
130-
parName = wmsx.Configurator.abbreviations[parName] || parName;
131-
this.parameters[parName] = decodeURIComponent(tokens[2]).trim();
124+
parseParams: function() {
125+
if (WMSX.ALLOW_URL_PARAMETERS) {
126+
var search = (window.location.search || "").split('+').join(' ');
127+
var reg = /[?&]?([^=]+)=([^&]*)/g;
128+
var tokens;
129+
while (tokens = reg.exec(search))
130+
WMSX.params[decodeURIComponent(tokens[1]).trim().toUpperCase()] = decodeURIComponent(tokens[2]).trim();
131+
}
132+
// Replace abbreviations
133+
for (var parName in WMSX.params) {
134+
var newName = wmsx.Configurator.abbreviations[parName];
135+
if (newName) {
136+
WMSX.params[newName] = WMSX.params[parName];
137+
delete WMSX.params[parName];
138+
}
132139
}
133140
},
134141

@@ -385,8 +392,6 @@ wmsx.Configurator = {
385392

386393
originalConfig: {},
387394

388-
parameters: {},
389-
390395
abbreviations: {
391396
E: "ENVIRONMENT",
392397
ENV: "ENVIRONMENT",

src/main/WMSX.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ WMSX.PRESETS_CONFIG = {
236236
"PRESETS_CONFIG.DISK": { "EXTENSIONS.DISK": 1 }
237237
},
238238

239+
// Boosted Machine Preset
240+
241+
BOOSTED: { CPU_TURBO_MODE: 3, VDP_TURBO_MODE: 3, BOOT_DURATION_AUTO: 165, _INCLUDE: "HARDDISK" },
242+
239243
// MSX2++ Machine Presets. Do not use directly
240244

241245
_MSX2PPA: {
@@ -340,11 +344,11 @@ WMSX.PRESETS_CONFIG = {
340344

341345
_BASE: {
342346
CPU_TURBO_MODE: 0,
343-
VDP_TURBO_MODE: 0,
344-
VDP_TYPE: -1,
345-
RTC_ACTIVE: -1
347+
VDP_TURBO_MODE: 0
346348
}
347349

348350
};
349351

352+
WMSX.params = {}; // Additional parameter overrides
353+
350354
wmsx = window.wmsx || {}; // Namespace

src/main/WMSXCBios.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ WMSX.PRESETS_CONFIG = {
219219
"EXTENSIONS_CONFIG.MSXMUSIC.SLOT": [2, 2]
220220
},
221221

222+
// Boosted Machine Preset
223+
224+
BOOSTED: { CPU_TURBO_MODE: 3, VDP_TURBO_MODE: 3, BOOT_DURATION_AUTO: 165, _INCLUDE: "HARDDISK" },
225+
222226
// MSX2++ Machine Presets. Do not use directly
223227

224228
_MSX2PPA: {
@@ -322,11 +326,11 @@ WMSX.PRESETS_CONFIG = {
322326

323327
_BASE: {
324328
CPU_TURBO_MODE: 0,
325-
VDP_TURBO_MODE: 0,
326-
VDP_TYPE: -1,
327-
RTC_ACTIVE: -1
329+
VDP_TURBO_MODE: 0
328330
}
329331

330332
};
331333

334+
WMSX.params = {}; // Additional parameter overrides
335+
332336
wmsx = window.wmsx || {}; // Namespace

0 commit comments

Comments
 (0)