Skip to content

Commit

Permalink
Fixed code typo that was causing an exception when choosing pce gecdb…
Browse files Browse the repository at this point in the history
…ios - #200
  • Loading branch information
Asnivor committed Feb 2, 2018
1 parent b256784 commit 3d950fb
Show file tree
Hide file tree
Showing 32 changed files with 406 additions and 4 deletions.
1 change: 1 addition & 0 deletions BuildTools/ChangeLog/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ title: Changelog
* (BugFix) - Controller and Misc Binding configuration windows now instantiate based on the current MedLaunch window height (so that buttons at the bottom of the window should never be cut off) ([#197](https://github.com/Asnivor/MedLaunch/issues/197))
* (Enhancement) - Added shared memcard option for PSX ([#194](https://github.com/Asnivor/MedLaunch/issues/194)) - Caveat: this may not play nice with savestates, use with caution
* (BugFix) - Added better error handling when inspecting corrupt archive files ([#198](https://github.com/Asnivor/MedLaunch/issues/198))
* (BugFix) - Fixed code typo that was causing an exception when choosing pce gecdbios ([#200](https://github.com/Asnivor/MedLaunch/issues/200))

##### [0.5.18.5](https://medlaunch.info/releases/0-5-18-5)
###### 2018-01-15
Expand Down
6 changes: 3 additions & 3 deletions MedLaunch.sln
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "BuildTools", "BuildTools\",
ProjectSection(WebsiteProperties) = preProject
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.5.2"
Debug.AspNetCompiler.VirtualPath = "/localhost_6840"
Debug.AspNetCompiler.PhysicalPath = "T:\Matt Burgess\VS\MedLaunch\BuildTools\"
Debug.AspNetCompiler.PhysicalPath = "BuildTools\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_6840\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/localhost_6840"
Release.AspNetCompiler.PhysicalPath = "T:\Matt Burgess\VS\MedLaunch\BuildTools\"
Release.AspNetCompiler.PhysicalPath = "BuildTools\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_6840\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
VWDPort = "6840"
SlnRelativePath = "T:\Matt Burgess\VS\MedLaunch\BuildTools\"
SlnRelativePath = "BuildTools\"
DefaultWebSiteLanguage = "Visual C#"
EndProjectSection
EndProject
Expand Down
Binary file added MedLaunch/Data/System/skeletonKey.db
Binary file not shown.
Binary file added MedLaunch/Data/System/skeletonKeyOLD.db
Binary file not shown.
5 changes: 5 additions & 0 deletions MedLaunch/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@ xmlns:il="clr-namespace:Microsoft.Expression.Interactivity.Layout;assembly=Micro

</MenuItem>

<MenuItem Header="SkeletonKey DB (Admin)">
<MenuItem Name="dbgImportSkeleton" Header="Import skeletonKey data from DAT directory (to DB)" Click="dbgImportSkeleton_Click"/>

</MenuItem>

<MenuItem Header="DATDB (Admin)">
<MenuItem Header="ToSec">
<MenuItem Header="Import All ToSec DATS" Click="btnToSecImportAll_Click"/>
Expand Down
16 changes: 15 additions & 1 deletion MedLaunch/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,18 @@ await Task.Run(() =>

#endregion

/// <summary>
/// Imports skeleton key data into database
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void dbgImportSkeleton_Click(object sender, RoutedEventArgs e)
{
_Debug.skeletonKey.AdminSkeletonKey sdb = new _Debug.skeletonKey.AdminSkeletonKey();
sdb.EntryPoint();
}


private void dbgImportPlatGames_Click(object sender, RoutedEventArgs e)
{
_Debug.ScrapeDB.AdminScrapeDb adb = new _Debug.ScrapeDB.AdminScrapeDb();
Expand Down Expand Up @@ -3542,7 +3554,7 @@ private void btnMednafenBiosPaths_Click(object sender, RoutedEventArgs e)
tbName = "cfg_gba__bios";
break;
case "PceGe":
tbName = "cfg_pce__gecdbioss";
tbName = "cfg_pce__gecdbios";
break;
case "PceCd":
tbName = "cfg_pce__cdbios";
Expand Down Expand Up @@ -5769,6 +5781,8 @@ public static Visibility IsDebug
get { return Visibility.Collapsed; }
#endif
}


}


Expand Down
26 changes: 26 additions & 0 deletions MedLaunch/MedLaunch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,10 @@
<Compile Include="_Debug\ScrapeDB\MasterView.cs" />
<Compile Include="_Debug\ScrapeDB\MOBY_Game.cs" />
<Compile Include="_Debug\ScrapeDB\MOBY_Platform.cs" />
<Compile Include="_Debug\skeletonKey\AdminSkeletonKey.cs" />
<Compile Include="_Debug\skeletonKey\SK_Game.cs" />
<Compile Include="_Debug\skeletonKey\skeletonKeyAdminDbContext.cs" />
<Compile Include="_Debug\skeletonKey\SK_System.cs" />
<Page Include="Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down Expand Up @@ -857,6 +861,27 @@
<None Include="Data\System\ToolTips.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="_Debug\skeletonKey\DATFiles\Atari - Lynx.7z" />
<None Include="_Debug\skeletonKey\DATFiles\Bandai - WonderSwan Color.7z" />
<None Include="_Debug\skeletonKey\DATFiles\Bandai - WonderSwan.7z" />
<None Include="_Debug\skeletonKey\DATFiles\NEC - PC Engine - TurboGrafx 16.7z" />
<None Include="_Debug\skeletonKey\DATFiles\NEC - PC Engine CD - TurboGrafx CD.7z" />
<None Include="_Debug\skeletonKey\DATFiles\NEC - PC Engine SuperGrafx.7z" />
<None Include="_Debug\skeletonKey\DATFiles\NEC - PC-FX.7z" />
<None Include="_Debug\skeletonKey\DATFiles\Nintendo - Famicom.7z" />
<None Include="_Debug\skeletonKey\DATFiles\Nintendo - Game Boy Advance.7z" />
<None Include="_Debug\skeletonKey\DATFiles\Nintendo - Game Boy Color.7z" />
<None Include="_Debug\skeletonKey\DATFiles\Nintendo - Game Boy.7z" />
<None Include="_Debug\skeletonKey\DATFiles\Nintendo - Nintendo Entertainment System.7z" />
<None Include="_Debug\skeletonKey\DATFiles\Nintendo - Super Nintendo Entertainment System.7z" />
<None Include="_Debug\skeletonKey\DATFiles\Nintendo - Virtual Boy.7z" />
<None Include="_Debug\skeletonKey\DATFiles\Sega - Game Gear.7z" />
<None Include="_Debug\skeletonKey\DATFiles\Sega - Master System - Mark III.7z" />
<None Include="_Debug\skeletonKey\DATFiles\Sega - Mega Drive - Genesis.7z" />
<None Include="_Debug\skeletonKey\DATFiles\Sega - Saturn.7z" />
<None Include="_Debug\skeletonKey\DATFiles\SNK - Neo Geo Pocket Color.7z" />
<None Include="_Debug\skeletonKey\DATFiles\SNK - Neo Geo Pocket.7z" />
<None Include="_Debug\skeletonKey\DATFiles\Sony - Playstation.7z" />
<Resource Include="Fonts\Arvo-Bold.ttf" />
<Resource Include="Fonts\Arvo-BoldItalic.ttf" />
<Resource Include="Fonts\Arvo-Italic.ttf" />
Expand Down Expand Up @@ -1000,6 +1025,7 @@
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Classes\skeletonKey\" />
<Folder Include="_Debug\DATDB\DATFiles\PSXDATACENTER\" />
</ItemGroup>
<ItemGroup>
Expand Down
173 changes: 173 additions & 0 deletions MedLaunch/_Debug/skeletonKey/AdminSkeletonKey.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
using MahApps.Metro.Controls.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using MedLaunch.Common.IO.Compression;
using System.IO;
using System.Xml;

namespace MedLaunch._Debug.skeletonKey
{
public class AdminSkeletonKey
{
public List<SK_System> systems { get; set; }
public MainWindow mw { get; set; }

public AdminSkeletonKey()
{
systems = SK_System.GetSystems();
mw = Application.Current.Windows.OfType<MainWindow>().FirstOrDefault();
}

/// <summary>
/// main entry point for DAT importing
/// </summary>
public async void EntryPoint()
{
var mySettings = new MetroDialogSettings()
{
NegativeButtonText = "Cancel Import",
AnimateShow = false,
AnimateHide = false
};

string output = "Scanning local SkeletonKey archive files - ";

var controller = await mw.ShowProgressAsync("SkeletonKey Importer", output, true, settings: mySettings);
controller.SetCancelable(true);
controller.SetIndeterminate();
await Task.Delay(1000);

// start import
await Task.Run(() =>
{
// setup working list object
List<SK_Game> roms = new List<SK_Game>();

// get all datfile archives
var archives = System.IO.Directory.GetFiles(@"..\..\_Debug\skeletonKey\DATFiles");

string outputDir = AppDomain.CurrentDomain.BaseDirectory + @"_xmls";
Directory.CreateDirectory(outputDir);

// iterate through each DAT
foreach (var arch in archives)
{
int count = 0;
Archive a = new Archive(arch);
string[] allowed = { ".xml" };
var crs = a.ProcessArchive(allowed);

// determine system
string system = Path.GetFileNameWithoutExtension(crs.ArchivePath);
controller.SetMessage(output + system + "\n\n");
int sysId = GetSystemID(system);
if (sysId == 0)
continue;

foreach (var c in crs.Results)
{
string extractedPath = outputDir + @"\" + c.FileName;
Archive.ExtractFile(crs.ArchivePath, c.InternalPath, outputDir);

// process xml file
count++;
controller.SetMessage(output + system + "\n\nProcessing: " + count);
var data = ProcessXML(extractedPath);
data.pid = sysId;

// delete xml file
try
{
File.Delete(extractedPath);
}
catch (Exception ex)
{
// do nothing
string e = ex.ToString();
}

}
}
});

await controller.CloseAsync();

if (controller.IsCanceled)
{
await mw.ShowMessageAsync("SK Builder", "Import Cancelled");
}
else
{
await mw.ShowMessageAsync("SK Builder", "Import Completed\n\n" + output);
}

}

private SK_Game ProcessXML(string xmlPath)
{
SK_Game sk = new SK_Game();

string xmlStr = File.ReadAllText(xmlPath);

XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlPath);

return sk;
}

private int GetSystemID(string archiveName)
{
switch (archiveName)
{
case "Atari - Lynx":
return 4923;
case "Bandai - WonderSwan Color":
return 4926;
case "Bandai - WonderSwan":
return 4925;
case "NEC - PC Engine - TurboGrafx 16":
case "NEC - PC Engine SuperGrafx":
return 34;
case "NEC - PC Engine CD - TurboGrafx CD":
return 4955;
case "NEC - PC-FX":
return 4930;
case "Nintendo - Famicom":
return 4936;
case "Nintendo - Game Boy Advance":
return 5;
case "Nintendo - Game Boy Color":
return 42;
case "Nintendo - Game Boy":
return 4;
case "Nintendo - Nintendo Entertainment System":
return 7;
case "Nintendo - Super Nintendo Entertainment System":
return 6;
case "Nintendo - Virtual Boy":
return 4918;
case "Sega - Game Gear":
return 20;
case "Sega - Master System - Mark III":
return 20;
case "Sega - Mega Drive - Genesis":
return 18;
case "Sega - Saturn":
return 17;
case "SNK - Neo Geo Pocket Color":
return 4923;
case "SNK - Neo Geo Pocket":
return 4922;
case "Sony - Playstation":
return 10;
default:
return 0;
}
}
}

}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 3d950fb

Please sign in to comment.