Skip to content

Commit 217f080

Browse files
committed
What the f-
1 parent d6afee3 commit 217f080

File tree

3 files changed

+95
-1
lines changed

3 files changed

+95
-1
lines changed

source/archipelago/APPlayState.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class APPlayState extends PlayState {
3232
public static var notePositions:Array<Int> = [0, 1, 2, 3];
3333
public static var validWords:Array<String> = [];
3434
public static var controlButtons:Array<String> = [];
35-
public static var ogScroll:Bool = ClientPrefs.data.downScroll;
35+
public var ogScroll:Bool = ClientPrefs.data.downScroll;
3636
public var allowSetChartModifier:Bool = false;
3737
public var activeItems:Array<Int> = [0, 0, 0, 0]; // Shield, Curse, MHP, Traps
3838
public var itemAmount:Int = 0;

source/yutautil/PointerStorage.hx

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
package backend;
2+
3+
import haxe.ds.StringMap;
4+
import haxe.io.Bytes;
5+
import haxe.io.Eof;
6+
import haxe.io.Input;
7+
import haxe.io.Output;
8+
9+
class Pointer<T> {
10+
private var ref:Ref<T>;
11+
12+
public function new(ref:Ref<T>) {
13+
this.ref = ref;
14+
}
15+
16+
public function get():T {
17+
return ref.value;
18+
}
19+
20+
public function set(value:T):Void {
21+
ref.value = value;
22+
}
23+
}
24+
25+
class Ref<T> {
26+
public var value:T;
27+
28+
public function new(value:T) {
29+
this.value = value;
30+
}
31+
}
32+
33+
class HaxePointer {
34+
private var memory:StringMap<Dynamic>;
35+
private var pointer:Int;
36+
37+
public function new() {
38+
memory = new StringMap<Dynamic>();
39+
pointer = 0;
40+
}
41+
42+
public function allocate(size:Int):Int {
43+
var addr = pointer;
44+
pointer += size;
45+
return addr;
46+
}
47+
48+
public function free(addr:Int):Void {
49+
memory.remove(addr);
50+
}
51+
52+
public function write(addr:Int, data:Dynamic):Void {
53+
memory.set(addr, data);
54+
}
55+
56+
public function read(addr:Int):Dynamic {
57+
return memory.get(addr);
58+
}
59+
60+
public function findByType(type:String):Array<Int> {
61+
var result:Array<Int> = [];
62+
for (key in memory.keys()) {
63+
if (Type.typeof(memory.get(key)).toString() == type) {
64+
result.push(key);
65+
}
66+
}
67+
return result;
68+
}
69+
70+
public function findByValue(value:Dynamic):Array<Int> {
71+
var result:Array<Int> = [];
72+
for (key in memory.keys()) {
73+
if (memory.get(key) == value) {
74+
result.push(key);
75+
}
76+
}
77+
return result;
78+
}
79+
80+
public function dumpMemory():Void {
81+
for (key in memory.keys()) {
82+
trace('Address: $key, Value: ${memory.get(key)}');
83+
}
84+
}
85+
86+
public static function createPointer<T>(value:T):Pointer<T> {
87+
var ref = new Ref<T>(value);
88+
return new Pointer<T>(ref);
89+
}
90+
}

source/yutautil/Sandbox.hx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,9 @@ class Sandbox<T> {
107107
}
108108
return proxy;
109109
}
110+
111+
// private function updateProxy(field:Dynamic, value:Dynamic):Void {
112+
// Reflect.setField(proxy, field, value);
113+
// }
110114
}
111115

0 commit comments

Comments
 (0)