-
Notifications
You must be signed in to change notification settings - Fork 1
/
Getgames.CB
65 lines (47 loc) · 1.44 KB
/
Getgames.CB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//Hakee pelit Games kansiosta ja kirjoittaa sopivat include tiedostot
Type game
Field id$
End Type
GetGames("Games","Start.cb","Stop.cb","Include.cb")
Function GetGames(subdir$,startfile$,endfile$,includefile$)
cd$ = CurrentDir()
If ( IsDirectory(subdir$) ) Then ChDir subdir$
StartSearch
Repeat
file$=FindFile()
If( IsDirectory(file$) And file$ <> "." And file$ <> "..") Then
If( FileExists(file$+"\gameinfo.ini") And FileExists(file$+"\logo.png") And FileExists(file$+"\main.cb") ) Then
g.game = New(game)
g\id = file$
EndIf
EndIf
Until file$ = ""
'End search
EndSearch
f = OpenToWrite(startfile$)
WriteLine f,"Select ID$"
For g.game = Each game
WriteLine f," Case "+Chr(34)+g\id+Chr(34)
WriteLine f," "+g\id+"_Game()"
Next g
WriteLine f,"Default"
WriteLine f," MakeError "+Chr(34)+"Peliä "+Chr(34)+" + ID$ + "+Chr(34)+" ei löytynyt!"+Chr(34)
WriteLine f,"EndSelect"
CloseFile f
f = OpenToWrite(endfile$)
WriteLine f,"Select ID$"
For g.game = Each game
WriteLine f," Case "+Chr(34)+g\id+Chr(34)
WriteLine f," "+g\id+"_End()"
Next g
WriteLine f,"Default"
WriteLine f," //Game is Not running"
WriteLine f,"EndSelect"
CloseFile f
f = OpenToWrite(includefile$)
For g.game = Each game
WriteLine f,"Include "+Chr(34)+"Games\"+g\id+"\Main.cb"+Chr(34)
WriteLine f,"MAIN_AddGame("+Chr(34)+g\id+Chr(34)+")"
Next g
CloseFile f
EndFunction