update 0.9.0
This commit is contained in:
parent
55271fab81
commit
ea1d34267e
11 changed files with 1052 additions and 65 deletions
27
sae/amiga.js
27
sae/amiga.js
|
|
@ -390,16 +390,25 @@ function ScriptedAmigaEmulator() {
|
|||
|
||||
this.start_program = function() {
|
||||
this.do_start_program();
|
||||
|
||||
if (typeof SAEV_config.hook.event.started === "function")
|
||||
SAEV_config.hook.event.started();
|
||||
}
|
||||
|
||||
this.leave_program = function() {
|
||||
this.dump();
|
||||
this.do_leave_program();
|
||||
|
||||
if (typeof SAEV_config.hook.event.stopped === "function")
|
||||
SAEV_config.hook.event.stopped();
|
||||
}
|
||||
|
||||
this.pause_program = function(p) {
|
||||
this.audio.pauseResume(p);
|
||||
this.events.pauseResume(p);
|
||||
|
||||
if (typeof SAEV_config.hook.event.paused === "function")
|
||||
SAEV_config.hook.event.paused(p);
|
||||
}
|
||||
|
||||
/*---------------------------------*/
|
||||
|
|
@ -503,16 +512,16 @@ function ScriptedAmigaEmulator() {
|
|||
}
|
||||
};
|
||||
|
||||
this.reset = function(hardreset, keyboardreset) { //uae_reset(hardreset, keyboardreset)
|
||||
if (typeof hardreset == "undefined") var hardreset = 1;
|
||||
if (typeof keyboardreset == "undefined") var keyboardreset = 0;
|
||||
this.reset = function(hard, keyboard) { //uae_reset(hard, keyboard)
|
||||
if (typeof hard == "undefined") var hard = false;
|
||||
if (typeof keyboard == "undefined") var keyboard = false;
|
||||
if (this.running) {
|
||||
SAEF_info("sae.reset() hard %d, keyboard %d", hardreset, keyboardreset);
|
||||
SAEF_info("sae.reset() hard %d, keyboard %d", hard?1:0, keyboard?1:0);
|
||||
if (SAEV_command == 0) {
|
||||
SAEV_command = -SAEC_command_Reset;
|
||||
if (keyboardreset)
|
||||
SAEV_command = -SAEC_command_Reset; /* soft */
|
||||
if (keyboard)
|
||||
SAEV_command = -SAEC_command_KeyboardReset;
|
||||
if (hardreset)
|
||||
if (hard)
|
||||
SAEV_command = -SAEC_command_HardReset;
|
||||
}
|
||||
return SAEE_None;
|
||||
|
|
@ -576,6 +585,10 @@ function ScriptedAmigaEmulator() {
|
|||
return SAEE_None;
|
||||
};
|
||||
|
||||
this.keyPress = function(e, down) {
|
||||
this.input.keyPress(e, down);
|
||||
}
|
||||
|
||||
/*---------------------------------*/
|
||||
|
||||
SAEF_info("SAE %d.%d.%d", SAEC_Version, SAEC_Revision, SAEC_Patch);
|
||||
|
|
|
|||
|
|
@ -710,7 +710,7 @@ function SAEO_Config() {
|
|||
|
||||
this.hook = {
|
||||
log: {
|
||||
error: function (err, msg) {}
|
||||
error: function(err, msg) {}
|
||||
},
|
||||
led: {
|
||||
power: function(on) {},
|
||||
|
|
@ -718,6 +718,12 @@ function SAEO_Config() {
|
|||
df: function(unit, dis, cyl, side, rw) {},
|
||||
fps: function(fps, paused) {},
|
||||
cpu: function(usage, paused) {}
|
||||
},
|
||||
event: {
|
||||
started: function() {},
|
||||
stopped: function() {},
|
||||
reseted: function(hard) { console.warn("RES", hard); },
|
||||
paused: function(paused) {}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -741,6 +741,10 @@ function SAEO_Keyboard() {
|
|||
if (keyState[loc][code] != oldstate)
|
||||
processKey(loc, code, keyState[loc][code]);
|
||||
};
|
||||
|
||||
this.keyPress = function(e, down) {
|
||||
handleKey(e, down);
|
||||
};
|
||||
}
|
||||
|
||||
function SAEO_Input() {
|
||||
|
|
@ -772,6 +776,10 @@ function SAEO_Input() {
|
|||
potgo.count = 0;
|
||||
};
|
||||
|
||||
this.keyPress = function (e, down) {
|
||||
this.keyboard.keyPress(e, down);
|
||||
};
|
||||
|
||||
this.POTGO = function (v) {
|
||||
//SAEF_log("Input.POTGO() $%04x", v);
|
||||
potgo.data = v;
|
||||
|
|
|
|||
|
|
@ -227,7 +227,6 @@ function SAEO_M68K() {
|
|||
SAER.memory.clear();
|
||||
SAEF_log("m68k.m68k_cycle() hardreset, memory cleared.");
|
||||
}
|
||||
cpu_hardreset = false;
|
||||
|
||||
if (SAEV_config.audio.mode == 0)
|
||||
SAER_Events_eventtab[SAEC_Events_EV_AUDIO].active = false;
|
||||
|
|
@ -237,6 +236,11 @@ function SAEO_M68K() {
|
|||
//SAER.audio.check_prefs_changed_audio();
|
||||
|
||||
//statusline_clear();
|
||||
|
||||
if (typeof SAEV_config.hook.event.reseted === "function")
|
||||
SAEV_config.hook.event.reseted(cpu_hardreset);
|
||||
|
||||
cpu_hardreset = false;
|
||||
}
|
||||
|
||||
if (startup) {
|
||||
|
|
|
|||
|
|
@ -2205,7 +2205,7 @@ function SAEO_Playfield() {
|
|||
switch (gfxvidinfo.drawbuffer.pixbytes) {
|
||||
case 2:
|
||||
pfield_do_linetoscr_normal = need_genlock_data ? linetoscr_16_stretch2_aga_genlock : linetoscr_16_stretch2_aga;
|
||||
pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_16_stretch2_aga_spr_genlock : linetoscr_16_stretch2_aga_spr_genlock;
|
||||
pfield_do_linetoscr_sprite = need_genlock_data ? linetoscr_16_stretch2_aga_spr_genlock : linetoscr_16_stretch2_aga_spr;
|
||||
pfield_do_linetoscr_spriteonly = linetoscr_16_stretch2_aga_spronly;
|
||||
break;
|
||||
case 4:
|
||||
|
|
|
|||
48
sae/video.js
48
sae/video.js
|
|
@ -92,7 +92,6 @@ function SAEO_Video() {
|
|||
this.surface = null;
|
||||
|
||||
this.div = null;
|
||||
this.video = null;
|
||||
this.shown = false;
|
||||
this.fullscreen = false;
|
||||
}
|
||||
|
|
@ -198,7 +197,12 @@ function SAEO_Video() {
|
|||
function CreateWindow(left, top, width, height) {
|
||||
var hWnd = new HWND();
|
||||
|
||||
hWnd.canvas = document.createElement("canvas");
|
||||
var el = document.getElementById(SAEV_config.video.id);
|
||||
if (el.nodeName == "CANVAS")
|
||||
hWnd.canvas = el;
|
||||
else
|
||||
hWnd.canvas = document.createElement("canvas");
|
||||
|
||||
hWnd.canvas.width = width;
|
||||
hWnd.canvas.height = height;
|
||||
hWnd.canvas.style.backgroundColor = sprintf("#%06X", SAEV_config.video.backgroundColor);
|
||||
|
|
@ -265,40 +269,39 @@ function SAEO_Video() {
|
|||
const SW_SHOWNORMAL = 1;
|
||||
//const SW_SHOW = 5;
|
||||
//const SW_SHOWDEFAULT = 10;
|
||||
|
||||
function ShowWindow(hWnd, nCmdShow) {
|
||||
if (nCmdShow == SW_SHOWNORMAL && !hWnd.shown) {
|
||||
hWnd.video = document.createElement("div");
|
||||
hWnd.video.style.webkitTouchCallout = "none";
|
||||
hWnd.video.style.webkitUserSelect = "none";
|
||||
hWnd.video.style.khtmlUserSelect = "none";
|
||||
hWnd.video.style.mozUserSelect = "none";
|
||||
hWnd.video.style.msUserSelect = "none";
|
||||
hWnd.video.style.userSelect = "none";
|
||||
hWnd.video.appendChild(hWnd.canvas);
|
||||
var el = document.getElementById(SAEV_config.video.id);
|
||||
if (el.nodeName == "DIV") {
|
||||
hWnd.div = el;
|
||||
hWnd.div.style.width = String(currentmode.native_width)+"px";
|
||||
hWnd.div.style.height = String(currentmode.native_height)+"px";
|
||||
hWnd.div.appendChild(hWnd.canvas);
|
||||
} else
|
||||
hWnd.div = null;
|
||||
|
||||
hWnd.div = document.getElementById(SAEV_config.video.id);
|
||||
hWnd.div.style.width = String(currentmode.native_width)+"px";
|
||||
hWnd.div.style.height = String(currentmode.native_height)+"px";
|
||||
hWnd.div.appendChild(hWnd.video);
|
||||
hWnd.shown = true;
|
||||
}
|
||||
else if (nCmdShow == SW_HIDE && hWnd.shown) {
|
||||
hWnd.div.removeChild(hWnd.video);
|
||||
//hWnd.div.style.width = "0px";
|
||||
//hWnd.div.style.height = "0px";
|
||||
hWnd.video = null;
|
||||
if (hWnd.div !== null) {
|
||||
hWnd.div.removeChild(hWnd.canvas);
|
||||
hWnd.canvas = null;
|
||||
}
|
||||
|
||||
hWnd.shown = false;
|
||||
}
|
||||
}
|
||||
|
||||
function GetWindowRect(hWnd, rect) {
|
||||
if (hWnd.shown) {
|
||||
var bcr = hWnd.div.getBoundingClientRect();
|
||||
/*if (hWnd.shown) {
|
||||
var bcr = hWnd.canvas.getBoundingClientRect();
|
||||
rect.left = Math.floor(bcr.left);
|
||||
rect.top = Math.floor(bcr.top);
|
||||
rect.right = Math.floor(bcr.right);
|
||||
rect.bottom = Math.floor(bcr.bottom);
|
||||
} else {
|
||||
console.dir(bcr);
|
||||
} else*/ {
|
||||
rect.left = (screen.width >> 1) - (currentmode.native_width >> 1); if (rect.left < 0) rect.left = 0;
|
||||
rect.top = (screen.height >> 1) - (currentmode.native_height >> 1); if (rect.top < 0) rect.top = 0;
|
||||
rect.right = rect.left + currentmode.native_width;
|
||||
|
|
@ -1804,7 +1807,8 @@ function SAEO_Video() {
|
|||
if (!SAEV_config.video.enabled)
|
||||
return SAEE_None;
|
||||
|
||||
if (!document.getElementById(SAEV_config.video.id))
|
||||
var id = document.getElementById(SAEV_config.video.id);
|
||||
if (id === null || (id.nodeName != "DIV" && id.nodeName != "CANVAS"))
|
||||
return SAEE_Video_ElementNotFound;
|
||||
|
||||
if (SAEV_config.video.api == SAEC_Config_Video_API_WebGL && !SAEC_info.video.webGL) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue