X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=frontend%2Fplat_pollux.c;h=3cf3a9b14846b24aa64a667d18cc616dc0331ea5;hp=d402e848e990c59a8041574aa99a63e58bcd947a;hb=7badc9353b9570fd1c67827cfb477cef07974ddb;hpb=a72ac8031937bb80f36e9392d07724a954995029 diff --git a/frontend/plat_pollux.c b/frontend/plat_pollux.c index d402e848..3cf3a9b1 100644 --- a/frontend/plat_pollux.c +++ b/frontend/plat_pollux.c @@ -49,18 +49,7 @@ static int psx_step, psx_width, psx_height, psx_bpp; static int psx_offset_x, psx_offset_y, psx_src_width, psx_src_height; static int fb_offset_x, fb_offset_y; -// TODO: get rid of this -struct vout_fbdev; -struct vout_fbdev *layer_fb; -int g_layer_x, g_layer_y, g_layer_w, g_layer_h; - -int omap_enable_layer(int enabled) -{ - return 0; -} - static void caanoo_init(void); -static void *pl_vout_set_mode(int w, int h, int bpp); static void *fb_flip(void) @@ -249,7 +238,6 @@ void plat_video_menu_leave(void) memset(g_menuscreen_ptr, 0, 320*240 * psx_bpp/8); g_menuscreen_ptr = fb_flip(); - pl_vout_set_mode(psx_width, psx_height, psx_bpp); } void *plat_prepare_screenshot(int *w, int *h, int *bpp) @@ -335,7 +323,7 @@ static void raw_flip_dma(int x, int y) if (psx_bpp == 16) { pl_vout_buf = g_menuscreen_ptr; - pl_print_hud(320, fb_offset_y + psx_src_height, fb_offset_x); + pl_print_hud(fb_offset_x); } g_menuscreen_ptr = fb_flip(); @@ -364,7 +352,7 @@ static void name(int x, int y) \ if (psx_bpp == 16) { \ pl_vout_buf = g_menuscreen_ptr; \ - pl_print_hud(320, fb_offset_y + psx_src_height, fb_offset_x); \ + pl_print_hud(fb_offset_x); \ } \ \ g_menuscreen_ptr = fb_flip(); \ @@ -378,9 +366,10 @@ make_flip_func(raw_flip_soft_368, blit320_368) make_flip_func(raw_flip_soft_512, blit320_512) make_flip_func(raw_flip_soft_640, blit320_640) -static void *pl_vout_set_mode(int w, int h, int bpp) +void *plat_gvideo_set_mode(int *w_, int *h_, int *bpp_) { int poff_w, poff_h, w_max; + int w = *w_, h = *h_, bpp = *bpp_; if (!w || !h || !bpp) return NULL; @@ -446,14 +435,27 @@ static void *pl_vout_set_mode(int w, int h, int bpp) pl_set_gun_rect(fb_offset_x, fb_offset_y, w > 320 ? 320 : w, h); + // adjust for hud + *w_ = 320; + *h_ = fb_offset_y + psx_src_height; + return NULL; } -static void *pl_vout_flip(void) +/* not really used, we do raw_flip */ +void plat_gvideo_open(void) +{ +} + +void *plat_gvideo_flip(void) { return NULL; } +void plat_gvideo_close(void) +{ +} + static void save_multiple_regs(unsigned int *dest, int base, int count) { const volatile unsigned int *regs = memregl + base / 4; @@ -527,12 +529,6 @@ void plat_init(void) g_menuscreen_h = 240; g_menuscreen_ptr = fb_flip(); - g_menubg_ptr = calloc(320*240*2, 1); - if (g_menubg_ptr == NULL) { - fprintf(stderr, "OOM\n"); - exit(1); - } - warm_ret = warm_init(); have_warm = warm_ret == 0; warm_change_cb_upper(WCB_B_BIT, 1); @@ -603,9 +599,7 @@ void plat_init(void) if (mixerdev == -1) perror("open(/dev/mixer)"); - pl_rearmed_cbs.pl_vout_flip = pl_vout_flip; pl_rearmed_cbs.pl_vout_raw_flip = have_warm ? raw_flip_dma : raw_flip_soft; - pl_rearmed_cbs.pl_vout_set_mode = pl_vout_set_mode; pl_rearmed_cbs.pl_vout_set_raw_vram = pl_vout_set_raw_vram; psx_src_width = 320; @@ -689,21 +683,22 @@ struct haptic_data { #define HAPTIC_SET_VIB_LEVEL _IOW(HAPTIC_IOCTL_MAGIC, 9, unsigned int) static int hapticdev = -1; -static struct haptic_data haptic_seq; +static struct haptic_data haptic_seq[2]; -static int haptic_init(void) +static int haptic_read(const char *fname, struct haptic_data *data) { int i, ret, v1, v2; char buf[128], *p; FILE *f; - f = fopen("haptic.txt", "r"); + f = fopen(fname, "r"); if (f == NULL) { - perror("fopen(haptic.txt)"); + fprintf(stderr, "fopen(%s)", fname); + perror(""); return -1; } - for (i = 0; i < sizeof(haptic_seq.actions) / sizeof(haptic_seq.actions[0]); ) { + for (i = 0; i < sizeof(data->actions) / sizeof(data->actions[0]); ) { p = fgets(buf, sizeof(buf), f); if (p == NULL) break; @@ -718,17 +713,31 @@ static int haptic_init(void) continue; } - haptic_seq.actions[i].time = v1; - haptic_seq.actions[i].strength = v2; + data->actions[i].time = v1; + data->actions[i].strength = v2; i++; } fclose(f); if (i == 0) { - fprintf(stderr, "bad haptic.txt\n"); + fprintf(stderr, "bad haptic file: %s\n", fname); return -1; } - haptic_seq.count = i; + data->count = i; + + return 0; +} + +static int haptic_init(void) +{ + int ret, i; + + ret = haptic_read("haptic_w.cfg", &haptic_seq[0]); + if (ret != 0) + return -1; + ret = haptic_read("haptic_s.cfg", &haptic_seq[1]); + if (ret != 0) + return -1; hapticdev = open("/dev/isa1200", O_RDWR | O_NONBLOCK); if (hapticdev == -1) { @@ -750,7 +759,7 @@ static int haptic_init(void) return 0; } -void plat_trigger_vibrate(void) +void plat_trigger_vibrate(int is_strong) { int ret; @@ -764,7 +773,7 @@ void plat_trigger_vibrate(void) } } - ioctl(hapticdev, HAPTIC_PLAY_PATTERN, &haptic_seq); + ioctl(hapticdev, HAPTIC_PLAY_PATTERN, &haptic_seq[!!is_strong]); } /* Wiz stuff */