Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fullscreenViaKeyboard: true,
paddleViaMouse: true,
pauseViaKeyboard: true,
pauseViaTouch: true,
fullscreenViaTouch: true,
enableGamepad: true,
resetViaKeyboard: true,
...config
};
this._emulationService = new EmulationService(workerUrl);
this.frequencyUpdate = this._emulationService.frequencyUpdate;
const stateChange = new EventImplementation();
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.bind(this._emulationService);
this._serviceInitialized = this._emulationService.init().then(undefined, e => {
console.log(e);
throw e;
});
}
constructor(fsProvider: FilesystemProviderInterface, protected _cartridgeFile?: string) {
super(fsProvider);
this.events.stateChanged = new Event();
const systemConfigSetupProvider = new SystemConfigSetupProvider(this._stellaConfig);
this._commandInterpreter.registerCommands({
run: () => (this._setState(StellaCLI.State.run), 'running...')
});
this._runModeCommandInterpreter = new CommandInterpreter({
stop: () => (this._setState(StellaCLI.State.debug), 'stopped, entered debugger')
});
this._setupModeCommandInterpreter = new CommandInterpreter({
'load-cartridge': this._executeLoadCartridge.bind(this)
});
this._setupModeCommandInterpreter.registerCommands(systemConfigSetupProvider.getCommands());
if (victim._isAvailable) {
if (this._poolSize > 1) {
this._pool[victim._poolPosition] = this._pool[this._poolSize - 1];
}
this._poolSize--;
}
victim._isDisposed = true;
this.event.dispose.dispatch(victim.get());
}
event = {
release: new Event(),
dispose: new Event()
};
private _pool: Array> = [];
private _poolSize = 0;
}
namespace Pool {
export interface FactoryInterface {
(): T;
}
export interface RecycleCallbackInterface {
(value: T): void;
}
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
import { Event } from 'microevent.ts';
abstract class AbstractCLI {
events: AbstractCLI.Events = {
outputAvailable: new Event(),
quit: new Event(),
promptChanged: new Event(),
prompt: new Event(),
availableCommandsChanged: new Event()
};
}
namespace AbstractCLI {
export interface Events {
outputAvailable: Event;
quit: Event;
promptChanged: Event;
prompt: Event;
getLastAddresBusValue(): number {
return this._lastAddressBusValue;
}
private triggerTrap(reason: Bus.TrapReason, message?: string): void {
if (this.event.trap.hasHandlers) {
this.event.trap.dispatch(new Bus.TrapPayload(reason, this, message));
} else {
throw new Error(message);
}
}
event = {
trap: new Event(),
read: new Event(),
write: new Event()
};
private _tia: Tia = null;
private _pia: Pia = null;
private _cartridge: CartridgeInterface = null;
private _lastDataBusValue = 0;
private _lastAddressBusValue = 0;
}
namespace Bus {
export const enum TrapReason {
tia,
pia,
cartridge
getLastAddresBusValue(): number {
return this._lastAddressBusValue;
}
private triggerTrap(reason: Bus.TrapReason, message?: string): void {
if (this.event.trap.hasHandlers) {
this.event.trap.dispatch(new Bus.TrapPayload(reason, this, message));
} else {
throw new Error(message);
}
}
event = {
trap: new Event(),
read: new Event(),
write: new Event()
};
private _tia: Tia = null;
private _pia: Pia = null;
private _cartridge: CartridgeInterface = null;
private _lastDataBusValue = 0;
private _lastAddressBusValue = 0;
}
namespace Bus {
export const enum TrapReason {
tia,
pia,
cartridge
}
if (victim._isAvailable) {
if (this._poolSize > 1) {
this._pool[victim._poolPosition] = this._pool[this._poolSize - 1];
}
this._poolSize--;
}
victim._isDisposed = true;
this.event.dispose.dispatch(victim.get());
}
event = {
release: new Event(),
dispose: new Event()
};
private _pool: Array> = [];
private _poolSize = 0;
}
namespace Pool {
export interface FactoryInterface {
(): T;
}
export interface RecycleCallbackInterface {
(value: T): void;
}
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
import { Event } from 'microevent.ts';
abstract class AbstractCLI {
events: AbstractCLI.Events = {
outputAvailable: new Event(),
quit: new Event(),
promptChanged: new Event(),
prompt: new Event(),
availableCommandsChanged: new Event()
};
}
namespace AbstractCLI {
export interface Events {
outputAvailable: Event;
quit: Event;
promptChanged: Event;
prompt: Event;
availableCommandsChanged: Event;
}
}
getLastAddresBusValue(): number {
return this._lastAddressBusValue;
}
private triggerTrap(reason: Bus.TrapReason, message?: string): void {
if (this.event.trap.hasHandlers) {
this.event.trap.dispatch(new Bus.TrapPayload(reason, this, message));
} else {
throw new Error(message);
}
}
event = {
trap: new Event(),
read: new Event(),
write: new Event()
};
private _tia: Tia = null;
private _pia: Pia = null;
private _cartridge: CartridgeInterface = null;
private _lastDataBusValue = 0;
private _lastAddressBusValue = 0;
}
namespace Bus {
export const enum TrapReason {
tia,
pia,