Skip to content
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

Make Pokopom Cross-Platform #20

Open
Algebro7 opened this issue Feb 24, 2017 · 21 comments
Open

Make Pokopom Cross-Platform #20

Algebro7 opened this issue Feb 24, 2017 · 21 comments

Comments

@Algebro7
Copy link
Contributor

Algebro7 commented Feb 24, 2017

I started this process with #19 and #18 but figured it made sense to open an enhancement request ticket to discuss this development. As I mentioned in the PR, I'm pretty much a C++/cmake newb, but I've managed to get the plugin to build on Windows/Visual Studio using cmake, and PCSX2 seems to be able to load and configure it.

Unfortunately, on Linux, the plugin builds successfully with cmake but is not able to be loaded by PCSX2. It throws the following error when attempting to load it:

[wx] /usr/lib/games/PCSX2/libpadPokopom.so: undefined symbol: multitap
Path: /usr/lib/games/PCSX2/libpadPokopom.so
File is not a valid dynamic library.
Some kinda plugin failure: /usr/lib/games/PCSX2/libpadPokopom.so

When looking through the source code of other plugins in https://github.com/PCSX2/pcsx2/tree/master/plugins, I'm noticing a lot of code like this before function definitions:
EXPORT_C_(const char *). I noticed you have a similar macro defined in https://github.com/KrossX/Pokopom/blob/master/Pokopom/General.h with #define DllExport extern "C". Do you think this macro needs to be added to various type definitions and functions through the project? Or do you think it might be an issue with my build configuration?

@KrossX
Copy link
Owner

KrossX commented Feb 24, 2017

I'm building it the "usual" way for me on linux and I got the same error. I didn't debug it much but got it to compile and show up on PCSX2. However, it segfaults and I have no clue why (the backtrace didn't help). I'll be making some tests to try and isolate the problematic part,

As for the defines, I would leave them as they are until it's proven to be the actual problem.

@Algebro7
Copy link
Contributor Author

Good to know, and thanks for helping me look into this. Is there any chance you would mind sending me your makefile for linux?

@KrossX
Copy link
Owner

KrossX commented Feb 24, 2017

Makefile? Pfff, that would be too fancy. I just use a terminal with something like this:

g++ --std=c++11 --shared -o libPokopom.so ./Pokopom/*.cpp

That should give a file ready to be used. Add extra arguments as needed for debug and stuff.

@Algebro7
Copy link
Contributor Author

Thanks for the information! Here's the behavior when I try on my machine:

g++ --std=c++11 --shared -m32 -o libPokopom.so ./Pokopomclion/Pokopom/*.cpp

(Compiles without any warnings or errors)

image

Are you seeing different behavior?

@KrossX
Copy link
Owner

KrossX commented Feb 24, 2017

I removed non-playstation systems. Those files should have some define guards to make it easier.

@Algebro7
Copy link
Contributor Author

Algebro7 commented Feb 24, 2017

Got it. I did the same and now it's just the multitap symbol as before. I removed Chankast*, demul*, and Zilmar* from the sources directory, were there any others I needed to get rid of?

@KrossX
Copy link
Owner

KrossX commented Feb 24, 2017

I think that's it. I'll add some define guards. As for the segfault, the following change seems to fix it for now. HEADER

#define DllExport extern "C"
to
#define DllExport extern "C" __attribute__((stdcall))

Though since this makes even the most basic stub fail without it, I guess this change is rather recent. I don't know if it will have an effect against ps1 emulators for example. Bummer.

#EDIT: Try again with latest changes.

@Algebro7
Copy link
Contributor Author

Awesome, thanks! PCSX2 will load the plugin now, but there is no option to configure it. Are you seeing the same behavior?

@KrossX
Copy link
Owner

KrossX commented Feb 24, 2017

It has always been that way, linux settings can only be changed from the ini file directly.

@Algebro7
Copy link
Contributor Author

Awesome, I really appreciate you looking into this.

Just so I understand, you're saying the change to the Export syntax fixes the problem for PCSX2, but may break compatibility with other emulators?

@KrossX
Copy link
Owner

KrossX commented Feb 25, 2017

It changes the way functions are called under linux. It seems to solve problems for PCSX2 (see change here) but pokopom works for multiple emulators even on linux. Though limited to only some ps1 emulators and PCSX2 in that os, I don't know if the ps1 emulators are still compatible.

Anyhow, if it becomes an issue at least I know where to start looking at.

@Algebro7
Copy link
Contributor Author

Do you know if there is any special trick to using this plugin on Linux? I tried plugging in both a steam controller and a DS3 controller and neither was detected by PCSX2. I'm sure it's just user error but if you have any ideas or could help me test that the plugin works that'd be awesome.

@KrossX
Copy link
Owner

KrossX commented Feb 26, 2017

Pokopom was an X360 controller plugin mostly. Under windows that means just using XInput, though other controllers may support that. On linux however, the plugin only accepts X360 controllers.

The rewrite that I started years ago was supposed to support multiple API and possibly any input device supported. But that rewrite never went anywhere.

@Algebro7
Copy link
Contributor Author

Algebro7 commented Feb 26, 2017

Ahh, ok, I appreciate the information. I just tested it with an X360 controller on Linux and it appears to work flawlessly. I will work on updating the wiki with build instructions and a getting started section that discusses some of these points.

Also, should we update the releases section to include the working Linux binary? The one hosted on your Google drive is the old, broken one. We could also update the Windows binary but I'd like to do some testing to make sure I didn't break anything before we do that.

@KrossX
Copy link
Owner

KrossX commented Feb 27, 2017

I used to make builds from the ubuntu build I would be using at the time. Though now perhaps it would be better for people to build their own? Pokopom on linux has always been a very "try at your own risk" operation after all.

As for windows, I don't see any new changes that would require a new build. Unless I'm missing something that is.

@Algebro7
Copy link
Contributor Author

Yeah, that makes sense. And with cmake support it will be easier to build on Linux, since all they need to do is cmake ../and it's ready to go.

@Algebro7
Copy link
Contributor Author

FYI, I updated the Pokopom wiki with detailed build instructions and a discussion about the current known limitations on Linux. I figured I'd let you know since I'm not sure if it notifies you when someone edits the wiki.

@KrossX
Copy link
Owner

KrossX commented Feb 27, 2017

Thanks and no, I don't get notifications about the wiki. That reminds me, I never updated the security setting on the wiki section (it's been public all along).

@halian
Copy link

halian commented Nov 21, 2020

g++ --std=c++11 --shared -o libPokopom.so ./Pokopom/*.cpp

On a point of information: This now requires -fPIC, but after that addition compiles without issue under Arch Linux.

Unfortunately, I have no clue how to configure Pokopom by hacking on the .ini file directly, as is required here….

@KrossX
Copy link
Owner

KrossX commented Nov 21, 2020

Checking the FileIO.cpp file should give you an idea about what settings do, there's not much to customize though. Any reason to be using Pokopom nowadays, specially on linux? Seems like an odd choice.

@halian
Copy link

halian commented Nov 22, 2020 via email

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

No branches or pull requests

3 participants