mirror of
https://github.com/YellowberryHN/WACCALauncher
synced 2024-11-23 22:51:01 +01:00
An incredible series of spaghetti code, the movie, the game.
This commit is contained in:
parent
8f3a3a24d6
commit
d7beb37d0a
@ -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
|
||||
|
36
MainForm.cs
36
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;
|
||||
|
@ -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")]
|
||||
|
13
README.md
13
README.md
@ -1 +1,12 @@
|
||||
# WACCALauncher
|
||||
# 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/)
|
7
SetShell.reg
Normal file
7
SetShell.reg
Normal file
@ -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"
|
@ -66,6 +66,7 @@
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="WaccaVFD.cs" />
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@ -91,6 +92,15 @@
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Resources\funny.ttf" />
|
||||
<None Include="README.md" />
|
||||
<None Include="SetShell.reg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="LICENSE.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
132
WaccaVFD.cs
Normal file
132
WaccaVFD.cs
Normal file
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user