1 Commits

Author SHA1 Message Date
Michael Nguyen
9cc2c6cc4d updated iOS UI issues:
* fixed status bar issue on iOS7, where status bar information was invisible on iOS7 devices
  * fixed some font issues on the Shop screens to make them more legible for iOS users. ( changed font size for Interactive Buttons and card list)
  * added new gesture for opening up the menu screen for iOS.  Since there are no external buttons on iOS devices, we need either on-screen buttons or gestures to compensate.  Using the pinch or zoom gesture will simulate pressing the "MENU" button on the PSP on all screens now.  Not ideal, but something for now until we can work in a new button or way to open up the menu.
2013-11-27 22:25:22 -08:00
858 changed files with 32202 additions and 142465 deletions

View File

@@ -1,30 +1,17 @@
language: objective-c
language: cpp
before_install:
- brew update
- brew install qt5
- sudo pip install pyjavaproperties
- sudo pip install github3.py
- brew install dpkg ldid
#- curl -s -f -L https://raw.github.com/r-plus/dotfiles/master/install_theos.sh | bash
- mkdir theos
- cd theos
- git clone --recursive https://github.com/theos/theos.git
- export THEOS="$TRAVIS_BUILD_DIR/theos"
- cd ..
- pwd
- ls
env:
global:
secure: "EBzr1+qjQsOhn0s+tcFmXR1jP9B0xiOSXuXbRXWZ1OEHNvp8+A5/pS84LYVFlaZqmxr5dApxvPtwhgLIUbQ3EPXm8LpC3KgSD4dS+9/QMbxhe5TK4oczgFRGcDTMJQZsCzhOh7hp3tbcbJg5Gp+VT7aFjFQSHDGwhzSJXsXwh/8="
script:
- /usr/local/opt/qt5/bin/qmake projects/mtg/wagic-qt.pro CONFIG+=graphics
- make -j 4 dmg
- cd projects/mtg/iOS
- make -j 4 package
- cd ../../..
after_success:
- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l wagic.dmg -r Wagic-macosx.dmg -b $TRAVIS_BRANCH
- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l projects/mtg/iOS/net.wagic_0.19.2-1_iphoneos-arm.deb -r Wagic-iOS.deb -b $TRAVIS_BRANCH
- export PSPDEV="$TRAVIS_BUILD_DIR/opt/pspsdk"
- export PSPSDK="$PSPDEV/psp/sdk"
- export PATH="$PATH:$PSPDEV/bin:$PSPSDK/bin"
- export ANDROID="android-sdk-linux/tools/android"
install:
- sudo apt-get update -qq
- if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch; fi
- 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
- tar -x --xz -f sdk.lzma
- wget http://dl.google.com/android/ndk/android-ndk-r9-linux-x86_64.tar.bz2 -nv
- wget http://dl.google.com/android/android-sdk_r22-linux.tgz -nv
- tar --absolute-names -jxf android-ndk-r9-linux-x86_64.tar.bz2
- tar -zxf android-sdk_r22-linux.tgz
- echo yes | $ANDROID update sdk --filter 1,2,3,8 --no-ui --force > log.txt
script: "./travis-script.sh"

View File

@@ -1,221 +0,0 @@
# Changelog
## [latest-master] (https://github.com/WagicProject/wagic/tree/latest-master)
#### 8/3/16
- *Merged pull-request:* andAbility on ATokenCreator, Extend AAFlip [#\824] (https://github.com/WagicProject/wagic/pull/824) ([kevlahnota](https://github.com/kevlahnota))
#### 7/31/16
- *Merged pull-request:* Fix Chandra, Flamecaller & Cryptolith Rite [#\818] (https://github.com/WagicProject/wagic/pull/818) ([kevlahnota](https://github.com/kevlahnota))
#### 7/28/16
- *Merged pull-request:* changing some of the logic to the previous fixes, we want to avoid using code that looks for specific card names. [#\800] (https://github.com/WagicProject/wagic/pull/800) ([zethfoxster](https://github.com/zethfoxster))
#### 7/26/16
- *Merged pull-request:* granted flashback [#\791] (https://github.com/WagicProject/wagic/pull/791) ([kevlahnota](https://github.com/kevlahnota))
#### 7/23/16
- *Merged pull-request:* Fix Flying vs Moat (multiples of them). Fixes issue #526 [#\783] (https://github.com/WagicProject/wagic/pull/783) ([kevlahnota](https://github.com/kevlahnota))
#### 7/19/16
- *Merged pull-request:* pushing to master [#\770] (https://github.com/WagicProject/wagic/pull/770) ([zethfoxster](https://github.com/zethfoxster))
#### 7/18/16
- *Merged pull-request:* Fix Deck Menu layer, Change Main Menu Layout, Fix Crash cdaactive on tokens [#\765] (https://github.com/WagicProject/wagic/pull/765) ([kevlahnota](https://github.com/kevlahnota))
#### 7/12/16
- *Merged pull-request:* Pushing fixes [#\750] (https://github.com/WagicProject/wagic/pull/750) ([zethfoxster](https://github.com/zethfoxster))
- *Merged pull-request:* try to fix failed logic here [#\747] (https://github.com/WagicProject/wagic/pull/747) ([kevlahnota](https://github.com/kevlahnota))
#### 7/9/16
- *Merged pull-request:* pushing to master [#\738] (https://github.com/WagicProject/wagic/pull/738) ([zethfoxster](https://github.com/zethfoxster))
- *Merged pull-request:* Sorted Primitives and Cleanup Tabs [#\736] (https://github.com/WagicProject/wagic/pull/736) ([kevlahnota](https://github.com/kevlahnota))
#### 7/7/16
- *Merged pull-request:* Sorted Primitives and Cleanup Tabs [#\727] (https://github.com/WagicProject/wagic/pull/719) ([kevlahnota](https://github.com/kevlahnota))
- *Merged pull-request:* push to wagicproject [#\725] (https://github.com/WagicProject/wagic/pull/725) ([zethfoxster](https://github.com/zethfoxster))
#### 7/4/16
- *Merged pull-request:* Sorted Primitives & Updated Premium Deck Series [#\719] (https://github.com/WagicProject/wagic/pull/719) ([kevlahnota](https://github.com/kevlahnota))
- *Merged pull-request:* Fails but I have no idea why [#\717] (https://github.com/WagicProject/wagic/pull/717) ([zethfoxster](https://github.com/zethfoxster))
- *Merged pull-request:* Updated Sets [#\715] (https://github.com/WagicProject/wagic/pull/715) ([kevlahnota](https://github.com/kevlahnota))
#### 7/2/16
- *Merged pull-request:* Updated Masters, Beginners, Duels and Vault Sets [#\714] (https://github.com/WagicProject/wagic/pull/714) ([kevlahnota](https://github.com/kevlahnota))
#### 7/1/16
- *Merged pull-request:* Cleaned and Sorted all Core and Expansion Sets [#\713] (https://github.com/WagicProject/wagic/pull/713) ([kevlahnota](https://github.com/kevlahnota))
- *Merged pull-request:* Soulbond Pair Indicator [#\712] (https://github.com/WagicProject/wagic/pull/712) ([kevlahnota](https://github.com/kevlahnota))
#### 6/30/16
- *Merged pull-request:* Sorted Primitives [#\711] (https://github.com/WagicProject/wagic/pull/711) ([kevlahnota](https://github.com/kevlahnota))
- *Merged pull-request:* Add Shackle Ability [#\710] (https://github.com/WagicProject/wagic/pull/710) ([kevlahnota](https://github.com/kevlahnota))
- *Merged pull-request:* Fix Cascade, Crash fix on lastController and some corrections [#\709] (https://github.com/WagicProject/wagic/pull/709) ([kevlahnota](https://github.com/kevlahnota))
#### 6/29/16
- *Merged pull-request:* Updated Primitives and Hide Highlight Border [#\707] (https://github.com/WagicProject/wagic/pull/707) ([kevlahnota](https://github.com/kevlahnota))
- *Committed:* Pretty huge patch here(sorry old habits never die :( ) [#\6ee00c1] (https://github.com/WagicProject/wagic/commit/6ee00c138ce374d54cb3ee034575ce440288ca0e) ([zethfoxster](https://github.com/zethfoxster))
#### 6/23/16
- *Merged pull-request:* Fix producecolor:color [#\704] (https://github.com/WagicProject/wagic/pull/704) ([kevlahnota](https://github.com/kevlahnota))
#### 6/17/16
- *Merged pull-request:* Force Mounting 2 [#\699] (https://github.com/WagicProject/wagic/pull/699) ([kevlahnota](https://github.com/kevlahnota))
#### 6/16/16
- *Merged pull-request:* Import Deck Options [#\697] (https://github.com/WagicProject/wagic/pull/697) ([kevlahnota](https://github.com/kevlahnota))
#### 6/11/16
- *Merged pull-request:* Refactor & Devotion [#\690] (https://github.com/WagicProject/wagic/pull/690) ([kevlahnota](https://github.com/kevlahnota))
#### 6/9/16
- *Closed issue:* Clone goes to graveyard before being able to copy anything [\#546](https://github.com/WagicProject/wagic/issues/546)
- *Closed issue:* Blinking an aura causes freeze [\#541](https://github.com/WagicProject/wagic/issues/541)
- *Closed issue:* Profile name at upper left side is not being updated correctly [\#469](https://github.com/WagicProject/wagic/issues/469)
- *Closed issue:* Giving card C protection from X does not remove cards attached to C which have quality X [\#464](https://github.com/WagicProject/wagic/issues/464)
- *Closed issue:* (graphical glitch) wood / gold textures [\#461](https://github.com/WagicProject/wagic/issues/461)
- *Closed issue:* Clone does not get all P/T bonuses [\#448](https://github.com/WagicProject/wagic/issues/448)
- *Closed issue:* Card "threaten" messes up the GUI [\#473](https://github.com/WagicProject/wagic/issues/473)
#### 6/7/16
- *Closed issue:* Emrakul isn't killed by creatures with deathtouch [\#597](https://github.com/WagicProject/wagic/issues/597)
#### 6/3/16
- *Merged pull-request:* Cost Increaser & Reducer Fix [#\676] (https://github.com/WagicProject/wagic/pull/676) ([kevlahnota](https://github.com/kevlahnota))
#### 5/30/16
- *Fixed Bug:* deckstats crash when "unlock cards" is used [#\668] (https://github.com/WagicProject/wagic/issues/668) ([zethfoxster](https://github.com/zethfoxster))
#### 5/26/16
- *Closed issue:* Nasty memleak crashing devices and its fix. [#\664] (https://github.com/WagicProject/wagic/issues/664) ([zethfoxster](https://github.com/zethfoxster))
#### 11/08/15
- *Merged pull-request:* produce mana for lands you/opponent could produce [#\658] (https://github.com/WagicProject/wagic/pull/658) ([kevlahnota](https://github.com/kevlahnota))
#### 11/07/15
- *Merged pull-request:* Manacost Changes, Anyzone for CDA, PayZero Cost [#\656] (https://github.com/WagicProject/wagic/pull/656) ([kevlahnota](https://github.com/kevlahnota))
#### 10/31/15
- *Merged pull-request:* Exile Zone, Altercost and Hand modifier [#\653] (https://github.com/WagicProject/wagic/pull/653) ([kevlahnota](https://github.com/kevlahnota))
#### 10/17/15
- *Merged pull-request:* Fix issue #473 #784 [#\646] (https://github.com/WagicProject/wagic/pull/646) ([kevlahnota](https://github.com/kevlahnota))
#### 10/15/15
- *Merged pull-request:* Bug Fix: Planeswalker Rule & ABlink return to play ability for Aura cards [#\644] (https://github.com/WagicProject/wagic/pull/644) ([kevlahnota](https://github.com/kevlahnota))
#### 10/14/15
- *Merged pull-request:* Fix Legend Rule [#\643] (https://github.com/WagicProject/wagic/pull/643) ([kevlahnota](https://github.com/kevlahnota))
#### 10/12/15
- *Merged pull-request:* Fix crash bug, support doubled res texture for background, avatars, menutitle [#\641] (https://github.com/WagicProject/wagic/pull/641) ([kevlahnota](https://github.com/kevlahnota))
#### 10/02/15
- *Merged pull-request:* LKI for power, toughness and basic abilities, produceextra ability [#\636] (https://github.com/WagicProject/wagic/pull/636) ([kevlahnota](https://github.com/kevlahnota))
#### 09/29/15
- *Merged pull-request:* Fix Recover Cards, Cloner, Copier, and Preliminary support for Madness [#\635] (https://github.com/WagicProject/wagic/pull/635) ([kevlahnota](https://github.com/kevlahnota))
#### 09/22/15
- *Merged pull-request:* Auraward, unattach event and statebased action for protection from quality [#\631] (https://github.com/WagicProject/wagic/pull/631) ([kevlahnota](https://github.com/kevlahnota))
#### 09/19/15
- *Merged pull-request:* PT Switch like Layer 7e and Token Indicator [#\626] (https://github.com/WagicProject/wagic/pull/626) ([kevlahnota](https://github.com/kevlahnota))
#### 09/18/15
- *Merged pull-request:* Token Cloning fix and colored PT [#\624] (https://github.com/WagicProject/wagic/pull/624) ([kevlahnota](https://github.com/kevlahnota))
#### 09/15/15
- *Merged pull-request:* CDA and X manacost on stack [\#623] (https://github.com/WagicProject/wagic/pull/623) ([kevlahnota](https://github.com/kevlahnota))
#### 08/12/14
- *Merged pull-request:* Fix for guild_keywords Devotion, added some "Chroma" cards [\#606](https://github.com/WagicProject/wagic/pull/606) ([kevlahnota](https://github.com/kevlahnota))
- *Merged pull-request:* added guild keywords, added specific life cost [\#605](https://github.com/WagicProject/wagic/pull/605) ([kevlahnota](https://github.com/kevlahnota))
- *Merged pull-request:* Buyback issue and a fix [\#604](https://github.com/WagicProject/wagic/pull/604) ([apollovy](https://github.com/apollovy))
- *Merged pull-request:* Feature/ios update xcode5.1 [\#602](https://github.com/WagicProject/wagic/pull/602) ([mjnguyen](https://github.com/mjnguyen))
- *Merged pull-request:* Remove dead code and fix circular initialization [\#601](https://github.com/WagicProject/wagic/pull/601) ([ZobyTwo](https://github.com/ZobyTwo))
- *Merged pull-request:* update android build tools version [\#600](https://github.com/WagicProject/wagic/pull/600) ([Rolzad73](https://github.com/Rolzad73))
- *Merged pull-request:* Attempt to make android tools fetching for TravisCI explicit and futureproof [\#599](https://github.com/WagicProject/wagic/pull/599) ([Rolzad73](https://github.com/Rolzad73))
- *Merged pull-request:* Damager keyword [\#598](https://github.com/WagicProject/wagic/pull/598) ([bjornsnoen](https://github.com/bjornsnoen))
- *Merged pull-request:* Fix a rarity mistake and a grammatical error [\#596](https://github.com/WagicProject/wagic/pull/596) ([bjornsnoen](https://github.com/bjornsnoen))
- *Merged pull-request:* Fix bug where the phase wheel got out of sync [\#588](https://github.com/WagicProject/wagic/pull/588) ([ZobyTwo](https://github.com/ZobyTwo))
- *Merged pull-request:* More easing [\#586](https://github.com/WagicProject/wagic/pull/586) ([ZobyTwo](https://github.com/ZobyTwo))
- *Merged pull-request:* Added Avatar Tokens created by Ajani Goldmane. [\#585](https://github.com/WagicProject/wagic/pull/585) ([bjornsnoen](https://github.com/bjornsnoen))
- *Merged pull-request:* Cleanup, usability fixes and source code documentation for DeckView.h and GridDeckView.h [\#583](https://github.com/WagicProject/wagic/pull/583) ([ZobyTwo](https://github.com/ZobyTwo))
- *Fixed bug:* Blight does not destroy at the end of turn but right now [\#592](https://github.com/WagicProject/wagic/issues/592)
- *Fixed bug:* game freezes on Android when the phone returns from "sleep mode" [\#544](https://github.com/WagicProject/wagic/issues/544)
- *Fixed bug:* Android port needs to be able to respond to attaching/detaching devices to it [\#522](https://github.com/WagicProject/wagic/issues/522)
## [alpha-195] (https://github.com/WagicProject/wagic/tree/alpha-195)
#### 07/12/13
- *Merged pull-request:* Reset positions and filters when reopening the editor [\#578](https://github.com/WagicProject/wagic/pull/578) ([ZobyTwo](https://github.com/ZobyTwo))
- *Merged pull-request:* Deck viewer [\#577](https://github.com/WagicProject/wagic/pull/577) ([ZobyTwo](https://github.com/ZobyTwo))
- *Merged pull-request:* Do not specify the system directory in JGE [\#576](https://github.com/WagicProject/wagic/pull/576) ([ZobyTwo](https://github.com/ZobyTwo))
- *Merged pull-request:* Changed Travis build file to use Android API 10 and Android build tools 18.1.1 [\#575](https://github.com/WagicProject/wagic/pull/575) ([Rolzad73](https://github.com/Rolzad73))
- *Merged pull-request:* Feature/play from grave [\#574](https://github.com/WagicProject/wagic/pull/574) ([pankdm](https://github.com/pankdm))
- *Merged pull-request:* Fix Valgrind warnings appearing during the test suit. [\#573](https://github.com/WagicProject/wagic/pull/573) ([ZobyTwo](https://github.com/ZobyTwo))
- *Merged pull-request:* Strings 2 [\#572](https://github.com/WagicProject/wagic/pull/572) ([ZobyTwo](https://github.com/ZobyTwo))
- *Merged pull-request:* Android travis ci [\#570](https://github.com/WagicProject/wagic/pull/570) ([xawotihs](https://github.com/xawotihs))
- *Merged pull-request:* Android NDK build fix [\#569](https://github.com/WagicProject/wagic/pull/569) ([Rolzad73](https://github.com/Rolzad73))
- *Merged pull-request:* Add a few namespaces and fix header guards. [\#564](https://github.com/WagicProject/wagic/pull/564) ([ZobyTwo](https://github.com/ZobyTwo))
- *Merged pull-request:* Updated deckmenu.cpp to properly render deck description and summary [\#562](https://github.com/WagicProject/wagic/pull/562) ([citiral](https://github.com/citiral))
- *Merged pull-request:* Fix some valgrind memcheck warnings. However there remains one... [\#561](https://github.com/WagicProject/wagic/pull/561) ([ZobyTwo](https://github.com/ZobyTwo))
- *Merged pull-request:* Remove some dead code [\#560](https://github.com/WagicProject/wagic/pull/560) ([ZobyTwo](https://github.com/ZobyTwo))
- *Merged pull-request:* Show output only for failing tests [\#559](https://github.com/WagicProject/wagic/pull/559) ([pankdm](https://github.com/pankdm))
- *Merged pull-request:* Defines/Typos [\#557](https://github.com/WagicProject/wagic/pull/557) ([ZobyTwo](https://github.com/ZobyTwo))
- *Merged pull-request:* Simplify Damage::resolve a bit [\#556](https://github.com/WagicProject/wagic/pull/556) ([ZobyTwo](https://github.com/ZobyTwo))
- *Merged pull-request:* Fix cranial plating [\#555](https://github.com/WagicProject/wagic/pull/555) ([pankdm](https://github.com/pankdm))
- *Merged pull-request:* Android cleanup [\#1](https://github.com/WagicProject/wagic/pull/1) ([Rolzad73](https://github.com/Rolzad73))
- *Fixed bug:* Iona and Nin don't work [\#527](https://github.com/WagicProject/wagic/issues/527)
- *Closed issue:* Less verbose output of tests at Travis [\#558](https://github.com/WagicProject/wagic/issues/558)
## [wagic-0.19.2] (https://github.com/WagicProject/wagic/tree/wagic-v0.19.2)
#### 28/10/13

View File

@@ -77,13 +77,6 @@ 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
/* Need CPU instructions for spinlock here! */
__need_spinlock_implementation__

Binary file not shown.

Binary file not shown.

View File

@@ -73,7 +73,7 @@
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>TIXML_USE_STL; SDL_CONFIG;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>SDL_CONFIG;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -101,7 +101,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>TIXML_USE_STL; SDL_CONFIG;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>SDL_CONFIG;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
@@ -129,7 +129,7 @@
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>TIXML_USE_STL; SDL_CONFIG;WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_HAS_ITERATOR_DEBBUGING=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>SDL_CONFIG;WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_HAS_ITERATOR_DEBBUGING=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>

View File

@@ -31,8 +31,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,7 +81,7 @@ 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/
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

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()); \
OutputDebugString(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

@@ -1,128 +0,0 @@
#ifndef DOWNLOADER_H
#define DOWNLOADER_H
//-------------------------------------------------------------------------------------
//
// This class handles download of remote resources (any kind of file)
// All the resources are stored locally in the userPath
// For every resources, the downloader verifies if the resource was modifed
// on the server before downloading the update. The Downloader maintains a catalogue
// of resource downloaded to be able to check if they need to be updated.
//
// The interface can be used completly synchronously by the application and some
// context or message loop is needed in the implementation of this interface
//
// Note that the Downloader could in theory by implemented on top of JNetwork.
//
//-------------------------------------------------------------------------------------
#include <string>
#include <ostream>
#include <istream>
#include <fstream>
#include <map>
#include "Threading.h"
#ifdef QT_CONFIG
#include <QObject>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QNetworkAccessManager>
#endif
using namespace std;
class DownloadRequest
#ifdef QT_CONFIG
: public QObject
#endif
{
#ifdef QT_CONFIG
Q_OBJECT
private slots:
#endif
void fileDownloaded();
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
#ifdef QT_CONFIG
signals:
void percentChanged(int percent);
void statusChanged(int);
#endif
public:
typedef enum {
NOT_PRESENT,
DOWNLOADING,
DOWNLOADED,
DOWNLOAD_ERROR
} DownloadStatus;
protected:
string mLocalPath;
string mRemoteResourceURL;
// previous one is the original, next one can change after redirection
string mRequestedRemoteResourceURL;
string mETag;
DownloadStatus mDownloadStatus;
bool mUpgradeAvailable;
size_t mTotalSize;
size_t mCurrentSize;
ofstream mFile;
#ifdef QT_CONFIG
QNetworkReply* mNetworkReply;
static QNetworkAccessManager networkAccessManager;
#endif
public:
DownloadRequest(string localPath="",
string remoteResourceURL="",
string ETag = "",
DownloadStatus downloadStatus=NOT_PRESENT,
size_t totalSize = 0,
size_t currentSize = 0);
~DownloadRequest();
static bool NetworkIsAccessible();
string getTempLocalPath() const { return (mLocalPath+".tmp"); };
string getLocalPath() const { return mLocalPath; };
string getRemoteResource() const { return mRemoteResourceURL; };
string getETag() const { return mETag; };
void startGet();
void startHead();
DownloadStatus getDownloadStatus() const { return mDownloadStatus; };
bool upgradeAvailable() const { return mUpgradeAvailable; };
void getSizes(size_t& totalSize, size_t&currentSize) {
totalSize = mTotalSize;
currentSize = mCurrentSize;
};
friend ostream& operator<<(ostream& out, const DownloadRequest& d);
friend istream& operator>>(istream&, DownloadRequest&);
friend class Downloader;
};
class Downloader
{
protected:
Downloader(string globalRemoteURL="", string localCacheRecords="");
virtual ~Downloader();
static Downloader* mInstance;
string mGlobalRemoteURL;
string mLocalCacheRecords;
boost::mutex mMutex;
map<string, DownloadRequest*> mRequestMap;
public:
static Downloader* GetInstance();
static void Release();
void Update();
DownloadRequest* Get(string localPath, string remoteResourceURL="");
friend ostream& operator<<(ostream& out, const Downloader& d);
friend istream& operator>>(istream&, Downloader&);
};
#endif // DOWNLOADER_H

View File

@@ -297,6 +297,7 @@ public:
private:
float mTimer;
float mFrameTime;
JAnimator* mAnimator;
vector<JAnimatorObject *> mObjects;
};

View File

@@ -37,6 +37,7 @@ private:
float mTexY;
float mTexWidth;
float mTexHeight;
JTexture* mTexture;
JQuad* mQuad;

View File

@@ -128,7 +128,6 @@ public:
bool readIntoString(const string & FilePath, string & target);
bool openForWrite(ofstream & File, const string & FilePath, ios_base::openmode mode = ios_base::out );
bool Rename(string from, string to);
bool Remove(string aFile);
//Returns true if strFilename exists somewhere in the fileSystem
bool FileExists(const string& strFilename);
@@ -164,4 +163,4 @@ protected:
#endif
#endif

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

@@ -23,32 +23,28 @@
#include "SLES/OpenSLES_Android.h"
#elif defined USE_PHONON
#include <phonon/AudioOutput>
#include <phonon/MediaObject>
#elif (defined QT_CONFIG)
#include "QMediaPlayer"
#include "QMediaPlaylist"
#include "QSoundEffect"
#include <phonon/AudioOutput>
#include <phonon/MediaObject>
#elif defined WIN32
#include <windows.h>
#include <windows.h>
#define WITH_FMOD
#elif defined (PSP)
#include <pspgu.h>
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <time.h>
#include <string.h>
#include <pspaudiolib.h>
#include <psprtc.h>
#include <pspgu.h>
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <time.h>
#include <string.h>
#include <pspaudiolib.h>
#include <psprtc.h>
#include "JAudio.h"
#include "JMP3.h"
#include "JAudio.h"
#include "JMP3.h"
#endif
#ifdef WITH_FMOD
#include "../Dependencies/include/fmod.h"
#include "../Dependencies/include/fmod.h"
#endif
//------------------------------------------------------------------------------------------------
@@ -71,7 +67,7 @@ public:
#ifdef USE_PHONON
Phonon::AudioOutput* mOutput;
Phonon::MediaObject* mMediaObject;
public slots:
public slots:
void seekAtTheBegining();
#elif defined (PSP)
JMP3* mTrack;
@@ -86,10 +82,6 @@ public slots:
SLPlayItf playInterface;
SLSeekItf seekInterface;
SLVolumeItf musicVolumeInterface;
#elif (defined QT_CONFIG)
QMediaPlaylist* playlist;
QMediaPlayer* player;
string fullpath;
#else
void* mTrack;
#endif //WITH_FMOD
@@ -100,15 +92,13 @@ public slots:
//------------------------------------------------------------------------------------------------
class JSample
{
public:
public:
JSample();
~JSample();
unsigned long fileSize();
#if (defined QT_CONFIG) && (!defined USE_PHONON)
QMediaPlayer* effect;
void* mSample;
#elif defined (PSP)
#if defined (PSP)
WAVDATA *mSample;
#elif defined (IOS)
std::string filename;
@@ -143,130 +133,126 @@ class JSoundSystem
public:
//////////////////////////////////////////////////////////////////////////
/// Get the singleton instance
///
//////////////////////////////////////////////////////////////////////////
static JSoundSystem* GetInstance();
//////////////////////////////////////////////////////////////////////////
/// Get the singleton instance
///
//////////////////////////////////////////////////////////////////////////
static JSoundSystem* GetInstance();
static void Destroy();
static void Destroy();
//////////////////////////////////////////////////////////////////////////
/// Load music.
///
/// @note MP3 is the only supported format for the moment.
///
/// @param filename - Name of the music file.
///
//////////////////////////////////////////////////////////////////////////
JMusic *LoadMusic(const char *fileName);
//////////////////////////////////////////////////////////////////////////
/// Load music.
///
/// @note MP3 is the only supported format for the moment.
///
/// @param filename - Name of the music file.
///
//////////////////////////////////////////////////////////////////////////
JMusic *LoadMusic(const char *fileName);
//////////////////////////////////////////////////////////////////////////
/// Delete music from memory.
///
/// @param music - Music to be deleted.
///
//////////////////////////////////////////////////////////////////////////
//void FreeMusic(JMusic *music);
//////////////////////////////////////////////////////////////////////////
/// Delete music from memory.
///
/// @param music - Music to be deleted.
///
//////////////////////////////////////////////////////////////////////////
//void FreeMusic(JMusic *music);
//////////////////////////////////////////////////////////////////////////
/// Play music.
///
/// @param music - Music to be played.
/// @param looping - Play the music in a loop.
///
//////////////////////////////////////////////////////////////////////////
void PlayMusic(JMusic *music, bool looping = false);
//////////////////////////////////////////////////////////////////////////
/// Play music.
///
/// @param music - Music to be played.
/// @param looping - Play the music in a loop.
///
//////////////////////////////////////////////////////////////////////////
void PlayMusic(JMusic *music, bool looping = false);
//////////////////////////////////////////////////////////////////////////
/// Stop playing.
///
/// @param music - Music to be stopped.
///
//////////////////////////////////////////////////////////////////////////
void StopMusic(JMusic *music);
//////////////////////////////////////////////////////////////////////////
/// Stop playing.
///
/// @param music - Music to be stopped.
///
//////////////////////////////////////////////////////////////////////////
void StopMusic(JMusic *music);
//////////////////////////////////////////////////////////////////////////
/// Resume playing.
///
/// @param music - Music to be resumed.
///
//////////////////////////////////////////////////////////////////////////
void ResumeMusic(JMusic *music);
//////////////////////////////////////////////////////////////////////////
/// Resume playing.
///
/// @param music - Music to be resumed.
///
//////////////////////////////////////////////////////////////////////////
void ResumeMusic(JMusic *music);
//////////////////////////////////////////////////////////////////////////
/// Pause playing.
///
/// @param music - Music to be paused.
///
//////////////////////////////////////////////////////////////////////////
void PauseMusic(JMusic *music);
//////////////////////////////////////////////////////////////////////////
/// Pause playing.
///
/// @param music - Music to be paused.
///
//////////////////////////////////////////////////////////////////////////
void PauseMusic(JMusic *music);
//////////////////////////////////////////////////////////////////////////
/// Load sound effect.
///
/// @note WAV sound effect only.
///
/// @param fileName - Sound effect for loading.
///
//////////////////////////////////////////////////////////////////////////
JSample *LoadSample(const char *fileName);
//////////////////////////////////////////////////////////////////////////
/// Load sound effect.
///
/// @note WAV sound effect only.
///
/// @param fileName - Sound effect for loading.
///
//////////////////////////////////////////////////////////////////////////
JSample *LoadSample(const char *fileName);
//////////////////////////////////////////////////////////////////////////
/// Delete sound effect from memory.
///
/// @param sample - Sound to be deleted.
///
//////////////////////////////////////////////////////////////////////////
//void FreeSample(JSample *sample);
//////////////////////////////////////////////////////////////////////////
/// Delete sound effect from memory.
///
/// @param sample - Sound to be deleted.
///
//////////////////////////////////////////////////////////////////////////
//void FreeSample(JSample *sample);
//////////////////////////////////////////////////////////////////////////
/// Play sound effect.
///
/// @param sample - Sound for playing.
///
//////////////////////////////////////////////////////////////////////////
void PlaySample(JSample *sample);
//////////////////////////////////////////////////////////////////////////
/// Play sound effect.
///
/// @param sample - Sound for playing.
///
//////////////////////////////////////////////////////////////////////////
void PlaySample(JSample *sample);
//////////////////////////////////////////////////////////////////////////
/// Set volume for audio playback.
///
/// @param volume - New volume.
///
//////////////////////////////////////////////////////////////////////////
void SetVolume(int volume);
//////////////////////////////////////////////////////////////////////////
/// Set volume for audio playback.
///
/// @param volume - New volume.
///
//////////////////////////////////////////////////////////////////////////
void SetVolume(int volume);
void SetMusicVolume(int volume);
void SetMusicVolume(int volume);
void SetSfxVolume(int volume);
void SetSfxVolume(int volume);
int mChannel;
int mChannel;
protected:
JSoundSystem();
~JSoundSystem();
JSoundSystem();
~JSoundSystem();
void InitSoundSystem();
void DestroySoundSystem();
void InitSoundSystem();
void DestroySoundSystem();
private:
#if (defined PSP || defined ANDROID)
JMusic *mCurrentMusic;
JMusic *mCurrentMusic;
JSample *mCurrentSample;
#endif
int mVolume;
#ifndef IOS
int mMusicVolume;
#endif
int mSampleVolume;
int mVolume;
int mMusicVolume;
int mSampleVolume;
static JSoundSystem* mInstance;
static JSoundSystem* mInstance;
};
#endif

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

@@ -1,7 +1,7 @@
#ifndef THREADING_H
#define THREADING_H
#if !defined(PSP) && !defined(QT_CONFIG) && !(__cplusplus > 199711L)
#if !defined(PSP) && !defined(QT_CONFIG)
#include <boost/date_time.hpp>
#ifdef WIN32
@@ -14,7 +14,7 @@
#endif
#include <boost/thread/mutex.hpp>
#elif defined(PSP)
#elif !defined(QT_CONFIG)
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
@@ -26,7 +26,7 @@
namespace boost
{
/**
** PSP specific variant of a boost mutex & scoped_lock
** PSP specific variant of a boost mutex & scoped_lock
*/
template <class Mutex>
@@ -60,7 +60,7 @@ namespace boost
{
sceKernelDeleteSema(mID);
}
void lock()
{
int result = sceKernelWaitSema(mID, 1, 0);
@@ -142,7 +142,7 @@ namespace boost
}
}
int mID;
int mThreadID;
volatile int mRecursionCount;
@@ -164,7 +164,7 @@ namespace boost
/**
** Emulating boost::thread configuration glue, with some shortcuts
** Emulating boost::thread configuration glue, with some shortcuts
** This detail namespace is a distillation of boost's thread.hpp, thread_data.hpp.
*/
namespace detail
@@ -212,13 +212,13 @@ namespace boost
**
** The intent of its usage is this form only:
** mWorkerThread = boost::thread(ThreadProc, this);
** where ThreadProc is a static member function of the 'this' class,eg:
** static void FOO::ThreadProc(void* inParam)
** {
** FOO* instance = reinterpret_cast<FOO*>(inParam);
** // now you have class instance data available...
** }
**
** where ThreadProc is a static member function of the 'this' class,eg:
** static void FOO::ThreadProc(void* inParam)
** {
** FOO* instance = reinterpret_cast<FOO*>(inParam);
** // now you have class instance data available...
** }
**
** Any other variant of a thread proc with more than one param is unimplemented.
*/
class thread
@@ -227,7 +227,7 @@ namespace boost
** Helper class for sceKernelStartThread, which passes args by value, not by reference
** We use this struct to wrap any pointers that we want to pass to the worker thread.
*/
struct CallbackData
struct CallbackData
{
CallbackData(detail::thread_data_ptr inThreadInfo)
: mThreadInfo(inThreadInfo)
@@ -307,11 +307,13 @@ namespace boost
}
}
#elif defined(QT_CONFIG) && (__cplusplus <= 199711L)
#elif defined(QT_CONFIG)
#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;
@@ -537,80 +537,6 @@ namespace boost
}
}
#elif (__cplusplus > 199711L)
#include <thread>
#include <mutex>
namespace boost
{
typedef std::thread thread;
template <class Mutex>
struct unique_lock
{
unique_lock(Mutex& inMutex) : mMutex(&inMutex)
{
mMutex->lock();
}
~unique_lock()
{
mMutex->unlock();
}
Mutex* mMutex;
};
class mutex
{
public:
typedef unique_lock<mutex> scoped_lock;
mutex()
: mQMutex()
{
}
~mutex()
{
}
void lock()
{
mQMutex.lock();
}
void unlock()
{
mQMutex.unlock();
}
std::mutex mQMutex;
private:
mutex(mutex const&);
mutex& operator=(mutex const&);
};
namespace posix_time
{
typedef unsigned int milliseconds;
}
/**
** boost's platform neutral sleep call.
*/
namespace this_thread
{
inline void sleep(boost::posix_time::milliseconds const& time)
{
std::this_thread::sleep_for(std::chrono::milliseconds(time));
}
}
}
#endif
#endif // THREADING_H

View File

@@ -136,20 +136,6 @@ signals:
private slots:
private:
int lastPosx(){
#if QT_VERSION >= 0x050100
return m_lastPos.x()*devicePixelRatio();
#else
return m_lastPos.x();
#endif
}
int lastPosy(){
#if QT_VERSION >= 0x050100
return m_lastPos.y()*devicePixelRatio();
#else
return m_lastPos.y();
#endif
}
void timerEvent( QTimerEvent* );
void doAndEnqueue(JButton action) {
m_engine->HoldKey_NoRepeat(action);
@@ -168,7 +154,6 @@ private:
int m_timerId;
bool m_active;
QRect m_viewPort;
QPoint m_lastPos;
#ifdef QT_WIDGET
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
int mMouseDownX;

Binary file not shown.

Binary file not shown.

View File

@@ -1,298 +0,0 @@
#include "DebugRoutines.h"
#include "JFileSystem.h"
#include "Downloader.h"
#define RECORDS_DEFAULT_FILE "cache/records.txt"
#ifdef QT_CONFIG
QNetworkAccessManager DownloadRequest::networkAccessManager;
#endif
DownloadRequest::DownloadRequest(string localPath,
string remoteResourceURL,
string ETag,
DownloadStatus downloadStatus,
size_t totalSize,
size_t currentSize):
mLocalPath(localPath),
mRemoteResourceURL(remoteResourceURL),
mRequestedRemoteResourceURL(remoteResourceURL),
mETag(ETag),
mDownloadStatus(downloadStatus),
mUpgradeAvailable(false),
mTotalSize(totalSize),
mCurrentSize(currentSize)
{
}
DownloadRequest::~DownloadRequest()
{
}
void DownloadRequest::startHead()
{
#ifdef QT_CONFIG
QNetworkRequest request(QUrl(QString(mRequestedRemoteResourceURL.c_str())));
request.setRawHeader("If-None-Match", mETag.c_str());
mNetworkReply = networkAccessManager.head(request);
connect(mNetworkReply, SIGNAL(finished()), SLOT(fileDownloaded()));
#endif
}
void DownloadRequest::startGet()
{
#ifdef QT_CONFIG
mNetworkReply = networkAccessManager.get(QNetworkRequest(QUrl(QString(mRequestedRemoteResourceURL.c_str()))));
#endif
mFile.close();
JFileSystem::GetInstance()->Remove(getTempLocalPath());
JFileSystem::GetInstance()->openForWrite(mFile, getTempLocalPath());
#ifdef QT_CONFIG
connect(mNetworkReply, SIGNAL(downloadProgress(qint64, qint64)),
SLOT(downloadProgress(qint64, qint64)));
connect(mNetworkReply, SIGNAL(finished()), SLOT(fileDownloaded()));
#endif
}
void DownloadRequest::fileDownloaded()
{
do {
QByteArray eTagByteArray = mNetworkReply->rawHeader("ETag");
if(!eTagByteArray.isEmpty()) {
string oldETag = mETag;
mETag = QString(eTagByteArray).toStdString();
if(oldETag!="" && oldETag != mETag)
mUpgradeAvailable = true;
}
// let's check some error
if(mNetworkReply->error() != QNetworkReply::NoError) {
DebugTrace(mNetworkReply->errorString().toStdString());
mDownloadStatus = DownloadRequest::DOWNLOAD_ERROR;
mFile.close();
JFileSystem::GetInstance()->Remove(getTempLocalPath());
break;
}
// check if we're getting redirected
QVariant redirectionTarget = mNetworkReply->attribute(QNetworkRequest::RedirectionTargetAttribute);
if (!redirectionTarget.isNull()) {
QUrl newUrl = QUrl(mRequestedRemoteResourceURL.c_str()).resolved(redirectionTarget.toUrl());
DebugTrace(string("Redirect to ")+ newUrl.toString().toStdString());
mRequestedRemoteResourceURL = newUrl.toString().toStdString();
mNetworkReply->deleteLater();
if(mFile.is_open())
startGet();
else
startHead();
return;
}
if(mFile.is_open())
{
QByteArray byteArray = mNetworkReply->readAll();
mFile.write(byteArray.constData(), byteArray.size());
mFile.close();
if(!JFileSystem::GetInstance()->Rename(getTempLocalPath(), mLocalPath)) {
mDownloadStatus = DownloadRequest::DOWNLOAD_ERROR;
break;
}
}
mDownloadStatus = DownloadRequest::DOWNLOADED;
} while(0);
Downloader::GetInstance()->Update();
mNetworkReply->deleteLater();
emit statusChanged((int)mDownloadStatus);
}
void DownloadRequest::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
{
QByteArray byteArray = mNetworkReply->readAll();
mFile.write(byteArray.constData(), byteArray.size());
mCurrentSize = bytesReceived;
mTotalSize = bytesTotal;
int percent = 0;
if(bytesTotal)
percent = (bytesReceived/bytesTotal)*100;
emit percentChanged(percent);
}
Downloader* Downloader::mInstance = 0;
Downloader::Downloader(string globalRemoteURL, string localcacheRecords):
mGlobalRemoteURL(globalRemoteURL),
mLocalCacheRecords(localcacheRecords)
{
JFileSystem::GetInstance()->MakeDir("cache");
izfstream downloadRecords;
if(mLocalCacheRecords.empty())
mLocalCacheRecords = RECORDS_DEFAULT_FILE;
if(JFileSystem::GetInstance()->openForRead(downloadRecords, mLocalCacheRecords))
{// File exists, let's read it.
downloadRecords >> (*this);
}
JFileSystem::GetInstance()->CloseFile();
}
Downloader::~Downloader()
{
map<string, DownloadRequest*>::iterator ite;
for(ite = mRequestMap.begin(); ite != mRequestMap.end(); ite++)
{
delete (*ite).second;
}
mRequestMap.erase(mRequestMap.begin(), mRequestMap.end());
}
Downloader* Downloader::GetInstance()
{
if(!mInstance)
{
mInstance = new Downloader();
}
return mInstance;
}
void Downloader::Release()
{
if(mInstance)
{
delete mInstance;
mInstance = 0;
}
}
bool DownloadRequest::NetworkIsAccessible()
{
bool result = false;
#ifdef QT_CONFIG
networkAccessManager.setNetworkAccessible(QNetworkAccessManager::Accessible);
result = networkAccessManager.networkAccessible();
#endif
return result;
}
DownloadRequest* Downloader::Get(string localPath, string remoteResourceURL)
{
map<string, DownloadRequest*>::iterator ite = mRequestMap.find(localPath);
if(ite == mRequestMap.end())
{ // request does not exist, let's create it
DownloadRequest* request = new DownloadRequest(localPath, remoteResourceURL);
std::pair<std::map<string,DownloadRequest*>::iterator,bool> ret;
ret = mRequestMap.insert ( std::pair<string,DownloadRequest*>(localPath, request) );
if (ret.second==false) {
DebugTrace("Downloader::Get Error inserting request in Map");
return 0;
}
ite = ret.first;
}
// Now, we can check the server
if((*ite).second->getDownloadStatus() == DownloadRequest::NOT_PRESENT ||
(*ite).second->upgradeAvailable())
{ // File is not here or an update is available, let's get it
(*ite).second->startGet();
(*ite).second->mDownloadStatus = DownloadRequest::DOWNLOADING;
}
else if ((*ite).second->getDownloadStatus() == DownloadRequest::DOWNLOADED)
{ // File is here, let's check if there is some update without blocking the playback
(*ite).second->startHead();
}
return (*ite).second;
}
void Downloader::Update()
{
ofstream downloadRecords;
if(JFileSystem::GetInstance()->openForWrite(downloadRecords, mLocalCacheRecords))
{
downloadRecords << (*this);
}
downloadRecords.close();
}
ostream& operator<<(ostream& out, const DownloadRequest& d)
{
// HEAD request fails, so this line erase cache record after upgrade check :(
// if(d.getDownloadStatus() == DownloadRequest::DOWNLOADED)
{
out << "localPath=" << d.mLocalPath << endl;
out << "remoteResource=" << d.mRemoteResourceURL << endl;
out << "ETag=" << d.mETag << endl;
out << "upgradeAvailable=" << d.mUpgradeAvailable <<endl;
}
return out;
}
istream& operator>>(istream& in, DownloadRequest& d)
{
string s;
while(std::getline(in, s))
{
size_t limiter = s.find("=");
string areaS;
if (limiter != string::npos)
{
areaS = s.substr(0, limiter);
if (areaS.compare("localPath") == 0)
{
d.mLocalPath = s.substr(limiter + 1);
}
else if (areaS.compare("remoteResource") == 0)
{
d.mRemoteResourceURL = s.substr(limiter + 1);
d.mRequestedRemoteResourceURL = d.mRemoteResourceURL;
}
else if (areaS.compare("ETag") == 0)
{
d.mETag = s.substr(limiter + 1);
d.mDownloadStatus = DownloadRequest::DOWNLOADED;
}
else if (areaS.compare("upgradeAvailable") == 0)
{
d.mUpgradeAvailable = (bool)atoi(s.substr(limiter + 1).c_str());
break;
}
}
}
return in;
}
ostream& operator<<(ostream& out, const Downloader& d)
{
map<string, DownloadRequest*>::const_iterator ite;
for(ite = d.mRequestMap.begin(); ite != d.mRequestMap.end(); ite++)
{
out << (*(*ite).second) << endl;
}
return out;
}
istream& operator>>(istream& in, Downloader& d)
{
while(!in.eof())
{
DownloadRequest* downloadRequest = new DownloadRequest();
in >> (*downloadRequest);
if(!downloadRequest->getLocalPath().empty() &&
!downloadRequest->getRemoteResource().empty() &&
!downloadRequest->getETag().empty()) {
d.mRequestMap[downloadRequest->getLocalPath()] = downloadRequest;
} else {
delete downloadRequest;
}
}
return in;
}

View File

@@ -67,7 +67,7 @@ bool JAnimator::Load(const char* scriptFile)
element = script->ToElement();
printf("---- Loading %s:%s\n", element->Value(), element->Attribute("name"));
string type[] =
const char *type[] =
{
"ANIMATION_TYPE_LOOPING",
"ANIMATION_TYPE_ONCE_AND_STAY",
@@ -78,7 +78,7 @@ bool JAnimator::Load(const char* scriptFile)
const char* aniType = element->Attribute("type");
for (int i=0;i<5;i++)
if (type[i] == aniType)
if (strcmp(type[i], aniType)==0)
{
SetAnimationType(i);
break;
@@ -108,7 +108,7 @@ bool JAnimator::Load(const char* scriptFile)
element = param->ToElement();
if (element != NULL)
{
if (element->ValueStr() == "settings")
if (strcmp(element->Value(), "settings")==0)
{
const char* quadName = element->Attribute("quad");
JQuad* quad = mResource->GetQuad(quadName);

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()
@@ -137,7 +126,7 @@ JFileSystem::JFileSystem(const string & _userPath, const string & _systemPath)
DebugTrace("User path " << userPath);
#elif defined (QT_CONFIG)
QDir sysDir(RESDIR);
QDir sysDir("projects/mtg/bin/Res");
QDir dir(QDir::homePath());
dir.mkdir(USERDIR);
dir.cd(USERDIR);
@@ -259,7 +248,7 @@ void JFileSystem::clearZipCache()
bool JFileSystem::AttachZipFile(const string &zipfile, char *password /* = NULL */)
{
if (mZipAvailable && mZipFile.is_open())
if (mZipAvailable && mZipFile != NULL)
{
if (mZipFileName != zipfile)
DetachZipFile(); // close the previous zip file
@@ -324,15 +313,11 @@ bool JFileSystem::readIntoString(const string & FilePath, string & target)
int fileSize = GetFileSize(file);
#ifndef __MINGW32__
try {
#endif
target.resize((std::string::size_type) fileSize);
#ifndef __MINGW32__
} catch (bad_alloc&) {
return false;
}
#endif
if (fileSize)
@@ -568,13 +553,7 @@ bool JFileSystem::Rename(string _from, string _to)
string from = mUserFSPath + _from;
string to = mUserFSPath + _to;
std::remove(to.c_str());
return (rename(from.c_str(), to.c_str()) == 0);
}
bool JFileSystem::Remove(string aFile)
{
string toRemove = mUserFSPath + aFile;
return (std::remove(toRemove.c_str()) == 0);
return rename(from.c_str(), to.c_str()) ? true: false;
}
int JFileSystem::GetFileSize(izfstream & file)

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)

View File

@@ -65,7 +65,7 @@ void JQuad::SetHotSpot(float x, float y)
//////////////////////////////////////////////////////////////////////////
JTexture::JTexture() : mWidth(0), mHeight(0), mBuffer(NULL)
JTexture::JTexture() : mBuffer(NULL)
{
mTexId = -1;
}
@@ -305,12 +305,14 @@ void JRenderer::TransferTextureToGLContext(JTexture& inTexture)
JTexture* JRenderer::CreateTexture(int width, int height, int mode __attribute__((unused)))
{
JTexture *tex = new JTexture();
return tex;
}
JTexture* JRenderer::LoadTexture(const char* filename, int mode, int textureFormat)
{
JTexture *tex = new JTexture();
return tex;
}

View File

@@ -75,10 +75,10 @@ bool JOBJModel::Load(const char *modelName, const char *textureName)
int count;
while (filePtr < size)
{
while (filePtr < size)
{
filePtr = ReadLine(tmpLine, buffer, filePtr, size);
{
{
if ((tmpLine[0] == '#') || (strlen(tmpLine) < 3))
{
@@ -89,19 +89,19 @@ bool JOBJModel::Load(const char *modelName, const char *textureName)
if (count == 4)
{
if (string("vn") == s1)
if (strcmp(s1, "vn") == 0)
normalList.push_back(vert);
else if (string("vt") == s1)
else if (strcmp(s1, "vt") == 0)
texList.push_back(vert);
else if (string("v") == s1)
else if (strcmp(s1, "v") == 0)
vertList.push_back(vert);
}
else if (count == 3)
{
if (string("vt") == s1)
if (strcmp(s1, "vt") == 0)
texList.push_back(vert);
}
}
else if (tmpLine[0] == 'f')
{
@@ -211,7 +211,7 @@ bool JOBJModel::Load(const char *modelName, const char *textureName)
if (textureName != NULL)
mTexture = JRenderer::GetInstance()->LoadTexture(textureName);
return true;
return true;
}

View File

@@ -90,7 +90,7 @@ bool JParticleEffect::Load(const char* filename)
// FIELD_COUNT
// };
const string lifeValues[] =
const char* lifeValues[] =
{
"speed",
"size",
@@ -104,7 +104,7 @@ bool JParticleEffect::Load(const char* filename)
"gravity"
};
const string typeNames[] =
const char* typeNames[] =
{
"POINT",
"AREA",
@@ -113,7 +113,7 @@ bool JParticleEffect::Load(const char* filename)
"CIRCLE"
};
const string modeNames[] =
const char* modeNames[] =
{
"REPEAT",
"ONCE",
@@ -149,32 +149,32 @@ bool JParticleEffect::Load(const char* filename)
{
element = param->ToElement();
if (string("settings") == element->Attribute("name"))
if (strcmp(element->Attribute("name"), "settings")==0)
{
if (string("NORMAL") == element->Attribute("blend"))
if (strcmp(element->Attribute("blend"), "NORMAL")==0)
mParticleEmitters[mEmitterCount]->SetBlending(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
else if (string("ADDITIVE") == element->Attribute("blend"))
else if (strcmp(element->Attribute("blend"), "ADDITIVE")==0)
mParticleEmitters[mEmitterCount]->SetBlending(BLEND_SRC_ALPHA, BLEND_ONE);
for (unsigned int i=0;i<sizeof(modeNames)/sizeof(char*);i++)
{
if (modeNames[i] == element->Attribute("mode"))
if (strcmp(element->Attribute("mode"), modeNames[i])==0)
{
mParticleEmitters[mEmitterCount]->mEmitterMode = i;
#if defined (_DEBUG)
printf("emitter mode:%s\n", modeNames[i].c_str());
printf("emitter mode:%s\n", modeNames[i]);
#endif
break;
}
}
for (unsigned i=0;i<sizeof(typeNames)/sizeof(char*);i++)
{
if (typeNames[i] == element->Attribute("type"))
if (strcmp(element->Attribute("type"), typeNames[i])==0)
{
mParticleEmitters[mEmitterCount]->mType = i;
#if defined (_DEBUG)
printf("emitter type:%s\n", typeNames[i].c_str());
printf("emitter type:%s\n", typeNames[i]);
#endif
break;
}
@@ -213,7 +213,7 @@ bool JParticleEffect::Load(const char* filename)
}
}
else if (string("quantity") == element->Attribute("name"))
else if (strcmp(element->Attribute("name"), "quantity")==0)
{
for (key = param->FirstChild(); key; key = key->NextSibling())
{
@@ -227,7 +227,7 @@ bool JParticleEffect::Load(const char* filename)
}
}
else if (string("lifex") == element->Attribute("name"))
else if (strcmp(element->Attribute("name"), "lifex")==0)
{
if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS &&
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
@@ -236,7 +236,7 @@ bool JParticleEffect::Load(const char* filename)
mParticleEmitters[mEmitterCount]->mLifeMax= value;
}
}
else if (string("anglex") == element->Attribute("name"))
else if (strcmp(element->Attribute("name"), "anglex")==0)
{
if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS &&
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
@@ -245,7 +245,7 @@ bool JParticleEffect::Load(const char* filename)
mParticleEmitters[mEmitterCount]->mAngleMax= value*DEG2RAD;
}
}
else if (string("speedx") == element->Attribute("name"))
else if (strcmp(element->Attribute("name"), "speedx")==0)
{
if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS &&
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
@@ -254,7 +254,7 @@ bool JParticleEffect::Load(const char* filename)
mParticleEmitters[mEmitterCount]->mSpeedMax= value;
}
}
else if (string("sizex") == element->Attribute("name"))
else if (strcmp(element->Attribute("name"), "sizex")==0)
{
if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS &&
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
@@ -267,7 +267,7 @@ bool JParticleEffect::Load(const char* filename)
{
for (int i=0;i<FIELD_COUNT;i++)
{
if (lifeValues[i] == element->Attribute("name"))
if (strcmp(element->Attribute("name"), lifeValues[i])==0)
{
for (key = param->FirstChild(); key; key = key->NextSibling())
{

View File

@@ -119,11 +119,11 @@ bool JResourceManager::LoadResource(const string& resourceName)
element = node->ToElement();
if (element != NULL)
{
if (element->ValueStr() == "texture")
if (strcmp(element->Value(), "texture")==0)
{
CreateTexture(element->Attribute("name"));
}
else if (element->ValueStr() == "quad")
else if (strcmp(element->Value(), "quad")==0)
{
string quadName = element->Attribute("name");
string textureName = element->Attribute("texture");
@@ -170,7 +170,7 @@ bool JResourceManager::LoadResource(const string& resourceName)
GetQuad(id)->SetHotSpot(hotspotX, hotspotY);
}
}
else if (element->ValueStr() == "font")
else if (strcmp(element->Value(), "font")==0)
{
}

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/");
@@ -94,8 +96,9 @@ int main(int argc, char* argv[])
options.reloadProfile();
TestSuite testSuite("test/_tests.txt");
result = testSuite.run();
int totalTests = testSuite.nbTests + testSuite.nbAITests;
delete wagicCore;
DebugTrace("TestSuite done: failed test: " << result << " out of " << testSuite.nbTests + testSuite.nbAITests << " total");
DebugTrace("TestSuite done: failed test: " << result << " out of " << totalTests << " total");
#ifdef CAPTURE_STDERR
OutputCapturer::debugAndClear();
#endif

View File

@@ -9,11 +9,11 @@
#include <QtDeclarative>
#include "qmlapplicationviewer.h"
#endif //QT_WIDGET
#include "Downloader.h"
#include "filedownloader.h"
#include "GameApp.h"
#include "corewrapper.h"
WagicCore* g_glwidget = NULL;
QWidget* g_glwidget = NULL;
static const struct { LocalKeySym keysym; JButton keycode; } gDefaultBindings[] =
{
@@ -69,25 +69,18 @@ int main(int argc, char* argv[])
#endif //QT_WIDGET
if(argc >= 2 && strcmp(argv[1], "testsuite")==0)
{
int result = 0;
result += WagicCore::runTestSuite();
return result;
}
app->setApplicationName(WagicCore::getApplicationName());
DownloadRequest* downloadRequest = NULL;
#ifdef WAGIC_RESOURCE_URL
Downloader*downloader = Downloader::GetInstance();
downloadRequest = downloader->Get(
"core.zip",
WAGIC_RESOURCE_URL
);
#endif
FileDownloader fileDownloader(USERDIR, WAGIC_RESOURCE_NAME);
#ifdef QT_WIDGET
g_glwidget = new WagicCore();
if(!downloadRequest || downloadRequest->getDownloadStatus() == DownloadRequest::DOWNLOADED)
{
g_glwidget->start(0);
}
else
{
g_glwidget->connect(downloadRequest, SIGNAL(statusChanged(int)), SLOT(start(int)));
}
g_glwidget->connect(&fileDownloader, SIGNAL(finished(int)), SLOT(start(int)));
#else
qmlRegisterType<WagicCore>("CustomComponents", 1, 0, "WagicCore");

View File

@@ -78,20 +78,7 @@ extern "C" void Java_org_libsdl_app_SDLActivity_nativeResume(
{
if (!g_engine)
return;
g_engine->Resume();
}
#include "Wagic_Version.h"
extern "C" jstring Java_org_libsdl_app_SDLActivity_getResourceName(
JNIEnv* env, jclass cls)
{
return env->NewStringUTF (WAGIC_RESOURCE_NAME);
}
extern "C" jstring Java_org_libsdl_app_SDLActivity_getResourceUrl(
JNIEnv* env, jclass cls)
{
return env->NewStringUTF (WAGIC_RESOURCE_URL);
g_engine->Resume();
}
#endif
@@ -293,18 +280,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

@@ -166,11 +166,12 @@ void DestroyGame(void)
[menuKeyRecognizer requireGestureRecognizerToFail: selectKeyRecognizer];
[self addGestureRecognizer:menuKeyRecognizer];
/*
// initialize the scaling factor
lastScale = 1.f;
UIPinchGestureRecognizer *pinchZoomRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinchZoom:)];
[self addGestureRecognizer:pinchZoomRecognizer];
[pinchZoomRecognizer release];
*/
/*
Create a single tap recognizer to select the nearest object.
@@ -391,8 +392,6 @@ void DestroyGame(void)
}
- (BOOL) gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
@@ -425,6 +424,21 @@ void DestroyGame(void)
}
#pragma mark Gesture Recognizer callbacks
- (void)handlePinchZoom: (UIPinchGestureRecognizer *) pinchGesture {
[[[pinchGesture view] layer] removeAllAnimations];
CGFloat currentScaleFactor = [pinchGesture scale];
if (pinchGesture.state == UIGestureRecognizerStateEnded) {
if (lastScale < 1.3f) {
lastScale *= currentScaleFactor;
}
else {
lastScale = 1;
[self displayGameMenu];
}
pinchGesture.scale = 1.f;
}
}
- (void)handlePanMotion: (UIPanGestureRecognizer *) panGesture
{

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

@@ -47,34 +47,36 @@
- (void)viewDidLoad {
NSLog(@"EAGL ViewController - view Did Load");
[super viewDidLoad];
}
- (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];
}
- (UIStatusBarStyle)preferredStatusBarStyle {
return UIStatusBarStyleLightContent;
}
- (void)viewDidAppear:(BOOL)animated {

View File

@@ -7,6 +7,7 @@
#include "JFileSystem.h"
#include "JRenderer.h"
#include "JGameLauncher.h"
#include "UIScreen+Util.h"
#define ACTUAL_SCREEN_WIDTH (SCREEN_WIDTH)
#define ACTUAL_SCREEN_HEIGHT (SCREEN_HEIGHT)
@@ -61,7 +62,7 @@ bool checkFramebufferStatus();
// for retina devices. because of the 568 px, the ratio between height-width skews the
// frame a bit
if ( backingHeight == 568 || backingWidth == 568) {
if ( [UIScreen isRetinaDisplay]) {
viewPort.left = 0;
viewPort.top = -((backingWidth/ACTUAL_RATIO)-backingHeight)/2 + 22; // account for status bar
viewPort.right = backingWidth;

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

@@ -343,7 +343,7 @@ void JQuad::SetHotSpot(float x, float y)
//////////////////////////////////////////////////////////////////////////
JTexture::JTexture() : mWidth(0), mHeight(0), mBuffer(NULL)
JTexture::JTexture() : mBuffer(NULL)
{
mTexId = -1;
}
@@ -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;
}
@@ -2533,7 +2486,7 @@ void JRenderer::Enable2D()
#if (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
glOrthof(0.0f, SCREEN_WIDTH_F, 0.0f, SCREEN_HEIGHT_F-1.0f, -1.0f, 1.0f);
#else
glOrtho(0.0f, SCREEN_WIDTH_F, 0.0f, SCREEN_HEIGHT_F-1.0f, -1.0f, 1.0f);
gluOrtho2D(0.0f, SCREEN_WIDTH_F, 0.0f, SCREEN_HEIGHT_F-1.0f);
#endif
glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix

View File

@@ -22,8 +22,6 @@
JMusic::JMusic()
#ifdef USE_PHONON
: mOutput(0), mMediaObject(0)
#elif defined QT_CONFIG
: playlist(0), player(0)
#endif
{
}
@@ -42,16 +40,11 @@ int JMusic::getPlayTime(){
JMusic::~JMusic()
{
#if defined USE_PHONON
#ifdef USE_PHONON
if(mOutput)
delete mOutput;
if(mMediaObject)
delete mMediaObject;
#elif defined QT_CONFIG
if(player)
delete player;
if(playlist)
delete playlist;
#elif defined WITH_FMOD
JSoundSystem::GetInstance()->StopMusic(this);
if (mTrack) FSOUND_Sample_Free(mTrack);
@@ -76,10 +69,7 @@ JSample::JSample()
JSample::~JSample()
{
#if (defined QT_CONFIG) && (!defined USE_PHONON)
if(effect)
delete effect;
#elif USE_PHONON
#ifdef USE_PHONON
if(mOutput)
delete mOutput;
if(mMediaObject)
@@ -154,84 +144,65 @@ void JSoundSystem::DestroySoundSystem()
JMusic *JSoundSystem::LoadMusic(const char *fileName)
{
JMusic* music = NULL;
#if (defined QT_CONFIG) && (!defined USE_PHONON)
music = new JMusic();
if (music)
{
music->player = new QMediaPlayer;
music->player->setVolume(100);
music->playlist = new QMediaPlaylist;
music->fullpath = JFileSystem::GetInstance()->GetResourceFile(fileName);
music->playlist->addMedia(QUrl::fromLocalFile(music->fullpath.c_str()));
music->playlist->setCurrentIndex(0);
}
#elif defined USE_PHONON
music = new JMusic();
if (music)
{
music->mOutput = new Phonon::AudioOutput(Phonon::GameCategory, 0);
music->mMediaObject = new Phonon::MediaObject(0);
string fullpath = JFileSystem::GetInstance()->GetResourceFile(fileName);
music->mMediaObject->setCurrentSource(QString(fullpath.c_str()));
Phonon::Path mediapath = Phonon::createPath(music->mMediaObject, music->mOutput);
Q_ASSERT(mediapath.isValid());
}
#ifdef USE_PHONON
JMusic* music = new JMusic();
if (music)
{
music->mOutput = new Phonon::AudioOutput(Phonon::GameCategory, 0);
music->mMediaObject = new Phonon::MediaObject(0);
string fullpath = JFileSystem::GetInstance()->GetResourceFile(fileName);
music->mMediaObject->setCurrentSource(QString(fullpath.c_str()));
Phonon::Path mediapath = Phonon::createPath(music->mMediaObject, music->mOutput);
Q_ASSERT(mediapath.isValid());
}
return music;
#elif (defined WITH_FMOD)
music = new JMusic();
if (music)
JMusic* music = new JMusic();
if (music)
{
JFileSystem* fileSystem = JFileSystem::GetInstance();
if (fileSystem->OpenFile(fileName))
{
int size = fileSystem->GetFileSize();
char *buffer = new char[size];
fileSystem->ReadFile(buffer, size);
music->mTrack = FSOUND_Sample_Load(FSOUND_UNMANAGED, buffer, FSOUND_LOADMEMORY, 0, size);
JFileSystem* fileSystem = JFileSystem::GetInstance();
if (fileSystem->OpenFile(fileName))
{
int size = fileSystem->GetFileSize();
char *buffer = new char[size];
fileSystem->ReadFile(buffer, size);
music->mTrack = FSOUND_Sample_Load(FSOUND_UNMANAGED, buffer, FSOUND_LOADMEMORY, 0, size);
delete[] buffer;
fileSystem->CloseFile();
}
delete[] buffer;
fileSystem->CloseFile();
}
}
return music;
#else
cerr << fileName << endl;
return NULL;
#endif
return music;
}
void JSoundSystem::PlayMusic(JMusic *music, bool looping)
{
#if (defined QT_CONFIG) && (!defined USE_PHONON)
if(music && music->player && music->playlist)
#ifdef USE_PHONON
if (music && music->mMediaObject && music->mOutput)
{
if(looping)
{
if(looping)
music->playlist->setPlaybackMode(QMediaPlaylist::Loop);
music->player->setPlaylist(music->playlist);
music->player->play();
music->mMediaObject->connect(music->mMediaObject, SIGNAL(aboutToFinish()), music, SLOT(seekAtTheBegining()));
}
#elif USE_PHONON
if (music && music->mMediaObject && music->mOutput)
{
if(looping)
{
music->mMediaObject->connect(music->mMediaObject, SIGNAL(aboutToFinish()), music, SLOT(seekAtTheBegining()));
}
music->mOutput->setVolume((qreal)mVolume*0.01);
music->mMediaObject->play();
music->mOutput->setVolume((qreal)mVolume*0.01);
music->mMediaObject->play();
}
}
#elif (defined WITH_FMOD)
if (music && music->mTrack)
if (music && music->mTrack)
{
mChannel = FSOUND_PlaySound(mChannel, music->mTrack);
SetMusicVolume(mVolume);
mChannel = FSOUND_PlaySound(mChannel, music->mTrack);
SetMusicVolume(mVolume);
if (looping)
FSOUND_SetLoopMode(mChannel, FSOUND_LOOP_NORMAL);
else
FSOUND_SetLoopMode(mChannel, FSOUND_LOOP_OFF);
if (looping)
FSOUND_SetLoopMode(mChannel, FSOUND_LOOP_NORMAL);
else
FSOUND_SetLoopMode(mChannel, FSOUND_LOOP_OFF);
}
#else
music = 0;
@@ -242,12 +213,7 @@ void JSoundSystem::PlayMusic(JMusic *music, bool looping)
void JSoundSystem::StopMusic(JMusic *music)
{
#if (defined QT_CONFIG) && (!defined USE_PHONON)
if (music && music->player && music->playlist)
{
music->player->stop();
}
#elif defined USE_PHONON
#ifdef USE_PHONON
if (music && music->mMediaObject && music->mOutput)
{
music->mMediaObject->stop();
@@ -298,61 +264,47 @@ void JSoundSystem::SetSfxVolume(int volume){
JSample *JSoundSystem::LoadSample(const char *fileName)
{
JSample* sample = NULL;
#if (defined QT_CONFIG) && (!defined USE_PHONON)
sample = new JSample();
if (sample)
{
string fullpath = JFileSystem::GetInstance()->GetResourceFile(fileName);
sample->effect = new QMediaPlayer;
sample->effect->setMedia(QUrl::fromLocalFile(fullpath.c_str()));
sample->effect->setVolume(100);
sample->mSample = &(sample->effect);
}
#elif (defined USE_PHONON)
sample = new JSample();
if (sample)
{
sample->mOutput = new Phonon::AudioOutput(Phonon::GameCategory, 0);
sample->mMediaObject = new Phonon::MediaObject(0);
string fullpath = JFileSystem::GetInstance()->GetResourceFile(fileName);
sample->mMediaObject->setCurrentSource(QString(fullpath.c_str()));
Phonon::Path mediapath = Phonon::createPath(sample->mMediaObject, sample->mOutput);
Q_ASSERT(mediapath.isValid());
}
#if (defined USE_PHONON)
JSample* sample = new JSample();
if (sample)
{
sample->mOutput = new Phonon::AudioOutput(Phonon::GameCategory, 0);
sample->mMediaObject = new Phonon::MediaObject(0);
string fullpath = JFileSystem::GetInstance()->GetResourceFile(fileName);
sample->mMediaObject->setCurrentSource(QString(fullpath.c_str()));
Phonon::Path mediapath = Phonon::createPath(sample->mMediaObject, sample->mOutput);
Q_ASSERT(mediapath.isValid());
}
return sample;
#elif (defined WITH_FMOD)
sample = new JSample();
if (sample)
JSample* sample = new JSample();
if (sample)
{
JFileSystem* fileSystem = JFileSystem::GetInstance();
if (fileSystem->OpenFile(fileName))
{
int size = fileSystem->GetFileSize();
char *buffer = new char[size];
fileSystem->ReadFile(buffer, size);
sample->mSample = FSOUND_Sample_Load(FSOUND_UNMANAGED, buffer, FSOUND_LOADMEMORY, 0, size);
JFileSystem* fileSystem = JFileSystem::GetInstance();
if (fileSystem->OpenFile(fileName))
{
int size = fileSystem->GetFileSize();
char *buffer = new char[size];
fileSystem->ReadFile(buffer, size);
sample->mSample = FSOUND_Sample_Load(FSOUND_UNMANAGED, buffer, FSOUND_LOADMEMORY, 0, size);
delete[] buffer;
fileSystem->CloseFile();
}else
sample->mSample = NULL;
delete[] buffer;
fileSystem->CloseFile();
}else
sample->mSample = NULL;
}
return sample;
#else
cerr << fileName << endl;
return NULL;
#endif
return sample;
}
void JSoundSystem::PlaySample(JSample *sample)
{
#if (defined QT_CONFIG) && (!defined USE_PHONON)
if(sample)
{
sample->effect->play();
}
#elif defined USE_PHONON
#ifdef USE_PHONON
if (sample && sample->mMediaObject && sample->mOutput)
{
sample->mOutput->setVolume((qreal)mSampleVolume*0.01);

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>

View File

@@ -335,7 +335,7 @@ void WagicCore::resizeGL(int width, int height)
#if (defined GL_VERSION_ES_CM_1_1 || defined GL_OES_VERSION_1_1)
glOrthof(0.0f, (float) (m_viewPort.right()-m_viewPort.left())-1.0f, 0.0f, (float) (m_viewPort.bottom()-m_viewPort.top())-1.0f, -1.0f, 1.0f);
#else
glOrtho(0.0f, (float) (m_viewPort.right()-m_viewPort.left())-1.0f, 0.0f, (float) (m_viewPort.bottom()-m_viewPort.top())-1.0f, -1.0f, 1.0f);
gluOrtho2D(0.0f, (float) (m_viewPort.right()-m_viewPort.left())-1.0f, 0.0f, (float) (m_viewPort.bottom()-m_viewPort.top())-1.0f);
#endif
glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix
@@ -418,29 +418,29 @@ void WagicCore::mousePressEvent(QMouseEvent *event)
{
if(event->button() == Qt::LeftButton)
{
m_lastPos = event->pos();
QPoint lastPos = event->pos();
// this is intended to convert window coordinate into game coordinate.
// this is correct only if the game and window have the same aspect ratio, otherwise, it's just wrong
int actualWidth = (int) JRenderer::GetInstance()->GetActualWidth();
int actualHeight = (int) JRenderer::GetInstance()->GetActualHeight();
if (lastPosy() >= m_viewPort.top() &&
lastPosy() <= m_viewPort.bottom() &&
lastPosx() <= m_viewPort.right() &&
lastPosx() >= m_viewPort.left()) {
if (lastPos.y() >= m_viewPort.top() &&
lastPos.y() <= m_viewPort.bottom() &&
lastPos.x() <= m_viewPort.right() &&
lastPos.x() >= m_viewPort.left()) {
m_engine->LeftClicked(
((lastPosx()-m_viewPort.left())*SCREEN_WIDTH)/actualWidth,
((lastPosy()-m_viewPort.top())*SCREEN_HEIGHT)/actualHeight);
((lastPos.x()-m_viewPort.left())*SCREEN_WIDTH)/actualWidth,
((lastPos.y()-m_viewPort.top())*SCREEN_HEIGHT)/actualHeight);
#if (!defined Q_WS_MAEMO_5) && (!defined MEEGO_EDITION_HARMATTAN) && (!defined Q_WS_ANDROID)
m_engine->HoldKey_NoRepeat(JGE_BTN_OK);
#else
mMouseDownX = lastPosx();
mMouseDownY = lastPosy();
mMouseDownX = lastPos.x();
mMouseDownY = lastPos.y();
mLastFingerDownTime = g_startTimer.elapsed();
#endif
} else if(lastPosy()<m_viewPort.top()) {
} else if(lastPos.y()<m_viewPort.top()) {
m_engine->HoldKey_NoRepeat(JGE_BTN_MENU);
} else if(lastPosy()>m_viewPort.bottom()) {
} else if(lastPos.y()>m_viewPort.bottom()) {
m_engine->HoldKey_NoRepeat(JGE_BTN_NEXT);
}
event->accept();
@@ -465,33 +465,33 @@ void WagicCore::mouseReleaseEvent(QMouseEvent *event)
{
if(event->button() == Qt::LeftButton)
{
m_lastPos = event->pos();
QPoint lastPos = event->pos();
if (lastPosy() >= m_viewPort.top() &&
lastPosy() <= m_viewPort.bottom() &&
lastPosx() <= m_viewPort.right() &&
lastPosx() >= m_viewPort.left()) {
if (lastPos.y() >= m_viewPort.top() &&
lastPos.y() <= m_viewPort.bottom() &&
lastPos.x() <= m_viewPort.right() &&
lastPos.x() >= m_viewPort.left()) {
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
if(g_startTimer.elapsed() - mLastFingerDownTime <= kTapEventTimeout )
{
if(abs(mMouseDownX - lastPosx()) < kHitzonePliancy &&
abs(mMouseDownY - lastPosy()) < kHitzonePliancy)
if(abs(mMouseDownX - lastPos.x()) < kHitzonePliancy &&
abs(mMouseDownY - lastPos.y()) < kHitzonePliancy)
{
m_engine->HoldKey_NoRepeat(JGE_BTN_OK);
}
}
else if (g_startTimer.elapsed() - mLastFingerDownTime >= kSwipeEventMinDuration)
{ // Let's swipe
m_engine->Scroll(lastPosx()-mMouseDownX, lastPosy()-mMouseDownY);
m_engine->Scroll(lastPos.x()-mMouseDownX, lastPos.y()-mMouseDownY);
}
#else
//#if (!defined Q_WS_MAEMO_5) && (!defined MEEGO_EDITION_HARMATTAN)
m_engine->ReleaseKey(JGE_BTN_OK);
#endif
m_engine->ReleaseKey(JGE_BTN_MENU);
} else if(lastPosy() < m_viewPort.top()) {
} else if(lastPos.y() < m_viewPort.top()) {
m_engine->ReleaseKey(JGE_BTN_MENU);
} else if(lastPosy() > m_viewPort.bottom()) {
} else if(lastPos.y() > m_viewPort.bottom()) {
m_engine->ReleaseKey(JGE_BTN_NEXT);
}
event->accept();
@@ -517,15 +517,15 @@ void WagicCore::mouseMoveEvent(QMouseEvent *event)
int actualWidth = (int) JRenderer::GetInstance()->GetActualWidth();
int actualHeight = (int) JRenderer::GetInstance()->GetActualHeight();
m_lastPos = event->pos();
QPoint lastPos = event->pos();
if (lastPosy() >= m_viewPort.top() &&
lastPosy() <= m_viewPort.bottom() &&
lastPosx() <= m_viewPort.right() &&
lastPosx() >= m_viewPort.left()) {
if (lastPos.y() >= m_viewPort.top() &&
lastPos.y() <= m_viewPort.bottom() &&
lastPos.x() <= m_viewPort.right() &&
lastPos.x() >= m_viewPort.left()) {
m_engine->LeftClicked(
((lastPosx()-m_viewPort.left())*SCREEN_WIDTH)/actualWidth,
((lastPosy()-m_viewPort.top())*SCREEN_HEIGHT)/actualHeight);
((lastPos.x()-m_viewPort.left())*SCREEN_WIDTH)/actualWidth,
((lastPos.y()-m_viewPort.top())*SCREEN_HEIGHT)/actualHeight);
event->accept();
} else {
super::mouseMoveEvent(event);

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

@@ -106,7 +106,6 @@ public:
virtual int overflow(int c = EOF);
virtual int underflow();
virtual int sync();
using std::streambuf::setbuf;
virtual std::streambuf * setbuf(char * pr, int nLength);
virtual std::streampos seekoff(std::streamoff, std::ios::seekdir, std::ios::openmode);
@@ -132,7 +131,6 @@ public:
virtual int overflow(int c = EOF);
virtual int underflow();
virtual int sync();
using std::streambuf::setbuf;
virtual std::streambuf * setbuf(char * pr, int nLength);
virtual std::streampos seekoff(std::streamoff, std::ios::seekdir, std::ios::openmode);

View File

@@ -2,8 +2,6 @@
[![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
@@ -18,11 +16,6 @@ Wagic, the Homebrew, is a C++ game engine that allows to play card games against
It is highly customizable and allows the player to tweak the rules / create their own cards, their own themes, etc...
Info, downloads, discussions and more at http://wololo.net/forum/index.php
Info, Downloads, and more at http://wololo.net
![alt text](http://wololo.net/wagic/wp-content/uploads/2009/10/shop.jpg "Screenshot")
### Sample round play-through video
[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/WUFSAPZuDIk/0.jpg)](http://www.youtube.com/watch?v=WUFSAPZuDIk)
-![alt text](http://wololo.net/wagic/wp-content/uploads/2009/10/shop.jpg "Screenshot")

View File

@@ -1,76 +0,0 @@
# Notes:
# - Minimal appveyor.yml file is an empty file. All sections are optional.
# - Indent each level of configuration with 2 spaces. Do not use tabs!
# - All section names are case-sensitive.
# - Section names should be unique on each level.
# branches to build
branches:
# blacklist
except:
- travis_mac_osx
# Do not build on tags (GitHub only)
skip_tags: true
#---------------------------------#
# environment configuration #
#---------------------------------#
environment:
GH_TOKEN:
secure: dYnBDQkiY5oVjIlswzBX9BJigNtBGXgGlp1tK3XbHzrDEDrs2vaKD5m+Oz5OSz1C
# scripts that run after cloning repository
install:
- ps: (new-object net.webclient).DownloadFile('https://bootstrap.pypa.io/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"
#---------------------------------#
# build configuration #
#---------------------------------#
# build Configuration, i.e. Debug, Release, etc.
configuration: Release
build:
project: projects/mtg/mtg_vs2010.sln # path to Visual Studio solution or project
#---------------------------------#
# tests configuration #
#---------------------------------#
# to disable automatic tests
test: off
#---------------------------------#
# artifacts configuration #
#---------------------------------#
artifacts:
# pushing windows package
- path: projects\mtg\bin\Wagic-windows*.zip
#---------------------------------#
# deployment configuration #
#---------------------------------#
# scripts to run before deployment
before_deploy:
- cd projects/mtg/bin
- "C:/Python27/python.exe createWindowsZip.py"
- cd ../../..
# scripts to run after deployment
after_deploy:
# to run your custom scripts instead of provider deployments
deploy_script:
- "C:/Python27/python.exe tools/upload-binaries.py -t %GH_TOKEN% -s %APPVEYOR_REPO_COMMIT% -l projects/mtg/bin/Wagic-windows.zip -r Wagic-windows.zip -b %APPVEYOR_REPO_BRANCH%"
# to disable deployment
#deploy: off

View File

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

View File

@@ -1,16 +1,18 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="0201" android:versionName="@string/app_version" package="net.wagic.app">
<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: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">
<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

@@ -11,9 +11,10 @@ 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
LOCAL_CFLAGS += -D_STLP_USE_SIMPLE_NODE_ALLOC -DTIXML_USE_STL
LOCAL_CFLAGS += -DLINUX -DANDROID -DSDL_CONFIG -D_$(DEBUG)
LOCAL_CFLAGS += -D_STLP_USE_SIMPLE_NODE_ALLOC
LOCAL_CFLAGS += -D__arm__ -D_REENTRANT -D_GLIBCXX__PTHREADS
LOCAL_STATIC_LIBRARIES := libpng libjpeg
LOCAL_SHARED_LIBRARIES := SDL
@@ -56,6 +57,7 @@ LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.cpp \
$(MTG_PATH)/src/DeckMetaData.cpp \
$(MTG_PATH)/src/DeckStats.cpp \
$(MTG_PATH)/src/DuelLayers.cpp \
$(MTG_PATH)/src/Effects.cpp \
$(MTG_PATH)/src/ExtraCost.cpp \
$(MTG_PATH)/src/GameApp.cpp \
$(MTG_PATH)/src/GameLauncher.cpp \
@@ -134,9 +136,6 @@ LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.cpp \
$(MTG_PATH)/src/WFont.cpp \
$(MTG_PATH)/src/WGui.cpp \
$(MTG_PATH)/src/WResourceManager.cpp \
$(MTG_PATH)/src/DeckView.cpp \
$(MTG_PATH)/src/CarouselDeckView.cpp \
$(MTG_PATH)/src/GridDeckView.cpp \
$(JGE_PATH)/src/SDLmain.cpp \
$(JGE_PATH)/src/Encoding.cpp \
$(JGE_PATH)/src/JAnimator.cpp \

View File

@@ -1,7 +1,6 @@
APP_PROJECT_PATH := $(call my-dir)/..
APP_CPPFLAGS += -frtti -fexceptions
APP_ABI := armeabi armeabi-v7a
#APP_ABI := x86 # mainly for emulators
APP_STL := gnustl_static
APP_MODULES := libpng libjpeg main SDL

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

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Wagic</string>
<string name="app_version">0.20.1</string>
<string name="info_text">Wagic v0.20.1\\nAll 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,275 +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 = "#SB:";
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("") && cardcount < 61) // 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 += arranged + " (" + renameSet(slines[1]) + ") * " + slines[0] + "\n";
} else
{
deck += arranged + "(*) * " + slines[0] + "\n";
}
cardcount += Integer.parseInt(slines[0]);
}
}
}
File profile = new File(activePath + "/Res/settings/options.txt");
if (profile.exists() && !profile.isDirectory())
{
String profileName = getActiveProfile(profile);
if (profileName != "Missing!")
{
File rootProfiles = new File(activePath + "/Res/profiles/" + profileName);
if (rootProfiles.exists() && rootProfiles.isDirectory())
{
//save deck
int countdeck = 1;
File[] files = rootProfiles.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(rootProfiles + "/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 = "Import Deck Success!\n" + cardcount + " total cards in this deck\n\n" + deck;
} catch (IOException e)
{
message = e.getMessage();
}
} else
{
message = "Missing Folder!";
}
}
} else
{
message = "Invalid Profile!";
}
} 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 "Missing!";
}
}
catch(IOException e)
{
return "Missing!";
}
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;
}
}

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>();
@@ -26,14 +21,8 @@ public class StorageOptions
public static void determineStorageOptions()
{
initializeMountPoints();
if (findForcemount()){
readMountsFileTest();
}
readMountsFile();
readVoldFile();
if (findForcemount()){
removeDuplicates(mMounts);
}
compareMountsWithVold();
testAndCleanMountsList();
setProperties();
@@ -51,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()
{
/*
@@ -112,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);
}
}
@@ -145,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
@@ -199,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.
*/
@@ -260,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 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++);
}
}
labels = new String[mLabels.size()];
mLabels.toArray(labels);
@@ -295,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;
}
}
}

View File

@@ -1,18 +1,12 @@
package org.libsdl.app;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Scanner;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
@@ -22,7 +16,6 @@ import javax.microedition.khronos.egl.EGLSurface;
import net.wagic.app.R;
import net.wagic.utils.StorageOptions;
import net.wagic.utils.DeckImporter;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -66,11 +59,9 @@ import android.widget.FrameLayout.LayoutParams;
*/
public class SDLActivity extends Activity implements OnKeyListener
{
private static final String TAG = SDLActivity.class.getCanonicalName();
//import deck globals
public ArrayList<String> myresult = new ArrayList<String>();
public String myclickedItem = "";
// TAG used for debugging in DDMS
public static String TAG = Activity.class.getCanonicalName();
// Main components
private static SDLActivity mSingleton;
@@ -89,6 +80,7 @@ public class SDLActivity extends Activity implements OnKeyListener
public Boolean mErrorHappened = false;
public final static String RES_FOLDER = Environment.getExternalStorageDirectory().getPath() + "/Wagic/Res/";
public static String RES_FILENAME = "core_0184.zip";
public static final String RES_URL = "http://wagic.googlecode.com/files/";
public String systemFolder = Environment.getExternalStorageDirectory().getPath() + "/Wagic/Res/";
private String userFolder;
@@ -209,60 +201,7 @@ public class SDLActivity extends Activity implements OnKeyListener
setStorage.create().show();
}
private void importDeckOptions()
{
AlertDialog.Builder importDeck = new AlertDialog.Builder(this);
importDeck.setTitle("Choose Deck to Import:");
File root = new File(System.getenv("EXTERNAL_STORAGE")+"/Download");
File[] files = root.listFiles();
for( File f : files)
{
if( !myresult.contains(f.toString()) && (f.toString().contains(".txt")||f.toString().contains(".dck")||f.toString().contains(".dec")))
myresult.add(f.toString());
}
//get first item?
if(!myresult.isEmpty())
myclickedItem = myresult.get(0).toString();
importDeck.setSingleChoiceItems(myresult.toArray(new String[myresult.size()]), 0, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
myclickedItem = myresult.get(item).toString();
}
});
importDeck.setPositiveButton("Import Deck", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
processSelectedDeck( myclickedItem );
if (mSurface == null)
mSingleton.initializeGame();
}
});
importDeck.create().show();
}
private void processSelectedDeck(String mypath)
{
AlertDialog.Builder infoDialog = new AlertDialog.Builder(this);
infoDialog.setTitle("Imported Deck:");
String activePath = sdcardPath;
if(activePath == ""){
activePath = internalPath;
}
File f = new File(mypath);
//Call the deck importer....
String state = DeckImporter.importDeck(f, mypath, activePath);
infoDialog.setMessage(state);
infoDialog.show();
}
private void checkStorageLocationPreference()
{
SharedPreferences settings = getSharedPreferences(kWagicSharedPreferencesKey, MODE_PRIVATE);
@@ -349,7 +288,7 @@ public class SDLActivity extends Activity implements OnKeyListener
updateStorageLocations();
} catch (Exception ioex)
{
Log.e(TAG, "An error occurred in setting up the storage locations.");
Log.e("SDL", "An error occurred in setting up the storage locations.");
}
}
@@ -368,7 +307,7 @@ public class SDLActivity extends Activity implements OnKeyListener
private void startDownload()
{
String url = getResourceUrl();
String url = RES_URL + RES_FILENAME;
if (!checkStorageState())
{
Log.e(TAG, "Error in initializing storage space.");
@@ -396,8 +335,7 @@ public class SDLActivity extends Activity implements OnKeyListener
public boolean onCreateOptionsMenu(Menu menu)
{
SubMenu settingsMenu = menu.addSubMenu(Menu.NONE, 1, 1, "Settings");
menu.add(Menu.NONE, 2, 2, "Import");
menu.add(Menu.NONE, 3, 3, "About");
menu.add(Menu.NONE, 2, 2, "About");
settingsMenu.add(kStorageDataOptionsMenuId, kStorageDataOptionsMenuId, Menu.NONE, "Storage Data Options");
// buildStorageOptionsMenu(settingsMenu);
@@ -413,9 +351,6 @@ public class SDLActivity extends Activity implements OnKeyListener
{
displayStorageOptions();
} else if (itemId == 2)
{
importDeckOptions();
} else if (itemId == 3)
{
// display some info about the app
AlertDialog.Builder infoDialog = new AlertDialog.Builder(this);
@@ -494,13 +429,15 @@ public class SDLActivity extends Activity implements OnKeyListener
@Override
protected void onCreate(Bundle savedInstanceState)
{
//Log.d(TAG, "onCreate()");
// Log.v("SDL", "onCreate()");
super.onCreate(savedInstanceState);
// So we can call stuff from static callbacks
mSingleton = this;
mContext = this.getApplicationContext();
RES_FILENAME = getResourceName();
// get the current version of the app to set the core filename
String versionCodeString = getApplicationCode();
RES_FILENAME = "core_" + versionCodeString + ".zip";
StorageOptions.determineStorageOptions();
checkStorageLocationPreference();
@@ -527,7 +464,7 @@ public class SDLActivity extends Activity implements OnKeyListener
@Override
protected void onPause()
{
// Log.d(TAG, "onPause()");
// Log.v("SDL", "onPause()");
super.onPause();
SDLActivity.nativePause();
}
@@ -535,7 +472,7 @@ public class SDLActivity extends Activity implements OnKeyListener
@Override
protected void onResume()
{
// Log.d(TAG, "onResume()");
// Log.v("SDL", "onResume()");
super.onResume();
SDLActivity.nativeResume();
}
@@ -543,7 +480,8 @@ public class SDLActivity extends Activity implements OnKeyListener
@Override
public void onDestroy()
{
// Log.d(TAG, "onDestroy()");
// Log.v("SDL", "onDestroy()");
super.onDestroy();
mSurface.onDestroy();
}
@@ -587,9 +525,6 @@ public class SDLActivity extends Activity implements OnKeyListener
}
// C functions we call
public static native String getResourceUrl();
public static native String getResourceName();
public static native void nativeInit();
public static native void nativeQuit();
@@ -654,7 +589,7 @@ public class SDLActivity extends Activity implements OnKeyListener
int audioFormat = is16Bit ? AudioFormat.ENCODING_PCM_16BIT : AudioFormat.ENCODING_PCM_8BIT;
int frameSize = (isStereo ? 2 : 1) * (is16Bit ? 2 : 1);
// Log.d(TAG, "SDL audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + ((float)sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer");
// Log.v("SDL", "SDL audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + ((float)sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer");
// Let the user pick a larger buffer if they really want -- but ye
// gods they probably shouldn't, the minimums are horrifyingly high
@@ -665,7 +600,7 @@ public class SDLActivity extends Activity implements OnKeyListener
audioStartThread();
// Log.d(TAG, "SDL audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + ((float)mAudioTrack.getSampleRate() / 1000f) +
// Log.v("SDL", "SDL audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + ((float)mAudioTrack.getSampleRate() / 1000f) +
// "kHz, " + desiredFrames + " frames buffer");
if (is16Bit)
@@ -713,7 +648,7 @@ public class SDLActivity extends Activity implements OnKeyListener
}
} else
{
Log.w(TAG, "SDL audio: error return from write(short)");
Log.w("SDL", "SDL audio: error return from write(short)");
return;
}
}
@@ -738,7 +673,7 @@ public class SDLActivity extends Activity implements OnKeyListener
}
} else
{
Log.w(TAG, "SDL audio: error return from write(short)");
Log.w("SDL", "SDL audio: error return from write(short)");
return;
}
}
@@ -753,11 +688,11 @@ public class SDLActivity extends Activity implements OnKeyListener
mAudioThread.join();
} catch (Exception e)
{
Log.e(TAG, "Problem stopping audio thread: " + e);
Log.v("SDL", "Problem stopping audio thread: " + e);
}
mAudioThread = null;
// Log.d(TAG, "Finished waiting for audio thread");
// Log.v("SDL", "Finished waiting for audio thread");
}
if (mAudioTrack != null)
@@ -769,7 +704,7 @@ public class SDLActivity extends Activity implements OnKeyListener
class DownloadFileAsync extends AsyncTask<String, Integer, Long>
{
private final String TAG = DownloadFileAsync.class.getCanonicalName();
final String TAG1 = DownloadFileAsync.class.getCanonicalName();
@Override
protected void onPreExecute()
@@ -788,6 +723,7 @@ public class SDLActivity extends Activity implements OnKeyListener
try
{
//
// Prepare the sdcard folders in order to download the resource file
//
@@ -808,7 +744,7 @@ public class SDLActivity extends Activity implements OnKeyListener
conexion.connect();
int lengthOfFile = conexion.getContentLength();
// Log.d(TAG, " Length of file: " + lengthOfFile);
// Log.d("Wagic - " + TAG1, " Length of file: " + lengthOfFile);
input = new BufferedInputStream(url.openStream());
// create a File object for the output file
@@ -831,8 +767,8 @@ public class SDLActivity extends Activity implements OnKeyListener
{
String errorMessage = "An error happened while downloading the resources. It could be that our server is temporarily down, that your device is not connected to a network, or that we cannot write to " + mSingleton.getSystemStorageLocation() + ". Please check your phone settings and try again. For more help please go to http://wagic.net";
mSingleton.downloadError(errorMessage);
Log.e(TAG, errorMessage);
Log.e(TAG, e.getMessage());
Log.e(TAG1, errorMessage);
Log.e(TAG1, e.getMessage());
}
return Long.valueOf(totalBytes);
@@ -842,7 +778,7 @@ public class SDLActivity extends Activity implements OnKeyListener
{
if (progress[0] != mProgressDialog.getProgress())
{
// Log.d(TAG, "current progress : " + progress[0]);
// Log.d("Wagic - " + TAG1, "current progress : " + progress[0]);
mProgressDialog.setProgress(progress[0]);
}
}
@@ -915,7 +851,6 @@ public class SDLActivity extends Activity implements OnKeyListener
*/
class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnKeyListener, View.OnTouchListener, SensorEventListener
{
private static final String TAG = SDLSurface.class.getCanonicalName();
// This is what SDL runs in. It invokes SDL_main(), eventually
private Thread mSDLThread;
@@ -955,7 +890,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
SDLActivity.nativeQuit();
Log.d(TAG, "SDL thread terminated");
Log.v("SDL", "SDL thread terminated");
// On exit, tear everything down for a fresh restart next time.
System.exit(0);
@@ -982,7 +917,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
// Called when we have a valid drawing surface
public void surfaceCreated(SurfaceHolder holder)
{
//Log.d(TAG, "surfaceCreated()");
Log.v("SDL", "surfaceCreated()");
enableSensor(Sensor.TYPE_ACCELEROMETER, true);
}
@@ -1002,18 +937,18 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
mSDLThread.join();
} catch (Exception e)
{
Log.e(TAG, "Problem stopping thread: " + e);
Log.v("SDL", "Problem stopping thread: " + e);
}
mSDLThread = null;
// Log.d(TAG, "Finished waiting for SDL thread");
// Log.v("SDL", "Finished waiting for SDL thread");
}
}
// Called when we lose the surface
public void surfaceDestroyed(SurfaceHolder holder)
{
Log.d(TAG, "surfaceDestroyed()");
Log.v("SDL", "surfaceDestroyed()");
synchronized (mSemSurface)
{
mSurfaceValid = false;
@@ -1025,51 +960,51 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
// Called when the surface is resized
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
{
Log.d(TAG, "surfaceChanged()");
Log.d("SDL", "surfaceChanged()");
int sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565 by default
switch (format)
{
case PixelFormat.A_8:
Log.d("TAG", "pixel format A_8");
Log.d("SDL", "pixel format A_8");
break;
case PixelFormat.LA_88:
Log.d("TAG", "pixel format LA_88");
Log.d("SDL", "pixel format LA_88");
break;
case PixelFormat.L_8:
Log.d("TAG", "pixel format L_8");
Log.d("SDL", "pixel format L_8");
break;
case PixelFormat.RGBA_4444:
Log.d("TAG", "pixel format RGBA_4444");
Log.d("SDL", "pixel format RGBA_4444");
sdlFormat = 0x85421002; // SDL_PIXELFORMAT_RGBA4444
break;
case PixelFormat.RGBA_5551:
Log.d(TAG, "pixel format RGBA_5551");
Log.d("SDL", "pixel format RGBA_5551");
sdlFormat = 0x85441002; // SDL_PIXELFORMAT_RGBA5551
break;
case PixelFormat.RGBA_8888:
Log.d(TAG, "pixel format RGBA_8888");
Log.d("SDL", "pixel format RGBA_8888");
sdlFormat = 0x86462004; // SDL_PIXELFORMAT_RGBA8888
break;
case PixelFormat.RGBX_8888:
Log.d(TAG, "pixel format RGBX_8888");
Log.d("SDL", "pixel format RGBX_8888");
sdlFormat = 0x86262004; // SDL_PIXELFORMAT_RGBX8888
break;
case PixelFormat.RGB_332:
Log.d(TAG, "pixel format RGB_332");
Log.d("SDL", "pixel format RGB_332");
sdlFormat = 0x84110801; // SDL_PIXELFORMAT_RGB332
break;
case PixelFormat.RGB_565:
Log.d(TAG, "pixel format RGB_565");
Log.d("SDL", "pixel format RGB_565");
sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565
break;
case PixelFormat.RGB_888:
Log.d(TAG, "pixel format RGB_888");
Log.d("SDL", "pixel format RGB_888");
// Not sure this is right, maybe SDL_PIXELFORMAT_RGB24 instead?
sdlFormat = 0x86161804; // SDL_PIXELFORMAT_RGB888
break;
default:
Log.d(TAG, "pixel format unknown " + format);
Log.d("SDL", "pixel format unknown " + format);
break;
}
SDLActivity.onNativeResize(width, height, sdlFormat);
@@ -1086,10 +1021,11 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
// EGL functions
public boolean initEGL(int majorVersion, int minorVersion)
{
Log.d(TAG, "Starting up OpenGL ES " + majorVersion + "." + minorVersion);
Log.d("SDL", "Starting up OpenGL ES " + majorVersion + "." + minorVersion);
try
{
EGL10 egl = (EGL10) EGLContext.getEGL();
EGLDisplay dpy = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
@@ -1115,7 +1051,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
int[] num_config = new int[1];
if (!egl.eglChooseConfig(dpy, configSpec, configs, 1, num_config) || num_config[0] == 0)
{
Log.e(TAG, "No EGL config available");
Log.e("SDL", "No EGL config available");
return false;
}
mEGLConfig = configs[0];
@@ -1123,7 +1059,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
EGLContext ctx = egl.eglCreateContext(dpy, mEGLConfig, EGL10.EGL_NO_CONTEXT, null);
if (ctx == EGL10.EGL_NO_CONTEXT)
{
Log.e(TAG, "Couldn't create context");
Log.e("SDL", "Couldn't create context");
return false;
}
@@ -1137,10 +1073,10 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
} catch (Exception e)
{
Log.e(TAG, e + "");
Log.e("SDL", e + "");
for (StackTraceElement s : e.getStackTrace())
{
Log.e(TAG, s.toString());
Log.e("SDL", s.toString());
}
}
@@ -1155,6 +1091,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
EGL10 egl = (EGL10) EGLContext.getEGL();
if (mEGLSurface != null)
{
/*
* Unbind and destroy the old EGL surface, if there is one.
*/
@@ -1168,7 +1105,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
mEGLSurface = egl.eglCreateWindowSurface(mEGLDisplay, mEGLConfig, holder, null);
if (mEGLSurface == EGL10.EGL_NO_SURFACE)
{
Log.e(TAG, "Couldn't create surface");
Log.e("SDL", "Couldn't create surface");
return false;
}
@@ -1177,7 +1114,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
*/
if (!egl.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext))
{
Log.e(TAG, "Couldn't make context current");
Log.e("SDL", "Couldn't make context current");
return false;
}
@@ -1189,6 +1126,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
// EGL buffer flip
public void flipEGL()
{
if (!mSurfaceValid)
{
createSurface(this.getHolder());
@@ -1198,7 +1136,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
{
EGL10 egl = (EGL10) EGLContext.getEGL();
egl.eglWaitNative(EGL10.EGL_CORE_NATIVE_ENGINE, null);
egl.eglWaitNative(EGL10.EGL_NATIVE_RENDERABLE, null);
// drawing here
@@ -1208,12 +1146,13 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
} catch (Exception e)
{
Log.e(TAG, "flipEGL(): " + e);
Log.e("SDL", "flipEGL(): " + e);
for (StackTraceElement s : e.getStackTrace())
{
Log.e(TAG, s.toString());
Log.e("SDL", s.toString());
}
}
}
// Key events
@@ -1224,15 +1163,14 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
return false;
if (event.getAction() == KeyEvent.ACTION_DOWN)
{
// Log.d(TAG, "key down: " + keyCode);
// Log.d("SDL", "key down: " + keyCode);
SDLActivity.onNativeKeyDown(keyCode);
return true;
} else if (event.getAction() == KeyEvent.ACTION_UP)
{
// Log.d(TAG, "key up: " + keyCode);
// Log.d("SDL", "key up: " + keyCode);
SDLActivity.onNativeKeyUp(keyCode);
return true;
}
@@ -1243,6 +1181,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
// Touch events
public boolean onTouch(View v, MotionEvent event)
{
for (int index = 0; index < event.getPointerCount(); ++index)
{
int action = event.getActionMasked();
@@ -1309,4 +1248,3 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK
}
}
}

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

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>wagic.launcher</string>
<key>CFBundleIdentifier</key>
<string>wagic.wagic</string>
<key>NOTE</key>
<string>This file was generated by Qt/QMake.</string>
</dict>
</plist>

Binary file not shown.

View File

@@ -1,5 +0,0 @@
#!/bin/bash
cd ${0%/*/*}/Resources
#cd ../Resources
exec ../MacOS/wagic -platformpluginpath ../PlugIns >> ../logs/out.log 2> ../logs/err.log

View File

@@ -6,7 +6,7 @@ OBJS = objs/InteractiveButton.o objs/AbilityParser.o objs/ActionElement.o\
objs/Counters.o objs/Credits.o objs/Damage.o objs/DamagerDamaged.o\
objs/DeckDataWrapper.o objs/DeckEditorMenu.o objs/DeckMenu.o\
objs/DeckMenuItem.o objs/DeckMetaData.o objs/DeckStats.o objs/DuelLayers.o\
objs/ExtraCost.o objs/GameApp.o objs/GameLauncher.o\
objs/Effects.o objs/ExtraCost.o objs/GameApp.o objs/GameLauncher.o\
objs/GameObserver.o objs/GameOptions.o objs/GameState.o\
objs/GameStateAwards.o objs/GameStateDeckViewer.o objs/GameStateDuel.o\
objs/DeckManager.o objs/GameStateMenu.o objs/GameStateOptions.o\
@@ -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/CarouselDeckView.o objs/GridDeckView.o objs/DeckView.o
objs/WFont.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
@@ -72,37 +73,20 @@ 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
CFLAGS = -O2 -G0 -DPSPFW3XX -DDEVHOOK -DUSE_PRECOMPILED_HEADERS=1 -DPSP
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 -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 -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 -Werror -Wno-unused $(CFLAGS)
CXXFLAGS += $(CFLAGS)
# -fno-exceptions
@@ -126,6 +110,8 @@ debug: all
else
$(TARGET): Makefile.$(TARGET_ARCHITECTURE) $(OBJS) ../../JGE/lib/linux/libjge.a
$(CXX) -o $(TARGET) $(OBJS) $(LIBS) $(LIBDIR)
@@ -142,7 +128,7 @@ clean:
endif
define compile
$(CXX) -c $(CXXFLAGS) $< -o $@
$(CXX) -c $(CXXFLAGS) $< -o $@
endef
PrecompiledHeader.h.gch: ../../projects/mtg/include/PrecompiledHeader.h

View File

@@ -1,3 +0,0 @@
maxGrade=0: Borderline (99% OK)
keybindings_sdl=13:2,27:2,32:10,97:7,98:5,100:6,101:15,102:16,105:11,106:12,107:13,108:10,113:14,115:9,119:8,1073741903:6,1073741904:7,1073741905:9,1073741906:8,1073741912:2,1073741952:14,1073741953:13,1073742048:3,1073742052:3,1073742094:2
aidecks=10

View File

@@ -1,11 +1,5 @@
#NAME:Kill by Numbers
#DESC:They just keep multiplying.
#HINT:castpriority(enchantment,instant,sorcery,artifact,creature)
#HINT:dontattackwith(Rhys the Redeemed)
#HINT:dontblockwith(Rhys the Redeemed)
#HINT:dontattackwith(Kazandu Tuskcaller)
#HINT:dontblockwith(Kazandu Tuskcaller)
Mox Emerald (LEA) *2
Mox Pearl (LEA) *2
Forest (LEA) *15

View File

@@ -1,6 +1,7 @@
#NAME:Etched Affinity
#DESC:Modern URB Aggro
#HINT:dontattackwith(creature[power<=0])
#HINT:combo hold(Glimmervoid|myhand)^until(artifact|mybattlefield)^cast(Glimmervoid|myhand)^totalmananeeded({0})
#HINT:combo hold(Galvanic Blast|myhand)^cast(Galvanic Blast|myhand)^restriction{type(artifact|mybattlefield)~morethan~2,turn:3}^totalmananeeded({R})
#25 creatures

View File

@@ -23,23 +23,23 @@
369072
#4 x Armada Wurm (RTR), {2}{g}{g}{w}{w}, Creature Wurm, 5/5, trample;
253587
253587
253587
253587
999009
999009
999009
999009
#2 x Precinct Captain (RTR), {w}{w}, Creature Human Soldier, 2/2, first strike;
270792
270792
999171
999171
#4 x Wayfaring Temple (RTR), {1}{g}{w}, Creature Elemental, 0/0,
253539
253539
253539
253539
999260
999260
999260
999260
#1 x Worldspine Wurm (RTR), {8}{g}{g}{g}, Creature Wurm, 15/15, trample;
253575
999262
@@ -57,14 +57,14 @@
369060
#2 x Chromatic Lantern (RTR), {3}, Artifact,
290542
290542
999039
999039
#4 x Growing Ranks (RTR), {2}{g/w}{g/w}, Enchantment,
270957
270957
270957
270957
999106
999106
999106
999106
@@ -84,26 +84,26 @@
369018
#4 x Forest (RTR), Basic Land Forest,
289326
289326
289326
289326
999086
999086
999086
999086
#4 x Plains (RTR), Basic Land Plains,
289310
289310
289310
289310
999168
999168
999168
999168
#2 x Temple Garden (RTR), Land Forest Plains,
253681
253681
999238
999238
#4 x Plains (RTR), Basic Land Plains,
289309
289309
289309
289309
999265
999265
999265
999265

View File

@@ -7,13 +7,10 @@ from optparse import OptionParser
def createResZipFile(filename):
utilities = ZipUtilities()
rename = False
if not os.path.isfile('settings/options.txt'):
os.rename('settings/options.orig.txt', 'settings/options.txt')
remame = True
if not os.path.isfile('player/options.txt'):
os.rename('player/options.orig.txt', 'player/options.txt')
rename = True
zip_file = zipfile.ZipFile(filename, 'w', zipfile.ZIP_STORED)
utilities.addFolderToZip(zip_file, 'themes')
@@ -28,10 +25,6 @@ def createResZipFile(filename):
utilities.addFolderToZip(zip_file, 'campaigns')
utilities.addFolderToZip(zip_file, 'ai')
zip_file.close()
if rename:
os.rename('settings/options.txt', 'settings/options.orig.txt')
os.rename('player/options.txt', 'player/options.orig.txt')
def getFilename():
p = Properties();
@@ -44,18 +37,16 @@ def getFilename():
def createStandardResFile(filename):
print('Creating Standard Resource File')
if not filename:
filename = getFilename() + '.zip'
def createStandardResFile():
print "Creating Standard Resource File"
filename = getFilename() + '.zip'
createResZipFile( filename )
print >> sys.stderr, 'Created Resource Package for Standard Distribution: {0}'.format( filename)
def createIosResFile(filename):
print('Preparing Resource Package for iOS')
def createIosResFile():
print 'Preparing Resource Package for iOS'
utilities = ZipUtilities()
if not filename:
filename = getFilename() + '_iOS.zip'
filename = getFilename() + '_iOS.zip'
#createResZipFile( filename )
zip_file = zipfile.ZipFile(filename, 'a', zipfile.ZIP_STORED)
zip_file.write("../../iOS/Res/rules/modrules.xml", "rules/modrules.xml", zipfile.ZIP_STORED)
@@ -80,10 +71,10 @@ class ZipUtilities:
if file != '.svn':
full_path = os.path.join(folder, file)
if os.path.isfile(full_path):
print('File added: ' + str(full_path))
print 'File added: ' + str(full_path)
zip_file.write(full_path)
elif os.path.isdir(full_path):
print('Entering folder: ' + str(full_path))
print 'Entering folder: ' + str(full_path)
self.addFolderToZip(zip_file, full_path)
@@ -92,17 +83,16 @@ def main():
parser = OptionParser()
parser.add_option("-p", "--platform", help="PLATFORM: specify custom build. (eg ios, android, etc)", metavar="PLATFORM", dest="platform")
parser.add_option("-n", "--name", help="NAME: specify resource file name", metavar="NAME", dest="name")
(options, args) = parser.parse_args()
if (options.platform):
if (options.platform == "ios"):
createIosResFile(options.name)
else:
createStandardResFile(options.name)
if (options.platform == "ios"):
createIosResFile()
else:
createStandardResFile()
else:
createStandardResFile(options.name)
createStandardResFile()
if __name__ == "__main__":
main()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

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