mirror of
https://github.com/YellowberryHN/WACCALauncher
synced 2024-11-27 17:00:49 +01:00
Fixed launching as shell, added support for Saturn, updated font
This commit is contained in:
parent
a2035ec8c6
commit
9c91fa3160
83
MainForm.cs
83
MainForm.cs
@ -42,6 +42,7 @@ namespace WACCALauncher
|
|||||||
|
|
||||||
private readonly Process _gameProcess = new Process();
|
private readonly Process _gameProcess = new Process();
|
||||||
private bool _gameRunning = false;
|
private bool _gameRunning = false;
|
||||||
|
public bool AutoLaunch = true;
|
||||||
|
|
||||||
public MenuManager _menuManager;
|
public MenuManager _menuManager;
|
||||||
private VFD _vfd;
|
private VFD _vfd;
|
||||||
@ -90,12 +91,6 @@ namespace WACCALauncher
|
|||||||
_menuFont = new Font(_fonts.Families[0], 22.5F);
|
_menuFont = new Font(_fonts.Families[0], 22.5F);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool[] _buttonStates;
|
|
||||||
private bool[] _lastButtonStates = new bool[4];
|
|
||||||
|
|
||||||
public bool _autoLaunch = true;
|
|
||||||
private int _currentMenuItem;
|
|
||||||
|
|
||||||
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
||||||
{
|
{
|
||||||
if (!_gameRunning)
|
if (!_gameRunning)
|
||||||
@ -105,7 +100,7 @@ namespace WACCALauncher
|
|||||||
else if (keyData == Keys.Enter) { _menuManager.MenuSelect(); return true; }
|
else if (keyData == Keys.Enter) { _menuManager.MenuSelect(); return true; }
|
||||||
else if (keyData == Keys.Escape)
|
else if (keyData == Keys.Escape)
|
||||||
{
|
{
|
||||||
if (_autoLaunch) MenuShow();
|
if (AutoLaunch) MenuShow();
|
||||||
else _menuManager.MenuBack();
|
else _menuManager.MenuBack();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -114,23 +109,8 @@ namespace WACCALauncher
|
|||||||
return base.ProcessCmdKey(ref msg, keyData);
|
return base.ProcessCmdKey(ref msg, keyData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
private bool[] _buttonStates;
|
||||||
private void KeyPressed(object sender, KeyPressEventArgs e)
|
private bool[] _lastButtonStates = new bool[4];
|
||||||
{
|
|
||||||
if (_gameRunning) return;
|
|
||||||
switch ((Keys)e.KeyChar)
|
|
||||||
{
|
|
||||||
case Keys.Escape:
|
|
||||||
if (_autoLaunch) MenuShow();
|
|
||||||
else MenuBack();
|
|
||||||
e.Handled = true;
|
|
||||||
break;
|
|
||||||
case Keys.Enter:
|
|
||||||
MenuSelect();
|
|
||||||
e.Handled = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
private async void Tick(object sender, EventArgs e)
|
private async void Tick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -180,7 +160,7 @@ namespace WACCALauncher
|
|||||||
if (_buttonStates[9] && !_lastButtonStates[9])
|
if (_buttonStates[9] && !_lastButtonStates[9])
|
||||||
{
|
{
|
||||||
Console.WriteLine("test button");
|
Console.WriteLine("test button");
|
||||||
if(_autoLaunch)
|
if(AutoLaunch)
|
||||||
{
|
{
|
||||||
MenuShow();
|
MenuShow();
|
||||||
}
|
}
|
||||||
@ -197,14 +177,17 @@ namespace WACCALauncher
|
|||||||
_loadingLabel.Hide();
|
_loadingLabel.Hide();
|
||||||
menuLabel.Show();
|
menuLabel.Show();
|
||||||
waccaListTest.Visible = waccaListTest.Enabled = true;
|
waccaListTest.Visible = waccaListTest.Enabled = true;
|
||||||
_autoLaunch = false;
|
AutoLaunch = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MenuHide()
|
public void MenuHide()
|
||||||
{
|
{
|
||||||
_autoLaunch = true;
|
AutoLaunch = true;
|
||||||
menuLabel.Hide();
|
menuLabel.Hide();
|
||||||
waccaListTest.Visible = waccaListTest.Enabled = false;
|
waccaListTest.Visible = waccaListTest.Enabled = false;
|
||||||
|
|
||||||
|
if (_hasError) return;
|
||||||
|
|
||||||
_loadingLabel.Show();
|
_loadingLabel.Show();
|
||||||
|
|
||||||
_delayTimer = new System.Timers.Timer(5000);
|
_delayTimer = new System.Timers.Timer(5000);
|
||||||
@ -316,6 +299,11 @@ namespace WACCALauncher
|
|||||||
Process.Start(@"C:\Windows\System32\taskkill.exe", @"/F /IM explorer.exe");
|
Process.Start(@"C:\Windows\System32\taskkill.exe", @"/F /IM explorer.exe");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void KillAMDaemon()
|
||||||
|
{
|
||||||
|
Process.Start(@"C:\Windows\System32\taskkill.exe", @"/F /IM amdaemon.exe");
|
||||||
|
}
|
||||||
|
|
||||||
private static void OpenExplorer()
|
private static void OpenExplorer()
|
||||||
{
|
{
|
||||||
var processes = Process.GetProcessesByName("explorer");
|
var processes = Process.GetProcessesByName("explorer");
|
||||||
@ -346,6 +334,7 @@ namespace WACCALauncher
|
|||||||
private void QuitLauncher(Object source, EventArgs e)
|
private void QuitLauncher(Object source, EventArgs e)
|
||||||
{
|
{
|
||||||
// Only exit after the game has closed, so that the launcher doesn't keep opening when configured as a shell
|
// Only exit after the game has closed, so that the launcher doesn't keep opening when configured as a shell
|
||||||
|
KillAMDaemon(); // Just in case it gets left open
|
||||||
Application.Exit();
|
Application.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,11 +356,16 @@ namespace WACCALauncher
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var version = new Version(iniPath, item);
|
var version = new Version(iniPath, item);
|
||||||
if (!version.HasSegatools)
|
if (!version.HasSegatools && version.GameVersion != VersionType.Saturn)
|
||||||
{
|
{
|
||||||
DisplayError("Segatools missing", $"Ensure segatools is present in the bin folder ({version})");
|
DisplayError("Segatools missing", $"Ensure segatools is present in the bin folder ({version})");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (version.BatchPath == String.Empty && version.GameVersion == VersionType.Saturn)
|
||||||
|
{
|
||||||
|
DisplayError("Saturn missing", $"Check path, cannot find saturn data");
|
||||||
|
return;
|
||||||
|
}
|
||||||
Versions.Add(version);
|
Versions.Add(version);
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (ex is NotSupportedException || ex is DirectoryNotFoundException || ex is ArgumentException)
|
catch (Exception ex) when (ex is NotSupportedException || ex is DirectoryNotFoundException || ex is ArgumentException)
|
||||||
@ -433,8 +427,11 @@ namespace WACCALauncher
|
|||||||
_parser.WriteFile("wacca.ini", _config);
|
_parser.WriteFile("wacca.ini", _config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _hasError = false;
|
||||||
|
|
||||||
private void DisplayError(string error, string description = "")
|
private void DisplayError(string error, string description = "")
|
||||||
{
|
{
|
||||||
|
_hasError = true;
|
||||||
_delayTimer.Stop();
|
_delayTimer.Stop();
|
||||||
_loadingLabel?.Hide();
|
_loadingLabel?.Hide();
|
||||||
|
|
||||||
@ -476,7 +473,8 @@ namespace WACCALauncher
|
|||||||
Lily_R,
|
Lily_R,
|
||||||
Reverse,
|
Reverse,
|
||||||
Offline,
|
Offline,
|
||||||
Custom = 10
|
Custom = 10,
|
||||||
|
Saturn
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Version
|
public class Version
|
||||||
@ -500,10 +498,17 @@ namespace WACCALauncher
|
|||||||
if (customName != string.Empty) this.CustomName = customName;
|
if (customName != string.Empty) this.CustomName = customName;
|
||||||
var binPath = Path.Combine(_dir.FullName, "bin");
|
var binPath = Path.Combine(_dir.FullName, "bin");
|
||||||
|
|
||||||
if (CheckForSegatools(binPath))
|
if (version != VersionType.Saturn)
|
||||||
{
|
{
|
||||||
HasSegatools = true;
|
if (CheckForSegatools(binPath))
|
||||||
BatchPath = Path.Combine(binPath, "start.bat");
|
{
|
||||||
|
HasSegatools = true;
|
||||||
|
BatchPath = Path.Combine(binPath, "start.bat");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (CheckForSaturn(path))
|
||||||
|
{
|
||||||
|
BatchPath = Path.Combine(path, "SaturnGame.exe");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,6 +519,12 @@ namespace WACCALauncher
|
|||||||
File.Exists(Path.Combine(path, "inject.exe"));
|
File.Exists(Path.Combine(path, "inject.exe"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CheckForSaturn(string path)
|
||||||
|
{
|
||||||
|
return Directory.Exists(Path.Combine(path, "SaturnGame_data")) &&
|
||||||
|
File.Exists(Path.Combine(path, "SaturnGame.exe"));
|
||||||
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return GameVersion.ToString().Replace('_', ' ');
|
return GameVersion.ToString().Replace('_', ' ');
|
||||||
@ -626,7 +637,7 @@ namespace WACCALauncher
|
|||||||
public void CursorUp()
|
public void CursorUp()
|
||||||
{
|
{
|
||||||
// move cursor up
|
// move cursor up
|
||||||
if (_form._autoLaunch) return;
|
if (_form.AutoLaunch) return;
|
||||||
|
|
||||||
var idx = ((_list.SelectedIndex - 1) + _list.Items.Count) % _list.Items.Count;
|
var idx = ((_list.SelectedIndex - 1) + _list.Items.Count) % _list.Items.Count;
|
||||||
_list.SelectedIndex = idx;
|
_list.SelectedIndex = idx;
|
||||||
@ -635,7 +646,7 @@ namespace WACCALauncher
|
|||||||
public void CursorDown()
|
public void CursorDown()
|
||||||
{
|
{
|
||||||
// move cursor down
|
// move cursor down
|
||||||
if (_form._autoLaunch) return;
|
if (_form.AutoLaunch) return;
|
||||||
|
|
||||||
var idx = (_list.SelectedIndex + 1) % _list.Items.Count;
|
var idx = (_list.SelectedIndex + 1) % _list.Items.Count;
|
||||||
_list.SelectedIndex = idx;
|
_list.SelectedIndex = idx;
|
||||||
@ -644,7 +655,7 @@ namespace WACCALauncher
|
|||||||
public void MenuBack()
|
public void MenuBack()
|
||||||
{
|
{
|
||||||
// back from current menu item
|
// back from current menu item
|
||||||
if (_form._autoLaunch) return;
|
if (_form.AutoLaunch) return;
|
||||||
|
|
||||||
Console.WriteLine("MenuBack");
|
Console.WriteLine("MenuBack");
|
||||||
if (_form._menuManager.GetCurrentMenu().ParentMenu == null)
|
if (_form._menuManager.GetCurrentMenu().ParentMenu == null)
|
||||||
@ -655,7 +666,7 @@ namespace WACCALauncher
|
|||||||
public void MenuSelect()
|
public void MenuSelect()
|
||||||
{
|
{
|
||||||
// select menu item
|
// select menu item
|
||||||
if (_form._autoLaunch) return;
|
if (_form.AutoLaunch) return;
|
||||||
|
|
||||||
Console.WriteLine("MenuSelect");
|
Console.WriteLine("MenuSelect");
|
||||||
(_list.SelectedItem as ConfigMenu).Select(_form);
|
(_list.SelectedItem as ConfigMenu).Select(_form);
|
||||||
|
@ -30,7 +30,7 @@ namespace WACCALauncher
|
|||||||
return BuildNumber == 14393 && ReleaseId == 1607;
|
return BuildNumber == 14393 && ReleaseId == 1607;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsWACCA()
|
public static bool IsCorrectEnv()
|
||||||
{
|
{
|
||||||
return IsCorrectRes() && IsCorrectVer();
|
return IsCorrectRes() && IsCorrectVer();
|
||||||
}
|
}
|
||||||
@ -46,8 +46,10 @@ namespace WACCALauncher
|
|||||||
CurrentScreen = Screen.AllScreens[1];
|
CurrentScreen = Screen.AllScreens[1];
|
||||||
|
|
||||||
// when running as system shell, we must set our working directory manually
|
// when running as system shell, we must set our working directory manually
|
||||||
if(Directory.GetCurrentDirectory() == Environment.GetFolderPath(Environment.SpecialFolder.System))
|
var whereAmI = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||||
Directory.SetCurrentDirectory(Path.GetPathRoot(Assembly.GetExecutingAssembly().Location));
|
|
||||||
|
if (Directory.GetCurrentDirectory() != whereAmI)
|
||||||
|
Directory.SetCurrentDirectory(whereAmI);
|
||||||
|
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
@ -6,11 +6,11 @@ using System.Runtime.InteropServices;
|
|||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("WACCALauncher")]
|
[assembly: AssemblyTitle("WACCALauncher")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("me when i launch my wacca")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("YellowberryHN")]
|
[assembly: AssemblyCompany("YellowberryHN")]
|
||||||
[assembly: AssemblyProduct("WACCALauncher")]
|
[assembly: AssemblyProduct("WACCALauncher")]
|
||||||
[assembly: AssemblyCopyright("Copyright © YellowberryHN 2023")]
|
[assembly: AssemblyCopyright("Copyright © YellowberryHN 2024")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.10.0.0")]
|
[assembly: AssemblyVersion("0.11.0.0")]
|
||||||
[assembly: AssemblyFileVersion("0.10.0.0")]
|
[assembly: AssemblyFileVersion("0.11.0.0")]
|
||||||
|
@ -119,6 +119,6 @@
|
|||||||
</resheader>
|
</resheader>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
<data name="menufont" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="menufont" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\funny.ttf;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>..\Resources\font.ttf;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
@ -50,7 +50,6 @@ that looks something like this:
|
|||||||
name = WACCA Omega Supermix Deluxe
|
name = WACCA Omega Supermix Deluxe
|
||||||
path = C:\WACCA\Versions\Omega Supermix Deluxe
|
path = C:\WACCA\Versions\Omega Supermix Deluxe
|
||||||
type = reverse
|
type = reverse
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
`type` must match one of the versions listed above, it will likely be `reverse` unless specified.
|
`type` must match one of the versions listed above, it will likely be `reverse` unless specified.
|
||||||
|
BIN
Resources/font.ttf
Normal file
BIN
Resources/font.ttf
Normal file
Binary file not shown.
Binary file not shown.
@ -94,7 +94,7 @@
|
|||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
<EmbeddedResource Include="Resources\funny.ttf" />
|
<EmbeddedResource Include="Resources\font.ttf" />
|
||||||
<None Include="README.md" />
|
<None Include="README.md" />
|
||||||
<None Include="SetShell.reg">
|
<None Include="SetShell.reg">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
Loading…
Reference in New Issue
Block a user