if (menu_sel_color < 0) return; // no selection hilight\r
\r
if (y > 0) y--;\r
- dest = (unsigned short *)g_screen_ptr + x + y * g_screen_width + 14;\r
+ dest = (unsigned short *)g_screen_ptr + x + y * g_screen_width + me_mfont_w * 2 - 2;\r
for (h = me_mfont_h + 1; h > 0; h--)\r
{\r
dst = dest;\r
- for (i = w - 14; i > 0; i--)\r
+ for (i = w - (me_mfont_w * 2 - 2); i > 0; i--)\r
*dst++ = menu_sel_color;\r
dest += g_screen_width;\r
}\r
\r
// load custom font and selector (stored as 1st symbol in font table)\r
emu_make_path(buff, "skin/font.png", sizeof(buff));\r
- readpng(menu_font_data, buff, READPNG_FONT);\r
+ readpng(menu_font_data, buff, READPNG_FONT,\r
+ MENU_X2 ? 256 : 128, MENU_X2 ? 320 : 160);\r
// default selector symbol is '>'\r
memcpy(menu_font_data, menu_font_data + ((int)'>') * me_mfont_w * me_mfont_h / 2,\r
me_mfont_w * me_mfont_h / 2);\r
emu_make_path(buff, "skin/selector.png", sizeof(buff));\r
- readpng(menu_font_data, buff, READPNG_SELECTOR);\r
+ readpng(menu_font_data, buff, READPNG_SELECTOR, MENU_X2 ? 16 : 8, MENU_X2 ? 20 : 10);\r
\r
// load custom colors\r
emu_make_path(buff, "skin/skin.txt", sizeof(buff));\r
\r
// should really only happen once, on startup..\r
emu_make_path(buff, "skin/background.png", sizeof(buff));\r
- if (readpng(g_menubg_ptr, buff, READPNG_BG) < 0)\r
+ if (readpng(g_menubg_ptr, buff, READPNG_BG, g_screen_width, g_screen_height) < 0)\r
memset(g_menubg_ptr, 0, g_screen_width * g_screen_height * 2);\r
}\r
\r
\r
static void me_draw(const menu_entry *entries, int sel, void (*draw_more)(void))\r
{\r
- const menu_entry *ent;\r
+ const menu_entry *ent, *ent_sel = entries;\r
int x, y, w = 0, h = 0;\r
int offs, col2_offs = 27 * me_mfont_w;\r
+ int vi_sel_ln = 0;\r
const char *name;\r
- int asel = 0;\r
int i, n;\r
\r
/* calculate size of menu rect */\r
if (!ent->enabled)\r
continue;\r
\r
- if (i == sel)\r
- asel = n;\r
+ if (i == sel) {\r
+ ent_sel = ent;\r
+ vi_sel_ln = n;\r
+ }\r
\r
name = NULL;\r
wt = strlen(ent->name) * me_mfont_w;\r
\r
/* draw */\r
plat_video_menu_begin();\r
- menu_draw_selection(x, y + asel * me_mfont_h, w);\r
+ menu_draw_selection(x, y + vi_sel_ln * me_mfont_h, w);\r
x += me_mfont_w * 2;\r
\r
for (ent = entries; ent->name; ent++)\r
if (plat_get_ticks_ms() - menu_error_time > 2048)\r
menu_error_msg[0] = 0;\r
}\r
- else if (entries[asel].help != NULL) {\r
- const char *tmp = entries[asel].help;\r
+ else if (ent_sel->help != NULL) {\r
+ const char *tmp = ent_sel->help;\r
int l;\r
for (l = 0; tmp != NULL && *tmp != 0; l++)\r
tmp = strchr(tmp + 1, '\n');\r
if (h >= l * me_sfont_h + 4)\r
- for (tmp = entries[asel].help; l > 0; l--, tmp = strchr(tmp, '\n') + 1)\r
+ for (tmp = ent_sel->help; l > 0; l--, tmp = strchr(tmp, '\n') + 1)\r
smalltext_out16(5, g_screen_height - (l * me_sfont_h + 4), tmp, 0xffff);\r
}\r
\r
#include "readpng.h"
#include "lprintf.h"
-#ifdef PSP
-#define BG_WIDTH 480
-#define BG_HEIGHT 272
-#else
-#define BG_WIDTH 320
-#define BG_HEIGHT 240
-#endif
-
-int readpng(void *dest, const char *fname, readpng_what what)
+int readpng(void *dest, const char *fname, readpng_what what, int req_w, int req_h)
{
FILE *fp;
png_structp png_ptr = NULL;
break;
}
height = info_ptr->height;
- if (height > BG_HEIGHT) height = BG_HEIGHT;
+ if (height > req_h)
+ height = req_h;
width = info_ptr->width;
- if (width > BG_WIDTH) width = BG_WIDTH;
+ if (width > req_w)
+ width = req_w;
for (h = 0; h < height; h++)
{
#endif
src += 3;
}
- dst += BG_WIDTH - width;
+ dst += req_w - width;
}
break;
}
{
int x, y, x1, y1;
unsigned char *dst = dest;
- if (info_ptr->width != 128 || info_ptr->height != 160)
+ if (info_ptr->width != req_w || info_ptr->height != req_h)
{
- lprintf(__FILE__ ": unexpected font image size %ix%i, needed 128x160\n",
- (int)info_ptr->width, (int)info_ptr->height);
+ lprintf(__FILE__ ": unexpected font image size %dx%d, needed %dx%d\n",
+ (int)info_ptr->width, (int)info_ptr->height, req_w, req_h);
break;
}
if (info_ptr->pixel_depth != 8)
{
for (x = 0; x < 16; x++)
{
- for (y1 = 0; y1 < 10; y1++)
+ /* 16x16 grid of syms */
+ int sym_w = req_w / 16;
+ int sym_h = req_h / 16;
+ for (y1 = 0; y1 < sym_h; y1++)
{
- unsigned char *src = row_ptr[y*10 + y1] + x*8;
- for (x1 = 8/2; x1 > 0; x1--, src+=2)
+ unsigned char *src = row_ptr[y*sym_h + y1] + x*sym_w;
+ for (x1 = sym_w/2; x1 > 0; x1--, src+=2)
*dst++ = ((src[0]^0xff) & 0xf0) | ((src[1]^0xff) >> 4);
}
}
{
int x1, y1;
unsigned char *dst = dest;
- if (info_ptr->width != 8 || info_ptr->height != 10)
+ if (info_ptr->width != req_w || info_ptr->height != req_h)
{
- lprintf(__FILE__ ": unexpected selector image size %ix%i, needed 8x10\n",
- (int)info_ptr->width, (int)info_ptr->height);
+ lprintf(__FILE__ ": unexpected selector image size %ix%i, needed %dx%d\n",
+ (int)info_ptr->width, (int)info_ptr->height, req_w, req_h);
break;
}
if (info_ptr->pixel_depth != 8)
lprintf(__FILE__ ": selector image uses %ibpp, needed 8bpp\n", info_ptr->pixel_depth);
break;
}
- for (y1 = 0; y1 < 10; y1++)
+ for (y1 = 0; y1 < req_h; y1++)
{
unsigned char *src = row_ptr[y1];
- for (x1 = 8/2; x1 > 0; x1--, src+=2)
+ for (x1 = req_w/2; x1 > 0; x1--, src+=2)
*dst++ = ((src[0]^0xff) & 0xf0) | ((src[1]^0xff) >> 4);
}
break;
}
- case READPNG_320_24:
- case READPNG_480_24:
+ case READPNG_24:
{
int height, width, h;
- int needw = (what == READPNG_480_24) ? 480 : 320;
unsigned char *dst = dest;
if (info_ptr->pixel_depth != 24)
{
break;
}
height = info_ptr->height;
- if (height > 240) height = 240;
+ if (height > req_h)
+ height = req_h;
width = info_ptr->width;
- if (width > needw) width = needw;
+ if (width > req_w)
+ width = req_w;
for (h = 0; h < height; h++)
{
int len = width;
unsigned char *src = row_ptr[h];
- dst += (needw - width) * 3;
+ dst += (req_w - width) * 3;
for (len = width; len > 0; len--, dst+=3, src+=3)
dst[0] = src[2], dst[1] = src[1], dst[2] = src[0];
}
READPNG_BG = 1,
READPNG_FONT,
READPNG_SELECTOR,
- READPNG_320_24,
- READPNG_480_24
+ READPNG_24,
}
readpng_what;
extern "C" {
#endif
-int readpng(void *dest, const char *fname, readpng_what what);
+int readpng(void *dest, const char *fname, readpng_what what, int w, int h);
#ifdef __cplusplus
}
fbdev_mem_size = *w * *h * 2 * fbdev_buffer_count;
fbdev_mem = mmap(0, fbdev_mem_size, PROT_WRITE|PROT_READ, MAP_SHARED, fbdev, 0);
if (fbdev_mem == MAP_FAILED && fbdev_buffer_count > 1) {
+ fprintf(stderr, "Warning: can't map %d bytes, doublebuffering disabled\n", fbdev_mem_size);
fbdev_mem_size = *w * *h * 2;
fbdev_buffer_count = 1;
- fprintf(stderr, "Warning: can't map %d bytes, doublebuffering disabled\n", fbdev_mem_size);
fbdev_mem = mmap(0, fbdev_mem_size, PROT_WRITE|PROT_READ, MAP_SHARED, fbdev, 0);
}
if (fbdev_mem == MAP_FAILED) {
{ KEY_LEFT, PBTN_LEFT },
{ KEY_RIGHT, PBTN_RIGHT },
{ KEY_ENTER, PBTN_MOK },
- { KEY_KP2, PBTN_MOK },
+ { KEY_END, PBTN_MOK },
{ BTN_TRIGGER, PBTN_MOK },
{ KEY_ESC, PBTN_MBACK },
- { KEY_KP3, PBTN_MBACK },
+ { KEY_PAGEDOWN, PBTN_MBACK },
{ BTN_THUMB, PBTN_MBACK },
{ KEY_A, PBTN_MA2 },
- { KEY_KP4, PBTN_MA2 },
+ { KEY_HOME, PBTN_MA2 },
{ KEY_S, PBTN_MA3 },
- { KEY_KP1, PBTN_MA3 },
+ { KEY_PAGEUP, PBTN_MA3 },
{ KEY_BACKSLASH, PBTN_MENU },
{ KEY_LEFTCTRL, PBTN_MENU },
- { BTN_TL, PBTN_L },
+ { KEY_RIGHTSHIFT, PBTN_L },
{ KEY_LEFTBRACE, PBTN_L },
- { BTN_TR, PBTN_R },
+ { KEY_RIGHTCTRL, PBTN_R },
{ KEY_RIGHTBRACE, PBTN_R },
};
{ KEY_LEFT, IN_BINDTYPE_PLAYER12, 2 },
{ KEY_RIGHT, IN_BINDTYPE_PLAYER12, 3 },
{ KEY_S, IN_BINDTYPE_PLAYER12, 4 }, /* B */
- { KEY_KP3, IN_BINDTYPE_PLAYER12, 4 },
+ { KEY_PAGEDOWN, IN_BINDTYPE_PLAYER12, 4 },
{ KEY_D, IN_BINDTYPE_PLAYER12, 5 }, /* C */
- { KEY_KP2, IN_BINDTYPE_PLAYER12, 5 },
+ { KEY_END, IN_BINDTYPE_PLAYER12, 5 },
{ KEY_A, IN_BINDTYPE_PLAYER12, 6 }, /* A */
- { KEY_KP4, IN_BINDTYPE_PLAYER12, 6 },
+ { KEY_HOME, IN_BINDTYPE_PLAYER12, 6 },
{ KEY_ENTER, IN_BINDTYPE_PLAYER12, 7 },
{ KEY_LEFTALT, IN_BINDTYPE_PLAYER12, 7 },
- { BTN_TL, IN_BINDTYPE_EMU, PEVB_STATE_LOAD },
- { BTN_TR, IN_BINDTYPE_EMU, PEVB_STATE_SAVE },
- { KEY_LEFTCTRL, IN_BINDTYPE_EMU, PEVB_MENU },
+ { KEY_RIGHTSHIFT,IN_BINDTYPE_EMU, PEVB_STATE_SAVE },
+ { KEY_RIGHTCTRL, IN_BINDTYPE_EMU, PEVB_STATE_LOAD },
+ { KEY_LEFTCTRL, IN_BINDTYPE_EMU, PEVB_MENU },
};
#define DEF_BIND_COUNT (sizeof(in_evdev_def_binds) / sizeof(in_evdev_def_binds[0]))
#include <stdio.h>
#include <string.h>
#include <pthread.h>
+
#include <dlfcn.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <termios.h>
+#include <linux/kd.h>
+
+#define PFX "oshide: "
+#define TERMIOS_DUMP_FILE "/tmp/pico_tios"
+
#define FPTR(f) typeof(f) * p##f
#define FPTR_LINK(xf, dl, f) { \
xf.p##f = dlsym(dl, #f); \
visual = DefaultVisual(display, 0);
if (visual->class != TrueColor)
- {
- fprintf(stderr, "cannot handle non true color visual\n");
- xf.pXCloseDisplay(display);
- goto fail2;
- }
+ fprintf(stderr, PFX "warning: non true color visual\n");
- printf("x11h: X vendor: %s, rel: %d, display: %s, protocol ver: %d.%d\n", ServerVendor(display),
+ printf(PFX "X vendor: %s, rel: %d, display: %s, protocol ver: %d.%d\n", ServerVendor(display),
VendorRelease(display), DisplayString(display), ProtocolVersion(display),
ProtocolRevision(display));
display_width = DisplayWidth(display, screen);
display_height = DisplayHeight(display, screen);
- printf("x11h: display is %dx%d\n", display_width, display_height);
+ printf(PFX "display is %dx%d\n", display_width, display_height);
win = xf.pXCreateSimpleWindow(display,
RootWindow(display, screen),
return NULL;
}
-int x11h_init(void)
+static struct termios g_kbd_termios_saved;
+static int g_kbdfd;
+
+static void hidecon_start(void)
+{
+ struct termios kbd_termios;
+ FILE *tios_f;
+ int mode;
+
+ g_kbdfd = open("/dev/tty", O_RDWR);
+ if (g_kbdfd == -1) {
+ perror(PFX "open /dev/tty");
+ return;
+ }
+
+ if (ioctl(g_kbdfd, KDGETMODE, &mode) == -1) {
+ perror(PFX "(not hiding FB): KDGETMODE");
+ goto fail;
+ }
+
+ if (tcgetattr(g_kbdfd, &kbd_termios) == -1) {
+ perror(PFX "tcgetattr");
+ goto fail;
+ }
+
+ /* dump for picorestore */
+ g_kbd_termios_saved = kbd_termios;
+ tios_f = fopen(TERMIOS_DUMP_FILE, "wb");
+ if (tios_f) {
+ fwrite(&kbd_termios, sizeof(kbd_termios), 1, tios_f);
+ fclose(tios_f);
+ }
+
+ kbd_termios.c_lflag &= ~(ICANON | ECHO); // | ISIG);
+ kbd_termios.c_iflag &= ~(ISTRIP | IGNCR | ICRNL | INLCR | IXOFF | IXON);
+ kbd_termios.c_cc[VMIN] = 0;
+ kbd_termios.c_cc[VTIME] = 0;
+
+ if (tcsetattr(g_kbdfd, TCSAFLUSH, &kbd_termios) == -1) {
+ perror(PFX "tcsetattr");
+ goto fail;
+ }
+
+ if (ioctl(g_kbdfd, KDSETMODE, KD_GRAPHICS) == -1) {
+ perror(PFX "KDSETMODE KD_GRAPHICS");
+ tcsetattr(g_kbdfd, TCSAFLUSH, &g_kbd_termios_saved);
+ goto fail;
+ }
+
+ return;
+
+fail:
+ close(g_kbdfd);
+ g_kbdfd = -1;
+}
+
+static void hidecon_end(void)
+{
+ if (g_kbdfd < 0)
+ return;
+
+ if (ioctl(g_kbdfd, KDSETMODE, KD_TEXT) == -1)
+ perror(PFX "KDSETMODE KD_TEXT");
+
+ if (tcsetattr(g_kbdfd, TCSAFLUSH, &g_kbd_termios_saved) == -1)
+ perror(PFX "tcsetattr");
+
+ remove(TERMIOS_DUMP_FILE);
+
+ close(g_kbdfd);
+ g_kbdfd = -1;
+}
+
+int oshide_init(void)
{
pthread_t tid;
int ret;
ret = pthread_create(&tid, NULL, x11h_handler, NULL);
if (ret != 0) {
- fprintf(stderr, "x11h: failed to create thread: %d\n", ret);
+ fprintf(stderr, PFX "failed to create thread: %d\n", ret);
return ret;
}
pthread_detach(tid);
+ hidecon_start();
+
return 0;
}
+void oshide_finish(void)
+{
+ /* XXX: the X thread.. */
+
+ hidecon_end();
+}
+
#if 0
int main()
{
--- /dev/null
+int oshide_init(void);
+void oshide_finish(void);
+
+++ /dev/null
-int x11h_init(void);
-
platform/common/arm_utils.o platform/common/mp3_helix.o platform/common/arm_linux.o \\r
platform/common/readpng.o platform/common/input.o platform/common/main.o \\r
platform/linux/fbdev.o platform/linux/in_evdev.o platform/linux/sndout_oss.o \\r
- platform/linux/plat.o platform/linux/x11h.o\r
+ platform/linux/plat.o platform/linux/oshide.o\r
\r
# ARM stuff\r
OBJS += pico/carthw/svp/compiler.o pico/carthw/svp/stub_arm.o\r
vpath %.S = ../..\r
DIRS += platform/linux zlib unzip\r
\r
-all: mkdirs PicoDrive\r
+all: mkdirs PicoDrive picorestore\r
\r
include ../common/common.mak\r
include ../common/common_arm.mak\r
-void clut_line(void *dest, const void *src, const unsigned short *pal, int pixels_mask);
+void clut_line2x2(void *dest, const void *src, const unsigned short *pal, int pixels_mask);
+void clut_line3x2(void *dest, const void *src, const unsigned short *pal, int pixels_mask);
@ vim:filetype=armasm
-.global clut_line @ void *dest, void *src, unsigned short *pal, int pixels_mask
+@ FIXME: handle dual issue
+.global clut_line2x2 @ void *dest, void *src, unsigned short *pal, int pixels_mask
-clut_line:
+clut_line2x2:
stmfd sp!, {r4-r11,lr}
and lr, r3, #0xff0000
and r3, r3, #0xff @ counter
add r11,r0, #800*2
-clut_line_loop:
+clut_line_2x2_loop:
ldmia r1!, {r10,r12}
and r4, lr, r10, lsl #1
stmia r0!, {r4-r10,r12}
stmia r11!,{r4-r10,r12}
- bne clut_line_loop
+ bne clut_line_2x2_loop
+
+ ldmfd sp!, {r4-r11,pc}
+
+
+@ 00 01 11 22 23 33
+@ r4 r5 r6 r7 r8 r9
+
+.macro do_4_to_12 rs
+ and r4, lr, \rs, lsl #1
+ and r6, lr, \rs, lsr #7
+ and r7, lr, \rs, lsr #15
+ and r9, lr, \rs, lsr #23
+ ldrh r4, [r2, r4]
+ ldrh r6, [r2, r6]
+ ldrh r7, [r2, r7]
+ ldrh r9, [r2, r9]
+
+ orr r5, r4, r6, lsl #16
+ orr r4, r4, r4, lsl #16
+ orr r6, r6, r6, lsl #16
+
+ orr r8, r7, r9, lsl #16
+ orr r7, r7, r7, lsl #16
+ orr r9, r9, r9, lsl #16
+.endm
+
+
+.global clut_line3x2 @ void *dest, void *src, unsigned short *pal, int pixels_mask
+
+clut_line3x2:
+ stmfd sp!, {r4-r11,lr}
+
+ and lr, r3, #0xff0000
+ mov lr, lr, lsr #15 @ mask
+ mov r3, r3, lsr #3
+ and r3, r3, #0xff @ counter
+ add r11,r0, #800*2
+
+clut_line3x2_loop:
+ ldmia r1!, {r10,r12}
+
+ do_4_to_12 r10
+ stmia r0!, {r4-r9}
+ stmia r11!,{r4-r9}
+
+ do_4_to_12 r12
+ subs r3, r3, #1
+ stmia r0!, {r4-r9}
+ stmia r11!,{r4-r9}
+
+ bne clut_line3x2_loop
ldmfd sp!, {r4-r11,pc}
\r
#include <pico/pico_int.h>\r
\r
-//#define USE_320_SCREEN 1\r
-\r
\r
static short __attribute__((aligned(4))) sndBuffer[2*44100/50];\r
static unsigned char temp_frame[g_screen_width * g_screen_height * 2];\r
unsigned char *PicoDraw2FB = temp_frame;\r
const char *renderer_names[] = { NULL };\r
const char *renderer_names32x[] = { NULL };\r
-char cpu_clk_name[] = "unused";\r
+char cpu_clk_name[] = "Max CPU clock";\r
+\r
+enum {\r
+ SCALE_1x1,\r
+ SCALE_2x2_3x2,\r
+ SCALE_2x2_2x2,\r
+};\r
\r
+static int get_cpu_clock(void)\r
+{\r
+ FILE *f;\r
+ int ret = 0;\r
+ f = fopen("/proc/pandora/cpu_mhz_max", "r");\r
+ if (f) {\r
+ fscanf(f, "%d", &ret);\r
+ fclose(f);\r
+ }\r
+ return ret;\r
+}\r
\r
void pemu_prep_defconfig(void)\r
{\r
g_menubg_ptr = temp_frame;\r
\r
defaultConfig.EmuOpt |= EOPT_VSYNC;\r
+ defaultConfig.scaling = SCALE_2x2_3x2;\r
}\r
\r
void pemu_validate_config(void)\r
{\r
+ currentConfig.CPUclock = get_cpu_clock();\r
}\r
\r
// FIXME: cleanup\r
}\r
}\r
\r
-#ifdef USE_320_SCREEN\r
-\r
-static int EmuScanBegin16(unsigned int num)\r
+static int emuscan_1x1(unsigned int num)\r
{\r
DrawLineDest = (unsigned short *)g_screen_ptr + num*800 + 800/2 - 320/2;\r
//int w = (Pico.video.reg[12]&1) ? 320 : 256;\r
return 0;\r
}\r
\r
-#else // USE_320_SCREEN\r
-\r
-static int EmuScanEnd16(unsigned int num)\r
-{\r
- unsigned char *ps=HighCol+8;\r
- unsigned short *pd;\r
- unsigned short *pal=HighPal;\r
- int sh = Pico.video.reg[0xC]&8;\r
- int len, mask = 0xff;\r
-\r
- pd=(unsigned short *)g_screen_ptr + num*800*2 + 800/2 - 320*2/2;\r
-\r
- if (Pico.m.dirtyPal)\r
- PicoDoHighPal555(sh);\r
-\r
- if (Pico.video.reg[12]&1) {\r
- len = 320;\r
- } else {\r
- pd += 32*2;\r
- len = 256;\r
- }\r
-\r
- if (!sh && (rendstatus & PDRAW_SPR_LO_ON_HI))\r
- mask=0x3f; // messed sprites, upper bits are priority stuff\r
-\r
-#if 1\r
- clut_line(pd, ps, pal, (mask<<16) | len);\r
-#else\r
- for (; len > 0; len--)\r
- {\r
- unsigned int p = pal[*ps++ & mask];\r
- p |= p << 16;\r
- *(unsigned int *)pd = p;\r
- *(unsigned int *)(&pd[800]) = p;\r
- pd += 2;\r
- }\r
-#endif\r
-\r
- return 0;\r
+#define MAKE_EMUSCAN(name_, clut_name_, offs_, len_) \\r
+static int name_(unsigned int num) \\r
+{ \\r
+ unsigned char *ps = HighCol+8; \\r
+ unsigned short *pd, *pal = HighPal; \\r
+ int sh = Pico.video.reg[0xC] & 8; \\r
+ int mask = 0xff; \\r
+ \\r
+ pd = (unsigned short *)g_screen_ptr + num*800*2 + offs_;\\r
+ \\r
+ if (Pico.m.dirtyPal) \\r
+ PicoDoHighPal555(sh); \\r
+ \\r
+ if (!sh && (rendstatus & PDRAW_SPR_LO_ON_HI)) \\r
+ mask = 0x3f; /* upper bits are priority stuff */\\r
+ \\r
+ clut_line##clut_name_(pd, ps, pal, (mask<<16) | len_); \\r
+ \\r
+ return 0; \\r
}\r
\r
+MAKE_EMUSCAN(emuscan_2x2_40, 2x2, 800/2 - 320*2/2, 320)\r
+MAKE_EMUSCAN(emuscan_2x2_32, 2x2, 800/2 - 256*2/2, 256)\r
+MAKE_EMUSCAN(emuscan_3x2_32, 3x2, 800/2 - 256*3/2, 256)\r
+\r
+#if 0 /* FIXME */\r
static int EmuScanEnd16_32x(unsigned int num)\r
{\r
unsigned int *ps;\r
\r
return 0;\r
}\r
-#endif // USE_320_SCREEN\r
+#endif\r
\r
void pemu_finalize_frame(const char *fps, const char *notice)\r
{\r
for (i = 0; i < fbdev_buffer_count; i++)\r
memset32(fbdev_buffers[i], 0, g_screen_width * g_screen_height * 2 / 4);\r
\r
-#ifdef USE_320_SCREEN\r
- PicoDrawSetOutFormat(PDF_RGB555, 1);\r
- PicoScanBegin = EmuScanBegin16;\r
-#else\r
+ PicoScanBegin = NULL;\r
+ PicoScanEnd = NULL;\r
+\r
+#if 0\r
if (PicoAHW & PAHW_32X) {\r
+ /* FIXME */\r
DrawLineDest = (unsigned short *)temp_frame;\r
PicoDrawSetOutFormat(PDF_RGB555, 1);\r
- PicoScanBegin = NULL;\r
PicoScanEnd = EmuScanEnd16_32x;\r
- } else {\r
- PicoDrawSetOutFormat(PDF_NONE, 0);\r
- PicoScanBegin = NULL;\r
- PicoScanEnd = EmuScanEnd16;\r
- }\r
+ } else\r
#endif\r
+ {\r
+ switch (currentConfig.scaling) {\r
+ case SCALE_1x1:\r
+ PicoDrawSetOutFormat(PDF_RGB555, 1);\r
+ PicoScanBegin = emuscan_1x1;\r
+ break;\r
+ case SCALE_2x2_3x2:\r
+ PicoDrawSetOutFormat(PDF_NONE, 0);\r
+ PicoScanEnd = is_32cols ? emuscan_3x2_32 : emuscan_2x2_40;\r
+ break;\r
+ case SCALE_2x2_2x2:\r
+ PicoDrawSetOutFormat(PDF_NONE, 0);\r
+ PicoScanEnd = is_32cols ? emuscan_2x2_32 : emuscan_2x2_40;\r
+ break;\r
+ }\r
+ }\r
}\r
\r
void pemu_loop_prep(void)\r
{\r
emu_video_mode_change(0, 0, 0);\r
+ \r
+ if (currentConfig.CPUclock != get_cpu_clock()) {\r
+ FILE *f = fopen("/proc/pandora/cpu_mhz_max", "w");\r
+ if (f != NULL) {\r
+ fprintf(f, "%d\n", currentConfig.CPUclock);\r
+ fclose(f);\r
+ }\r
+ }\r
+\r
pemu_sound_start();\r
}\r
\r
\r
now = plat_get_ticks_us();\r
\r
- // XXX: need to check NOHZ and djw kernel\r
+ // XXX: need to check NOHZ\r
diff = (signed int)(us_to - now);\r
if (diff > 10000) {\r
//printf("sleep %d\n", us_to - now);\r
" base code of PicoDrive\n"\r
"Reesy & FluBBa: DrZ80 core\n"\r
"MAME devs: YM2612 and SN76496 cores\n"\r
- "rlyeh and others: minimal SDK\n"\r
- "Squidge: mmuhack\n"\r
- "Dzz: ARM940 sample\n"\r
- "GnoStiC / Puck2099: USB joy code\n"\r
- "craigix: GP2X hardware\n"\r
- "ketchupgun: skin design\n"\r
+ "Pandora team: Pandora\n"\r
+ "Inder: menu bg\n"\r
"\n"\r
"special thanks (for docs, ideas):\n"\r
" Charles MacDonald, Haze,\n"\r
+static const char *men_scaler[] = { "1x1, 1x1", "2x2, 3x2", "2x2, 2x2", NULL };
+static const char h_scaler[] = "Scalers for 40 and 32 column modes\n"
+ "(320 and 256 pixel wide horizontal)";
+
#define MENU_OPTIONS_GFX \
- mee_onoff ("Vsync", MA_OPT2_VSYNC, currentConfig.EmuOpt, EOPT_VSYNC),
+ mee_onoff ("Vsync", MA_OPT2_VSYNC, currentConfig.EmuOpt, EOPT_VSYNC), \
+ mee_enum_h ("Scaler", MA_OPT_SCALING, currentConfig.scaling, \
+ men_scaler, h_scaler),
#define MENU_OPTIONS_ADV \
mee_onoff ("SVP dynarec", MA_OPT2_SVP_DYNAREC, PicoOpt, POPT_EN_SVP_DRC), \
\r
#include "../linux/sndout_oss.h"\r
#include "../linux/fbdev.h"\r
-#include "../linux/x11h.h"\r
+#include "../linux/oshide.h"\r
#include "../common/emu.h"\r
\r
void plat_early_init(void)\r
{\r
int ret, w, h;\r
\r
- x11h_init();\r
+ oshide_init();\r
\r
ret = vout_fbdev_init(&w, &h);\r
if (ret != 0) {\r
{\r
sndout_oss_exit();\r
vout_fbdev_finish();\r
+ oshide_finish();\r
\r
- printf("all done");\r
+ printf("all done\n");\r
}\r
\r
/* lprintf */\r
--- /dev/null
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <linux/fb.h>
+#include <termios.h>
+#include <linux/kd.h>
+
+int main()
+{
+ struct fb_var_screeninfo fbvar;
+ struct termios kbd_termios;
+ int ret, fbdev, kbdfd;
+ FILE *tios_f;
+
+ fbdev = open("/dev/fb0", O_RDWR);
+ if (fbdev == -1) {
+ perror("open");
+ return 1;
+ }
+
+ ret = ioctl(fbdev, FBIOGET_VSCREENINFO, &fbvar);
+ if (ret == -1) {
+ perror("FBIOGET_VSCREENINFO ioctl");
+ goto end_fb;
+ }
+
+ if (fbvar.yoffset != 0) {
+ printf("fixing yoffset.. ");
+ fbvar.yoffset = 0;
+ ret = ioctl(fbdev, FBIOPAN_DISPLAY, &fbvar);
+ if (ret < 0)
+ perror("ioctl FBIOPAN_DISPLAY");
+ else
+ printf("ok\n");
+ }
+
+end_fb:
+ close(fbdev);
+
+ tios_f = fopen("/tmp/pico_tios", "rb");
+ if (tios_f != NULL) {
+ kbdfd = open("/dev/tty", O_RDWR);
+ if (kbdfd == -1) {
+ perror("open /dev/tty");
+ return 1;
+ }
+
+ if (fread(&kbd_termios, sizeof(kbd_termios), 1, tios_f) == 1) {
+ if (ioctl(kbdfd, KDSETMODE, KD_TEXT) == -1)
+ perror("KDSETMODE KD_TEXT");
+
+ printf("restoring termios.. ");
+ if (tcsetattr(kbdfd, TCSAFLUSH, &kbd_termios) == -1)
+ perror("tcsetattr");
+ else
+ printf("ok\n");
+ }
+
+ close(kbdfd);
+ fclose(tios_f);
+ }
+
+ return 0;
+}
\r
bmem = calloc(1, is_480 ? 480*240*3 : 320*240*3);\r
if (bmem == NULL) return NULL;\r
- ret = readpng(bmem, fname, is_480 ? READPNG_480_24 : READPNG_320_24);\r
+ ret = readpng(bmem, fname, READPNG_24, is_480 ? 480 : 320, 240);\r
if (ret != 0) {\r
free(bmem);\r
return NULL;\r