aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authortwinaphex2013-01-29 01:59:01 +0100
committertwinaphex2013-01-29 01:59:01 +0100
commit2dfdc938c99783e187f60c1d13db73e0ee434c92 (patch)
treeeb063a3af74ff44b2ba22ec34deb5811129d1cd4 /frontend
parente5f4d90401d099d5191f95e9f771ab5a81c87ed8 (diff)
parent17f84149a604fefb8181a280487bd48ca7a353b2 (diff)
downloadpcsx_rearmed-2dfdc938c99783e187f60c1d13db73e0ee434c92.tar.gz
pcsx_rearmed-2dfdc938c99783e187f60c1d13db73e0ee434c92.tar.bz2
pcsx_rearmed-2dfdc938c99783e187f60c1d13db73e0ee434c92.zip
Merge git://github.com/notaz/pcsx_rearmed
Diffstat (limited to 'frontend')
m---------frontend/libpicofe0
-rw-r--r--frontend/libretro.c8
-rw-r--r--frontend/main.c129
-rw-r--r--frontend/menu.c12
4 files changed, 90 insertions, 59 deletions
diff --git a/frontend/libpicofe b/frontend/libpicofe
-Subproject 4db02226eb3c80f49f5c412f7718c437c5e817f
+Subproject 215e7ed2510e191664b611a578ffb987cf4fdab
diff --git a/frontend/libretro.c b/frontend/libretro.c
index e7153ac..4f6879e 100644
--- a/frontend/libretro.c
+++ b/frontend/libretro.c
@@ -35,6 +35,7 @@ static bool vout_can_dupe;
static int samples_sent, samples_to_send;
static int plugins_opened;
+static int is_pal_mode;
/* memory card data */
extern char Mcd1Data[MCD_SIZE];
@@ -182,6 +183,7 @@ void pl_frame_limit(void)
void pl_timing_prepare(int is_pal)
{
+ is_pal_mode = is_pal;
}
void plat_trigger_vibrate(int is_strong)
@@ -254,7 +256,7 @@ void retro_get_system_info(struct retro_system_info *info)
void retro_get_system_av_info(struct retro_system_av_info *info)
{
memset(info, 0, sizeof(*info));
- info->timing.fps = 60;
+ info->timing.fps = is_pal_mode ? 50 : 60;
info->timing.sample_rate = 44100;
info->geometry.base_width = 320;
info->geometry.base_height = 240;
@@ -446,7 +448,7 @@ void retro_unload_game(void)
unsigned retro_get_region(void)
{
- return RETRO_REGION_NTSC;
+ return is_pal_mode ? RETRO_REGION_PAL : RETRO_REGION_NTSC;
}
void *retro_get_memory_data(unsigned id)
@@ -501,7 +503,7 @@ void retro_run(void)
stop = 0;
psxCpu->Execute();
- samples_to_send += 44100 / 60;
+ samples_to_send += is_pal_mode ? 44100 / 50 : 44100 / 60;
video_cb((vout_fb_dirty || !vout_can_dupe) ? vout_buf : NULL,
vout_width, vout_height, vout_width * 2);
diff --git a/frontend/main.c b/frontend/main.c
index 43a1a03..0f0e641 100644
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -33,6 +33,8 @@
#include "libpicofe/readpng.h"
static void toggle_fast_forward(int force_off);
+static void check_profile(void);
+static void check_memcards(void);
#endif
#ifndef BOOT_MSG
#define BOOT_MSG "Booting up..."
@@ -66,28 +68,6 @@ static void make_path(char *buf, size_t size, const char *dir, const char *fname
#define MAKE_PATH(buf, dir, fname) \
make_path(buf, sizeof(buf), dir, fname)
-static void create_profile_dir(const char *directory) {
- char path[MAXPATHLEN];
-
- MAKE_PATH(path, directory, NULL);
- mkdir(path, S_IRWXU | S_IRWXG);
-}
-
-static void CheckSubDir() {
- // make sure that ~/.pcsx exists
- create_profile_dir(PCSX_DOT_DIR);
-
- create_profile_dir(BIOS_DIR);
- create_profile_dir(MEMCARD_DIR);
- create_profile_dir(STATES_DIR);
- create_profile_dir(PLUGINS_DIR);
- create_profile_dir(PLUGINS_CFG_DIR);
- create_profile_dir(CHEATS_DIR);
- create_profile_dir(PATCHES_DIR);
- create_profile_dir(PCSX_DOT_DIR "cfg");
- create_profile_dir("/screenshots/");
-}
-
static int get_gameid_filename(char *buf, int size, const char *fmt, int i) {
char trimlabel[33];
int j;
@@ -126,9 +106,12 @@ void set_cd_image(const char *fname)
static void set_default_paths(void)
{
+#ifndef NO_FRONTEND
+ snprintf(Config.PatchesDir, sizeof(Config.PatchesDir), "." PATCHES_DIR);
MAKE_PATH(Config.Mcd1, MEMCARD_DIR, "card1.mcd");
MAKE_PATH(Config.Mcd2, MEMCARD_DIR, "card2.mcd");
strcpy(Config.BiosDir, "bios");
+#endif
strcpy(Config.PluginsDir, "plugins");
strcpy(Config.Gpu, "builtin_gpu");
@@ -137,8 +120,6 @@ static void set_default_paths(void)
strcpy(Config.Pad1, "builtin_pad");
strcpy(Config.Pad2, "builtin_pad");
strcpy(Config.Net, "Disabled");
-
- snprintf(Config.PatchesDir, sizeof(Config.PatchesDir), "." PATCHES_DIR);
}
void emu_set_default_config(void)
@@ -175,25 +156,6 @@ void emu_set_default_config(void)
in_type2 = PSE_PAD_TYPE_STANDARD;
}
-static void check_memcards(void)
-{
- char buf[MAXPATHLEN];
- FILE *f;
- int i;
-
- for (i = 1; i <= 9; i++) {
- snprintf(buf, sizeof(buf), ".%scard%d.mcd", MEMCARD_DIR, i);
-
- f = fopen(buf, "rb");
- if (f == NULL) {
- SysPrintf("Creating memcard: %s\n", buf);
- CreateMcd(buf);
- }
- else
- fclose(f);
- }
-}
-
void do_emu_action(void)
{
int ret;
@@ -454,8 +416,12 @@ int emu_core_preinit(void)
int emu_core_init(void)
{
- CheckSubDir();
+ SysPrintf("Starting PCSX-ReARMed " REV "\n");
+
+#ifndef NO_FRONTEND
+ check_profile();
check_memcards();
+#endif
if (EmuInit() == -1) {
SysPrintf("PSX emulator couldn't be initialized.\n");
@@ -472,6 +438,47 @@ int emu_core_init(void)
}
#ifndef NO_FRONTEND
+static void create_profile_dir(const char *directory) {
+ char path[MAXPATHLEN];
+
+ MAKE_PATH(path, directory, NULL);
+ mkdir(path, S_IRWXU | S_IRWXG);
+}
+
+static void check_profile(void) {
+ // make sure that ~/.pcsx exists
+ create_profile_dir(PCSX_DOT_DIR);
+
+ create_profile_dir(BIOS_DIR);
+ create_profile_dir(MEMCARD_DIR);
+ create_profile_dir(STATES_DIR);
+ create_profile_dir(PLUGINS_DIR);
+ create_profile_dir(PLUGINS_CFG_DIR);
+ create_profile_dir(CHEATS_DIR);
+ create_profile_dir(PATCHES_DIR);
+ create_profile_dir(PCSX_DOT_DIR "cfg");
+ create_profile_dir("/screenshots/");
+}
+
+static void check_memcards(void)
+{
+ char buf[MAXPATHLEN];
+ FILE *f;
+ int i;
+
+ for (i = 1; i <= 9; i++) {
+ snprintf(buf, sizeof(buf), ".%scard%d.mcd", MEMCARD_DIR, i);
+
+ f = fopen(buf, "rb");
+ if (f == NULL) {
+ SysPrintf("Creating memcard: %s\n", buf);
+ CreateMcd(buf);
+ }
+ else
+ fclose(f);
+ }
+}
+
int main(int argc, char *argv[])
{
char file[MAXPATHLEN] = "";
@@ -553,7 +560,8 @@ int main(int argc, char *argv[])
plat_init();
menu_init(); // loads config
- emu_core_init();
+ if (emu_core_init() != 0)
+ return 1;
if (psxout)
Config.PsxOut = 1;
@@ -761,6 +769,8 @@ int emu_load_state(int slot)
return LoadState(fname);
}
+#ifndef ANDROID
+
void SysPrintf(const char *fmt, ...) {
va_list list;
@@ -769,16 +779,31 @@ void SysPrintf(const char *fmt, ...) {
va_end(list);
}
+#else
+
+#include <android/log.h>
+
+void SysPrintf(const char *fmt, ...) {
+ va_list list;
+
+ va_start(list, fmt);
+ __android_log_vprint(ANDROID_LOG_INFO, "PCSX", fmt, list);
+ va_end(list);
+}
+
+#endif
+
void SysMessage(const char *fmt, ...) {
- va_list list;
- char msg[512];
+ va_list list;
+ char msg[512];
+ int ret;
- va_start(list, fmt);
- vsnprintf(msg, sizeof(msg), fmt, list);
- va_end(list);
+ va_start(list, fmt);
+ ret = vsnprintf(msg, sizeof(msg), fmt, list);
+ va_end(list);
- if (msg[strlen(msg) - 1] == '\n')
- msg[strlen(msg) - 1] = 0;
+ if (ret < sizeof(msg) && msg[ret - 1] == '\n')
+ msg[ret - 1] = 0;
SysPrintf("%s\n", msg);
}
diff --git a/frontend/menu.c b/frontend/menu.c
index 7dab2e6..8119505 100644
--- a/frontend/menu.c
+++ b/frontend/menu.c
@@ -8,7 +8,7 @@
* See the COPYING file in the top-level directory.
*/
-#define _GNU_SOURCE
+#define _GNU_SOURCE 1
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -251,7 +251,9 @@ static int optional_cdimg_filter(struct dirent **namelist, int count,
p = strrchr(buf2, '/');
if (p == NULL)
p = strrchr(buf2, '\\');
- if (p == NULL)
+ if (p != NULL)
+ p++;
+ else
p = buf2;
snprintf(buf, sizeof(buf), "%s/%s", basedir, p);
@@ -327,6 +329,7 @@ static void menu_set_defconfig(void)
g_opts = 0;
g_scaler = SCALE_4_3;
+ g_gamma = 100;
volume_boost = 0;
frameskip = 0;
analog_deadzone = 50;
@@ -391,6 +394,7 @@ static const struct {
CE_CONFIG_VAL(Cpu),
CE_INTVAL(region),
CE_INTVAL_V(g_scaler, 2),
+ CE_INTVAL(g_gamma),
CE_INTVAL(g_layer_x),
CE_INTVAL(g_layer_y),
CE_INTVAL(g_layer_w),
@@ -1696,10 +1700,10 @@ out:
static void handle_memcard_sel(void)
{
- Config.Mcd1[0] = 0;
+ strcpy(Config.Mcd1, "none");
if (memcard1_sel != 0)
snprintf(Config.Mcd1, sizeof(Config.Mcd1), ".%s%s", MEMCARD_DIR, memcards[memcard1_sel]);
- Config.Mcd2[0] = 0;
+ strcpy(Config.Mcd2, "none");
if (memcard2_sel != 0)
snprintf(Config.Mcd2, sizeof(Config.Mcd2), ".%s%s", MEMCARD_DIR, memcards[memcard2_sel]);
LoadMcds(Config.Mcd1, Config.Mcd2);