Compare commits

...

5 Commits

10 changed files with 162 additions and 33 deletions

View File

@ -58,6 +58,7 @@ stardotstar
Konstantinos Sykas (Getafix)
David Taylor (dajt)
Tichy
Jost Triller (tsoj)
Eric Walch
Michael Werle (Micha)
Gary Wong (Y A J)

View File

@ -10,6 +10,7 @@
| | [![Github release](https://img.shields.io/github/downloads/OoliteProject/Oolite/latest/oolite-1.90-test.linux-x86_64.tgz.svg)](https://github.com/OoliteProject/oolite/releases/latest) | |
| | [![Github release](https://img.shields.io/github/downloads/OoliteProject/Oolite/latest/oolite-1.90-test.linux-x86.tgz.svg)](https://github.com/OoliteProject/oolite/releases/latest) | |
![Oolite](http://oolite.org/images/gallery/large/another_commander-210210_LeavingCoriolisAgain.png)
Oolite for all platforms can be built from this repository. Here is a quick
guide to the source tree.
@ -46,15 +47,19 @@ For end-user documentation, see [oolite.org](http://www.oolite.org/) and
- **tools**: Various tools for preparing files, builds, releases etc.
## Building
On Mac OS X, you will need the latest version of Xcode from the App Store.
### Mac OS X
You will need the latest version of Xcode from the App Store.
Then double click on the Xcode project in the Finder, select one of the Oolite
targets from the Scheme pop-up, and hit Build and Run (the play button in the
toolbar).
For Windows, see the Oolite wiki:
### Windows
See the Oolite wiki:
http://wiki.alioth.net/index.php/Running_Oolite-Windows
On Linux, if you have the Debian package tools (installed by default with
### Linux
If you have the Debian package tools (installed by default with
Debian and Ubuntu), use dpkg-buildpackage.
On Linux, BSD and other Unix platforms without dpkg tools, you will need to
@ -65,14 +70,20 @@ distros, GNUstep and SDL development libraries come prepackaged - just
apt-get/yum install the relevant files. You may also need to install Mozilla
Spidermonkey (libmozjs). On others you may need to build them from source. In
particular, you need the SDL_Mixer library, which doesn't always come with the
base SDL development kit. Then just type `make`, or, if you're using GNU make,
`make -f Makefile`. On some systems, such as Gentoo, you may need to run
`make -f Makefile OBJCFLAGS=-fobjc-exceptions`.
base SDL development kit.
Then just type `make`, or, if you're using GNU make,
`make -f Makefile release`. On some systems, such as Gentoo, you may need to run
`make -f Makefile release OBJCFLAGS=-fobjc-exceptions`.
If you get errors like `make[1]: *** No rule to make target '/objc.make'. Stop.` it might help if you run `source /usr/share/GNUstep/Makefiles/GNUstep.sh` (the exact path to `GNUstep.sh` might differ).
If you have problems with missing textures you can try to delete `deps/Linux-deps/include/png.h` and `deps/Linux-deps/include/pngconf.h` before compiling.
Also remember to first fetch the various submodules, see [Git](#Git).
## Running
On OS X, you can run from Xcode by clicking on the appropriate icon
(or choosing 'Run' from the 'Product' menu).
On Linux/BSD/Unix, in a terminal, type `openapp oolite`
(or choosing 'Run' from the 'Product' menu).
On Linux/BSD/Unix, in a terminal, type `openapp oolite`, or if you compiled it yourself you can run it with `./oolite.app/oolite`.
## Git
The Oolite source is available from github.

View File

@ -1335,6 +1335,8 @@
"oolite-oxzmanager-install" = "Install expansion pack";
"oolite-oxzmanager-installed" = "List installed expansion packs";
"oolite-oxzmanager-remove" = "Remove expansion pack";
"oolite-oxzmanager-update-all" = "Update installed expansion packs";
"oolite-oxzmanager-firstrun" = "Before Oolite can install your requested expansions automatically, it needs to retrieve the expansions list. You will need to be connected to the internet for this to work. Use the 'Download expansions list' option when you are ready, or 'Return to Menu' if you do not have internet access now or would rather download and install expansions yourself.\n\nImportant: if you have old expansion packs installed in the OXP format, Oolite will not be able to automatically detect that they are the same pack as a new release. When downloading an expansion through this manager, you must first uninstall any old OXP versions of the same expansion to avoid problems.";
"oolite-oxzmanager-secondrun" = "Your expansion list may be out of date. Do you want to download the latest list now?\n\nIf you keep the old list, some installations may fail as the expansion pack is no longer available at that location or for that version. However, if you only want to uninstall expansion packs, you do not need to update the list.\n\nIf you need to update the list later, you can do this by selecting 'Update expansions list' from the menu.";
"oolite-oxzmanager-intro" = "Oolite can automatically install some expansions for you if you are connected to the internet. Use the 'Update expansions list' option to retrieve the latest expansions list, and the 'Install expansions' and 'Remove expansions' options to add and remove expansion packs.\n\nThere are also many more expansion packs not available through the automatic installer.\n\nImportant: if you have old expansion packs installed in the OXP format, Oolite will not be able to automatically detect that they are the same pack as a new release. When downloading an expansion through this manager, you must first uninstall any old OXP versions of the same expansion to avoid problems.\n\nIf an expansion pack requires other expansion packs to run, Oolite will automatically download those other expansion packs for you, if they are available.";

View File

@ -27,6 +27,10 @@ MA 02110-1301, USA.
#import "OOCocoa.h"
#include <stdint.h>
#if OOLITE_LINUX
#include <sys/sysinfo.h>
#endif
void OOCPUInfoInit(void);
@ -43,6 +47,13 @@ NSUInteger OOCPUCount(void);
#if (OOLITE_WINDOWS || OOLITE_LINUX)
NSString* OOCPUDescription(void);
void OOCPUID(int CPUInfo[4], int InfoType);
typedef struct
{
unsigned long long ooPhysicalMemory;
unsigned long long ooAvailableMemory;
} OOMemoryStatus;
OOMemoryStatus OOSystemMemoryStatus(void);
#endif

View File

@ -154,6 +154,33 @@ NSString* OOCPUDescription(void)
}
return [NSString stringWithCString:CPUBrandString];
}
OOMemoryStatus OOSystemMemoryStatus(void)
{
const unsigned int toMegabyte = 1024 * 1024;
OOMemoryStatus systemMemoryStatus;
memset(&systemMemoryStatus, 0, sizeof(systemMemoryStatus));
#if OOLITE_WINDOWS
MEMORYSTATUSEX memStatus;
memStatus.dwLength = sizeof(memStatus);
if(GlobalMemoryStatusEx(&memStatus))
{
// return memory size in MB
systemMemoryStatus.ooPhysicalMemory = memStatus.ullTotalPhys / toMegabyte;
systemMemoryStatus.ooAvailableMemory = memStatus.ullAvailPhys / toMegabyte;
}
#else
struct sysinfo si;
sysinfo(&si);
systemMemoryStatus.ooPhysicalMemory = (unsigned long long)(si.totalram / toMegabyte);
systemMemoryStatus.ooAvailableMemory = (unsigned long long)(si.freeram / toMegabyte);
#endif
return systemMemoryStatus;
}
#endif //(OOLITE_WINDOWS || OOLITE_LINUX)

View File

@ -348,7 +348,8 @@ static NSString *AdditionalLogHeaderInfo(void)
{
unsigned cpuCount = OOCPUCount();
NSString *cpuDescription = OOCPUDescription();
OOMemoryStatus systemMemoryStatus = OOSystemMemoryStatus();
return [NSString stringWithFormat:@"%@ %u processor%@ detected.", cpuDescription, cpuCount, cpuCount != 1 ? @"s" : @""];
return [NSString stringWithFormat:@"%@ %u processor%@ detected. System RAM: %llu MB (free: %llu MB).", cpuDescription, cpuCount, cpuCount != 1 ? @"s" : @"", systemMemoryStatus.ooPhysicalMemory, systemMemoryStatus.ooAvailableMemory];
}
#endif

View File

@ -93,13 +93,14 @@ enum {
OXZ_GUI_ROW_LISTSTART = 2,
OXZ_GUI_NUM_LISTROWS = 10,
OXZ_GUI_ROW_LISTNEXT = 12,
OXZ_GUI_ROW_LISTFILTER = 22,
OXZ_GUI_ROW_LISTSTATUS = 14,
OXZ_GUI_ROW_LISTDESC = 16,
OXZ_GUI_ROW_LISTINFO1 = 20,
OXZ_GUI_ROW_LISTINFO2 = 21,
OXZ_GUI_ROW_INSTALL = 23,
OXZ_GUI_ROW_INSTALLED = 24,
OXZ_GUI_ROW_LISTINFO1 = 19,
OXZ_GUI_ROW_LISTINFO2 = 20,
OXZ_GUI_ROW_LISTFILTER = 21,
OXZ_GUI_ROW_INSTALL = 22,
OXZ_GUI_ROW_INSTALLED = 23,
OXZ_GUI_ROW_UPDATE_ALL = 24,
OXZ_GUI_ROW_REMOVE = 25,
OXZ_GUI_ROW_PROCEED = 25,
OXZ_GUI_ROW_UPDATE = 26,
@ -147,6 +148,7 @@ static OOOXZManager *sSingleton = nil;
- (void) setProgressStatus:(NSString *)newStatus;
- (BOOL) installOXZ:(NSUInteger)item;
- (BOOL) updateAllOXZ;
- (BOOL) removeOXZ:(NSUInteger)item;
- (NSArray *) installOptions;
- (NSArray *) removeOptions;
@ -799,10 +801,11 @@ static OOOXZManager *sSingleton = nil;
foreach (requirement, tempStack)
{
OOLog(kOOOXZDebugLog,@"Dependency stack: checking %@",[requirement oo_stringForKey:kOOManifestRelationIdentifier]);
if (![ResourceManager manifest:downloadedManifest HasUnmetDependency:requirement logErrors:NO])
if (![ResourceManager manifest:downloadedManifest HasUnmetDependency:requirement logErrors:NO]
&& requires != nil && [requires containsObject:requirement])
{
// it was unmet, but now it's met
[progress appendFormat:DESC(@"oolite-oxzmanager-progress-now-has-@"),[requirement oo_stringForKey:kOOManifestRelationDescription defaultValue:[requirement oo_stringForKey:kOOManifestRelationIdentifier]]];
// it was unmet, but now it's met
[_dependencyStack removeObject:requirement];
OOLog(kOOOXZDebugLog, @"%@", @"Dependency stack: requirement met");
} else if ([[requirement oo_stringForKey:kOOManifestRelationIdentifier] isEqualToString:[downloadedManifest oo_stringForKey:kOOManifestIdentifier]]) {
@ -996,25 +999,27 @@ static OOOXZManager *sSingleton = nil;
{
return OXZ_INSTALLABLE_CONFLICTS;
}
if ([ResourceManager manifestHasMissingDependencies:manifest logErrors:NO])
if (installed != nil)
{
NSString *availableVersion = [manifest oo_stringForKey:kOOManifestAvailableVersion];
if (availableVersion == nil)
{
availableVersion = [manifest oo_stringForKey:kOOManifestVersion];
}
NSString *installedVersion = [installed oo_stringForKey:kOOManifestVersion];
OOLog(@"version.debug",@"%@ mv:%@ mav:%@",identifier,installedVersion,availableVersion);
if (CompareVersions(ComponentsFromVersionString(installedVersion),ComponentsFromVersionString(availableVersion)) == NSOrderedDescending)
{
// the installed copy is more recent than the server copy
return OXZ_UNINSTALLABLE_NOREMOTE;
}
return OXZ_INSTALLABLE_UPDATE;
}
if ([ResourceManager manifestHasMissingDependencies:manifest logErrors:NO])
{
return OXZ_INSTALLABLE_DEPENDENCIES;
}
else
{
if (installed != nil)
{
OOLog(@"version.debug",@"%@ mv:%@ mav:%@",identifier,[installed oo_stringForKey:kOOManifestVersion],[manifest oo_stringForKey:kOOManifestVersion]);
// if (CompareVersions(ComponentsFromVersionString([installed oo_stringForKey:kOOManifestVersion]),ComponentsFromVersionString([installed oo_stringForKey:kOOManifestAvailableVersion])) == NSOrderedDescending)
if (CompareVersions(ComponentsFromVersionString([installed oo_stringForKey:kOOManifestVersion]),ComponentsFromVersionString([manifest oo_stringForKey:kOOManifestVersion])) == NSOrderedDescending)
{
// the installed copy is more recent than the server copy
return OXZ_UNINSTALLABLE_NOREMOTE;
}
return OXZ_INSTALLABLE_UPDATE;
}
return OXZ_INSTALLABLE_OKAY;
}
return OXZ_INSTALLABLE_OKAY;
}
@ -1140,6 +1145,8 @@ static OOOXZManager *sSingleton = nil;
[gui setKey:@"_REMOVE" forRow:OXZ_GUI_ROW_REMOVE];
[gui setText:DESC(@"oolite-oxzmanager-update-list") forRow:OXZ_GUI_ROW_UPDATE align:GUI_ALIGN_CENTER];
[gui setKey:@"_UPDATE" forRow:OXZ_GUI_ROW_UPDATE];
[gui setText:DESC(@"oolite-oxzmanager-update-all") forRow:OXZ_GUI_ROW_UPDATE_ALL align:GUI_ALIGN_CENTER];
[gui setKey:@"_UPDATE_ALL" forRow:OXZ_GUI_ROW_UPDATE_ALL];
startRow = OXZ_GUI_ROW_INSTALL;
break;
@ -1408,6 +1415,11 @@ static OOOXZManager *sSingleton = nil;
_interfaceState = OXZ_STATE_PICK_REMOVE;
}
}
else if (selection == OXZ_GUI_ROW_UPDATE_ALL)
{
OOLog(kOOOXZDebugLog, @"Trying to update all managed OXPs");
[self updateAllOXZ];
}
else if (selection == OXZ_GUI_ROW_LISTPREV)
{
[self processOptionsPrev];
@ -1632,6 +1644,37 @@ static OOOXZManager *sSingleton = nil;
}
- (BOOL) updateAllOXZ
{
[_dependencyStack removeAllObjects];
_downloadAllDependencies = YES;
[self setFilteredList:_oxzList];
NSDictionary *manifest = nil;
foreach (manifest,_oxzList)
{
if ([self installableState:manifest] == OXZ_INSTALLABLE_UPDATE)
{
OOLog(kOOOXZDebugLog, @"Queuing in for update: %@", manifest);
[_dependencyStack addObject:manifest];
}
}
NSDictionary *first = [_dependencyStack anyObject];
NSString* identifier = [first oo_stringForKey:kOOManifestRelationIdentifier];
NSUInteger item = NSUIntegerMax;
NSDictionary *availableDownload = nil;
foreach (availableDownload, _oxzList)
{
if ([[availableDownload oo_stringForKey:kOOManifestIdentifier] isEqualToString:identifier])
{
item = [_oxzList indexOfObject:availableDownload];
break;
}
}
return [self installOXZ:item];
}
- (NSArray *) installOptions
{
NSUInteger start = _offset;

View File

@ -47,6 +47,7 @@ SOFTWARE.
+ (void) reload;
- (NSDictionary *) shipInfoForKey:(NSString *)key;
- (void) setShipInfoForKey:(NSString *)key with:(NSDictionary *)newShipData;
- (NSDictionary *) effectInfoForKey:(NSString *)key;
- (NSDictionary *) shipyardInfoForKey:(NSString *)key;
- (OOProbabilitySet *) probabilitySetForRole:(NSString *)role;

View File

@ -210,6 +210,15 @@ static NSString * const kVisualEffectDataCacheKey = @"visual effect data";
}
- (void) setShipInfoForKey:(NSString *)key with:(NSDictionary *)newShipData
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionaryWithDictionary:_shipData];
[mutableDict setObject:OODeepCopy(newShipData) forKey:key];
DESTROY(_shipData);
_shipData = [[NSDictionary dictionaryWithDictionary:mutableDict] retain];
}
- (NSDictionary *) effectInfoForKey:(NSString *)key
{
return [_effectData objectForKey:key];

View File

@ -151,6 +151,7 @@ static JSBool ShipStaticKeys(JSContext *context, uintN argc, jsval *vp);
static JSBool ShipStaticRoles(JSContext *context, uintN argc, jsval *vp);
static JSBool ShipStaticRoleIsInCategory(JSContext *context, uintN argc, jsval *vp);
static JSBool ShipStaticShipDataForKey(JSContext *context, uintN argc, jsval *vp);
static JSBool ShipStaticSetShipDataForKey(JSContext *context, uintN argc, jsval *vp);
static JSClass sShipClass =
{
@ -575,6 +576,7 @@ static JSFunctionSpec sShipStaticMethods[] =
{ "roleIsInCategory", ShipStaticRoleIsInCategory, 2 },
{ "roles", ShipStaticRoles, 0 },
{ "shipDataForKey", ShipStaticShipDataForKey, 1 },
{ "setShipDataForKey", ShipStaticSetShipDataForKey, 2 },
{ 0 }
};
@ -4352,7 +4354,28 @@ static JSBool ShipStaticShipDataForKey(JSContext *context, uintN argc, jsval *vp
}
else
{
OOJSReportBadArguments(context, @"Ship", @"shipDataForKey", MIN(argc, 1U), OOJS_ARGV, nil, @"ship role");
OOJSReportBadArguments(context, @"Ship", @"shipDataForKey", MIN(argc, 1U), OOJS_ARGV, nil, @"key");
return NO;
}
OOJS_NATIVE_EXIT
}
static JSBool ShipStaticSetShipDataForKey(JSContext *context, uintN argc, jsval *vp)
{
OOJS_NATIVE_ENTER(context);
OOShipRegistry *registry = [OOShipRegistry sharedRegistry];
if (argc >= 2)
{
NSString *key = OOStringFromJSValue(context, OOJS_ARGV[0]);
NSDictionary *newShipData = OOJSNativeObjectFromJSObject(context, JSVAL_TO_OBJECT(OOJS_ARGV[1]));
[registry setShipInfoForKey:key with:newShipData];
OOJS_RETURN_BOOL(YES);
}
else
{
OOJSReportBadArguments(context, @"Ship", @"setShipInfoForKey", MIN(argc, 2U), OOJS_ARGV, nil, @"key shipdata");
return NO;
}
OOJS_NATIVE_EXIT