├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── feature_request.md
│ └── question-or-other.md
└── workflows
│ └── dotnet.yml
├── .gitignore
├── 86BoxManager.API
├── 86BoxManager.API.csproj
├── IEnv.cs
├── IExecVars.cs
├── IExecutor.cs
├── IManager.cs
├── IMessageLoop.cs
├── IMessageReceiver.cs
├── IMessageSender.cs
├── IShell.cs
├── IVerInfo.cs
└── IVm.cs
├── 86BoxManager.Common
├── 86BoxManager.Common.csproj
├── CommonExecVars.cs
├── CommonExecutor.cs
├── CommonManager.cs
├── CommonShell.cs
└── CommonVerInfo.cs
├── 86BoxManager.Core
├── 86BoxManager.Core.csproj
├── Core
│ └── Serializer.cs
├── Model
│ ├── SortType.cs
│ └── VM.cs
├── Registry
│ ├── ConfigKey.cs
│ ├── Configs.cs
│ ├── Settings.cs
│ └── ValueKind.cs
└── Xplat
│ ├── CurrentApp.cs
│ ├── Platforms.cs
│ └── Search.cs
├── 86BoxManager.Gtk
├── 86BoxManager.Gtk.csproj
├── Core
│ ├── VMCenter.cs
│ ├── VMHandler.cs
│ └── VMWatch.cs
├── Model
│ ├── Cache.cs
│ └── VMRow.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Resources
│ ├── 86Box-gray.ico
│ ├── 86Box-gray.ma.png
│ ├── 86Box-gray.png
│ ├── 86Box-gray.sm.png
│ ├── 86Box-gray.svg
│ ├── vm-paused.png
│ ├── vm-running.png
│ ├── vm-stopped.png
│ └── vm-waiting.png
├── Tools
│ ├── Dialogs.cs
│ ├── Resources.cs
│ ├── ToolTips.cs
│ └── Trays.cs
└── View
│ ├── dlgAddVM.Designer.cs
│ ├── dlgAddVM.cs
│ ├── dlgAddVM.glade
│ ├── dlgCloneVM.Designer.cs
│ ├── dlgCloneVM.cs
│ ├── dlgCloneVM.glade
│ ├── dlgEditVM.Designer.cs
│ ├── dlgEditVM.cs
│ ├── dlgEditVM.glade
│ ├── dlgSettings.Designer.cs
│ ├── dlgSettings.cs
│ ├── dlgSettings.glade
│ ├── frmMain.Designer.cs
│ ├── frmMain.cs
│ └── frmMain.glade
├── 86BoxManager.Linux
├── 86BoxManager.Linux.csproj
├── LinuxEnv.cs
├── LinuxManager.cs
└── LinuxShell.cs
├── 86BoxManager.Mac
├── 86BoxManager.Mac.csproj
├── MacEnv.cs
├── MacManager.cs
└── MacShell.cs
├── 86BoxManager.Unix
├── 86BoxManager.Unix.csproj
├── UnixExecutor.cs
├── UnixLoop.cs
└── UnixManager.cs
├── 86BoxManager.Windows
├── 86BoxManager.Windows.csproj
├── Internal
│ ├── Win32Imports.cs
│ ├── WinExecutor.cs
│ ├── WinLoop.cs
│ └── WinVerInfo.cs
├── WinEnv.cs
├── WinManager.cs
├── WinShell.cs
└── lib
│ └── Interop.IWshRuntimeLibrary.dll
├── 86BoxManager.sln
├── 86BoxManager
├── 86BoxManager.csproj
├── App.axaml
├── App.axaml.cs
├── Assets
│ ├── 86Box-gray.ico
│ ├── 86Box-gray.ma.png
│ ├── 86Box-gray.png
│ └── 86Box-gray.sm.png
├── Core
│ ├── VMCenter.cs
│ ├── VMHandler.cs
│ └── VMWatch.cs
├── Models
│ └── Cache.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Resources
│ ├── 86Box-gray.svg
│ ├── vm-paused.png
│ ├── vm-running.png
│ ├── vm-stopped.png
│ └── vm-waiting.png
├── Tools
│ ├── Compat.cs
│ ├── Dialogs.cs
│ ├── Lifetimes.cs
│ ├── Resources.cs
│ ├── ToolTips.cs
│ └── Trays.cs
├── ViewModels
│ ├── MainModel.cs
│ └── VMRow.cs
├── Views
│ ├── dlgAddVM.axaml
│ ├── dlgAddVM.axaml.cs
│ ├── dlgCloneVM.axaml
│ ├── dlgCloneVM.axaml.cs
│ ├── dlgEditVM.axaml
│ ├── dlgEditVM.axaml.cs
│ ├── dlgSettings.axaml
│ ├── dlgSettings.axaml.cs
│ ├── frmMain.axaml
│ └── frmMain.axaml.cs
└── app.manifest
├── AUTHORS
├── LICENSE
├── README.md
└── build.sh
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Use this template only for bug reports.
4 | title: "[BUG]"
5 | labels: bug
6 | assignees: daviunic
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Environment (please complete the following information):**
27 | - Host OS: [e.g. WIndows 10 version 2004]
28 | - 86Box build number and type [e.g. 2529 regular, 2515 dev, etc.]
29 | - 86Box Manager Version [e.g. 1.7.1]
30 | - VM config file (86box.cfg) if applicable
31 | - VM name and full path if applicable
32 |
33 | **Additional context**
34 | Add any other context about the problem here.
35 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Use this template only for feature requests.
4 | title: "[Feature]"
5 | labels: enhancement
6 | assignees: daviunic
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/question-or-other.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Question or other
3 | about: Use this template only for questions or other kinds of issues. Do NOT use for
4 | bug reports or feature requests.
5 | title: ''
6 | labels: ''
7 | assignees: daviunic
8 |
9 | ---
10 |
11 | Ask away.
12 |
--------------------------------------------------------------------------------
/.github/workflows/dotnet.yml:
--------------------------------------------------------------------------------
1 | name: .NET
2 |
3 | on:
4 | push:
5 | branches: [ "master" ]
6 | tags: [ "v*" ]
7 | pull_request:
8 | branches: [ "master" ]
9 |
10 | jobs:
11 | build:
12 |
13 | runs-on: ubuntu-latest
14 |
15 | steps:
16 | - name: Checkout
17 | uses: actions/checkout@v3
18 |
19 | - name: Setup .NET
20 | uses: actions/setup-dotnet@v3
21 | with:
22 | dotnet-version: 6.0.x
23 |
24 | - name: Restore dependencies
25 | run: dotnet restore
26 |
27 | - name: Build
28 | run: dotnet build --no-restore
29 |
30 | - name: Test
31 | run: dotnet test --no-build --verbosity normal
32 |
33 | - name: Publish
34 | if: startsWith(github.ref, 'refs/tags/')
35 | run: |
36 | sudo apt-get install -y zip
37 | ./build.sh
38 |
39 | - name: Release
40 | uses: softprops/action-gh-release@v1
41 | if: startsWith(github.ref, 'refs/tags/')
42 | with:
43 | files: pub/*.*
44 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Dd]ebugPublic/
19 | [Rr]elease/
20 | [Rr]eleases/
21 | x64/
22 | x86/
23 | bld/
24 | [Bb]in/
25 | [Oo]bj/
26 | [Ll]og/
27 |
28 | # Visual Studio 2015/2017 cache/options directory
29 | .vs/
30 | # Uncomment if you have tasks that create the project's static files in wwwroot
31 | #wwwroot/
32 |
33 | # Visual Studio 2017 auto generated files
34 | Generated\ Files/
35 |
36 | # MSTest test Results
37 | [Tt]est[Rr]esult*/
38 | [Bb]uild[Ll]og.*
39 |
40 | # NUNIT
41 | *.VisualState.xml
42 | TestResult.xml
43 |
44 | # Build Results of an ATL Project
45 | [Dd]ebugPS/
46 | [Rr]eleasePS/
47 | dlldata.c
48 |
49 | # Benchmark Results
50 | BenchmarkDotNet.Artifacts/
51 |
52 | # .NET Core
53 | project.lock.json
54 | project.fragment.lock.json
55 | artifacts/
56 |
57 | # StyleCop
58 | StyleCopReport.xml
59 |
60 | # Files built by Visual Studio
61 | *_i.c
62 | *_p.c
63 | *_h.h
64 | *.ilk
65 | *.meta
66 | *.obj
67 | *.iobj
68 | *.pch
69 | *.pdb
70 | *.ipdb
71 | *.pgc
72 | *.pgd
73 | *.rsp
74 | *.sbr
75 | *.tlb
76 | *.tli
77 | *.tlh
78 | *.tmp
79 | *.tmp_proj
80 | *_wpftmp.csproj
81 | *.log
82 | *.vspscc
83 | *.vssscc
84 | .builds
85 | *.pidb
86 | *.svclog
87 | *.scc
88 |
89 | # Chutzpah Test files
90 | _Chutzpah*
91 |
92 | # Visual C++ cache files
93 | ipch/
94 | *.aps
95 | *.ncb
96 | *.opendb
97 | *.opensdf
98 | *.sdf
99 | *.cachefile
100 | *.VC.db
101 | *.VC.VC.opendb
102 |
103 | # Visual Studio profiler
104 | *.psess
105 | *.vsp
106 | *.vspx
107 | *.sap
108 |
109 | # Visual Studio Trace Files
110 | *.e2e
111 |
112 | # TFS 2012 Local Workspace
113 | $tf/
114 |
115 | # Guidance Automation Toolkit
116 | *.gpState
117 |
118 | # ReSharper is a .NET coding add-in
119 | _ReSharper*/
120 | *.[Rr]e[Ss]harper
121 | *.DotSettings.user
122 |
123 | # JustCode is a .NET coding add-in
124 | .JustCode
125 |
126 | # TeamCity is a build add-in
127 | _TeamCity*
128 |
129 | # DotCover is a Code Coverage Tool
130 | *.dotCover
131 |
132 | # AxoCover is a Code Coverage Tool
133 | .axoCover/*
134 | !.axoCover/settings.json
135 |
136 | # Visual Studio code coverage results
137 | *.coverage
138 | *.coveragexml
139 |
140 | # NCrunch
141 | _NCrunch_*
142 | .*crunch*.local.xml
143 | nCrunchTemp_*
144 |
145 | # MightyMoose
146 | *.mm.*
147 | AutoTest.Net/
148 |
149 | # Web workbench (sass)
150 | .sass-cache/
151 |
152 | # Installshield output folder
153 | [Ee]xpress/
154 |
155 | # DocProject is a documentation generator add-in
156 | DocProject/buildhelp/
157 | DocProject/Help/*.HxT
158 | DocProject/Help/*.HxC
159 | DocProject/Help/*.hhc
160 | DocProject/Help/*.hhk
161 | DocProject/Help/*.hhp
162 | DocProject/Help/Html2
163 | DocProject/Help/html
164 |
165 | # Click-Once directory
166 | publish/
167 |
168 | # Publish Web Output
169 | *.[Pp]ublish.xml
170 | *.azurePubxml
171 | # Note: Comment the next line if you want to checkin your web deploy settings,
172 | # but database connection strings (with potential passwords) will be unencrypted
173 | *.pubxml
174 | *.publishproj
175 |
176 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
177 | # checkin your Azure Web App publish settings, but sensitive information contained
178 | # in these scripts will be unencrypted
179 | PublishScripts/
180 |
181 | # NuGet Packages
182 | *.nupkg
183 | # The packages folder can be ignored because of Package Restore
184 | **/[Pp]ackages/*
185 | # except build/, which is used as an MSBuild target.
186 | !**/[Pp]ackages/build/
187 | # Uncomment if necessary however generally it will be regenerated when needed
188 | #!**/[Pp]ackages/repositories.config
189 | # NuGet v3's project.json files produces more ignorable files
190 | *.nuget.props
191 | *.nuget.targets
192 |
193 | # Microsoft Azure Build Output
194 | csx/
195 | *.build.csdef
196 |
197 | # Microsoft Azure Emulator
198 | ecf/
199 | rcf/
200 |
201 | # Windows Store app package directories and files
202 | AppPackages/
203 | BundleArtifacts/
204 | Package.StoreAssociation.xml
205 | _pkginfo.txt
206 | *.appx
207 |
208 | # Visual Studio cache files
209 | # files ending in .cache can be ignored
210 | *.[Cc]ache
211 | # but keep track of directories ending in .cache
212 | !*.[Cc]ache/
213 |
214 | # Others
215 | ClientBin/
216 | ~$*
217 | *~
218 | *.dbmdl
219 | *.dbproj.schemaview
220 | *.jfm
221 | *.pfx
222 | *.publishsettings
223 | orleans.codegen.cs
224 |
225 | # Including strong name files can present a security risk
226 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
227 | #*.snk
228 |
229 | # Since there are multiple workflows, uncomment next line to ignore bower_components
230 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
231 | #bower_components/
232 |
233 | # RIA/Silverlight projects
234 | Generated_Code/
235 |
236 | # Backup & report files from converting an old project file
237 | # to a newer Visual Studio version. Backup files are not needed,
238 | # because we have git ;-)
239 | _UpgradeReport_Files/
240 | Backup*/
241 | UpgradeLog*.XML
242 | UpgradeLog*.htm
243 | ServiceFabricBackup/
244 | *.rptproj.bak
245 |
246 | # SQL Server files
247 | *.mdf
248 | *.ldf
249 | *.ndf
250 |
251 | # Business Intelligence projects
252 | *.rdl.data
253 | *.bim.layout
254 | *.bim_*.settings
255 | *.rptproj.rsuser
256 |
257 | # Microsoft Fakes
258 | FakesAssemblies/
259 |
260 | # GhostDoc plugin setting file
261 | *.GhostDoc.xml
262 |
263 | # Node.js Tools for Visual Studio
264 | .ntvs_analysis.dat
265 | node_modules/
266 |
267 | # Visual Studio 6 build log
268 | *.plg
269 |
270 | # Visual Studio 6 workspace options file
271 | *.opt
272 |
273 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
274 | *.vbw
275 |
276 | # Visual Studio LightSwitch build output
277 | **/*.HTMLClient/GeneratedArtifacts
278 | **/*.DesktopClient/GeneratedArtifacts
279 | **/*.DesktopClient/ModelManifest.xml
280 | **/*.Server/GeneratedArtifacts
281 | **/*.Server/ModelManifest.xml
282 | _Pvt_Extensions
283 |
284 | # Paket dependency manager
285 | .paket/paket.exe
286 | paket-files/
287 |
288 | # FAKE - F# Make
289 | .fake/
290 |
291 | # JetBrains Rider
292 | .idea/
293 | *.sln.iml
294 |
295 | # CodeRush personal settings
296 | .cr/personal
297 |
298 | # Python Tools for Visual Studio (PTVS)
299 | __pycache__/
300 | *.pyc
301 |
302 | # Cake - Uncomment if you are using it
303 | # tools/**
304 | # !tools/packages.config
305 |
306 | # Tabs Studio
307 | *.tss
308 |
309 | # Telerik's JustMock configuration file
310 | *.jmconfig
311 |
312 | # BizTalk build output
313 | *.btp.cs
314 | *.btm.cs
315 | *.odx.cs
316 | *.xsd.cs
317 |
318 | # OpenCover UI analysis results
319 | OpenCover/
320 |
321 | # Azure Stream Analytics local run output
322 | ASALocalRun/
323 |
324 | # MSBuild Binary and Structured Log
325 | *.binlog
326 |
327 | # NVidia Nsight GPU debugger configuration file
328 | *.nvuser
329 |
330 | # MFractors (Xamarin productivity tool) working folder
331 | .mfractor/
332 |
333 | # Local History for Visual Studio
334 | .localhistory/
335 | /dist
336 | /pub
337 | .DS_Store
338 |
--------------------------------------------------------------------------------
/86BoxManager.API/86BoxManager.API.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 | _86BoxManager.API
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/86BoxManager.API/IEnv.cs:
--------------------------------------------------------------------------------
1 | namespace _86BoxManager.API
2 | {
3 | public interface IEnv
4 | {
5 | string MyComputer { get; }
6 |
7 | string UserProfile { get; }
8 |
9 | string[] ExeNames { get; }
10 |
11 | string MyDocuments { get; }
12 |
13 | string Desktop { get; }
14 |
15 | string[] GetProgramFiles(string appName);
16 | }
17 | }
--------------------------------------------------------------------------------
/86BoxManager.API/IExecVars.cs:
--------------------------------------------------------------------------------
1 | namespace _86BoxManager.API
2 | {
3 | public interface IExecVars
4 | {
5 | string FileName { get; }
6 |
7 | string RomPath { get; }
8 |
9 | string LogFile { get; }
10 |
11 | string VmPath { get; }
12 |
13 | IVm Vm { get; }
14 |
15 | (string id, string hWnd)? Handle { get; }
16 | }
17 | }
--------------------------------------------------------------------------------
/86BoxManager.API/IExecutor.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 |
3 | namespace _86BoxManager.API
4 | {
5 | public interface IExecutor
6 | {
7 | ProcessStartInfo BuildStartInfo(IExecVars args);
8 |
9 | ProcessStartInfo BuildConfigInfo(IExecVars args);
10 | }
11 | }
--------------------------------------------------------------------------------
/86BoxManager.API/IManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace _86BoxManager.API
4 | {
5 | public interface IManager
6 | {
7 | bool IsFirstInstance(string name);
8 |
9 | IntPtr RestoreAndFocus(string title, string handleTitle);
10 |
11 | bool IsProcessRunning(string name);
12 |
13 | IVerInfo GetBoxVersion(string exeDir);
14 |
15 | IMessageLoop GetLoop(IMessageReceiver callback);
16 |
17 | IMessageSender GetSender();
18 |
19 | IExecutor GetExecutor();
20 | }
21 | }
--------------------------------------------------------------------------------
/86BoxManager.API/IMessageLoop.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace _86BoxManager.API
4 | {
5 | public interface IMessageLoop
6 | {
7 | IntPtr GetHandle();
8 | }
9 | }
--------------------------------------------------------------------------------
/86BoxManager.API/IMessageReceiver.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace _86BoxManager.API
4 | {
5 | public interface IMessageReceiver
6 | {
7 | void OnEmulatorInit(IntPtr hWnd, uint vmId);
8 | void OnEmulatorShutdown(IntPtr hWnd);
9 |
10 | void OnVmPaused(IntPtr hWnd);
11 | void OnVmResumed(IntPtr hWnd);
12 |
13 | void OnDialogOpened(IntPtr hWnd);
14 | void OnDialogClosed(IntPtr hWnd);
15 |
16 | void OnManagerStartVm(string vmName);
17 | }
18 | }
--------------------------------------------------------------------------------
/86BoxManager.API/IMessageSender.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace _86BoxManager.API
4 | {
5 | public interface IMessageSender
6 | {
7 | void DoVmRequestStop(IVm vm);
8 | void DoVmForceStop(IVm vm);
9 |
10 | void DoVmPause(IVm vm);
11 | void DoVmResume(IVm vm);
12 |
13 | void DoVmCtrlAltDel(IVm vm);
14 | void DoVmHardReset(IVm vm);
15 |
16 | void DoVmConfigure(IVm vm);
17 |
18 | void DoManagerStartVm(IntPtr hWnd, string vmName);
19 | }
20 | }
--------------------------------------------------------------------------------
/86BoxManager.API/IShell.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace _86BoxManager.API
4 | {
5 | public interface IShell
6 | {
7 | void CreateShortcut(string address, string name, string desc, string startup);
8 |
9 | void PushToForeground(IntPtr window);
10 |
11 | void PrepareAppId(string appId);
12 |
13 | void OpenFolder(string folder);
14 |
15 | void EditFile(string file);
16 | }
17 | }
--------------------------------------------------------------------------------
/86BoxManager.API/IVerInfo.cs:
--------------------------------------------------------------------------------
1 | namespace _86BoxManager.API
2 | {
3 | public interface IVerInfo
4 | {
5 | int FilePrivatePart { get; }
6 |
7 | int FileMajorPart { get; }
8 |
9 | int FileMinorPart { get; }
10 |
11 | int FileBuildPart { get; }
12 | }
13 | }
--------------------------------------------------------------------------------
/86BoxManager.API/IVm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | // ReSharper disable InconsistentNaming
4 |
5 | namespace _86BoxManager.API
6 | {
7 | public interface IVm
8 | {
9 | ///
10 | /// Name of the virtual machine
11 | ///
12 | string Name { get; }
13 |
14 | ///
15 | /// Window handle for the VM once it's started
16 | ///
17 | IntPtr hWnd { get; }
18 |
19 | ///
20 | /// Callback to invoke when VM is gone
21 | ///
22 | Action OnExit { set; }
23 | }
24 | }
--------------------------------------------------------------------------------
/86BoxManager.Common/86BoxManager.Common.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 | _86BoxManager.Common
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/86BoxManager.Common/CommonExecVars.cs:
--------------------------------------------------------------------------------
1 | using _86BoxManager.API;
2 |
3 | namespace _86BoxManager.Common
4 | {
5 | public sealed class CommonExecVars : IExecVars
6 | {
7 | public string FileName { get; set; }
8 |
9 | public string RomPath { get; set; }
10 |
11 | public string LogFile { get; set; }
12 |
13 | public string VmPath { get; set; }
14 |
15 | public IVm Vm { get; set; }
16 |
17 | public (string id, string hWnd)? Handle { get; set; }
18 | }
19 | }
--------------------------------------------------------------------------------
/86BoxManager.Common/CommonExecutor.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using _86BoxManager.API;
3 |
4 | namespace _86BoxManager.Common
5 | {
6 | public abstract class CommonExecutor : IExecutor
7 | {
8 | public virtual ProcessStartInfo BuildStartInfo(IExecVars args)
9 | {
10 | var info = new ProcessStartInfo(args.FileName);
11 | var ops = info.ArgumentList;
12 | if (!string.IsNullOrWhiteSpace(args.RomPath))
13 | {
14 | ops.Add("-R");
15 | ops.Add(args.RomPath);
16 | }
17 | if (!string.IsNullOrWhiteSpace(args.LogFile))
18 | {
19 | ops.Add("-L");
20 | ops.Add(args.LogFile);
21 | }
22 | ops.Add("-P");
23 | ops.Add(args.VmPath);
24 | ops.Add("-V");
25 | ops.Add(args.Vm.Name);
26 | return info;
27 | }
28 |
29 | public virtual ProcessStartInfo BuildConfigInfo(IExecVars args)
30 | {
31 | var info = new ProcessStartInfo(args.FileName);
32 | var ops = info.ArgumentList;
33 | ops.Add("--settings");
34 | ops.Add("-P");
35 | ops.Add(args.VmPath);
36 | return info;
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/86BoxManager.Common/CommonManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Reflection;
5 | using _86BoxManager.API;
6 |
7 | namespace _86BoxManager.Common
8 | {
9 | public abstract class CommonManager : IManager
10 | {
11 | private IntPtr _lastEnemy;
12 |
13 | public virtual bool IsFirstInstance(string name)
14 | {
15 | var entry = Assembly.GetEntryAssembly()?.Location;
16 | if (entry != null)
17 | {
18 | var exeName = Path.GetFileNameWithoutExtension(entry);
19 | var myProcId = Environment.ProcessId;
20 | var processes = Process.GetProcessesByName(exeName);
21 | foreach (var proc in processes)
22 | if (proc.Id != myProcId)
23 | {
24 | _lastEnemy = new IntPtr(proc.Id);
25 | return false;
26 | }
27 | }
28 | return true;
29 | }
30 |
31 | public virtual IntPtr RestoreAndFocus(string title, string handleTitle)
32 | {
33 | return _lastEnemy;
34 | }
35 |
36 | public virtual bool IsProcessRunning(string name)
37 | {
38 | var processes = Process.GetProcessesByName(name);
39 | return processes.Length > 0;
40 | }
41 |
42 | public abstract IVerInfo GetBoxVersion(string exeDir);
43 | public abstract IMessageLoop GetLoop(IMessageReceiver callback);
44 | public abstract IMessageSender GetSender();
45 | public abstract IExecutor GetExecutor();
46 | }
47 | }
--------------------------------------------------------------------------------
/86BoxManager.Common/CommonShell.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using _86BoxManager.API;
4 |
5 | namespace _86BoxManager.Common
6 | {
7 | public abstract class CommonShell : IShell
8 | {
9 | public abstract void CreateShortcut(string address, string name, string desc, string startup);
10 |
11 | public virtual void PushToForeground(IntPtr window)
12 | {
13 | // NO-OP
14 | }
15 |
16 | public virtual void PrepareAppId(string appId)
17 | {
18 | // NO-OP
19 | }
20 |
21 | public virtual void OpenFolder(string folder)
22 | {
23 | Process.Start(new ProcessStartInfo(folder)
24 | {
25 | UseShellExecute = true
26 | });
27 | }
28 |
29 | public virtual void EditFile(string file)
30 | {
31 | Process.Start(new ProcessStartInfo(file)
32 | {
33 | UseShellExecute = true
34 | });
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/86BoxManager.Common/CommonVerInfo.cs:
--------------------------------------------------------------------------------
1 | using _86BoxManager.API;
2 |
3 | namespace _86BoxManager.Common
4 | {
5 | public sealed class CommonVerInfo : IVerInfo
6 | {
7 | public int FilePrivatePart { get; set; }
8 |
9 | public int FileMajorPart { get; set; }
10 |
11 | public int FileMinorPart { get; set; }
12 |
13 | public int FileBuildPart { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/86BoxManager.Core/86BoxManager.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 | _86BoxManager
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/86BoxManager.Core/Core/Serializer.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Runtime.Serialization.Formatters.Binary;
3 |
4 | #pragma warning disable SYSLIB0011
5 |
6 | namespace _86BoxManager.Core
7 | {
8 | public static class Serializer
9 | {
10 | private static readonly BinaryFormatter Bf = new();
11 |
12 | public static T Read(byte[] array)
13 | {
14 | using var ms = new MemoryStream(array);
15 | var res = (T)Bf.Deserialize(ms);
16 | ms.Close();
17 | return res;
18 | }
19 |
20 | public static byte[] Write(object obj)
21 | {
22 | using var ms = new MemoryStream();
23 | var formatter = new BinaryFormatter();
24 | formatter.Serialize(ms, obj);
25 | var data = ms.ToArray();
26 | return data;
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/86BoxManager.Core/Model/SortType.cs:
--------------------------------------------------------------------------------
1 | namespace _86BoxManager.Models
2 | {
3 | public enum SortType
4 | {
5 | Ascending = 0,
6 |
7 | Descending
8 | }
9 | }
--------------------------------------------------------------------------------
/86BoxManager.Core/Model/VM.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using _86BoxManager.API;
3 |
4 | // ReSharper disable InconsistentNaming
5 |
6 | namespace _86BoxManager.Models
7 | {
8 | [Serializable] //For serializing VMs so they can be stored in the registry
9 | public class VM : IVm
10 | {
11 | public IntPtr hWnd { get; set; } //Window handle for the VM once it's started
12 | public string Name { get; set; } //Name of the virtual machine
13 | public string Desc { get; set; } //Description
14 | public string Path { get; set; } //Path to config, nvr, etc.
15 | public int Status { get; set; } //Status
16 | public int Pid { get; set; } //Process ID of 86box executable running the VM
17 |
18 | public const int STATUS_STOPPED = 0; //VM is not running
19 | public const int STATUS_RUNNING = 1; //VM is running
20 | public const int STATUS_WAITING = 2; //VM is waiting for user response
21 | public const int STATUS_PAUSED = 3; //VM is paused
22 |
23 | public VM(){
24 | Name = "defaultName";
25 | Desc = "defaultDesc";
26 | Path = "defaultPath";
27 | Status = STATUS_STOPPED;
28 | hWnd = IntPtr.Zero;
29 | }
30 |
31 | public VM(string name, string desc, string path)
32 | {
33 | Name = name;
34 | Desc = desc;
35 | Path = path;
36 | Status = STATUS_STOPPED;
37 | hWnd = IntPtr.Zero;
38 | }
39 |
40 | public override string ToString()
41 | {
42 | return $"Name: {Name}, description: {Desc}, path: {Path}, status: {Status}";
43 | }
44 |
45 | //Returns a lovely status string for use in UI
46 | public string GetStatusString()
47 | {
48 | switch (Status)
49 | {
50 | case STATUS_STOPPED: return "Stopped";
51 | case STATUS_RUNNING: return "Running";
52 | case STATUS_PAUSED: return "Paused";
53 | case STATUS_WAITING: return "Waiting";
54 | default: return "Invalid status";
55 | }
56 | }
57 |
58 | public Action OnExit { get; set; }
59 | }
60 | }
--------------------------------------------------------------------------------
/86BoxManager.Core/Registry/ConfigKey.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Newtonsoft.Json.Linq;
4 | using RegistryValueKind = _86BoxManager.Registry.ValueKind;
5 |
6 | namespace _86BoxManager.Registry
7 | {
8 | public sealed class ConfigKey
9 | {
10 | private readonly JObject _content;
11 | private readonly Action