libretro / libretro-handy

K. Wilkins' Atari Lynx emulator Handy (http://handy.sourceforge.net/) for libretro
13 stars 35 forks source link

[Feature Request] Core for Wii/Wii U? #75

Closed Cee123 closed 2 years ago

Cee123 commented 4 years ago

Hi there, just wondering why this core is not available on Retroarch for Wii.

EndangeredNayla commented 3 years ago

because no one wants to work on powerpc

Cee123 commented 3 years ago

Actually yeah, I did try to build the cores for Wii on Linux, but that was the thing that was giving me the biggest issue is I kept getting errors for powerpc-eabi-gcc.

ghost commented 3 years ago

If I can do it, you can too! https://ci.appveyor.com/project/trioan/libretro-handy/builds/34709308 https://raw.githubusercontent.com/trioan/libretro-handy/wii/appveyor-git.yml

Cee123 commented 3 years ago

If I can do it, you can too! https://ci.appveyor.com/project/trioan/libretro-handy/builds/34709308 https://raw.githubusercontent.com/trioan/libretro-handy/wii/appveyor-git.yml

Nice! I couldn't get it to build just kept getting a bunch of error messages i dont know why.

Cee123 commented 3 years ago

I tried following these instructions https://docs.libretro.com/development/retroarch/compilation/wii/

But seems to be something missing here.

ghost commented 3 years ago
https://docs.libretro.com/development/retroarch/compilation/wii/

You need the homebrew Nintendo Wii SDK libogc and Devkitpro PPC toolchain installed.

1) Be sure to use the libretro Devkitpro tools. And manually setup the DEVKITPPC and DEVKITPRO paths. https://github.com/libretro/libretro-toolchains/blob/master/wiiu.tar.xz?raw=true

Which I did in my script

export DIR = $PWD

export PATH="$DIR/tools/devkitpro/devkitPPC/powerpc-eabi:$PATH"
export DEVKITPPC="$DIR/tools/devkitpro/devkitPPC"
export DEVKITPRO="$DIR/tools/devkitpro"

2) Then try make -f Makefile platform=wii

Cee123 commented 3 years ago

Nice, that's fantastic. Thank you! I'll try and do what you said and see if I can compile it for the Wii. That was what I was missing I think.

Cee123 commented 3 years ago

@trioan Thanks! That seemed to work.

Cee123 commented 3 years ago

I copied your script above, and extracted the necessary files in the same location, and I'm also now using that same path and everything seems to be working now but still with some minor issues that I'm trying to figure out.

ls: cannot access '*_wii.a': No such file or directory

ghost commented 3 years ago

Huh. Could be linux path thing. My entire bash script is

      cd .
      export DIR=$PWD

      export PATH="$DIR/tools/devkitpro/devkitPPC/powerpc-eabi:$PATH"
      export DEVKITPPC="$DIR/tools/devkitpro/devkitPPC"
      export DEVKITPRO="$DIR/tools/devkitpro"

      git clone https://github.com/libretro/RetroArch Retroarch

      wget "https://github.com/libretro/libretro-toolchains/blob/master/wiiu.tar.xz?raw=true" -O "wiiu.tar.xz"
      mkdir tools
      tar xf wiiu.tar.xz -C tools

      cd $DIR
      make -f Makefile platform=wii
      cp *.a $DIR/Retroarch/dist-scripts

      cd $DIR/Retroarch/dist-scripts
      chmod a+x dist-cores.sh
      ./dist-cores.sh wii
Cee123 commented 3 years ago

I finally got it to compile (as well as a few other cores I'm testing) by placing the devkitpro files in the root of the drive and merging them with the system files (i.e. merging the bin folders etc). Now I don't have to worry about paths. I'm using a virtual machine anyway.

So, this core works on the Wii! Runs better than the Mednafen Lynx core... BUT there's a small issue. It doesn't seem to detect the Wii controllers. You can access the Retroarch menu and everything, but the controllers themselves in game don't seem to respond. Not sure why that is. Strange.

ghost commented 3 years ago

Beetle Lynx input works?

Cee123 commented 3 years ago

Beetle Lynx input works?

Yeah Beetle Lynx works. They've included it in retroarch wii. Works pretty good.

Cee123 commented 3 years ago

The control problem was also on these other cores I've tried:

So that must be why they dont include these cores in official retroarch wii.

ghost commented 3 years ago

First guess: MSB flip.

https://github.com/libretro/libretro-handy/blob/master/libretro/libretro.cpp#L292

static unsigned get_lynx_input(void)
{
   unsigned i, res = 0;
   for (i = 0; i < sizeof(btn_map_no_rot) / sizeof(map); ++i)
      res |= input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, btn_map[i].retro) ? btn_map[i].lynx : 0;

#ifdef MSB_FIRST
   return ((res<<8)&0xff00) | ((res>>8)&0xff);
#else
   return res;
#endif
}
Cee123 commented 3 years ago

Well, I'm thinking it might not be to do with those cores now. It's happening with most of my other cores now and seems to be with the latest version/s of retroarch. It's even happening with the cores that I've grabbed from a nightly a couple months back. It doesn't matter if I've compiled the cores or got them from a nightly. Some are working, some aren't and it seems to be totally random which cores have working controls. The controls for Cave Story aren't working, neither with Mr Boom and also for FCEUmm and also a bunch of others. I've tried deleting the retroarch configs and letting it generate new ones. I've also replaced the boot.dol with other versions thinking that's the problem. Nothing's working. Really strange.

ghost commented 3 years ago

Tried current handy core with Dolphin Wii emulator and input works using virtual GCPad controller.

ghost commented 3 years ago

@Cee123 Do any other Mednafen cores work besides Lynx? Trying to wonder if the Handy core needs to use the updated Libretro input bitmask api.

Cee123 commented 3 years ago

@trioan Hey yeah well, the controls don't seem to be responding on Mednafen PCE Fast or Mednafen VB at the moment either.

But they are working fine on Mednafen Supergrafx.

https://github.com/libretro/RetroArch/issues/11217

ghost commented 3 years ago

Added support for input bitmasks. https://github.com/libretro/libretro-handy/pull/81

Based on the other working repos, it could fix your Wii input problem. Please test. https://ci.appveyor.com/project/trioan/libretro-handy/builds/35059824/artifacts

ghost commented 3 years ago

@Cee123 If you have some time, would you mind testing this Wii build to see if your input problems get fixed? https://ci.appveyor.com/project/trioan/libretro-handy/builds/35169071/artifacts

Based on your working Wii repos, they all use input bitmasks which reads the controller in 1 go. So I think it may cure the Handy problem. If it works, then I guess I'll add it to some of the other bad cores.

Cee123 commented 3 years ago

@trioan Oh great! Thank you. That's excellent. Yeah i will gladly test it out, see if the issue is fixed with the input bitmask. If that is the issue then it should be a pretty simple fix (hopefully!).

Cee123 commented 3 years ago

@trioan Well, I just tried it out. And I can say it's working. Good work, you fixed it! That's fantastic, the controls are working fine now! Seems like that was the issue.

Cee123 commented 3 years ago

Yeah that version you posted works perfect.

ghost commented 3 years ago

The next problem is that the buildbot is not building this core for Wii?

Cee123 commented 3 years ago

The next problem is that the buildbot is not building this core for Wii?

Ah really? Damn, wonder why.

ghost commented 3 years ago

Once that gets merged, buildbot will take care of the rest and this ticket can get shut down.

inactive123 commented 2 years ago

Should be added now for Wii/WiiU as well as Gamecube.

Cee123 commented 2 years ago

Should be added now for Wii/WiiU as well as Gamecube.

Yeah, was added a while ago now. Meant to close this earlier but forgot about it.