Skip to content

Commit d608127

Browse files
committed
🐛 fix a bug of update config
need the update of the vscode-dosbox
1 parent 2a1af98 commit d608127

File tree

2 files changed

+25
-34
lines changed

2 files changed

+25
-34
lines changed

package.json

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "MASM/TASM",
44
"publisher": "xsro",
55
"description": "run MASM/TASM assembly in DOSBox 汇编语言开发插件",
6-
"version": "1.0.0",
6+
"version": "1.0.1",
77
"keywords": [
88
"dosbox",
99
"16位",
@@ -226,7 +226,7 @@
226226
"support": [
227227
"jsdos",
228228
"dosbox",
229-
"dosboxX",
229+
"dosbox-x",
230230
"msdos player"
231231
]
232232
}
@@ -239,7 +239,7 @@
239239
"enum": [
240240
"jsdos",
241241
"dosbox",
242-
"dosboxX",
242+
"dosbox-x",
243243
"msdos player"
244244
],
245245
"enumDescriptions": [
@@ -287,8 +287,8 @@
287287
"type": "string"
288288
},
289289
"default": {
290-
"SDL.windowresolution": "1024x640",
291-
"SDL.output": "opengl"
290+
"sdl.windowresolution": "1024x640",
291+
"sdl.output": "overlay"
292292
},
293293
"markdownDescription": "%config.boxconfig.description%"
294294
},
@@ -297,10 +297,6 @@
297297
"additionalProperties": {
298298
"type": "string"
299299
},
300-
"default": {
301-
"SDL.windowresolution": "1024x640",
302-
"SDL.output": "opengl"
303-
},
304300
"markdownDescription": "%config.boxXconfig.description%"
305301
}
306302
}

src/ASM/main.ts

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as vscode from 'vscode';
22
import * as path from 'path';
33
import * as nodefs from 'fs';
44

5-
import { API } from './vscode-dosbox';
5+
import { API, Dosbox } from './vscode-dosbox';
66
import * as statusBar from './statusBar';
77
import * as Diag from '../diagnose/main';
88
import * as conf from '../utils/configuration';
@@ -48,6 +48,23 @@ export async function activate(context: vscode.ExtensionContext) {
4848
const assemblyToolsFolder = vscode.Uri.joinPath(context.globalStorageUri, conf.extConf.asmType);
4949
const seperateSpaceFolder = vscode.Uri.joinPath(context.globalStorageUri, "workspace");
5050

51+
function updateDosboxConf(box: Dosbox) {
52+
let confSting = "dosbox.config";
53+
if (conf.extConf.emulator === conf.DosEmulatorType.dosboxX) {
54+
confSting = "dosboxX.config";
55+
}
56+
if (conf.extConf._conf.has(confSting)) {
57+
const dosboxConf: { [id: string]: string } | undefined = conf.extConf._conf.get(confSting);
58+
if (dosboxConf) {
59+
for (const id in dosboxConf) {
60+
const [section, key] = id.toLowerCase().split('.');
61+
const value = dosboxConf[id];
62+
box.updateConf(section, key, value);
63+
}
64+
}
65+
}
66+
}
67+
5168
async function singleFileMode(act: conf.actionType, _uri: vscode.Uri): Promise<AsmResult> {
5269
logger.channel(actionMessage(act, _uri.fsPath));
5370

@@ -130,18 +147,7 @@ export async function activate(context: vscode.ExtensionContext) {
130147
}
131148
}
132149

133-
const dosboxConf: { [id: string]: string } | undefined =
134-
conf.extConf.emulator === conf.DosEmulatorType.dosboxX
135-
? vscode.workspace.getConfiguration("masmtasm").get("dosbox.config")
136-
: vscode.workspace.getConfiguration("masmtasm").get("dosboxX.config");
137-
if (dosboxConf) {
138-
for (const id in dosboxConf) {
139-
const [section, key] = id.toLowerCase().split('.');
140-
const value = dosboxConf[id];
141-
box.updateConf(section, key, value);
142-
}
143-
}
144-
150+
updateDosboxConf(box);
145151
box.updateAutoexec(autoexec);
146152

147153
if (act !== conf.actionType.open) {
@@ -375,18 +381,7 @@ export async function activate(context: vscode.ExtensionContext) {
375381
}
376382
}
377383

378-
const dosboxConf: { [id: string]: string } | undefined =
379-
conf.extConf.emulator === conf.DosEmulatorType.dosboxX
380-
? vscode.workspace.getConfiguration("masmtasm").get("dosbox.config")
381-
: vscode.workspace.getConfiguration("masmtasm").get("dosboxX.config");
382-
if (dosboxConf) {
383-
for (const id in dosboxConf) {
384-
const [section, key] = id.toLowerCase().split('.');
385-
const value = dosboxConf[id];
386-
box.updateConf(section, key, value);
387-
}
388-
}
389-
384+
updateDosboxConf(box);
390385
box.updateAutoexec(autoexec);
391386

392387
if (act !== conf.actionType.open) {

0 commit comments

Comments
 (0)