6502.ts
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -0,1 +1,14 @@ | ||
# 1.0.3 | ||
## stellerator-embedded | ||
* First release after the 1.x rewrite | ||
* Support the new video settings | ||
* Rework the documentation | ||
* Example page: load the ROM via `fetch` | ||
## Stellerator | ||
* Documentation | ||
# 1.0.2 | ||
@@ -2,0 +15,0 @@ |
import { EventInterface as Event } from 'microevent.ts'; | ||
import CartridgeInfo from '../../../machine/stella/cartridge/CartridgeInfo'; | ||
import ControlPanel from './ControlPanel'; | ||
declare class Stellerator { | ||
export declare class Stellerator { | ||
constructor(canvasElt: HTMLCanvasElement | null, workerUrl: string, config?: Partial<Stellerator.Config>); | ||
setGamma(gamma: number): this; | ||
getGamma(): number; | ||
enablePovSimulation(povEnabled: boolean): this; | ||
isPovSimulationEnabled(): boolean; | ||
enableSmoothScaling(smoothScalingEnabled: boolean): this; | ||
smoothScalingEnabled(): boolean; | ||
setScalingMode(scalingMode: Stellerator.ScalingMode): this; | ||
getScalingMode(): Stellerator.ScalingMode; | ||
setTvEmulation(tvEmulation: Stellerator.TvEmulation): this; | ||
getTvEmulation(): Stellerator.TvEmulation; | ||
setPhosphorLevel(phosphorLevel: number): this; | ||
getPhosphorLevel(): number; | ||
setScanlineLevel(scanlineLevel: number): this; | ||
getScanlineLevel(): number; | ||
toggleFullscreen(fullscreen?: boolean): this; | ||
@@ -58,7 +62,9 @@ isFullscreen(): boolean; | ||
} | ||
declare namespace Stellerator { | ||
export declare namespace Stellerator { | ||
interface Config { | ||
smoothScaling: boolean; | ||
simulatePov: boolean; | ||
gamma: number; | ||
scalingMode: ScalingMode; | ||
tvEmulation: TvEmulation; | ||
phosphorLevel: number; | ||
scanlineLevel: number; | ||
audio: boolean; | ||
@@ -84,2 +90,12 @@ volume: number; | ||
} | ||
enum TvEmulation { | ||
composite = "composite", | ||
svideo = "svideo", | ||
none = "none" | ||
} | ||
enum ScalingMode { | ||
qis = "qis", | ||
bilinear = "bilinear", | ||
none = "none" | ||
} | ||
interface CartridgeConfig { | ||
@@ -86,0 +102,0 @@ cartridgeType: CartridgeInfo.CartridgeType; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = void 0; | ||
exports.default = exports.Stellerator = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -62,12 +62,12 @@ const async_mutex_1 = require("async-mutex"); | ||
this._canvasElt = canvasElt; | ||
this._config = Object.assign({ smoothScaling: true, simulatePov: true, gamma: 1, audio: true, volume: 0.5, enableKeyboard: true, enableTouch: true, touchLeftHanded: false, touchJoystickSensitivity: 15, keyboardTarget: document, fullscreenViaKeyboard: true, paddleViaMouse: true, pauseViaKeyboard: true, pauseViaTouch: true, fullscreenViaTouch: true, enableGamepad: true, resetViaKeyboard: true }, config); | ||
this._config = Object.assign({ gamma: 1, scalingMode: Stellerator.ScalingMode.qis, tvEmulation: Stellerator.TvEmulation.composite, phosphorLevel: 0.5, scanlineLevel: 0.2, audio: true, volume: 0.5, enableKeyboard: true, enableTouch: true, touchLeftHanded: false, touchJoystickSensitivity: 15, keyboardTarget: document, fullscreenViaKeyboard: true, paddleViaMouse: true, pauseViaKeyboard: true, pauseViaTouch: true, fullscreenViaTouch: true, enableGamepad: true, resetViaKeyboard: true }, config); | ||
this._emulationService = new EmulationService_1.default(workerUrl); | ||
this.frequencyUpdate = this._emulationService.frequencyUpdate; | ||
const stateChange = new microevent_ts_1.Event(); | ||
this._emulationService.stateChanged.addHandler(newState => stateChange.dispatch(this._mapState(newState))); | ||
this._emulationService.stateChanged.addHandler((newState) => stateChange.dispatch(this._mapState(newState))); | ||
this.stateChange = stateChange; | ||
this._createDrivers(); | ||
this._driverManager.addDriver(this._controlPanel, context => this._controlPanel.bind(context.getControlPanel())); | ||
this._driverManager.addDriver(this._controlPanel, (context) => this._controlPanel.bind(context.getControlPanel())); | ||
this._driverManager.bind(this._emulationService); | ||
this._serviceInitialized = this._emulationService.init().then(undefined, e => { | ||
this._serviceInitialized = this._emulationService.init().then(undefined, (e) => { | ||
console.log(e); | ||
@@ -78,27 +78,41 @@ throw e; | ||
setGamma(gamma) { | ||
if (this._videoDriver) { | ||
} | ||
this._config.gamma = gamma; | ||
this._createVideoDriver(); | ||
return this; | ||
} | ||
getGamma() { | ||
return 1; | ||
return this._config.gamma; | ||
} | ||
enablePovSimulation(povEnabled) { | ||
if (this._videoDriver) { | ||
} | ||
this._config.simulatePov = povEnabled; | ||
setScalingMode(scalingMode) { | ||
this._config.scalingMode = scalingMode; | ||
this._createVideoDriver(); | ||
return this; | ||
} | ||
isPovSimulationEnabled() { | ||
return false; | ||
getScalingMode() { | ||
return this._config.scalingMode; | ||
} | ||
enableSmoothScaling(smoothScalingEnabled) { | ||
if (this._videoDriver) { | ||
} | ||
setTvEmulation(tvEmulation) { | ||
this._config.tvEmulation = tvEmulation; | ||
this._createVideoDriver(); | ||
return this; | ||
} | ||
smoothScalingEnabled() { | ||
return false; | ||
getTvEmulation() { | ||
return this._config.tvEmulation; | ||
} | ||
setPhosphorLevel(phosphorLevel) { | ||
this._config.phosphorLevel = phosphorLevel; | ||
this._createVideoDriver(); | ||
return this; | ||
} | ||
getPhosphorLevel() { | ||
return this._config.phosphorLevel; | ||
} | ||
setScanlineLevel(scanlineLevel) { | ||
this._config.scanlineLevel = scanlineLevel; | ||
this._createVideoDriver(); | ||
return this; | ||
} | ||
getScanlineLevel() { | ||
return this._config.scanlineLevel; | ||
} | ||
toggleFullscreen(fullscreen) { | ||
@@ -162,3 +176,3 @@ if (!this._fullscreenVideo) { | ||
tvMode: this._convertTvMode(tvMode), | ||
pcmAudio: true | ||
pcmAudio: true, | ||
}); | ||
@@ -236,4 +250,4 @@ if (typeof config.randomSeed !== 'undefined' && config.randomSeed > 0) { | ||
this._audioDriver.setMasterVolume(this._config.volume); | ||
this._driverManager.addDriver(this._audioDriver, context => this._audioDriver.bind(true, [context.getPCMChannel()])); | ||
this._emulationService.stateChanged.addHandler(newState => { | ||
this._driverManager.addDriver(this._audioDriver, (context) => this._audioDriver.bind(true, [context.getPCMChannel()])); | ||
this._emulationService.stateChanged.addHandler((newState) => { | ||
switch (newState) { | ||
@@ -255,3 +269,3 @@ case EmulationServiceInterface_1.default.State.running: | ||
this._keyboardIO = new KeyboardIO_1.default(this._config.keyboardTarget); | ||
this._driverManager.addDriver(this._keyboardIO, context => this._keyboardIO.bind(context.getJoystick(0), context.getJoystick(1), context.getControlPanel())); | ||
this._driverManager.addDriver(this._keyboardIO, (context) => this._keyboardIO.bind(context.getJoystick(0), context.getJoystick(1), context.getControlPanel())); | ||
if (this._config.fullscreenViaKeyboard) { | ||
@@ -270,5 +284,5 @@ this._keyboardIO.toggleFullscreen.addHandler(() => this._fullscreenVideo && this._fullscreenVideo.toggle()); | ||
this._gamepad.init(); | ||
this._driverManager.addDriver(this._gamepad, context => this._gamepad.bind([context.getJoystick(0), context.getJoystick(1)], { | ||
this._driverManager.addDriver(this._gamepad, (context) => this._gamepad.bind([context.getJoystick(0), context.getJoystick(1)], { | ||
["start"]: context.getControlPanel().getResetButton(), | ||
["select"]: context.getControlPanel().getSelectSwitch() | ||
["select"]: context.getControlPanel().getSelectSwitch(), | ||
})); | ||
@@ -278,3 +292,3 @@ } | ||
this._paddle = new MouseAsPaddle_1.default(); | ||
this._driverManager.addDriver(this._paddle, context => this._paddle.bind(context.getPaddle(0))); | ||
this._driverManager.addDriver(this._paddle, (context) => this._paddle.bind(context.getPaddle(0))); | ||
} | ||
@@ -302,4 +316,10 @@ this._asyncIO = new AsyncIO_1.default(); | ||
} | ||
this._videoDriver = new Video_1.default(this._canvasElt).init(); | ||
this._driverManager.addDriver(this._videoDriver, context => this._videoDriver.bind(context.getVideo())); | ||
this._videoDriver = new Video_1.default(this._canvasElt, { | ||
gamma: this._config.gamma, | ||
scalingMode: this._config.scalingMode, | ||
tvEmulation: this._config.tvEmulation, | ||
phosphorLevel: this._config.phosphorLevel, | ||
scanlineLevel: this._config.scanlineLevel, | ||
}).init(); | ||
this._driverManager.addDriver(this._videoDriver, (context) => this._videoDriver.bind(context.getVideo())); | ||
this._fullscreenVideo = new FullscreenVideo_1.default(this._videoDriver); | ||
@@ -321,3 +341,3 @@ } | ||
this._touchIO = new TouchIO_1.default(this._canvasElt, this._config.touchJoystickSensitivity, this._config.touchLeftHanded); | ||
this._driverManager.addDriver(this._touchIO, context => this._touchIO.bind(context.getJoystick(0), context.getControlPanel())); | ||
this._driverManager.addDriver(this._touchIO, (context) => this._touchIO.bind(context.getJoystick(0), context.getControlPanel())); | ||
if (this._config.pauseViaTouch) { | ||
@@ -346,2 +366,3 @@ this._touchIO.togglePause.addHandler(this._pauseHandler); | ||
} | ||
exports.Stellerator = Stellerator; | ||
exports.default = Stellerator; | ||
@@ -355,2 +376,14 @@ (function (Stellerator) { | ||
})(TvMode = Stellerator.TvMode || (Stellerator.TvMode = {})); | ||
let TvEmulation; | ||
(function (TvEmulation) { | ||
TvEmulation["composite"] = "composite"; | ||
TvEmulation["svideo"] = "svideo"; | ||
TvEmulation["none"] = "none"; | ||
})(TvEmulation = Stellerator.TvEmulation || (Stellerator.TvEmulation = {})); | ||
let ScalingMode; | ||
(function (ScalingMode) { | ||
ScalingMode["qis"] = "qis"; | ||
ScalingMode["bilinear"] = "bilinear"; | ||
ScalingMode["none"] = "none"; | ||
})(ScalingMode = Stellerator.ScalingMode || (Stellerator.ScalingMode = {})); | ||
Stellerator.CartridgeType = CartridgeInfo_1.default.CartridgeType; | ||
@@ -371,4 +404,4 @@ Stellerator.describeCartridgeType = CartridgeInfo_1.default.describeCartridgeType; | ||
})(CpuAccuracy = Stellerator.CpuAccuracy || (Stellerator.CpuAccuracy = {})); | ||
})(Stellerator || (Stellerator = {})); | ||
})(Stellerator = exports.Stellerator || (exports.Stellerator = {})); | ||
exports.default = Stellerator; | ||
//# sourceMappingURL=Stellerator.js.map |
{ | ||
"name": "6502.ts", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A 6502 emulator written in typescript", | ||
@@ -74,2 +74,4 @@ "author": "cnspeckn@googlemail.com", | ||
"tslint": "^6.1.3", | ||
"typedoc": "^0.20.19", | ||
"typedoc-plugin-jekyll": "^0.1.0", | ||
"typescript": "^4.0.3" | ||
@@ -76,0 +78,0 @@ }, |
Sorry, the diff of this file is not supported yet
2327736
21464
42