Merge branch 'master' into cd-swap

This commit is contained in:
Themaister 2013-02-23 14:50:33 +01:00
commit 0d1d275227
15 changed files with 140 additions and 31 deletions

View File

@ -4,6 +4,8 @@ DEBUG = 0
HAVE_LOGGER = 1
HAVE_FILE_LOGGER = 0
PERF_TEST = 0
WHOLE_ARCHIVE_LINK = 0
BIG_STACK = 0
PC_DEVELOPMENT_IP_ADDRESS = "192.168.1.7"
PC_DEVELOPMENT_UDP_PORT = 3490
@ -32,8 +34,15 @@ LIBDIRS := -L$(DEVKITPRO)/libogc/lib/cube -L.
MACHDEP := -DGEKKO -DHW_DOL -mogc -mcpu=750 -meabi -mhard-float
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE)
LDFLAGS := $(MACHDEP) -Wl,-Map,$(notdir $(ELF_TARGET)).map -T gx/ld/ogc.ld
LIBS := -lfat -lretro_ngc -logc
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_START := -Wl,--whole-archive
WHOLE_END := -Wl,--no-whole-archive
endif
LDFLAGS := $(MACHDEP) -Wl,-Map,$(notdir $(ELF_TARGET)).map
ifeq ($(BIG_STACK), 1)
LDFLAGS += -T gx/ld/ogc.ld
endif
LIBS := -lfat $(WHOLE_START) -lretro_ngc $(WHOLE_END) -logc
OBJ = console/griffin/griffin.o

View File

@ -4,7 +4,8 @@ DEBUG = 0
HAVE_LOGGER = 0
HAVE_FILE_LOGGER = 0
PERF_TEST = 0
WHOLE_ARCHIVE_LINK = 0
WHOLE_ARCHIVE_LINK = 0
BIG_STACK = 0
PC_DEVELOPMENT_IP_ADDRESS = "192.168.1.100"
PC_DEVELOPMENT_UDP_PORT = 3490
@ -36,10 +37,13 @@ LIBDIRS := -L$(DEVKITPRO)/libogc/lib/wii -L.
MACHDEP := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE)
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_START := -Wl,--whole-archive
WHOLE_END := -Wl,--no-whole-archive
WHOLE_START := -Wl,--whole-archive
WHOLE_END := -Wl,--no-whole-archive
endif
LDFLAGS := $(MACHDEP) -Wl,-Map,$(notdir $(ELF_TARGET)).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,strdup,-wrap,strndup,-wrap,malloc_usable_size
ifeq ($(BIG_STACK), 1)
LDFLAGS += -T gx/ld/rvl.ld
endif
LDFLAGS := $(MACHDEP) -Wl,-Map,$(notdir $(ELF_TARGET)).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,strdup,-wrap,strndup,-wrap,malloc_usable_size -T gx/ld/rvl.ld
LIBS := -lfat $(WHOLE_START) -lretro_wii $(WHOLE_END) -logc $(LDFLAGS_WIIUSE) -lbte
APP_BOOTER_DIR = wii/app_booter

View File

@ -59,11 +59,13 @@ public class RetroArch extends Activity implements
AdapterView.OnItemClickListener {
private IconAdapter<ModuleWrapper> adapter;
static private final int ACTIVITY_LOAD_ROM = 0;
static private final int ACTIVITY_NATIVE_ACTIVITY = 1;
static private String libretro_path;
static private Double report_refreshrate;
static private final String TAG = "RetroArch-Phoenix";
private ConfigFile config;
private ConfigFile core_config;
private String return_file;
private final double getDisplayRefreshRate() {
// Android is *very* likely to screw this up.
@ -282,6 +284,12 @@ public class RetroArch extends Activity implements
}
}
if (getCacheDir() != null && getCacheDir().getAbsolutePath() != null) {
return_file = getCacheDir().getAbsolutePath() + File.pathSeparator + ".return";
} else {
return_file = getDefaultConfigPath() + ".ret";
}
this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
@ -307,11 +315,7 @@ public class RetroArch extends Activity implements
startActivity(i);
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
.setNegativeButton("No", null);
alert.show();
}
}
@ -349,8 +353,10 @@ public class RetroArch extends Activity implements
return internal + File.separator + "retroarch.cfg";
else if (external != null && new File(internal + File.separator + "retroarch.cfg").canWrite())
return external + File.separator + "retroarch.cfg";
else
else if (getCacheDir() != null && getCacheDir().getAbsolutePath() != null)
return getCacheDir().getAbsolutePath() + File.separator + "retroarch.cfg";
else // emergency fallback, all else failed
return "/mnt/sdcard/retroarch.cfg";
}
private void updateConfigFile() {
@ -365,10 +371,10 @@ public class RetroArch extends Activity implements
config.setBoolean("video_vsync", prefs.getBoolean("video_vsync", true));
config.setBoolean("input_autodetect_enable", prefs.getBoolean("input_autodetect_enable", true));
config.setBoolean("input_debug_enable", prefs.getBoolean("input_debug_enable", false));
config.setInt("input_autodetect_icade_profile_pad1", prefs.getInt("input_autodetect_icade_profile_pad1", 0));
config.setInt("input_autodetect_icade_profile_pad2", prefs.getInt("input_autodetect_icade_profile_pad2", 0));
config.setInt("input_autodetect_icade_profile_pad3", prefs.getInt("input_autodetect_icade_profile_pad3", 0));
config.setInt("input_autodetect_icade_profile_pad4", prefs.getInt("input_autodetect_icade_profile_pad4", 0));
config.setInt("input_autodetect_icade_profile_pad1", Integer.valueOf(prefs.getString("input_autodetect_icade_profile_pad1", "0")));
config.setInt("input_autodetect_icade_profile_pad2", Integer.valueOf(prefs.getString("input_autodetect_icade_profile_pad2", "0")));
config.setInt("input_autodetect_icade_profile_pad3", Integer.valueOf(prefs.getString("input_autodetect_icade_profile_pad3", "0")));
config.setInt("input_autodetect_icade_profile_pad4", Integer.valueOf(prefs.getString("input_autodetect_icade_profile_pad4", "0")));
config.setDouble("video_refresh_rate", getRefreshRate());
config.setBoolean("video_threaded", prefs.getBoolean("video_threaded", false));
@ -454,6 +460,7 @@ public class RetroArch extends Activity implements
switch (requestCode) {
case ACTIVITY_LOAD_ROM:
if (data.getStringExtra("PATH") != null) {
new File(return_file).delete();
Toast.makeText(this,
"Loading: [" + data.getStringExtra("PATH") + "]...",
Toast.LENGTH_SHORT).show();
@ -461,10 +468,27 @@ public class RetroArch extends Activity implements
myIntent.putExtra("ROM", data.getStringExtra("PATH"));
myIntent.putExtra("LIBRETRO", libretro_path);
myIntent.putExtra("CONFIGFILE", getDefaultConfigPath());
myIntent.putExtra("RETURN", return_file);
myIntent.putExtra("IME", current_ime);
startActivity(myIntent);
startActivityForResult(myIntent, ACTIVITY_NATIVE_ACTIVITY);
}
break;
case ACTIVITY_NATIVE_ACTIVITY:
AlertDialog.Builder builder = new AlertDialog.Builder(this).setNeutralButton("OK", null);
try {
DataInputStream cacheStream = new DataInputStream(new FileInputStream(return_file));
int value = cacheStream.readInt();
cacheStream.close();
if (value != 0) {
throw new IOException();
}
} catch (FileNotFoundException e) {
builder.setTitle("Crash").setMessage("RetroArch Crashed").show();
} catch (IOException e) {
builder.setTitle("Error").setMessage("RetroArch Could not load the chosen ROM.\n\nCheck the Cores Guide for details on valid ROMs for this emulator.").show();
}
new File(return_file).delete();
break;
}
}

View File

@ -5,12 +5,15 @@ make -C ../ -f Makefile.ngc clean || exit 1
for f in *_ngc.a ; do
name=`echo "$f" | sed 's/\(_libretro\|\)_ngc.a$//'`
whole_archive=
big_stack=
if [ $name = "nxengine" ] ; then
whole_archive="WHOLE_ARCHIVE_LINK=1"
echo $name yes
fi
if [ $name = "tyrquake" ] ; then
big_stack="BIG_STACK=1"
fi
cp -f "$f" ../libretro_ngc.a
make -C ../ -f Makefile.ngc $whole_archive -j3 || exit 1
make -C ../ -f Makefile.ngc $whole_archive $big_stack -j3 || exit 1
mv -f ../retroarch_ngc.dol ../ngc/pkg/$name.dol
rm -f ../retroarch_ngc.dol ../retroarch_ngc.elf ../retroarch_ngc.elf.map
done

View File

@ -9,12 +9,15 @@ make -C ../ -f Makefile.wii.salamander pkg || exit 1
for f in *_wii.a ; do
name=`echo "$f" | sed 's/\(_libretro\|\)_wii.a$//'`
whole_archive=
big_stack=
if [ $name = "nxengine" ] ; then
whole_archive="WHOLE_ARCHIVE_LINK=1"
echo $name yes
fi
if [ $name = "tyrquake" ] ; then
big_stack="BIG_STACK=1"
fi
cp -f "$f" ../libretro_wii.a
make -C ../ -f Makefile.wii $whole_archive -j3 || exit 1
make -C ../ -f Makefile.wii $whole_archive $big_stack -j3 || exit 1
mv -f ../retroarch_wii.dol ../wii/pkg/$name.dol
rm -f ../retroarch_wii.dol ../retroarch_wii.elf ../retroarch_wii.elf.map
done

View File

@ -19,6 +19,7 @@
#include <unistd.h>
#include <string.h>
#include <sys/resource.h>
#include <byteswap.h>
#include "frontend_android.h"
#include "../android/native/jni/jni_macros.h"
@ -280,6 +281,12 @@ static bool android_app_start_main(struct android_app *android_app, int *init_re
strlcpy(out_args.in, "IME", sizeof(out_args.in));
jni_get(&in_params, &out_args);
// Return value file
out_args.out = android_app->return_file;
out_args.out_sizeof = sizeof(android_app->return_file);
strlcpy(out_args.in, "RETURN", sizeof(out_args.in));
jni_get(&in_params, &out_args);
(*in_params.java_vm)->DetachCurrentThread(in_params.java_vm);
RARCH_LOG("Checking arguments passed ...\n");
@ -287,6 +294,9 @@ static bool android_app_start_main(struct android_app *android_app, int *init_re
RARCH_LOG("Libretro path: [%s].\n", libretro_path);
RARCH_LOG("Config file: [%s].\n", config_file);
RARCH_LOG("Current IME: [%s].\n", android_app->current_ime);
RARCH_LOG("Return file: [%s].\n", android_app->return_file);
unlink(android_app->return_file);
struct rarch_main_wrap args = {0};
@ -371,6 +381,19 @@ exit:
#endif
rarch_main_clear_state();
int bs_return = bswap_32(init_ret);
FILE *return_file = fopen(android_app->return_file, "w");
if (return_file)
{
fwrite(&bs_return, 4, 1, return_file);
fclose(return_file);
}
// returning from the native activity too fast can make the Java frontend not reappear
// work around it only if we fail to load the ROM
if (init_ret != 0)
usleep(1000000);
RARCH_LOG("android_app_destroy!");
if (android_app->inputQueue != NULL)
AInputQueue_detachLooper(android_app->inputQueue);

View File

@ -49,6 +49,7 @@ struct android_app
AInputQueue* pendingInputQueue;
ANativeWindow* pendingWindow;
char current_ime[PATH_MAX];
char return_file[PATH_MAX];
};
enum {

View File

@ -155,6 +155,7 @@ struct settings
struct
{
char driver[32];
char gl_context[32];
float xscale;
float yscale;
bool fullscreen;

View File

@ -630,6 +630,6 @@ const gfx_ctx_driver_t gfx_ctx_drm_egl = {
gfx_ctx_init_egl_image_buffer,
gfx_ctx_write_egl_image,
NULL,
"drm-egl",
"kms-egl",
};

View File

@ -369,7 +369,7 @@ static bool gfx_ctx_set_video_mode(
if (true_full)
{
RARCH_LOG("[GLX]: Using true fullscreen.\n");
RARCH_LOG("[X/EGL]: Using true fullscreen.\n");
XMapRaised(g_dpy, g_win);
}
else if (fullscreen) // We attempted true fullscreen, but failed. Attempt using windowed fullscreen.
@ -455,7 +455,7 @@ static void gfx_ctx_destroy(void)
g_screen = x11_get_xinerama_monitor(g_dpy, x, y,
target.width, target.height);
RARCH_LOG("[GLX]: Saved monitor #%u.\n", g_screen);
RARCH_LOG("[X/EGL]: Saved monitor #%u.\n", g_screen);
#endif
XUnmapWindow(g_dpy, g_win);

View File

@ -1569,6 +1569,45 @@ static void gl_init_pbo_readback(void *data)
#endif
}
static const gfx_ctx_driver_t *gl_get_context(void)
{
#ifdef HAVE_OPENGLES
enum gfx_ctx_api api = GFX_CTX_OPENGL_ES_API;
const char *api_name = "OpenGL ES";
#else
enum gfx_ctx_api api = GFX_CTX_OPENGL_API;
const char *api_name = "OpenGL";
#endif
if (*g_settings.video.gl_context)
{
const gfx_ctx_driver_t *ctx = gfx_ctx_find_driver(g_settings.video.gl_context);
if (ctx)
{
if (!ctx->bind_api(api))
{
RARCH_ERR("Failed to bind API %s to context %s.\n", api_name, g_settings.video.gl_context);
return NULL;
}
if (!ctx->init())
{
RARCH_ERR("Failed to init GL context: %s.\n", ctx->ident);
return NULL;
}
}
else
{
RARCH_ERR("Didn't find GL context: %s.\n", g_settings.video.gl_context);
return NULL;
}
return ctx;
}
else
return gfx_ctx_init_first(api);
}
static void *gl_init(const video_info_t *video, const input_driver_t **input, void **input_data)
{
#ifdef _WIN32
@ -1589,11 +1628,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
if (!gl)
return NULL;
#ifdef HAVE_OPENGLES
gl->ctx_driver = gfx_ctx_init_first(GFX_CTX_OPENGL_ES_API);
#else
gl->ctx_driver = gfx_ctx_init_first(GFX_CTX_OPENGL_API);
#endif
gl->ctx_driver = gl_get_context();
if (!gl->ctx_driver)
{
free(gl);

View File

@ -257,7 +257,7 @@ SECTIONS
}
__isIPL = 0;
__stack_addr = (__bss_start + SIZEOF(.bss) + 0x40000 + 7) & (-8);
__stack_addr = (__bss_start + SIZEOF(.bss) + 0x80000 + 7) & (-8);
__stack_end = (__bss_start + SIZEOF(.bss));
__intrstack_addr = (__stack_addr + 0x4000);
__intrstack_end = (__stack_addr);

View File

@ -268,7 +268,7 @@ SECTIONS
}
__isIPL = 0;
__stack_addr = (__bss_start + SIZEOF(.bss) + 0x40000 + 7) & (-8);
__stack_addr = (__bss_start + SIZEOF(.bss) + 0x80000 + 7) & (-8);
__stack_end = (__bss_start + SIZEOF(.bss));
__intrstack_addr = (__stack_addr + 0x4000);
__intrstack_end = (__stack_addr);

View File

@ -40,6 +40,11 @@
# Video driver to use. "gl", "xvideo", "sdl"
# video_driver = "gl"
# Which OpenGL context implementation to use.
# Possible ones for desktop are: glx, x-egl, kms-egl, sdl-gl, wgl.
# By default, tries to use first suitable driver.
# video_gl_context =
# Windowed xscale and yscale
# (Real x res: base_size * xscale * aspect_ratio, real y res: base_size * yscale)
# video_xscale = 3.0

View File

@ -648,6 +648,7 @@ bool config_load_file(const char *path)
CONFIG_GET_STRING(audio.resampler, "audio_resampler");
CONFIG_GET_STRING(video.driver, "video_driver");
CONFIG_GET_STRING(video.gl_context, "video_gl_context");
CONFIG_GET_STRING(audio.driver, "audio_driver");
CONFIG_GET_PATH(audio.dsp_plugin, "audio_dsp_plugin");
CONFIG_GET_STRING(input.driver, "input_driver");