Fixed cross-compiling with theos

This commit is contained in:
xawotihs
2015-08-23 21:23:55 +02:00
parent e2814c04f4
commit 907274f9bd
25 changed files with 320 additions and 387 deletions

View File

@@ -180,7 +180,7 @@ static void logNetworkStatus_(const char *name, int line, NetworkStatus status)
#define logNetworkStatus(status)
#endif
@interface Reachability (private)
@interface Reachability ()
- (NetworkStatus) networkStatusForFlags: (SCNetworkReachabilityFlags) flags;

View File

@@ -73,66 +73,67 @@ void* MyGetOpenALAudioData(CFURLRef inFileURL, ALsizei *outDataSize, ALenum *out
void* theData = NULL;
AudioStreamBasicDescription theOutputFormat;
// Open a file with ExtAudioFileOpen()
err = ExtAudioFileOpenURL(inFileURL, &extRef);
if(err) { printf("MyGetOpenALAudioData: ExtAudioFileOpenURL FAILED, Error = %ld\n", err); goto Exit; }
// Get the audio data format
err = ExtAudioFileGetProperty(extRef, kExtAudioFileProperty_FileDataFormat, &thePropertySize, &theFileFormat);
if(err) { printf("MyGetOpenALAudioData: ExtAudioFileGetProperty(kExtAudioFileProperty_FileDataFormat) FAILED, Error = %ld\n", err); goto Exit; }
if (theFileFormat.mChannelsPerFrame > 2) { printf("MyGetOpenALAudioData - Unsupported Format, channel count is greater than stereo\n"); goto Exit;}
do {
// Open a file with ExtAudioFileOpen()
err = ExtAudioFileOpenURL(inFileURL, &extRef);
if(err) { printf("MyGetOpenALAudioData: ExtAudioFileOpenURL FAILED, Error = %ld\n", err); break; }
// Set the client format to 16 bit signed integer (native-endian) data
// Maintain the channel count and sample rate of the original source format
theOutputFormat.mSampleRate = theFileFormat.mSampleRate;
theOutputFormat.mChannelsPerFrame = theFileFormat.mChannelsPerFrame;
// Get the audio data format
err = ExtAudioFileGetProperty(extRef, kExtAudioFileProperty_FileDataFormat, &thePropertySize, &theFileFormat);
if(err) { printf("MyGetOpenALAudioData: ExtAudioFileGetProperty(kExtAudioFileProperty_FileDataFormat) FAILED, Error = %ld\n", err); break; }
if (theFileFormat.mChannelsPerFrame > 2) { printf("MyGetOpenALAudioData - Unsupported Format, channel count is greater than stereo\n"); break;}
theOutputFormat.mFormatID = kAudioFormatLinearPCM;
theOutputFormat.mBytesPerPacket = 2 * theOutputFormat.mChannelsPerFrame;
theOutputFormat.mFramesPerPacket = 1;
theOutputFormat.mBytesPerFrame = 2 * theOutputFormat.mChannelsPerFrame;
theOutputFormat.mBitsPerChannel = 16;
theOutputFormat.mFormatFlags = kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked | kAudioFormatFlagIsSignedInteger;
// Set the client format to 16 bit signed integer (native-endian) data
// Maintain the channel count and sample rate of the original source format
theOutputFormat.mSampleRate = theFileFormat.mSampleRate;
theOutputFormat.mChannelsPerFrame = theFileFormat.mChannelsPerFrame;
theOutputFormat.mFormatID = kAudioFormatLinearPCM;
theOutputFormat.mBytesPerPacket = 2 * theOutputFormat.mChannelsPerFrame;
theOutputFormat.mFramesPerPacket = 1;
theOutputFormat.mBytesPerFrame = 2 * theOutputFormat.mChannelsPerFrame;
theOutputFormat.mBitsPerChannel = 16;
theOutputFormat.mFormatFlags = kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked | kAudioFormatFlagIsSignedInteger;
// Set the desired client (output) data format
err = ExtAudioFileSetProperty(extRef, kExtAudioFileProperty_ClientDataFormat, sizeof(theOutputFormat), &theOutputFormat);
if(err) { printf("MyGetOpenALAudioData: ExtAudioFileSetProperty(kExtAudioFileProperty_ClientDataFormat) FAILED, Error = %ld\n", err); break; }
// Get the total frame count
thePropertySize = sizeof(theFileLengthInFrames);
err = ExtAudioFileGetProperty(extRef, kExtAudioFileProperty_FileLengthFrames, &thePropertySize, &theFileLengthInFrames);
if(err) { printf("MyGetOpenALAudioData: ExtAudioFileGetProperty(kExtAudioFileProperty_FileLengthFrames) FAILED, Error = %ld\n", err); break; }
// Read all the data into memory
UInt32 dataSize = theFileLengthInFrames * theOutputFormat.mBytesPerFrame;;
theData = malloc(dataSize);
if (theData)
{
AudioBufferList theDataBuffer;
theDataBuffer.mNumberBuffers = 1;
theDataBuffer.mBuffers[0].mDataByteSize = dataSize;
theDataBuffer.mBuffers[0].mNumberChannels = theOutputFormat.mChannelsPerFrame;
theDataBuffer.mBuffers[0].mData = theData;
// Read the data into an AudioBufferList
err = ExtAudioFileRead(extRef, (UInt32*)&theFileLengthInFrames, &theDataBuffer);
if(err == noErr)
{
// success
*outDataSize = (ALsizei)dataSize;
*outDataFormat = (theOutputFormat.mChannelsPerFrame > 1) ? AL_FORMAT_STEREO16 : AL_FORMAT_MONO16;
*outSampleRate = (ALsizei)theOutputFormat.mSampleRate;
}
else
{
// failure
free (theData);
theData = NULL; // make sure to return NULL
printf("MyGetOpenALAudioData: ExtAudioFileRead FAILED, Error = %ld\n", err); break;
}
}
} while(0);
// Set the desired client (output) data format
err = ExtAudioFileSetProperty(extRef, kExtAudioFileProperty_ClientDataFormat, sizeof(theOutputFormat), &theOutputFormat);
if(err) { printf("MyGetOpenALAudioData: ExtAudioFileSetProperty(kExtAudioFileProperty_ClientDataFormat) FAILED, Error = %ld\n", err); goto Exit; }
// Get the total frame count
thePropertySize = sizeof(theFileLengthInFrames);
err = ExtAudioFileGetProperty(extRef, kExtAudioFileProperty_FileLengthFrames, &thePropertySize, &theFileLengthInFrames);
if(err) { printf("MyGetOpenALAudioData: ExtAudioFileGetProperty(kExtAudioFileProperty_FileLengthFrames) FAILED, Error = %ld\n", err); goto Exit; }
// Read all the data into memory
UInt32 dataSize = theFileLengthInFrames * theOutputFormat.mBytesPerFrame;;
theData = malloc(dataSize);
if (theData)
{
AudioBufferList theDataBuffer;
theDataBuffer.mNumberBuffers = 1;
theDataBuffer.mBuffers[0].mDataByteSize = dataSize;
theDataBuffer.mBuffers[0].mNumberChannels = theOutputFormat.mChannelsPerFrame;
theDataBuffer.mBuffers[0].mData = theData;
// Read the data into an AudioBufferList
err = ExtAudioFileRead(extRef, (UInt32*)&theFileLengthInFrames, &theDataBuffer);
if(err == noErr)
{
// success
*outDataSize = (ALsizei)dataSize;
*outDataFormat = (theOutputFormat.mChannelsPerFrame > 1) ? AL_FORMAT_STEREO16 : AL_FORMAT_MONO16;
*outSampleRate = (ALsizei)theOutputFormat.mSampleRate;
}
else
{
// failure
free (theData);
theData = NULL; // make sure to return NULL
printf("MyGetOpenALAudioData: ExtAudioFileRead FAILED, Error = %ld\n", err); goto Exit;
}
}
Exit:
// Dispose the ExtAudioFileRef, it is no longer needed
if (extRef) ExtAudioFileDispose(extRef);
return theData;

View File

@@ -206,7 +206,7 @@ SYNTHESIZE_SINGLETON_FOR_CLASS(SoundManager);
ALenum format;
ALsizei size;
ALsizei freq;
ALvoid *data;
ALvoid *data = 0;
alError = AL_NO_ERROR;
NSBundle *bundle = [NSBundle mainBundle];
@@ -780,8 +780,6 @@ SYNTHESIZE_SINGLETON_FOR_CLASS(SoundManager);
- (void)setActivated:(BOOL)aState {
OSStatus result;
if(aState) {
NSLog(@"INFO - SoundManager: OpenAL Active");

View File

@@ -21,8 +21,6 @@
#define WAGIC_IOS_RESOURCE_NAME WAGIC_CORE_VERSION_STRING "_iOS.zip"
static NSString *kDownloadUrlPath = @"http://wagic.googlecode.com/files/";
- (void) handleFailedDownload: (NSNotification *) sender
{
NSString *downloadType = [sender object];
@@ -103,6 +101,7 @@ static NSString *kDownloadUrlPath = @"http://wagic.googlecode.com/files/";
NSURL *url = nil;
NSString *downloadFilename = nil;
// determine which file to download
kDownloadFileName = [NSString stringWithCString: WAGIC_RESOURCE_NAME encoding:NSUTF8StringEncoding];
kDownloadIosUpdateFileName = [NSString stringWithCString: WAGIC_IOS_RESOURCE_NAME encoding:NSUTF8StringEncoding];
@@ -118,8 +117,9 @@ static NSString *kDownloadUrlPath = @"http://wagic.googlecode.com/files/";
{
NSLog( @"Not Implemented for type: %@", downloadType);
}
url = [NSURL URLWithString: [NSString stringWithCString: WAGIC_RESOURCE_URL encoding:NSUTF8StringEncoding]];
url = [NSURL URLWithString: [NSString stringWithFormat: @"%@/%@", kDownloadUrlPath, downloadFilename]];
NSString *downloadFilePath = [systemResourceDirectory stringByAppendingString: [NSString stringWithFormat: @"/%@", downloadFilename]];
NSLog(@"Downloading %@", [url absoluteURL]);

View File

@@ -573,7 +573,7 @@ static NSOperationQueue *sharedQueue = nil;
return;
}
if ([self shouldStreamPostDataFromDisk]) {
[[self postBodyWriteStream] write:[data bytes] maxLength:[data length]];
[[self postBodyWriteStream] write:(const uint8_t *)[data bytes] maxLength:[data length]];
} else {
[[self postBody] appendData:data];
}
@@ -3367,7 +3367,7 @@ static NSOperationQueue *sharedQueue = nil;
[[self inflatedFileDownloadOutputStream] open];
}
[[self inflatedFileDownloadOutputStream] write:[inflatedData bytes] maxLength:[inflatedData length]];
[[self inflatedFileDownloadOutputStream] write:(const uint8_t *)[inflatedData bytes] maxLength:[inflatedData length]];
}

View File

@@ -16,8 +16,6 @@
int AIPlayer::totalAIDecks = -1;
const char * const MTG_LAND_TEXTS[] = { "artifact", "forest", "island", "mountain", "swamp", "plains", "other lands" };
AIAction::AIAction(AIPlayer * owner, MTGCardInstance * c, MTGCardInstance * t)
: owner(owner), ability(NULL), player(NULL), click(c), target(t)
{

View File

@@ -21,13 +21,10 @@ namespace DeckMenuConst
const float kDescriptionVerticalBoxPadding = -5;
const float kDescriptionHorizontalBoxPadding = 5;
const float kDefaultFontScale = 1.0f;
const float kVerticalScrollSpeed = 7.0f;
const int DETAILED_INFO_THRESHOLD = 20;
const int kDetailedInfoButtonId = 10000;
const PIXEL_TYPE kRedColor = ARGB(0xFF, 0xFF, 0x00, 0x00);
}
hgeParticleSystem* DeckMenu::stars = NULL;

View File

@@ -28,9 +28,6 @@
#include <time.h>
#endif
const float MENU_FONT_SCALE = 1.0f;
enum ENUM_DUEL_STATE
{
DUEL_STATE_UNSET = 0,

View File

@@ -355,10 +355,9 @@ void SimplePad::Render()
//This could use some cleaning up to make margins more explicit
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MENU_FONT);
float offX = 0, offY = 0;
float offY = 0;
float kH = mFont->GetHeight();
float hSpacing = mFont->GetStringWidth("W");
float rowLen = mFont->GetStringWidth("JKLMNOPQR") + 14 * 7;
float vSpacing = 0;
float kW = hSpacing;
@@ -401,7 +400,9 @@ void SimplePad::Render()
if (!bShowNumpad) vSpacing -= kH + 12;
#ifndef IOS
float offX = 0;
float rowLen = mFont->GetStringWidth("JKLMNOPQR") + 14 * 7;
for (int x = 0; x < nbitems; x++)
if (keys[x])
{

View File

@@ -2308,8 +2308,10 @@ void WGuiKeyBinder::setData()
j->ResetInput();
}
#if (!defined IOS)
static const JButton btnToCheck[] = { JGE_BTN_MENU, JGE_BTN_CTRL, JGE_BTN_RIGHT, JGE_BTN_LEFT, JGE_BTN_UP, JGE_BTN_DOWN,
JGE_BTN_OK, JGE_BTN_CANCEL, JGE_BTN_PRI, JGE_BTN_SEC, JGE_BTN_PREV, JGE_BTN_NEXT };
#endif
#define C(o) (static_cast<OptionKey*>(o))
WGuiBase::CONFIRM_TYPE WGuiKeyBinder::needsConfirm()

View File

@@ -11,8 +11,10 @@
#endif
#include "WFont.h"
#ifdef FORCE_LOW_CACHE_MEMORY
//#define FORCE_LOW_CACHE_MEMORY
const unsigned int kConstrainedCacheLimit = 8 * 1024 * 1024;
#endif
extern bool neofont;
int idCounter = OTHERS_OFFSET;