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;
- int len = strlen(text) * 8 / 2;
+ int len = clear_all ? (480 / 2) : (strlen(text) * 8 / 2);
int *p, h;
void *tmp;
for (h = 0; h < 8; h++) {
void emu_msg_cb(const char *msg)
{
- osd_text(4, msg, 1);
+ osd_text(4, msg, 1, 1);
noticeMsgTime = sceKernelGetSystemTimeLow() - 2000000;
/* assumption: emu_msg_cb gets called only when something slow is about to happen */
currentConfig.KeyBinds[30] = 1<<1;
currentConfig.KeyBinds[31] = 1<<2;
currentConfig.KeyBinds[29] = 1<<3;
- currentConfig.PicoCDBuffers = 0;
+ currentConfig.PicoCDBuffers = 64;
currentConfig.scaling = 1; // bilinear filtering for psp
currentConfig.scale = 1.20; // fullscreen
currentConfig.hscale40 = 1.25;
int vsync = 0, emu_opt = currentConfig.EmuOpt;
if (notice || (emu_opt & 2)) {
- if (notice) osd_text(4, notice, 0);
- if (emu_opt & 2) osd_text(OSD_FPS_X, fps, 0);
+ if (notice) osd_text(4, notice, 0, 0);
+ if (emu_opt & 2) osd_text(OSD_FPS_X, fps, 0, 0);
}
dbg_text();
lprintf("starting audio: %i, len: %i, stereo: %i, pal: %i, block samples: %i\n",
PsndRate, PsndLen, stereo, Pico.m.pal, samples_block);
- while (sceAudioOutput2GetRestSample() > 0) psp_msleep(100);
- sceAudio_5C37C0AE();
+ // while (sceAudioOutput2GetRestSample() > 0) psp_msleep(100);
+ // sceAudio_5C37C0AE();
ret = sceAudio_38553111(samples_block/2, PsndRate, 2); // seems to not need that stupid 64byte alignment
if (ret < 0) {
lprintf("sceAudio_38553111() failed: %i\n", ret);
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;
- while (sceAudioOutput2GetRestSample() > 0)
+ for (i = 0; sceAudioOutput2GetRestSample() > 0 && i < 16; i++)
psp_msleep(100);
sceAudio_5C37C0AE();
}
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;
emu_SaveLoadGame((which & 0x1000) >> 12, 0);
PicoStateProgressCB = NULL;
char *bios, *p;
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;
} else strcpy(bios_names.us, "NOT FOUND");
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;
} else strcpy(bios_names.eu, "NOT FOUND");
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;
} else strcpy(bios_names.jp, "NOT FOUND");
}
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);
}
lprintf("mp3_start_play(%s) @ %i\n", fname, pos);
psp_sem_lock(thread_busy_sem);
- if (mp3_fname != fname)
+ if (mp3_fname != fname || mp3_handle < 0)
{
if (mp3_handle >= 0) sceIoClose(mp3_handle);
mp3_handle = sceIoOpen(fname, PSP_O_RDONLY, 0777);