diff --git a/LICENSE.txt b/LICENSE.txt index 8aa2645..1733de7 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) [year] [fullname] +Copyright (c) 2023 Yellowberry Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/MainForm.cs b/MainForm.cs index dfb4882..0b77bc1 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -13,6 +13,7 @@ using SharpDX.DirectInput; using System.Collections; using System.Linq; using IniParser.Exceptions; +using System.Reflection; namespace WACCALauncher { @@ -27,6 +28,7 @@ namespace WACCALauncher private readonly PrivateFontCollection _fonts = new PrivateFontCollection(); private Label _loadingLabel; + private Label _versionLabel; private Font _menuFont; @@ -259,6 +261,21 @@ namespace WACCALauncher this.Controls.Add(CurrentMenu[_currentMenuItem].label); } + private static void vfd_test() + { + var vfd = new WaccaVFD(); + vfd.Power(true); + vfd.Clear(); + vfd.Brightness(WaccaVFD.bright.BRIGHT_50); + vfd.Cursor(0, 0); + vfd.CanvasShift(0); + vfd.Write("Testing VFD!"); + vfd.Cursor(0, 16); + vfd.ScrollSpeed(2); + vfd.ScrollText(Math.PI.ToString()+" "); + vfd.ScrollStart(); + } + private void Form1_Load(object sender, EventArgs e) { _loadingLabel = new Label(); @@ -275,6 +292,21 @@ namespace WACCALauncher this.Controls.Add(_loadingLabel); + _versionLabel = new Label(); + + _versionLabel.Font = _menuFont; + _versionLabel.ForeColor = Color.FromArgb(50,50,50); + _versionLabel.Location = new Point(458, 1000); + _versionLabel.Name = "versionLabel"; + _versionLabel.Size = new Size(164, 30); + _versionLabel.TabIndex = 0; + _versionLabel.Text = Assembly.GetEntryAssembly().GetName().Version.ToString(); + _versionLabel.TextAlign = ContentAlignment.MiddleCenter; + + Console.WriteLine(_versionLabel.Text); + + this.Controls.Add(_versionLabel); + LoadVersionsFromConfig(); var defVerMenu = new ConfigMenu("default version"); @@ -289,6 +321,10 @@ namespace WACCALauncher MainMenu.Add(new ConfigMenuItem("set default version", ConfigMenuAction.Submenu, submenu: defVerMenu)); + MainMenu.Add(new ConfigMenuItem("test VFD", ConfigMenuAction.Command, method: vfd_test)); + + MainMenu.Add(new ConfigMenuItem("exit to windows", ConfigMenuAction.Command, method: Application.Exit)); + MainMenu.Add(new ConfigMenuItem("launch game", ConfigMenuAction.Return)); _loadingLabel.Font = _menuFont; diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index d476f49..a9c6d6a 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.0.2.0")] -[assembly: AssemblyFileVersion("0.0.2.0")] +[assembly: AssemblyVersion("0.9.0.0")] +[assembly: AssemblyFileVersion("0.9.0.0")] diff --git a/README.md b/README.md index 9176af5..354e630 100644 --- a/README.md +++ b/README.md @@ -1 +1,12 @@ -# WACCALauncher \ No newline at end of file +# WACCA Launcher + +If you can't figure out how to use this, it's probably not for you. + +## Notice + +This code was never intended to be public, as such, it is a dumpster fire. +If you want to help make the code a little less awful, issues and pull requests are welcome. + +## License + +[MIT License](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git a/SetShell.reg b/SetShell.reg new file mode 100644 index 0000000..51437f2 --- /dev/null +++ b/SetShell.reg @@ -0,0 +1,7 @@ +Windows Registry Editor Version 5.00 + +[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot] +"Shell"="USR:Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" + +[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Winlogon] +"Shell"="C:\\WACCA\\WACCALauncher.exe" diff --git a/WACCALauncher.csproj b/WACCALauncher.csproj index 07a157c..fc70ca6 100644 --- a/WACCALauncher.csproj +++ b/WACCALauncher.csproj @@ -66,6 +66,7 @@ + MainForm.cs @@ -91,6 +92,15 @@ True + + + PreserveNewest + + + + + PreserveNewest + diff --git a/WaccaVFD.cs b/WaccaVFD.cs new file mode 100644 index 0000000..e511b68 --- /dev/null +++ b/WaccaVFD.cs @@ -0,0 +1,132 @@ +using System; +using System.Text; +using System.IO.Ports; + +namespace WACCALauncher +{ + class WaccaVFD + { + SerialPort port; + + public WaccaVFD(string portName = "COM2") + { + this.port = new SerialPort(portName, 115200); + port.Open(); + Reset(); + } + + private void VFD_Write(byte number) + { + VFD_Write($"{(char)number}"); + } + + private void VFD_Write(string text) + { + Console.WriteLine(BitConverter.ToString(Encoding.Default.GetBytes(text))); + port.Write(text); + } + + private void VFD_WriteShort(short x) + { + char hi = (char)((x & 0x100) >> 8); + char lo = (char)(x & 0xFF); + VFD_Write($"{hi}{lo}"); + } + + public void Write(string text) + { + VFD_Write(text); + } + + public void Reset() + { + VFD_Write("\x1B\x0B"); + } + + public void Clear() + { + VFD_Write("\x1B\x0C"); + } + + public enum bright { + BRIGHT_0 = 0, + BRIGHT_25 = 1, + BRIGHT_50 = 2, + BRIGHT_75 = 3, + BRIGHT_100 = 4 + } + + public void Brightness(bright brightness) + { + VFD_Write("\x1B\x20" + (char)brightness); + } + + public void Power(bool on) + { + VFD_Write("\x1B\x21" + (on ? "\x01" : "\x00")); + } + + public void CanvasShift(short left) + { + VFD_Write("\x1B\x22"); + VFD_WriteShort(left); + } + + public void Cursor(short left, byte top) + { + VFD_Write("\x1B\x30"); + VFD_WriteShort(left); + VFD_Write(top); + } + + public enum lang { + SIMP_CHINESE, + TRAD_CHINESE, + JAPANESE, + KOREAN + } + + public void Language(lang language) + { + VFD_Write("\x1B\x32" + (char)language); + } + + public enum font_size + { + FONT_16_16, + FONT_6_8 + } + + public void FontSize(font_size size) + { + VFD_Write("\x1B\x33" + (char)size); + } + + public void CreateScrollBox(short left, byte top, short width, byte height) + { + VFD_Write("\x1B\x40"); + VFD_WriteShort(left); + VFD_Write(top); + VFD_WriteShort(width); + VFD_Write(height); + } + + public void ScrollSpeed(byte divisor) + { + VFD_Write("\x1B\x33" + (char)divisor); + } + + public void ScrollText(string text) + { + if (text.Length > 255) throw new ArgumentOutOfRangeException("Text is too long."); + VFD_Write("\x1B\x50"); + VFD_Write((byte)text.Length); + VFD_Write(text); + } + + public void ScrollStart() + { + VFD_Write("\x1B\x51"); + } + } +}