Skip to content

PlayStation Vita support#1440

Draft
scribam wants to merge 4 commits intoflyinghead:devfrom
scribam:dev_vita
Draft

PlayStation Vita support#1440
scribam wants to merge 4 commits intoflyinghead:devfrom
scribam:dev_vita

Conversation

@scribam
Copy link
Copy Markdown
Collaborator

@scribam scribam commented Mar 5, 2024

No description provided.

@scribam scribam mentioned this pull request Mar 5, 2024
@scribam
Copy link
Copy Markdown
Collaborator Author

scribam commented Mar 5, 2024

@scribam scribam marked this pull request as draft March 5, 2024 18:39
@flyinghead
Copy link
Copy Markdown
Owner

@Rinnegatamante Do we need the "Use Simple Shaders" option? What is the benefit for users to select advanced/not simple shaders? and how to decide which setting to use?

@Rinnegatamante
Copy link
Copy Markdown

@Rinnegatamante Do we need the "Use Simple Shaders" option? What is the benefit for users to select advanced/not simple shaders? and how to decide which setting to use?

I added it cause some games were artifacting with "complete" shaders if i remember correctly.

@Rinnegatamante
Copy link
Copy Markdown

Mhhh for me it still crashes although, can we make the CI split out also the unstipped elf? (So i can look into the cause of the crash)

@scribam
Copy link
Copy Markdown
Collaborator Author

scribam commented Mar 7, 2024

@Rinnegatamante
Copy link
Copy Markdown

The crash is caused by wrong settings on vitaGL.
vitaGL needs to be compiled with HAVE_WRAPPED_ALLOCATORS=1

@scribam
Copy link
Copy Markdown
Collaborator Author

scribam commented Mar 7, 2024

New build available with vitaGL compiled with HAVE_WRAPPED_ALLOCATORS=1

@Rinnegatamante
Copy link
Copy Markdown

Oh, it seems you also used SDL2 from vdpm. That one has no vitaGL support. You need this fork: https://github.com/Northfear/SDL

@scribam scribam force-pushed the dev_vita branch 2 times, most recently from 1905cac to 8afd690 Compare March 8, 2024 13:06
@scribam
Copy link
Copy Markdown
Collaborator Author

scribam commented Mar 8, 2024

New build available with SDL2 from https://github.com/Northfear/SDL (and compiled with VIDEO_VITA_VGL=ON)

@Rinnegatamante
Copy link
Copy Markdown

New build is prefetching on gl_CompileAndLink apparently :/

Here's the coredump analysis:
https://pastebin.com/PxwiQ3Td

@flyinghead
Copy link
Copy Markdown
Owner

It looks like the crash happens in gl_CompileShader and probably caused by a NULL OpenGL function (PC == 0).
Probable stack trace:

gl_CompileShader()
gl_CompileAndLink()
initQuad()
gl_create_resources()
OpenGLRenderer::Init()

Other OpenGL functions have already been called at this point so it's not a general glad issue but it looks like at least one of these functions is missing:

glCreateShader
glShaderSource
glCompileShader
glGetShaderiv
glGetShaderInfoLog

@Rinnegatamante
Copy link
Copy Markdown

https://github.com/Rinnegatamante/vitaGL/blob/master/source/lookup.c#L29-L420

These are all the available gl functions resolveable via vglGetProcAddress/eglGetProcAddress/SDL_GL_GetProcAddress.
In my fork, i recall having to ifdef out some gl funcs cause unavailable on vitaGL indeed.

@flyinghead
Copy link
Copy Markdown
Owner

It looks like glDetachShader is missing, and called in gl_CompileAndLink()

@Rinnegatamante
Copy link
Copy Markdown

Rinnegatamante commented Mar 13, 2024

This last build does launch fine but has some vmem issues still when launching any rom. I'll let Bythos know.

@bythos14
Copy link
Copy Markdown

@scribam The os_InstallFaultHandler function in linux/common.cpp is overriding the one in vita_fault_handler.cpp. Fully ifdef out the ones in common.cpp for the vita

@scribam
Copy link
Copy Markdown
Collaborator Author

scribam commented Mar 13, 2024

Thank you for your help @bythos14. I pushed a commit to ifdef out the os_InstallFaultHandler and os_UninstallFaultHandler functions in linux/common.cpp for the vita.

A new build is available for testing

@bythos14
Copy link
Copy Markdown

bythos14 commented Mar 13, 2024

@scribam Also, add __vita__ to this ifdef

#if defined(__unix__)

@bythos14
Copy link
Copy Markdown

With the handler hacked in, it's now dying at sh4_sched_request due to a failed verify

@bythos14
Copy link
Copy Markdown

Invalid cycle count comes from this function:

void SCIFSerialPort::updateBaudRate()

@bythos14
Copy link
Copy Markdown

Okay, it's seemingly being caused by a sign extension on the input to SCBRR2_write, causing the input to go from 0xFF to 0xFFFFFFFF. Patching the ELF to write SCBRR2 with strb instead of str allows me to boot in game

@flyinghead
Copy link
Copy Markdown
Owner

I can reproduce the issue on Android arm32 as well. Although it doesn't crash, it's still not correct.
Looking into it.

@flyinghead
Copy link
Copy Markdown
Owner

Fixed on master: 6115a91

@Rinnegatamante
Copy link
Copy Markdown

Bythos referred that with these changes game do finally boot although performances are worse than the og Vita fork. Anything in particular that could've caused it in latest changes to the codebase?

@scribam scribam changed the base branch from dev to master March 14, 2024 17:24
@scribam
Copy link
Copy Markdown
Collaborator Author

scribam commented Jun 10, 2024

Branch updated with latest dev

@scribam
Copy link
Copy Markdown
Collaborator Author

scribam commented Jul 7, 2024

Updated with latest dev and conflicts fixed in core/ui/gui.cpp

@scribam
Copy link
Copy Markdown
Collaborator Author

scribam commented Aug 9, 2024

Branch updated with latest master and kubridge is now installed with vdpm

@scribam
Copy link
Copy Markdown
Collaborator Author

scribam commented Dec 13, 2024

Branch updated with latest dev

Hindikw

This comment was marked as off-topic.

@scribam scribam marked this pull request as draft October 21, 2025 15:40
@scribam
Copy link
Copy Markdown
Collaborator Author

scribam commented Nov 2, 2025

Branch updated with latest dev

@scribam scribam force-pushed the dev_vita branch 5 times, most recently from c4af9c0 to 064a85d Compare December 22, 2025 21:20
@scribam
Copy link
Copy Markdown
Collaborator Author

scribam commented Dec 22, 2025

Branch updated with latest dev

Rinnegatamante and others added 4 commits April 1, 2026 21:30
Port of https://github.com/Rinnegatamante/flycast-vita.
Credits to @bythos14 for everything concerning the dynarec implementation and page fault handler.

Co-authored-by: bythos14 <45720552+bythos14@users.noreply.github.com>
Co-authored-by: scribam <scribam@users.noreply.github.com>
Co-authored-by: bythos14 <45720552+bythos14@users.noreply.github.com>
Allows us to take more memory for the heap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants