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

Adding recursive xorpad file search and crc32 support #9

Closed
wants to merge 2 commits into from

Conversation

putnam
Copy link

@putnam putnam commented Nov 16, 2016

Summary:
Many xorpad repos/distributions now include the CRC32 of the title in the filename. In many cases the xorpad files are also split into multiple subfolders. Currently, 3dsconv will not discover xorpad files in subdirectories or with crc32 info in their filename. In some cases, titles may have multiple revisions. By calculating the crc32 of the input file we can more accurately find its related xorpad.

Changes:

  • The xorpad directory is now searched recursively for xorpad files
  • xorpad files are searched in a case-insensitive fashion
  • Discover and prefer xorpad files with matching crc32 in the filename

Extra info:
I wrote the CRC32 function included here for minimal memory use and high speed. zlib is about 5x faster than using binascii.crc32.

Summary:
  Many xorpad repos/distributions now include the CRC32 of the title in the filename. In many cases the xorpad files are also split into multiple subfolders. Currently, 3dsconv will not discover xorpad files in subdirectories or with crc32 info in their filename. In some cases, titles may have multiple revisions. By calculating the crc32 of the input file we can more accurately find its related xorpad.

Changes:
  - The xorpad directory is now searched recursively for xorpad files
  - xorpad files are searched in a case-insensitive fashion
  - Discover and prefer xorpad files with matching crc32 in the filename

Extra info:
  I wrote the CRC32 function included here for minimal memory use and high speed. zlib is about 5x faster than using binascii.crc32.
@putnam
Copy link
Author

putnam commented Nov 16, 2016

Need to make a change to this. My break in the file loop is not adequate. Will fix momentarily

Summary:
  Whoops, python doesn't let you break out of nested loops like that. Moved xorpad search to a function.

  Also added useful display output during crc32 calculation, and displaying each title to help demarcate individual conversions.
@putnam
Copy link
Author

putnam commented Nov 16, 2016

OK, changes applied and tested.

@putnam
Copy link
Author

putnam commented Nov 17, 2016

I'm going to collapse these commits together and add another fix, so closing this.

@putnam putnam closed this Nov 17, 2016
@ihaveamac
Copy link
Owner

"collapse" you mean squash? github already allows doing that at merge-time, so doing it manually is not required anymore.

@putnam
Copy link
Author

putnam commented Nov 17, 2016

Oh nice, I didn't realize. Was gonna do an --amend on my side. I'll commit one more thing real quick to fix the bug I just came across

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.

2 participants