Skip to content

Commit 2243314

Browse files
committed
enable dosbox config setting
1 parent 8d7e4ac commit 2243314

File tree

4 files changed

+51
-45
lines changed

4 files changed

+51
-45
lines changed

package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,17 @@
238238
"SDL.output": "opengl"
239239
},
240240
"markdownDescription": "%config.boxconfig.description%"
241+
},
242+
"masmtasm.dosboxX.config": {
243+
"type": "object",
244+
"additionalProperties": {
245+
"type": "string"
246+
},
247+
"default": {
248+
"SDL.windowresolution": "1024x640",
249+
"SDL.output": "opengl"
250+
},
251+
"markdownDescription": "%config.boxXconfig.description%"
241252
}
242253
}
243254
},

package.nls.json

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,20 @@
33
"editor.runAsm": "Run ASM code",
44
"editor.debugAsm": "Debug ASM code",
55
"command.cleanalldianose": "MASM/TASM: Clean all diagnose information generated by the extension",
6-
"command.dosboxhere": "DOSBox here: Open DosBox and prepare the environment",
7-
"config.toolspath.mddescription": "the path of your tools folder for assembly, used to replace the built-in one",
8-
"config.masmortasm.description": "use TASM or MASM to operate your assembly codes",
9-
"config.masmortasm.enum1": "use MASM toolset, including masm.exe,link.exe,debug.exe...",
10-
"config.masmortasm.enum2": "use TASM toolset, including tasm.exe,tlink.exe,td.exe...",
6+
"config.assembler.description": "use TASM or MASM to operate your assembly codes",
117
"config.emulator.description": "DOS environment emulator",
128
"config.emulator.jsdos": "Use jsdos(wdosbox), run in webview",
13-
"config.emulator.dosbox": "Use DOSBox(most stable),need to install dosbox by yourself",
14-
"config.emulator.player": "Use MSDOS-player for most cases(use dosbox for TD),this may be more quiet",
15-
"config.emulator.auto": "use MSDOS-player to compile,use dosbox to run,use dosbox for TD.exe,MSDOS player for debug.exe",
9+
"config.emulator.dosbox": "Use DOSBox",
10+
"config.emulator.dosboxX": "Use DOSBox-x",
11+
"config.emulator.player": "Use MSDOS-player",
1612
"config.savefirst": "Save the file before Open dosbox, run and debug ASM codes",
1713
"config.boxrun.description": "What to do after run code in dosbox",
1814
"config.boxrun.enum1": "do nothing, manually input exit or click 'x' or press 'Ctrl+F9' to exit",
1915
"config.boxrun.enum2": "exit DOSBox automatically",
2016
"config.boxrun.enum3": "pause and then exit",
2117
"config.boxrun.choose": "use choose command to decide keep dosbox or not",
22-
"config.boxcommand": "If defined, the extension will use this command to open dosbox instead of default command",
23-
"config.boxconsole.description": "what to do with the console window",
24-
"config.boxconsole.min": "- For windows, use command like `start/min dosbox`, this will **Minimize** the console window\n- for other OS, will not process the console information",
25-
"config.boxconsole.normal": "- For windows, use command like `dosbox`, this will **Create** a console window by dosbox\n- for other OS, will not process the console information",
26-
"config.boxconsole.noconsole": "don't show console\n\n- For windows, use command like `dosbox -noconsole` to redirect the console stdout and stderr to files\n- for other OS, will not process the console information",
27-
"config.boxconsole.redirect-show": "Redirect the console stdout and stderr to VSCode output channel, and show. For windows it will not display in real time",
28-
"config.boxconsole.redirect": "Redirect the console stdout and stderr to VSCode output channel. For windows it will not display in real time",
29-
"config.boxconfig.description": "dosbox configurations that will be used, see [link](https://www.dosbox.com/wiki/Dosbox.conf),use property like `\"AUTOEXEC\":\"echo hi\\ndir\"` if need to use *AUTOEXEC*",
18+
"config.boxconfig.description": "configuration for DOSBox, use format like the default value, see [dosbox](https://www.dosbox.com/wiki/Dosbox.conf),Please don't set `autoexec` here",
19+
"config.boxXconfig.description": "configuration for DOSBox-X, use format like the default value, see [dosbox-x](https://dosbox-x.com/wiki/), Please don't set `autoexec `here",
3020
"config.hover": "Display Hover information or not, restart VSCode to apply",
31-
"config.PLF": "Experimental programmatic language features like outline,jump to definition/reference. Restart needed",
32-
"config.separateSpace": "Use a Separate space to keep the workspace clean. This will cause problem with multi-file assembly. \n\n- The extension will copy source code file to this space\n- When the emulator's fileSystem do not support your file path, this will be enabled by default",
33-
"config.clean": "clean related files before action",
34-
"config.jsdos.viewColumn": "the view Column where the jsdos webview will create. See [ViewColumn](https://code.visualstudio.com/api/references/vscode-api#ViewColumn)",
35-
"config.jsdos.viewColumn.Active": "Active panel",
36-
"config.jsdos.viewColumn.Besides": "Besides panel",
37-
"config.dosbox.more": "The commands to use when in dosbox mode.\n\n- The extension will mount tools folder to dosbox's disk C, the file's folder to disk D\n- a separate space as dosbox's disk X,the extension will read file X:\\ASM.LOG to process assembler's message\n",
38-
"config.jsdos.more": "The commands to use when in wdosbox(jsdos mode)",
39-
"config.msdos.more": "The commands to use when in msdos player or auto mode"
21+
"config.PLF": "Experimental programmatic language features like outline,jump to definition/reference. Restart needed"
4022
}

package.nls.zh-cn.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"config.boxrun.enum2": "运行程序之后直接关闭DOSBOX",
1616
"config.boxrun.enum3": "运行程序之后先停顿一下,输入任意字符后关闭DOSBOX窗口",
1717
"config.boxrun.choose": "使用choose命令,来选择是否关闭dosbox",
18-
"config.boxconfig.description": "dosbox的配置信息,将会写到插件专用的配置文件中, 参见 [dosbox官网的说明](https://www.dosbox.com/wiki/Dosbox.conf),如果需要设置AUTOEXEC,可以使用格式如`\"AUTOEXEC\":\"echo hi\\ndir\"`",
18+
"config.boxconfig.description": "dosbox的配置信息,将会写到插件专用的配置文件中, 参见 [dosbox官网的说明](https://www.dosbox.com/wiki/Dosbox.conf),请勿设置`autoexec`",
19+
"config.boxXconfig.description": "dosbox-x的配置信息,将会写到插件专用的配置文件中, 参见 [dosbox-x官网的说明](https://dosbox-x.com/wiki/),请勿设置`autoexec`",
1920
"config.hover": "是否显示悬浮提示(hover),可能需要重启vscode来应用变更",
2021
"config.PLF": "使用提供大纲,跳到定义,查找引用等programmatic features"
2122
}

src/ASM/main.ts

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -109,28 +109,40 @@ export async function activate(context: vscode.ExtensionContext) {
109109
autoexec.push(...action.debug.map(cb));
110110
}
111111

112-
autoexec.push("exit");
113-
114112
const box = conf.extConf.emulator === conf.DosEmulatorType.dosboxX ? api.dosboxX : api.dosbox;
115113
await box.fromBundle(bundle, assemblyToolsFolder);
116114

117-
switch (vscode.workspace.getConfiguration('masm-tasm').get('dosbox.run')) {
118-
case "keep":
119-
break;
120-
case "exit":
121-
autoexec.push('exit');
122-
break;
123-
case 'pause':
124-
autoexec.push('pause', 'exit');
125-
break;
126-
case "choose":
127-
default:
128-
autoexec.push(
129-
"@choice Do you need to keep the DOSBox",
130-
"@IF ERRORLEVEL 2 exit",
131-
"@IF ERRORLEVEL 1 echo on"
132-
);
133-
break;
115+
if (act !== conf.actionType.open) {
116+
switch (vscode.workspace.getConfiguration('masm-tasm').get('dosbox.run')) {
117+
case "keep":
118+
break;
119+
case "exit":
120+
autoexec.push('exit');
121+
break;
122+
case 'pause':
123+
autoexec.push('pause', 'exit');
124+
break;
125+
case "choose":
126+
default:
127+
autoexec.push(
128+
"@choice Do you need to keep the DOSBox",
129+
"@IF ERRORLEVEL 2 exit",
130+
"@IF ERRORLEVEL 1 echo on"
131+
);
132+
break;
133+
}
134+
}
135+
136+
const dosboxConf: { [id: string]: string } | undefined =
137+
conf.extConf.emulator === conf.DosEmulatorType.dosboxX
138+
? vscode.workspace.getConfiguration("masmtasm").get("dosbox.config")
139+
: vscode.workspace.getConfiguration("masmtasm").get("dosboxX.config");
140+
if (dosboxConf) {
141+
for (const id in dosboxConf) {
142+
const [section, key] = id.toLowerCase().split('.');
143+
const value = dosboxConf[id];
144+
box.updateConf(section, key, value);
145+
}
134146
}
135147

136148
box.updateAutoexec(autoexec);

0 commit comments

Comments
 (0)