get rom name

This commit is contained in:
NicoAICP 2020-04-17 03:51:56 +02:00
parent 7ec59d7a4f
commit 81aa7c155c
6 changed files with 50 additions and 4 deletions

View file

@ -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()

View file

@ -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;
}
}
}

View file

@ -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"/>

View file

@ -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)

View file

@ -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"/>

View file

@ -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)