RetroAchievements / docs-archive

RADocs
https://docs-archive.retroachievements.org
52 stars 10 forks source link

Mega Drive game identification #20

Closed meleu closed 5 years ago

meleu commented 5 years ago

@Jamiras According to the Game Identification page, in the Mega Drive case the entire file is hashed.

But the logic in RetroArch gives me the impression that it pads the content with zeros when the file size is smaller than 6 megabytes.

Could you find on RAGens code how the hash is calculated?

Maybe @leiradel or @ScottFromDerby can shed some light here too.

Jamiras commented 5 years ago

It passes the ROM_Size as the amount to hash, and that seems to be getting set to the size of the ROM. https://github.com/RetroAchievements/RAEmus/blob/master/RAGens/common/src/Rom.cpp#L432

image

As far as I can tell, that's been the behavior since RAGens was introduced four years ago. I'm not sure where the 6MB padded logic in RetroArch comes from.

GameDragon2k commented 5 years ago

So, a lot of the older commits on this repo weren't actually released, at least not during the time the commits happened. All of the 2015 and most of 2014 commits weren't available to people until 2017.

This includes the hash change for RAGens. While on github, this changed years back, the Mega Drive hash kept the same 6 mb padding until April 14, 2017.

meleu commented 5 years ago

@GameDragon2k then it's safe to remove such logic on RetroArch, right?

GameDragon2k commented 5 years ago

Yeah, it should be fine.

Jamiras commented 5 years ago

The padded hashing code has been removed from RetroArch. I don't have permission to close this.

ScottFromDerby commented 5 years ago

Hey, that was my poor implementation back in 2014, at the time I couldn't find the size of the loaded ROM reliably (turns out the size was stored off as a power of 2 IIRC?) so I looked over the no-intro ROM collection and the largest seemed to be 6mb, so I zeroed 6mb, popped the ROM in at the start and hashed that. We made the change to hash 'correctly' roughly 2017, you're right GD.