X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fcommon%2Femu.c;h=0a9f0890a5a2390ed88b6a1daadbeb65dbf539cb;hb=ee3c39efd2cf51cd654b6240f6fb595673f10f45;hp=407ed599d769c56f99a6681c979bb9390b0a450a;hpb=35f2b65ef708e7afc922ceda8d00b716de289610;p=picodrive.git diff --git a/platform/common/emu.c b/platform/common/emu.c index 407ed59..0a9f089 100644 --- a/platform/common/emu.c +++ b/platform/common/emu.c @@ -42,6 +42,7 @@ void *g_screen_ptr; int g_screen_width = 320; int g_screen_height = 240; +int g_screen_ppitch = 320; // pitch in pixels const char *PicoConfigFile = "config2.cfg"; currentConfig_t currentConfig, defaultConfig; @@ -604,7 +605,7 @@ void emu_set_defconfig(void) { memcpy(¤tConfig, &defaultConfig, sizeof(currentConfig)); PicoIn.opt = currentConfig.s_PicoOpt; - PsndRate = currentConfig.s_PsndRate; + PicoIn.sndRate = currentConfig.s_PsndRate; PicoIn.regionOverride = currentConfig.s_PicoRegion; PicoIn.autoRgnOrder = currentConfig.s_PicoAutoRgnOrder; } @@ -730,12 +731,12 @@ void name(int x, int y, const char *text) \ } \ } -mk_text_out(emu_text_out8, unsigned char, 0xf0, g_screen_ptr, 1, g_screen_width) -mk_text_out(emu_text_out16, unsigned short, 0xffff, g_screen_ptr, 1, g_screen_width) +mk_text_out(emu_text_out8, unsigned char, 0xf0, g_screen_ptr, 1, g_screen_ppitch) +mk_text_out(emu_text_out16, unsigned short, 0xffff, g_screen_ptr, 1, g_screen_ppitch) mk_text_out(emu_text_out8_rot, unsigned char, 0xf0, - (char *)g_screen_ptr + (g_screen_width - 1) * g_screen_height, -g_screen_height, 1) + (char *)g_screen_ptr + (g_screen_ppitch - 1) * g_screen_height, -g_screen_height, 1) mk_text_out(emu_text_out16_rot, unsigned short, 0xffff, - (short *)g_screen_ptr + (g_screen_width - 1) * g_screen_height, -g_screen_height, 1) + (short *)g_screen_ptr + (g_screen_ppitch - 1) * g_screen_height, -g_screen_height, 1) #undef mk_text_out @@ -751,7 +752,7 @@ void emu_osd_text16(int x, int y, const char *text) for (h = 0; h < 8; h++) { unsigned short *p; p = (unsigned short *)g_screen_ptr - + x + g_screen_width * (y + h); + + x + g_screen_ppitch * (y + h); for (i = len; i > 0; i--, p++) *p = (*p >> 2) & 0x39e7; } @@ -958,10 +959,10 @@ void emu_set_fastforward(int set_on) static int set_Frameskip, set_EmuOpt, is_on = 0; if (set_on && !is_on) { - set_PsndOut = PsndOut; + set_PsndOut = PicoIn.sndOut; set_Frameskip = currentConfig.Frameskip; set_EmuOpt = currentConfig.EmuOpt; - PsndOut = NULL; + PicoIn.sndOut = NULL; currentConfig.Frameskip = 8; currentConfig.EmuOpt &= ~4; currentConfig.EmuOpt |= 0x40000; @@ -969,7 +970,7 @@ void emu_set_fastforward(int set_on) emu_status_msg("FAST FORWARD"); } else if (!set_on && is_on) { - PsndOut = set_PsndOut; + PicoIn.sndOut = set_PsndOut; currentConfig.Frameskip = set_Frameskip; currentConfig.EmuOpt = set_EmuOpt; PsndRerate(1); @@ -1204,8 +1205,11 @@ static void mkdir_path(char *path_with_reserve, int pos, const char *name) void emu_cmn_forced_frame(int no_scale, int do_emu) { int po_old = PicoIn.opt; + int y; - memset32(g_screen_ptr, 0, g_screen_width * g_screen_height * 2 / 4); + for (y = 0; y < g_screen_height; y++) + memset32((short *)g_screen_ptr + g_screen_ppitch * y, 0, + g_screen_width * 2 / 4); PicoIn.opt &= ~POPT_ALT_RENDERER; PicoIn.opt |= POPT_ACC_SPRITES; @@ -1253,9 +1257,9 @@ void emu_init(void) config_readlrom(path); PicoInit(); - PicoMessage = plat_status_msg_busy_next; - PicoMCDopenTray = emu_tray_open; - PicoMCDcloseTray = emu_tray_close; + PicoIn.osdMessage = plat_status_msg_busy_next; + PicoIn.mcdTrayOpen = emu_tray_open; + PicoIn.mcdTrayClose = emu_tray_close; sndout_init(); } @@ -1285,12 +1289,12 @@ void emu_finish(void) static void snd_write_nonblocking(int len) { - sndout_write_nb(PsndOut, len); + sndout_write_nb(PicoIn.sndOut, len); } void emu_sound_start(void) { - PsndOut = NULL; + PicoIn.sndOut = NULL; if (currentConfig.EmuOpt & EOPT_EN_SOUND) { @@ -1299,12 +1303,12 @@ void emu_sound_start(void) PsndRerate(Pico.m.frame_count ? 1 : 0); printf("starting audio: %i len: %i stereo: %i, pal: %i\n", - PsndRate, PsndLen, is_stereo, Pico.m.pal); - sndout_start(PsndRate, is_stereo); - PicoWriteSound = snd_write_nonblocking; + PicoIn.sndRate, Pico.snd.len, is_stereo, Pico.m.pal); + sndout_start(PicoIn.sndRate, is_stereo); + PicoIn.writeSound = snd_write_nonblocking; plat_update_volume(0, 0); memset(sndBuffer, 0, sizeof(sndBuffer)); - PsndOut = sndBuffer; + PicoIn.sndOut = sndBuffer; } }