aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--frontend/main.c4
-rw-r--r--frontend/menu.c3
-rw-r--r--frontend/menu.h1
-rw-r--r--frontend/plugin_lib.c32
-rw-r--r--plugins/dfsound/spu.c20
5 files changed, 59 insertions, 1 deletions
diff --git a/frontend/main.c b/frontend/main.c
index 13be9ac..b17df53 100644
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -476,7 +476,9 @@ int emu_save_state(int slot)
if (ret != 0)
return ret;
- return SaveState(fname);
+ ret = SaveState(fname);
+ printf("* %s \"%s\" [%d]\n", ret == 0 ? "saved" : "failed to save", fname, slot);
+ return ret;
}
int emu_load_state(int slot)
diff --git a/frontend/menu.c b/frontend/menu.c
index dee0159..2b9c155 100644
--- a/frontend/menu.c
+++ b/frontend/menu.c
@@ -1143,6 +1143,8 @@ static int menu_loop_plugin_options(int id, int keys)
static const char *men_cfg_cdrr[] = { "Auto", "ON", "OFF", NULL };
static const char h_cfg_cpul[] = "Shows CPU usage in %";
+static const char h_cfg_spu[] = "Shows active SPU channels\n"
+ "(green: normal, red: fmod, blue: noise)";
static const char h_cfg_fl[] = "Frame Limiter keeps the game from running too fast";
static const char h_cfg_xa[] = "Disables XA sound, which can sometimes improve performance";
static const char h_cfg_cdda[] = "Disable CD Audio for a performance boost\n"
@@ -1161,6 +1163,7 @@ static const char h_cfg_nodrc[] = "Disable dynamic recompiler and use interpret
static menu_entry e_menu_adv_options[] =
{
mee_onoff_h ("Show CPU load", 0, g_opts, OPT_SHOWCPU, h_cfg_cpul),
+ mee_onoff_h ("Show SPU channels", 0, g_opts, OPT_SHOWSPU, h_cfg_spu),
mee_onoff_h ("Disable Frame Limiter", 0, g_opts, OPT_NO_FRAMELIM, h_cfg_fl),
mee_onoff_h ("Disable XA Decoding", 0, Config.Xa, 1, h_cfg_xa),
mee_onoff_h ("Disable CD Audio", 0, Config.Cdda, 1, h_cfg_cdda),
diff --git a/frontend/menu.h b/frontend/menu.h
index d8aa892..7e401a3 100644
--- a/frontend/menu.h
+++ b/frontend/menu.h
@@ -9,6 +9,7 @@ enum opts {
OPT_SHOWFPS = 1 << 0,
OPT_SHOWCPU = 1 << 1,
OPT_NO_FRAMELIM = 1 << 2,
+ OPT_SHOWSPU = 1 << 3,
};
extern int g_opts;
diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c
index 58c67d2..8d5605f 100644
--- a/frontend/plugin_lib.c
+++ b/frontend/plugin_lib.c
@@ -74,6 +74,35 @@ static void print_cpu_usage(void)
pl_text_out16(pl_fbdev_w - 28, pl_fbdev_h - 10, "%3d", tick_per_sec);
}
+// draw 192x8 status of 24 sound channels
+static __attribute__((noinline)) void draw_active_chans(void)
+{
+ extern void spu_get_debug_info(int *chans_out, int *fmod_chans_out, int *noise_chans_out); // hack
+ int live_chans, fmod_chans, noise_chans;
+
+ static const unsigned short colors[2] = { 0x1fe3, 0x0700 };
+ unsigned short *dest = (unsigned short *)pl_fbdev_buf +
+ pl_fbdev_w * (pl_fbdev_h - 10) + pl_fbdev_w / 2 - 192/2;
+ unsigned short *d, p;
+ int c, x, y;
+
+ if (pl_fbdev_bpp != 16)
+ return;
+
+ spu_get_debug_info(&live_chans, &fmod_chans, &noise_chans);
+
+ for (c = 0; c < 24; c++) {
+ d = dest + c * 8;
+ p = !(live_chans & (1<<c)) ? 0 :
+ (fmod_chans & (1<<c)) ? 0xf000 :
+ (noise_chans & (1<<c)) ? 0x001f :
+ colors[c & 1];
+ for (y = 0; y < 8; y++, d += pl_fbdev_w)
+ for (x = 0; x < 8; x++)
+ d[x] = p;
+ }
+}
+
void *pl_fbdev_set_mode(int w, int h, int bpp)
{
void *ret;
@@ -102,6 +131,9 @@ void *pl_fbdev_flip(void)
flip_cnt++;
if (pl_fbdev_buf != NULL) {
+ if (g_opts & OPT_SHOWSPU)
+ draw_active_chans();
+
if (hud_msg[0] != 0)
print_hud();
else if (g_opts & OPT_SHOWFPS)
diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c
index 780b091..228267d 100644
--- a/plugins/dfsound/spu.c
+++ b/plugins/dfsound/spu.c
@@ -1075,4 +1075,24 @@ char * SPUgetLibInfos(void)
}
*/
+// debug
+void spu_get_debug_info(int *chans_out, int *fmod_chans_out, int *noise_chans_out)
+{
+ int ch = 0, fmod_chans = 0, noise_chans = 0;
+
+ for(;ch<MAXCHAN;ch++)
+ {
+ if (!(dwChannelOn & (1<<ch)))
+ continue;
+ if (s_chan[ch].bFMod == 2)
+ fmod_chans |= 1 << ch;
+ if (s_chan[ch].bNoise)
+ noise_chans |= 1 << ch;
+ }
+
+ *chans_out = dwChannelOn;
+ *fmod_chans_out = fmod_chans;
+ *noise_chans_out = noise_chans;
+}
+
// vim:shiftwidth=1:expandtab