Video: Output standard resolution frames in 256x239 instead of always doubling resolution
This commit is contained in:
parent
5d79229f3a
commit
f16970a2fd
10 changed files with 170 additions and 100 deletions
|
@ -26,10 +26,11 @@ void BaseVideoFilter::SetBaseFrameInfo(FrameInfo frameInfo)
|
||||||
|
|
||||||
FrameInfo BaseVideoFilter::GetFrameInfo()
|
FrameInfo BaseVideoFilter::GetFrameInfo()
|
||||||
{
|
{
|
||||||
|
int overscanMultiplier = _baseFrameInfo.Width == 512 ? 2 : 1;
|
||||||
FrameInfo frameInfo = _baseFrameInfo;
|
FrameInfo frameInfo = _baseFrameInfo;
|
||||||
OverscanDimensions overscan = GetOverscan();
|
OverscanDimensions overscan = GetOverscan();
|
||||||
frameInfo.Width -= overscan.Left * 2 + overscan.Right * 2;
|
frameInfo.Width -= overscan.Left * overscanMultiplier + overscan.Right * overscanMultiplier;
|
||||||
frameInfo.Height -= overscan.Top * 2 + overscan.Bottom * 2;
|
frameInfo.Height -= overscan.Top * overscanMultiplier + overscan.Bottom * overscanMultiplier;
|
||||||
return frameInfo;
|
return frameInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,20 +89,22 @@ void DefaultVideoFilter::ApplyFilter(uint16_t *ppuOutputBuffer)
|
||||||
FrameInfo frameInfo = GetFrameInfo();
|
FrameInfo frameInfo = GetFrameInfo();
|
||||||
OverscanDimensions overscan = GetOverscan();
|
OverscanDimensions overscan = GetOverscan();
|
||||||
|
|
||||||
uint32_t xOffset = overscan.Left * 2;
|
int overscanMultiplier = _baseFrameInfo.Width == 512 ? 2 : 1;
|
||||||
uint32_t yOffset = overscan.Top * 2 * 512;
|
uint32_t width = _baseFrameInfo.Width;
|
||||||
|
uint32_t xOffset = overscan.Left * overscanMultiplier;
|
||||||
|
uint32_t yOffset = overscan.Top * overscanMultiplier * width;
|
||||||
|
|
||||||
uint8_t scanlineIntensity = (uint8_t)((1.0 - _console->GetSettings()->GetVideoConfig().ScanlineIntensity) * 255);
|
uint8_t scanlineIntensity = (uint8_t)((1.0 - _console->GetSettings()->GetVideoConfig().ScanlineIntensity) * 255);
|
||||||
if(scanlineIntensity < 255) {
|
if(scanlineIntensity < 255) {
|
||||||
for(uint32_t i = 0; i < frameInfo.Height; i++) {
|
for(uint32_t i = 0; i < frameInfo.Height; i++) {
|
||||||
if(i & 0x01) {
|
if(i & 0x01) {
|
||||||
for(uint32_t j = 0; j < frameInfo.Width; j++) {
|
for(uint32_t j = 0; j < frameInfo.Width; j++) {
|
||||||
*out = ApplyScanlineEffect(_calculatedPalette[ppuOutputBuffer[i * 512 + j + yOffset + xOffset]], scanlineIntensity);
|
*out = ApplyScanlineEffect(_calculatedPalette[ppuOutputBuffer[i * width + j + yOffset + xOffset]], scanlineIntensity);
|
||||||
out++;
|
out++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for(uint32_t j = 0; j < frameInfo.Width; j++) {
|
for(uint32_t j = 0; j < frameInfo.Width; j++) {
|
||||||
*out = _calculatedPalette[ppuOutputBuffer[i * 512 + j + yOffset + xOffset]];
|
*out = _calculatedPalette[ppuOutputBuffer[i * width + j + yOffset + xOffset]];
|
||||||
out++;
|
out++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,7 +112,7 @@ void DefaultVideoFilter::ApplyFilter(uint16_t *ppuOutputBuffer)
|
||||||
} else {
|
} else {
|
||||||
for(uint32_t i = 0; i < frameInfo.Height; i++) {
|
for(uint32_t i = 0; i < frameInfo.Height; i++) {
|
||||||
for(uint32_t j = 0; j < frameInfo.Width; j++) {
|
for(uint32_t j = 0; j < frameInfo.Width; j++) {
|
||||||
out[i*frameInfo.Width+j] = _calculatedPalette[ppuOutputBuffer[i * 512 + j + yOffset + xOffset]];
|
out[i*frameInfo.Width+j] = _calculatedPalette[ppuOutputBuffer[i * width + j + yOffset + xOffset]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,8 +81,8 @@ public:
|
||||||
_argbBuffer = argbBuffer;
|
_argbBuffer = argbBuffer;
|
||||||
_overscan = overscan;
|
_overscan = overscan;
|
||||||
_lineWidth = lineWidth;
|
_lineWidth = lineWidth;
|
||||||
_yScale = 2; //TODO
|
_yScale = lineWidth >= 512 ? 2 : 1;
|
||||||
_xScale = 2; //TODO
|
_xScale = lineWidth >= 512 ? 2.0f : 1.0f;
|
||||||
|
|
||||||
InternalDraw();
|
InternalDraw();
|
||||||
|
|
||||||
|
|
|
@ -415,10 +415,12 @@ int LuaApi::GetScreenBuffer(lua_State *lua)
|
||||||
{
|
{
|
||||||
LuaCallHelper l(lua);
|
LuaCallHelper l(lua);
|
||||||
|
|
||||||
|
int multiplier = _ppu->IsHighResOutput() ? 2 : 1;
|
||||||
|
|
||||||
lua_newtable(lua);
|
lua_newtable(lua);
|
||||||
for(int y = 0; y < 239; y++) {
|
for(int y = 0; y < 239; y++) {
|
||||||
for(int x = 0; x < 256; x++) {
|
for(int x = 0; x < 256; x++) {
|
||||||
lua_pushinteger(lua, DefaultVideoFilter::ToArgb(*(_ppu->GetScreenBuffer() + y * 1024 + x * 2)) & 0xFFFFFF);
|
lua_pushinteger(lua, DefaultVideoFilter::ToArgb(*(_ppu->GetScreenBuffer() + y * 256 * multiplier * multiplier + x * multiplier)) & 0xFFFFFF);
|
||||||
lua_rawseti(lua, -2, (y << 8) + x);
|
lua_rawseti(lua, -2, (y << 8) + x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -450,8 +452,10 @@ int LuaApi::GetPixel(lua_State *lua)
|
||||||
checkparams();
|
checkparams();
|
||||||
errorCond(x < 0 || x > 255 || y < 0 || y > 238, "invalid x,y coordinates (must be between 0-255, 0-238)");
|
errorCond(x < 0 || x > 255 || y < 0 || y > 238, "invalid x,y coordinates (must be between 0-255, 0-238)");
|
||||||
|
|
||||||
|
int multiplier = _ppu->IsHighResOutput() ? 2 : 1;
|
||||||
|
|
||||||
//Ignores intensify & grayscale bits
|
//Ignores intensify & grayscale bits
|
||||||
l.Return(DefaultVideoFilter::ToArgb(*(_ppu->GetScreenBuffer() + y * 1024 + x * 2)) & 0xFFFFFF);
|
l.Return(DefaultVideoFilter::ToArgb(*(_ppu->GetScreenBuffer() + y * 256 * multiplier * multiplier + x * multiplier)) & 0xFFFFFF);
|
||||||
return l.ReturnCount();
|
return l.ReturnCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,13 @@ NtscFilter::NtscFilter(shared_ptr<Console> console) : BaseVideoFilter(console)
|
||||||
|
|
||||||
FrameInfo NtscFilter::GetFrameInfo()
|
FrameInfo NtscFilter::GetFrameInfo()
|
||||||
{
|
{
|
||||||
FrameInfo frameInfo = BaseVideoFilter::GetFrameInfo();
|
|
||||||
OverscanDimensions overscan = GetOverscan();
|
OverscanDimensions overscan = GetOverscan();
|
||||||
frameInfo.Width = SNES_NTSC_OUT_WIDTH(_baseFrameInfo.Width / 2) - overscan.Left * 2 - overscan.Right * 2;
|
int widthDivider = _baseFrameInfo.Width == 512 ? 2 : 1;
|
||||||
|
int heightMultiplier = _baseFrameInfo.Width == 512 ? 1 : 2;
|
||||||
|
|
||||||
|
FrameInfo frameInfo;
|
||||||
|
frameInfo.Width = SNES_NTSC_OUT_WIDTH(_baseFrameInfo.Width / widthDivider) - overscan.Left*2 - overscan.Right*2;
|
||||||
|
frameInfo.Height = _baseFrameInfo.Height * heightMultiplier - overscan.Top*2 - overscan.Bottom*2;
|
||||||
return frameInfo;
|
return frameInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,22 +51,29 @@ void NtscFilter::ApplyFilter(uint16_t *ppuOutputBuffer)
|
||||||
{
|
{
|
||||||
FrameInfo frameInfo = GetFrameInfo();
|
FrameInfo frameInfo = GetFrameInfo();
|
||||||
OverscanDimensions overscan = GetOverscan();
|
OverscanDimensions overscan = GetOverscan();
|
||||||
|
|
||||||
|
bool useHighResOutput = _baseFrameInfo.Width == 512;
|
||||||
uint32_t baseWidth = SNES_NTSC_OUT_WIDTH(256);
|
uint32_t baseWidth = SNES_NTSC_OUT_WIDTH(256);
|
||||||
uint32_t xOffset = overscan.Left * 2;
|
uint32_t xOffset = overscan.Left * 2;
|
||||||
uint32_t yOffset = overscan.Top * 2 * baseWidth;
|
uint32_t yOffset = overscan.Top * 2 * baseWidth;
|
||||||
|
|
||||||
snes_ntsc_blit_hires(&_ntscData, ppuOutputBuffer, 512, IsOddFrame() ? 0 : 1, 512, frameInfo.Height, _ntscBuffer, SNES_NTSC_OUT_WIDTH(256)*4);
|
if(useHighResOutput) {
|
||||||
|
snes_ntsc_blit_hires(&_ntscData, ppuOutputBuffer, 512, IsOddFrame() ? 0 : 1, 512, _baseFrameInfo.Height, _ntscBuffer, SNES_NTSC_OUT_WIDTH(256) * 4);
|
||||||
|
} else {
|
||||||
|
snes_ntsc_blit(&_ntscData, ppuOutputBuffer, 256, IsOddFrame() ? 0 : 1, 256, _baseFrameInfo.Height, _ntscBuffer, SNES_NTSC_OUT_WIDTH(256) * 8);
|
||||||
|
}
|
||||||
VideoConfig cfg = _console->GetSettings()->GetVideoConfig();
|
VideoConfig cfg = _console->GetSettings()->GetVideoConfig();
|
||||||
|
|
||||||
if(cfg.ScanlineIntensity == 0) {
|
if(cfg.ScanlineIntensity == 0) {
|
||||||
for(uint32_t i = 0; i < frameInfo.Height; i++) {
|
for(uint32_t i = 0; i < frameInfo.Height; i+=2) {
|
||||||
memcpy(GetOutputBuffer()+i*frameInfo.Width, _ntscBuffer + yOffset + xOffset + i*baseWidth, frameInfo.Width * sizeof(uint32_t));
|
memcpy(GetOutputBuffer()+i*frameInfo.Width, _ntscBuffer + yOffset + xOffset + i*baseWidth, frameInfo.Width * sizeof(uint32_t));
|
||||||
|
memcpy(GetOutputBuffer()+(i+1)*frameInfo.Width, _ntscBuffer + yOffset + xOffset + i*baseWidth, frameInfo.Width * sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uint8_t intensity = (uint8_t)((1.0 - cfg.ScanlineIntensity) * 255);
|
uint8_t intensity = (uint8_t)((1.0 - cfg.ScanlineIntensity) * 255);
|
||||||
for(uint32_t i = 0; i < frameInfo.Height; i++) {
|
for(uint32_t i = 0; i < frameInfo.Height; i++) {
|
||||||
if(i & 0x01) {
|
if(i & 0x01) {
|
||||||
uint32_t *in = _ntscBuffer + yOffset + xOffset + i * baseWidth;
|
uint32_t *in = _ntscBuffer + yOffset + xOffset + (i - 1) * baseWidth;
|
||||||
uint32_t *out = GetOutputBuffer() + i * frameInfo.Width;
|
uint32_t *out = GetOutputBuffer() + i * frameInfo.Width;
|
||||||
for(uint32_t j = 0; j < frameInfo.Width; j++) {
|
for(uint32_t j = 0; j < frameInfo.Width; j++) {
|
||||||
out[j] = ApplyScanlineEffect(in[j], intensity);
|
out[j] = ApplyScanlineEffect(in[j], intensity);
|
||||||
|
|
57
Core/Ppu.cpp
57
Core/Ppu.cpp
|
@ -147,8 +147,6 @@ bool Ppu::ProcessEndOfScanline(uint16_t hClock)
|
||||||
_internalOamAddress = (_oamRamAddress << 1);
|
_internalOamAddress = (_oamRamAddress << 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_allowFrameSkip = !_console->GetVideoRenderer()->IsRecording() && (_console->GetSettings()->GetEmulationSpeed() == 0 || _console->GetSettings()->GetEmulationSpeed() > 150);
|
|
||||||
|
|
||||||
VideoConfig cfg = _console->GetSettings()->GetVideoConfig();
|
VideoConfig cfg = _console->GetSettings()->GetVideoConfig();
|
||||||
_configVisibleLayers = (cfg.HideBgLayer0 ? 0 : 1) | (cfg.HideBgLayer1 ? 0 : 2) | (cfg.HideBgLayer2 ? 0 : 4) | (cfg.HideBgLayer3 ? 0 : 8) | (cfg.HideSprites ? 0 : 16);
|
_configVisibleLayers = (cfg.HideBgLayer0 ? 0 : 1) | (cfg.HideBgLayer1 ? 0 : 2) | (cfg.HideBgLayer2 ? 0 : 4) | (cfg.HideBgLayer3 ? 0 : 8) | (cfg.HideSprites ? 0 : 16);
|
||||||
|
|
||||||
|
@ -161,6 +159,12 @@ bool Ppu::ProcessEndOfScanline(uint16_t hClock)
|
||||||
_regs->SetNmiFlag(true);
|
_regs->SetNmiFlag(true);
|
||||||
SendFrame();
|
SendFrame();
|
||||||
|
|
||||||
|
_allowFrameSkip = !_console->GetVideoRenderer()->IsRecording() && (_console->GetSettings()->GetEmulationSpeed() == 0 || _console->GetSettings()->GetEmulationSpeed() > 150);
|
||||||
|
if(!_allowFrameSkip || (_frameCount & 0x03) == 0) {
|
||||||
|
//If we're not skipping this frame, reset the high resolution flag
|
||||||
|
_useHighResOutput = false;
|
||||||
|
}
|
||||||
|
|
||||||
if(_regs->IsNmiEnabled()) {
|
if(_regs->IsNmiEnabled()) {
|
||||||
_console->GetCpu()->SetNmiFlag();
|
_console->GetCpu()->SetNmiFlag();
|
||||||
}
|
}
|
||||||
|
@ -1086,10 +1090,42 @@ void Ppu::ApplyBrightness()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Ppu::ConvertToHiRes()
|
||||||
|
{
|
||||||
|
uint16_t scanline = _overscanMode ? (_scanline - 1) : (_scanline + 6);
|
||||||
|
|
||||||
|
if(_drawStartX > 0) {
|
||||||
|
for(int x = 0; x < _drawStartX; x++) {
|
||||||
|
_currentBuffer[(scanline << 10) + (x << 1)] = _currentBuffer[(scanline << 8) + x];
|
||||||
|
_currentBuffer[(scanline << 10) + (x << 1) + 1] = _currentBuffer[(scanline << 8) + x];
|
||||||
|
}
|
||||||
|
memcpy(_currentBuffer + (scanline << 10) + 512, _currentBuffer + (scanline << 10), 512 * sizeof(uint16_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = scanline - 1; i >= 0; i--) {
|
||||||
|
for(int x = 0; x < 256; x++) {
|
||||||
|
_currentBuffer[(i << 10) + (x << 1)] = _currentBuffer[(i << 8) + x];
|
||||||
|
_currentBuffer[(i << 10) + (x << 1) + 1] = _currentBuffer[(i << 8) + x];
|
||||||
|
}
|
||||||
|
memcpy(_currentBuffer + (i << 10) + 512, _currentBuffer + (i << 10), 512 * sizeof(uint16_t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Ppu::ApplyHiResMode()
|
void Ppu::ApplyHiResMode()
|
||||||
{
|
{
|
||||||
//When overscan mode is off, center the 224-line picture in the center of the 239-line output buffer
|
//When overscan mode is off, center the 224-line picture in the center of the 239-line output buffer
|
||||||
uint16_t scanline = _overscanMode ? (_scanline - 1) : (_scanline + 6);
|
uint16_t scanline = _overscanMode ? (_scanline - 1) : (_scanline + 6);
|
||||||
|
|
||||||
|
bool useHighResOutput = _useHighResOutput || IsDoubleWidth() || IsDoubleHeight();
|
||||||
|
if(_useHighResOutput != useHighResOutput) {
|
||||||
|
//Convert standard res picture to high resolution when the PPU starts drawing in high res mid frame
|
||||||
|
ConvertToHiRes();
|
||||||
|
_useHighResOutput = useHighResOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!_useHighResOutput) {
|
||||||
|
memcpy(_currentBuffer + (scanline << 8) + _drawStartX, _mainScreenBuffer + _drawStartX, (_drawEndX - _drawStartX + 1) << 2);
|
||||||
|
} else {
|
||||||
uint32_t screenY = IsDoubleHeight() ? (_oddFrame ? ((scanline << 1) + 1) : (scanline << 1)) : (scanline << 1);
|
uint32_t screenY = IsDoubleHeight() ? (_oddFrame ? ((scanline << 1) + 1) : (scanline << 1)) : (scanline << 1);
|
||||||
uint32_t baseAddr = (screenY << 9);
|
uint32_t baseAddr = (screenY << 9);
|
||||||
|
|
||||||
|
@ -1114,6 +1150,7 @@ void Ppu::ApplyHiResMode()
|
||||||
(_drawEndX - _drawStartX + 1) << 2
|
(_drawEndX - _drawStartX + 1) << 2
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<uint8_t layerIndex>
|
template<uint8_t layerIndex>
|
||||||
|
@ -1151,15 +1188,17 @@ void Ppu::ProcessWindowMaskSettings(uint8_t value, uint8_t offset)
|
||||||
|
|
||||||
void Ppu::SendFrame()
|
void Ppu::SendFrame()
|
||||||
{
|
{
|
||||||
constexpr uint16_t width = 512;
|
uint16_t width = _useHighResOutput ? 512 : 256;
|
||||||
constexpr uint16_t height = 478;
|
uint16_t height = _useHighResOutput ? 478 : 239;
|
||||||
|
|
||||||
_console->GetNotificationManager()->SendNotification(ConsoleNotificationType::PpuFrameDone);
|
_console->GetNotificationManager()->SendNotification(ConsoleNotificationType::PpuFrameDone);
|
||||||
|
|
||||||
if(!_overscanMode) {
|
if(!_overscanMode) {
|
||||||
//Clear the top 7 and bottom 8 rows
|
//Clear the top 7 and bottom 8 rows
|
||||||
memset(_currentBuffer, 0, width * 14 * sizeof(uint16_t));
|
int top = (_useHighResOutput ? 14 : 7);
|
||||||
memset(_currentBuffer + width * 462, 0, width * 16 * sizeof(uint16_t));
|
int bottom = (_useHighResOutput ? 16 : 8);
|
||||||
|
memset(_currentBuffer, 0, width * top * sizeof(uint16_t));
|
||||||
|
memset(_currentBuffer + width * (height - bottom), 0, width * bottom * sizeof(uint16_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isRewinding = _console->GetRewindManager()->IsRewinding();
|
bool isRewinding = _console->GetRewindManager()->IsRewinding();
|
||||||
|
@ -1178,6 +1217,12 @@ void Ppu::SendFrame()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Ppu::IsHighResOutput()
|
||||||
|
{
|
||||||
|
return _useHighResOutput;
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t* Ppu::GetScreenBuffer()
|
uint16_t* Ppu::GetScreenBuffer()
|
||||||
{
|
{
|
||||||
return _currentBuffer;
|
return _currentBuffer;
|
||||||
|
|
|
@ -79,6 +79,7 @@ private:
|
||||||
|
|
||||||
uint16_t *_outputBuffers[2] = {};
|
uint16_t *_outputBuffers[2] = {};
|
||||||
uint16_t *_currentBuffer = nullptr;
|
uint16_t *_currentBuffer = nullptr;
|
||||||
|
bool _useHighResOutput = false;
|
||||||
|
|
||||||
SpriteInfo _sprites[33] = {};
|
SpriteInfo _sprites[33] = {};
|
||||||
uint8_t _spriteCount = 0;
|
uint8_t _spriteCount = 0;
|
||||||
|
@ -201,6 +202,7 @@ private:
|
||||||
template<bool forMainScreen>
|
template<bool forMainScreen>
|
||||||
void ApplyBrightness();
|
void ApplyBrightness();
|
||||||
|
|
||||||
|
void ConvertToHiRes();
|
||||||
void ApplyHiResMode();
|
void ApplyHiResMode();
|
||||||
|
|
||||||
template<uint8_t layerIndex>
|
template<uint8_t layerIndex>
|
||||||
|
@ -235,6 +237,7 @@ public:
|
||||||
bool ProcessEndOfScanline(uint16_t hClock);
|
bool ProcessEndOfScanline(uint16_t hClock);
|
||||||
uint16_t GetLastScanline();
|
uint16_t GetLastScanline();
|
||||||
|
|
||||||
|
bool IsHighResOutput();
|
||||||
uint16_t* GetScreenBuffer();
|
uint16_t* GetScreenBuffer();
|
||||||
uint8_t* GetVideoRam();
|
uint8_t* GetVideoRam();
|
||||||
uint8_t* GetCgRam();
|
uint8_t* GetCgRam();
|
||||||
|
|
|
@ -41,12 +41,16 @@ ScreenSize VideoDecoder::GetScreenSize(bool ignoreScale)
|
||||||
FrameInfo frameInfo = _videoFilter->GetFrameInfo();
|
FrameInfo frameInfo = _videoFilter->GetFrameInfo();
|
||||||
double aspectRatio = _console->GetSettings()->GetAspectRatio(_console->GetRegion());
|
double aspectRatio = _console->GetSettings()->GetAspectRatio(_console->GetRegion());
|
||||||
double scale = (ignoreScale ? 1 : _console->GetSettings()->GetVideoConfig().VideoScale);
|
double scale = (ignoreScale ? 1 : _console->GetSettings()->GetVideoConfig().VideoScale);
|
||||||
size.Width = (int32_t)(frameInfo.Width * scale / 2);
|
|
||||||
size.Height = (int32_t)(frameInfo.Height * scale / 2);
|
bool useHighResOutput = _baseFrameInfo.Width >= 512 || _videoFilterType == VideoFilterType::NTSC;
|
||||||
|
int divider = useHighResOutput ? 2 : 1;
|
||||||
|
|
||||||
|
size.Width = (int32_t)(frameInfo.Width * scale / divider);
|
||||||
|
size.Height = (int32_t)(frameInfo.Height * scale / divider);
|
||||||
if(aspectRatio != 0.0) {
|
if(aspectRatio != 0.0) {
|
||||||
uint32_t originalHeight = frameInfo.Height + (overscan.Top + overscan.Bottom) * 2;
|
uint32_t originalHeight = frameInfo.Height + (overscan.Top + overscan.Bottom) * divider;
|
||||||
uint32_t originalWidth = frameInfo.Width + (overscan.Left + overscan.Right) * 2;
|
uint32_t originalWidth = frameInfo.Width + (overscan.Left + overscan.Right) * divider;
|
||||||
size.Width = (uint32_t)(originalHeight * scale * aspectRatio * ((double)frameInfo.Width / originalWidth)) / 2;
|
size.Width = (uint32_t)(originalHeight * scale * aspectRatio * ((double)frameInfo.Width / originalWidth)) / divider;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
if(!_skipMode && _sendFrame) {
|
if(!_skipMode && _sendFrame) {
|
||||||
//Use Blargg's NTSC filter's max size as a minimum resolution, to prevent changing resolution too often
|
//Use Blargg's NTSC filter's max size as a minimum resolution, to prevent changing resolution too often
|
||||||
int32_t newWidth = std::max<int32_t>(width, SNES_NTSC_OUT_WIDTH(256));
|
int32_t newWidth = std::max<int32_t>(width, SNES_NTSC_OUT_WIDTH(256));
|
||||||
int32_t newHeight = std::max<int32_t>(height, 240);
|
int32_t newHeight = std::max<int32_t>(height, 239 * 2);
|
||||||
if(_retroEnv != nullptr && (_previousWidth != newWidth || _previousHeight != newHeight)) {
|
if(_retroEnv != nullptr && (_previousWidth != newWidth || _previousHeight != newHeight)) {
|
||||||
//Resolution change is needed
|
//Resolution change is needed
|
||||||
retro_system_av_info avInfo = {};
|
retro_system_av_info avInfo = {};
|
||||||
|
@ -63,8 +63,8 @@ public:
|
||||||
ratio = (float)256 / 239;
|
ratio = (float)256 / 239;
|
||||||
}
|
}
|
||||||
OverscanDimensions overscan = _console->GetSettings()->GetOverscan();
|
OverscanDimensions overscan = _console->GetSettings()->GetOverscan();
|
||||||
int width = (256 - overscan.Left - overscan.Right) * 2;
|
int width = (256 - overscan.Left - overscan.Right);
|
||||||
int height = (239 - overscan.Top - overscan.Bottom) * 2;
|
int height = (239 - overscan.Top - overscan.Bottom);
|
||||||
ratio *= (float)width / height / 256 * 239;
|
ratio *= (float)width / height / 256 * 239;
|
||||||
|
|
||||||
info.geometry.aspect_ratio = ratio;
|
info.geometry.aspect_ratio = ratio;
|
||||||
|
|
98
UI/Forms/Config/frmVideoConfig.Designer.cs
generated
98
UI/Forms/Config/frmVideoConfig.Designer.cs
generated
|
@ -86,11 +86,6 @@
|
||||||
this.tableLayoutPanel14 = new System.Windows.Forms.TableLayoutPanel();
|
this.tableLayoutPanel14 = new System.Windows.Forms.TableLayoutPanel();
|
||||||
this.nudOverscanLeft = new Mesen.GUI.Controls.MesenNumericUpDown();
|
this.nudOverscanLeft = new Mesen.GUI.Controls.MesenNumericUpDown();
|
||||||
this.lblLeft = new System.Windows.Forms.Label();
|
this.lblLeft = new System.Windows.Forms.Label();
|
||||||
this.ctxPicturePresets = new System.Windows.Forms.ContextMenuStrip(this.components);
|
|
||||||
this.mnuPresetComposite = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.mnuPresetSVideo = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.mnuPresetRgb = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.mnuPresetMonochrome = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.tpgAdvanced = new System.Windows.Forms.TabPage();
|
this.tpgAdvanced = new System.Windows.Forms.TabPage();
|
||||||
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||||
this.chkHideBgLayer0 = new Mesen.GUI.Controls.ctrlRiskyOption();
|
this.chkHideBgLayer0 = new Mesen.GUI.Controls.ctrlRiskyOption();
|
||||||
|
@ -98,6 +93,11 @@
|
||||||
this.chkHideBgLayer2 = new Mesen.GUI.Controls.ctrlRiskyOption();
|
this.chkHideBgLayer2 = new Mesen.GUI.Controls.ctrlRiskyOption();
|
||||||
this.chkHideBgLayer3 = new Mesen.GUI.Controls.ctrlRiskyOption();
|
this.chkHideBgLayer3 = new Mesen.GUI.Controls.ctrlRiskyOption();
|
||||||
this.chkHideSprites = new Mesen.GUI.Controls.ctrlRiskyOption();
|
this.chkHideSprites = new Mesen.GUI.Controls.ctrlRiskyOption();
|
||||||
|
this.ctxPicturePresets = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
|
this.mnuPresetComposite = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.mnuPresetSVideo = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.mnuPresetRgb = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.mnuPresetMonochrome = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.tabMain.SuspendLayout();
|
this.tabMain.SuspendLayout();
|
||||||
this.tpgGeneral.SuspendLayout();
|
this.tpgGeneral.SuspendLayout();
|
||||||
this.tlpMain.SuspendLayout();
|
this.tlpMain.SuspendLayout();
|
||||||
|
@ -119,9 +119,9 @@
|
||||||
this.tableLayoutPanel12.SuspendLayout();
|
this.tableLayoutPanel12.SuspendLayout();
|
||||||
this.tableLayoutPanel13.SuspendLayout();
|
this.tableLayoutPanel13.SuspendLayout();
|
||||||
this.tableLayoutPanel14.SuspendLayout();
|
this.tableLayoutPanel14.SuspendLayout();
|
||||||
this.ctxPicturePresets.SuspendLayout();
|
|
||||||
this.tpgAdvanced.SuspendLayout();
|
this.tpgAdvanced.SuspendLayout();
|
||||||
this.tableLayoutPanel2.SuspendLayout();
|
this.tableLayoutPanel2.SuspendLayout();
|
||||||
|
this.ctxPicturePresets.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// baseConfigPanel
|
// baseConfigPanel
|
||||||
|
@ -140,7 +140,7 @@
|
||||||
this.tabMain.Location = new System.Drawing.Point(0, 0);
|
this.tabMain.Location = new System.Drawing.Point(0, 0);
|
||||||
this.tabMain.Name = "tabMain";
|
this.tabMain.Name = "tabMain";
|
||||||
this.tabMain.SelectedIndex = 0;
|
this.tabMain.SelectedIndex = 0;
|
||||||
this.tabMain.Size = new System.Drawing.Size(574, 437);
|
this.tabMain.Size = new System.Drawing.Size(574, 408);
|
||||||
this.tabMain.TabIndex = 2;
|
this.tabMain.TabIndex = 2;
|
||||||
//
|
//
|
||||||
// tpgGeneral
|
// tpgGeneral
|
||||||
|
@ -1075,51 +1075,13 @@
|
||||||
this.lblLeft.Text = "Left";
|
this.lblLeft.Text = "Left";
|
||||||
this.lblLeft.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
this.lblLeft.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||||
//
|
//
|
||||||
// ctxPicturePresets
|
|
||||||
//
|
|
||||||
this.ctxPicturePresets.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.mnuPresetComposite,
|
|
||||||
this.mnuPresetSVideo,
|
|
||||||
this.mnuPresetRgb,
|
|
||||||
this.mnuPresetMonochrome});
|
|
||||||
this.ctxPicturePresets.Name = "contextPicturePresets";
|
|
||||||
this.ctxPicturePresets.Size = new System.Drawing.Size(148, 92);
|
|
||||||
//
|
|
||||||
// mnuPresetComposite
|
|
||||||
//
|
|
||||||
this.mnuPresetComposite.Name = "mnuPresetComposite";
|
|
||||||
this.mnuPresetComposite.Size = new System.Drawing.Size(147, 22);
|
|
||||||
this.mnuPresetComposite.Text = "Composite";
|
|
||||||
this.mnuPresetComposite.Click += new System.EventHandler(this.mnuPresetComposite_Click);
|
|
||||||
//
|
|
||||||
// mnuPresetSVideo
|
|
||||||
//
|
|
||||||
this.mnuPresetSVideo.Name = "mnuPresetSVideo";
|
|
||||||
this.mnuPresetSVideo.Size = new System.Drawing.Size(147, 22);
|
|
||||||
this.mnuPresetSVideo.Text = "S-Video";
|
|
||||||
this.mnuPresetSVideo.Click += new System.EventHandler(this.mnuPresetSVideo_Click);
|
|
||||||
//
|
|
||||||
// mnuPresetRgb
|
|
||||||
//
|
|
||||||
this.mnuPresetRgb.Name = "mnuPresetRgb";
|
|
||||||
this.mnuPresetRgb.Size = new System.Drawing.Size(147, 22);
|
|
||||||
this.mnuPresetRgb.Text = "RGB";
|
|
||||||
this.mnuPresetRgb.Click += new System.EventHandler(this.mnuPresetRgb_Click);
|
|
||||||
//
|
|
||||||
// mnuPresetMonochrome
|
|
||||||
//
|
|
||||||
this.mnuPresetMonochrome.Name = "mnuPresetMonochrome";
|
|
||||||
this.mnuPresetMonochrome.Size = new System.Drawing.Size(147, 22);
|
|
||||||
this.mnuPresetMonochrome.Text = "Monochrome";
|
|
||||||
this.mnuPresetMonochrome.Click += new System.EventHandler(this.mnuPresetMonochrome_Click);
|
|
||||||
//
|
|
||||||
// tpgAdvanced
|
// tpgAdvanced
|
||||||
//
|
//
|
||||||
this.tpgAdvanced.Controls.Add(this.tableLayoutPanel2);
|
this.tpgAdvanced.Controls.Add(this.tableLayoutPanel2);
|
||||||
this.tpgAdvanced.Location = new System.Drawing.Point(4, 22);
|
this.tpgAdvanced.Location = new System.Drawing.Point(4, 22);
|
||||||
this.tpgAdvanced.Name = "tpgAdvanced";
|
this.tpgAdvanced.Name = "tpgAdvanced";
|
||||||
this.tpgAdvanced.Padding = new System.Windows.Forms.Padding(3);
|
this.tpgAdvanced.Padding = new System.Windows.Forms.Padding(3);
|
||||||
this.tpgAdvanced.Size = new System.Drawing.Size(566, 411);
|
this.tpgAdvanced.Size = new System.Drawing.Size(566, 382);
|
||||||
this.tpgAdvanced.TabIndex = 7;
|
this.tpgAdvanced.TabIndex = 7;
|
||||||
this.tpgAdvanced.Text = "Advanced";
|
this.tpgAdvanced.Text = "Advanced";
|
||||||
this.tpgAdvanced.UseVisualStyleBackColor = true;
|
this.tpgAdvanced.UseVisualStyleBackColor = true;
|
||||||
|
@ -1143,7 +1105,7 @@
|
||||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(560, 405);
|
this.tableLayoutPanel2.Size = new System.Drawing.Size(560, 376);
|
||||||
this.tableLayoutPanel2.TabIndex = 0;
|
this.tableLayoutPanel2.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// chkHideBgLayer0
|
// chkHideBgLayer0
|
||||||
|
@ -1196,6 +1158,44 @@
|
||||||
this.chkHideSprites.TabIndex = 4;
|
this.chkHideSprites.TabIndex = 4;
|
||||||
this.chkHideSprites.Text = "Hide sprites";
|
this.chkHideSprites.Text = "Hide sprites";
|
||||||
//
|
//
|
||||||
|
// ctxPicturePresets
|
||||||
|
//
|
||||||
|
this.ctxPicturePresets.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.mnuPresetComposite,
|
||||||
|
this.mnuPresetSVideo,
|
||||||
|
this.mnuPresetRgb,
|
||||||
|
this.mnuPresetMonochrome});
|
||||||
|
this.ctxPicturePresets.Name = "contextPicturePresets";
|
||||||
|
this.ctxPicturePresets.Size = new System.Drawing.Size(148, 92);
|
||||||
|
//
|
||||||
|
// mnuPresetComposite
|
||||||
|
//
|
||||||
|
this.mnuPresetComposite.Name = "mnuPresetComposite";
|
||||||
|
this.mnuPresetComposite.Size = new System.Drawing.Size(147, 22);
|
||||||
|
this.mnuPresetComposite.Text = "Composite";
|
||||||
|
this.mnuPresetComposite.Click += new System.EventHandler(this.mnuPresetComposite_Click);
|
||||||
|
//
|
||||||
|
// mnuPresetSVideo
|
||||||
|
//
|
||||||
|
this.mnuPresetSVideo.Name = "mnuPresetSVideo";
|
||||||
|
this.mnuPresetSVideo.Size = new System.Drawing.Size(147, 22);
|
||||||
|
this.mnuPresetSVideo.Text = "S-Video";
|
||||||
|
this.mnuPresetSVideo.Click += new System.EventHandler(this.mnuPresetSVideo_Click);
|
||||||
|
//
|
||||||
|
// mnuPresetRgb
|
||||||
|
//
|
||||||
|
this.mnuPresetRgb.Name = "mnuPresetRgb";
|
||||||
|
this.mnuPresetRgb.Size = new System.Drawing.Size(147, 22);
|
||||||
|
this.mnuPresetRgb.Text = "RGB";
|
||||||
|
this.mnuPresetRgb.Click += new System.EventHandler(this.mnuPresetRgb_Click);
|
||||||
|
//
|
||||||
|
// mnuPresetMonochrome
|
||||||
|
//
|
||||||
|
this.mnuPresetMonochrome.Name = "mnuPresetMonochrome";
|
||||||
|
this.mnuPresetMonochrome.Size = new System.Drawing.Size(147, 22);
|
||||||
|
this.mnuPresetMonochrome.Text = "Monochrome";
|
||||||
|
this.mnuPresetMonochrome.Click += new System.EventHandler(this.mnuPresetMonochrome_Click);
|
||||||
|
//
|
||||||
// frmVideoConfig
|
// frmVideoConfig
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
@ -1208,8 +1208,8 @@
|
||||||
this.Name = "frmVideoConfig";
|
this.Name = "frmVideoConfig";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
this.Text = "frmVideoConfig";
|
this.Text = "frmVideoConfig";
|
||||||
this.Controls.SetChildIndex(this.tabMain, 0);
|
|
||||||
this.Controls.SetChildIndex(this.baseConfigPanel, 0);
|
this.Controls.SetChildIndex(this.baseConfigPanel, 0);
|
||||||
|
this.Controls.SetChildIndex(this.tabMain, 0);
|
||||||
this.tabMain.ResumeLayout(false);
|
this.tabMain.ResumeLayout(false);
|
||||||
this.tpgGeneral.ResumeLayout(false);
|
this.tpgGeneral.ResumeLayout(false);
|
||||||
this.tlpMain.ResumeLayout(false);
|
this.tlpMain.ResumeLayout(false);
|
||||||
|
@ -1242,9 +1242,9 @@
|
||||||
this.tableLayoutPanel13.PerformLayout();
|
this.tableLayoutPanel13.PerformLayout();
|
||||||
this.tableLayoutPanel14.ResumeLayout(false);
|
this.tableLayoutPanel14.ResumeLayout(false);
|
||||||
this.tableLayoutPanel14.PerformLayout();
|
this.tableLayoutPanel14.PerformLayout();
|
||||||
this.ctxPicturePresets.ResumeLayout(false);
|
|
||||||
this.tpgAdvanced.ResumeLayout(false);
|
this.tpgAdvanced.ResumeLayout(false);
|
||||||
this.tableLayoutPanel2.ResumeLayout(false);
|
this.tableLayoutPanel2.ResumeLayout(false);
|
||||||
|
this.ctxPicturePresets.ResumeLayout(false);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue