Opened 13 years ago

Closed 13 years ago

Last modified 12 months ago

#8634 closed patch

Small patches for AdvancedDetector

Reported by: jvprat Owned by: fingolfin
Priority: normal Component: --Other--
Keywords: Cc:
Game:

Description

I've written a small patch to clean the MD5 output when no match is found to make it easier to copy-paste. This removes duplicates (the same file ending with a dot) and sorts the list by file name.

Old output:
"resource.000.", "eb1cc4c1e44b33c0a622f6a16e1f66ad", 737253
"resource.002.", "79f4efe77f4a502465b61904998aa563", 1153561
"resource.004.", "e19ffa75e8b31238b5a497df00911284", 1143606
"resource.001.", "f37ab6914348f47a933537048fe0fb1a", 1196787
"resource.map", "baac9cc6903a7bd6acb4d4d9f9ed6931", 5559
"resource.map.", "baac9cc6903a7bd6acb4d4d9f9ed6931", 5559
"resource.000", "eb1cc4c1e44b33c0a622f6a16e1f66ad", 737253
"resource.001", "f37ab6914348f47a933537048fe0fb1a", 1196787
"resource.002", "79f4efe77f4a502465b61904998aa563", 1153561
"resource.003.", "ca6fc95d9417237689feaf3d68bebfa0", 1159791
"resource.003", "ca6fc95d9417237689feaf3d68bebfa0", 1159791
"resource.004", "e19ffa75e8b31238b5a497df00911284", 1143606

New output:
"resource.000", "eb1cc4c1e44b33c0a622f6a16e1f66ad", 737253
"resource.001", "f37ab6914348f47a933537048fe0fb1a", 1196787
"resource.002", "79f4efe77f4a502465b61904998aa563", 1153561
"resource.003", "ca6fc95d9417237689feaf3d68bebfa0", 1159791
"resource.004", "e19ffa75e8b31238b5a497df00911284", 1143606
"resource.map", "baac9cc6903a7bd6acb4d4d9f9ed6931", 5559

Ticket imported from: #1697907. Ticket imported from: patches/739.

Attachments (3)

clean_md5_output.patch (1.2 KB ) - added by jvprat 13 years ago.
Clean the MD5 output
uninitialized-var.patch (448 bytes ) - added by jvprat 13 years ago.
Fix an uninitialized variable
cleandetector.patch (5.1 KB ) - added by jvprat 13 years ago.
Don't add trailing dots

Download all attachments as: .zip

Change History (11)

by jvprat, 13 years ago

Attachment: clean_md5_output.patch added

Clean the MD5 output

by jvprat, 13 years ago

Attachment: uninitialized-var.patch added

Fix an uninitialized variable

comment:1 by jvprat, 13 years ago

While writing the previous patch, I've found a case where an uninitialized variable is used. The attached patch should solve it.

This made me wonder if the filename duplication (adding a final dot) is really needed. It seems it's added everywhere (both in the needed files and in the found ones), and in the end it's like a brute force search. Maybe we could reduce the addition just in one direction. For example, if we know the engines always search files without an ending dot, we don't need to add dots to the found files. This would enable a cleaner approach for my previous patch.

File Added: uninitialized-var.patch

comment:2 by sev-, 13 years ago

Basically trailing dot is needed only for file names without extension. I.e. 'gamepc' in AGOS engine. It was problematic due to CDs written in that weird way, i.e. they have 'gamepc.' instead of plain 'gamepc'. Under Miscrosoft OS it makes no problem, but is problematic under proper POSIX systems.

comment:3 by sev-, 13 years ago

Owner: set to sev-

comment:4 by fingolfin, 13 years ago

So, we should only be trying a second time with a dot added if the original name doesn't contain one.

by jvprat, 13 years ago

Attachment: cleandetector.patch added

Don't add trailing dots

comment:5 by jvprat, 13 years ago

I'm attaching a cleaning patch for the detector that always works without the trailing dot. I've tested it with simon and found that it's still detected when renaming gamepc as sev said.

I haven't tested the filename based fallback, as I don't know of any game that works with this.
File Added: cleandetector.patch

comment:6 by fingolfin, 13 years ago

Haven't heard from Eugene yet, but I think this latest patch (cleandetector.patch) looks good. Commited to SVN, thanks!

comment:7 by fingolfin, 13 years ago

Owner: changed from sev- to fingolfin
Status: newclosed

comment:8 by digitall, 12 months ago

Component: --Other--
Note: See TracTickets for help on using tickets.