Guest User

Untitled

a guest
Oct 3rd, 2026
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.96 KB | None | 0 0
  1.  
  2. ╔══════════════════════════════════════════════════════════════════╗
  3. ║ ║
  4. ║ VGM WEB PLAYER ║
  5. ║ Main features of the script ║
  6. ║ ║
  7. ╚══════════════════════════════════════════════════════════════════╝
  8.  
  9. File .......... VGMWebPlayer.py
  10. Language ...... Python 3 + Tkinter (interface), pygame (audio and
  11. gamepad), Pillow (images and graphic theme)
  12. VGM engine .... VGMPlay (NTSC version in app\ and PAL in app\PAL\)
  13. Emulator ...... Kega Fusion (app\kegafusion\), to play the games
  14. whose music you are listening to
  15. Purpose ....... Retro-style offline player for the VGM soundtracks
  16. of Sega Master System, Game Gear, SG-1000 and
  17. SC-3000, with automatic library download.
  18.  
  19.  
  20. ──────────────────────────────────────────────────────────────────
  21. 1. MUSIC LIBRARY
  22. ──────────────────────────────────────────────────────────────────
  23.  
  24. • Scans the "music" folder: reads the tracks inside ZIP archives
  25. and the standalone files.
  26. • Supported formats: .vgm, .vgz, .wav, .mp3.
  27. • Each ZIP is an album. Standalone files go into the
  28. "Standalone Files" album.
  29. • Album and track names are made readable automatically
  30. ("AlexKiddInMiracleWorld-SMS" → "Alex Kidd In Miracle World SMS").
  31. • "+ ADD" button to add files or ZIPs from any folder.
  32. Added files stay in the library even after a Sync Web, for the
  33. whole session.
  34.  
  35.  
  36. ──────────────────────────────────────────────────────────────────
  37. 2. FILTERS
  38. ──────────────────────────────────────────────────────────────────
  39.  
  40. • Console filter: GG (Game Gear), SMS (Master System),
  41. SG (SG-1000), SC (SC-3000).
  42. • Sound chip filter: FM (YM2413) or PSG.
  43. • Filters can be combined. The "Reset" button clears them.
  44. • Game and track counts are updated in the status display.
  45.  
  46.  
  47. ──────────────────────────────────────────────────────────────────
  48. 3. THE THREE VIEWS
  49. ──────────────────────────────────────────────────────────────────
  50.  
  51. GRID VIEW
  52. • Cover grid that adapts to the window width.
  53. • Cards drawn directly on the Canvas: even with more than 700
  54. games it is built in less than a tenth of a second.
  55. • Covers loaded in a background thread, with a loading
  56. animation.
  57. • "NEW" badge on albums downloaded in the last 5 minutes.
  58. • Colors: green = album playing, yellow border = keyboard or
  59. gamepad selection, lime border = album playing and also
  60. selected, light green border = mouse hover.
  61. • SHIFT+R shows or hides a soft red border around the albums
  62. that have no ROM in app\roms. The status line shows how many
  63. there are for a few seconds.
  64. • When switching to the grid from another view, the album playing
  65. appears in the second visible row. With the arrow keys the view
  66. scrolls only when the selection reaches the edge of the visible
  67. area.
  68.  
  69. TRACKLIST
  70. • Album → track tree, with a cover preview on the side.
  71. • Drawn "virtually": only the visible rows exist, so it stays
  72. instant even with about 9,000 tracks.
  73. • Opens automatically on the album and track currently
  74. playing.
  75. • Star ★ next to favorite tracks.
  76.  
  77. FAVORITES
  78. • Alphabetical list of favorites, with cover preview and a count
  79. on the view button.
  80. • Removal with the Delete key or with right-click.
  81.  
  82. All views stay built in memory: they are rebuilt only when the
  83. library or the filters change, so switching between them is
  84. instant. When you return to a view, it moves back to the track
  85. playing.
  86.  
  87.  
  88. ──────────────────────────────────────────────────────────────────
  89. 4. PLAYBACK
  90. ──────────────────────────────────────────────────────────────────
  91.  
  92. • VGM/VGZ files are converted to WAV with VGMPlay and then
  93. played with pygame.
  94. • Cache of converted tracks (app\cache): keeps the last 15,
  95. so listening to them again is instant. Cleared on exit.
  96. • NTSC/PAL button: plays VGMs at 60 Hz or 50 Hz.
  97. • LOOP repeats the current track. RAND enables random playback
  98. among the filtered tracks.
  99. • Previous and next, including the automatic one at the end of a
  100. track, always start from the track playing, even if another
  101. track has been selected in the meantime.
  102. • Progress bar: a click anywhere jumps there, or you can drag
  103. the handle. Playback resumes from there on release.
  104. • Pressing Stop while a VGM is still loading, the track no longer
  105. starts right afterwards.
  106. • MP3s use their real length and are not cut off before the
  107. end.
  108. • Reads the GD3 metadata of VGMs (title, game, system, author,
  109. date, notes) in a collapsible panel.
  110.  
  111.  
  112. ──────────────────────────────────────────────────────────────────
  113. 5. DISPLAY AND GRAPHICS
  114. ──────────────────────────────────────────────────────────────────
  115.  
  116. • LCD-style status display, with the track list of the album
  117. playing (▶ on the current track). Clicking a track in the list
  118. plays it.
  119. • Slideshow of screenshots of the game playing (256×192), with
  120. adjustable speed from 1 to 7 seconds. If there are no
  121. screenshots, the album cover is shown.
  122. • Animated bar equalizer with peak indicators.
  123. • Vertical "stepped" VU-meter style volume slider:
  124. - click or drag to set the volume;
  125. - mouse wheel to adjust it in small steps;
  126. - top icon for maximum volume;
  127. - bottom icon for mute, which remembers the previous volume.
  128. • Classic Winamp skin style theme:
  129. - "chassis" background with a violet-blue gradient, lighter at
  130. the top center, generated at the real size of the window;
  131. - inset frames around displays, lists and equalizer;
  132. - raised buttons with the gradient tinted by their color,
  133. brighter on mouse hover and with inverted relief when
  134. pressed;
  135. - the gradient is also the background of grid cards,
  136. tracklist, favorites, LCD and equalizer, and stays still
  137. while the content scrolls;
  138. - progress bar with a transparent inset groove, the part
  139. already played in soft green and a raised green handle;
  140. - vertical scrollbars in the same style: inset groove, raised
  141. arrows and handle, long handle so it is easy to grab;
  142. - secondary windows (Sync Web, Greetings & Links, messages)
  143. use the theme too.
  144. • Colored title bar on Windows 11. The window appears already
  145. colored, with no white flash at startup.
  146.  
  147.  
  148. ──────────────────────────────────────────────────────────────────
  149. 6. FAVORITES
  150. ──────────────────────────────────────────────────────────────────
  151.  
  152. • Right-click on a track (in Tracklist, in Favorites or on the top
  153. display for the track playing): add to or remove from
  154. favorites.
  155. • Saved in favorites.lst next to the app, with relative paths.
  156. The app folder can be moved without losing favorites.
  157. • "Atomic" file write (first a temporary file, then the
  158. replacement): an interruption does not corrupt it.
  159.  
  160.  
  161. ──────────────────────────────────────────────────────────────────
  162. 7. LAUNCHING GAMES IN THE EMULATOR
  163. ──────────────────────────────────────────────────────────────────
  164.  
  165. • Right-click on an album (grid card, or album or track in
  166. Tracklist and Favorites): two entries to launch the game ROM
  167. with Kega Fusion:
  168. - "Launch ... in Grid View": embedded in the grid;
  169. - "Launch ... in External Window": in a separate window.
  170. • On the gamepad, pressing A twice quickly launches the selected
  171. game embedded in Grid View. From Tracklist or Favorites the
  172. player switches to the grid by itself first.
  173. • The ROM is looked up in app\roms\<album name>\ (the first .zip
  174. in the folder is used, even with a different name) and the
  175. emulator in app\kegafusion\Fusion.exe, both with paths relative
  176. to the app folder.
  177. • The music is stopped before the game starts, even if the track
  178. was still loading.
  179.  
  180. EMULATOR EMBEDDED IN GRID VIEW
  181. • The Kega Fusion window is created already hidden, stripped of
  182. borders and menu and placed over the grid: it never appears as
  183. a separate window.
  184. • The game area always keeps a 4:3 ratio and is centered.
  185. • Decorative console frame (bezel) around the game, for Master
  186. System, Game Gear, SC-3000 and SG-1000. The "Bezel ON/OFF"
  187. button shows or hides it immediately. When it is on, the window
  188. width adapts to the frame.
  189. • "✕ Close emulator" button above the game. Alternatively it
  190. closes by pressing + and - together on the gamepad.
  191. • While playing, the grid icons, scrollbar and title are hidden.
  192. View switching (buttons, TAB and SHIFT+TAB), filters and
  193. playback controls are disabled. The volume stays usable.
  194. • ESC is blocked when the player or the emulator is in the
  195. foreground, to stop Kega Fusion from going full screen and
  196. changing resolution. With other programs in the foreground ESC
  197. works normally.
  198. • When the emulator closes, the grid goes back to how it was.
  199.  
  200. EMULATOR IN AN EXTERNAL WINDOW
  201. • Kega Fusion opens like a normal program, as if launched from
  202. File Explorer, and closes the same way. The gamepad + and -
  203. combination is left to the game.
  204.  
  205. IN BOTH CASES
  206. • The player's volume slider also sets the volume of Kega Fusion
  207. in the Windows volume mixer (requires pycaw).
  208. • The equalizer follows the real game audio: the output sound is
  209. only read (WASAPI loopback capture), without changing it or
  210. adding latency (requires PyAudioWPatch and numpy). Without these
  211. packages the bars stay still while playing.
  212. • While the emulator is open the player ignores the other gamepad
  213. buttons, so music and view don't change while playing.
  214.  
  215.  
  216. ──────────────────────────────────────────────────────────────────
  217. 8. ONLINE SYNCHRONIZATION (SYNC WEB)
  218. ──────────────────────────────────────────────────────────────────
  219.  
  220. • Downloads the missing soundtracks (ZIP) and icons from
  221. vgm.impulseinformatica.com.br.
  222. • Checks the ZIPs already present and downloads damaged ones again.
  223. • Downloads game screenshots from smspower.org, with 12
  224. parallel requests:
  225. - the FM/PSG variants of the same game share the same
  226. screenshots;
  227. - games without screenshots are marked and no longer
  228. checked again at every Sync.
  229. • Downloads and extracts the VGMPlay engine only if it is missing.
  230. For the .7z it tries tar, then 7-Zip, then py7zr, in that order,
  231. and creates the PAL version by itself.
  232. • Downloads with timeout and in chunks: CANCEL stops immediately,
  233. and an interrupted download leaves no incomplete files.
  234. • Final summary with the new albums, the downloaded screenshots and
  235. any problems.
  236. • On first launch without music or without VGMPlay it offers the
  237. synchronization by itself.
  238.  
  239.  
  240. ──────────────────────────────────────────────────────────────────
  241. 9. KEYBOARD, GAMEPAD AND MOUSE
  242. ──────────────────────────────────────────────────────────────────
  243.  
  244. • Keyboard:
  245. - arrows and Enter to move and play in all views;
  246. - TAB and SHIFT+TAB to go to the next or previous view
  247. (Grid View ⇄ Tracklist ⇄ Favorites);
  248. - SHIFT+R in Grid View to highlight albums without a ROM;
  249. - Delete to remove a favorite.
  250. • Quick search: type the beginning of an album or track name,
  251. even a whole word, and the item gets selected. The typed text
  252. is cleared after a 1-second pause.
  253. • USB gamepad (read with pygame, through the SDL2 mapping
  254. database; recognized even if plugged in while the app is open):
  255. - D-pad or left stick to move (in Grid View also right and
  256. left);
  257. - A to play the selected album or track;
  258. - A twice quickly to launch the game embedded in Grid
  259. View, stopping the music;
  260. - B to pause and resume;
  261. - X to switch between NTSC and PAL;
  262. - L2/R2 for the previous/next view
  263. (Grid View ⇄ Tracklist ⇄ Favorites), read as analog axes
  264. with hysteresis;
  265. - L1/R1 for previous/next track;
  266. - + to turn RANDOM mode on or off;
  267. - + and - pressed together to close the embedded Kega Fusion.
  268. While the emulator is open the player ignores the other gamepad
  269. buttons, so music and view don't change while playing.
  270. • Gamepad check mode: launching the program with
  271. "python VGMWebPlayer.py --pad-debug" the Command Prompt shows
  272. the recognized gamepad and the buttons read at every press.
  273. • Mouse: click, double-click, right-click for favorites and
  274. emulator, wheel to scroll lists and grid and to adjust the
  275. volume.
  276. • The full list of controls is in the files
  277. Docs\VGM Player Comandi_IT.pdf and Docs\VGM Player Controls_EN.pdf.
  278.  
  279.  
  280. ──────────────────────────────────────────────────────────────────
  281. 10. RELIABILITY AND PERFORMANCE
  282. ──────────────────────────────────────────────────────────────────
  283.  
  284. • Background threads never touch the interface directly:
  285. updates go through a queue run by the main thread.
  286. • The app always uses its own folder, even when launched from a
  287. shortcut or from another folder.
  288. • At startup, temporary files left over from an abnormal exit are
  289. deleted.
  290. • The console/chip classification of each track is computed only
  291. once. With these optimizations filters, tracklist and grid
  292. stay fast even with more than 8,500 tracks.
  293. • The gradient background is recomputed only when the window size
  294. changes; when lists scroll it is only moved, at the same moment
  295. as the content, so it does not flicker.
  296.  
  297.  
  298. ──────────────────────────────────────────────────────────────────
  299. 11. FOLDER STRUCTURE
  300. ──────────────────────────────────────────────────────────────────
  301.  
  302. VGMWebPlayer.py (or .exe)
  303. favorites.lst favorites (created automatically)
  304. music\ soundtracks (ZIP) and single files
  305. Docs\ controls guides (PDF) and this file
  306. GUI\
  307. icon.ico, alex_onigiri.gif, album covers
  308. bezel_*.png, gg_bezel_*.png,
  309. sc_bezel_*.png, sg_bezel_*.png console frames
  310. ScreenShots\<game>\ downloaded screenshots
  311. app\
  312. vgmplay.exe, vgmplay.ini, zlib1.dll NTSC engine (60 Hz)
  313. PAL\ PAL engine (50 Hz)
  314. cache\ converted tracks
  315. roms\<game>\ ROMs for the emulator
  316. kegafusion\Fusion.exe Kega Fusion emulator
  317.  
  318.  
  319. ──────────────────────────────────────────────────────────────────
  320. 12. REQUIREMENTS
  321. ──────────────────────────────────────────────────────────────────
  322.  
  323. pip install pygame pillow
  324. (pygame is used both for audio and for the gamepad)
  325. Optional:
  326. pip install py7zr to extract VGMPlay if the PC
  327. has neither 7-Zip nor a tar
  328. that opens .7z files
  329. pip install PyAudioWPatch numpy equalizer that follows the
  330. game audio
  331. pip install pycaw comtypes Kega Fusion volume set by the
  332. player's slider
Advertisement
Add Comment
Please, Sign In to add comment