libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.08k stars 1.81k forks source link

Bounty to add dynarec core for Wii U port of either Beetle PSX or PCSX-R emulator [$470] #4852

Open roflcopter777 opened 7 years ago

roflcopter777 commented 7 years ago

Just to reemphasize the bounty goal for this project:

Update 4-25-18: Title of thread bounty has been changed to reflect that it should be PCSX-R or any PSX core that has a dynarec core.

The ultimate goal, is once more, full speed dynarec on the Wii U of any PSX core that RetroArch currently uses, this can eventually lead the way to future cores in being ported, That's all this is aiming for.


Update: Spoke with developer of WiiSX-R, a PCSX port on the Wii, Mystro256 who stated the Dynarec is publicly available on GitHub, and since Wii and Wii U both use PPC, I figure I'd link both on here:

PPC source https://github.com/Mystro256/wiisxr/tree/master/ppc Main WiiSX-R GitHub https://github.com/Mystro256/wiisxr

Disclaimer: The end goal is getting as much support as possible, the higher the donations the better, to support those who write the PPC dynarec. Thank you for your understanding.

It's well-established that the Wii U is more powerful than what the Virtual Console has shown, notably with NERD (Nintendo European Research and Development)'s efforts in their Nintendo DS emulation. There is untapped potential in the Wii U hardware and showing it is more than capable in running respective emulators for Nintendo 64 and Playstation (Mupen64 and PCSX-R). With that said, I wish to open this as a bounty to rally the support of those interested and wanted to throw my own hat into the ring, and I know of some other people who would be interested in contributing to see the Wii U to its full emulation potential.

The end goal is to unlock the power of the Wii U, but also adding support for a plethora of cores that have not been possible.

The end goal to any developer who is assigned to this task:

--- There is a **[$120 open bounty](https://www.bountysource.com/issues/44566014-bounty-to-add-dynarec-core-for-wii-u-port-of-beetle-mednafen-psx?utm_campaign=plugin&utm_content=tracker%2F296058&utm_medium=issues&utm_source=github)** on this issue. Add to the bounty at [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F296058&utm_medium=issues&utm_source=github).
embercold commented 3 years ago

I do know how to read exception reports, it's just that it went kaput so far outside the core's address space that I'm left baffled. I did some type coercions while mapping WiiU funcs to their pthread equivalents, so it's likely I'll just need to proofread them. Or rewrite them. It's likely that I've corrupted a thread context or a mutex struct somehow. sigh And I can't just use rthreads, as there are over 250 calls to pthread func. As for cemu, they're certainly having fun with their emulator - it crashes while reading manifests, even before any homebrew is loaded. Anyway, this still has nothing on damn gpulib bugs, so I'll manage.

Ploggy commented 3 years ago

I can now confirm background music still doesn't work in Bust A Move 2.. I luckily managed to get ingame by selecting another game mode. The stage started to play the BG music (never did on older builds so its progress) :P but only played the beginning piece, then the game froze. I made a vid... Ear Rape Warning again :P https://youtu.be/LNE7qVMAyuo

ashquarky commented 3 years ago

That looks about right for code in the .rpx on wiiu, they generally end up between 0x0B000000 and 0x10000000 (where the data segment starts). If you do end up implementing pthreads, it'd be nice to turn that into an rthreads wrapper at some point for the frontend, get threaded video and such. In case you didn't know, it's worth noting that the wiiu has cooperative threading (I dunno if libogc is the same) so for two threads that get scheduled on the same core, they have to sleep on mutexes and the like to actually let the other run - the OS will always just run the highest-priority non-sleeping thread. Different to PC where you can schedule two threads, stick them in infinite loops, and both will still manage to run.

embercold commented 3 years ago

@Ploggy I've found and fixed a bug that could've caused crashes, so I updated the core in my dropbox. Idk if there's more to it, so for today I'm working on lightrec exclusively. @QuarkTheAwesome There's already a rthreads implementation for Wii/WiiU, and it is based on an internal pthreads adapter seemingly based on aliaspider's work. I've finished my own Wii pthreads adapter, then dropped it in the favor of the latter. It's just that I can't replace pthreads with rthreads, as the core has support for non-libretro frontends too. I've figured out that there's no thread preemption, but the core doesn't seem to do busy waiting so it's fine.

Ploggy commented 3 years ago

Thanks, sorry but this build tests the same as the last build.. its still freezing on loading. Threaded Rendering still causes a DSI Error whenever I enable it.

Sometimes the Core can freeze when I select Close Content, needing me to hard reset the Console. I'm also getting this Core crash sometimes when the game freezes and I try to load another game (Close content then try to load a new game) This was happening with yesterdays build too but because the error screen doesn't display every time it crashes I didn't manage to get a pic until now ;) 20210810_145454

I hope the Lightrec plays nice and goes smoothly :)

inactive123 commented 3 years ago

Hi there @embercold , if it helps your development efforts we can help getting you a WiiU. We will pay for the expenses.

To anyone here, any ideas where to get a WiiU still that can be jailbroken and developed on? We might want to source one near embercold's vicinity so that shipping costs don't amount to much.

embercold commented 3 years ago

@twinaphex Thank you for your offer, but I have to refuse - I'll get this core running on WiiU at nice 60fps one way or another, maybe have the Wii run games with frameskip, but then I'd rather never see or hear of those consoles ever again. Hardware or no, programming platforms like these is like doing brain surgery through the asshole. I'd love to work on some mainstream cores/platforms, though!

carnage702 commented 3 years ago

@twinaphex Thank you for your offer, but I have to refuse - I'll get this core running on WiiU at nice 60fps one way or another, maybe have the Wii run games with frameskip, but then I'd rather never see or hear of those consoles ever again. Hardware or no, programming platforms like these is like doing brain surgery through the asshole. I'd love to work on some mainstream cores/platforms, though!

well i would say the wii is preety much the pinacle of homebrew stuff, its probably the console with most work put in it, i consider it a main platform for all homebrew xD, shame you dont want a wiiu, such a great console imo, sadly nintendo ported all its best games to switch mostly :P

piratesephiroth commented 3 years ago

Hi there @embercold , if it helps your development efforts we can help getting you a WiiU. We will pay for the expenses.

To anyone here, any ideas where to get a WiiU still that can be jailbroken and developed on? We might want to source one near embercold's vicinity so that shipping costs don't amount to much.

Any Wii U can be jailbroken right now.

embercold commented 3 years ago

I apologize it has to end that way, but I failed to make any progress this week, and even thoughts of returning to this project make me miserable, so I have to abandon it. In addition, I've already spent twice more time on it than I could really afford, and the repercussions I'll have to sort out for the rest of the month. I'm sorry for leading you on. The state of the work I've left is solid, with only WiiU pthread polyfill and a proper lightrec port remaining. Please feel free to use it if you wish - I have no claims whatsoever to the code.

Ploggy commented 3 years ago

I'm sorry your feeling that way.. As much as wanted this to succeed, I don't want you to be miserable :( If this really this is the end I just want to thank you for all the work that you've done for us, even though its not finished, you've brought the PS1 WiiU port pretty damn close to completion. It's been fun testing all your builds and watch the project get better and better (remember the LSD Spyro?) :P

I wish you luck with whatever project you take on next :) Good luck mate!

For any potential new devs wanting to carry on embercold's work this is the link to the code: https://github.com/embercold/pcsx_rearmed/tree/nintendo-build

piratesephiroth commented 3 years ago

Yeah, thanks for your work @embercold.

Dramoor commented 3 years ago

uhh. 2 weeks and miserable. Hope you never get a job as a coder. Won't last very long.

On Thu, Aug 12, 2021 at 4:26 PM piratesephiroth @.***> wrote:

Yeah, thanks for your work @embercold https://github.com/embercold.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/libretro/RetroArch/issues/4852#issuecomment-897979359, or unsubscribe https://github.com/notifications/unsubscribe-auth/AELYES3EIVVJC3MTDDRNRDTT4Q4BXANCNFSM4DJFBOQQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

hizzlekizzle commented 3 years ago

@embercold it was a good run. I hope you'll still hang around, though. There's plenty of less-excruciating stuff to work on :)

jrb00 commented 3 years ago

@embercold Don't be sorry my dude, you gave me something to look forward to and read about every night! Even if it wasn't the results you were going for, you still made huge progress that someone might pick up on later. Thanks for everything.

ashquarky commented 3 years ago

I spent today putting some hacks of questionable quality into both Decaf (to get RA to run) and embercold's work: https://github.com/QuarkTheAwesome/pcsx_rearmed/tree/nintendo-build-spicy

with that, threaded video actually does work!

Link: retroarch_wiiu.rpx.zip (QuarkTheAwesome/pcsx_rearmed@8f6a0a2, RA d0a08ce)

Goes to show just how much progress embercold made here.

Ploggy commented 3 years ago

Thanks quarky, I did a quick test, games that crashed before still crash with your build.. Bust A Move 2 - Mortal Kombat Trilogy (2 good games if your doing tests) Castlevania seems to run faster with Threaded Rendering off (really close to fullspeed) lol but in other games I think I'm seeing a small boost in FPS :D

I did get a DSI Error but I didnt get a pic of it.. I'll update my post if I get it again :)

EDIT: 20210814_153515 Easy to reproduce.. Just load Mortal Kombat Trilogy and don't press any Buttons, after the FMV's and just after the backstory screen loads Thank You.

carnage702 commented 3 years ago

I spent today putting some hacks of questionable quality into both Decaf (to get RA to run) and embercold's work: https://github.com/QuarkTheAwesome/pcsx_rearmed/tree/nintendo-build-spicy

with that, threaded video actually does work!

* RetroArch Threaded Video should to be _OFF_. I couldn't find it at all in the menus but in case you have turned it on somehow, don't,

* PCSX threaded video (start a game->Quick Menu->Options->Threaded Rendering) is the interesting option. I had good results with it set to "async", YMMV. Crash was significantly worse in the logo and menus, but once it actually started rendering 3D, it seemed to hit full framerate - which it couldn't before!

Link: retroarch_wiiu.rpx.zip (QuarkTheAwesome/pcsx_rearmed@8f6a0a2, RA d0a08ce)

Goes to show just how much progress embercold made here.

hopefully you can maybe follow up on his work xD or atleast make it work without crashing and removing the debug stuff from screen so we can get some wiiu psx fullspeed atleast.

Ploggy commented 3 years ago

I spent today putting some hacks of questionable quality into both Decaf (to get RA to run) and embercold's work: https://github.com/QuarkTheAwesome/pcsx_rearmed/tree/nintendo-build-spicy with that, threaded video actually does work!

* RetroArch Threaded Video should to be _OFF_. I couldn't find it at all in the menus but in case you have turned it on somehow, don't,

* PCSX threaded video (start a game->Quick Menu->Options->Threaded Rendering) is the interesting option. I had good results with it set to "async", YMMV. Crash was significantly worse in the logo and menus, but once it actually started rendering 3D, it seemed to hit full framerate - which it couldn't before!

Link: retroarch_wiiu.rpx.zip (QuarkTheAwesome/pcsx_rearmed@8f6a0a2, RA d0a08ce) Goes to show just how much progress embercold made here.

hopefully you can maybe follow up on his work xD or atleast make it work without crashing and removing the debug stuff from screen so we can get some wiiu psx fullspeed atleast.

Quarks build doesn't have any debug stuff displayed but does still crash like the previous builds.. This was the commit that started off the instability, But I don't know if it was due to the polyfill, the threaded renderer work or the CDDA restoration?
https://github.com/embercold/pcsx_rearmed/commit/ba9b1da363cd614b02bca353566ab5b6f58463db It's weird that games tend crash during loading times. Maybe that could narrow down the issue?

Ploggy commented 2 years ago

Hey there, I'm uploading a video of what performance is currently like with PcsxRearmed on WiiU, the hope is to show potential devs what performance we have and and what needs to be done :)

https://www.youtube.com/watch?v=OiUVsAKBMC8

Ploggy commented 2 years ago

Just putting it out there, Lightrec recently had an update that sports an upto 200% increase in performance!! Sadly Lightrec was never implemented for PCSXRearmed for WiiU when it was worked on last year only the WiiSX dynarec was, which didn't deliver the performance increase that was hoped. Perhaps if the Lightrec was to be added now that performance could finally reach 100%

@embercold you still around :P JK ...... (kinda) :D

pcercuei commented 2 years ago

if @QuarkTheAwesome can implement ppsspp's trick to give me a 4 MiB X+W buffer, then the rest will be easy.

ashquarky commented 2 years ago

You can have a hair under 8MiB for free: https://github.com/QuarkTheAwesome/pcsx_rearmed/commit/af045322371365bade51e4de250270834c6eebe6 Last I remember we had determined that 8 just isn't enough for decent perf with the WiiSX JIT (which is what we were using) and were talking about GPU acceleration support. You planning on using a different JIT engine?

pcercuei commented 2 years ago

Anything above 4 MiB will work perfectly fine with Lightrec. So I guess this won't be a problem then.

ashquarky commented 2 years ago

Awesome! You need any help with setting up the toolchains or build targets?

pcercuei commented 2 years ago

Oh, I'm not doing the work ;D I don't have a WiiU.

ashquarky commented 2 years ago

Right :sweat_smile: You got someone in mind, or am I going to be sent a repo link?

pcercuei commented 2 years ago

I could try to get the core to work on the GameCube first. But I'd need RetroArch to work there (doesn't detect my SD2SP2, I can't load any games).

ashquarky commented 2 years ago

That'd be interesting! Given that's only a gen ahead of the PSX, it'd be really interesting to see if the CPU grunt is there to actually run it.

Ploggy commented 2 years ago

I could try to get the core to work on the GameCube first. But I'd need RetroArch to work there (doesn't detect my SD2SP2, I can't load any games).

It's not just SD2SP2 I cant get the GC RA to work either (using SDgecko) apparently RA for GC has been broken for a while now. Other GC standalone emulators run fine.

pcercuei commented 2 years ago

Well it boots here. But it only proposes me to load games from the memory card slots (which isn't really useful). The funny part is that it did create files and directories on my SD card, so RetroArch can use SD2SP2 just fine.

Ploggy commented 2 years ago

Well it boots here. But it only proposes me to load games from the memory card slots (which isn't really useful). The funny part is that it did create files and directories on my SD card, so RetroArch can use SD2SP2 just fine.

Oh, I can get RA to boot AND see my roms but whenever I try to boot a rom it resets the GC :/

EDIT: Tried with the latest nightly.. still resets GC on rom load..

danny199012 commented 2 years ago

Is anything come of this now anyway a new environment is out I'm making cores into .wuhb also just read beetle psx core now has more better support so even if we get software rendering running decent will be a bonus

nngeorgiy commented 1 year ago

@pcercuei Are you planning to work on this? If not, I'd like to try it myself.

pcercuei commented 1 year ago

@nngeorgiy you're too late, it's pretty much done already. @Ploggy can confirm.

nngeorgiy commented 1 year ago

@pcercuei Thanks! I'll be moving on, then. Out of curiosity, why wasn't lightrec working on the WiiU? Missed endianness correction?

pcercuei commented 1 year ago

Some endianness issues (since until very recently I only had little-endian hardware), some memory map issues, and some issues in the code generated by Lightning, but it's all fine now.

nngeorgiy commented 1 year ago

What are your impressions of lightning, by the way? If I'm to make a performence-focused recompiler, will it be worthwhile to roll out my own code emitter, or will it suffice?

pcercuei commented 1 year ago

It is really great, no complaints at all. Go for it.

Ploggy commented 1 year ago

I can confirm :) Wow its just like Busses, you wait ages for one dev then two come at once haha. Thank you for the offer @nngeorgiy :)

Ploggy commented 1 year ago

@nngeorgiy if your looking for a WiiU project to mess with you could.. Update the PSP Standalone Emulator? Aliaspider started to port it and got quite far but it hasn't seem any love for a few years https://github.com/aliaspider/ppsspp/branches/all?query=wiiu Or port the Wii64/Not64 Emulator to WiiU or perhaps add the Wii64 Dynarec to the Mupen64plus Retroarch Core? :D

Any of those would be amazing.

nngeorgiy commented 1 year ago

@Ploggy I'll take a good look at PPSSPP - it seems portable enough. As for mupen64, its CPU is mostly compatible witx PSX's, to the point that PCSX used its recompilers before lightrec came along, so I'll wait until you guys are done here then do a lightrec port. Don't wait for me, though, I'll ping you if I take either project.

Ploggy commented 1 year ago

Thank you that sounds great!

ShadowOne333 commented 1 year ago

Seeing N64 on WiiU would be amazing, it has been the most desired emu port for the WiiU without a doubt next to PSX. Hopefully that one is possible.

steeletyler1 commented 1 year ago

What's the latest on the PS1 emulator on WiiU? Also wondering about N64 and GC on the WiiU since those were mentioned.

pcercuei commented 1 year ago

WiiSX / CubeSX v3.0 beta was released a few days ago: https://github.com/emukidid/pcsxgc/releases/tag/Beta_3.0

It features my dynarec (Lightrec), which is also used for the Beetle and PCSX_ReArmed libretro cores on the WiiU. It is pretty mature now, and really gave a boost to WiiSX/CubeSX's performance, to the point where a lot of games are fullspeed on the Wii, and most games are even fullspeed on the GameCube. The same performance boost can be had on the Retroarch cores for the WiiU.

I suppose I can claim the bounty now.

steeletyler1 commented 1 year ago

WiiSX / CubeSX v3.0 beta was released a few days ago: https://github.com/emukidid/pcsxgc/releases/tag/Beta_3.0

It features my dynarec (Lightrec), which is also used for the Beetle and PCSX_ReArmed libretro cores on the WiiU. It is pretty mature now, and really gave a boost to WiiSX/CubeSX's performance, to the point where a lot of games are fullspeed on the Wii, and most games are even fullspeed on the GameCube. The same performance boost can be had on the Retroarch cores for the WiiU.

I suppose I can claim the bounty now.

Can you explain how to use this for the WiiU? Where can I find a RetroArch PS1 core for the WiiU that you mentioned? I'm currently using WiiSXRX with the channel forwarder on the WiiU home menu.

pcercuei commented 1 year ago

@steeletyler1 Good question. I don't have a WiiU, I assumed the pcsx/beetle cores would be available for download on retroarch's website, but apparently not? @Ploggy was testing those builds, unless he was actually building them manually every time.

piratesephiroth commented 1 year ago

@pcercuei yeah it's not on buildbot.libretro.com either

steeletyler1 commented 1 year ago

So am I stuck using the WiiSXRX WiiU overclock?