2021-07-18 09:44:23 -07:00
using System.Collections.Concurrent ;
using System.Collections.Generic ;
2022-05-01 17:41:50 -07:00
using BurnOutSharp.Interfaces ;
2021-03-22 23:02:01 -07:00
using BurnOutSharp.Matching ;
2019-09-27 23:52:24 -07:00
namespace BurnOutSharp.ProtectionType
{
2022-11-06 22:30:59 -07:00
/// <summary>
/// Freelock is software intended to allow users to burn a copy protected PSX CD-R.
/// It accomplishes this by adding additional dummy tracks to an image before burning, and then attempting to use a corrupted file to burn to these tracks, causing the write process to fail at the end.
/// Freelock versions 1.0-1.2a were intended solely to be copied to a floppy disk and then used, as the main executable itself was intentionally corrupted in these versions.
/// Freelock version 1.3 intentionally corrupts a different file, allowing you to run the program without a floppy disk.
///
/// Official websites:
/// https://web.archive.org/web/20010801181527/http://www.geocities.com/freelock_psx/
/// https://web.archive.org/web/19991001075001/http://www.geocities.com/SiliconValley/Code/6061/
///
/// Versions:
/// Freelock 1.0: https://web.archive.org/web/20040615215309/http://www.geocities.com/SiliconValley/Code/6061/programs/flock10.zip
/// Freelock 1.2: https://web.archive.org/web/20091027114741/http://geocities.com/siliconvalley/code/6061/programs/flock12.zip
/// Freelock 1.2a: https://web.archive.org/web/20040613085437/http://www.geocities.com/SiliconValley/Code/6061/programs/Flock12a.zip
/// Freelock 1.3: https://web.archive.org/web/20040606222542/http://www.geocities.com/SiliconValley/Code/6061/programs/flock13.zip
/// </summary>
public class Freelock : IPathCheck
2019-09-27 23:52:24 -07:00
{
2022-11-06 22:30:59 -07:00
// TODO: Add an MS-DOS executable check for "FREELOCK.EXE".
2021-02-26 00:32:09 -08:00
/// <inheritdoc/>
2021-07-18 09:44:23 -07:00
public ConcurrentQueue < string > CheckDirectoryPath ( string path , IEnumerable < string > files )
2019-09-27 23:52:24 -07:00
{
2021-03-22 23:02:01 -07:00
var matchers = new List < PathMatchSet >
{
2022-11-06 22:30:59 -07:00
// The disk image that every version of Freelock is distributed through.
new PathMatchSet ( new PathMatch ( "FREELOCK.IMG" , useEndsWith : true ) , "Freelock Disk Image" ) ,
// Found in every "FREELOCK.IMG".
new PathMatchSet ( new PathMatch ( "FREELOCK.EXE" , useEndsWith : true ) , "Freelock" ) ,
new PathMatchSet ( new PathMatch ( "FREELOCK.TXT" , useEndsWith : true ) , "Freelock" ) ,
// Found in "FREELOCK.IMG" from Freelock 1.0-1.2.
new PathMatchSet ( new PathMatch ( "FREELOCK" , useEndsWith : true ) , "Freelock 1.0-1.2" ) ,
// Found in "FREELOCK.IMG" from Freelock 1.2+.
new PathMatchSet ( new PathMatch ( "GENLOCK.EXE" , useEndsWith : true ) , "Freelock 1.2-1.3" ) ,
new PathMatchSet ( new PathMatch ( "freelock.ico" , useEndsWith : true ) , "Freelock 1.2-1.3" ) ,
new PathMatchSet ( new PathMatch ( "freelock.pif" , useEndsWith : true ) , "Freelock 1.2-1.3" ) ,
// Found in "FREELOCK.IMG" From Freelock 1.3.
new PathMatchSet ( new PathMatch ( "FREELOCK.13" , useEndsWith : true ) , "Freelock 1.3" ) ,
// Found in "FREELOCK.IMG" From Freelock 1.3.
new PathMatchSet ( new List < PathMatch >
{
new PathMatch ( "FREELOCK.13" , useEndsWith : true ) ,
new PathMatch ( "FL.DAT" , useEndsWith : true ) ,
} , "Freelock 1.3" ) ,
2021-03-22 23:02:01 -07:00
} ;
2021-03-23 13:35:12 -07:00
return MatchUtil . GetAllMatches ( files , matchers , any : true ) ;
2021-03-19 15:41:49 -07:00
}
/// <inheritdoc/>
public string CheckFilePath ( string path )
{
2021-03-22 23:02:01 -07:00
var matchers = new List < PathMatchSet >
{
2022-11-06 22:30:59 -07:00
// The disk image that every version of Freelock is distributed through.
new PathMatchSet ( new PathMatch ( "FREELOCK.IMG" , useEndsWith : true ) , "Freelock Disk Image" ) ,
// Found in every "FREELOCK.IMG".
new PathMatchSet ( new PathMatch ( "FREELOCK.EXE" , useEndsWith : true ) , "Freelock" ) ,
new PathMatchSet ( new PathMatch ( "FREELOCK.TXT" , useEndsWith : true ) , "Freelock" ) ,
// Found in "FREELOCK.IMG" from Freelock 1.0-1.2.
new PathMatchSet ( new PathMatch ( "FREELOCK" , useEndsWith : true ) , "Freelock 1.0-1.2" ) ,
// Found in "FREELOCK.IMG" from Freelock 1.2+.
new PathMatchSet ( new PathMatch ( "GENLOCK.EXE" , useEndsWith : true ) , "Freelock 1.2-1.3" ) ,
new PathMatchSet ( new PathMatch ( "freelock.ico" , useEndsWith : true ) , "Freelock 1.2-1.3" ) ,
new PathMatchSet ( new PathMatch ( "freelock.pif" , useEndsWith : true ) , "Freelock 1.2-1.3" ) ,
// Found in "FREELOCK.IMG" From Freelock 1.3.
new PathMatchSet ( new PathMatch ( "FREELOCK.13" , useEndsWith : true ) , "Freelock 1.3" ) ,
2021-03-22 23:02:01 -07:00
} ;
2019-09-27 23:52:24 -07:00
2021-03-22 23:02:01 -07:00
return MatchUtil . GetFirstMatch ( path , matchers , any : true ) ;
2019-09-27 23:52:24 -07:00
}
}
}