fix crashing bugs in yabause+software
This commit is contained in:
parent
1edd4edb49
commit
92f417dade
|
@ -76,10 +76,6 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
//this is here for future use and tracking purposes.. however.. instead of relying on this, we should just make sure we always activate what we need before we use it
|
//this is here for future use and tracking purposes.. however.. instead of relying on this, we should just make sure we always activate what we need before we use it
|
||||||
}
|
}
|
||||||
|
|
||||||
// ret.RequestGLContext = () => new BizHawk.Bizware.BizwareGL.Drivers.OpenTK.IGL_TK();
|
|
||||||
//ret.ActivateGLContext = (gl) => ((BizHawk.Bizware.BizwareGL.Drivers.OpenTK.IGL_TK)gl).MakeDefaultCurrent();
|
|
||||||
//ret.DeactivateGLContext = () => GlobalWin.DisplayManager..
|
|
||||||
|
|
||||||
public class ContextRef
|
public class ContextRef
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,18 +69,32 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
||||||
|
|
||||||
ResetCounters();
|
ResetCounters();
|
||||||
|
|
||||||
CoreComm.ActivateGLContext(glContext);
|
ActivateGL();
|
||||||
Init(bios);
|
Init(bios);
|
||||||
|
|
||||||
InputCallbackH = new LibYabause.InputCallback(() => CoreComm.InputCallback.Call());
|
InputCallbackH = new LibYabause.InputCallback(() => CoreComm.InputCallback.Call());
|
||||||
LibYabause.libyabause_setinputcallback(InputCallbackH);
|
LibYabause.libyabause_setinputcallback(InputCallbackH);
|
||||||
CoreComm.UsesDriveLed = true;
|
CoreComm.UsesDriveLed = true;
|
||||||
|
|
||||||
CoreComm.DeactivateGLContext();
|
DeactivateGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
static object glContext;
|
static object glContext;
|
||||||
|
|
||||||
|
void ActivateGL()
|
||||||
|
{
|
||||||
|
//if (!SyncSettings.UseGL) return; //not safe
|
||||||
|
if (glContext == null) return;
|
||||||
|
CoreComm.ActivateGLContext(glContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeactivateGL()
|
||||||
|
{
|
||||||
|
//if (!SyncSettings.UseGL) return; //not safe
|
||||||
|
if (glContext == null) return;
|
||||||
|
CoreComm.DeactivateGLContext();
|
||||||
|
}
|
||||||
|
|
||||||
void Init(byte[] bios)
|
void Init(byte[] bios)
|
||||||
{
|
{
|
||||||
bool GL = SyncSettings.UseGL;
|
bool GL = SyncSettings.UseGL;
|
||||||
|
@ -197,7 +211,7 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
||||||
{
|
{
|
||||||
int w, h, nsamp;
|
int w, h, nsamp;
|
||||||
|
|
||||||
CoreComm.ActivateGLContext(glContext);
|
ActivateGL();
|
||||||
|
|
||||||
LibYabause.Buttons1 p11 = (LibYabause.Buttons1)0xff;
|
LibYabause.Buttons1 p11 = (LibYabause.Buttons1)0xff;
|
||||||
LibYabause.Buttons2 p12 = (LibYabause.Buttons2)0xff;
|
LibYabause.Buttons2 p12 = (LibYabause.Buttons2)0xff;
|
||||||
|
@ -279,7 +293,7 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
||||||
|
|
||||||
//CheckStates();
|
//CheckStates();
|
||||||
|
|
||||||
CoreComm.DeactivateGLContext();
|
DeactivateGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Frame { get; private set; }
|
public int Frame { get; private set; }
|
||||||
|
@ -373,11 +387,11 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
||||||
fp.Offer(data);
|
fp.Offer(data);
|
||||||
|
|
||||||
//loadstate can trigger GL work
|
//loadstate can trigger GL work
|
||||||
CoreComm.ActivateGLContext(glContext);
|
ActivateGL();
|
||||||
|
|
||||||
bool succeed = LibYabause.libyabause_loadstate(fp.GetPipeNameNative());
|
bool succeed = LibYabause.libyabause_loadstate(fp.GetPipeNameNative());
|
||||||
|
|
||||||
CoreComm.DeactivateGLContext();
|
DeactivateGL();
|
||||||
|
|
||||||
fp.Finish();
|
fp.Finish();
|
||||||
if (!succeed)
|
if (!succeed)
|
||||||
|
@ -537,7 +551,7 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
||||||
{
|
{
|
||||||
if (!Disposed)
|
if (!Disposed)
|
||||||
{
|
{
|
||||||
CoreComm.ActivateGLContext(glContext);
|
ActivateGL();
|
||||||
if (SaveRamModified)
|
if (SaveRamModified)
|
||||||
DisposedSaveRam = ReadSaveRam();
|
DisposedSaveRam = ReadSaveRam();
|
||||||
LibYabause.libyabause_setvidbuff(IntPtr.Zero);
|
LibYabause.libyabause_setvidbuff(IntPtr.Zero);
|
||||||
|
@ -546,7 +560,7 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
||||||
VideoHandle.Free();
|
VideoHandle.Free();
|
||||||
SoundHandle.Free();
|
SoundHandle.Free();
|
||||||
Disposed = true;
|
Disposed = true;
|
||||||
CoreComm.DeactivateGLContext();
|
DeactivateGL();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue