revive pandora and win32 builds, rm gp2x dep for linux, lots of refactoring

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@842 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2009-12-16 23:38:37 +00:00
parent 18b9412743
commit 697746df02
26 changed files with 723 additions and 1048 deletions

View file

@ -1,3 +1,35 @@
ifneq ($(DEBUG),)
CFLAGS += -ggdb
endif
ifeq "$(profile)" "1"
CFLAGS += -fprofile-generate
endif
ifeq "$(profile)" "2"
CFLAGS += -fprofile-use
endif
# === Pico core ===
# Pico
OBJS += pico/area.o pico/cart.o pico/memory.o pico/pico.o pico/sek.o pico/z80if.o \
pico/videoport.o pico/draw2.o pico/draw.o pico/mode4.o pico/sms.o \
pico/misc.o pico/eeprom.o pico/patch.o pico/debug.o
# CD
OBJS += pico/cd/pico.o pico/cd/memory.o pico/cd/sek.o pico/cd/LC89510.o \
pico/cd/cd_sys.o pico/cd/cd_file.o pico/cd/cue.o pico/cd/gfx_cd.o \
pico/cd/area.o pico/cd/misc.o pico/cd/pcm.o pico/cd/buffering.o
# 32X
OBJS += pico/32x/32x.o pico/32x/memory.o pico/32x/draw.o pico/32x/pwm.o
# Pico
OBJS += pico/pico/pico.o pico/pico/memory.o pico/pico/xpcm.o
# carthw
OBJS += pico/carthw/carthw.o
# SVP
OBJS += pico/carthw/svp/svp.o pico/carthw/svp/memory.o \
pico/carthw/svp/ssp16.o
# sound
OBJS += pico/sound/sound.o
OBJS += pico/sound/sn76496.o pico/sound/ym2612.o
# === CPU cores ===
# --- M68k ---
ifeq "$(use_musashi)" "1"
@ -54,6 +86,29 @@ OBJS += cpu/sh2/mame/sh2pico.o
endif
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
# common rules
.c.o:
@echo ">>>" $<
$(CC) $(CFLAGS) -c $< -o $@
.s.o:
@echo ">>>" $<
$(CC) $(CFLAGS) -c $< -o $@
clean_prof:
find ../.. -name '*.gcno' -delete
find ../.. -name '*.gcda' -delete
mkdirs:
mkdir -p $(DIRS)
../../tools/textfilter: ../../tools/textfilter.c
make -C ../../tools/ textfilter
# random deps
pico/carthw/svp/compiler.o : ../../cpu/drc/emit_$(ARCH).c
cpu/sh2/compiler.o : ../../cpu/drc/emit_$(ARCH).c

View file

@ -26,27 +26,10 @@ OBJS += pico/cd/memory_arm.o
endif
.c.o:
@echo ">>>" $<
$(CC) $(CFLAGS) -c $< -o $@
DIRS += cpu/Cyclone cpu/Cyclone/proj cpu/Cyclone/tools cpu/DrZ80
.S.o:
@echo ">>>" $<
$(CC) $(CFLAGS) -c $< -o $@
../../tools/textfilter: ../../tools/textfilter.c
make -C ../../tools/ textfilter
clean_prof:
find ../.. -name '*.gcno' -delete
find ../.. -name '*.gcda' -delete
mkdirs:
mkdir -p $(DIRS)
# build helix libs
../common/helix/$(CROSS)helix-mp3.a:
make -C ../common/helix clean all
make -C ../common/helix CROSS=$(CROSS) clean all

View file

@ -730,6 +730,27 @@ static void make_config_cfg(char *cfg_buff_512)
cfg_buff_512[511] = 0;
}
void emu_prep_defconfig(void)
{
memset(&defaultConfig, 0, sizeof(defaultConfig));
defaultConfig.EmuOpt = 0x9d | EOPT_RAM_TIMINGS|EOPT_CONFIRM_SAVE|EOPT_EN_CD_LEDS;
defaultConfig.s_PicoOpt = POPT_EN_STEREO|POPT_EN_FM|POPT_EN_PSG|POPT_EN_Z80 |
POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_SVP_DRC|POPT_ACC_SPRITES |
POPT_EN_32X|POPT_EN_PWM;
defaultConfig.s_PsndRate = 44100;
defaultConfig.s_PicoRegion = 0; // auto
defaultConfig.s_PicoAutoRgnOrder = 0x184; // US, EU, JP
defaultConfig.s_PicoCDBuffers = 0;
defaultConfig.Frameskip = -1; // auto
defaultConfig.volume = 50;
defaultConfig.gamma = 100;
defaultConfig.scaling = 0;
defaultConfig.turbo_rate = 15;
// platform specific overrides
pemu_prep_defconfig();
}
void emu_set_defconfig(void)
{
memcpy(&currentConfig, &defaultConfig, sizeof(currentConfig));
@ -786,7 +807,7 @@ int emu_read_config(int game, int no_defaults)
}
}
plat_validate_config();
pemu_validate_config();
// some sanity checks
#ifdef PSP

View file

@ -117,6 +117,7 @@ int emu_swap_cd(const char *fname);
int emu_save_load_game(int load, int sram);
void emu_reset_game(void);
void emu_prep_defconfig(void);
void emu_set_defconfig(void);
int emu_read_config(int game, int no_defaults);
int emu_write_config(int game);

View file

@ -69,7 +69,7 @@ int main(int argc, char *argv[])
/* in_init() must go before config, config accesses in_ fwk */
in_init();
pemu_prep_defconfig();
emu_prep_defconfig();
emu_read_config(0, 0);
config_readlrom(PicoConfigFile);

View file

@ -23,8 +23,9 @@
#include <pico/patch.h>
static char static_buff[64];
char menu_error_msg[64] = { 0, };
static int menu_error_time = 0;
char menu_error_msg[64] = { 0, };
void *g_menubg_ptr;
#ifndef UIQ3
@ -300,6 +301,49 @@ void menu_init(void)
}
static void menu_darken_bg(void *dst, void *src, int pixels, int darker)
{
unsigned int *dest = dst;
unsigned int *sorc = src;
pixels /= 2;
if (darker)
{
while (pixels--)
{
unsigned int p = *sorc++;
*dest++ = ((p&0xf79ef79e)>>1) - ((p&0xc618c618)>>3);
}
}
else
{
while (pixels--)
{
unsigned int p = *sorc++;
*dest++ = (p&0xf79ef79e)>>1;
}
}
}
static void menu_enter(int is_rom_loaded)
{
if (is_rom_loaded)
{
// darken the active framebuffer
menu_darken_bg(g_menubg_ptr, g_screen_ptr, g_screen_width * g_screen_height, 1);
}
else
{
char buff[256];
// should really only happen once, on startup..
emu_make_path(buff, "skin/background.png", sizeof(buff));
if (readpng(g_menubg_ptr, buff, READPNG_BG) < 0)
memset(g_menubg_ptr, 0, g_screen_width * g_screen_height * 2);
}
plat_video_menu_enter(is_rom_loaded);
}
static int me_id2offset(const menu_entry *ent, menu_id id)
{
int i;
@ -664,7 +708,7 @@ static void do_delete(const char *fpath, const char *fname)
plat_video_menu_begin();
if (!rom_loaded)
menu_darken_bg(g_screen_ptr, g_screen_width * g_screen_height, 0);
menu_darken_bg(g_screen_ptr, g_screen_ptr, g_screen_width * g_screen_height, 0);
len = strlen(fname);
if (len > g_screen_width/6)
@ -712,6 +756,7 @@ static unsigned short file2color(const char *fname)
static void draw_dirlist(char *curdir, struct dirent **namelist, int n, int sel)
{
int max_cnt, start, i, x, pos;
void *darken_ptr;
max_cnt = g_screen_height / me_sfont_h;
start = max_cnt / 2 - sel;
@ -722,7 +767,8 @@ static void draw_dirlist(char *curdir, struct dirent **namelist, int n, int sel)
// if (!rom_loaded)
// menu_darken_bg(gp2x_screen, 320*240, 0);
menu_darken_bg((short *)g_screen_ptr + g_screen_width * max_cnt/2 * 10, g_screen_width * 8, 0);
darken_ptr = (short *)g_screen_ptr + g_screen_width * max_cnt/2 * 10;
menu_darken_bg(darken_ptr, darken_ptr, g_screen_width * 8, 0);
x = 5 + me_mfont_w + 1;
if (start - 2 >= 0)
@ -1002,7 +1048,7 @@ static void draw_savestate_bg(int slot)
/* do a frame and fetch menu bg */
pemu_forced_frame(POPT_EN_SOFTSCALE);
plat_video_menu_enter(1);
menu_enter(1);
memcpy(Pico.vram, tmp_vram, sizeof(Pico.vram));
memcpy(Pico.cram, tmp_cram, sizeof(Pico.cram));
@ -1809,7 +1855,7 @@ static void debug_menu_loop(void)
case 1: draw_frame_debug(); break;
case 2: memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2);
pemu_forced_frame(0);
menu_darken_bg(g_screen_ptr, g_screen_width * g_screen_height, 0);
menu_darken_bg(g_screen_ptr, g_screen_ptr, g_screen_width * g_screen_height, 0);
PDebugShowSpriteStats((unsigned short *)g_screen_ptr + (g_screen_height/2 - 240/2)*g_screen_width +
g_screen_width/2 - 320/2, g_screen_width); break;
case 3: memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2);
@ -1969,7 +2015,7 @@ void menu_loop(void)
me_enable(e_menu_main, MA_MAIN_RESET_GAME, rom_loaded);
me_enable(e_menu_main, MA_MAIN_PATCHES, PicoPatches != NULL);
plat_video_menu_enter(rom_loaded);
menu_enter(rom_loaded);
in_set_blocking(1);
me_loop(e_menu_main, &sel, menu_main_plat_draw);
@ -2017,7 +2063,7 @@ int menu_loop_tray(void)
{
int ret = 1, sel = 0;
plat_video_menu_enter(rom_loaded);
menu_enter(rom_loaded);
in_set_blocking(1);
me_loop(e_menu_tray, &sel, NULL);
@ -2068,29 +2114,6 @@ void menu_plat_setup(int is_wiz)
e_menu_gfx_options[i].need_to_save = 0;
}
/* TODO: rename */
void menu_darken_bg(void *dst, int pixels, int darker)
{
unsigned int *screen = dst;
pixels /= 2;
if (darker)
{
while (pixels--)
{
unsigned int p = *screen;
*screen++ = ((p&0xf79ef79e)>>1) - ((p&0xc618c618)>>3);
}
}
else
{
while (pixels--)
{
unsigned int p = *screen;
*screen++ = (p&0xf79ef79e)>>1;
}
}
}
/* hidden options for config engine only */
static menu_entry e_menu_hidden[] =
{

View file

@ -154,6 +154,8 @@ typedef struct
extern me_bind_action me_ctrl_actions[15];
extern me_bind_action emuctrl_actions[]; // platform code
extern void *g_menubg_ptr;
void menu_init(void);
void menu_plat_setup(int is_wiz);
void text_out16(int x, int y, const char *texto, ...);
@ -168,5 +170,3 @@ int menu_loop_tray(void);
menu_entry *me_list_get_first(void);
menu_entry *me_list_get_next(void);
void menu_darken_bg(void *dst, int pixels, int darker);

View file

@ -6,6 +6,7 @@ extern "C" {
extern char cpu_clk_name[];
void pemu_prep_defconfig(void);
void pemu_validate_config(void);
void pemu_loop_prep(void);
void pemu_loop_end(void);
void pemu_forced_frame(int opts);
@ -34,7 +35,6 @@ void plat_video_menu_end(void);
void plat_video_wait_vsync(void);
void plat_video_toggle_renderer(int is_next, int force_16bpp, int is_menu);
void plat_validate_config(void);
void plat_update_volume(int has_changed, int is_up);
int plat_is_dir(const char *path);