remove PicoDrive-specific stuff, add readme

This commit is contained in:
notaz 2012-09-08 20:31:36 +03:00 committed by Grazvydas Ignotas
parent ca69c3e5a0
commit f506842df2
73 changed files with 13 additions and 16178 deletions

View file

@ -1,97 +0,0 @@
# settings
#use_fbdev = 1
#fake_in_gp2x = 1
use_musashi = 1
#use_fame = 1
use_cz80 = 1
use_sh2drc = 1
#use_sh2mame = 1
#drc_debug = 3
#drc_debug_interp = 1
#profile = 1
all: mkdirs PicoDrive
-include Makefile.local
ifndef ARCH
ARCH = x86
endif
DEFINES = _UNZIP_SUPPORT IO_STATS IN_EVDEV
CFLAGS += -ggdb -Wall -falign-functions=2
CFLAGS += -I../.. -I.
LDFLAGS += -lm -lpng
ifeq "$(ARCH)" "arm"
CFLAGS += -mcpu=arm920t
DEFINES += ARM
endif
CC ?= $(CROSS)gcc
# frontend
OBJS += io.o emu.o blit.o in_evdev.o plat.o sndout_oss.o log_io.o
# common
OBJS += platform/common/main.o platform/common/emu.o platform/common/menu_pico.o \
platform/common/config.o platform/common/fonts.o platform/common/readpng.o \
platform/common/input.o
ifeq "$(use_fbdev)" "1"
DEFINES += FBDEV
OBJS += fbdev.o
else
LDFLAGS += -lpthread
LDFLAGS += -lX11
endif
ifeq "$(fake_in_gp2x)" "1"
DEFINES += IN_GP2X FAKE_IN_GP2X
OBJS += platform/gp2x/in_gp2x.o
DIRS += platform/gp2x
endif
ifeq "$(ARCH)" "arm"
OBJS += pico/carthw/svp/stub_arm.o
endif
OBJS += pico/sound/mix.o
OBJS += pico/carthw/svp/compiler.o
# zlib
OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \
zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o zlib/uncompr.o
# unzip
OBJS += unzip/unzip.o unzip/unzip_stream.o
vpath %.c = ../..
vpath %.s = ../..
vpath %.S = ../..
vpath %.asm = ../..
DIRS += platform/linux zlib unzip
include ../common/common.mak
include ../common/revision.mak
CFLAGS += $(addprefix -D,$(DEFINES))
clean: tidy
@$(RM) PicoDrive
tidy:
$(RM) $(OBJS)
rm -rf $(DIRS)
@make -C ../../cpu/mz80/ clean
PicoDrive : $(OBJS)
@echo ">>>" $@
$(CC) $(CFLAGS) $^ $(LDFLAGS) -Wl,-Map=PicoDrive.map -o $@
pprof: pprof.c
$(CROSS)gcc -O2 -ggdb -DPPROF -DPPROF_TOOL -I../../ -I. $^ -o $@
%.o : %.asm
@echo ">>>" $<
nasm -f elf $< -o $@

View file

@ -1,4 +0,0 @@
This port tries to emulate gp2x environment on a standard linux box for testing
(i.e. to be able to use things like valgrind and efence, gcc runtime
optimizations, etc.).

View file

@ -1,83 +0,0 @@
// Convert 0000bbb0 ggg0rrr0 0000bbb0 ggg0rrr0
// to 00000000 rrr00000 ggg00000 bbb00000 ...
// TODO: rm when gp2x/emu.c is no longer used
void bgr444_to_rgb32(void *to, void *from)
{
unsigned short *ps = from;
unsigned int *pd = to;
int pixels;
for (pixels = 0x40; pixels; pixels--, ps++, pd++)
{
*pd = ((*ps<<20)&0xe00000) | ((*ps<<8)&0xe000) | ((*ps>>4)&0xe0);
*pd |= *pd >> 3;
}
}
void bgr444_to_rgb32_sh(void *to, void *from)
{
unsigned short *ps = from;
unsigned int *pd = to;
int pixels;
pd += 0x40;
for (pixels = 0x40; pixels; pixels--, ps++, pd++)
{
*pd = ((*ps<<20)&0xe00000) | ((*ps<<8)&0xe000) | ((*ps>>4)&0xe0);
*pd >>= 1;
*pd |= *pd >> 3;
pd[0x40*2] = *pd;
}
ps -= 0x40;
for (pixels = 0x40; pixels; pixels--, ps++, pd++)
{
*pd = ((*ps<<20)&0xe00000) | ((*ps<<8)&0xe000) | ((*ps>>4)&0xe0);
continue;
*pd += 0x00404040;
if (*pd & 0x01000000) *pd |= 0x00e00000;
if (*pd & 0x00010000) *pd |= 0x0000e000;
if (*pd & 0x00000100) *pd |= 0x000000e0;
*pd &= 0x00e0e0e0;
*pd |= *pd >> 3;
}
}
void vidcpy_m2(void *dest, void *src, int m32col, int with_32c_border)
{
unsigned char *pd = dest, *ps = src;
int i, u;
if (m32col) {
for (i = 0; i < 224; i++)
{
ps += 8;
pd += 32;
for (u = 0; u < 256; u++)
*pd++ = *ps++;
ps += 64;
pd += 32;
}
} else {
for (i = 0; i < 224; i++)
{
ps += 8;
for (u = 0; u < 320; u++)
*pd++ = *ps++;
}
}
}
void vidcpy_m2_rot(void *dest, void *src, int m32col, int with_32c_border)
{
}
void rotated_blit8 (void *dst, void *linesx4, int y, int is_32col)
{
}
void rotated_blit16(void *dst, void *linesx4, int y, int is_32col)
{
}

View file

@ -1,300 +0,0 @@
// (c) Copyright 2006-2009 notaz, All rights reserved.
// Free for non-commercial use.
// For commercial use, separate licencing terms must be obtained.
#include <stdio.h>
#include <unistd.h>
#include "../common/emu.h"
#include "../common/menu.h"
#include "../common/plat.h"
#include "../common/arm_utils.h"
#include "../linux/sndout_oss.h"
#include "version.h"
#include <pico/pico_int.h>
static short __attribute__((aligned(4))) sndBuffer[2*44100/50];
const char *renderer_names[] = { "16bit accurate", " 8bit accurate", " 8bit fast", NULL };
const char *renderer_names32x[] = { "accurate", "faster", "fastest", NULL };
enum renderer_types { RT_16BIT, RT_8BIT_ACC, RT_8BIT_FAST, RT_COUNT };
void pemu_prep_defconfig(void)
{
}
void pemu_validate_config(void)
{
extern int PicoOpt;
// PicoOpt &= ~POPT_EXT_FM;
PicoOpt &= ~POPT_EN_SVP_DRC;
}
// FIXME: dupes from GP2X, need cleanup
static void (*osd_text)(int x, int y, const char *text);
/*
static void osd_text8(int x, int y, const char *text)
{
int len = strlen(text)*8;
int *p, i, h, offs;
len = (len+3) >> 2;
for (h = 0; h < 8; h++) {
offs = (x + g_screen_width * (y+h)) & ~3;
p = (int *) ((char *)g_screen_ptr + offs);
for (i = len; i; i--, p++)
*p = 0xe0e0e0e0;
}
emu_text_out8(x, y, text);
}
*/
static void osd_text16(int x, int y, const char *text)
{
int len = strlen(text)*8;
int *p, i, h, offs;
len = (len+1) >> 1;
for (h = 0; h < 8; h++) {
offs = (x + g_screen_width * (y+h)) & ~1;
p = (int *) ((short *)g_screen_ptr + offs);
for (i = len; i; i--, p++)
*p = (*p >> 2) & 0x39e7;
}
emu_text_out16(x, y, text);
}
static void draw_cd_leds(void)
{
int led_reg, pitch, scr_offs, led_offs;
led_reg = Pico_mcd->s68k_regs[0];
pitch = 320;
led_offs = 4;
scr_offs = pitch * 2 + 4;
if (currentConfig.renderer != RT_16BIT) {
#define p(x) px[(x) >> 2]
// 8-bit modes
unsigned int *px = (unsigned int *)((char *)g_screen_ptr + scr_offs);
unsigned int col_g = (led_reg & 2) ? 0xc0c0c0c0 : 0xe0e0e0e0;
unsigned int col_r = (led_reg & 1) ? 0xd0d0d0d0 : 0xe0e0e0e0;
p(pitch*0) = p(pitch*1) = p(pitch*2) = col_g;
p(pitch*0 + led_offs) = p(pitch*1 + led_offs) = p(pitch*2 + led_offs) = col_r;
#undef p
} else {
#define p(x) px[(x)*2 >> 2] = px[((x)*2 >> 2) + 1]
// 16-bit modes
unsigned int *px = (unsigned int *)((short *)g_screen_ptr + scr_offs);
unsigned int col_g = (led_reg & 2) ? 0x06000600 : 0;
unsigned int col_r = (led_reg & 1) ? 0xc000c000 : 0;
p(pitch*0) = p(pitch*1) = p(pitch*2) = col_g;
p(pitch*0 + led_offs) = p(pitch*1 + led_offs) = p(pitch*2 + led_offs) = col_r;
#undef p
}
}
void pemu_finalize_frame(const char *fps, const char *notice)
{
if (currentConfig.renderer != RT_16BIT && !(PicoAHW & PAHW_32X)) {
unsigned short *pd = (unsigned short *)g_screen_ptr + 8 * g_screen_width;
unsigned char *ps = PicoDraw2FB + 328*8 + 8;
unsigned short *pal = HighPal;
int i, x;
if (Pico.m.dirtyPal)
PicoDrawUpdateHighPal();
for (i = 0; i < 224; i++, ps += 8)
for (x = 0; x < 320; x++)
*pd++ = pal[*ps++];
}
if (notice || (currentConfig.EmuOpt & EOPT_SHOW_FPS)) {
if (notice)
osd_text(4, g_screen_height - 8, notice);
if (currentConfig.EmuOpt & EOPT_SHOW_FPS)
osd_text(g_screen_width - 60, g_screen_height - 8, fps);
}
if ((PicoAHW & PAHW_MCD) && (currentConfig.EmuOpt & EOPT_EN_CD_LEDS))
draw_cd_leds();
}
static void apply_renderer(void)
{
switch (currentConfig.renderer) {
case RT_16BIT:
PicoOpt &= ~POPT_ALT_RENDERER;
PicoDrawSetOutFormat(PDF_RGB555, 0);
PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
break;
case RT_8BIT_ACC:
PicoOpt &= ~POPT_ALT_RENDERER;
PicoDrawSetOutFormat(PDF_8BIT, 0);
PicoDrawSetOutBuf(PicoDraw2FB + 8, 328);
break;
case RT_8BIT_FAST:
PicoOpt |= POPT_ALT_RENDERER;
PicoDrawSetOutFormat(PDF_NONE, 0);
break;
}
if (PicoAHW & PAHW_32X) {
int only_32x = 0;
if (currentConfig.renderer == RT_16BIT)
only_32x = 1;
else
PicoDrawSetOutFormat(PDF_NONE, 0);
PicoDraw32xSetFrameMode(1, only_32x);
PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
}
//PicoDraw32xSetFrameMode(0, 0);
//PicoDrawSetOutFormat(PDF_RGB555, 1);
}
void plat_video_toggle_renderer(int change, int is_menu)
{
currentConfig.renderer += change;
if (currentConfig.renderer >= RT_COUNT)
currentConfig.renderer = 0;
else if (currentConfig.renderer < 0)
currentConfig.renderer = RT_COUNT - 1;
if (!is_menu)
apply_renderer();
emu_status_msg(renderer_names[currentConfig.renderer]);
}
void plat_video_menu_enter(int is_rom_loaded)
{
}
void plat_video_menu_begin(void)
{
g_menuscreen_ptr = g_screen_ptr;
}
void plat_video_menu_end(void)
{
plat_video_flip();
}
void plat_status_msg_clear(void)
{
unsigned short *d = (unsigned short *)g_screen_ptr + g_screen_width * g_screen_height;
int l = g_screen_width * 8;
memset32((int *)(d - l), 0, l * 2 / 4);
}
void plat_status_msg_busy_next(const char *msg)
{
plat_status_msg_clear();
pemu_finalize_frame("", msg);
plat_video_flip();
emu_status_msg("");
reset_timing = 1;
}
void plat_status_msg_busy_first(const char *msg)
{
// memset32(g_screen_ptr, 0, g_screen_width * g_screen_height * 2 / 4);
plat_status_msg_busy_next(msg);
}
void plat_update_volume(int has_changed, int is_up)
{
}
void pemu_forced_frame(int no_scale, int do_emu)
{
PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
PicoDraw32xSetFrameMode(0, 0);
PicoDrawSetCallbacks(NULL, NULL);
Pico.m.dirtyPal = 1;
emu_cmn_forced_frame(no_scale, do_emu);
g_menubg_src_ptr = g_screen_ptr;
}
static void oss_write_nonblocking(int len)
{
// sndout_oss_can_write() is not reliable, only use with no_frmlimit
if ((currentConfig.EmuOpt & EOPT_NO_FRMLIMIT) && !sndout_oss_can_write(len))
return;
sndout_oss_write_nb(PsndOut, len);
}
void pemu_sound_start(void)
{
PsndOut = NULL;
if (currentConfig.EmuOpt & EOPT_EN_SOUND)
{
int is_stereo = (PicoOpt & POPT_EN_STEREO) ? 1 : 0;
PsndRerate(Pico.m.frame_count ? 1 : 0);
printf("starting audio: %i len: %i stereo: %i, pal: %i\n",
PsndRate, PsndLen, is_stereo, Pico.m.pal);
sndout_oss_start(PsndRate, is_stereo, 1);
sndout_oss_setvol(currentConfig.volume, currentConfig.volume);
PicoWriteSound = oss_write_nonblocking;
plat_update_volume(0, 0);
memset(sndBuffer, 0, sizeof(sndBuffer));
PsndOut = sndBuffer;
}
}
void pemu_sound_stop(void)
{
}
void pemu_sound_wait(void)
{
// don't need to do anything, writes will block by themselves
}
void plat_debug_cat(char *str)
{
}
void emu_video_mode_change(int start_line, int line_count, int is_32cols)
{
// clear whole screen in all buffers
memset32(g_screen_ptr, 0, g_screen_width * g_screen_height * 2 / 4);
}
void pemu_loop_prep(void)
{
apply_renderer();
osd_text = osd_text16;
pemu_sound_start();
}
void pemu_loop_end(void)
{
pemu_sound_stop();
/* do one more frame for menu bg */
pemu_forced_frame(0, 1);
}
void plat_wait_till_us(unsigned int us_to)
{
unsigned int now;
now = plat_get_ticks_us();
while ((signed int)(us_to - now) > 512)
{
usleep(1024);
now = plat_get_ticks_us();
}
}

View file

@ -1,383 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../common/emu.h"
#include "../common/menu.h"
#include "../common/plat.h"
#include "../common/input.h"
#include "sndout_oss.h"
#include "version.h"
#include "log_io.h"
int current_keys;
unsigned char *PicoDraw2FB;
#ifdef FBDEV
#include "fbdev.h"
#else
#include <pthread.h>
#include <semaphore.h>
static int current_bpp = 16;
static int current_pal[256];
static const char *verstring = "PicoDrive " VERSION;
static int scr_changed = 0, scr_w = SCREEN_WIDTH, scr_h = SCREEN_HEIGHT;
/* faking GP2X pad */
enum { GP2X_UP=0x1, GP2X_LEFT=0x4, GP2X_DOWN=0x10, GP2X_RIGHT=0x40,
GP2X_START=1<<8, GP2X_SELECT=1<<9, GP2X_L=1<<10, GP2X_R=1<<11,
GP2X_A=1<<12, GP2X_B=1<<13, GP2X_X=1<<14, GP2X_Y=1<<15,
GP2X_VOL_UP=1<<23, GP2X_VOL_DOWN=1<<22, GP2X_PUSH=1<<27 };
static void key_press_event(int keycode)
{
switch (keycode)
{
case 111:
case 0x62: current_keys |= GP2X_UP; break;
case 116:
case 0x68: current_keys |= GP2X_DOWN; break;
case 113:
case 0x64: current_keys |= GP2X_LEFT; break;
case 114:
case 0x66: current_keys |= GP2X_RIGHT; break;
case 0x24: current_keys |= GP2X_START; break; // enter
case 0x23: current_keys |= GP2X_SELECT;break; // ]
case 0x34: current_keys |= GP2X_A; break; // z
case 0x35: current_keys |= GP2X_X; break; // x
case 0x36: current_keys |= GP2X_B; break; // c
case 0x37: current_keys |= GP2X_Y; break; // v
case 0x27: current_keys |= GP2X_L; break; // s
case 0x28: current_keys |= GP2X_R; break; // d
case 0x29: current_keys |= GP2X_PUSH; break; // f
case 0x18: current_keys |= GP2X_VOL_DOWN;break; // q
case 0x19: current_keys |= GP2X_VOL_UP;break; // w
case 0x2d: log_io_clear(); break; // k
case 0x2e: log_io_dump(); break; // l
case 0x17: { // tab
extern int PicoReset(void);
PicoReset();
break;
}
}
}
static void key_release_event(int keycode)
{
switch (keycode)
{
case 111:
case 0x62: current_keys &= ~GP2X_UP; break;
case 116:
case 0x68: current_keys &= ~GP2X_DOWN; break;
case 113:
case 0x64: current_keys &= ~GP2X_LEFT; break;
case 114:
case 0x66: current_keys &= ~GP2X_RIGHT; break;
case 0x24: current_keys &= ~GP2X_START; break; // enter
case 0x23: current_keys &= ~GP2X_SELECT;break; // ]
case 0x34: current_keys &= ~GP2X_A; break; // z
case 0x35: current_keys &= ~GP2X_X; break; // x
case 0x36: current_keys &= ~GP2X_B; break; // c
case 0x37: current_keys &= ~GP2X_Y; break; // v
case 0x27: current_keys &= ~GP2X_L; break; // s
case 0x28: current_keys &= ~GP2X_R; break; // d
case 0x29: current_keys &= ~GP2X_PUSH; break; // f
case 0x18: current_keys &= ~GP2X_VOL_DOWN;break; // q
case 0x19: current_keys &= ~GP2X_VOL_UP;break; // w
}
}
/* --- */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
static Display *xlib_display;
static Window xlib_window;
static XImage *ximage;
static void ximage_realloc(Display *display, Visual *visual)
{
void *xlib_screen;
XLockDisplay(xlib_display);
if (ximage != NULL)
XDestroyImage(ximage);
ximage = NULL;
xlib_screen = calloc(scr_w * scr_h, 4);
if (xlib_screen != NULL)
ximage = XCreateImage(display, visual, 24, ZPixmap, 0,
xlib_screen, scr_w, scr_h, 32, 0);
if (ximage == NULL)
fprintf(stderr, "failed to alloc ximage\n");
XUnlockDisplay(xlib_display);
}
static void xlib_update(void)
{
Status xstatus;
XLockDisplay(xlib_display);
xstatus = XPutImage(xlib_display, xlib_window, DefaultGC(xlib_display, 0), ximage,
0, 0, 0, 0, g_screen_width, g_screen_height);
if (xstatus != 0)
fprintf(stderr, "XPutImage %d\n", xstatus);
XUnlockDisplay(xlib_display);
}
static void *xlib_threadf(void *targ)
{
unsigned int width, height, display_width, display_height;
sem_t *sem = targ;
XTextProperty windowName;
Window win;
XEvent report;
Display *display;
Visual *visual;
int screen;
XInitThreads();
xlib_display = display = XOpenDisplay(NULL);
if (display == NULL)
{
fprintf(stderr, "cannot connect to X server %s\n",
XDisplayName(NULL));
sem_post(sem);
return NULL;
}
visual = DefaultVisual(display, 0);
if (visual->class != TrueColor)
{
fprintf(stderr, "cannot handle non true color visual\n");
XCloseDisplay(display);
sem_post(sem);
return NULL;
}
printf("X vendor: %s, rel: %d, display: %s, protocol ver: %d.%d\n", ServerVendor(display),
VendorRelease(display), DisplayString(display), ProtocolVersion(display),
ProtocolRevision(display));
screen = DefaultScreen(display);
ximage_realloc(display, visual);
sem_post(sem);
display_width = DisplayWidth(display, screen);
display_height = DisplayHeight(display, screen);
xlib_window = win = XCreateSimpleWindow(display,
RootWindow(display, screen),
display_width / 2 - scr_w / 2,
display_height / 2 - scr_h / 2,
scr_w + 2, scr_h + 2, 1,
BlackPixel(display, screen),
BlackPixel(display, screen));
XStringListToTextProperty((char **)&verstring, 1, &windowName);
XSetWMName(display, win, &windowName);
XSelectInput(display, win, ExposureMask |
KeyPressMask | KeyReleaseMask |
StructureNotifyMask);
XMapWindow(display, win);
while (1)
{
XNextEvent(display, &report);
switch (report.type)
{
case Expose:
while (XCheckTypedEvent(display, Expose, &report))
;
xlib_update();
break;
case ConfigureNotify:
width = report.xconfigure.width;
height = report.xconfigure.height;
if (scr_w != width - 2 || scr_h != height - 2) {
scr_w = width - 2;
scr_h = height - 2;
scr_changed = 1;
}
break;
case ButtonPress:
break;
case KeyPress:
key_press_event(report.xkey.keycode);
break;
case KeyRelease:
key_release_event(report.xkey.keycode);
break;
default:
break;
}
}
}
static void xlib_init(void)
{
pthread_t x_thread;
sem_t xlib_sem;
sem_init(&xlib_sem, 0, 0);
pthread_create(&x_thread, NULL, xlib_threadf, &xlib_sem);
pthread_detach(x_thread);
sem_wait(&xlib_sem);
sem_destroy(&xlib_sem);
}
/* --- */
static void realloc_screen(void)
{
int size = scr_w * scr_h * 2;
g_screen_width = g_menuscreen_w = scr_w;
g_screen_height = g_menuscreen_h = scr_h;
g_screen_ptr = realloc(g_screen_ptr, size);
g_menubg_ptr = realloc(g_menubg_ptr, size);
memset(g_screen_ptr, 0, size);
memset(g_menubg_ptr, 0, size);
PicoDraw2FB = g_menubg_ptr;
scr_changed = 0;
}
void plat_video_flip(void)
{
unsigned int *image;
int pixel_count, i;
if (ximage == NULL)
return;
pixel_count = g_screen_width * g_screen_height;
image = (void *)ximage->data;
if (current_bpp == 8)
{
unsigned char *pixels = g_screen_ptr;
int pix;
for (i = 0; i < pixel_count; i++)
{
pix = current_pal[pixels[i]];
image[i] = pix;
}
}
else
{
unsigned short *pixels = g_screen_ptr;
for (i = 0; i < pixel_count; i++)
{
/* in: rrrr rggg gggb bbbb */
/* out: rrrr r000 gggg gg00 bbbb b000 */
image[i] = (pixels[i] << 8) & 0xf80000;
image[i] |= (pixels[i] << 5) & 0x00fc00;
image[i] |= (pixels[i] << 3) & 0x0000f8;
}
}
xlib_update();
if (scr_changed) {
realloc_screen();
ximage_realloc(xlib_display, DefaultVisual(xlib_display, 0));
// propagate new ponters to renderers
plat_video_toggle_renderer(0, 0);
}
}
void plat_video_wait_vsync(void)
{
}
#endif // !FBDEV
void plat_early_init(void)
{
}
void plat_init(void)
{
#ifdef FBDEV
int ret, w, h;
ret = vout_fbdev_init(&w, &h);
if (ret != 0)
exit(1);
g_screen_width = g_menuscreen_w = w;
g_screen_height = g_menuscreen_h = h;
g_menubg_ptr = realloc(g_menubg_ptr, w * g_screen_height * 2);
PicoDraw2FB = g_menubg_ptr;
#else
realloc_screen();
memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2);
xlib_init();
#endif
// snd
sndout_oss_init();
}
void plat_finish(void)
{
#ifdef FBDEV
vout_fbdev_finish();
#else
free(g_screen_ptr);
#endif
sndout_oss_exit();
}
/* misc */
int mp3_get_bitrate(void *f, int size)
{
return 128;
}
void mp3_start_play(void *f, int pos)
{
}
void mp3_update(int *buffer, int length, int stereo)
{
}
#include <linux/input.h>
struct in_default_bind in_evdev_defbinds[] =
{
/* MXYZ SACB RLDU */
{ KEY_UP, IN_BINDTYPE_PLAYER12, 0 },
{ KEY_DOWN, IN_BINDTYPE_PLAYER12, 1 },
{ KEY_LEFT, IN_BINDTYPE_PLAYER12, 2 },
{ KEY_RIGHT, IN_BINDTYPE_PLAYER12, 3 },
{ KEY_S, IN_BINDTYPE_PLAYER12, 4 }, /* B */
{ KEY_D, IN_BINDTYPE_PLAYER12, 5 }, /* C */
{ KEY_A, IN_BINDTYPE_PLAYER12, 6 }, /* A */
{ KEY_ENTER, IN_BINDTYPE_PLAYER12, 7 },
{ KEY_BACKSLASH, IN_BINDTYPE_EMU, PEVB_MENU },
{ 0, 0, 0 }
};

View file

@ -1,81 +0,0 @@
#include <stdio.h>
typedef struct
{
unsigned int addr_min, addr_max;
int r8, r16, r32, w8, w16, w32;
} io_log_location;
static io_log_location io_locations[] =
{
{ 0x400000, 0x9FFFFF, 0, }, // unused
{ 0xa00000, 0xa03fff, 0, }, // z80 RAM
{ 0xa04000, 0xa05fff, 0, }, // ym2612
{ 0xa06000, 0xa060ff, 0, }, // bank reg
{ 0xa06100, 0xa07eff, 0, }, // unused
{ 0xa07f00, 0xa07fff, 0, }, // vdp
{ 0xa08000, 0xa0ffff, 0, }, // 0xa00000-0xa07fff mirror
{ 0xa10000, 0xa1001f, 0, }, // i/o
{ 0xa10020, 0xa10fff, 0, }, // expansion
{ 0xa11000, 0xa110ff, 0, }, // expansion
{ 0xa11100, 0xa11101, 0, }, // z80 busreq
{ 0xa11102, 0xa111ff, 0, }, // expansion
{ 0xa11200, 0xa11201, 0, }, // z80 reset
{ 0xa11202, 0xbfffff, 0, }, // expansion
{ 0xc00000, 0xc00003, 0, }, // vdp data port
{ 0xc00004, 0xc00007, 0, }, // vdp control
{ 0xc00009, 0xc0000f, 0, }, // hv counter
{ 0xc00010, 0xc00017, 0, }, // PSG
{ 0xc00018, 0xc0001f, 0, }, // unused
{ 0xc00020, 0xdfffff, 0, } // vdp mirrors
};
void log_io(unsigned int a, int bits, int is_write)
{
int i;
a &= 0x00ffffff;
if (bits > 8) a&=~1;
for (i = 0; i < sizeof(io_locations)/sizeof(io_locations[0]); i++)
{
if (a >= io_locations[i].addr_min && a <= io_locations[i].addr_max)
{
switch (bits|(is_write<<8)) {
case 0x008: io_locations[i].r8 ++; break;
case 0x010: io_locations[i].r16++; break;
case 0x020: io_locations[i].r32++; break;
case 0x108: io_locations[i].w8 ++; break;
case 0x110: io_locations[i].w16++; break;
case 0x120: io_locations[i].w32++; break;
default: printf("%06x %i %i\n", a, bits, is_write); break;
}
}
}
}
void log_io_clear(void)
{
int i;
for (i = 0; i < sizeof(io_locations)/sizeof(io_locations[0]); i++)
{
io_log_location *iol = &io_locations[i];
iol->r8 = iol->r16 = iol->r32 = iol->w8 = iol->w16 = iol->w32 = 0;
}
}
void log_io_dump(void)
{
int i;
printf(" range : r8 r16 r32 w8 w16 w32\n");
for (i = 0; i < sizeof(io_locations)/sizeof(io_locations[0]); i++)
{
io_log_location *iol = &io_locations[i];
if (iol->r8 == 0 && iol->r16 == 0 && iol->r32 == 0 && iol->w8 == 0 && iol->w16 == 0 && iol->w32 == 0)
continue;
printf("%06x - %06x : %8i %8i %8i %8i %8i %8i\n", iol->addr_min, iol->addr_max,
iol->r8, iol->r16, iol->r32, iol->w8, iol->w16, iol->w32);
}
printf("\n");
}

View file

@ -1,3 +0,0 @@
void log_io_clear(void);
void log_io_dump(void);

View file

@ -1,41 +0,0 @@
// port specific settings
#ifndef PORT_CONFIG_H
#define PORT_CONFIG_H
#define NO_SYNC
#define CASE_SENSITIVE_FS 1 // CS filesystem
#define DONT_OPEN_MANY_FILES 0
#define REDUCE_IO_CALLS 0
#define SCREEN_SIZE_FIXED 0
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define MSCREEN_SIZE_FIXED 0
#define MSCREEN_WIDTH SCREEN_WIDTH
#define MSCREEN_HEIGHT SCREEN_HEIGHT
// draw2.c
#define START_ROW 0 // which row of tiles to start rendering at?
#define END_ROW 28 // ..end
// pico.c
#define CAN_HANDLE_240_LINES 1
#define SIMPLE_WRITE_SOUND 0
#define mix_32_to_16l_stereo_lvl mix_32_to_16l_stereo
#define EL_LOGMASK (EL_STATUS|EL_ANOMALY|EL_UIO)
// EL_VDPDMA|EL_ASVDP|EL_SR | EL_IDLE | EL_BUSREQ|EL_Z80BNK | EL_32X)
//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)
#define dprintf(x...)
// platform
#define PATH_SEP "/"
#define PATH_SEP_C '/'
#define MENU_X2 0
#endif //PORT_CONFIG_H

View file

@ -1,126 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <pico/pico_int.h>
struct pp_counters *pp_counters;
static int shmemid;
void pprof_init(void)
{
int this_is_new_shmem = 1;
key_t shmemkey;
void *shmem;
#ifndef PPROF_TOOL
unsigned int tmp = pprof_get_one();
printf("pprof: measured diff is %u\n", pprof_get_one() - tmp);
#endif
shmemkey = ftok(".", 0x02ABC32E);
if (shmemkey == -1)
{
perror("pprof: ftok failed");
return;
}
#ifndef PPROF_TOOL
shmemid = shmget(shmemkey, sizeof(*pp_counters),
IPC_CREAT | IPC_EXCL | 0644);
if (shmemid == -1)
#endif
{
shmemid = shmget(shmemkey, sizeof(*pp_counters),
0644);
if (shmemid == -1)
{
perror("pprof: shmget failed");
return;
}
this_is_new_shmem = 0;
}
shmem = shmat(shmemid, NULL, 0);
if (shmem == (void *)-1)
{
perror("pprof: shmat failed");
return;
}
pp_counters = shmem;
if (this_is_new_shmem) {
memset(pp_counters, 0, sizeof(*pp_counters));
printf("pprof: pp_counters cleared.\n");
}
}
void pprof_finish(void)
{
shmdt(pp_counters);
shmctl(shmemid, IPC_RMID, NULL);
}
#ifdef PPROF_TOOL
#define IT(n) { pp_##n, #n }
static const struct {
enum pprof_points pp;
const char *name;
} pp_tab[] = {
IT(main),
IT(frame),
IT(draw),
IT(sound),
IT(m68k),
IT(z80),
IT(msh2),
IT(ssh2),
IT(dummy),
};
int main(int argc, char *argv[])
{
unsigned long long old[pp_total_points], new[pp_total_points];
int base = 0;
int l, i;
pprof_init();
if (pp_counters == NULL)
return 1;
if (argc >= 2)
base = atoi(argv[1]);
memset(old, 0, sizeof(old));
for (l = 0; ; l++)
{
if ((l & 0x1f) == 0) {
for (i = 0; i < ARRAY_SIZE(pp_tab); i++)
printf("%6s ", pp_tab[i].name);
printf("\n");
}
memcpy(new, pp_counters->counter, sizeof(new));
for (i = 0; i < ARRAY_SIZE(pp_tab); i++)
{
unsigned long long idiff = new[i] - old[i];
unsigned long long bdiff = (new[base] - old[base]) | 1;
printf("%6.2f ", (double)idiff * 100.0 / bdiff);
}
printf("\n");
memcpy(old, new, sizeof(old));
if (argc < 3)
break;
usleep(atoi(argv[2]));
}
return 0;
}
#endif // PPROF_TOOL

View file

@ -1,67 +0,0 @@
#ifndef __PPROF_H__
#define __PPROF_H__
enum pprof_points {
pp_main,
pp_frame,
pp_draw,
pp_sound,
pp_m68k,
pp_z80,
pp_msh2,
pp_ssh2,
pp_dummy,
pp_total_points
};
struct pp_counters
{
unsigned long long counter[pp_total_points];
};
extern struct pp_counters *pp_counters;
#ifdef __i386__
static __attribute__((always_inline)) inline unsigned int pprof_get_one(void)
{
unsigned long long ret;
__asm__ __volatile__ ("rdtsc" : "=A" (ret));
return (unsigned int)ret;
}
#define unglitch_timer(x)
#elif defined(__GP2X__)
// XXX: MMSP2 only, timer sometimes seems to return lower vals?
extern volatile unsigned long *gp2x_memregl;
#define pprof_get_one() (unsigned int)gp2x_memregl[0x0a00 >> 2]
#define unglitch_timer(di) \
if ((signed int)(di) < 0) di = 0
#else
#error no timer
#endif
#define pprof_start(point) { \
unsigned int pp_start_##point = pprof_get_one()
#define pprof_end(point) \
{ \
unsigned int di = pprof_get_one() - pp_start_##point; \
unglitch_timer(di); \
pp_counters->counter[pp_##point] += di; \
} \
}
// subtract for recursive stuff
#define pprof_end_sub(point) \
{ \
unsigned int di = pprof_get_one() - pp_start_##point; \
unglitch_timer(di); \
pp_counters->counter[pp_##point] -= di; \
} \
}
extern void pprof_init(void);
extern void pprof_finish(void);
#endif // __PPROF_H__

View file

@ -1,2 +0,0 @@
#include "../gp2x/version.h"