I thought there was more to this vb settings thing. I guess not.
This commit is contained in:
parent
c07f9e7ee6
commit
7880cbabb3
|
@ -37,10 +37,23 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.VB
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public class NativeSettings
|
public class NativeSyncSettings
|
||||||
{
|
{
|
||||||
public int InstantReadHack;
|
public int InstantReadHack;
|
||||||
public int DisableParallax;
|
public int DisableParallax;
|
||||||
|
|
||||||
|
public static NativeSyncSettings FromFrontendSettings(VirtualBoyee.SyncSettings ss)
|
||||||
|
{
|
||||||
|
return new NativeSyncSettings
|
||||||
|
{
|
||||||
|
InstantReadHack = ss.InstantReadHack ? 1 : 0,
|
||||||
|
DisableParallax = ss.DisableParallax ? 1 : 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class NativeSettings
|
||||||
|
{
|
||||||
public int ThreeDeeMode;
|
public int ThreeDeeMode;
|
||||||
public int SwapViews;
|
public int SwapViews;
|
||||||
public int AnaglyphPreset;
|
public int AnaglyphPreset;
|
||||||
|
@ -56,12 +69,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.VB
|
||||||
return c.ToArgb();
|
return c.ToArgb();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NativeSettings FromFrontendSettings(VirtualBoyee.Settings s, VirtualBoyee.SyncSettings ss)
|
public static NativeSettings FromFrontendSettings(VirtualBoyee.Settings s)
|
||||||
{
|
{
|
||||||
return new NativeSettings
|
return new NativeSettings
|
||||||
{
|
{
|
||||||
InstantReadHack = ss.InstantReadHack ? 1 : 0,
|
|
||||||
DisableParallax = ss.DisableParallax ? 1 : 0,
|
|
||||||
ThreeDeeMode = (int)s.ThreeDeeMode,
|
ThreeDeeMode = (int)s.ThreeDeeMode,
|
||||||
SwapViews = s.SwapViews ? 1 : 0,
|
SwapViews = s.SwapViews ? 1 : 0,
|
||||||
AnaglyphPreset = (int)s.AnaglyphPreset,
|
AnaglyphPreset = (int)s.AnaglyphPreset,
|
||||||
|
@ -77,7 +88,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.VB
|
||||||
|
|
||||||
|
|
||||||
[BizImport(CC)]
|
[BizImport(CC)]
|
||||||
public abstract bool Load(byte[] rom, int length, [In]NativeSettings settings);
|
public abstract bool Load(byte[] rom, int length, NativeSyncSettings settings);
|
||||||
|
|
||||||
|
[BizImport(CC)]
|
||||||
|
public abstract void SetSettings(NativeSettings settings);
|
||||||
|
|
||||||
[BizImport(CC)]
|
[BizImport(CC)]
|
||||||
public abstract void HardReset();
|
public abstract void HardReset();
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.VB
|
||||||
|
|
||||||
[CoreConstructor("VB")]
|
[CoreConstructor("VB")]
|
||||||
public VirtualBoyee(CoreComm comm, byte[] rom, Settings settings, SyncSettings syncSettings)
|
public VirtualBoyee(CoreComm comm, byte[] rom, Settings settings, SyncSettings syncSettings)
|
||||||
:base(comm, new Configuration
|
: base(comm, new Configuration
|
||||||
{
|
{
|
||||||
DefaultFpsNumerator = 20000000,
|
DefaultFpsNumerator = 20000000,
|
||||||
DefaultFpsDenominator = 397824,
|
DefaultFpsDenominator = 397824,
|
||||||
|
@ -38,8 +38,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.VB
|
||||||
{
|
{
|
||||||
_settings = settings ?? new Settings();
|
_settings = settings ?? new Settings();
|
||||||
_syncSettings = syncSettings ?? new SyncSettings();
|
_syncSettings = syncSettings ?? new SyncSettings();
|
||||||
// TODO: the way settings work in this core, changing the non-sync ones will invalidate savestates
|
|
||||||
var nativeSettings = LibVirtualBoyee.NativeSettings.FromFrontendSettings(_settings, _syncSettings);
|
|
||||||
|
|
||||||
_boyee = PreInit<LibVirtualBoyee>(new PeRunnerOptions
|
_boyee = PreInit<LibVirtualBoyee>(new PeRunnerOptions
|
||||||
{
|
{
|
||||||
|
@ -50,7 +48,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.VB
|
||||||
PlainHeapSizeKB = 256
|
PlainHeapSizeKB = 256
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!_boyee.Load(rom, rom.Length, nativeSettings))
|
if (!_boyee.Load(rom, rom.Length, LibVirtualBoyee.NativeSyncSettings.FromFrontendSettings(_syncSettings)))
|
||||||
throw new InvalidOperationException("Core rejected the rom");
|
throw new InvalidOperationException("Core rejected the rom");
|
||||||
|
|
||||||
// do a quick hack up for frame zero size
|
// do a quick hack up for frame zero size
|
||||||
|
@ -60,6 +58,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.VB
|
||||||
BufferHeight = tmp.Height;
|
BufferHeight = tmp.Height;
|
||||||
|
|
||||||
PostInit();
|
PostInit();
|
||||||
|
|
||||||
|
_boyee.SetSettings(LibVirtualBoyee.NativeSettings.FromFrontendSettings(_settings));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override LibWaterboxCore.FrameInfo FrameAdvancePrep(IController controller, bool render, bool rendersound)
|
protected override LibWaterboxCore.FrameInfo FrameAdvancePrep(IController controller, bool render, bool rendersound)
|
||||||
|
|
Binary file not shown.
|
@ -26,10 +26,13 @@
|
||||||
|
|
||||||
namespace MDFN_IEN_VB
|
namespace MDFN_IEN_VB
|
||||||
{
|
{
|
||||||
struct NativeSettings
|
struct NativeSyncSettings
|
||||||
{
|
{
|
||||||
int InstantReadHack;
|
int InstantReadHack;
|
||||||
int DisableParallax;
|
int DisableParallax;
|
||||||
|
};
|
||||||
|
struct NativeSettings
|
||||||
|
{
|
||||||
int ThreeDeeMode;
|
int ThreeDeeMode;
|
||||||
int SwapViews;
|
int SwapViews;
|
||||||
int AnaglyphPreset;
|
int AnaglyphPreset;
|
||||||
|
@ -56,14 +59,14 @@ enum
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32 AnaglyphPreset_Colors[][2] =
|
static const uint32 AnaglyphPreset_Colors[][2] =
|
||||||
{
|
{
|
||||||
{0, 0},
|
{0, 0},
|
||||||
{0xFF0000, 0x0000FF},
|
{0xFF0000, 0x0000FF},
|
||||||
{0xFF0000, 0x00B7EB},
|
{0xFF0000, 0x00B7EB},
|
||||||
{0xFF0000, 0x00FFFF},
|
{0xFF0000, 0x00FFFF},
|
||||||
{0xFF0000, 0x00FF00},
|
{0xFF0000, 0x00FF00},
|
||||||
{0x00FF00, 0xFF00FF},
|
{0x00FF00, 0xFF00FF},
|
||||||
{0xFFFF00, 0x0000FF},
|
{0xFFFF00, 0x0000FF},
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint32 VB3DMode;
|
static uint32 VB3DMode;
|
||||||
|
@ -501,7 +504,6 @@ void VB_ExitLoop(void)
|
||||||
VB_V810->Exit();
|
VB_V810->Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*MDFNGI EmulatedVB =
|
/*MDFNGI EmulatedVB =
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -552,7 +554,7 @@ void VB_ExitLoop(void)
|
||||||
|
|
||||||
using namespace MDFN_IEN_VB;
|
using namespace MDFN_IEN_VB;
|
||||||
|
|
||||||
EXPORT int Load(const uint8 *rom, int length, const NativeSettings* settings)
|
EXPORT int Load(const uint8 *rom, int length, const NativeSyncSettings *syncSettings)
|
||||||
{
|
{
|
||||||
const uint64 rom_size = length;
|
const uint64 rom_size = length;
|
||||||
V810_Emu_Mode cpu_mode = V810_EMU_MODE_ACCURATE;
|
V810_Emu_Mode cpu_mode = V810_EMU_MODE_ACCURATE;
|
||||||
|
@ -660,20 +662,20 @@ EXPORT int Load(const uint8 *rom, int length, const NativeSettings* settings)
|
||||||
VB_VSU = new VSU();
|
VB_VSU = new VSU();
|
||||||
VBINPUT_Init();
|
VBINPUT_Init();
|
||||||
|
|
||||||
VB3DMode = settings->ThreeDeeMode;
|
VB3DMode = 0;
|
||||||
uint32 prescale = settings->InterlacePrescale;
|
uint32 prescale = 1;
|
||||||
uint32 sbs_separation = settings->SideBySideSeparation;
|
uint32 sbs_separation = 0;
|
||||||
bool reverse = settings->SwapViews;
|
bool reverse = false;
|
||||||
|
|
||||||
VIP_Set3DMode(VB3DMode, reverse, prescale, sbs_separation);
|
VIP_Set3DMode(VB3DMode, reverse, prescale, sbs_separation);
|
||||||
|
|
||||||
VIP_SetParallaxDisable(settings->DisableParallax);
|
VIP_SetParallaxDisable(syncSettings->DisableParallax);
|
||||||
|
|
||||||
{
|
{
|
||||||
auto presetColor = settings->AnaglyphPreset;
|
auto presetColor = 1;
|
||||||
|
|
||||||
uint32 lcolor = settings->AnaglyphCustomLeftColor;
|
uint32 lcolor = 0xff0000;
|
||||||
uint32 rcolor = settings->AnaglyphCustomRightColor;
|
uint32 rcolor = 0x00ff00;
|
||||||
|
|
||||||
if (presetColor != ANAGLYPH_PRESET_DISABLED)
|
if (presetColor != ANAGLYPH_PRESET_DISABLED)
|
||||||
{
|
{
|
||||||
|
@ -681,12 +683,12 @@ EXPORT int Load(const uint8 *rom, int length, const NativeSettings* settings)
|
||||||
rcolor = AnaglyphPreset_Colors[presetColor][1];
|
rcolor = AnaglyphPreset_Colors[presetColor][1];
|
||||||
}
|
}
|
||||||
VIP_SetAnaglyphColors(lcolor, rcolor);
|
VIP_SetAnaglyphColors(lcolor, rcolor);
|
||||||
VIP_SetDefaultColor(settings->NonAnaglyphColor);
|
VIP_SetDefaultColor(0xffffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
VBINPUT_SetInstantReadHack(settings->InstantReadHack);
|
VBINPUT_SetInstantReadHack(syncSettings->InstantReadHack);
|
||||||
|
|
||||||
VIP_SetLEDOnScale(settings->LedOnScale / 1000.0);
|
VIP_SetLEDOnScale(1750 / 1000.0);
|
||||||
|
|
||||||
VB_Power();
|
VB_Power();
|
||||||
|
|
||||||
|
@ -731,7 +733,34 @@ EXPORT int Load(const uint8 *rom, int length, const NativeSettings* settings)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void GetMemoryAreas(MemoryArea* m)
|
EXPORT void SetSettings(const NativeSettings *settings)
|
||||||
|
{
|
||||||
|
VB3DMode = settings->ThreeDeeMode;
|
||||||
|
uint32 prescale = settings->InterlacePrescale;
|
||||||
|
uint32 sbs_separation = settings->SideBySideSeparation;
|
||||||
|
bool reverse = settings->SwapViews;
|
||||||
|
|
||||||
|
VIP_Set3DMode(VB3DMode, reverse, prescale, sbs_separation);
|
||||||
|
|
||||||
|
{
|
||||||
|
auto presetColor = settings->AnaglyphPreset;
|
||||||
|
|
||||||
|
uint32 lcolor = settings->AnaglyphCustomLeftColor;
|
||||||
|
uint32 rcolor = settings->AnaglyphCustomRightColor;
|
||||||
|
|
||||||
|
if (presetColor != ANAGLYPH_PRESET_DISABLED)
|
||||||
|
{
|
||||||
|
lcolor = AnaglyphPreset_Colors[presetColor][0];
|
||||||
|
rcolor = AnaglyphPreset_Colors[presetColor][1];
|
||||||
|
}
|
||||||
|
VIP_SetAnaglyphColors(lcolor, rcolor);
|
||||||
|
VIP_SetDefaultColor(settings->NonAnaglyphColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
VIP_SetLEDOnScale(settings->LedOnScale / 1000.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPORT void GetMemoryAreas(MemoryArea *m)
|
||||||
{
|
{
|
||||||
m[0].Data = WRAM;
|
m[0].Data = WRAM;
|
||||||
m[0].Name = "WRAM";
|
m[0].Name = "WRAM";
|
||||||
|
@ -749,7 +778,7 @@ EXPORT void GetMemoryAreas(MemoryArea* m)
|
||||||
m[2].Flags = MEMORYAREA_FLAGS_WORDSIZE4;
|
m[2].Flags = MEMORYAREA_FLAGS_WORDSIZE4;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void FrameAdvance(MyFrameInfo* frame)
|
EXPORT void FrameAdvance(MyFrameInfo *frame)
|
||||||
{
|
{
|
||||||
v810_timestamp_t v810_timestamp;
|
v810_timestamp_t v810_timestamp;
|
||||||
lagged = true;
|
lagged = true;
|
||||||
|
@ -779,7 +808,7 @@ EXPORT void FrameAdvance(MyFrameInfo* frame)
|
||||||
VB_V810->ResetTS(0);
|
VB_V810->ResetTS(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void PredictFrameSize(MyFrameInfo* frame)
|
EXPORT void PredictFrameSize(MyFrameInfo *frame)
|
||||||
{
|
{
|
||||||
VIP_CalcFrameSize(frame);
|
VIP_CalcFrameSize(frame);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "vb.h"
|
#include "vb.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include "../emulibc/emulibc.h"
|
||||||
|
|
||||||
#define VIP_DBGMSG(format, ...) \
|
#define VIP_DBGMSG(format, ...) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -67,8 +68,8 @@ static uint32 ColorLUT[2][256];
|
||||||
static int32 BrightnessCache[4];
|
static int32 BrightnessCache[4];
|
||||||
static uint32 BrightCLUT[2][4];
|
static uint32 BrightCLUT[2][4];
|
||||||
|
|
||||||
static float ColorLUTNoGC[2][256][3];
|
static float ECL_INVISIBLE ColorLUTNoGC[2][256][3];
|
||||||
static uint32 AnaSlowColorLUT[256][256];
|
static uint32 ECL_INVISIBLE AnaSlowColorLUT[256][256];
|
||||||
|
|
||||||
static bool VidSettingsDirty;
|
static bool VidSettingsDirty;
|
||||||
static bool ParallaxDisabled;
|
static bool ParallaxDisabled;
|
||||||
|
|
Loading…
Reference in New Issue