WARNING(_("No resource map has been loaded yet."));
return 0;
}
- WARNING(_("Loading sound resources from alternative location not yet supported."));
- return 0;
+ gchar *filename = glk_data->resource_load_callback(CHIMARA_RESOURCE_SOUND, snd, glk_data->resource_load_callback_data);
+ if(!filename) {
+ WARNING(_("Error loading resource from alternative location."));
+ return 0;
+ }
+
+ GError *err = NULL;
+ GFile *file = g_file_new_for_path(filename);
+ stream = G_INPUT_STREAM(g_file_read(file, NULL, &err));
+ if(!stream) {
+ IO_WARNING(_("Error loading resource from file"), filename, err->message);
+ g_free(filename);
+ g_object_unref(file);
+ return 0;
+ }
+ g_free(filename);
+ g_object_unref(file);
} else {
giblorb_result_t resource;
giblorb_err_t result = giblorb_load_resource(glk_data->resource_map, giblorb_method_Memory, &resource, giblorb_ID_Snd, snd);
gtk_container_add(GTK_CONTAINER(window), glk);
}
+static gchar *
+resource_load(ChimaraResourceType usage, guint32 resnum)
+{
+ char *resstr;
+ if(usage == CHIMARA_RESOURCE_IMAGE)
+ resstr = "PIC";
+ else if(usage == CHIMARA_RESOURCE_SOUND)
+ resstr = "SND";
+ else
+ resstr = "FCK";
+ return g_strdup_printf("%s%d", resstr, resnum);
+}
+
int
main(int argc, char *argv[])
{
if(argc < 2)
g_error("Must provide a plugin\n");
+
+ chimara_glk_set_resource_load_callback(CHIMARA_GLK(glk), (ChimaraResourceLoadFunc)resource_load, NULL);
if( !chimara_glk_run(CHIMARA_GLK(glk), argv[1], argc - 1, argv + 1, &error) )
g_error("Error starting Glk library: %s\n", error->message);
nothing we can do without it, so exit. */
return;
}
+ glk_set_window(mainwin);
char buffer[1024];
int len;