Core could really do with a few major updates.
Audio Engine Refactor
Audio engine needs rewritten to use AudioWorkletNode, to resolve the "black screen" stalls caused by deprecated audio nodes.
Storage Decoupling
Remove all direct localStorage calls to eliminate security errors in sandboxed environments.
Rewrite the saveState and loadState methods to be asynchronous.
core needs modified so it no longer calls setItem or getItem directly. Instead, have the core emit a window.parent.postMessage containing the data to be saved.
Create a listener within the core that waits for an external message to trigger a state injection (loading).
UI/Core Separation
monolithic GUI needs to be stripped to prevent TypeError crashes and "Select Cartridge" screen loops.
In other words the core needs refactored to run as a 'headless' core without a built in UI.
As well as removing jt.ScreenGUI class and all logic that injects CSS or manipulates the DOM.
Also the jt.Room initialization needs simplified so it only requires a target element for video output.
fileloader logic needs modified to bypass the internal 'Insert Cartridge' screen so it starts the ROM immediately upon receiving a valid "CARTRIDGE_URL."
Timing & Worker Implementation
Improve performance by moving emulation tasks off the main thread.
Make it analyze the main emulation loop (look for requestAnimationFrame or jt.Room.update).
The CPU cycle counting logic needs optimized to ensure the 6502 CPU and TIA video chip remain in sync.
The refactored core needs packed so it can run inside a web worker.
Also need to define a message passing interface to bridge the main thread (user inputs and video rendering) with the worker thread (CPU execution and audio generation).
Core could really do with a few major updates.
Audio Engine Refactor
Audio engine needs rewritten to use AudioWorkletNode, to resolve the "black screen" stalls caused by deprecated audio nodes.
Storage Decoupling
Remove all direct localStorage calls to eliminate security errors in sandboxed environments.
Rewrite the saveState and loadState methods to be asynchronous.
core needs modified so it no longer calls setItem or getItem directly. Instead, have the core emit a window.parent.postMessage containing the data to be saved.
Create a listener within the core that waits for an external message to trigger a state injection (loading).
UI/Core Separation
monolithic GUI needs to be stripped to prevent TypeError crashes and "Select Cartridge" screen loops.
In other words the core needs refactored to run as a 'headless' core without a built in UI.
As well as removing jt.ScreenGUI class and all logic that injects CSS or manipulates the DOM.
Also the jt.Room initialization needs simplified so it only requires a target element for video output.
fileloader logic needs modified to bypass the internal 'Insert Cartridge' screen so it starts the ROM immediately upon receiving a valid "CARTRIDGE_URL."
Timing & Worker Implementation
Improve performance by moving emulation tasks off the main thread.
Make it analyze the main emulation loop (look for requestAnimationFrame or jt.Room.update).
The CPU cycle counting logic needs optimized to ensure the 6502 CPU and TIA video chip remain in sync.
The refactored core needs packed so it can run inside a web worker.
Also need to define a message passing interface to bridge the main thread (user inputs and video rendering) with the worker thread (CPU execution and audio generation).