mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
tweaking pandora frontend
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@874 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
03065bb617
commit
be672de78d
16 changed files with 378 additions and 144 deletions
|
@ -49,7 +49,7 @@ OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o pla
|
|||
platform/common/arm_utils.o platform/common/mp3_helix.o platform/common/arm_linux.o \
|
||||
platform/common/readpng.o platform/common/input.o platform/common/main.o \
|
||||
platform/linux/fbdev.o platform/linux/in_evdev.o platform/linux/sndout_oss.o \
|
||||
platform/linux/plat.o platform/linux/x11h.o
|
||||
platform/linux/plat.o platform/linux/oshide.o
|
||||
|
||||
# ARM stuff
|
||||
OBJS += pico/carthw/svp/compiler.o pico/carthw/svp/stub_arm.o
|
||||
|
@ -66,7 +66,7 @@ vpath %.s = ../..
|
|||
vpath %.S = ../..
|
||||
DIRS += platform/linux zlib unzip
|
||||
|
||||
all: mkdirs PicoDrive
|
||||
all: mkdirs PicoDrive picorestore
|
||||
|
||||
include ../common/common.mak
|
||||
include ../common/common_arm.mak
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
|
||||
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);
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
@ 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
|
||||
|
@ -12,7 +13,7 @@ clut_line:
|
|||
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
|
||||
|
@ -50,7 +51,58 @@ clut_line_loop:
|
|||
|
||||
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}
|
||||
|
||||
|
|
|
@ -17,16 +17,31 @@
|
|||
|
||||
#include <pico/pico_int.h>
|
||||
|
||||
//#define USE_320_SCREEN 1
|
||||
|
||||
|
||||
static short __attribute__((aligned(4))) sndBuffer[2*44100/50];
|
||||
static unsigned char temp_frame[g_screen_width * g_screen_height * 2];
|
||||
unsigned char *PicoDraw2FB = temp_frame;
|
||||
const char *renderer_names[] = { NULL };
|
||||
const char *renderer_names32x[] = { NULL };
|
||||
char cpu_clk_name[] = "unused";
|
||||
char cpu_clk_name[] = "Max CPU clock";
|
||||
|
||||
enum {
|
||||
SCALE_1x1,
|
||||
SCALE_2x2_3x2,
|
||||
SCALE_2x2_2x2,
|
||||
};
|
||||
|
||||
static int get_cpu_clock(void)
|
||||
{
|
||||
FILE *f;
|
||||
int ret = 0;
|
||||
f = fopen("/proc/pandora/cpu_mhz_max", "r");
|
||||
if (f) {
|
||||
fscanf(f, "%d", &ret);
|
||||
fclose(f);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void pemu_prep_defconfig(void)
|
||||
{
|
||||
|
@ -34,10 +49,12 @@ void pemu_prep_defconfig(void)
|
|||
g_menubg_ptr = temp_frame;
|
||||
|
||||
defaultConfig.EmuOpt |= EOPT_VSYNC;
|
||||
defaultConfig.scaling = SCALE_2x2_3x2;
|
||||
}
|
||||
|
||||
void pemu_validate_config(void)
|
||||
{
|
||||
currentConfig.CPUclock = get_cpu_clock();
|
||||
}
|
||||
|
||||
// FIXME: cleanup
|
||||
|
@ -94,9 +111,7 @@ static void draw_cd_leds(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef USE_320_SCREEN
|
||||
|
||||
static int EmuScanBegin16(unsigned int num)
|
||||
static int emuscan_1x1(unsigned int num)
|
||||
{
|
||||
DrawLineDest = (unsigned short *)g_screen_ptr + num*800 + 800/2 - 320/2;
|
||||
//int w = (Pico.video.reg[12]&1) ? 320 : 256;
|
||||
|
@ -105,47 +120,32 @@ static int EmuScanBegin16(unsigned int num)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#else // USE_320_SCREEN
|
||||
|
||||
static int EmuScanEnd16(unsigned int num)
|
||||
{
|
||||
unsigned char *ps=HighCol+8;
|
||||
unsigned short *pd;
|
||||
unsigned short *pal=HighPal;
|
||||
int sh = Pico.video.reg[0xC]&8;
|
||||
int len, mask = 0xff;
|
||||
|
||||
pd=(unsigned short *)g_screen_ptr + num*800*2 + 800/2 - 320*2/2;
|
||||
|
||||
if (Pico.m.dirtyPal)
|
||||
PicoDoHighPal555(sh);
|
||||
|
||||
if (Pico.video.reg[12]&1) {
|
||||
len = 320;
|
||||
} else {
|
||||
pd += 32*2;
|
||||
len = 256;
|
||||
}
|
||||
|
||||
if (!sh && (rendstatus & PDRAW_SPR_LO_ON_HI))
|
||||
mask=0x3f; // messed sprites, upper bits are priority stuff
|
||||
|
||||
#if 1
|
||||
clut_line(pd, ps, pal, (mask<<16) | len);
|
||||
#else
|
||||
for (; len > 0; len--)
|
||||
{
|
||||
unsigned int p = pal[*ps++ & mask];
|
||||
p |= p << 16;
|
||||
*(unsigned int *)pd = p;
|
||||
*(unsigned int *)(&pd[800]) = p;
|
||||
pd += 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
#define MAKE_EMUSCAN(name_, clut_name_, offs_, len_) \
|
||||
static int name_(unsigned int num) \
|
||||
{ \
|
||||
unsigned char *ps = HighCol+8; \
|
||||
unsigned short *pd, *pal = HighPal; \
|
||||
int sh = Pico.video.reg[0xC] & 8; \
|
||||
int mask = 0xff; \
|
||||
\
|
||||
pd = (unsigned short *)g_screen_ptr + num*800*2 + offs_;\
|
||||
\
|
||||
if (Pico.m.dirtyPal) \
|
||||
PicoDoHighPal555(sh); \
|
||||
\
|
||||
if (!sh && (rendstatus & PDRAW_SPR_LO_ON_HI)) \
|
||||
mask = 0x3f; /* upper bits are priority stuff */\
|
||||
\
|
||||
clut_line##clut_name_(pd, ps, pal, (mask<<16) | len_); \
|
||||
\
|
||||
return 0; \
|
||||
}
|
||||
|
||||
MAKE_EMUSCAN(emuscan_2x2_40, 2x2, 800/2 - 320*2/2, 320)
|
||||
MAKE_EMUSCAN(emuscan_2x2_32, 2x2, 800/2 - 256*2/2, 256)
|
||||
MAKE_EMUSCAN(emuscan_3x2_32, 3x2, 800/2 - 256*3/2, 256)
|
||||
|
||||
#if 0 /* FIXME */
|
||||
static int EmuScanEnd16_32x(unsigned int num)
|
||||
{
|
||||
unsigned int *ps;
|
||||
|
@ -171,7 +171,7 @@ static int EmuScanEnd16_32x(unsigned int num)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif // USE_320_SCREEN
|
||||
#endif
|
||||
|
||||
void pemu_finalize_frame(const char *fps, const char *notice)
|
||||
{
|
||||
|
@ -337,26 +337,47 @@ void emu_video_mode_change(int start_line, int line_count, int is_32cols)
|
|||
for (i = 0; i < fbdev_buffer_count; i++)
|
||||
memset32(fbdev_buffers[i], 0, g_screen_width * g_screen_height * 2 / 4);
|
||||
|
||||
#ifdef USE_320_SCREEN
|
||||
PicoDrawSetOutFormat(PDF_RGB555, 1);
|
||||
PicoScanBegin = EmuScanBegin16;
|
||||
#else
|
||||
PicoScanBegin = NULL;
|
||||
PicoScanEnd = NULL;
|
||||
|
||||
#if 0
|
||||
if (PicoAHW & PAHW_32X) {
|
||||
/* FIXME */
|
||||
DrawLineDest = (unsigned short *)temp_frame;
|
||||
PicoDrawSetOutFormat(PDF_RGB555, 1);
|
||||
PicoScanBegin = NULL;
|
||||
PicoScanEnd = EmuScanEnd16_32x;
|
||||
} else {
|
||||
PicoDrawSetOutFormat(PDF_NONE, 0);
|
||||
PicoScanBegin = NULL;
|
||||
PicoScanEnd = EmuScanEnd16;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
switch (currentConfig.scaling) {
|
||||
case SCALE_1x1:
|
||||
PicoDrawSetOutFormat(PDF_RGB555, 1);
|
||||
PicoScanBegin = emuscan_1x1;
|
||||
break;
|
||||
case SCALE_2x2_3x2:
|
||||
PicoDrawSetOutFormat(PDF_NONE, 0);
|
||||
PicoScanEnd = is_32cols ? emuscan_3x2_32 : emuscan_2x2_40;
|
||||
break;
|
||||
case SCALE_2x2_2x2:
|
||||
PicoDrawSetOutFormat(PDF_NONE, 0);
|
||||
PicoScanEnd = is_32cols ? emuscan_2x2_32 : emuscan_2x2_40;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void pemu_loop_prep(void)
|
||||
{
|
||||
emu_video_mode_change(0, 0, 0);
|
||||
|
||||
if (currentConfig.CPUclock != get_cpu_clock()) {
|
||||
FILE *f = fopen("/proc/pandora/cpu_mhz_max", "w");
|
||||
if (f != NULL) {
|
||||
fprintf(f, "%d\n", currentConfig.CPUclock);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
||||
pemu_sound_start();
|
||||
}
|
||||
|
||||
|
@ -388,7 +409,7 @@ void plat_wait_till_us(unsigned int us_to)
|
|||
|
||||
now = plat_get_ticks_us();
|
||||
|
||||
// XXX: need to check NOHZ and djw kernel
|
||||
// XXX: need to check NOHZ
|
||||
diff = (signed int)(us_to - now);
|
||||
if (diff > 10000) {
|
||||
//printf("sleep %d\n", us_to - now);
|
||||
|
@ -412,12 +433,8 @@ const char *plat_get_credits(void)
|
|||
" base code of PicoDrive\n"
|
||||
"Reesy & FluBBa: DrZ80 core\n"
|
||||
"MAME devs: YM2612 and SN76496 cores\n"
|
||||
"rlyeh and others: minimal SDK\n"
|
||||
"Squidge: mmuhack\n"
|
||||
"Dzz: ARM940 sample\n"
|
||||
"GnoStiC / Puck2099: USB joy code\n"
|
||||
"craigix: GP2X hardware\n"
|
||||
"ketchupgun: skin design\n"
|
||||
"Pandora team: Pandora\n"
|
||||
"Inder: menu bg\n"
|
||||
"\n"
|
||||
"special thanks (for docs, ideas):\n"
|
||||
" Charles MacDonald, Haze,\n"
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
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), \
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "../linux/sndout_oss.h"
|
||||
#include "../linux/fbdev.h"
|
||||
#include "../linux/x11h.h"
|
||||
#include "../linux/oshide.h"
|
||||
#include "../common/emu.h"
|
||||
|
||||
void plat_early_init(void)
|
||||
|
@ -15,7 +15,7 @@ void plat_init(void)
|
|||
{
|
||||
int ret, w, h;
|
||||
|
||||
x11h_init();
|
||||
oshide_init();
|
||||
|
||||
ret = vout_fbdev_init(&w, &h);
|
||||
if (ret != 0) {
|
||||
|
@ -37,8 +37,9 @@ void plat_finish(void)
|
|||
{
|
||||
sndout_oss_exit();
|
||||
vout_fbdev_finish();
|
||||
oshide_finish();
|
||||
|
||||
printf("all done");
|
||||
printf("all done\n");
|
||||
}
|
||||
|
||||
/* lprintf */
|
||||
|
|
67
platform/pandora/picorestore.c
Normal file
67
platform/pandora/picorestore.c
Normal file
|
@ -0,0 +1,67 @@
|
|||
#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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue