};
static int last_psx_w, last_psx_h, last_psx_bpp;
-static int scaling, filter, cpu_clock, cpu_clock_st, volume_boost, frameskip;
+static int scaling, cpu_clock, cpu_clock_st, volume_boost, frameskip;
static char rom_fname_reload[MAXPATHLEN];
static char last_selected_fname[MAXPATHLEN];
static int warned_about_bios, region, in_type_sel1, in_type_sel2;
static int memcard1_sel, memcard2_sel;
int g_opts;
int soft_scaling, analog_deadzone; // for Caanoo
+int filter;
#ifdef __ARM_ARCH_7A__
#define DEFAULT_PSX_CLOCK 57
free(gpu);
}
-// ---------- XXX: pandora specific -----------
-
-static const char pnd_script_base[] = "sudo -n /usr/pandora/scripts";
-static char **pnd_filter_list;
-
-static void apply_filter(int which)
-{
- static int old = -1;
- char buf[128];
- int i;
-
- if (pnd_filter_list == NULL || which == old)
- return;
-
- for (i = 0; i < which; i++)
- if (pnd_filter_list[i] == NULL)
- return;
-
- if (pnd_filter_list[i] == NULL)
- return;
-
- snprintf(buf, sizeof(buf), "%s/op_videofir.sh %s", pnd_script_base, pnd_filter_list[i]);
- system(buf);
- old = which;
-}
-
-static void apply_lcdrate(int pal)
-{
- static int old = -1;
- char buf[128];
-
- if (pal == old)
- return;
-
- snprintf(buf, sizeof(buf), "%s/op_lcdrate.sh %d",
- pnd_script_base, pal ? 50 : 60);
- system(buf);
- old = pal;
-}
-
-static menu_entry e_menu_gfx_options[];
-
-static void pnd_menu_init(void)
-{
- struct dirent *ent;
- int i, count = 0;
- char **mfilters;
- char buff[64];
- DIR *dir;
-
- cpu_clock_st = cpu_clock = plat_cpu_clock_get();
-
- dir = opendir("/etc/pandora/conf/dss_fir");
- if (dir == NULL) {
- perror("filter opendir");
- return;
- }
-
- while (1) {
- errno = 0;
- ent = readdir(dir);
- if (ent == NULL) {
- if (errno != 0)
- perror("readdir");
- break;
- }
-
- if (ent->d_type != DT_REG && ent->d_type != DT_LNK)
- continue;
-
- count++;
- }
-
- if (count == 0)
- return;
-
- mfilters = calloc(count + 1, sizeof(mfilters[0]));
- if (mfilters == NULL)
- return;
-
- rewinddir(dir);
- for (i = 0; (ent = readdir(dir)); ) {
- size_t len;
-
- if (ent->d_type != DT_REG && ent->d_type != DT_LNK)
- continue;
-
- len = strlen(ent->d_name);
-
- // skip pre-HF5 extra files
- if (len >= 3 && strcmp(ent->d_name + len - 3, "_v3") == 0)
- continue;
- if (len >= 3 && strcmp(ent->d_name + len - 3, "_v5") == 0)
- continue;
-
- // have to cut "_up_h" for pre-HF5
- if (len > 5 && strcmp(ent->d_name + len - 5, "_up_h") == 0)
- len -= 5;
-
- if (len > sizeof(buff) - 1)
- continue;
-
- strncpy(buff, ent->d_name, len);
- buff[len] = 0;
- mfilters[i] = strdup(buff);
- if (mfilters[i] != NULL)
- i++;
- }
- closedir(dir);
-
- i = me_id2offset(e_menu_gfx_options, MA_OPT_FILTERING);
- e_menu_gfx_options[i].data = (void *)mfilters;
- pnd_filter_list = mfilters;
-}
-
-void menu_finish(void)
-{
- plat_cpu_clock_apply(cpu_clock_st);
-}
-
// -------------- key config --------------
me_bind_action me_ctrl_actions[] =
scaling = SCALE_CUSTOM;
- plat_gvideo_open();
+ plat_gvideo_open(Config.PsxType);
for (;;)
{
if (g_layer_y + g_layer_h > 480)
g_layer_h = 480 - g_layer_y;
// resize the layer
- plat_gvideo_open();
+ plat_gvideo_open(Config.PsxType);
}
}
return 0;
}
+// XXX
+void menu_set_filter_list(void *filters)
+{
+ int i;
+
+ i = me_id2offset(e_menu_gfx_options, MA_OPT_FILTERING);
+ e_menu_gfx_options[i].data = filters;
+ me_enable(e_menu_gfx_options, MA_OPT_FILTERING, filters != NULL);
+}
+
// ------------ bios/plugins ------------
#ifdef __ARM_NEON__
strcpy(last_selected_fname, "/media");
+ cpu_clock_st = cpu_clock = plat_cpu_clock_get();
+
scan_bios_plugins();
- pnd_menu_init();
menu_init_common();
menu_set_defconfig();
CDR_stop();
menu_sync_config();
- apply_lcdrate(Config.PsxType);
- apply_filter(filter);
if (cpu_clock > 0)
plat_cpu_clock_apply(cpu_clock);
lprintf("msg: %s\n", menu_error_msg);
}
+void menu_finish(void)
+{
+ plat_cpu_clock_apply(cpu_clock_st);
+}
void menu_finish(void);
void menu_notify_mode_change(int w, int h, int bpp);
+void menu_set_filter_list(void *filters);
enum opts {
OPT_SHOWFPS = 1 << 0,
extern int g_opts;
extern int soft_scaling, analog_deadzone;
+extern int filter;
int plat_get_bat_capacity(void);
// indirectly called from GPU plugin
-void plat_gvideo_open(void);
+void plat_gvideo_open(int is_pal);
void *plat_gvideo_set_mode(int *w, int *h, int *bpp);
void *plat_gvideo_flip(void);
void plat_gvideo_close(void);
-
-// XXX
-int plat_pandora_init(void);
{
}
-void plat_gvideo_open(void)
+void plat_gvideo_open(int is_pal)
{
}
#include "plugin_lib.h"
#include "pl_gun_ts.h"
#include "plat.h"
+#include "plat_omap.h"
#include "menu.h"
static struct vout_fbdev *main_fb, *layer_fb;
g_layer_x, g_layer_y, g_layer_w, g_layer_h);
}
-void plat_gvideo_open(void)
+void plat_omap_gvideo_open(void)
{
omap_enable_layer(1);
omap_enable_layer(1);
}
-void plat_step_volume(int is_up)
-{
-}
-
-void plat_trigger_vibrate(int is_strong)
-{
-}
-
void *plat_prepare_screenshot(int *w, int *h, int *bpp)
{
return NULL;
}
-void plat_init(void)
+void plat_omap_init(void)
{
const char *main_fb_name, *layer_fb_name;
int fd, ret, w, h;
goto fail0;
}
- plat_pandora_init(); // XXX
-
return;
fail0:
exit(1);
}
-void plat_finish(void)
+void plat_omap_finish(void)
{
omap_enable_layer(0);
vout_fbdev_finish(layer_fb);
--- /dev/null
+
+void plat_omap_init(void);
+void plat_omap_finish(void);
+void plat_omap_gvideo_open(void);
+
#include <sys/ioctl.h>
#include <unistd.h>
#include <linux/input.h>
+#include <dirent.h>
#include <errno.h>
#include "common/input.h"
#include "linux/in_evdev.h"
#include "plugin_lib.h"
#include "plat.h"
+#include "plat_omap.h"
#include "main.h"
+#include "menu.h"
static const char * const pandora_gpio_keys[KEY_MAX + 1] = {
[0 ... KEY_MAX] = NULL,
{ 0, 0, 0 }
};
-int plat_pandora_init(void)
+static const char pnd_script_base[] = "sudo -n /usr/pandora/scripts";
+static char **pnd_filter_list;
+
+static void scan_for_filters(void)
+{
+ struct dirent *ent;
+ int i, count = 0;
+ char **mfilters;
+ char buff[64];
+ DIR *dir;
+
+ dir = opendir("/etc/pandora/conf/dss_fir");
+ if (dir == NULL) {
+ perror("filter opendir");
+ return;
+ }
+
+ while (1) {
+ errno = 0;
+ ent = readdir(dir);
+ if (ent == NULL) {
+ if (errno != 0)
+ perror("readdir");
+ break;
+ }
+
+ if (ent->d_type != DT_REG && ent->d_type != DT_LNK)
+ continue;
+
+ count++;
+ }
+
+ if (count == 0)
+ return;
+
+ mfilters = calloc(count + 1, sizeof(mfilters[0]));
+ if (mfilters == NULL)
+ return;
+
+ rewinddir(dir);
+ for (i = 0; (ent = readdir(dir)); ) {
+ size_t len;
+
+ if (ent->d_type != DT_REG && ent->d_type != DT_LNK)
+ continue;
+
+ len = strlen(ent->d_name);
+
+ // skip pre-HF5 extra files
+ if (len >= 3 && strcmp(ent->d_name + len - 3, "_v3") == 0)
+ continue;
+ if (len >= 3 && strcmp(ent->d_name + len - 3, "_v5") == 0)
+ continue;
+
+ // have to cut "_up_h" for pre-HF5
+ if (len > 5 && strcmp(ent->d_name + len - 5, "_up_h") == 0)
+ len -= 5;
+
+ if (len > sizeof(buff) - 1)
+ continue;
+
+ strncpy(buff, ent->d_name, len);
+ buff[len] = 0;
+ mfilters[i] = strdup(buff);
+ if (mfilters[i] != NULL)
+ i++;
+ }
+ closedir(dir);
+
+ pnd_filter_list = mfilters;
+ menu_set_filter_list((void *)mfilters);
+}
+
+int plat_init(void)
{
int gpiokeys_id;
+ plat_omap_init();
+
in_evdev_init(in_evdev_defbinds);
in_probe();
gpiokeys_id = in_name_to_id("evdev:gpio-keys");
in_adev[0] = in_name_to_id("evdev:nub0");
in_adev[1] = in_name_to_id("evdev:nub1");
+ scan_for_filters();
+
return 0;
}
-static const char pnd_script_base[] = "sudo -n /usr/pandora/scripts";
+void plat_finish(void)
+{
+ plat_omap_finish();
+}
+
+static void apply_lcdrate(int pal)
+{
+ char buf[128];
+
+ snprintf(buf, sizeof(buf), "%s/op_lcdrate.sh %d",
+ pnd_script_base, pal ? 50 : 60);
+ system(buf);
+}
+
+static void apply_filter(int which)
+{
+ char buf[128];
+ int i;
+
+ if (pnd_filter_list == NULL)
+ return;
+
+ for (i = 0; i < which; i++)
+ if (pnd_filter_list[i] == NULL)
+ return;
+
+ if (pnd_filter_list[i] == NULL)
+ return;
+
+ snprintf(buf, sizeof(buf), "%s/op_videofir.sh %s",
+ pnd_script_base, pnd_filter_list[i]);
+ system(buf);
+}
+
+void plat_gvideo_open(int is_pal)
+{
+ static int old_pal = -1, old_filter = -1;
+
+ if (is_pal != old_pal) {
+ apply_lcdrate(is_pal);
+ old_pal = is_pal;
+ }
+ if (filter != old_filter) {
+ apply_filter(filter);
+ old_filter = filter;
+ }
+
+ plat_omap_gvideo_open();
+}
int plat_cpu_clock_get(void)
{
}
return ret;
}
+
+void plat_step_volume(int is_up)
+{
+}
+
+void plat_trigger_vibrate(int is_strong)
+{
+}
+
}
/* not really used, we do raw_flip */
-void plat_gvideo_open(void)
+void plat_gvideo_open(int is_pal)
{
}
SDL_Quit();
}
-void plat_gvideo_open(void)
+void plat_gvideo_open(int is_pal)
{
}
int g_layer_x, g_layer_y, g_layer_w, g_layer_h;
static int pl_vout_w, pl_vout_h, pl_vout_bpp;
static int vsync_cnt;
-static int frame_interval, frame_interval1024, vsync_usec_time;
+static int is_pal, frame_interval, frame_interval1024;
+static int vsync_usec_time;
static __attribute__((noinline)) int get_cpu_ticks(void)
pl_vout_h--;
pl_vout_buf = pl_vout_set_mode(pl_vout_w, h, pl_vout_bpp);
- plat_gvideo_open();
+ plat_gvideo_open(is_pal);
gettimeofday(&now, 0);
vsync_usec_time = now.tv_usec;
pcnt_start(PCNT_ALL);
}
-void pl_timing_prepare(int is_pal)
+void pl_timing_prepare(int is_pal_)
{
pl_rearmed_cbs.fskip_advice = 0;
pl_rearmed_cbs.flips_per_sec = 0;
pl_rearmed_cbs.cpu_usage = 0;
+ is_pal = is_pal_;
frame_interval = is_pal ? 20000 : 16667;
frame_interval1024 = is_pal ? 20000*1024 : 17066667;