12 Commits

Author SHA1 Message Date
xawotihs
ab34d0d366 Removed Werror to work around a bug in the PSP cross-compiler. 2015-08-29 20:31:56 +02:00
xawotihs
963ab2840b Should fix cross-compilation issue on PSP. 2015-08-29 19:23:07 +02:00
xawotihs
a25b010429 Merge branch 'master' into minmax 2015-08-28 23:48:54 +02:00
xawotihs
504160a740 Latest min-max branch 2015-08-25 23:29:58 +02:00
xawotihs
5061f7c37f Merge branch 'master' into minmax 2015-08-25 22:41:44 +02:00
xawotihs
165eb699e8 Fixed and activated redo in testsuite 2014-08-17 16:31:21 +02:00
xawotihs
33760f4066 Add minmax in Qt project, fixed small issue in later qtMultimedia code 2014-08-08 18:08:13 +02:00
xawotihs
656ab78cf5 Merge branch 'master' into minmax 2014-08-07 22:29:41 +02:00
xawotihs
541698f98e Merge branch 'master' into minmax 2014-01-24 23:49:30 +01:00
xawotihs
746a486e7a Added some comments for the redo tests. 2013-11-30 23:39:29 +01:00
xawotihs
261a6e4780 Merge branch 'master' into minmax 2013-11-30 23:10:24 +01:00
xawotihs
a683f5a2b7 Some preliminary work for minmax 2013-11-19 11:09:39 +01:00
1520 changed files with 198815 additions and 749593 deletions

View File

@@ -1,38 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View File

@@ -1,10 +0,0 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''
---

View File

@@ -1,20 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "docs/wiki"]
path = docs/wiki
url = https://github.com/WagicProject/wagic.wiki

View File

@@ -1,79 +1,60 @@
language: cpp
dist: xenial
branches:
only:
- master
except:
- latest-master
before_install:
- export BUILD_PSP=YES
- export BUILD_ANDROID=YES
- export BUILD_Qt=YES
- export BUILD_MAC=NO
- echo -e "machine github.com\n login $GH_TOKEN2" > ~/.netrc
- git lfs pull
# Only building on Mac when not handling pull request
# - if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
# export BUILD_MAC=YES;
# fi
- export BUILD_MAC=YES
- sudo apt-get update -qq
# Building for PSP here
- if [ "$BUILD_PSP" == "YES" ]; then
export PSPDEV="$TRAVIS_BUILD_DIR/opt/pspsdk" &&
export PSPSDK="$PSPDEV/psp/sdk" &&
export PATH="$PATH:$PSPDEV/bin:$PSPSDK/bin" &&
wget --no-check-certificate -O sdk.lzma http://downloads.sourceforge.net/project/minpspw/SDK%20%2B%20devpak/pspsdk%200.11.2/minpspw_0.11.2-amd64.tar.lzma;
fi
# Building for Qt here
- if [ "$BUILD_Qt" == "YES" ]; then
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu xenial universe" &&
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu xenial main" &&
sudo apt-get -qq update &&
sudo apt-get -qq install qt5-qmake qtbase5-dev qtdeclarative5-dev qttools5-dev qtmultimedia5-dev libqt5opengl5 libqt5opengl5-dev pulseaudio libpulse-dev &&
export QMAKE="qmake -qt=qt5";
wget -O sdk.lzma http://sourceforge.net/projects/minpspw/files/SDK%20%2B%20devpak/pspsdk%200.11.2/minpspw_0.11.2-amd64.tar.lzma/download;
fi
# Building for Android here
- if [ "$BUILD_ANDROID" == "YES" ]; then
export ANDROID="android-sdk-linux/tools/android" &&
if [ `uname -m` = x86_64 ]; then
sudo dpkg --add-architecture i386 && sudo apt-get update &&
sudo apt-get install -qq --force-yes libgd2-xpm-dev libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z1 jq ant; fi &&
wget https://dl.google.com/android/repository/android-ndk-r22-linux-x86_64.zip -nv &&
wget http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz -nv;
if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch jq; fi &&
wget http://dl.google.com/android/ndk/android-ndk-r9-linux-x86_64.tar.bz2 -nv &&
wget http://dl.google.com/android/android-sdk_r24.3.3-linux.tgz -nv;
fi
# Building for Qt here
- if [ "$BUILD_Qt" == "YES" ]; then
sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa &&
sudo apt-get update -qq &&
sudo apt-get install -qq qt5-qmake qtbase5-dev qtdeclarative5-dev qttools5-dev qtmultimedia5-dev pulseaudio libpulse-dev &&
export QMAKE="qmake -qt=qt5";
fi
install:
- if [ "$BUILD_PSP" == "YES" ]; then
tar -x --xz -f sdk.lzma;
fi
- if [ "$BUILD_ANDROID" == "YES" ]; then
unzip android-ndk-r22-linux-x86_64.zip &&
tar -zxf android-sdk_r24.4.1-linux.tgz &&
tar --absolute-names -jxf android-ndk-r9-linux-x86_64.tar.bz2 &&
tar -zxf android-sdk_r24.3.3-linux.tgz &&
$ANDROID list sdk --extended -a &&
echo yes | $ANDROID update sdk -a -t tools,platform-tools,build-tools-23.0.1,android-23 --no-ui --force --no-https;
sudo apt-get install openjdk-8-jdk;
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64;
export PATH=$JAVA_HOME/bin:$PATH;
echo yes | $ANDROID update sdk -a -t tools,platform-tools,build-tools-22.0.1,android-10 --no-ui --force --no-https;
fi
- sudo pip install pyjavaproperties
- sudo pip install github3.py
- sudo pip install cpp-coveralls
- curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
- sudo python2 get-pip.py
- sudo python2 -m pip install --upgrade pip
- sudo python2 -m pip install setuptools-rust
- sudo python2 -m pip install pyOpenSSL
- sudo python2 -m pip install pyjavaproperties
- sudo python2 -m pip install github3.py
- sudo python2 -m pip install cpp-coveralls
- sudo python2 -m pip install certifi
env:
global:
- secure: "EBzr1+qjQsOhn0s+tcFmXR1jP9B0xiOSXuXbRXWZ1OEHNvp8+A5/pS84LYVFlaZqmxr5dApxvPtwhgLIUbQ3EPXm8LpC3KgSD4dS+9/QMbxhe5TK4oczgFRGcDTMJQZsCzhOh7hp3tbcbJg5Gp+VT7aFjFQSHDGwhzSJXsXwh/8="
- secure: "X5dTQfofqAutnXxmu11Ep2MQ5QYnMN8m0AITRtwymhEF2UclcOudI1+skPtuhAGbWQnSO+lhunV3cvMfw2/Ml3k/VDz6VdFSKFrzAu7ja1VLJfcxr7chi0s8q30pVBb66tGydjIBac3B+RQyqgmZQW1frbRrhC/kPFQ6wPWOJdQ="
- secure: "T97NUPnxCpVZ/c5HH0zfo0FO3DPSRMSmze58ubW5EUTZOjAMtEt+OFdsrNZvUTCugUj2M1agtonZbAbczpaAL+lgZcHDgXgWMkfO0pMnsWX1yyCNqMuE/iTMpJr/xsLQeyWlftWjJLsseQU45abZsd1XVmda/G+ZhrDLF1y55SA="
before_script:
- export REQUESTS_CA_BUNDLE=/usr/local/lib/python2.7/dist-packages/certifi/cacert.pem
script: "tools/travis-script.sh"
after_success:
- coveralls -b . -e JGE/src -e JGE/include -i projects/mtg/include -i projects/mtg/src --gcov-options '\-lp'
- export VERSION=$(grep "=" projects/mtg/build.number.properties | sed 's/.*=//' | tr -d '\n\t\r ')
- python2 tools/upload-binaries.py -t $GH_TOKEN2 -s $TRAVIS_COMMIT -l core.zip -r Wagic-core-$VERSION.zip -b $TRAVIS_BRANCH
- python2 tools/upload-binaries.py -t $GH_TOKEN2 -s $TRAVIS_COMMIT -l projects/mtg/Android/bin/Wagic-debug.apk -r Wagic-$VERSION.apk -b $TRAVIS_BRANCH
- python2 tools/upload-binaries.py -t $GH_TOKEN2 -s $TRAVIS_COMMIT -l projects/mtg/psprelease.zip -r WagicPSP-$VERSION.zip -b $TRAVIS_BRANCH
- python2 tools/upload-binaries.py -t $GH_TOKEN2 -s $TRAVIS_COMMIT -l qt-gui-build/linuxqtrelease.zip -r WagicLinux-$VERSION.zip -b $TRAVIS_BRANCH
- python2 tools/upload-binaries.py -t $GH_TOKEN2 -s $TRAVIS_COMMIT -l projects/mtg/CardImageLinks.csv -r CardImageLinks.csv -b $TRAVIS_BRANCH
- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l core.zip -r Wagic-core.zip -b $TRAVIS_BRANCH
- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l projects/mtg/Android/bin/Wagic-debug.apk -r Wagic-android.apk -b $TRAVIS_BRANCH
- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l projects/mtg/psprelease.zip -r Wagic-psp.zip -b $TRAVIS_BRANCH

View File

@@ -29,30 +29,11 @@ public:
{
int r;
#if defined(__ARM_FEATURE_LSE)
// Use LSE atomic instructions if supported
#pragma message("LSE feature detected") // This will print a message in your build logs
__asm__ __volatile__(
"ldaxr %0, [%1];" // Load-Exclusive instruction
"cbnz %0, 1f;" // If the value is non-zero, the lock is already acquired
"stlxr %w0, %2, [%1];" // Store-Exclusive instruction
"cbnz %w0, 1f;" // If the store failed, retry
"mov %0, #0;" // Success, zero indicates lock acquired
"1:"
: "=&r"(r)
: "r"(&v_), "r"(1)
: "memory", "cc"
);
#else
// Fallback for systems that don't support LSE
#pragma message("LSE feature not detected") // This will print a message in your build logs if LSE is not detected
__asm__ __volatile__(
"swp %0, %1, [%2];" // Swap instruction (used as a fallback)
: "=&r"(r) // output constraint
: "r"(1), "r"(&v_) // input constraints
: "memory", "cc" // clobbered registers
);
#endif
"swp %0, %1, [%2]":
"=&r"( r ): // outputs
"r"( 1 ), "r"( &v_ ): // inputs
"memory", "cc" );
return r == 0;
}

View File

@@ -20,7 +20,7 @@ namespace boost {
enum xtime_clock_types
{
TIME_UTC_=1
TIME_UTC=1
// TIME_TAI,
// TIME_MONOTONIC,
// TIME_PROCESS,
@@ -68,7 +68,7 @@ inline xtime get_xtime(boost::system_time const& abs_time)
inline int xtime_get(struct xtime* xtp, int clock_type)
{
if (clock_type == TIME_UTC_)
if (clock_type == TIME_UTC)
{
*xtp=get_xtime(get_system_time());
return clock_type;

View File

@@ -350,7 +350,7 @@ namespace boost
cond.timed_wait(lock, xt);
# endif
xtime cur;
xtime_get(&cur, TIME_UTC_);
xtime_get(&cur, TIME_UTC);
if (xtime_cmp(xt, cur) <= 0)
return;
}
@@ -365,7 +365,7 @@ namespace boost
BOOST_VERIFY(!pthread_yield());
# else
xtime xt;
xtime_get(&xt, TIME_UTC_);
xtime_get(&xt, TIME_UTC);
sleep(xt);
# endif
}

View File

@@ -20,8 +20,8 @@ const int NANOSECONDS_PER_MICROSECOND = 1000;
inline void to_time(int milliseconds, boost::xtime& xt)
{
int res = 0;
res = boost::xtime_get(&xt, boost::TIME_UTC_);
BOOST_ASSERT(res == boost::TIME_UTC_);
res = boost::xtime_get(&xt, boost::TIME_UTC);
BOOST_ASSERT(res == boost::TIME_UTC);
xt.sec += (milliseconds / MILLISECONDS_PER_SECOND);
xt.nsec += ((milliseconds % MILLISECONDS_PER_SECOND) *
@@ -57,8 +57,8 @@ inline void to_timespec_duration(const boost::xtime& xt, timespec& ts)
{
boost::xtime cur;
int res = 0;
res = boost::xtime_get(&cur, boost::TIME_UTC_);
BOOST_ASSERT(res == boost::TIME_UTC_);
res = boost::xtime_get(&cur, boost::TIME_UTC);
BOOST_ASSERT(res == boost::TIME_UTC);
if (boost::xtime_cmp(xt, cur) <= 0)
{
@@ -88,8 +88,8 @@ inline void to_duration(boost::xtime xt, int& milliseconds)
{
boost::xtime cur;
int res = 0;
res = boost::xtime_get(&cur, boost::TIME_UTC_);
BOOST_ASSERT(res == boost::TIME_UTC_);
res = boost::xtime_get(&cur, boost::TIME_UTC);
BOOST_ASSERT(res == boost::TIME_UTC);
if (boost::xtime_cmp(xt, cur) <= 0)
milliseconds = 0;
@@ -110,8 +110,8 @@ inline void to_microduration(boost::xtime xt, int& microseconds)
{
boost::xtime cur;
int res = 0;
res = boost::xtime_get(&cur, boost::TIME_UTC_);
BOOST_ASSERT(res == boost::TIME_UTC_);
res = boost::xtime_get(&cur, boost::TIME_UTC);
BOOST_ASSERT(res == boost::TIME_UTC);
if (boost::xtime_cmp(xt, cur) <= 0)
microseconds = 0;

File diff suppressed because it is too large Load Diff

View File

@@ -14,11 +14,10 @@
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_stdinc.h"
#include "SDL_atomic.h"
@@ -31,7 +30,8 @@
#endif
/* This function is where all the magic happens... */
SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock)
SDL_bool
SDL_AtomicTryLock(SDL_SpinLock *lock)
{
#if SDL_ATOMIC_DISABLED
/* Terrible terrible damage */
@@ -77,35 +77,14 @@ SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock)
: "=&r" (result) : "r" (1), "r" (lock) : "cc", "memory");
return (result == 0);
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
int result;
__asm__ __volatile__(
"lock ; xchgl %0, (%1)\n"
: "=r" (result) : "r" (lock), "0" (1) : "cc", "memory");
return (result == 0);
#else
/* Fallback implementation using a standard mutex */
/* You can use SDL_mutex as a fallback if no atomic instructions are available */
static SDL_mutex *mutex;
if (!mutex) {
mutex = SDL_CreateMutex();
}
SDL_mutexP(mutex);
if (*lock == 0) {
*lock = 1;
SDL_mutexV(mutex);
return SDL_TRUE;
} else {
SDL_mutexV(mutex);
return SDL_FALSE;
}
/* Need CPU instructions for spinlock here! */
__need_spinlock_implementation__
#endif
}
void SDL_AtomicLock(SDL_SpinLock *lock)
void
SDL_AtomicLock(SDL_SpinLock *lock)
{
/* FIXME: Should we have an eventual timeout? */
while (!SDL_AtomicTryLock(lock)) {
@@ -113,7 +92,8 @@ void SDL_AtomicLock(SDL_SpinLock *lock)
}
}
void SDL_AtomicUnlock(SDL_SpinLock *lock)
void
SDL_AtomicUnlock(SDL_SpinLock *lock)
{
#if defined(_MSC_VER)
_ReadWriteBarrier();

Binary file not shown.

View File

@@ -1,10 +0,0 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -474,7 +474,7 @@
#ifndef PNG_VERSION_INFO_ONLY
/* include the compression library's header */
#include "../include/zlib.h"
#include "zlib.h"
#endif
/* include all user configurable info, including optional assembler routines */

View File

@@ -32,7 +32,6 @@ HGE_OBJS = src/hge/hgecolor.o src/hge/hgeparticle.o \
CXXFLAGS = -W -Wall -Werror -Wno-unused
CXXFLAGS += -DTIXML_USE_STL
CXXFLAGS += -Wno-deprecated-declarations -Wno-sign-compare
ifdef DEBUG
CXXFLAGS += -ggdb3
@@ -83,8 +82,8 @@ ifeq ($(TARGET_ARCHITECTURE),linux)
OBJS = $(GENERIC_OBJS) $(LINUX_OBJS)
TARGET_LIB = libjge.a
TARGET_HGE = libhgetools.a
INCDIR = $(shell freetype-config --cflags 2> /dev/null) -I/usr/X11/include -I/usr/include/boost -Isrc/zipFS -Iinclude/
CXXFLAGS += -DLINUX -DNETWORK_SUPPORT $(FMOD)
INCDIR = $(shell freetype-config --cflags 2> /dev/null) -I/usr/X11/include -I../Boost -Isrc/zipFS -Iinclude/
CXXFLAGS += -DLINUX $(FMOD)
CXXFLAGS += $(INCDIR)
LIBDIR = lib/linux
endif

View File

@@ -18,9 +18,9 @@ using namespace std;
template <class T>
std::string ToHex(T* pointer)
{
std::ostringstream stream;
stream << hex << showbase << setfill('0') << setw(8) << (uint64_t) pointer;
return stream.str();
std::ostringstream stream;
stream << hex << showbase << setfill('0') << setw(8) << (uint64_t) pointer;
return stream.str();
}
#ifdef LINUX
@@ -42,9 +42,9 @@ std::string ToHex(T* pointer)
#else // CAPTURE_STDERR
#define DebugTrace(inString) \
{ \
std::ostringstream stream; \
stream << inString; \
qDebug("%s", stream.str().c_str()); \
std::ostringstream stream; \
stream << inString; \
qDebug("%s", stream.str().c_str()); \
}
#endif // CAPTURE_STDERR
@@ -52,16 +52,16 @@ std::string ToHex(T* pointer)
#include <android/log.h>
#define DebugTrace(inString) \
{ \
std::ostringstream stream; \
stream << inString; \
__android_log_write(ANDROID_LOG_DEBUG, "Wagic", stream.str().c_str());\
std::ostringstream stream; \
stream << inString; \
__android_log_write(ANDROID_LOG_DEBUG, "Wagic", stream.str().c_str());\
}
#else
#define DebugTrace(inString) \
{ \
std::ostringstream stream; \
stream << inString << std::endl; \
OutputDebugStringA(stream.str().c_str()); \
OutputDebugStringA(stream.str().c_str()); \
}
#endif // QT_CONFIG
#endif // Win32, Linux
@@ -71,7 +71,7 @@ std::string ToHex(T* pointer)
#ifndef DebugTrace
#define DebugTrace(inString) \
{ \
std::cerr << inString << std::endl; \
std::cerr << inString << std::endl; \
}
#endif //DEBUG
#endif

View File

@@ -394,7 +394,6 @@ class JGE
void SetJNIEnv(JNIEnv * env, jclass cls);
void sendJNICommand(std::string command);
std::string getFileSystemLocation();
std::string getFileUserFolderPath();
#endif
protected:

View File

@@ -30,7 +30,6 @@ const int kInfoMenuID = -200;
const int kRandomPlayerMenuID = -11;
const int kRandomAIPlayerMenuID = -12;
const int kEvilTwinMenuID = -14;
const int kCommanderMenuID = -33;
class JGuiListener
{

View File

@@ -178,6 +178,8 @@ private:
float mSpacing;
PIXEL_TYPE mColor;
int mBlend;
int mBase;
};

View File

@@ -598,6 +598,8 @@ private:
GLint prog2_positionLoc;
GLint prog2_texCoordLoc;
GLint prog2_colorLoc;
// MVP matrix
ESMatrix prog2_mvpMatrix;
// Uniform locations
GLint prog2_mvpLoc;
@@ -610,11 +612,13 @@ private:
int mCurrentTextureFormat;
#endif
#ifdef PSP
bool mVsync;
int mTexCounter;
#endif
int mSwizzle;
int mTexCounter;
int mCurrentTextureFilter;
int mCurrTexBlendSrc;

View File

@@ -258,9 +258,7 @@ private:
#endif
int mVolume;
#ifndef IOS
int mMusicVolume;
#endif
int mSampleVolume;

View File

@@ -18,11 +18,12 @@ using namespace std;
#define MID_POINT_THRESHOLD 1.0f
//////////////////////////////////////////////////////////////////////////
/// Position of a single dot on screen.
///
//////////////////////////////////////////////////////////////////////////
class JPoint
class Point
{
public:
@@ -33,13 +34,13 @@ public:
/// @param _y - Y position.
///
//////////////////////////////////////////////////////////////////////////
JPoint(float _x, float _y) { x = _x; y = _y; }
Point(float _x, float _y) { x = _x; y = _y; }
//////////////////////////////////////////////////////////////////////////
/// Constructor, set position to default (0.0f, 0.0f)
///
//////////////////////////////////////////////////////////////////////////
JPoint() { x = 0.0f; y = 0.0f; }
Point() { x = 0.0f; y = 0.0f; }
float x; ///< X position.
float y; ///< Y position.
@@ -94,7 +95,7 @@ public:
/// @param pt - Control point.
///
//////////////////////////////////////////////////////////////////////////
void AddControlPoint(const JPoint &pt);
void AddControlPoint(const Point &pt);
//////////////////////////////////////////////////////////////////////////
/// Get a control point of the spline.
@@ -104,7 +105,7 @@ public:
/// @return Control point.
///
//////////////////////////////////////////////////////////////////////////
void GetControlPoint(JPoint &point, int index);
void GetControlPoint(Point &point, int index);
//////////////////////////////////////////////////////////////////////////
/// Work out all pixels of the spline.
@@ -127,7 +128,7 @@ public:
/// @return Position of the desire point.
///
//////////////////////////////////////////////////////////////////////////
void PointOnCurve(JPoint &out, float t, const JPoint &p0, const JPoint &p1, const JPoint &p2, const JPoint &p3);
void PointOnCurve(Point &out, float t, const Point &p0, const Point &p1, const Point &p2, const Point &p3);
//////////////////////////////////////////////////////////////////////////
/// Get a number of pixels for this spline.
@@ -145,7 +146,7 @@ public:
/// @return Position of the desire point.
///
//////////////////////////////////////////////////////////////////////////
void GetPixel(JPoint &point, int index);
void GetPixel(Point &point, int index);
//////////////////////////////////////////////////////////////////////////
/// Render the spline to screen.
@@ -155,8 +156,8 @@ public:
private:
vector<JPoint> mMidPoints;
vector<JPoint> mPixels;
vector<Point> mMidPoints;
vector<Point> mPixels;
int mCount;
};

View File

@@ -311,7 +311,9 @@ namespace boost
#include <QMutex>
#include <QThread>
#include <QSharedPointer>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include "../include/JLogger.h"
@@ -418,25 +420,23 @@ namespace boost
virtual void run() = 0;
};
typedef boost::shared_ptr<detail::thread_data_base> thread_data_ptr;
typedef QSharedPointer<detail::thread_data_base> thread_data_ptr;
template<typename F, typename A1>
template<typename F>
class thread_data : public detail::thread_data_base
{
public:
thread_data(F f_, A1 a1_) : f(f_), a1(a1_)
thread_data(F f_) : f(f_)
{
}
void run()
{
f(a1);
f();
}
private:
F f;
A1 a1;
void operator=(thread_data&);
thread_data(thread_data&);
@@ -493,7 +493,7 @@ namespace boost
}
template <class F,class A1>
thread(F f, A1 a1) : mThreadInfo(make_thread_info(f, a1))
thread(F f, A1 a1) : mThreadInfo(make_thread_info(boost::bind(boost::type<void>(), f, a1)))
{
mpThread = new threadImpl(mThreadInfo);
LOG("Calling start func");
@@ -510,10 +510,10 @@ namespace boost
}
private:
template<typename F, typename A1>
static inline detail::thread_data_ptr make_thread_info(F f, A1 a1)
template<typename F>
static inline detail::thread_data_ptr make_thread_info(F f)
{
return detail::thread_data_ptr(new detail::thread_data<F, A1>(f, a1));
return detail::thread_data_ptr(new detail::thread_data<F>(f));
}
detail::thread_data_ptr mThreadInfo;

Binary file not shown.

Binary file not shown.

View File

@@ -16,14 +16,9 @@ User folder is the only one that is really needed to guarantee both read and wri
The content that users should not be touching.
*/
#if defined (ANDROID)
#ifndef PSP
#include "PrecompiledHeader.h"
#endif //ANDROID
#if defined (LINUX)
#include "../../projects/mtg/include/PrecompiledHeader.h"
#endif //LINUX
#endif //PSP
#ifdef WIN32
#pragma warning(disable : 4786)
@@ -43,12 +38,6 @@ The content that users should not be touching.
#include <QDir>
#endif
/*
#ifdef IOS
#include <Foundation/Foundation.h>
#endif
*/
JFileSystem* JFileSystem::mInstance = NULL;
JZipCache::JZipCache()
@@ -131,11 +120,10 @@ JFileSystem::JFileSystem(const string & _userPath, const string & _systemPath)
systemPath = [[documentsDirectory stringByAppendingString: @"/Res/"] cStringUsingEncoding:1];
#elif defined (ANDROID)
userPath = JGE::GetInstance()->getFileUserFolderPath();
systemPath = JGE::GetInstance()->getFileSystemLocation();
userPath = JGE::GetInstance()->getFileSystemLocation();
systemPath = "";
DebugTrace("User path " << userPath);
DebugTrace("System path " << systemPath);
DebugTrace("User path " << userPath);
#elif defined (QT_CONFIG)
QDir sysDir(RESDIR);
@@ -260,7 +248,6 @@ void JFileSystem::clearZipCache()
bool JFileSystem::AttachZipFile(const string &zipfile, char *password /* = NULL */)
{
#ifndef WIN32
if (mZipAvailable && mZipFile.is_open())
{
if (mZipFileName != zipfile)
@@ -268,7 +255,7 @@ bool JFileSystem::AttachZipFile(const string &zipfile, char *password /* = NULL
else
return true;
}
#endif
mZipFileName = zipfile;
mPassword = password;

View File

@@ -249,7 +249,6 @@ u32 JGE::BindKey(LocalKeySym sym, JButton button)
u32 JGE::UnbindKey(LocalKeySym sym, JButton button)
{
for (keycodes_it it = keyBinds.begin(); it != keyBinds.end(); )
{
if (sym == it->first && button == it->second)
{
keycodes_it er = it;
@@ -257,8 +256,7 @@ u32 JGE::UnbindKey(LocalKeySym sym, JButton button)
keyBinds.erase(er);
}
else ++it;
}
return keyBinds.size();
return keyBinds.size();
}
u32 JGE::UnbindKey(LocalKeySym sym)
@@ -668,7 +666,7 @@ string JGE::getFileSystemLocation()
if (env == NULL)
{
DebugTrace("An Error Occurred in getting the JNI Environment whie trying to get the system folder location. Defaulting to /mnt/sdcard/net.wagic.app/Wagic");
return "/mnt/sdcard/Wagic/Res";
return "/mnt/sdcard/Wagic";
};
jclass jniClass = env->FindClass("org/libsdl/app/SDLActivity");
@@ -677,36 +675,7 @@ string JGE::getFileSystemLocation()
if (methodId == 0)
{
DebugTrace("An Error Occurred in getting the JNI methodID for getSystemFolderPath. Defaulting to /mnt/sdcard/Wagic");
return "/mnt/sdcard/Wagic/Res";
};
jstring systemPath = (jstring) env->CallStaticObjectMethod(jniClass, methodId);
// Now convert the Java String to C++ char array
const char* cstr = env->GetStringUTFChars(systemPath, 0);
string retVal (cstr);
env->ReleaseStringUTFChars(systemPath, cstr);
env->DeleteLocalRef(systemPath);
return retVal;
}
string JGE::getFileUserFolderPath()
{
JNIEnv * env = getJNIEnv();
if (env == NULL)
{
DebugTrace("An Error Occurred in getting the JNI Environment whie trying to get the system folder location. Defaulting to /mnt/sdcard/net.wagic.app/Wagic");
return "/mnt/sdcard/Wagic/User";
};
jclass jniClass = env->FindClass("org/libsdl/app/SDLActivity");
jmethodID methodId = env->GetStaticMethodID( jniClass, "getUserFolderPath", "()Ljava/lang/String;");
if (methodId == 0)
{
DebugTrace("An Error Occurred in getting the JNI methodID for getSystemFolderPath. Defaulting to /mnt/sdcard/Wagic");
return "/mnt/sdcard/Wagic/User";
return "/mnt/sdcard/Wagic";
};
jstring systemPath = (jstring) env->CallStaticObjectMethod(jniClass, methodId);

View File

@@ -197,7 +197,7 @@ bool JGuiController::CheckUserInput(JButton key)
mObjects[mCurr]->Entering();
}
mEngine->LeftClickedProcessed();
mEngine->ResetInput();
mEngine->ResetInput();
return true;
}
mEngine->LeftClickedProcessed();

View File

@@ -71,7 +71,7 @@ bool JSpline::Load(const char *filename, float xscale, float yscale)
element->QueryFloatAttribute("x", &xx);
element->QueryFloatAttribute("y", &yy);
JPoint pt(xx*xscale, yy*yscale);
Point pt(xx*xscale, yy*yscale);
AddControlPoint(pt);
}
@@ -84,7 +84,7 @@ bool JSpline::Load(const char *filename, float xscale, float yscale)
void JSpline::PointOnCurve(JPoint &out, float t, const JPoint &p0, const JPoint &p1, const JPoint &p2, const JPoint &p3)
void JSpline::PointOnCurve(Point &out, float t, const Point &p0, const Point &p1, const Point &p2, const Point &p3)
{
float t2 = t * t;
float t3 = t2 * t;
@@ -113,8 +113,8 @@ void JSpline::GeneratePixels()
x = mMidPoints[1].x;
y = mMidPoints[1].y;
JPoint newPt(x, y);
JPoint extraPt;
Point newPt(x, y);
Point extraPt;
mPixels.push_back(newPt);
@@ -151,13 +151,13 @@ void JSpline::GeneratePixels()
}
void JSpline::AddControlPoint(const JPoint &pt)
void JSpline::AddControlPoint(const Point &pt)
{
mMidPoints.push_back(pt);
}
void JSpline::GetControlPoint(JPoint &point, int index)
void JSpline::GetControlPoint(Point &point, int index)
{
if (index < (int)mMidPoints.size())
{
@@ -167,7 +167,7 @@ void JSpline::GetControlPoint(JPoint &point, int index)
}
void JSpline::GetPixel(JPoint &point, int index)
void JSpline::GetPixel(Point &point, int index)
{
if (index < (int)mPixels.size())
{

View File

@@ -87,6 +87,8 @@ WagicWrapper::~WagicWrapper()
int main(int argc, char* argv[])
{
QCoreApplication a(argc, argv);
int result = 0;
WagicWrapper* wagicCore = new WagicWrapper();
MTGCollection()->loadFolder("sets/primitives/");

View File

@@ -18,11 +18,6 @@
#include <stdexcept>
#include <iostream>
#include <math.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#if (defined FORCE_GLES)
#undef GL_ES_VERSION_2_0
@@ -58,7 +53,6 @@ JGameLauncher* g_launcher = NULL;
#ifdef ANDROID
JNIEnv * mJNIEnv = NULL;
jclass * mJNIClass = NULL;
int SDL_ResumeSyncTime = 0;
#endif
class SdlApp;
@@ -84,7 +78,6 @@ extern "C" void Java_org_libsdl_app_SDLActivity_nativeResume(
{
if (!g_engine)
return;
SDL_ResumeSyncTime = 100000;
g_engine->Resume();
}
@@ -143,16 +136,8 @@ public:
if(!g_engine->IsPaused())
OnEvent(&Event);
}
if(!g_engine->IsPaused()){
#ifdef ANDROID
// Fix for SDL crash on resuming Android app from background.
if(SDL_ResumeSyncTime){
usleep(SDL_ResumeSyncTime);
SDL_ResumeSyncTime = 0;
}
#endif
if(!g_engine->IsPaused())
OnUpdate();
}
}
}
@@ -308,18 +293,17 @@ static const struct { LocalKeySym keysym; JButton keycode; } gDefaultBindings[]
{ SDLK_DOWN, JGE_BTN_DOWN },
{ SDLK_LEFT, JGE_BTN_LEFT },
{ SDLK_RIGHT, JGE_BTN_RIGHT },
{ SDLK_w, JGE_BTN_UP },
{ SDLK_s, JGE_BTN_DOWN },
{ SDLK_a, JGE_BTN_LEFT },
{ SDLK_z, JGE_BTN_UP },
{ SDLK_d, JGE_BTN_RIGHT },
{ SDLK_q, JGE_BTN_PREV },
{ SDLK_s, JGE_BTN_DOWN },
{ SDLK_q, JGE_BTN_LEFT },
{ SDLK_a, JGE_BTN_PREV },
{ SDLK_e, JGE_BTN_NEXT },
{ SDLK_i, JGE_BTN_CANCEL },
{ SDLK_l, JGE_BTN_OK },
{ SDLK_SPACE, JGE_BTN_OK },
{ SDLK_k, JGE_BTN_SEC },
{ SDLK_j, JGE_BTN_PRI },
{ SDLK_b, JGE_BTN_SOUND },
{ SDLK_f, JGE_BTN_FULLSCREEN },
/* old Qt ones, basically modified to comply with the N900 keyboard

View File

@@ -185,9 +185,9 @@ static const int doubleBufferAttributes[] = {
GLX_RED_SIZE, 1, /* the maximum number of bits per component */
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
0L /* None */
None
};
static int WaitForNotify(Display *dpy, XEvent *event, XPointer arg)
static Bool WaitForNotify(Display *dpy, XEvent *event, XPointer arg)
{
return (event->type == MapNotify) && (event->xmap.window == (Window) arg);
}
@@ -387,13 +387,13 @@ int main(int argc, char* argv[])
if (XCheckWindowEvent(gXDisplay, gXWindow, KeyPressMask | KeyReleaseMask | StructureNotifyMask, &event))
switch (event.type)
{
case 2: /* KeyPress */
case KeyPress:
{
const KeySym sym = XKeycodeToKeysym(gXDisplay, event.xkey.keycode, 1);
g_engine->HoldKey_NoRepeat(sym);
}
break;
case 3: /* KeyRelease */
case KeyRelease:
g_engine->ReleaseKey(XKeycodeToKeysym(gXDisplay, event.xkey.keycode, 1));
break;
case ConfigureNotify:

View File

@@ -184,13 +184,7 @@ JMusic *JSoundSystem::LoadMusic(const char *fileName)
const SLboolean req[2] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE};
result = (*engineEngine)->CreateAudioPlayer(engineEngine, &music->playerObject, &audioSrc, &audioSnk, 2, ids, req);
DebugTrace("result " << result);
if(result == SL_RESULT_MEMORY_FAILURE){
delete music;
mCurrentMusic = NULL;
return NULL;
}
// realize the player
result = (*music->playerObject)->Realize(music->playerObject, SL_BOOLEAN_FALSE);
DebugTrace("result " << result);
@@ -309,12 +303,6 @@ JSample *JSoundSystem::LoadSample(const char *fileName)
1, ids, req);
DebugTrace("result " << result);
if(result == SL_RESULT_MEMORY_FAILURE){
delete sample;
mCurrentSample = NULL;
return NULL;
}
// realize the player
result = (*sample->playerObject)->Realize(sample->playerObject, SL_BOOLEAN_FALSE);
DebugTrace("result " << result);

View File

@@ -96,8 +96,7 @@ hgeParticleSystem::hgeParticleSystem(hgeParticleSystemInfo *psi)
{
//hge=hgeCreate(HGE_VERSION);
if (psi)
memcpy(&info, psi, sizeof(hgeParticleSystemInfo));
memcpy(&info, psi, sizeof(hgeParticleSystemInfo));
vecLocation.x=vecPrevLocation.x=0.0f;
vecLocation.y=vecPrevLocation.y=0.0f;

View File

@@ -10,6 +10,5 @@ void resumeGame();
@property (nonatomic, retain) id eaglView;
@property (nonatomic, retain) UITextField *inputField;
@property (nonatomic, assign) BOOL bannerIsVisible;
- (void)toggleKeyboardWithState: (NSString *) initialText;
@end

View File

@@ -53,28 +53,28 @@
- (void)viewWillAppear:(BOOL)animated {
NSLog(@"EAGL ViewController - view Will Appear");
[(id)self.view resumeGame];
[self.view resumeGame];
}
- (void)viewWillDisappear:(BOOL)animated
{
[(id)self.view pauseGame];
[self.view pauseGame];
}
- (void)pauseGame
{
[(id)self.view pauseGame];
[self.view pauseGame];
}
- (void)resumeGame
{
[(id)self.view resumeGame];
[self.view resumeGame];
}
- (void)endGame
{
[(id)self.view endGame];
[self.view endGame];
}
- (void)viewDidAppear:(BOOL)animated {

View File

@@ -337,7 +337,7 @@
- (void)applicationWillTerminate:(UIApplication *)application
{
[(id)self.glViewController.view destroyGame];
[self.glViewController.view destroyGame];
}
- (void)initializeKeyboard: (id) initialState

View File

@@ -1804,7 +1804,7 @@ static void PNGCustomReadDataFn(png_structp png_ptr, png_bytep data, png_size_t
{
png_size_t check;
JFileSystem *fileSystem = (JFileSystem*)png_get_io_ptr(png_ptr);
JFileSystem *fileSystem = (JFileSystem*)png_ptr->io_ptr;
check = fileSystem->ReadFile(data, length);
@@ -1887,7 +1887,7 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char *filename, int mode
//fclose(fp);
fileSystem->CloseFile();
png_destroy_read_struct(&png_ptr, NULL, NULL);
png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
return JGE_ERR_PNG;
}
@@ -1896,15 +1896,11 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char *filename, int mode
png_set_sig_bytes(png_ptr, sig_read);
png_read_info(png_ptr, info_ptr);
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL);
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, int_p_NULL, int_p_NULL);
png_set_strip_16(png_ptr);
png_set_packing(png_ptr);
if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png_ptr);
#if PNG_LIBPNG_VER >= 10400
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr);
#else
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_gray_1_2_4_to_8(png_ptr);
#endif
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr);
png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
@@ -1914,7 +1910,7 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char *filename, int mode
//fclose(fp);
fileSystem->CloseFile();
png_destroy_read_struct(&png_ptr, NULL, NULL);
png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
return JGE_ERR_MALLOC_FAILED;
}
@@ -1936,7 +1932,7 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char *filename, int mode
for (y = 0; y < (int)height; y++)
{
png_read_row(png_ptr, (BYTE*) line, NULL);
png_read_row(png_ptr, (BYTE*) line, png_bytep_NULL);
for (x = 0; x < (int)width; x++)
{
DWORD color32 = line[x];
@@ -1959,7 +1955,7 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char *filename, int mode
free (line);
png_read_end(png_ptr, info_ptr);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
fileSystem->CloseFile();
@@ -2002,15 +1998,8 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
GifFileType *GifFileIn = NULL;
ColorMapObject *palette;
int ExtCode;
#if GIFLIB_MAJOR >= 5
if ((GifFileIn = DGifOpen(handle, readFunc, NULL)) == NULL)
return 1;
#else
if ((GifFileIn = DGifOpen(handle, readFunc)) == NULL)
return 1;
#endif
*bgcolor = 0;
textureInfo.mWidth = 0;
textureInfo.mHeight = 0;
@@ -2019,11 +2008,7 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
do {
if (DGifGetRecordType(GifFileIn, &RecordType) == GIF_ERROR)
{
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn);
#endif
return 1;
}
@@ -2032,20 +2017,12 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
{
if (DGifGetImageDesc(GifFileIn) == GIF_ERROR)
{
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn);
#endif
return 1;
}
if((palette = (GifFileIn->SColorMap != NULL) ? GifFileIn->SColorMap : GifFileIn->Image.ColorMap) == NULL)
{
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn);
#endif
return 1;
}
textureInfo.mWidth = GifFileIn->Image.Width;
@@ -2053,11 +2030,7 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
*bgcolor = gif_color32(GifFileIn->SBackGroundColor);
if((LineIn = (GifRowType) malloc(GifFileIn->Image.Width * sizeof(GifPixelType))) == NULL)
{
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn);
#endif
return 1;
}
textureInfo.mTexWidth = getNextPower2(GifFileIn->Image.Width);
@@ -2067,11 +2040,7 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
if((p32 = (DWORD *)malloc(sizeof(PIXEL_TYPE) * textureInfo.mTexWidth * textureInfo.mTexHeight)) == NULL)
{
free((void *)LineIn);
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn);
#endif
return 1;
}
DWORD * curr = p32;
@@ -2083,11 +2052,7 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
{
free((void *)p32);
free((void *)LineIn);
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn);
#endif
return 1;
}
for (GifWord j = 0; j < GifFileIn->Image.Width; j ++)
@@ -2116,11 +2081,7 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
}
if(LineIn != NULL)
free((void *)LineIn);
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn);
#endif
return 1;
}
while (Extension != NULL) {
@@ -2133,11 +2094,7 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
}
if(LineIn != NULL)
free((void *)LineIn);
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn);
#endif
return 1;
}
}
@@ -2152,11 +2109,7 @@ int JRenderer::image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bg
if(LineIn != NULL)
free((void *)LineIn);
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GifFileIn, NULL);
#else
DGifCloseFile(GifFileIn);
#endif
return 0;
}

View File

@@ -67,7 +67,9 @@ void JMusic::seekAtTheBegining()
//////////////////////////////////////////////////////////////////////////
JSample::JSample()
#ifdef USE_PHONON
#ifdef QT_CONFIG
: effect(0)
#elif (defined USE_PHONON)
: mOutput(0), mMediaObject(0)
#endif
{
@@ -77,9 +79,11 @@ JSample::JSample()
JSample::~JSample()
{
#if (defined QT_CONFIG) && (!defined USE_PHONON)
if(effect)
if(effect) {
delete effect;
#elif USE_PHONON
effect = 0;
}
#elif (defined USE_PHONON)
if(mOutput)
delete mOutput;
if(mMediaObject)

View File

@@ -7,7 +7,6 @@
#include <winsock.h>
#include <fcntl.h>
#elif LINUX
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -48,9 +47,7 @@ JSocket::JSocket(string ipAddr)
#ifdef WIN32
unsigned int addr_dest = inet_addr(ipAddr.c_str());
hostentptr = gethostbyaddr((char*) &addr_dest, 4, AF_INET);
if (hostentptr == NULL)
hostentptr = gethostbyname(ipAddr.c_str()); // Fix for Windows if IP Address cannot be resolved.
hostentptr=gethostbyaddr((char*) &addr_dest, 4, AF_INET);
#elif LINUX
hostentptr = gethostbyname(ipAddr.c_str());
#endif

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 */
# endif
static int crypthead(
const char *passwd, /* password string */
unsigned char *buf, /* where to write header */
int bufSize,
unsigned long* pkeys,
const unsigned long* pcrc_32_tab,
unsigned long crcForCrypting)
static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting)
const char *passwd; /* password string */
unsigned char *buf; /* where to write header */
int bufSize;
unsigned long* pkeys;
const unsigned long* pcrc_32_tab;
unsigned long crcForCrypting;
{
int n; /* index in random header */
int t; /* temporary */

View File

@@ -65,10 +65,10 @@ int ZCALLBACK ferror_file_func OF((
voidpf stream));
voidpf ZCALLBACK fopen_file_func (
voidpf opaque,
const char* filename,
int mode)
voidpf ZCALLBACK fopen_file_func (opaque, filename, mode)
voidpf opaque;
const char* filename;
int mode;
{
FILE* file = NULL;
const char* mode_fopen = NULL;
@@ -87,11 +87,11 @@ voidpf ZCALLBACK fopen_file_func (
}
uLong ZCALLBACK fread_file_func (
voidpf opaque,
voidpf stream,
void* buf,
uLong size)
uLong ZCALLBACK fread_file_func (opaque, stream, buf, size)
voidpf opaque;
voidpf stream;
void* buf;
uLong size;
{
uLong ret;
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
@@ -99,31 +99,31 @@ uLong ZCALLBACK fread_file_func (
}
uLong ZCALLBACK fwrite_file_func (
voidpf opaque,
voidpf stream,
const void* buf,
uLong size)
uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size)
voidpf opaque;
voidpf stream;
const void* buf;
uLong size;
{
uLong ret;
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
return ret;
}
long ZCALLBACK ftell_file_func (
voidpf opaque,
voidpf stream)
long ZCALLBACK ftell_file_func (opaque, stream)
voidpf opaque;
voidpf stream;
{
long ret;
ret = ftell((FILE *)stream);
return ret;
}
long ZCALLBACK fseek_file_func (
voidpf opaque,
voidpf stream,
uLong offset,
int origin)
long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
voidpf opaque;
voidpf stream;
uLong offset;
int origin;
{
int fseek_origin=0;
long ret;
@@ -145,26 +145,26 @@ long ZCALLBACK fseek_file_func (
return ret;
}
int ZCALLBACK fclose_file_func (
voidpf opaque,
voidpf stream)
int ZCALLBACK fclose_file_func (opaque, stream)
voidpf opaque;
voidpf stream;
{
int ret;
ret = fclose((FILE *)stream);
return ret;
}
int ZCALLBACK ferror_file_func (
voidpf opaque,
voidpf stream)
int ZCALLBACK ferror_file_func (opaque, stream)
voidpf opaque;
voidpf stream;
{
int ret;
ret = ferror((FILE *)stream);
return ret;
}
void fill_fopen_filefunc (
zlib_filefunc_def* pzlib_filefunc_def)
void fill_fopen_filefunc (pzlib_filefunc_def)
zlib_filefunc_def* pzlib_filefunc_def;
{
pzlib_filefunc_def->zopen_file = fopen_file_func;
pzlib_filefunc_def->zread_file = fread_file_func;

View File

@@ -168,7 +168,10 @@ local int unzlocal_getByte OF((
voidpf filestream,
int *pi));
local int unzlocal_getByte(const zlib_filefunc_def* pzlib_filefunc_def,voidpf filestream,int *pi)
local int unzlocal_getByte(pzlib_filefunc_def,filestream,pi)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
int *pi;
{
unsigned char c;
int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
@@ -195,7 +198,10 @@ local int unzlocal_getShort OF((
voidpf filestream,
uLong *pX));
local int unzlocal_getShort (const zlib_filefunc_def* pzlib_filefunc_def,voidpf filestream,uLong *pX)
local int unzlocal_getShort (pzlib_filefunc_def,filestream,pX)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong *pX;
{
uLong x ;
int i;
@@ -220,7 +226,10 @@ local int unzlocal_getLong OF((
voidpf filestream,
uLong *pX));
local int unzlocal_getLong (const zlib_filefunc_def* pzlib_filefunc_def,voidpf filestream,uLong *pX)
local int unzlocal_getLong (pzlib_filefunc_def,filestream,pX)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong *pX;
{
uLong x ;
int i;
@@ -250,7 +259,9 @@ local int unzlocal_getLong (const zlib_filefunc_def* pzlib_filefunc_def,voidpf f
/* My own strcmpi / strcasecmp */
local int strcmpcasenosensitive_internal (const char* fileName1,const char* fileName2)
local int strcmpcasenosensitive_internal (fileName1,fileName2)
const char* fileName1;
const char* fileName2;
{
for (;;)
{
@@ -291,7 +302,10 @@ local int strcmpcasenosensitive_internal (const char* fileName1,const char* file
(like 1 on Unix, 2 on Windows)
*/
extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,const char* fileName2,int iCaseSensitivity)
extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity)
const char* fileName1;
const char* fileName2;
int iCaseSensitivity;
{
if (iCaseSensitivity==0)
iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
@@ -314,7 +328,9 @@ local uLong unzlocal_SearchCentralDir OF((
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream));
local uLong unzlocal_SearchCentralDir(const zlib_filefunc_def* pzlib_filefunc_def,voidpf filestream)
local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
{
unsigned char* buf;
uLong uSizeFile;
@@ -378,7 +394,9 @@ local uLong unzlocal_SearchCentralDir(const zlib_filefunc_def* pzlib_filefunc_de
Else, the return value is a unzFile Handle, usable with other function
of this unzip package.
*/
extern unzFile ZEXPORT unzOpen2 (const char *path, zlib_filefunc_def* pzlib_filefunc_def)
extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def)
const char *path;
zlib_filefunc_def* pzlib_filefunc_def;
{
unz_s us;
unz_s *s;
@@ -479,7 +497,8 @@ extern unzFile ZEXPORT unzOpen2 (const char *path, zlib_filefunc_def* pzlib_file
}
extern unzFile ZEXPORT unzOpen (const char *path)
extern unzFile ZEXPORT unzOpen (path)
const char *path;
{
return unzOpen2(path, NULL);
}
@@ -489,7 +508,8 @@ extern unzFile ZEXPORT unzOpen (const char *path)
If there is files inside the .Zip opened with unzipOpenCurrentFile (see later),
these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
return UNZ_OK if there is no problem. */
extern int ZEXPORT unzClose (unzFile file)
extern int ZEXPORT unzClose (file)
unzFile file;
{
unz_s* s;
if (file==NULL)
@@ -509,7 +529,9 @@ extern int ZEXPORT unzClose (unzFile file)
Write info about the ZipFile in the *pglobal_info structure.
No preparation of the structure is needed
return UNZ_OK if there is no problem. */
extern int ZEXPORT unzGetGlobalInfo (unzFile file,unz_global_info *pglobal_info)
extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info)
unzFile file;
unz_global_info *pglobal_info;
{
unz_s* s;
if (file==NULL)
@@ -523,7 +545,9 @@ extern int ZEXPORT unzGetGlobalInfo (unzFile file,unz_global_info *pglobal_info)
/*
Translate date/time from Dos format to tm_unz (readable more easilty)
*/
local void unzlocal_DosDateToTmuDate (uLong ulDosDate, tm_unz* ptm)
local void unzlocal_DosDateToTmuDate (ulDosDate, ptm)
uLong ulDosDate;
tm_unz* ptm;
{
uLong uDate;
uDate = (uLong)(ulDosDate>>16);
@@ -550,16 +574,21 @@ local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file,
char *szComment,
uLong commentBufferSize));
local int unzlocal_GetCurrentFileInfoInternal (
unzFile file,
unz_file_info *pfile_info,
unz_file_info_internal *pfile_info_internal,
char *szFileName,
uLong fileNameBufferSize,
void *extraField,
uLong extraFieldBufferSize,
char *szComment,
uLong commentBufferSize)
local int unzlocal_GetCurrentFileInfoInternal (file,
pfile_info,
pfile_info_internal,
szFileName, fileNameBufferSize,
extraField, extraFieldBufferSize,
szComment, commentBufferSize)
unzFile file;
unz_file_info *pfile_info;
unz_file_info_internal *pfile_info_internal;
char *szFileName;
uLong fileNameBufferSize;
void *extraField;
uLong extraFieldBufferSize;
char *szComment;
uLong commentBufferSize;
{
unz_s* s;
unz_file_info file_info;
@@ -717,15 +746,19 @@ local int unzlocal_GetCurrentFileInfoInternal (
No preparation of the structure is needed
return UNZ_OK if there is no problem.
*/
extern int ZEXPORT unzGetCurrentFileInfo (
unzFile file,
unz_file_info *pfile_info,
char *szFileName,
uLong fileNameBufferSize,
void *extraField,
uLong extraFieldBufferSize,
char *szComment,
uLong commentBufferSize)
extern int ZEXPORT unzGetCurrentFileInfo (file,
pfile_info,
szFileName, fileNameBufferSize,
extraField, extraFieldBufferSize,
szComment, commentBufferSize)
unzFile file;
unz_file_info *pfile_info;
char *szFileName;
uLong fileNameBufferSize;
void *extraField;
uLong extraFieldBufferSize;
char *szComment;
uLong commentBufferSize;
{
return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL,
szFileName,fileNameBufferSize,
@@ -737,7 +770,8 @@ extern int ZEXPORT unzGetCurrentFileInfo (
Set the current file of the zipfile to the first file.
return UNZ_OK if there is no problem
*/
extern int ZEXPORT unzGoToFirstFile (unzFile file)
extern int ZEXPORT unzGoToFirstFile (file)
unzFile file;
{
int err=UNZ_OK;
unz_s* s;
@@ -758,7 +792,8 @@ extern int ZEXPORT unzGoToFirstFile (unzFile file)
return UNZ_OK if there is no problem
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
*/
extern int ZEXPORT unzGoToNextFile (unzFile file)
extern int ZEXPORT unzGoToNextFile (file)
unzFile file;
{
unz_s* s;
int err;
@@ -791,7 +826,10 @@ extern int ZEXPORT unzGoToNextFile (unzFile 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
*/
extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity)
extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
unzFile file;
const char *szFileName;
int iCaseSensitivity;
{
unz_s* s;
int err;
@@ -867,7 +905,9 @@ typedef struct unz_file_pos_s
} unz_file_pos;
*/
extern int ZEXPORT unzGetFilePos(unzFile file, unz_file_pos* file_pos)
extern int ZEXPORT unzGetFilePos(file, file_pos)
unzFile file;
unz_file_pos* file_pos;
{
unz_s* s;
@@ -883,7 +923,9 @@ extern int ZEXPORT unzGetFilePos(unzFile file, unz_file_pos* file_pos)
return UNZ_OK;
}
extern int ZEXPORT unzGoToFilePos(unzFile file, unz_file_pos*file_pos)
extern int ZEXPORT unzGoToFilePos(file, file_pos)
unzFile file;
unz_file_pos* file_pos;
{
unz_s* s;
int err;
@@ -917,11 +959,13 @@ extern int ZEXPORT unzGoToFilePos(unzFile file, unz_file_pos*file_pos)
store in *piSizeVar the size of extra info in local header
(filename and size of extra field data)
*/
local int unzlocal_CheckCurrentFileCoherencyHeader (
unz_s* s,
uInt* piSizeVar,
uLong *poffset_local_extrafield,
uInt *psize_local_extrafield)
local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
poffset_local_extrafield,
psize_local_extrafield)
unz_s* s;
uInt* piSizeVar;
uLong *poffset_local_extrafield;
uInt *psize_local_extrafield;
{
uLong uMagic,uData,uFlags;
uLong size_filename;
@@ -1006,12 +1050,12 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (
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.
*/
extern int ZEXPORT unzOpenCurrentFile3 (
unzFile file,
int* method,
int* level,
int raw,
const char* password)
extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
unzFile file;
int* method;
int* level;
int raw;
const char* password;
{
int err=UNZ_OK;
uInt iSizeVar;
@@ -1092,7 +1136,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (
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.opaque = (voidpf)0;
pfile_in_zip_read_info->stream.next_in = (Bytef*)0;
pfile_in_zip_read_info->stream.next_in = (voidpf)0;
pfile_in_zip_read_info->stream.avail_in = 0;
err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
@@ -1151,21 +1195,24 @@ extern int ZEXPORT unzOpenCurrentFile3 (
return UNZ_OK;
}
extern int ZEXPORT unzOpenCurrentFile (unzFile file)
extern int ZEXPORT unzOpenCurrentFile (file)
unzFile file;
{
return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
}
extern int ZEXPORT unzOpenCurrentFilePassword (unzFile file, const char* password)
extern int ZEXPORT unzOpenCurrentFilePassword (file, password)
unzFile file;
const char* password;
{
return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
}
extern int ZEXPORT unzOpenCurrentFile2 (
unzFile file,
int* method,
int* level,
int raw)
extern int ZEXPORT unzOpenCurrentFile2 (file,method,level,raw)
unzFile file;
int* method;
int* level;
int raw;
{
return unzOpenCurrentFile3(file, method, level, raw, NULL);
}
@@ -1180,10 +1227,10 @@ extern int ZEXPORT unzOpenCurrentFile2 (
return <0 with error code if there is an error
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
*/
extern int ZEXPORT unzReadCurrentFile(
unzFile file,
voidp buf,
unsigned len)
extern int ZEXPORT unzReadCurrentFile (file, buf, len)
unzFile file;
voidp buf;
unsigned len;
{
int err=UNZ_OK;
uInt iRead = 0;
@@ -1341,7 +1388,8 @@ extern int ZEXPORT unzReadCurrentFile(
/*
Give the current position in uncompressed data
*/
extern z_off_t ZEXPORT unztell (unzFile file)
extern z_off_t ZEXPORT unztell (file)
unzFile file;
{
unz_s* s;
file_in_zip_read_info_s* pfile_in_zip_read_info;
@@ -1360,7 +1408,8 @@ extern z_off_t ZEXPORT unztell (unzFile file)
/*
return 1 if the end of file was reached, 0 elsewhere
*/
extern int ZEXPORT unzeof (unzFile file)
extern int ZEXPORT unzeof (file)
unzFile file;
{
unz_s* s;
file_in_zip_read_info_s* pfile_in_zip_read_info;
@@ -1392,10 +1441,10 @@ extern int ZEXPORT unzeof (unzFile file)
the return value is the number of bytes copied in buf, or (if <0)
the error code
*/
extern int ZEXPORT unzGetLocalExtrafield (
unzFile file,
voidp buf,
unsigned len)
extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
unzFile file;
voidp buf;
unsigned len;
{
unz_s* s;
file_in_zip_read_info_s* pfile_in_zip_read_info;
@@ -1443,7 +1492,8 @@ extern int ZEXPORT unzGetLocalExtrafield (
Close the file in zip opened with unzipOpenCurrentFile
Return UNZ_CRCERROR if all the file was read but the CRC is not good
*/
extern int ZEXPORT unzCloseCurrentFile (unzFile file)
extern int ZEXPORT unzCloseCurrentFile (file)
unzFile file;
{
int err=UNZ_OK;
@@ -1485,11 +1535,12 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file)
uSizeBuf is the size of the szComment buffer.
return the number of byte copied or an error code <0
*/
extern int ZEXPORT unzGetGlobalComment (
unzFile file,
char *szComment,
uLong uSizeBuf)
extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
unzFile file;
char *szComment;
uLong uSizeBuf;
{
int err=UNZ_OK;
unz_s* s;
uLong uReadThis ;
if (file==NULL)
@@ -1516,7 +1567,8 @@ extern int ZEXPORT unzGetGlobalComment (
}
/* Additions by RX '2004 */
extern uLong ZEXPORT unzGetOffset (unzFile file)
extern uLong ZEXPORT unzGetOffset (file)
unzFile file;
{
unz_s* s;
@@ -1531,9 +1583,9 @@ extern uLong ZEXPORT unzGetOffset (unzFile file)
return s->pos_in_central_dir;
}
extern int ZEXPORT unzSetOffset (
unzFile file,
uLong pos)
extern int ZEXPORT unzSetOffset (file, pos)
unzFile file;
uLong pos;
{
unz_s* s;
int err;

View File

@@ -172,7 +172,8 @@ local linkedlist_datablock_internal* allocate_new_datablock()
return ldi;
}
local void free_datablock(linkedlist_datablock_internal* ldi)
local void free_datablock(ldi)
linkedlist_datablock_internal* ldi;
{
while (ldi!=NULL)
{
@@ -182,24 +183,24 @@ local void free_datablock(linkedlist_datablock_internal* ldi)
}
}
local void init_linkedlist(
linkedlist_data* ll)
local void init_linkedlist(ll)
linkedlist_data* ll;
{
ll->first_block = ll->last_block = NULL;
}
local void free_linkedlist(
linkedlist_data* ll)
local void free_linkedlist(ll)
linkedlist_data* ll;
{
free_datablock(ll->first_block);
ll->first_block = ll->last_block = NULL;
}
local int add_data_in_datablock(
linkedlist_data* ll,
const void* buf,
uLong len)
local int add_data_in_datablock(ll,buf,len)
linkedlist_data* ll;
const void* buf;
uLong len;
{
linkedlist_datablock_internal* ldi;
const unsigned char* from_copy;
@@ -262,11 +263,11 @@ local int add_data_in_datablock(
local int ziplocal_putValue OF((const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream, uLong x, int nbByte));
local int ziplocal_putValue (
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
uLong x,
int nbByte)
local int ziplocal_putValue (pzlib_filefunc_def, filestream, x, nbByte)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong x;
int nbByte;
{
unsigned char buf[4];
int n;
@@ -290,10 +291,10 @@ local int ziplocal_putValue (
}
local void ziplocal_putValue_inmemory OF((void* dest, uLong x, int nbByte));
local void ziplocal_putValue_inmemory (
void* dest,
uLong x,
int nbByte)
local void ziplocal_putValue_inmemory (dest, x, nbByte)
void* dest;
uLong x;
int nbByte;
{
unsigned char* buf=(unsigned char*)dest;
int n;
@@ -314,9 +315,9 @@ local void ziplocal_putValue_inmemory (
/****************************************************************************/
local uLong ziplocal_TmzDateToDosDate(
const tm_zip* ptm,
uLong dosDate)
local uLong ziplocal_TmzDateToDosDate(ptm,dosDate)
const tm_zip* ptm;
uLong dosDate;
{
uLong year = (uLong)ptm->tm_year;
if (year>1980)
@@ -336,10 +337,10 @@ local int ziplocal_getByte OF((
voidpf filestream,
int *pi));
local int ziplocal_getByte(
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
int *pi)
local int ziplocal_getByte(pzlib_filefunc_def,filestream,pi)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
int *pi;
{
unsigned char c;
int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
@@ -366,10 +367,10 @@ local int ziplocal_getShort OF((
voidpf filestream,
uLong *pX));
local int ziplocal_getShort (
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
uLong *pX)
local int ziplocal_getShort (pzlib_filefunc_def,filestream,pX)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong *pX;
{
uLong x ;
int i;
@@ -394,10 +395,10 @@ local int ziplocal_getLong OF((
voidpf filestream,
uLong *pX));
local int ziplocal_getLong (
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
uLong *pX)
local int ziplocal_getLong (pzlib_filefunc_def,filestream,pX)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong *pX;
{
uLong x ;
int i;
@@ -436,9 +437,9 @@ local uLong ziplocal_SearchCentralDir OF((
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream));
local uLong ziplocal_SearchCentralDir(
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream)
local uLong ziplocal_SearchCentralDir(pzlib_filefunc_def,filestream)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
{
unsigned char* buf;
uLong uSizeFile;
@@ -495,11 +496,11 @@ local uLong ziplocal_SearchCentralDir(
#endif /* !NO_ADDFILEINEXISTINGZIP*/
/************************************************************/
extern zipFile ZEXPORT zipOpen2 (
const char *pathname,
int append,
zipcharpc* globalcomment,
zlib_filefunc_def* pzlib_filefunc_def)
extern zipFile ZEXPORT zipOpen2 (pathname, append, globalcomment, pzlib_filefunc_def)
const char *pathname;
int append;
zipcharpc* globalcomment;
zlib_filefunc_def* pzlib_filefunc_def;
{
zip_internal ziinit;
zip_internal* zi;
@@ -614,7 +615,7 @@ extern zipFile ZEXPORT zipOpen2 (
if (size_comment>0)
{
ziinit.globalcomment = (char*)ALLOC(size_comment+1);
ziinit.globalcomment = ALLOC(size_comment+1);
if (ziinit.globalcomment)
{
size_comment = ZREAD(ziinit.z_filefunc, ziinit.filestream,ziinit.globalcomment,size_comment);
@@ -679,30 +680,35 @@ extern zipFile ZEXPORT zipOpen2 (
}
}
extern zipFile ZEXPORT zipOpen (
const char *pathname,
int append)
extern zipFile ZEXPORT zipOpen (pathname, append)
const char *pathname;
int append;
{
return zipOpen2(pathname,append,NULL,NULL);
}
extern int ZEXPORT zipOpenNewFileInZip3 (
zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int raw,
int windowBits,
int memLevel,
int strategy,
const char* password,
uLong crcForCrypting)
extern int ZEXPORT zipOpenNewFileInZip3 (file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, raw,
windowBits, memLevel, strategy,
password, crcForCrypting)
zipFile file;
const char* filename;
const zip_fileinfo* zipfi;
const void* extrafield_local;
uInt size_extrafield_local;
const void* extrafield_global;
uInt size_extrafield_global;
const char* comment;
int method;
int level;
int raw;
int windowBits;
int memLevel;
int strategy;
const char* password;
uLong crcForCrypting;
{
zip_internal* zi;
uInt size_filename;
@@ -890,18 +896,21 @@ extern int ZEXPORT zipOpenNewFileInZip3 (
return err;
}
extern int ZEXPORT zipOpenNewFileInZip2(
zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int raw)
extern int ZEXPORT zipOpenNewFileInZip2(file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, raw)
zipFile file;
const char* filename;
const zip_fileinfo* zipfi;
const void* extrafield_local;
uInt size_extrafield_local;
const void* extrafield_global;
uInt size_extrafield_global;
const char* comment;
int method;
int level;
int raw;
{
return zipOpenNewFileInZip3 (file, filename, zipfi,
extrafield_local, size_extrafield_local,
@@ -911,17 +920,20 @@ extern int ZEXPORT zipOpenNewFileInZip2(
NULL, 0);
}
extern int ZEXPORT zipOpenNewFileInZip (
zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level)
extern int ZEXPORT zipOpenNewFileInZip (file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level)
zipFile file;
const char* filename;
const zip_fileinfo* zipfi;
const void* extrafield_local;
uInt size_extrafield_local;
const void* extrafield_global;
uInt size_extrafield_global;
const char* comment;
int method;
int level;
{
return zipOpenNewFileInZip2 (file, filename, zipfi,
extrafield_local, size_extrafield_local,
@@ -929,8 +941,8 @@ extern int ZEXPORT zipOpenNewFileInZip (
comment, method, level, 0);
}
local int zipFlushWriteBuffer(
zip_internal* zi)
local int zipFlushWriteBuffer(zi)
zip_internal* zi;
{
int err=ZIP_OK;
@@ -951,10 +963,10 @@ local int zipFlushWriteBuffer(
return err;
}
extern int ZEXPORT zipWriteInFileInZip (
zipFile file,
const void* buf,
unsigned len)
extern int ZEXPORT zipWriteInFileInZip (file, buf, len)
zipFile file;
const void* buf;
unsigned len;
{
zip_internal* zi;
int err=ZIP_OK;
@@ -966,9 +978,9 @@ extern int ZEXPORT zipWriteInFileInZip (
if (zi->in_opened_file_inzip == 0)
return ZIP_PARAMERROR;
zi->ci.stream.next_in = (Bytef*)buf;
zi->ci.stream.next_in = (void*)buf;
zi->ci.stream.avail_in = len;
zi->ci.crc32 = crc32(zi->ci.crc32,(const Bytef*)buf,len);
zi->ci.crc32 = crc32(zi->ci.crc32,buf,len);
while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
{
@@ -1016,10 +1028,10 @@ extern int ZEXPORT zipWriteInFileInZip (
return err;
}
extern int ZEXPORT zipCloseFileInZipRaw (
zipFile file,
uLong uncompressed_size,
uLong crc32)
extern int ZEXPORT zipCloseFileInZipRaw (file, uncompressed_size, crc32)
zipFile file;
uLong uncompressed_size;
uLong crc32;
{
zip_internal* zi;
uLong compressed_size;
@@ -1112,15 +1124,15 @@ extern int ZEXPORT zipCloseFileInZipRaw (
return err;
}
extern int ZEXPORT zipCloseFileInZip (
zipFile file)
extern int ZEXPORT zipCloseFileInZip (file)
zipFile file;
{
return zipCloseFileInZipRaw (file,0,0);
}
extern int ZEXPORT zipClose (
zipFile file,
const char* global_comment)
extern int ZEXPORT zipClose (file, global_comment)
zipFile file;
const char* global_comment;
{
zip_internal* zi;
int err = 0;

View File

@@ -42,6 +42,7 @@ filesystem * filesystem::pCurrentFS = NULL;
std::vector<filesystem::pooledBuffer *> filesystem::m_Buffers;
static const int STORED = 0;
static const int DEFLATED = 8;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
@@ -631,8 +632,8 @@ streamoff filesystem::CentralDirZipped(std::istream & File, std::streamoff begin
std::streamoff eof = begin + size;
// Look for the "end of central dir" header. Start minimum 22 bytes before end.
if (! File.seekg(eof - 22, ios::beg))
return -1;
if (! File.seekg(eof - 22, ios::beg))
return -1;
streamoff EndPos;
streamoff StartPos = File.tellg();

View File

@@ -258,8 +258,8 @@ inline void izfstream::open(const char * FilePath, filesystem * pFS) {
if (pFS)
m_pFS = pFS;
if (m_pFS != NULL)
m_pFS->Open(* this, FilePath);
if (m_pFS != NULL)
m_pFS->Open(* this, FilePath);
}
inline void izfstream::close() {

View File

@@ -76,8 +76,8 @@ bool zbuffer::use(std::streamoff Offset, std::streamoff Size)
return false;
//Don't use a buffer already used;
if (m_Used)
return false;
if (m_Used)
return false;
// adjust file position
if (! m_ZipFile.seekg(Offset, ios::beg))

View File

@@ -1,45 +1,28 @@
# Wagic the Homebrew
#Wagic the Homebrew
[![Build Status](https://travis-ci.org/WagicProject/wagic.png?branch=master)](https://travis-ci.com/WagicProject/wagic)
[![Build Status](https://travis-ci.org/WagicProject/wagic.png?branch=master)](https://travis-ci.org/WagicProject/wagic)
[![Build status](https://ci.appveyor.com/api/projects/status/7j4fbr6m62aqej59/branch/master)](https://ci.appveyor.com/project/xawotihs/wagic/branch/master)
[![Coverage Status](https://coveralls.io/repos/WagicProject/wagic/badge.png?branch=master)](https://coveralls.io/r/WagicProject/wagic?branch=master)
## Description
**Wagic, the Homebrew** is a C++ game engine that allows to play card games against an AI on:
Wagic, the Homebrew, is a C++ game engine that allows to play card games against an AI on
- Android (phones and tablets)
- iOS (iPhone/iPad)
- Sony PSP
- Windows desktops
- MacOS
- Linux and derivatives like Maemo or Meego
- Linux and derivated like Maemo or Meego
It is highly customizable and allows the player to tweak the rules, create their own cards, their own themes, etc...
#### [Download from GitHub Releases!](https://github.com/WagicProject/wagic/releases)
![Screenshot of shop from wololo.net](docs/img/shop.jpg)
It is highly customizable and allows the player to tweak the rules / create their own cards, their own themes, etc...
### Documentation
Info, downloads, discussions and more at http://wololo.net/forum/index.php
Info, downloads, discussions and more at http://wololo.net/forum/index.php (archived as of 16 Nov 2022).
-![alt text](http://wololo.net/wagic/wp-content/uploads/2009/10/shop.jpg "Screenshot")
Chat with the community on the [**Wagic - MTG Game** Discord](https://discord.com/invite/JHK5pVaK5p) (Feb 2023).
Developer information from the [Wagic Wiki](https://github.com/WagicProject/wagic/wiki) is also included in the [wagic/docs/](docs) folder.
### Sample round play-through video
[![Wagic, The Homebrew sample playthrough](docs/img/Wagic%2C%20The%20Homebrew%20sample%20playthrough.jpg)](http://www.youtube.com/watch?v=WUFSAPZuDIk)
*Wagic, The Homebrew sample playthrough on YouTube by Rolz73, 6 Feb 2014*
## Sister projects
- [WagicSyntaxPlugin
](https://github.com/Vitty85/WagicSyntaxPlugin), a Wagic developer tool by Vitty85 for [Notepad++](https://notepad-plus-plus.org/downloads/)
- [Forge](https://www.slightlymagic.net/forum/viewforum.php?f=26), a Java-based game engine similar to Wagic ([Source](https://github.com/Card-Forge/forge/))
- [XMage](http://xmage.today/), a Java-based online multiplayer digital CCG ([Source](https://github.com/magefree/mage))
[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/WUFSAPZuDIk/0.jpg)](http://www.youtube.com/watch?v=WUFSAPZuDIk)

View File

@@ -22,8 +22,8 @@ environment:
# scripts that run after cloning repository
install:
- powershell -Command "& {(new-object net.webclient).DownloadFile('https://bootstrap.pypa.io/get-pip.py', 'C:/get-pip.py')}"
- powershell -Command "& {C:/Python27/python.exe C:/get-pip.py}"
- ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:/get-pip.py')
- "C:/Python27/python.exe C:/get-pip.py"
- "C:/Python27/Scripts/pip.exe install pyjavaproperties"
- "C:/Python27/Scripts/pip.exe install github3.py"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Submodule docs/wiki deleted from 0244ca1874

View File

@@ -1,4 +1,3 @@
/gen
/bin
/libs

View File

@@ -1,28 +1,18 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="0240"
android:installLocation="preferExternal"
android:versionName="@string/app_version"
package="net.wagic.app">
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<activity android:debuggable="false"
android:configChanges="keyboard|keyboardHidden|orientation"
android:label="@string/app_name"
android:name="org.libsdl.app.SDLActivity"
android:screenOrientation="sensorLandscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="10"
android:targetSdkVersion="29" />
</manifest>
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="0192" android:versionName="@string/app_version" package="net.wagic.app">
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application android:debuggable="true" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<activity android:configChanges="keyboard|keyboardHidden|orientation" android:label="@string/app_name" android:name="org.libsdl.app.SDLActivity" android:screenOrientation="sensorLandscape">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:configChanges="keyboard|keyboardHidden|orientation" android:name="com.google.ads.AdActivity" android:screenOrientation="sensorLandscape"/>
</application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10"/>
</manifest>

View File

@@ -8,4 +8,4 @@
# project structure.
# Project target.
target=android-23
target=android-10

View File

@@ -11,8 +11,9 @@ SDL_PATH := $(JGE_PATH)/Dependencies/SDL
BOOST_PATH := $(MY_WAGIC_ROOT)/Boost
JPEG_PATH := $(JGE_PATH)/Dependencies/libjpeg
PNG_PATH := $(JGE_PATH)/Dependencies/libpng
DEBUG ?= DEBUG
LOCAL_CFLAGS += -DLINUX -DANDROID -DSDL_CONFIG -DNETWORK_SUPPORT
LOCAL_CFLAGS += -DLINUX -DANDROID -DSDL_CONFIG -D_$(DEBUG)
LOCAL_CFLAGS += -D_STLP_USE_SIMPLE_NODE_ALLOC -DTIXML_USE_STL
LOCAL_CFLAGS += -D__arm__ -D_REENTRANT -D_GLIBCXX__PTHREADS
LOCAL_STATIC_LIBRARIES := libpng libjpeg
@@ -133,7 +134,6 @@ LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.cpp \
$(MTG_PATH)/src/WFilter.cpp \
$(MTG_PATH)/src/WFont.cpp \
$(MTG_PATH)/src/WGui.cpp \
$(MTG_PATH)/src/WParsedInt.cpp \
$(MTG_PATH)/src/WResourceManager.cpp \
$(MTG_PATH)/src/DeckView.cpp \
$(MTG_PATH)/src/CarouselDeckView.cpp \

View File

@@ -1,11 +1,7 @@
APP_PROJECT_PATH := $(call my-dir)/..
APP_CPPFLAGS += -frtti -fexceptions
APP_ABI := arm64-v8a
APP_PLATFORM := android-21
APP_CFLAGS += -march=armv8.1-a
APP_CPPFLAGS += -D__ARM_FEATURE_LSE=1
#APP_ABI := x86 # mainly for emulators
APP_STL := c++_static
APP_ABI := armeabi armeabi-v7a
APP_STL := gnustl_static
APP_MODULES := libpng libjpeg main SDL
#APP_OPTIM is 'release' by default

View File

@@ -11,4 +11,4 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-23
target=android-10

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

View File

@@ -4,7 +4,6 @@
android:id="@+id/mainLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:keepScreenOn="true"
>
<TextView
android:layout_width="fill_parent"

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Wagic</string>
<string name="app_version">0.20.0</string>
<string name="info_text">All Rights Reserved.</string>
<string name="app_version">0.19.2</string>
<string name="info_text">Wagic v0.19.2\\nAll Rights Reserved.</string>
</resources>

View File

@@ -1,279 +0,0 @@
package net.wagic.utils;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.File;
import java.io.IOException;
import java.util.Scanner;
import android.util.Log;
public class DeckImporter
{
public static String importDeck( File f, String mypath, String activePath )
{
String message = "";
String deck = "";
String deckname = "";
String prefix = "";
int cardcount = 0;
if(f.exists() && !f.isDirectory())
{
deckname = f.getName();
int pos = deckname.lastIndexOf(".");
if (pos > 0)
{
deckname = deckname.substring(0, pos);
}
deck += "#NAME:"+deckname+"\n";
try
{
Scanner scanner = new Scanner(new File(mypath));
if (scanner.hasNext())
{
while (scanner.hasNext())
{
String line = scanner.nextLine();
line = line.trim();
if (line.equals("")) {
line = scanner.nextLine();
prefix = "#SB:"; // Sideboard started from next card.
if (line.equals("")) {
line = scanner.nextLine(); // Sometimes there are 2 blank lines from main deck and sideboard.
}
}
if (!line.equals("")) // don't write out blank lines
{
String[] slines = line.split("\\s+");
String arranged = "";
for (int idx = 1; idx < slines.length; idx++)
{
arranged += slines[idx] + " ";
}
if ((isNumeric(slines[0])) && arranged != null)
{
if (slines[1] != null && slines[1].startsWith("["))
{
arranged = arranged.substring(5);
slines[1] = slines[1].replaceAll("\\[", "").replaceAll("\\]", "");
deck += prefix + arranged + " (" + renameSet(slines[1]) + ") * " + slines[0] + "\n";
} else
{
deck += prefix + arranged + "(*) * " + slines[0] + "\n";
}
cardcount += Integer.parseInt(slines[0]);
}
}
}
File profile = new File(activePath + "/User/settings/options.txt");
String profileName = "Default";
if (profile.exists() && !profile.isDirectory())
profileName = getActiveProfile(profile);
File rootDecks = null;
if (!profileName.equalsIgnoreCase("Default"))
rootDecks = new File(activePath + "/User/profiles/" + profileName);
else
rootDecks = new File(activePath + "/User/player/");
if (rootDecks.exists() && rootDecks.isDirectory())
{
//save deck
int countdeck = 1;
File[] files = rootDecks.listFiles();
for (int i = 0; i < files.length; i++)
{//check if there is available deck...
if (files[i].getName().startsWith("deck"))
countdeck++;
}
File toSave = new File(rootDecks + "/deck" + countdeck + ".txt");
try
{
FileOutputStream fop = new FileOutputStream(toSave);
// if file doesn't exists, then create it
if (!toSave.exists())
{
toSave.createNewFile();
}
// get the content in bytes
byte[] contentInBytes = deck.getBytes();
fop.write(contentInBytes);
fop.flush();
fop.close();
message = "The deck has been successfully imported as: " + toSave.getName() + "\n" + cardcount + " total cards in this deck\n\n" + deck;
} catch (IOException e)
{
message = e.getMessage();
}
} else
{
message = "Problem opening decks folder: " + rootDecks.getAbsolutePath();
}
} else
{
message = "No errors, and file EMPTY";
}
} catch (IOException e)
{
message = e.getMessage();
}
}
return message;
}
private static boolean isNumeric(String input)
{
try
{
Integer.parseInt(input);
}
catch(NumberFormatException ex)
{
return false;
}
return true;
}
private static String getActiveProfile(File mypath)
{
String name = "";
try
{
Scanner scanner = new Scanner(new File(mypath.toString()));
if (scanner.hasNext())
{
String line = scanner.nextLine();
name = line.substring(8);
}
else
{
return "Default";
}
}
catch(IOException e)
{
return "Default";
}
return name;
}
private static String renameSet(String set)
{
if (set == "")
return "*";
if (set == "AL")
return "ALL";
if (set == "AQ")
return "ATQ";
if (set == "AP")
return "APC";
if (set == "AN")
return "ARN";
if (set == "AE")
return "ARC";
if (set == "BR")
return "BRB";
if (set == "BD")
return "BTD";
if (set == "CH")
return "CHR";
if (set == "6E")
return "6ED";
if (set == "CS")
return "CSP";
if (set == "DS")
return "DST";
if (set == "D2")
return "DD2";
if (set == "8E")
return "8ED";
if (set == "EX")
return "EXO";
if (set == "FE")
return "FEM";
if (set == "FD")
return "5DN";
if (set == "5E")
return "5ED";
if (set == "4E")
return "4ED";
if (set == "GP")
return "GPT";
if (set == "HL")
return "HML";
if (set == "IA")
return "ICE";
if (set == "IN")
return "INV";
if (set == "JU")
return "JUD";
if (set == "LG")
return "LEG";
if (set == "LE")
return "LGN";
if (set == "A")
return "LEA";
if (set == "B")
return "LEB";
if (set == "MM")
return "MMQ";
if (set == "MI")
return "MIR";
if (set == "MR")
return "MRD";
if (set == "NE")
return "NEM";
if (set == "9E")
return "9ED";
if (set == "OD")
return "ODY";
if (set == "ON")
return "ONS";
if (set == "PS")
return "PLS";
if (set == "PT")
return "POR";
if (set == "P2")
return "P02";
if (set == "P3")
return "PTK";
if (set == "PR")
return "PPR";
if (set == "PY")
return "PCY";
if (set == "R")
return "RV";
if (set == "SC")
return "SCG";
if (set == "7E")
return "7ED";
if (set == "ST")
return "S99";
if (set == "ST2K")
return "S00";
if (set == "SH")
return "STH";
if (set == "TE")
return "TMP";
if (set == "DK")
return "DRK";
if (set == "TO")
return "TOR";
if (set == "UG")
return "UGL";
if (set == "U")
return "2ED";
if (set == "UD")
return "UDS";
if (set == "UL")
return "ULG";
if (set == "US")
return "USG";
if (set == "VI")
return "VIS";
if (set == "WL")
return "WTH";
else
return set;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -5,16 +5,11 @@ import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.HashSet;
import java.util.Set;
import android.os.Build;
import android.os.Environment;
import android.util.Log;
public class StorageOptions
{
private static final String TAG = StorageOptions.class.getCanonicalName();
private static ArrayList<String> mMounts = new ArrayList<String>();
private static ArrayList<String> mVold = new ArrayList<String>();
@@ -23,29 +18,13 @@ public class StorageOptions
public static int count = 0;
public static String defaultMountPoint;
public static void determineStorageOptions(android.content.Context mContext)
public static void determineStorageOptions()
{
initializeMountPoints();
if (findForcemount()){
readMountsFileTest();
}
readMountsFile();
readVoldFile();
if (findForcemount()){
removeDuplicates(mMounts);
}
compareMountsWithVold();
testAndCleanMountsList();
File[] externalStorageVolumes = mContext.getExternalFilesDirs("");
for(int i = 0; i < externalStorageVolumes.length; i++){
mMounts.add(externalStorageVolumes[i].getAbsolutePath());
}
for(int i = 0; i < mMounts.size(); i++){
for(int j = 0; j < mMounts.size(); j++){
if(i!=j && mMounts.get(i).startsWith(mMounts.get(j)))
mMounts.remove(i);
}
}
setProperties();
}
@@ -61,42 +40,6 @@ public class StorageOptions
}
}
private static void readMountsFileTest()
{
/*
* Test mountpoints storage -kevlahnota
*/
try
{
Scanner scanner = new Scanner(new File("/proc/mounts"));
while (scanner.hasNext())
{
String line = scanner.nextLine();
if (line.startsWith("/"))
{
String[] lineElements = line.split("\\s+");
if ("vfat".equals(lineElements[2]) || "fuse".equals(lineElements[2]) || "sdcardfs".equals(lineElements[2]))
{
File mountPoint = new File(lineElements[1]);
if (!lineElements[1].equals(defaultMountPoint))
if (mountPoint.isDirectory() && mountPoint.canRead())
mMounts.add(lineElements[1]);
}
}
}
} catch (FileNotFoundException fnfex)
{
// if proc/mount doesn't exist we just use
Log.i(TAG, fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point");
mMounts.add(defaultMountPoint);
} catch (Exception e)
{
Log.e(TAG, e.getMessage() + ": unknown exception while reading mounts file");
mMounts.add(defaultMountPoint);
}
}
private static void readMountsFile()
{
/*
@@ -122,11 +65,11 @@ public class StorageOptions
} catch (FileNotFoundException fnfex)
{
// if proc/mount doesn't exist we just use
Log.i(TAG, fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point");
Log.i(StorageOptions.class.getCanonicalName(), fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point");
mMounts.add(defaultMountPoint);
} catch (Exception e)
{
Log.e(TAG, e.getMessage() + ": unknown exception while reading mounts file");
Log.e(StorageOptions.class.getCanonicalName(), e.getMessage() + ": unknown exception while reading mounts file");
mMounts.add(defaultMountPoint);
}
}
@@ -155,48 +98,28 @@ public class StorageOptions
} catch (FileNotFoundException fnfex)
{
// if vold.fstab doesn't exist we use the value gathered from the Environment
Log.i(TAG, fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point");
Log.i(StorageOptions.class.getCanonicalName(), fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point");
mMounts.add(defaultMountPoint);
} catch (Exception e)
{
Log.e(TAG, e.getMessage() + ": unknown exception while reading vold.fstab file");
Log.e(StorageOptions.class.getCanonicalName(), e.getMessage() + ": unknown exception while reading mounts file");
mMounts.add(defaultMountPoint);
}
}
private static ArrayList<String> removeDuplicates(ArrayList<String> list)
{
ArrayList<String> result = new ArrayList<String>();
HashSet<String> set = new HashSet<String>();
for (String item : list)
{
if (!set.contains(item))
{
result.add(item);
set.add(item);
}
}
return result;
}
private static void compareMountsWithVold()
{
/*
* Sometimes the two lists of mount points will be different. We only want those mount points that are in both list.
*
*
* Compare the two lists together and remove items that are not in both lists.
*/
if (mVold.size() > 0)
for (int i = 0; i < mMounts.size(); i++)
{
for (int i = 0; i < mMounts.size(); i++)
{
String mount = mMounts.get(i);
if (!mVold.contains(mount))
mMounts.remove(i--);
}
String mount = mMounts.get(i);
if (!mVold.contains(mount))
mMounts.remove(i--);
}
// don't need this anymore, clear the vold list to reduce memory
@@ -209,60 +132,18 @@ public class StorageOptions
/*
* Now that we have a cleaned list of mount paths Test each one to make sure it's a valid and available path. If it is not, remove it from the list.
*/
int t = 0;
for (int i = 0; i < mMounts.size(); i++)
{
t++;
String mount = mMounts.get(i);
File root = new File(mount);
if (!root.exists() || !root.isDirectory() || !root.canWrite())
mMounts.remove(i--);
}
if (t == 0 && Build.VERSION.SDK_INT >= 16 && findForcemount())
{
//if none is found lets force it for Jellybean and above...
if (System.getenv("EXTERNAL_STORAGE") != null)
{
File root = new File(System.getenv("EXTERNAL_STORAGE"));
if (root.exists() && root.isDirectory() && root.canWrite())
{
if(!isRooted())
{
File folder = new File(System.getenv("EXTERNAL_STORAGE")+"/Android/data/net.wagic.app/files");
folder.mkdirs();
mMounts.add(folder.toString());
}
else
{
mMounts.add(System.getenv("EXTERNAL_STORAGE"));
}
}
}
if (System.getenv("SECONDARY_STORAGE") != null)
{
File root = new File(System.getenv("SECONDARY_STORAGE"));
if (root.exists() && root.isDirectory() && root.canWrite())
{
if(!isRooted())
{
File folder = new File(System.getenv("SECONDARY_STORAGE")+"/Android/data/net.wagic.app/files");
folder.mkdirs();
mMounts.add(folder.toString());
}
else
{
mMounts.add(System.getenv("SECONDARY_STORAGE"));
}
}
}
}
}
private static void setProperties()
{
Log.d(TAG, "setProperties()");
/*
* At this point all the paths in the list should be valid. Build the public properties.
*/
@@ -270,29 +151,14 @@ public class StorageOptions
ArrayList<String> mLabels = new ArrayList<String>();
int i = 1;
if(findForcemount()){
for (String path : mMounts)
{//with forcemount menu
if ("/mnt/sdcard".equalsIgnoreCase(path) || "/storage/sdcard0".equalsIgnoreCase(path))
mLabels.add("Internal SD " + "[" + path + "/]");
else if (path.contains("emulated"))
mLabels.add("Emulated SD " + " [" + path + "/]");
else
mLabels.add("External SD " + " [" + path + "/]");
}
for (String path : mMounts)
{ // TODO: /mnt/sdcard is assumed to always mean internal storage. Use this comparison until there is a better way to do this
if ("/mnt/sdcard".equalsIgnoreCase(path))
mLabels.add("Built-in Storage");
else
mLabels.add("External SD Card " + i++);
}
else
{
for (String path : mMounts)
{
// TODO: /mnt/sdcard and emulated are assumed to always mean internal storage. Use this comparison until there is a better way to do this
if ("/mnt/sdcard".equalsIgnoreCase(path) || path.contains("emulated"))
mLabels.add("Built-in Storage " + "[" + path + "/]");
else
mLabels.add("External SD Card " + "[" + path + "/]");
}
}
labels = new String[mLabels.size()];
mLabels.toArray(labels);
@@ -305,119 +171,4 @@ public class StorageOptions
// use and to prepare it for the next time it's needed.
mMounts.clear();
}
private static boolean isExternalStorageReadOnly() {
String extStorageState = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(extStorageState)) {
return true;
}
return false;
}
private static boolean isExternalStorageAvailable() {
String extStorageState = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(extStorageState)) {
return true;
}
return false;
}
/**
* Checks if the device is rooted.
*
* @return <code>true</code> if the device is rooted, <code>false</code> otherwise.
*/
public static boolean isRooted()
{
// get from build info
String buildTags = android.os.Build.TAGS;
if (buildTags != null && buildTags.contains("test-keys"))
{
return true;
}
// check if /system/app/Superuser.apk is present
try
{
File file = new File("/system/app/Superuser.apk");
if (file.exists())
{
return true;
}
} catch (Exception e1)
{
// ignore
}
try
{
File file = new File("/system/app/Superuser/Superuser.apk");
if (file.exists())
{
return true;
}
} catch (Exception e1)
{
// ignore
}
//SuperSU
try
{
File file = new File("/system/app/SuperSU.apk");
if (file.exists())
{
return true;
}
} catch (Exception e1)
{
// ignore
}
try
{
File file = new File("/system/app/SuperSU/SuperSU.apk");
if (file.exists())
{
return true;
}
} catch (Exception e1)
{
// ignore
}
// try executing commands
return canExecuteCommand("/system/xbin/which su")
|| canExecuteCommand("/system/bin/which su") || canExecuteCommand("which su");
}
// executes a command on the system
private static boolean canExecuteCommand(String command)
{
boolean executedSuccesfully;
try
{
Runtime.getRuntime().exec(command);
executedSuccesfully = true;
} catch (Exception e)
{
executedSuccesfully = false;
}
return executedSuccesfully;
}
private static boolean findForcemount()
{
Log.d(TAG, "findForcemount()");
try
{
File file = new File(System.getenv("EXTERNAL_STORAGE") + "/forcemount");
if (file.exists())
{
return true;
}
} catch (Exception e)
{
Log.w(TAG, e.getMessage());
return false;
}
return false;
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

Before

Width:  |  Height:  |  Size: 820 KiB

After

Width:  |  Height:  |  Size: 820 KiB

View File

Before

Width:  |  Height:  |  Size: 235 KiB

After

Width:  |  Height:  |  Size: 235 KiB

View File

Before

Width:  |  Height:  |  Size: 630 KiB

After

Width:  |  Height:  |  Size: 630 KiB

View File

Before

Width:  |  Height:  |  Size: 233 KiB

After

Width:  |  Height:  |  Size: 233 KiB

View File

Before

Width:  |  Height:  |  Size: 417 KiB

After

Width:  |  Height:  |  Size: 417 KiB

View File

Before

Width:  |  Height:  |  Size: 235 KiB

After

Width:  |  Height:  |  Size: 235 KiB

View File

Before

Width:  |  Height:  |  Size: 235 KiB

After

Width:  |  Height:  |  Size: 235 KiB

View File

@@ -27,7 +27,7 @@ OBJS = objs/InteractiveButton.o objs/AbilityParser.o objs/ActionElement.o\
objs/ThisDescriptor.o objs/Token.o objs/Translate.o objs/TranslateKeys.o\
objs/Trash.o objs/utils.o objs/WEvent.o objs/WResourceManager.o\
objs/WCachedResource.o objs/WDataSrc.o objs/WGui.o objs/WFilter.o objs/Tasks.o\
objs/WFont.o objs/WParsedInt.o objs/CarouselDeckView.o objs/GridDeckView.o objs/DeckView.o
objs/WFont.o objs/CarouselDeckView.o objs/GridDeckView.o objs/DeckView.o
DEPS = $(patsubst objs/%.o, deps/%.d, $(OBJS))
RESULT = $(shell psp-config --psp-prefix 2> Makefile.cache)
@@ -59,6 +59,7 @@ endif
ifeq ($(TARGET_ARCHITECTURE),psp)
DEFAULT_RULE = 3xx
TARGET_ARCHITECTURE = psp
PSP_FW_VERSION=371
BUILD_PRX = 1
SIGN_PRX = 1
@@ -68,42 +69,24 @@ EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Wagic, the Homebrew?!
PSP_EBOOT_ICON = icon.png
#PSP_EBOOT_ICON1 = icon1.pmf
PSP_LARGE_MEMORY = 1
PSP_EBOOT_UNKPNG = pic0.png
PSP_EBOOT_PIC1 = pic1.png
INCDIR = ../../JGE/include ../../JGE/src/zipFS ../../JGE/include/psp ../../JGE/include/psp/freetype2 ../../JGE/src ../../projects/mtg/include ../../Boost
LIBDIR = ../../JGE/lib/psp
CFLAGS = -O2 -G0 -DPSPFW3XX -DDEVHOOK -DUSE_PRECOMPILED_HEADERS=1 -DPSP -DTIXML_USE_STL
else
ifeq ($(MAKECMDGOALS),x11)
OBJS += objs/TestSuiteAI.o
INCDIR = -I../../JGE/include -I../../JGE/src -I/usr/X11/include -I../../projects/mtg/include -I/usr/include/boost -I../../JGE/src/zipFS
LIBDIR = -L../../JGE/lib/linux -L../../JGE -L/usr/X11/lib
LIBS = -ljge -lfreetype -ljpeg -lgif -lpng -lz -lm -lstdc++ -lhgetools -lGL -lGLU -lX11 -lpthread $(FMOD)
CFLAGS = $(INCDIR) -DLINUX -DNETWORK_SUPPORT -DUSE_PRECOMPILED_HEADERS=1 -DTIXML_USE_STL -Wno-nonnull-compare
ASFLAGS = $(CXXFLAGS)
all: $(DEFAULT_RULE)
else
OBJS += objs/TestSuiteAI.o
INCDIR = -I../../JGE/include -I../../JGE/src -I/usr/X11/include -I../../projects/mtg/include -I../../Boost -I../../JGE/src/zipFS
LIBDIR = -L../../JGE/lib/linux -L../../JGE -L/usr/X11/lib -L../../Boost/lib
LIBS = -ljge -lfreetype -ljpeg -lgif -lpng -lz -lm -lstdc++ -lhgetools -lGL -lGLU -lX11 -lboost_thread $(FMOD)
CFLAGS = $(INCDIR) -DLINUX -DNETWORK_SUPPORT -DUSE_PRECOMPILED_HEADERS=1 -Wno-nonnull-compare
CFLAGS = $(INCDIR) -DLINUX -DUSE_PRECOMPILED_HEADERS=1
ASFLAGS = $(CXXFLAGS)
all: $(DEFAULT_RULE)
endif
endif
CFLAGS := -Wall -W -Werror -Wno-unused -Wno-deprecated-declarations $(CFLAGS)
CFLAGS := -Wall -W -Wno-unused $(CFLAGS)
CXXFLAGS += $(CFLAGS)
# -fno-exceptions
@@ -127,6 +110,8 @@ debug: all
else
$(TARGET): Makefile.$(TARGET_ARCHITECTURE) $(OBJS) ../../JGE/lib/linux/libjge.a
$(CXX) -o $(TARGET) $(OBJS) $(LIBS) $(LIBDIR)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Some files were not shown because too many files have changed in this diff Show More