Skip to content

Commit 529bd19

Browse files
committed
New loader: DEPLS project loader
1 parent f30bab3 commit 529bd19

File tree

7 files changed

+300
-690
lines changed

7 files changed

+300
-690
lines changed

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,27 @@ Please see `docs/How_To_Setup.md`
1313
Components
1414
==========
1515

16-
Live Simulator: 2 uses these special components:
16+
Live Simulator: 2 uses these special components specially created for this project:
1717

18-
* AquaShine Loader (base/core component that runs Live Simulator: 2). Please see `docs/AquaShine.md` for more information about this component.
18+
* AquaShine. Please see `docs/AquaShine.md` for more information about this component.
1919

20-
* NoteLoader, internal component responsible of loading beatmaps from variety of different formats.
20+
* NoteLoader, internal component responsible of loading beatmaps from variety of different formats. Depends on AquaShine
21+
22+
* LS2, Live Simulator: 2 binary beatmap parser and generator.
2123

2224
Live Simulator: 2 uses these external libraries to run:
2325

2426
* [Yohane Playground Flash Abstraction](https://github.com/MikuAuahDark/Yohane)
2527

26-
* [Shelsha Playground Texture Bank Loader](https://github.com/MikuAuahDark/Shelsha)
27-
2828
* [LuaBit](http://luaforge.net/projects/bit/) (when running under Lua 5.1)
2929

30-
* [tween.lua](https://github.com/kikito/tween.lua) (for most animations)
30+
* [tween.lua](https://github.com/kikito/tween.lua)
3131

32-
* [JSON.lua](http://regex.info/blog/lua/json) (to load SIF and LLP beatmap)
32+
* [JSON.lua](http://regex.info/blog/lua/json)
33+
34+
Live Simulator: 2 uses these external libraries if available:
35+
36+
* [FFmpeg 3.2](http://ffmpeg.org/) (Windows & Android)
3337

3438
Controls
3539
========
@@ -46,12 +50,16 @@ Controls
4650

4751
* F6 = Turn the song volume up by 5%
4852

53+
* PageUp = Increase speed factor by 2x (max 400%)
54+
55+
* PageDown = Decrease speed factor by 2x (min 6.25%)
56+
4957
* Backspace = Restart live simulator
5058

5159
Supported Beatmaps
5260
==================
5361

54-
* Raw SIF beatmap, this is main beatmap format that Live Simulator: 2 internally uses.
62+
* SIF beatmap, this is main beatmap format that Live Simulator: 2 uses.
5563

5664
* Sukufesu Simulator beatmap, yuyu live simulator beatmap.
5765

@@ -96,14 +104,6 @@ Motoya L Maru font license.
96104

97105
Live Simulator: 2 uses image asset from Love Live! School Idol Festival.
98106

99-
Live Simulator: 2 uses these external libraries:
100-
101-
* [tween.lua](https://github.com/kikito/tween.lua)
102-
103-
* [JSON.lua](http://regex.info/blog/lua/json)
104-
105-
* Lua FFT library (`luafft.lua`)
106-
107-
* LuaBit library (`bit.lua`) (fallback: used if `bit` library is unavailable)
107+
Live Simulator: 2 uses FFmpeg when available, and it's licensed under GNU GPLv3
108108

109109
Please see respective files (or website) for license of those libraries.

TODO.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ v1.1.3
1717
v2.0
1818
- FFmpeg extension OK
1919
- Unit creation
20-
- NoteLoader2 (metadata loading, beatmap verification) OK (core, TODO: Loaders)
20+
- NoteLoader2 (metadata loading, beatmap verification) OK
2121
- Hidden note and sudden note
2222
- Individual note speed OK
2323
- Live Show! Failed

livesim.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
-- Live Simulator: 2, enhanced version of DEPLS!
1+
-- Live Simulator: 2
2+
-- High-performance LL!SIF Live Simulator
23
-- See copyright notice in main.lua
34

45
local love = love

main.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
--]]---------------------------------------------------------------------------
2525

2626
-- Version
27-
DEPLS_VERSION = "2.0-20170701"
28-
DEPLS_VERSION_NUMBER = 01010402 -- xxyyzzww. x = major, y = minor, z = patch, w = pre-release counter
27+
DEPLS_VERSION = "2.0-beta1"
28+
DEPLS_VERSION_NUMBER = 01010501 -- xxyyzzww. x = major, y = minor, z = patch, w = pre-release counter
2929

3030
----------------------
3131
-- AquaShine loader --

noteloader/load_depls.lua

Lines changed: 278 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
-- Dark Energy Processor Live Simulator beatmap project loader
2+
-- Part of Live Simulator: 2
3+
-- See copyright notice in main.lua
4+
5+
local AquaShine, NoteLoader = ...
6+
local love = love
7+
local LuaStoryboard = require("luastoryboard2")
8+
local DEPLSLoader = {ProjectLoader = true}
9+
local DEPLSBeatmap = {}
10+
DEPLSBeatmap.__index = NoteLoader.NoteLoaderNoteObject._derive(DEPLSBeatmap)
11+
12+
------------------
13+
-- DEPLS Loader --
14+
------------------
15+
16+
function DEPLSLoader.GetLoaderName()
17+
return "DEPLS Beatmap Project"
18+
end
19+
20+
function DEPLSLoader.LoadNoteFromFilename(file)
21+
local this = {}
22+
this.project_dir = file
23+
24+
-- At least one DEPLS beatmap project must have "beatmap.*"
25+
-- file which is supported by NoteLoader2
26+
for _, v in ipairs(love.filesystem.getDirectoryItems(file)) do
27+
if v:find("^beatmap%.[^%.]+$") == 1 then
28+
-- Looks like we have one here. Try to load it
29+
-- NoteLoader will return nil if it's not supported
30+
this.note_object = NoteLoader.NoteLoader(file.."/"..v)
31+
end
32+
33+
if this.note_object then break end
34+
end
35+
36+
assert(this.note_object, "No beatmap file found")
37+
return setmetatable(this, DEPLSBeatmap)
38+
end
39+
40+
--------------------------
41+
-- DEPLS Beatmap Object --
42+
--------------------------
43+
44+
function DEPLSBeatmap.GetNotesList(this)
45+
return this.note_object:GetNotesList()
46+
end
47+
48+
function DEPLSBeatmap.GetName(this)
49+
if not(this.name) then
50+
this.name = this.note_object:GetName()
51+
52+
-- If it's named "beatmap", then it should take it from
53+
-- NoteLoader argument. In that case, don't use that name
54+
if this.name == "beatmap" then
55+
local cover_info = this:GetCoverArt()
56+
57+
if cover_info and cover_info.title then
58+
this.name = cover_info.title
59+
else
60+
this.name = NoteLoader._GetBasenameWOExt(this.project_dir)
61+
end
62+
end
63+
end
64+
65+
return this.name
66+
end
67+
68+
function DEPLSBeatmap.GetBeatmapTypename(this)
69+
if not(this.typename) then
70+
this.typename = "DEPLS Project: "..this.note_object:GetBeatmapTypename()
71+
end
72+
73+
return this.typename
74+
end
75+
76+
function DEPLSBeatmap.GetCoverArt(this)
77+
if not(this.cover_loaded) then
78+
local cover_info = this.project_dir.."/cover.txt"
79+
local cover_img = this.project_dir.."/cover.png"
80+
81+
if love.filesystem.isFile(cover_info) and love.filesystem.isFile(cover_img) then
82+
local line = love.filesystem.lines(cover_info)
83+
84+
this.cover = {}
85+
this.cover.image = love.graphics.newImage(cover_img)
86+
this.cover.title = line()
87+
this.cover.arrangement = line()
88+
else
89+
this.cover = this.note_object:GetCoverArt()
90+
end
91+
92+
this.cover_loaded = true
93+
end
94+
95+
return this.cover
96+
end
97+
98+
function DEPLSBeatmap.GetCustomUnitInformation(this)
99+
if not(this.custom_unit) then
100+
local image_cache = {}
101+
this.custom_unit = {}
102+
this.note_object_custom_unit = this.note_object:GetCustomUnitInformation(this)
103+
104+
for i = 1, 9 do
105+
local filename = this.project_dir.."/unit_pos_"..i..".txt"
106+
107+
if love.filesystem.isFile(filename) then
108+
local image_name = love.filesystem.read(filename)
109+
110+
if not(image_cache[image_name]) then
111+
image_cache[image_name] = love.graphics.newImage(this.project_dir.."/"..image_name)
112+
end
113+
114+
this.custom_unit[i] = image_cache[image_name]
115+
else
116+
local image_name = "unit_pos_"..i..".png"
117+
filename = this.project_dir.."/"..image_name
118+
119+
if not(image_cache[image_name]) and love.filesystem.isFile(filename) then
120+
image_cache[image_name] = love.graphics.newImage(filename)
121+
end
122+
123+
this.custom_unit[i] = image_cache[image_name]
124+
end
125+
126+
this.custom_unit[i] = this.custom_unit[i] or this.note_object_custom_unit[i]
127+
end
128+
end
129+
130+
return this.custom_unit
131+
end
132+
133+
function DEPLSBeatmap.GetScoreInformation(this)
134+
return this.note_object:GetScoreInformation()
135+
end
136+
137+
function DEPLSBeatmap.GetStoryboard(this)
138+
-- 1. Get "storyboard.lua" file
139+
local storyboard_file = this.project_dir.."/storyboard.lua"
140+
141+
if love.filesystem.isFile(storyboard_file) then
142+
return LuaStoryboard.Load(storyboard_file)
143+
end
144+
145+
return this.note_object:GetStoryboard()
146+
end
147+
148+
function DEPLSBeatmap.GetBackgroundID(this)
149+
local bgobj = this:GetCustomBackground()
150+
151+
if bgobj then
152+
return -1
153+
end
154+
155+
local bgidname = this.project_dir.."/background.txt"
156+
if not(this.bgid_loaded) and love.filesystem.isFile(bgidname) then
157+
this.bgid = tonumber(love.filesystem.read(bgidname))
158+
this.bgid_loaded = true
159+
end
160+
161+
return this.bgid or 0
162+
end
163+
164+
local supported_img_fmts = {".png", ".jpg", ".bmp"}
165+
function DEPLSBeatmap.GetCustomBackground(this)
166+
if not(this.bg_loaded) then
167+
for _, ext in ipairs(supported_img_fmts) do
168+
local bgname = this.project_dir.."/background"..ext
169+
170+
if love.filesystem.isFile(bgname) then
171+
this.background = {}
172+
this.background[0] = love.graphics.newImage(bgname)
173+
174+
for i = 1, 4 do
175+
bgname = this.project_dir.."/background-"..i..ext
176+
177+
if love.filesystem.isFile(bgname) then
178+
this.background[i] = love.graphics.newImage(bgname)
179+
end
180+
end
181+
182+
if not(this.background[1] and this.background[2]) then
183+
AquaShine.Log("NoteLoader2/load_depls", "Non-balanced background (only contain left or right part). Removed")
184+
this.backgound[1], this.background[2] = nil, nil
185+
end
186+
187+
if not(this.background[3] and this.background[4]) then
188+
AquaShine.Log("NoteLoader2/load_depls", "Non-balanced background (only contain top or bottom part). Removed")
189+
this.backgound[3], this.background[4] = nil, nil
190+
end
191+
192+
break
193+
end
194+
end
195+
196+
this.bg_loaded = true
197+
end
198+
199+
return this.background
200+
end
201+
202+
local supported_video_fmts = {".ogg", ".ogv"}
203+
if AquaShine.FFmpegExt then
204+
supported_video_fmts[#supported_video_fmts + 1] = ".mp4"
205+
supported_video_fmts[#supported_video_fmts + 1] = ".mkv"
206+
supported_video_fmts[#supported_video_fmts + 1] = ".avi"
207+
supported_video_fmts[#supported_video_fmts + 1] = ".flv"
208+
end
209+
function DEPLSBeatmap.GetVideoBackground(this)
210+
if not(this.video_loaded) then
211+
for _, v in ipairs(supported_video_fmts) do
212+
local name = this.project_folder.."/video_background"..v
213+
214+
if love.filesystem.isFile(name) then
215+
local message
216+
this.video, message = AquaShine.LoadVideo(name)
217+
218+
if not(this.video) then
219+
AquaShine.Log("NoteLoader2/load_depls", "Failed to load video: %s", message)
220+
end
221+
222+
break
223+
end
224+
end
225+
226+
this.video_loaded = true
227+
end
228+
229+
return this.video
230+
end
231+
232+
function DEPLSBeatmap.GetScorePerTap(this)
233+
return this.note_object:GetScorePerTap()
234+
end
235+
236+
function DEPLSBeatmap.GetStamina(this)
237+
return this.note_object:GetStamina()
238+
end
239+
240+
function DEPLSBeatmap.GetNotesStyle(this)
241+
return this.note_object:GetNotesStyle()
242+
end
243+
244+
function DEPLSBeatmap.GetBeatmapAudio(this)
245+
if not(this.audio_loaded) then
246+
-- 1. Load songFile.wav/ogg/mp3 file
247+
this.audio = AquaShine.LoadAudio(this.project_dir.."/songFile.wav")
248+
249+
if not(this.audio) then
250+
-- 2. Load embedded audio from beatmap
251+
this.audio = this.note_object:GetBeatmapAudio()
252+
253+
if not(this.audio) then
254+
-- 3. Load from audio/ folder
255+
this.audio = AquaShine.LoadAudio("audio/"..AquaShine.Basename(this.project_dir)..".wav")
256+
end
257+
end
258+
259+
this.audio_loaded = true
260+
end
261+
262+
return this.audio
263+
end
264+
265+
function DEPLSBeatmap.GetLiveClearSound(this)
266+
return AquaShine.LoadAudio(this.project_dir.."/live_clear.wav") or this.note_object:GetLiveClearSound()
267+
end
268+
269+
function DEPLSBeatmap.GetStarDifficultyInfo(this)
270+
return this.note_object:GetStarDifficultyInfo()
271+
end
272+
273+
function DEPLSBeatmap.ReleaseBeatmapAudio(this)
274+
this.audio_loaded, this.audio = false, nil
275+
return this.note_object:ReleaseBeatmapAudio()
276+
end
277+
278+
return DEPLSLoader

0 commit comments

Comments
 (0)