Commit Graph

1290 Commits

Author SHA1 Message Date
Valdis Bogdāns
cfcd365158
Merge branch 'shadps4-emu:main' into fontlib 2026-01-06 14:25:59 +02:00
georgemoralis
256397aa3b
Net fixes (#3895)
* support for flag in recv/send

* make kalapsofos happy

* on more SendMessage try

* ReceiveMessage too
2026-01-05 01:57:31 +02:00
mercury501
975b1d312a
Fixed dialog text input off by one error (#3892)
* Fixed dialog off by one error

* Fixed exclusion error

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
2026-01-04 21:30:50 +02:00
kalaposfos13
df844f8c02
Add thread names to log lines (#3893)
* the bare minimum (this won't even compile on windows yet)

* well I guess this is redundant now

* Windows GetThreadName

* Move function to common/thread and add full guest name where applicable

* the loathsome clang-formatter

* do stuff first ask for opinions later

* copyright 2026

* remove unused header

* copyright 2024-2026

---------

Co-authored-by: Stephen Miller <56742918+StevenMiller123@users.noreply.github.com>
2026-01-04 21:10:42 +02:00
Vladislav Mikhalin
9a3e4ea56b
ajm: support for m4aac (#3880)
* ajm m4aac

* fix build on unix

* small tunes

* skip 2 frames if nodelay is not set, change to google repo
2025-12-28 13:24:42 +02:00
Vladislav Mikhalin
05f14e3682
ajm fixes (#3875) 2025-12-23 11:11:52 +02:00
Valdis Bogdāns
ff947b61a5
Merge branch 'shadps4-emu:main' into fontlib 2025-12-23 01:06:25 +02:00
Rodrigo Cioletti
138425fdf4
Network: Fixed null string crash on sceNetResolverCreate (#3872)
Some checks failed
Build and Release / reuse (push) Has been cancelled
Build and Release / clang-format (push) Has been cancelled
Build and Release / get-info (push) Has been cancelled
Build and Release / windows-sdl (push) Has been cancelled
Build and Release / macos-sdl (push) Has been cancelled
Build and Release / linux-sdl (push) Has been cancelled
Build and Release / linux-sdl-gcc (push) Has been cancelled
Build and Release / pre-release (push) Has been cancelled
* Network: Fixed null string crash on sceNetResolverCreate

* Assigned an empty string for better code styling

* Fixed wrong commit
2025-12-21 15:50:49 +02:00
Valdis Bogdāns
42f088f56d
Merge branch 'shadps4-emu:main' into fontlib 2025-12-20 14:07:47 +02:00
marecl
2bbb04ff55
ENAMETOOLONG, posix_rename fix (#3869)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
* ENAMETOOLONG on paths > 255 characters
Corrected posix_rename behaviour:
* handles errors only if dst exists (shouldn't error out if doesn't)
* recursively removes "old name" (would otherwise fail if it's a not-empty dir)
* actually creates target directory

* Updated detection

* destubbed unlink()

* proper error returned
2025-12-19 14:58:07 +02:00
Valdis Bogdāns
20927a88d7
Merge branch 'shadps4-emu:main' into fontlib 2025-12-12 22:17:50 +02:00
Stephen Miller
9e7df6ae54
Kernel.Vmm: Remove hack from #2726 (#3864)
Some checks failed
Build and Release / reuse (push) Has been cancelled
Build and Release / clang-format (push) Has been cancelled
Build and Release / get-info (push) Has been cancelled
Build and Release / windows-sdl (push) Has been cancelled
Build and Release / macos-sdl (push) Has been cancelled
Build and Release / linux-sdl (push) Has been cancelled
Build and Release / linux-sdl-gcc (push) Has been cancelled
Build and Release / pre-release (push) Has been cancelled
* Remove SceKernelInternalMemory mapping

Contrary to my initial beliefs, this is very much a hack.

* Unreachable for unpatched code

This will always infinitely loop, making logs extremely large.

* Update linker.cpp
2025-12-11 12:24:45 +02:00
AlpinDale
de6c5bbb83
cli: add --show-fps to the CLI launcher (#3860)
* cli: add `--show-fps` to the CLI launcher

* fix: clang-format

* nit: PascalCase -> camelCase
2025-12-08 21:02:54 +01:00
Stephen Miller
65f0b07c34
libkernel: Implement sceKernelEnableDmemAliasing, proper mapping type checks in posix_mmap (#3859)
* Basic handling for MAP_VOID, MAP_STACK, and MAP_ANON in mmap.

* Update memory.cpp

* Update memory.cpp

* Dmem aliasing check

* Oops
2025-12-08 13:46:32 +02:00
kalaposfos13
2a5910ed51
New translations en_us.ts (OpenOrbis) (#3858) 2025-12-07 23:56:51 +02:00
Stephen Miller
391d30cbb1
cpu_patches: Patch stack canary accesses (#3857)
* Patch stack checks done using fs:[0x28]

Additionally adds support for multiple patches per instruction, since this makes two separate patches we need to conditionally perform for mov instructions.

* Missing include

* Disable patches for Apple

Mac can use their native FS segment directly, so these patches aren't needed

* Oops
2025-12-06 22:47:39 -08:00
Odukoya Abdullahi Ademola
5183cbe686
sceHttpUriSweepPath (#3854)
Some checks failed
Build and Release / reuse (push) Has been cancelled
Build and Release / clang-format (push) Has been cancelled
Build and Release / get-info (push) Has been cancelled
Build and Release / windows-sdl (push) Has been cancelled
Build and Release / macos-sdl (push) Has been cancelled
Build and Release / linux-sdl (push) Has been cancelled
Build and Release / linux-sdl-gcc (push) Has been cancelled
Build and Release / pre-release (push) Has been cancelled
2025-12-04 10:50:24 +02:00
Odukoya Abdullahi Ademola
9e80cde60d
Implement http uri escape unescape (#3853)
* Implement sceHttpUriEscape and sceHttpUriUnescape

* Implement sceHttpUriEscape and sceHttpUriUnescape

* edge case

---------

Co-authored-by: Pirky10 <odukoyaabdullah@gmail.com>
2025-12-04 10:50:01 +02:00
kalaposfos13
98fd0689ac
Revert non-Linux parts of #3819 (#3852)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
* Revert non-Linux parts of #3819

* More OpenOrbis stuff that I couldn't be bothered to put in a new PR
2025-12-03 15:05:19 +02:00
Pirky
e5ea55e425
np: Add dialog state tracking for NpCommerce (#3841) 2025-12-02 10:22:41 +02:00
Stephen Miller
a5f9280841
Return CPU mode based on param.sfo attributes (#3846)
Some checks failed
Build and Release / reuse (push) Has been cancelled
Build and Release / clang-format (push) Has been cancelled
Build and Release / get-info (push) Has been cancelled
Build and Release / windows-sdl (push) Has been cancelled
Build and Release / macos-sdl (push) Has been cancelled
Build and Release / linux-sdl (push) Has been cancelled
Build and Release / linux-sdl-gcc (push) Has been cancelled
Build and Release / pre-release (push) Has been cancelled
Values are based on hardware observations.
2025-12-01 10:21:19 +02:00
kalaposfos13
cf866ab294
Don't bother trying to restart the emulator if sceSystemServiceLoadExec is called with an invalid path (#3845)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
2025-11-30 22:40:58 +02:00
TheThunderTurner
78e301c3db
libSceNpCommerce (#3839)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
* libSceNpCommerce

* copyright notice
2025-11-29 23:47:15 +02:00
Valdis Bogdāns
e53d581a78
Merge branch 'main' into fontlib 2025-11-24 22:20:59 +02:00
w1naenator
59785a020d 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.
2025-11-24 22:05:34 +02:00
kalaposfos13
2577dfde7e
Add assert on SFO file being empty (#3815)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
2025-11-23 17:30:09 -08:00
Stephen Miller
f6ae5544fd
Kernel.Vmm: Protect Fixes (#3822)
Some checks failed
Build and Release / reuse (push) Has been cancelled
Build and Release / clang-format (push) Has been cancelled
Build and Release / get-info (push) Has been cancelled
Build and Release / windows-sdl (push) Has been cancelled
Build and Release / macos-sdl (push) Has been cancelled
Build and Release / linux-sdl (push) Has been cancelled
Build and Release / linux-sdl-gcc (push) Has been cancelled
Build and Release / pre-release (push) Has been cancelled
* Some mprotect fixes

The biggest thing here is preventing mprotect on memory that isn't mapped in address space. This would cause exceptions before, but succeeds on real hardware.
I've also included a couple other minor fixes, mostly based around some tests I recently performed.

Note: All changes to memory pools in this PR are assumed. I have not yet tested memory pools with any of this logic, but I do at least want to prevent mprotect on pool reserved memory to avoid crashes.

* Update memory.cpp

* clang
2025-11-22 10:32:53 +02:00
oltolm
4922d526fe
msys2: fix build (#3818)
* cmake: fix mingw-w64 build

* time.cpp: fix build with Clang on Windows

* tls.h: include malloc.h for alloca
2025-11-22 10:32:29 +02:00
w1naenator
c3948bff95 Merge branch 'fontlib' of https://github.com/w1naenator/shadPS4 into fontlib 2025-11-22 01:21:19 +02:00
w1naenator
7600090b9c clang 2025-11-22 01:21:16 +02:00
Valdis Bogdāns
95b9ea6f99
Merge branch 'main' into fontlib 2025-11-22 01:15:41 +02:00
w1naenator
e3e8561d58 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).
2025-11-22 01:14:32 +02:00
kalaposfos13
56109a1331
Avoid storing the Tcb pointer on the stack (#3819)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
* Avoid storing the Tcb pointer on the stack

* Just return the already stored pointer in GetTcbBase

* Replace uses of GetTcbBase with g_curthread->tcb

* copyright 2025

* sir clang offnir, the all-formatting
2025-11-21 00:42:49 -08:00
marecl
6612a32523
Prevent writing to directories (#3820)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
* Prevent writing to directories

* Prevent writing to directories
2025-11-20 19:41:01 +02:00
Valdis Bogdāns
a6280053b7
Merge branch 'main' into fontlib 2025-11-19 22:07:48 +02:00
rainmakerv2
ed14359c87
Re-implement custom trophy sounds using sdl3 mixer (#3805)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
* re-implement custom trophy sounds using sdl3 mixer

* fix build vars

* Don't change SDL version
2025-11-16 10:36:54 +02:00
georgemoralis
d0855348f1
Merge branch 'main' into fontlib 2025-11-14 22:04:24 +02:00
Stephen Miller
93c340c6e1
calloc libusb_interface instead of pointer (#3793)
Some checks failed
Build and Release / reuse (push) Has been cancelled
Build and Release / clang-format (push) Has been cancelled
Build and Release / get-info (push) Has been cancelled
Build and Release / windows-sdl (push) Has been cancelled
Build and Release / macos-sdl (push) Has been cancelled
Build and Release / linux-sdl (push) Has been cancelled
Build and Release / linux-sdl-gcc (push) Has been cancelled
Build and Release / pre-release (push) Has been cancelled
interface->num_altsetting is oob
2025-11-12 17:26:26 +02:00
Joshua de Reeper
25344a3b89
calloc UsbDevice instead of pointer (#3790) 2025-11-12 12:40:39 +02:00
Stephen Miller
ee2bc97248
Windows: Limit address space maximum when higher addresses are not needed (#3775)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
* Earlier initialization of elf info.

Everything used for elf info initialization comes from the param.sfo, so we can initialize this earlier to have this information accessible during memory init.

* Extract compiled SDK version from pubtoolinfo string

Up until now, we've been using the game's reported "firmware version" as our compiled SDK version. This behavior is inaccurate, and is something that has come up in my hardware tests before.

For the actual compiled SDK version, we should use the SDK version in the PUBTOOLINFO string of the param.sfo, only falling back on the firmware version when that the sdk_ver component isn't present.

* Store compiled SDK version in ElfInfo

* Limit address space for compiled SDK version at or above FW 3

Sony placed a hard cap at 0xfc00000000, with a slight extension for stack mappings. For now, though stack mappings aren't implemented, there's no harm in keeping a slightly extended address space (since this cap is lower than our old user max).

Limiting the max through address space is necessary for Windows due to performance issues, in the future I plan to properly implement checks in memory manager code to properly handle this behavior for all platforms.

* Use compiled SDK version for sceKernelGetCompiledSdkVersion

I think this is pretty self explanatory.

* Log SDK version

Since this value is what most internal firmware version checks are against, logging the value will help with debugging.

* Update address_space.cpp

* Update emulator.cpp

* Backwards compatible logging

Because that's apparently an issue now
2025-11-10 17:07:17 +02:00
w1naenator
25d41c3a54 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
2025-11-10 15:30:40 +02:00
w1naenator
b35d82e8f3 Remove unused <system_error> include from font.cpp
possible MacOS build crash reason.
2025-11-08 13:41:32 +02:00
w1naenator
0b9f941e63 Handle missing system font by clearing font bytes and logging an error 2025-11-08 13:27:18 +02:00
w1naenator
9287fb31bf Merge branch 'fontlib' of https://github.com/w1naenator/shadPS4 into fontlib 2025-11-08 13:08:22 +02:00
w1naenator
850f40f61a Add system font path configuration and loading functionality
Config example:

[General]
...
sysFontPath = "/.../NotoSansJP-Regular.ttf"
...
2025-11-08 13:08:20 +02:00
Valdis Bogdāns
5f6c1b342d
Merge branch 'main' into fontlib 2025-11-07 18:34:31 +02:00
w1naenator
2afcdb981c restored accidentally deleted stubbs. 2025-11-07 08:40:26 +02:00
w1naenator
d85bde3d8f Loading font files from app0, some other fixes. 2025-11-07 08:12:16 +02:00
Emma
2f022a462d
filesystem: return st_mtim in posix_stat (fixes RB4 / CUSA02901 DLC crash) (#3781)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
* filesystem: return st_mtim in posix_stat

* filesystem: stat - remove reliance on clock_cast

* filesystem: stat - remove reliance on to_time_t
2025-11-06 22:47:40 +02:00
Joshua de Reeper
f5505daaca
usbd: Emulate Dimensions Toypad (#3779)
* Dimensions Toypad

* update comment
2025-11-06 17:46:43 +02:00