-
Notifications
You must be signed in to change notification settings - Fork 2.2k
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nintendo switch port of ppsspp (request). #10934
Comments
Once there's a good homebrew environment for a publicly available CFW, and drivers for the GPU, a port should be fairly straightforward so I'm sure someone's gonna try it eventually. It's a bit too early still though. |
This should be more feasible in the near future, as SDL2 has been ported, and a port of Mesa (and Nouveau) is being worked on for Horizon (the Switch's OS by Nintendo), so there will also be a standard OpenGL environment as well. Keep an eye on https://github.com/devkitPro/libdrm_nouveau and https://github.com/devkitPro/mesa . |
that’s fantastic news. Actually I saw someone on Twitter called Fincs he showed us an app running on switch using OpenGL.(so OpenGL is finally implemented to switch). So I hope we can get ppsspp on horizon OS eventually. |
Yeah, fincs is working on it. It's still very early though, so I think it's best to wait and see before jumping right in. As for the CFW situation, the Switch has been pretty hackable for the last 3 months or so via a vunerability in the hardware's recovery mode, so full control is a non-issue on most Switch consoles (there are something like 15 or more million units vulnerable, so they're not hard to find currently). Debugging still leaves a bit to be desired, though. Edit: https://twitter.com/fincsdev/status/1037457485983096832 I'm excited. Hopefully it won't be too buggy! |
Here’s a new news about OpenGL on switch see here: This is a great thing indeed. To see his tweet see here So I hope we can get a port of ppsspp on horizon OS eventually. |
I'm keeping an eye on it. If the SDL2 port and this implementation of OpenGL work nicely together, that would mainly leave the recompiler (JIT). Horizon does provide JIT services/SVCs if I remember correctly, so it should just be a matter of talking to that to get the ball rolling. Hopefully. |
That’s something pretty nice to read. Also here is an official GitHub link with JIT implemented. |
What's there to correct? I said it does provide it if I remember correctly, and I did. :P But yeah, I'll be waiting a bit longer, at least until the first public beta release. |
Oh I’m sorry. |
It's fine, haha. |
That means that all the big puzzle pieces are in place, at least. I'm personally not going to do Switch development until it gets a bit more stable and usable (is there already something like psplink? ) but there's nothing stopping anyone else from porting it. GL 4.3 should be alright. |
You can get crash dumps via CFW and there are a couple WIP debuggers, but no gdb or stepping through code yet (to my knowledge). |
Well, the nice thing about psplink is you can quickly run a program over USB on the PSP from the desktop. It allows automating running tests or programs and getting the result. That's how all pspautotests were built. IIRC, Wii has something similar, but it's less reliable. PS2 too (and similarly less reliable.) Hence, ps2autotests. -[Unknown] |
Oh, then yeah, there's a program called nxlink you can use to send over NROs (homebrew executables) to the homebrew menu on the Switch via the network (USB isn't entirely understood on the Switch yet, since the API seemingly changes somewhat often..). I'm not sure if nxlink supports redirecting stdout though. I'll have a look eventually. |
LibNX is now on version 1.4.0 For more info see here. I hope this could help about getting ppsspp on switch. |
There are still several issues to work out before PPSSPP will build (I looked into it a bit earlier), but yeah, their OpenGL stuff is progressing quickly. |
Alright, so I took a brief look at it last night, and here's what I came up with so far with regards to porting PPSSPP:
|
I think std::mutex and std::thread could quite easily be implemented on top of Switch OS primitives, although that comes from looking at the 3DS OS, I haven't looked much at the Switch. That would be best done as part of libnx though. GL support in the SDL2 port is probably just a matter of time, or a small patch... |
@thedax there’s already a bounty for getting ARM64 JIT to work on Nintendo Switch Here’s a link to that bounty: I just want to to know about ARM64 JIT because you just mentioned it on your plans list. |
libnx has functions to create "JIT" buffers, e.g. buffers where the memory is executable. I looked at the PPSSPP code, and I think that we'll only need to hook it to |
I saw the comments on that bountysource link, but for the sake of convenience: PPSSPP already has an ARM64 JIT like natinusala said on there. Getting the JIT to work is the least of our problems here. :P |
That’s nice to hear. I didn’t know about that indeed. So what is missing to get it to work? Thanks a lot for your efforts. |
Still waiting on SDL2 to be updated. Threading is another issue, but SDL2 is more important. |
SDL can easily be updated if you replace the GL includes by the glad includes and init the context properly. You can use mGBA or RetroArch as a reference for that, the switch-examples are borked. |
@thedax |
@iOS4all Be patient, don't nag. If thedax wants to work on it, he will. |
@hrydgard ok I’ll. |
SDL2 has been updated and you can use GL context it creates. The wrapper is partially feasible, here is a very partial impl. for pthreads : https://github.com/m4xw/RetroArch/blob/fd155db9cca5696495440a35cc7fb9fc9b8831ff/libretro-common/rthreads/switch_pthread.h unforunately it's nowhere near enough for the __gthread wrapper (libgcc std::thread wraps) and gthr-single.h just returns 0 or -1 to everything. There are also various other issues, mostly revolving around switch using a custom micro kernel that is not remotely posix compliant. IE: the only current method to map pages RW -> RX is shown in the jit examples, and though it seems to be done in a single process now, it gives back two address spaces: one RW and one RX. I haven't looked into the details on Icache/block manager yet, it might not be difficult to make the changes necessary to ensure the recompiler calls the 'second' (RX) address space. Likely you will run into many more, the project is rather large and has multiple deps. Here is a cmake file I used to test a bit, since it's really a cross compile and I did not want to modify the base cmake file you need to configure like: cmake .. -DCMAKE_TOOLCHAIN_FILE=./devkitA64.cmake Below is the devkitA64.cmake
|
Set the flag MASKED_PSP_MEMORY in MemMap.h. That replaces the mirroring with masking. Then you can create a dummy MemArena implementation that allocates a giant buffer and have CreateView returns pointers offset into that. The buffer probably really only needs to be sized 0x0B000000 as that's the highest masked valid address that user mode PSP programs can used. |
Good bit of info, I will check it out |
Anything new about this please? |
@iOS4all If he has something to show, I'm sure he'll show it. Don't be impatient :) |
Patience isn't exactly the strength of this scene |
@iOS4all "Patience is a virtue" |
Atmosphere .8.4 added Jit kernel patches Kernel patches for JIT support were added (Thanks, @m4xw!). https://github.com/Atmosphere-NX/Atmosphere/releases/tag/0.8.4 |
@hrydgard Got it to compile after manually building a devkitA64 based toolchain with gthreads enabled newlib. |
Sounds like good progress. In addition to the missing threads, sounds like a bunch of issues to file in libnx then, as especially the file I/O functions would be nice to have there :) We don't really use dlsym for anything you'll notice for a Switch GL port. Yes we really should rip out glew for a number of reasons... |
I will take a look at what's required in newlib to enable them (if supported) |
Actually I just got told there might be a devkitA64 revision very soon, with std::thread and pthreads support. |
Sounds good. PPSSPP is a must for Nintendo Switch! |
@m4xw pthreads is indeed now available in libnx :) |
What does that mean ? :) |
@hrydgard I didn't find a way around missing mman yet. Edit: nvm, got it working with masking (didn't see the memcpy is masked too), should be sufficient. |
From my understanding these things are extremely important for ppsspp in order to run it. Of course besides other things. |
Basically, if you imagine Switch as a world, it previously didn't have gravity. Now it has gravity. PPSSPP is like a really awesome car, but it's kinda been built with the assumption that gravity will be working on the planet it's used on. Now we're just working on the next problem, which is that the planet is -150 celcius and the car won't move because it's frozen. So we're trying to figure out if we need to move a sun into place near the planet or if there's some other way to generate heat. Once all of basic physics works like we thought it would, actually having PPSSPP work will probably not be too hard. -[Unknown] |
Also another headsup, ofc their pthreads support had to be incomplete (seems to be sufficient so far for glslang, tho I won't test linkage/functionality right now) |
https://twitter.com/m4xwdev/status/1113463278162862091 |
Excellent work! inb4 "is it released yet" and "where can I download it". What remains to be worked on? |
Fix JIT, major cleanup, revise all changes, also hook up glsm properly (glew died in the battle). |
Keep up the good work. Get your time and release it when you think it is ready. Amazing. |
Awesome work m4xw! If you have managed to kill off glew, please submit that in a separate pull request before anything else. Been meaning to do that for ages, though I planned to simply grab and modify Dolphin's loader to fit us. |
Will do, first i need to do a major cleanup and some other updates for glsm. |
Any info regarding a standalone release for the switch? |
Standalone tease https://twitter.com/m4xwdev/status/1151131806055321603 |
Don't think we need this open anymore :) |
@hrydgard hi there.
Many people are wondering and excited about getting a Nintendo switch port of ppsspp (including me).
As you see Nintendo switch is already hacked specially on v3.0.0 we can run hombrews and emulators including retroarch on it. And also @plutoo is bringing JIT on LibNX (LibNX is the place to run hombrews). Also he and others developers are working to bring gpu drivers to libnx as well.
Finally @SciresM will bring CFW for Nintendo switch this summer.
It's very nice to get ppsspp for all platforms.
Thanks for your hard work.
The text was updated successfully, but these errors were encountered: