dualcore integration in famc, bram cart C code, psp bugfixes

git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@294 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2007-11-11 15:38:27 +00:00
parent a6df06b763
commit 60a10527f2
6 changed files with 34 additions and 18 deletions

View file

@ -217,9 +217,9 @@ readme.txt: ../../tools/textfilter ../base_readme.txt
# cleanup # cleanup
clean: tidy clean: tidy
@$(RM) PicoDrive.gpe $(RM) PicoDrive.gpe
tidy: tidy:
@$(RM) $(OBJS) $(RM) $(OBJS)
# @make -C ../../cpu/Cyclone/proj -f Makefile.linux clean # @make -C ../../cpu/Cyclone/proj -f Makefile.linux clean

View file

@ -5,6 +5,7 @@
#define CASE_SENSITIVE_FS 1 // CS filesystem #define CASE_SENSITIVE_FS 1 // CS filesystem
#define DONT_OPEN_MANY_FILES 0 #define DONT_OPEN_MANY_FILES 0
#define REDUCE_IO_CALLS 0
// draw.c // draw.c
#define OVERRIDE_HIGHCOL 0 #define OVERRIDE_HIGHCOL 0

View file

@ -48,10 +48,10 @@ void emu_getMainDir(char *dst, int len)
if (len > 0) *dst = 0; if (len > 0) *dst = 0;
} }
static void osd_text(int x, const char *text, int is_active) static void osd_text(int x, const char *text, int is_active, int clear_all)
{ {
unsigned short *screen = is_active ? psp_video_get_active_fb() : psp_screen; unsigned short *screen = is_active ? psp_video_get_active_fb() : psp_screen;
int len = strlen(text) * 8 / 2; int len = clear_all ? (480 / 2) : (strlen(text) * 8 / 2);
int *p, h; int *p, h;
void *tmp; void *tmp;
for (h = 0; h < 8; h++) { for (h = 0; h < 8; h++) {
@ -66,7 +66,7 @@ static void osd_text(int x, const char *text, int is_active)
void emu_msg_cb(const char *msg) void emu_msg_cb(const char *msg)
{ {
osd_text(4, msg, 1); osd_text(4, msg, 1, 1);
noticeMsgTime = sceKernelGetSystemTimeLow() - 2000000; noticeMsgTime = sceKernelGetSystemTimeLow() - 2000000;
/* assumption: emu_msg_cb gets called only when something slow is about to happen */ /* assumption: emu_msg_cb gets called only when something slow is about to happen */
@ -149,7 +149,7 @@ void emu_setDefaultConfig(void)
currentConfig.KeyBinds[30] = 1<<1; currentConfig.KeyBinds[30] = 1<<1;
currentConfig.KeyBinds[31] = 1<<2; currentConfig.KeyBinds[31] = 1<<2;
currentConfig.KeyBinds[29] = 1<<3; currentConfig.KeyBinds[29] = 1<<3;
currentConfig.PicoCDBuffers = 0; currentConfig.PicoCDBuffers = 64;
currentConfig.scaling = 1; // bilinear filtering for psp currentConfig.scaling = 1; // bilinear filtering for psp
currentConfig.scale = 1.20; // fullscreen currentConfig.scale = 1.20; // fullscreen
currentConfig.hscale40 = 1.25; currentConfig.hscale40 = 1.25;
@ -411,8 +411,8 @@ static void blit2(const char *fps, const char *notice, int lagging_behind)
int vsync = 0, emu_opt = currentConfig.EmuOpt; int vsync = 0, emu_opt = currentConfig.EmuOpt;
if (notice || (emu_opt & 2)) { if (notice || (emu_opt & 2)) {
if (notice) osd_text(4, notice, 0); if (notice) osd_text(4, notice, 0, 0);
if (emu_opt & 2) osd_text(OSD_FPS_X, fps, 0); if (emu_opt & 2) osd_text(OSD_FPS_X, fps, 0, 0);
} }
dbg_text(); dbg_text();
@ -567,8 +567,8 @@ static void sound_prepare(void)
lprintf("starting audio: %i, len: %i, stereo: %i, pal: %i, block samples: %i\n", lprintf("starting audio: %i, len: %i, stereo: %i, pal: %i, block samples: %i\n",
PsndRate, PsndLen, stereo, Pico.m.pal, samples_block); PsndRate, PsndLen, stereo, Pico.m.pal, samples_block);
while (sceAudioOutput2GetRestSample() > 0) psp_msleep(100); // while (sceAudioOutput2GetRestSample() > 0) psp_msleep(100);
sceAudio_5C37C0AE(); // sceAudio_5C37C0AE();
ret = sceAudio_38553111(samples_block/2, PsndRate, 2); // seems to not need that stupid 64byte alignment ret = sceAudio_38553111(samples_block/2, PsndRate, 2); // seems to not need that stupid 64byte alignment
if (ret < 0) { if (ret < 0) {
lprintf("sceAudio_38553111() failed: %i\n", ret); lprintf("sceAudio_38553111() failed: %i\n", ret);
@ -589,8 +589,19 @@ static void sound_prepare(void)
static void sound_end(void) static void sound_end(void)
{ {
int i;
if (samples_done == 0)
{
// if no data is written between sceAudio_38553111 and sceAudio_5C37C0AE calls,
// we get a deadlock on next sceAudio_38553111 call
// so this is yet another workaround:
memset32((int *)(void *)sndBuffer, 0, samples_block*4/4);
samples_made = samples_block * 3;
sceKernelSignalSema(sound_sem, 1);
}
sceKernelDelayThread(100*1000);
samples_made = samples_done = 0; samples_made = samples_done = 0;
while (sceAudioOutput2GetRestSample() > 0) for (i = 0; sceAudioOutput2GetRestSample() > 0 && i < 16; i++)
psp_msleep(100); psp_msleep(100);
sceAudio_5C37C0AE(); sceAudio_5C37C0AE();
} }
@ -685,7 +696,7 @@ static void RunEvents(unsigned int which)
if (do_it) if (do_it)
{ {
osd_text(4, (which & 0x1000) ? "LOADING GAME" : "SAVING GAME", 1); osd_text(4, (which & 0x1000) ? "LOADING GAME" : "SAVING GAME", 1, 0);
PicoStateProgressCB = emu_msg_cb; PicoStateProgressCB = emu_msg_cb;
emu_SaveLoadGame((which & 0x1000) >> 12, 0); emu_SaveLoadGame((which & 0x1000) >> 12, 0);
PicoStateProgressCB = NULL; PicoStateProgressCB = NULL;

View file

@ -917,17 +917,20 @@ static void cd_menu_loop_options(void)
char *bios, *p; char *bios, *p;
if (emu_findBios(4, &bios)) { // US if (emu_findBios(4, &bios)) { // US
for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--); p++; for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--);
if (*p == '/') p++;
strncpy(bios_names.us, p, sizeof(bios_names.us)); bios_names.us[sizeof(bios_names.us)-1] = 0; strncpy(bios_names.us, p, sizeof(bios_names.us)); bios_names.us[sizeof(bios_names.us)-1] = 0;
} else strcpy(bios_names.us, "NOT FOUND"); } else strcpy(bios_names.us, "NOT FOUND");
if (emu_findBios(8, &bios)) { // EU if (emu_findBios(8, &bios)) { // EU
for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--); p++; for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--);
if (*p == '/') p++;
strncpy(bios_names.eu, p, sizeof(bios_names.eu)); bios_names.eu[sizeof(bios_names.eu)-1] = 0; strncpy(bios_names.eu, p, sizeof(bios_names.eu)); bios_names.eu[sizeof(bios_names.eu)-1] = 0;
} else strcpy(bios_names.eu, "NOT FOUND"); } else strcpy(bios_names.eu, "NOT FOUND");
if (emu_findBios(1, &bios)) { // JP if (emu_findBios(1, &bios)) { // JP
for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--); p++; for (p = bios+strlen(bios)-1; p > bios && *p != '/'; p--);
if (*p == '/') p++;
strncpy(bios_names.jp, p, sizeof(bios_names.jp)); bios_names.jp[sizeof(bios_names.jp)-1] = 0; strncpy(bios_names.jp, p, sizeof(bios_names.jp)); bios_names.jp[sizeof(bios_names.jp)-1] = 0;
} else strcpy(bios_names.jp, "NOT FOUND"); } else strcpy(bios_names.jp, "NOT FOUND");

View file

@ -104,7 +104,7 @@ static int read_next_frame(int which_buffer)
} }
if (frame_offset) { if (frame_offset) {
lprintf("unaligned, foffs=%i, offs=%i\n", mp3_src_pos - bytes_read, frame_offset); //lprintf("unaligned, foffs=%i, offs=%i\n", mp3_src_pos - bytes_read, frame_offset);
memmove(mp3_src_buffer[which_buffer], mp3_src_buffer[which_buffer] + frame_offset, frame_size); memmove(mp3_src_buffer[which_buffer], mp3_src_buffer[which_buffer] + frame_offset, frame_size);
} }
@ -327,7 +327,7 @@ void mp3_start_play(FILE *f, int pos)
lprintf("mp3_start_play(%s) @ %i\n", fname, pos); lprintf("mp3_start_play(%s) @ %i\n", fname, pos);
psp_sem_lock(thread_busy_sem); psp_sem_lock(thread_busy_sem);
if (mp3_fname != fname) if (mp3_fname != fname || mp3_handle < 0)
{ {
if (mp3_handle >= 0) sceIoClose(mp3_handle); if (mp3_handle >= 0) sceIoClose(mp3_handle);
mp3_handle = sceIoOpen(fname, PSP_O_RDONLY, 0777); mp3_handle = sceIoOpen(fname, PSP_O_RDONLY, 0777);

View file

@ -4,7 +4,8 @@
#define PORT_CONFIG_H #define PORT_CONFIG_H
#define CASE_SENSITIVE_FS 0 #define CASE_SENSITIVE_FS 0
#define DONT_OPEN_MANY_FILES 1 // work around the stupid PSP 10 open file limit #define DONT_OPEN_MANY_FILES 1 // work around the stupid PSP ~10 open file limit
#define REDUCE_IO_CALLS 1 // another workaround
// draw.c // draw.c
#define USE_BGR555 1 #define USE_BGR555 1