apply Arcade Pit work: "Extract NesCarts.xml for easier modification"

This commit is contained in:
zeromus 2016-11-12 18:18:19 -06:00
parent 3a41cc4531
commit 0b4fc8b6a5
4 changed files with 10 additions and 5 deletions

Binary file not shown.

BIN
Assets/gamedb/NesCarts.xml Normal file

Binary file not shown.

View File

@ -134,9 +134,12 @@ namespace BizHawk.Client.EmuHawk
// we could background thread this later instead if we wanted to be real clever // we could background thread this later instead if we wanted to be real clever
NES.BootGodDB.GetDatabaseBytes = () => NES.BootGodDB.GetDatabaseBytes = () =>
{ {
using (var NesCartFile = string xmlPath = Path.Combine( PathManager.GetExeDirectoryAbsolute(), "gamedb", "NesCarts.xml" );
new HawkFile(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "gamedb", "NesCarts.7z")).BindFirst()) string x7zPath = Path.Combine( PathManager.GetExeDirectoryAbsolute(), "gamedb", "NesCarts.7z" );
bool loadXml = File.Exists( xmlPath );
using (var NesCartFile = new HawkFile(loadXml ? xmlPath : x7zPath))
{ {
if (!loadXml) { NesCartFile.BindFirst(); }
return NesCartFile return NesCartFile
.GetStream() .GetStream()
.ReadAllBytes(); .ReadAllBytes();

View File

@ -65,13 +65,15 @@ namespace BizHawk.Client.MultiHawk
// we could background thread this later instead if we wanted to be real clever // we could background thread this later instead if we wanted to be real clever
NES.BootGodDB.GetDatabaseBytes = () => NES.BootGodDB.GetDatabaseBytes = () =>
{ {
using (var NesCartFile = string xmlPath = Path.Combine( PathManager.GetExeDirectoryAbsolute(), "gamedb", "NesCarts.xml" );
new HawkFile(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "gamedb", "NesCarts.7z")).BindFirst()) string x7zPath = Path.Combine( PathManager.GetExeDirectoryAbsolute(), "gamedb", "NesCarts.7z" );
bool loadXml = File.Exists( xmlPath );
using ( var NesCartFile = new HawkFile( loadXml ? xmlPath : x7zPath ) )
{ {
if ( !loadXml ) { NesCartFile.BindFirst(); }
return NesCartFile return NesCartFile
.GetStream() .GetStream()
.ReadAllBytes(); .ReadAllBytes();
}
}; };
Database.LoadDatabase(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "gamedb", "gamedb.txt")); Database.LoadDatabase(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "gamedb", "gamedb.txt"));