Libretro: Added "raw" palette option
This commit is contained in:
parent
950d05229a
commit
a086acde87
8 changed files with 66 additions and 1 deletions
|
@ -529,6 +529,7 @@
|
|||
<ClInclude Include="MMC3_198.h" />
|
||||
<ClInclude Include="MovieRecorder.h" />
|
||||
<ClInclude Include="AsciiTurboFile.h" />
|
||||
<ClInclude Include="RawVideoFilter.h" />
|
||||
<ClInclude Include="SystemActionManager.h" />
|
||||
<ClInclude Include="DatachBarcodeReader.h" />
|
||||
<ClInclude Include="DebugHud.h" />
|
||||
|
@ -941,6 +942,7 @@
|
|||
<ClCompile Include="MovieRecorder.cpp" />
|
||||
<ClCompile Include="OggMixer.cpp" />
|
||||
<ClCompile Include="OggReader.cpp" />
|
||||
<ClCompile Include="RawVideoFilter.cpp" />
|
||||
<ClCompile Include="RecordedRomTest.cpp" />
|
||||
<ClCompile Include="AutoSaveManager.cpp" />
|
||||
<ClCompile Include="AviRecorder.cpp" />
|
||||
|
|
|
@ -1366,6 +1366,9 @@
|
|||
<ClInclude Include="DrawScreenBufferCommand.h">
|
||||
<Filter>Debugger\Scripting\DebugHud</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RawVideoFilter.h">
|
||||
<Filter>VideoDecoder</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
@ -1629,5 +1632,8 @@
|
|||
<ClCompile Include="RotateFilter.cpp">
|
||||
<Filter>VideoDecoder</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RawVideoFilter.cpp">
|
||||
<Filter>VideoDecoder</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -147,6 +147,7 @@ enum class VideoFilterType
|
|||
Prescale6x = 22,
|
||||
Prescale8x = 23,
|
||||
Prescale10x = 24,
|
||||
Raw = 25,
|
||||
HdPack = 999
|
||||
};
|
||||
|
||||
|
|
34
Core/RawVideoFilter.cpp
Normal file
34
Core/RawVideoFilter.cpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include "stdafx.h"
|
||||
#include "RawVideoFilter.h"
|
||||
#include "PPU.h"
|
||||
|
||||
RawVideoFilter::RawVideoFilter()
|
||||
{
|
||||
//Use the same raw output as the Nestopia core
|
||||
for(int i = 0; i < 512; i++) {
|
||||
_rawPalette[i] = (
|
||||
(((i & 0x0F) * 255 / 15) << 16) |
|
||||
((((i >> 4) & 0x03) * 255 / 3) << 8) |
|
||||
(((i >> 6) & 0x07) * 255 / 7)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void RawVideoFilter::ApplyFilter(uint16_t * ppuOutputBuffer)
|
||||
{
|
||||
//Do nothing - return 9-bit values (6-bit Palette + 3-bit emphasis)
|
||||
OverscanDimensions overscan = GetOverscan();
|
||||
uint32_t* out = (uint32_t*)GetOutputBuffer();
|
||||
for(uint32_t i = overscan.Top, iMax = 240 - overscan.Bottom; i < iMax; i++) {
|
||||
for(uint32_t j = overscan.Left, jMax = 256 - overscan.Right; j < jMax; j++) {
|
||||
*out = _rawPalette[ppuOutputBuffer[i * 256 + j]];
|
||||
out++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FrameInfo RawVideoFilter::GetFrameInfo()
|
||||
{
|
||||
OverscanDimensions overscan = GetOverscan();
|
||||
return { overscan.GetScreenWidth(), overscan.GetScreenHeight(), PPU::ScreenWidth, PPU::ScreenHeight, 4 };
|
||||
}
|
16
Core/RawVideoFilter.h
Normal file
16
Core/RawVideoFilter.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "BaseVideoFilter.h"
|
||||
|
||||
class RawVideoFilter : public BaseVideoFilter
|
||||
{
|
||||
private:
|
||||
uint32_t _rawPalette[512];
|
||||
|
||||
public:
|
||||
RawVideoFilter();
|
||||
|
||||
void ApplyFilter(uint16_t *ppuOutputBuffer);
|
||||
FrameInfo GetFrameInfo();
|
||||
};
|
|
@ -3,6 +3,7 @@
|
|||
#include "VideoDecoder.h"
|
||||
#include "EmulationSettings.h"
|
||||
#include "DefaultVideoFilter.h"
|
||||
#include "RawVideoFilter.h"
|
||||
#include "BisqwitNtscFilter.h"
|
||||
#include "NtscFilter.h"
|
||||
#include "HdVideoFilter.h"
|
||||
|
@ -84,6 +85,7 @@ void VideoDecoder::UpdateVideoFilter()
|
|||
case VideoFilterType::BisqwitNtsc: _videoFilter.reset(new BisqwitNtscFilter(1)); break;
|
||||
case VideoFilterType::BisqwitNtscHalfRes: _videoFilter.reset(new BisqwitNtscFilter(2)); break;
|
||||
case VideoFilterType::BisqwitNtscQuarterRes: _videoFilter.reset(new BisqwitNtscFilter(4)); break;
|
||||
case VideoFilterType::Raw: _videoFilter.reset(new RawVideoFilter()); break;
|
||||
default: _scaleFilter = ScaleFilter::GetScaleFilter(_videoFilterType); break;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ SOURCES_CXX := $(LIBRETRO_DIR)/libretro.cpp \
|
|||
$(CORE_DIR)/Debugger.cpp \
|
||||
$(CORE_DIR)/DebugHud.cpp \
|
||||
$(CORE_DIR)/DefaultVideoFilter.cpp \
|
||||
$(CORE_DIR)/RawVideoFilter.cpp \
|
||||
$(CORE_DIR)/DeltaModulationChannel.cpp \
|
||||
$(CORE_DIR)/Disassembler.cpp \
|
||||
$(CORE_DIR)/DisassemblyInfo.cpp \
|
||||
|
|
|
@ -140,7 +140,7 @@ extern "C" {
|
|||
|
||||
static const struct retro_variable vars[] = {
|
||||
{ MesenNtscFilter, "NTSC filter; Disabled|Composite (Blargg)|S-Video (Blargg)|RGB (Blargg)|Monochrome (Blargg)|Bisqwit 2x|Bisqwit 4x|Bisqwit 8x" },
|
||||
{ MesenPalette, "Palette; Default|Composite Direct (by FirebrandX)|Nes Classic|Nestopia (RGB)|Original Hardware (by FirebrandX)|PVM Style (by FirebrandX)|Sony CXA2025AS|Unsaturated v6 (by FirebrandX)|YUV v3 (by FirebrandX)|Custom" },
|
||||
{ MesenPalette, "Palette; Default|Composite Direct (by FirebrandX)|Nes Classic|Nestopia (RGB)|Original Hardware (by FirebrandX)|PVM Style (by FirebrandX)|Sony CXA2025AS|Unsaturated v6 (by FirebrandX)|YUV v3 (by FirebrandX)|Custom|Raw" },
|
||||
{ MesenOverclock, "Overclock; None|Low|Medium|High|Very High" },
|
||||
{ MesenOverclockType, "Overclock Type; Before NMI (Recommended)|After NMI" },
|
||||
{ MesenRegion, "Region; Auto|NTSC|PAL|Dendy" },
|
||||
|
@ -374,6 +374,9 @@ extern "C" {
|
|||
EmulationSettings::SetRgbPalette(yuvPalette);
|
||||
} else if(value == "Custom") {
|
||||
load_custom_palette();
|
||||
} else if(value == "Raw") {
|
||||
//Using the raw palette replaces the NTSC filters, if one is selected
|
||||
EmulationSettings::SetVideoFilterType(VideoFilterType::Raw);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue