Closed GoogleCodeExporter closed 8 years ago
ini_search_by_crc is depreciated and only used as a fallback in rom.c and by
the
cheat subsystem which is in the process of being rewritten.
I fixed the core issue in issue 89. I'm fairly sure the code does work, but if
not,
>> has endian issues. The real solution is either to remove the function
altogether
or change the API to passing an unsigned char as that's the size of the CRCs.
Original comment by sknau...@wesleyan.edu
on 11 Oct 2008 at 3:12
I agree it is only used as fallback in rom.c, but my opinion is still that it is
failing. I have now tested with a faulty .zip archive. The crc1 and crc2 are
successfully extracted from the rom header, but still the game is not found in
the
ini file.
I see this line printed on the terminal (rom.c:581):
printf("%s\n", ROM_SETTINGS.goodname);
Not sure what you mean with "I fixed the core issue in issue 89".
Tried to make a little more robust patch:
Index: main/romcache.c
===================================================================
--- main/romcache.c (revision 1102)
+++ main/romcache.c (working copy)
@@ -939,11 +939,20 @@
romdatabase_entry* ini_search_by_crc(unsigned int crc1, unsigned int crc2)
{
+ unsigned char buffer[10];
+ char temp[3];
+ temp[2] = '\0';
+
if(g_romdatabase.comment==NULL)
return &empty_entry;
romdatabase_search* search;
- search = g_romdatabase.crc_lists[(unsigned short)crc1];
+ sprintf(buffer, "%x", crc1);
+ temp[0] = buffer[0];
+ temp[1] = buffer[1];
+
+ search = g_romdatabase.crc_lists[hexconvert(temp)];
+
while (search != NULL && search->entry.crc1 != crc1 && search->entry.crc2 != crc2)
search = search->next_crc;
Original comment by olejl77@gmail.com
on 11 Oct 2008 at 7:37
I meant I fixed the .zip problem in issue 89.
Anyway... I did some more testing and yes, there is a bug. I applied a similar
patch in r1108
Original comment by sknau...@wesleyan.edu
on 11 Oct 2008 at 10:50
Fix verified OK.
Original comment by olejl77@gmail.com
on 12 Oct 2008 at 5:49
Original issue reported on code.google.com by
olejl77@gmail.com
on 10 Oct 2008 at 9:35