Skip to content

Commit

Permalink
added jsmess keyboard files (to fix CSP issues w/ new archive.org setup)
Browse files Browse the repository at this point in the history
  • Loading branch information
traceypooh committed Jan 15, 2025
1 parent 218d576 commit ed9a9ff
Show file tree
Hide file tree
Showing 12 changed files with 2,148 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ jobs:
with:
NOMAD_VAR_PORTS: '{ 80 = "http" }'
NO_TEST: true
NOMAD_VAR_COUNT: 2
secrets:
NOMAD_TOKEN: ${{ secrets.NOMAD_TOKEN }}
NOMAD_TOKEN_PROD: ${{ secrets.NOMAD_TOKEN_PROD }}
13 changes: 13 additions & 0 deletions jsmess_keyboard_v2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# JSMess keyboard files

Files previously were stored at: https://archive.org/download/jsmess_keyboard_v2/

## Description

The goal is to provide a ubiquitous, flexible, comprehensive-as-possible emulator that will appear in as many browsers as possible without installing a plugin or runtime. While a number of emulation solutions exist that allow much of what is wanted, they nearly all require plugins and most are directed towards a single machine or small sets of machines.

Currently, the most flexible runtime is current versions of Javascript, a horribly named runtime that utilizes a Turing-complete programming language to provide all manner of applications, effects and trickery to the browsing public. All major browsers support Javascript, and the language also allows support for cleanly informing end-users what is going on if something goes wrong.

MESS and MAME were started over a decade ago to provide ubiquitous, universal emulation of arcade/gaming machines (MAME) and general computer hardware (MESS). While specific emulation implementations exist that do specific machines better than MAME/MESS, no other project has the comprehensiveness and modularity. Modifications are consistently coming in, and emulation breadth and quality increases over time. In the case of MAME, pages exist listing machines it does not emulate.

The dream/goal is to provide access to computer software and artwork that would otherwise require the user to have the original hardware and software at hand to bring into existence. While nothing beats having vintage, well-maintained computer hardware to show what software "was", it requires advocacy and often physical presence to do so. Games like Pac-Man' or Super Mario have been re-done many times and provided in all manner of online and offline presentations... not so much examples of Wordperfect, Peachtree Accounting, or the Atari TOS. By providing this method of calling in software, historians and academics and the merely curious can get near-instantaneous access to the gist of these early programming works. As a side benefit, people with collections of old software will be more inclined to share or donate their piles of materials knowing that universal access will come shortly after.
34 changes: 34 additions & 0 deletions jsmess_keyboard_v2/a800-special.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
$(document).ready(function() {
function fakeScancode(scancode) {
JSMAME.sdl_sendkeyboardkey(1, scancode);
setTimeout(function() { JSMAME.sdl_sendkeyboardkey(0, scancode) }, 20);
}

$.extend($.keyboard.keyaction, {
option: function(base) { fakeScancode(60); }, // SDL_SCANCODE_F3
select: function(base) { fakeScancode(59); }, // SDL_SCANCODE_F2
start: function(base) { fakeScancode(58); } // SDL_SCANCODE_F1
});

$('#keyboard').keyboard({
layout : 'custom',
restrictInput : false, // Prevent keys not in the displayed keyboard from being typed in
preventPaste : true, // prevent ctrl-v and right click
autoAccept : true,
usePreview : false,
alwaysOpen : true,
useCombos : false,
customLayout: {
'default' : [
'{option}',
'{select}',
'{start}'
]
},
display: {
'option': 'OPTION',
'select': 'SELECT',
'start': 'START'
}
});
});
56 changes: 56 additions & 0 deletions jsmess_keyboard_v2/a800.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
$(document).ready(function() {
function fakeScancode(scancode) {
JSMAME.sdl_sendkeyboardkey(1, scancode);
setTimeout(function() { JSMAME.sdl_sendkeyboardkey(0, scancode) }, 20);
}

$.extend($.keyboard.keyaction, {
option: function(base) { fakeScancode(34); }, // SDL_SCANCODE_5
select: function(base) { fakeScancode(30); }, // SDL_SCANCODE_1
start: function(base) { fakeScancode(81); } // SDL_SCANCODE_DOWN
});

$('#keyboard').keyboard({
layout : 'custom',
restrictInput : false, // Prevent keys not in the displayed keyboard from being typed in
preventPaste : true, // prevent ctrl-v and right click
autoAccept : true,
usePreview : false,
alwaysOpen : true,
useCombos : false,
customLayout: {

'default': [
'{esc} 1 2 3 4 5 6 7 8 9 0 < > {bksp} {brk}',
'{tab} q w e r t y u i o p - = {enter}',
'{ctrl} a s d f g h j k l ; + *',
'{s} z x c v b n m , . / {atari} {s}',
'{space}',
'{option} {select} {start}'
],

'shift': [
'{esc} ! " # $ % & H @ ( ) {clear} {insert} {delete} {break}',
'{set} Q W E R T Y U I O P _ | {enter}',
'{ctrl} A S D F G H J K L : \ ^',
'{s} Z X C V B N M [ ] ? {atar} {s}',
'{space}',
'{option} {select} {start}'
],

'meta1': [
'1 2 3 4 5 6 7 8 9 0 {bksp}',
'- / : ; ( ) \u20ac & @ {enter}',
'{meta2} . , ? ! \' " {meta2}',
'{default} {space} {default} {accept}'
],
'meta2': [
'[ ] { } # % ^ * + = {bksp}',
'_ \\ | ~ < > $ \u00a3 \u00a5 {enter}',
'{meta1} . , ? ! \' " {meta1}',
'{default} {space} {default} {accept}'
]

},
});
});
69 changes: 69 additions & 0 deletions jsmess_keyboard_v2/apple2-floppy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
$(document).ready(function() {
function fakeScancode(scancode) {
JSMAME.sdl_sendkeyboardkey(1, scancode);
setTimeout(function() { JSMAME.sdl_sendkeyboardkey(0, scancode) }, 20);
}

// Opens up a prompt to save fileData to the user's computer as filename.

function saveFile(fileData, filename) {
var data = new Blob([fileData], {'type':'application/octet-stream'}),
a = document.createElement('a');
a.href = window.URL.createObjectURL(data);
a.download = filename;
a.click();
}

$.extend($.keyboard.keyaction, {
eject: function(base) {
// Save the cart in the machine.
// ASSUMPTION: There's only one file in the root directory, and that is
// the game.
if (typeof FS === 'undefined') {
alert('JSMESS has not started yet, so there is nothing to eject!');
return;
}
var contents = FS.readdir('/'), i;
for (i = 0; i < contents.length; i++) {
if (contents[i].indexOf('.zip') === -1 && FS.isFile(FS.stat('/' + contents[i]).mode)) {
// Download the file.
saveFile(FS.readFile('/' + contents[i], { encoding: 'binary' }), contents[i]);
break;
}
}
}
});

// Override default keyboard position options because passing them in at init doesn't seem to work

$.extend($.keyboard.defaultOptions.position, {
my: 'left top',
at: 'left top',
at2: 'left top',
});


$('#keyboard').keyboard({
layout : 'custom',
restrictInput : false, // Prevent keys not in the displayed keyboard from being typed in
preventPaste : true, // prevent ctrl-v and right click
autoAccept : true,
usePreview : false,
alwaysOpen : true,
useCombos : false,
customLayout: {
'default' : [
'{eject}'
]
},
display: {
'eject': 'EJECT (AND SAVE) FLOPPY'
},
position: {
my: 'left top',
at: 'left top',
of: $('#begPgSpcr')
}

});
});
55 changes: 55 additions & 0 deletions jsmess_keyboard_v2/arcade-defender.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
$(document).ready(function() {
function fakeScancode(scancode) {
JSMAME.sdl_sendkeyboardkey(1, scancode);
setTimeout(function() { JSMAME.sdl_sendkeyboardkey(0, scancode) }, 20);
}

$.extend($.keyboard.keyaction, {
coin: function(base) { fakeScancode(34); }, // SDL_SCANCODE_5
p1: function(base) { fakeScancode(30); }, // SDL_SCANCODE_1
p2: function(base) { fakeScancode(31); }, // SDL_SCANCODE_2
autoup: function(base) { fakeScancode(58); }, // SDL_SCANCODE_F1
advance: function(base) { fakeScancode(59); }, // SDL_SCANCODE_F2
reset: function(base) { fakeScancode(38); } // SDL_SCANCODE_9
});

// Override default keyboard position options because passing them in at init doesn't seem to work
$.extend($.keyboard.defaultOptions.position, {
my: 'left top',
at: 'left top',
at2: 'left top',
});

$('#keyboard').keyboard({
layout : 'custom',
restrictInput : false, // Prevent keys not in the displayed keyboard from being typed in
preventPaste : true, // prevent ctrl-v and right click
autoAccept : true,
usePreview : false,
alwaysOpen : true,
useCombos : false,
customLayout: {
'default' : [
'{coin}',
'{p1}',
'{p2}',
'{autoup}',
'{advance}',
'{reset}',
]
},
display: {
'coin': 'INSERT COIN',
'p1': 'PLAYER 1',
'p2': 'PLAYER 2',
'autoup': 'AUTO UP',
'advance': 'ADVANCE',
'reset': 'RESET'
},
position: {
my: 'left top',
at: 'left top',
of: $('#begPgSpcr')
}
});
});
42 changes: 42 additions & 0 deletions jsmess_keyboard_v2/arcade-qix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
$(document).ready(function() {
function fakeScancode(scancode) {
JSMAME.sdl_sendkeyboardkey(1, scancode);
setTimeout(function() { JSMAME.sdl_sendkeyboardkey(0, scancode) }, 20);
}

$.extend($.keyboard.keyaction, {
coin: function(base) { fakeScancode(34); }, // SDL_SCANCODE_5
p1: function(base) { fakeScancode(30); }, // SDL_SCANCODE_1
p2: function(base) { fakeScancode(31); }, // SDL_SCANCODE_2
advance: function(base) { fakeScancode(58); }, // SDL_SCANCODE_F1
});

$('#keyboard').keyboard({
layout : 'custom',
restrictInput : false, // Prevent keys not in the displayed keyboard from being typed in
preventPaste : true, // prevent ctrl-v and right click
autoAccept : true,
usePreview : false,
alwaysOpen : true,
useCombos : false,
customLayout: {
'default' : [
'{coin}',
'{p1}',
'{p2}',
'{advance}'
]
},
display: {
'coin': 'INSERT COIN',
'p1': 'PLAYER 1',
'p2': 'PLAYER 2',
'advance': 'ADVANCE'
},
position: {
my: 'right top',
at: 'left top',
of: $('#canvas')
}
});
});
46 changes: 46 additions & 0 deletions jsmess_keyboard_v2/arcade-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
$(document).ready(function() {
function fakeScancode(scancode) {
JSMAME.sdl_sendkeyboardkey(1, scancode);
setTimeout(function() { JSMAME.sdl_sendkeyboardkey(0, scancode) }, 20);
}

$.extend($.keyboard.keyaction, {
coin: function(base) { fakeScancode(34); }, // SDL_SCANCODE_5
p1: function(base) { fakeScancode(30); }, // SDL_SCANCODE_1
p2: function(base) { fakeScancode(31); } // SDL_SCANCODE_2
});

// Override default keyboard position options because passing them in at init doesn't seem to work
$.extend($.keyboard.defaultOptions.position, {
my: 'left top',
at: 'left top',
at2: 'left top',
});

$('#keyboard').keyboard({
layout : 'custom',
restrictInput : false, // Prevent keys not in the displayed keyboard from being typed in
preventPaste : true, // prevent ctrl-v and right click
autoAccept : true,
usePreview : false,
alwaysOpen : true,
useCombos : false,
customLayout: {
'default' : [
'{coin}',
'{p1}',
'{p2}'
]
},
display: {
'coin': 'INSERT COIN',
'p1': 'PLAYER 1',
'p2': 'PLAYER 2'
},
position: {
my: 'left top',
at: 'left top',
of: $('#begPgSpcr')
}
});
});
56 changes: 56 additions & 0 deletions jsmess_keyboard_v2/arcade-williams.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
$(document).ready(function() {
function fakeScancode(scancode) {
JSMAME.sdl_sendkeyboardkey(1, scancode);
setTimeout(function() { JSMAME.sdl_sendkeyboardkey(0, scancode) }, 20);
}

$.extend($.keyboard.keyaction, {
coin: function(base) { fakeScancode(34); }, // SDL_SCANCODE_5
p1: function(base) { fakeScancode(30); }, // SDL_SCANCODE_1
p2: function(base) { fakeScancode(31); }, // SDL_SCANCODE_2
advance: function(base) { fakeScancode(59); }, // SDL_SCANCODE_F2
});

$.extend($.keyboard.keyaction, {
coin: function(base) { fakeKeypress(53); },
p1: function(base) { fakeKeypress(49); },
p2: function(base) { fakeKeypress(50); },
advance: function(base) { fakeKeypress(113); }
});

// Override default keyboard position options because passing them in at init doesn't seem to work
$.extend($.keyboard.defaultOptions.position, {
my: 'left top',
at: 'left top',
at2: 'left top',
});

$('#keyboard').keyboard({
layout : 'custom',
restrictInput : false, // Prevent keys not in the displayed keyboard from being typed in
preventPaste : true, // prevent ctrl-v and right click
autoAccept : true,
usePreview : false,
alwaysOpen : true,
useCombos : false,
customLayout: {
'default' : [
'{coin}',
'{p1}',
'{p2}',
'{advance}'
]
},
display: {
'coin': 'INSERT COIN',
'p1': 'PLAYER 1',
'p2': 'PLAYER 2',
'advance': 'ADVANCE'
},
position: {
my: 'left top',
at: 'left top',
of: $('#begPgSpcr')
}
});
});
Loading

0 comments on commit ed9a9ff

Please sign in to comment.