Video: Split fullscreen refresh rate option into 2 (ntsc/pal)

This commit is contained in:
Sour 2023-02-18 22:38:38 -05:00
parent fea92478f9
commit 9504973e7c
9 changed files with 50 additions and 28 deletions

View file

@ -237,6 +237,8 @@ void NesConsole::UpdateRegion(bool forceUpdate)
void NesConsole::RunFrame()
{
UpdateRegion();
uint32_t frame = _ppu->GetFrameCount();
if(_nextFrameOverclockDisabled) {

View file

@ -57,6 +57,8 @@ void SnesConsole::Release()
void SnesConsole::RunFrame()
{
UpdateRegion();
_frameRunning = true;
while(_frameRunning) {
@ -201,7 +203,6 @@ void SnesConsole::UpdateRegion()
double SnesConsole::GetFps()
{
UpdateRegion();
if(_region == ConsoleRegion::Ntsc) {
return 60.0988118623484;
} else {

View file

@ -105,7 +105,8 @@ struct VideoConfig
bool FullscreenForceIntegerScale = false;
bool UseExclusiveFullscreen = false;
uint32_t ExclusiveFullscreenRefreshRate = 60;
uint32_t ExclusiveFullscreenRefreshRateNtsc = 60;
uint32_t ExclusiveFullscreenRefreshRatePal = 50;
uint32_t FullscreenResWidth = 0;
uint32_t FullscreenResHeight = 0;

View file

@ -43,7 +43,8 @@ namespace Mesen.Config
[Reactive] public bool FullscreenForceIntegerScale { get; set; } = false;
[Reactive] public bool UseExclusiveFullscreen { get; set; } = false;
[Reactive] public UInt32 ExclusiveFullscreenRefreshRate { get; set; } = 60;
[Reactive] public UInt32 ExclusiveFullscreenRefreshRateNtsc { get; set; } = 60;
[Reactive] public UInt32 ExclusiveFullscreenRefreshRatePal { get; set; } = 50;
[Reactive] public FullscreenResolution ExclusiveFullscreenResolution { get; set; } = 0;
[Reactive] public ScreenRotation ScreenRotation { get; set; } = ScreenRotation.None;
@ -85,7 +86,8 @@ namespace Mesen.Config
FullscreenForceIntegerScale = this.FullscreenForceIntegerScale,
UseExclusiveFullscreen = this.UseExclusiveFullscreen,
ExclusiveFullscreenRefreshRate = this.ExclusiveFullscreenRefreshRate,
ExclusiveFullscreenRefreshRateNtsc = this.ExclusiveFullscreenRefreshRateNtsc,
ExclusiveFullscreenRefreshRatePal = this.ExclusiveFullscreenRefreshRatePal,
FullscreenResWidth = (uint)(ExclusiveFullscreenResolution == FullscreenResolution.Default ? (ApplicationHelper.GetMainWindow()?.Screens.Primary?.Bounds.Width ?? 1920) : ExclusiveFullscreenResolution.GetWidth()),
FullscreenResHeight = (uint)(ExclusiveFullscreenResolution == FullscreenResolution.Default ? (ApplicationHelper.GetMainWindow()?.Screens.Primary?.Bounds.Height ?? 1080) : ExclusiveFullscreenResolution.GetHeight()),
@ -127,7 +129,8 @@ namespace Mesen.Config
[MarshalAs(UnmanagedType.I1)] public bool FullscreenForceIntegerScale;
[MarshalAs(UnmanagedType.I1)] public bool UseExclusiveFullscreen;
public UInt32 ExclusiveFullscreenRefreshRate;
public UInt32 ExclusiveFullscreenRefreshRateNtsc;
public UInt32 ExclusiveFullscreenRefreshRatePal;
public UInt32 FullscreenResWidth;
public UInt32 FullscreenResHeight;

View file

@ -146,7 +146,8 @@
<Control ID="lblFullscreenResolution">Fullscreen Resolution:</Control>
<Control ID="chkFullscreenForceIntegerScale">Use integer scale values when entering fullscreen mode</Control>
<Control ID="chkUseExclusiveFullscreen">Use exclusive fullscreen mode</Control>
<Control ID="lblRequestedRefreshRate">Requested Refresh Rate:</Control>
<Control ID="lblRequestedRefreshRateNtsc">Refresh Rate (NTSC / 60 Hz):</Control>
<Control ID="lblRequestedRefreshRatePal">Refresh Rate (PAL / 50 Hz):</Control>
<Control ID="chkEnableGameSpecificOverscan">Enable game-specific overscan settings</Control>
<Control ID="tpgPicture">Picture</Control>
@ -2223,16 +2224,16 @@
</Enum>
<Enum ID="RecordMovieFrom">
<Value ID="StartWithoutSaveData">Power on</Value>
<Value ID="StartWithSaveData">Power <Value ID="on">on</Value>, with save data</Value>
<Value ID="StartWithSaveData">Power on, with save data</Value>
<Value ID="CurrentState">Current state</Value>
</Enum>
<Enum ID="AudioSampleRate">
<Value ID="_11025"><Value ID="11">11</Value>,025 Hz</Value>
<Value ID="_22050"><Value ID="22">22</Value>,050 Hz</Value>
<Value ID="_32000"><Value ID="32">32</Value>,000 Hz</Value>
<Value ID="_44100"><Value ID="44">44</Value>,100 Hz</Value>
<Value ID="_48000"><Value ID="48">48</Value>,000 Hz</Value>
<Value ID="_96000"><Value ID="96">96</Value>,000 Hz</Value>
<Value ID="_11025">11,025 Hz</Value>
<Value ID="_22050">>22,050 Hz</Value>
<Value ID="_32000">32,000 Hz</Value>
<Value ID="_44100">44,100 Hz</Value>
<Value ID="_48000">48,000 Hz</Value>
<Value ID="_96000">96,000 Hz</Value>
</Enum>
<Enum ID="StereoFilter">
<Value ID="None">None</Value>

View file

@ -25,7 +25,7 @@ namespace Mesen.ViewModels
public ReactiveCommand<Unit, Unit> ResetPictureSettingsCommand { get; }
[Reactive] public VideoConfig Config { get; set; }
public UInt32[] AvailableRefreshRates { get; } = new UInt32[] { 50, 60, 75, 100, 120, 144, 200, 240 };
public UInt32[] AvailableRefreshRates { get; } = new UInt32[] { 50, 60, 75, 100, 120, 144, 200, 240, 360 };
public VideoConfigViewModel()
{

View file

@ -17,6 +17,15 @@
<vm:VideoConfigViewModel />
</Design.DataContext>
<UserControl.DataTemplates>
<DataTemplate DataType="{x:Type x:UInt32}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding}" />
<TextBlock Text=" Hz" />
</StackPanel>
</DataTemplate>
</UserControl.DataTemplates>
<TabControl TabStripPlacement="Top" SelectedIndex="0">
<TabItem Header="{l:Translate tpgGeneral}">
<ScrollViewer AllowAutoHide="False" HorizontalScrollBarVisibility="Auto" Padding="0 0 2 0">
@ -51,21 +60,19 @@
<TextBlock Grid.Row="0" Grid.Column="0" Text="{l:Translate lblFullscreenResolution}" />
<c:EnumComboBox Grid.Row="0" Grid.Column="1" SelectedItem="{CompiledBinding Config.ExclusiveFullscreenResolution}" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="{l:Translate lblRequestedRefreshRate}" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="{l:Translate lblRequestedRefreshRateNtsc}" />
<ComboBox
Grid.Row="1" Grid.Column="1"
SelectedItem="{CompiledBinding Config.ExclusiveFullscreenRefreshRate}"
SelectedItem="{CompiledBinding Config.ExclusiveFullscreenRefreshRateNtsc}"
Items="{CompiledBinding AvailableRefreshRates}"
>
<ComboBox.DataTemplates>
<DataTemplate DataType="{x:Type x:UInt32}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding}" />
<TextBlock Text=" Hz" />
</StackPanel>
</DataTemplate>
</ComboBox.DataTemplates>
</ComboBox>
/>
<TextBlock Grid.Row="2" Grid.Column="0" Text="{l:Translate lblRequestedRefreshRatePal}" />
<ComboBox
Grid.Row="2" Grid.Column="1"
SelectedItem="{CompiledBinding Config.ExclusiveFullscreenRefreshRatePal}"
Items="{CompiledBinding AvailableRefreshRates}"
/>
</Grid>
</StackPanel>
</StackPanel>

View file

@ -47,6 +47,7 @@ void Renderer::SetScreenSize(uint32_t width, uint32_t height)
{
VideoConfig cfg = _emu->GetSettings()->GetVideoConfig();
FrameInfo rendererSize = _emu->GetVideoRenderer()->GetRendererSize();
uint32_t refreshRate = _emu->GetFps() < 55 ? cfg.ExclusiveFullscreenRefreshRatePal : cfg.ExclusiveFullscreenRefreshRateNtsc;
auto needUpdate = [=] {
return (
@ -55,7 +56,8 @@ void Renderer::SetScreenSize(uint32_t width, uint32_t height)
_screenHeight != rendererSize.Height ||
_screenWidth != rendererSize.Width ||
_newFullscreen != _fullscreen ||
_useSrgbTextureFormat != cfg.UseSrgbTextureFormat
_useSrgbTextureFormat != cfg.UseSrgbTextureFormat ||
(_fullscreen && _fullscreenRefreshRate != refreshRate)
);
};
@ -82,6 +84,10 @@ void Renderer::SetScreenSize(uint32_t width, uint32_t height)
}
_fullscreen = _newFullscreen;
if(_fullscreenRefreshRate != refreshRate) {
_fullscreenRefreshRate = refreshRate;
needReset = true;
}
_screenHeight = rendererSize.Height;
_screenWidth = rendererSize.Width;
@ -288,7 +294,7 @@ HRESULT Renderer::InitDevice()
sd.BufferDesc.Width = _realScreenWidth;
sd.BufferDesc.Height = _realScreenHeight;
sd.BufferDesc.Format = GetTextureFormat();
sd.BufferDesc.RefreshRate.Numerator = _emu->GetSettings()->GetVideoConfig().ExclusiveFullscreenRefreshRate;
sd.BufferDesc.RefreshRate.Numerator = _fullscreenRefreshRate;
sd.BufferDesc.RefreshRate.Denominator = 1;
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
sd.Flags = _fullscreen ? DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH : 0;

View file

@ -54,6 +54,7 @@ private:
bool _newFullscreen = false;
bool _fullscreen = false;
uint32_t _fullscreenRefreshRate = 60;
bool _useSrgbTextureFormat = false;
uint32_t _screenWidth = 0;