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

add m3u support #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

add m3u support #9

wants to merge 1 commit into from

Conversation

i30817
Copy link

@i30817 i30817 commented May 20, 2023

Description of Changes

Updated version of the m3u code that works with current master code.

Rationale behind Changes

m3u pr required had a very old version of the code and used wxwidgets

Suggested Testing Steps

No clue.

I used fstream ifstream getline to get the m3u file data, not sure if the best idea and if libretro has some better idea. I'm also actually not sure if this will work with utf-8. I didn't have problems, but i don't have games with Japanese on it, maybe it's better to test a m3u with it.

@i30817
Copy link
Author

i30817 commented May 21, 2023

The code also advertises .cue support but it doesn't work yet, this is not from this pr, it happened before. Maybe elf doesn't work either because i removed the code handling it in the previous version of this PR (in the hope it had already been done and abstractred in CDVD because of the info->valid_extensions = "elf|iso|ciso|cue|bin|gz"; already in the code. Like the old code it won't like leading spaces, etc, but i'm guessing i didn't really want to build something bullet proof here.

One way this isn't worse than the other PR is that it adds support for absolute paths in m3us, which was just a if away with the right Path function.

I needed update because all my games playlists are in m3us with isos inside (or even cues for the few ps2 games using iso, like Growlanser III and IV).

@i30817 i30817 force-pushed the m3u branch 2 times, most recently from ebcae54 to f9d72e3 Compare May 21, 2023 04:47
@i30817
Copy link
Author

i30817 commented May 21, 2023

I'm a bit confused about RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE

To clarify, it's used just in the case that we're in the same game game, so i should always start the image_index to 0 when in retro_load_game right?

I thought it was supposed to remember between loads of a game, like it would get the variable from a frontend maintained 'memory' or from the playlist to see the last cd loaded and load that. So one could close a game on cd 2, loading another game, closing that and starting the original and start on cd 2.

But apparently it's not so, and the only reason for those are just the restart option to remember the current game index. Worse than i expected, but not too bad.

I was breaking the code in these last updates assuming that there was a hidden call before retro_load_game 'restoring' the last used index for the game entry, back to set to 0 on that function...

@i30817 i30817 force-pushed the m3u branch 2 times, most recently from f955280 to af65ea0 Compare May 21, 2023 04:58
@i30817
Copy link
Author

i30817 commented May 21, 2023

Seems like there is a cue RFE in upstream since 2021. I'm guessing it will get implemented when playing ps1 games gets serious. There is little point implementing it here if it's going to get added transparently, and yet, it's been 2 years.

@i30817
Copy link
Author

i30817 commented May 24, 2023

Ah damn, this isn't working because of utf-8 breaking. I'll have to see if it's possible without wxwidgets.

@i30817
Copy link
Author

i30817 commented May 24, 2023

Ok, i think i fixed the bugs.

bug 1: the messages didn't have \n

bug 2: ifstream utf-8 requires opening with a filesystem path library. I kept the BOM strip because it doesn't sound like it would do any harm.

bug 3: i forgot to test for a empty parent when joining the files inside the m3u if relative to the 'parent' of the m3u. This is necessary because there is no way in the pcsx2 path library to 'absolutize' a path, and so i needed to treat relative paths inside m3us as if they were relative to the file, but the file could be passed from another directory than the current.

bug 4: invalid use of rfind instead of find...

for instance, retroarch -L pcsx2 a/a.m3u' would need to check 'a/a.iso' with 'a.iso inside the m3u. That worked, but if i didn't have that check, retroarch -L pcsx2 a.m3u' would check '/a.iso' because it would try to join the empty string (the 'parent' of the m3u). I kind of expected the function to be more resilient.

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

Successfully merging this pull request may close these issues.

1 participant