voila, "emu" resolution lua drawing, hacked in place of the native resolution drawing because rolanmen1 decided to destroy my surface management paradigms (i can tell because the earth is scorched with spaces instead of tabs)
This commit is contained in:
parent
cd0016343f
commit
857d0a5b39
|
@ -591,6 +591,18 @@ namespace BizHawk.MultiClient
|
||||||
return luaNativeSurfaceSet.AllocateSurface(currNativeWidth, currNativeHeight);
|
return luaNativeSurfaceSet.AllocateSurface(currNativeWidth, currNativeHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SwappableDisplaySurfaceSet luaEmuSurfaceSet = new SwappableDisplaySurfaceSet();
|
||||||
|
public void SetLuaSurfaceEmu(DisplaySurface surface) { luaEmuSurfaceSet.SetPending(surface); }
|
||||||
|
public DisplaySurface GetLuaEmuSurfaceEmu()
|
||||||
|
{
|
||||||
|
int width = 1, height = 1;
|
||||||
|
if (currentSourceSurface != null)
|
||||||
|
width = currentSourceSurface.Width;
|
||||||
|
if (currentSourceSurface != null)
|
||||||
|
height = currentSourceSurface.Height;
|
||||||
|
return luaEmuSurfaceSet.AllocateSurface(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
int currNativeWidth, currNativeHeight;
|
int currNativeWidth, currNativeHeight;
|
||||||
EventWaitHandle wakeupEvent, suspendReplyEvent;
|
EventWaitHandle wakeupEvent, suspendReplyEvent;
|
||||||
bool shutdownFlag, suspendFlag;
|
bool shutdownFlag, suspendFlag;
|
||||||
|
@ -677,11 +689,15 @@ namespace BizHawk.MultiClient
|
||||||
g.CompositingMode = CompositingMode.SourceCopy;
|
g.CompositingMode = CompositingMode.SourceCopy;
|
||||||
g.CompositingQuality = CompositingQuality.HighSpeed;
|
g.CompositingQuality = CompositingQuality.HighSpeed;
|
||||||
g.DrawImage(currentSourceSurface.PeekBitmap(), 0, 0, w, h);
|
g.DrawImage(currentSourceSurface.PeekBitmap(), 0, 0, w, h);
|
||||||
g.Clip = new Region(new Rectangle(0, 0, nativeBmp.Width, nativeBmp.Height));
|
|
||||||
|
|
||||||
//switch to fancier composition for OSD overlays and such
|
//switch to fancier composition for OSD overlays and such
|
||||||
g.CompositingMode = CompositingMode.SourceOver;
|
g.CompositingMode = CompositingMode.SourceOver;
|
||||||
|
|
||||||
|
//this could have been done onto the source surface earlier and then scaled only once but the whole composition system needs revising, soo..
|
||||||
|
DisplaySurface luaEmuSurface = luaEmuSurfaceSet.GetCurrent();
|
||||||
|
if (luaEmuSurface != null) g.DrawImage(luaEmuSurface.PeekBitmap(), 0, 0, w, h);
|
||||||
|
g.Clip = new Region(new Rectangle(0, 0, nativeBmp.Width, nativeBmp.Height));
|
||||||
|
|
||||||
//apply a lua layer
|
//apply a lua layer
|
||||||
var luaSurface = luaNativeSurfaceSet.GetCurrent();
|
var luaSurface = luaNativeSurfaceSet.GetCurrent();
|
||||||
if (luaSurface != null) g.DrawImageUnscaled(luaSurface.PeekBitmap(), 0, 0);
|
if (luaSurface != null) g.DrawImageUnscaled(luaSurface.PeekBitmap(), 0, 0);
|
||||||
|
|
|
@ -488,6 +488,11 @@ namespace BizHawk.MultiClient
|
||||||
luaSurface = Global.DisplayManager.GetLuaSurfaceNative();
|
luaSurface = Global.DisplayManager.GetLuaSurfaceNative();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void gui_drawNewEmu()
|
||||||
|
{
|
||||||
|
luaSurface = Global.DisplayManager.GetLuaEmuSurfaceEmu();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// finishes the current drawing and submits it to the display manager (at native [host] resolution pre-osd)
|
/// finishes the current drawing and submits it to the display manager (at native [host] resolution pre-osd)
|
||||||
/// you would probably want some way to specify which surface to set it to, when there are other surfaces.
|
/// you would probably want some way to specify which surface to set it to, when there are other surfaces.
|
||||||
|
@ -499,6 +504,12 @@ namespace BizHawk.MultiClient
|
||||||
luaSurface = null;
|
luaSurface = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void gui_drawFinishEmu()
|
||||||
|
{
|
||||||
|
Global.DisplayManager.SetLuaSurfaceEmu(luaSurface);
|
||||||
|
luaSurface = null;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// draws a random rectangle for testing purposes
|
/// draws a random rectangle for testing purposes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -832,8 +832,8 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LuaImp.gui_drawNew();
|
LuaImp.gui_drawNewEmu();
|
||||||
//LuaImp.gui_clearGraphics();
|
//LuaImp.gui_clearGraphics();
|
||||||
if (s.Enabled && s.Thread != null && !s.Paused)
|
if (s.Enabled && s.Thread != null && !s.Paused)
|
||||||
{
|
{
|
||||||
bool prohibit = false;
|
bool prohibit = false;
|
||||||
|
@ -844,7 +844,7 @@ namespace BizHawk.MultiClient
|
||||||
var result = LuaImp.ResumeScript(s.Thread);
|
var result = LuaImp.ResumeScript(s.Thread);
|
||||||
s.FrameWaiting = result.WaitForFrame;
|
s.FrameWaiting = result.WaitForFrame;
|
||||||
}
|
}
|
||||||
LuaImp.gui_drawFinish();
|
LuaImp.gui_drawFinishEmu();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue