Subversion Repositories NedoOS

Rev

Rev 2423 | Blame | Compare with Previous | Last modification | View Log | Download

  1. PLAYERSTART = 0x4000
  2. PLAYEREND   = 0x8000
  3. SYSTEM_MEMORY_END = 0x200 ;must not touch memory below this address
  4.  
  5.         macro PLAYERHEADER customui
  6.         jp playerinit      ;called once, should check if sound device is available (if possible)
  7.         jp playerdeinit    ;called once when the application is exiting
  8.         jp musicload       ;function that loads the file allocating all required resources
  9.         jp musicunload     ;function that frees all resources allocated in musicload and mutes the sound device
  10.         jp musicplay       ;function called in the main loop, should update progress variable
  11.         jp isfilesupported ;function to determine if this player can handle the file
  12.         dw playernamestr   ;player name string
  13.         dw 0               ;address of error string
  14.         dw customui        ;address of custom UI elements
  15.         endm
  16.  
  17. PLAYERINITPROCADDR      = PLAYERSTART+0x01
  18. PLAYERDEINITPROCADDR    = PLAYERSTART+0x04
  19. MUSICLOADPROCADDR       = PLAYERSTART+0x07
  20. MUSICUNLOADPROCADDR     = PLAYERSTART+0x0a
  21. MUSICPLAYPROCADDR       = PLAYERSTART+0x0d
  22. ISFILESUPPORTEDPROCADDR = PLAYERSTART+0x10
  23. PLAYERNAMESTRADDR       = PLAYERSTART+0x12
  24. ERRORSTRINGADDR         = PLAYERSTART+0x14
  25. CUSTOMUIADDR            = PLAYERSTART+0x16
  26.  
  27. VSYNC_FREQ = 49 ;Vsync interrupt rate in Hz
  28.  
  29.         struct GPSETTINGS
  30. drawprogresscallback dw 0
  31. drawcustomui dw 0
  32. usemp3 dw 0
  33. usemwm dw 0
  34. usept3 dw 0
  35. usevgm dw 0
  36. usemoonmod dw 0
  37. usemoonmid dw 0
  38. moonmoddefaultpanning dw 0
  39. midiuartdelayoverride dw 0
  40. mididevice dw 0
  41. moddevice dw 0
  42. slowtfm dw 0
  43. slowmidiuart dw 0
  44. framelength dw 0 ;in 42 t-states units
  45. moonsoundstatus ds 1 ; 0 - no device, 1 - BomgeMoon or MoonSound with old firmware (wave ports not working), 2 - MoonSound OK
  46. tfmstatus ds 1 ; 0 - no device, 1 - TFM, 2 - slow TFM
  47. opmstatus ds 1 ; 0 - no device, 1 - single YM2151, 2 - dual YM2151
  48. opnastatus ds 1 ; 0 - no device, 1 - found YM2608
  49. sharedpages ds 3
  50.         ends
  51.  
  52. DEVICE_AY_BIT         = 0
  53. DEVICE_TURBOSOUND_BIT = 1
  54. DEVICE_TFM_BIT        = 2
  55. DEVICE_MOONSOUND_BIT  = 3
  56. DEVICE_GS_BIT         = 4
  57. DEVICE_NEOGS_BIT      = 5
  58. DEVICE_MIDI_UART_BIT  = 6
  59. DEVICE_OPM_BIT        = 7
  60. DEVICE_DUAL_OPM_BIT   = 8
  61. DEVICE_OPNA_BIT       = 9
  62.  
  63. DEVICE_AY_MASK         = 1<<DEVICE_AY_BIT
  64. DEVICE_TURBOSOUND_MASK = 1<<DEVICE_TURBOSOUND_BIT
  65. DEVICE_TFM_MASK        = 1<<DEVICE_TFM_BIT
  66. DEVICE_MOONSOUND_MASK  = 1<<DEVICE_MOONSOUND_BIT
  67. DEVICE_GS_MASK         = 1<<DEVICE_GS_BIT
  68. DEVICE_NEOGS_MASK      = 1<<DEVICE_NEOGS_BIT
  69. DEVICE_MIDI_UART_MASK  = 1<<DEVICE_MIDI_UART_BIT
  70. DEVICE_OPM_MASK        = 1<<DEVICE_OPM_BIT
  71. DEVICE_DUAL_OPM_MASK   = 1<<DEVICE_DUAL_OPM_BIT
  72. DEVICE_OPNA_MASK       = 1<<DEVICE_OPNA_BIT
  73.  
  74. MIN_FRAME_LENGTH_FPGA  = 18000000/49/42
  75. MIN_FRAME_LENGTH_ZXEVO = 10000000/49/42
  76.  
  77. COLOR_DEFAULT = 0x07
  78. COLOR_PANEL = 0x4f
  79. COLOR_CURSOR = 0x28
  80. COLOR_PANEL_FILE = 0x0f
  81. COLOR_PANEL_DIR = 0x4f
  82. COLOR_PANEL_DRIVE = 0x4b
  83. COLOR_ERROR_WINDOW = 0x17
  84.  
  85. CUSTOM_UI_CMD_DRAW_WINDOW          = 0 ;draws window
  86. CUSTOM_UI_CMD_PRINT_TEXT           = 1 ;prints text at the specified cursor position
  87. CUSTOM_UI_CMD_SET_COLOR            = 2 ;affects subsequent drawing and text output
  88. CUSTOM_UI_CMD_PLAYER_WINDOW        = 3 ;redraw is special and managed by shared UI code
  89. CUSTOM_UI_CMD_PLAYER_WINDOW_TITLE  = 4 ;autogenerated player window title string
  90. CUSTOM_UI_CMD_PLAY_TIME            = 5 ;shows elapsed time in mm:ss format
  91. CUSTOM_UI_CMD_PLAY_PROGRESS        = 6 ;shows progress bar or loading message
  92. CUSTOM_UI_CMD_SONG_TITLE           = 7 ;prints song title or filename if string is empty
  93. CUSTOM_UI_CMD_SEPARATOR            = 8 ;draws a visual separator
  94. CUSTOM_UI_CMD_COUNT                = 9 ;number of custom UI commands
  95.  
  96.         struct CUSTOMUIDRAWEND
  97. cmd db CUSTOM_UI_CMD_COUNT
  98.         ends
  99.  
  100.         struct CUSTOMUIDRAWWINDOW
  101. cmd db CUSTOM_UI_CMD_DRAW_WINDOW
  102. topleftx db 0
  103. toplefty db 0
  104. clientwidth db 0
  105. clientheight db 0
  106.         ends
  107.  
  108.         struct CUSTOMUIPRINTTEXT
  109. cmd db CUSTOM_UI_CMD_PRINT_TEXT
  110. posx db 0
  111. posy db 0
  112. straddr dw 0
  113.         ends
  114.  
  115.         struct CUSTOMUISETCOLOR
  116. cmd db CUSTOM_UI_CMD_SET_COLOR
  117. color db 0
  118.         ends
  119.  
  120.         struct CUSTOMUIPLAYERWINDOW
  121. cmd db CUSTOM_UI_CMD_PLAYER_WINDOW
  122. topleftx db 0
  123. toplefty db 0
  124. clientwidth db 0
  125. clientheight db 0
  126.         ends
  127.  
  128.         struct CUSTOMUIPLAYERWINDOWTITLE
  129. cmd db CUSTOM_UI_CMD_PLAYER_WINDOW_TITLE
  130. posx db 0
  131. posy db 0
  132.         ends
  133.  
  134.         struct CUSTOMUIPLAYTIME
  135. cmd db CUSTOM_UI_CMD_PLAY_TIME
  136. posx db 0
  137. posy db 0
  138. color dw COLOR_CURSOR
  139.         ends
  140.  
  141.         struct CUSTOMUISONGTITLE
  142. cmd db CUSTOM_UI_CMD_SONG_TITLE
  143. posx db 0
  144. posy db 0
  145. straddr dw 0
  146.         ends
  147.  
  148.         struct CUSTOMUIPLAYPROGRESS
  149. cmd db CUSTOM_UI_CMD_PLAY_PROGRESS
  150. posx db 0
  151. posy db 0
  152. counteraddr dw 0
  153. color dw COLOR_PANEL_DIR
  154.         ends
  155.  
  156.         struct CUSTOMUISEPARATOR
  157. cmd db CUSTOM_UI_CMD_SEPARATOR
  158. posx db 0
  159. posy db 0
  160. middlecharcount db 0
  161. middlechar db 196
  162. leftchar db 199
  163. rightchar db 182
  164.         ends
  165.  
  166.         macro PROGRESSIVEPLAYERWINDOWTEMPLATE songtitle,progresscounter
  167.         CUSTOMUIPLAYERWINDOW ,6,8,66,4
  168.         CUSTOMUIPLAYERWINDOWTITLE ,8,8
  169.         CUSTOMUISONGTITLE ,8,10,songtitle
  170.         CUSTOMUIPLAYPROGRESS ,8,11,progresscounter
  171.         CUSTOMUIPLAYTIME ,67,8
  172.         CUSTOMUIDRAWEND
  173.         endm
  174.  
  175.         macro PLAYERWINDOWTEMPLATE songtitle
  176.         CUSTOMUIPLAYERWINDOW ,12,8,54,3
  177.         CUSTOMUIPLAYERWINDOWTITLE ,14,8
  178.         CUSTOMUISONGTITLE ,14,10,songtitle
  179.         CUSTOMUIPLAYPROGRESS ,255
  180.         CUSTOMUIPLAYTIME ,61,8
  181.         CUSTOMUIDRAWEND
  182.         endm
  183.  
  184.         macro PROGRESSIVELOADINGWINDOWTEMPLATE windowtitlestr,progresscounter
  185.         CUSTOMUISETCOLOR ,COLOR_PANEL
  186.         CUSTOMUIDRAWWINDOW ,6,8,66,4
  187.         CUSTOMUISETCOLOR ,COLOR_CURSOR
  188.         CUSTOMUIPRINTTEXT ,8,8,windowtitlestr
  189.         CUSTOMUISONGTITLE ,8,10,0
  190.         CUSTOMUIPLAYPROGRESS ,8,11,progresscounter,7
  191.         CUSTOMUIDRAWEND
  192.         endm
  193.