version 0.5.2

master
Dmitr Rodin 2010-05-08 18:24:54 +07:00
parent b510db8d5f
commit 3cd165edd5
11 changed files with 66 additions and 60 deletions

View File

@ -0,0 +1,5 @@
#Sat May 08 18:19:49 ICT 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.source=1.5

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drodin.zxdroid" android:versionCode="6"
android:versionName="0.5.1">
package="com.drodin.zxdroid" android:versionCode="7"
android:versionName="0.5.2">
<supports-screens android:smallScreens="true"
android:normalScreens="true" android:largeScreens="true"

View File

@ -71,7 +71,7 @@ resize(JNIEnv *env, jobject thiz, jint width, jint height, jboolean scaling) {
jfieldID sfid = (*cenv)->GetStaticFieldID(cenv, nclass, "soundEnabled", "Z");
settings_current.sound = (*cenv)->GetStaticBooleanField(cenv, nclass, sfid);
jfieldID rfid = (*cenv)->GetStaticFieldID(cenv, nclass, "frameSkip", "Z");
jfieldID rfid = (*cenv)->GetStaticFieldID(cenv, nclass, "skipFrames", "Z");
settings_current.frame_rate = (*cenv)->GetStaticBooleanField(cenv, nclass, rfid) + 1;
jboolean isCopy;

View File

@ -2,19 +2,6 @@
<resources>
<string name="app_name">ZXdroid</string>
<string name="welcome_title">Welcome to ZXdroid!</string>
<string name="welcome_message">
A ZX Spectrum emulator for Android platform based
on
Fuse (the Free Unix Spectrum Emulator).
\n\nCoded by Dmitry Rodin.
\n\nYou can get Spectrum games on
\nwww.worldofspectrum.com
\n\nDpad/trackball is definied as Kempston
joystick by default - you
can change it in
Menu > Define keys.</string>
<string name="emulator_state">Emulator state</string>
<string name="load_file">Load file</string>
<string name="save_snapshot">Save snapshot</string>
@ -29,6 +16,7 @@
<string name="enable_sound">Enable sounds</string>
<string name="control_settings">Control settings</string>
<string name="hide_controls">Hide Controls</string>
<string name="onscreen_controls">OnScreen controls</string>
<string name="define_keys">Define Keys</string>
<string name="intercept_menu_back">Intercept Menu &amp; Back</string>

View File

@ -16,6 +16,8 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/control_settings">
<CheckBoxPreference android:key="hideControls"
android:title="@string/hide_controls" android:defaultValue="false" />
<ListPreference android:key="onScreenControls"
android:title="@string/onscreen_controls" android:entries="@array/control_entries"
android:entryValues="@array/control_entries" android:defaultValue="Keyboard" />
@ -35,8 +37,8 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/video_settings">
<CheckBoxPreference android:key="frameSkip"
android:title="@string/frame_skip" android:defaultValue="false" />
<CheckBoxPreference android:key="skipFrames"
android:title="@string/frame_skip" android:defaultValue="true" />
<CheckBoxPreference android:key="smoothScaling"
android:title="@string/smooth_scaling" android:defaultValue="true" />
</PreferenceCategory>

View File

@ -132,13 +132,15 @@ public class MainActivity extends Activity implements AdListener {
mInnerLayout.addView(mMainView,
new LayoutParams(NativeLib.mWidth, NativeLib.mHeight));
mMainLayout.addView(mInnerLayout);
mMainLayout.addView(mControlsView,
new LayoutParams(NativeLib.mWidth, mSoftControls.mControl.getHeight()));
if (!NativeLib.hideControls) {
mMainLayout.addView(mControlsView,
new LayoutParams(NativeLib.mWidth, mSoftControls.mControl.getHeight()));
}
mMainLayout.addView(adView,
new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT));
} else {
mMainLayout.setOrientation(LinearLayout.HORIZONTAL);
/*if (NativeLib.hideControls) {
if (NativeLib.hideControls) {
mInnerLayout.setLayoutParams(
new LayoutParams(
NativeLib.mWidth*NativeLib.spectrumScreenWidth/NativeLib.spectrumScreenHeight,
@ -147,7 +149,7 @@ public class MainActivity extends Activity implements AdListener {
new LayoutParams(
NativeLib.mWidth*NativeLib.spectrumScreenWidth/NativeLib.spectrumScreenHeight,
NativeLib.mWidth));
} else {*/
} else {
mMainLayout.addView(mControlsView,
new LayoutParams(NativeLib.displayHeight-NativeLib.mWidth, NativeLib.mWidth));
mInnerLayout.setLayoutParams(
@ -156,7 +158,7 @@ public class MainActivity extends Activity implements AdListener {
new LayoutParams(NativeLib.mWidth, NativeLib.mHeight));
mInnerLayout.addView(adView,
new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT));
//}
}
mMainLayout.addView(mInnerLayout);
}
@ -226,14 +228,14 @@ public class MainActivity extends Activity implements AdListener {
startActivityForResult(new Intent(this, MenuTop.class), 0);
}
}
public void showSelectControl () {
if (!menuOnTop) {
menuOnTop = true;
startActivityForResult(new Intent(this, SelectControl.class), 0);
}
}
public void showWelcomeMenu () {
if (!menuOnTop) {
menuOnTop = true;
@ -245,6 +247,11 @@ public class MainActivity extends Activity implements AdListener {
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(NativeLib.hideControls != NativeLib.controlsHidden) {
NativeLib.controlsHidden = NativeLib.hideControls;
createScreen();
}
if (resultCode == RESULT_OK && requestCode == 0) {
final String openFileName = data.getStringExtra("openFileName");
@ -277,10 +284,12 @@ public class MainActivity extends Activity implements AdListener {
= Integer.parseInt(keyPairs[i].split(":")[1]);
}
NativeLib.frameSkip = settings.getBoolean("frameSkip", false);
NativeLib.skipFrames = settings.getBoolean("skipFrames", true);
NativeLib.smoothScaling = settings.getBoolean("smoothScaling", true);
NativeLib.soundEnabled = settings.getBoolean("soundEnabled", false);
NativeLib.trackballSensitivity = settings.getInt("trackballSensitivity", 3);
NativeLib.hideControls = settings.getBoolean("hideControls", false);
NativeLib.controlsHidden = NativeLib.hideControls;
NativeLib.interceptMenuBack = settings.getBoolean("interceptMenuBack", false);
NativeLib.onScreenControls = settings.getString("onScreenControls", "Kempston");
//NativeLib.currentMachine = settings.getString("currentMachine", "128");
@ -320,25 +329,21 @@ public class MainActivity extends Activity implements AdListener {
} catch(IOException e) { }
}
@Override
public void onFailedToReceiveAd(AdView arg0) {
// TODO Auto-generated method stub
}
@Override
public void onFailedToReceiveRefreshedAd(AdView arg0) {
// TODO Auto-generated method stub
}
@Override
public void onReceiveAd(AdView arg0) {
// TODO Auto-generated method stub
}
@Override
public void onReceiveRefreshedAd(AdView arg0) {
// TODO Auto-generated method stub

View File

@ -34,7 +34,7 @@ import android.view.MotionEvent;
public class MainView extends GLSurfaceView {
MainActivity mMainActivity = null;
private MainActivity mMainActivity = null;
private static boolean trackballUsed = false;
private static long trackUp = 0;
@ -45,12 +45,14 @@ public class MainView extends GLSurfaceView {
public MainView(Context context) {
super(context);
mMainActivity = MainActivity.currentInstance;
setId((int)Math.random()*100);
setFocusable(true);
setFocusableInTouchMode(true);
//requestFocus();
requestFocus();
setRenderer(new MainRenderer());
setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
@ -64,10 +66,18 @@ public class MainView extends GLSurfaceView {
event.getY()>NativeLib.menuTouchDelta &&
event.getY()<(float)getHeight()-NativeLib.menuTouchDelta
) {
if (NativeLib.interceptMenuBack)
MainActivity.currentInstance.showMenu();
if (NativeLib.interceptMenuBack || NativeLib.hideControls)
post(new Runnable() {
public void run() {
mMainActivity.showMenu();
}
});
else
MainActivity.currentInstance.showSelectControl();
post(new Runnable() {
public void run() {
mMainActivity.showSelectControl();
}
});
}
return true;
}
@ -77,8 +87,11 @@ public class MainView extends GLSurfaceView {
final int keyCode = event.getKeyCode();
if (event.getRepeatCount() == 0 && keyCode > 0 && keyCode < NativeLib.androidKeys.length) {
if (!NativeLib.interceptMenuBack && keyCode==KeyEvent.KEYCODE_MENU) {
MainActivity.currentInstance.showMenu();
return true;
post(new Runnable() {
public void run() {
mMainActivity.showMenu();
}
}); return true;
} else if (!NativeLib.interceptMenuBack && keyCode==KeyEvent.KEYCODE_BACK) {
return false;
} else if (keyCode==KeyEvent.KEYCODE_VOLUME_UP &&
@ -220,7 +233,6 @@ public class MainView extends GLSurfaceView {
public class MainRenderer implements GLSurfaceView.Renderer {
@Override
public void onDrawFrame(GL10 gl) {
if (trackballUsed)
@ -235,22 +247,18 @@ public class MainView extends GLSurfaceView {
}
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
NativeLib.resize(width, height, NativeLib.smoothScaling);
if (MainActivity.firstRun) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
MainActivity.currentInstance.showWelcomeMenu();
post(new Runnable() {
public void run() {
mMainActivity.showWelcomeMenu();
}
});
MainActivity.firstRun = false;
}
}
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
//Process.setThreadPriority(Process.THREAD_PRIORITY_DISPLAY);

View File

@ -36,7 +36,7 @@ public class NativeLib {
public static volatile String openFileName = "";
public static volatile String saveFileName = "";
public static boolean frameSkip;
public static boolean skipFrames;
public static boolean smoothScaling;
@ -124,5 +124,6 @@ public class NativeLib {
public static final String tmpFilePrefix = "zxdroid_tmp_";
public static String tmpUncompressedFN = null;
//public static boolean hideControls = true;
public static boolean hideControls;
public static boolean controlsHidden;
}

View File

@ -130,7 +130,6 @@ public class SoftControls extends KeyboardView implements KeyboardView.OnKeyboar
}
}
@Override
public void onKey(int primaryCode, int[] keyCodes) {
if (primaryCode == Keyboard.KEYCODE_SHIFT) {
@ -173,7 +172,6 @@ public class SoftControls extends KeyboardView implements KeyboardView.OnKeyboar
}
@Override
public void onPress(final int primaryCode) {
if (primaryCode!=Keyboard.KEYCODE_SHIFT && primaryCode!=Keyboard.KEYCODE_ALT) {
if (primaryCode > NativeLib.spectrumModFireLock + NativeLib.spectrumKeys.length) {
@ -196,8 +194,6 @@ public class SoftControls extends KeyboardView implements KeyboardView.OnKeyboar
}
}
@Override
public void onRelease(final int primaryCode) {
if (primaryCode!=Keyboard.KEYCODE_SHIFT && primaryCode!=Keyboard.KEYCODE_ALT) {
if (lastKeyCode1!=0) {
@ -211,7 +207,6 @@ public class SoftControls extends KeyboardView implements KeyboardView.OnKeyboar
}
}
@Override
public void onText(CharSequence text) {
}

View File

@ -89,8 +89,6 @@ public class FileSave extends ListActivity {
saveButton = (Button) findViewById(R.id.save_btn);
saveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final Intent extras = new Intent();
extras.putExtra("menuEventValue", NativeLib.MENU_FILE_SAVESNAPSHOT);

View File

@ -54,11 +54,12 @@ implements Preference.OnPreferenceChangeListener {
settings = PreferenceManager.getDefaultSharedPreferences(this);
findPreference("frameSkip").setOnPreferenceChangeListener(this);
findPreference("skipFrames").setOnPreferenceChangeListener(this);
findPreference("smoothScaling").setOnPreferenceChangeListener(this);
findPreference("soundEnabled").setOnPreferenceChangeListener(this);
findPreference("hideControls").setOnPreferenceChangeListener(this);
findPreference("onScreenControls").setSummary(NativeLib.onScreenControls);
findPreference("onScreenControls").setOnPreferenceChangeListener(this);
@ -114,10 +115,9 @@ implements Preference.OnPreferenceChangeListener {
return super.onPreferenceTreeClick(screen, pref);
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (preference.getKey().equals("frameSkip")) {
NativeLib.frameSkip = (newValue.equals(false))?false:true;
if (preference.getKey().equals("skipFrames")) {
NativeLib.skipFrames = (newValue.equals(false))?false:true;
finish();
}
if (preference.getKey().equals("smoothScaling")) {
@ -128,6 +128,10 @@ implements Preference.OnPreferenceChangeListener {
NativeLib.soundEnabled = (newValue.equals(false))?false:true;
finish();
}
if (preference.getKey().equals("hideControls")) {
NativeLib.hideControls = (newValue.equals(false))?false:true;
finish();
}
if (preference.getKey().equals("interceptMenuBack")) {
NativeLib.interceptMenuBack = (newValue.equals(false))?false:true;
if (newValue.equals(true)) {