Skip to content

Commit

Permalink
added vsync setting, it required for some device as nvidia shield
Browse files Browse the repository at this point in the history
  • Loading branch information
U-TelNav-PC\TelNav authored and U-TelNav-PC\TelNav committed Nov 10, 2014
1 parent fd73c7d commit 2b9d95b
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 22 deletions.
51 changes: 51 additions & 0 deletions HowToBuild.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
1) At first for building we need linux-console
I used speedLinux under windows

2) Install Android sdk&ndk (i unpacked it into ~/sdk directory)
https://developer.android.com/tools/sdk/ndk/index.html
https://developer.android.com/sdk/index.html

for run android environment i create and use simple script setenv-android.sh

#!/bin/sh

export ANT_HOME=~/sdk/apache-ant-1.8.2
export PATH=~/sdk/android-ndk-r10c:$PATH
export PATH=~/sdk/android-sdk-linux/tools:$PATH
export PATH=~/sdk/android-sdk-linux/build-tools/21.0.1:$PATH
export PATH=~/sdk/jdk1.7.0_03/jre/bin:$PATH
export PATH=~/sdk/apache-ant-1.8.2/bin:$PATH

now we can run android build environment via console
. setenv-android.sh

Now via Android SDK Manager (for call sdk manager via console type android). We need download latest version:
Android SDK Tools
Android SDK Platform-tools
Android SDL Build tools
Android 5.0 (API 21)
+SDK Platform (API 21)
+Google APIs (API 21)

3) Install pelya's libSDL-environment
cd ~
git clone git://github.com/pelya/commandergenius
I renamed commandergenius folder to androidsdl

4) download uae4all2 sources
git clone git://github.com/lubomyr/uae4all2
Copy folder ~/uae4all2 into ~/androidsdl/project/jni/application
cd ~/androidsdl/project/jni/application/uae4all2
. copy_src2x86.sh
. copy_src2v7a.sh
. copy_src2v7a-neon.sh


// creating symlink src to uae4all2
cd ~/androidsdl/project/jni/application
rm src
ln -s uae4all2 src

// Now we can build project (apk)
cd ~/androidsdl
./build.sh
14 changes: 0 additions & 14 deletions build-instruction.txt

This file was deleted.

19 changes: 17 additions & 2 deletions src/drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,30 @@ static __inline__ void count_frame (void)
switch(prefs_gfx_framerate)
{
case 0: // draw every frame (Limiting is done by waiting for vsync...)
fs_framecnt = 0;
#if defined(ANDROIDSDL) || defined(AROS)
if (!mainMenu_vsync)
#endif
fs_framecnt = 0;
#if defined(ANDROIDSDL) || defined(AROS)
else
{
// Limiter
while(getTime10MicroSec() < lastTick + ticksPerFrame)
{
usleep(100);
gettimeofday(&tv, 0);
}
lastTick += ticksPerFrame;
}
#endif
break;

case 1: // draw every second frame
fs_framecnt++;
if (fs_framecnt > 1)
fs_framecnt = 0;
// Limiter
while(getTime10MicroSec() < lastTick + ticksPerFrame - 500)
while(getTime10MicroSec() < lastTick + ticksPerFrame)
{
usleep(100);
gettimeofday(&tv, 0);
Expand Down
11 changes: 10 additions & 1 deletion src/gp2x/menu/menu_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ int menuLoad_extfilter=1;
int mainMenu_quickSwitch=0;
int mainMenu_FloatingJoystick=0;
#endif
#if defined(ANDROIDSDL) || defined(AROS)
int mainMenu_vsync=0;
#endif

void SetDefaultMenuSettings(int general)
{
Expand Down Expand Up @@ -1021,6 +1024,10 @@ int saveconfig(int general)
fputs(buffer,f);
snprintf((char*)buffer, 255, "FloatingJoystick=%d\n",mainMenu_FloatingJoystick);
fputs(buffer,f);
#endif
#if defined(ANDROIDSDL) || defined(AROS)
snprintf((char*)buffer, 255, "VSync=%d\n",mainMenu_vsync);
fputs(buffer,f);
#endif
fclose(f);
return 1;
Expand Down Expand Up @@ -1270,7 +1277,9 @@ void loadconfig(int general)
fscanf(f,"quick_switch=%d\n",&mainMenu_quickSwitch);
fscanf(f,"FloatingJoystick=%d\n",&mainMenu_FloatingJoystick);
#endif

#if defined(ANDROIDSDL) || defined(AROS)
fscanf(f,"VSync=%d\n",&mainMenu_vsync);
#endif
fclose(f);
}

Expand Down
3 changes: 3 additions & 0 deletions src/gp2x/menu/menu_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,7 @@ extern int menuLoad_extfilter;
extern int mainMenu_quickSwitch;
extern int mainMenu_FloatingJoystick;
#endif
#if defined(ANDROIDSDL) || defined(AROS)
extern int mainMenu_vsync;
#endif
#endif
47 changes: 42 additions & 5 deletions src/menu_guichan/menuTabDisplaySound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ namespace widgets
gcn::UaeDropDown* dropDown_vertical_pos;
gcn::UaeDropDown* dropDown_cut_left;
gcn::UaeDropDown* dropDown_cut_right;
#if defined(ANDROIDSDL) || defined(AROS)
gcn::CheckBox* checkBox_vsync;
#endif

// Sound
gcn::Window *group_refreshrate;
Expand Down Expand Up @@ -289,6 +292,21 @@ namespace widgets
};
CutRightActionListener* cutRightActionListener;

#if defined(ANDROIDSDL) || defined(AROS)
class VsyncActionListener : public gcn::ActionListener
{
public:
void action(const gcn::ActionEvent& actionEvent)
{
if (actionEvent.getSource() == checkBox_vsync)
if (checkBox_vsync->isSelected())
mainMenu_vsync=1;
else
mainMenu_vsync=0;
}
};
VsyncActionListener* vsyncActionListener;
#endif

class SoundActionListener : public gcn::ActionListener
{
Expand Down Expand Up @@ -495,9 +513,17 @@ namespace widgets
group_refreshrate->add(radioButton_refreshrate_50Hz);
group_refreshrate->add(radioButton_refreshrate_60Hz);
group_refreshrate->setMovable(false);
group_refreshrate->setSize(100,85);
group_refreshrate->setBaseColor(baseCol);

group_refreshrate->setSize(100,85);
group_refreshrate->setBaseColor(baseCol);
#if defined(ANDROIDSDL) || defined(AROS)
checkBox_vsync = new gcn::CheckBox("VSyncOff");
checkBox_vsync->setPosition(180,215);
checkBox_vsync->setId("VSyncOff");
checkBox_vsync->setBaseColor(baseColLabel);
vsyncActionListener = new VsyncActionListener();
checkBox_vsync->addActionListener(vsyncActionListener);
#endif

// Select Sound enable/accuracy
radioButton_sound_off = new gcn::UaeRadioButton("off", "radiosoundpresentgroup");
radioButton_sound_off->setPosition(5,10);
Expand Down Expand Up @@ -593,6 +619,9 @@ namespace widgets
tab_displaysound->add(backgrd_cut_right);
tab_displaysound->add(dropDown_cut_right);
tab_displaysound->add(group_refreshrate);
#if defined(ANDROIDSDL) || defined(AROS)
tab_displaysound->add(checkBox_vsync);
#endif
tab_displaysound->setSize(600,280);
tab_displaysound->setBaseColor(baseCol);
tab_displaysound->add(group_sound_enable);
Expand Down Expand Up @@ -639,11 +668,14 @@ namespace widgets
delete group_refreshrate;
delete radioButton_refreshrate_50Hz;
delete radioButton_refreshrate_60Hz;
#if defined(ANDROIDSDL) || defined(AROS)
delete checkBox_vsync;
#endif
delete group_sound_enable;
delete radioButton_sound_off;
delete radioButton_sound_fast;
delete radioButton_sound_accurate;
delete group_sound_rate;
delete group_sound_rate;
delete radioButton_soundrate_8k;
delete radioButton_soundrate_11k;
delete radioButton_soundrate_22k;
Expand Down Expand Up @@ -795,7 +827,12 @@ namespace widgets
radioButton_refreshrate_50Hz->setSelected(true);
else if (mainMenu_ntsc)
radioButton_refreshrate_60Hz->setSelected(true);

#if defined(ANDROIDSDL) || defined(AROS)
if (mainMenu_vsync)
checkBox_vsync->setSelected(true);
else
checkBox_vsync->setSelected(false);
#endif
if (mainMenu_sound==0)
radioButton_sound_off->setSelected(true);
else if (mainMenu_sound==1)
Expand Down

0 comments on commit 2b9d95b

Please sign in to comment.