dsda: pass all non-sync settings to the core once they change

This commit is contained in:
feos 2025-04-19 21:44:12 +03:00
parent 9d80ea12b3
commit 45e16c0ec2
7 changed files with 78 additions and 10 deletions

Binary file not shown.

View File

@ -149,10 +149,23 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
}
}
PackedRenderInfo renderInfo = new PackedRenderInfo();
renderInfo.RenderVideo = renderVideo ? 1 : 0;
renderInfo.RenderAudio = renderAudio ? 1 : 0;
renderInfo.PlayerPointOfView = _settings.DisplayPlayer - 1;
PackedRenderInfo renderInfo = new PackedRenderInfo()
{
ScaleFactor = _settings.ScaleFactor,
Gamma = _settings.Gamma,
HeadsUpMode = (int)_settings.HeadsUpMode,
RenderVideo = renderVideo ? 1 : 0,
RenderAudio = renderAudio ? 1 : 0,
DoUpdate = _settings.DoUpdate ? 1 : 0,
ShowMessages = _settings.ShowMessages ? 1 : 0,
ReportSecrets = _settings.ReportSecrets ? 1 : 0,
DsdaExHud = _settings.DsdaExHud ? 1 : 0,
DisplayCommands = _settings.DisplayCommands ? 1 : 0,
MapTotals = _settings.MapTotals ? 1 : 0,
MapTime = _settings.MapTime ? 1 : 0,
MapCoordinates = _settings.MapCoordinates ? 1 : 0,
PlayerPointOfView = _settings.DisplayPlayer - 1,
};
IsLagFrame = _core.dsda_frame_advance(
commonButtons,
@ -162,6 +175,11 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
ref players[3],
ref renderInfo);
if (_settings.DoUpdate)
{
_settings.DoUpdate = false;
}
if (renderVideo)
UpdateVideo();

View File

@ -125,6 +125,9 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
[CoreSettings]
public class DoomSettings
{
[JsonIgnore]
public bool DoUpdate = false;
[DisplayName("Internal Resolution Scale Factor")]
[Description("Which factor to increase internal resolution by [1 - 12]. Affects \"quality\" of rendered image at the cost of accuracy. Native resolution is 320x200 resized to 4:3 DAR on a CRT monitor.")]
[Range(1, 12)]
@ -166,17 +169,17 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
[DisplayName("Automap Totals")]
[Description("Shows counts for kills, items, and secrets on automap.")]
[DefaultValue(true)]
[DefaultValue(false)]
public bool MapTotals { get; set; }
[DisplayName("Automap Time")]
[Description("Shows elapsed time on automap.")]
[DefaultValue(true)]
[DefaultValue(false)]
public bool MapTime { get; set; }
[DisplayName("Automap Coordinates")]
[Description("Shows in-level coordinates on automap.")]
[DefaultValue(true)]
[DefaultValue(false)]
public bool MapCoordinates { get; set; }
[JsonIgnore]
@ -193,8 +196,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
public DoomSettings Clone()
=> (DoomSettings)MemberwiseClone();
public static bool NeedsReboot(DoomSettings x, DoomSettings y)
=> !DeepEquality.DeepEquals(x, y);
public static bool NeedsReboot(DoomSettings x, DoomSettings y) => false;
}
public PutSettingsDirtyBits PutSettings(DoomSettings o)
{
@ -204,6 +206,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
if (_settings.DisplayPlayer == 2 && !_syncSettings.Player2Present) throw new Exception($"Trying to set display player '{_settings.DisplayPlayer}' but it is not active in this movie.");
if (_settings.DisplayPlayer == 3 && !_syncSettings.Player3Present) throw new Exception($"Trying to set display player '{_settings.DisplayPlayer}' but it is not active in this movie.");
if (_settings.DisplayPlayer == 4 && !_syncSettings.Player4Present) throw new Exception($"Trying to set display player '{_settings.DisplayPlayer}' but it is not active in this movie.");
_settings.DoUpdate = true;
return ret ? PutSettingsDirtyBits.RebootCore : PutSettingsDirtyBits.None;
}

View File

@ -75,7 +75,6 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
Console.WriteLine($"Reserving {totalWadSizeKb}kb for WAD file memory");
string hudMode = "";
switch (_settings.HeadsUpMode)
{
case HudMode.Vanilla:

View File

@ -59,8 +59,19 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
[StructLayout(LayoutKind.Sequential)]
public struct PackedRenderInfo
{
public int DoUpdate;
public int RenderVideo;
public int RenderAudio;
public int ScaleFactor;
public int Gamma;
public int ShowMessages;
public int ReportSecrets;
public int HeadsUpMode;
public int DsdaExHud;
public int DisplayCommands;
public int MapTotals;
public int MapTime;
public int MapCoordinates;
public int PlayerPointOfView;
}

View File

@ -159,6 +159,26 @@ ECL_EXPORT void dsda_get_video(int *w, int *h, int *pitch, uint8_t **buffer, int
ECL_EXPORT bool dsda_frame_advance(CommonButtons commonButtons, struct PackedPlayerInput *player1Inputs, struct PackedPlayerInput *player2Inputs, struct PackedPlayerInput *player3Inputs, struct PackedPlayerInput *player4Inputs, struct PackedRenderInfo *renderInfo)
{
if (renderInfo->DoUpdate)
{
char setting_buffer[512];
sprintf(setting_buffer, "%dx%d", NATIVE_X * renderInfo->ScaleFactor, NATIVE_Y * renderInfo->ScaleFactor);
dsda_UpdateStringConfig(dsda_config_screen_resolution, setting_buffer, true);
printf("dsda_config_screen_resolution = %s\n", setting_buffer);
dsda_UpdateIntConfig(dsda_config_screenblocks, renderInfo->HeadsUpMode ? 11 : 10, true);
dsda_UpdateIntConfig(dsda_config_hud_displayed, renderInfo->HeadsUpMode == 2 ? 0 : 1, true);
dsda_UpdateIntConfig(dsda_config_usegamma, renderInfo->Gamma, true);
dsda_UpdateIntConfig(dsda_config_show_messages, renderInfo->ShowMessages, true);
dsda_UpdateIntConfig(dsda_config_hudadd_secretarea, renderInfo->ReportSecrets, true);
dsda_UpdateIntConfig(dsda_config_exhud, renderInfo->DsdaExHud, true);
dsda_UpdateIntConfig(dsda_config_command_display, renderInfo->DisplayCommands, true);
dsda_UpdateIntConfig(dsda_config_map_totals, renderInfo->MapTotals, true);
dsda_UpdateIntConfig(dsda_config_map_time, renderInfo->MapTime, true);
dsda_UpdateIntConfig(dsda_config_map_coordinates, renderInfo->MapCoordinates, true);
}
// Setting inputs
headlessClearTickCommand();
common_input(commonButtons);

View File

@ -90,6 +90,12 @@ enum MemoryArrayType
ARRAY_SECTORS = 2
};
enum NativeResolution
{
NATIVE_X = 320,
NATIVE_Y = 200
};
typedef union
{
struct
@ -150,8 +156,19 @@ struct PackedPlayerInput
struct PackedRenderInfo
{
int DoUpdate;
int RenderVideo;
int RenderAudio;
int ScaleFactor;
int Gamma;
int ShowMessages;
int ReportSecrets;
int HeadsUpMode;
int DsdaExHud;
int DisplayCommands;
int MapTotals;
int MapTime;
int MapCoordinates;
int PlayerPointOfView;
} __attribute__((packed));