genesis: layer draw toggles
This commit is contained in:
parent
7a8b5d9887
commit
e660937c46
|
@ -220,7 +220,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
case "GEN":
|
||||
var genesis = new GPGX(
|
||||
nextComm, null, disc, "GEN", GetCoreSyncSettings<GPGX>());
|
||||
nextComm, null, disc, "GEN", GetCoreSettings<GPGX>(), GetCoreSyncSettings<GPGX>());
|
||||
nextEmulator = genesis;
|
||||
break;
|
||||
case "SAT":
|
||||
|
@ -335,7 +335,7 @@ namespace BizHawk.Client.Common
|
|||
nextEmulator = new PCEngine(nextComm, game, rom.RomData, GetCoreSettings<PCEngine>(), GetCoreSyncSettings<PCEngine>());
|
||||
break;
|
||||
case "GEN":
|
||||
nextEmulator = new GPGX(nextComm, rom.RomData, null, "GEN", GetCoreSyncSettings<GPGX>());
|
||||
nextEmulator = new GPGX(nextComm, rom.RomData, null, "GEN", GetCoreSettings<GPGX>(), GetCoreSyncSettings<GPGX>());
|
||||
break;
|
||||
case "TI83":
|
||||
nextEmulator = new TI83(nextComm, game, rom.RomData, GetCoreSettings<TI83>());
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Text;
|
|||
|
||||
using BizHawk.Common.BufferExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Common;
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -50,7 +51,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
Mouse
|
||||
};
|
||||
|
||||
public GPGX(CoreComm NextComm, byte[] romfile, DiscSystem.Disc CD, string romextension, object SyncSettings)
|
||||
public GPGX(CoreComm NextComm, byte[] romfile, DiscSystem.Disc CD, string romextension, object Settings, object SyncSettings)
|
||||
{
|
||||
// three or six button?
|
||||
// http://www.sega-16.com/forum/showthread.php?4398-Forgotten-Worlds-giving-you-GAME-OVER-immediately-Fix-inside&highlight=forgotten%20worlds
|
||||
|
@ -64,7 +65,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
|
||||
try
|
||||
{
|
||||
this._SyncSettings = (GPGXSyncSettings)SyncSettings ?? GPGXSyncSettings.GetDefaults();
|
||||
_SyncSettings = (GPGXSyncSettings)SyncSettings ?? new GPGXSyncSettings();
|
||||
|
||||
CoreComm = NextComm;
|
||||
if (AttachedCore != null)
|
||||
|
@ -153,6 +154,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
if (CD != null)
|
||||
CoreComm.UsesDriveLed = true;
|
||||
|
||||
PutSettings(Settings ?? new GPGXSettings());
|
||||
|
||||
InitMemCallbacks();
|
||||
KillMemCallbacks();
|
||||
}
|
||||
|
@ -736,10 +739,16 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
#region Settings
|
||||
|
||||
GPGXSyncSettings _SyncSettings;
|
||||
GPGXSettings _Settings;
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSettings() { return _Settings.Clone(); }
|
||||
public object GetSyncSettings() { return _SyncSettings.Clone(); }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
public bool PutSettings(object o)
|
||||
{
|
||||
_Settings = (GPGXSettings)o;
|
||||
LibGPGX.gpgx_set_draw_mask(_Settings.GetDrawMask());
|
||||
return false;
|
||||
}
|
||||
public bool PutSyncSettings(object o)
|
||||
{
|
||||
bool ret;
|
||||
|
@ -749,6 +758,38 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
return ret;
|
||||
}
|
||||
|
||||
public class GPGXSettings
|
||||
{
|
||||
[Description("True to draw BG layer A")]
|
||||
[DefaultValue(true)]
|
||||
public bool DrawBGA { get; set; }
|
||||
[Description("True to draw BG layer B")]
|
||||
[DefaultValue(true)]
|
||||
public bool DrawBGB { get; set; }
|
||||
[Description("True to draw BG layer W")]
|
||||
[DefaultValue(true)]
|
||||
public bool DrawBGW { get; set; }
|
||||
|
||||
public GPGXSettings()
|
||||
{
|
||||
SettingsUtil.SetDefaultValues(this);
|
||||
}
|
||||
|
||||
public GPGXSettings Clone()
|
||||
{
|
||||
return (GPGXSettings)MemberwiseClone();
|
||||
}
|
||||
|
||||
public LibGPGX.DrawMask GetDrawMask()
|
||||
{
|
||||
LibGPGX.DrawMask ret = 0;
|
||||
if (DrawBGA) ret |= LibGPGX.DrawMask.BGA;
|
||||
if (DrawBGB) ret |= LibGPGX.DrawMask.BGB;
|
||||
if (DrawBGW) ret |= LibGPGX.DrawMask.BGW;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public class GPGXSyncSettings
|
||||
{
|
||||
[Description("Controls the type of any attached normal controllers; six button controllers are used if true, otherwise three button controllers. Some games don't work correctly with six button controllers. Not relevant if other controller types are connected.")]
|
||||
|
@ -763,14 +804,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
|
||||
public GPGXSyncSettings()
|
||||
{
|
||||
UseSixButton = true;
|
||||
ControlType = ControlType.Normal;
|
||||
Region = LibGPGX.Region.Autodetect;
|
||||
}
|
||||
|
||||
public static GPGXSyncSettings GetDefaults()
|
||||
{
|
||||
return new GPGXSyncSettings();
|
||||
SettingsUtil.SetDefaultValues(this);
|
||||
}
|
||||
|
||||
public GPGXSyncSettings Clone()
|
||||
|
|
|
@ -277,5 +277,16 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
|
||||
[DllImport("libgenplusgx.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int gpgx_getregs([Out] RegisterInfo[] regs);
|
||||
|
||||
[Flags]
|
||||
public enum DrawMask : int
|
||||
{
|
||||
BGA = 1,
|
||||
BGB = 2,
|
||||
BGW = 4
|
||||
}
|
||||
|
||||
[DllImport("libgenplusgx.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void gpgx_set_draw_mask(DrawMask mask);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,10 @@ static uint32_t bitmap_data_[1024 * 512];
|
|||
static int16 soundbuffer[4096];
|
||||
static int nsamples;
|
||||
|
||||
int cinterface_render_bga = 1;
|
||||
int cinterface_render_bgb = 1;
|
||||
int cinterface_render_bgw = 1;
|
||||
|
||||
#define GPGX_EX __declspec(dllexport)
|
||||
|
||||
static int vwidth;
|
||||
|
@ -531,6 +535,13 @@ GPGX_EX void gpgx_set_mem_callback(void (*read)(unsigned), void (*write)(unsigne
|
|||
biz_execcb = exec;
|
||||
}
|
||||
|
||||
GPGX_EX void gpgx_set_draw_mask(int mask)
|
||||
{
|
||||
cinterface_render_bga = !!(mask & 1);
|
||||
cinterface_render_bgb = !!(mask & 2);
|
||||
cinterface_render_bgw = !!(mask & 4);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int value;
|
||||
|
|
|
@ -43,6 +43,11 @@
|
|||
#include "md_ntsc.h"
|
||||
#include "sms_ntsc.h"
|
||||
|
||||
// layer toggle
|
||||
extern int cinterface_render_bga;
|
||||
extern int cinterface_render_bgb;
|
||||
extern int cinterface_render_bgw;
|
||||
|
||||
/*** NTSC Filters ***/
|
||||
extern md_ntsc_t *md_ntsc;
|
||||
extern sms_ntsc_t *sms_ntsc;
|
||||
|
@ -1526,7 +1531,10 @@ void render_bg_m5(int line)
|
|||
#endif
|
||||
|
||||
/* Plane B name table */
|
||||
uint32 *nt = (uint32 *)&vram[ntbb + (((v_line >> 3) << pf_shift) & 0x1FC0)];
|
||||
uint32 *nt;
|
||||
if (cinterface_render_bgb)
|
||||
{
|
||||
nt = (uint32 *)&vram[ntbb + (((v_line >> 3) << pf_shift) & 0x1FC0)];
|
||||
|
||||
/* Pattern row index */
|
||||
v_line = (v_line & 7) << 3;
|
||||
|
@ -1550,6 +1558,11 @@ void render_bg_m5(int line)
|
|||
atbuf = nt[index & pf_col_mask];
|
||||
DRAW_COLUMN(atbuf, v_line)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(&linebuf[0][0], 0, 512);
|
||||
}
|
||||
|
||||
if (w == (line >= a))
|
||||
{
|
||||
|
@ -1565,7 +1578,7 @@ void render_bg_m5(int line)
|
|||
}
|
||||
|
||||
/* Plane A */
|
||||
if (a)
|
||||
if (a && cinterface_render_bga)
|
||||
{
|
||||
/* Plane A width */
|
||||
start = clip[0].left;
|
||||
|
@ -1621,9 +1634,13 @@ void render_bg_m5(int line)
|
|||
start = clip[1].left;
|
||||
end = clip[1].right;
|
||||
}
|
||||
else if (!cinterface_render_bga)
|
||||
{
|
||||
memset(&linebuf[1][0], 0, 512);
|
||||
}
|
||||
|
||||
/* Window */
|
||||
if (w)
|
||||
if (w && cinterface_render_bgw)
|
||||
{
|
||||
/* Window name table */
|
||||
nt = (uint32 *)&vram[ntwb | ((line >> 3) << (6 + (reg[12] & 1)))];
|
||||
|
@ -1685,6 +1702,8 @@ void render_bg_m5_vs(int line)
|
|||
yscroll = vs[19] & (vs[19] >> 16);
|
||||
}
|
||||
|
||||
if (cinterface_render_bgb)
|
||||
{
|
||||
if(shift)
|
||||
{
|
||||
/* Plane B vertical scroll */
|
||||
|
@ -1726,7 +1745,12 @@ void render_bg_m5_vs(int line)
|
|||
atbuf = nt[index & pf_col_mask];
|
||||
DRAW_COLUMN(atbuf, v_line)
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(&linebuf[0][0], 0, 512);
|
||||
}
|
||||
|
||||
if (w == (line >= a))
|
||||
{
|
||||
/* Window takes up entire line */
|
||||
|
@ -1741,7 +1765,7 @@ void render_bg_m5_vs(int line)
|
|||
}
|
||||
|
||||
/* Plane A */
|
||||
if (a)
|
||||
if (a && cinterface_render_bga)
|
||||
{
|
||||
/* Plane A width */
|
||||
start = clip[0].left;
|
||||
|
@ -1811,9 +1835,13 @@ void render_bg_m5_vs(int line)
|
|||
start = clip[1].left;
|
||||
end = clip[1].right;
|
||||
}
|
||||
else if (!cinterface_render_bga)
|
||||
{
|
||||
memset(&linebuf[1][0], 0, 512);
|
||||
}
|
||||
|
||||
/* Window */
|
||||
if (w)
|
||||
if (w && cinterface_render_bgw)
|
||||
{
|
||||
/* Window name table */
|
||||
nt = (uint32 *)&vram[ntwb | ((line >> 3) << (6 + (reg[12] & 1)))];
|
||||
|
@ -1868,7 +1896,10 @@ void render_bg_m5_im2(int line)
|
|||
#endif
|
||||
|
||||
/* Plane B name table */
|
||||
uint32 *nt = (uint32 *)&vram[ntbb + (((v_line >> 3) << pf_shift) & 0x1FC0)];
|
||||
uint32 *nt;
|
||||
if (cinterface_render_bgb)
|
||||
{
|
||||
nt = (uint32 *)&vram[ntbb + (((v_line >> 3) << pf_shift) & 0x1FC0)];
|
||||
|
||||
/* Pattern row index */
|
||||
v_line = (((v_line & 7) << 1) | odd) << 3;
|
||||
|
@ -1892,6 +1923,11 @@ void render_bg_m5_im2(int line)
|
|||
atbuf = nt[index & pf_col_mask];
|
||||
DRAW_COLUMN_IM2(atbuf, v_line)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(&linebuf[0][0], 0, 512);
|
||||
}
|
||||
|
||||
if (w == (line >= a))
|
||||
{
|
||||
|
@ -1907,7 +1943,7 @@ void render_bg_m5_im2(int line)
|
|||
}
|
||||
|
||||
/* Plane A */
|
||||
if (a)
|
||||
if (a && cinterface_render_bga)
|
||||
{
|
||||
/* Plane A width */
|
||||
start = clip[0].left;
|
||||
|
@ -1963,9 +1999,13 @@ void render_bg_m5_im2(int line)
|
|||
start = clip[1].left;
|
||||
end = clip[1].right;
|
||||
}
|
||||
else if (!cinterface_render_bga)
|
||||
{
|
||||
memset(&linebuf[1][0], 0, 512);
|
||||
}
|
||||
|
||||
/* Window */
|
||||
if (w)
|
||||
if (w && cinterface_render_bgw)
|
||||
{
|
||||
/* Window name table */
|
||||
nt = (uint32 *)&vram[ntwb | ((line >> 3) << (6 + (reg[12] & 1)))];
|
||||
|
@ -2028,6 +2068,8 @@ void render_bg_m5_im2_vs(int line)
|
|||
yscroll = (vs[19] >> 1) & (vs[19] >> 17);
|
||||
}
|
||||
|
||||
if (cinterface_render_bgb)
|
||||
{
|
||||
if(shift)
|
||||
{
|
||||
/* Plane B vertical scroll */
|
||||
|
@ -2069,6 +2111,11 @@ void render_bg_m5_im2_vs(int line)
|
|||
atbuf = nt[index & pf_col_mask];
|
||||
DRAW_COLUMN_IM2(atbuf, v_line)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(&linebuf[0][0], 0, 512);
|
||||
}
|
||||
|
||||
if (w == (line >= a))
|
||||
{
|
||||
|
@ -2084,7 +2131,7 @@ void render_bg_m5_im2_vs(int line)
|
|||
}
|
||||
|
||||
/* Plane A */
|
||||
if (a)
|
||||
if (a && cinterface_render_bga)
|
||||
{
|
||||
/* Plane A width */
|
||||
start = clip[0].left;
|
||||
|
@ -2154,9 +2201,13 @@ void render_bg_m5_im2_vs(int line)
|
|||
start = clip[1].left;
|
||||
end = clip[1].right;
|
||||
}
|
||||
else if (!cinterface_render_bga)
|
||||
{
|
||||
memset(&linebuf[1][0], 0, 512);
|
||||
}
|
||||
|
||||
/* Window */
|
||||
if (w)
|
||||
if (w && cinterface_render_bgw)
|
||||
{
|
||||
/* Window name table */
|
||||
nt = (uint32 *)&vram[ntwb | ((line >> 3) << (6 + (reg[12] & 1)))];
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue