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

CHD support through libchdr #18198

Merged
merged 7 commits into from
Sep 29, 2023
Merged

CHD support through libchdr #18198

merged 7 commits into from
Sep 29, 2023

Conversation

hrydgard
Copy link
Owner

@hrydgard hrydgard commented Sep 22, 2023

Yes, I'm adding basic CHD support. You asked for it, you got it - but I still recommend CSO! I'm just tired of the complaints, and it's just not that hard to do.

Basically a lean and mean replacement for the bloated 150000-line #13810 , which I couldn't merge as-is.

Uses libchdr through a submodule and unlike the previous PR doesn't add a lot of other unnecessary libraries - flac is entirely useless for example since UMDs don't have audio tracks.

I've disabled the parent/child thing due to file system performance concerns on Android and libchdr missing the functionality to just scan file headers from a FILE *, which we require. See rtissera/libchdr#55 for more details. I'm not sure how desirable that feature is for PSP games anyway.

Fixes #10417

The build system setup isn't finished yet, still need to add the new files to Android.mk and the libretro makefile.

@hrydgard hrydgard added the User Interface PPSSPP's own user interface / UX label Sep 22, 2023
@hrydgard hrydgard added this to the v1.17.0 milestone Sep 22, 2023
@hrydgard
Copy link
Owner Author

hrydgard commented Sep 22, 2023

Okay, one build error left.. Weird:

jni/../../ext/libchdr/deps/lzma-22.01/src/CpuArch.c:447: error: undefined reference to 'getauxval'

I guess that's a newer libc function, but why would that build, aandroid armeabi-v7a, be so special....

EDIT: my hack below didn't work for some reason.. oh oops, need it in Android.mk as well.

@hrydgard hrydgard marked this pull request as ready for review September 22, 2023 20:51
@hrydgard hrydgard changed the title WIP: CHD support through libchdr CHD support through libchdr Sep 22, 2023
@GABO1423
Copy link
Contributor

I spotted some stuff to clean up/fix in the UWP files, I'll make a PR for those tweaks once this is merged. Unless you want to fix these quirks right now.

@hrydgard
Copy link
Owner Author

@GABO1423 I won't be merging this PR for a little while (until I'm happy with the stability of 1.16.x), so feel free to do a PR against this PR.

@@ -4,11 +4,45 @@ SRC := ../..
include $(CLEAR_VARS)
include $(LOCAL_PATH)/Locals.mk

LOCAL_CFLAGS += -D_7ZIP_ST -D__SWITCH__
Copy link
Collaborator

Choose a reason for hiding this comment

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

__SWITCH__?

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

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

It only makes sense if you go look at the c file in question, CpuArch in lzma. It avoids using the getauxflags function on Switch and Vita to check for NEON, and that workaround for the lack of the function works fine for us.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Heh, a bit gross, but got it. We don't get getauxval on some Android archs because we're still supporting older targets iirc. cpu_features had this issue too but I think had a cleaner check.

-[Unknown]

Path paths[8];
paths[0] = fileLoader->GetPath();

chd_error err = chd_read_header(paths[0].c_str(), &childHeader);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't this mean it won't work on Android? Is this function even needed? Later it opens it from a FILE * anyway, which would probably also solve the international path thing too?

Of course it won't support read ISO into RAM or remote disc streaming, but I guess people using this format mostly want the hype and will probably feel like it's more powerful because stuff doesn't work.

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

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

That is absolutely true, but as commented elsewhere, I haven't enabled this path yet.

Copy link
Collaborator

@unknownbrackets unknownbrackets Sep 23, 2023

Choose a reason for hiding this comment

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

This is at the very beginning of the function. It's not a commented out part or after that part.

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

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

Oh duh, was thinking of the below block, too lazy to click into the full view..

Yeah, this is bad. I just realize I only tested it on an old Android.

So this will need fixing for modern Android, and I'll probably end up submitting a patch to libchdr to add chd_read_header_file.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it even need this though? It seems to just open from a file and actually get the header from there later?

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

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

True that, I'll look into getting rid of it before merge.

@hrydgard hrydgard merged commit 80ae562 into master Sep 29, 2023
18 checks passed
@hrydgard hrydgard deleted the libchdr-support branch September 29, 2023 09:31
@orbea
Copy link
Contributor

orbea commented Oct 5, 2023

@hrydgard To be honest is unfortunate you merged this at all.

@deltabeard
Copy link

@hrydgard To be honest is unfortunate you merged this at all.

Why?

@carmiker
Copy link

carmiker commented Oct 5, 2023

@deltabeard the discussion, which should probably not be had again at this point, is available for you to read here: #13810

@hrydgard
Copy link
Owner Author

hrydgard commented Oct 5, 2023

To sum it up, I figured out that we could do this without bloating things as much as the original PR did, which changed the equation from absolutely not worth it, to just barely worth doing to stop all the recurring complaints about the lack of support that I kept getting through multiple channels. So I did for my own long term benefit, even though the feature on its own really isn't worth a lot when we already have CSO.

End of discussion. Further posts will be deleted.

Repository owner locked and limited conversation to collaborators Oct 5, 2023
Repository owner deleted a comment from carmiker Oct 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
User Interface PPSSPP's own user interface / UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Request] Support for CHD format
7 participants