diff --git a/.gitignore b/.gitignore
index e4350c09b..c5210358c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,5 @@ obj/
newdc/android/libnewdc/bin/libnewdc.jar
newdc/android/libnewdc/bin/classes/com/example/newdc/JNIdc.class
+
+shell/android/assets/build
diff --git a/README.md b/README.md
index 00018cb12..c7a245455 100644
--- a/README.md
+++ b/README.md
@@ -32,6 +32,10 @@ ndk-build -j 4
ant debug
```
+Beta versions
+-------------------
+Compiled test versions are available at reicast.loungekatt.com
+
Donations and stuff
-------------------
Well, glad you liked the project so far!
diff --git a/core/nullDC.cpp b/core/nullDC.cpp
index b3c7c587e..0d9a6d54e 100755
--- a/core/nullDC.cpp
+++ b/core/nullDC.cpp
@@ -216,7 +216,7 @@ void LoadSettings()
settings.dynarec.Enable = cfgLoadInt("config","Dynarec.Enabled", 1)!=0;
settings.dynarec.idleskip = cfgLoadInt("config","Dynarec.idleskip",1)!=0;
settings.dynarec.unstable_opt = cfgLoadInt("config","Dynarec.unstable-opt",0);
- settings.dreamcast.cable = cfgLoadInt("config","Dreamcast.Cable", 3);
+ settings.dreamcast.cable = cfgLoadInt("config","Dreamcast.Cable",3);
settings.dreamcast.RTC = cfgLoadInt("config","Dreamcast.RTC",GetRTC_now());
settings.dreamcast.region = cfgLoadInt("config","Dreamcast.Region",3);
settings.dreamcast.broadcast = cfgLoadInt("config","Dreamcast.Broadcast",4);
diff --git a/shell/android/AndroidManifest.xml b/shell/android/AndroidManifest.xml
index 5d6f3f570..a92509b6a 100644
--- a/shell/android/AndroidManifest.xml
+++ b/shell/android/AndroidManifest.xml
@@ -7,10 +7,11 @@
android:minSdkVersion="8"
android:targetSdkVersion="19" />
-
+
+
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/shell/android/res/drawable/gradient_bg.xml b/shell/android/res/drawable/gradient_bg.xml
new file mode 100755
index 000000000..1a64c34a5
--- /dev/null
+++ b/shell/android/res/drawable/gradient_bg.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/shell/android/res/drawable/gradient_bg_hover.xml b/shell/android/res/drawable/gradient_bg_hover.xml
new file mode 100755
index 000000000..f7612e8c8
--- /dev/null
+++ b/shell/android/res/drawable/gradient_bg_hover.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/shell/android/res/drawable/image_bg.xml b/shell/android/res/drawable/image_bg.xml
new file mode 100755
index 000000000..a1004de21
--- /dev/null
+++ b/shell/android/res/drawable/image_bg.xml
@@ -0,0 +1,14 @@
+
+
+
+ -
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/shell/android/res/drawable/list_selector.xml b/shell/android/res/drawable/list_selector.xml
new file mode 100755
index 000000000..fb1560c2e
--- /dev/null
+++ b/shell/android/res/drawable/list_selector.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/shell/android/res/layout/about_fragment.xml b/shell/android/res/layout/about_fragment.xml
new file mode 100755
index 000000000..2db297a1c
--- /dev/null
+++ b/shell/android/res/layout/about_fragment.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/shell/android/res/layout/change_item.xml b/shell/android/res/layout/change_item.xml
new file mode 100755
index 000000000..2cfdc070f
--- /dev/null
+++ b/shell/android/res/layout/change_item.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/shell/android/res/layout/configure_fragment.xml b/shell/android/res/layout/configure_fragment.xml
index 216c23757..a705e4e9e 100644
--- a/shell/android/res/layout/configure_fragment.xml
+++ b/shell/android/res/layout/configure_fragment.xml
@@ -7,38 +7,12 @@
+ android:stretchColumns="*"
+ android:layout_marginLeft="6dp" >
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
+ android:layout_marginTop="10dp"
+ android:orientation="vertical" >
-
+
+
+
+ android:layout_marginTop="10dp"
+ android:orientation="vertical" >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/shell/android/res/values-el/strings.xml b/shell/android/res/values-el/strings.xml
index 73768a465..986d2d1ad 100644
--- a/shell/android/res/values-el/strings.xml
+++ b/shell/android/res/values-el/strings.xml
@@ -52,7 +52,6 @@
MOGA Pro Connected!
MOGA Connected!
- About reicast
reicast is a dreamcast emulator\n\nVersion: %1$s
diff --git a/shell/android/res/values-es/strings.xml b/shell/android/res/values-es/strings.xml
index 0d1343b7b..ef7b8172c 100644
--- a/shell/android/res/values-es/strings.xml
+++ b/shell/android/res/values-es/strings.xml
@@ -51,7 +51,6 @@
MOGA Pro conectado!
MOGA conectado!
- Acerca reicast
reicast es un emulador de Dreamcast\n\nVersion: %1$s
diff --git a/shell/android/res/values-fr/strings.xml b/shell/android/res/values-fr/strings.xml
new file mode 100644
index 000000000..4f52e0270
--- /dev/null
+++ b/shell/android/res/values-fr/strings.xml
@@ -0,0 +1,116 @@
+
+
+ reicast
+ Réglages
+ reicast
+ Répertoire système (emplacement du répertoire \'data\' comprenant les fichiers \'dc_boot.bin\' et \'dc_flash.bin\')
+ Répertoire système par défaut
+ Répertoire des jeux (emplacement de vos fichiers images au format gdi, chd ou cdi)
+ Répertoire des jeux par défaut
+
+ Démarrer le bios Dreamcast
+ Il manque le fichier BIOS. Le fichier BIOS de la Dreamcast est indispensable pour faire fonctionner cet émulateur. Celui-ci doit être placé dans %1$s/data/dc_boot.bin
+ Il manque le fichier FLASH. Le fichier FLASH de la Dreamcast est indispensable pour faire fonctionner cet émulateur. Celui-ci doit être placé dans %1$s/data/dc_flash.bin
+ Vous devez fournir un fichier BIOS
+
+ DEMARRER LE BIOS
+ SELECTIONNER LE DOSSIER ACTUEL
+
+ Experimental (peut causer un crash)
+ Options du Dynarec
+ Optimisations instables
+ Région du bios
+ Limiter le nombre de FPS
+ Rendu Mipmaps (correction pour l\'ancien SGX540)
+ Mode portrait (écran large)
+ Valeur de saut des images
+ Rendu PVR (ne fonctionne pas pour le moment)
+ Régler le disc par défaut
+
+ Liste des jeux disponibles
+
+ Personnaliser les contrôles tactiles
+ Lancer l\'éditeur
+ Vibrations
+ Manette A
+ Manette B
+ Manette C
+ Manette D
+ Manette non connectée
+ Aucune manette selectionnée
+ Choisir
+ Supprimer
+ Choisir manette
+ Pressez une touche de la manette %1$s pour attribuer
+ Cette manette est déjà utilisé !
+ Activer la fonction de disposition des touches
+ Activer le mode de compatibilité
+ Joystick utilisant la disposition du pad directionnel
+
+ Customiser les touches physiques
+ Modifier la manette
+ Pressez une nouvelle touche pour %1$s
+
+ MOGA Pro connecté
+ MOGA connecté
+
+ reicast est un émulateur dreamcast\n\nVersion: %1$s
+ Site web officiel: http://reicast.com
+ Bétas: http://reicast.loungekatt.com
+ https://api.github.com/repos/NoblesseOblige/reicast-emulator/commits
+
+
+ - Manette A
+ - Manette B
+ - Manette C
+ - Manette D
+
+
+
+ - cdi
+ - chd
+ - gdi
+
+
+
+ - E - Etats-Unis
+ - J - Japon
+ - U - Europe
+ - R - Sans région
+
+
+ Menu curseur ouvert
+ Menu curseur fermé
+
+
+
+ - Navigateur
+ - Réglages
+ - Chemins
+ - Configurer manette
+ - A propos
+ - Evaluez-nous
+
+
+
+
+
+ - @drawable/disk_unknown
+ - @drawable/config
+ - @drawable/open_folder
+ - @drawable/input
+ - @drawable/question
+ - @drawable/star
+
+
+
+ Icône de l\'élément
+
+ ALLUME
+ ETEINT
+
+ Identifié %1$s
+
+ Sauvegarde des logs d\'erreurs
+
+
diff --git a/shell/android/res/values-jp/strings.xml b/shell/android/res/values-jp/strings.xml
index c4e007a68..f6d7a78c4 100644
--- a/shell/android/res/values-jp/strings.xml
+++ b/shell/android/res/values-jp/strings.xml
@@ -51,7 +51,6 @@
MOGAプロ接続!
MOGA接続!
- reicastについて
reicastはドリームキャストエミュレータです\n\nバージョン: %1$s
diff --git a/shell/android/res/values-pl/strings.xml b/shell/android/res/values-pl/strings.xml
index d600a22cb..c73863f9c 100644
--- a/shell/android/res/values-pl/strings.xml
+++ b/shell/android/res/values-pl/strings.xml
@@ -52,7 +52,6 @@
MOGA Pro Connected!
MOGA Connected!
- About reicast
reicast is a dreamcast emulator\n\nVersion: %1$s
diff --git a/shell/android/res/values-pt/strings.xml b/shell/android/res/values-pt/strings.xml
index 5f32dfcf5..f25cd8c11 100644
--- a/shell/android/res/values-pt/strings.xml
+++ b/shell/android/res/values-pt/strings.xml
@@ -44,7 +44,7 @@
Pressione o novo botão para o controlador %1$s
MOGA Pro Conectado!
MOGA Conectado!
- Sobre o reicast
+
reicast é um emulador de Dreamcast\n\nVersão :%1$s
diff --git a/shell/android/res/values-sv/strings.xml b/shell/android/res/values-sv/strings.xml
index 73768a465..986d2d1ad 100644
--- a/shell/android/res/values-sv/strings.xml
+++ b/shell/android/res/values-sv/strings.xml
@@ -52,7 +52,6 @@
MOGA Pro Connected!
MOGA Connected!
- About reicast
reicast is a dreamcast emulator\n\nVersion: %1$s
diff --git a/shell/android/res/values-zh-rCN/strings.xml b/shell/android/res/values-zh-rCN/strings.xml
new file mode 100644
index 000000000..eceb2ab3b
--- /dev/null
+++ b/shell/android/res/values-zh-rCN/strings.xml
@@ -0,0 +1,111 @@
+
+
+ reicast
+ Hello world!
+ 设置
+ reicast
+ 系统路径 (dc_boot.bin/dc_flash.bin 所在的路径)
+ 默认系统路径
+ 储存路径 (.gdi, .chd 或 .cdi 镜像所在的路径)
+ 默认储存路径
+
+ 启动Dreamcast Bios
+ 找不到BIOS. 需要Dreamcast BIOS才能让模拟器运行.请把 BIOS文件放置在 %1$s/data/dc_boot.bin
+ 找不到Flash. 需要 Dreamcast Flash才能让模拟器运行. 请把 Flash文件放置在 %1$s/data/dc_flash.bin
+ 你需要提供BIOS
+
+ 启动BIOS
+ 选择当前路径
+
+ Dynarec设置
+ 不稳定优化
+ DC区域
+ 帧数限制
+ 使用Mipmaps (修复SGX540)
+ 宽屏模式
+ 跳帧值
+ PVR 渲染 (目前没有任何效果)
+ 设置默认光盘
+
+ 可用的Dreamcast游戏
+
+ 自定义触屏控制
+ 启动编辑器
+ 按键振动
+ 控制器A
+ 控制器B
+ 控制器C
+ 控制器D
+ 控制器未连接
+ 未选择任何控制器
+ 选择
+ 移除
+ 选择控制器
+ 按控制器 %1$s 上的任意键来分配控制器
+ 该控制器已被使用!
+ 启用自定义按键布局
+ 启用兼容模式
+
+ 自定义物理控制
+ 修改控制器
+ 按下控制器按钮来映射 %1$s
+
+ MOGA Pro已连接!
+ MOGA已连接
+
+ 关于 reicast
+ reicast是一款dreamcast模拟器 \n\n版本: %1$s
+
+
+ - 控制器A
+ - 控制器B
+ - 控制器C
+ - 控制器D
+
+
+
+ - cdi
+ - chd
+ - gdi
+
+
+
+
+
+
+ - (Default)
+
+
+ Slider Menu Opened
+ Slider Menu Closed
+
+
+
+ - 浏览器
+ - 设置
+ - 路径
+ - 输入
+ - 关于
+ - 评分
+
+
+
+
+
+ - @drawable/disk_unknown
+ - @drawable/config
+ - @drawable/open_folder
+ - @drawable/input
+ - @drawable/question
+ - @drawable/star
+
+
+
+ Item Icon
+
+ 开
+ 关
+
+ 保存出错日志
+
+
diff --git a/shell/android/res/values/strings.xml b/shell/android/res/values/strings.xml
index b49bc5db5..3a68d5f47 100644
--- a/shell/android/res/values/strings.xml
+++ b/shell/android/res/values/strings.xml
@@ -16,6 +16,7 @@
BOOT BIOS
SELECT CURRENT FOLDER
+ Experimental (May cause widespread panic)
Dynarec Options
Unstable Optimisations
DC Region
@@ -44,6 +45,7 @@
This controller is already in use!
Enable Custom Key Layout
Enable Compatibility Mode
+ Joystick Uses DPAD Layout
Customize Physical Controls
Modify Controller
@@ -52,8 +54,10 @@
MOGA Pro Connected!
MOGA Connected!
- About reicast
reicast is a dreamcast emulator\n\nVersion: %1$s
+ Homepage: http://reicast.com
+ Betas: http://reicast.loungekatt.com
+ https://api.github.com/repos/NoblesseOblige/reicast-emulator/commits
- Controller A
@@ -69,10 +73,10 @@
-
-
-
- - (Default)
+ - E - United States
+ - J - Japanese
+ - U - European
+ - R - Region Free
Slider Menu Opened
@@ -104,6 +108,8 @@
ON
OFF
+
+ Identified %1$s
Save Error Logs
diff --git a/shell/android/src/com/reicast/emulator/AboutFragment.java b/shell/android/src/com/reicast/emulator/AboutFragment.java
new file mode 100644
index 000000000..b0f3a2d20
--- /dev/null
+++ b/shell/android/src/com/reicast/emulator/AboutFragment.java
@@ -0,0 +1,318 @@
+/* ====================================================================
+ * Copyright (c) 2012-2013 Lounge Katt Entertainment. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by Lounge Katt" unless
+ * otherwise displayed by public repository entries.
+ *
+ * 4. The names "Lounge Katt", "TwistedUmbrella", and "LiveLog"
+ * must not be used to endorse or promote products derived from this
+ * software without prior written permission. For written permission,
+ * please contact admin@loungekatt.com.
+ *
+ * 5. Products derived from this software may not be called "LiveLog"
+ * nor may "LiveLog" appear in their names without prior written
+ * permission of Lounge Katt Entertainment.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by Lounge Katt" unless
+ * otherwise displayed by tagged repository entries.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Lounge Katt ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * The license and distribution terms for any publicly available version or
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
+ * copied and put under another distribution license
+ * [including the GNU Public License.] Content not subject to these terms is
+ * subject to to the terms and conditions of the Apache License, Version 2.0.
+ */
+
+package com.reicast.emulator;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.StatusLine;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.app.Activity;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.os.AsyncTask;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Handler;
+import android.support.v4.app.Fragment;
+import android.text.util.Linkify;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.ListView;
+import android.widget.SlidingDrawer;
+import android.widget.SlidingDrawer.OnDrawerOpenListener;
+import android.widget.TextView;
+import android.widget.Toast;
+
+public class AboutFragment extends Fragment {
+
+ SlidingDrawer slidingGithub;
+ private ListView list;
+ private GitAdapter adapter;
+ private Handler handler;
+
+ private Activity parentActivity;
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ return inflater.inflate(R.layout.about_fragment, container, false);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ parentActivity = getActivity();
+ handler = new Handler();
+ try {
+ String versionName = parentActivity.getPackageManager()
+ .getPackageInfo(parentActivity.getPackageName(), 0).versionName;
+ int versionCode = parentActivity.getPackageManager()
+ .getPackageInfo(parentActivity.getPackageName(), 0).versionCode;
+ TextView version = (TextView) getView().findViewById(
+ R.id.about_text);
+ version.setText(parentActivity.getString(R.string.about_text,
+ versionName + "(" + String.valueOf(versionCode) + ")"));
+ } catch (NameNotFoundException e) {
+ e.printStackTrace();
+ }
+
+ TextView website = (TextView) getView().findViewById(
+ R.id.site_text);
+ Linkify.addLinks(website, Linkify.ALL);
+
+ TextView compiled = (TextView) getView().findViewById(
+ R.id.beta_text);
+ Linkify.addLinks(compiled, Linkify.ALL);
+
+ slidingGithub = (SlidingDrawer) getView().findViewById(
+ R.id.slidingGithub);
+ slidingGithub.setOnDrawerOpenListener(new OnDrawerOpenListener() {
+ public void onDrawerOpened() {
+ String git = parentActivity.getString(R.string.git_api);
+ retrieveGitTask queryGithub = new retrieveGitTask();
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ queryGithub.executeOnExecutor(
+ AsyncTask.THREAD_POOL_EXECUTOR, git);
+ } else {
+ queryGithub.execute(git);
+ }
+ }
+ });
+ slidingGithub.open();
+ }
+
+ public class retrieveGitTask extends
+ AsyncTask>> {
+
+ private String buildId = "";
+
+ @Override
+ protected void onPreExecute() {
+ try {
+ InputStream file = parentActivity.getAssets().open("build");
+ if (file != null) {
+ BufferedReader reader = new BufferedReader(
+ new InputStreamReader(file));
+ buildId = reader.readLine();
+ file.close();
+ }
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+ }
+
+ @Override
+ protected ArrayList> doInBackground(
+ String... paths) {
+ ArrayList> commitList = new ArrayList>();
+ try {
+ JSONArray gitObject = getContent(paths[0]);
+ for (int i = 0; i < gitObject.length(); i++) {
+ JSONObject jsonObject = gitObject.getJSONObject(i);
+
+ JSONObject commitArray = jsonObject.getJSONObject("commit");
+
+ String date = commitArray.getJSONObject("committer")
+ .getString("date").replace("T", " ")
+ .replace("Z", "");
+ String author = commitArray.getJSONObject("author")
+ .getString("name");
+ String committer = commitArray.getJSONObject("committer")
+ .getString("name");
+
+ String avatar = null;
+ if (!jsonObject.getString("committer").equals("null")) {
+ avatar = jsonObject.getJSONObject("committer")
+ .getString("avatar_url");
+ committer = committer
+ + " ("
+ + jsonObject.getJSONObject("committer")
+ .getString("login") + ")";
+ if (avatar.equals("null")) {
+ avatar = "https://github.com/apple-touch-icon-144.png";
+ }
+ } else {
+ avatar = "https://github.com/apple-touch-icon-144.png";
+ }
+ if (!jsonObject.getString("author").equals("null")) {
+ author = author
+ + " ("
+ + jsonObject.getJSONObject("author").getString(
+ "login") + ")";
+ }
+ String sha = jsonObject.getString("sha");
+ String curl = jsonObject
+ .getString("url")
+ .replace("https://api.github.com/repos",
+ "https://github.com")
+ .replace("commits", "commit");
+
+ String title = "No commit heading attached";
+ String message = "No commit message attached";
+
+ if (commitArray.getString("message").contains("\n\n")) {
+ String fullOutput = commitArray.getString("message");
+ title = fullOutput.substring(0,
+ fullOutput.indexOf("\n\n"));
+ message = fullOutput.substring(
+ fullOutput.indexOf("\n\n") + 1,
+ fullOutput.length());
+ } else {
+ title = commitArray.getString("message");
+ }
+
+ HashMap map = new HashMap();
+ map.put("Date", date);
+ map.put("Committer", committer);
+ map.put("Title", title);
+ map.put("Message", message);
+ map.put("Sha", sha);
+ map.put("Url", curl);
+ map.put("Author", author);
+ map.put("Avatar", avatar);
+ map.put("Build", buildId);
+ commitList.add(map);
+ }
+
+ } catch (JSONException e) {
+ handler.post(new Runnable() {
+ public void run() {
+ Toast.makeText(parentActivity,
+ "GitHub Native Unavailable!", Toast.LENGTH_LONG)
+ .show();
+ slidingGithub.close();
+ }
+ });
+ e.printStackTrace();
+ } catch (Exception e) {
+ handler.post(new Runnable() {
+ public void run() {
+ Toast.makeText(parentActivity,
+ "GitHub Native Unavailable!", Toast.LENGTH_LONG)
+ .show();
+ slidingGithub.close();
+ }
+ });
+ e.printStackTrace();
+ }
+
+ return commitList;
+ }
+
+ @Override
+ protected void onPostExecute(
+ ArrayList> commitList) {
+ if (commitList != null && commitList.size() > 0) {
+ list = (ListView) getView().findViewById(R.id.list);
+ list.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
+ adapter = new GitAdapter(parentActivity, commitList);
+ // Set adapter as specified collection
+ list.setAdapter(adapter);
+
+ list.setOnItemClickListener(new OnItemClickListener() {
+ public void onItemClick(AdapterView> parent, View view,
+ int position, long id) {
+ }
+ });
+ }
+
+ }
+ }
+
+ private JSONArray getContent(String urlString) throws IOException,
+ JSONException {
+ StringBuilder builder = new StringBuilder();
+ HttpClient client = new DefaultHttpClient();
+ HttpGet httpGet = new HttpGet(urlString);
+ try {
+ HttpResponse response = client.execute(httpGet);
+ StatusLine statusLine = response.getStatusLine();
+ int statusCode = statusLine.getStatusCode();
+ if (statusCode == 200) {
+ HttpEntity entity = response.getEntity();
+ InputStream content = entity.getContent();
+ BufferedReader reader = new BufferedReader(
+ new InputStreamReader(content));
+ String line;
+ while ((line = reader.readLine()) != null) {
+ builder.append(line);
+ }
+ } else {
+ }
+ } catch (ClientProtocolException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return new JSONArray(builder.toString());
+ }
+}
diff --git a/shell/android/src/com/reicast/emulator/ConfigureFragment.java b/shell/android/src/com/reicast/emulator/ConfigureFragment.java
index f8f6b98d5..0cc94e51a 100644
--- a/shell/android/src/com/reicast/emulator/ConfigureFragment.java
+++ b/shell/android/src/com/reicast/emulator/ConfigureFragment.java
@@ -12,9 +12,6 @@ import java.util.Scanner;
import org.apache.commons.lang3.StringUtils;
-import de.ankri.views.Switch;
-
-import android.annotation.TargetApi;
import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Build;
@@ -28,21 +25,26 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CompoundButton;
-import android.widget.EditText;
-import android.widget.Toast;
import android.widget.CompoundButton.OnCheckedChangeListener;
+import android.widget.EditText;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
+import android.widget.Spinner;
import android.widget.TextView;
+import android.widget.Toast;
+import de.ankri.views.Switch;
public class ConfigureFragment extends Fragment {
Activity parentActivity;
TextView mainFrames;
OnClickListener mCallback;
-
+
boolean dynarecopt = true;
boolean unstableopt = false;
int dcregion = 3;
@@ -53,6 +55,9 @@ public class ConfigureFragment extends Fragment {
boolean pvrrender = false;
String cheatdisk = "null";
+ boolean tegra = false;
+ boolean qualcomm = false;
+
private SharedPreferences mPrefs;
private File sdcard = Environment.getExternalStorageDirectory();
private String home_directory = sdcard + "/dc";
@@ -99,6 +104,19 @@ public class ConfigureFragment extends Fragment {
mPrefs = PreferenceManager.getDefaultSharedPreferences(parentActivity);
home_directory = mPrefs.getString("home_directory", home_directory);
+ String platform = readOutput("/system/bin/getprop ro.board.platform");
+ if (platform != null && !platform.equals(null)) {
+ Toast.makeText(parentActivity,
+ parentActivity.getString(R.string.platform, platform),
+ Toast.LENGTH_SHORT).show();
+ if (platform.contains("msm")) {
+ qualcomm = true;
+ }
+ if (platform.contains("tegra")) {
+ tegra = true;
+ }
+ }
+
try {
File config = new File(home_directory, "emu.cfg");
if (config.exists()) {
@@ -106,26 +124,32 @@ public class ConfigureFragment extends Fragment {
String currentLine;
while (scanner.hasNextLine()) {
currentLine = scanner.nextLine();
-
- // Check if the existing emu.cfg has the setting and get current value
-
- /*if (StringUtils.containsIgnoreCase(currentLine, "Dynarec.Enabled")) {
+
+ // Check if the existing emu.cfg has the setting and get
+ // current value
+
+ if (StringUtils.containsIgnoreCase(currentLine,
+ "Dynarec.Enabled")) {
dynarecopt = Boolean.valueOf(currentLine.replace(
"Dynarec.Enabled=", ""));
- }*/
- if (StringUtils.containsIgnoreCase(currentLine, "Dynarec.unstable-opt")) {
+ }
+ if (StringUtils.containsIgnoreCase(currentLine,
+ "Dynarec.unstable-opt")) {
unstableopt = Boolean.valueOf(currentLine.replace(
"Dynarec.unstable-opt=", ""));
}
- /*if (StringUtils.containsIgnoreCase(currentLine, "Dreamcast.Region")) {
+ if (StringUtils.containsIgnoreCase(currentLine,
+ "Dreamcast.Region")) {
dcregion = Integer.valueOf(currentLine.replace(
"Dreamcast.Region=", ""));
- }*/
- if (StringUtils.containsIgnoreCase(currentLine, "aica.LimitFPS")) {
+ }
+ if (StringUtils.containsIgnoreCase(currentLine,
+ "aica.LimitFPS")) {
limitfps = Boolean.valueOf(currentLine.replace(
"aica.LimitFPS=", ""));
}
- if (StringUtils.containsIgnoreCase(currentLine, "rend.UseMipmaps")) {
+ if (StringUtils.containsIgnoreCase(currentLine,
+ "rend.UseMipmaps")) {
mipmaps = Boolean.valueOf(currentLine.replace(
"rend.UseMipmaps=", ""));
}
@@ -138,23 +162,24 @@ public class ConfigureFragment extends Fragment {
frameskip = Integer.valueOf(currentLine.replace(
"ta.skip=", ""));
}
- /*if (StringUtils.containsIgnoreCase(currentLine, "pvr.rend")) {
+ if (StringUtils.containsIgnoreCase(currentLine, "pvr.rend")) {
pvrrender = Boolean.valueOf(currentLine.replace(
"pvr.rend=", ""));
- }*/
+ }
if (StringUtils.containsIgnoreCase(currentLine, "image")) {
cheatdisk = currentLine.replace("image=", "");
}
+
}
scanner.close();
}
} catch (Exception e) {
Log.d("reicast", "Exception: " + e);
}
-
+
// Generate the menu options and fill in existing settings
-
- /*OnCheckedChangeListener dynarec_options = new OnCheckedChangeListener() {
+
+ OnCheckedChangeListener dynarec_options = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
@@ -166,16 +191,16 @@ public class ConfigureFragment extends Fragment {
}
}
};
- Switch dynarec_opt = (Switch) getView().findViewById(
- R.id.dynarec_option);
- boolean dynarec = mPrefs.getBoolean("dynarec_opt", dynarecopt);
- if (dynarec) {
- dynarec_opt.setChecked(true);
- } else {
- dynarec_opt.setChecked(false);
- }
- dynarec_opt.setOnCheckedChangeListener(dynarec_options);*/
-
+ Switch dynarec_opt = (Switch) getView().findViewById(
+ R.id.dynarec_option);
+ boolean dynarec = mPrefs.getBoolean("dynarec_opt", dynarecopt);
+ if (dynarec) {
+ dynarec_opt.setChecked(true);
+ } else {
+ dynarec_opt.setChecked(false);
+ }
+ dynarec_opt.setOnCheckedChangeListener(dynarec_options);
+
OnCheckedChangeListener unstable_option = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
@@ -197,8 +222,9 @@ public class ConfigureFragment extends Fragment {
unstable_opt.setChecked(false);
}
unstable_opt.setOnCheckedChangeListener(unstable_option);
-
- /*String[] regions = parentActivity.getResources().getStringArray(R.array.region);
+
+ String[] regions = parentActivity.getResources().getStringArray(
+ R.array.region);
Spinner region_spnr = (Spinner) getView().findViewById(
R.id.region_spinner);
@@ -207,7 +233,7 @@ public class ConfigureFragment extends Fragment {
localeAdapter
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
region_spnr.setAdapter(localeAdapter);
-
+
int dc_region = mPrefs.getInt("dc_region", dcregion);
region_spnr.setSelection(dc_region, true);
@@ -225,11 +251,11 @@ public class ConfigureFragment extends Fragment {
}
public void onNothingSelected(AdapterView> arg0) {
- mPrefs.edit().putInt("dc_region", 3).commit();
+ mPrefs.edit().putInt("dc_region", dcregion).commit();
}
- });*/
-
+ });
+
OnCheckedChangeListener limitfps_option = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
@@ -251,7 +277,7 @@ public class ConfigureFragment extends Fragment {
limit_fps.setChecked(false);
}
limit_fps.setOnCheckedChangeListener(limitfps_option);
-
+
OnCheckedChangeListener mipmaps_option = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
@@ -295,7 +321,7 @@ public class ConfigureFragment extends Fragment {
stretch_view.setChecked(false);
}
stretch_view.setOnCheckedChangeListener(full_screen);
-
+
mainFrames = (TextView) getView().findViewById(R.id.current_frames);
mainFrames.setText(String.valueOf(frameskip));
@@ -328,7 +354,7 @@ public class ConfigureFragment extends Fragment {
}
});
- /*OnCheckedChangeListener pvr_rendering = new OnCheckedChangeListener() {
+ OnCheckedChangeListener pvr_rendering = new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
@@ -347,7 +373,7 @@ public class ConfigureFragment extends Fragment {
} else {
pvr_render.setChecked(false);
}
- pvr_render.setOnCheckedChangeListener(pvr_rendering);*/
+ pvr_render.setOnCheckedChangeListener(pvr_rendering);
final EditText cheatEdit = (EditText) getView().findViewById(
R.id.cheat_disk);
@@ -372,7 +398,7 @@ public class ConfigureFragment extends Fragment {
int count) {
}
});
-
+
Button debug_button = (Button) getView()
.findViewById(R.id.debug_button);
debug_button.setOnClickListener(new View.OnClickListener() {
@@ -495,9 +521,9 @@ public class ConfigureFragment extends Fragment {
File config = new File(home_directory, "emu.cfg");
if (config.exists()) {
try {
-
+
// Read existing emu.cfg and substitute new setting value
-
+
StringBuilder rebuildFile = new StringBuilder();
Scanner scanner = new Scanner(config);
String currentLine;
@@ -533,23 +559,27 @@ public class ConfigureFragment extends Fragment {
if (config.exists()) {
config.delete();
}
-
+
// Write new emu.cfg using current display values
-
+
StringBuilder rebuildFile = new StringBuilder();
rebuildFile.append("[config]" + "\n");
- rebuildFile.append("Dynarec.Enabled=" + String.valueOf(dynarecopt ? 1 : 0) + "\n");
+ rebuildFile.append("Dynarec.Enabled="
+ + String.valueOf(dynarecopt ? 1 : 0) + "\n");
rebuildFile.append("Dynarec.idleskip=1" + "\n");
- rebuildFile.append("Dynarec.unstable-opt=" + String.valueOf(unstableopt ? 1 : 0) + "\n");
+ rebuildFile.append("Dynarec.unstable-opt="
+ + String.valueOf(unstableopt ? 1 : 0) + "\n");
rebuildFile.append("Dreamcast.Cable=3" + "\n");
rebuildFile.append("Dreamcast.RTC="
+ String.valueOf(System.currentTimeMillis()) + "\n");
rebuildFile.append("Dreamcast.Region=" + String.valueOf(dcregion)
+ "\n");
rebuildFile.append("Dreamcast.Broadcast=4" + "\n");
- rebuildFile.append("aica.LimitFPS=" + String.valueOf(limitfps ? 1 : 0) + "\n");
+ rebuildFile.append("aica.LimitFPS="
+ + String.valueOf(limitfps ? 1 : 0) + "\n");
rebuildFile.append("aica.NoBatch=0" + "\n");
- rebuildFile.append("rend.UseMipmaps=" + String.valueOf(mipmaps ? 1 : 0) + "\n");
+ rebuildFile.append("rend.UseMipmaps="
+ + String.valueOf(mipmaps ? 1 : 0) + "\n");
rebuildFile.append("rend.WideScreen="
+ String.valueOf(widescreen ? 1 : 0) + "\n");
rebuildFile.append("pvr.Subdivide=0" + "\n");
diff --git a/shell/android/src/com/reicast/emulator/EditVJoyActivity.java b/shell/android/src/com/reicast/emulator/EditVJoyActivity.java
index ab3ffc782..80065e034 100644
--- a/shell/android/src/com/reicast/emulator/EditVJoyActivity.java
+++ b/shell/android/src/com/reicast/emulator/EditVJoyActivity.java
@@ -1,16 +1,11 @@
package com.reicast.emulator;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
-import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
diff --git a/shell/android/src/com/reicast/emulator/FileBrowser.java b/shell/android/src/com/reicast/emulator/FileBrowser.java
index 4c464b4d4..b3899a29e 100644
--- a/shell/android/src/com/reicast/emulator/FileBrowser.java
+++ b/shell/android/src/com/reicast/emulator/FileBrowser.java
@@ -15,13 +15,8 @@ import java.util.Locale;
import org.apache.commons.lang3.StringUtils;
import android.app.Activity;
-import android.app.AlertDialog;
import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
import android.content.SharedPreferences;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.net.Uri;
@@ -120,7 +115,7 @@ public class FileBrowser extends Fragment {
if (!file.exists()) {
file.createNewFile();
OutputStream fo = new FileOutputStream(file);
- InputStream png = parentActivity.getBaseContext().getAssets()
+ InputStream png = parentActivity.getAssets()
.open("buttons.png");
byte[] buffer = new byte[4096];
diff --git a/shell/android/src/com/reicast/emulator/GL2JNIActivity.java b/shell/android/src/com/reicast/emulator/GL2JNIActivity.java
index 0f468673e..88c5e38e9 100644
--- a/shell/android/src/com/reicast/emulator/GL2JNIActivity.java
+++ b/shell/android/src/com/reicast/emulator/GL2JNIActivity.java
@@ -3,9 +3,6 @@ package com.reicast.emulator;
import java.util.Arrays;
import java.util.HashMap;
-// Keeping a reference just in case it's needed
-import com.reicast.emulator.GL2JNIView.EmuThread;
-
import tv.ouya.console.api.OuyaController;
import android.annotation.TargetApi;
import android.app.Activity;
@@ -16,7 +13,6 @@ import android.content.res.Configuration;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
-import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.Gravity;
@@ -40,8 +36,10 @@ public class GL2JNIActivity extends Activity {
LayoutParams params;
MOGAInput moga = new MOGAInput();
private SharedPreferences prefs;
- static boolean[] custom = { false, false, false, false }, xbox = { false,
- false, false, false }, nVidia = { false, false, false, false };
+ static String[] portId = { "_A", "_B", "_C", "_D" };
+ static boolean[] compat = { false, false, false, false }, custom = { false,
+ false, false, false }, jsCompat = { false, false, false, false };
+ static boolean[] xbox = { false, false, false, false }, nVidia = { false, false, false, false };
int[] name = { -1, -1, -1, -1 };
float[] globalLS_X = new float[4], globalLS_Y = new float[4],
previousLS_X = new float[4], previousLS_Y = new float[4];
@@ -217,18 +215,18 @@ public class GL2JNIActivity extends Activity {
.get(deviceId_deviceDescriptor.get(joys[i]));
if (playerNum != null) {
- String[] players = getResources().getStringArray(R.array.controllers);
- String id = "_" + players[playerNum].substring(
- players[playerNum].lastIndexOf(" ") + 1, players[playerNum].length());
- boolean compat = prefs.getBoolean("controller_compat" + id, false);
- if (!compat) {
- if (prefs.getBoolean("modified_key_layout" + id, false)) {
+ String id = portId[playerNum];
+ custom[playerNum] = prefs.getBoolean("modified_key_layout" + id, false);
+ compat[playerNum] = prefs.getBoolean("controller_compat" + id, false);
+ jsCompat[playerNum] = prefs.getBoolean("dpad_js_layout" + id, false);
+ if (!compat[playerNum]) {
+ if (custom[playerNum]) {
map[playerNum] = setModifiedKeys(playerNum);
- custom[playerNum] = true;
-
- globalLS_X[playerNum] = previousLS_X[playerNum] = 0.0f;
- globalLS_Y[playerNum] = previousLS_Y[playerNum] = 0.0f;
+ if (jsCompat[playerNum]) {
+ globalLS_X[playerNum] = previousLS_X[playerNum] = 0.0f;
+ globalLS_Y[playerNum] = previousLS_Y[playerNum] = 0.0f;
+ }
} else if (InputDevice.getDevice(joys[i]).getName()
.equals("Sony PLAYSTATION(R)3 Controller")) {
map[playerNum] = new int[] {
@@ -324,7 +322,6 @@ public class GL2JNIActivity extends Activity {
// Create the actual GLES view
mView = new GL2JNIView(getApplication(), fileName, false, 24, 0, false);
setContentView(mView);
- moga.setGL2View(mView);
Toast.makeText(getApplicationContext(),
"Press the back button for a menu", Toast.LENGTH_SHORT).show();
@@ -332,11 +329,8 @@ public class GL2JNIActivity extends Activity {
private void runCompatibilityMode() {
for (int n = 0; n < 4; n++) {
- String[] players = getResources().getStringArray(R.array.controllers);
- String id = "_" + players[n].substring(
- players[n].lastIndexOf(" ") + 1, players[n].length());
- if (prefs.getBoolean("controller_compat" + id, false)) {
- getCompatibilityMap(n, id);
+ if (compat[n]) {
+ getCompatibilityMap(n, portId[n]);
}
}
}
@@ -345,17 +339,15 @@ public class GL2JNIActivity extends Activity {
name[playerNum] = prefs.getInt("controller" + id, -1);
if (name[playerNum] != -1) {
map[playerNum] = setModifiedKeys(playerNum);
- custom[playerNum] = true;
}
-
- globalLS_X[playerNum] = previousLS_X[playerNum] = 0.0f;
- globalLS_Y[playerNum] = previousLS_Y[playerNum] = 0.0f;
+ if (jsCompat[playerNum]) {
+ globalLS_X[playerNum] = previousLS_X[playerNum] = 0.0f;
+ globalLS_Y[playerNum] = previousLS_Y[playerNum] = 0.0f;
+ }
}
private int[] setModifiedKeys(int player) {
- String[] players = getResources().getStringArray(R.array.controllers);
- String id = "_" + players[player].substring(
- players[player].lastIndexOf(" ") + 1, players[player].length());
+ String id = portId[player];
return new int[] {
prefs.getInt("a_button" + id, OuyaController.BUTTON_O), key_CONT_A,
prefs.getInt("b_button" + id, OuyaController.BUTTON_A), key_CONT_B,
@@ -378,13 +370,18 @@ public class GL2JNIActivity extends Activity {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
- Integer playerNum = deviceDescriptor_PlayerNum
+ Integer playerNum = Arrays.asList(name).indexOf(event.getDeviceId());
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD && playerNum == -1) {
+ playerNum = deviceDescriptor_PlayerNum
.get(deviceId_deviceDescriptor.get(event.getDeviceId()));
+ } else {
+ playerNum = -1;
+ }
- if (playerNum == null)
+ if (playerNum == null || playerNum == -1)
return false;
- if (!moga.isActive[playerNum] && !custom[playerNum]) {
+ if (!moga.isActive[playerNum] || compat[playerNum]) {
// TODO: Moga should handle this locally
// Joystick
@@ -398,7 +395,7 @@ public class GL2JNIActivity extends Activity {
float L2 = event.getAxisValue(OuyaController.AXIS_L2);
float R2 = event.getAxisValue(OuyaController.AXIS_R2);
- if (custom[playerNum] || xbox[playerNum] || nVidia[playerNum]) {
+ if (jsCompat[playerNum] || xbox[playerNum] || nVidia[playerNum]) {
previousLS_X[playerNum] = globalLS_X[playerNum];
previousLS_Y[playerNum] = globalLS_Y[playerNum];
globalLS_X[playerNum] = LS_X;
@@ -414,7 +411,7 @@ public class GL2JNIActivity extends Activity {
}
- if ((custom[playerNum] || xbox[playerNum] || nVidia[playerNum])
+ if ((jsCompat[playerNum] || xbox[playerNum] || nVidia[playerNum])
&& ((globalLS_X[playerNum] == previousLS_X[playerNum] && globalLS_Y[playerNum] == previousLS_Y[playerNum]) || (previousLS_X[playerNum] == 0.0f && previousLS_Y[playerNum] == 0.0f)))
// Only handle Left Stick on an Xbox 360 controller if there was
// some actual motion on the stick,
@@ -522,11 +519,8 @@ public class GL2JNIActivity extends Activity {
}
if (playerNum != null && playerNum != -1) {
- String[] players = getResources().getStringArray(R.array.controllers);
- String id = "_" + players[playerNum].substring(
- players[playerNum].lastIndexOf(" ") + 1, players[playerNum].length());
- boolean compat = prefs.getBoolean("controller_compat" + id, false);
- if (compat || custom[playerNum]) {
+ String id = portId[playerNum];
+ if (custom[playerNum]) {
if (keyCode == prefs.getInt("l_button" + id, OuyaController.BUTTON_L1)) {
GL2JNIView.lt[playerNum] = (int) (0.5 * 255);
GL2JNIView.lt[playerNum] = (int) (1.0 * 255);
diff --git a/shell/android/src/com/reicast/emulator/GL2JNIView.java b/shell/android/src/com/reicast/emulator/GL2JNIView.java
index ef7a8ea21..3bc5f35b0 100644
--- a/shell/android/src/com/reicast/emulator/GL2JNIView.java
+++ b/shell/android/src/com/reicast/emulator/GL2JNIView.java
@@ -8,13 +8,14 @@ import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.opengles.GL10;
import android.content.Context;
-import android.content.res.Configuration;
import android.content.SharedPreferences;
+import android.content.res.Configuration;
import android.graphics.PixelFormat;
import android.media.AudioFormat;
import android.media.AudioManager;
import android.media.AudioTrack;
import android.opengl.GLSurfaceView;
+import android.os.Build;
import android.os.Vibrator;
import android.preference.PreferenceManager;
import android.util.Log;
@@ -209,17 +210,18 @@ class GL2JNIView extends GLSurfaceView
this.editVjoyMode = editVjoyMode;
setKeepScreenOn(true);
- setOnSystemUiVisibilityChangeListener (new OnSystemUiVisibilityChangeListener() {
- @Override
- public void onSystemUiVisibilityChange(int visibility) {
- if ((visibility & SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
- GL2JNIView.this.setSystemUiVisibility(
- SYSTEM_UI_FLAG_IMMERSIVE_STICKY
- | SYSTEM_UI_FLAG_FULLSCREEN
- | SYSTEM_UI_FLAG_HIDE_NAVIGATION);
- }
- }
- });
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ setOnSystemUiVisibilityChangeListener (new OnSystemUiVisibilityChangeListener() {
+ public void onSystemUiVisibilityChange(int visibility) {
+ if ((visibility & SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
+ GL2JNIView.this.setSystemUiVisibility(
+ SYSTEM_UI_FLAG_IMMERSIVE_STICKY
+ | SYSTEM_UI_FLAG_FULLSCREEN
+ | SYSTEM_UI_FLAG_HIDE_NAVIGATION);
+ }
+ }
+ });
+ }
vib=(Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
diff --git a/shell/android/src/com/reicast/emulator/GitAdapter.java b/shell/android/src/com/reicast/emulator/GitAdapter.java
new file mode 100644
index 000000000..5c76d2a09
--- /dev/null
+++ b/shell/android/src/com/reicast/emulator/GitAdapter.java
@@ -0,0 +1,227 @@
+/* ====================================================================
+ * Copyright (c) 2012-2013 Lounge Katt Entertainment. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by Lounge Katt" unless
+ * otherwise displayed by public repository entries.
+ *
+ * 4. The names "Lounge Katt", "TwistedUmbrella", and "LiveLog"
+ * must not be used to endorse or promote products derived from this
+ * software without prior written permission. For written permission,
+ * please contact admin@loungekatt.com.
+ *
+ * 5. Products derived from this software may not be called "LiveLog"
+ * nor may "LiveLog" appear in their names without prior written
+ * permission of Lounge Katt Entertainment.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by Lounge Katt" unless
+ * otherwise displayed by tagged repository entries.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Lounge Katt ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * The license and distribution terms for any publicly available version or
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
+ * copied and put under another distribution license
+ * [including the GNU Public License.] Content not subject to these terms is
+ * subject to to the terms and conditions of the Apache License, Version 2.0.
+ */
+
+package com.reicast.emulator;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.graphics.PorterDuff;
+import android.os.Build;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.webkit.CookieManager;
+import android.webkit.CookieSyncManager;
+import android.webkit.WebSettings;
+import android.webkit.WebSettings.PluginState;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+import android.webkit.WebViewDatabase;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.nostra13.universalimageloader.core.DisplayImageOptions;
+import com.nostra13.universalimageloader.core.ImageLoader;
+import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
+import com.nostra13.universalimageloader.core.assist.ImageScaleType;
+
+public class GitAdapter extends BaseAdapter {
+
+ private Activity activity;
+ private ArrayList> data;
+ private LayoutInflater inflater = null;
+ private DisplayImageOptions options;
+
+ public GitAdapter(Activity a, ArrayList> d) {
+ this.activity = a;
+ this.data = d;
+ this.inflater = (LayoutInflater) activity
+ .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ ImageLoaderConfiguration configicon = new ImageLoaderConfiguration.Builder(activity)
+ .memoryCacheExtraOptions(96, 96)
+ .build();
+ this.options = new DisplayImageOptions.Builder()
+ .showStubImage(R.drawable.ic_github)
+ .showImageForEmptyUri(R.drawable.ic_github)
+ .imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
+ .build();
+
+ ImageLoader.getInstance().init(configicon);
+
+ }
+
+ public int getCount() {
+ return this.data.size();
+ }
+
+ public Object getItem(int position) {
+ return position;
+ }
+
+ public long getItemId(int position) {
+ return position;
+ }
+
+ public View getView(final int position, View convertView, ViewGroup parent) {
+ View vi = convertView;
+ if (convertView == null)
+ vi = this.inflater.inflate(R.layout.change_item, null);
+ TextView dateText = (TextView) vi.findViewById(R.id.date);
+ TextView committerText = (TextView) vi.findViewById(R.id.committer);
+ TextView titleText = (TextView) vi.findViewById(R.id.title);
+ ImageView avatarIcon = (ImageView) vi.findViewById(R.id.avatar);
+
+ final HashMap commit = this.data.get(position);
+ final String date = commit.get("Date");
+ final String committer = commit.get("Committer");
+ final String title = commit.get("Title");
+ final String message = commit.get("Message");
+ final String sha = commit.get("Sha");
+ final String url = commit.get("Url");
+ final String author = commit.get("Author");
+ final String avatar = commit.get("Avatar");
+ final String current = commit.get("Build");
+
+ RelativeLayout item = (RelativeLayout) vi.findViewById(R.id.change);
+ if (current != null && !current.equals("") && current.equals(sha)) {
+ item.getBackground().setColorFilter(0xFF00FF00,
+ PorterDuff.Mode.MULTIPLY);
+ } else {
+ item.getBackground().setColorFilter(null);
+ }
+
+ dateText.setText(date);
+ committerText.setText(committer);
+ titleText.setText(title);
+ ImageLoader.getInstance().displayImage(avatar, avatarIcon, this.options);
+
+ vi.setOnClickListener(new OnClickListener() {
+ public void onClick(View v) {
+ System.gc();
+ String output = message + "\n\n" + " - " + author;
+ displayCommit(sha, output, url, v.getContext());
+ }
+ });
+ // Handle clicking individual item from list
+
+ return vi;
+ }
+ public static void displayCommit(String title, String message, String url,
+ Context context) {
+ final AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ builder.setCancelable(true);
+ builder.setTitle(title);
+ builder.setMessage(message);
+ LayoutInflater infalter = LayoutInflater.from(context);
+ final View popWebView = infalter.inflate(R.layout.webview, null);
+ WebView mWebView = (WebView) popWebView.findViewById(R.id.webframe);
+ mWebView = configureWebview(url, context, mWebView);
+ builder.setView(popWebView);
+ builder.setPositiveButton("Close",
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ return;
+ }
+ });
+ builder.create().show();
+ }
+
+ public static WebView configureWebview(String url, Context context,
+ WebView mWebView) {
+ mWebView.getSettings().setSupportZoom(true);
+ mWebView.getSettings().setBuiltInZoomControls(true);
+ if (Integer.parseInt(Build.VERSION.SDK) >= Build.VERSION_CODES.HONEYCOMB) {
+ mWebView.getSettings().setDisplayZoomControls(false);
+ }
+ mWebView.setInitialScale(1);
+ if (Integer.parseInt(Build.VERSION.SDK) >= Build.VERSION_CODES.ECLAIR) {
+ mWebView.getSettings().setUseWideViewPort(true);
+ }
+ if (Integer.parseInt(Build.VERSION.SDK) >= Build.VERSION_CODES.ECLAIR_MR1) {
+ mWebView.getSettings().setLoadWithOverviewMode(true);
+ }
+ mWebView.getSettings().setJavaScriptEnabled(true);
+ mWebView.getSettings().setPluginState(PluginState.ON);
+ mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
+ mWebView.clearHistory();
+ mWebView.clearFormData();
+ mWebView.clearCache(true);
+ WebViewDatabase mDatabase = WebViewDatabase.getInstance(context);
+ mDatabase.clearUsernamePassword();
+ CookieSyncManager.createInstance(context);
+ CookieManager cookieManager = CookieManager.getInstance();
+ cookieManager.removeAllCookie();
+ CookieSyncManager.getInstance().stopSync();
+ mWebView.getSettings().setSavePassword(false);
+ mWebView.setWebViewClient(new WebViewClient() {
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url) {
+ view.loadUrl(url);
+ return true;
+ }
+ });
+ mWebView.loadUrl(url);
+ return mWebView;
+ }
+}
\ No newline at end of file
diff --git a/shell/android/src/com/reicast/emulator/InputFragment.java b/shell/android/src/com/reicast/emulator/InputFragment.java
index d01da1356..77c567bc2 100644
--- a/shell/android/src/com/reicast/emulator/InputFragment.java
+++ b/shell/android/src/com/reicast/emulator/InputFragment.java
@@ -1,20 +1,11 @@
package com.reicast.emulator;
-import com.bda.controller.Controller;
-import com.bda.controller.ControllerListener;
-import com.bda.controller.MotionEvent;
-import com.bda.controller.StateEvent;
-import com.reicast.emulator.MOGAInput.ExampleControllerListener;
-
-import de.ankri.views.Switch;
-import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
@@ -28,11 +19,18 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CompoundButton;
+import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView;
import android.widget.TableLayout;
import android.widget.TextView;
import android.widget.Toast;
-import android.widget.CompoundButton.OnCheckedChangeListener;
+
+import com.bda.controller.Controller;
+import com.bda.controller.ControllerListener;
+import com.bda.controller.MotionEvent;
+import com.bda.controller.StateEvent;
+
+import de.ankri.views.Switch;
public class InputFragment extends Fragment {
@@ -305,13 +303,27 @@ public class InputFragment extends Fragment {
builder.setTitle(getString(R.string.select_controller_title));
builder.setMessage(getString(R.string.select_controller_message,
String.valueOf(listenForButton)));
- builder.setNegativeButton("Cancel",
+ builder.setPositiveButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
listenForButton = 0;
dialog.dismiss();
}
});
+ builder.setNegativeButton("Custom",
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ InputModFragment inputModFrag = new InputModFragment();
+ Bundle args = new Bundle();
+ args.putInt("portNumber", listenForButton - 1);
+ inputModFrag.setArguments(args);
+ getActivity().getSupportFragmentManager()
+ .beginTransaction()
+ .replace(R.id.fragment_container, inputModFrag,
+ "INPUT_MOD_FRAG").addToBackStack(null).commit();
+ dialog.dismiss();
+ }
+ });
builder.setOnKeyListener(new Dialog.OnKeyListener() {
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
return mapDevice(keyCode, event);
diff --git a/shell/android/src/com/reicast/emulator/InputModFragment.java b/shell/android/src/com/reicast/emulator/InputModFragment.java
index 8f02a4727..8b5f426f2 100644
--- a/shell/android/src/com/reicast/emulator/InputModFragment.java
+++ b/shell/android/src/com/reicast/emulator/InputModFragment.java
@@ -3,7 +3,6 @@ package com.reicast.emulator;
import java.io.IOException;
import java.io.InputStream;
-import de.ankri.views.Switch;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -14,7 +13,6 @@ import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
-import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
@@ -23,14 +21,15 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CompoundButton;
+import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
-import android.widget.AdapterView.OnItemSelectedListener;
-import android.widget.CompoundButton.OnCheckedChangeListener;
+import de.ankri.views.Switch;
public class InputModFragment extends Fragment {
@@ -40,6 +39,7 @@ public class InputModFragment extends Fragment {
private Switch switchCompatibilityEnabled;
private String player = "_A";
private int sS = 2;
+ private int playerNum = -1;
// Container Activity must implement this interface
public interface OnClickListener {
@@ -62,8 +62,13 @@ public class InputModFragment extends Fragment {
mPrefs = PreferenceManager.getDefaultSharedPreferences(parentActivity);
- String[] controllers = parentActivity.getResources().getStringArray(
+ final String[] controllers = parentActivity.getResources().getStringArray(
R.array.controllers);
+
+ Bundle b = getArguments();
+ if (b != null) {
+ playerNum = b.getInt("portNumber", -1);
+ }
Spinner player_spnr = (Spinner) getView().findViewById(
R.id.player_spinner);
@@ -73,7 +78,9 @@ public class InputModFragment extends Fragment {
playerAdapter
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
player_spnr.setAdapter(playerAdapter);
-
+ if (playerNum != -1) {
+ player_spnr.setSelection(playerNum, true);
+ }
player_spnr.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView> parent, View view,
@@ -85,7 +92,9 @@ public class InputModFragment extends Fragment {
}
public void onNothingSelected(AdapterView> arg0) {
- player = "_A";
+ if (playerNum != -1) {
+ player = controllers[playerNum];
+ }
}
});
@@ -133,6 +142,7 @@ public class InputModFragment extends Fragment {
a_button_icon.setImageDrawable(getButtonImage(448 / sS, 0));
final TextView a_button_text = (TextView) getView().findViewById(
R.id.a_button_key);
+ getKeyCode("a_button", a_button_text);
Button a_button = (Button) getView().findViewById(R.id.a_button_edit);
a_button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
@@ -260,6 +270,25 @@ public class InputModFragment extends Fragment {
joystick.setEnabled(false);
mPrefs.edit().remove("joystick").commit();
// Still needs better support for identifying the entire stick
+
+ OnCheckedChangeListener dpad_joystick = new OnCheckedChangeListener() {
+ public void onCheckedChanged(CompoundButton buttonView,
+ boolean isChecked) {
+ mPrefs.edit()
+ .putBoolean("dpad_js_layout" + player, isChecked)
+ .commit();
+ }
+ };
+ Switch dpad_js_layout = (Switch) getView().findViewById(
+ R.id.dpad_js_layout);
+ boolean joypad = mPrefs.getBoolean("dpad_js_layout" + player,
+ false);
+ if (joypad) {
+ dpad_js_layout.setChecked(true);
+ } else {
+ dpad_js_layout.setChecked(false);
+ }
+ dpad_js_layout.setOnCheckedChangeListener(dpad_joystick);
final TextView dpad_up_text = (TextView) getView().findViewById(
R.id.dpad_up_key);
diff --git a/shell/android/src/com/reicast/emulator/MOGAInput.java b/shell/android/src/com/reicast/emulator/MOGAInput.java
index cdab91df5..49f7c3f2f 100644
--- a/shell/android/src/com/reicast/emulator/MOGAInput.java
+++ b/shell/android/src/com/reicast/emulator/MOGAInput.java
@@ -7,7 +7,6 @@ import tv.ouya.console.api.OuyaController;
import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Handler;
-import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.widget.Toast;
@@ -36,7 +35,13 @@ public class MOGAInput
Controller mController = null;
private Handler handler;
private String notify;
- private GL2JNIView mView;
+
+ static String[] portId = { "_A", "_B", "_C", "_D" };
+ static boolean[] custom = { false, false, false, false },
+ jsCompat = { false, false, false, false };
+
+ float[] globalLS_X = new float[4], globalLS_Y = new float[4],
+ previousLS_X = new float[4], previousLS_Y = new float[4];
public boolean isActive[] = { false, false, false, false };
public boolean isMogaPro[] = { false, false, false, false };
@@ -101,16 +106,14 @@ public class MOGAInput
mMotions.put(MotionEvent.AXIS_RTRIGGER, new ExampleFloat("AXIS_RTRIGGER........."));
*/
}
-
- public void setGL2View(GL2JNIView mView) {
- this.mView = mView;
- }
protected void onCreate(Activity act)
{
this.act = act;
handler = new Handler();
+ prefs = PreferenceManager
+ .getDefaultSharedPreferences(act.getApplicationContext());
mController = Controller.getInstance(act);
mController.init();
@@ -156,12 +159,8 @@ public class MOGAInput
}
private void setModifiedKeys(int player) {
- prefs = PreferenceManager
- .getDefaultSharedPreferences(act.getApplicationContext());
- String[] players = act.getResources().getStringArray(R.array.controllers);
- String id = players[player].substring(
- players[player].lastIndexOf(" "), players[player].length());
- if (prefs.getBoolean("modified_key_layout" + id, false)) {
+ String id = portId[player];
+ if (custom[player]) {
map[player] = new int[] {
prefs.getInt("a_button" + id, KeyEvent.KEYCODE_BUTTON_A), key_CONT_A,
prefs.getInt("b_button" + id, KeyEvent.KEYCODE_BUTTON_B), key_CONT_B,
@@ -176,6 +175,10 @@ public class MOGAInput
prefs.getInt("start_button" + id, KeyEvent.KEYCODE_BUTTON_START), key_CONT_START,
};
}
+ if (jsCompat[player]) {
+ globalLS_X[player] = previousLS_X[player] = 0.0f;
+ globalLS_Y[player] = previousLS_Y[player] = 0.0f;
+ }
}
class ExampleControllerListener implements ControllerListener
@@ -187,35 +190,20 @@ public class MOGAInput
if (playerNum == null)
return;
- String[] players = act.getResources().getStringArray(R.array.controllers);
- String id = "_" + players[playerNum].substring(
- players[playerNum].lastIndexOf(" ") + 1, players[playerNum].length());
- if (prefs.getBoolean("modified_key_layout" + id, false)) {
- float x = -1, y = -1;
- if (event.getKeyCode() == prefs.getInt("l_button" + id, OuyaController.BUTTON_L1)) {
- float LxC = prefs.getFloat("touch_x_shift_left_trigger", 0);
- float LyC = prefs.getFloat("touch_y_shift_left_trigger", 0);
- x = 440 + LxC + 1;
- y = 200 + LyC + 1;
- }
- if (event.getKeyCode() == prefs.getInt("r_button" + id, OuyaController.BUTTON_R1)) {
- float RxC = prefs.getFloat("touch_x_shift_right_trigger", 0);
- float RyC = prefs.getFloat("touch_y_shift_right_trigger", 0);
- x = 542 + RxC + 1;
- y = 200 + RyC + 1;
- }
- if (mView != null && (x != -1 || y != -1)) {
- JNIdc.show_osd();
- long downTime = SystemClock.uptimeMillis();
- long eventTime = SystemClock.uptimeMillis() + 100;
- int metaState = 0;
- android.view.MotionEvent motionEvent = android.view.MotionEvent.obtain(downTime, eventTime,
- android.view.MotionEvent.ACTION_UP, x, y, metaState);
- mView.dispatchTouchEvent(motionEvent);
- if (playerNum == 0)
- JNIdc.hide_osd();
- return;
- }
+ String id = portId[playerNum];
+ if (custom[playerNum]) {
+ if (event.getKeyCode() == prefs.getInt("l_button" + id, OuyaController.BUTTON_L1)) {
+ GL2JNIView.lt[playerNum] = (int) (0.5 * 255);
+ GL2JNIView.lt[playerNum] = (int) (1.0 * 255);
+ GL2JNIView.lt[playerNum] = (int) (0.5 * 255);
+ GL2JNIView.lt[playerNum] = 0;
+ }
+ if (event.getKeyCode() == prefs.getInt("r_button" + id, OuyaController.BUTTON_R1)) {
+ GL2JNIView.lt[playerNum] = (int) (0.5 * 255);
+ GL2JNIView.lt[playerNum] = (int) (1.0 * 255);
+ GL2JNIView.lt[playerNum] = (int) (0.5 * 255);
+ GL2JNIView.lt[playerNum] = 0;
+ }
}
if(playerNum == 0)
@@ -246,6 +234,15 @@ public class MOGAInput
float LS_Y = event.getAxisValue(MotionEvent.AXIS_Y);
float L2 = event.getAxisValue(MotionEvent.AXIS_LTRIGGER);
float R2 = event.getAxisValue(MotionEvent.AXIS_RTRIGGER);
+
+ if (jsCompat[playerNum]) {
+
+ previousLS_X[playerNum] = globalLS_X[playerNum];
+ previousLS_Y[playerNum] = globalLS_Y[playerNum];
+ globalLS_X[playerNum] = LS_X;
+ globalLS_Y[playerNum] = LS_Y;
+
+ }
GL2JNIView.lt[playerNum] = (int) (L2 * 255);
GL2JNIView.rt[playerNum] = (int) (R2 * 255);
@@ -271,6 +268,10 @@ public class MOGAInput
if(playerNum == 0)
JNIdc.hide_osd();
+
+ String id = portId[playerNum];
+ custom[playerNum] = prefs.getBoolean("modified_key_layout" + id, false);
+ jsCompat[playerNum] = prefs.getBoolean("dpad_js_layout" + id, false);
if (event.getState() == StateEvent.STATE_CONNECTION && event.getAction() == ACTION_CONNECTED) {
int mControllerVersion = mController.getState(Controller.STATE_CURRENT_PRODUCT_VERSION);
diff --git a/shell/android/src/com/reicast/emulator/MainActivity.java b/shell/android/src/com/reicast/emulator/MainActivity.java
index 074c9aeda..9c697d97e 100644
--- a/shell/android/src/com/reicast/emulator/MainActivity.java
+++ b/shell/android/src/com/reicast/emulator/MainActivity.java
@@ -8,8 +8,6 @@ import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.net.Uri;
@@ -232,46 +230,64 @@ public class MainActivity extends FragmentActivity implements
}
});
-
- findViewById(R.id.about).setOnTouchListener(new OnTouchListener() {
- public boolean onTouch(View v, MotionEvent event) {
- if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
- // vib.vibrate(50);
- AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
- MainActivity.this);
-
- // set title
- alertDialogBuilder.setTitle(getString(R.string.about_title));
-
- String versionName = "";
- try {
- PackageInfo pInfo = getPackageManager()
- .getPackageInfo(getPackageName(), 0);
- versionName = pInfo.versionName;
- } catch (NameNotFoundException e) {
- e.printStackTrace();
+
+ findViewById(R.id.about).setOnClickListener(new OnClickListener() {
+ public void onClick(View view) {
+ AboutFragment aboutFrag = (AboutFragment) getSupportFragmentManager()
+ .findFragmentByTag("ABOUT_FRAG");
+ if (aboutFrag != null) {
+ if (aboutFrag.isVisible()) {
+ return;
}
-
- alertDialogBuilder
- .setMessage(getString(R.string.about_text, versionName))
- .setCancelable(false)
- .setPositiveButton("Dismiss",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- dialog.dismiss();
- }
- });
-
- // create alert dialog
- AlertDialog alertDialog = alertDialogBuilder.create();
-
- // show it
- alertDialog.show();
- return true;
- } else
- return false;
+ }
+ aboutFrag = new AboutFragment();
+ getSupportFragmentManager()
+ .beginTransaction()
+ .replace(R.id.fragment_container, aboutFrag,
+ "ABOUT_FRAG").addToBackStack(null).commit();
}
+
});
+
+// findViewById(R.id.about).setOnTouchListener(new OnTouchListener() {
+// public boolean onTouch(View v, MotionEvent event) {
+// if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
+// // vib.vibrate(50);
+// AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
+// MainActivity.this);
+//
+// // set title
+// alertDialogBuilder.setTitle(getString(R.string.about_title));
+//
+// String versionName = "";
+// try {
+// PackageInfo pInfo = getPackageManager()
+// .getPackageInfo(getPackageName(), 0);
+// versionName = pInfo.versionName;
+// } catch (NameNotFoundException e) {
+// e.printStackTrace();
+// }
+//
+// alertDialogBuilder
+// .setMessage(getString(R.string.about_text, versionName))
+// .setCancelable(false)
+// .setPositiveButton("Dismiss",
+// new DialogInterface.OnClickListener() {
+// public void onClick(DialogInterface dialog, int id) {
+// dialog.dismiss();
+// }
+// });
+//
+// // create alert dialog
+// AlertDialog alertDialog = alertDialogBuilder.create();
+//
+// // show it
+// alertDialog.show();
+// return true;
+// } else
+// return false;
+// }
+// });
findViewById(R.id.rate).setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
@@ -483,41 +499,52 @@ public class MainActivity extends FragmentActivity implements
frag_tag = "INPUT_FRAG";
break;
case 4:
- fragment = null;
- // vib.vibrate(50);
- AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
- MainActivity.this);
-
- // set title
- alertDialogBuilder.setTitle(getString(R.string.about_title));
-
- String versionName = "";
- try {
- PackageInfo pInfo = getPackageManager().getPackageInfo(
- getPackageName(), 0);
- versionName = pInfo.versionName;
- } catch (NameNotFoundException e) {
- e.printStackTrace();
+ fragment = (AboutFragment) getSupportFragmentManager()
+ .findFragmentByTag("ABOUT_FRAG");
+ if (fragment != null) {
+ if (fragment.isVisible()) {
+ return;
+ }
}
-
- alertDialogBuilder
- .setMessage(getString(R.string.about_text, versionName))
- .setCancelable(false)
- .setPositiveButton("Dismiss",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog,
- int id) {
- dialog.dismiss();
- }
- });
-
- // create alert dialog
- AlertDialog alertDialog = alertDialogBuilder.create();
-
- // show it
- alertDialog.show();
+ fragment = new AboutFragment();
+ frag_tag = "ABOUT_FRAG";
break;
+// fragment = null;
+// // vib.vibrate(50);
+// AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
+// MainActivity.this);
+//
+// // set title
+// alertDialogBuilder.setTitle(getString(R.string.about_title));
+//
+// String versionName = "";
+// try {
+// PackageInfo pInfo = getPackageManager().getPackageInfo(
+// getPackageName(), 0);
+// versionName = pInfo.versionName;
+// } catch (NameNotFoundException e) {
+// e.printStackTrace();
+// }
+//
+// alertDialogBuilder
+// .setMessage(getString(R.string.about_text, versionName))
+// .setCancelable(false)
+// .setPositiveButton("Dismiss",
+// new DialogInterface.OnClickListener() {
+// public void onClick(DialogInterface dialog,
+// int id) {
+// dialog.dismiss();
+// }
+// });
+//
+// // create alert dialog
+// AlertDialog alertDialog = alertDialogBuilder.create();
+//
+// // show it
+// alertDialog.show();
+// break;
+
case 5:
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("market://details?id=" + getPackageName())));
diff --git a/shell/android/src/com/reicast/emulator/NavDrawerListAdapter.java b/shell/android/src/com/reicast/emulator/NavDrawerListAdapter.java
index fde20241d..eb7ba2419 100644
--- a/shell/android/src/com/reicast/emulator/NavDrawerListAdapter.java
+++ b/shell/android/src/com/reicast/emulator/NavDrawerListAdapter.java
@@ -1,7 +1,7 @@
package com.reicast.emulator;
import java.util.ArrayList;
-
+
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
diff --git a/shell/android/src/de/ankri/views/Switch.java b/shell/android/src/de/ankri/views/Switch.java
index 6bc2bd8a3..c6cc50982 100644
--- a/shell/android/src/de/ankri/views/Switch.java
+++ b/shell/android/src/de/ankri/views/Switch.java
@@ -1,8 +1,5 @@
package de.ankri.views;
-import com.reicast.emulator.R;
-import de.ankri.text.method.AllCapsTransformationMethod;
-import de.ankri.text.method.TransformationMethodCompat2;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -26,6 +23,11 @@ import android.view.View;
import android.view.ViewConfiguration;
import android.widget.CompoundButton;
+import com.reicast.emulator.R;
+
+import de.ankri.text.method.AllCapsTransformationMethod;
+import de.ankri.text.method.TransformationMethodCompat2;
+
/**
* A Switch is a two-state toggle switch widget that can select between two options. The user may drag the "thumb" back and forth to choose the selected option, or simply tap to toggle as if it were a
* checkbox. The {@link #setText(CharSequence) text} property controls the text displayed in the label for the switch, whereas the {@link #setTextOff(CharSequence) off} and
diff --git a/shell/android/src/de/ankri/views/TwoStatePreference.java b/shell/android/src/de/ankri/views/TwoStatePreference.java
index a295b227d..a6ad2f24f 100644
--- a/shell/android/src/de/ankri/views/TwoStatePreference.java
+++ b/shell/android/src/de/ankri/views/TwoStatePreference.java
@@ -34,9 +34,9 @@ import android.os.Parcelable;
import android.preference.Preference;
import android.util.AttributeSet;
import android.view.View;
+import android.widget.TextView;
//import android.view.accessibility.AccessibilityEvent;
//import android.view.accessibility.AccessibilityManager;
-import android.widget.TextView;
/**
* Common base class for preferences that have two selectable states, persist a
diff --git a/shell/android/strings.txt b/shell/android/strings.txt
deleted file mode 100644
index 372591d88..000000000
--- a/shell/android/strings.txt
+++ /dev/null
@@ -1,62 +0,0 @@
-Settings
-reicast
-System Path (location of the data folder with dc_boot.bin/dc_flash.bin inside)
-Default System Path
-Storage Path (location of .gdi, .chd or .cdi images)
-Default Game Storage
-Boot Dreamcast Bios
-BIOS Missing. The Dreamcast BIOS is required for this emulator to work. Place the BIOS file in ####/data/dc_boot.bin
-Flash Missing. The Dreamcast Flash is required for this emulator to work. Place the Flash file in ####/data/dc_flash.bin
-You have to provide the BIOS
-BOOT BIOS
-SELECT CURRENT FOLDER
-Dynarec Options
-Unstable Optimisations
-DC Region
-Limit FPS
-Use Mipmaps (fix for old SGX540)
-Widescreen Mode
-Frameskip Value
-PVR Rendering (does nothing for now)
-Set Default Disk
-Available Dreamcast Games
-Customize Touch Controls
-Launch Editor
-Touch Vibration
-Controller A
-Controller B
-Controller C
-Controller D
-Controller Not Connected
-No Controller Selected
-Select
-Remove
-Select Controller
-Press any button on the controller #### to assign to port
-This controller is already in use!
-Enable Custom Key Layout
-Enable Compatibility Mode
-Customize Physical Controls
-Modify Controller
-Press the new controller button for ####
-MOGA Pro Connected!
-MOGA Connected!
-About reicast
-reicast is a dreamcast emulator\\n\\nVersion: ####
-Controller A
-Controller B
-Controller C
-Controller D
-(Default)
-Slider Menu Opened
-Slider Menu Closed
-Browser
-Settings
-Paths
-Input
-About
-Rate Me
-Item Icon
-ON
-OFF
-Save Error Logs