improved disk

This commit is contained in:
Djeeberjr 2022-03-05 03:06:41 +01:00
parent 6b3f0760ca
commit 335992a338
2 changed files with 24 additions and 0 deletions

View File

@ -1,13 +1,36 @@
package kernel.peripherals; package kernel.peripherals;
import kernel.net.Package;
using tink.CoreApi;
class Drive implements IPeripheral { class Drive implements IPeripheral {
public final onDiskInsert:Signal<Noise>;
public final onDiskEject:Signal<Noise>;
private final addr:String; private final addr:String;
private final native:cc.periphs.Disk; private final native:cc.periphs.Disk;
private final onDiskInsertTrigger:SignalTrigger<Noise> = Signal.trigger();
private final onDiskEjectTrigger:SignalTrigger<Noise> = Signal.trigger();
@:allow(kernel.peripherals) @:allow(kernel.peripherals)
private function new(native: cc.periphs.Disk,addr: String) { private function new(native: cc.periphs.Disk,addr: String) {
this.addr = addr; this.addr = addr;
this.native = native; this.native = native;
this.onDiskInsert = this.onDiskInsertTrigger.asSignal();
this.onDiskEject = this.onDiskEjectTrigger.asSignal();
KernelEvents.instance.onDisk.handle((addr) ->{
if (addr == this.addr){
this.onDiskInsertTrigger.trigger(null);
}
});
KernelEvents.instance.onDiskEject.handle((addr)->{
if (addr == this.addr){
this.onDiskEjectTrigger.trigger(null);
}
});
} }
public function getAddr():String { public function getAddr():String {

View File

@ -30,6 +30,7 @@ class Peripheral {
private function updatePeripherals() { private function updatePeripherals() {
findScreens(); findScreens();
findModems(); findModems();
findDrives();
} }
/** /**