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
-2
View File
@@ -178,8 +178,6 @@ private:
float mSpacing; float mSpacing;
PIXEL_TYPE mColor; PIXEL_TYPE mColor;
int mBlend;
int mBase; int mBase;
}; };
+3 -7
View File
@@ -598,8 +598,6 @@ private:
GLint prog2_positionLoc; GLint prog2_positionLoc;
GLint prog2_texCoordLoc; GLint prog2_texCoordLoc;
GLint prog2_colorLoc; GLint prog2_colorLoc;
// MVP matrix
ESMatrix prog2_mvpMatrix;
// Uniform locations // Uniform locations
GLint prog2_mvpLoc; GLint prog2_mvpLoc;
@@ -612,13 +610,11 @@ private:
int mCurrentTextureFormat; int mCurrentTextureFormat;
#endif #endif
#ifdef PSP
bool mVsync; bool mVsync;
int mTexCounter;
#endif
int mSwizzle; int mSwizzle;
int mTexCounter;
int mCurrentTextureFilter; int mCurrentTextureFilter;
int mCurrTexBlendSrc; int mCurrTexBlendSrc;
+2
View File
@@ -258,7 +258,9 @@ private:
#endif #endif
int mVolume; int mVolume;
#ifndef IOS
int mMusicVolume; int mMusicVolume;
#endif
int mSampleVolume; int mSampleVolume;
+9 -10
View File
@@ -18,12 +18,11 @@ using namespace std;
#define MID_POINT_THRESHOLD 1.0f #define MID_POINT_THRESHOLD 1.0f
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/// Position of a single dot on screen. /// Position of a single dot on screen.
/// ///
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
class Point class JPoint
{ {
public: public:
@@ -34,13 +33,13 @@ public:
/// @param _y - Y position. /// @param _y - Y position.
/// ///
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
Point(float _x, float _y) { x = _x; y = _y; } JPoint(float _x, float _y) { x = _x; y = _y; }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/// Constructor, set position to default (0.0f, 0.0f) /// Constructor, set position to default (0.0f, 0.0f)
/// ///
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
Point() { x = 0.0f; y = 0.0f; } JPoint() { x = 0.0f; y = 0.0f; }
float x; ///< X position. float x; ///< X position.
float y; ///< Y position. float y; ///< Y position.
@@ -95,7 +94,7 @@ public:
/// @param pt - Control point. /// @param pt - Control point.
/// ///
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
void AddControlPoint(const Point &pt); void AddControlPoint(const JPoint &pt);
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/// Get a control point of the spline. /// Get a control point of the spline.
@@ -105,7 +104,7 @@ public:
/// @return Control point. /// @return Control point.
/// ///
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
void GetControlPoint(Point &point, int index); void GetControlPoint(JPoint &point, int index);
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/// Work out all pixels of the spline. /// Work out all pixels of the spline.
@@ -128,7 +127,7 @@ public:
/// @return Position of the desire point. /// @return Position of the desire point.
/// ///
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
void PointOnCurve(Point &out, float t, const Point &p0, const Point &p1, const Point &p2, const Point &p3); void PointOnCurve(JPoint &out, float t, const JPoint &p0, const JPoint &p1, const JPoint &p2, const JPoint &p3);
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/// Get a number of pixels for this spline. /// Get a number of pixels for this spline.
@@ -146,7 +145,7 @@ public:
/// @return Position of the desire point. /// @return Position of the desire point.
/// ///
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
void GetPixel(Point &point, int index); void GetPixel(JPoint &point, int index);
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/// Render the spline to screen. /// Render the spline to screen.
@@ -156,8 +155,8 @@ public:
private: private:
vector<Point> mMidPoints; vector<JPoint> mMidPoints;
vector<Point> mPixels; vector<JPoint> mPixels;
int mCount; int mCount;
}; };
+7 -1
View File
@@ -38,6 +38,12 @@ The content that users should not be touching.
#include <QDir> #include <QDir>
#endif #endif
/*
#ifdef IOS
#include <Foundation/Foundation.h>
#endif
*/
JFileSystem* JFileSystem::mInstance = NULL; JFileSystem* JFileSystem::mInstance = NULL;
JZipCache::JZipCache() JZipCache::JZipCache()
@@ -248,7 +254,7 @@ void JFileSystem::clearZipCache()
bool JFileSystem::AttachZipFile(const string &zipfile, char *password /* = NULL */) bool JFileSystem::AttachZipFile(const string &zipfile, char *password /* = NULL */)
{ {
if (mZipAvailable && mZipFile != NULL) if (mZipAvailable && mZipFile.is_open())
{ {
if (mZipFileName != zipfile) if (mZipFileName != zipfile)
DetachZipFile(); // close the previous zip file DetachZipFile(); // close the previous zip file
+7 -7
View File
@@ -71,7 +71,7 @@ bool JSpline::Load(const char *filename, float xscale, float yscale)
element->QueryFloatAttribute("x", &xx); element->QueryFloatAttribute("x", &xx);
element->QueryFloatAttribute("y", &yy); element->QueryFloatAttribute("y", &yy);
Point pt(xx*xscale, yy*yscale); JPoint pt(xx*xscale, yy*yscale);
AddControlPoint(pt); AddControlPoint(pt);
} }
@@ -84,7 +84,7 @@ bool JSpline::Load(const char *filename, float xscale, float yscale)
void JSpline::PointOnCurve(Point &out, float t, const Point &p0, const Point &p1, const Point &p2, const Point &p3) void JSpline::PointOnCurve(JPoint &out, float t, const JPoint &p0, const JPoint &p1, const JPoint &p2, const JPoint &p3)
{ {
float t2 = t * t; float t2 = t * t;
float t3 = t2 * t; float t3 = t2 * t;
@@ -113,8 +113,8 @@ void JSpline::GeneratePixels()
x = mMidPoints[1].x; x = mMidPoints[1].x;
y = mMidPoints[1].y; y = mMidPoints[1].y;
Point newPt(x, y); JPoint newPt(x, y);
Point extraPt; JPoint extraPt;
mPixels.push_back(newPt); mPixels.push_back(newPt);
@@ -151,13 +151,13 @@ void JSpline::GeneratePixels()
} }
void JSpline::AddControlPoint(const Point &pt) void JSpline::AddControlPoint(const JPoint &pt)
{ {
mMidPoints.push_back(pt); mMidPoints.push_back(pt);
} }
void JSpline::GetControlPoint(Point &point, int index) void JSpline::GetControlPoint(JPoint &point, int index)
{ {
if (index < (int)mMidPoints.size()) if (index < (int)mMidPoints.size())
{ {
@@ -167,7 +167,7 @@ void JSpline::GetControlPoint(Point &point, int index)
} }
void JSpline::GetPixel(Point &point, int index) void JSpline::GetPixel(JPoint &point, int index)
{ {
if (index < (int)mPixels.size()) if (index < (int)mPixels.size())
{ {
+1
View File
@@ -10,5 +10,6 @@ void resumeGame();
@property (nonatomic, retain) id eaglView; @property (nonatomic, retain) id eaglView;
@property (nonatomic, retain) UITextField *inputField; @property (nonatomic, retain) UITextField *inputField;
@property (nonatomic, assign) BOOL bannerIsVisible; @property (nonatomic, assign) BOOL bannerIsVisible;
- (void)toggleKeyboardWithState: (NSString *) initialText;
@end @end
+5 -5
View File
@@ -53,28 +53,28 @@
- (void)viewWillAppear:(BOOL)animated { - (void)viewWillAppear:(BOOL)animated {
NSLog(@"EAGL ViewController - view Will Appear"); NSLog(@"EAGL ViewController - view Will Appear");
[self.view resumeGame]; [(id)self.view resumeGame];
} }
- (void)viewWillDisappear:(BOOL)animated - (void)viewWillDisappear:(BOOL)animated
{ {
[self.view pauseGame]; [(id)self.view pauseGame];
} }
- (void)pauseGame - (void)pauseGame
{ {
[self.view pauseGame]; [(id)self.view pauseGame];
} }
- (void)resumeGame - (void)resumeGame
{ {
[self.view resumeGame]; [(id)self.view resumeGame];
} }
- (void)endGame - (void)endGame
{ {
[self.view endGame]; [(id)self.view endGame];
} }
- (void)viewDidAppear:(BOOL)animated { - (void)viewDidAppear:(BOOL)animated {
+1 -1
View File
@@ -337,7 +337,7 @@
- (void)applicationWillTerminate:(UIApplication *)application - (void)applicationWillTerminate:(UIApplication *)application
{ {
[self.glViewController.view destroyGame]; [(id)self.glViewController.view destroyGame];
} }
- (void)initializeKeyboard: (id) initialState - (void)initializeKeyboard: (id) initialState
+7 -7
View File
@@ -87,13 +87,13 @@ static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned lon
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */ # define ZCR_SEED2 3141592654UL /* use PI as default pattern */
# endif # endif
static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting) static int crypthead(
const char *passwd; /* password string */ const char *passwd, /* password string */
unsigned char *buf; /* where to write header */ unsigned char *buf, /* where to write header */
int bufSize; int bufSize,
unsigned long* pkeys; unsigned long* pkeys,
const unsigned long* pcrc_32_tab; const unsigned long* pcrc_32_tab,
unsigned long crcForCrypting; unsigned long crcForCrypting)
{ {
int n; /* index in random header */ int n; /* index in random header */
int t; /* temporary */ int t; /* temporary */
+30 -30
View File
@@ -65,10 +65,10 @@ int ZCALLBACK ferror_file_func OF((
voidpf stream)); voidpf stream));
voidpf ZCALLBACK fopen_file_func (opaque, filename, mode) voidpf ZCALLBACK fopen_file_func (
voidpf opaque; voidpf opaque,
const char* filename; const char* filename,
int mode; int mode)
{ {
FILE* file = NULL; FILE* file = NULL;
const char* mode_fopen = NULL; const char* mode_fopen = NULL;
@@ -87,11 +87,11 @@ voidpf ZCALLBACK fopen_file_func (opaque, filename, mode)
} }
uLong ZCALLBACK fread_file_func (opaque, stream, buf, size) uLong ZCALLBACK fread_file_func (
voidpf opaque; voidpf opaque,
voidpf stream; voidpf stream,
void* buf; void* buf,
uLong size; uLong size)
{ {
uLong ret; uLong ret;
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream); ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
@@ -99,31 +99,31 @@ uLong ZCALLBACK fread_file_func (opaque, stream, buf, size)
} }
uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size) uLong ZCALLBACK fwrite_file_func (
voidpf opaque; voidpf opaque,
voidpf stream; voidpf stream,
const void* buf; const void* buf,
uLong size; uLong size)
{ {
uLong ret; uLong ret;
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream); ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
return ret; return ret;
} }
long ZCALLBACK ftell_file_func (opaque, stream) long ZCALLBACK ftell_file_func (
voidpf opaque; voidpf opaque,
voidpf stream; voidpf stream)
{ {
long ret; long ret;
ret = ftell((FILE *)stream); ret = ftell((FILE *)stream);
return ret; return ret;
} }
long ZCALLBACK fseek_file_func (opaque, stream, offset, origin) long ZCALLBACK fseek_file_func (
voidpf opaque; voidpf opaque,
voidpf stream; voidpf stream,
uLong offset; uLong offset,
int origin; int origin)
{ {
int fseek_origin=0; int fseek_origin=0;
long ret; long ret;
@@ -145,26 +145,26 @@ long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
return ret; return ret;
} }
int ZCALLBACK fclose_file_func (opaque, stream) int ZCALLBACK fclose_file_func (
voidpf opaque; voidpf opaque,
voidpf stream; voidpf stream)
{ {
int ret; int ret;
ret = fclose((FILE *)stream); ret = fclose((FILE *)stream);
return ret; return ret;
} }
int ZCALLBACK ferror_file_func (opaque, stream) int ZCALLBACK ferror_file_func (
voidpf opaque; voidpf opaque,
voidpf stream; voidpf stream)
{ {
int ret; int ret;
ret = ferror((FILE *)stream); ret = ferror((FILE *)stream);
return ret; return ret;
} }
void fill_fopen_filefunc (pzlib_filefunc_def) void fill_fopen_filefunc (
zlib_filefunc_def* pzlib_filefunc_def; zlib_filefunc_def* pzlib_filefunc_def)
{ {
pzlib_filefunc_def->zopen_file = fopen_file_func; pzlib_filefunc_def->zopen_file = fopen_file_func;
pzlib_filefunc_def->zread_file = fread_file_func; pzlib_filefunc_def->zread_file = fread_file_func;
+73 -125
View File
@@ -168,10 +168,7 @@ local int unzlocal_getByte OF((
voidpf filestream, voidpf filestream,
int *pi)); int *pi));
local int unzlocal_getByte(pzlib_filefunc_def,filestream,pi) local int unzlocal_getByte(const zlib_filefunc_def* pzlib_filefunc_def,voidpf filestream,int *pi)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
int *pi;
{ {
unsigned char c; unsigned char c;
int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1); int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
@@ -198,10 +195,7 @@ local int unzlocal_getShort OF((
voidpf filestream, voidpf filestream,
uLong *pX)); uLong *pX));
local int unzlocal_getShort (pzlib_filefunc_def,filestream,pX) local int unzlocal_getShort (const zlib_filefunc_def* pzlib_filefunc_def,voidpf filestream,uLong *pX)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong *pX;
{ {
uLong x ; uLong x ;
int i; int i;
@@ -226,10 +220,7 @@ local int unzlocal_getLong OF((
voidpf filestream, voidpf filestream,
uLong *pX)); uLong *pX));
local int unzlocal_getLong (pzlib_filefunc_def,filestream,pX) local int unzlocal_getLong (const zlib_filefunc_def* pzlib_filefunc_def,voidpf filestream,uLong *pX)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong *pX;
{ {
uLong x ; uLong x ;
int i; int i;
@@ -259,9 +250,7 @@ local int unzlocal_getLong (pzlib_filefunc_def,filestream,pX)
/* My own strcmpi / strcasecmp */ /* My own strcmpi / strcasecmp */
local int strcmpcasenosensitive_internal (fileName1,fileName2) local int strcmpcasenosensitive_internal (const char* fileName1,const char* fileName2)
const char* fileName1;
const char* fileName2;
{ {
for (;;) for (;;)
{ {
@@ -302,10 +291,7 @@ local int strcmpcasenosensitive_internal (fileName1,fileName2)
(like 1 on Unix, 2 on Windows) (like 1 on Unix, 2 on Windows)
*/ */
extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity) extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,const char* fileName2,int iCaseSensitivity)
const char* fileName1;
const char* fileName2;
int iCaseSensitivity;
{ {
if (iCaseSensitivity==0) if (iCaseSensitivity==0)
iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE; iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
@@ -328,9 +314,7 @@ local uLong unzlocal_SearchCentralDir OF((
const zlib_filefunc_def* pzlib_filefunc_def, const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream)); voidpf filestream));
local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream) local uLong unzlocal_SearchCentralDir(const zlib_filefunc_def* pzlib_filefunc_def,voidpf filestream)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
{ {
unsigned char* buf; unsigned char* buf;
uLong uSizeFile; uLong uSizeFile;
@@ -394,9 +378,7 @@ local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
Else, the return value is a unzFile Handle, usable with other function Else, the return value is a unzFile Handle, usable with other function
of this unzip package. of this unzip package.
*/ */
extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def) extern unzFile ZEXPORT unzOpen2 (const char *path, zlib_filefunc_def* pzlib_filefunc_def)
const char *path;
zlib_filefunc_def* pzlib_filefunc_def;
{ {
unz_s us; unz_s us;
unz_s *s; unz_s *s;
@@ -497,8 +479,7 @@ extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def)
} }
extern unzFile ZEXPORT unzOpen (path) extern unzFile ZEXPORT unzOpen (const char *path)
const char *path;
{ {
return unzOpen2(path, NULL); return unzOpen2(path, NULL);
} }
@@ -508,8 +489,7 @@ extern unzFile ZEXPORT unzOpen (path)
If there is files inside the .Zip opened with unzipOpenCurrentFile (see later), If there is files inside the .Zip opened with unzipOpenCurrentFile (see later),
these files MUST be closed with unzipCloseCurrentFile before call unzipClose. these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
return UNZ_OK if there is no problem. */ return UNZ_OK if there is no problem. */
extern int ZEXPORT unzClose (file) extern int ZEXPORT unzClose (unzFile file)
unzFile file;
{ {
unz_s* s; unz_s* s;
if (file==NULL) if (file==NULL)
@@ -529,9 +509,7 @@ extern int ZEXPORT unzClose (file)
Write info about the ZipFile in the *pglobal_info structure. Write info about the ZipFile in the *pglobal_info structure.
No preparation of the structure is needed No preparation of the structure is needed
return UNZ_OK if there is no problem. */ return UNZ_OK if there is no problem. */
extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info) extern int ZEXPORT unzGetGlobalInfo (unzFile file,unz_global_info *pglobal_info)
unzFile file;
unz_global_info *pglobal_info;
{ {
unz_s* s; unz_s* s;
if (file==NULL) if (file==NULL)
@@ -545,9 +523,7 @@ extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info)
/* /*
Translate date/time from Dos format to tm_unz (readable more easilty) Translate date/time from Dos format to tm_unz (readable more easilty)
*/ */
local void unzlocal_DosDateToTmuDate (ulDosDate, ptm) local void unzlocal_DosDateToTmuDate (uLong ulDosDate, tm_unz* ptm)
uLong ulDosDate;
tm_unz* ptm;
{ {
uLong uDate; uLong uDate;
uDate = (uLong)(ulDosDate>>16); uDate = (uLong)(ulDosDate>>16);
@@ -574,21 +550,16 @@ local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file,
char *szComment, char *szComment,
uLong commentBufferSize)); uLong commentBufferSize));
local int unzlocal_GetCurrentFileInfoInternal (file, local int unzlocal_GetCurrentFileInfoInternal (
pfile_info, unzFile file,
pfile_info_internal, unz_file_info *pfile_info,
szFileName, fileNameBufferSize, unz_file_info_internal *pfile_info_internal,
extraField, extraFieldBufferSize, char *szFileName,
szComment, commentBufferSize) uLong fileNameBufferSize,
unzFile file; void *extraField,
unz_file_info *pfile_info; uLong extraFieldBufferSize,
unz_file_info_internal *pfile_info_internal; char *szComment,
char *szFileName; uLong commentBufferSize)
uLong fileNameBufferSize;
void *extraField;
uLong extraFieldBufferSize;
char *szComment;
uLong commentBufferSize;
{ {
unz_s* s; unz_s* s;
unz_file_info file_info; unz_file_info file_info;
@@ -746,19 +717,15 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
No preparation of the structure is needed No preparation of the structure is needed
return UNZ_OK if there is no problem. return UNZ_OK if there is no problem.
*/ */
extern int ZEXPORT unzGetCurrentFileInfo (file, extern int ZEXPORT unzGetCurrentFileInfo (
pfile_info, unzFile file,
szFileName, fileNameBufferSize, unz_file_info *pfile_info,
extraField, extraFieldBufferSize, char *szFileName,
szComment, commentBufferSize) uLong fileNameBufferSize,
unzFile file; void *extraField,
unz_file_info *pfile_info; uLong extraFieldBufferSize,
char *szFileName; char *szComment,
uLong fileNameBufferSize; uLong commentBufferSize)
void *extraField;
uLong extraFieldBufferSize;
char *szComment;
uLong commentBufferSize;
{ {
return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL, return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL,
szFileName,fileNameBufferSize, szFileName,fileNameBufferSize,
@@ -770,8 +737,7 @@ extern int ZEXPORT unzGetCurrentFileInfo (file,
Set the current file of the zipfile to the first file. Set the current file of the zipfile to the first file.
return UNZ_OK if there is no problem return UNZ_OK if there is no problem
*/ */
extern int ZEXPORT unzGoToFirstFile (file) extern int ZEXPORT unzGoToFirstFile (unzFile file)
unzFile file;
{ {
int err=UNZ_OK; int err=UNZ_OK;
unz_s* s; unz_s* s;
@@ -792,8 +758,7 @@ extern int ZEXPORT unzGoToFirstFile (file)
return UNZ_OK if there is no problem return UNZ_OK if there is no problem
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
*/ */
extern int ZEXPORT unzGoToNextFile (file) extern int ZEXPORT unzGoToNextFile (unzFile file)
unzFile file;
{ {
unz_s* s; unz_s* s;
int err; int err;
@@ -826,10 +791,7 @@ extern int ZEXPORT unzGoToNextFile (file)
UNZ_OK if the file is found. It becomes the current file. UNZ_OK if the file is found. It becomes the current file.
UNZ_END_OF_LIST_OF_FILE if the file is not found UNZ_END_OF_LIST_OF_FILE if the file is not found
*/ */
extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity) extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity)
unzFile file;
const char *szFileName;
int iCaseSensitivity;
{ {
unz_s* s; unz_s* s;
int err; int err;
@@ -905,9 +867,7 @@ typedef struct unz_file_pos_s
} unz_file_pos; } unz_file_pos;
*/ */
extern int ZEXPORT unzGetFilePos(file, file_pos) extern int ZEXPORT unzGetFilePos(unzFile file, unz_file_pos* file_pos)
unzFile file;
unz_file_pos* file_pos;
{ {
unz_s* s; unz_s* s;
@@ -923,9 +883,7 @@ extern int ZEXPORT unzGetFilePos(file, file_pos)
return UNZ_OK; return UNZ_OK;
} }
extern int ZEXPORT unzGoToFilePos(file, file_pos) extern int ZEXPORT unzGoToFilePos(unzFile file, unz_file_pos*file_pos)
unzFile file;
unz_file_pos* file_pos;
{ {
unz_s* s; unz_s* s;
int err; int err;
@@ -959,13 +917,11 @@ extern int ZEXPORT unzGoToFilePos(file, file_pos)
store in *piSizeVar the size of extra info in local header store in *piSizeVar the size of extra info in local header
(filename and size of extra field data) (filename and size of extra field data)
*/ */
local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, local int unzlocal_CheckCurrentFileCoherencyHeader (
poffset_local_extrafield, unz_s* s,
psize_local_extrafield) uInt* piSizeVar,
unz_s* s; uLong *poffset_local_extrafield,
uInt* piSizeVar; uInt *psize_local_extrafield)
uLong *poffset_local_extrafield;
uInt *psize_local_extrafield;
{ {
uLong uMagic,uData,uFlags; uLong uMagic,uData,uFlags;
uLong size_filename; uLong size_filename;
@@ -1050,12 +1006,12 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
Open for reading data the current file in the zipfile. Open for reading data the current file in the zipfile.
If there is no error and the file is opened, the return value is UNZ_OK. If there is no error and the file is opened, the return value is UNZ_OK.
*/ */
extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password) extern int ZEXPORT unzOpenCurrentFile3 (
unzFile file; unzFile file,
int* method; int* method,
int* level; int* level,
int raw; int raw,
const char* password; const char* password)
{ {
int err=UNZ_OK; int err=UNZ_OK;
uInt iSizeVar; uInt iSizeVar;
@@ -1136,7 +1092,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
pfile_in_zip_read_info->stream.zfree = (free_func)0; pfile_in_zip_read_info->stream.zfree = (free_func)0;
pfile_in_zip_read_info->stream.opaque = (voidpf)0; pfile_in_zip_read_info->stream.opaque = (voidpf)0;
pfile_in_zip_read_info->stream.next_in = (voidpf)0; pfile_in_zip_read_info->stream.next_in = (Bytef*)0;
pfile_in_zip_read_info->stream.avail_in = 0; pfile_in_zip_read_info->stream.avail_in = 0;
err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
@@ -1195,24 +1151,21 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
return UNZ_OK; return UNZ_OK;
} }
extern int ZEXPORT unzOpenCurrentFile (file) extern int ZEXPORT unzOpenCurrentFile (unzFile file)
unzFile file;
{ {
return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL); return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
} }
extern int ZEXPORT unzOpenCurrentFilePassword (file, password) extern int ZEXPORT unzOpenCurrentFilePassword (unzFile file, const char* password)
unzFile file;
const char* password;
{ {
return unzOpenCurrentFile3(file, NULL, NULL, 0, password); return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
} }
extern int ZEXPORT unzOpenCurrentFile2 (file,method,level,raw) extern int ZEXPORT unzOpenCurrentFile2 (
unzFile file; unzFile file,
int* method; int* method,
int* level; int* level,
int raw; int raw)
{ {
return unzOpenCurrentFile3(file, method, level, raw, NULL); return unzOpenCurrentFile3(file, method, level, raw, NULL);
} }
@@ -1227,10 +1180,10 @@ extern int ZEXPORT unzOpenCurrentFile2 (file,method,level,raw)
return <0 with error code if there is an error return <0 with error code if there is an error
(UNZ_ERRNO for IO error, or zLib error for uncompress error) (UNZ_ERRNO for IO error, or zLib error for uncompress error)
*/ */
extern int ZEXPORT unzReadCurrentFile (file, buf, len) extern int ZEXPORT unzReadCurrentFile(
unzFile file; unzFile file,
voidp buf; voidp buf,
unsigned len; unsigned len)
{ {
int err=UNZ_OK; int err=UNZ_OK;
uInt iRead = 0; uInt iRead = 0;
@@ -1388,8 +1341,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
/* /*
Give the current position in uncompressed data Give the current position in uncompressed data
*/ */
extern z_off_t ZEXPORT unztell (file) extern z_off_t ZEXPORT unztell (unzFile file)
unzFile file;
{ {
unz_s* s; unz_s* s;
file_in_zip_read_info_s* pfile_in_zip_read_info; file_in_zip_read_info_s* pfile_in_zip_read_info;
@@ -1408,8 +1360,7 @@ extern z_off_t ZEXPORT unztell (file)
/* /*
return 1 if the end of file was reached, 0 elsewhere return 1 if the end of file was reached, 0 elsewhere
*/ */
extern int ZEXPORT unzeof (file) extern int ZEXPORT unzeof (unzFile file)
unzFile file;
{ {
unz_s* s; unz_s* s;
file_in_zip_read_info_s* pfile_in_zip_read_info; file_in_zip_read_info_s* pfile_in_zip_read_info;
@@ -1441,10 +1392,10 @@ extern int ZEXPORT unzeof (file)
the return value is the number of bytes copied in buf, or (if <0) the return value is the number of bytes copied in buf, or (if <0)
the error code the error code
*/ */
extern int ZEXPORT unzGetLocalExtrafield (file,buf,len) extern int ZEXPORT unzGetLocalExtrafield (
unzFile file; unzFile file,
voidp buf; voidp buf,
unsigned len; unsigned len)
{ {
unz_s* s; unz_s* s;
file_in_zip_read_info_s* pfile_in_zip_read_info; file_in_zip_read_info_s* pfile_in_zip_read_info;
@@ -1492,8 +1443,7 @@ extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
Close the file in zip opened with unzipOpenCurrentFile Close the file in zip opened with unzipOpenCurrentFile
Return UNZ_CRCERROR if all the file was read but the CRC is not good Return UNZ_CRCERROR if all the file was read but the CRC is not good
*/ */
extern int ZEXPORT unzCloseCurrentFile (file) extern int ZEXPORT unzCloseCurrentFile (unzFile file)
unzFile file;
{ {
int err=UNZ_OK; int err=UNZ_OK;
@@ -1535,12 +1485,11 @@ extern int ZEXPORT unzCloseCurrentFile (file)
uSizeBuf is the size of the szComment buffer. uSizeBuf is the size of the szComment buffer.
return the number of byte copied or an error code <0 return the number of byte copied or an error code <0
*/ */
extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf) extern int ZEXPORT unzGetGlobalComment (
unzFile file; unzFile file,
char *szComment; char *szComment,
uLong uSizeBuf; uLong uSizeBuf)
{ {
int err=UNZ_OK;
unz_s* s; unz_s* s;
uLong uReadThis ; uLong uReadThis ;
if (file==NULL) if (file==NULL)
@@ -1567,8 +1516,7 @@ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
} }
/* Additions by RX '2004 */ /* Additions by RX '2004 */
extern uLong ZEXPORT unzGetOffset (file) extern uLong ZEXPORT unzGetOffset (unzFile file)
unzFile file;
{ {
unz_s* s; unz_s* s;
@@ -1583,9 +1531,9 @@ extern uLong ZEXPORT unzGetOffset (file)
return s->pos_in_central_dir; return s->pos_in_central_dir;
} }
extern int ZEXPORT unzSetOffset (file, pos) extern int ZEXPORT unzSetOffset (
unzFile file; unzFile file,
uLong pos; uLong pos)
{ {
unz_s* s; unz_s* s;
int err; int err;
+102 -114
View File
@@ -172,8 +172,7 @@ local linkedlist_datablock_internal* allocate_new_datablock()
return ldi; return ldi;
} }
local void free_datablock(ldi) local void free_datablock(linkedlist_datablock_internal* ldi)
linkedlist_datablock_internal* ldi;
{ {
while (ldi!=NULL) while (ldi!=NULL)
{ {
@@ -183,24 +182,24 @@ local void free_datablock(ldi)
} }
} }
local void init_linkedlist(ll) local void init_linkedlist(
linkedlist_data* ll; linkedlist_data* ll)
{ {
ll->first_block = ll->last_block = NULL; ll->first_block = ll->last_block = NULL;
} }
local void free_linkedlist(ll) local void free_linkedlist(
linkedlist_data* ll; linkedlist_data* ll)
{ {
free_datablock(ll->first_block); free_datablock(ll->first_block);
ll->first_block = ll->last_block = NULL; ll->first_block = ll->last_block = NULL;
} }
local int add_data_in_datablock(ll,buf,len) local int add_data_in_datablock(
linkedlist_data* ll; linkedlist_data* ll,
const void* buf; const void* buf,
uLong len; uLong len)
{ {
linkedlist_datablock_internal* ldi; linkedlist_datablock_internal* ldi;
const unsigned char* from_copy; const unsigned char* from_copy;
@@ -263,11 +262,11 @@ local int add_data_in_datablock(ll,buf,len)
local int ziplocal_putValue OF((const zlib_filefunc_def* pzlib_filefunc_def, local int ziplocal_putValue OF((const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream, uLong x, int nbByte)); voidpf filestream, uLong x, int nbByte));
local int ziplocal_putValue (pzlib_filefunc_def, filestream, x, nbByte) local int ziplocal_putValue (
const zlib_filefunc_def* pzlib_filefunc_def; const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream; voidpf filestream,
uLong x; uLong x,
int nbByte; int nbByte)
{ {
unsigned char buf[4]; unsigned char buf[4];
int n; int n;
@@ -291,10 +290,10 @@ local int ziplocal_putValue (pzlib_filefunc_def, filestream, x, nbByte)
} }
local void ziplocal_putValue_inmemory OF((void* dest, uLong x, int nbByte)); local void ziplocal_putValue_inmemory OF((void* dest, uLong x, int nbByte));
local void ziplocal_putValue_inmemory (dest, x, nbByte) local void ziplocal_putValue_inmemory (
void* dest; void* dest,
uLong x; uLong x,
int nbByte; int nbByte)
{ {
unsigned char* buf=(unsigned char*)dest; unsigned char* buf=(unsigned char*)dest;
int n; int n;
@@ -315,9 +314,9 @@ local void ziplocal_putValue_inmemory (dest, x, nbByte)
/****************************************************************************/ /****************************************************************************/
local uLong ziplocal_TmzDateToDosDate(ptm,dosDate) local uLong ziplocal_TmzDateToDosDate(
const tm_zip* ptm; const tm_zip* ptm,
uLong dosDate; uLong dosDate)
{ {
uLong year = (uLong)ptm->tm_year; uLong year = (uLong)ptm->tm_year;
if (year>1980) if (year>1980)
@@ -337,10 +336,10 @@ local int ziplocal_getByte OF((
voidpf filestream, voidpf filestream,
int *pi)); int *pi));
local int ziplocal_getByte(pzlib_filefunc_def,filestream,pi) local int ziplocal_getByte(
const zlib_filefunc_def* pzlib_filefunc_def; const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream; voidpf filestream,
int *pi; int *pi)
{ {
unsigned char c; unsigned char c;
int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1); int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
@@ -367,10 +366,10 @@ local int ziplocal_getShort OF((
voidpf filestream, voidpf filestream,
uLong *pX)); uLong *pX));
local int ziplocal_getShort (pzlib_filefunc_def,filestream,pX) local int ziplocal_getShort (
const zlib_filefunc_def* pzlib_filefunc_def; const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream; voidpf filestream,
uLong *pX; uLong *pX)
{ {
uLong x ; uLong x ;
int i; int i;
@@ -395,10 +394,10 @@ local int ziplocal_getLong OF((
voidpf filestream, voidpf filestream,
uLong *pX)); uLong *pX));
local int ziplocal_getLong (pzlib_filefunc_def,filestream,pX) local int ziplocal_getLong (
const zlib_filefunc_def* pzlib_filefunc_def; const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream; voidpf filestream,
uLong *pX; uLong *pX)
{ {
uLong x ; uLong x ;
int i; int i;
@@ -437,9 +436,9 @@ local uLong ziplocal_SearchCentralDir OF((
const zlib_filefunc_def* pzlib_filefunc_def, const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream)); voidpf filestream));
local uLong ziplocal_SearchCentralDir(pzlib_filefunc_def,filestream) local uLong ziplocal_SearchCentralDir(
const zlib_filefunc_def* pzlib_filefunc_def; const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream; voidpf filestream)
{ {
unsigned char* buf; unsigned char* buf;
uLong uSizeFile; uLong uSizeFile;
@@ -496,11 +495,11 @@ local uLong ziplocal_SearchCentralDir(pzlib_filefunc_def,filestream)
#endif /* !NO_ADDFILEINEXISTINGZIP*/ #endif /* !NO_ADDFILEINEXISTINGZIP*/
/************************************************************/ /************************************************************/
extern zipFile ZEXPORT zipOpen2 (pathname, append, globalcomment, pzlib_filefunc_def) extern zipFile ZEXPORT zipOpen2 (
const char *pathname; const char *pathname,
int append; int append,
zipcharpc* globalcomment; zipcharpc* globalcomment,
zlib_filefunc_def* pzlib_filefunc_def; zlib_filefunc_def* pzlib_filefunc_def)
{ {
zip_internal ziinit; zip_internal ziinit;
zip_internal* zi; zip_internal* zi;
@@ -615,7 +614,7 @@ extern zipFile ZEXPORT zipOpen2 (pathname, append, globalcomment, pzlib_filefunc
if (size_comment>0) if (size_comment>0)
{ {
ziinit.globalcomment = ALLOC(size_comment+1); ziinit.globalcomment = (char*)ALLOC(size_comment+1);
if (ziinit.globalcomment) if (ziinit.globalcomment)
{ {
size_comment = ZREAD(ziinit.z_filefunc, ziinit.filestream,ziinit.globalcomment,size_comment); size_comment = ZREAD(ziinit.z_filefunc, ziinit.filestream,ziinit.globalcomment,size_comment);
@@ -680,35 +679,30 @@ extern zipFile ZEXPORT zipOpen2 (pathname, append, globalcomment, pzlib_filefunc
} }
} }
extern zipFile ZEXPORT zipOpen (pathname, append) extern zipFile ZEXPORT zipOpen (
const char *pathname; const char *pathname,
int append; int append)
{ {
return zipOpen2(pathname,append,NULL,NULL); return zipOpen2(pathname,append,NULL,NULL);
} }
extern int ZEXPORT zipOpenNewFileInZip3 (file, filename, zipfi, extern int ZEXPORT zipOpenNewFileInZip3 (
extrafield_local, size_extrafield_local, zipFile file,
extrafield_global, size_extrafield_global, const char* filename,
comment, method, level, raw, const zip_fileinfo* zipfi,
windowBits, memLevel, strategy, const void* extrafield_local,
password, crcForCrypting) uInt size_extrafield_local,
zipFile file; const void* extrafield_global,
const char* filename; uInt size_extrafield_global,
const zip_fileinfo* zipfi; const char* comment,
const void* extrafield_local; int method,
uInt size_extrafield_local; int level,
const void* extrafield_global; int raw,
uInt size_extrafield_global; int windowBits,
const char* comment; int memLevel,
int method; int strategy,
int level; const char* password,
int raw; uLong crcForCrypting)
int windowBits;
int memLevel;
int strategy;
const char* password;
uLong crcForCrypting;
{ {
zip_internal* zi; zip_internal* zi;
uInt size_filename; uInt size_filename;
@@ -896,21 +890,18 @@ extern int ZEXPORT zipOpenNewFileInZip3 (file, filename, zipfi,
return err; return err;
} }
extern int ZEXPORT zipOpenNewFileInZip2(file, filename, zipfi, extern int ZEXPORT zipOpenNewFileInZip2(
extrafield_local, size_extrafield_local, zipFile file,
extrafield_global, size_extrafield_global, const char* filename,
comment, method, level, raw) const zip_fileinfo* zipfi,
zipFile file; const void* extrafield_local,
const char* filename; uInt size_extrafield_local,
const zip_fileinfo* zipfi; const void* extrafield_global,
const void* extrafield_local; uInt size_extrafield_global,
uInt size_extrafield_local; const char* comment,
const void* extrafield_global; int method,
uInt size_extrafield_global; int level,
const char* comment; int raw)
int method;
int level;
int raw;
{ {
return zipOpenNewFileInZip3 (file, filename, zipfi, return zipOpenNewFileInZip3 (file, filename, zipfi,
extrafield_local, size_extrafield_local, extrafield_local, size_extrafield_local,
@@ -920,20 +911,17 @@ extern int ZEXPORT zipOpenNewFileInZip2(file, filename, zipfi,
NULL, 0); NULL, 0);
} }
extern int ZEXPORT zipOpenNewFileInZip (file, filename, zipfi, extern int ZEXPORT zipOpenNewFileInZip (
extrafield_local, size_extrafield_local, zipFile file,
extrafield_global, size_extrafield_global, const char* filename,
comment, method, level) const zip_fileinfo* zipfi,
zipFile file; const void* extrafield_local,
const char* filename; uInt size_extrafield_local,
const zip_fileinfo* zipfi; const void* extrafield_global,
const void* extrafield_local; uInt size_extrafield_global,
uInt size_extrafield_local; const char* comment,
const void* extrafield_global; int method,
uInt size_extrafield_global; int level)
const char* comment;
int method;
int level;
{ {
return zipOpenNewFileInZip2 (file, filename, zipfi, return zipOpenNewFileInZip2 (file, filename, zipfi,
extrafield_local, size_extrafield_local, extrafield_local, size_extrafield_local,
@@ -941,8 +929,8 @@ extern int ZEXPORT zipOpenNewFileInZip (file, filename, zipfi,
comment, method, level, 0); comment, method, level, 0);
} }
local int zipFlushWriteBuffer(zi) local int zipFlushWriteBuffer(
zip_internal* zi; zip_internal* zi)
{ {
int err=ZIP_OK; int err=ZIP_OK;
@@ -963,10 +951,10 @@ local int zipFlushWriteBuffer(zi)
return err; return err;
} }
extern int ZEXPORT zipWriteInFileInZip (file, buf, len) extern int ZEXPORT zipWriteInFileInZip (
zipFile file; zipFile file,
const void* buf; const void* buf,
unsigned len; unsigned len)
{ {
zip_internal* zi; zip_internal* zi;
int err=ZIP_OK; int err=ZIP_OK;
@@ -978,9 +966,9 @@ extern int ZEXPORT zipWriteInFileInZip (file, buf, len)
if (zi->in_opened_file_inzip == 0) if (zi->in_opened_file_inzip == 0)
return ZIP_PARAMERROR; return ZIP_PARAMERROR;
zi->ci.stream.next_in = (void*)buf; zi->ci.stream.next_in = (Bytef*)buf;
zi->ci.stream.avail_in = len; zi->ci.stream.avail_in = len;
zi->ci.crc32 = crc32(zi->ci.crc32,buf,len); zi->ci.crc32 = crc32(zi->ci.crc32,(const Bytef*)buf,len);
while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0)) while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
{ {
@@ -1028,10 +1016,10 @@ extern int ZEXPORT zipWriteInFileInZip (file, buf, len)
return err; return err;
} }
extern int ZEXPORT zipCloseFileInZipRaw (file, uncompressed_size, crc32) extern int ZEXPORT zipCloseFileInZipRaw (
zipFile file; zipFile file,
uLong uncompressed_size; uLong uncompressed_size,
uLong crc32; uLong crc32)
{ {
zip_internal* zi; zip_internal* zi;
uLong compressed_size; uLong compressed_size;
@@ -1124,15 +1112,15 @@ extern int ZEXPORT zipCloseFileInZipRaw (file, uncompressed_size, crc32)
return err; return err;
} }
extern int ZEXPORT zipCloseFileInZip (file) extern int ZEXPORT zipCloseFileInZip (
zipFile file; zipFile file)
{ {
return zipCloseFileInZipRaw (file,0,0); return zipCloseFileInZipRaw (file,0,0);
} }
extern int ZEXPORT zipClose (file, global_comment) extern int ZEXPORT zipClose (
zipFile file; zipFile file,
const char* global_comment; const char* global_comment)
{ {
zip_internal* zi; zip_internal* zi;
int err = 0; int err = 0;
-1
View File
@@ -42,7 +42,6 @@ filesystem * filesystem::pCurrentFS = NULL;
std::vector<filesystem::pooledBuffer *> filesystem::m_Buffers; std::vector<filesystem::pooledBuffer *> filesystem::m_Buffers;
static const int STORED = 0; static const int STORED = 0;
static const int DEFLATED = 8;
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Construction/Destruction // Construction/Destruction
@@ -180,7 +180,7 @@ static void logNetworkStatus_(const char *name, int line, NetworkStatus status)
#define logNetworkStatus(status) #define logNetworkStatus(status)
#endif #endif
@interface Reachability (private) @interface Reachability ()
- (NetworkStatus) networkStatusForFlags: (SCNetworkReachabilityFlags) flags; - (NetworkStatus) networkStatusForFlags: (SCNetworkReachabilityFlags) flags;
+58 -57
View File
@@ -73,66 +73,67 @@ void* MyGetOpenALAudioData(CFURLRef inFileURL, ALsizei *outDataSize, ALenum *out
void* theData = NULL; void* theData = NULL;
AudioStreamBasicDescription theOutputFormat; AudioStreamBasicDescription theOutputFormat;
// Open a file with ExtAudioFileOpen() do {
err = ExtAudioFileOpenURL(inFileURL, &extRef); // Open a file with ExtAudioFileOpen()
if(err) { printf("MyGetOpenALAudioData: ExtAudioFileOpenURL FAILED, Error = %ld\n", err); goto Exit; } err = ExtAudioFileOpenURL(inFileURL, &extRef);
if(err) { printf("MyGetOpenALAudioData: ExtAudioFileOpenURL FAILED, Error = %ld\n", err); break; }
// 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;}
// Set the client format to 16 bit signed integer (native-endian) data // Get the audio data format
// Maintain the channel count and sample rate of the original source format err = ExtAudioFileGetProperty(extRef, kExtAudioFileProperty_FileDataFormat, &thePropertySize, &theFileFormat);
theOutputFormat.mSampleRate = theFileFormat.mSampleRate; if(err) { printf("MyGetOpenALAudioData: ExtAudioFileGetProperty(kExtAudioFileProperty_FileDataFormat) FAILED, Error = %ld\n", err); break; }
theOutputFormat.mChannelsPerFrame = theFileFormat.mChannelsPerFrame; if (theFileFormat.mChannelsPerFrame > 2) { printf("MyGetOpenALAudioData - Unsupported Format, channel count is greater than stereo\n"); break;}
theOutputFormat.mFormatID = kAudioFormatLinearPCM; // Set the client format to 16 bit signed integer (native-endian) data
theOutputFormat.mBytesPerPacket = 2 * theOutputFormat.mChannelsPerFrame; // Maintain the channel count and sample rate of the original source format
theOutputFormat.mFramesPerPacket = 1; theOutputFormat.mSampleRate = theFileFormat.mSampleRate;
theOutputFormat.mBytesPerFrame = 2 * theOutputFormat.mChannelsPerFrame; theOutputFormat.mChannelsPerFrame = theFileFormat.mChannelsPerFrame;
theOutputFormat.mBitsPerChannel = 16;
theOutputFormat.mFormatFlags = kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked | kAudioFormatFlagIsSignedInteger; 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 // Dispose the ExtAudioFileRef, it is no longer needed
if (extRef) ExtAudioFileDispose(extRef); if (extRef) ExtAudioFileDispose(extRef);
return theData; return theData;
+1 -3
View File
@@ -206,7 +206,7 @@ SYNTHESIZE_SINGLETON_FOR_CLASS(SoundManager);
ALenum format; ALenum format;
ALsizei size; ALsizei size;
ALsizei freq; ALsizei freq;
ALvoid *data; ALvoid *data = 0;
alError = AL_NO_ERROR; alError = AL_NO_ERROR;
NSBundle *bundle = [NSBundle mainBundle]; NSBundle *bundle = [NSBundle mainBundle];
@@ -780,8 +780,6 @@ SYNTHESIZE_SINGLETON_FOR_CLASS(SoundManager);
- (void)setActivated:(BOOL)aState { - (void)setActivated:(BOOL)aState {
OSStatus result;
if(aState) { if(aState) {
NSLog(@"INFO - SoundManager: OpenAL Active"); NSLog(@"INFO - SoundManager: OpenAL Active");
@@ -21,8 +21,6 @@
#define WAGIC_IOS_RESOURCE_NAME WAGIC_CORE_VERSION_STRING "_iOS.zip" #define WAGIC_IOS_RESOURCE_NAME WAGIC_CORE_VERSION_STRING "_iOS.zip"
static NSString *kDownloadUrlPath = @"http://wagic.googlecode.com/files/";
- (void) handleFailedDownload: (NSNotification *) sender - (void) handleFailedDownload: (NSNotification *) sender
{ {
NSString *downloadType = [sender object]; NSString *downloadType = [sender object];
@@ -103,6 +101,7 @@ static NSString *kDownloadUrlPath = @"http://wagic.googlecode.com/files/";
NSURL *url = nil; NSURL *url = nil;
NSString *downloadFilename = nil; NSString *downloadFilename = nil;
// determine which file to download // determine which file to download
kDownloadFileName = [NSString stringWithCString: WAGIC_RESOURCE_NAME encoding:NSUTF8StringEncoding]; kDownloadFileName = [NSString stringWithCString: WAGIC_RESOURCE_NAME encoding:NSUTF8StringEncoding];
kDownloadIosUpdateFileName = [NSString stringWithCString: WAGIC_IOS_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); 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]]; NSString *downloadFilePath = [systemResourceDirectory stringByAppendingString: [NSString stringWithFormat: @"/%@", downloadFilename]];
NSLog(@"Downloading %@", [url absoluteURL]); NSLog(@"Downloading %@", [url absoluteURL]);
@@ -573,7 +573,7 @@ static NSOperationQueue *sharedQueue = nil;
return; return;
} }
if ([self shouldStreamPostDataFromDisk]) { if ([self shouldStreamPostDataFromDisk]) {
[[self postBodyWriteStream] write:[data bytes] maxLength:[data length]]; [[self postBodyWriteStream] write:(const uint8_t *)[data bytes] maxLength:[data length]];
} else { } else {
[[self postBody] appendData:data]; [[self postBody] appendData:data];
} }
@@ -3367,7 +3367,7 @@ static NSOperationQueue *sharedQueue = nil;
[[self inflatedFileDownloadOutputStream] open]; [[self inflatedFileDownloadOutputStream] open];
} }
[[self inflatedFileDownloadOutputStream] write:[inflatedData bytes] maxLength:[inflatedData length]]; [[self inflatedFileDownloadOutputStream] write:(const uint8_t *)[inflatedData bytes] maxLength:[inflatedData length]];
} }
-2
View File
@@ -16,8 +16,6 @@
int AIPlayer::totalAIDecks = -1; 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) AIAction::AIAction(AIPlayer * owner, MTGCardInstance * c, MTGCardInstance * t)
: owner(owner), ability(NULL), player(NULL), click(c), target(t) : owner(owner), ability(NULL), player(NULL), click(c), target(t)
{ {
-3
View File
@@ -21,13 +21,10 @@ namespace DeckMenuConst
const float kDescriptionVerticalBoxPadding = -5; const float kDescriptionVerticalBoxPadding = -5;
const float kDescriptionHorizontalBoxPadding = 5; const float kDescriptionHorizontalBoxPadding = 5;
const float kDefaultFontScale = 1.0f;
const float kVerticalScrollSpeed = 7.0f; const float kVerticalScrollSpeed = 7.0f;
const int DETAILED_INFO_THRESHOLD = 20; const int DETAILED_INFO_THRESHOLD = 20;
const int kDetailedInfoButtonId = 10000; const int kDetailedInfoButtonId = 10000;
const PIXEL_TYPE kRedColor = ARGB(0xFF, 0xFF, 0x00, 0x00);
} }
hgeParticleSystem* DeckMenu::stars = NULL; hgeParticleSystem* DeckMenu::stars = NULL;
-3
View File
@@ -28,9 +28,6 @@
#include <time.h> #include <time.h>
#endif #endif
const float MENU_FONT_SCALE = 1.0f;
enum ENUM_DUEL_STATE enum ENUM_DUEL_STATE
{ {
DUEL_STATE_UNSET = 0, DUEL_STATE_UNSET = 0,
+4 -3
View File
@@ -355,10 +355,9 @@ void SimplePad::Render()
//This could use some cleaning up to make margins more explicit //This could use some cleaning up to make margins more explicit
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MENU_FONT); WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MENU_FONT);
float offX = 0, offY = 0; float offY = 0;
float kH = mFont->GetHeight(); float kH = mFont->GetHeight();
float hSpacing = mFont->GetStringWidth("W"); float hSpacing = mFont->GetStringWidth("W");
float rowLen = mFont->GetStringWidth("JKLMNOPQR") + 14 * 7;
float vSpacing = 0; float vSpacing = 0;
float kW = hSpacing; float kW = hSpacing;
@@ -401,7 +400,9 @@ void SimplePad::Render()
if (!bShowNumpad) vSpacing -= kH + 12; if (!bShowNumpad) vSpacing -= kH + 12;
#ifndef IOS #ifndef IOS
float offX = 0;
float rowLen = mFont->GetStringWidth("JKLMNOPQR") + 14 * 7;
for (int x = 0; x < nbitems; x++) for (int x = 0; x < nbitems; x++)
if (keys[x]) if (keys[x])
{ {
+2
View File
@@ -2308,8 +2308,10 @@ void WGuiKeyBinder::setData()
j->ResetInput(); 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, 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 }; 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)) #define C(o) (static_cast<OptionKey*>(o))
WGuiBase::CONFIRM_TYPE WGuiKeyBinder::needsConfirm() WGuiBase::CONFIRM_TYPE WGuiKeyBinder::needsConfirm()
+2
View File
@@ -11,8 +11,10 @@
#endif #endif
#include "WFont.h" #include "WFont.h"
#ifdef FORCE_LOW_CACHE_MEMORY
//#define FORCE_LOW_CACHE_MEMORY //#define FORCE_LOW_CACHE_MEMORY
const unsigned int kConstrainedCacheLimit = 8 * 1024 * 1024; const unsigned int kConstrainedCacheLimit = 8 * 1024 * 1024;
#endif
extern bool neofont; extern bool neofont;
int idCounter = OTHERS_OFFSET; int idCounter = OTHERS_OFFSET;