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

Core-side unique id / checksum calculation #4

Open
heuripedes opened this issue Aug 29, 2014 · 7 comments
Open

Core-side unique id / checksum calculation #4

heuripedes opened this issue Aug 29, 2014 · 7 comments

Comments

@heuripedes
Copy link
Contributor

It would be nice if the libretro api had a way to allow the frontend to query for a string that could uniquely identify the content.

Example usage:

  • Cheat support when the core sets need_fullpath=true.
  • Single save file for multi-file content.
@Alcaro
Copy link
Collaborator

Alcaro commented Aug 30, 2014

We could read the file ourself even if need_fullpath is set, but reading and hashing a 650MB ISO would take a while, and the base file could refer to a dozen of other files (pretty sure CUE files do something funny, and bsnes BML files could have same content for different ROMs too).
Definitely an interesting idea.

@ramapcsx2
Copy link

The ISO reading can be done faster by looking inside the container and hashing just some identifiable object there, like the main executable.

@Alcaro
Copy link
Collaborator

Alcaro commented Oct 27, 2014

So you're proposing that the frontend learns how to read every disc file system in existence? Because that's nowhere near realistic, and even if it was, the point of libretro is that we can create a new core without reworking the front.

A better idea would be to hash a few carefully chosen megabytes from the file. That would make different files show up different (even J/E/U should have a few bytes shifted which will make everything show up differently, alternatively use the RAM differently which will show up once we hash a chunk of code), with the exception of romhacks, and almost all cheats work for hacked ROMs anyways.

@ramapcsx2
Copy link

Yea, that's right. Your suggestion would be better at this approach.
Then again, there's still the problem of even trying to compile a list of every content ever created..

@heuripedes
Copy link
Contributor Author

@Alcaro Hashing a piece of data from the ISO does create unique ids but it disallows the frontend to store a single .srm for multi-file content, if it were to be implemented.
@ramapcsx2 In the case of roms, there's http://datomatic.no-intro.org/ which can provide file hashes and internal rom checksums.

@ramapcsx2
Copy link

So it appears this function could be done and could be useful, but it needs to approach content in different ways. Hashing it all is good and preferable for small content. It's fast and there are various known good file hashes available to identify it.
For larger content it gets complicated. I would still implement an image reader to identify CD based content. Most console games (if not all) have identifiying files in them that can be looked up in already available databases. (For example: PSX and PS2 via the Sony catalog number).
Unique, new content that was made for libretro can have an ID requirement in the API.

@heuripedes
Copy link
Contributor Author

The proposal here is to free the frontend from the "burden" of having to uniquely identify something it doesn't know anything about. For roms, regardless of the media, the emulator core would just return a string containing the internal checksum, game id or catalog number (perhaps with a prefix/namespace to avoid conflicts.) For cores can't identify the content, the frontend would fallback to the current behavior.

I'm against adding a image reader dependency to the frontend.

edit: I'm against requiring the frontend to have a image reader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants