2013-04-24 22:09:11 +00:00
using System ;
using System.IO ;
using System.Text ;
2012-09-30 02:37:00 +00:00
namespace BizHawk
2011-06-11 22:15:08 +00:00
{
2012-12-10 00:43:43 +00:00
public class CoreComm
2011-06-11 22:15:08 +00:00
{
public int NES_BackdropColor ;
2013-07-12 21:26:57 +00:00
public bool NES_UnlimitedSprites = false ;
public bool NES_ShowBG = true , NES_ShowOBJ = true ;
public bool PCE_ShowBG1 = true , PCE_ShowOBJ1 = true , PCE_ShowBG2 = true , PCE_ShowOBJ2 = true ;
public bool SMS_ShowBG = true , SMS_ShowOBJ = true ;
2012-10-30 23:38:53 +00:00
public bool GG_ShowClippedRegions ;
public bool GG_HighlightActiveDisplayRegion ;
2012-09-04 19:12:16 +00:00
2012-11-04 23:29:06 +00:00
public string PSX_FirmwaresPath ;
2012-09-27 11:58:04 +00:00
public string SNES_FirmwaresPath ;
2012-11-06 06:19:27 +00:00
public string C64_FirmwaresPath ;
2013-08-10 01:17:06 +00:00
public ICoreFileProvider CoreFileProvider ;
2013-04-24 22:09:11 +00:00
2012-12-25 20:36:04 +00:00
public string SNES_ExePath ;
public string SNES_Profile ;
2013-01-18 05:06:26 +00:00
public bool SNES_UseRingBuffer ;
2013-04-22 22:34:18 +00:00
public bool SNES_AlwaysDoubleSize ;
2012-12-25 20:36:04 +00:00
2012-09-04 19:12:16 +00:00
public bool SNES_ShowBG1_0 , SNES_ShowBG2_0 , SNES_ShowBG3_0 , SNES_ShowBG4_0 ;
public bool SNES_ShowBG1_1 , SNES_ShowBG2_1 , SNES_ShowBG3_1 , SNES_ShowBG4_1 ;
public bool SNES_ShowOBJ_0 , SNES_ShowOBJ_1 , SNES_ShowOBJ_2 , SNES_ShowOBJ_3 ;
2012-09-16 19:38:08 +00:00
2013-07-12 21:26:57 +00:00
public bool Atari2600_ShowBG = true , Atari2600_ShowPlayer1 = true , Atari2600_ShowPlayer2 = true , Atari2600_ShowMissle1 = true , Atari2600_ShowMissle2 = true , Atari2600_ShowBall = true , Atari2600_ShowPF = true ;
2012-10-30 00:18:56 +00:00
2012-09-16 19:38:08 +00:00
/// <summary>
/// if this is set, then the cpu should dump trace info to CpuTraceStream
/// </summary>
2012-09-30 02:37:00 +00:00
public TraceBuffer Tracer = new TraceBuffer ( ) ;
2012-10-06 13:34:04 +00:00
/// <summary>
/// for emu.on_snoop()
/// </summary>
public System . Action InputCallback ;
2012-10-13 18:59:09 +00:00
public MemoryCallbackSystem MemoryCallbackSystem = new MemoryCallbackSystem ( ) ;
2011-06-11 22:15:08 +00:00
2012-07-11 21:37:35 +00:00
public double VsyncRate
{
get
{
return VsyncNum / ( double ) VsyncDen ;
}
}
public int VsyncNum = 60 ;
public int VsyncDen = 1 ;
2012-11-04 23:29:06 +00:00
//a core should set these if you wish to provide rom status information yourself. otherwise it will be calculated by the frontend in a way you may not like, using RomGame-related concepts.
2011-07-10 21:00:28 +00:00
public string RomStatusAnnotation ;
public string RomStatusDetails ;
2012-09-16 19:38:08 +00:00
2012-09-20 00:22:24 +00:00
public int ScreenLogicalOffsetX , ScreenLogicalOffsetY ;
2012-09-30 02:07:14 +00:00
public bool CpuTraceAvailable = false ;
2012-11-24 00:45:25 +00:00
public string TraceHeader = "Instructions" ;
2012-11-26 01:43:34 +00:00
2012-11-26 02:25:23 +00:00
// size hint to a/v out resizer. this probably belongs in VideoProvider? but it's somewhat different than VirtualWidth...
public int NominalWidth = 640 ;
public int NominalHeight = 480 ;
2012-11-26 01:43:34 +00:00
public bool DriveLED = false ;
public bool UsesDriveLed = false ;
2011-06-11 22:15:08 +00:00
}
2012-09-30 02:37:00 +00:00
public class TraceBuffer
{
public string TakeContents ( )
{
string s = buffer . ToString ( ) ;
buffer . Clear ( ) ;
return s ;
}
public string Contents
{
get
{
return buffer . ToString ( ) ;
}
}
public void Put ( string content )
{
if ( logging )
{
buffer . Append ( content ) ;
buffer . Append ( '\n' ) ;
}
}
public TraceBuffer ( )
{
buffer = new StringBuilder ( ) ;
}
public bool Enabled
{
get
{
return logging ;
}
set
{
logging = value ;
}
}
private StringBuilder buffer ;
private bool logging = false ;
}
2012-10-13 18:59:09 +00:00
public class MemoryCallbackSystem
{
public int? ReadAddr = null ;
2012-10-14 15:19:31 +00:00
private System . Action < uint > ReadCallback = null ;
public void SetReadCallback ( System . Action < uint > func )
2012-10-14 14:08:25 +00:00
{
ReadCallback = func ;
}
public bool HasRead
{
get
{
return ReadCallback ! = null ;
}
}
2012-10-13 18:59:09 +00:00
public void TriggerRead ( int addr )
{
if ( ReadCallback ! = null )
{
if ( ReadAddr ! = null )
{
if ( ReadAddr = = addr )
{
2012-10-14 15:19:31 +00:00
ReadCallback ( ( uint ) addr ) ;
2012-10-13 18:59:09 +00:00
}
}
else
{
2012-10-14 15:19:31 +00:00
ReadCallback ( ( uint ) addr ) ;
2012-10-13 18:59:09 +00:00
}
}
}
public int? WriteAddr = null ;
2012-10-14 15:19:31 +00:00
private System . Action < uint > WriteCallback = null ;
public void SetWriteCallback ( System . Action < uint > func )
2012-10-14 14:08:25 +00:00
{
WriteCallback = func ;
}
public bool HasWrite
{
get
{
return WriteCallback ! = null ;
}
}
2012-10-13 18:59:09 +00:00
public void TriggerWrite ( int addr )
{
if ( WriteCallback ! = null )
{
if ( WriteAddr ! = null )
{
if ( WriteAddr = = addr )
{
2012-10-14 15:19:31 +00:00
WriteCallback ( ( uint ) addr ) ;
2012-10-13 18:59:09 +00:00
}
}
else
{
2012-10-14 15:19:31 +00:00
WriteCallback ( ( uint ) addr ) ;
2012-10-13 18:59:09 +00:00
}
}
}
}
2012-03-11 06:50:46 +00:00
}