dsda: set full render info before we emulate anything
gamma was correct on startup but other settings were only applied on first emulated frame frame 0 will be blank with and without wipescreen
This commit is contained in:
parent
adf8e38c7e
commit
080017b800
Binary file not shown.
|
@ -15,11 +15,38 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
|||
public int VsyncDenominator { get; }
|
||||
public int[] GetVideoBuffer() => _vidBuff;
|
||||
|
||||
private unsafe void UpdateVideo(int gamma = -1)
|
||||
private void InitVideo()
|
||||
{
|
||||
var renderInfo = new LibDSDA.PackedRenderInfo()
|
||||
{
|
||||
SfxVolume = _settings.SfxVolume,
|
||||
MusicVolume = _settings.MusicVolume,
|
||||
Gamma = _settings.Gamma,
|
||||
HeadsUpMode = (int) _settings.HeadsUpMode,
|
||||
MapDetails = (int) _settings.MapDetails,
|
||||
MapOverlay = (int) _settings.MapOverlay,
|
||||
RenderVideo = 1,
|
||||
RenderAudio = 1,
|
||||
ShowMessages = Convert.ToInt32(_settings.ShowMessages),
|
||||
ReportSecrets = Convert.ToInt32(_settings.ReportSecrets),
|
||||
DsdaExHud = Convert.ToInt32(_settings.DsdaExHud),
|
||||
DisplayCoordinates = Convert.ToInt32(_settings.DisplayCoordinates),
|
||||
DisplayCommands = Convert.ToInt32(_settings.DisplayCommands),
|
||||
MapTotals = Convert.ToInt32(_settings.MapTotals),
|
||||
MapTime = Convert.ToInt32(_settings.MapTime),
|
||||
MapCoordinates = Convert.ToInt32(_settings.MapCoordinates),
|
||||
PlayerPointOfView = _settings.DisplayPlayer - 1,
|
||||
};
|
||||
|
||||
_core.dsda_init_video(ref renderInfo);
|
||||
_vidBuff = new int[BufferWidth * BufferHeight];
|
||||
}
|
||||
|
||||
private unsafe void UpdateVideo(bool init = false)
|
||||
{
|
||||
using (_elf.EnterExit())
|
||||
{
|
||||
_core.dsda_get_video(gamma, out var vi);
|
||||
_core.dsda_get_video(out var vi);
|
||||
|
||||
int[] _palBuffer = [ ];
|
||||
var videoBuffer = (byte*)vi.VideoBuffer.ToPointer();
|
||||
|
|
|
@ -216,10 +216,9 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
|||
_elf.Seal();
|
||||
}
|
||||
|
||||
// we have to set gamma after the core is sealed to ensure states don't depend on its initial value
|
||||
// but if we set it during frame advance, first frame won't have it set
|
||||
// so we set gamma here and force a video update, and other UpdateVideo() calls are blank
|
||||
UpdateVideo(_settings.Gamma);
|
||||
// we have to set render info after the core is sealed to ensure
|
||||
// states don't depend on its initial value
|
||||
InitVideo();
|
||||
|
||||
// Registering memory domains
|
||||
SetupMemoryDomains();
|
||||
|
|
|
@ -119,7 +119,10 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
|||
public abstract bool dsda_init(ref InitSettings settings, int argc, string[] argv);
|
||||
|
||||
[BizImport(CallingConvention.Cdecl)]
|
||||
public abstract void dsda_get_video(int gamma, out VideoInfo info);
|
||||
public abstract void dsda_init_video(ref PackedRenderInfo renderInfo);
|
||||
|
||||
[BizImport(CallingConvention.Cdecl)]
|
||||
public abstract void dsda_get_video(out VideoInfo videoInfo);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate int load_archive_cb(string filename, IntPtr buffer, int maxsize);
|
||||
|
|
|
@ -222,14 +222,8 @@ ECL_EXPORT void dsda_get_audio(int *n, void **buffer)
|
|||
*buffer = audioBuffer;
|
||||
}
|
||||
|
||||
ECL_EXPORT void dsda_get_video(int gamma, struct VideoInfo* vi)
|
||||
ECL_EXPORT void dsda_get_video(struct VideoInfo* vi)
|
||||
{
|
||||
if (gamma != -1)
|
||||
{
|
||||
dsda_UpdateIntConfig(dsda_config_usegamma, gamma, true);
|
||||
headlessUpdateVideo();
|
||||
}
|
||||
|
||||
vi->buffer = (uint8_t *)headlessGetVideoBuffer();
|
||||
vi->width = headlessGetVideoWidth();
|
||||
vi->height = headlessGetVideoHeight();
|
||||
|
@ -250,9 +244,14 @@ ECL_EXPORT void dsda_get_video(int gamma, struct VideoInfo* vi)
|
|||
vi->paletteBuffer = _convertedPaletteBuffer;
|
||||
}
|
||||
|
||||
ECL_EXPORT void dsda_init_video(struct PackedRenderInfo *renderInfo)
|
||||
{
|
||||
render_updates(renderInfo);
|
||||
headlessUpdateVideo();
|
||||
}
|
||||
|
||||
ECL_EXPORT bool dsda_frame_advance(AutomapButtons buttons, struct PackedPlayerInput *player1Inputs, struct PackedPlayerInput *player2Inputs, struct PackedPlayerInput *player3Inputs, struct PackedPlayerInput *player4Inputs, struct PackedRenderInfo *renderInfo)
|
||||
{
|
||||
// Live render changes
|
||||
if (renderInfo->RenderVideo)
|
||||
render_updates(renderInfo);
|
||||
|
||||
|
|
Loading…
Reference in New Issue