win32: Get win32 working with variable font.

This commit is contained in:
BearOso 2023-05-04 15:55:11 -05:00
parent 8289c775b8
commit ebf2e9981e
20 changed files with 225 additions and 289 deletions

View File

@ -279,5 +279,5 @@ void S9xImGuiInit(S9xImGuiInitInfo *init_info)
builder.AddText("←↑→↓▶❚"); builder.AddText("←↑→↓▶❚");
ranges.clear(); ranges.clear();
builder.BuildRanges(&ranges); builder.BuildRanges(&ranges);
ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF(imgui_noto_font_compressed_data, settings.font_size, nullptr, ranges.Data); ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF(imgui_noto_font_compressed_data, imgui_noto_font_compressed_size, settings.font_size, nullptr, ranges.Data);
} }

145
gfx.cpp
View File

@ -12,7 +12,6 @@
#include "cheats.h" #include "cheats.h"
#include "movie.h" #include "movie.h"
#include "screenshot.h" #include "screenshot.h"
#include "font.h"
#include "display.h" #include "display.h"
extern struct SCheatData Cheat; extern struct SCheatData Cheat;
@ -21,7 +20,6 @@ extern struct SLineMatrixData LineMatrixData[240];
void S9xComputeClipWindows (void); void S9xComputeClipWindows (void);
static int font_width = 8, font_height = 9;
void (*S9xCustomDisplayString) (const char *, int, int, bool, int) = NULL; void (*S9xCustomDisplayString) (const char *, int, int, bool, int) = NULL;
static void SetupOBJ (void); static void SetupOBJ (void);
@ -1733,76 +1731,147 @@ void S9xSetInfoString (const char *string)
} }
} }
void S9xDisplayChar (uint16 *s, uint8 c) #include "var8x10font.h"
static const int font_width = 8;
static const int font_height = 10;
static inline int CharWidth(uint8 c)
{ {
const uint16 black = BUILD_PIXEL(0, 0, 0); return font_width - var8x10font_kern[c - 32][0] - var8x10font_kern[c - 32][1];
}
int line = ((c - 32) >> 4) * font_height; static int StringWidth(const char* str)
int offset = ((c - 32) & 15) * font_width; {
int length = strlen(str);
int pixcount = 0;
for (int h = 0; h < font_height; h++, line++, s += GFX.RealPPL - font_width) if (length > 0)
pixcount++;
for (int i = 0; i < length; i++)
{ {
for (int w = 0; w < font_width; w++, s++) pixcount += (CharWidth(str[i]) - 1);
{ }
char p = font[line][offset + w];
if (p == '#') return pixcount;
}
static void VariableDisplayChar(int x, int y, uint8 c, bool monospace = false, int overlap = 0)
{
int cindex = c - 32;
int crow = cindex >> 4;
int ccol = cindex & 15;
int cwidth = font_width - (monospace ? 0 : (var8x10font_kern[cindex][0] + var8x10font_kern[cindex][1]));
int line = crow * font_height;
int offset = ccol * font_width + (monospace ? 0 : var8x10font_kern[cindex][0]);
int scale = IPPU.RenderedScreenWidth / SNES_WIDTH;
uint16* s = GFX.Screen + y * GFX.RealPPL + x * scale;
for (int h = 0; h < font_height; h++, line++, s += GFX.RealPPL - cwidth * scale)
{
for (int w = 0; w < cwidth; w++, s++)
{
if (var8x10font[line][offset + w] == '#')
*s = Settings.DisplayColor; *s = Settings.DisplayColor;
else else if (var8x10font[line][offset + w] == '.')
if (p == '.') *s = 0x0000;
*s = black; // else if (!monospace && w >= overlap)
// *s = (*s & 0xf7de) >> 1;
// *s = (*s & 0xe79c) >> 2;
if (scale > 1)
{
s[1] = s[0];
s++;
}
} }
} }
} }
static void DisplayStringFromBottom (const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap) static void S9xVariableDisplayString(const char* string, int linesFromBottom,
int pixelsFromLeft, bool allowWrap, int type)
{ {
if (S9xCustomDisplayString) bool monospace = true;
if (type == S9X_NO_INFO)
{ {
S9xCustomDisplayString (string, linesFromBottom, pixelsFromLeft, allowWrap, S9X_NO_INFO);
return;
}
if (linesFromBottom <= 0) if (linesFromBottom <= 0)
linesFromBottom = 1; linesFromBottom = 1;
uint16 *dst = GFX.Screen + (IPPU.RenderedScreenHeight - font_height * linesFromBottom) * GFX.RealPPL + pixelsFromLeft; if (linesFromBottom >= 5 && !Settings.DisplayPressedKeys)
int len = strlen(string);
int max_chars = IPPU.RenderedScreenWidth / (font_width - 1);
int char_count = 0;
for (int i = 0 ; i < len ; i++, char_count++)
{ {
if (char_count >= max_chars || (uint8) string[i] < 32) if (!Settings.DisplayPressedKeys)
linesFromBottom -= 3;
else
linesFromBottom -= 1;
}
if (pixelsFromLeft > 128)
pixelsFromLeft = SNES_WIDTH - StringWidth(string);
monospace = false;
}
int dst_x = pixelsFromLeft;
int dst_y = IPPU.RenderedScreenHeight - (font_height)*linesFromBottom;
int len = strlen(string);
if (IPPU.RenderedScreenHeight % 224 && !Settings.ShowOverscan)
dst_y -= 8;
else if (Settings.ShowOverscan)
dst_y += 8;
int overlap = 0;
for (int i = 0; i < len; i++)
{
int cindex = string[i] - 32;
int char_width = font_width - (monospace ? 1 : (var8x10font_kern[cindex][0] + var8x10font_kern[cindex][1]));
if (dst_x + char_width > SNES_WIDTH || (uint8)string[i] < 32)
{ {
if (!allowWrap) if (!allowWrap)
break; break;
dst += font_height * GFX.RealPPL - (font_width - 1) * max_chars; linesFromBottom--;
if (dst >= GFX.Screen + IPPU.RenderedScreenHeight * GFX.RealPPL) dst_y = IPPU.RenderedScreenHeight - font_height * linesFromBottom;
break; dst_x = pixelsFromLeft;
char_count -= max_chars; if (dst_y >= IPPU.RenderedScreenHeight)
break;
} }
if ((uint8) string[i] < 32) if ((uint8)string[i] < 32)
continue; continue;
S9xDisplayChar(dst, string[i]); VariableDisplayChar(dst_x, dst_y, string[i], monospace, overlap);
dst += font_width - 1;
dst_x += char_width - 1;
overlap = 1;
} }
} }
static void S9xDisplayStringType (const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap, int type) static void DisplayStringFromBottom(const char* string, int linesFromBottom, int pixelsFromLeft, bool allowWrap)
{ {
if (S9xCustomDisplayString) if (S9xCustomDisplayString)
{ {
S9xCustomDisplayString (string, linesFromBottom, pixelsFromLeft, allowWrap, type); S9xCustomDisplayString(string, linesFromBottom, pixelsFromLeft, allowWrap, S9X_NO_INFO);
return; return;
} }
S9xDisplayString (string, linesFromBottom, pixelsFromLeft, allowWrap); S9xVariableDisplayString(string, linesFromBottom, pixelsFromLeft, allowWrap, S9X_NO_INFO);
}
static void S9xDisplayStringType(const char* string, int linesFromBottom, int pixelsFromLeft, bool allowWrap, int type)
{
if (S9xCustomDisplayString)
{
S9xCustomDisplayString(string, linesFromBottom, pixelsFromLeft, allowWrap, type);
return;
}
S9xVariableDisplayString(string, linesFromBottom, pixelsFromLeft, allowWrap, type);
} }
static void DisplayTime (void) static void DisplayTime (void)

11
port.h
View File

@ -123,20 +123,11 @@ typedef size_t pint;
#include "fscompat.h" #include "fscompat.h"
#ifndef __WIN32__
#define S9xDisplayString DisplayStringFromBottom #define S9xDisplayString DisplayStringFromBottom
#else // __WIN32__ #ifdef __WIN32__
#define snprintf _snprintf #define snprintf _snprintf
#define strcasecmp stricmp #define strcasecmp stricmp
#define strncasecmp strnicmp #define strncasecmp strnicmp
#ifndef __LIBRETRO__
void WinDisplayStringFromBottom(const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap);
#define S9xDisplayString WinDisplayStringFromBottom
void SetInfoDlgColor(unsigned char, unsigned char, unsigned char);
#define SET_UI_COLOR(r,g,b) SetInfoDlgColor(r,g,b)
#else // __LIBRETRO__
#define S9xDisplayString DisplayStringFromBottom
#endif // __LIBRETRO__
#endif // __WIN32__ #endif // __WIN32__
#if defined(__DJGPP) || defined(__WIN32__) #if defined(__DJGPP) || defined(__WIN32__)

View File

@ -259,6 +259,7 @@ struct SSettings
uint32 InitialInfoStringTimeout; uint32 InitialInfoStringTimeout;
uint16 DisplayColor; uint16 DisplayColor;
bool8 BilinearFilter; bool8 BilinearFilter;
bool ShowOverscan;
bool8 Multi; bool8 Multi;
char CartAName[PATH_MAX + 1]; char CartAName[PATH_MAX + 1];

View File

@ -290,10 +290,6 @@ void CDirect3D::Render(SSurface Src)
Dst.Pitch = lr.Pitch; Dst.Pitch = lr.Pitch;
RenderMethod (Src, Dst, &dstRect); RenderMethod (Src, Dst, &dstRect);
if(!Settings.AutoDisplayMessages) {
WinSetCustomDisplaySurface((void *)Dst.Surface, Dst.Pitch/2, dstRect.right-dstRect.left, dstRect.bottom-dstRect.top, GetFilterScale(CurrentScale));
S9xDisplayMessages ((uint16*)Dst.Surface, Dst.Pitch/2, dstRect.right-dstRect.left, dstRect.bottom-dstRect.top, GetFilterScale(CurrentScale));
}
drawSurface->UnlockRect(0); drawSurface->UnlockRect(0);
} }

View File

@ -435,11 +435,6 @@ void CDirectDraw::Render(SSurface Src)
RenderMethod (Src, Dst, &srcRect); RenderMethod (Src, Dst, &srcRect);
} }
if(!Settings.AutoDisplayMessages) {
WinSetCustomDisplaySurface((void *)Dst.Surface, (Dst.Pitch*8/GUI.ScreenDepth), srcRect.right-srcRect.left, srcRect.bottom-srcRect.top, GetFilterScale(CurrentScale));
S9xDisplayMessages ((uint16*)Dst.Surface, Dst.Pitch/2, srcRect.right-srcRect.left, srcRect.bottom-srcRect.top, GetFilterScale(CurrentScale));
}
RECT lastRect = SizeHistory [GUI.FlipCounter % GUI.NumFlipFrames]; RECT lastRect = SizeHistory [GUI.FlipCounter % GUI.NumFlipFrames];
POINT p; POINT p;
@ -456,7 +451,7 @@ void CDirectDraw::Render(SSurface Src)
int height = dstRect.bottom - dstRect.top; int height = dstRect.bottom - dstRect.top;
int oldWidth = GUI.AspectWidth; int oldWidth = GUI.AspectWidth;
int oldHeight = GUI.HeightExtend ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT; int oldHeight = Settings.ShowOverscan ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT;
int newWidth, newHeight; int newWidth, newHeight;
if(oldWidth * height > oldHeight * width) if(oldWidth * height > oldHeight * width)

View File

@ -297,10 +297,6 @@ void COpenGL::Render(SSurface Src)
Dst.Pitch = outTextureWidth * 2; Dst.Pitch = outTextureWidth * 2;
RenderMethod (Src, Dst, &dstRect); RenderMethod (Src, Dst, &dstRect);
if(!Settings.AutoDisplayMessages) {
WinSetCustomDisplaySurface((void *)Dst.Surface, Dst.Pitch/2, dstRect.right-dstRect.left, dstRect.bottom-dstRect.top, GetFilterScale(CurrentScale));
S9xDisplayMessages ((uint16*)Dst.Surface, Dst.Pitch/2, dstRect.right-dstRect.left, dstRect.bottom-dstRect.top, GetFilterScale(CurrentScale));
}
if(pboFunctionsLoaded) if(pboFunctionsLoaded)
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER); glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);

View File

@ -74,11 +74,6 @@ void CVulkan::Render(SSurface Src)
RenderMethod(Src, Dst, &dstRect); RenderMethod(Src, Dst, &dstRect);
if (!Settings.AutoDisplayMessages) {
WinSetCustomDisplaySurface((void*)Dst.Surface, Dst.Pitch / 2, dstRect.right - dstRect.left, dstRect.bottom - dstRect.top, GetFilterScale(GUI.Scale));
S9xDisplayMessages((uint16*)Dst.Surface, Dst.Pitch / 2, dstRect.right - dstRect.left, dstRect.bottom - dstRect.top, GetFilterScale(GUI.Scale));
}
RECT windowSize, displayRect; RECT windowSize, displayRect;
GetClientRect(hWnd, &windowSize); GetClientRect(hWnd, &windowSize);
//Get maximum rect respecting AR setting //Get maximum rect respecting AR setting

View File

@ -300,7 +300,7 @@ inline static bool GetFilterBlendSupport(RenderFilter filterID)
void AdjustHeightExtend(unsigned int &height) void AdjustHeightExtend(unsigned int &height)
{ {
if(GUI.HeightExtend) if(Settings.ShowOverscan)
{ {
if(height == SNES_HEIGHT) if(height == SNES_HEIGHT)
height = SNES_HEIGHT_EXTENDED; height = SNES_HEIGHT_EXTENDED;

View File

@ -418,6 +418,8 @@
#define IDC_NO_SPRITE_LIMIT 3037 #define IDC_NO_SPRITE_LIMIT 3037
#define IDC_SET_DEFAULTS 3038 #define IDC_SET_DEFAULTS 3038
#define IDC_BUTTON_SLOT_1 3039 #define IDC_BUTTON_SLOT_1 3039
#define IDC_OSD_SCALE 3041
#define IDC_SPIN_OSD_SIZE 3042
#define IDC_STATIC_SLOT_1 3059 #define IDC_STATIC_SLOT_1 3059
#define ID_FILE_EXIT 40001 #define ID_FILE_EXIT 40001
#define ID_WINDOW_HIDEMENUBAR 40004 #define ID_WINDOW_HIDEMENUBAR 40004
@ -561,7 +563,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 169 #define _APS_NEXT_RESOURCE_VALUE 169
#define _APS_NEXT_COMMAND_VALUE 40189 #define _APS_NEXT_COMMAND_VALUE 40189
#define _APS_NEXT_CONTROL_VALUE 3040 #define _APS_NEXT_CONTROL_VALUE 3044
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif

View File

@ -222,10 +222,8 @@ BEGIN
CONTROL "Transparency Effects",IDC_TRANS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,131,150,8 CONTROL "Transparency Effects",IDC_TRANS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,131,150,8
CONTROL "Blend Hi-Res Images",IDC_HIRESBLEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,143,150,8 CONTROL "Blend Hi-Res Images",IDC_HIRESBLEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,143,150,8
CONTROL "Extend Height of SNES Image",IDC_HEIGHT_EXTEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,155,150,8 CONTROL "Extend Height of SNES Image",IDC_HEIGHT_EXTEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,155,150,8
CONTROL "Display messages before applying filters",IDC_MESSAGES_IN_IMAGE, CONTROL "Display messages inside SNES image",IDC_MESSAGES_IN_IMAGE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,167,150,8 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,167,150,8
CONTROL "Scale messages with EPX if possible",IDC_MESSAGES_SCALE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,179,150,8
GROUPBOX "Frame Skipping:",IDC_STATIC,6,145,168,48,0,WS_EX_TRANSPARENT GROUPBOX "Frame Skipping:",IDC_STATIC,6,145,168,48,0,WS_EX_TRANSPARENT
GROUPBOX "SNES Image",IDC_STATIC,180,118,162,75,0,WS_EX_TRANSPARENT GROUPBOX "SNES Image",IDC_STATIC,180,118,162,75,0,WS_EX_TRANSPARENT
GROUPBOX "Output Image Processing",IDC_STATIC,180,6,162,61,0,WS_EX_TRANSPARENT GROUPBOX "Output Image Processing",IDC_STATIC,180,6,162,61,0,WS_EX_TRANSPARENT
@ -233,6 +231,9 @@ BEGIN
LTEXT "Hi Res:",IDC_HIRESLABEL,186,36,31,8 LTEXT "Hi Res:",IDC_HIRESLABEL,186,36,31,8
GROUPBOX "General",IDC_STATIC,6,6,168,138,0,WS_EX_TRANSPARENT GROUPBOX "General",IDC_STATIC,6,6,168,138,0,WS_EX_TRANSPARENT
LTEXT "Output Method",IDC_STATIC,12,18,51,12 LTEXT "Output Method",IDC_STATIC,12,18,51,12
LTEXT "On-screen Display Size:",IDC_STATIC,186,179,79,8
EDITTEXT IDC_OSD_SCALE,296,176,40,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SPIN_OSD_SIZE,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,320,177,9,12
END END
IDD_CHEATER DIALOGEX 0, 0, 378, 189 IDD_CHEATER DIALOGEX 0, 0, 378, 189

View File

@ -118,7 +118,7 @@
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;D3D_DEBUG_INFO;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;D3D_DEBUG_INFO;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<StructMemberAlignment>Default</StructMemberAlignment> <StructMemberAlignment>Default</StructMemberAlignment>
<PrecompiledHeader /> <PrecompiledHeader />
@ -169,7 +169,7 @@
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;D3D_DEBUG_INFO;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;D3D_DEBUG_INFO;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<StructMemberAlignment>Default</StructMemberAlignment> <StructMemberAlignment>Default</StructMemberAlignment>
<PrecompiledHeader /> <PrecompiledHeader />
@ -225,7 +225,7 @@
<OmitFramePointers>true</OmitFramePointers> <OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<StructMemberAlignment>Default</StructMemberAlignment> <StructMemberAlignment>Default</StructMemberAlignment>
@ -280,7 +280,7 @@
<OmitFramePointers>true</OmitFramePointers> <OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<StructMemberAlignment>Default</StructMemberAlignment> <StructMemberAlignment>Default</StructMemberAlignment>
@ -343,6 +343,17 @@
<CustomBuild Include="..\dma.h" /> <CustomBuild Include="..\dma.h" />
<CustomBuild Include="..\dsp.h" /> <CustomBuild Include="..\dsp.h" />
<ClInclude Include="..\apu\resampler.h" /> <ClInclude Include="..\apu\resampler.h" />
<ClInclude Include="..\external\imgui\imconfig.h" />
<ClInclude Include="..\external\imgui\imgui.h" />
<ClInclude Include="..\external\imgui\imgui_impl_dx9.h" />
<ClInclude Include="..\external\imgui\imgui_impl_opengl3.h" />
<ClInclude Include="..\external\imgui\imgui_impl_opengl3_loader.h" />
<ClInclude Include="..\external\imgui\imgui_impl_vulkan.h" />
<ClInclude Include="..\external\imgui\imgui_internal.h" />
<ClInclude Include="..\external\imgui\imstb_rectpack.h" />
<ClInclude Include="..\external\imgui\imstb_textedit.h" />
<ClInclude Include="..\external\imgui\imstb_truetype.h" />
<ClInclude Include="..\external\imgui\snes9x_imgui.h" />
<ClInclude Include="..\filter\2xsai.h" /> <ClInclude Include="..\filter\2xsai.h" />
<ClInclude Include="..\filter\blit.h" /> <ClInclude Include="..\filter\blit.h" />
<ClInclude Include="..\filter\epx.h" /> <ClInclude Include="..\filter\epx.h" />
@ -508,6 +519,15 @@
<ClCompile Include="..\dsp3.cpp" /> <ClCompile Include="..\dsp3.cpp" />
<ClCompile Include="..\dsp4.cpp" /> <ClCompile Include="..\dsp4.cpp" />
<ClCompile Include="..\external\fmt\src\format.cc" /> <ClCompile Include="..\external\fmt\src\format.cc" />
<ClCompile Include="..\external\imgui\imgui.cpp" />
<ClCompile Include="..\external\imgui\imgui_demo.cpp" />
<ClCompile Include="..\external\imgui\imgui_draw.cpp" />
<ClCompile Include="..\external\imgui\imgui_impl_dx9.cpp" />
<ClCompile Include="..\external\imgui\imgui_impl_opengl3.cpp" />
<ClCompile Include="..\external\imgui\imgui_impl_vulkan.cpp" />
<ClCompile Include="..\external\imgui\imgui_tables.cpp" />
<ClCompile Include="..\external\imgui\imgui_widgets.cpp" />
<ClCompile Include="..\external\imgui\snes9x_imgui.cpp" />
<ClCompile Include="..\external\stb\stb_image_implementation.cpp" /> <ClCompile Include="..\external\stb\stb_image_implementation.cpp" />
<ClCompile Include="..\filter\2xsai.cpp" /> <ClCompile Include="..\filter\2xsai.cpp" />
<ClCompile Include="..\filter\blit.cpp" /> <ClCompile Include="..\filter\blit.cpp" />

View File

@ -46,6 +46,9 @@
<Filter Include="GUI\VideoDriver\Vulkan"> <Filter Include="GUI\VideoDriver\Vulkan">
<UniqueIdentifier>{33cdb579-8582-4adc-91d3-c6624af3ad94}</UniqueIdentifier> <UniqueIdentifier>{33cdb579-8582-4adc-91d3-c6624af3ad94}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="GUI\VideoDriver\ImGui">
<UniqueIdentifier>{fc57774a-1be8-4755-932f-90d2f6609097}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\statemanager.h"> <ClInclude Include="..\statemanager.h">
@ -330,6 +333,39 @@
<ClInclude Include="..\vulkan\vulkan_simple_output.hpp"> <ClInclude Include="..\vulkan\vulkan_simple_output.hpp">
<Filter>GUI\VideoDriver\Vulkan</Filter> <Filter>GUI\VideoDriver\Vulkan</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\external\imgui\imconfig.h">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClInclude>
<ClInclude Include="..\external\imgui\imgui.h">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClInclude>
<ClInclude Include="..\external\imgui\imgui_impl_dx9.h">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClInclude>
<ClInclude Include="..\external\imgui\imgui_impl_opengl3.h">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClInclude>
<ClInclude Include="..\external\imgui\imgui_impl_opengl3_loader.h">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClInclude>
<ClInclude Include="..\external\imgui\imgui_impl_vulkan.h">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClInclude>
<ClInclude Include="..\external\imgui\imgui_internal.h">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClInclude>
<ClInclude Include="..\external\imgui\imstb_rectpack.h">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClInclude>
<ClInclude Include="..\external\imgui\imstb_textedit.h">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClInclude>
<ClInclude Include="..\external\imgui\imstb_truetype.h">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClInclude>
<ClInclude Include="..\external\imgui\snes9x_imgui.h">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\bsx.cpp"> <ClCompile Include="..\bsx.cpp">
@ -725,6 +761,33 @@
<ClCompile Include="..\vulkan\vulkan_simple_output.cpp"> <ClCompile Include="..\vulkan\vulkan_simple_output.cpp">
<Filter>GUI\VideoDriver\Vulkan</Filter> <Filter>GUI\VideoDriver\Vulkan</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\external\imgui\imgui.cpp">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClCompile>
<ClCompile Include="..\external\imgui\imgui_demo.cpp">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClCompile>
<ClCompile Include="..\external\imgui\imgui_draw.cpp">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClCompile>
<ClCompile Include="..\external\imgui\imgui_impl_dx9.cpp">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClCompile>
<ClCompile Include="..\external\imgui\imgui_impl_opengl3.cpp">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClCompile>
<ClCompile Include="..\external\imgui\imgui_impl_vulkan.cpp">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClCompile>
<ClCompile Include="..\external\imgui\imgui_tables.cpp">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClCompile>
<ClCompile Include="..\external\imgui\imgui_widgets.cpp">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClCompile>
<ClCompile Include="..\external\imgui\snes9x_imgui.cpp">
<Filter>GUI\VideoDriver\ImGui</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="rsrc\nodrop.cur"> <None Include="rsrc\nodrop.cur">

View File

@ -766,7 +766,7 @@ void WinRegisterConfigItems()
AddStringC("Direct3D:D3DShader", GUI.D3DshaderFileName, MAX_PATH, "", "shader filename for Direct3D mode (HLSL effect file or CG shader"); AddStringC("Direct3D:D3DShader", GUI.D3DshaderFileName, MAX_PATH, "", "shader filename for Direct3D mode (HLSL effect file or CG shader");
AddStringC("OpenGL:OGLShader", GUI.OGLshaderFileName, MAX_PATH, "", "shader filename for OpenGL mode (bsnes-style XML shader or CG shader)"); AddStringC("OpenGL:OGLShader", GUI.OGLshaderFileName, MAX_PATH, "", "shader filename for OpenGL mode (bsnes-style XML shader or CG shader)");
AddBoolC("OpenGL:DisablePBOs", GUI.OGLdisablePBOs, true, "do not use PBOs in OpenGL mode, even if the video card supports them"); AddBoolC("OpenGL:DisablePBOs", GUI.OGLdisablePBOs, true, "do not use PBOs in OpenGL mode, even if the video card supports them");
AddBoolC("ExtendHeight", GUI.HeightExtend, false, "true to display an extra 15 pixels at the bottom, which few games use. Also increases AVI output size from 256x224 to 256x240."); AddBoolC("ExtendHeight", Settings.ShowOverscan, false, "true to display an extra 15 pixels at the bottom, which few games use. Also increases AVI output size from 256x224 to 256x240.");
AddBoolC("AlwaysCenterImage", GUI.AlwaysCenterImage,false, "true to center the image even if larger than window"); AddBoolC("AlwaysCenterImage", GUI.AlwaysCenterImage,false, "true to center the image even if larger than window");
AddIntC("Window:Width", GUI.window_size.right, 512, "256=1x, 512=2x, 768=3x, 1024=4x, etc. (usually)"); AddIntC("Window:Width", GUI.window_size.right, 512, "256=1x, 512=2x, 768=3x, 1024=4x, etc. (usually)");
AddIntC("Window:Height", GUI.window_size.bottom, 448, "224=1x, 448=2x, 672=3x, 896=4x, etc. (usually)"); AddIntC("Window:Height", GUI.window_size.bottom, 448, "224=1x, 448=2x, 672=3x, 896=4x, etc. (usually)");
@ -800,7 +800,7 @@ void WinRegisterConfigItems()
AddBoolC("Vsync", GUI.Vsync, false, "true to enable Vsync"); AddBoolC("Vsync", GUI.Vsync, false, "true to enable Vsync");
AddBoolC("ReduceInputLag", GUI.ReduceInputLag, false, "true to reduce input lag by hard synchronization"); AddBoolC("ReduceInputLag", GUI.ReduceInputLag, false, "true to reduce input lag by hard synchronization");
AddBoolC("DWMSync", GUI.DWMSync, false, "sync to DWM compositor if it is running"); AddBoolC("DWMSync", GUI.DWMSync, false, "sync to DWM compositor if it is running");
AddBoolC("FilterMessageFont", GUI.filterMessagFont, true, "true to filter message font with EPX on 2x/3x scales if MessagesInImage is false)"); AddUInt("OSDSize", GUI.OSDSize, 24, "Size of On-Screen Display");
#undef CATEGORY #undef CATEGORY
#define CATEGORY "Settings" #define CATEGORY "Settings"
AddUIntC("FrameSkip", Settings.SkipFrames, AUTO_FRAMERATE, "200=automatic (limits at 50/60 fps), 0=none, 1=skip every other, ..."); AddUIntC("FrameSkip", Settings.SkipFrames, AUTO_FRAMERATE, "200=automatic (limits at 50/60 fps), 0=none, 1=skip every other, ...");

View File

@ -1169,7 +1169,7 @@ void DoAVIOpen(const TCHAR* filename)
AVISetFramerate(framerate, frameskip, GUI.AVIOut); AVISetFramerate(framerate, frameskip, GUI.AVIOut);
avi_width = SNES_WIDTH; avi_width = SNES_WIDTH;
avi_height = GUI.HeightExtend ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT; avi_height = Settings.ShowOverscan ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT;
avi_skip_frames = Settings.SkipFrames; avi_skip_frames = Settings.SkipFrames;
if(GUI.AVIHiRes) { if(GUI.AVIHiRes) {

View File

@ -59,7 +59,7 @@ void DoAVIVideoFrame();
static void CheckOverscanOffset() static void CheckOverscanOffset()
{ {
int lines_to_skip = 0; int lines_to_skip = 0;
if (!GUI.HeightExtend) if (!Settings.ShowOverscan)
{ {
if (Src.Height == SNES_HEIGHT_EXTENDED) if (Src.Height == SNES_HEIGHT_EXTENDED)
lines_to_skip = 7; lines_to_skip = 7;
@ -207,7 +207,7 @@ RECT CalculateDisplayRect(unsigned int sourceWidth,unsigned int sourceHeight,
double yFactor; double yFactor;
double minFactor; double minFactor;
double renderWidthCalc,renderHeightCalc; double renderWidthCalc,renderHeightCalc;
int hExtend = GUI.HeightExtend ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT; int hExtend = Settings.ShowOverscan ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT;
double snesAspect = (double)GUI.AspectWidth/hExtend; double snesAspect = (double)GUI.AspectWidth/hExtend;
RECT drawRect; RECT drawRect;
@ -888,189 +888,3 @@ void ConvertDepth (SSurface *src, SSurface *dst, RECT *srect)
} }
/* Depth conversion functions end */ /* Depth conversion functions end */
/* The rest of the functions are recreations of the core string display functions with additional scaling.
They provide the possibility to render the messages into a surface other than the core GFX.Screen.
*/
void WinDisplayStringFromBottom (const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap)
{
if(Settings.StopEmulation)
return;
if(Settings.AutoDisplayMessages) {
WinSetCustomDisplaySurface((void *)GFX.Screen, GFX.RealPPL, IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight, 1);
WinDisplayStringInBuffer<uint16>(string, linesFromBottom, pixelsFromLeft, allowWrap);
} else
if(GUI.ScreenDepth == 32) {
WinDisplayStringInBuffer<uint32>(string, linesFromBottom, pixelsFromLeft, allowWrap);
} else {
WinDisplayStringInBuffer<uint16>(string, linesFromBottom, pixelsFromLeft, allowWrap);
}
}
static int font_width = 8, font_height = 9;
static void *displayScreen;
int displayPpl, displayWidth, displayHeight, displayScale, fontwidth_scaled, fontheight_scaled;
void WinSetCustomDisplaySurface(void *screen, int ppl, int width, int height, int scale)
{
displayScreen=screen;
displayPpl=ppl;
displayWidth=width;
displayHeight=height;
displayScale=max(1,width/IPPU.RenderedScreenWidth);
fontwidth_scaled=font_width*displayScale;
fontheight_scaled=font_height*displayScale;
}
template<typename screenPtrType>
void WinDisplayChar (screenPtrType *s, uint8 c)
{
int h, w;
int line = ((c - 32) >> 4) * fontheight_scaled;
int offset = ((c - 32) & 15) * fontwidth_scaled;
if (GUI.filterMessagFont && (displayScale == 2 || displayScale == 3))
{
if (displayScale == 2) {
for (h = 0; h < fontheight_scaled; h += 2, line += 2, s += 2 * displayPpl - fontwidth_scaled)
for (w = 0; w < fontwidth_scaled; w += 2, s += 2)
FontPixToScreenEPX((offset + w) / 2, line / 2, s);
}
else if (displayScale == 3) {
for (h = 0; h < fontheight_scaled; h += 3, line += 3, s += 3 * displayPpl - fontwidth_scaled)
for (w = 0; w < fontwidth_scaled; w += 3, s += 3)
FontPixToScreenEPXSimple3((offset + w) / 3, line / 3, s);
}
}
else
{
for(h=0; h<fontheight_scaled; h++, line++, s+=displayPpl-fontwidth_scaled)
for(w=0; w<fontwidth_scaled; w++, s++)
FontPixToScreen(font [(line)/displayScale] [(offset + w)/displayScale], s);
}
}
static inline void FontPixToScreen(char p, uint16 *s)
{
if(p == '#')
{
*s = Settings.DisplayColor;
}
else if(p == '.')
{
static const uint16 black = BUILD_PIXEL(0,0,0);
*s = black;
}
}
static inline void FontPixToScreen(char p, uint32 *s)
{
#define CONVERT_16_TO_32(pixel) \
(((((pixel) >> 11) ) << /*RedShift+3*/ 19) | \
((((pixel) >> 6) & 0x1f) << /*GreenShift+3*/11) | \
(((pixel) & 0x1f) << /*BlueShift+3*/ 3))
if(p == '#')
{
*s = CONVERT_16_TO_32(Settings.DisplayColor);
}
else if(p == '.')
{
static const uint32 black = CONVERT_16_TO_32(BUILD_PIXEL(0,0,0));
*s = black;
}
}
#define CHOOSE(c1) ((c1=='#'||X=='#') ? '#' : ((c1=='.'||X=='.') ? '.' : c1))
template<typename screenPtrType>
static inline void FontPixToScreenEPX(int x, int y, screenPtrType *s)
{
const char X = font[y][x]; // E D H
const char A = x>0 ?font[y][x-1]:' '; // A X C
const char C = x<143?font[y][x+1]:' '; // F B G
if (A != C)
{
const char D = y>0 ?font[y-1][x]:' ';
const char B = y<125?font[y+1][x]:' ';
if (B != D)
{
FontPixToScreen((D == A) ? CHOOSE(D) : X, s);
FontPixToScreen((C == D) ? CHOOSE(C) : X, s+1);
FontPixToScreen((A == B) ? CHOOSE(A) : X, s+displayPpl);
FontPixToScreen((B == C) ? CHOOSE(B) : X, s+displayPpl+1);
return;
}
}
FontPixToScreen(X, s);
FontPixToScreen(X, s+1);
FontPixToScreen(X, s+displayPpl);
FontPixToScreen(X, s+displayPpl+1);
}
#undef CHOOSE
#define CHOOSE(c1) ((X=='#') ? '#' : c1)
template<typename screenPtrType>
inline void FontPixToScreenEPXSimple3(int x, int y, screenPtrType *s)
{
const char X = font[y][x]; // E D H
const char A = x>0 ?font[y][x-1]:' '; // A X C
const char C = x<143?font[y][x+1]:' '; // F B G
const char D = y>0 ?font[y-1][x]:' ';
const char B = y<125?font[y+1][x]:' ';
const bool XnE = y>0 &&x>0 ?(X != font[y-1][x-1]):X!=' ';
const bool XnF = y<125&&x<143?(X != font[y+1][x-1]):X!=' ';
const bool XnG = y<125&&x>0 ?(X != font[y+1][x+1]):X!=' ';
const bool XnH = y>0 &&x<143?(X != font[y-1][x+1]):X!=' ';
const bool DA = D == A && (XnE || CHOOSE(D)!=X);
const bool AB = A == B && (XnF || CHOOSE(A)!=X);
const bool BC = B == C && (XnG || CHOOSE(B)!=X);
const bool CD = C == D && (XnH || CHOOSE(C)!=X);
FontPixToScreen(DA ? A : X, s);
FontPixToScreen(X, s+1);
FontPixToScreen(CD ? C : X, s+2);
FontPixToScreen(X, s+displayPpl);
FontPixToScreen(X, s+displayPpl+1);
FontPixToScreen(X, s+displayPpl+2);
FontPixToScreen(AB ? A : X, s+displayPpl+displayPpl);
FontPixToScreen(X, s+displayPpl+displayPpl+1);
FontPixToScreen(BC ? C : X, s+displayPpl+displayPpl+2);
}
#undef CHOOSE
template<typename screenPtrType>
void WinDisplayStringInBuffer (const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap)
{
if (linesFromBottom <= 0)
linesFromBottom = 1;
screenPtrType *dst = (screenPtrType *)displayScreen + (displayHeight - fontheight_scaled * linesFromBottom) * displayPpl + (int)(pixelsFromLeft * (float)displayWidth/IPPU.RenderedScreenWidth);
int len = strlen(string);
int max_chars = displayWidth / (fontwidth_scaled - displayScale);
int char_count = 0;
for (int i = 0 ; i < len ; i++, char_count++)
{
if (char_count >= max_chars || (uint8) string[i] < 32)
{
if (!allowWrap)
break;
dst += fontheight_scaled * displayPpl - (fontwidth_scaled - displayScale) * max_chars;
if (dst >= (screenPtrType *)displayScreen + displayHeight * displayPpl)
break;
char_count -= max_chars;
}
if ((uint8) string[i] < 32)
continue;
WinDisplayChar(dst, string[i]);
dst += fontwidth_scaled - displayScale;
}
}

View File

@ -33,10 +33,6 @@ RECT CalculateDisplayRect(unsigned int sourceWidth,unsigned int sourceHeight,
unsigned int displayWidth,unsigned int displayHeight); unsigned int displayWidth,unsigned int displayHeight);
void WinEnumDisplayModes(std::vector<dMode> *modeVector); void WinEnumDisplayModes(std::vector<dMode> *modeVector);
void ConvertDepth (SSurface *src, SSurface *dst, RECT *srect); void ConvertDepth (SSurface *src, SSurface *dst, RECT *srect);
void WinDisplayStringFromBottom (const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap);
void WinSetCustomDisplaySurface(void *screen, int ppl, int width, int height, int scale);
template<typename screenPtrType>
void WinDisplayStringInBuffer (const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap);
char *ReadShaderFileContents(const TCHAR *filename); char *ReadShaderFileContents(const TCHAR *filename);
void ReduceToPath(TCHAR *filename); void ReduceToPath(TCHAR *filename);
double WinGetRefreshRate(); double WinGetRefreshRate();

View File

@ -2114,7 +2114,7 @@ LRESULT CALLBACK WinProc(
RECT margins; RECT margins;
factor = (wParam & 0xffff) - ID_WINDOW_SIZE_1X + 1; factor = (wParam & 0xffff) - ID_WINDOW_SIZE_1X + 1;
newWidth = GUI.AspectWidth * factor; newWidth = GUI.AspectWidth * factor;
newHeight = (GUI.HeightExtend ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT) * factor; newHeight = (Settings.ShowOverscan ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT) * factor;
margins = GetWindowMargins(GUI.hWnd,newWidth); margins = GetWindowMargins(GUI.hWnd,newWidth);
newHeight += margins.top + margins.bottom; newHeight += margins.top + margins.bottom;
@ -2448,7 +2448,7 @@ LRESULT CALLBACK WinProc(
// int theight; // int theight;
// (IPPU.RenderedScreenHeight> 256)? theight= SNES_HEIGHT_EXTENDED<<1: theight = SNES_HEIGHT_EXTENDED; // (IPPU.RenderedScreenHeight> 256)? theight= SNES_HEIGHT_EXTENDED<<1: theight = SNES_HEIGHT_EXTENDED;
int theight = GUI.HeightExtend ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT; int theight = Settings.ShowOverscan ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT;
if(IPPU.RenderedScreenHeight > SNES_HEIGHT_EXTENDED) theight <<= 1; if(IPPU.RenderedScreenHeight > SNES_HEIGHT_EXTENDED) theight <<= 1;
startx= size.right-IPPU.RenderedScreenWidth; startx= size.right-IPPU.RenderedScreenWidth;
@ -2478,7 +2478,7 @@ LRESULT CALLBACK WinProc(
sizex=IPPU.RenderedScreenWidth; sizex=IPPU.RenderedScreenWidth;
else sizex=IPPU.RenderedScreenWidth*2; else sizex=IPPU.RenderedScreenWidth*2;
int theight = GUI.HeightExtend ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT; int theight = Settings.ShowOverscan ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT;
sizey = (IPPU.RenderedScreenHeight > SNES_HEIGHT_EXTENDED) ? theight : (theight << 1); sizey = (IPPU.RenderedScreenHeight > SNES_HEIGHT_EXTENDED) ? theight : (theight << 1);
startx= size.right-sizex; startx= size.right-sizex;
@ -2503,7 +2503,7 @@ LRESULT CALLBACK WinProc(
else else
{ {
int sizex = IPPU.RenderedScreenWidth; int sizex = IPPU.RenderedScreenWidth;
int sizey = GUI.HeightExtend ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT; int sizey = Settings.ShowOverscan ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT;
sizey = (IPPU.RenderedScreenHeight > SNES_HEIGHT_EXTENDED) ? (sizey << 1) : sizey; sizey = (IPPU.RenderedScreenHeight > SNES_HEIGHT_EXTENDED) ? (sizey << 1) : sizey;
int width = size.right, height = size.bottom, xdiff = 0, ydiff = 0; int width = size.right, height = size.bottom, xdiff = 0, ydiff = 0;
if(GUI.AspectRatio) if(GUI.AspectRatio)
@ -7504,7 +7504,7 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
prevAspectRatio = GUI.AspectRatio; prevAspectRatio = GUI.AspectRatio;
prevAspectWidth = GUI.AspectWidth; prevAspectWidth = GUI.AspectWidth;
prevIntegerScaling = GUI.IntegerScaling; prevIntegerScaling = GUI.IntegerScaling;
prevHeightExtend = GUI.HeightExtend; prevHeightExtend = Settings.ShowOverscan;
prevAutoDisplayMessages = Settings.AutoDisplayMessages != 0; prevAutoDisplayMessages = Settings.AutoDisplayMessages != 0;
prevShaderEnabled = GUI.shaderEnabled; prevShaderEnabled = GUI.shaderEnabled;
prevBlendHires = GUI.BlendHiRes; prevBlendHires = GUI.BlendHiRes;
@ -7533,12 +7533,10 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
if (GUI.BlendHiRes) if (GUI.BlendHiRes)
SendDlgItemMessage(hDlg, IDC_HIRESBLEND, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); SendDlgItemMessage(hDlg, IDC_HIRESBLEND, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
if (GUI.HeightExtend) if (Settings.ShowOverscan)
SendDlgItemMessage(hDlg, IDC_HEIGHT_EXTEND, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); SendDlgItemMessage(hDlg, IDC_HEIGHT_EXTEND, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
if (Settings.AutoDisplayMessages) if (Settings.AutoDisplayMessages)
SendDlgItemMessage(hDlg, IDC_MESSAGES_IN_IMAGE, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); SendDlgItemMessage(hDlg, IDC_MESSAGES_IN_IMAGE, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
if (GUI.filterMessagFont)
SendDlgItemMessage(hDlg, IDC_MESSAGES_SCALE, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
if (Settings.SkipFrames == AUTO_FRAMERATE) if (Settings.SkipFrames == AUTO_FRAMERATE)
SendDlgItemMessage(hDlg, IDC_AUTOFRAME, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); SendDlgItemMessage(hDlg, IDC_AUTOFRAME, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
if (GUI.Stretch) if (GUI.Stretch)
@ -7592,6 +7590,8 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
SendDlgItemMessage(hDlg, IDC_SPIN_MAX_SKIP_DISP, UDM_SETPOS, 0, Settings.AutoMaxSkipFrames); SendDlgItemMessage(hDlg, IDC_SPIN_MAX_SKIP_DISP, UDM_SETPOS, 0, Settings.AutoMaxSkipFrames);
SendDlgItemMessage(hDlg, IDC_SPIN_MAX_SKIP_DISP_FIXED, UDM_SETRANGE, 0, MAKELPARAM((short)59, (short)0)); SendDlgItemMessage(hDlg, IDC_SPIN_MAX_SKIP_DISP_FIXED, UDM_SETRANGE, 0, MAKELPARAM((short)59, (short)0));
SendDlgItemMessage(hDlg, IDC_SPIN_MAX_SKIP_DISP_FIXED, UDM_SETPOS, 0, Settings.SkipFrames == AUTO_FRAMERATE ? 0 : Settings.SkipFrames); SendDlgItemMessage(hDlg, IDC_SPIN_MAX_SKIP_DISP_FIXED, UDM_SETPOS, 0, Settings.SkipFrames == AUTO_FRAMERATE ? 0 : Settings.SkipFrames);
SendDlgItemMessage(hDlg, IDC_SPIN_OSD_SIZE, UDM_SETRANGE, 0, MAKELPARAM(160, 24));
SendDlgItemMessage(hDlg, IDC_SPIN_OSD_SIZE, UDM_SETPOS, 0, GUI.OSDSize);
if (GUI.shaderEnabled) { if (GUI.shaderEnabled) {
SendDlgItemMessage(hDlg, IDC_SHADER_ENABLED, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); SendDlgItemMessage(hDlg, IDC_SHADER_ENABLED, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
@ -7688,7 +7688,6 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
case IDC_MESSAGES_IN_IMAGE: case IDC_MESSAGES_IN_IMAGE:
case IDC_MESSAGES_SCALE: case IDC_MESSAGES_SCALE:
Settings.AutoDisplayMessages = (bool)(IsDlgButtonChecked(hDlg,IDC_MESSAGES_IN_IMAGE)==BST_CHECKED); Settings.AutoDisplayMessages = (bool)(IsDlgButtonChecked(hDlg,IDC_MESSAGES_IN_IMAGE)==BST_CHECKED);
GUI.filterMessagFont = (bool)(IsDlgButtonChecked(hDlg, IDC_MESSAGES_SCALE) == BST_CHECKED);
if(Settings.AutoDisplayMessages) if(Settings.AutoDisplayMessages)
{ {
if(GFX.InfoString.empty()) { if(GFX.InfoString.empty()) {
@ -7740,7 +7739,7 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
break; break;
case IDC_HEIGHT_EXTEND: case IDC_HEIGHT_EXTEND:
GUI.HeightExtend = (bool)(IsDlgButtonChecked(hDlg,IDC_HEIGHT_EXTEND)==BST_CHECKED); Settings.ShowOverscan = (bool)(IsDlgButtonChecked(hDlg,IDC_HEIGHT_EXTEND)==BST_CHECKED);
// refresh screen, so the user can see the new mode // refresh screen, so the user can see the new mode
WinDisplayApplyChanges(); WinDisplayApplyChanges();
@ -7922,9 +7921,8 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
bool fullscreenWanted; bool fullscreenWanted;
Settings.Transparency = IsDlgButtonChecked(hDlg, IDC_TRANS); Settings.Transparency = IsDlgButtonChecked(hDlg, IDC_TRANS);
Settings.BilinearFilter = (bool)(IsDlgButtonChecked(hDlg,IDC_BILINEAR)==BST_CHECKED); Settings.BilinearFilter = (bool)(IsDlgButtonChecked(hDlg,IDC_BILINEAR)==BST_CHECKED);
GUI.HeightExtend = IsDlgButtonChecked(hDlg, IDC_HEIGHT_EXTEND)!=0; Settings.ShowOverscan = IsDlgButtonChecked(hDlg, IDC_HEIGHT_EXTEND)!=0;
Settings.AutoDisplayMessages = IsDlgButtonChecked(hDlg, IDC_MESSAGES_IN_IMAGE); Settings.AutoDisplayMessages = IsDlgButtonChecked(hDlg, IDC_MESSAGES_IN_IMAGE);
GUI.filterMessagFont = IsDlgButtonChecked(hDlg, IDC_MESSAGES_SCALE);
GUI.DoubleBuffered = (bool)(IsDlgButtonChecked(hDlg, IDC_DBLBUFFER)==BST_CHECKED); GUI.DoubleBuffered = (bool)(IsDlgButtonChecked(hDlg, IDC_DBLBUFFER)==BST_CHECKED);
GUI.ReduceInputLag = (bool)(IsDlgButtonChecked(hDlg, IDC_REDUCEINPUTLAG) == BST_CHECKED); GUI.ReduceInputLag = (bool)(IsDlgButtonChecked(hDlg, IDC_REDUCEINPUTLAG) == BST_CHECKED);
GUI.Vsync = (bool)(IsDlgButtonChecked(hDlg, IDC_VSYNC GUI.Vsync = (bool)(IsDlgButtonChecked(hDlg, IDC_VSYNC
@ -8004,7 +8002,7 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
GUI.AspectRatio = prevAspectRatio; GUI.AspectRatio = prevAspectRatio;
GUI.AspectWidth = prevAspectWidth; GUI.AspectWidth = prevAspectWidth;
GUI.IntegerScaling = prevIntegerScaling; GUI.IntegerScaling = prevIntegerScaling;
GUI.HeightExtend = prevHeightExtend; Settings.ShowOverscan = prevHeightExtend;
GUI.shaderEnabled = prevShaderEnabled; GUI.shaderEnabled = prevShaderEnabled;
GUI.BlendHiRes = prevBlendHires; GUI.BlendHiRes = prevBlendHires;
GUI.NTSCScanlines = prevNTSCScanlines; GUI.NTSCScanlines = prevNTSCScanlines;

View File

@ -162,7 +162,6 @@ struct sGUI {
bool FullScreen; bool FullScreen;
bool FullscreenOnOpen; bool FullscreenOnOpen;
bool Stretch; bool Stretch;
bool HeightExtend;
bool AspectRatio; bool AspectRatio;
bool IntegerScaling; bool IntegerScaling;
OutputMethod outputMethod; OutputMethod outputMethod;
@ -179,7 +178,7 @@ struct sGUI {
TCHAR OGLshaderFileName[MAX_PATH]; TCHAR OGLshaderFileName[MAX_PATH];
bool OGLdisablePBOs; bool OGLdisablePBOs;
bool filterMessagFont; int OSDSize;
bool IgnoreNextMouseMove; bool IgnoreNextMouseMove;
RECT window_size; RECT window_size;