mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
add configure, revive pnd build, unify/refactor things
This commit is contained in:
parent
7e7b446f29
commit
d4d626658a
22 changed files with 733 additions and 498 deletions
|
@ -20,6 +20,37 @@ DEFINES += PPROF
|
|||
OBJS += platform/linux/pprof.o
|
||||
endif
|
||||
|
||||
# asm stuff
|
||||
ifeq "$(asm_render)" "1"
|
||||
DEFINES += _ASM_DRAW_C
|
||||
OBJS += pico/draw_arm.o pico/draw2_arm.o
|
||||
endif
|
||||
ifeq "$(asm_memory)" "1"
|
||||
DEFINES += _ASM_MEMORY_C
|
||||
OBJS += pico/memory_arm.o
|
||||
endif
|
||||
ifeq "$(asm_ym2612)" "1"
|
||||
DEFINES += _ASM_YM2612_C
|
||||
OBJS += pico/sound/ym2612_arm.o
|
||||
endif
|
||||
ifeq "$(asm_misc)" "1"
|
||||
DEFINES += _ASM_MISC_C
|
||||
OBJS += pico/misc_arm.o
|
||||
OBJS += pico/cd/misc_arm.o
|
||||
endif
|
||||
ifeq "$(asm_cdpico)" "1"
|
||||
DEFINES += _ASM_CD_PICO_C
|
||||
OBJS += pico/cd/pico_arm.o
|
||||
endif
|
||||
ifeq "$(asm_cdmemory)" "1"
|
||||
DEFINES += _ASM_CD_MEMORY_C
|
||||
OBJS += pico/cd/memory_arm.o
|
||||
endif
|
||||
ifeq "$(asm_32xdraw)" "1"
|
||||
DEFINES += _ASM_32X_DRAW
|
||||
OBJS += pico/32x/draw_arm.o
|
||||
endif
|
||||
|
||||
# === Pico core ===
|
||||
# Pico
|
||||
OBJS += pico/state.o pico/cart.o pico/memory.o pico/pico.o pico/sek.o pico/z80if.o \
|
||||
|
@ -48,6 +79,10 @@ OBJS += pico/carthw/carthw.o
|
|||
# SVP
|
||||
OBJS += pico/carthw/svp/svp.o pico/carthw/svp/memory.o \
|
||||
pico/carthw/svp/ssp16.o
|
||||
ifeq "$(ARCH)" "arm"
|
||||
OBJS += pico/carthw/svp/stub_arm.o
|
||||
OBJS += pico/carthw/svp/compiler.o
|
||||
endif
|
||||
# sound
|
||||
OBJS += pico/sound/sound.o
|
||||
OBJS += pico/sound/sn76496.o pico/sound/ym2612.o
|
||||
|
@ -61,7 +96,7 @@ OBJS += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o
|
|||
endif
|
||||
ifeq "$(use_cyclone)" "1"
|
||||
DEFINES += EMU_C68K
|
||||
OBJS += pico/m68kif_cyclone.o cpu/Cyclone/proj/Cyclone.o cpu/Cyclone/tools/idle.o
|
||||
OBJS += pico/m68kif_cyclone.o cpu/cyclone/Cyclone.o cpu/cyclone/tools/idle.o
|
||||
endif
|
||||
ifeq "$(use_fame)" "1"
|
||||
DEFINES += EMU_F68K
|
||||
|
@ -104,22 +139,13 @@ OBJS += cpu/sh2/mame/sh2pico.o
|
|||
endif
|
||||
endif # !no_32x
|
||||
|
||||
|
||||
DIRS += platform platform/common pico pico/cd pico/pico pico/32x pico/sound pico/carthw/svp \
|
||||
cpu cpu/musashi cpu/cz80 cpu/fame cpu/sh2/mame cpu/drc
|
||||
|
||||
CFLAGS += $(addprefix -D,$(DEFINES))
|
||||
|
||||
# common rules
|
||||
.c.o:
|
||||
@echo ">>>" $<
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
.s.o:
|
||||
@echo ">>>" $<
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
mkdirs:
|
||||
mkdir -p $(DIRS)
|
||||
|
||||
tools/textfilter: tools/textfilter.c
|
||||
make -C tools/ textfilter
|
||||
|
||||
|
@ -138,7 +164,7 @@ cpu/fame/famec.o : cpu/fame/famec.c cpu/fame/famec_opcodes.h
|
|||
@echo ">>>" $<
|
||||
$(CC) $(CFLAGS) -Wno-unused -c $< -o $@
|
||||
|
||||
cpu/Cyclone/proj/Cyclone.s:
|
||||
cpu/cyclone/Cyclone.s:
|
||||
@echo building Cyclone...
|
||||
@make -C cpu/Cyclone/proj CONFIG_FILE=config_pico.h
|
||||
@make -C cpu/cyclone CONFIG_FILE='\"../cyclone_config.h\"'
|
||||
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
# asm stuff
|
||||
ifeq "$(asm_render)" "1"
|
||||
DEFINES += _ASM_DRAW_C
|
||||
OBJS += pico/draw_arm.o pico/draw2_arm.o
|
||||
endif
|
||||
ifeq "$(asm_memory)" "1"
|
||||
DEFINES += _ASM_MEMORY_C
|
||||
OBJS += pico/memory_arm.o
|
||||
endif
|
||||
ifeq "$(asm_ym2612)" "1"
|
||||
DEFINES += _ASM_YM2612_C
|
||||
OBJS += pico/sound/ym2612_arm.o
|
||||
endif
|
||||
ifeq "$(asm_misc)" "1"
|
||||
DEFINES += _ASM_MISC_C
|
||||
OBJS += pico/misc_arm.o
|
||||
OBJS += pico/cd/misc_arm.o
|
||||
endif
|
||||
ifeq "$(asm_cdpico)" "1"
|
||||
DEFINES += _ASM_CD_PICO_C
|
||||
OBJS += pico/cd/pico_arm.o
|
||||
endif
|
||||
ifeq "$(asm_cdmemory)" "1"
|
||||
DEFINES += _ASM_CD_MEMORY_C
|
||||
OBJS += pico/cd/memory_arm.o
|
||||
endif
|
||||
ifeq "$(asm_32xdraw)" "1"
|
||||
DEFINES += _ASM_32X_DRAW
|
||||
OBJS += pico/32x/draw_arm.o
|
||||
endif
|
||||
|
||||
|
||||
DIRS += cpu/Cyclone cpu/Cyclone/proj cpu/Cyclone/tools cpu/DrZ80
|
||||
|
||||
|
||||
# build helix libs
|
||||
../common/helix/$(CROSS)helix-mp3.a:
|
||||
make -C ../common/helix CROSS=$(CROSS) clean all
|
||||
|
|
@ -1483,6 +1483,29 @@ void emu_sound_wait(void)
|
|||
sndout_wait();
|
||||
}
|
||||
|
||||
static void emu_loop_prep(void)
|
||||
{
|
||||
static int pal_old = -1;
|
||||
static int filter_old = -1;
|
||||
|
||||
if (currentConfig.CPUclock != plat_target_cpu_clock_get())
|
||||
plat_target_cpu_clock_set(currentConfig.CPUclock);
|
||||
|
||||
if (Pico.m.pal != pal_old) {
|
||||
plat_target_lcdrate_set(Pico.m.pal);
|
||||
pal_old = Pico.m.pal;
|
||||
}
|
||||
|
||||
if (currentConfig.filter != filter_old) {
|
||||
plat_target_hwfilter_set(currentConfig.filter);
|
||||
filter_old = currentConfig.filter;
|
||||
}
|
||||
|
||||
plat_target_gamma_set(currentConfig.gamma, 0);
|
||||
|
||||
pemu_loop_prep();
|
||||
}
|
||||
|
||||
static void skip_frame(int do_audio)
|
||||
{
|
||||
PicoSkipFrame = do_audio ? 1 : 2;
|
||||
|
@ -1517,7 +1540,7 @@ void emu_loop(void)
|
|||
PicoCDBufferInit();
|
||||
|
||||
plat_video_loop_prepare();
|
||||
pemu_loop_prep();
|
||||
emu_loop_prep();
|
||||
pemu_sound_start();
|
||||
|
||||
/* number of ticks per frame */
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* This work is licensed under the terms of MAME license.
|
||||
* See COPYING file in the top-level directory.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "emu.h"
|
||||
|
@ -16,6 +17,12 @@
|
|||
#include <pico/pico.h>
|
||||
#include <pico/patch.h>
|
||||
|
||||
#ifdef PANDORA
|
||||
#define MENU_X2 1
|
||||
#else
|
||||
#define MENU_X2 0
|
||||
#endif
|
||||
|
||||
// FIXME
|
||||
#define REVISION "0"
|
||||
|
||||
|
@ -45,6 +52,8 @@ static unsigned short fname2color(const char *fname)
|
|||
|
||||
#include "../libpicofe/menu.c"
|
||||
|
||||
static const char *men_dummy[] = { NULL };
|
||||
|
||||
/* platform specific options and handlers */
|
||||
#if defined(__GP2X__)
|
||||
#include "../gp2x/menu.c"
|
||||
|
@ -56,25 +65,48 @@ static unsigned short fname2color(const char *fname)
|
|||
#define menu_main_plat_draw NULL
|
||||
#endif
|
||||
|
||||
static void make_bg(int no_scale)
|
||||
{
|
||||
unsigned short *src = (void *)g_menubg_src_ptr;
|
||||
int w = g_screen_width, h = g_screen_height;
|
||||
short *dst;
|
||||
int x, y;
|
||||
|
||||
if (!no_scale && g_menuscreen_w / w >= 2 && g_menuscreen_h / h >= 2)
|
||||
{
|
||||
unsigned int t, *d = g_menubg_ptr;
|
||||
d += (g_menuscreen_h / 2 - h * 2 / 2)
|
||||
* g_menuscreen_w / 2;
|
||||
d += (g_menuscreen_w / 2 - w * 2 / 2) / 2;
|
||||
for (y = 0; y < h; y++, src += w, d += g_menuscreen_w*2/2) {
|
||||
for (x = 0; x < w; x++) {
|
||||
t = src[x];
|
||||
t = ((t & 0xf79e)>>1) - ((t & 0xc618)>>3);
|
||||
t |= t << 16;
|
||||
d[x] = d[x + g_menuscreen_w / 2] = t;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (w > g_menuscreen_w)
|
||||
w = g_menuscreen_w;
|
||||
if (h > g_menuscreen_h)
|
||||
h = g_menuscreen_h;
|
||||
dst = (short *)g_menubg_ptr +
|
||||
(g_menuscreen_h / 2 - h / 2) * g_menuscreen_w +
|
||||
(g_menuscreen_w / 2 - w / 2);
|
||||
|
||||
// darken the active framebuffer
|
||||
for (; h > 0; dst += g_menuscreen_w, src += g_screen_width, h--)
|
||||
menu_darken_bg(dst, src, w, 1);
|
||||
}
|
||||
|
||||
static void menu_enter(int is_rom_loaded)
|
||||
{
|
||||
if (is_rom_loaded)
|
||||
{
|
||||
int w = g_screen_width, h = g_screen_height;
|
||||
short *src, *dst;
|
||||
|
||||
if (w > g_menuscreen_w)
|
||||
w = g_menuscreen_w;
|
||||
if (h > g_menuscreen_h)
|
||||
h = g_menuscreen_h;
|
||||
src = (short *)g_menubg_src_ptr;
|
||||
dst = (short *)g_menubg_ptr +
|
||||
(g_menuscreen_h / 2 - h / 2) * g_menuscreen_w +
|
||||
(g_menuscreen_w / 2 - w / 2);
|
||||
|
||||
// darken the active framebuffer
|
||||
for (; h > 0; dst += g_menuscreen_w, src += g_screen_width, h--)
|
||||
menu_darken_bg(dst, src, w, 1);
|
||||
make_bg(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -105,7 +137,7 @@ static void draw_savestate_bg(int slot)
|
|||
/* do a frame and fetch menu bg */
|
||||
pemu_forced_frame(0, 0);
|
||||
|
||||
menu_darken_bg(g_menubg_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h, 1);
|
||||
make_bg(0);
|
||||
|
||||
PicoTmpStateRestore(tmp_state);
|
||||
}
|
||||
|
@ -485,12 +517,14 @@ static int menu_loop_adv_options(int id, int keys)
|
|||
|
||||
// ------------ gfx options menu ------------
|
||||
|
||||
static const char *men_dummy[] = { NULL };
|
||||
static const char h_gamma[] = "Gamma/brightness adjustment (default 100)";
|
||||
|
||||
static menu_entry e_menu_gfx_options[] =
|
||||
{
|
||||
mee_enum("Video output mode", MA_OPT_VOUT_MODE, plat_target.vout_method, men_dummy),
|
||||
mee_enum("Renderer", MA_OPT_RENDERER, currentConfig.renderer, renderer_names),
|
||||
mee_enum ("Video output mode", MA_OPT_VOUT_MODE, plat_target.vout_method, men_dummy),
|
||||
mee_enum ("Renderer", MA_OPT_RENDERER, currentConfig.renderer, renderer_names),
|
||||
mee_enum ("Filter", MA_OPT3_FILTERING, currentConfig.filter, men_dummy),
|
||||
mee_range_h("Gamma adjustment", MA_OPT3_GAMMA, currentConfig.gamma, 1, 200, h_gamma),
|
||||
MENU_OPTIONS_GFX
|
||||
mee_end,
|
||||
};
|
||||
|
@ -775,7 +809,8 @@ static void draw_frame_debug(void)
|
|||
if (PicoDrawMask & PDRAW_32X_ON) memcpy(layer_str + 26, "32x", 4);
|
||||
|
||||
pemu_forced_frame(1, 0);
|
||||
memcpy(g_menuscreen_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h * 2);
|
||||
make_bg(1);
|
||||
|
||||
smalltext_out16(4, 1, "build: r" REVISION " "__DATE__ " " __TIME__ " " COMPILER, 0xffff);
|
||||
smalltext_out16(4, g_menuscreen_h - me_sfont_h, layer_str, 0xffff);
|
||||
}
|
||||
|
@ -803,7 +838,7 @@ static void debug_menu_loop(void)
|
|||
case 1: draw_frame_debug();
|
||||
break;
|
||||
case 2: pemu_forced_frame(1, 0);
|
||||
menu_darken_bg(g_menuscreen_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h, 0);
|
||||
make_bg(1);
|
||||
PDebugShowSpriteStats((unsigned short *)g_menuscreen_ptr + (g_menuscreen_h/2 - 240/2)*g_menuscreen_w +
|
||||
g_menuscreen_w/2 - 320/2, g_menuscreen_w);
|
||||
break;
|
||||
|
@ -1111,4 +1146,12 @@ void menu_init(void)
|
|||
e_menu_gfx_options[i].data = plat_target.vout_methods;
|
||||
me_enable(e_menu_gfx_options, MA_OPT_VOUT_MODE,
|
||||
plat_target.vout_methods != NULL);
|
||||
|
||||
i = me_id2offset(e_menu_gfx_options, MA_OPT3_FILTERING);
|
||||
e_menu_gfx_options[i].data = plat_target.hwfilters;
|
||||
me_enable(e_menu_gfx_options, MA_OPT3_FILTERING,
|
||||
plat_target.hwfilters != NULL);
|
||||
|
||||
me_enable(e_menu_gfx_options, MA_OPT3_GAMMA,
|
||||
plat_target.gamma_set != NULL);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ typedef enum
|
|||
MA_OPT3_PRES_FULLSCR,
|
||||
MA_OPT3_FILTERING,
|
||||
MA_OPT3_VSYNC,
|
||||
MA_OPT3_GAMMAA,
|
||||
MA_OPT3_GAMMA,
|
||||
MA_OPT3_BLACKLVL,
|
||||
MA_OPT3_LAYER_X,
|
||||
MA_OPT3_LAYER_Y,
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 26d3ca0d29e87a14943d29fcafc93da753df60cd
|
||||
Subproject commit b57ed12e39ff8b0b678d18e5a729ea54ffb0542a
|
|
@ -18,7 +18,7 @@ extern char **g_argv;
|
|||
|
||||
static struct disassemble_info di;
|
||||
|
||||
#ifdef ARM
|
||||
#ifdef __arm__
|
||||
#define print_insn_func print_insn_little_arm
|
||||
#define BFD_ARCH bfd_arch_arm
|
||||
#define BFD_MACH bfd_mach_arm_4T
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
// platform
|
||||
#define PATH_SEP "/"
|
||||
#define PATH_SEP_C '/'
|
||||
#define MENU_X2 0
|
||||
|
||||
#endif //PORT_CONFIG_H
|
||||
|
||||
|
|
|
@ -1,107 +0,0 @@
|
|||
#export CROSS = arm-none-linux-gnueabi-
|
||||
CROSS ?= $(CROSS_COMPILE)
|
||||
LIBROOT = /home/notaz/dev/pnd/libroot
|
||||
PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh
|
||||
|
||||
# settings
|
||||
use_cyclone = 1
|
||||
#use_musashi = 1
|
||||
use_drz80 = 1
|
||||
use_sh2drc = 1
|
||||
#use_sh2mame = 1
|
||||
|
||||
asm_memory = 1
|
||||
asm_render = 1
|
||||
asm_ym2612 = 1
|
||||
asm_misc = 1
|
||||
asm_cdpico = 1
|
||||
asm_cdmemory = 1
|
||||
#profile = 1
|
||||
#drc_debug = 3
|
||||
|
||||
-include Makefile.local
|
||||
|
||||
ifeq "$(use_musashi)" "1"
|
||||
# due to CPU stop flag acces
|
||||
asm_cdpico = 0
|
||||
asm_cdmemory = 0
|
||||
endif
|
||||
|
||||
ARCH = arm
|
||||
DEFINES += ARM PANDORA IN_EVDEV
|
||||
CFLAGS += -I../.. -I. -I$(LIBROOT)/include
|
||||
CFLAGS += -Wall -Winline -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a
|
||||
ifeq ($(DEBUG),)
|
||||
CFLAGS += -O2 -fomit-frame-pointer -fstrict-aliasing -ffast-math
|
||||
endif
|
||||
LDFLAGS += -L$(LIBROOT)/lib -Wl,-Bstatic -lpng -Wl,-Bdynamic -lm -lpthread -ldl
|
||||
ASFLAGS = -mcpu=cortex-a8
|
||||
CC = $(CROSS)gcc
|
||||
STRIP = $(CROSS)strip
|
||||
AS = $(CROSS)as
|
||||
LD = $(CROSS)ld
|
||||
OBJCOPY = $(CROSS)objcopy
|
||||
|
||||
# frontend
|
||||
OBJS += plat.o asm_utils.o
|
||||
|
||||
# common
|
||||
OBJS += platform/common/emu.o platform/common/menu_pico.o platform/common/fonts.o platform/common/config.o \
|
||||
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/common/mp3.o \
|
||||
platform/linux/fbdev.o platform/linux/in_evdev.o platform/linux/sndout_oss.o \
|
||||
platform/linux/plat.o platform/linux/xenv.o
|
||||
|
||||
# ARM stuff
|
||||
OBJS += pico/carthw/svp/compiler.o pico/carthw/svp/stub_arm.o
|
||||
OBJS += pico/sound/mix_arm.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
|
||||
# unzip
|
||||
OBJS += unzip/unzip.o unzip/unzip_stream.o
|
||||
|
||||
vpath %.c = ../..
|
||||
vpath %.s = ../..
|
||||
vpath %.S = ../..
|
||||
DIRS += platform/linux zlib unzip
|
||||
|
||||
all: mkdirs PicoDrive picorestore
|
||||
|
||||
include ../common/common.mak
|
||||
include ../common/common_arm.mak
|
||||
include ../common/revision.mak
|
||||
|
||||
CFLAGS += $(addprefix -D,$(DEFINES))
|
||||
|
||||
PicoDrive : $(OBJS) ../common/helix/$(CROSS)helix-mp3.a
|
||||
@echo ">>>" $@
|
||||
$(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) -Wl,-Map=PicoDrive.map
|
||||
ifeq ($(DEBUG),)
|
||||
$(STRIP) $@
|
||||
endif
|
||||
|
||||
clean: tidy
|
||||
$(RM) PicoDrive
|
||||
tidy:
|
||||
$(RM) $(OBJS)
|
||||
|
||||
readme.txt: ../../tools/textfilter ../base_readme.txt
|
||||
../../tools/textfilter ../base_readme.txt $@ PANDORA
|
||||
|
||||
PicoDrive.pxml: PicoDrive.pxml.template
|
||||
./make_pxml.sh PicoDrive.pxml.template PicoDrive.pxml
|
||||
|
||||
platform/common/menu_pico.o: platform/common/menu.c menu.c
|
||||
|
||||
# ----------- release -----------
|
||||
|
||||
VER ?= $(shell head -n 1 version.h | sed 's/.*"\(.*\)\.\(.*\)".*/\1\2/g')
|
||||
|
||||
rel: PicoDrive PicoDrive.run picorestore ../../pico/carthw.cfg readme.txt \
|
||||
skin PicoDrive.png PicoDrive_p.png PicoDrive.pxml
|
||||
rm -rf out
|
||||
mkdir out
|
||||
cp -r $^ out/
|
||||
$(PND_MAKE) -p PicoDrive_$(VER).pnd -d out -x PicoDrive.pxml -i PicoDrive.png -c
|
|
@ -5,8 +5,6 @@ static const char h_scaler[] = "Scalers for 40 and 32 column modes\n"
|
|||
"(320 and 256 pixel wide horizontal)";
|
||||
static const char h_cscaler[] = "Displays the scaler layer, you can resize it\n"
|
||||
"using d-pad or move it using R+d-pad";
|
||||
static const char *men_dummy[] = { NULL };
|
||||
char **pnd_filter_list;
|
||||
|
||||
static int menu_loop_cscaler(int id, int keys)
|
||||
{
|
||||
|
@ -19,12 +17,13 @@ static int menu_loop_cscaler(int id, int keys)
|
|||
|
||||
for (;;)
|
||||
{
|
||||
menu_draw_begin(0);
|
||||
menu_draw_begin(0, 1);
|
||||
memset(g_menuscreen_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2);
|
||||
text_out16(2, 480 - 18, "%dx%d | d-pad to resize, R+d-pad to move", g_layer_cw, g_layer_ch);
|
||||
menu_draw_end();
|
||||
|
||||
inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_R|PBTN_MOK|PBTN_MBACK, 40);
|
||||
inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT
|
||||
|PBTN_R|PBTN_MOK|PBTN_MBACK, NULL, 40);
|
||||
if (inp & PBTN_UP) g_layer_cy--;
|
||||
if (inp & PBTN_DOWN) g_layer_cy++;
|
||||
if (inp & PBTN_LEFT) g_layer_cx--;
|
||||
|
@ -61,7 +60,6 @@ static int menu_loop_cscaler(int id, int keys)
|
|||
#define MENU_OPTIONS_GFX \
|
||||
mee_enum_h ("Scaler", MA_OPT_SCALING, currentConfig.scaling, \
|
||||
men_scaler, h_scaler), \
|
||||
mee_enum ("Filter", MA_OPT3_FILTERING, currentConfig.filter, men_dummy), \
|
||||
mee_onoff ("Vsync", MA_OPT2_VSYNC, currentConfig.EmuOpt, EOPT_VSYNC), \
|
||||
mee_cust_h ("Setup custom scaler", MA_NONE, menu_loop_cscaler, NULL, h_cscaler), \
|
||||
mee_range_hide("layer_x", MA_OPT3_LAYER_X, g_layer_cx, 0, 640), \
|
||||
|
@ -75,70 +73,13 @@ static int menu_loop_cscaler(int id, int keys)
|
|||
|
||||
#define menu_main_plat_draw NULL
|
||||
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
|
||||
static menu_entry e_menu_gfx_options[];
|
||||
static menu_entry e_menu_options[];
|
||||
static menu_entry e_menu_keyconfig[];
|
||||
|
||||
void pnd_menu_init(void)
|
||||
{
|
||||
struct dirent *ent;
|
||||
int i, count = 0;
|
||||
char **mfilters;
|
||||
char buff[64], *p;
|
||||
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;
|
||||
}
|
||||
p = strstr(ent->d_name, "_up");
|
||||
if (p != NULL && (p[3] == 0 || !strcmp(p + 3, "_h")))
|
||||
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;
|
||||
|
||||
p = strstr(ent->d_name, "_up");
|
||||
if (p == NULL || (p[3] != 0 && strcmp(p + 3, "_h")))
|
||||
continue;
|
||||
|
||||
len = p - ent->d_name;
|
||||
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_OPT3_FILTERING);
|
||||
e_menu_gfx_options[i].data = (void *)mfilters;
|
||||
pnd_filter_list = mfilters;
|
||||
int i;
|
||||
|
||||
i = me_id2offset(e_menu_options, MA_OPT_CPU_CLOCKS);
|
||||
e_menu_options[i].name = "Max CPU clock";
|
||||
|
|
|
@ -15,23 +15,24 @@
|
|||
#include <unistd.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/omapfb.h>
|
||||
#include <linux/input.h>
|
||||
|
||||
#include "../common/emu.h"
|
||||
#include "../common/menu.h"
|
||||
#include "../common/plat.h"
|
||||
#include "../common/arm_utils.h"
|
||||
#include "../common/input.h"
|
||||
#include "../linux/sndout_oss.h"
|
||||
#include "../linux/fbdev.h"
|
||||
#include "../linux/xenv.h"
|
||||
#include "../common/input_pico.h"
|
||||
#include "../common/version.h"
|
||||
#include "../libpicofe/input.h"
|
||||
#include "../libpicofe/menu.h"
|
||||
#include "../libpicofe/plat.h"
|
||||
#include "../libpicofe/linux/in_evdev.h"
|
||||
#include "../libpicofe/linux/sndout_oss.h"
|
||||
#include "../libpicofe/linux/fbdev.h"
|
||||
#include "../libpicofe/linux/xenv.h"
|
||||
#include "plat.h"
|
||||
#include "asm_utils.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <pico/pico_int.h>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
static struct vout_fbdev *main_fb, *layer_fb;
|
||||
// g_layer_* - in use, g_layer_c* - configured custom
|
||||
int g_layer_cx, g_layer_cy, g_layer_cw, g_layer_ch;
|
||||
|
@ -40,8 +41,7 @@ static int g_layer_w = 320, g_layer_h = 240;
|
|||
static int g_osd_fps_x, g_osd_y, doing_bg_frame;
|
||||
|
||||
static const char pnd_script_base[] = "sudo -n /usr/pandora/scripts";
|
||||
static short __attribute__((aligned(4))) sndBuffer[2*44100/50];
|
||||
static unsigned char __attribute__((aligned(4))) fb_copy[g_screen_width * g_screen_height * 2];
|
||||
static unsigned char __attribute__((aligned(4))) fb_copy[320 * 240 * 2];
|
||||
static void *temp_frame;
|
||||
unsigned char *PicoDraw2FB;
|
||||
const char *renderer_names[] = { NULL };
|
||||
|
@ -64,42 +64,29 @@ static const char * const pandora_gpio_keys[KEY_MAX + 1] = {
|
|||
[KEY_MENU] = "Pandora",
|
||||
};
|
||||
|
||||
struct in_default_bind in_evdev_defbinds[] =
|
||||
static 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_UP, IN_BINDTYPE_PLAYER12, GBTN_UP },
|
||||
{ KEY_DOWN, IN_BINDTYPE_PLAYER12, GBTN_DOWN },
|
||||
{ KEY_LEFT, IN_BINDTYPE_PLAYER12, GBTN_LEFT },
|
||||
{ KEY_RIGHT, IN_BINDTYPE_PLAYER12, GBTN_RIGHT },
|
||||
{ KEY_A, IN_BINDTYPE_PLAYER12, GBTN_A },
|
||||
{ KEY_S, IN_BINDTYPE_PLAYER12, GBTN_B },
|
||||
{ KEY_D, IN_BINDTYPE_PLAYER12, GBTN_C },
|
||||
{ KEY_ENTER, IN_BINDTYPE_PLAYER12, GBTN_START },
|
||||
{ KEY_BACKSLASH, IN_BINDTYPE_EMU, PEVB_MENU },
|
||||
{ KEY_SPACE, IN_BINDTYPE_EMU, PEVB_MENU },
|
||||
/* Pandora */
|
||||
{ KEY_PAGEDOWN, IN_BINDTYPE_PLAYER12, 4 },
|
||||
{ KEY_END, IN_BINDTYPE_PLAYER12, 5 },
|
||||
{ KEY_HOME, IN_BINDTYPE_PLAYER12, 6 },
|
||||
{ KEY_LEFTALT, IN_BINDTYPE_PLAYER12, 7 },
|
||||
{ KEY_HOME, IN_BINDTYPE_PLAYER12, GBTN_A },
|
||||
{ KEY_PAGEDOWN, IN_BINDTYPE_PLAYER12, GBTN_B },
|
||||
{ KEY_END, IN_BINDTYPE_PLAYER12, GBTN_C },
|
||||
{ KEY_LEFTALT, IN_BINDTYPE_PLAYER12, GBTN_START },
|
||||
{ KEY_RIGHTSHIFT,IN_BINDTYPE_EMU, PEVB_STATE_SAVE },
|
||||
{ KEY_RIGHTCTRL, IN_BINDTYPE_EMU, PEVB_STATE_LOAD },
|
||||
{ KEY_LEFTCTRL, IN_BINDTYPE_EMU, PEVB_MENU },
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
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)
|
||||
{
|
||||
defaultConfig.EmuOpt |= EOPT_VSYNC|EOPT_16BPP;
|
||||
|
@ -109,7 +96,7 @@ void pemu_prep_defconfig(void)
|
|||
|
||||
void pemu_validate_config(void)
|
||||
{
|
||||
currentConfig.CPUclock = get_cpu_clock();
|
||||
currentConfig.CPUclock = plat_target_cpu_clock_get();
|
||||
}
|
||||
|
||||
static void osd_text(int x, int y, const char *text)
|
||||
|
@ -175,8 +162,7 @@ void plat_video_flip(void)
|
|||
g_screen_ptr = vout_fbdev_flip(layer_fb);
|
||||
|
||||
// XXX: drain OS event queue here, maybe we'll actually use it someday..
|
||||
int dummy;
|
||||
xenv_update(&dummy);
|
||||
xenv_update(NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void plat_video_toggle_renderer(int change, int is_menu)
|
||||
|
@ -196,6 +182,10 @@ void plat_video_menu_end(void)
|
|||
g_menuscreen_ptr = vout_fbdev_flip(main_fb);
|
||||
}
|
||||
|
||||
void plat_video_menu_leave(void)
|
||||
{
|
||||
}
|
||||
|
||||
void plat_video_wait_vsync(void)
|
||||
{
|
||||
vout_fbdev_wait_vsync(main_fb);
|
||||
|
@ -222,53 +212,6 @@ void plat_status_msg_busy_first(const char *msg)
|
|||
|
||||
void plat_update_volume(int has_changed, int is_up)
|
||||
{
|
||||
static int prev_frame = 0, wait_frames = 0;
|
||||
int vol = currentConfig.volume;
|
||||
|
||||
if (has_changed)
|
||||
{
|
||||
if (is_up) {
|
||||
if (vol < 99) vol++;
|
||||
} else {
|
||||
if (vol > 0) vol--;
|
||||
}
|
||||
wait_frames = 0;
|
||||
sndout_oss_setvol(vol, vol);
|
||||
currentConfig.volume = vol;
|
||||
emu_status_msg("VOL: %02i", vol);
|
||||
prev_frame = Pico.m.frame_count;
|
||||
}
|
||||
}
|
||||
|
||||
static void make_bg(int no_scale)
|
||||
{
|
||||
unsigned short *s = (void *)fb_copy;
|
||||
int x, y;
|
||||
|
||||
memset32(g_menubg_src_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2 / 4);
|
||||
|
||||
if (!no_scale && g_menuscreen_w >= 640 && g_menuscreen_h >= 480) {
|
||||
unsigned int t, *d = g_menubg_src_ptr;
|
||||
d += (g_menuscreen_h / 2 - 480 / 2) * g_menuscreen_w / 2;
|
||||
d += (g_menuscreen_w / 2 - 640 / 2) / 2;
|
||||
for (y = 0; y < 240; y++, s += 320, d += g_menuscreen_w*2/2) {
|
||||
for (x = 0; x < 320; x++) {
|
||||
t = s[x];
|
||||
t |= t << 16;
|
||||
d[x] = d[x + g_menuscreen_w / 2] = t;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_menuscreen_w >= 320 && g_menuscreen_h >= 240) {
|
||||
unsigned short *d = g_menubg_src_ptr;
|
||||
d += (g_menuscreen_h / 2 - 240 / 2) * g_menuscreen_w;
|
||||
d += (g_menuscreen_w / 2 - 320 / 2);
|
||||
for (y = 0; y < 240; y++, s += 320, d += g_menuscreen_w)
|
||||
memcpy(d, s, 320*2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void pemu_forced_frame(int no_scale, int do_emu)
|
||||
|
@ -278,55 +221,13 @@ void pemu_forced_frame(int no_scale, int do_emu)
|
|||
doing_bg_frame = 0;
|
||||
|
||||
// making a copy because enabling the layer clears it's mem
|
||||
memcpy32((void *)fb_copy, g_screen_ptr, sizeof(fb_copy) / 4);
|
||||
make_bg(no_scale);
|
||||
}
|
||||
|
||||
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);
|
||||
memcpy((void *)fb_copy, g_screen_ptr, sizeof(fb_copy));
|
||||
g_menubg_src_ptr = fb_copy;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
/*
|
||||
* for 44k stereo, we do 1470 samples/emu_frame
|
||||
* OMAP driver does power of 2 buffers, so we need at least 4K buffer.
|
||||
* The most we can lag is 1K samples, size of OMAP's McBSP FIFO,
|
||||
* with 2K sample buffer we might sometimes lag more than that,
|
||||
* thus causing underflows.
|
||||
*/
|
||||
printf("starting audio: %i len: %i stereo: %i, pal: %i\n",
|
||||
PsndRate, PsndLen, is_stereo, Pico.m.pal);
|
||||
sndout_oss_start(PsndRate, is_stereo, 2);
|
||||
//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)
|
||||
{
|
||||
sndout_oss_stop();
|
||||
}
|
||||
|
||||
void pemu_sound_wait(void)
|
||||
{
|
||||
// don't need to do anything, writes will block by themselves
|
||||
emu_sound_start();
|
||||
}
|
||||
|
||||
void plat_debug_cat(char *str)
|
||||
|
@ -395,29 +296,10 @@ void pnd_restore_layer_data(void)
|
|||
if ((t[0] | t[5] | t[13]) == 0)
|
||||
memset32((void *)fb_copy, 0x07000700, sizeof(fb_copy) / 4);
|
||||
|
||||
memcpy32(g_screen_ptr, (void *)fb_copy, 320*240*2 / 4);
|
||||
memcpy(g_screen_ptr, (void *)fb_copy, 320*240*2);
|
||||
plat_video_flip();
|
||||
}
|
||||
|
||||
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 emu_video_mode_change(int start_line, int line_count, int is_32cols)
|
||||
{
|
||||
int fb_w = 320, fb_h = 240, fb_left = 0, fb_right = 0, fb_top = 0, fb_bottom = 0;
|
||||
|
@ -480,47 +362,24 @@ void emu_video_mode_change(int start_line, int line_count, int is_32cols)
|
|||
plat_video_flip();
|
||||
}
|
||||
|
||||
void pemu_loop_prep(void)
|
||||
void plat_video_loop_prepare(void)
|
||||
{
|
||||
static int pal_old = -1;
|
||||
static int filter_old = -1;
|
||||
char buf[128];
|
||||
|
||||
if (currentConfig.CPUclock != get_cpu_clock()) {
|
||||
snprintf(buf, sizeof(buf), "unset DISPLAY; echo y | %s/op_cpuspeed.sh %d",
|
||||
pnd_script_base, currentConfig.CPUclock);
|
||||
system(buf);
|
||||
}
|
||||
|
||||
if (Pico.m.pal != pal_old) {
|
||||
snprintf(buf, sizeof(buf), "%s/op_lcdrate.sh %d",
|
||||
pnd_script_base, Pico.m.pal ? 50 : 60);
|
||||
system(buf);
|
||||
pal_old = Pico.m.pal;
|
||||
}
|
||||
|
||||
if (currentConfig.filter != filter_old) {
|
||||
apply_filter(currentConfig.filter);
|
||||
filter_old = currentConfig.filter;
|
||||
}
|
||||
|
||||
// make sure there is no junk left behind the layer
|
||||
memset32(g_menuscreen_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2 / 4);
|
||||
memset(g_menuscreen_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2);
|
||||
g_menuscreen_ptr = vout_fbdev_flip(main_fb);
|
||||
|
||||
// emu_video_mode_change will call pnd_setup_layer()
|
||||
}
|
||||
|
||||
void pemu_loop_prep(void)
|
||||
{
|
||||
// dirty buffers better go now than during gameplay
|
||||
sync();
|
||||
sleep(0);
|
||||
|
||||
pemu_sound_start();
|
||||
}
|
||||
|
||||
void pemu_loop_end(void)
|
||||
{
|
||||
pemu_sound_stop();
|
||||
|
||||
/* do one more frame for menu bg */
|
||||
pemu_forced_frame(0, 1);
|
||||
|
||||
|
@ -582,7 +441,7 @@ void plat_init(void)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
xenv_init();
|
||||
xenv_init(NULL, "PicoDrive " VERSION);
|
||||
|
||||
w = h = 0;
|
||||
main_fb = vout_fbdev_init(main_fb_name, &w, &h, 16, 2);
|
||||
|
@ -617,11 +476,14 @@ void plat_init(void)
|
|||
g_menubg_src_ptr = temp_frame;
|
||||
PicoDraw2FB = temp_frame;
|
||||
|
||||
sndout_oss_init();
|
||||
pnd_menu_init();
|
||||
|
||||
in_set_config(in_name_to_id("evdev:gpio-keys"), IN_CFG_KEY_NAMES,
|
||||
pandora_gpio_keys, sizeof(pandora_gpio_keys));
|
||||
in_evdev_init(in_evdev_defbinds);
|
||||
in_probe();
|
||||
plat_target_setup_input();
|
||||
|
||||
sndout_oss_frag_frames = 2;
|
||||
|
||||
return;
|
||||
|
||||
fail1:
|
||||
|
@ -633,7 +495,6 @@ fail0:
|
|||
|
||||
void plat_finish(void)
|
||||
{
|
||||
sndout_oss_exit();
|
||||
vout_fbdev_finish(main_fb);
|
||||
xenv_finish();
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
extern char **pnd_filter_list;
|
||||
extern int g_layer_cx, g_layer_cy;
|
||||
extern int g_layer_cw, g_layer_ch;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue