mirror of
https://github.com/stuff-by-3-random-dudes/UWUVCI-AIO-WPF
synced 2024-11-22 19:13:11 +00:00
get rom name
This commit is contained in:
parent
7ec59d7a4f
commit
81aa7c155c
6 changed files with 50 additions and 4 deletions
|
@ -42,7 +42,7 @@ namespace UWUVCI_AIO_WPF.Classes
|
|||
"BASE.zip",
|
||||
"tga2png.exe",
|
||||
"iconTex.tga",
|
||||
"wii-vnc.exe"
|
||||
"wii-vmc.exe"
|
||||
};
|
||||
|
||||
public static bool DoesToolsFolderExist()
|
||||
|
|
|
@ -1586,5 +1586,41 @@ namespace UWUVCI_AIO_WPF
|
|||
|
||||
return true;
|
||||
}
|
||||
public string getInternalName(string OpenGame)
|
||||
{
|
||||
string ret = "";
|
||||
using (var reader = new BinaryReader(File.OpenRead(OpenGame)))
|
||||
{
|
||||
reader.BaseStream.Position = 0x00;
|
||||
char TempChar;
|
||||
//WBFS Check
|
||||
if (new FileInfo(OpenGame).Extension.Contains("wbfs")) //Performs actions if the header indicates a WBFS file
|
||||
{
|
||||
|
||||
reader.BaseStream.Position = 0x200;
|
||||
|
||||
reader.BaseStream.Position = 0x218;
|
||||
|
||||
|
||||
reader.BaseStream.Position = 0x220;
|
||||
while ((int)(TempChar = reader.ReadChar()) != 0) ret = ret + TempChar;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
|
||||
reader.BaseStream.Position = 0x18;
|
||||
|
||||
reader.BaseStream.Position = 0x20;
|
||||
while ((int)(TempChar = reader.ReadChar()) != 0) ret = ret + TempChar;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<TextBox materialDesign:HintAssist.Hint="BOOTDRCTEX (OPTIONAL)" Name="drc" Style="{StaticResource MaterialDesignFloatingHintTextBox}" ToolTip="Needs a BitDepth of 24 and a Dimension of 854x480" Margin="10,241,157,197" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGADrc.ImgPath}" Cursor="Help"/>
|
||||
<TextBox materialDesign:HintAssist.Hint="BOOTTVTEX" Name="tv" Style="{StaticResource MaterialDesignFloatingHintTextBox}" ToolTip="Needs a BitDepth of 24 and a Dimension of 1280x720" Margin="10,196,157,242" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGATv.ImgPath}" Cursor="Help"/>
|
||||
<TextBox materialDesign:HintAssist.Hint="BOOTLOGOTEX" ToolTip="Needs a BitDepth of 32 and a Dimension of 170x42" Name="log" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,286,157,152" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Cursor="Help" Text="{Binding GameConfiguration.TGALog.ImgPath}"/>
|
||||
<TextBox materialDesign:HintAssist.Hint="GAME NAME" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,358,157,82" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" Text="{Binding GameConfiguration.GameName}" Name="gn" KeyUp="gn_KeyUp" MaxLength="250"/>
|
||||
<TextBox materialDesign:HintAssist.Hint="GAME NAME" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,358,157,79" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" Text="{Binding GameConfiguration.GameName}" Name="gn" KeyUp="gn_KeyUp" MaxLength="250"/>
|
||||
<Button Content="Inject" HorizontalAlignment="Left" Margin="506,401,0,0" VerticalAlignment="Top" Width="127" IsEnabled="{Binding CanInject}" Click="InjectGame"/>
|
||||
<Button Content="Select File" HorizontalAlignment="Left" Margin="506,299,0,0" VerticalAlignment="Top" Width="127" Click="Set_LogoTex"/>
|
||||
<Button Content="Select File" HorizontalAlignment="Left" Margin="506,209,0,0" VerticalAlignment="Top" Width="127" Click="Set_TvTex"/>
|
||||
|
|
|
@ -52,7 +52,11 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
string rom = mvm.getInternalName(mvm.RomPath);
|
||||
Regex reg = new Regex("[*'\",_&#^@:;?!<>|µ~#°²³]");
|
||||
gn.Text = reg.Replace(rom, string.Empty);
|
||||
mvm.GameConfiguration.GameName = reg.Replace(rom, string.Empty);
|
||||
|
||||
}
|
||||
|
||||
private void InjectGame(object sender, RoutedEventArgs e)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<TextBox materialDesign:HintAssist.Hint="BOOTDRCTEX (OPTIONAL)" Name="drc" Style="{StaticResource MaterialDesignFloatingHintTextBox}" ToolTip="Needs a BitDepth of 24 and a Dimension of 854x480" Margin="10,247,157,191" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGADrc.ImgPath}" Cursor="Help"/>
|
||||
<TextBox materialDesign:HintAssist.Hint="BOOTTVTEX" Name="tv" Style="{StaticResource MaterialDesignFloatingHintTextBox}" ToolTip="Needs a BitDepth of 24 and a Dimension of 1280x720" Margin="10,202,157,236" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGATv.ImgPath}" Cursor="Help"/>
|
||||
<TextBox materialDesign:HintAssist.Hint="BOOTLOGOTEX (OPTIONAL)" ToolTip="Needs a BitDepth of 32 and a Dimension of 170x42" Name="log" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,292,157,146" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Cursor="Help" Text="{Binding GameConfiguration.TGALog.ImgPath}"/>
|
||||
<TextBox materialDesign:HintAssist.Hint="GAME NAME" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,364,157,75" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" Text="{Binding GameConfiguration.GameName}" Name="gn" KeyUp="gn_KeyUp" MaxLength="250"/>
|
||||
<TextBox materialDesign:HintAssist.Hint="GAME NAME" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,364,157,73" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" Text="{Binding GameConfiguration.GameName}" Name="gn" KeyUp="gn_KeyUp" MaxLength="250"/>
|
||||
<Button Content="Inject" HorizontalAlignment="Left" Margin="506,407,0,0" VerticalAlignment="Top" Width="127" IsEnabled="{Binding CanInject}" Click="InjectGame"/>
|
||||
<Button Content="Select File" HorizontalAlignment="Left" Margin="506,305,0,0" VerticalAlignment="Top" Width="127" Click="Set_LogoTex"/>
|
||||
<Button Content="Select File" HorizontalAlignment="Left" Margin="506,215,0,0" VerticalAlignment="Top" Width="127" Click="Set_TvTex"/>
|
||||
|
|
|
@ -56,8 +56,14 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
|
|||
mvm.CanInject = true;
|
||||
|
||||
}
|
||||
string rom = mvm.getInternalName(mvm.RomPath);
|
||||
Regex reg = new Regex("[*'\",_&#^@:;?!<>|µ~#°²³]");
|
||||
gn.Text = reg.Replace(rom, string.Empty);
|
||||
mvm.GameConfiguration.GameName = reg.Replace(rom, string.Empty);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void InjectGame(object sender, RoutedEventArgs e)
|
||||
|
|
Loading…
Reference in a new issue