Add usage of snes_library_id().

This commit is contained in:
Themaister 2011-03-17 01:25:44 +01:00
parent 3fa037daee
commit ec51ceb010
6 changed files with 21 additions and 4 deletions

View File

@ -39,6 +39,10 @@
if (p##x == NULL) { SSNES_ERR("Failed to load symbol: \"%s\"\n", #x); exit(1); } \
} while(0)
#define OPT_SYM(x) do { \
p##x = DLSYM(lib_handle, x); \
} while(0)
static dylib_t lib_handle = NULL;
#endif
@ -52,6 +56,7 @@ void (*psnes_set_input_state)(snes_input_state_t);
void (*psnes_run)(void);
const char *(*psnes_library_id)(void) = NULL;
unsigned (*psnes_library_revision_minor)(void);
unsigned (*psnes_library_revision_major)(void);
@ -102,6 +107,7 @@ static void load_dynamic(void)
SYM(snes_set_audio_sample);
SYM(snes_set_input_poll);
SYM(snes_set_input_state);
OPT_SYM(snes_library_id);
SYM(snes_library_revision_minor);
SYM(snes_library_revision_major);
SYM(snes_run);

View File

@ -37,6 +37,7 @@ extern void (*psnes_set_audio_sample)(snes_audio_sample_t);
extern void (*psnes_set_input_poll)(snes_input_poll_t);
extern void (*psnes_set_input_state)(snes_input_state_t);
extern const char* (*psnes_library_id)(void);
extern unsigned (*psnes_library_revision_minor)(void);
extern unsigned (*psnes_library_revision_major)(void);
@ -55,7 +56,6 @@ extern bool (*psnes_load_cartridge_sufami_turbo)(
const char*, const uint8_t*, unsigned,
const char*, const uint8_t*, unsigned);
extern void (*psnes_set_controller_port_device)(bool, unsigned);
extern bool (*psnes_get_region)(void);

View File

@ -232,6 +232,8 @@ struct global
char record_path[256];
bool recording;
#endif
char title_buf[64];
};
void parse_config(void);

View File

@ -552,7 +552,7 @@ static void show_fps(void)
float fps = tv_to_fps(&tmp_tv, &new_tv, 180);
snprintf(tmpstr, sizeof(tmpstr), "SSNES || FPS: %6.1f || Frames: %d", fps, frames);
snprintf(tmpstr, sizeof(tmpstr), "%s || FPS: %6.1f || Frames: %d", g_extern.title_buf, fps, frames);
SDL_WM_SetCaption(tmpstr, NULL);
}
frames++;
@ -819,7 +819,7 @@ static void* gl_init(video_info_t *video, const input_driver_t **input, void **i
glColor4f(1, 1, 1, 1);
glClearColor(0, 0, 0, 1);
SDL_WM_SetCaption("SSNES", NULL);
SDL_WM_SetCaption(g_extern.title_buf, NULL);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

View File

@ -369,7 +369,7 @@ static void* xv_init(video_info_t *video, const input_driver_t **input, void **i
XSetWindowBackground(xv->display, xv->window, 0);
XMapWindow(xv->display, xv->window);
XStoreName(xv->display, xv->window, "SSNES");
XStoreName(xv->display, xv->window, g_extern.title_buf);
if (video->fullscreen)
set_fullscreen(xv);
hide_mouse(xv);

View File

@ -1154,12 +1154,21 @@ static void do_state_checks(void)
check_input_rate();
}
static void fill_title_buf(void)
{
if (psnes_library_id)
snprintf(g_extern.title_buf, sizeof(g_extern.title_buf), "SSNES : %s", psnes_library_id());
else
snprintf(g_extern.title_buf, sizeof(g_extern.title_buf), "SSNES");
}
int main(int argc, char *argv[])
{
parse_input(argc, argv);
parse_config();
init_dlsym();
fill_title_buf();
psnes_init();
if (strlen(g_extern.basename) > 0)