├── .gitignore
├── Brewmaster
├── AboutWindow.Designer.cs
├── AboutWindow.cs
├── AboutWindow.resx
├── App.config
├── Brewmaster IDE.csproj
├── BuildProcess
│ └── BuildHandler.cs
├── CartridgeExplorer
│ ├── CartridgeExplorer.cs
│ └── CartridgeExplorer.resx
├── EditorWindows
│ ├── Code
│ │ ├── AllCompletion.cs
│ │ ├── Ca65Completion.cs
│ │ ├── Ca65Editor.cs
│ │ ├── Ca65Highlighting.cs
│ │ ├── CodeMarkers.cs
│ │ ├── CodeMenu.cs
│ │ ├── CompletionWindow.cs
│ │ ├── CpuAddressMargin.cs
│ │ ├── FileCompletion.cs
│ │ ├── GoToAll.cs
│ │ ├── GoToAll.resx
│ │ ├── SourceNavigator.cs
│ │ ├── SourceNavigator.resx
│ │ └── Symbol.cs
│ ├── EditorTabs.cs
│ ├── EditorWindow.cs
│ ├── ISaveable.cs
│ ├── Images
│ │ ├── ChrPipelineSettings.cs
│ │ ├── ChrPipelineSettings.resx
│ │ ├── ImagePipelineSettings.cs
│ │ ├── ImagePipelineSettings.resx
│ │ ├── ImageWindow.cs
│ │ ├── PaletteEntries.cs
│ │ ├── PaletteReductionSettings.cs
│ │ └── PaletteReductionSettings.resx
│ └── Text
│ │ ├── FindResults.cs
│ │ ├── FindResults.resx
│ │ ├── FindWindow.Designer.cs
│ │ ├── FindWindow.cs
│ │ ├── FindWindow.resx
│ │ ├── GoToWindow.Designer.cs
│ │ ├── GoToWindow.cs
│ │ ├── GoToWindow.resx
│ │ ├── TextEditor.cs
│ │ ├── TextEditorMenu.cs
│ │ ├── TextEditorWindow.cs
│ │ └── TextEditorWindow.resx
├── Emulation
│ ├── Emulator.cs
│ ├── EmulatorHandler.cs
│ ├── IEmulatorHandler.cs
│ ├── MesenControl.cs
│ ├── MesenControl.resx
│ ├── MesenRenderer.cs
│ ├── NesEmulatorHandler.cs
│ ├── SmallTrackBar.cs
│ └── SnesEmulatorHandler.cs
├── GnuWin32
│ └── bin
│ │ ├── libiconv2.dll
│ │ ├── libintl3.dll
│ │ └── make.exe
├── Layout
│ ├── FloatPanel.Designer.cs
│ ├── FloatPanel.cs
│ ├── FloatPanel.resx
│ ├── HeaderPanel.cs
│ ├── HeaderPanel.resx
│ ├── IdePanel.cs
│ ├── LayoutHandler.cs
│ ├── MultiSplitContainer.cs
│ ├── Overlay.cs
│ ├── Prompt.cs
│ └── StoredLayoutHandler.cs
├── LoadWindow.Designer.cs
├── LoadWindow.cs
├── LoadWindow.resx
├── MainForm.Designer.cs
├── MainForm.cs
├── MainForm.resx
├── MemoryViewer
│ ├── HexEditor.Drawing.cs
│ ├── HexEditor.cs
│ ├── MemoryTabs.cs
│ ├── MemoryViewer.cs
│ └── MemoryViewer.resx
├── MenuHelp.xml
├── Modules
│ ├── Breakpoints
│ │ ├── BreakpointEditor.cs
│ │ ├── BreakpointEditor.resx
│ │ ├── BreakpointList.cs
│ │ └── BreakpointList.resx
│ ├── Build
│ │ ├── ErrorList.cs
│ │ ├── ErrorList.resx
│ │ ├── LogData.cs
│ │ ├── OutputWindow.cs
│ │ └── OutputWindow.resx
│ ├── Ca65Helper
│ │ ├── Ca65CommandDocumentation.cs
│ │ ├── Ca65CommandDocumentation.resx
│ │ └── Ca65DocParser.cs
│ ├── Events.cs
│ ├── MenuHelper.cs
│ ├── NumberHelper
│ │ ├── NumberHelper.Designer.cs
│ │ ├── NumberHelper.cs
│ │ └── NumberHelper.resx
│ ├── OpcodeHelper
│ │ ├── AddressingModeDescription.cs
│ │ ├── AddressingModeDescription.resx
│ │ ├── OpcodeHelper.cs
│ │ ├── OpcodeHelper.resx
│ │ └── OpcodeParser.cs
│ ├── Ppu
│ │ ├── ChrRender.cs
│ │ ├── ChrViewer.Designer.cs
│ │ ├── ChrViewer.cs
│ │ ├── ChrViewer.resx
│ │ ├── ConsolePaletteViewer.cs
│ │ ├── GamePaletteViewer.cs
│ │ ├── Palette.cs
│ │ ├── PaletteViewer.cs
│ │ ├── ScaledImageRenderer.cs
│ │ ├── SpriteRender.cs
│ │ ├── SpriteViewer.Designer.cs
│ │ ├── SpriteViewer.cs
│ │ ├── SpriteViewer.resx
│ │ ├── TileMapRender.cs
│ │ ├── TileMapViewer.Designer.cs
│ │ ├── TileMapViewer.cs
│ │ └── TileMapViewer.resx
│ ├── ScrollableView.cs
│ ├── SpriteList
│ │ ├── Sprite.cs
│ │ └── SpriteList.cs
│ └── Watch
│ │ ├── WatchList.cs
│ │ ├── WatchList.resx
│ │ ├── WatchValues.Designer.cs
│ │ ├── WatchValues.cs
│ │ └── WatchValues.resx
├── Pipeline
│ ├── ChrPipeline.cs
│ └── DataPipeline.cs
├── Program.cs
├── ProjectExplorer
│ ├── FileNode.cs
│ ├── OsFeatures.cs
│ ├── ProjectExplorer.cs
│ ├── ProjectExplorer.resx
│ ├── ProjectExplorerMenu.cs
│ ├── SelectableTreeView.cs
│ └── SortableTreeView.cs
├── ProjectModel
│ ├── AsmProject.cs
│ ├── AsmProjectFile.cs
│ ├── Breakpoint.cs
│ ├── Compatibility
│ │ └── LegacyProjectFileHeaderV1.cs
│ ├── DebugInfo.cs
│ ├── NesCartridge.cs
│ └── ProjectFileHeader.cs
├── ProjectWizard
│ ├── ConfigurationManager.Designer.cs
│ ├── ConfigurationManager.cs
│ ├── ConfigurationManager.resx
│ ├── ConfigurationSettings.Designer.cs
│ ├── ConfigurationSettings.cs
│ ├── ConfigurationSettings.resx
│ ├── ImportFile.Designer.cs
│ ├── ImportFile.cs
│ ├── ImportFile.resx
│ ├── ImportProject.cs
│ ├── ImportProjectFiles.Designer.cs
│ ├── ImportProjectFiles.cs
│ ├── ImportProjectFiles.resx
│ ├── ImportProjectPath.Designer.cs
│ ├── ImportProjectPath.cs
│ ├── ImportProjectPath.resx
│ ├── NewProject.cs
│ ├── NewProjectPath.Designer.cs
│ ├── NewProjectPath.cs
│ ├── NewProjectPath.resx
│ ├── ProjectTemplates.Designer.cs
│ ├── ProjectTemplates.cs
│ ├── ProjectTemplates.resx
│ ├── WizardDialog.Designer.cs
│ ├── WizardDialog.cs
│ └── WizardDialog.resx
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ ├── Settings.settings
│ └── app.manifest
├── Resources
│ ├── 6502.html
│ ├── 65816.html
│ ├── Files
│ │ ├── cartridge.png
│ │ ├── chip.png
│ │ ├── data.png
│ │ ├── file.png
│ │ ├── file_config.png
│ │ ├── file_image.png
│ │ ├── file_text.png
│ │ ├── folder-dark.png
│ │ ├── folder.png
│ │ ├── image.png
│ │ ├── nesproject.ico
│ │ ├── nesproject.png
│ │ ├── snesproject.png
│ │ └── text.png
│ ├── Other
│ │ ├── ca65icon.png
│ │ ├── close.png
│ │ ├── collapsed.png
│ │ ├── error.png
│ │ ├── expanded.png
│ │ ├── label.png
│ │ ├── logo.png
│ │ ├── macro.png
│ │ ├── opcode.png
│ │ ├── smallload.png
│ │ ├── smallsave.png
│ │ └── warning.png
│ ├── Toolbar
│ │ ├── build.png
│ │ ├── build2.png
│ │ ├── build3.png
│ │ ├── buildrun.png
│ │ ├── config.png
│ │ ├── copy.png
│ │ ├── cut.png
│ │ ├── new.png
│ │ ├── open.png
│ │ ├── paste.png
│ │ ├── pause.png
│ │ ├── redo.png
│ │ ├── restart.png
│ │ ├── run.png
│ │ ├── save-all.png
│ │ ├── save.png
│ │ ├── settings.png
│ │ ├── step out.png
│ │ ├── step.png
│ │ ├── stepback.png
│ │ ├── stepover.png
│ │ ├── stop.png
│ │ └── undo.png
│ └── ca65.html
├── Settings
│ ├── ButtonAssignment.cs
│ ├── ButtonAssignment.resx
│ ├── KeyBindingSettings.cs
│ ├── KeyBindingWindow.cs
│ ├── KeyBindingWindow.resx
│ ├── ProjectSettingsWindow.Designer.cs
│ ├── ProjectSettingsWindow.cs
│ ├── ProjectSettingsWindow.resx
│ ├── Settings.cs
│ ├── SettingsWindow.Designer.cs
│ ├── SettingsWindow.cs
│ └── SettingsWindow.resx
├── StatusView
│ ├── CpuStatus.Designer.cs
│ ├── CpuStatus.cs
│ ├── CpuStatus.resx
│ ├── ExpandButton.cs
│ ├── HorizontalLine.cs
│ └── RegisterValue.cs
├── Templates
│ ├── TemplateModule.cs
│ └── ftm
├── brewmaster.ico
├── cc65
│ └── bin
│ │ ├── ar65.exe
│ │ ├── ca65.exe
│ │ ├── cc65.exe
│ │ ├── cl65.exe
│ │ ├── co65.exe
│ │ ├── da65.exe
│ │ ├── grc65.exe
│ │ ├── ld65.exe
│ │ ├── od65.exe
│ │ ├── sim65.exe
│ │ └── sp65.exe
├── lib
│ ├── 7z.dll
│ ├── Mesen-S.dll
│ ├── Mesen
│ │ ├── Font.24.spritefont
│ │ ├── Font.64.spritefont
│ │ ├── LICENSE.txt
│ │ └── PixelFont.ttf
│ ├── MesenCore.dll
│ ├── MesenSCore.dll
│ └── lua51.dll
├── nes.pal
├── nesproject.ico
├── packages.config
└── setup.iss
├── CleanUp.ruleset
├── Ide.sln
├── LICENSE
├── docs
├── CNAME
├── README.md
├── _config.yml
├── getting-started.md
└── logo.png
└── packages
├── HtmlAgilityPack.1.11.23
├── .signature.p7s
├── HtmlAgilityPack.1.11.23.nupkg
└── lib
│ ├── Net35
│ ├── HtmlAgilityPack.dll
│ ├── HtmlAgilityPack.pdb
│ └── HtmlAgilityPack.xml
│ ├── Net40-client
│ ├── HtmlAgilityPack.dll
│ ├── HtmlAgilityPack.pdb
│ └── HtmlAgilityPack.xml
│ ├── Net40
│ ├── HtmlAgilityPack.XML
│ ├── HtmlAgilityPack.dll
│ └── HtmlAgilityPack.pdb
│ ├── Net45
│ ├── HtmlAgilityPack.XML
│ ├── HtmlAgilityPack.dll
│ └── HtmlAgilityPack.pdb
│ ├── NetCore45
│ ├── HtmlAgilityPack.XML
│ ├── HtmlAgilityPack.dll
│ └── HtmlAgilityPack.pdb
│ ├── netstandard1.3
│ ├── HtmlAgilityPack.deps.json
│ ├── HtmlAgilityPack.dll
│ ├── HtmlAgilityPack.pdb
│ └── HtmlAgilityPack.xml
│ ├── netstandard1.6
│ ├── HtmlAgilityPack.deps.json
│ ├── HtmlAgilityPack.dll
│ ├── HtmlAgilityPack.pdb
│ └── HtmlAgilityPack.xml
│ ├── netstandard2.0
│ ├── HtmlAgilityPack.deps.json
│ ├── HtmlAgilityPack.dll
│ ├── HtmlAgilityPack.pdb
│ └── HtmlAgilityPack.xml
│ ├── portable-net45+netcore45+wp8+MonoAndroid+MonoTouch
│ ├── HtmlAgilityPack.XML
│ ├── HtmlAgilityPack.dll
│ └── HtmlAgilityPack.pdb
│ ├── portable-net45+netcore45+wpa81+wp8+MonoAndroid+MonoTouch
│ ├── HtmlAgilityPack.XML
│ ├── HtmlAgilityPack.dll
│ └── HtmlAgilityPack.pdb
│ └── uap10.0
│ ├── HtmlAgilityPack.XML
│ ├── HtmlAgilityPack.dll
│ ├── HtmlAgilityPack.pdb
│ └── HtmlAgilityPack.pri
└── ICSharpCode.TextEditor.3.2.1.6466
├── ICSharpCode.TextEditor.3.2.1.6466.nupkg
└── lib
└── Net20
└── ICSharpCode.TextEditor.dll
/.gitignore:
--------------------------------------------------------------------------------
1 | $ cat .gitignore
2 | # exclude compile files
3 | /.vs/*
4 | /Brewmaster/bin/*
5 | /Brewmaster/obj/*
6 | *.user
7 | *.suo
--------------------------------------------------------------------------------
/Brewmaster/AboutWindow.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Drawing.Drawing2D;
4 | using System.Reflection;
5 | using System.Windows.Forms;
6 |
7 | namespace Brewmaster
8 | {
9 | public partial class AboutWindow : Form
10 | {
11 | public AboutWindow()
12 | {
13 | InitializeComponent();
14 |
15 | var version = "?.?.?";
16 | try
17 | {
18 | var assembly = Assembly.GetExecutingAssembly();
19 | version = FileVersionInfo.GetVersionInfo(assembly.Location).ProductVersion;
20 | }
21 | catch { }
22 | text.Text = string.Format("Version {0}\r\n\r\nAn open source homebrew IDE for Windows\r\n\r\n2019-2020 Created by Sumez", version);
23 | }
24 |
25 | private void closeButton_Click(object sender, EventArgs e)
26 | {
27 | Close();
28 | }
29 |
30 | private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
31 | {
32 | try
33 | {
34 | Process.Start("https://brewmaster.dev");
35 | }
36 | catch { }
37 | }
38 | }
39 | public class LogoPicture : PictureBox
40 | {
41 | protected override void OnPaint(PaintEventArgs paintEventArgs)
42 | {
43 | paintEventArgs.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
44 | base.OnPaint(paintEventArgs);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Brewmaster/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Brewmaster/CartridgeExplorer/CartridgeExplorer.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace Brewmaster.CartridgeExplorer
4 | {
5 | public class CartridgeExplorer: TreeView
6 | {
7 | private System.ComponentModel.IContainer components;
8 |
9 | public CartridgeExplorer()
10 | {
11 | InitializeComponent();
12 | }
13 |
14 | protected override void OnCreateControl()
15 | {
16 | base.OnCreateControl();
17 | }
18 |
19 | public void RefreshTree()
20 | {
21 | var cartridgeNode = new TreeNode("NROM", 0, 0);
22 | var prgNode = new TreeNode("PRG", 1, 1);
23 | var chrNode = new TreeNode("CHR", 1, 1);
24 |
25 | prgNode.Nodes.Add(new TreeNode("Bank 0"));
26 | chrNode.Nodes.Add(new TreeNode("Bank 0"));
27 |
28 | cartridgeNode.Nodes.Add(prgNode);
29 | cartridgeNode.Nodes.Add(chrNode);
30 |
31 | Nodes.Clear();
32 | Nodes.Add(cartridgeNode);
33 | }
34 |
35 | private void InitializeComponent()
36 | {
37 | this.SuspendLayout();
38 | this.ResumeLayout(false);
39 |
40 | }
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/Brewmaster/EditorWindows/Code/AllCompletion.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Windows.Forms;
6 | using Brewmaster.Modules;
7 | using Brewmaster.ProjectModel;
8 | using Brewmaster.Properties;
9 | using ICSharpCode.TextEditor;
10 | using ICSharpCode.TextEditor.Gui.CompletionWindow;
11 |
12 | namespace Brewmaster.EditorWindows.Code
13 | {
14 | public class AllCompletion : CompletionDataProvider
15 | {
16 | public AsmProject Project { get; private set; }
17 | public Events Events { get; private set; }
18 | public override ImageList ImageList { get; set; }
19 | public override string PreSelection { get; set; }
20 | public override int DefaultIndex { get; set; }
21 |
22 | public AllCompletion(AsmProject project, Events events)
23 | {
24 | Project = project;
25 | Events = events;
26 | ImageList = new ImageList();
27 | ImageList.Images.Add(Resources.label);
28 | ImageList.Images.Add(Resources.file);
29 | ImageList.Images.Add(Resources.macro);
30 | }
31 |
32 | public override ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
33 | {
34 | var preSelection = PreSelection.ToLower();
35 | var returnValues = new List();
36 | var sources = new List();
37 | foreach (var symbol in Project.Symbols)
38 | {
39 | if (symbol.Key.ToLower().Contains(preSelection))
40 | {
41 | var source = new Source { Text = symbol.Value.Text, File = symbol.Value.Source, Line = symbol.Value.Line, Character = symbol.Value.Character };
42 | if (sources.Contains(source)) continue;
43 | returnValues.Add(new NavigationData(symbol.Value, Project, Events));
44 | sources.Add(source);
45 | }
46 | }
47 |
48 | foreach (var file in Project.Files)
49 | {
50 | if (file.File.Name.ToLower().Contains(preSelection))
51 | {
52 | returnValues.Add(new NavigationData(file, Events));
53 | }
54 | }
55 |
56 | return returnValues.ToArray();
57 | }
58 |
59 | public override bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key)
60 | {
61 | return data.InsertAction(textArea, key);
62 | }
63 |
64 | public override CompletionDataProviderKeyResult ProcessKey(char key)
65 | {
66 | return CompletionDataProviderKeyResult.NormalKey;
67 | }
68 |
69 | public struct Source
70 | {
71 | public string Text;
72 | public string File;
73 | public int Line;
74 | public int Character;
75 | }
76 | }
77 |
78 | public class NavigationData : ICompletionData
79 | {
80 | private readonly Action _navigate;
81 | public NavigationData(Symbol symbol, AsmProject project, Events events)
82 | {
83 | Text = symbol.Text;
84 | Description = string.Format(@"{0}: {1},{2}", new FileInfo(symbol.Source).Name, symbol.Line, symbol.Character + 1);
85 | _navigate = () =>
86 | {
87 | var file = project.Files.FirstOrDefault(f => f.File.FullName == symbol.Source);
88 | if (file == null) return;
89 | events.OpenFile(file, symbol.Line, symbol.Character, symbol.Text.Length);
90 | };
91 | ImageIndex = symbol is MacroSymbol ? 2 : 0;
92 | }
93 |
94 | public NavigationData(AsmProjectFile file, Events events)
95 | {
96 | Text = file.File.Name;
97 | Description = file.File.FullName;
98 | _navigate = () => events.OpenFile(file);
99 | ImageIndex = 1;
100 | }
101 |
102 | public bool InsertAction(TextArea textArea, char ch)
103 | {
104 | _navigate();
105 | return true;
106 | }
107 |
108 | public int ImageIndex { get; }
109 | public string Text { get; set; }
110 | public string Description { get; }
111 | public double Priority { get; }
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/Brewmaster/EditorWindows/Code/CodeMarkers.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 | using Brewmaster.ProjectModel;
5 | using ICSharpCode.TextEditor;
6 | using ICSharpCode.TextEditor.Document;
7 |
8 | namespace Brewmaster.EditorWindows.Code
9 | {
10 | public class ErrorMarker : TextMarker
11 | {
12 | public ErrorMarker(int offset, int length, string message, Color color)
13 | : base(offset, length, TextMarkerType.WaveLine, color)
14 | {
15 | ToolTip = message;
16 | }
17 | }
18 | public class BreakpointMarker : Bookmark
19 | {
20 | public int BuildLine { get; set; }
21 | public bool Healthy { get; set; }
22 | public Breakpoint GlobalBreakpoint { get; set; }
23 |
24 | public event Action OnRemove;
25 | public BreakpointMarker(IDocument document, int line, int buildLine, bool isEnabled, bool isHealthy, Action onRemove)
26 | : base(document, new TextLocation(0, line), isEnabled)
27 | {
28 | BuildLine = buildLine;
29 | Healthy = isHealthy;
30 | OnRemove = onRemove;
31 | }
32 | public override void Draw(IconBarMargin margin, Graphics g, Point p)
33 | {
34 | var brush = Healthy ? Brushes.OrangeRed : Brushes.Gold;
35 | var diameter = margin.Size.Width / 1.5f;
36 | if (IsEnabled)
37 | g.FillEllipse(brush, p.X, p.Y + (diameter / 4), diameter, diameter);
38 | else
39 | g.DrawEllipse(new Pen(brush, 1), p.X, p.Y + (diameter / 4), diameter, diameter);
40 | }
41 |
42 | public override bool Click(Control parent, MouseEventArgs e)
43 | {
44 | base.Click(parent, e);
45 | if (OnRemove != null) OnRemove();
46 | return true;
47 | }
48 | }
49 | public class BuildLineMarker : Bookmark
50 | {
51 | public int BuildLine { get; set; }
52 | public BuildLineMarker(IDocument document, int line) : base(document, new TextLocation(0, line), true)
53 | {
54 | BuildLine = line;
55 | }
56 | public override bool Click(Control parent, MouseEventArgs e)
57 | {
58 | return false;
59 | }
60 | public override void Draw(IconBarMargin margin, Graphics g, Point p)
61 | {
62 | }
63 | }
64 | public class PcArrow : Bookmark
65 | {
66 | public PcArrow(IDocument document, int line) : base(document, new TextLocation(0, line), true)
67 | {
68 | }
69 | public override bool Click(Control parent, MouseEventArgs e)
70 | {
71 | return false;
72 | }
73 | public override void Draw(IconBarMargin margin, Graphics g, Point p)
74 | {
75 | /*var path = new System.Drawing.Drawing2D.GraphicsPath(new []
76 | {
77 | new PointF(p.X, p.Y-3),
78 | new PointF(p.X+4, p.Y-3),
79 | new PointF(p.X+4, p.Y-6),
80 | new PointF(p.X+7, p.Y),
81 | new PointF(p.X+4, p.Y+6),
82 | new PointF(p.X+4, p.Y+3),
83 | new PointF(p.X, p.Y+3),
84 | }, new Byte[] {
85 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
86 | });
87 | g.FillPath(Brushes.White, path);*/
88 | margin.DrawArrow(g, p.Y);
89 | }
90 | }
91 |
92 | }
--------------------------------------------------------------------------------
/Brewmaster/EditorWindows/Code/CodeMenu.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using Brewmaster.EditorWindows.Text;
4 | using Brewmaster.Modules;
5 | using Brewmaster.ProjectModel;
6 | using Brewmaster.Settings;
7 |
8 | namespace Brewmaster.EditorWindows.Code
9 | {
10 | public class CodeMenu : TextEditorMenu
11 | {
12 | public Action GoToDefinition;
13 | public Action ToggleBreakpoint;
14 | public Action AddToWatch;
15 | public Action BreakOnAccess;
16 |
17 | public CodeMenu(Events events) : base(events) { }
18 |
19 | protected override void InitializeComponent()
20 | {
21 | Items.Add(GoToDefinitionOption = new ToolStripMenuItem("Go To Definition", null, GoToDefinition_Click));
22 | Items.Add(AddToWatchOption = new ToolStripMenuItem("Add To Watch", null, AddToWatch_Click));
23 | Items.Add(BreakOnWriteOption = new ToolStripMenuItem("Break On Write", null, (s, e) => { if (BreakOnAccess != null) BreakOnAccess(Breakpoint.Types.Write); }));
24 | Items.Add(BreakOnReadOption = new ToolStripMenuItem("Break On Read", null, (s, e) => { if (BreakOnAccess != null) BreakOnAccess(Breakpoint.Types.Read); }));
25 | Items.Add(new ToolStripSeparator());
26 | Items.Add(AddBreakpointOption = new ToolStripMenuItem("Toggle Breakpoint", null, AddBreakpoint_Click));
27 |
28 | Program.BindKey(Feature.GoToDefinition, (keys) => GoToDefinitionOption.ShortcutKeys = keys);
29 | Program.BindKey(Feature.AddToWatch, (keys) => AddToWatchOption.ShortcutKeys = keys);
30 |
31 | Closing += (sender, args) => { AddToWatchOption.Enabled = GoToDefinitionOption.Enabled = true; };
32 | Items.Add(new ToolStripSeparator());
33 |
34 | base.InitializeComponent();
35 | }
36 |
37 | private void AddBreakpoint_Click(object sender, EventArgs e)
38 | {
39 | if (ToggleBreakpoint != null) ToggleBreakpoint();
40 | }
41 |
42 | private void AddToWatch_Click(object sender, EventArgs e)
43 | {
44 | if (AddToWatch != null) AddToWatch();
45 | }
46 |
47 | public ToolStripMenuItem GoToDefinitionOption { get; private set; }
48 | public ToolStripMenuItem AddToWatchOption { get; private set; }
49 | public ToolStripMenuItem BreakOnWriteOption { get; private set; }
50 | public ToolStripMenuItem BreakOnReadOption { get; private set; }
51 | public ToolStripMenuItem AddBreakpointOption { get; private set; }
52 |
53 | public AsmWord CurrentWord
54 | {
55 | set
56 | {
57 | if (value == null)
58 | {
59 | BreakOnWriteOption.Enabled = BreakOnReadOption.Enabled = AddToWatchOption.Enabled = GoToDefinitionOption.Enabled = false;
60 | }
61 | else
62 | {
63 | GoToDefinitionOption.Enabled = (value.WordType == AsmWord.AsmWordType.LabelAbsolute || value.WordType == AsmWord.AsmWordType.LabelReference || value.WordType == AsmWord.AsmWordType.Macro || value.WordType == AsmWord.AsmWordType.FileReference);
64 | BreakOnWriteOption.Enabled = BreakOnReadOption.Enabled = (value.WordType == AsmWord.AsmWordType.LabelReference || value.WordType == AsmWord.AsmWordType.LabelDefinition || value.WordType == AsmWord.AsmWordType.NumberByte || value.WordType == AsmWord.AsmWordType.NumberWord);
65 | AddToWatchOption.Enabled = BreakOnWriteOption.Enabled || value.WordType == AsmWord.AsmWordType.AddressReference;
66 | }
67 | AddToWatchOption.Text = AddToWatchOption.Enabled ? string.Format("Add '{0}' To Watch", value.Word) : "Add To Watch";
68 | }
69 | }
70 |
71 |
72 | private void GoToDefinition_Click(object sender, EventArgs e)
73 | {
74 | if (GoToDefinition != null) GoToDefinition();
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/Brewmaster/EditorWindows/Code/CpuAddressMargin.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using Brewmaster.Modules.Watch;
4 | using Brewmaster.ProjectModel;
5 | using ICSharpCode.TextEditor;
6 |
7 | namespace Brewmaster.EditorWindows.Code
8 | {
9 | public class CpuAddressMargin : AbstractMargin
10 | {
11 | private readonly Func _getDebugLine;
12 | private readonly int _addressWidth;
13 |
14 | public CpuAddressMargin(TextArea textArea, Func getDebugLine, int addressWidth) : base(textArea)
15 | {
16 | _getDebugLine = getDebugLine;
17 | _addressWidth = addressWidth;
18 | }
19 |
20 | public override bool IsVisible
21 | {
22 | get
23 | {
24 | if (textArea.MotherTextEditorControl is Ca65Editor editor) return editor.ShowCpuAddresses;
25 | return false;
26 | }
27 | }
28 | public override Size Size
29 | {
30 | get { return new Size(textArea.TextView.WideSpaceWidth * (_addressWidth + 3),
31 | -1); }
32 | }
33 |
34 | public override void Paint(Graphics graphics, Rectangle bounds)
35 | {
36 | var lineAddressColor = textArea.Document.HighlightingStrategy.GetColorFor("CPU Addresses");
37 | graphics.FillRectangle(BrushRegistry.GetBrush(lineAddressColor.BackgroundColor), bounds);
38 |
39 | var font = lineAddressColor.GetFont(TextEditorProperties.FontContainer);
40 | var brush = BrushRegistry.GetBrush(lineAddressColor.Color);
41 |
42 | for (var y = 0; y < (DrawingPosition.Height + textArea.TextView.VisibleLineDrawingRemainder) / textArea.TextView.FontHeight + 1; ++y)
43 | {
44 | var backgroundRectangle = new Rectangle(drawingPosition.X,
45 | 2 + drawingPosition.Y + textArea.TextView.FontHeight * y - textArea.TextView.VisibleLineDrawingRemainder,
46 | drawingPosition.Width + 10,
47 | textArea.TextView.FontHeight);
48 |
49 | if (!bounds.IntersectsWith(backgroundRectangle)) continue;
50 |
51 | var currentLine = textArea.Document.GetFirstLogicalLine(textArea.TextView.FirstPhysicalLine + y);
52 | if (currentLine < textArea.Document.TotalNumberOfLines)
53 | {
54 | var debugLine = _getDebugLine(currentLine);
55 | if (debugLine == null || !debugLine.CpuAddress.HasValue) continue;
56 | graphics.DrawString(WatchValue.FormatHexAddress(debugLine.CpuAddress.Value, _addressWidth), font, brush, backgroundRectangle);
57 | }
58 | }
59 | }
60 | }
61 | }
--------------------------------------------------------------------------------
/Brewmaster/EditorWindows/Code/FileCompletion.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Windows.Forms;
6 | using Brewmaster.Properties;
7 | using ICSharpCode.TextEditor;
8 | using ICSharpCode.TextEditor.Gui.CompletionWindow;
9 |
10 | namespace Brewmaster.EditorWindows.Code
11 | {
12 | public class FileCompletion : CompletionDataProvider
13 | {
14 | public override ImageList ImageList { get; set; }
15 | public override string PreSelection { get; set; }
16 | public override int DefaultIndex { get; set; }
17 | private DirectoryInfo[] _directories;
18 | private readonly Action _reOpen;
19 |
20 | public FileCompletion(DirectoryInfo[] directories, Action reOpen)
21 | {
22 | _directories = directories;
23 | _reOpen = reOpen;
24 | ImageList = new ImageList();
25 | ImageList.Images.Add(Resources.folder);
26 | ImageList.Images.Add(Resources.file);
27 | DefaultIndex = -1;
28 | }
29 |
30 | public override ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
31 | {
32 | var returnValues = new List();
33 | if (!PreSelection.StartsWith("\"")) return returnValues.ToArray();
34 |
35 | var baseDir = "";
36 | var preSelection = PreSelection.Substring(1);
37 | var lastSlash = preSelection.LastIndexOfAny(new[] { '/', '\\' });
38 | if (lastSlash >= 0)
39 | {
40 | baseDir = preSelection.Substring(0, lastSlash + 1);
41 | preSelection = lastSlash < preSelection.Length ? preSelection.Substring(lastSlash + 1) : "";
42 | }
43 |
44 | var searchedDirectories = new List();
45 | foreach (var originalDirectory in _directories)
46 | {
47 | try
48 | {
49 | var directory = new DirectoryInfo(Path.Combine(originalDirectory.FullName, baseDir));
50 |
51 | if (!directory.Exists) continue;
52 | if (searchedDirectories.Contains(directory.FullName)) continue;
53 | searchedDirectories.Add(directory.FullName);
54 | foreach (var subDirectory in directory.GetDirectories().Where(dir => dir.Name.StartsWith(preSelection, StringComparison.InvariantCultureIgnoreCase)))
55 | {
56 | returnValues.Add(new DirectoryData(subDirectory.Name, _reOpen));
57 | }
58 | foreach (var file in directory.GetFiles().Where(file => file.Name.StartsWith(preSelection, StringComparison.InvariantCultureIgnoreCase)))
59 | {
60 | returnValues.Add(new FileData(file.Name));
61 | }
62 | }
63 | catch
64 | {
65 | // Directory is an invalid name, user doesn't have access, etc.
66 | continue;
67 | }
68 |
69 | }
70 |
71 | return returnValues.ToArray();
72 | }
73 |
74 | public override bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key)
75 | {
76 | var preOffset = PreSelection.LastIndexOfAny(new[] {'\\', '/', '"'});
77 | if (preOffset < 0) return false;
78 | textArea.Caret.Position = textArea.Document.OffsetToPosition(insertionOffset);
79 | textArea.InsertString(PreSelection.Substring(0, preOffset + 1));
80 | return data.InsertAction(textArea, key);
81 | }
82 |
83 | public override CompletionDataProviderKeyResult ProcessKey(char key)
84 | {
85 | return CompletionDataProviderKeyResult.NormalKey;
86 | }
87 | }
88 |
89 | public class FileData : ICompletionData
90 | {
91 | public FileData(string name)
92 | {
93 | Text = name;
94 | //Description = opcode.ToString();
95 | }
96 | public virtual bool InsertAction(TextArea textArea, char ch)
97 | {
98 | textArea.InsertString(Text + "\"");
99 | return true;
100 | }
101 |
102 | public virtual int ImageIndex { get { return 1; } }
103 | public string Text { get; set; }
104 | public virtual string Description { get; }
105 | public virtual double Priority { get { return 10; } }
106 | }
107 | public class DirectoryData : FileData
108 | {
109 | private readonly Action _reOpen;
110 | public DirectoryData(string name, Action reOpen) : base(name)
111 | {
112 | _reOpen = reOpen;
113 | }
114 | public override bool InsertAction(TextArea textArea, char ch)
115 | {
116 | textArea.InsertString(Text + "/");
117 | if (_reOpen != null) _reOpen();
118 | return false;
119 | }
120 |
121 | public override int ImageIndex { get { return 0; } }
122 | public override double Priority { get { return 1; } }
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/Brewmaster/EditorWindows/Code/GoToAll.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 | using Brewmaster.EditorWindows.Text;
5 | using Brewmaster.Modules;
6 | using Brewmaster.ProjectModel;
7 |
8 | namespace Brewmaster.EditorWindows.Code
9 | {
10 | public class GoToAll : Form
11 | {
12 | private TextBox _searchQuery;
13 | private CompletionWindow _completionWindow;
14 | private CompletionDataProvider _completionProvider;
15 |
16 | public GoToAll(AsmProject project, Events events)
17 | {
18 | _completionProvider = new AllCompletion(project, events);
19 | var dummyControl = new TextEditor(); // TODO: Create own, improved auto-completion window to remove reliance on texteditor
20 | InitializeComponent();
21 |
22 | _searchQuery.TextChanged += (s, a) =>
23 | {
24 | if (_searchQuery.Text.Length == 0)
25 | {
26 | if (_completionWindow != null) _completionWindow.Close();
27 | _completionWindow = null;
28 | return;
29 | }
30 |
31 | _completionProvider.PreSelection = _searchQuery.Text;
32 | if (_completionWindow != null && !_completionWindow.IsDisposed)
33 | {
34 | _completionWindow.RefreshCompletionData(null, ' ');
35 | return;
36 | }
37 | _completionWindow = CompletionWindow.ShowCompletionWindow(this, dummyControl, _completionProvider, PointToScreen(new Point(_searchQuery.Left, _searchQuery.Bounds.Bottom)));
38 | if (_completionWindow != null) _completionWindow.InsertCompleted += Close;
39 | };
40 | }
41 |
42 | protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
43 | {
44 | if (keyData == Keys.Escape)
45 | {
46 | Close();
47 | return true;
48 | }
49 |
50 | if (_completionWindow != null && _completionWindow.ProcessKey(keyData)) return true;
51 | return base.ProcessCmdKey(ref msg, keyData);
52 | }
53 |
54 | protected override void OnShown(EventArgs e)
55 | {
56 | base.OnShown(e);
57 | _searchQuery.Focus();
58 |
59 | Deactivate += (s, a) =>
60 | {
61 | BeginInvoke(new Action(() =>
62 | {
63 | if (ContainsFocus || (_completionWindow != null && _completionWindow.ContainsFocus)) return;
64 | Close();
65 | }));
66 | };
67 | }
68 |
69 | private void InitializeComponent()
70 | {
71 | System.Windows.Forms.Panel panel;
72 | System.Windows.Forms.Label label;
73 | this._searchQuery = new System.Windows.Forms.TextBox();
74 | panel = new System.Windows.Forms.Panel();
75 | label = new System.Windows.Forms.Label();
76 | panel.SuspendLayout();
77 | this.SuspendLayout();
78 | //
79 | // panel
80 | //
81 | panel.Controls.Add(this._searchQuery);
82 | panel.Controls.Add(label);
83 | panel.Dock = System.Windows.Forms.DockStyle.Fill;
84 | panel.Location = new System.Drawing.Point(0, 0);
85 | panel.Name = "panel";
86 | panel.Size = new System.Drawing.Size(352, 42);
87 | panel.TabIndex = 2;
88 | //
89 | // _searchQuery
90 | //
91 | this._searchQuery.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
92 | | System.Windows.Forms.AnchorStyles.Right)));
93 | this._searchQuery.Location = new System.Drawing.Point(2, 20);
94 | this._searchQuery.Name = "_searchQuery";
95 | this._searchQuery.Size = new System.Drawing.Size(348, 20);
96 | this._searchQuery.TabIndex = 0;
97 | //
98 | // label
99 | //
100 | label.AutoSize = true;
101 | label.Location = new System.Drawing.Point(0, 4);
102 | label.Name = "label";
103 | label.Size = new System.Drawing.Size(102, 13);
104 | label.TabIndex = 1;
105 | label.Text = "Search everywhere:";
106 | //
107 | // GoToAll
108 | //
109 | this.ClientSize = new System.Drawing.Size(352, 42);
110 | this.ControlBox = false;
111 | this.Controls.Add(panel);
112 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
113 | this.Name = "GoToAll";
114 | this.ShowIcon = false;
115 | this.ShowInTaskbar = false;
116 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
117 | panel.ResumeLayout(false);
118 | panel.PerformLayout();
119 | this.ResumeLayout(false);
120 |
121 | }
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/Brewmaster/EditorWindows/Code/SourceNavigator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Windows.Forms;
6 |
7 | namespace Brewmaster.EditorWindows.Code
8 | {
9 | public class SourceNavigator : UserControl
10 | {
11 | public List Symbols { get; set; }
12 | public event Action Navigated;
13 |
14 | public int CurrentLine
15 | {
16 | get { return _currentLine; }
17 | set
18 | {
19 | _currentLine = value;
20 | if (!_suppressEvent) UpdateCurrentSymbol();
21 | }
22 | }
23 |
24 | public void UpdateCurrentSymbol()
25 | {
26 | var currentSymbol = Symbols.LastOrDefault(s => s.Line <= CurrentLine + 1);
27 | if (currentSymbol != null)
28 | {
29 | _suppressEvent = true;
30 | _symbolSelector.SelectedItem = currentSymbol;
31 | _suppressEvent = false;
32 | }
33 | }
34 | private void symbolSelector_SelectedIndexChanged(object sender, System.EventArgs e)
35 | {
36 | if (_suppressEvent || Navigated == null) return;
37 | _suppressEvent = true;
38 | Navigated(_currentLine = ((Symbol) _symbolSelector.SelectedItem).Line);
39 | _suppressEvent = false;
40 | }
41 |
42 | public SourceNavigator()
43 | {
44 | Symbols = new List();
45 | InitializeComponent();
46 | }
47 |
48 | private Panel _bottomBorder;
49 | private Panel _sideBorder;
50 | private ComboBox _symbolSelector;
51 | private int _currentLine;
52 | private bool _suppressEvent;
53 |
54 | private void InitializeComponent()
55 | {
56 | this._symbolSelector = new System.Windows.Forms.ComboBox();
57 | this._bottomBorder = new System.Windows.Forms.Panel();
58 | this._sideBorder = new System.Windows.Forms.Panel();
59 | this.SuspendLayout();
60 | //
61 | // comboBox1
62 | //
63 | this._symbolSelector.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
64 | this._symbolSelector.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
65 | this._symbolSelector.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
66 | this._symbolSelector.FormattingEnabled = true;
67 | this._symbolSelector.ItemHeight = 13;
68 | this._symbolSelector.Location = new System.Drawing.Point(503, 4);
69 | this._symbolSelector.Name = "_symbolSelector";
70 | this._symbolSelector.Size = new System.Drawing.Size(263, 21);
71 | this._symbolSelector.TabIndex = 0;
72 | this._symbolSelector.SelectedIndexChanged += new System.EventHandler(this.symbolSelector_SelectedIndexChanged);
73 | //
74 | // panel1
75 | //
76 | this._bottomBorder.BackColor = System.Drawing.SystemColors.ControlDark;
77 | this._bottomBorder.Dock = System.Windows.Forms.DockStyle.Bottom;
78 | this._bottomBorder.Location = new System.Drawing.Point(0, 29);
79 | this._bottomBorder.Name = "_bottomBorder";
80 | this._bottomBorder.Size = new System.Drawing.Size(771, 1);
81 | this._bottomBorder.TabIndex = 1;
82 | //
83 | // panel2
84 | //
85 | this._sideBorder.BackColor = System.Drawing.SystemColors.ControlDark;
86 | this._sideBorder.Location = new System.Drawing.Point(0, 0);
87 | this._sideBorder.Name = "_sideBorder";
88 | this._sideBorder.Size = new System.Drawing.Size(1, 97);
89 | this._sideBorder.TabIndex = 2;
90 | //
91 | // SourceNavigator
92 | //
93 | this.Controls.Add(this._sideBorder);
94 | this.Controls.Add(this._bottomBorder);
95 | this.Controls.Add(this._symbolSelector);
96 | this.Name = "SourceNavigator";
97 | this.Size = new System.Drawing.Size(771, 30);
98 | this.ResumeLayout(false);
99 |
100 | }
101 |
102 | public void UpdateSymbols(IEnumerable symbols)
103 | {
104 | Symbols = symbols.Where(s => !s.Text.StartsWith("@")).OrderBy(s => s.Line).ToList();
105 | if (Symbols.Count > 0) Symbols.Insert(0, new Symbol { Text = new FileInfo(Symbols[0].Source).Name, Line = 0 });
106 | _symbolSelector.Items.Clear();
107 | _symbolSelector.Items.AddRange(Symbols.ToArray());
108 | UpdateCurrentSymbol();
109 | _symbolSelector.Enabled = Symbols.Count > 0;
110 | }
111 |
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/Brewmaster/EditorWindows/Code/Symbol.cs:
--------------------------------------------------------------------------------
1 |
2 | using System.Collections.Generic;
3 |
4 | namespace Brewmaster.EditorWindows.Code
5 | {
6 | public class Symbol
7 | {
8 | public string Text { get; set; }
9 | public string Source { get; set; }
10 | public string Value { get; set; }
11 | public int Line { get; set; }
12 | public int Character { get; set; }
13 | public bool Public { get; set; }
14 | public string LocalToFile { get; set; }
15 |
16 | public override string ToString()
17 | {
18 | return Text;
19 | }
20 | }
21 | public class MacroSymbol : Symbol
22 | {
23 | public List Parameters { get; set; }
24 | public override string ToString()
25 | {
26 | return string.Format("{0} {1}", Text, string.Join(", ", Parameters));
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Brewmaster/EditorWindows/EditorWindow.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Windows.Forms;
4 | using Brewmaster.Modules;
5 | using Brewmaster.ProjectModel;
6 |
7 | namespace Brewmaster.EditorWindows
8 | {
9 | public class EditorWindow : TabPage
10 | {
11 | protected MainForm MainWindow { get; set; }
12 | public AsmProjectFile ProjectFile { get; protected set; }
13 | public Events ModuleEvents { get; protected set; }
14 |
15 | public EditorWindow(MainForm form, AsmProjectFile file, Events events)
16 | {
17 | MainWindow = form;
18 | ProjectFile = file;
19 | ModuleEvents = events;
20 | Text = ProjectFile.File.Name;
21 | }
22 | }
23 |
24 | public abstract class SaveableEditorWindow : EditorWindow, ISaveable
25 | {
26 | protected SaveableEditorWindow(MainForm form, AsmProjectFile file, Events events) : base(form, file, events) { }
27 | public abstract void Save(Func getNewFileName = null);
28 |
29 | private bool _pristine;
30 | public bool Pristine
31 | {
32 | get { return _pristine; }
33 | protected set
34 | {
35 | var updated = _pristine != value;
36 | _pristine = value;
37 | RefreshTitle();
38 | if (updated && PristineChanged != null) PristineChanged();
39 |
40 | if (!_pristine) ProjectFile.Project.UpdatedSinceLastBuild = true;
41 | }
42 | }
43 | public event Action PristineChanged;
44 | protected void RefreshTitle()
45 | {
46 | Text = WindowTitle + (Pristine ? "" : " *");
47 | }
48 |
49 | protected virtual string WindowTitle
50 | {
51 | get { return ProjectFile.File.Name; }
52 | }
53 | }
54 |
55 | }
--------------------------------------------------------------------------------
/Brewmaster/EditorWindows/ISaveable.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Brewmaster.EditorWindows
5 | {
6 | public interface ISaveable
7 | {
8 | void Save(Func getNewFileName = null);
9 | bool Pristine { get; }
10 | event Action PristineChanged;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Brewmaster/EditorWindows/Text/GoToWindow.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using ICSharpCode.TextEditor;
4 |
5 | namespace Brewmaster.EditorWindows.Text
6 | {
7 | public partial class GoToWindow : Form
8 | {
9 | private int MaxLines
10 | {
11 | get { return Math.Max(_editor.TextEditor.Document.TotalNumberOfLines, 1); }
12 | }
13 | private readonly TextEditorWindow _editor;
14 |
15 | public GoToWindow(Func getTargetEditor)
16 | {
17 | InitializeComponent();
18 | _editor = getTargetEditor();
19 | GoToLabel.Text = string.Format("Go to line (1 - {0}):", MaxLines);
20 | }
21 |
22 | private void GoToLine_TextChanged(object sender, EventArgs e)
23 | {
24 | GoToButton.Enabled = int.TryParse(GoToLineTextBox.Text, out var line) && line <= MaxLines && line > 0;
25 | }
26 |
27 | private void GoToButton_Click(object sender, EventArgs e)
28 | {
29 | if (!int.TryParse(GoToLineTextBox.Text, out var line)) return;
30 | _editor.TextEditor.FocusLine(line, false);
31 | Close();
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Brewmaster/EditorWindows/Text/TextEditor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Linq;
5 | using System.Windows.Forms;
6 | using Brewmaster.EditorWindows.Code;
7 | using Brewmaster.Settings;
8 | using ICSharpCode.TextEditor;
9 | using ICSharpCode.TextEditor.Actions;
10 | using ICSharpCode.TextEditor.Document;
11 |
12 | namespace Brewmaster.EditorWindows.Text
13 | {
14 | public class TextEditor : TextEditorControl
15 | {
16 | public TextEditor()
17 | {
18 | Text = "";
19 | TextEditorProperties = DefaultCodeProperties;
20 |
21 | FeatureActions.Add(Feature.Undo, editactions[Keys.Control | Keys.Z]);
22 | FeatureActions.Add(Feature.Redo, editactions[Keys.Control | Keys.Y]);
23 | FeatureActions.Add(Feature.Cut, editactions[Keys.Control | Keys.X]);
24 | FeatureActions.Add(Feature.Copy, editactions[Keys.Control | Keys.C]);
25 | FeatureActions.Add(Feature.Paste, editactions[Keys.Control | Keys.V]);
26 | FeatureActions.Add(Feature.SelectAll, editactions[Keys.Control | Keys.A]);
27 |
28 | foreach (var feature in FeatureActions)
29 | {
30 | Program.BindKey(feature.Key, UpdateKeyBinding);
31 | }
32 | }
33 |
34 | protected void UpdateKeyBinding(KeyBindingEventArgs args)
35 | {
36 | var action = FeatureActions[args.Feature];
37 | var existingAction = editactions.FirstOrDefault(kvp => kvp.Value == action);
38 | if (existingAction.Value == action) editactions.Remove(existingAction.Key);
39 | if (!editactions.ContainsKey(args.Keys)) editactions.Add(args.Keys, action);
40 | }
41 |
42 | protected override void Dispose(bool disposing)
43 | {
44 | foreach (var feature in FeatureActions)
45 | {
46 | Program.UnbindKey(feature.Key, UpdateKeyBinding);
47 | }
48 | base.Dispose(disposing);
49 | }
50 |
51 | protected Dictionary FeatureActions = new Dictionary();
52 |
53 | public static ITextEditorProperties DefaultCodeProperties = new DefaultBrewmasterCodeProperties();
54 |
55 | public void GoToWordAt(int line, int column, int? length)
56 | {
57 | var lineSegment = Document.GetLineSegment(line - 1);
58 | if (!length.HasValue)
59 | {
60 | var word = lineSegment.GetWord(column);
61 | if (word == null) throw new Exception("Word not fount at Line " + line + ", column " + column);
62 | length = word.Length;
63 | }
64 | if (length > 0) ActiveTextAreaControl.SelectionManager.SetSelection(new TextLocation(column, line - 1), new TextLocation(column + length.Value, line - 1));
65 | ActiveTextAreaControl.Caret.Position = new TextLocation(column, line - 1);
66 | }
67 |
68 | public void FocusLine(int line, bool isBuildLine)
69 | {
70 | line -= 1;
71 | if (isBuildLine)
72 | {
73 | var buildLine = Document.BookmarkManager.Marks.OfType().FirstOrDefault(m => m.BuildLine == line);
74 | if (buildLine == null) return;
75 | line = buildLine.LineNumber;
76 | }
77 | ActiveTextAreaControl.TextArea.ScrollTo(line);
78 | ActiveTextAreaControl.Caret.Position = new TextLocation(0, line);
79 | }
80 |
81 | public virtual void Cut(object sender, EventArgs eventArgs)
82 | {
83 | ActiveTextAreaControl.TextArea.ClipboardHandler.Cut(sender, eventArgs);
84 | }
85 | public virtual void Paste(object sender, EventArgs eventArgs)
86 | {
87 | ActiveTextAreaControl.TextArea.ClipboardHandler.Paste(sender, eventArgs);
88 | }
89 | public virtual void Delete(object sender, EventArgs eventArgs)
90 | {
91 | ActiveTextAreaControl.TextArea.ClipboardHandler.Delete(sender, eventArgs);
92 | }
93 | public virtual void Copy(object sender, EventArgs eventArgs)
94 | {
95 | ActiveTextAreaControl.TextArea.ClipboardHandler.Copy(sender, eventArgs);
96 | }
97 | public virtual void SelectAll(object sender, EventArgs eventArgs)
98 | {
99 | ActiveTextAreaControl.TextArea.ClipboardHandler.SelectAll(sender, eventArgs);
100 | }
101 | }
102 |
103 | public class DefaultBrewmasterCodeProperties : DefaultTextEditorProperties
104 | {
105 | public DefaultBrewmasterCodeProperties()
106 | {
107 | IsIconBarVisible = true;
108 | Font = new Font("Courier New", 10, GraphicsUnit.Point);
109 | VerticalRulerRow = 0;
110 | EnableFolding = false;
111 | ShowLineNumbers = true;
112 | CutCopyWholeLine = false;
113 | }
114 | }
115 | }
--------------------------------------------------------------------------------
/Brewmaster/EditorWindows/Text/TextEditorMenu.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 | using Brewmaster.Modules;
3 |
4 | namespace Brewmaster.EditorWindows.Text
5 | {
6 | public class TextEditorMenu : ContextMenuStrip
7 | {
8 | private readonly ToolStripMenuItem _cutMenuItem;
9 | private readonly ToolStripMenuItem _copyMenuItem;
10 | private readonly ToolStripMenuItem _pasteMenuItem;
11 | private readonly ToolStripMenuItem _deleteMenuItem;
12 | private readonly ToolStripMenuItem _selectAllMenuItem;
13 |
14 | public TextEditorMenu(Events events)
15 | {
16 | _cutMenuItem = new ToolStripMenuItem("Cut", Properties.Resources.cut1, (s, a) => events.Cut());
17 | _copyMenuItem = new ToolStripMenuItem("Copy", Properties.Resources.copy1, (s, a) => events.Copy());
18 | _pasteMenuItem = new ToolStripMenuItem("Paste", Properties.Resources.paste1, (s, a) => events.Paste());
19 |
20 | _deleteMenuItem = new ToolStripMenuItem("Delete", null, (s, a) => events.Delete());
21 | _selectAllMenuItem = new ToolStripMenuItem("Select All", null, (s, a) => events.SelectAll());
22 |
23 | InitializeComponent();
24 | }
25 |
26 |
27 | protected virtual void InitializeComponent()
28 | {
29 | Items.AddRange(new ToolStripItem[]
30 | {
31 | _cutMenuItem,
32 | _copyMenuItem,
33 | _pasteMenuItem,
34 | new ToolStripSeparator(),
35 | _deleteMenuItem,
36 | _selectAllMenuItem
37 | });
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/Brewmaster/Emulation/EmulatorHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 |
4 | namespace Brewmaster.Emulation
5 | {
6 | public abstract class EmulatorHandler
7 | {
8 | public event Action OnFpsUpdate;
9 | public int UpdateRate { get; set; }
10 |
11 | public abstract bool IsRunning();
12 |
13 | private int _updateCounter;
14 |
15 | private byte _frameCount = 0;
16 | private Timer _timer;
17 | protected virtual void GameLoaded()
18 | {
19 | if (_timer != null) _timer.Dispose();
20 | _timer = new Timer(SampleFrameRate, null, TimeSpan.Zero, TimeSpan.FromSeconds(1));
21 | }
22 |
23 | private void SampleFrameRate(object state)
24 | {
25 |
26 | if (IsRunning() && OnFpsUpdate != null) OnFpsUpdate(_frameCount);
27 | _frameCount = 0;
28 | }
29 |
30 | protected virtual void CountFrame()
31 | {
32 | _frameCount++;
33 |
34 | if (UpdateRate == 0) return;
35 | _updateCounter++;
36 | if (_updateCounter < UpdateRate) return;
37 | EmitDebugData();
38 | _updateCounter = 0;
39 | }
40 |
41 | protected abstract void EmitDebugData();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Brewmaster/Emulation/MesenRenderer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Forms;
8 | using Brewmaster.ProjectModel;
9 | using Brewmaster.Settings;
10 |
11 | namespace Brewmaster.Emulation
12 | {
13 | public class MesenRenderer : UserControl
14 | {
15 | ///
16 | /// Required designer variable.
17 | ///
18 | private System.ComponentModel.IContainer components = null;
19 |
20 | ///
21 | /// Clean up any resources being used.
22 | ///
23 | /// true if managed resources should be disposed; otherwise, false.
24 | protected override void Dispose(bool disposing)
25 | {
26 | if (disposing && (components != null))
27 | {
28 | components.Dispose();
29 | }
30 | base.Dispose(disposing);
31 | }
32 |
33 | #region Component Designer generated code
34 |
35 | public MesenRenderer()
36 | {
37 | InitializeComponent();
38 |
39 | _renderSurfaces = new Dictionary();
40 |
41 | SizeChanged += (obj, args) =>
42 | {
43 | ResizeSurface();
44 | };
45 | }
46 |
47 | ///
48 | /// Required method for Designer support - do not modify
49 | /// the contents of this method with the code editor.
50 | ///
51 | private void InitializeComponent()
52 | {
53 | this.SuspendLayout();
54 | //
55 | // MesenRenderer
56 | //
57 | this.AutoScaleDimensions = new System.Drawing.SizeF(256F, 240F);
58 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
59 | this.Name = "MesenRenderer";
60 | this.BackColor = Color.Black;
61 | this.ResumeLayout(false);
62 |
63 | }
64 | #endregion
65 |
66 | public Func ScaleChanged { get; set; }
67 | public bool IntegerScaling { get; set; }
68 |
69 | private UserControl _currentRenderSurface;
70 | private readonly Dictionary _renderSurfaces;
71 |
72 | public void ResizeSurface()
73 | {
74 | if (_currentRenderSurface == null) return;
75 | var t = Math.Min((double)Width / 256, (double)Height / 240);
76 | if (IntegerScaling) t = Math.Max(1, Math.Floor(t));
77 | var targetWidth = (int)(256 * t);
78 | var targetHeight = (int)(240 * t);
79 | //renderSurface.SizeChanged
80 |
81 | if (ScaleChanged == null || !ScaleChanged(t)) _currentRenderSurface.Size = new Size(targetWidth, targetHeight);
82 | _currentRenderSurface.Location = new Point((Size.Width - _currentRenderSurface.Size.Width) / 2, (Size.Height - _currentRenderSurface.Size.Height) / 2);
83 |
84 | }
85 |
86 | public Control GetRenderSurface(ProjectType projectType)
87 | {
88 | if (!_renderSurfaces.ContainsKey(projectType))
89 | {
90 | var renderSurface = new UserControl();
91 | renderSurface.Dock = DockStyle.None;
92 | renderSurface.Location = new Point(0, 0);
93 | renderSurface.TabIndex = 1;
94 | _renderSurfaces.Add(projectType, renderSurface);
95 | }
96 | return _renderSurfaces[projectType];
97 | }
98 |
99 | public void SwitchRenderSurface(ProjectType projectType)
100 | {
101 | if (_currentRenderSurface != null) Controls.Remove(_currentRenderSurface);
102 | _currentRenderSurface = _renderSurfaces[projectType];
103 | Controls.Add(_currentRenderSurface);
104 | ResizeSurface();
105 | }
106 | }
107 |
108 | }
--------------------------------------------------------------------------------
/Brewmaster/Emulation/SmallTrackBar.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Forms;
8 | using System.Windows.Forms.VisualStyles;
9 |
10 | namespace Brewmaster.Emulation
11 | {
12 | public class SmallTrackBar : TrackBar
13 | {
14 | public SmallTrackBar()
15 | {
16 | SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint, true);
17 | //SetStyle(ControlStyles.UserPaint, true);
18 | }
19 |
20 | private int _oldValue;
21 | public new event Action ValueChanged;
22 | protected override void OnPaint(PaintEventArgs e)
23 | {
24 | if (_oldValue != Value)
25 | {
26 | _oldValue = Value;
27 | if (ValueChanged != null) ValueChanged();
28 | }
29 |
30 | base.OnPaint(e);
31 |
32 | var trackBarWidth = Width - 16;
33 | var thumbWidth = 7;
34 | //TrackBarRenderer.DrawBottomPointingThumb(e.Graphics, e.ClipRectangle, TrackBarThumbState.Normal);
35 | //base.OnPaint(e);
36 | var position = Maximum == 0 ? 0 : (int)Math.Floor(((Value - Minimum) / (double)Maximum) * (double) (trackBarWidth - thumbWidth));
37 | TrackBarRenderer.DrawHorizontalTrack(e.Graphics, new Rectangle(8, 6, trackBarWidth, 3));
38 | TrackBarRenderer.DrawHorizontalThumb(e.Graphics, new Rectangle(8 + position, 2, thumbWidth, 12), TrackBarThumbState.Normal);
39 | }
40 |
41 | protected override void OnScroll(EventArgs e)
42 | {
43 | base.OnScroll(e);
44 | }
45 |
46 | protected override void OnMouseMove(MouseEventArgs e)
47 | {
48 | base.OnMouseMove(e);
49 | }
50 |
51 | protected override void OnValueChanged(EventArgs e)
52 | {
53 | base.OnValueChanged(e);
54 | }
55 |
56 | protected override void OnInvalidated(InvalidateEventArgs e)
57 | {
58 | base.OnInvalidated(e);
59 | }
60 |
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/Brewmaster/GnuWin32/bin/libiconv2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/GnuWin32/bin/libiconv2.dll
--------------------------------------------------------------------------------
/Brewmaster/GnuWin32/bin/libintl3.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/GnuWin32/bin/libintl3.dll
--------------------------------------------------------------------------------
/Brewmaster/GnuWin32/bin/make.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/GnuWin32/bin/make.exe
--------------------------------------------------------------------------------
/Brewmaster/Layout/FloatPanel.Designer.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace Brewmaster.Layout
4 | {
5 | partial class FloatPanel
6 | {
7 | private System.ComponentModel.IContainer components = null;
8 |
9 | protected override void Dispose(bool disposing)
10 | {
11 | if (disposing && (components != null))
12 | {
13 | components.Dispose();
14 | }
15 | base.Dispose(disposing);
16 | }
17 |
18 | #region Windows Form Designer generated code
19 |
20 | ///
21 | /// Required method for Designer support - do not modify
22 | /// the contents of this method with the code editor.
23 | ///
24 | private void InitializeComponent()
25 | {
26 | this.SuspendLayout();
27 | //
28 | // FloatPanel
29 | //
30 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
31 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
32 | this.ClientSize = new System.Drawing.Size(308, 246);
33 | this.ControlBox = false;
34 | this.MaximizeBox = false;
35 | this.MinimizeBox = false;
36 | this.Name = "FloatPanel";
37 | this.ShowIcon = false;
38 | this.ShowInTaskbar = false;
39 | this.FormBorderStyle = FormBorderStyle.SizableToolWindow;
40 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
41 | this.Load += new System.EventHandler(this.FloatPanel_Load);
42 | this.ResumeLayout(false);
43 |
44 | }
45 |
46 | #endregion
47 |
48 |
49 |
50 |
51 | }
52 | }
--------------------------------------------------------------------------------
/Brewmaster/Layout/FloatPanel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Drawing;
4 | using System.Linq;
5 | using System.Windows.Forms;
6 |
7 | namespace Brewmaster.Layout
8 | {
9 | public partial class FloatPanel : Form, IIdeLayoutParent
10 | {
11 | public LayoutHandler LayoutHandler { get; set; }
12 |
13 | public FloatPanel(LayoutHandler layoutHandler)
14 | {
15 | LayoutHandler = layoutHandler;
16 | InitializeComponent();
17 | }
18 |
19 |
20 | private HeaderPanel _header;
21 | protected override void OnControlAdded(ControlEventArgs e)
22 | {
23 | base.OnControlAdded(e);
24 |
25 | var idePanel = Controls.OfType().FirstOrDefault();
26 | if (idePanel != null)
27 | {
28 | _header = idePanel.Header;
29 | _header.MouseDownHandler = AscendMouseEvent;
30 | }
31 | }
32 |
33 | private void AscendMouseEvent(object sender, MouseEventArgs e)
34 | {
35 | OnMouseDown(e);
36 | }
37 |
38 | protected override void OnClosing(CancelEventArgs e)
39 | {
40 | if (_header != null) _header.MouseDownHandler = null;
41 | base.OnClosing(e);
42 | }
43 |
44 | private void FloatPanel_Load(object sender, EventArgs e)
45 | {
46 |
47 | }
48 |
49 |
50 | public const int WM_NCLBUTTONDOWN = 0xA1;
51 | public const int HT_CAPTION = 0x2;
52 | [System.Runtime.InteropServices.DllImportAttribute("user32.dll")]
53 | public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
54 | [System.Runtime.InteropServices.DllImportAttribute("user32.dll")]
55 | public static extern bool ReleaseCapture();
56 |
57 | private bool _dragging = false;
58 | protected override void OnMouseDown(MouseEventArgs e)
59 | {
60 | base.OnMouseDown(e);
61 | if (e.Button == MouseButtons.Left)
62 | {
63 | _dragging = true;
64 | ReleaseCapture();
65 | SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
66 | }
67 | }
68 |
69 | protected override void OnResizeEnd(EventArgs e)
70 | {
71 | base.OnResizeEnd(e);
72 | if (_dragging) LayoutHandler.DockPanel(this);
73 | TopMost = false;
74 | _dragging = false;
75 | }
76 |
77 | protected override void OnMove(EventArgs e)
78 | {
79 | base.OnMove(e);
80 | var cursorPosition = new Point(Cursor.Position.X - Owner.Left, Cursor.Position.Y - Owner.Top);
81 | //System.Diagnostics.Debug.Write(cursorPosition.X + "," + cursorPosition.Y + Environment.NewLine);
82 |
83 | TopMost = true;
84 | if (_dragging) LayoutHandler.SuggestDock(cursorPosition, this);
85 | }
86 |
87 | public void SetChildPanel(IdePanel panel)
88 | {
89 | if (Controls.Count >= 0) Controls.Clear();
90 | panel.Dock = DockStyle.Fill;
91 | Controls.Add(panel);
92 | }
93 | public IdePanel ChildPanel { get { return Controls[0] as IdePanel; } }
94 | }
95 | public interface IIdeLayoutParent
96 | {
97 | LayoutHandler LayoutHandler { get; }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/Brewmaster/Layout/Overlay.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 |
5 | namespace Brewmaster.Layout
6 | {
7 | public class Overlay : Form
8 | {
9 | public Rectangle Rectangle
10 | {
11 | get { return Bounds; }
12 | set { Bounds = value; }
13 | }
14 |
15 | public Overlay(Form parent)
16 | {
17 |
18 | FormBorderStyle = FormBorderStyle.None;
19 | //BackColor = Color.Magenta;
20 | //TransparencyKey = Color.Magenta;
21 | ShowInTaskbar = false;
22 | StartPosition = FormStartPosition.Manual;
23 | //Size = parent.ClientSize;
24 | //DoubleBuffered = true;
25 |
26 | //var panel = new Panel();
27 | //panel.BackColor = Color.FromArgb(25, Color.CadetBlue);
28 | //panel.Dock = DockStyle.Fill;
29 | //Controls.Add(panel);
30 | }
31 |
32 | protected override void OnLoad(EventArgs e)
33 | {
34 | base.OnLoad(e);
35 | //BackColor = Color.Magenta;
36 | //TransparencyKey = Color.Magenta;
37 | BackColor = SystemColors.HotTrack; // Color.CadetBlue;
38 | Opacity = 0.5;
39 | }
40 |
41 | protected override void OnPaint(PaintEventArgs e)
42 | {
43 | return;
44 | //e.Graphics.DrawLine(Pens.Yellow, 0, 0, 100, 100);
45 | var rectangle = Bounds;
46 | rectangle.Location = new Point(0, 0);
47 | rectangle.Inflate(-1, -1);
48 | var rectangle2 = rectangle;
49 | rectangle2.Inflate(-6, -6);
50 |
51 | using (var brush = new SolidBrush(Color.CadetBlue))
52 | {
53 | //e.Graphics.DrawRectangle(new Pen(Color.CadetBlue, 2), rectangle);
54 | //e.Graphics.DrawRectangle(new Pen(Color.CadetBlue, 2), rectangle);
55 | //e.Graphics.DrawRectangle(new Pen(Color.CadetBlue, 2), rectangle2);
56 | }
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Brewmaster/Layout/Prompt.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 |
4 | namespace Brewmaster.Layout
5 | {
6 | public static class Prompt
7 | {
8 | public static bool ShowDialog(string text, string caption)
9 | {
10 | using (var prompt = new Form
11 | {
12 | FormBorderStyle = FormBorderStyle.FixedDialog,
13 | Text = caption,
14 | StartPosition = FormStartPosition.CenterScreen,
15 | ShowInTaskbar = false,
16 | AutoSize = true,
17 | AutoSizeMode = AutoSizeMode.GrowOnly,
18 | Height = 10,
19 | Width = 340
20 | }) {
21 | var textLabel = new Label
22 | {
23 | Padding = new Padding(10),
24 | Dock = DockStyle.Top,
25 | Text = text,
26 | AutoSize = true,
27 | MaximumSize = new Size(300, 600),
28 | MinimumSize = new Size(300, 10)
29 | };
30 | var confirmation = new Button
31 | {
32 | Text = "Yes",
33 | Dock = DockStyle.Right,
34 | DialogResult = DialogResult.Yes
35 | };
36 | var rejection = new Button
37 | {
38 | Text = "No",
39 | Dock = DockStyle.Right,
40 | DialogResult = DialogResult.No
41 | };
42 | var buttonContainer = new ContainerControl
43 | {
44 | Dock = DockStyle.Top,
45 | Height = confirmation.Height + 10,
46 | Padding = new Padding(10, 0, 10, 10)
47 | };
48 | confirmation.Click += (sender, e) => { prompt.Close(); };
49 | rejection.Click += (sender, e) => { prompt.Close(); };
50 |
51 | buttonContainer.Controls.Add(confirmation);
52 | buttonContainer.Controls.Add(rejection);
53 | prompt.Controls.Add(buttonContainer);
54 | prompt.Controls.Add(textLabel);
55 |
56 | return prompt.ShowDialog() == DialogResult.Yes;
57 | }
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/Brewmaster/LoadWindow.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Brewmaster
2 | {
3 | // TODO: Find something better to do with this
4 | partial class LoadWindow
5 | {
6 | ///
7 | /// Required designer variable.
8 | ///
9 | private System.ComponentModel.IContainer components = null;
10 |
11 | ///
12 | /// Clean up any resources being used.
13 | ///
14 | /// true if managed resources should be disposed; otherwise, false.
15 | protected override void Dispose(bool disposing)
16 | {
17 | if (disposing && (components != null))
18 | {
19 | components.Dispose();
20 | }
21 | base.Dispose(disposing);
22 | }
23 |
24 | #region Windows Form Designer generated code
25 |
26 | ///
27 | /// Required method for Designer support - do not modify
28 | /// the contents of this method with the code editor.
29 | ///
30 | private void InitializeComponent()
31 | {
32 | System.Windows.Forms.Label label1;
33 | label1 = new System.Windows.Forms.Label();
34 | this.SuspendLayout();
35 | //
36 | // label1
37 | //
38 | label1.AutoSize = true;
39 | label1.Location = new System.Drawing.Point(12, 9);
40 | label1.Name = "label1";
41 | label1.Size = new System.Drawing.Size(89, 13);
42 | label1.TabIndex = 0;
43 | label1.Text = "Loading project...";
44 | //
45 | // LoadWindow
46 | //
47 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
48 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
49 | this.ClientSize = new System.Drawing.Size(202, 31);
50 | this.ControlBox = false;
51 | this.Controls.Add(label1);
52 | this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
53 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
54 | this.Name = "LoadWindow";
55 | this.ShowIcon = false;
56 | this.ShowInTaskbar = false;
57 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
58 | this.ResumeLayout(false);
59 | this.PerformLayout();
60 |
61 | }
62 |
63 | #endregion
64 |
65 |
66 |
67 |
68 | }
69 | }
--------------------------------------------------------------------------------
/Brewmaster/LoadWindow.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace Brewmaster
4 | {
5 | public partial class LoadWindow : Form
6 | {
7 | public LoadWindow()
8 | {
9 | InitializeComponent();
10 | }
11 | public void ShowImmediately(IWin32Window owner) { Show(owner); Refresh(); }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Brewmaster/MemoryViewer/MemoryTabs.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace Brewmaster.MemoryViewer
4 | {
5 | public class MemoryTabs : TabControl
6 | {
7 | public MemoryTabs(Modules.Events events)
8 | {
9 | CpuMemoryTab = new TabPage("CPU");
10 | PpuMemoryTab = new TabPage("PPU");
11 | OamMemoryTab = new TabPage("OAM");
12 |
13 | CpuMemoryTab.Controls.Add(Cpu = new MemoryViewer { Dock = DockStyle.Fill });
14 | PpuMemoryTab.Controls.Add(Ppu = new MemoryViewer { Dock = DockStyle.Fill });
15 | OamMemoryTab.Controls.Add(Oam = new MemoryViewer { Dock = DockStyle.Fill });
16 |
17 | Alignment = TabAlignment.Bottom;
18 | Controls.AddRange(new Control[] { CpuMemoryTab, PpuMemoryTab, OamMemoryTab });
19 |
20 | events.EmulationStateUpdate += (state) =>
21 | {
22 | Cpu.SetData(state.Memory.CpuData);
23 | Ppu.SetData(state.Memory.PpuData);
24 | Oam.SetData(state.Memory.OamData);
25 | };
26 | }
27 |
28 | public MemoryViewer Cpu { get; set; }
29 | public MemoryViewer Ppu { get; set; }
30 | public MemoryViewer Oam { get; set; }
31 |
32 | public TabPage OamMemoryTab { get; set; }
33 | public TabPage PpuMemoryTab { get; set; }
34 | public TabPage CpuMemoryTab { get; set; }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/Build/ErrorList.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Linq;
5 | using System.Windows.Forms;
6 | using Brewmaster.BuildProcess;
7 | using Brewmaster.Layout;
8 |
9 | namespace Brewmaster.Modules.Build
10 | {
11 | public class ErrorList : ListView
12 | {
13 | // TODO: Tool tips?
14 |
15 | private ImageList errorIcons;
16 | private System.ComponentModel.IContainer components;
17 |
18 | public Action GoTo { get; set; }
19 |
20 | public ErrorList()
21 | {
22 | InitializeComponent();
23 | OwnerDraw = true;
24 | ShowGroups = false;
25 | Activation = ItemActivation.Standard;
26 | FullRowSelect = true;
27 | GridLines = true;
28 | View = View.Details;
29 | BorderStyle = BorderStyle.None;
30 | Columns.AddRange(new[]
31 | {
32 | new ColumnHeader {Text = "", Width = 25},
33 | new ColumnHeader {Text = "Details"},
34 | new ColumnHeader {Text = "File", Width = 40},
35 | new ColumnHeader {Text = "Line", Width = 25}
36 | });
37 | }
38 |
39 | protected override void OnResize(EventArgs e)
40 | {
41 | base.OnResize(e);
42 | Columns[0].Width = 25;
43 | Columns[2].Width = 60;
44 | Columns[3].Width = 40;
45 | Columns[1].Width = Width - 120;
46 | }
47 |
48 | protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
49 | {
50 | if (SelectedItems.Count > 0 && keyData == (Keys.Control | Keys.C))
51 | {
52 | Clipboard.SetText(SelectedItems[0].SubItems[1].Text);
53 | return true;
54 | }
55 | return base.ProcessCmdKey(ref msg, keyData);
56 | }
57 |
58 | protected override void OnDrawColumnHeader(DrawListViewColumnHeaderEventArgs e)
59 | {
60 | base.OnDrawColumnHeader(e);
61 | e.DrawDefault = true;
62 | }
63 | protected override void OnDrawSubItem(DrawListViewSubItemEventArgs e)
64 | {
65 | base.OnDrawSubItem(e);
66 | if (e.ColumnIndex > 0)
67 | {
68 | e.DrawDefault = true;
69 | return;
70 | }
71 |
72 | var errorItem = e.Item as ErrorListItem;
73 | if (errorItem == null) return;
74 | e.Graphics.DrawImageUnscaled(errorIcons.Images[errorItem.Error.Type == BuildHandler.BuildError.BuildErrorType.Error ? 0 : 1], new Point(e.Bounds.X + 3, e.Bounds.Y));
75 | }
76 |
77 | public void RefreshList(List list)
78 | {
79 | BeginUpdate();
80 | Items.Clear();
81 | foreach (var error in list.OrderBy(l => l.Type != BuildHandler.BuildError.BuildErrorType.Error))
82 | {
83 | Items.Add(new ErrorListItem(error));
84 | }
85 | this.UpdateLabel(list.Count == 0 ? "Build Errors" : string.Format("Build Errors ({0})", list.Count));
86 | EndUpdate();
87 | }
88 |
89 | protected override void OnItemActivate(EventArgs e)
90 | {
91 | base.OnItemActivate(e);
92 | var errorItem = SelectedItems[0] as ErrorListItem;
93 | if (GoTo == null || errorItem == null || errorItem.Error.File == null) return;
94 |
95 | GoTo(errorItem.Error.File, errorItem.Error.Line);
96 | }
97 |
98 | private void InitializeComponent()
99 | {
100 | this.components = new System.ComponentModel.Container();
101 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ErrorList));
102 | this.errorIcons = new System.Windows.Forms.ImageList(this.components);
103 | this.SuspendLayout();
104 | //
105 | // errorIcons
106 | //
107 | this.errorIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("errorIcons.ImageStream")));
108 | this.errorIcons.TransparentColor = System.Drawing.Color.Transparent;
109 | this.errorIcons.Images.SetKeyName(0, "error.png");
110 | this.errorIcons.Images.SetKeyName(1, "warning.png");
111 | this.ResumeLayout(false);
112 |
113 | }
114 | }
115 |
116 | public class ErrorListItem : ListViewItem
117 | {
118 | public BuildHandler.BuildError Error { get; }
119 |
120 | public ErrorListItem(BuildHandler.BuildError error)
121 | :base(error.Type == BuildHandler.BuildError.BuildErrorType.Error ? "!" : "")
122 | {
123 | Error = error;
124 | SubItems.Add(error.Message);
125 | SubItems.Add(error.File);
126 | SubItems.Add(string.IsNullOrWhiteSpace(error.File) ? "" : error.Line.ToString());
127 | }
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/Build/LogData.cs:
--------------------------------------------------------------------------------
1 | using Brewmaster.BuildProcess;
2 |
3 | namespace Brewmaster.Modules.Build
4 | {
5 | public enum LogType
6 | {
7 | Normal, Error, Headline, Warning
8 | }
9 | public class LogData
10 | {
11 | public string Text { get; set; }
12 | public LogType Type { get; set; }
13 | public IFileLocation Location { get; set; }
14 |
15 | public LogData(string text, LogType type = LogType.Normal, IFileLocation fileLocation = null)
16 | {
17 | Text = text;
18 | Type = type;
19 | Location = fileLocation;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/Ca65Helper/Ca65DocParser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text.RegularExpressions;
5 | using Brewmaster.Properties;
6 | using HtmlAgilityPack;
7 |
8 | namespace Brewmaster.Modules.Ca65Helper
9 | {
10 | public class Ca65Command
11 | {
12 | public List Aliases = new List();
13 | public List SeeAlso = new List();
14 | public List Description = new List();
15 |
16 | public override string ToString()
17 | {
18 | return string.Join(Environment.NewLine, Description.Select(d => d.Text));
19 | }
20 | }
21 | public class Ca65CommandDescription
22 | {
23 | public string Text;
24 | public bool CodeExample;
25 | }
26 |
27 | public class Ca65Parser
28 | {
29 | private static Dictionary _list;
30 |
31 | private static Regex _cleanText = new Regex(@"\s+");
32 | public static Dictionary GetCommands()
33 | {
34 | if (_list != null) return _list;
35 |
36 | _list = new Dictionary();
37 | var html = new HtmlDocument();
38 | html.LoadHtml(Resources.ca65);
39 | var header = html.DocumentNode.SelectSingleNode("//a[@name='pseudo-variables']").ParentNode;
40 | var lastHeader = html.DocumentNode.SelectSingleNode("//a[@name='macros']").ParentNode;
41 |
42 | while ((header = header.SelectSingleNode("./following-sibling::h2")) != lastHeader)
43 | {
44 | var commandHeader = header.SelectSingleNode(".//code");
45 | if (commandHeader == null) continue;
46 | var ca65Command = new Ca65Command();
47 | var commands = commandHeader.InnerText.Trim().Split(new[] {", "}, StringSplitOptions.RemoveEmptyEntries);
48 | foreach (var command in commands.Where(c => c.StartsWith(".")))
49 | {
50 | ca65Command.Aliases.Add(command);
51 | _list[command] = ca65Command;
52 | }
53 |
54 | if (ca65Command.Aliases.Count == 0) continue;
55 |
56 | var descriptionNode = header;
57 | while ((descriptionNode = descriptionNode.SelectSingleNode("./following-sibling::*")).Name != "h2")
58 | {
59 | var text = _cleanText.Replace(descriptionNode.InnerText, " ").Trim();
60 | if (string.IsNullOrWhiteSpace(text)) continue;
61 |
62 | if (text.StartsWith("See also") || text.StartsWith("See:"))
63 | {
64 | foreach (var referenceNode in descriptionNode.SelectNodes(".//a"))
65 | {
66 | if (referenceNode.InnerText.Trim().StartsWith(".")) ca65Command.SeeAlso.Add(referenceNode.InnerText.Trim());
67 | }
68 | continue;
69 | }
70 |
71 | var isCode = descriptionNode.Name == "blockquote";
72 | ca65Command.Description.Add(new Ca65CommandDescription
73 | {
74 | Text = isCode ? descriptionNode.SelectSingleNode(".//pre").InnerText : text,
75 | CodeExample = isCode
76 | });
77 | }
78 | }
79 |
80 | return _list;
81 | }
82 |
83 | public static Ca65Command GetCommandFromWord(string word)
84 | {
85 | var knownCommands = GetCommands();
86 | if (knownCommands.ContainsKey(word.ToUpper())) return knownCommands[word.ToUpper()];
87 | else return null;
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/Events.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Brewmaster.EditorWindows.Text;
4 | using Brewmaster.Emulation;
5 | using Brewmaster.Modules.Ca65Helper;
6 | using Brewmaster.Modules.OpcodeHelper;
7 | using Brewmaster.ProjectModel;
8 |
9 | namespace Brewmaster.Modules
10 | {
11 | // TODO: More organized handling of global events (breakpoints, watch values, status, etc)
12 | public class Events
13 | {
14 | public Action Cut;
15 | public Action Copy;
16 | public Action Paste;
17 | public Action Delete;
18 | public Action SelectAll;
19 |
20 | public Action> RemoveBreakpoints;
21 | public Action AddBreakpoint;
22 | public Action UpdatedBreakpoints;
23 | public Func GetCurrentProject;
24 | public Func GetCurrentTextEditor;
25 | public Action OpenFileAction { private get; set; }
26 |
27 | public event Action EmulationStateUpdate;
28 | public int SelectedSprite { get; private set; } = -1;
29 | public ProjectType ProjectType { get; private set; } = ProjectType.Nes;
30 |
31 | public event Action SelectedSpriteChanged;
32 | public event Action ProjectTypeChanged;
33 | public event Action HighlightedOpcode;
34 | public event Action HighlightedCommand;
35 | public event Action FilenameChanged;
36 |
37 | public void HighlightOpcode(Opcode opcode)
38 | {
39 | if (HighlightedOpcode != null) HighlightedOpcode(opcode);
40 | }
41 | public void HighlightCommand(Ca65Command command)
42 | {
43 | if (HighlightedCommand != null) HighlightedCommand(command);
44 | }
45 |
46 | public void UpdateStates(EmulationState state)
47 | {
48 | if (EmulationStateUpdate != null) EmulationStateUpdate(state);
49 | }
50 |
51 | public void SelectSprite(int spriteIndex)
52 | {
53 | if (spriteIndex == SelectedSprite) return;
54 | SelectedSprite = spriteIndex;
55 | if (SelectedSpriteChanged != null) SelectedSpriteChanged(SelectedSprite);
56 | }
57 |
58 | private bool _projectTypeInitialized = false;
59 | public void SetProjectType(ProjectType projectType)
60 | {
61 | if (projectType == ProjectType && _projectTypeInitialized) return;
62 | ProjectType = projectType;
63 | _projectTypeInitialized = true;
64 | if (ProjectTypeChanged != null) ProjectTypeChanged(projectType);
65 | }
66 |
67 | public void OpenFile(AsmProjectFile file, int? line = null, int? column = null, int? length = null)
68 | {
69 | if (OpenFileAction != null) OpenFileAction(file, line, column, length);
70 | }
71 |
72 | public void OnFilenameChanged(AsmProjectFile projectFile)
73 | {
74 | if (FilenameChanged != null) FilenameChanged(projectFile);
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/MenuHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Windows.Forms;
7 | using System.Xml.Serialization;
8 |
9 | namespace Brewmaster.Modules
10 | {
11 | public class MenuHelper : Component
12 | {
13 | private Action _writeHelp;
14 | private MenuHelpCollection _helpItems;
15 |
16 | public MenuHelper()
17 | {
18 | }
19 |
20 | public MenuHelper(IContainer container)
21 | {
22 | }
23 |
24 | public void Prepare(IEnumerable toolStrips, Action writeHelp)
25 | {
26 | _helpItems = MenuHelpCollection.Load(Path.Combine(Program.WorkingDirectory, @"MenuHelp.xml"));
27 | _writeHelp = writeHelp;
28 |
29 | foreach (var toolStrip in toolStrips)
30 | {
31 | Prepare(toolStrip.Items);
32 | }
33 | }
34 |
35 | private void Prepare(ToolStripItemCollection toolStripItems)
36 | {
37 | foreach (ToolStripItem item in toolStripItems)
38 | {
39 | if (item is ToolStripSeparator) continue;
40 | if (item is ToolStripMenuItem menuItem) Prepare(menuItem.DropDownItems);
41 | item.MouseEnter += (s, a) =>
42 | {
43 | if (_writeHelp != null && !string.IsNullOrWhiteSpace(item.Name)) _writeHelp(_helpItems.Get(item.Name));
44 | };
45 | item.MouseLeave += (s, a) =>
46 | {
47 | if (_writeHelp != null) _writeHelp(null);
48 | };
49 | }
50 | }
51 | }
52 |
53 | [Serializable, XmlRoot("MenuHelpCollection")]
54 | public class MenuHelpCollection : List
55 | {
56 | private string _fileName;
57 | public static MenuHelpCollection Load(string fileName)
58 | {
59 | if (!File.Exists(fileName)) return new MenuHelpCollection { _fileName = fileName };
60 | var serializer = new XmlSerializer(typeof(MenuHelpCollection));
61 | using (var reader = File.OpenRead(fileName))
62 | {
63 | var collection = (MenuHelpCollection)serializer.Deserialize(reader);
64 | collection._fileName = fileName;
65 | return collection;
66 | }
67 | }
68 |
69 | [XmlIgnore]
70 | private Dictionary _dictionary;
71 |
72 | public string Get(string key)
73 | {
74 | if (_dictionary == null) _dictionary = this.ToDictionary(h => h.MenuItem, h => h.HelpText);
75 | if (!_dictionary.ContainsKey(key)) Add(key, null);
76 | return _dictionary[key];
77 | }
78 |
79 | private void Add(string menuItem, string helpText)
80 | {
81 | _dictionary.Add(menuItem, helpText);
82 | Add(new MenuHelp {MenuItem = menuItem, HelpText = helpText ?? " "});
83 | #if DEBUG
84 | using (var writer = File.OpenWrite(_fileName)) new XmlSerializer(typeof(MenuHelpCollection)).Serialize(writer, this);
85 | #endif
86 | }
87 | }
88 | [Serializable]
89 | public class MenuHelp
90 | {
91 | [XmlElement(ElementName = "MenuItem")]
92 | public string MenuItem;
93 | [XmlElement(ElementName = "HelpText")]
94 | public string HelpText;
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/OpcodeHelper/AddressingModeDescription.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Drawing;
3 | using System.Text.RegularExpressions;
4 | using System.Windows.Forms;
5 |
6 | namespace Brewmaster.Modules.OpcodeHelper
7 | {
8 | public class AddressingModeDescription : UserControl
9 | {
10 | private ToolTip _toolTip;
11 | public SolidBrush ByteBg { get; }
12 | public SolidBrush CycleBg { get; }
13 |
14 | private List _lines = new List();
15 |
16 | protected override void OnPaint(PaintEventArgs e)
17 | {
18 | for (var i = 0; i < _lines.Count; i++)
19 | {
20 | _lines[i].DrawMode(e.Graphics, i * 17, Font, ByteBg, CycleBg);
21 | }
22 | }
23 |
24 | public IEnumerable Modes
25 | {
26 | set
27 | {
28 | _lines.Clear();
29 | foreach (var mode in value)
30 | {
31 | _lines.Add(new AddressingModeLine(mode));
32 | }
33 | var height = _lines.Count * 17;
34 | if (Height != height) Height = height;
35 | Invalidate();
36 | }
37 | }
38 |
39 | protected override void OnMouseMove(MouseEventArgs e)
40 | {
41 | base.OnMouseMove(e);
42 | foreach (var line in _lines)
43 | {
44 | if (line.CycleExplanation != null && line.ToolTipBounds.Contains(e.Location))
45 | {
46 | _toolTip.SetToolTip(this, line.CycleExplanation);
47 | return;
48 | }
49 | }
50 | _toolTip.SetToolTip(this, null);
51 | }
52 |
53 | public AddressingModeDescription(ToolTip toolTip)
54 | {
55 | DoubleBuffered = true;
56 | _toolTip = toolTip;
57 | Font = new Font("Microsoft Tai Le", 10, FontStyle.Regular, GraphicsUnit.Pixel);
58 | Height = 17;
59 | Width = 200;
60 | ByteBg = new SolidBrush(Color.FromArgb(255, 224, 192));
61 | CycleBg = new SolidBrush(Color.FromArgb(210, 250, 220));
62 | }
63 |
64 | private class AddressingModeLine
65 | {
66 | private AddressingMode _mode;
67 | private string _byteText;
68 | private string _cycleText;
69 | public string CycleExplanation { get; private set; }
70 | public Rectangle ToolTipBounds;
71 |
72 | public AddressingModeLine(AddressingMode mode)
73 | {
74 | _mode = mode;
75 | _byteText = string.Format("{0} bytes", _mode.Bytes);
76 |
77 | var match = Regex.Match(_mode.Cycles, "^([0-9]+)(.*)$");
78 | if (!match.Success) return;
79 |
80 | var cycleCount = int.Parse(match.Groups[1].Value);
81 | _cycleText = string.Format("{0} cycles", cycleCount);
82 | if (match.Groups.Count > 2)
83 | {
84 | CycleExplanation = match.Groups[2].Value.Trim();
85 | var match2 = Regex.Match(CycleExplanation, @"\+[0-9]+(?!.*\+.*)");
86 | if (match2.Success) _cycleText = string.Format("{0} (+) cycles", cycleCount);
87 | }
88 |
89 | }
90 | public void DrawMode(Graphics graphics, int y, Font font, Brush byteBg, Brush cycleBg)
91 | {
92 | if (_mode == null) return;
93 | graphics.DrawString(_mode.Name, font, Brushes.Black, 4, y);
94 |
95 | var bWidth = graphics.MeasureString(_byteText, font).Width + 4;
96 | graphics.FillRectangle(byteBg, 80, y, bWidth, 13);
97 | graphics.DrawRectangle(Pens.DarkGray, 80, y, bWidth, 13);
98 | graphics.DrawString(_byteText, font, Brushes.Black, 82, y);
99 |
100 | if (_cycleText == null) return;
101 |
102 | var cX = (int)(80 + bWidth + 10);
103 | var cWidth = graphics.MeasureString(_cycleText, font).Width + 4;
104 | graphics.FillRectangle(cycleBg, cX, y, cWidth, 13);
105 | graphics.DrawRectangle(Pens.DarkGray, cX, y, cWidth, 13);
106 | graphics.DrawString(_cycleText, font, Brushes.Black, cX + 2, y);
107 |
108 | ToolTipBounds = new Rectangle(cX, y, (int)cWidth, 13);
109 | }
110 |
111 | }
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/Ppu/ChrRender.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Drawing.Imaging;
4 | using System.Runtime.InteropServices;
5 | using Brewmaster.Emulation;
6 | using Brewmaster.ProjectModel;
7 |
8 | namespace Brewmaster.Modules.Ppu
9 | {
10 | public class ChrRender : ScaledImageRenderer
11 | {
12 | private CharacterData _data;
13 | private ProjectType _type;
14 |
15 | public ChrRender()
16 | {
17 | SetImageSize(128, 256);
18 | }
19 |
20 | public void UpdateChrData(CharacterData data, ProjectType type)
21 | {
22 | _data = data;
23 | _type = type;
24 | RefreshImage();
25 | }
26 |
27 | protected override void DrawBackBuffer(Func getGraphics)
28 | {
29 | if (_data == null) return;
30 |
31 | if (ImageWidth != _data.Width || ImageHeight != _data.Height * _data.PixelData.Length)
32 | {
33 | SetImageSize(_data.Width, _data.Height * _data.PixelData.Length);
34 | }
35 |
36 | lock (BackBufferLock)
37 | using (var graphics = getGraphics())
38 | {
39 | graphics.Clear(Color.Black);
40 | for (var i = 0; i < _data.PixelData.Length; i++)
41 | {
42 | var handle = GCHandle.Alloc(_data.PixelData[i], GCHandleType.Pinned);
43 | using (var source = new Bitmap(_data.Width, _data.Height, 4 * _data.Width, PixelFormat.Format32bppPArgb, handle.AddrOfPinnedObject()))
44 | {
45 | graphics.DrawImage(source, 0, _data.Height * i);
46 | }
47 | handle.Free();
48 | }
49 | }
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/Ppu/ChrViewer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using Brewmaster.Emulation;
4 | using Brewmaster.ProjectModel;
5 |
6 | namespace Brewmaster.Modules.Ppu
7 | {
8 | public partial class ChrViewer : UserControl
9 | {
10 | private CharacterData _data;
11 |
12 | public ChrViewer(Events events)
13 | {
14 | InitializeComponent();
15 | events.EmulationStateUpdate += (state) => UpdateChrData(state.CharacterData, state.Type);
16 | events.ProjectTypeChanged += (type) =>
17 | {
18 | var showOptionPanel = type == ProjectType.Snes;
19 | if (_snesOptionPanel.Visible != showOptionPanel) _snesOptionPanel.Visible = showOptionPanel;
20 | };
21 | }
22 |
23 | private void UpdateChrData(CharacterData characterData, ProjectType type)
24 | {
25 | _data = characterData;
26 | _chrDisplay.UpdateChrData(characterData, type);
27 | if (_bitDepthSelector.SelectedIndex != characterData.ColorMode && !_bitDepthSelector.Focused) _bitDepthSelector.SelectedIndex = characterData.ColorMode;
28 | }
29 |
30 | protected override void OnLoad(EventArgs e)
31 | {
32 | base.OnLoad(e);
33 | _bitDepthSelector.Items.Add("2bpp");
34 | _bitDepthSelector.Items.Add("4bpp");
35 | _bitDepthSelector.Items.Add("8bpp");
36 | _bitDepthSelector.Items.Add("Direct color");
37 | _bitDepthSelector.Items.Add("Mode 7");
38 | _bitDepthSelector.Items.Add("Mode 7 direct color");
39 |
40 | _bitDepthSelector.SelectedIndexChanged += (s, a) => {
41 | if (_data == null) return;
42 | _data.RequestRefresh(_bitDepthSelector.SelectedIndex);
43 | };
44 | _bitDepthSelector.SelectedIndex = 1;
45 | }
46 |
47 | protected override void OnLayout(LayoutEventArgs e)
48 | {
49 | _chrDisplay.Width = Width;
50 | _chrDisplay.Height = Height - (_controlPanel.Visible ? _controlPanel.Height : 0) - 1;
51 | base.OnLayout(e);
52 | }
53 | public bool FitImage
54 | {
55 | get { return _scaleButton.Checked; }
56 | set { _scaleButton.Checked = value; }
57 | }
58 |
59 | private void _scaleButton_CheckedChanged(object sender, EventArgs e)
60 | {
61 | _chrDisplay.FitImage = _scaleButton.Checked;
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/Ppu/ConsolePaletteViewer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 |
4 | namespace Brewmaster.Modules.Ppu
5 | {
6 |
7 | public class ConsolePaletteViewer : PaletteViewer
8 | {
9 | public ConsolePaletteViewer(Events events)
10 | {
11 | Columns = 16;
12 |
13 | // TODO configurable palettes:
14 | /*ColorClicked += index =>
15 | {
16 | using (var colorDialog = new ColorDialog { Color = Palette.Colors[index] })
17 | {
18 | colorDialog.ShowDialog(this);
19 | Palette.Colors[index] = colorDialog.Color;
20 | }
21 | Invalidate();
22 | };*/
23 | events.ProjectTypeChanged += type =>
24 | {
25 | Columns = type == ProjectModel.ProjectType.Snes ? (0x20 * 8) : 16;
26 | CellWidth = CellHeight = type == ProjectModel.ProjectType.Snes ? 3 : 20;
27 |
28 | Invalidate();
29 | FitSize();
30 | };
31 | }
32 | protected override void DrawColor(Graphics graphics, int index, int x, int y)
33 | {
34 | base.DrawColor(graphics, index, x, y);
35 | if (index != HoverIndex) return;
36 |
37 | var brightness = Palette.Colors[index].GetBrightness();
38 | var hex = Convert.ToString(index, 16).PadLeft(2, '0').ToUpper();
39 | graphics.DrawString(hex, Font, brightness >= 0.7f ? Brushes.Black : Brushes.White, x + 1, y + 3);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/Ppu/GamePaletteViewer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Linq;
5 | using System.Windows.Forms;
6 | using Brewmaster.ProjectModel;
7 |
8 | namespace Brewmaster.Modules.Ppu
9 | {
10 | public class GamePaletteViewer : PaletteViewer
11 | {
12 | private List _paletteIndexes;
13 | private ProjectType _type;
14 | private int _bytesPerColor = 1;
15 | private ToolTip _toolTip;
16 |
17 | public Palette SourcePalette { get; set; }
18 |
19 | public GamePaletteViewer(Events events)
20 | {
21 | Columns = 4;
22 | CellWidth = 40;
23 | CellHeight = 40;
24 |
25 | Palette = new Palette();
26 | events.EmulationStateUpdate += state =>
27 | {
28 | if (_type != state.Type)
29 | {
30 | _type = state.Type;
31 | _bytesPerColor = _type == ProjectType.Snes ? 2 : 1;
32 | CellWidth = CellHeight = _type == ProjectType.Snes ? 20 : 40;
33 | Columns = _type == ProjectType.Nes ? 4 : 16;
34 | }
35 | var paletteSource = state.Memory.CgRam;
36 | Palette.Colors = new List(paletteSource.Length / _bytesPerColor);
37 |
38 | if (_bytesPerColor == 1) _paletteIndexes = paletteSource.Select(v => (int)v).ToList();
39 | else
40 | {
41 | _paletteIndexes = new List(paletteSource.Length / _bytesPerColor);
42 | for (var i = 0; i < paletteSource.Length; i += _bytesPerColor)
43 | {
44 | var paletteIndex = 0;
45 | for (var j = 0; j < _bytesPerColor; j++)
46 | {
47 | paletteIndex |= paletteSource[i + j] << (8 * j);
48 | }
49 | _paletteIndexes.Add(paletteIndex);
50 | }
51 | }
52 |
53 | for (var i = 0; i < _paletteIndexes.Count; i ++)
54 | {
55 | Palette.Colors.Add(SourcePalette.Get(_paletteIndexes[i]));
56 | }
57 | Invalidate();
58 | FitSize();
59 | };
60 | _toolTip = new ToolTip();
61 | _toolTip.AutoPopDelay = 5000;
62 | _toolTip.InitialDelay = 0;
63 | _toolTip.ReshowDelay = 100;
64 | _toolTip.ShowAlways = true;
65 | _toolTip.SetToolTip(this, "");
66 |
67 | }
68 | protected override void OnMouseMove(MouseEventArgs e)
69 | {
70 | base.OnMouseMove(e);
71 | if (HoverIndex < 0)
72 | {
73 | _toolTip.Active = false;
74 | return;
75 | }
76 | var indexHex = Convert.ToString(HoverIndex, 16).PadLeft(2, '0').ToUpper();
77 | var colorHex = Convert.ToString(_paletteIndexes[HoverIndex], 16).PadLeft(_type == ProjectType.Snes ? 4 : 2, '0').ToUpper();
78 | _toolTip.Active = true;
79 | _toolTip.Show(string.Format("${0}: ${1}", indexHex, colorHex), this, e.Location.X + 20, e.Location.Y + 2);
80 | }
81 | protected override void OnMouseLeave(EventArgs e)
82 | {
83 | base.OnMouseLeave(e);
84 | _toolTip.Active = false;
85 | }
86 |
87 | protected override void DrawColor(Graphics graphics, int index, int x, int y)
88 | {
89 | base.DrawColor(graphics, index, x, y);
90 |
91 | var brightness = Palette.Colors[index].GetBrightness();
92 | var hex = Convert.ToString(_paletteIndexes[index], 16).PadLeft(2, '0').ToUpper();
93 | if (CellWidth >= 30) graphics.DrawString(hex, Font, brightness >= 0.7f ? Brushes.Black : Brushes.White, x + 2, y + 2);
94 | }
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/Ppu/Palette.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Drawing;
3 | using System.IO;
4 |
5 | namespace Brewmaster.Modules.Ppu
6 | {
7 | public class Palette
8 | {
9 | public List Colors { get; set; }
10 | private bool _snes = false;
11 |
12 | public Palette()
13 | {
14 | Colors = new List();
15 | }
16 |
17 | public void Load(string filename)
18 | {
19 | Colors = new List();
20 | using (var stream = File.OpenRead(filename))
21 | {
22 | var channels = new byte[3];
23 | while (stream.Read(channels, 0, 3) == 3)
24 | {
25 | Colors.Add(Color.FromArgb(channels[0], channels[1], channels[2]));
26 | }
27 | }
28 | }
29 |
30 | public Color Get(int index)
31 | {
32 | if (!_snes) return Colors[index];
33 | var r = To8Bit(index & 0x1F);
34 | var g = To8Bit((index >> 5) & 0x1F);
35 | var b = To8Bit((index >> 10) & 0x1F);
36 |
37 | return Color.FromArgb(r, g, b);
38 | }
39 | private static int To8Bit(int color)
40 | {
41 | return ((color << 3) + (color >> 2));
42 | }
43 |
44 | public byte[] GetBinary(bool argb = true)
45 | {
46 | var returnValue = new List();
47 | foreach (var color in Colors)
48 | {
49 | if (argb)
50 | {
51 | returnValue.AddRange(new[] { color.B, color.G, color.R });
52 | returnValue.Add(255);
53 | }
54 | else returnValue.AddRange(new[] { color.R, color.G, color.B });
55 | }
56 | return returnValue.ToArray();
57 | }
58 |
59 | public void LoadSnesPalette()
60 | {
61 | _snes = true;
62 | //return;
63 |
64 | Colors = new List();
65 | for (var i = 0; i < 0x8000; i++) Colors.Add(Get(i));
66 | }
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/Ppu/PaletteViewer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 |
5 | namespace Brewmaster.Modules.Ppu
6 | {
7 | public class PaletteViewer : Control
8 | {
9 | private Palette _palette;
10 | protected int HoverIndex { get; private set; }
11 | public int Columns { get; set; }
12 | public int CellHeight { get; set; }
13 | public int CellWidth { get; set; }
14 |
15 | protected event Action ColorClicked;
16 |
17 | public PaletteViewer()
18 | {
19 | HoverIndex = -1;
20 | CellWidth = 20;
21 | CellHeight = 20;
22 | DoubleBuffered = true;
23 | Font = new Font("Consolas", 12, FontStyle.Bold, GraphicsUnit.Pixel);
24 | Layout += (s, a) => FitSize();
25 | }
26 |
27 | public Palette Palette
28 | {
29 | get { return _palette; }
30 | set
31 | {
32 | _palette = value;
33 | FitSize();
34 | Invalidate();
35 | }
36 | }
37 |
38 | protected override void OnMouseMove(MouseEventArgs e)
39 | {
40 | base.OnMouseMove(e);
41 | var hoverIndex = (e.Location.Y / CellHeight) * Columns + (e.Location.X / CellWidth);
42 | if (hoverIndex >= Palette.Colors.Count || e.Location.X > Columns * CellWidth) hoverIndex = -1;
43 | if (hoverIndex == HoverIndex) return;
44 | HoverIndex = hoverIndex;
45 | if (ColorClicked != null) Cursor = HoverIndex >= 0 ? Cursors.Hand : Cursors.Default;
46 | Invalidate();
47 | }
48 |
49 | protected override void OnMouseLeave(EventArgs e)
50 | {
51 | base.OnMouseLeave(e);
52 | HoverIndex = -1;
53 | Invalidate();
54 | }
55 |
56 | protected override void OnMouseClick(MouseEventArgs e)
57 | {
58 | base.OnMouseClick(e);
59 | if (HoverIndex >= 0 && e.Button == MouseButtons.Left && ColorClicked != null) ColorClicked(HoverIndex);
60 | }
61 |
62 | protected override void OnPaint(PaintEventArgs e)
63 | {
64 | base.OnPaint(e);
65 | for (var i = 0; i < Palette.Colors.Count; i++)
66 | {
67 | DrawColor(e.Graphics, i, CellWidth * (i % Columns), CellHeight * (i / Columns));
68 | }
69 |
70 | if (HoverIndex >= 0)
71 | {
72 | var i = HoverIndex;
73 | e.Graphics.DrawRectangle(Pens.White, CellWidth * (i % Columns), CellHeight * (i / Columns), CellWidth - 1, CellHeight - 1);
74 | e.Graphics.DrawRectangle(Pens.Black, CellWidth * (i % Columns) + 1, CellHeight * (i / Columns) + 1, CellWidth - 3, CellHeight - 3);
75 | }
76 | }
77 | public int BestWidth
78 | {
79 | get { return Columns * CellWidth; }
80 | }
81 | public int BestHeight
82 | {
83 | get { return (Palette.Colors.Count / Columns) * CellHeight; }
84 | }
85 | protected void FitSize()
86 | {
87 | if (Palette == null) return;
88 | if (Width == BestWidth && Height == BestHeight) return;
89 | Size = new Size(BestWidth, BestHeight);
90 | }
91 |
92 | protected virtual void DrawColor(Graphics graphics, int index, int x, int y)
93 | {
94 | using (var brush = new SolidBrush(Palette.Colors[index]))
95 | graphics.FillRectangle(brush, x, y, CellWidth, CellHeight);
96 | }
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/Ppu/ScaledImageRenderer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Drawing.Drawing2D;
4 | using System.Windows.Forms;
5 |
6 | namespace Brewmaster.Modules.Ppu
7 | {
8 | public abstract class ScaledImageRenderer : Panel
9 | {
10 | public int ImageWidth { get; private set; } = 512;
11 | public int ImageHeight { get; private set; } = 480;
12 | protected Object BackBufferLock = new Object();
13 |
14 | private bool _fitImage;
15 | private Bitmap _backBuffer = new Bitmap(512, 480);
16 | private readonly PictureBox _pictureBox;
17 | private float _scale = 1;
18 | private int _offsetX = 0;
19 | private int _offsetY = 0;
20 |
21 | protected ScaledImageRenderer()
22 | {
23 | _pictureBox = new PictureBox();
24 | _pictureBox.Image = new Bitmap(512, 480);
25 | _pictureBox.Width = 512;
26 | _pictureBox.Height = 480;
27 | Controls.Add(_pictureBox);
28 | _pictureBox.MouseDown += (s, a) => ClickedPicture(a);
29 |
30 | AutoScroll = true;
31 | }
32 |
33 | public bool FitImage
34 | {
35 | get { return _fitImage; }
36 | set { _fitImage = value; RepositionImage(); }
37 | }
38 |
39 | private void ScaleImage()
40 | {
41 | if (_backBuffer == null) return;
42 |
43 | BackColor = SystemColors.ControlDarkDark;
44 | var image = new Bitmap(ImageWidth, ImageHeight); // Create new temporary image to prevent errors when drawing a new image while the old is being drawn to screen
45 | lock (BackBufferLock)
46 | using (var g = Graphics.FromImage(image))
47 | {
48 | g.CompositingMode = CompositingMode.SourceCopy;
49 | g.CompositingQuality = CompositingQuality.HighSpeed;
50 | g.PixelOffsetMode = PixelOffsetMode.None;
51 | g.SmoothingMode = SmoothingMode.None;
52 | g.Clear(Color.Black);
53 | if (_fitImage) {
54 | var scaledRectangle = new Rectangle(Math.Max(0, -_offsetX), Math.Max(0, -_offsetY), (int)(ImageWidth * _scale), (int)(ImageHeight * _scale));
55 | g.InterpolationMode = InterpolationMode.Low;
56 | g.DrawImage(_backBuffer, scaledRectangle);
57 | }
58 | else
59 | {
60 | g.DrawImage(_backBuffer, 0, 0);
61 | }
62 | }
63 | var oldImage = _pictureBox.Image;
64 | _pictureBox.Image = image;
65 | oldImage.Dispose();
66 | }
67 |
68 | protected override void OnSizeChanged(EventArgs e)
69 | {
70 | RepositionImage();
71 | base.OnClientSizeChanged(e);
72 | PerformLayout();
73 | }
74 |
75 | private void RepositionImage()
76 | {
77 | _scale = 1f;
78 |
79 | if (_fitImage)
80 | {
81 | var t = Width / (float)ImageWidth;
82 | if (t < _scale) _scale = t;
83 | t = Height / (float)ImageHeight;
84 | if (t < _scale) _scale = t;
85 | }
86 | _offsetX = Math.Max(0, (int)(Width - ImageWidth * _scale) / 2);
87 | _offsetY = Math.Max(0, (int)(Height - ImageHeight * _scale) / 2);
88 |
89 | ScaleImage();
90 | _pictureBox.Left = _offsetX + AutoScrollPosition.X;
91 | _pictureBox.Top = _offsetY + AutoScrollPosition.Y;
92 |
93 | _pictureBox.Width = (int)(ImageWidth * _scale);
94 | _pictureBox.Height = (int)(ImageHeight * _scale);
95 | }
96 |
97 | protected override void OnPaint(PaintEventArgs e)
98 | {
99 | base.OnPaint(e);
100 | }
101 | protected void ClickedPicture(MouseEventArgs e)
102 | {
103 | var location = new Point((int)(e.X / _scale), (int)(e.Y / _scale));
104 | //location.Offset(-_pictureBox.Left, -_pictureBox.Top);
105 | OnMouseDownScaled(new MouseEventArgs(e.Button, e.Clicks, location.X, location.Y, 0));
106 | }
107 | protected virtual void OnMouseDownScaled(MouseEventArgs e) { }
108 | public void SetImageSize(int width, int height)
109 | {
110 | _backBuffer.Dispose();
111 | ImageWidth = width;
112 | ImageHeight = height;
113 | _backBuffer = new Bitmap(ImageWidth, ImageHeight);
114 | if (InvokeRequired) BeginInvoke(new Action(RepositionImage));
115 | else RepositionImage();
116 | }
117 |
118 | public void RefreshImage()
119 | {
120 | if (!Visible) return;
121 | DrawBackBuffer(() => Graphics.FromImage(_backBuffer));
122 | ScaleImage();
123 | if (InvokeRequired) BeginInvoke(new Action(Refresh));
124 | else Refresh();
125 | }
126 |
127 | protected override void OnVisibleChanged(EventArgs e)
128 | {
129 | base.OnVisibleChanged(e);
130 | if (Visible) RefreshImage();
131 | }
132 |
133 | protected abstract void DrawBackBuffer(Func getGraphics);
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/Ppu/SpriteRender.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Drawing.Imaging;
4 | using System.Runtime.InteropServices;
5 | using System.Windows.Forms;
6 | using Brewmaster.Emulation;
7 | using Brewmaster.ProjectModel;
8 |
9 | namespace Brewmaster.Modules.Ppu
10 | {
11 | public class SpriteRender : ScaledImageRenderer
12 | {
13 | private SpriteData _data;
14 | private ProjectType _type;
15 |
16 | public SpriteRender()
17 | {
18 | SetImageSize(256, 240);
19 | }
20 |
21 | private Events _events;
22 | public Events ModuleEvents
23 | {
24 | set
25 | {
26 | _events = value;
27 | if (_events == null) return;
28 | _events.EmulationStateUpdate += (state) => UpdateSpriteData(state.Sprites, state.Type);
29 | _events.SelectedSpriteChanged += index => RefreshImage();
30 | }
31 | }
32 |
33 | public void UpdateSpriteData(SpriteData data, ProjectType type)
34 | {
35 | _data = data;
36 | _type = type;
37 | RefreshImage();
38 | }
39 |
40 | protected override void OnMouseDownScaled(MouseEventArgs e)
41 | {
42 | if (_data == null) return;
43 |
44 | for (var i = 0; i < _data.Details.Count; i++)
45 | {
46 | var sprite = _data.Details[i];
47 | if (sprite.Bounds.Contains(e.Location))
48 | {
49 | _events.SelectSprite(i);
50 | break;
51 | }
52 | }
53 |
54 | }
55 |
56 | protected override void DrawBackBuffer(Func getGraphics)
57 | {
58 | if (_data == null) return;
59 |
60 | lock (BackBufferLock)
61 | using (var graphics = getGraphics())
62 | {
63 | graphics.Clear(Color.Transparent);
64 | var handle = GCHandle.Alloc(_data.PixelData, GCHandleType.Pinned);
65 | if (_type == ProjectType.Nes)
66 | {
67 | using (var source = new Bitmap(64, 128, 4 * 64, PixelFormat.Format32bppPArgb, handle.AddrOfPinnedObject()))
68 | {
69 | for (var i = 63; i >= 0; i--)
70 | {
71 | var sprite = _data.Details[i];
72 | if (sprite.Y < 240)
73 | graphics.DrawImage(source,
74 | sprite.Bounds,
75 | new Rectangle((i % 8) * 8, (i / 8) * 16, sprite.Width, sprite.Height),
76 | GraphicsUnit.Pixel);
77 | }
78 | }
79 | }
80 | else
81 | {
82 | using (var source = new Bitmap(256, 240, 4 * 256, PixelFormat.Format32bppPArgb, handle.AddrOfPinnedObject()))
83 | graphics.DrawImage(source, 0, 0);
84 | }
85 | handle.Free();
86 |
87 | if (_events.SelectedSprite >= 0 && _events.SelectedSprite < _data.Details.Count)
88 | {
89 | var scale = 1;
90 | var sprite = _data.Details[_events.SelectedSprite];
91 | var selection = sprite.Bounds;
92 | graphics.DrawRectangle(Pens.White, selection.Left * scale, selection.Top * scale, selection.Width * scale + 0.5f, selection.Height * scale + 0.5f);
93 | graphics.DrawRectangle(Pens.Gray, selection.Left * scale - 1, selection.Top * scale - 1, selection.Width * scale + 2.5f, selection.Height * scale + 2.5f);
94 | }
95 | }
96 | }
97 |
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/Ppu/SpriteViewer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace Brewmaster.Modules.Ppu
5 | {
6 | public partial class SpriteViewer : UserControl
7 | {
8 | public SpriteViewer(Events events)
9 | {
10 | InitializeComponent();
11 | _spriteDisplay.ModuleEvents = events;
12 | }
13 |
14 | protected override void OnLayout(LayoutEventArgs e)
15 | {
16 | _spriteDisplay.Width = Width;
17 | _spriteDisplay.Height = Height - (_controlPanel.Visible ? _controlPanel.Height : 0) - 1;
18 | base.OnLayout(e);
19 | }
20 | public bool FitImage
21 | {
22 | get { return _scaleButton.Checked; }
23 | set { _scaleButton.Checked = value; }
24 | }
25 |
26 | private void _scaleButton_CheckedChanged(object sender, EventArgs e)
27 | {
28 | _spriteDisplay.FitImage = _scaleButton.Checked;
29 | // Removes confusing focus from current button
30 | //if (_scaleButton.Focused && _layerButtons.Count > _requestedLayerId) _layerButtons[_requestedLayerId].Focus();
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/Ppu/TileMapViewer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Windows.Forms;
5 | using Brewmaster.Emulation;
6 | using Brewmaster.Layout;
7 | using Brewmaster.ProjectModel;
8 |
9 | namespace Brewmaster.Modules.Ppu
10 | {
11 | public partial class TileMapViewer : UserControl
12 | {
13 | public TileMapViewer(Events events)
14 | {
15 | InitializeComponent();
16 |
17 | events.EmulationStateUpdate += state => UpdateNametableData(state.TileMaps);
18 | events.ProjectTypeChanged += type => this.UpdateLabel(type == ProjectType.Nes ? "Nametables" : "Tilemaps");
19 | }
20 |
21 | protected override void OnLayout(LayoutEventArgs e)
22 | {
23 | _tileMapDisplay.Width = Width;
24 | _tileMapDisplay.Height = Height - (_controlPanel.Visible ? _controlPanel.Height : 0) - 1;
25 | base.OnLayout(e);
26 | }
27 |
28 | private List _layerButtons = new List();
29 | private int _numberOfLayers = 0;
30 | private TileMapData _data;
31 | private int _requestedLayerId = 1;
32 |
33 | public void UpdateNametableData(TileMapData data)
34 | {
35 | _data = data;
36 | _tileMapDisplay.UpdateNametableData(data);
37 | if (data.NumberOfPages != _numberOfLayers)
38 | {
39 | BeginInvoke(new Action(UpdateLayerAmount), _data.NumberOfPages, _data.GetPage);
40 | }
41 |
42 | if (data.GetPage != _requestedLayerId) // Forced to another tilemap page, probably because a new emulator was loaded
43 | {
44 | BeginInvoke(new Action(SetCurrentLayer), data.GetPage);
45 | }
46 | }
47 |
48 | private void UpdateLayerAmount(int layers, int selectedLayer)
49 | {
50 | _numberOfLayers = layers;
51 | while (_layerButtons.Count < _numberOfLayers)
52 | {
53 | var layerId = _layerButtons.Count;
54 | var button = new CheckBox
55 | {
56 | Checked = selectedLayer == layerId,
57 | Appearance = Appearance.Button,
58 | TextAlign = ContentAlignment.MiddleCenter,
59 | Width = 30,
60 | Height = 20,
61 | Text = (layerId + 1).ToString(),
62 | Margin = new Padding(2, 2, 0, 2)
63 | };
64 | button.Click += (s, a) => SetCurrentLayer(layerId);
65 | _layerButtons.Add(button);
66 | _layerButtonPanel.Controls.Add(button);
67 | }
68 | SuspendLayout();
69 | var visibleButtons = _numberOfLayers > 1 ? _numberOfLayers : 0;
70 | for (var i = 0; i < visibleButtons; i++) if (!_layerButtons[i].Visible) _layerButtons[i].Visible = true;
71 | for (var i = visibleButtons; i < _layerButtons.Count; i++) if (_layerButtons[i].Visible) _layerButtons[i].Visible = false;
72 | ResumeLayout();
73 | }
74 |
75 | private void SetCurrentLayer(int layerId)
76 | {
77 | _data.RequestRefresh(_requestedLayerId = layerId);
78 | for (var i = 0; i < _layerButtons.Count; i++)
79 | {
80 | _layerButtons[i].Checked = i == layerId;
81 | }
82 | }
83 |
84 | public bool FitImage
85 | {
86 | get { return _scaleButton.Checked; }
87 | set { _scaleButton.Checked = value; }
88 | }
89 | public bool ShowScrollOverlay
90 | {
91 | get { return _viewportButton.Checked; }
92 | set { _viewportButton.Checked = value; }
93 | }
94 |
95 | private void _scaleButton_CheckedChanged(object sender, EventArgs e)
96 | {
97 | _tileMapDisplay.FitImage = _scaleButton.Checked;
98 | // Removes confusing focus from current button
99 | if (_scaleButton.Focused && _layerButtons.Count > _requestedLayerId) _layerButtons[_requestedLayerId].Focus();
100 | }
101 |
102 | private void _viewportButton_CheckedChanged(object sender, EventArgs e)
103 | {
104 | _tileMapDisplay.ShowScrollOverlay = _viewportButton.Checked;
105 | if (_viewportButton.Focused && _layerButtons.Count > _requestedLayerId) _layerButtons[_requestedLayerId].Focus();
106 | }
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/ScrollableView.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 | using Brewmaster.ProjectExplorer;
4 |
5 | namespace Brewmaster.Modules
6 | {
7 | public class ScrollableView : Panel
8 | {
9 | public ScrollableView(Control child)
10 | {
11 | Controls.Add(child);
12 | child.Location = Point.Empty;
13 | AutoScroll = true;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/SpriteList/Sprite.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Drawing;
3 |
4 | namespace Brewmaster.Modules.SpriteList
5 | {
6 | public class Sprite
7 | {
8 | public int Index;
9 | public int X;
10 | public int Y;
11 | public int Width;
12 | public int Height;
13 | public int TileIndex;
14 | public int Palette;
15 | public int Priority;
16 | public bool Large;
17 | public bool FlipH;
18 | public bool FlipV;
19 | public bool UseSecondTable;
20 |
21 | public bool Visible
22 | {
23 | get {
24 | if (X + Width <= 0 || X > 255) return false;
25 | if (Y > 239 && ((Y + Height) & 0xFF) > Y) return false;
26 |
27 | return true;
28 | }
29 | }
30 |
31 | public Rectangle Bounds
32 | {
33 | get { return new Rectangle(X, Y, Width, Height); }
34 | }
35 |
36 | public static List GetSnesSprites(byte[] oamRam, int oamMode)
37 | {
38 | var sprites = new List();
39 | for (var i = 0; i < 512; i += 4)
40 | {
41 |
42 | var sprite = new Sprite();
43 | sprite.Y = oamRam[i + 1];
44 |
45 | var highTableOffset = i >> 4;
46 | var shift = ((i >> 2) & 0x03) << 1;
47 | var highTableValue = (byte)(oamRam[0x200 | highTableOffset] >> shift);
48 | sprite.Large = ((highTableValue & 0x02) >> 1) != 0;
49 | sprite.Height = OamSizes[oamMode, sprite.Large ? 1 : 0, 1] << 3;
50 | sprite.Width = OamSizes[oamMode, sprite.Large ? 1 : 0, 0] << 3;
51 |
52 | var sign = (highTableValue & 0x01) << 8;
53 | sprite.X = ((sign | oamRam[i]) << 23) >> 23;
54 | sprite.TileIndex = oamRam[i + 2];
55 |
56 | var flags = oamRam[i + 3];
57 | sprite.UseSecondTable = (flags & 0x01) != 0;
58 | sprite.Palette = (flags >> 1) & 0x07;
59 | sprite.Priority = (flags >> 4) & 0x03;
60 | sprite.FlipH = (flags & 0x40) != 0;
61 | sprite.FlipV = (flags & 0x80) != 0;
62 |
63 | sprites.Add(sprite);
64 | }
65 | return sprites;
66 | }
67 |
68 | public static List GetNesSprites(byte[] oamRam, bool largeSprites)
69 | {
70 | var sprites = new List();
71 | for (var i = 0; i < 256; i += 4)
72 | {
73 | var sprite = new Sprite();
74 | sprite.Y = oamRam[i];
75 | sprite.X = oamRam[i + 3];
76 | sprite.TileIndex = oamRam[i + 1];
77 | if (largeSprites)
78 | {
79 | sprite.UseSecondTable = (sprite.TileIndex & 1) == 1;
80 | sprite.TileIndex &= 0xFE;
81 | }
82 | sprite.Width = 8;
83 | sprite.Height = largeSprites ? 16 : 8;
84 |
85 | var attributes = oamRam[i + 2];
86 | sprite.Palette = attributes & 0x03;
87 | sprite.Priority = (attributes >> 5) & 1;
88 | sprite.FlipH = (attributes & 0x40) != 0;
89 | sprite.FlipV = (attributes & 0x80) != 0;
90 |
91 | sprites.Add(sprite);
92 | }
93 | return sprites;
94 | }
95 |
96 | private static readonly byte[,,] OamSizes = new byte[,,] {
97 | { { 1, 1 }, { 2, 2 } }, //8x8 + 16x16
98 | { { 1, 1 }, { 4, 4 } }, //8x8 + 32x32
99 | { { 1, 1 }, { 8, 8 } }, //8x8 + 64x64
100 | { { 2, 2 }, { 4, 4 } }, //16x16 + 32x32
101 | { { 2, 2 }, { 8, 8 } }, //16x16 + 64x64
102 | { { 4, 4 }, { 8, 8 } }, //32x32 + 64x64
103 | { { 2, 4 }, { 4, 8 } }, //16x32 + 32x64
104 | { { 2, 4 }, { 4, 4 } } //16x32 + 32x32
105 | };
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/SpriteList/SpriteList.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Windows.Forms;
3 | using Brewmaster.Emulation;
4 | using Brewmaster.Modules.Watch;
5 | using Brewmaster.ProjectModel;
6 | using Mesen.GUI.Debugger.PpuViewer;
7 |
8 | namespace Brewmaster.Modules.SpriteList
9 | {
10 | public class VirtualListView : ListView
11 | {
12 | public VirtualListView()
13 | {
14 | GridLines = true;
15 | View = View.Details;
16 | VirtualMode = true;
17 | DoubleBuffered = true;
18 | }
19 | }
20 | public class SpriteList : Control
21 | {
22 | private readonly Events _events;
23 | private ListView _listView;
24 | private SpriteData _spriteInfo;
25 |
26 | public SpriteList(Events events)
27 | {
28 | _events = events;
29 | _events.EmulationStateUpdate += UpdateSpriteList;
30 | _events.SelectedSpriteChanged += index =>
31 | {
32 | if (_listView.SelectedIndices.Contains(index)) return;
33 | _listView.SelectedIndices.Clear();
34 | _listView.SelectedIndices.Add(index);
35 | };
36 | _listView = new VirtualListView
37 | {
38 | Size = Size,
39 | FullRowSelect = true,
40 | HideSelection = false,
41 | Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top
42 | };
43 | _listView.RetrieveVirtualItem += GetListItem;
44 | _listView.ItemSelectionChanged += SelectedItem;
45 | Controls.Add(_listView);
46 |
47 | _listView.Columns.Add("#", 40);
48 | _listView.Columns.Add("Tile");
49 | _listView.Columns.Add("Position");
50 | _listView.Columns.Add("Palette");
51 | _listView.Columns.Add("Priority");
52 | _listView.Columns.Add("Flip");
53 | _listView.Columns.Add("Size");
54 | _listView.VirtualListSize = 0;
55 | }
56 |
57 | private void SelectedItem(object sender, ListViewItemSelectionChangedEventArgs e)
58 | {
59 | _events.SelectSprite(e.ItemIndex);
60 | }
61 |
62 | private void UpdateSpriteList(EmulationState state)
63 | {
64 | _spriteInfo = state.Sprites;
65 | _listView.BeginUpdate();
66 | _listView.VirtualListSize = state.Type == ProjectType.Snes ? 128 : 64;
67 | _listView.EndUpdate();
68 | }
69 |
70 | private void GetListItem(object sender, RetrieveVirtualItemEventArgs e)
71 | {
72 | var sprite = _spriteInfo.Details[e.ItemIndex];
73 |
74 | e.Item = new ListViewItem(new[]
75 | {
76 | e.ItemIndex.ToString(),
77 | string.Format(@"{0}{1}", WatchValue.FormatHex(sprite.TileIndex, 2), sprite.UseSecondTable ? " (2nd)" : ""),
78 | string.Format(@"{0}, {1}", sprite.X, sprite.Y),
79 | sprite.Palette.ToString(),
80 | sprite.Priority.ToString(),
81 | string.Format(@"{0}{1}", sprite.FlipH ? "H" : "", sprite.FlipV ? "V" : ""),
82 | string.Format(@"{0}x{1}", sprite.Width, sprite.Height)
83 | });
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/Watch/WatchValues.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Brewmaster.Modules.Watch
2 | {
3 | partial class WatchValues
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.watchList = new Brewmaster.Modules.Watch.WatchList();
32 | this.SuspendLayout();
33 | //
34 | // watchList
35 | //
36 | this.watchList.BorderStyle = System.Windows.Forms.BorderStyle.None;
37 | this.watchList.Dock = System.Windows.Forms.DockStyle.Fill;
38 | this.watchList.Location = new System.Drawing.Point(2, 0);
39 | this.watchList.Name = "watchList";
40 | this.watchList.Size = new System.Drawing.Size(273, 181);
41 | this.watchList.TabIndex = 0;
42 | this.watchList.UseCompatibleStateImageBehavior = false;
43 | this.watchList.View = System.Windows.Forms.View.Details;
44 | //
45 | // WatchValues
46 | //
47 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
48 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
49 | this.AutoSize = true;
50 | this.Controls.Add(this.watchList);
51 | this.MinimumSize = new System.Drawing.Size(275, 0);
52 | this.Name = "WatchValues";
53 | this.Padding = new System.Windows.Forms.Padding(2, 0, 0, 0);
54 | this.Size = new System.Drawing.Size(275, 181);
55 | this.ResumeLayout(false);
56 |
57 | }
58 |
59 | #endregion
60 |
61 | private WatchList watchList;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Brewmaster/Modules/Watch/WatchValues.cs:
--------------------------------------------------------------------------------
1 | using Brewmaster.Emulation;
2 | using Brewmaster.ProjectModel;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Windows.Forms;
7 |
8 | namespace Brewmaster.Modules.Watch
9 | {
10 | public partial class WatchValues : UserControl
11 | {
12 | public Action SetData { get; set; }
13 | public Func GetSymbol { set { watchList.GetSymbol = value; } }
14 | public Action AddBreakpoint { set { watchList.AddBreakpoint = value; } }
15 |
16 | public WatchValues()
17 | {
18 | InitializeComponent();
19 |
20 | SetData = watchList.SetData;
21 | }
22 |
23 |
24 | public void AddWatch(string expression, bool word = false)
25 | {
26 | watchList.AddWatch(expression, word);
27 | }
28 |
29 | public List GetSerializableData()
30 | {
31 | return watchList.Items.OfType().Select(v => new WatchValueData
32 | {
33 | Expression = v.Text,
34 | Decimal = v.ShowAsDecimal,
35 | Word = v.ShowAsWord
36 | }).ToList();
37 | }
38 |
39 | public void SetWatchValues(IEnumerable watchData)
40 | {
41 | watchList.ClearValues();
42 | foreach (var watch in watchData) watchList.AddWatch(watch.Expression, watch.Word, watch.Decimal);
43 | }
44 |
45 | public void Clear()
46 | {
47 | watchList.ClearValues();
48 | }
49 | }
50 |
51 | [Serializable]
52 | public class WatchValueData
53 | {
54 | public string Expression;
55 | public bool Word;
56 | public bool Decimal;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Brewmaster/Pipeline/DataPipeline.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Brewmaster.ProjectModel;
4 |
5 | namespace Brewmaster.Pipeline
6 | {
7 | public abstract class DataPipeline
8 | {
9 | // DATA ESSENTIAL TO OUR STORED FILE
10 | public AsmProjectFile File { get; set; }
11 | public abstract IEnumerable OutputFiles { get; }
12 | public DateTime? LastProcessed { get; protected set; }
13 |
14 | // END
15 |
16 | protected DataPipeline(AsmProjectFile file, DateTime? lastProcessed = null)
17 | {
18 | File = file;
19 | LastProcessed = lastProcessed;
20 | }
21 | public abstract void Process();
22 |
23 | public virtual void GetSettings(ProjectModel.Properties headerSettings)
24 | {
25 |
26 | }
27 |
28 | public virtual void SettingChanged()
29 | {
30 | LastProcessed = null;
31 | }
32 |
33 | public abstract DataPipeline Clone(bool toEditor = false);
34 | }
35 | }
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Brewmaster/ProjectExplorer/FileNode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.IO;
4 | using System.Windows.Forms;
5 | using Brewmaster.ProjectModel;
6 |
7 | namespace Brewmaster.ProjectExplorer
8 | {
9 |
10 | public class EditableNode : TreeNode
11 | {
12 | public bool Editable { get; set; }
13 |
14 | public EditableNode()
15 | {
16 | Editable = true;
17 | }
18 |
19 | public event Action Edited;
20 | internal virtual void AfterEdit(NodeLabelEditEventArgs args)
21 | {
22 | if (Editable && Edited != null) Edited(args);
23 | }
24 |
25 | }
26 |
27 | public class PipelineNode : EditableNode
28 | {
29 | private AsmProjectFile _projectFile;
30 |
31 | public PipelineNode(AsmProjectFile fileInfo, string fileName)
32 | {
33 | _projectFile = fileInfo;
34 | Text = fileName;
35 | }
36 | }
37 |
38 | public class DirectoryNode : EditableNode, IIdentifiableNode
39 | {
40 | public DirectoryInfo DirectoryInfo { get; set; }
41 |
42 | public DirectoryNode(DirectoryInfo directory)
43 | {
44 | DirectoryInfo = directory;
45 | Text = directory.Name;
46 | ImageIndex = 3;
47 | SelectedImageIndex = 3;
48 | }
49 |
50 | public void AddSubdirectory()
51 | {
52 | throw new NotImplementedException();
53 | }
54 |
55 | public object UniqueIdentifier { get { return DirectoryInfo.FullName.TrimEnd('\\', '/'); } }
56 | }
57 |
58 | public class FileNode : EditableNode, IIdentifiableNode
59 | {
60 | public AsmProjectFile FileInfo { get; set; }
61 |
62 | public FileNode(AsmProjectFile fileInfo)
63 | {
64 | UpdateFromFile(fileInfo);
65 | }
66 | public object UniqueIdentifier { get { return FileInfo.File; } }
67 |
68 | public void UpdateFromFile(AsmProjectFile fileInfo)
69 | {
70 | FileInfo = fileInfo;
71 | Text = fileInfo.File.Name;
72 |
73 | switch (fileInfo.Type)
74 | {
75 | case FileType.Source:
76 | case FileType.Include:
77 | ImageIndex = 6;
78 | break;
79 | case FileType.Image:
80 | ImageIndex = 5;
81 | break;
82 | default:
83 | ImageIndex = 4;
84 | break;
85 | }
86 |
87 | if (fileInfo.Mode == CompileMode.LinkerConfig) ImageIndex = 7;
88 | if (fileInfo.Missing)
89 | {
90 | ImageIndex = 100;
91 | ForeColor = SystemColors.GrayText;
92 | Text += " (missing)";
93 | }
94 | SelectedImageIndex = ImageIndex;
95 |
96 | if (false && fileInfo.Pipeline != null) // TODO: Display pipeline output in explorer?
97 | {
98 | foreach (var outputFile in fileInfo.Pipeline.OutputFiles)
99 | {
100 | if (outputFile == null) continue;
101 |
102 | var file = new FileInfo(outputFile);
103 | Nodes.Add(new PipelineNode(fileInfo, file.Name));
104 | }
105 | }
106 | }
107 | }
108 | public interface IIdentifiableNode
109 | {
110 | object UniqueIdentifier { get; }
111 | bool IsExpanded { get; }
112 | TreeNodeCollection Nodes { get; }
113 | void Expand();
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/Brewmaster/ProjectExplorer/SelectableTreeView.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace Brewmaster.ProjectExplorer
4 | {
5 | ///
6 | /// Fixes issues with the default WinForms TreeView class, allowing the user to mark an item on mouse
7 | /// down, yet only start editing node labels when clicking on an already selected item.
8 | /// To programmatically start editing a node, the EditNode() method should always be used.
9 | ///
10 | public class SelectableTreeView : TreeView
11 | {
12 | private TreeNode _previouslySelectedNode;
13 |
14 | public SelectableTreeView()
15 | {
16 | MouseDown += (s, a) =>
17 | {
18 | _previouslySelectedNode = SelectedNode;
19 | SelectedNode = GetNodeAt(a.X, a.Y);
20 | };
21 | }
22 |
23 | protected void EditNode(TreeNode node)
24 | {
25 | _previouslySelectedNode = node;
26 | node.BeginEdit();
27 | }
28 |
29 | protected override void OnBeforeLabelEdit(NodeLabelEditEventArgs e)
30 | {
31 | base.OnBeforeLabelEdit(e);
32 | if (_previouslySelectedNode != e.Node) e.CancelEdit = true;
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/Brewmaster/ProjectExplorer/SortableTreeView.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 |
4 | namespace Brewmaster.ProjectExplorer
5 | {
6 | ///
7 | /// A lot of messy basic code useful for any tree view with drag/drop and sorting features, making it
8 | /// behave more like people would usually expect. Moved to its own class to prevent clutter in ProjectExplorer.
9 | ///
10 | public class SortableTreeView : SelectableTreeView
11 | {
12 | private TreeNode _dragTarget;
13 |
14 | public SortableTreeView()
15 | {
16 | ItemDrag += (s, a) =>
17 | {
18 | if (!AllowDrop) return;
19 | if (!OnBeforeDrag(a.Item)) return;
20 | DoDragDrop(a.Item, DragDropEffects.Move | DragDropEffects.Scroll);
21 | };
22 | DragOver += (s, a) =>
23 | {
24 | a.Effect = DragDropEffects.Move | DragDropEffects.Scroll;
25 | var node = GetNodeAt(PointToClient(new Point(a.X, a.Y)));
26 | if (node == null || node == _dragTarget) return;
27 |
28 | if (_dragTarget != null)
29 | {
30 | _dragTarget.BackColor = BackColor;
31 | _dragTarget.ForeColor = ForeColor;
32 | }
33 | _dragTarget = node;
34 | node.BackColor = SystemColors.HotTrack;
35 | node.ForeColor = SystemColors.HighlightText;
36 | };
37 | DragLeave += (s, a) =>
38 | {
39 | if (_dragTarget == null) return;
40 | _dragTarget.BackColor = BackColor;
41 | _dragTarget.ForeColor = ForeColor;
42 | _dragTarget = null;
43 | };
44 | DragDrop += (s, a) =>
45 | {
46 | if (_dragTarget == null) return;
47 | _dragTarget.BackColor = BackColor;
48 | _dragTarget.ForeColor = ForeColor;
49 |
50 | OnAfterDrag(a.Data, _dragTarget);
51 | _dragTarget = null;
52 | };
53 |
54 | }
55 |
56 | protected virtual bool OnBeforeDrag(object draggedItem)
57 | {
58 | return true;
59 | }
60 | protected virtual void OnAfterDrag(IDataObject data, TreeNode dragTarget)
61 | {
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------
/Brewmaster/ProjectModel/Breakpoint.cs:
--------------------------------------------------------------------------------
1 | using Brewmaster.Settings;
2 | using System;
3 | using System.Collections.Generic;
4 | using Brewmaster.Modules.Watch;
5 |
6 | namespace Brewmaster.ProjectModel
7 | {
8 | public class Breakpoint
9 | {
10 | private bool _disabled;
11 |
12 | [Flags]
13 | public enum Types
14 | {
15 | Execute = 1,
16 | Read = 2,
17 | Write = 4
18 | }
19 |
20 | public event Action EnabledChanged;
21 | public enum AddressTypes
22 | {
23 | PrgRom = 1, ChrRom = 2, Cpu = 3, Ppu = 4, Apu = 5, Oam = 6
24 | }
25 | public int StartAddress { get; set; }
26 | public int? EndAddress { get; set; }
27 | public Types Type { get; set; }
28 | public AddressTypes AddressType { get; set; }
29 | public bool Automatic { get; set; }
30 | public string Symbol { get; set; }
31 | public AsmProjectFile File { get; set; }
32 | public int CurrentLine { get; set; }
33 | public int BuildLine { get; set; }
34 | public bool Broken { get; set; }
35 |
36 | public bool Disabled
37 | {
38 | get { return _disabled; }
39 | set
40 | {
41 | _disabled = value;
42 | if (EnabledChanged != null) EnabledChanged();
43 | }
44 | }
45 |
46 | public BreakpointData GetSerializable()
47 | {
48 | return new BreakpointData
49 | {
50 | StartAddress = StartAddress,
51 | EndAddress = EndAddress,
52 | Type = (int)Type,
53 | AddressType = (int)AddressType,
54 | Automatic = Automatic,
55 | Symbol = Symbol,
56 | File = File == null ? null : File.GetRelativePath(),
57 | Line = CurrentLine,
58 | Disabled = Disabled
59 | };
60 | }
61 |
62 | public void UpdateFromSymbols(Dictionary symbols)
63 | {
64 | if (symbols.ContainsKey(Symbol))
65 | {
66 | StartAddress = symbols[Symbol].Value;
67 | Broken = false;
68 | }
69 | else Broken = true;
70 | }
71 |
72 | public string GetAddressDescription()
73 | {
74 | return string.Format("{0}{1} ({2})",
75 | WatchValue.FormatHexAddress(StartAddress),
76 | EndAddress == null ? "" : ("-" + WatchValue.FormatHexAddress(EndAddress.Value)),
77 | AddressType.ToString().ToUpper());
78 | }
79 |
80 | public override string ToString()
81 | {
82 | return File != null
83 | ? string.Format("{0}:{1}", File.File.Name, CurrentLine)
84 | : Symbol != null
85 | ? Symbol + (StartAddress >= 0 ? string.Format(" ({0})", WatchValue.FormatHexAddress(StartAddress)) : "")
86 | : GetAddressDescription();
87 | }
88 | }
89 | }
--------------------------------------------------------------------------------
/Brewmaster/ProjectModel/Compatibility/LegacyProjectFileHeaderV1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Serialization;
3 |
4 | namespace Brewmaster.ProjectModel.Compatibility
5 | {
6 | [Serializable]
7 | [XmlRoot("ProjectFileHeader")]
8 | public class LegacyProjectFileHeaderV1 : ProjectFileHeader
9 | {
10 | [XmlArray("Files")]
11 | [XmlArrayItem("ProjectFileFileHeader")]
12 | public ProjectFileFileHeader[] LegacyFiles;
13 |
14 | [XmlArray("BuildConfigurations")]
15 | [XmlArrayItem("BuildConfigurationHeader")]
16 | public BuildConfigurationHeader[] LegacyBuildConfigurations;
17 |
18 | [XmlArray("ExtraDirectories")]
19 | public string[] LegacyExtraDirectories;
20 |
21 | public virtual void FixCompatibility()
22 | {
23 | Files = LegacyFiles;
24 | ExtraDirectories = LegacyExtraDirectories;
25 | BuildConfigurations = LegacyBuildConfigurations;
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/Brewmaster/ProjectModel/DebugInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Brewmaster.ProjectModel
4 | {
5 | public class DebugInfo
6 | {
7 | public Dictionary Files { get; private set; }
8 | public Dictionary Lines { get; private set; }
9 | public Dictionary LineIds { get; private set; }
10 | public Dictionary Segments { get; private set; }
11 | public Dictionary Symbols { get; private set; }
12 |
13 | public DebugInfo()
14 | {
15 | Files = new Dictionary();
16 | Lines = new Dictionary();
17 | LineIds = new Dictionary();
18 | Segments = new Dictionary();
19 | Symbols = new Dictionary();
20 | }
21 | }
22 |
23 |
24 | public struct DebugSegment
25 | {
26 | public int? RomOffset;
27 | public int? CpuAddress;
28 | }
29 |
30 | public class DebugFile
31 | {
32 | public string Name;
33 | public Dictionary Lines;
34 |
35 | public DebugFile()
36 | {
37 | Lines = new Dictionary();
38 | }
39 | }
40 |
41 | public class DebugLine
42 | {
43 | public DebugFile File;
44 | public int Line;
45 | public int? RomAddress;
46 | public int Size;
47 | public int? CpuAddress;
48 | }
49 | public class DebugSymbol
50 | {
51 | public int Value;
52 | public int Size;
53 | public int DebugLine;
54 | public string Source;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Brewmaster/ProjectModel/NesCartridge.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Brewmaster.ProjectModel
4 | {
5 | public class NesCartridge
6 | {
7 | public string Name { get; set; }
8 | public string Filename { get; set; }
9 | public string PrgFile { get; set; }
10 | public string ChrFile { get; set; }
11 | public string BuildPath { get; set; }
12 | public string PrgBuildPath { get; set; }
13 | public string DebugFile { get; set; }
14 | public string LinkerConfigFile { get; set; }
15 | public string ChrBuildPath { get; set; }
16 | public string MapFile { get; set; }
17 | public List Symbols { get; set; }
18 | public List ChrBanks { get; set; }
19 | public bool CalculateChecksum { get; set; }
20 |
21 | public NesCartridge()
22 | {
23 | ChrBanks = new List();
24 | Symbols = new List();
25 | }
26 |
27 | public override string ToString()
28 | {
29 | return string.IsNullOrWhiteSpace(Name) ? Filename : Name;
30 | }
31 | }
32 | public class ChrBank
33 | {
34 | public List Sources { get; set; }
35 |
36 | public ChrBank()
37 | {
38 | Sources = new List();
39 | }
40 | }
41 |
42 | }
--------------------------------------------------------------------------------
/Brewmaster/ProjectWizard/ConfigurationManager.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Brewmaster.ProjectWizard
2 | {
3 | partial class ConfigurationManager
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.Windows.Forms.Panel panel1;
32 | this.okButton = new System.Windows.Forms.Button();
33 | this.cancelButton = new System.Windows.Forms.Button();
34 | this.ConfigurationSettings = new Brewmaster.ProjectWizard.ConfigurationSettings();
35 | panel1 = new System.Windows.Forms.Panel();
36 | panel1.SuspendLayout();
37 | this.SuspendLayout();
38 | //
39 | // panel1
40 | //
41 | panel1.Controls.Add(this.okButton);
42 | panel1.Controls.Add(this.cancelButton);
43 | panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
44 | panel1.Location = new System.Drawing.Point(0, 337);
45 | panel1.Name = "panel1";
46 | panel1.Size = new System.Drawing.Size(604, 38);
47 | panel1.TabIndex = 2;
48 | //
49 | // okButton
50 | //
51 | this.okButton.Location = new System.Drawing.Point(436, 8);
52 | this.okButton.Name = "okButton";
53 | this.okButton.Size = new System.Drawing.Size(75, 23);
54 | this.okButton.TabIndex = 0;
55 | this.okButton.Text = "OK";
56 | this.okButton.UseVisualStyleBackColor = true;
57 | this.okButton.Click += new System.EventHandler(this.okButton_Click);
58 | //
59 | // cancelButton
60 | //
61 | this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
62 | this.cancelButton.Location = new System.Drawing.Point(517, 8);
63 | this.cancelButton.Name = "cancelButton";
64 | this.cancelButton.Size = new System.Drawing.Size(75, 23);
65 | this.cancelButton.TabIndex = 1;
66 | this.cancelButton.Text = "Cancel";
67 | this.cancelButton.UseVisualStyleBackColor = true;
68 | //
69 | // ConfigurationSettings
70 | //
71 | this.ConfigurationSettings.Location = new System.Drawing.Point(12, 12);
72 | this.ConfigurationSettings.Name = "ConfigurationSettings";
73 | this.ConfigurationSettings.Size = new System.Drawing.Size(592, 303);
74 | this.ConfigurationSettings.TabIndex = 0;
75 | //
76 | // ConfigurationManager
77 | //
78 | this.AcceptButton = this.okButton;
79 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
80 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
81 | this.CancelButton = this.cancelButton;
82 | this.ClientSize = new System.Drawing.Size(604, 375);
83 | this.Controls.Add(panel1);
84 | this.Controls.Add(this.ConfigurationSettings);
85 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
86 | this.Name = "ConfigurationManager";
87 | this.ShowIcon = false;
88 | this.ShowInTaskbar = false;
89 | this.Text = "New Configuration";
90 | panel1.ResumeLayout(false);
91 | this.ResumeLayout(false);
92 |
93 | }
94 |
95 | #endregion
96 | private ConfigurationSettings ConfigurationSettings;
97 | private System.Windows.Forms.Button okButton;
98 | private System.Windows.Forms.Button cancelButton;
99 | }
100 | }
--------------------------------------------------------------------------------
/Brewmaster/ProjectWizard/ConfigurationManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using System.Windows.Forms;
4 | using Brewmaster.ProjectModel;
5 |
6 | namespace Brewmaster.ProjectWizard
7 | {
8 | public partial class ConfigurationManager : Form
9 | {
10 | public ConfigurationManager(AsmProject project)
11 | {
12 | InitializeComponent();
13 |
14 | ConfigurationSettings.Project = project;
15 | ConfigurationSettings.ConfigurationName.Text = project.Type == ProjectType.Snes ? "SNES" : "NES";
16 | var defaultConfigFile = project.Files.FirstOrDefault(f => f.Mode == CompileMode.LinkerConfig);
17 | if (defaultConfigFile != null)
18 | ConfigurationSettings.ConfigurationFile.Text = defaultConfigFile.GetRelativePath();
19 |
20 | ConfigurationSettings.OutputFile.Text = project.Type == ProjectType.Snes ? "bin/game.sfc" : "bin/game.nes";
21 | }
22 |
23 | public NesCartridge Configuration { get; set; }
24 |
25 | private void okButton_Click(object sender, EventArgs e)
26 | {
27 | var configurationName = ConfigurationSettings.ConfigurationName.Text;
28 | if (ConfigurationSettings.Project.BuildConfigurations.Any(c => c.Name == configurationName))
29 | {
30 | MessageBox.Show(string.Format("A build configuration with the name '{0}' already exists.", configurationName));
31 | return;
32 | }
33 |
34 | Configuration = new NesCartridge();
35 | if (ConfigurationSettings.SetConfigurationSettings(Configuration))
36 | {
37 | DialogResult = DialogResult.OK;
38 | Close();
39 | }
40 | }
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Brewmaster/ProjectWizard/ConfigurationSettings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text.RegularExpressions;
6 | using System.Windows.Forms;
7 | using Brewmaster.ProjectModel;
8 |
9 | namespace Brewmaster.ProjectWizard
10 | {
11 | public partial class ConfigurationSettings : UserControl
12 | {
13 | private AsmProject _project;
14 | public AsmProject Project {
15 | get { return _project; }
16 | set
17 | {
18 | _project = value;
19 | CalculateSnesChecksum.Visible = ChecksumLabel.Visible = _project.Type == ProjectType.Snes;
20 | }
21 | }
22 |
23 | public ConfigurationSettings()
24 | {
25 | InitializeComponent();
26 | }
27 |
28 | public ConfigurationSettings(NesCartridge configuration, AsmProject project)
29 | {
30 | InitializeComponent();
31 |
32 | Project = project;
33 | ConfigurationName.Text = configuration.Name;
34 | OutputFile.Text = configuration.Filename;
35 | GenerateMapFile.Checked = configuration.MapFile != null;
36 | ConfigurationFile.Text = configuration.LinkerConfigFile;
37 | CalculateSnesChecksum.Checked = configuration.CalculateChecksum;
38 | Symbols.Text = string.Join(Environment.NewLine, configuration.Symbols);
39 | }
40 |
41 | public bool SetConfigurationSettings(NesCartridge configuration)
42 | {
43 | if (!IsValid()) return false;
44 |
45 | var outputFile = OutputFile.Text.Replace('\\', '/');
46 | var buildPath = Path.GetDirectoryName(outputFile);
47 | if (string.IsNullOrEmpty(buildPath)) buildPath = "";
48 | else buildPath = buildPath.Replace('\\', '/') + "/";
49 |
50 | configuration.Name = ConfigurationName.Text;
51 | configuration.Filename = outputFile;
52 | configuration.DebugFile = buildPath + Path.GetFileNameWithoutExtension(outputFile) + ".dbg";
53 | configuration.LinkerConfigFile = ConfigurationFile.Text;
54 | configuration.BuildPath = buildPath + "obj";
55 | configuration.MapFile = GenerateMapFile.Checked
56 | ? buildPath + Path.GetFileNameWithoutExtension(outputFile) + ".map.txt"
57 | : null;
58 | configuration.Symbols = GetSymbols().ToList();
59 | configuration.ChrBuildPath = null;
60 | configuration.ChrFile = null;
61 | configuration.PrgFile = null;
62 | configuration.PrgBuildPath = null;
63 |
64 | configuration.CalculateChecksum = CalculateSnesChecksum.Checked;
65 |
66 | return true;
67 | }
68 |
69 | private IEnumerable GetSymbols()
70 | {
71 | return Symbols.Text.Split(new[] {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries).Select(s => Regex.Replace(s.Trim(), @"\s+=\s+", "="));
72 | }
73 |
74 | public bool IsValid()
75 | {
76 | if (string.IsNullOrWhiteSpace(OutputFile.Text))
77 | {
78 | MessageBox.Show("Invalid filename");
79 | return false;
80 | }
81 | foreach (var character in NewProjectPath.InvalidPathChars)
82 | if (OutputFile.Text.Contains(character))
83 | {
84 | MessageBox.Show(string.Format("Invalid filename: '{0}'", OutputFile.Text));
85 | return false;
86 | }
87 |
88 | foreach (var symbol in GetSymbols())
89 | {
90 | if (!Regex.IsMatch(symbol, @"^[a-zA-Z][^\s]*(=[^\s]+)?$"))
91 | {
92 | MessageBox.Show(string.Format("Invalid symbol definition: '{0}'", symbol));
93 | return false;
94 | }
95 | }
96 |
97 | return true;
98 | }
99 |
100 | private void BrowseConfigFile_Click(object sender, EventArgs e)
101 | {
102 | using (var dialog = new OpenFileDialog())
103 | {
104 | dialog.CheckFileExists = false;
105 | dialog.Filter = "Configuration files (*.cfg;*.ini)|*.cfg;*.ini|All files (*.*)|*.*";
106 | dialog.DefaultExt = ".cfg";
107 | dialog.InitialDirectory = Project.Directory.FullName;
108 | if (!string.IsNullOrWhiteSpace(ConfigurationFile.Text))
109 | {
110 | try
111 | {
112 | var file = new FileInfo(Project.Directory.FullName + @"\" + ConfigurationFile.Text);
113 | dialog.FileName = file.Name;
114 | dialog.InitialDirectory = file.DirectoryName.Replace('/', '\\');
115 | }
116 | catch
117 | {
118 | // Eugh, exception driven logic, but there's not really any other reliable way
119 | }
120 | }
121 | if (dialog.ShowDialog() != DialogResult.OK) return;
122 |
123 | ConfigurationFile.Text = Project.GetRelativePath(dialog.FileName);
124 | }
125 | }
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/Brewmaster/ProjectWizard/ImportFile.Designer.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace Brewmaster.ProjectWizard
4 | {
5 | partial class ImportFile
6 | {
7 | ///
8 | /// Required designer variable.
9 | ///
10 | private System.ComponentModel.IContainer components = null;
11 |
12 | ///
13 | /// Clean up any resources being used.
14 | ///
15 | /// true if managed resources should be disposed; otherwise, false.
16 | protected override void Dispose(bool disposing)
17 | {
18 | if (disposing && (components != null))
19 | {
20 | components.Dispose();
21 | }
22 | base.Dispose(disposing);
23 | }
24 |
25 | #region Component Designer generated code
26 |
27 | ///
28 | /// Required method for Designer support - do not modify
29 | /// the contents of this method with the code editor.
30 | ///
31 | private void InitializeComponent()
32 | {
33 | this.EnableFile = new System.Windows.Forms.CheckBox();
34 | this.EnableProcessing = new System.Windows.Forms.CheckBox();
35 | this.ContentType = new System.Windows.Forms.ComboBox();
36 | this.SuspendLayout();
37 | //
38 | // EnableFile
39 | //
40 | this.EnableFile.Location = new System.Drawing.Point(0, 2);
41 | this.EnableFile.Name = "EnableFile";
42 | this.EnableFile.Size = new System.Drawing.Size(308, 17);
43 | this.EnableFile.TabIndex = 0;
44 | this.EnableFile.Text = "C:\\Users\\File\\Name.s";
45 | this.EnableFile.UseVisualStyleBackColor = true;
46 | this.EnableFile.CheckedChanged += new System.EventHandler(this.EnableFile_CheckedChanged);
47 | //
48 | // EnableProcessing
49 | //
50 | this.EnableProcessing.AutoSize = true;
51 | this.EnableProcessing.Location = new System.Drawing.Point(441, 2);
52 | this.EnableProcessing.Name = "EnableProcessing";
53 | this.EnableProcessing.Size = new System.Drawing.Size(118, 17);
54 | this.EnableProcessing.TabIndex = 2;
55 | this.EnableProcessing.Text = "Include in assembly";
56 | this.EnableProcessing.UseVisualStyleBackColor = true;
57 | //
58 | // ContentType
59 | //
60 | this.ContentType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
61 | this.ContentType.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
62 | this.ContentType.FormattingEnabled = true;
63 | this.ContentType.Location = new System.Drawing.Point(314, 0);
64 | this.ContentType.Name = "ContentType";
65 | this.ContentType.Size = new System.Drawing.Size(121, 21);
66 | this.ContentType.TabIndex = 1;
67 | this.ContentType.SelectedIndexChanged += new System.EventHandler(this.ContentType_SelectedIndexChanged);
68 | //
69 | // ImportFile
70 | //
71 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
72 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
73 | this.AutoSize = true;
74 | this.Controls.Add(this.EnableProcessing);
75 | this.Controls.Add(this.ContentType);
76 | this.Controls.Add(this.EnableFile);
77 | this.MaximumSize = new System.Drawing.Size(0, 24);
78 | this.Name = "ImportFile";
79 | this.Size = new System.Drawing.Size(562, 24);
80 | this.ResumeLayout(false);
81 | this.PerformLayout();
82 |
83 | }
84 |
85 | #endregion
86 |
87 | private CheckBox EnableFile;
88 | private CheckBox EnableProcessing;
89 | private ComboBox ContentType;
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/Brewmaster/ProjectWizard/ImportFile.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using Brewmaster.ProjectModel;
4 |
5 | namespace Brewmaster.ProjectWizard
6 | {
7 | public partial class ImportFile : UserControl
8 | {
9 | private ImportProjectFiles.FileImportInfo _file;
10 |
11 | public ImportFile()
12 | {
13 | InitializeComponent();
14 |
15 | ContentType.Items.Add("Source file");
16 | ContentType.Items.Add("Data file");
17 | ContentType.Items.Add("Linker configuration");
18 | ContentType.Items.Add("Other");
19 | }
20 |
21 | public ImportProjectFiles.FileImportInfo File
22 | {
23 | set
24 | {
25 | _file = value;
26 | EnableFile.Text = _file.ProjectFile.GetRelativePath();
27 | ContentType.Enabled = EnableFile.Checked = _file.IncludeInProject;
28 |
29 | switch (_file.ProjectFile.Mode)
30 | {
31 | case CompileMode.IncludeInAssembly:
32 | ContentType.SelectedIndex = 0;
33 | break;
34 | case CompileMode.ContentPipeline:
35 | ContentType.SelectedIndex = 1;
36 | break;
37 | case CompileMode.LinkerConfig:
38 | ContentType.SelectedIndex = 2;
39 | break;
40 | default:
41 | ContentType.SelectedIndex = 3;
42 | break;
43 | }
44 |
45 | EnableProcessing.Visible = false;
46 | }
47 | }
48 | private void ContentType_SelectedIndexChanged(object sender, EventArgs e)
49 | {
50 | switch (ContentType.SelectedIndex)
51 | {
52 | case 0:
53 | _file.ProjectFile.Mode = CompileMode.IncludeInAssembly;
54 | break;
55 | case 1:
56 | _file.ProjectFile.Mode = CompileMode.ContentPipeline;
57 | break;
58 | case 2:
59 | _file.ProjectFile.Mode = CompileMode.LinkerConfig;
60 | break;
61 | case 3:
62 | _file.ProjectFile.Mode = CompileMode.Ignore;
63 | break;
64 | }
65 | }
66 | private void EnableFile_CheckedChanged(object sender, System.EventArgs e)
67 | {
68 | _file.IncludeInProject = ContentType.Enabled = EnableFile.Checked;
69 | }
70 |
71 | public FocusType GetFocus()
72 | {
73 | return ContentType.ContainsFocus ? FocusType.ContentType
74 | : EnableFile.ContainsFocus ? FocusType.Enable
75 | : EnableProcessing.ContainsFocus ? FocusType.Process
76 | : FocusType.None;
77 | }
78 |
79 | public enum FocusType
80 | {
81 | None, Enable, ContentType, Process
82 | }
83 |
84 | public void Focus(FocusType focusType)
85 | {
86 | Focus();
87 | switch (focusType)
88 | {
89 | case FocusType.Enable:
90 | EnableFile.Focus();
91 | break;
92 | case FocusType.ContentType:
93 | ContentType.Select();
94 | ContentType.Focus();
95 | break;
96 | case FocusType.Process:
97 | EnableProcessing.Focus();
98 | break;
99 | }
100 | }
101 |
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/Brewmaster/ProjectWizard/ImportProject.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using Brewmaster.ProjectModel;
3 |
4 | namespace Brewmaster.ProjectWizard
5 | {
6 | public class ImportProject : WizardDialog
7 | {
8 | public AsmProject Project { get; set; }
9 |
10 | private readonly ImportProjectPath _importProjectPath;
11 | private readonly ImportProjectFiles _importFiles;
12 |
13 | public ImportProject(Settings.Settings settings) : base(settings)
14 | {
15 | _importProjectPath = new ImportProjectPath();
16 | _importFiles = new ImportProjectFiles();
17 |
18 | AddSteps(_importProjectPath, _importFiles);
19 | }
20 |
21 | protected override void ChangeStep(int step)
22 | {
23 | if (Step == 0 && step == 1)
24 | {
25 | var directory = new DirectoryInfo(_importProjectPath.Directory);
26 | if (Project == null || Project.Directory.Name != directory.Name)
27 | {
28 | _importFiles.Project = Project = AsmProject.ImportFromDirectory(directory);
29 | }
30 | Project.Name = _importProjectPath.ProjectName;
31 | Project.ProjectFile = new FileInfo(_importProjectPath.ProjectFile);
32 | }
33 | base.ChangeStep(step);
34 | }
35 |
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Brewmaster/ProjectWizard/ImportProjectFiles.Designer.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace Brewmaster.ProjectWizard
4 | {
5 | partial class ImportProjectFiles
6 | {
7 | ///
8 | /// Required designer variable.
9 | ///
10 | private System.ComponentModel.IContainer components = null;
11 |
12 | ///
13 | /// Clean up any resources being used.
14 | ///
15 | /// true if managed resources should be disposed; otherwise, false.
16 | protected override void Dispose(bool disposing)
17 | {
18 | if (disposing && (components != null))
19 | {
20 | components.Dispose();
21 | }
22 | base.Dispose(disposing);
23 | }
24 |
25 | #region Component Designer generated code
26 |
27 | ///
28 | /// Required method for Designer support - do not modify
29 | /// the contents of this method with the code editor.
30 | ///
31 | private void InitializeComponent()
32 | {
33 | this.components = new System.ComponentModel.Container();
34 | this.FilePanel = new System.Windows.Forms.Panel();
35 | this.FileList = new System.Windows.Forms.Panel();
36 | this.ScrollBar = new System.Windows.Forms.VScrollBar();
37 | this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components);
38 | this.FilePanel.SuspendLayout();
39 | ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit();
40 | this.SuspendLayout();
41 | //
42 | // FilePanel
43 | //
44 | this.FilePanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
45 | this.FilePanel.Controls.Add(this.FileList);
46 | this.FilePanel.Controls.Add(this.ScrollBar);
47 | this.FilePanel.Location = new System.Drawing.Point(3, 31);
48 | this.FilePanel.Name = "FilePanel";
49 | this.FilePanel.Size = new System.Drawing.Size(586, 260);
50 | this.FilePanel.TabIndex = 0;
51 | //
52 | // FileList
53 | //
54 | this.FileList.Location = new System.Drawing.Point(3, 0);
55 | this.FileList.Name = "FileList";
56 | this.FileList.Size = new System.Drawing.Size(564, 307);
57 | this.FileList.TabIndex = 1;
58 | //
59 | // ScrollBar
60 | //
61 | this.ScrollBar.Dock = System.Windows.Forms.DockStyle.Right;
62 | this.ScrollBar.Location = new System.Drawing.Point(567, 0);
63 | this.ScrollBar.Name = "ScrollBar";
64 | this.ScrollBar.Size = new System.Drawing.Size(17, 258);
65 | this.ScrollBar.TabIndex = 0;
66 | //
67 | // ImportProjectFiles
68 | //
69 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
70 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
71 | this.Controls.Add(this.FilePanel);
72 | this.Name = "ImportProjectFiles";
73 | this.Size = new System.Drawing.Size(592, 309);
74 | this.FilePanel.ResumeLayout(false);
75 | ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit();
76 | this.ResumeLayout(false);
77 |
78 | }
79 |
80 | #endregion
81 |
82 | private Panel FilePanel;
83 | private BindingSource bindingSource1;
84 | private VScrollBar ScrollBar;
85 | private Panel FileList;
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/Brewmaster/ProjectWizard/ImportProjectFiles.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 | using Brewmaster.ProjectModel;
6 |
7 | namespace Brewmaster.ProjectWizard
8 | {
9 | public partial class ImportProjectFiles : WizardStep
10 | {
11 | private AsmProject _project;
12 | private readonly List _fileControls = new List();
13 | private int _focusControl = -1;
14 | private ImportFile.FocusType _focusType = ImportFile.FocusType.None;
15 | private int _firstIndex;
16 |
17 | public override event Action ValidChanged;
18 |
19 | public ImportProjectFiles()
20 | {
21 | InitializeComponent();
22 | ScrollBar.Scroll += (sender, args) =>
23 | {
24 | RefreshScroll(args.NewValue);
25 | };
26 | FileList.MouseWheel += (sender, args) =>
27 | {
28 | ScrollBar.Value = Math.Max(0, Math.Min(ScrollBar.Maximum, ScrollBar.Value - (args.Delta / 20)));
29 | RefreshScroll(ScrollBar.Value);
30 | };
31 | for (var i = 0; i < 12; i++)
32 | {
33 | var fileControl = new ImportFile {Dock = DockStyle.Top};
34 | FileList.Controls.Add(fileControl);
35 | _fileControls.Insert(0, fileControl);
36 | }
37 | }
38 |
39 | private void RefreshScroll(int scrollAmount)
40 | {
41 |
42 | var oldIndex = _firstIndex;
43 | _firstIndex = scrollAmount / 6;
44 |
45 | for (var i = 0; i < 12; i++)
46 | {
47 | if (_fileControls[i].ContainsFocus)
48 | {
49 | _focusControl = oldIndex + i;
50 | _focusType = _fileControls[i].GetFocus();
51 | }
52 |
53 | }
54 |
55 | FileList.Top = (scrollAmount % 6) * -4;
56 | ScrollBar.Focus();
57 |
58 | for (var i = 0; i < 12; i++)
59 | {
60 | if (i + _firstIndex >= ImportSettings.Count)
61 | {
62 | _fileControls[i].Visible = false;
63 | }
64 | else
65 | {
66 | _fileControls[i].Visible = true;
67 | _fileControls[i].File = ImportSettings[i + _firstIndex];
68 | if (_focusControl == i + _firstIndex) _fileControls[i].Focus(_focusType);
69 | }
70 | }
71 | }
72 |
73 | public AsmProject Project
74 | {
75 | set
76 | {
77 | _project = value;
78 | ImportSettings = value.Files.Select(f => new FileImportInfo(f)).ToList();
79 |
80 | ScrollBar.Minimum = 0;
81 | ScrollBar.Maximum = Math.Max(0, (value.Files.Count - 5) * 6);
82 | ScrollBar.Value = 0;
83 | RefreshScroll(0);
84 | }
85 | }
86 |
87 | public List ImportSettings { get; set; }
88 |
89 | public class FileImportInfo
90 | {
91 | public AsmProjectFile ProjectFile { get; }
92 | public bool IncludeInProject { get; set; }
93 |
94 | public FileImportInfo(AsmProjectFile projectFile)
95 | {
96 | ProjectFile = projectFile;
97 | IncludeInProject = true;
98 |
99 | if (projectFile.GetRelativePath().StartsWith("bin/")) IncludeInProject = false;
100 | if (projectFile.File.Name.StartsWith(".")) IncludeInProject = false;
101 | if (projectFile.File.Extension == ".nes") IncludeInProject = false;
102 | }
103 | }
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/Brewmaster/ProjectWizard/ImportProjectPath.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Windows.Forms;
7 | using Brewmaster.ProjectModel;
8 |
9 | namespace Brewmaster.ProjectWizard
10 | {
11 | public partial class ImportProjectPath : WizardStep
12 | {
13 | private bool _projectNameChanged;
14 | public override event Action ValidChanged;
15 |
16 | public string Directory
17 | {
18 | get { return _projectDirectory.Text; }
19 | set { _projectDirectory.Text = value; }
20 | }
21 |
22 | public string ProjectName
23 | {
24 | get { return _projectName.Text; }
25 | set { _projectName.Text = value; }
26 | }
27 | public string ProjectFile
28 | {
29 | get { return _projectPathPreview.Text; }
30 | set { _projectPathPreview.Text = value; }
31 | }
32 |
33 | public ImportProjectPath()
34 | {
35 | InitializeComponent();
36 | }
37 |
38 | private void _projectName_TextChanged(object sender, EventArgs e)
39 | {
40 | _projectNameChanged = true;
41 | RefreshPreviewText();
42 | }
43 |
44 | public static readonly IEnumerable InvalidPathChars = Path.GetInvalidPathChars().Union(Path.GetInvalidFileNameChars()).Except(new [] {'\\', '/' });
45 | public static readonly IEnumerable InvalidFileChars = Path.GetInvalidFileNameChars();
46 |
47 | private void RefreshPreviewText()
48 | {
49 | var valid = GetFilePath(out var path);
50 |
51 | _projectPathPreview.ForeColor = valid ? SystemColors.ControlText : Color.Red;
52 | _projectPathPreview.Text = path;
53 |
54 | if (valid == Valid) return;
55 | Valid = valid;
56 | if (ValidChanged != null) ValidChanged();
57 | }
58 |
59 | private bool GetFilePath(out string path)
60 | {
61 | string error = null;
62 | var filename = _projectName.Text;
63 | foreach (var character in InvalidFileChars) filename = filename.Replace(character.ToString(), "");
64 | if (string.IsNullOrWhiteSpace(filename)) error = "Invalid project name";
65 |
66 | try
67 | {
68 | if (!new DirectoryInfo(_projectDirectory.Text).Exists) error = "Directory does not exist";
69 | }
70 | catch
71 | {
72 | error = "Directory does not exist";
73 | }
74 |
75 | filename = filename.Trim();
76 |
77 | path = error ??
78 | new DirectoryInfo(Path.Combine(
79 | _projectDirectory.Text,
80 | filename + ".bwm")).FullName;
81 |
82 | return error == null;
83 | }
84 |
85 | private void _projectDirectory_TextChanged(object sender, EventArgs e)
86 | {
87 | if ((!_projectNameChanged || string.IsNullOrWhiteSpace(_projectName.Text)) && !string.IsNullOrWhiteSpace(_projectDirectory.Text))
88 | {
89 | var dirs = _projectDirectory.Text.Split(new[] {'\\', '/'}, StringSplitOptions.RemoveEmptyEntries);
90 | if (dirs.Length > 0)
91 | {
92 | _projectName.Text = dirs.Last().Trim();
93 | _projectNameChanged = false;
94 | }
95 | }
96 | RefreshPreviewText();
97 | }
98 |
99 | private void _browseProjectPath_Click(object sender, EventArgs e)
100 | {
101 | using (var dialog = new FolderBrowserDialog())
102 | {
103 | dialog.ShowNewFolderButton = false;
104 | dialog.SelectedPath = _projectDirectory.Text;
105 | if (dialog.ShowDialog(this) == DialogResult.OK) _projectDirectory.Text = dialog.SelectedPath;
106 | }
107 | }
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/Brewmaster/ProjectWizard/NewProject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Brewmaster.ProjectModel;
3 |
4 | namespace Brewmaster.ProjectWizard
5 | {
6 | public class NewProject : WizardDialog
7 | {
8 | private NewProjectPath _newProjectPath;
9 | private ProjectTemplates _projectTemplates;
10 | public AsmProject Project { get; set; }
11 | public ProjectType ProjectType
12 | {
13 | get { return _newProjectPath.ProjectType; }
14 | private set { _newProjectPath.ProjectType = value; }
15 | }
16 |
17 | public NewProject(Settings.Settings settings, ProjectType projectType) : base(settings)
18 | {
19 | _newProjectPath = new NewProjectPath();
20 | _projectTemplates = new ProjectTemplates();
21 |
22 | ProjectType = projectType;
23 | _newProjectPath.Directory =
24 | string.IsNullOrWhiteSpace(Settings.DefaultProjectDirectory)
25 | ? Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
26 | : Settings.DefaultProjectDirectory;
27 |
28 | AddSteps(_newProjectPath, _projectTemplates);
29 | }
30 |
31 | protected override void Save()
32 | {
33 | Settings.DefaultProjectDirectory = _newProjectPath.Directory;
34 | Settings.Save();
35 | }
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/Brewmaster/ProjectWizard/NewProjectPath.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Windows.Forms;
7 | using Brewmaster.ProjectModel;
8 |
9 | namespace Brewmaster.ProjectWizard
10 | {
11 | public partial class NewProjectPath : WizardStep
12 | {
13 | private bool _folderNameChanged;
14 | public override event Action ValidChanged;
15 |
16 | public ProjectType ProjectType
17 | {
18 | get { return _snesProjectOption.Checked ? ProjectType.Nes : ProjectType.Snes; }
19 | set
20 | {
21 | _nesProjectOption.Checked = value == ProjectType.Nes;
22 | _snesProjectOption.Checked = value == ProjectType.Snes;
23 | }
24 | }
25 |
26 | public string Directory
27 | {
28 | get { return _projectDirectory.Text; }
29 | set { _projectDirectory.Text = value; }
30 | }
31 |
32 | public NewProjectPath()
33 | {
34 | InitializeComponent();
35 | }
36 |
37 | private void _nesImage_Click(object sender, MouseEventArgs e)
38 | {
39 | _nesProjectOption.PerformClick();
40 | }
41 |
42 | private void _snesImage_Click(object sender, MouseEventArgs e)
43 | {
44 | _snesProjectOption.PerformClick();
45 | }
46 |
47 | private void _projectName_TextChanged(object sender, EventArgs e)
48 | {
49 | if (!_folderNameChanged)
50 | {
51 | _projectFolderName.Text = _projectName.Text;
52 | _folderNameChanged = false;
53 | }
54 | }
55 |
56 | private void _projectFolderName_TextChanged(object sender, EventArgs e)
57 | {
58 | _folderNameChanged = true;
59 | RefreshPreviewText();
60 | }
61 |
62 | public static readonly IEnumerable InvalidPathChars = Path.GetInvalidPathChars().Union(Path.GetInvalidFileNameChars()).Except(new [] {'\\', '/' });
63 | public static readonly IEnumerable InvalidFileChars = Path.GetInvalidFileNameChars();
64 |
65 | private void RefreshPreviewText()
66 | {
67 | var valid = GetFilePath(out var path);
68 |
69 | _projectPathPreview.ForeColor = valid ? SystemColors.ControlText : Color.Red;
70 | _projectPathPreview.Text = path;
71 |
72 | if (valid == Valid) return;
73 | Valid = valid;
74 | if (ValidChanged != null) ValidChanged();
75 | }
76 |
77 | private bool GetFilePath(out string path)
78 | {
79 | string error = null;
80 | var filename = _projectName.Text;
81 | foreach (var character in InvalidFileChars) filename = filename.Replace(character.ToString(), "");
82 | if (string.IsNullOrWhiteSpace(filename)) error = "Invalid project name";
83 |
84 | var folderName = _projectFolderName.Text;
85 | foreach (var character in InvalidPathChars) if (folderName.Contains(character)) error = "Invalid characters in folder name";
86 |
87 | try
88 | {
89 | if (!new DirectoryInfo(_projectDirectory.Text).Exists) error = "Directory does not exist";
90 | }
91 | catch
92 | {
93 | error = "Directory does not exist";
94 | }
95 |
96 | filename = filename.Trim();
97 | folderName = folderName.Trim();
98 |
99 | path = error ??
100 | new DirectoryInfo(Path.Combine(
101 | _projectDirectory.Text,
102 | folderName,
103 | filename + ".bwm")).FullName;
104 |
105 | return error == null;
106 | }
107 |
108 | private void _projectDirectory_TextChanged(object sender, EventArgs e)
109 | {
110 | RefreshPreviewText();
111 | }
112 |
113 | private void _browseProjectPath_Click(object sender, EventArgs e)
114 | {
115 | using (var dialog = new FolderBrowserDialog())
116 | {
117 | dialog.ShowNewFolderButton = false;
118 | dialog.SelectedPath = _projectDirectory.Text;
119 | if (dialog.ShowDialog(this) == DialogResult.OK) _projectDirectory.Text = dialog.SelectedPath;
120 | }
121 | }
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/Brewmaster/ProjectWizard/ProjectTemplates.Designer.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace Brewmaster.ProjectWizard
4 | {
5 | partial class ProjectTemplates
6 | {
7 | ///
8 | /// Required designer variable.
9 | ///
10 | private System.ComponentModel.IContainer components = null;
11 |
12 | ///
13 | /// Clean up any resources being used.
14 | ///
15 | /// true if managed resources should be disposed; otherwise, false.
16 | protected override void Dispose(bool disposing)
17 | {
18 | if (disposing && (components != null))
19 | {
20 | components.Dispose();
21 | }
22 | base.Dispose(disposing);
23 | }
24 |
25 | #region Component Designer generated code
26 |
27 | ///
28 | /// Required method for Designer support - do not modify
29 | /// the contents of this method with the code editor.
30 | ///
31 | private void InitializeComponent()
32 | {
33 | this.checkedListBox1 = new System.Windows.Forms.CheckedListBox();
34 | this.SuspendLayout();
35 | //
36 | // checkedListBox1
37 | //
38 | this.checkedListBox1.FormattingEnabled = true;
39 | this.checkedListBox1.Items.AddRange(new object[] {
40 | "LoROM Base",
41 | "SNES Include File",
42 | "VRAM copy routines",
43 | "\"Hello World\" example",
44 | "Basic movement example"});
45 | this.checkedListBox1.Location = new System.Drawing.Point(432, 3);
46 | this.checkedListBox1.Name = "checkedListBox1";
47 | this.checkedListBox1.Size = new System.Drawing.Size(157, 304);
48 | this.checkedListBox1.TabIndex = 0;
49 | //
50 | // ProjectTemplates
51 | //
52 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
53 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
54 | this.Controls.Add(this.checkedListBox1);
55 | this.Name = "ProjectTemplates";
56 | this.Size = new System.Drawing.Size(592, 309);
57 | this.ResumeLayout(false);
58 |
59 | }
60 |
61 | #endregion
62 |
63 | private CheckedListBox checkedListBox1;
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/Brewmaster/ProjectWizard/ProjectTemplates.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Windows.Forms;
7 | using Brewmaster.ProjectModel;
8 |
9 | namespace Brewmaster.ProjectWizard
10 | {
11 | public partial class ProjectTemplates: WizardStep
12 | {
13 | private bool _folderNameChanged;
14 | public override event Action ValidChanged;
15 |
16 | public ProjectTemplates()
17 | {
18 | InitializeComponent();
19 | }
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Brewmaster/ProjectWizard/WizardDialog.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Brewmaster.ProjectWizard
2 | {
3 | partial class WizardDialog
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.StepPanel = new System.Windows.Forms.Panel();
32 | this._finishButton = new System.Windows.Forms.Button();
33 | this._nextButton = new System.Windows.Forms.Button();
34 | this._previousButton = new System.Windows.Forms.Button();
35 | this._cancelButton = new System.Windows.Forms.Button();
36 | this.SuspendLayout();
37 | //
38 | // StepPanel
39 | //
40 | this.StepPanel.Location = new System.Drawing.Point(12, 12);
41 | this.StepPanel.Name = "StepPanel";
42 | this.StepPanel.Size = new System.Drawing.Size(592, 299);
43 | this.StepPanel.TabIndex = 1;
44 | //
45 | // _finishButton
46 | //
47 | this._finishButton.Enabled = false;
48 | this._finishButton.Location = new System.Drawing.Point(448, 340);
49 | this._finishButton.Name = "_finishButton";
50 | this._finishButton.Size = new System.Drawing.Size(75, 23);
51 | this._finishButton.TabIndex = 2;
52 | this._finishButton.Text = "Finish >>";
53 | this._finishButton.UseVisualStyleBackColor = true;
54 | this._finishButton.Click += new System.EventHandler(this._finishButton_Click);
55 | //
56 | // _nextButton
57 | //
58 | this._nextButton.Enabled = false;
59 | this._nextButton.Location = new System.Drawing.Point(367, 340);
60 | this._nextButton.Name = "_nextButton";
61 | this._nextButton.Size = new System.Drawing.Size(75, 23);
62 | this._nextButton.TabIndex = 3;
63 | this._nextButton.Text = "Next >";
64 | this._nextButton.UseVisualStyleBackColor = true;
65 | this._nextButton.Click += new System.EventHandler(this._nextButton_Click);
66 | //
67 | // _previousButton
68 | //
69 | this._previousButton.Enabled = false;
70 | this._previousButton.Location = new System.Drawing.Point(286, 340);
71 | this._previousButton.Name = "_previousButton";
72 | this._previousButton.Size = new System.Drawing.Size(75, 23);
73 | this._previousButton.TabIndex = 4;
74 | this._previousButton.Text = "< Back";
75 | this._previousButton.UseVisualStyleBackColor = true;
76 | this._previousButton.Click += new System.EventHandler(this._previousButton_Click);
77 | //
78 | // _cancelButton
79 | //
80 | this._cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
81 | this._cancelButton.Location = new System.Drawing.Point(529, 340);
82 | this._cancelButton.Name = "_cancelButton";
83 | this._cancelButton.Size = new System.Drawing.Size(75, 23);
84 | this._cancelButton.TabIndex = 6;
85 | this._cancelButton.Text = "Cancel";
86 | this._cancelButton.UseVisualStyleBackColor = true;
87 | //
88 | // WizardDialog
89 | //
90 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
91 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
92 | this.CancelButton = this._cancelButton;
93 | this.ClientSize = new System.Drawing.Size(616, 375);
94 | this.Controls.Add(this._cancelButton);
95 | this.Controls.Add(this._previousButton);
96 | this.Controls.Add(this._nextButton);
97 | this.Controls.Add(this._finishButton);
98 | this.Controls.Add(this.StepPanel);
99 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
100 | this.Name = "WizardDialog";
101 | this.ShowIcon = false;
102 | this.ShowInTaskbar = false;
103 | this.Text = "New Project";
104 | this.ResumeLayout(false);
105 |
106 | }
107 |
108 | #endregion
109 | private System.Windows.Forms.Panel StepPanel;
110 | private System.Windows.Forms.Button _finishButton;
111 | private System.Windows.Forms.Button _nextButton;
112 | private System.Windows.Forms.Button _previousButton;
113 | private System.Windows.Forms.Button _cancelButton;
114 | }
115 | }
--------------------------------------------------------------------------------
/Brewmaster/ProjectWizard/WizardDialog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 |
6 | namespace Brewmaster.ProjectWizard
7 | {
8 | public partial class WizardDialog : Form
9 | {
10 | protected readonly Settings.Settings Settings;
11 |
12 | public WizardDialog(Settings.Settings settings)
13 | {
14 | Settings = settings;
15 | InitializeComponent();
16 |
17 | Steps = new List();
18 | }
19 |
20 | protected void AddSteps(params WizardStep[] steps)
21 | {
22 | foreach (var step in steps)
23 | {
24 | step.Visible = false;
25 | StepPanel.Controls.Add(step);
26 | Steps.Add(step);
27 | step.ValidChanged += UpdateButtons;
28 | }
29 | Step = 0;
30 | DisplayStep();
31 | }
32 |
33 | protected void UpdateButtons()
34 | {
35 | _previousButton.Enabled = Step > 0;
36 | _nextButton.Enabled = Steps[Step].Valid && Step < (Steps.Count - 1);
37 | _finishButton.Enabled = Steps.All(s => s.Valid);
38 | }
39 |
40 | protected void DisplayStep()
41 | {
42 | if (Step < 0) Step = 0;
43 | if (Step > Steps.Count - 1) Step = Steps.Count - 1;
44 |
45 | SuspendLayout();
46 | for (var i = 0; i < Steps.Count; i++)
47 | {
48 | if (i == Step && !Steps[i].Visible)
49 | {
50 | Steps[i].Visible = true;
51 | Steps[i].OnEnable();
52 | }
53 | else Steps[i].Visible = false;
54 | }
55 |
56 | UpdateButtons();
57 | ResumeLayout();
58 | }
59 |
60 | public int Step { get; set; }
61 | public List Steps { get; set; }
62 |
63 |
64 | private void _finishButton_Click(object sender, EventArgs e)
65 | {
66 | Save();
67 | }
68 |
69 | protected virtual void Save()
70 | {
71 |
72 | }
73 |
74 | private void _nextButton_Click(object sender, EventArgs e)
75 | {
76 | ChangeStep(Step + 1);
77 | }
78 |
79 | protected virtual void ChangeStep(int step)
80 | {
81 | Step = step;
82 | DisplayStep();
83 | }
84 |
85 | private void _previousButton_Click(object sender, EventArgs e)
86 | {
87 | ChangeStep(Step - 1);
88 | }
89 | }
90 |
91 |
92 | public class WizardStep : UserControl
93 | {
94 | public virtual event Action ValidChanged;
95 | public bool Valid { get; protected set; }
96 |
97 | public virtual void OnEnable() { }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/Brewmaster/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using System.Resources;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("Brewmaster")]
10 | [assembly: AssemblyDescription("Assembly IDE for NES/SNES/ca65 projects")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("Brewmaster")]
14 | [assembly: AssemblyCopyright("Copyright © 2019-2020")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Setting ComVisible to false makes the types in this assembly not visible
19 | // to COM components. If you need to access a type in this assembly from
20 | // COM, set the ComVisible attribute to true on that type.
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 | [assembly: Guid("4ae63645-9db4-4390-a409-c6cd6e84521a")]
25 |
26 | // Version information for an assembly consists of the following four values:
27 | //
28 | // Major Version
29 | // Minor Version
30 | // Build Number
31 | // Revision
32 | //
33 | // You can specify all the values or you can default the Build and Revision Numbers
34 | // by using the '*' as shown below:
35 | // [assembly: AssemblyVersion("1.0.*")]
36 | [assembly: AssemblyVersion("0.1.0")]
37 | [assembly: NeutralResourcesLanguage("en-US")]
38 |
--------------------------------------------------------------------------------
/Brewmaster/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Brewmaster.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Brewmaster/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Brewmaster/Properties/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
54 |
--------------------------------------------------------------------------------
/Brewmaster/Resources/Files/cartridge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Files/cartridge.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Files/chip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Files/chip.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Files/data.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Files/data.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Files/file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Files/file.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Files/file_config.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Files/file_config.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Files/file_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Files/file_image.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Files/file_text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Files/file_text.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Files/folder-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Files/folder-dark.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Files/folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Files/folder.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Files/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Files/image.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Files/nesproject.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Files/nesproject.ico
--------------------------------------------------------------------------------
/Brewmaster/Resources/Files/nesproject.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Files/nesproject.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Files/snesproject.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Files/snesproject.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Files/text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Files/text.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Other/ca65icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Other/ca65icon.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Other/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Other/close.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Other/collapsed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Other/collapsed.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Other/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Other/error.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Other/expanded.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Other/expanded.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Other/label.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Other/label.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Other/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Other/logo.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Other/macro.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Other/macro.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Other/opcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Other/opcode.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Other/smallload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Other/smallload.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Other/smallsave.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Other/smallsave.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Other/warning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Other/warning.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/build.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/build.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/build2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/build2.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/build3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/build3.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/buildrun.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/buildrun.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/config.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/config.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/copy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/copy.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/cut.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/cut.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/new.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/open.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/paste.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/paste.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/pause.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/redo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/redo.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/restart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/restart.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/run.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/run.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/save-all.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/save-all.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/save.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/save.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/settings.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/step out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/step out.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/step.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/step.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/stepback.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/stepback.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/stepover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/stepover.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/stop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/stop.png
--------------------------------------------------------------------------------
/Brewmaster/Resources/Toolbar/undo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Resources/Toolbar/undo.png
--------------------------------------------------------------------------------
/Brewmaster/Settings/ButtonAssignment.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Globalization;
4 | using System.Windows.Forms;
5 | using Brewmaster.Emulation;
6 |
7 | namespace Brewmaster.Settings
8 | {
9 | public class ButtonAssignment : Form, IMessageFilter
10 | {
11 | public ButtonAssignment(bool shortcut)
12 | {
13 | _emulator = new NesEmulatorHandler(this);
14 | _shortcut = shortcut;
15 | InitializeComponent();
16 | }
17 |
18 | private bool _shortcut;
19 | public Keys KeyboardInput { get; private set; }
20 | public int KeyCode { get; private set; }
21 | public string ButtonName { get; private set; }
22 | public Timer Timer { get; private set; }
23 |
24 | protected override void OnLoad(EventArgs e)
25 | {
26 | base.OnLoad(e);
27 | if (!_shortcut)
28 | {
29 | Application.AddMessageFilter(this);
30 | Timer = new Timer {Interval = 10};
31 | Timer.Tick += (s, a) => CheckEmulatorInput();
32 | Timer.Start();
33 |
34 | NesEmulatorHandler.InitiateInputCheck();
35 | }
36 | }
37 |
38 | protected override void OnClosing(CancelEventArgs e)
39 | {
40 | if (!_shortcut)
41 | {
42 | Application.RemoveMessageFilter(this);
43 | Timer.Stop();
44 | Timer.Dispose();
45 | NesEmulatorHandler.EndInputCheck();
46 | }
47 |
48 | base.OnClosing(e);
49 | }
50 | protected void CheckEmulatorInput()
51 | {
52 | var button = NesEmulatorHandler.GetCurrentInput();
53 | if (button == null) return;
54 | KeyCode = (int)button.Item1;
55 | ButtonName = button.Item2;
56 | Close();
57 | }
58 |
59 | protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
60 | {
61 | if (!_shortcut) return false;
62 |
63 | if (keyData == Keys.Escape)
64 | {
65 | Close();
66 | return true;
67 | }
68 |
69 | var pressedKey = keyData & Keys.KeyCode;
70 | if (pressedKey == Keys.ShiftKey
71 | || pressedKey == Keys.ControlKey
72 | || pressedKey == Keys.LWin
73 | || pressedKey == Keys.RWin
74 | || pressedKey == Keys.Menu) return true;
75 |
76 | try
77 | {
78 | testMenu.ShortcutKeys = keyData;
79 | }
80 | catch (InvalidEnumArgumentException)
81 | {
82 | return true;
83 | }
84 |
85 | KeyboardInput = keyData;
86 | Close();
87 | return true;
88 | }
89 |
90 | public static string GetString(object keys)
91 | {
92 | return new KeysConverter().ConvertTo(null, CultureInfo.CurrentUICulture, keys, typeof(string))?.ToString()
93 | .Replace("Oemcomma", ",")
94 | .Replace("OemPeriod", ".")
95 | .Replace("Oem", "");
96 | }
97 |
98 | private ToolStripMenuItem testMenu = new ToolStripMenuItem("test");
99 | private IEmulatorHandler _emulator;
100 |
101 |
102 | private const int WM_KEYDOWN = 0x100;
103 | private const int WM_KEYUP = 0x101;
104 | private const int WM_SYSKEYDOWN = 0x104;
105 | private const int WM_SYSKEYUP = 0x105;
106 |
107 | public bool PreFilterMessage(ref Message m)
108 | {
109 |
110 | var scanCode = (Int32)(((Int64)m.LParam & 0x1FF0000) >> 16);
111 | if (m.Msg == WM_KEYUP || m.Msg == WM_SYSKEYUP)
112 | {
113 | _emulator.SetKeyState(scanCode, false);
114 | }
115 | else if (ContainsFocus && (m.Msg == WM_SYSKEYDOWN || m.Msg == WM_KEYDOWN))
116 | {
117 | _emulator.SetKeyState(scanCode, true);
118 | }
119 | return false;
120 | }
121 |
122 |
123 | private void InitializeComponent()
124 | {
125 | System.Windows.Forms.Label label1;
126 | label1 = new System.Windows.Forms.Label();
127 | this.SuspendLayout();
128 | //
129 | // label1
130 | //
131 | label1.AutoSize = true;
132 | label1.Location = new System.Drawing.Point(66, 57);
133 | label1.Name = "label1";
134 | label1.Size = new System.Drawing.Size(105, 13);
135 | label1.TabIndex = 0;
136 | label1.Text = "Press key(s) to use...";
137 | //
138 | // ButtonAssignment
139 | //
140 | this.ClientSize = new System.Drawing.Size(231, 140);
141 | this.ControlBox = false;
142 | this.Controls.Add(label1);
143 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
144 | this.MaximizeBox = false;
145 | this.MinimizeBox = false;
146 | this.Name = "ButtonAssignment";
147 | this.ShowIcon = false;
148 | this.ShowInTaskbar = false;
149 | this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
150 | this.ResumeLayout(false);
151 | this.PerformLayout();
152 | }
153 | }
154 | }
--------------------------------------------------------------------------------
/Brewmaster/Settings/KeyBindingSettings.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Windows.Forms;
3 | using Brewmaster.Emulation;
4 |
5 | namespace Brewmaster.Settings
6 | {
7 | public class KeyBindingSettings : Control
8 | {
9 | public KeyBindingSettings()
10 | {
11 | }
12 |
13 | public List Mappings { get; private set; }
14 |
15 | public void SetMappings(List mappings)
16 | {
17 | Mappings = mappings;
18 | SuspendLayout();
19 | Controls.Clear();
20 | foreach (var mapping in mappings)
21 | {
22 | var panel = new Panel();
23 | panel.Dock = DockStyle.Top;
24 | panel.Height = 25;
25 |
26 | var button = new Button();
27 | button.Text = mapping.Name;
28 | button.Size = new System.Drawing.Size(75, 23);
29 | button.UseVisualStyleBackColor = true;
30 |
31 | panel.Controls.Add(button);
32 |
33 | var label = new Label();
34 | label.Location = new System.Drawing.Point(80, 5);
35 | label.Text = mapping.MappedToName ?? NesEmulatorHandler.GetInputName(mapping.MappedTo);
36 |
37 | panel.Controls.Add(label);
38 | button.Click += (s, a) =>
39 | {
40 | using (var keyAssignDialog = new ButtonAssignment(false))
41 | {
42 | keyAssignDialog.StartPosition = FormStartPosition.CenterParent;
43 | keyAssignDialog.ShowDialog(this);
44 | mapping.MappedTo = keyAssignDialog.KeyCode;
45 | mapping.MappedToName = keyAssignDialog.ButtonName;
46 | }
47 | label.Text = mapping.MappedToName ?? NesEmulatorHandler.GetInputName(mapping.MappedTo);
48 | SelectNextControl(button, true, false, true, true);
49 | };
50 |
51 | Controls.Add(panel);
52 | Controls.SetChildIndex(panel, 0);
53 | }
54 | ResumeLayout();
55 | }
56 |
57 | protected override void OnLayout(LayoutEventArgs a)
58 | {
59 | base.OnLayout(a);
60 | if (Controls.Count == 0) return;
61 | Height = Controls[0].Top + Controls[0].Height;
62 | Parent.PerformLayout(this, "Height");
63 | }
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/Brewmaster/Settings/KeyBindingWindow.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace Brewmaster.Settings
4 | {
5 | public class KeyBindingWindow : Form
6 | {
7 | private Button _cancelButton;
8 | private Button _okButton;
9 | public KeyBindingSettings KeyBindingSettings;
10 |
11 | public KeyBindingWindow()
12 | {
13 | InitializeComponent();
14 | }
15 |
16 | private void InitializeComponent()
17 | {
18 | this._cancelButton = new System.Windows.Forms.Button();
19 | this._okButton = new System.Windows.Forms.Button();
20 | this.KeyBindingSettings = new Brewmaster.Settings.KeyBindingSettings();
21 | this.SuspendLayout();
22 | //
23 | // _cancelButton
24 | //
25 | this._cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
26 | this._cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
27 | this._cancelButton.Location = new System.Drawing.Point(163, 365);
28 | this._cancelButton.Name = "_cancelButton";
29 | this._cancelButton.Size = new System.Drawing.Size(75, 23);
30 | this._cancelButton.TabIndex = 1;
31 | this._cancelButton.Text = "Cancel";
32 | this._cancelButton.UseVisualStyleBackColor = true;
33 | //
34 | // _okButton
35 | //
36 | this._okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
37 | this._okButton.Location = new System.Drawing.Point(82, 365);
38 | this._okButton.Name = "_okButton";
39 | this._okButton.Size = new System.Drawing.Size(75, 23);
40 | this._okButton.TabIndex = 2;
41 | this._okButton.Text = "OK";
42 | this._okButton.UseVisualStyleBackColor = true;
43 | this._okButton.Click += new System.EventHandler(this._okButton_Click);
44 | //
45 | // KeyBindingSettings
46 | //
47 | this.KeyBindingSettings.Location = new System.Drawing.Point(7, 9);
48 | this.KeyBindingSettings.Name = "KeyBindingSettings";
49 | this.KeyBindingSettings.Size = new System.Drawing.Size(227, 321);
50 | this.KeyBindingSettings.TabIndex = 0;
51 | this.KeyBindingSettings.Text = "keyBindingSettings1";
52 | //
53 | // KeyBindingWindow
54 | //
55 | this.AcceptButton = this._okButton;
56 | this.CancelButton = this._cancelButton;
57 | this.ClientSize = new System.Drawing.Size(250, 400);
58 | this.Controls.Add(this._okButton);
59 | this.Controls.Add(this._cancelButton);
60 | this.Controls.Add(this.KeyBindingSettings);
61 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
62 | this.MaximizeBox = false;
63 | this.MinimizeBox = false;
64 | this.Name = "KeyBindingWindow";
65 | this.ShowIcon = false;
66 | this.ShowInTaskbar = false;
67 | this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
68 | this.Text = "Key bindings";
69 | this.ResumeLayout(false);
70 |
71 | }
72 |
73 | private void _okButton_Click(object sender, System.EventArgs e)
74 | {
75 | DialogResult = DialogResult.OK;
76 | Close();
77 | }
78 |
79 | protected override void OnLayout(LayoutEventArgs levent)
80 | {
81 | base.OnLayout(levent);
82 | Height = KeyBindingSettings.Height + 100;
83 | }
84 | }
85 | }
--------------------------------------------------------------------------------
/Brewmaster/StatusView/ExpandButton.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Forms;
8 |
9 | namespace Brewmaster.StatusView
10 | {
11 | public class ExpandButton : Button
12 | {
13 | private Bitmap _collapsedIcon;
14 | private Bitmap _expandedIcon;
15 | private Panel _expandPanel;
16 |
17 | public Panel ExpandPanel
18 | {
19 | get
20 | {
21 | return _expandPanel;
22 | }
23 | set
24 | {
25 | _expandPanel = value;
26 | if (_expandPanel != null) _expandPanel.Visible = ExpandedState;
27 | }
28 | }
29 |
30 | public string ButtonText { get; set; }
31 | public bool ExpandedState { get; set; }
32 |
33 | public override string Text { get { return ""; } set {} }
34 |
35 | public ExpandButton()
36 | {
37 | _collapsedIcon = new Bitmap(Properties.Resources.collapsed);
38 | _expandedIcon = new Bitmap(Properties.Resources.expanded);
39 | }
40 | protected override bool ShowFocusCues { get { return false; } }
41 | protected override void OnClick(EventArgs e)
42 | {
43 | ExpandedState = !ExpandedState;
44 | if (_expandPanel != null) _expandPanel.Visible = ExpandedState;
45 | base.OnClick(e);
46 | Invalidate();
47 | }
48 |
49 | protected override void OnPaint(PaintEventArgs e)
50 | {
51 | base.OnPaint(e);
52 | e.Graphics.DrawImageUnscaled(ExpandedState ? _expandedIcon : _collapsedIcon, 2, 3);
53 | e.Graphics.DrawString(ButtonText, Font, new SolidBrush(ForeColor), 14, 3);
54 | }
55 |
56 | protected override void Dispose(bool disposing)
57 | {
58 | _collapsedIcon.Dispose();
59 | _expandedIcon.Dispose();
60 | base.Dispose(disposing);
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Brewmaster/StatusView/HorizontalLine.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 |
4 | namespace Brewmaster.StatusView
5 | {
6 | public class HorizontalLine : Control
7 | {
8 | private Color _lineColor = SystemColors.ButtonShadow;
9 | public Color LineColor
10 | {
11 | get { return _lineColor; }
12 | set { _lineColor = value; }
13 | }
14 |
15 | protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
16 | {
17 | base.SetBoundsCore(x, y, width, 1, specified);
18 | }
19 |
20 | protected override void OnPaint(PaintEventArgs e)
21 | {
22 | base.OnPaint(e);
23 | using (var pen = new Pen(_lineColor)) e.Graphics.DrawLine(pen, 0, 0, Width, 0);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Brewmaster/Templates/TemplateModule.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Brewmaster.ProjectModel;
3 |
4 | namespace Brewmaster.Templates
5 | {
6 | public class TemplateModule
7 | {
8 | public ProjectType ProjectType;
9 | public string Name;
10 | public string Directory;
11 | public List Dependencies;
12 | public string InitCode;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Brewmaster/Templates/ftm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/Templates/ftm
--------------------------------------------------------------------------------
/Brewmaster/brewmaster.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/brewmaster.ico
--------------------------------------------------------------------------------
/Brewmaster/cc65/bin/ar65.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/cc65/bin/ar65.exe
--------------------------------------------------------------------------------
/Brewmaster/cc65/bin/ca65.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/cc65/bin/ca65.exe
--------------------------------------------------------------------------------
/Brewmaster/cc65/bin/cc65.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/cc65/bin/cc65.exe
--------------------------------------------------------------------------------
/Brewmaster/cc65/bin/cl65.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/cc65/bin/cl65.exe
--------------------------------------------------------------------------------
/Brewmaster/cc65/bin/co65.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/cc65/bin/co65.exe
--------------------------------------------------------------------------------
/Brewmaster/cc65/bin/da65.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/cc65/bin/da65.exe
--------------------------------------------------------------------------------
/Brewmaster/cc65/bin/grc65.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/cc65/bin/grc65.exe
--------------------------------------------------------------------------------
/Brewmaster/cc65/bin/ld65.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/cc65/bin/ld65.exe
--------------------------------------------------------------------------------
/Brewmaster/cc65/bin/od65.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/cc65/bin/od65.exe
--------------------------------------------------------------------------------
/Brewmaster/cc65/bin/sim65.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/cc65/bin/sim65.exe
--------------------------------------------------------------------------------
/Brewmaster/cc65/bin/sp65.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/cc65/bin/sp65.exe
--------------------------------------------------------------------------------
/Brewmaster/lib/7z.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/lib/7z.dll
--------------------------------------------------------------------------------
/Brewmaster/lib/Mesen-S.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/lib/Mesen-S.dll
--------------------------------------------------------------------------------
/Brewmaster/lib/Mesen/Font.24.spritefont:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/lib/Mesen/Font.24.spritefont
--------------------------------------------------------------------------------
/Brewmaster/lib/Mesen/Font.64.spritefont:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/lib/Mesen/Font.64.spritefont
--------------------------------------------------------------------------------
/Brewmaster/lib/Mesen/PixelFont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/lib/Mesen/PixelFont.ttf
--------------------------------------------------------------------------------
/Brewmaster/lib/MesenCore.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/lib/MesenCore.dll
--------------------------------------------------------------------------------
/Brewmaster/lib/MesenSCore.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/lib/MesenSCore.dll
--------------------------------------------------------------------------------
/Brewmaster/lib/lua51.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/lib/lua51.dll
--------------------------------------------------------------------------------
/Brewmaster/nes.pal:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/nes.pal
--------------------------------------------------------------------------------
/Brewmaster/nesproject.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/Brewmaster/nesproject.ico
--------------------------------------------------------------------------------
/Brewmaster/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Brewmaster/setup.iss:
--------------------------------------------------------------------------------
1 | [Setup]
2 | AppId=brewmaster
3 | AppName=Brewmaster
4 | OutputBaseFilename=BrewmasterSetup
5 | AppVersion={#version}
6 | WizardStyle=modern
7 | DefaultDirName={autopf}\Brewmaster
8 | DefaultGroupName=Brewmaster
9 | UninstallDisplayIcon={app}\Brewmaster.exe
10 | Compression=lzma2
11 | SolidCompression=yes
12 | OutputDir=bin\Installer
13 | PrivilegesRequiredOverridesAllowed=dialog
14 |
15 | [Files]
16 | Source: "bin\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
17 |
18 | [Icons]
19 | Name: "{group}\Brewmaster"; Filename: "{app}\Brewmaster.exe"
20 | Name: "{group}\Uninstall Brewmaster"; Filename: "{uninstallexe}"
21 | Name: "{autodesktop}\Brewmaster"; Filename: "{app}\Brewmaster.exe"
22 |
23 | [Run]
24 | Filename: "{app}\Brewmaster.exe"; Description: "Launch Brewmaster now"; Flags: postinstall nowait skipifsilent
25 |
--------------------------------------------------------------------------------
/CleanUp.ruleset:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Ide.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.28010.2046
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Brewmaster IDE", "Brewmaster\Brewmaster IDE.csproj", "{25A34560-1B49-4408-B5B8-B6441A25AB9A}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Debug|x64 = Debug|x64
12 | Debug|x86 = Debug|x86
13 | Release|Any CPU = Release|Any CPU
14 | Release|x64 = Release|x64
15 | Release|x86 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {25A34560-1B49-4408-B5B8-B6441A25AB9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {25A34560-1B49-4408-B5B8-B6441A25AB9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {25A34560-1B49-4408-B5B8-B6441A25AB9A}.Debug|x64.ActiveCfg = Debug|x64
21 | {25A34560-1B49-4408-B5B8-B6441A25AB9A}.Debug|x64.Build.0 = Debug|x64
22 | {25A34560-1B49-4408-B5B8-B6441A25AB9A}.Debug|x86.ActiveCfg = Debug|x86
23 | {25A34560-1B49-4408-B5B8-B6441A25AB9A}.Debug|x86.Build.0 = Debug|x86
24 | {25A34560-1B49-4408-B5B8-B6441A25AB9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {25A34560-1B49-4408-B5B8-B6441A25AB9A}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {25A34560-1B49-4408-B5B8-B6441A25AB9A}.Release|x64.ActiveCfg = Release|x64
27 | {25A34560-1B49-4408-B5B8-B6441A25AB9A}.Release|x64.Build.0 = Release|x64
28 | {25A34560-1B49-4408-B5B8-B6441A25AB9A}.Release|x86.ActiveCfg = Release|x86
29 | {25A34560-1B49-4408-B5B8-B6441A25AB9A}.Release|x86.Build.0 = Release|x86
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(ExtensibilityGlobals) = postSolution
35 | SolutionGuid = {09C0023F-FADF-43A4-8733-F9D05B81801C}
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/docs/CNAME:
--------------------------------------------------------------------------------
1 | brewmaster.dev
--------------------------------------------------------------------------------
/docs/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-midnight
2 |
--------------------------------------------------------------------------------
/docs/getting-started.md:
--------------------------------------------------------------------------------
1 | TODO
2 |
--------------------------------------------------------------------------------
/docs/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/docs/logo.png
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/.signature.p7s:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/.signature.p7s
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/HtmlAgilityPack.1.11.23.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/HtmlAgilityPack.1.11.23.nupkg
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/Net35/HtmlAgilityPack.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/Net35/HtmlAgilityPack.dll
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/Net35/HtmlAgilityPack.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/Net35/HtmlAgilityPack.pdb
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/Net40-client/HtmlAgilityPack.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/Net40-client/HtmlAgilityPack.dll
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/Net40-client/HtmlAgilityPack.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/Net40-client/HtmlAgilityPack.pdb
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/Net40/HtmlAgilityPack.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/Net40/HtmlAgilityPack.dll
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/Net40/HtmlAgilityPack.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/Net40/HtmlAgilityPack.pdb
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/Net45/HtmlAgilityPack.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/Net45/HtmlAgilityPack.dll
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/Net45/HtmlAgilityPack.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/Net45/HtmlAgilityPack.pdb
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/NetCore45/HtmlAgilityPack.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/NetCore45/HtmlAgilityPack.dll
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/NetCore45/HtmlAgilityPack.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/NetCore45/HtmlAgilityPack.pdb
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/netstandard1.3/HtmlAgilityPack.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/netstandard1.3/HtmlAgilityPack.dll
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/netstandard1.3/HtmlAgilityPack.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/netstandard1.3/HtmlAgilityPack.pdb
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/netstandard1.6/HtmlAgilityPack.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/netstandard1.6/HtmlAgilityPack.dll
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/netstandard1.6/HtmlAgilityPack.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/netstandard1.6/HtmlAgilityPack.pdb
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/netstandard2.0/HtmlAgilityPack.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/netstandard2.0/HtmlAgilityPack.dll
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/netstandard2.0/HtmlAgilityPack.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/netstandard2.0/HtmlAgilityPack.pdb
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/portable-net45+netcore45+wp8+MonoAndroid+MonoTouch/HtmlAgilityPack.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/portable-net45+netcore45+wp8+MonoAndroid+MonoTouch/HtmlAgilityPack.dll
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/portable-net45+netcore45+wp8+MonoAndroid+MonoTouch/HtmlAgilityPack.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/portable-net45+netcore45+wp8+MonoAndroid+MonoTouch/HtmlAgilityPack.pdb
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/portable-net45+netcore45+wpa81+wp8+MonoAndroid+MonoTouch/HtmlAgilityPack.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/portable-net45+netcore45+wpa81+wp8+MonoAndroid+MonoTouch/HtmlAgilityPack.dll
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/portable-net45+netcore45+wpa81+wp8+MonoAndroid+MonoTouch/HtmlAgilityPack.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/portable-net45+netcore45+wpa81+wp8+MonoAndroid+MonoTouch/HtmlAgilityPack.pdb
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/uap10.0/HtmlAgilityPack.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/uap10.0/HtmlAgilityPack.dll
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/uap10.0/HtmlAgilityPack.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/uap10.0/HtmlAgilityPack.pdb
--------------------------------------------------------------------------------
/packages/HtmlAgilityPack.1.11.23/lib/uap10.0/HtmlAgilityPack.pri:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/HtmlAgilityPack.1.11.23/lib/uap10.0/HtmlAgilityPack.pri
--------------------------------------------------------------------------------
/packages/ICSharpCode.TextEditor.3.2.1.6466/ICSharpCode.TextEditor.3.2.1.6466.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/ICSharpCode.TextEditor.3.2.1.6466/ICSharpCode.TextEditor.3.2.1.6466.nupkg
--------------------------------------------------------------------------------
/packages/ICSharpCode.TextEditor.3.2.1.6466/lib/Net20/ICSharpCode.TextEditor.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sumez/Brewmaster/7b055ca697dbf0021080673adb68c7ba7f9a1a42/packages/ICSharpCode.TextEditor.3.2.1.6466/lib/Net20/ICSharpCode.TextEditor.dll
--------------------------------------------------------------------------------