launch android game emulators via intent and file name

raw

launch.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
//taken from nostalgia android emulator launcher
 
    public Intent getEmulatorIntent(String fileName, String ime, Context context) {
        Intent intent = new Intent();
        if ("gbcoid".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.androidemu.gbc", "com.androidemu.gbc.EmulatorActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("gameboid".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.androidemu.gba", "com.androidemu.gba.EmulatorActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("n64oid".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.androidemu.n64", "com.androidemu.n64.EmulatorActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("mupen64 plus ae".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("paulscode.android.mupen64plusae", "paulscode.android.mupen64plusae.MainActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("snesoid".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.androidemu.snes", "com.androidemu.snes.EmulatorActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("nesoid".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.androidemu.nes", "com.androidemu.nes.EmulatorActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("gensoid".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.androidemu.gens", "com.androidemu.gens.EmulatorActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("gearoid".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.androidemu.gg", "com.androidemu.gg.EmulatorActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("epsxe".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.epsxe.ePSXe", "com.epsxe.ePSXe.ePSXe"));
            intent.setAction("android.intent.action.MAIN");
            intent.putExtra("com.epsxe.ePSXe.isoName", fileName);
            intent.putExtra("com.epsxe.ePSXe.isoSlot", "0");
            intent.putExtra("com.epsxe.ePSXe.gui", "0");
        } else if ("fpse".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.emulator.fpse", "com.emulator.fpse.Main"));
            intent.setAction("android.intent.action.MAIN");
            intent.putExtra(ClientCookie.PATH_ATTR, fileName);
            intent.putExtra("glblit", false);
            intent.putExtra("aspect", 1);
            intent.putExtra("video", 2);
            intent.putExtra("bios", 1);
        } else if ("nes.emu".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.explusalpha.NesEmu", "com.imagine.BaseActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("msx.emu".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.explusalpha.MsxEmu", "com.imagine.BaseActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("gbc.emu".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.explusalpha.GbcEmu", "com.imagine.BaseActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("ngp.emu".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.explusalpha.NgpEmu", "com.imagine.BaseActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("c64.emu".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.explusalpha.C64Emu", "com.imagine.BaseActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("2600.emu".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.explusalpha.A2600Emu", "com.imagine.BaseActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("pce.emu".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.PceEmu", "com.imagine.BaseActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("neo.emu".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.explusalpha.NeoEmu", "com.imagine.BaseActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("gba.emu".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.explusalpha.GbaEmu", "com.imagine.BaseActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("md.emu".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.explusalpha.MdEmu", "com.imagine.BaseActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("msx.emu".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.explusalpha.MsxEmu", "com.imagine.BaseActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("snes9x ex+".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.explusalpha.Snes9xPlus", "com.imagine.BaseActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("drastic".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.dsemu.drastic", "com.dsemu.drastic.DraSticActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.putExtra("GAMEPATH", new File(fileName).getPath());
        } else if ("reicast".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.reicast.emulator", "com.reicast.emulator.MainActivity"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("ppsspp".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("org.ppsspp.ppsspp", "org.ppsspp.ppsspp.PpssppActivity"));
            intent.setAction("android.intent.action.MAIN");
            intent.putExtra("org.ppsspp.ppsspp.Shortcuts", fileName);
        } else if ("ppsspp gold".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("org.ppsspp.ppssppgold", "org.ppsspp.ppssppgold.PpssppActivity"));
            intent.setAction("android.intent.action.MAIN");
            intent.putExtra("org.ppsspp.ppssppgold.Shortcuts", fileName);
        } else if ("supergnes lite".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.bubblezapgames.supergnes_lite", "com.bubblezapgames.supergnes_lite.SuperGNES"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if ("supergnes".equals(this.selectedEmulator)) {
            intent.setComponent(new ComponentName("com.bubblezapgames.supergnes", "com.bubblezapgames.supergnes.Splash"));
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.fromFile(new File(fileName)));
        } else if (this.selectedEmulator.contains("retroarch")) {
            intent.setComponent(new ComponentName("com.retroarch", "com.retroarch.browser.retroactivity.RetroActivityFuture"));
            intent.putExtra("ROM", fileName);
            intent.putExtra("CONFIGFILE", getRetroarchProperties(context));
            intent.putExtra("IME", ime);
            System.out.println(this.systemName);
            System.out.println(this.selectedEmulator);
            System.out.println(fileName);
            if ("PLAYSTATION".equals(this.systemName) && "retroarch - pcsx rearmed".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/pcsx_rearmed_libretro_neon_android.so");
            } else if ("PLAYSTATION".equals(this.systemName) && "retroarch - mednafen: psx".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/mednafen_psx_libretro_android.so");
            } else if (("GBA".equals(this.systemName) || "GBC".equals(this.systemName) || "GAMEBOY".equals(this.systemName)) && "retroarch - vba next".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/vba_next_libretro_android.so");
            } else if (("GBA".equals(this.systemName) || "GBC".equals(this.systemName) || "GAMEBOY".equals(this.systemName)) && "retroarch - vba-m".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/vbam_libretro_android.so");
            } else if (("NGPC".equals(this.systemName) || "NGP".equals(this.systemName)) && "retroarch - mednafen: neopop".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/mednafen_ngp_libretro_android.so");
            } else if (("GBC".equals(this.systemName) || "GAMEBOY".equals(this.systemName)) && "retroarch - gambatte".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/gambatte_libretro_android.so");
            } else if ("VB".equals(this.systemName) && "retroarch - mednafen: vb".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/mednafen_vb_libretro_android.so");
            } else if ("SNES".equals(this.systemName) && "retroarch - bsnes".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/bsnes_performance_libretro_android.so");
            } else if ("NES".equals(this.systemName) && "retroarch - fceumm".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/fceumm_libretro_android.so");
            } else if ("NES".equals(this.systemName) && "retroarch - quicknes".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/quicknes_libretro_android.so");
            } else if ("MASTERSYSTEM".equals(this.systemName) || (("GG".equals(this.systemName) || "GENESIS".equals(this.systemName) || "SEGACD".equals(this.systemName)) && "retroarch - genesis plus gx".equals(this.selectedEmulator))) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/genesis_plus_gx_libretro_android.so");
            } else if (("MASTERSYSTEM".equals(this.systemName) || "32X".equals(this.systemName) || "GENESIS".equals(this.systemName) || "SEGACD".equals(this.systemName)) && "retroarch - picodrive".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/picodrive_libretro_android.so");
            } else if ("NES".equals(this.systemName) && "retroarch - nestopia".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/nestopia_libretro_android.so");
            } else if ("SNES".equals(this.systemName) && "retroarch - snesx9x".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/snes9x_libretro_android.so");
            } else if ("SNES".equals(this.systemName) && "retroarch - snesx9x next".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/snes9x_next_libretro_android.so");
            } else if ("TG16".equals(this.systemName) && "retroarch - mednafen: pce".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/mednafen_pce_fast_libretro_android.so");
            } else if ("2600".equals(this.systemName) && "retroarch - stella".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/stella_libretro_android.so");
            } else if ("NDS".equals(this.systemName) && "retroarch - desmume".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/desmume_libretro_android.so");
            } else if ("N64".equals(this.systemName) && "retroarch - mupen64plus".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/mupen64plus_libretro_android.so");
            } else if ("MAME".equals(this.systemName) && "retroarch - finalburn alpha".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/fb_alpha_libretro_android.so");
            } else if ("MAME".equals(this.systemName) && "retroarch - mame 0.78".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/mame078_libretro_android.so");
            } else if ("MAME".equals(this.systemName) && "retroarch - mame 0.139".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/mame2010_libretro_android.so");
            } else if ("LYNX".equals(this.systemName) && "retroarch - handy".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/handy_libretro_android.so");
            } else if ("WONDERSWAN".equals(this.systemName) && "retroarch - mednafen: wonderswan".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/mednafen_wswan_libretro_android.so");
            } else if ("WONDERSWAN_COLOR".equals(this.systemName) && "retroarch - mednafen: wonderswan".equals(this.selectedEmulator)) {
                intent.putExtra("LIBRETRO", "/data/data/com.retroarch/cores/mednafen_wswan_libretro_android.so");
            }
        }
        return intent;
    }
 
Christian Weiske Christian Weiske
owner

History