medfall

A super great game engine
Log | Files | Refs

commit 5cec05087131256fd1bf4bb787eb5c3c4c9e97f7
parent d58dfd4b9f2333933c1efb606599039768b3e72c
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sun Jul  2 12:15:44 +0300

Add a manifest field for platform specific files

Diffstat:
launcher/main.cc | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/launcher/main.cc b/launcher/main.cc @@ -160,24 +160,29 @@ static bool parse_manifest( std::map< std::string, ManifestEntry > & manifest, c ASSERT( line.n == 1 ); Matches matches; - bool ok = match( &matches, line[ 0 ], "^(%S+) (" SHA256_PATTERN ") (%d+)$" ); + bool ok = match( &matches, line[ 0 ], "^(%S+) (" SHA256_PATTERN ") (%d+)%s*(%w*)$" ); if( !ok ) return false; ASSERT( matches[ 1 ].n + 1 == SHA256_DIGEST_STRING_LENGTH ); const str< 256 > file_name( "{}", matches[ 0 ] ); const str< 16 > file_size( "{}", matches[ 2 ] ); + const str< 32 > file_platform( "{}", matches[ 3 ] ); u64 size = u64( strtonum( file_size.c_str(), 1, S64_MAX, NULL ) ); ManifestEntry entry; entry.file_size = size; bool ok_sha = parse_sha256( &entry.checksum, matches[ 1 ] ); - if( matches[ 0 ].n > file_name.len() || matches[ 2 ].n > file_size.len() || size == 0 || !ok_sha ) { + if( matches[ 0 ].n > file_name.len() || matches[ 2 ].n > file_size.len() || matches[ 3 ].n > file_platform.len() || size == 0 || !ok_sha ) { manifest.clear(); return false; } + if( file_platform != "" && file_platform != PLATFORM_NAME ) { + continue; + } + manifest[ file_name.c_str() ] = entry; }