mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
another OS X patch from stopiccot
This commit is contained in:
parent
1807a8a536
commit
e023b7d6bc
@ -17,7 +17,7 @@ option(DISABLE_ERM "Disable compilation of ERM scripting module" ON)
|
||||
|
||||
if (APPLE)
|
||||
# Default location for thirdparty libs
|
||||
set(CMAKE_INCLUDE_PATH "../include ${CMAKE_OSX_SYSROOT}/usr/include")
|
||||
set(CMAKE_INCLUDE_PATH "../include" "${CMAKE_OSX_SYSROOT}/usr/include")
|
||||
set(CMAKE_LIBRARY_PATH "../lib")
|
||||
set(CMAKE_FRAMEWORK_PATH "../Frameworks")
|
||||
set(BOOST_ROOT "../")
|
||||
@ -155,6 +155,8 @@ if(WIN32)
|
||||
set(CPACK_GENERATOR ZIP) # just use zip? CPack has some GUI install as well
|
||||
elseif(APPLE)
|
||||
set(CPACK_GENERATOR DragNDrop)
|
||||
set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/osx/dmg_background.png")
|
||||
set(CPACK_DMG_DS_STORE "${CMAKE_SOURCE_DIR}/osx/dmg_DS_Store")
|
||||
else()
|
||||
set(CPACK_GENERATOR TGZ)
|
||||
endif()
|
||||
|
@ -67,6 +67,7 @@ elseif(APPLE)
|
||||
cp ${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)/libStupidAI.dylib ${BUNDLE_PATH}/MacOS/AI/libStupidAI.dylib &&
|
||||
cp ${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)/libEmptyAI.dylib ${BUNDLE_PATH}/MacOS/AI/libEmptyAI.dylib &&
|
||||
cp ${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)/libBattleAI.dylib ${BUNDLE_PATH}/MacOS/AI/libBattleAI.dylib &&
|
||||
cp -r ${CMAKE_HOME_DIRECTORY}/osx/vcmibuilder.app ${BUNDLE_PATH}/MacOS/vcmibuilder.app &&
|
||||
|
||||
# Copy frameworks
|
||||
cp -r ${CMAKE_HOME_DIRECTORY}/${CMAKE_FRAMEWORK_PATH} ${BUNDLE_PATH}/Frameworks &&
|
||||
|
Binary file not shown.
BIN
osx/dmg_DS_Store
Normal file
BIN
osx/dmg_DS_Store
Normal file
Binary file not shown.
BIN
osx/dmg_background.png
Normal file
BIN
osx/dmg_background.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 275 KiB |
BIN
osx/dmg_background.psd
Normal file
BIN
osx/dmg_background.psd
Normal file
Binary file not shown.
BIN
osx/osx-vcmibuilder/innoextract
Executable file
BIN
osx/osx-vcmibuilder/innoextract
Executable file
Binary file not shown.
@ -5,6 +5,8 @@
|
||||
NSString* outputDir;
|
||||
NSString* tempDir;
|
||||
NSString* dataDir;
|
||||
NSString* currentArchiveName;
|
||||
NSString* currentArchiveFilename;
|
||||
|
||||
NSMutableArray* actions;
|
||||
|
||||
@ -38,6 +40,8 @@
|
||||
|
||||
- (void)downloadWogArchive;
|
||||
- (void)unzipWogArchive;
|
||||
- (void)downloadVcmiArchive;
|
||||
- (void)unzipVcmiArchive;
|
||||
- (void)extractGameData;
|
||||
- (void)innoexctract;
|
||||
- (NSString*)attachDiskImage:(NSString*)path;
|
@ -23,37 +23,39 @@
|
||||
- (void)download:(NSURLDownload*)download didReceiveDataOfLength:(NSUInteger)length
|
||||
{
|
||||
self->bytesRecieved += length;
|
||||
[self showProgressText:[NSString stringWithFormat:@"Downloading WoG archive: %3.1f Mb / %3.1f Mb",
|
||||
[self showProgressText:[NSString stringWithFormat:@"Downloading %@ archive: %3.1f Mb / %3.1f Mb", self->currentArchiveName,
|
||||
self->bytesRecieved / 1024.0f / 1024.0f, self->bytesExpected / 1024.0f / 1024.0f]];
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload*)download decideDestinationWithSuggestedFilename:(NSString*)filename
|
||||
{
|
||||
[download setDestination:[tempDir stringByAppendingString:@"/wog.zip"] allowOverwrite:YES];
|
||||
[download setDestination:[tempDir stringByAppendingString:currentArchiveFilename] allowOverwrite:YES];
|
||||
}
|
||||
|
||||
- (void)downloadDidFinish:(NSURLDownload*)download
|
||||
{
|
||||
[self showProgressText:@"Downloading WoG archive: completed"];
|
||||
[self showProgressText:[NSString stringWithFormat:@"Downloading %@ archive: completed", self->currentArchiveName]];
|
||||
[self nextAction];
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload*)download didFailWithError:(NSError*)error
|
||||
{
|
||||
[self showProgressText:@"Downloading WoG archive: failed"];
|
||||
[self showProgressText:[NSString stringWithFormat:@"Downloading %@ archive: failed", self->currentArchiveName]];
|
||||
[self showErrorText:[error localizedDescription]];
|
||||
}
|
||||
|
||||
- (void)nextAction
|
||||
{
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
SEL sel = NSSelectorFromString(actions[0]);
|
||||
[actions removeObjectAtIndex:0];
|
||||
@try {
|
||||
[self performSelector:sel];
|
||||
}
|
||||
@catch (NSException* e) {
|
||||
[self showErrorText:[e name]];
|
||||
if ([actions count] > 0) {
|
||||
SEL sel = NSSelectorFromString(actions[0]);
|
||||
[actions removeObjectAtIndex:0];
|
||||
@try {
|
||||
[self performSelector:sel];
|
||||
}
|
||||
@catch (NSException* e) {
|
||||
[self showErrorText:[e name]];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -100,6 +102,8 @@
|
||||
// First of all we need to download WoG archive
|
||||
// Downloading should be done on main thread because of callbacks
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self->currentArchiveName = @"WoG";
|
||||
self->currentArchiveFilename = @"/wog.zip";
|
||||
NSURL* url = [NSURL URLWithString:@"http://download.vcmi.eu/WoG/wog.zip"];
|
||||
self.download = [[NSURLDownload alloc] initWithRequest:[NSURLRequest requestWithURL:url] delegate:self];
|
||||
});
|
||||
@ -109,13 +113,36 @@
|
||||
{
|
||||
// Then we unzip downloaded WoG archive
|
||||
[self showProgressText:@"Unzipping WoG archive"];
|
||||
if ([self runTask:@"/usr/bin/unzip" withArgs:@[@"-qo", [tempDir stringByAppendingString:@"/wog.zip"], @"-d", outputDir] withWorkingDir:nil withPipe:nil] != 0) {
|
||||
if ([self runTask:@"/usr/bin/unzip" withArgs:@[@"-qo", [tempDir stringByAppendingString:currentArchiveFilename], @"-d", outputDir] withWorkingDir:nil withPipe:nil] != 0) {
|
||||
return [self showErrorText:@"Failed to unzip WoG archive"];
|
||||
}
|
||||
|
||||
[self nextAction];
|
||||
}
|
||||
|
||||
- (void)downloadVcmiArchive
|
||||
{
|
||||
// Than we need to download VCMI archive
|
||||
// Downloading should be done on main thread because of callbacks
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self->currentArchiveName = @"VCMI";
|
||||
self->currentArchiveFilename = @"/core.zip";
|
||||
NSURL* url = [NSURL URLWithString:@"http://download.vcmi.eu/core.zip"];
|
||||
self.download = [[NSURLDownload alloc] initWithRequest:[NSURLRequest requestWithURL:url] delegate:self];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)unzipVcmiArchive
|
||||
{
|
||||
// Then we unzip downloaded VCMI archive
|
||||
[self showProgressText:@"Unzipping VCMI archive"];
|
||||
if ([self runTask:@"/usr/bin/unzip" withArgs:@[@"-qo", [tempDir stringByAppendingString:currentArchiveFilename], @"-d", outputDir, @"-x", @"*.json", @"*.txt", @"*.PAL"] withWorkingDir:nil withPipe:nil] != 0) {
|
||||
return [self showErrorText:@"Failed to unzip VCMI archive"];
|
||||
}
|
||||
|
||||
[self nextAction];
|
||||
}
|
||||
|
||||
- (void)extractGameData
|
||||
{
|
||||
// Then we extract game data from provided iso files using unshield or from innosetup exe
|
||||
@ -266,6 +293,8 @@
|
||||
@"validateAction",
|
||||
@"downloadWogArchive",
|
||||
@"unzipWogArchive",
|
||||
@"downloadVcmiArchive",
|
||||
@"unzipVcmiArchive",
|
||||
@"extractGameData",
|
||||
@"extractionCompleted",
|
||||
nil
|
Loading…
Reference in New Issue
Block a user