summaryrefslogtreecommitdiff
path: root/apps/plugins/chip8.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/chip8.c')
-rw-r--r--apps/plugins/chip8.c47
1 files changed, 0 insertions, 47 deletions
diff --git a/apps/plugins/chip8.c b/apps/plugins/chip8.c
index f861d19caa..cb7b85786f 100644
--- a/apps/plugins/chip8.c
+++ b/apps/plugins/chip8.c
@@ -1331,39 +1331,11 @@ static byte chip8_keymap[16];
1331static unsigned long starttimer; /* Timer value at the beginning */ 1331static unsigned long starttimer; /* Timer value at the beginning */
1332static unsigned long cycles; /* Number of update cycles (50Hz) */ 1332static unsigned long cycles; /* Number of update cycles (50Hz) */
1333 1333
1334#if (CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR)
1335static bool is_playing;
1336
1337/* one frame of bitswapped mp3 data */
1338static unsigned char beep[]={255,
1339223, 28, 35, 0,192,210, 35,226, 72,188,242, 1,128,166, 16, 68,146,252,151, 19,
1340 10,180,245,127, 96,184, 3,184, 30, 0,118, 59,128,121,102, 6,212, 0, 97, 6,
1341 42, 65, 28,134,192,145, 57, 38,136, 73, 29, 38,132, 15, 21, 70, 91,185, 99,198,
1342 15,192, 83, 6, 33,129, 20, 6, 97, 33, 4, 6,245,128, 92, 6, 24, 0, 86, 6,
1343 56,129, 44, 24,224, 25, 13, 48, 50, 82,180, 11,251,106,249, 59, 24, 82,175,223,
1344252,119, 76,134,120,236,149,250,247,115,254,145,173,174,168,180,255,107,195, 89,
1345 24, 25, 48,131,192, 61, 48, 64, 10,176, 49, 64, 1,152, 50, 32, 8,140, 48, 16,
1346 5,129, 51,196,187, 41,177, 23,138, 70, 50, 8, 10,242, 48,192, 3,248,226, 0,
1347 20,100, 18, 96, 41, 96, 78,102, 7,201,122, 76,119, 20,137, 37,177, 15,132,224,
1348 20, 17,191, 67,147,187,116,211, 41,169, 63,172,182,186,217,155,111,140,104,254,
1349111,181,184,144, 17,148, 21,101,166,227,100, 86, 85, 85, 85};
1350/* callback to request more mp3 data */
1351static void callback(const void** start, size_t* size)
1352{
1353 *start = beep; /* give it the same frame again */
1354 *size = sizeof(beep);
1355}
1356#endif /* PLATFORM_NATIVE */
1357
1358/****************************************************************************/ 1334/****************************************************************************/
1359/* Turn sound on */ 1335/* Turn sound on */
1360/****************************************************************************/ 1336/****************************************************************************/
1361static void chip8_sound_on (void) 1337static void chip8_sound_on (void)
1362{ 1338{
1363#if(CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR)
1364 if (!is_playing)
1365 rb->mp3_play_pause(true); /* kickoff audio */
1366#endif
1367} 1339}
1368 1340
1369/****************************************************************************/ 1341/****************************************************************************/
@@ -1371,10 +1343,6 @@ static void chip8_sound_on (void)
1371/****************************************************************************/ 1343/****************************************************************************/
1372static void chip8_sound_off (void) 1344static void chip8_sound_off (void)
1373{ 1345{
1374#if (CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR)
1375 if (!is_playing)
1376 rb->mp3_play_pause(false); /* pause audio */
1377#endif
1378} 1346}
1379 1347
1380/****************************************************************************/ 1348/****************************************************************************/
@@ -1576,27 +1544,12 @@ static bool chip8_run(const char* file)
1576 rb->lcd_drawrect(CHIP8_X-1,CHIP8_Y-1,CHIP8_LCDWIDTH+2,CHIP8_HEIGHT+2); 1544 rb->lcd_drawrect(CHIP8_X-1,CHIP8_Y-1,CHIP8_LCDWIDTH+2,CHIP8_HEIGHT+2);
1577#endif 1545#endif
1578 rb->lcd_update(); 1546 rb->lcd_update();
1579#if (CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR)
1580 /* init sound */
1581 is_playing = rb->mp3_is_playing(); /* would we disturb playback? */
1582 if (!is_playing) /* no? then we can make sound */
1583 { /* prepare */
1584 rb->mp3_play_data(beep, sizeof(beep), callback);
1585 }
1586#endif
1587 starttimer = *rb->current_tick; 1547 starttimer = *rb->current_tick;
1588 1548
1589 chip8_iperiod=15; 1549 chip8_iperiod=15;
1590 cycles = 0; 1550 cycles = 0;
1591 chip8(); 1551 chip8();
1592 1552
1593#if (CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR)
1594 if (!is_playing)
1595 { /* stop it if we used audio */
1596 rb->mp3_play_stop(); /* Stop audio playback */
1597 }
1598#endif
1599
1600 if (chip8_running == 3) { 1553 if (chip8_running == 3) {
1601 /* unsupported instruction */ 1554 /* unsupported instruction */
1602 rb->splash(HZ, "Error: Unsupported" 1555 rb->splash(HZ, "Error: Unsupported"