mirror of
				https://github.com/hedge-dev/UnleashedRecomp.git
				synced 2025-10-30 07:11:05 +00:00 
			
		
		
		
	Options: Add Custom Aspect Ratios
This commit is contained in:
		
							parent
							
								
									da5db2a05a
								
							
						
					
					
						commit
						01b3fff8f1
					
				
					 6 changed files with 44 additions and 2 deletions
				
			
		|  | @ -2913,6 +2913,26 @@ void Video::ComputeViewportDimensions() | |||
| 
 | ||||
|         break; | ||||
|     } | ||||
|      | ||||
|     case EAspectRatio::Custom: | ||||
|     { | ||||
|         uint32_t horzAspect = Config::AspectWidth; | ||||
|         uint32_t vertAspect = Config::AspectHeight; | ||||
|         float customAspectRatio = float(horzAspect) / float(vertAspect); | ||||
| 
 | ||||
|         if (aspectRatio > customAspectRatio) | ||||
|         { | ||||
|             s_viewportWidth = height * horzAspect / vertAspect; | ||||
|             s_viewportHeight = height; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             s_viewportWidth = width; | ||||
|             s_viewportHeight = width * vertAspect / horzAspect; | ||||
|         } | ||||
| 
 | ||||
|         break; | ||||
|     } | ||||
| 
 | ||||
|     default: | ||||
|         s_viewportWidth = width; | ||||
|  | @ -7344,6 +7364,8 @@ void VideoConfigValueChangedCallback(IConfigDef* config) | |||
|     // Config options that require internal resolution resize
 | ||||
|     g_needsResize |= | ||||
|         config == &Config::AspectRatio || | ||||
|         config == &Config::AspectWidth || | ||||
|         config == &Config::AspectHeight || | ||||
|         config == &Config::ResolutionScale || | ||||
|         config == &Config::AntiAliasing || | ||||
|         config == &Config::ShadowResolution; | ||||
|  |  | |||
|  | @ -546,7 +546,8 @@ CONFIG_DEFINE_ENUM_LOCALE(EAspectRatio) | |||
|             { EAspectRatio::Auto, { "AUTO", "Auto: the aspect ratio will dynamically adjust to the window size." } }, | ||||
|             { EAspectRatio::Wide, { "16:9", "16:9: locks the game to a widescreen aspect ratio." } }, | ||||
|             { EAspectRatio::Narrow, { "4:3", "4:3: locks the game to a narrow aspect ratio." } }, | ||||
|             { EAspectRatio::OriginalNarrow, { "ORIGINAL 4:3", "Original 4:3: locks the game to a narrow aspect ratio and retains parity with the game's original implementation." } } | ||||
|             { EAspectRatio::OriginalNarrow, { "ORIGINAL 4:3", "Original 4:3: locks the game to a narrow aspect ratio and retains parity with the game's original implementation." } }, | ||||
|             { EAspectRatio::Custom, { "Custom", "The aspect ratio is set to the values in 'Aspect Width' and 'Aspect Height'." } } | ||||
|         } | ||||
|     }, | ||||
|     { | ||||
|  | @ -565,6 +566,7 @@ CONFIG_DEFINE_ENUM_LOCALE(EAspectRatio) | |||
|             { EAspectRatio::Wide, { "16:9", "16:9: Stellt das Spiel in einem Breitbildschirm-Vormat dar." } }, | ||||
|             { EAspectRatio::Narrow, { "4:3", "4:3: Stellt das Spiel in einem Mittel-Vormat dar." } }, | ||||
|             { EAspectRatio::OriginalNarrow, { "ORIGINAL 4:3", "Original 4:3: Stellt das Spiel in einem Mittel-Vormat dar, was der ursprünglichen Implementation originalgetreut bleibt." } } | ||||
|             { EAspectRatio::Custom, { "Benutzerdefiniert", "Das Seitenverhältnis entspricht den Werten in 'Seitenverhältnis-Breite' und 'Seitenverhältnis-Höhe'." } } | ||||
|         } | ||||
|     }, | ||||
|     { | ||||
|  | @ -596,6 +598,18 @@ CONFIG_DEFINE_ENUM_LOCALE(EAspectRatio) | |||
|     } | ||||
| }; | ||||
| 
 | ||||
| CONFIG_DEFINE_LOCALE(AspectWidth) | ||||
| { | ||||
|     { ELanguage::English, { "Aspect Width", "Adjust aspect width for custom aspect ratios." } }, | ||||
|     { ELanguage::German,  { "Seitenverhältnis-Breite", "Passe die Breite für benutzerdefinierte Seitenverhältnisse an." } } | ||||
| }; | ||||
| 
 | ||||
| CONFIG_DEFINE_LOCALE(AspectHeight) | ||||
| { | ||||
|     { ELanguage::English, { "Aspect Height", "Adjust aspect height for custom aspect ratios." } }, | ||||
|     { ELanguage::German,  { "Seitenverhältnis-Höhe", "Passe die Höhe für benutzerdefinierte Seitenverhältnisse an." } } | ||||
| }; | ||||
| 
 | ||||
| // Japanese Notes: This localization should include furigana.
 | ||||
| CONFIG_DEFINE_LOCALE(ResolutionScale) | ||||
| { | ||||
|  |  | |||
|  | @ -1266,6 +1266,8 @@ static void DrawConfigOptions() | |||
|             DrawConfigOption(rowCount++, yOffset, &Config::Monitor, canChangeMonitor, monitorReason, 0, 0, displayCount - 1, false); | ||||
| 
 | ||||
|             DrawConfigOption(rowCount++, yOffset, &Config::AspectRatio, true); | ||||
|             DrawConfigOption(rowCount++, yOffset, &Config::AspectWidth, true, nullptr, 1, 50, 100); | ||||
|             DrawConfigOption(rowCount++, yOffset, &Config::AspectHeight, true, nullptr, 1, 50, 100); | ||||
|             DrawConfigOption(rowCount++, yOffset, &Config::ResolutionScale, true, nullptr, 0.25f, 1.0f, 2.0f); | ||||
|             DrawConfigOption(rowCount++, yOffset, &Config::Fullscreen, true); | ||||
|             DrawConfigOption(rowCount++, yOffset, &Config::VSync, true); | ||||
|  |  | |||
|  | @ -322,6 +322,7 @@ CONFIG_DEFINE_ENUM_TEMPLATE(EAspectRatio) | |||
|     { "16:9", EAspectRatio::Wide }, | ||||
|     { "4:3",  EAspectRatio::Narrow }, | ||||
|     { "Original 4:3",  EAspectRatio::OriginalNarrow }, | ||||
|     { "Custom",  EAspectRatio::Custom }, | ||||
| }; | ||||
| 
 | ||||
| CONFIG_DEFINE_ENUM_TEMPLATE(ETripleBuffering) | ||||
|  |  | |||
|  | @ -84,7 +84,8 @@ enum class EAspectRatio : uint32_t | |||
|     Auto, | ||||
|     Wide, | ||||
|     Narrow, | ||||
|     OriginalNarrow | ||||
|     OriginalNarrow, | ||||
|     Custom | ||||
| }; | ||||
| 
 | ||||
| enum class ETripleBuffering : uint32_t | ||||
|  |  | |||
|  | @ -56,6 +56,8 @@ CONFIG_DEFINE("Video", int32_t, WindowHeight, 720); | |||
| CONFIG_DEFINE_ENUM("Video", EWindowState, WindowState, EWindowState::Normal); | ||||
| CONFIG_DEFINE_LOCALISED("Video", int32_t, Monitor, 0); | ||||
| CONFIG_DEFINE_ENUM_LOCALISED("Video", EAspectRatio, AspectRatio, EAspectRatio::Auto); | ||||
| CONFIG_DEFINE_LOCALISED("Video", int32_t, AspectWidth, 16); | ||||
| CONFIG_DEFINE_LOCALISED("Video", int32_t, AspectHeight, 9); | ||||
| CONFIG_DEFINE_LOCALISED("Video", float, ResolutionScale, 1.0f); | ||||
| CONFIG_DEFINE_LOCALISED("Video", bool, Fullscreen, true); | ||||
| CONFIG_DEFINE_LOCALISED("Video", bool, VSync, true); | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 JaceCear
						JaceCear