-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSonic2.asl
149 lines (133 loc) · 5.36 KB
/
Sonic2.asl
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
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
}
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
}
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
}
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
}
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
}
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
}
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;
}
}
reset
{
return (current.lives == 0 && current.continues == 0);
}
init
{
current.totalTime = 0;
vars.actsplits = new bool[][]
{
new bool[] {true, true}, // 0 - Emerald Hill Zone
new bool[] {false, false}, // 1 - unused
new bool[] {false, false}, // 2 - unused
new bool[] {false, false}, // 3 - unused
new bool[] {true, true}, // 4 - Metropolis
new bool[] {true, false}, // 5
new bool[] {true, false}, // 6 - Wing Fortress
new bool[] {true, true}, // 7 - Hill Top
new bool[] {false, false}, // 8 - unused
new bool[] {false, false}, // 9 - unused
new bool[] {true, true}, // 10 - Oil Ocean
new bool[] {true, true}, // 11 - Mystic Cave
new bool[] {true, true}, // 12 - Casino Night
new bool[] {true, true}, // 13 - Chemical Plant
new bool[] {true, false}, // 14 - Death Egg
new bool[] {true, true}, // 15 - Aquatic Ruin
new bool[] {true, false} // 16 - Sky Chase
};
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
return true;
// Final split
return current.trigger == 0x20;
}
gameTime
{
//main update
if (
(current.seconds == (old.seconds + 1)) && (current.minutes == old.minutes) ||
(current.seconds == 0 && (current.minutes == (old.minutes + 1)))
) {
current.totalTime++;
}
return TimeSpan.FromSeconds(current.totalTime);
}
isLoading
{
return true;
}