Added Space Bypass function

This commit is contained in:
NicoAICP 2020-06-24 17:54:51 +02:00
parent 56f16eb3b0
commit b76437ebaa
9 changed files with 161 additions and 40 deletions

View file

@ -55,6 +55,7 @@ namespace UWUVCI_AIO_WPF
}
}
bool check = true;
bool bypass = false;
if (e.Args.Length >= 1)
{
foreach(var s in e.Args)
@ -63,6 +64,11 @@ namespace UWUVCI_AIO_WPF
{
check = false;
}
if(s == "--spacebypass")
{
bypass = true;
}
}
}
@ -71,7 +77,7 @@ namespace UWUVCI_AIO_WPF
{
t.Elapsed += KillProg;
t.Start();
Custom_Message cm = new Custom_Message("Another Instance Running", "You already got another instance of UWUVCI AIO running.\nThis instance will terminate in 5 seconds.");
Custom_Message cm = new Custom_Message("Another Instance Running", " You already got another instance of UWUVCI AIO running. \n This instance will terminate in 5 seconds. ");
cm.ShowDialog();
KillProg(null, null);
@ -98,6 +104,10 @@ namespace UWUVCI_AIO_WPF
cm.ShowDialog();
}
MainWindow wnd = new MainWindow();
if (bypass) {
wnd.allowBypass();
}
// The OpenFile() method is just an example of what you could do with the
// parameter. The method should be declared on your MainWindow class, where
// you could use a range of methods to process the passed file path

View file

@ -148,30 +148,39 @@ namespace UWUVCI_AIO_WPF
[STAThread]
public static bool Inject(GameConfig Configuration, string RomPath, MainViewModel mvm, bool force)
{
Clean();
long gamesize = new FileInfo(RomPath).Length;
var drive = new DriveInfo(tempPath);
long freeSpaceInBytes = 0;
if (!mvm.saveworkaround)
{
long gamesize = new FileInfo(RomPath).Length;
var drive = new DriveInfo(tempPath);
freeSpaceInBytes = drive.AvailableFreeSpace;
}
long neededspace = 0;
long freeSpaceInBytes = drive.AvailableFreeSpace;
mvvm = mvm;
if (Directory.Exists(tempPath))
{
Directory.Delete(tempPath, true);
}
Directory.CreateDirectory(tempPath);
mvm.msg = "Checking Tools...";
mvm.InjcttoolCheck();
mvm.Progress = 5;
mvm.msg = "Copying Base...";
try
{
if (Configuration.Console == GameConsoles.WII || Configuration.Console == GameConsoles.GCN)
if (!mvm.saveworkaround && (Configuration.Console == GameConsoles.WII || Configuration.Console == GameConsoles.GCN))
{
if (mvm.GC)
@ -187,6 +196,10 @@ namespace UWUVCI_AIO_WPF
throw new Exception("12G");
}
}
else
{
MessageBox.Show("Using Bypass");
}
if(Configuration.BaseRom == null || Configuration.BaseRom.Name == null)
{
throw new Exception("BASE");

View file

@ -36,6 +36,8 @@ namespace UWUVCI_AIO_WPF
{
public class MainViewModel : BaseModel
{
public bool saveworkaround = false;
private bool Injected2 = false;
public bool injected2
{
@ -1242,11 +1244,26 @@ namespace UWUVCI_AIO_WPF
p.StartInfo.FileName = System.Windows.Application.ResourceAssembly.Location;
if (debug)
{
p.StartInfo.Arguments = "--debug --skip";
if (saveworkaround)
{
p.StartInfo.Arguments = "--debug --skip --spacebypass";
}
else
{
p.StartInfo.Arguments = "--debug --skip";
}
}
else
{
p.StartInfo.Arguments = "--skip";
if (saveworkaround)
{
p.StartInfo.Arguments = "--skip --spacebypass";
}
else
{
p.StartInfo.Arguments = "--skip";
}
}
p.Start();
Environment.Exit(0);
@ -3721,5 +3738,38 @@ namespace UWUVCI_AIO_WPF
}
}
public void RestartIntoBypass()
{
using(Process p = new Process())
{
p.StartInfo.FileName = System.Windows.Application.ResourceAssembly.Location;
if (debug)
{
if (saveworkaround)
{
p.StartInfo.Arguments = "--debug --skip --spacebypass";
}
else
{
p.StartInfo.Arguments = "--debug --skip";
}
}
else
{
if (saveworkaround)
{
p.StartInfo.Arguments = "--skip --spacebypass";
}
else
{
p.StartInfo.Arguments = "--skip";
}
}
p.Start();
Environment.Exit(0);
}
}
}
}

View file

@ -36,7 +36,7 @@
<TextBlock HorizontalAlignment="Left" Margin="1022,10,0,0" TextWrapping="Wrap" Text="v2.1 BETA" VerticalAlignment="Top" FontSize="20" Width="98" Visibility="Hidden"/>
<Button Content="Reset TitleKeys" HorizontalAlignment="Left" Margin="337,226,0,0" VerticalAlignment="Top" Width="153" RenderTransformOrigin="-0.099,0.116" Click="Button_Click_8" IsTabStop="False"/>
<Button Content="Start Nintendont Config Tool" HorizontalAlignment="Left" Margin="337,314,0,0" VerticalAlignment="Top" Width="267" RenderTransformOrigin="-0.099,0.116" Click="Button_Click_9" IsTabStop="False"/>
<Button Content="Reset Don't show this again Option" HorizontalAlignment="Left" Margin="422,358,0,0" VerticalAlignment="Top" Width="266" RenderTransformOrigin="-0.099,0.116" Click="Button_Click_10" IsTabStop="False"/>
<Button Content="Reset Don't show this again Option" HorizontalAlignment="Left" Margin="346,357,0,0" VerticalAlignment="Top" Width="258" RenderTransformOrigin="-0.099,0.116" Click="Button_Click_10" IsTabStop="False"/>
<Button Content="Button" HorizontalAlignment="Left" Margin="337,422,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_11" IsTabStop="False"/>
<Grid Margin="0,0,5,0"/>
<Rectangle Fill="LightGray" HorizontalAlignment="Left" Height="32" Margin="12,7,0,0" VerticalAlignment="Top" Width="1108"/>
@ -47,6 +47,7 @@
<Ellipse Fill="#FF2196F3" HorizontalAlignment="Left" Height="21" Margin="12,7,0,0" VerticalAlignment="Top" Width="17"/>
<Border BorderBrush="#FF2196F3" BorderThickness="1" HorizontalAlignment="Left" Height="33" Margin="12,6,0,0" VerticalAlignment="Top" Width="1108" CornerRadius="5" Background="#FF2196F3"/>
<Label Content="v3.0 BETA" HorizontalAlignment="Left" Margin="1048,10,0,0" VerticalAlignment="Top" Foreground="#DDFFFFFF" Width="72" Height="24"/>
<Button Content="SpaceBypass Mode" HorizontalAlignment="Left" Margin="609,357,0,0" VerticalAlignment="Top" Width="153" RenderTransformOrigin="-0.099,0.116" Click="Button_Click_12" IsTabStop="False" ToolTip="Restarts UWUVCI AIO into SpaceBypass mode." Name="spm"/>
</Grid>
</Page>

View file

@ -29,7 +29,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames
{
InitializeComponent();
parent = mw;
spm.Content += "\nThis will most likely fix the Injection Process, if it's stuck before it shows Copy Base";
}
public void Dispose()
{
@ -135,6 +135,9 @@ namespace UWUVCI_AIO_WPF.UI.Frames
}
private void Button_Click_12(object sender, RoutedEventArgs e)
{
(FindResource("mvm") as MainViewModel).RestartIntoBypass();
}
}
}

View file

@ -266,8 +266,12 @@ namespace UWUVCI_AIO_WPF.UI.Windows
try
{
if((FindResource("mvm") as MainViewModel).mw != null)
(FindResource("mvm") as MainViewModel).mw.Topmost = true;
if (!Title.Text.Contains("Warning"))
{
if ((FindResource("mvm") as MainViewModel).mw != null)
(FindResource("mvm") as MainViewModel).mw.Topmost = true;
}
}
catch (Exception )
{
@ -280,8 +284,11 @@ namespace UWUVCI_AIO_WPF.UI.Windows
{
try
{
if ((FindResource("mvm") as MainViewModel).mw != null)
(FindResource("mvm") as MainViewModel).mw.Topmost = false;
if (!Title.Text.Contains("Warning"))
{
if ((FindResource("mvm") as MainViewModel).mw != null)
(FindResource("mvm") as MainViewModel).mw.Topmost = false;
}
}
catch (Exception)
{

View file

@ -250,39 +250,60 @@ namespace UWUVCI_AIO_WPF.UI.Windows
return String.Format("{0:0.##} {1}", dblSByte, Suffix[i]);
}
private void setup_Click(object sender, RoutedEventArgs e)
{
long injctSize = GetDirectorySize(System.IO.Path.Combine(path, (FindResource("mvm") as MainViewModel).foldername), true);
if(injctSize >= new DriveInfo(driveletter).AvailableFreeSpace)
{if(!(FindResource("mvm") as MainViewModel).saveworkaround)
{
long div = injctSize - new DriveInfo(driveletter).AvailableFreeSpace + 1048576;
Custom_Message cm = new Custom_Message("Insufficient Space", $" You do not have enough space on the selected drive. \n Please make sure you have at least {FormatBytes(div)} free! ");
try
{
cm.Owner = (FindResource("mvm") as MainViewModel).mw;
}
catch (Exception)
long injctSize = GetDirectorySize(System.IO.Path.Combine(path, (FindResource("mvm") as MainViewModel).foldername), true);
if (injctSize >= new DriveInfo(driveletter).AvailableFreeSpace)
{
long div = injctSize - new DriveInfo(driveletter).AvailableFreeSpace + 1048576;
Custom_Message cm = new Custom_Message("Insufficient Space", $" You do not have enough space on the selected drive. \n Please make sure you have at least {FormatBytes(div)} free! ");
try
{
cm.Owner = (FindResource("mvm") as MainViewModel).mw;
}
catch (Exception)
{
}
cm.ShowDialog();
}
else
{
dp.Tick += Dp_Tick;
dp.Interval = TimeSpan.FromSeconds(1);
dp.Start();
Task.Run(() =>
{
if (gc)
{
SetupNintendont();
}
CopyInject();
});
setup.IsEnabled = false;
}
cm.ShowDialog();
}
else
{
dp.Tick += Dp_Tick;
dp.Interval = TimeSpan.FromSeconds(1);
dp.Start();
Task.Run(() =>
{
if (gc)
dp.Tick += Dp_Tick;
dp.Interval = TimeSpan.FromSeconds(1);
dp.Start();
Task.Run(() =>
{
SetupNintendont();
}
CopyInject();
});
setup.IsEnabled = false;
if (gc)
{
SetupNintendont();
}
CopyInject();
});
setup.IsEnabled = false;
}

View file

@ -51,6 +51,7 @@
</Grid.Background>
<TextBlock Name="tbTitleBar" HorizontalAlignment="Left" Margin="61,19,0,0" TextWrapping="Wrap" Text="UWUVCI AIO - Start" VerticalAlignment="Top" FontSize="25" Width="1075" TextAlignment="Center"/>
<TextBlock HorizontalAlignment="Left" Margin="61,3,0,0" TextWrapping="Wrap" Text="Space Bypass Mode" VerticalAlignment="Top" ToolTip="Disables all Space checks. May cause issues." Name="spc" Visibility="Hidden"/>
</Grid>
<Grid x:Name="GridMenu" Width="60" HorizontalAlignment="Left">
<Grid.Background>

View file

@ -409,6 +409,21 @@ namespace UWUVCI_AIO_WPF
{
MainViewModel mvm = FindResource("mvm") as MainViewModel;
mvm.debug = true;
spc.Visibility = Visibility.Visible;
if (mvm.saveworkaround)
{
spc.Text = "Debug & Space Bypass Mode";
}
else
{
spc.Text = "Debug Mode";
}
}
public void allowBypass()
{
(FindResource("mvm") as MainViewModel).saveworkaround = true;
spc.Visibility = Visibility.Visible;
}
}
}