comparison src/xs_sidplay2.cc @ 527:fe8b41abd923

Now everything necessary should be using the VFS functions.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 20 Feb 2007 18:09:04 +0000
parents fa95d942f226
children 0170ab0c98e6
comparison
equal deleted inserted replaced
526:fa95d942f226 527:fe8b41abd923
41 typedef struct { 41 typedef struct {
42 sidplay2 *currEng; 42 sidplay2 *currEng;
43 sidbuilder *currBuilder; 43 sidbuilder *currBuilder;
44 sid2_config_t currConfig; 44 sid2_config_t currConfig;
45 SidTune *currTune; 45 SidTune *currTune;
46 guint8 *buf;
47 size_t bufSize;
46 } t_xs_sidplay2; 48 } t_xs_sidplay2;
47 49
48 50
49 /* We need to 'export' all this pseudo-C++ crap */ 51 /* We need to 'export' all this pseudo-C++ crap */
50 extern "C" { 52 extern "C" {
409 */ 411 */
410 gboolean xs_sidplay2_load(t_xs_status * myStatus, gchar * pcFilename) 412 gboolean xs_sidplay2_load(t_xs_status * myStatus, gchar * pcFilename)
411 { 413 {
412 t_xs_sidplay2 *myEngine; 414 t_xs_sidplay2 *myEngine;
413 assert(myStatus); 415 assert(myStatus);
416 myStatus->isInitialized = FALSE;
414 417
415 myEngine = (t_xs_sidplay2 *) myStatus->sidEngine; 418 myEngine = (t_xs_sidplay2 *) myStatus->sidEngine;
416 if (!myEngine) return FALSE; 419 if (!myEngine) return FALSE;
417
418 myStatus->isInitialized = FALSE;
419 420
420 /* Try to get the tune */ 421 /* Try to get the tune */
421 if (!pcFilename) return FALSE; 422 if (!pcFilename) return FALSE;
422 423
423 if (!myEngine->currTune->load(pcFilename)) 424 if (xs_fload_buffer(pcFilename, &(myEngine->buf), &(myEngine->bufSize)) != 0)
425 return FALSE;
426
427 if (!myEngine->currTune->read(myEngine->buf, myEngine->bufSize))
424 return FALSE; 428 return FALSE;
425 429
426 return TRUE; 430 return TRUE;
427 } 431 }
428 432
429 433
430 /* Delete INTERNAL information 434 /* Delete INTERNAL information
431 */ 435 */
432 void xs_sidplay2_delete(t_xs_status * myStatus) 436 void xs_sidplay2_delete(t_xs_status * myStatus)
433 { 437 {
434 assert(myStatus); 438 t_xs_sidplay2 *myEngine;
435 439 assert(myStatus);
436 /* With the current scheme of handling sidtune-loading, 440
437 * we don't do anything here. 441 myEngine = (t_xs_sidplay2 *) myStatus->sidEngine;
438 */ 442 if (!myEngine) return;
443
444 g_free(myEngine->buf);
445 myEngine->buf = NULL;
446 myEngine->bufSize = 0;
439 } 447 }
440 448
441 449
442 /* Hardware backend flushing 450 /* Hardware backend flushing
443 */ 451 */