* NP Part 1: NPSignaling
PR Split 1 of X, adds the NPSignaling Library and some of the dependencies. Any stubs are highlighted by the stubs files and will be resolved upon other PRs. (Dependencies are to shadnet and further PR's to Matching2)
* PR Corrections
* PR Corrections 2
* PR Corrections 3
* clang fix
* Move to folder per request
* dummy fontlib libs
* register font libs
* typo fix
* added font error file
* added sceFontCharacterGetBidiLevel (from RE)
* fixup
* sceFontCharacterGetTextOrder , sceFontCharacterLooksFormatCharacters , sceFontCharacterLooksWhiteSpace RE
* sceFontCharacterRefersTextBack,sceFontCharacterRefersTextNext,sceFontRenderSurfaceInit,sceFontRenderSurfaceSetScissor RE
* sceFontRenderSurfaceSetStyleFrame ,sceFontStyleFrameGetEffectSlant RE added
* clang fix
* sceFontStyleFrameGetEffectWeight
* added sceFontStyleFrameGetScalePixel
* Update types.h
* fixup merge
* Enhance font rendering and management system
- Integrated `stb_truetype` for advanced font rendering.
- Added support for external and system fonts with logging.
- Introduced new structures for glyphs, metrics, and kerning.
- Implemented functions for font state management and scaling.
- Improved glyph rendering, including subpixel and caching.
- Enhanced render surface initialization and scissor handling.
- Refactored stubbed functions with proper implementations.
- Added ABI compatibility checks for key structures.
- Improved logging, error handling, and code organization.
- Updated documentation and comments for better clarity.
* Fix for DC: font scale still inaccurate, cause unknown.
Refactor font library: streamline file handling, enhance layout caching, and improve scale computation.
* Remove unnecessary blank line in OrbisFontStyleFrame struct
* Loading font files from app0, some other fixes.
* restored accidentally deleted stubbs.
* Add system font path configuration and loading functionality
Config example:
[General]
...
sysFontPath = "/.../NotoSansJP-Regular.ttf"
...
* Handle missing system font by clearing font bytes and logging an error
* Remove unused <system_error> include from font.cpp
possible MacOS build crash reason.
* fontlib: refactor style frame API; config-driven system fonts
-Update style frame getters to take the frame explicitly:
--sceFontStyleFrameGetResolutionDpi(OrbisFontStyleFrame*, u32* h_dpi, u32* v_dpi)
--sceFontStyleFrameGetScalePixel(OrbisFontStyleFrame*, float* w, float* h)
--sceFontStyleFrameGetScalePoint(OrbisFontStyleFrame*, float* w, float* h)
-Ensure setters operate directly on the passed style frame (signatures unified):
--sceFontStyleFrameSetEffectSlant(OrbisFontStyleFrame*, float slantRatio)
--sceFontStyleFrameSetEffectWeight(OrbisFontStyleFrame*, float weightXScale, float weightYScale, u32 mode)
--sceFontStyleFrameSetResolutionDpi(OrbisFontStyleFrame*, u32 h_dpi, u32 v_dpi)
--sceFontStyleFrameSetScalePixel(OrbisFontStyleFrame*, float w, float h)
--sceFontStyleFrameSetScalePoint(OrbisFontStyleFrame*, float w, float h)
-Remove/streamline unused declarations from font.h to tighten the interface
-Call sites using style frame getters must pass an OrbisFontStyleFrame* now
Config: define system fonts path and default filename overrides
-Add [General].sysFontPath to set the base directory for system fonts
-Add [SystemFonts]:
--fallback = "SST-Roman.otf" (lowercase key) for the default face when no set is requested
--Per-font overrides using lowerCamelCase keys (start with fontSet...), e.g.:
---fontSetSstStdJapaneseJpArBold = "SSTJpPro-Bold.otf"
--Override values are filenames resolved under sysFontPath (paths are rejected and logged)
-Back-compat: still accept legacy SysFontPath and Fallback if present
-Logging: emit errors when sysFontPath is missing/invalid, fallback missing, or an override includes a path
-Configs should switch to sysFontPath and [SystemFonts].fallback with override keys
* font.cpp
Added full glyph tracking/outline plumbing plus mutex-protected generated-glyph tracking and helpers (BuildTrueOutline, true-outline extraction, glyf detection, system-font cache/fallback logic, etc.).
Swapped OTF defaults for several JP/JP_AR sets (and CJK sets used by Death Stranding / Anywhere VR) to SSTAribStdB24-Regular.ttf or other TTFs so we load glyf faces.
Wrapped every LOG_* call in INFO/DEBUG pairs: INFO just announces the call, DEBUG lists each parameter on its own line with an extra trailing newline; warnings/errors remain for validation/fallback.
Implemented TTF detection for cache loading and fallback with logging.
Renamed glyph param struct/members, moved glyph handle struct into the header, and renamed the glyph API parameters/fields accordingly.
font.h
Added the new glyph outline/glyph handle definitions and renamed OrbisFontGenerateGlyphParams members (id, res0, form_options, mem, res1/2).
Updated function prototypes to use the renamed types and pointers (e.g., sceFontGenerateCharGlyph signature now matches the new names).
fontft.cpp
Reworked sceFontSelectLibraryFt/sceFontSelectRendererFt logging to follow the same INFO/DEBUG pattern (INFO announces that selection is requested, DEBUG dumps all params).
* clang
* Scaling and font state
Removed env‑driven debug scaling (ScaleMode, GetScaleMode, GetScaleBias, SHADPS4_FONT_SCALE_*).
Added FontState::is_otf_cff and storing of external vmetrics (ext_ascent, ext_descent, ext_lineGap).
Introduced ComputeScaleExtPoint, ComputeScaleExtPixel, IsEmProfileExternalFont and ComputeScaleExtForState to choose ascender‑ vs EM‑based scaling per font (system fonts + CFF → ascender; selected TTF profiles → EM).
Updated callers (sceFontGetCharGlyphMetrics, glyph cache, layout, renderer, clones, scale setters) to use ComputeScaleExtForState instead of ComputeScale / ComputeScaleExt.
System font handling
Added ReportSystemFaceRequest helper to centralize “attach system font or log why not” and avoid repeating the logic at each call site.
Slightly adjusted when system_requested is set and how fallback/system attach errors are reported.
Horizontal layout
sceFontGetHorizontalLayout now logs invalid parameter/handle and, when an external face is present, uses that face’s vmetrics and the per‑state scale to compute baselineOffset and lineAdvance.
(Fallback still uses the simple scale_h‑based approximation.)
Glyph rendering (horizontal)
Reworked sceFontRenderCharGlyphImageHorizontal:
Resolves effective pixel scale from the attached style frame + point/pixel API via ResolveStyleFrameScale.
Uses ComputeScaleExtForState to compute scale_y (and derived scale_x), rather than a single global scale.
Always computes metrics from stbtt_GetCodepointHMetrics + GetCodepointBitmapBoxSubpixel, with metrics->h_bearing_* and h_adv in sync with those scales.
Introduces a clearer origin/gravity model:
System fonts: (x,y) treated as raw top‑left.
Certain external TTFs (EM‑profile) : (x,y) treated as baseline.
Other external fonts (CFF/point etc.): (x,y) treated as line‑top with baseline offset.
Validates surfaces more strictly and returns NO_SUPPORT_SURFACE when buffer/size/bpp are invalid; supports only 1‑bpp and 4‑bpp.
Uses a local glyph_bitmap and a straightforward blit with scissor/clipping, instead of the older mix of cached bitmaps/PUA logging.
Removed PUA/placeholder glyph debug tracing and the more ad‑hoc baseline “adjusted_y” heuristic.
Logging clean‑up
Standardized LOG_INFO/LOG_DEBUG in sceFont* functions:
Info: usually just "called" or a short description (“scale pixel set requested”, etc.).
Debug: "parameters:\n"/"result:\n"/"template state:\n" followed by values on separate lines.
LOG_ERROR messages no longer repeat the function name (logger already prints it); they now say "invalid parameter", "invalid font handle", "no support glyph (face/scale)", "no support surface (buffer)", etc.
Added missing error logs before some early returns (allocation failures, page_count == 0, invalid parameters), and upgraded a few previous LOG_DEBUG “invalid params” to LOG_ERROR where they correspond to an error return.
* Add internal font handling structures and layout computation functions
This commit introduces a new header file `fontft_internal.h` containing
various structures and functions for managing font handles, layout metrics,
and rendering operations. Key additions include:
- Definitions for `FontHandleOpenInfo`, `FontHandleStyleStateTail`,
and `FontHandleOpaqueNative` to encapsulate font state and properties.
- Layout-related structures such as `HorizontalLayoutBlocks`,
`VerticalLayoutBlocks`, and their respective I/O structures for
managing layout metrics and effects.
- Functions for computing horizontal and vertical layout blocks,
along with utility functions for handling layout words in byte format.
- Stubs for library functions related to font management and rendering.
These changes aim to enhance the font rendering capabilities of the
shadPS4 Emulator Project, providing a robust foundation for future
font-related features.
* Add FreeType submodule for GitHub CI workflows
* Refactor font rendering and path resolution logic to fix Metaphor: ReFantazio glyphs cropping and anywhereVR "thin" glyphs.
- Updated RenderCodepointToSurface and RenderCodepointToSurfaceWithScale functions to set result->transImage to nullptr instead of result->stage.
- Modified font definitions to use updated font file names for various language sets.
- Introduced ResolveSystemFontPathCandidate function to streamline font path resolution, allowing for better handling of font directories.
- Enhanced LoadFontFile function to check for font files in "font" and "font2" directories based on the parent directory name.
- Improved error logging for font path overrides in ResolveSystemFontPath function.
* clang
* Update fontft_internal.cpp
typo fix
* Fix: fypo
* create sys_fonts in users folder and instructions.txt of what to put inside
* cut version of emulator settings to support custom sysfonts folder
* load settings
* cmakelist
* using new saving system but i can't understand the fallback mechanism
* removed lle versions
* Enhance error logging in font metrics functions and update comments for clarity
* Refactor font library functions and improve thread safety
- Updated function signatures in font.h to include the OrbisFontLib parameter for cache clearing and outline buffer management.
- Introduced a mutex in font_internal.cpp to ensure thread safety by protecting access to global font state and library state.
- Added a RemoveState function to safely remove font states.
- Enhanced memory allocation functions in fontft_internal.cpp to use Core::ExecuteGuest for better integration with the guest environment.
- Simplified font loading logic in LibraryOpenFontMemoryStub to improve readability and maintainability.
- Removed redundant code related to file opening and memory allocation, streamlining the font loading process.
This potentially fixes emulator crashes in games that use parallel font initialization, such as Dragon’s Crown.
* Add system font path and override config support
Introduce new config options for system font directory, fallback font name, and per-font overrides. Update config load/save logic to handle a [SystemFonts] TOML section, supporting both fallback and individual font overrides. Improve user instructions for custom font setup and clarify related code comments. These changes enhance flexibility and user experience for system font configuration.
* clang
* Add system font path management functions and refactor font directory retrieval
* Restored support for loading the libSceAudiodec system module
* Refactor font path handling and remove unused functions
* Fix include order for emulator settings and key manager (Clang)
* Remove unused emulator settings files and clean up includes in main and config files
* Remove unused instructions file creation from user paths initialization
* Consolidate internal font/ft internals
Move internal font structs, aliases, and helpers out of font.cpp into shared internal headers/sources.
Promote shared ABI-facing types (including FontHandleOpaqueNative and layout/system-use structs) into font internal headers and remove function-local duplicates.
Move FreeType driver/renderer table construction into fontft_internal.cpp and wire fontft.cpp to internal getters.
Ensure internal.cpp implementations are declared in headers; deduplicate declarations and clean includes.
* Refactor memory allocation and deallocation calls to remove Core::ExecuteGuest wrapper
* clang
* Add conditional linking for freetype library in shadps4 target
* Add new fixed-point arithmetic functions for font rendering
This commit introduces several new functions to handle fixed-point arithmetic operations, specifically for converting and scaling values related to font rendering. The added functions include:
- FixedMulUnitsToF26Dot6
- Cvttss2siCompat
- RoundMul16x16ToS32
- TruncFixed16x16ToInt
- RoundFixedMulValueScaleToS32
- TruncMulUnitsToS64
- RoundFixedMul16x16ToS64
These functions will enhance the precision and performance of font rendering calculations.
* Refactor: Replace Config usage with EmulatorSettings for font directory retrieval
* Sysmodule: Stop forcing HLE for font modules
* Add support for built-in font handling and fallback mechanisms
- Introduced a new structure `BuiltinFontBlob` to manage built-in font data.
- Implemented decompression functions for loading built-in fonts from compressed data.
- Added functions to resolve and load built-in fonts, including `LoadBuiltinFontBytesShared` and `IsBuiltinFontPath`.
- Enhanced `AttachSystemFont` to utilize built-in fonts as fallbacks when system fonts are unavailable.
- Implemented `AddBuiltinFallbackFaces` to add necessary fallback fonts based on font set types.
- Updated font selection logic to include Thai and symbol fonts in `ResolveSysFontCodepoint`.
- Modified `LibraryOpenFontMemoryStub` to handle loading built-in fonts directly from shared data.
- Added notifications for users when system fonts are not found, indicating fallback usage.
- Updated header files to declare new structures and functions related to built-in font handling.
---------
Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
Co-authored-by: w1naenator <valdis.bogdans@hotmail.com>
* Reset controller colours on emulator shutdown
* bruh moment
* Don't use the destructor for this
* clang, formatter of night
* forgot to stage this file
* ffs
* fix tests
* fixed tests?
* gcn tests fixed?
* now?
* possible fixed
---------
Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
* Add error logging for unsupported file descriptors
Log an error when an unsupported file descriptor is encountered.
* Log error with correct variable in file_system.cpp
* fix clang being a whiny bitch
* use {}
* changed from error to warning, and added it to windows version of function
meow
* Fix some new bugs caused by lack of trophy key after #4498
By not adding to the trophy map, games would hit the error return in sceNpTrophyCreateContext instead of the stub for trophy-key-less individuals.
* Revert "Workaround for bad npbind.dat"
This reverts commit 7bd27054f3.
* Move NPCommID checks to sceNpTrophyRegisterContext
CreateContext doesn't seem to check anything, I can run it successfully on a homebrew with none of the NP files. The first errors start in sceNpTrophyRegisterContext.
* Update np_error.h
* Update np_trophy.cpp
* Workaround for bad npbind.dat
Games that check trophy returns still complain, and at this point, it's entirely the user's fault.
However, people don't like that answer, so workaround the issue.
Introduces a check for valid context paths, and a stub OK return that triggers if RegisterContext would've failed on real hardware.
* Better log messages
* sceHttpAddRequestHeader
* added sceHttpRemoveRequestHeader
* implemented a few more functions
* added sceHttpSetProxy
* cleanup
* more cleanup
* fix tests?
* fix tests part2
* Added debug in SendRequest
* improved debug
* forgot
* added real http connection path
* fixes for wipeout
* add custom redirect as it doesn't match the httplib one
* more debug messages
* clang is not my friend
* argg
* make kernelstub configurable
* added url override
* fixup
* ..
* stephen's reviews
* more stephen reviews
* http tests
* fixed tests
* fixed a single tests isssue
* one more fix
* argg
* Uze miniz instead of zlib for libSceZlib
Might fix ROTTR?
* Claaaaang
* Explicitly use miniz's uncompress
* Clang2
* Swap types
In theory, these types are all the same size. Best we use the right ones for the library though.
* Remove "stub" logs
* Restructed PthreadMutex struct
When libc creates mspaces, they modify the data of a PthreadMutex to set the mutex's private flag. Previously, on Linux, this would modify internal data of our TimedMutex, and on Windows this would modify the m_yieldloops variable.
This makes it so our m_flags is at the same offset as the real pthread_mutex struct, so no data corruption occurs.
* Further struct changes
To address review comments
It's recursive in the actual library, and since our implementation in thoroughly based on the actual library, this is needed for our code to function appropriately.
Add check in sceKernelReserveVirtualRange, sceKernelMapNamedDirectMemory, and
sceKernelMapNamedFlexibleMemory per StevenMiller123 review:
- FW >= 1.70 returns EINVAL for Fixed + addr == 0
- Older FW clears Fixed flag to fall through to managed allocation
Co-authored-by: opencode <dev@shadps4.local>
* Set dummy GameController's m_connected to false
* Remove this check and handle it differently
* Save one reverse lookup on a map
this is mostly irrelevant on performance
* i have no clue so let's just log stuff
* apparently this is the correct default
* swap this to debug logging
* the loathsome clang-formatter
* sigaddset, sigdelset, sigismember
* Some define fixups
Based on decomp, PS4 sigset is defined as a u32[4]. This doesn't change any behavior, but makes my decomp-based sigaddset and sigdelset implementations function appropriately.
Additionally, define handler and sigaction functions as PS4_SYSV_ABI.
* Fix returns
* Implement signal, export _sigintr
In libkernel, signal just uses sigaction. No harm in implementing it, since we've got our own implementations for everything except sigaction (and sigaction is implemented for Unix platforms).
* Fix and cleanup posix_select defines
Swaps use of defines for just having static functions, and fixes the pd_set_posix struct to match FreeBSD/Orbis properly (sizeof(long) == 4 on Windows, which does not match Orbis).
* Fix siginfo struct
Again, sizeof(long) differs on different platforms. Need to use our proper typedef to ensure accuracy.
* Clang, the bane of my existance.
* Oops
* move np_score to /np_score folder
* added more logging to np functions
* using common np_error file
* moved web_api to dedicated folder
* implemented some context creations for np_score so logging would be more productive
* implement sceAudio3dPortCreate and closer implementation to sceAudio3dPortOpen
* clang format and forgot to remove some lines
* refactor port creation, small cleanups and openal
* rename parameter arguments
* idk might be correct
* floor size_this to closest multiple of 8
* Fix nids for strcmp vs strncmp
Co-Authored-By: m33ts4k0z <3597723+m33ts4k0z@users.noreply.github.com>
* Fix sign_bit_set logic
Co-Authored-By: m33ts4k0z <3597723+m33ts4k0z@users.noreply.github.com>
* Fix IterateDirectory on mounts
IterateDirectory would just retrieve the base path when trying to iterate /app0, since GetHostPath for the other path types would still return the base path.
Co-Authored-By: m33ts4k0z <3597723+m33ts4k0z@users.noreply.github.com>
* Fix function resolves
If multiple modules export the same library and module, then we would only check the first one we find for the symbol. This can end up breaking the font library stack
Co-Authored-By: m33ts4k0z <3597723+m33ts4k0z@users.noreply.github.com>
* Update fs.cpp
Co-Authored-By: m33ts4k0z <3597723+m33ts4k0z@users.noreply.github.com>
* Oops
---------
Co-authored-by: m33ts4k0z <3597723+m33ts4k0z@users.noreply.github.com>
* Fix flip status on close
* Store equeues by handle instead of pointer
As is, a game could call sceKernelDeleteEqueue on the equeue registered for flip/vblank events, and terminate the equeue while our VideoOut driver retains a valid pointer to it.
Changing to storing the equeue handle means we can check if the equeue still exists and prevent this.
* Remove flip and vblank events on sceVideoOutClose
* Don't forget to clear vectors
* Oops
Intended to erase the memset on FlipStatus, not VblankStatus.
* Add proper SDK checks for language values
Fixes some crashes caused by otherwise valid languages in older titles.
* Rename firmware constants
Makes more sense this way, and works better in case we find an SDK check added in a more minor update.
Instead of 1.00 being 10, 1.50 being 15, and so on, this commit changes 1.00 to 100, 1.50 to 150, and so on.
* Claaaaang
* more uri work based on decompile and tests
* fix includes
* fix loader stubs
* cleanups
* sceHttpParseStatusLine matches decompile and tests
* sceHttpParseResponseHeader implemenation and tests
* try fixing no-internet path in sendrequest
* minimal state machine to support proper erroring of no-internet available
* more improvements
* more implementation based on stephen's comments
* some more fixes based on decompile
* add parameters and logging
* added sceHttpUriBuild , fixes to sceHttpUriEscape ,sceHttpUriParse
* return an error to statuscode , this should be enough for no-connection
* Core: Add user state callback management and improve user login/logout handling
* Core: Implement handle key lookup and special handle checks in pad library
---------
Co-authored-by: w1naenator <valdis.bogdans@hotmail.com>
Use template <auto f> for HostCallWrapperImpl and OrbisWrapperImpl instead of passing the function type and value separately.
This keeps the wrapper behavior the same while matching the form MinGW-w64 GCC accepts.
* Export empty environment
Media Player tries to read from environ before doing some rather freaky stuff, without anything exported it will just crash from dereferencing an invalid pointer.
* Set program name
Wasn't sure what the best way would be to do this
* Just stub to eboot.bin
Accurate enough, hopefully.
* Fix for SignalTo behavior
Should run FindThread to make sure thread input is valid.
* Missing mutex-related exports
* Oops
* All missing cond exports
We have these implemented, so we might as well export them.
I also organized them a bit.
* Implement pthread_attr_getscope, pthread_attr_setcreatesuspend_np, pthread_attr_setscope
Also export all of our pthread_attr functions.
* Oops
* Fix SchedPolicy::Fifo definition
Some tricks FreeBSD source performs breaks with this incorrectly set.
Specifically, stuff like setting priorities breaks because we do array accesses with priority - 1 like FreeBSD, but Fifo being 0 makes that an oob read.
* Fix error checks in pthread_attr_setschedparam
* Fix and run thread destructors
_sceKernelSetThreadDtors receives the function itself, not a pointer to the function.
* Oops
* Rewrite pthread_rename_np for accuracy
There's a couple details the initial implementation missed that decomp shows. We weren't locking, we weren't doing the reference add or delete ops, and we were erroneously skipping null names when real hardware actually seems to allow it (the only thing real hardware skips for null name is naming the thread stack).
* Avoid changing common code by using the converted thread name instead
Slightly cleaner code
* Oops
* Flip priority defines
This better matches with FreeBSD's defines, and fixes the returns of sched_get_priority_min and sched_get_priority_max
* Fix args and return for sched_get_priority_max and sched_get_priority_min
Behavior is based on my own kernel decomp (though what I'm seeing matches what red_prig's done for fpPS4 too).
* Better comment
why not
* Fix error behavior of scePthreadGetPrio
Can error from invalid thread input, which the function hardcodes as an ORBIS_KERNEL_ERROR_ESRCH.
* Fix pthread_setprio
This should use the RefAdd and RefDelete functions on non-curthread threads, not FindThread.
* Remove pthread_set_name_np
Decomp shows it's identical to pthread_rename_np.
* Bring back pthread_set_name_np
What I didn't realize was that it was a void method. Behavior is the same as pthread_rename_np though, so call it instead of doing the direct common setname call.
* Move pthread_set_name_np
Needs to be under pthread_rename_np so I can actually call it.
* Better implementation of pthread_getname_np
* rwlock types
Some Sony extension to rwlocks, paired with a proper SDK check specific to rwlock init. I've implemented both pthread_rwlockattr_gettype_np and pthread_rwlockattr_settype_np, and added the relevant SDK check for rwlockattr type.
* Missing thread unlock in SignalTo
SignalTo specifically runs FindThread, then unlocks before running pretty much the same code as Signal.
* Fix comment
* sceKernelGetProcessType
* sceCoredumpRegisterCoredumpHandler stub
* Better stub for sceCoredumpRegisterCoredumpHandler, stub sceCoredumpUnregisterCoredumpHandler
* sceNpSetNpTitleId stub
* sceNpSetContentRestriction stub
* sceKernelMlock stub
* posix_sigfillset
* posix_sigprocmask stub
Just logs the how parameter
* posix_msync stub
Just logging for now
* libSceContentExport stubs
* Clang
* sceVideoRecordingSetInfo stub
* sceKernelTitleWorkaroundIsEnabled
* Provide title workaround bits
Just grabbed them from fpPS4 code, I have a feeling actually applying these is gonna be a bit of a pain though.
* fpPS4 has a 0x39 bit, I guess that was probably added after 12.52 though.
* Bump to error
It's not going to work without proper sceKernelGetAppInfo workaround data
* Clang
* Clang2
* Fixes PSP emulation with the following changes:
1. Reserved Memory cannot be mapped, this seems to be incorrect and the
PSP emulation relies on reserving then mapping memory at startup.
From other logs, this may affect PS2 emulation as well.
2. Temp directory output may have garbase and the API is not null
terminating the output, resulting in failures when the file
path is not valid.
3. Fix misaligned images when viewport is sized for PSP.
This fixes garbage in movies on the PSP emulator, making the
movies viewable, scaled correctly for the screen.
4. Some PSP moves render incorrectly without sceVideodec2GetAvcPictureInfo
5. Fix dirty hash size calculation and RGB4444 mapping to fix textures
These changes combined allow Jean d'Arc, LocoRoco and Patapon to run
decently.
* fix formatting
* null terminate the temp path rather than using memset
* fix memory mapping in a more correct way
* revert RGB4444 changes as it breaks other games color mapping
* Set up [userid, type, index] -> pad_handle mapping and hook up currently existing GameControllers backend to it
* just use basic oop principles why are we even shoving callee responsibility in caller logic
* support special pads
* random edge case I thought of
* return error if handle is already opened, redirect scePadOpenExt to scePadOpen
* scePadClose
* error out if trying to close an unopened handle
* oof
* logging
* Add IME keyboard layout and panel metrics support
- Introduced new header and implementation files for IME keyboard layout handling.
- Added structures for viewport metrics, keyboard grid layout, and drawing parameters.
- Implemented functions to compute viewport and panel metrics for the IME dialog.
- Enhanced the IME dialog UI to utilize the new keyboard layout and metrics.
- Updated input handling to support new keyboard interactions and layout adjustments.
- Added caret management and text normalization features in the IME dialog state.
- Improved window positioning logic to accommodate different screen resolutions.
* fix for Maxos Linux builds
* Align IME behavior with real PS4 libSceIme/Dialog flow
Features:
- Add validation helpers for IME option/language/extended-option masks
- Implement `sceImeGetPanelSize` sizing logic
- Replace `sceImeSetTextGeometry` no-op path with real state/argument validation
- Align panel sizing/validation paths closer to PS4 IME behavior
- Improve panel text/caret handling reliability during UI updates
- Add IME panel movement via controller right stick
- Support mouse drag repositioning for the panel
- Respect `FIXED_POSITION` by disabling movement when locked
Updates:
- Tighten `sceImeOpen` checks (user/type/input method, handler, work alignment, reserved, overlap)
- Validate initial/runtime text rules (`\n`/`\r` and surrogate rejection) in open/set-text paths
- Enforce caret bounds and null-caret behavior in `sceImeSetCaret`
- Update `sceImeUpdate` to return `NOT_OPENED` in invalid states and respect handler matching
- Harden `ImeHandler` against null state/callback execution paths
- Optimize keyboard grid rendering by reusing per-frame buffers
- Reduce input callback allocations with fixed-size buffers
- Harden panel update paths for invalid handler/open-state cases
- Clamp panel position to visible screen bounds
- Apply stick deadzone/speed scaling for stable movement
- Keep panel coordinates consistent with IME coordinate mode
* 🤦♂️
* Enhance IME UI and Input Handling
- Introduced BrightenColor function to adjust color brightness for UI elements.
- Improved UTF-16 character handling with new functions to count UTF-16 units and reject input based on UTF-16 limits.
- Added functionality to clamp input buffer to UTF-16 limits, ensuring text input does not exceed specified limits.
- Refactored virtual pad input handling to encapsulate left stick directions and panel movement.
- Enhanced IME UI drawing logic to incorporate new input handling and navigation features.
- Updated keyboard layout handling to support dynamic configurations and improved navigation shortcuts.
- Integrated additional font ranges for better language support in the IME, including Chinese, Arabic, and Thai.
- Improved overall code structure and readability by utilizing modern C++ features such as std::vector and std::array.
* Remove non existing Roboto Medium font from IME initialization
* Enhance IME Dialog and UI with Improved Gamepad Navigation and Key Mapping
- Added support for disabling gamepad input through OrbisImeDisableDevice in ImeDialogState.
- Updated ImeKbLayout to modify key mappings for better character input, including changes to punctuation keys.
- Implemented enhanced left stick navigation with repeat functionality in ImeUi, allowing for smoother input handling.
- Introduced new constants for stick navigation delays and repeat intervals to improve responsiveness.
- Refactored input handling logic to accommodate both virtual and gamepad inputs, ensuring consistent behavior across devices.
- Added functionality to clear all text in the input field with a specific shortcut, aligning with expected user behavior.
* clang
* Enhance IME functionality with improved gamepad navigation and layout handling
* ime: fix specials/accent layout mapping and dynamic panel resize handling
- Expand specials/accent keyboard layouts to a 7-row model and move function keys to fixed bottom rows.
- Add variable row-height support to the keyboard grid (`fixed_bottom_rows`, `bottom_row_h`) and compute row offsets/span heights from layout config.
- Preserve function-row height in `ime_ui` and `ime_dialog_ui` while distributing remaining height across typing rows.
- Make mode-switch focus layout-driven by resolving `SymbolsMode`/`SpecialsMode` action keys in the active layout instead of relying on implicit row assumptions.
- Track panel layout anchor deltas in `ime_dialog_ui` and use press-offset dragging so cursor remains on the originally pressed point when panel dimensions/position change.
* Add IME UI enhancements and shared utilities
- Introduced new states for panel navigation and selector fade in `ime_ui.h`.
- Added a new header file `ime_ui_shared.h` containing utility functions and structures for virtual pad input handling, including deadzone application and stick navigation direction resolution.
- Updated `font_stack.cpp` to include additional Unicode ranges for general punctuation in the font atlas.
* Refactor IME settings: remove deprecated accessibility options and update references to use new settings structure
* Refactor IME UI Navigation and Activation Logic
- Introduced a new mechanism for handling virtual button repeat actions, improving responsiveness for gamepad navigation.
- Added support for stick navigation with adjustable repeat rates and initial delays, enhancing user experience during input.
- Removed the ImeSelectorFadeState structure and related logic to streamline the IME keyboard layout drawing process.
- Simplified the activation logic for menus, ensuring that menu activation is more intuitive and responsive to user input.
- Adjusted the navigation threshold for stick inputs to improve sensitivity and control.
- Cleaned up the code by removing unused variables and consolidating repeated logic into reusable functions.
* Refactor IME UI shared header: streamline code and improve structure
- Removed unused includes and redundant structures.
- Consolidated virtual pad snapshot handling and input state management.
- Introduced new structures for OSK pad input and navigation handling.
- Updated function signatures for clarity and consistency.
- Enhanced keyboard parameter application for OSK shortcuts.
- Improved overall readability and maintainability of the code.
* Refactor OskShortcutActionResult to simplify triangle button press handling
* Enhance IME Keyboard Layout and UI Functionality
- Added new key glyphs for Shift and Caps Lock in ime_kb_layout.h.
- Improved keyboard navigation logic to skip non-action keys.
- Introduced new constants for selector IDs in ime_ui.cpp for better readability.
- Refactored keyboard row and column clamping logic for clarity.
- Enhanced selector drawing logic with fade and pulse effects for better user feedback.
- Implemented functions for cycling keyboard case states and toggling keyboard family modes.
- Added functionality to focus on keyboard action keys based on their actions.
- Improved edit menu handling with new templated functions for better code reuse.
- Updated caret blinking logic to improve text input experience.
- Expanded symbol ranges in font_stack.cpp to include keyboard symbols.
---------
Co-authored-by: w1naenator <valdis.bogdans@hotmail.com>
* Refactor memory size constants and calculations
Updated memory size handling in video decoder functions.
* Refactor video decoder frame size calculations
Updated frame size computation to use worst-case dimensions and adjusted alignment values.
* Refactor alignment logic to use Common::AlignUp