jabo check shouldnt depend on PWD for path resolution; add minimally acceptable hacky code to build dll dir based on executing assembly path

This commit is contained in:
zeromus 2014-07-27 02:13:23 +00:00
parent 4d380626a1
commit 9b70edb54c
1 changed files with 12 additions and 7 deletions

View File

@ -61,10 +61,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi
break;
case PluginType.Jabo:
videoplugin = "mupen64plus-video-jabo.dll";
if (File.Exists("dll\\Jabo_Direct3D8_patched.dll"))
//THIS IS HORRIBLE! PATH MUST BE PASSED IN SOME OTHER WAY
string dllDir = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "dll");
string rawPath = Path.Combine(dllDir, "Jabo_Direct3D8.dll");
string patchedPath = Path.Combine(dllDir, "Jabo_Direct3D8_patched.dll");
if (File.Exists(patchedPath))
{
byte[] hash = MD5.Create().ComputeHash(File.ReadAllBytes("dll\\Jabo_Direct3D8_patched.dll"));
byte[] hash = MD5.Create().ComputeHash(File.ReadAllBytes(patchedPath));
string hash_string = BitConverter.ToString(hash).Replace("-", "");
if (hash_string == "F4D6E624489CD88C68A5850426D4D70E")
{
@ -72,13 +77,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi
}
}
if (!jaboReady && File.Exists("dll\\Jabo_Direct3D8.dll"))
if (!jaboReady && File.Exists(rawPath))
{
byte[] hash = MD5.Create().ComputeHash(File.ReadAllBytes("dll\\Jabo_Direct3D8.dll"));
byte[] hash = MD5.Create().ComputeHash(File.ReadAllBytes(rawPath));
string hash_string = BitConverter.ToString(hash).Replace("-", "");
if (hash_string == "4F353AA71E7455B81205D8EC0AA339E1")
{
byte[] jaboDLL = File.ReadAllBytes("dll\\Jabo_Direct3D8.dll");
byte[] jaboDLL = File.ReadAllBytes(rawPath);
jaboDLL[583] = 0xA0;
jaboDLL[623] = 0xA0;
jaboDLL[663] = 0xA0;
@ -87,7 +92,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi
jaboDLL[783] = 0xA0;
jaboDLL[823] = 0xA0;
jaboDLL[863] = 0xA0;
File.WriteAllBytes("dll\\Jabo_Direct3D8_patched.dll", jaboDLL);
File.WriteAllBytes(patchedPath, jaboDLL);
jaboReady = true;
}
}