📄 genmenu.c
字号:
#include <stdio.h>#include <stdlib.h>#include <ctype.h>/* 20080123 name and fileName fields swapped to save VS1000 code space. parent field is used again 20080124 time calculation fixed (two double->int conversions caused the result to be wrong) *//*GENESI00OGGSINEMONOOGG SINESTEROGG *//* --main menu-- "Old Testament" submenu "Old Testament" autoplay "New Testament" submenu "New Testament" autoplay "Story Index" submenu "Story Index" autoplay "Special Features" submenu "Special Features" autoplay "Backlight Timer" submenu "Backlight Timer" timer --Old Testament-- "Genesis" submenu "Genesis" autoplay "Exodus" submenu "Exodus" autoplay --New Testament-- "Matthew" submenu "Matthew" autoplay --Story Index-- */typedef unsigned char ubyte;/* All 2-byte entries are in HI LO -order. The most significant 8 bits of the 16-bit value are in the first byte, the less significant bits in the second byte. Filenames starting with ':' are bookmark menu entries. The parent entry (subtree != NULL) must also have ':'. The second and third characters should be 0. The fourth character gives the bookmark index, starting from 0. Filenames starting with '!' are backlight timer entries. The parent entry (subtree != NULL) should also have '!'. The second character should be 0. The third and fourth character gives the backlight timer value in HI-LO format. 0xff 0xff is always on, 0x00 0x00 is always off. Otherwise the timeout in seconds is the value/100. Note: the parent field is again used. */struct ENTRY { ubyte parent[2]; /*0 parent index: 0 or 1..65535 */ ubyte subtree[2]; /*1 subtree index: 0 or 1..65535 */ ubyte extra; /*2 number of extra files to play */ ubyte flags; /*2 flags for this entry */ ubyte fileName[8]; /*28 FAT short filename, .ogg implied */ ubyte startFraction[2]; /*24 clip start position, x/65536 seconds */ ubyte startSeconds[2]; /*25 clip start position, seconds */ ubyte endFraction[2]; /*26 clip end position, x/65536 seconds */ ubyte endSeconds[2]; /*27 clip end position, seconds */ ubyte name[42]; /*3 entry name (for display) */};#define MFLG_LAST 1 /* last entry */#define MFLG_FIRST 2 /* first entry */#define MFLG_USEENDTIME 4 /* play only to the specified end time */#define MFLG_ENDPLAY 8 /* end of leaf entries, stop playing */#if 0struct ENTRY menu[] = { {/*0*/ "\0\0", "\0\x06", // -> points to entry 0x06 1, MFLG_FIRST, // first entry in the main menu, 1 extra file played "Collection ", {0,0}, {0,0}, {0,0}, {0,0}, "auto" }, {/*1*/ "\0\0", "\0\x0a", // -> points to entry 0x0a 0, 0, "Preview", {0,0}, {0,0}, {0,0}, {0,0}, "" }, {/*2*/ "\0\0", "\0\x08", // -> points to entry 0x08 /* Play 2 files starting from entry 8, the second file must be just after the last entry of the first file. */ 1, 0, "Sine Tests", {0,0}, {0,0}, {0,0}, {0,0}, "auto" }, {/*3*/ "\0\0", "\0\x18", // -> points to entry 0x18 0, 0, "Genesis 1 autoplay", {0,0}, {0,0}, {0,0}, {0,0}, "auto" // Has filename, so will start to play subtree automatically //The filename does not matter, because the tree is followed //to the first leaf and playback starts from there. }, {/*4*/ "\0\0", "\0\x20", // -> points to entry 0x20 0, 0, "Bookmarks", {0,0}, {0,0}, {0,0}, {0,0}, ":\0\0\0" // is marked as the root of bookmark entry }, {/*5*/ "\0\0", "\0\x10", // -> points to entry 0x10 0, MFLG_LAST, // last entry in the main menu "Backlight Timer", {0,0}, {0,0}, {0,0}, {0,0}, "!\0\0\0" // is marked as the root of backlight timer entry }, {/*6*/ /* Collection menu contents. - the first entry points to genesis 1 entries - the second entry is a file This is an example of mixed-length subtrees, but this kind of configuration may not be needed in the actual usage. Because the collection root menu entry calls for 1 extra file to be played, this play entry must be duplicated after the GENESI00 entries. Note: this chained play does not currently work, because genesis 1 is only a little over 45 seconds long, but there are entries for a longer file. */ "\0\0", "\0\x18", // -> points to entry 0x18 0, MFLG_FIRST, "Genesis 1 autoplay", {0,0}, {0,0}, {0,0}, {0,0}, "GENESI00" }, {/*7*/ "\0\0", "\0\0", 0, MFLG_LAST, "Sine -mono", {0,0}, {0,0}, {0,0}, {127,255}, "SINEMONO" }, {/*8*/ /* If PLAY is pressed at the Sine Tests menu (autoplay), the first leaf found is this entry, and because the menu specifies 2 files to be played, entry 9 is played automatically after it. If this menu is entered first, and Sine -stereo is selected, only it is played, and the player returns to menu. */ "\0\0", "\0\0", 0, MFLG_FIRST, "Sine -stereo", {0,0}, {0,0}, {0,0}, {0,0}, "SINESTER" }, {/*9*/ "\0\0", "\0\0", 0, MFLG_LAST, "Sine -mono", {0,0}, {0,0}, {0,0}, {127,255}, "SINEMONO" },/*preview: only play from start to end */ {/*10*/ /* These entries force the end time to be used. Play ends when the end time is reached. Combining automatic play of multiple files does not work with this feature. Automatic play of multiple files requires that the file is played to the end. */ "\0\0", "\0\0", 0, MFLG_FIRST|MFLG_USEENDTIME, "Genesis 1 0.5-10.5", {128,0}, {0,0}, {128,0},{0,10}, "GENESI00" }, {/*11*/ "\0\0", "\0\0", 0, MFLG_USEENDTIME, "Genesis 1 1.25-11.5", {64,0},{0,1}, //(64*256+0)/65536 + 0*256+1 = 1.25 {128,0},{0,11}, "GENESI00" }, {/*12*/ "\0\0", "\0\0", 0, MFLG_USEENDTIME, "Genesis 1 2.5-12.5", {128,0},{0,2}, {128,0},{0,12}, "GENESI00" }, {/*13*/ "\0\0", "\0\0", 0, MFLG_USEENDTIME, "Genesis 1 3.5-13.5", {128,0},{0,3}, {128,0},{0,13}, "GENESI00" }, {/*14*/ "\0\0", "\0\0", 0, MFLG_USEENDTIME, "SINE-mono 4.5-14.5", {128,0},{0,4}, {128,0},{0,14}, "SINEMONO" }, {/*15*/ "\0\0", "\0\0", 0, MFLG_LAST|MFLG_USEENDTIME, "SINE-stereo 5.5-15.5", {128,0},{0,5}, {128,0},{0,15}, "SINESTER" }, {/*16*/ /* backlight timer */ "\0\0", "\0\0", 0, MFLG_FIRST, // first entry in backlight timer menu "10 Seconds", {0,0},{0,0}, {0,0},{0,0}, "!\0\x03\xe8" //0x03e8 = 10 seconds }, {/*17*/ "\0\0", "\0\0", 0, 0, "20 Seconds", {0,0}, {0,0}, {0,0}, {0,0}, "!\0\x07\xd0" //0x07d0 = 20 seconds }, {/*18*/ "\0\0", "\0\0", 0, 0, "30 Seconds", {0,0}, {0,0}, {0,0}, {0,0}, "!\0\x0b\xb8" //0x0bb8 = 30 seconds }, {/*19*/ "\0\0", "\0\0", 0, 0, "Always On", {0,0}, {0,0}, {0,0}, {0,0}, "!\0\xff\xff" //0xffff = always on }, {/*20*/ "\0\0", "\0\0", 0, MFLG_LAST, // last entry in backlight timer menu "Always Off", {0,0}, {0,0}, {0,0}, {0,0}, "!\0\0\0" // 0x0000 = always off }, {/*21*/ "\0\0", "\0\0", 0, MFLG_FIRST, "", {0,0}, {0,0}, {0,0}, {0,0}, "" }, {/*22*/ "\0\0", "\0\0", 0, MFLG_LAST, "", {0,0}, {0,0}, {0,0}, {0,0}, "" }, {/*23*/ "\0\0", "\0\0", 0, MFLG_LAST, "", {0,0},{0,0}, {0,0},{0,0}, "" }, {/*24 = 0x18 */ "\0\0", "\0\0", 0, MFLG_FIRST, "Genesis 1 0 to 15", {0,0},{0,0}, //start = 0.0 seconds {0/*hi*/,0/*lo*/},{0/*hi*/,15/*lo*/}, //end = 15.0 seconds "GENESI00" }, {/*25*/ "\0\0", "\0\0", 0, 0, "Genesis 1 15 to 35.5", {0,0},{0,15}, //start = 15.0 seconds {128,0},{0,35}, //end = 35.5 seconds "GENESI00" }, {/*26*/ "\0\0", "\0\0", 0, 0, "Genesis 1 35 to 45", {0,0},{0,35}, {0,0},{0,45}, "GENESI00" }, {/*27*/ "\0\0", "\0\0", 0, 0, "Genesis 1 45 to 100", {0,0},{0,45}, {0,0},{0,100}, "GENESI00" }, {/*28*/ "\0\0", "\0\0", 0, 0, "Genesis 1 100 to 120.5", {0,0},{0,100}, {128,0},{0,120}, "GENESI00" }, {/*29*/ "\0\0", "\0\0", 0, 0, "Genesis 1 120 to 140", {0,0},{0,120}, {0,0},{0,140}, "GENESI00" }, {/*30*/ "\0\0", "\0\0", 0, MFLG_LAST, "Genesis 1 140 to end", {0,0},{0,140}, {0,0},{127,255}, "GENESI00" }, {/*31*/ /* Duplicated entry for the Collection menu entry. The second file leaf entries must directly follow the first one. */ "\0\0", "\0\0", 0, MFLG_FIRST|MFLG_LAST|MFLG_ENDPLAY, /*end of leaf entries, stop playing*/ "Sine -mono", {0,0}, {0,0}, {0,0}, {127,255}, "SINEMONO" }, {/*32=0x20*/ "\0\0", "\0\0", 0, MFLG_FIRST, "Bookmark 1", {0,0},{0,0}, {0,0},{0,0}, ":\0\0\0" //bookmark index 0 }, {/*33*/ "\0\0", "\0\0", 0, 0, "Bookmark 2", {0,0},{0,0}, {0,0},{0,1}, ":\0\0\1" //bookmark index 1 }, {/*34*/ "\0\0", "\0\0", 0, 0, "Bookmark 3", {0,0},{0,0}, {0,0},{0,2}, ":\0\0\2" //bookmark index 2 }, {/*35*/ "\0\0", "\0\0", 0, 0, "Bookmark 4", {0,0},{0,0}, {0,0},{0,3}, ":\0\0\3" }, {/*36*/ "\0\0", "\0\0", 0, 0, "Bookmark 5", {0,0},{0,0}, {0,0},{0,4}, ":\0\0\4" }, {/*37*/ "\0\0", "\0\0", 0, 0, "Bookmark 6", {0,0},{0,0}, {0,0},{0,5}, ":\0\0\5" }, {/*38*/ "\0\0", "\0\0", 0, 0, "Bookmark 7", {0,0},{0,0}, {0,0},{0,6}, ":\0\0\6" }, {/*39*/ "\0\0", "\0\0", 0, 0,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -