The NEW Build Your Own Arcade Controls

Main => Main Forum => Topic started by: aishwarya on July 10, 2018, 01:17:39 am

Title: Can I port RetroArch to Native Client
Post by: aishwarya on July 10, 2018, 01:17:39 am
hello,
I've been cutting my teeth on another coding project, and figured that the best thing that I could try is to port RetroArch all in one Emulator into Native Client, so that it could very well be a packaged app with cloud saves entirely within a browser. Look up the project on Github since I don't have enough links.

The way RetroArch is built on linux is to run a configure script, then make, then sudo make install. Altering the configure agent to select the Native Client compilers, I was able to get a couple seconds into the build when this happened,

http://pastebin.com/0WtrY6aU (http://pastebin.com/0WtrY6aU)

using this custom Makefile here.

http://pastebin.com/iv6RmQVr (http://pastebin.com/iv6RmQVr)

I figure it's gonna be a long hard road building and debugging this puppy, but where do you recommend I get started?
Title: Re: Can I port RetroArch to Native Client
Post by: Osirus23 on July 10, 2018, 12:42:11 pm
Have you asked over on the Libretro forums? They've been pretty helpful in the past when I've gone about compiling Retro Arch customizations.
Title: Re: Can I port RetroArch to Native Client
Post by: georgebelly on September 05, 2018, 12:17:07 pm
You're starting from a good place, you've just hit your first compile error.

Here it is:

In file included from settings.c:23:
input/input_common.h:73: error: redefinition of typedef ‘rarch_joypad_driver_t’
driver.h:327: note: previous declaration of ‘rarch_joypad_driver_t’ was here
Here is an excerpt from input_common.h:

typedef struct rarch_joypad_driver
{
   ...
} rarch_joypad_driver_t;
Here is an excerpt from driver.h:

typedef struct rarch_joypad_driver rarch_joypad_driver_t;
Just as the error says, the typedef is being redefined. I ran a test using gcc 4.6.3 from Ubuntu 12.04:

typedef struct foo { int bar; } foo_t;
typedef struct foo foo_t;
int main() { return 0; }
This compiles and links fine. The same code compiled with x86_64-nacl-gcc (which is using gcc 4.4.3), gives the following error:

typedef.c:2: error: redefinition of typedef ‘foo_t’
typedef.c:1: note: previous declaration of ‘foo_t’ was here
It seems that this error has been relaxed in more recent versions of gcc. I did some searching and found this stackoverflow link: Why "Redefinition of typedef" error with GCC 4.3 but not GCC 4.6?.

It's worth noting that x86_64-nacl-g++ will compile this code unmodified. Here are two things to try:

Compile with CC using x86_64-nacl-g++ instead of x86_64-nacl-gcc
ifdef out the definition in driver.h, and replace the other use in that file with struct rarch_joypad_driver.
For #2, you can use the following: showbox (https://showboxapkdl.org/)

#ifndef __native_client__
...
#endif
Good luck, there likely will be more compile failures to fix. :)
Title: Re: Can I port RetroArch to Native Client
Post by: Haze on September 05, 2018, 01:04:24 pm
Calling Retroarch an emulator is a disservice to those actually developing emulators.

It's a frontend that requires specifically hacked emulators (in the form of 'libretro cores') to work with it.

They're emulating nothing, and using every cheap trick in the book they can to win popularity.

This annoys me because I've had people containing me saying they donated money to RA related projects thinking it would improve MAME when the actual emulator devs see nothing at all of what goes there, only the people hacking up cores, often in ways that can't be backported to the original projects because they're quick fix hacks.