mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-31 19:47:06 +01:00
Draws a user image around or behind the PSP screen, to fill the black bars on displays whose aspect ratio doesn't match the PSP's (#20325). - Overlays are PNGs in PSP/OVERLAYS. A plain PNG there just works: it's drawn in front of the game, and its transparent hole is found by walking from the image center to each edge until a nearly opaque pixel. Existing RetroArch overlay images can be dropped in as-is. - A subfolder with an overlay.ini can define overlays with a Name, Layer (Foreground/Background) and an explicit Hole=x,y,w,h. - "Load overlay image..." in the display layout screen imports any PNG (including Android content URIs) into the overlays folder and selects it. - The overlay is fit to the screen (aspect preserved, centered). The hole is mapped with the same scale, and the game is fit into it with the normal stretch / integer scale / aspect ratio options. Offset and scale don't apply while an overlay with a hole is active. This goes through CalculateDisplayOutputRect, so touch mapping and post shaders agree. - The selection is a per-orientation, per-game DisplayLayout setting. - Disabled in VR, Cardboard, and with skip buffer effects (except software rendering), since the presentation path doesn't run there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QGBg32EFPsTXjAFu7dnTcz
60 lines
2.1 KiB
C++
60 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
#include "Common/File/Path.h"
|
|
|
|
// Use these in conjunction with GetSysDirectory.
|
|
enum PSPDirectories {
|
|
DIRECTORY_PSP,
|
|
DIRECTORY_CHEATS,
|
|
DIRECTORY_SCREENSHOT,
|
|
DIRECTORY_SYSTEM,
|
|
DIRECTORY_NAND,
|
|
DIRECTORY_GAME,
|
|
DIRECTORY_SAVEDATA,
|
|
DIRECTORY_PAUTH,
|
|
DIRECTORY_DUMP,
|
|
DIRECTORY_SAVESTATE,
|
|
DIRECTORY_CACHE,
|
|
DIRECTORY_TEXTURES,
|
|
DIRECTORY_PLUGINS,
|
|
DIRECTORY_APP_CACHE, // Use the OS app cache if available
|
|
DIRECTORY_VIDEO,
|
|
DIRECTORY_AUDIO,
|
|
DIRECTORY_MEMSTICK_ROOT,
|
|
DIRECTORY_EXDATA,
|
|
DIRECTORY_CUSTOM_SHADERS,
|
|
DIRECTORY_CUSTOM_THEMES,
|
|
DIRECTORY_CUSTOM_OVERLAYS,
|
|
COUNT,
|
|
};
|
|
|
|
// Returns true if the given path (e.g. a zip entry name) contains a parent
|
|
// directory ("..") component. Used to guard against path traversal when
|
|
// extracting or writing files to disk.
|
|
bool HasParentDirComponent(std::string_view path);
|
|
|
|
// Returns true if the given string contains a path separator ('/' or '\\')
|
|
// or is a bare dot component ("." or ".."). Used to reject guest-controlled
|
|
// strings that would otherwise become host filesystem path components.
|
|
bool HasPathTraversal(std::string_view path);
|
|
|
|
// Returns true if an untrusted string (a disc ID, a texture pack's game ID) can be used as a single
|
|
// directory or file name. Stricter than HasPathTraversal: also rejects empty names, control
|
|
// characters, ':' (drive letters, NTFS streams) and the trailing dots and spaces Win32 strips,
|
|
// which would turn "..." into "..".
|
|
bool IsSafePathComponent(std::string_view name);
|
|
|
|
Path FindConfigFile(const Path &searchPath, std::string_view baseFilename, bool *exists);
|
|
Path GetSysDirectory(PSPDirectories directoryType);
|
|
bool CreateSysDirectories();
|
|
Path GetGameConfigFilePath(const Path &searchPath, std::string_view gameId, bool *exists);
|
|
bool TryUpdateSavedPath(Path *path);
|
|
Path GetFailedBackendsDir();
|
|
// The default memory stick of the Mac and Linux builds, shared by the app and headless. The Mac app may use
|
|
// another one, if the user picked it.
|
|
Path GetDefaultDesktopMemStickDirectory();
|
|
std::string GetFriendlyPath(Path path, const Path &rootMatch = Path(), std::string_view rootDisplay = "ms:/");
|