FAME + some random stuff added

git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@276 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2007-10-21 10:20:56 +00:00
parent 703e4c7bbb
commit 2b90fc61e0
8 changed files with 71 additions and 8 deletions

View file

@ -3,7 +3,7 @@
PSPSDK = $(shell psp-config --pspsdk-path)
# settings
use_musashi = 1
#use_musashi = 1
use_mz80 = 1
amalgamate = 0
#profile = 1
@ -13,7 +13,7 @@ amalgamate = 0
CFLAGS += -I../.. -I. -D_UNZIP_SUPPORT -DNO_SYNC # -DBENCHMARK
CFLAGS += -Wall -Winline
ifeq ($(DEBUG),)
CFLAGS += -O2 -G0 -ftracer -fstrength-reduce -fomit-frame-pointer -fstrict-aliasing -ffast-math
CFLAGS += -O2 -G0 -ftracer -fstrength-reduce -ffast-math
else
CFLAGS += -ggdb
endif
@ -37,7 +37,7 @@ OBJS += ../../PicoAll.o
else
OBJS += ../../Pico/Area.o ../../Pico/Cart.o ../../Pico/Memory.o ../../Pico/Misc.o \
../../Pico/Pico.o ../../Pico/Sek.o ../../Pico/VideoPort.o ../../Pico/Draw2.o ../../Pico/Draw.o \
../../Pico/Patch.o
../../Pico/Patch.o ../../Pico/Draw_amips.o
# Pico - 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/gfx_cd.o \
@ -59,6 +59,9 @@ OBJS += ../../unzip/unzip.o ../../unzip/unzip_stream.o
ifeq "$(use_musashi)" "1"
CFLAGS += -DEMU_M68K
OBJS += ../../cpu/musashi/m68kops.o ../../cpu/musashi/m68kcpu.o
else
CFLAGS += -DEMU_F68K
OBJS += ../../cpu/fame/famec.o
endif
# z80
ifeq "$(use_mz80)" "1"
@ -69,7 +72,7 @@ $(error nothing here!)
endif
LIBS += -lpng -lm -lpspgu # -lpspaudio -lpspgu -lpsppower -lpsphprm -lz -lm -lstdc++
LIBS += -lpng -lm -lpspgu -lpsppower -Wl,-Map=PicoDrive.map # -lpspaudio -lpsphprm
# target
TARGET = PicoDrive
@ -82,12 +85,17 @@ CUSTOM_CLEAN = myclean
include $(PSPSDK)/lib/build.mak
# some additional rules
.c.o:
@echo ">>>" $<
$(CC) $(CFLAGS) -c $< -o $@
AS := psp-as
.s.o:
@echo ">>>" $<
$(AS) -march=allegrex -mtune=allegrex $< -o $@
../../cpu/musashi/m68kops.c :
make -C ../../cpu/musashi
@ -97,6 +105,9 @@ readme.txt: ../../tools/textfilter ../base_readme.txt
../../tools/textfilter: ../../tools/textfilter.c
make -C ../../tools/ textfilter
../../cpu/fame/famec.o : ../../cpu/fame/famec.c
@echo ">>>" $<
$(CC) $(CFLAGS) -Wno-unused -c $< -o $@
# ?
up: EBOOT.PBP

View file

@ -3,6 +3,7 @@
#include <sys/syslimits.h> // PATH_MAX
#include <pspthreadman.h>
#include <pspdisplay.h>
#include "psp.h"
#include "menu.h"
@ -121,6 +122,7 @@ void emu_setDefaultConfig(void)
currentConfig.PicoAutoRgnOrder = 0x184; // US, EU, JP
currentConfig.Frameskip = -1; // auto
currentConfig.volume = 50;
currentConfig.CPUclock = 222;
currentConfig.KeyBinds[ 4] = 1<<0; // SACB RLDU
currentConfig.KeyBinds[ 6] = 1<<1;
currentConfig.KeyBinds[ 7] = 1<<2;
@ -386,6 +388,9 @@ static void updateKeys(void)
int i;
keys = psp_pad_read(0);
if (keys & PSP_CTRL_HOME)
sceDisplayWaitVblankStart();
if (keys & BTN_SELECT)
engineState = PGS_Menu;
@ -498,6 +503,13 @@ void emu_Loop(void)
fpsbuff[0] = 0;
if (currentConfig.CPUclock != psp_get_cpu_clock()) {
lprintf("setting cpu clock to %iMHz... ", currentConfig.CPUclock);
i = psp_set_cpu_clock(currentConfig.CPUclock);
lprintf(i ? "failed\n" : "done\n");
currentConfig.CPUclock = psp_get_cpu_clock();
}
// make sure we are in correct mode
vidResetMode();
Pico.m.dirtyPal = 1;

View file

@ -1032,6 +1032,7 @@ menu_entry opt_entries[] =
{ "Use SRAM/BRAM savestates", MB_ONOFF, MA_OPT_SRAM_STATES, &currentConfig.EmuOpt, 0x0001, 0, 0, 1 },
{ NULL, MB_NONE, MA_OPT_CONFIRM_STATES,NULL, 0, 0, 0, 1 },
{ "Save slot", MB_RANGE, MA_OPT_SAVE_SLOT, &state_slot, 0, 0, 9, 1 },
{ NULL, MB_NONE, MA_OPT_CPU_CLOCKS, NULL, 0, 0, 0, 1 },
{ "[Sega/Mega CD options]", MB_NONE, MA_OPT_SCD_OPTS, NULL, 0, 0, 0, 1 },
{ "[advanced options]", MB_NONE, MA_OPT_ADV_OPTS, NULL, 0, 0, 0, 1 },
{ NULL, MB_NONE, MA_OPT_SAVECFG, NULL, 0, 0, 0, 1 },
@ -1102,6 +1103,9 @@ static void menu_opt_cust_draw(const menu_entry *entry, int x, int y, void *para
}
text_out16(x, y, "Confirm savestate %s", str);
break;
case MA_OPT_CPU_CLOCKS:
text_out16(x, y, "CPU/bus clock %3i/%3iMHz", currentConfig.CPUclock, currentConfig.CPUclock/2);
break;
case MA_OPT_SAVECFG:
str24[0] = 0;
if (config_slot != 0) sprintf(str24, " (profile: %i)", config_slot);
@ -1250,6 +1254,14 @@ static int menu_loop_options(void)
} else {state_slot--; if (state_slot < 0) state_slot = 9;
}
break;
case MA_OPT_CPU_CLOCKS:
while ((inp = psp_pad_read(0)) & (BTN_LEFT|BTN_RIGHT)) {
currentConfig.CPUclock += (inp & BTN_LEFT) ? -1 : 1;
if (currentConfig.CPUclock < 19) currentConfig.CPUclock = 19;
if (currentConfig.CPUclock > 333) currentConfig.CPUclock = 333;
draw_menu_options(menu_sel); // will wait vsync
}
break;
case MA_OPT_SAVECFG:
case MA_OPT_SAVECFG_GAME:
case MA_OPT_LOADCFG:

View file

@ -6,6 +6,7 @@
#define CPU_CALL
// draw.c
#define USE_BGR555 1
#define OVERRIDE_HIGHCOL 0
// draw2.c

View file

@ -5,6 +5,7 @@
#include <pspkernel.h>
#include <pspiofilemgr.h>
#include <pspdisplay.h>
#include <psppower.h>
#include <pspgu.h>
#include "psp.h"
@ -76,7 +77,8 @@ void psp_finish(void)
void psp_video_flip(int wait_vsync)
{
if (wait_vsync) sceDisplayWaitVblankStart();
sceDisplaySetFrameBuf(psp_screen, 512, PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_NEXTFRAME);
sceDisplaySetFrameBuf(psp_screen, 512, PSP_DISPLAY_PIXEL_FORMAT_565,
wait_vsync ? PSP_DISPLAY_SETBUF_IMMEDIATE : PSP_DISPLAY_SETBUF_NEXTFRAME);
current_screen ^= 1;
psp_screen = current_screen ? PSP_VRAM_BASE0 : PSP_VRAM_BASE1;
}
@ -108,6 +110,19 @@ unsigned int psp_pad_read(int blocking)
return pad.Buttons;
}
int psp_get_cpu_clock(void)
{
return scePowerGetCpuClockFrequencyInt();
}
int psp_set_cpu_clock(int clock)
{
int ret = scePowerSetClockFrequency(clock, clock, clock/2);
if (ret != 0) lprintf("failed to set clock: %i\n", ret);
return ret;
}
/* alt logging */
#define LOG_FILE "log.log"

View file

@ -15,6 +15,8 @@ extern void *psp_screen;
unsigned int psp_pad_read(int blocking);
int psp_get_cpu_clock(void);
int psp_set_cpu_clock(int clock);
/* shorter btn names */
#define BTN_UP PSP_CTRL_UP