forked from SonicSpeedrunning/LiveSplitASL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSonic.asl
More file actions
153 lines (138 loc) · 5.58 KB
/
Sonic.asl
File metadata and controls
153 lines (138 loc) · 5.58 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
state("Fusion") //converts to big-endian
{
byte seconds : "Fusion.exe", 0x2A52D4, 0xFE24;
byte minutes : "Fusion.exe", 0x2A52D4, 0xFE23;
byte lives : "Fusion.exe", 0x2A52D4, 0xFE12;
byte continues : "Fusion.exe", 0x2A52D4, 0xFE18;
byte zone : "Fusion.exe", 0x2A52D4, 0xFE10;
byte act : "Fusion.exe", 0x2A52D4, 0xFE11;
byte trigger : "Fusion.exe", 0x2A52D4, 0xF600; //new game is 8C, cutscene plays on 0x20
ushort levelframecount : "Fusion.exe", 0x2A52D4, 0xFE04;
}
state("gens") //little endian
{
byte seconds : "gens.exe", 0x40F5C, 0xFE25;
byte minutes : "gens.exe", 0x40F5C, 0xFE22;
byte lives : "gens.exe", 0x40F5C, 0xFE13;
byte continues : "gens.exe", 0x40F5C, 0xFE19;
byte zone : "gens.exe", 0x40F5C, 0xFE11;
byte act : "gens.exe", 0x40F5C, 0xFE10;
byte trigger : "gens.exe", 0x40F5C, 0xF601; //new game is 8C, cutscene plays on 0x20
ushort levelframecount : "gens.exe", 0x40F5C, 0xFE04;
}
state("retroarch", "32bit") //little endian
{
byte seconds : "genesis_plus_gx_libretro.dll", 0x01AF84, 0xFE25;
byte minutes : "genesis_plus_gx_libretro.dll", 0x01AF84, 0xFE22;
byte lives : "genesis_plus_gx_libretro.dll", 0x01AF84, 0xFE13;
byte continues : "genesis_plus_gx_libretro.dll", 0x01AF84, 0xFE19;
byte zone : "genesis_plus_gx_libretro.dll", 0x01AF84, 0xFE11;
byte act : "genesis_plus_gx_libretro.dll", 0x01AF84, 0xFE10;
byte trigger : "genesis_plus_gx_libretro.dll", 0x01AF84, 0xF601; //new game is 8C, cutscene plays on 0x20
ushort levelframecount : "genesis_plus_gx_libretro.dll", 0x01AF84, 0xFE04;
}
state("retroarch", "64bit") //little endian
{
byte seconds : "genesis_plus_gx_libretro.dll", 0x24A3D0, 0xFE25;
byte minutes : "genesis_plus_gx_libretro.dll", 0x24A3D0, 0xFE22;
byte lives : "genesis_plus_gx_libretro.dll", 0x24A3D0, 0xFE13;
byte continues : "genesis_plus_gx_libretro.dll", 0x24A3D0, 0xFE19;
byte zone : "genesis_plus_gx_libretro.dll", 0x24A3D0, 0xFE11;
byte act : "genesis_plus_gx_libretro.dll", 0x24A3D0, 0xFE10;
byte trigger : "genesis_plus_gx_libretro.dll", 0x24A3D0, 0xF601; //new game is 8C, cutscene plays on 0x20
ushort levelframecount : "genesis_plus_gx_libretro.dll", 0x24A3D0, 0xFE04;
}
state("SEGAGameRoom") //little endian
{
byte seconds : "GenesisEmuWrapper.dll", 0xB677E8, 0xFE25;
byte minutes : "GenesisEmuWrapper.dll", 0xB677E8, 0xFE22;
byte lives : "GenesisEmuWrapper.dll", 0xB677E8, 0xFE13;
byte continues : "GenesisEmuWrapper.dll", 0xB677E8, 0xFE19;
byte zone : "GenesisEmuWrapper.dll", 0xB677E8, 0xFE11;
byte act : "GenesisEmuWrapper.dll", 0xB677E8, 0xFE10;
byte trigger : "GenesisEmuWrapper.dll", 0xB677E8, 0xF601; //new game is 8C, cutscene plays on 0x20
ushort levelframecount : "GenesisEmuWrapper.dll", 0xB677E8, 0xFE04;
}
state("SEGAGenesisClassics") //little endian
{
byte seconds : "SEGAGenesisClassics.exe", 0x71704, 0xFE25;
byte minutes : "SEGAGenesisClassics.exe", 0x71704, 0xFE22;
byte lives : "SEGAGenesisClassics.exe", 0x71704, 0xFE13;
byte continues : "SEGAGenesisClassics.exe", 0x71704, 0xFE19;
byte zone : "SEGAGenesisClassics.exe", 0x71704, 0xFE11;
byte act : "SEGAGenesisClassics.exe", 0x71704, 0xFE10;
byte trigger : "SEGAGenesisClassics.exe", 0x71704, 0xF601; //new game is 8C, cutscene plays on 0x20
ushort levelframecount : "SEGAGenesisClassics.exe", 0x71704, 0xFE04;
}
start
{
return (current.trigger == 0x8C && current.act == 0 && current.zone == 0);
}
update
{
// Stores the curent phase the timer is in, so we can use the old one on the next frame.
current.timerPhase = timer.CurrentPhase;
if ((old.timerPhase != current.timerPhase && old.timerPhase != TimerPhase.Paused) && current.timerPhase == TimerPhase.Running)
//pressed start run or autostarted run
{
print("run start detected");
current.totalTime = 0;
vars.pause = true;
}
}
reset
{
return (current.lives == 0 && current.continues == 0);
}
init
{
current.totalTime = 0;
vars.pause = false;
vars.actsplits = new bool[][]
{
new bool[] {true, true, true}, // 0 - Green Hill Zone
new bool[] {true, true, true, true}, // 1 - Labyrinth Zone
new bool[] {true, true, true}, // 2 - Marble Zone
new bool[] {true, true, true}, // 3 - Star Light Zone
new bool[] {true, true, true}, // 4 - Spring Yard Zone
new bool[] {true, true, true} // 5 - Scrap Brain Zone
};
if ( game.ProcessName == "retroarch" ) {
if ( game.Is64Bit() ) {
version = "64bit";
} else {
version = "32bit";
}
}
}
split
{
if ((current.act != old.act || current.zone != old.zone) &&
vars.actsplits[current.zone][current.act] && vars.actsplits[old.zone][old.act]) //act changed or zone changed, and both new and old levels are in the split list
{
if(current.act == 2 && current.zone == 5) vars.pause = true; //the timer keeps counting for 3 seconds at the start of final zone, as SB3 doesn't pause the timer
return true;
}
// Final split
return current.trigger == 0x18;
}
gameTime
{
//main update
if (!vars.pause)
{
if (
(current.seconds == (old.seconds + 1)) && (current.minutes == old.minutes) ||
(current.seconds == 0 && (current.minutes == (old.minutes + 1)))
)
{
current.totalTime++;
}
}
else if (current.levelframecount == 0 && current.seconds == 0 && current.minutes == 0) vars.pause = false; //unpause timer once game time has reset
return TimeSpan.FromSeconds(current.totalTime);
}
isLoading
{
return true;
}