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

Libretro upstreaming #1464

Merged
merged 30 commits into from
May 11, 2019
Merged

Conversation

Ghabry
Copy link
Member

@Ghabry Ghabry commented Oct 29, 2018

I'm slowly annoyed by always rebasing this therefore I would like to finally upstream the libretro code.

The code is not very invasive, only adds required libretro_ui and _audio files and "USE_LIBRETRO" where needed.

CMake considerations:
The CMakeLists is sufficient to build a easyrpg_libretro.a/.so when you have all dependencies installed (I refuse to add dependency source code in the upstream repo), simply compile with -DPLAYER_TARGET_PLATFORM="libretro" -DBUILD_SHARED_LIBS=ON and you get a library that works with at least Linux RetroArch.

The exception is libretro-common which I added as a submodule with an appropriate CMakeLists.txt.

I'm a bit surprised how simple it was to add a non-SDL2 build with not too many changes (also a nice base now for other platforms) as I didn't intended that use-case when writing the file...

Biggest changes to the CMake file is the new "PLAYER_TARGET_PLATFORM"
Almost everything else is just adding tabulators because code was moved into if() but this renders badly in the diff viewer :/.

@Ghabry
Copy link
Member Author

Ghabry commented Oct 30, 2018

updated the readme with minimal instructions

@Ghabry
Copy link
Member Author

Ghabry commented Nov 20, 2018

should be ready now.

src/player.h Outdated Show resolved Hide resolved
@Ghabry Ghabry force-pushed the libretro_upstreaming branch 3 times, most recently from 871a0b0 to 864838f Compare November 21, 2018 02:26
Copy link
Member

@carstene1ns carstene1ns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just had a quick glance, will look into this some more later.

src/player.cpp Show resolved Hide resolved
src/audio_libretro.h Outdated Show resolved Hide resolved
src/audio_libretro.cpp Outdated Show resolved Hide resolved
#else
# define Offset off_t
# define EasyRPG_Offset off_t
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very ugly (also the other type bending in filefinder for PSVita). I hope we can change this to use the same types later and get rid of all these Sce stuff. The vitasdk should really abstract this away in their c library.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be done in one go with the AMIGA symbol mess :/

README.md Show resolved Hide resolved
@Ghabry Ghabry force-pushed the libretro_upstreaming branch 3 times, most recently from 079663e to 04f0582 Compare November 23, 2018 10:39
@carstene1ns carstene1ns removed the Awaiting Rebase Pull requests with conflicting files due to former merge label Apr 18, 2019
return false;
}

extract_directory(parent_dir, game->path, sizeof(parent_dir));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This crashes on Windows because path in game->path is not UTF-8. Don't tell me they use the local Codepage here m(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, the path is UTF-8 encoded but liblcf can't handle such paths on Windows. In the GameBrowser we work around this with "SetCurrentDirectory" but I have a proper solution for this in my VFS branch, so I won't fix this. This is only a problem for the filename of the main game folder (where liblcf must have access to).

@Ghabry
Copy link
Member Author

Ghabry commented Apr 23, 2019

This is also ready now. There were no new crashes or anything reported by libretro users.

The Player still crashes on Android when closing but I blame RetroArch for this, even my start/stop simplification didn't help here.

@Ghabry
Copy link
Member Author

Ghabry commented Apr 26, 2019

I have an idea how to fix the audio thread crashes on core shutdown on Windows and Android (these are RetroArch bugs because they call code in the unloaded dll/so) but I need to wait for there awesome buildbot infrastructure first before I can test it ^^'

@Ghabry
Copy link
Member Author

Ghabry commented Apr 27, 2019

okay the workaround works, will only update libretro-common to the latest submodule version, then we are good to go.

src/libretro_ui.h Outdated Show resolved Hide resolved
src/player.cpp Outdated Show resolved Hide resolved
src/system.h Outdated Show resolved Hide resolved
…argc instead, otherwise this mismatches when e.g. libretro uses (nullptr, 0) and crashes.

Remove dead code
Fix memory leak, the Windows CLI was not deleted
Copy link
Member

@carstene1ns carstene1ns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not really like it, but i guess i cannot defend Player anymore 🤐

@carstene1ns carstene1ns merged commit c4d475c into EasyRPG:master May 11, 2019
@Ghabry Ghabry deleted the libretro_upstreaming branch September 8, 2020 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

6 participants