mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-07-05 01:28:57 +00:00
Tweaked bootup appearance
This commit is contained in:
parent
0ca9b29614
commit
4376bb5378
@ -6,10 +6,8 @@
|
||||
package jace;
|
||||
|
||||
import com.sun.glass.ui.Application;
|
||||
import jace.cheat.MetaCheat;
|
||||
import jace.core.Card;
|
||||
import jace.core.Computer;
|
||||
import jace.core.Keyboard;
|
||||
import jace.library.MediaCache;
|
||||
import jace.library.MediaConsumer;
|
||||
import jace.library.MediaConsumerParent;
|
||||
@ -81,8 +79,10 @@ public class JaceUIController {
|
||||
assert appleScreen != null : "fx:id=\"appleScreen\" was not injected: check your FXML file 'JaceUI.fxml'.";
|
||||
appleScreen.fitWidthProperty().bind(rootPane.widthProperty());
|
||||
appleScreen.fitHeightProperty().bind(rootPane.heightProperty());
|
||||
appleScreen.setVisible(false);
|
||||
rootPane.setOnDragEntered(this::processDragEnteredEvent);
|
||||
rootPane.setOnDragExited(this::processDragExitedEvent);
|
||||
rootPane.setBackground(new Background(new BackgroundFill(Color.BLACK, null, null)));
|
||||
}
|
||||
|
||||
public void connectComputer(Computer computer, Stage primaryStage) {
|
||||
@ -99,6 +99,7 @@ public class JaceUIController {
|
||||
rootPane.setFocusTraversable(true);
|
||||
}
|
||||
appleScreen.setImage(computer.getVideo().getFrameBuffer());
|
||||
appleScreen.setVisible(true);
|
||||
rootPane.requestFocus();
|
||||
});
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.StageStyle;
|
||||
|
||||
@ -63,6 +64,7 @@ public class LawlessLegends extends Application {
|
||||
controller = fxmlLoader.getController();
|
||||
controller.initialize();
|
||||
Scene s = new Scene(node);
|
||||
s.setFill(Color.BLACK);
|
||||
primaryStage.setScene(s);
|
||||
primaryStage.setTitle("Lawless Legends");
|
||||
Utility.loadIcon("game_icon.png").ifPresent(primaryStage.getIcons()::add);
|
||||
@ -71,8 +73,8 @@ public class LawlessLegends extends Application {
|
||||
}
|
||||
|
||||
primaryStage.show();
|
||||
new Emulator(getParameters().getRaw());
|
||||
new Thread(() -> {
|
||||
new Emulator(getParameters().getRaw());
|
||||
reconnectUIHooks();
|
||||
EmulatorUILogic.scaleIntegerRatio();
|
||||
while (Emulator.computer.getVideo() == null || Emulator.computer.getVideo().getFrameBuffer() == null) {
|
||||
|
@ -297,7 +297,9 @@ public class Apple2e extends Computer {
|
||||
getVideo().configureVideoMode();
|
||||
getVideo().reconfigure();
|
||||
Emulator.resizeVideo();
|
||||
LawlessLegends.getApplication().reconnectUIHooks();
|
||||
if (LawlessLegends.getApplication() != null) {
|
||||
LawlessLegends.getApplication().reconnectUIHooks();
|
||||
}
|
||||
getVideo().resume();
|
||||
} catch (InstantiationException | IllegalAccessException ex) {
|
||||
Logger.getLogger(Apple2e.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
@ -20,8 +20,17 @@ import java.util.logging.Logger;
|
||||
* Extends standard implementation to provide different cold start behavior
|
||||
*/
|
||||
public class LawlessComputer extends Apple2e {
|
||||
|
||||
|
||||
byte[] bootScreen = null;
|
||||
boolean performedBootAnimation = false;
|
||||
|
||||
public LawlessComputer() {
|
||||
super();
|
||||
// Fill text page 1 with spaces
|
||||
for (int i = 0x0400; i < 0x07FF; i++) {
|
||||
getMemory().write(i, (byte) (0x080 | ' '), false, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void coldStart() {
|
||||
@ -32,9 +41,8 @@ public class LawlessComputer extends Apple2e {
|
||||
}
|
||||
(new Thread(this::startAnimation)).start();
|
||||
}
|
||||
|
||||
|
||||
public void startAnimation() {
|
||||
doResume();
|
||||
getCpu().suspend();
|
||||
SoftSwitches._80COL.getSwitch().setState(true);
|
||||
SoftSwitches.TEXT.getSwitch().setState(false);
|
||||
@ -44,37 +52,44 @@ public class LawlessComputer extends Apple2e {
|
||||
((VideoNTSC) getVideo()).enableVideo7 = false;
|
||||
getMemory().configureActiveMemory();
|
||||
getVideo().configureVideoMode();
|
||||
|
||||
try {
|
||||
waitForVBL();
|
||||
renderWithMask(0x8, 0x11, 0x22, 0x44);
|
||||
Video.forceRefresh();
|
||||
waitForVBL(10);
|
||||
renderWithMask(0x4c, 0x19, 0x33, 0x66);
|
||||
Video.forceRefresh();
|
||||
waitForVBL(10);
|
||||
renderWithMask(0x6e, 0x5d, 0x3B, 0x77);
|
||||
Video.forceRefresh();
|
||||
waitForVBL(10);
|
||||
renderWithMask(0x7f, 0x7f, 0x7f, 0x7f);
|
||||
Video.forceRefresh();
|
||||
waitForVBL(250);
|
||||
renderWithMask(0x6e, 0x5d, 0x3B, 0x77);
|
||||
Video.forceRefresh();
|
||||
waitForVBL(10);
|
||||
renderWithMask(0x4c, 0x19, 0x33, 0x66);
|
||||
Video.forceRefresh();
|
||||
waitForVBL(10);
|
||||
renderWithMask(0x8, 0x11, 0x22, 0x44);
|
||||
Video.forceRefresh();
|
||||
waitForVBL(10);
|
||||
finishColdStart();
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(LawlessComputer.class.getName()).log(Level.SEVERE, null, ex);
|
||||
doResume();
|
||||
|
||||
if (!performedBootAnimation) {
|
||||
try {
|
||||
performedBootAnimation = true;
|
||||
waitForVBL();
|
||||
renderWithMask(0x8, 0x11, 0x22, 0x44);
|
||||
Video.forceRefresh();
|
||||
waitForVBL(10);
|
||||
renderWithMask(0x4c, 0x19, 0x33, 0x66);
|
||||
Video.forceRefresh();
|
||||
waitForVBL(10);
|
||||
renderWithMask(0x6e, 0x5d, 0x3B, 0x77);
|
||||
Video.forceRefresh();
|
||||
waitForVBL(10);
|
||||
renderWithMask(0x7f, 0x7f, 0x7f, 0x7f);
|
||||
Video.forceRefresh();
|
||||
waitForVBL(250);
|
||||
// renderWithMask(0x6e, 0x5d, 0x3B, 0x77);
|
||||
renderWithMask(0x77, 0x6e, 0x5d, 0x3b);
|
||||
Video.forceRefresh();
|
||||
waitForVBL(10);
|
||||
// renderWithMask(0x4c, 0x19, 0x33, 0x66);
|
||||
renderWithMask(0x33, 0x66, 0x4c, 0x19);
|
||||
Video.forceRefresh();
|
||||
waitForVBL(10);
|
||||
// renderWithMask(0x8, 0x11, 0x22, 0x44);
|
||||
renderWithMask(0x11, 0x22, 0x44, 0x8);
|
||||
Video.forceRefresh();
|
||||
waitForVBL(10);
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(LawlessComputer.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
finishColdStart();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void renderWithMask(int i1, int i2, int i3, int i4) {
|
||||
RAM128k ram = (RAM128k) getMemory();
|
||||
byte[] framebuffer = getBootScreen();
|
||||
@ -83,7 +98,7 @@ public class LawlessComputer extends Apple2e {
|
||||
if (i < 0x02000) {
|
||||
next = (framebuffer[i] & 1) << 6;
|
||||
}
|
||||
Byte b1 = (byte) ((framebuffer[i + 0x02000] & 0x07f) >> 1 | next );
|
||||
Byte b1 = (byte) ((framebuffer[i + 0x02000] & 0x07f) >> 1 | next);
|
||||
ram.getAuxMemory().writeByte(0x02000 + i, (byte) (b1 & i1 | 0x080));
|
||||
if (i < 0x01FFF) {
|
||||
next = (framebuffer[i + 0x02001] & 1) << 6;
|
||||
@ -102,13 +117,13 @@ public class LawlessComputer extends Apple2e {
|
||||
ram.getMainMemory().writeByte(0x02001 + i, (byte) (b4 & i4 | 0x080));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<Runnable> vblCallbacks = Collections.synchronizedList(new ArrayList<Runnable>());
|
||||
|
||||
|
||||
public void waitForVBL() throws InterruptedException {
|
||||
waitForVBL(0);
|
||||
}
|
||||
|
||||
|
||||
public void waitForVBL(int count) throws InterruptedException {
|
||||
Semaphore s = new Semaphore(0);
|
||||
onNextVBL(s::release);
|
||||
@ -117,11 +132,11 @@ public class LawlessComputer extends Apple2e {
|
||||
waitForVBL(count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onNextVBL(Runnable r) {
|
||||
vblCallbacks.add(r);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void notifyVBLStateChanged(boolean state) {
|
||||
super.notifyVBLStateChanged(state);
|
||||
@ -132,7 +147,7 @@ public class LawlessComputer extends Apple2e {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void finishColdStart() {
|
||||
try {
|
||||
for (Optional<Card> c : getMemory().getAllCards()) {
|
||||
@ -145,7 +160,7 @@ public class LawlessComputer extends Apple2e {
|
||||
Logger.getLogger(LawlessComputer.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private byte[] getBootScreen() {
|
||||
if (bootScreen == null) {
|
||||
InputStream in = getClass().getClassLoader().getResourceAsStream("jace/data/bootscreen.bin");
|
||||
@ -158,9 +173,9 @@ public class LawlessComputer extends Apple2e {
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(LawlessComputer.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return bootScreen;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,18 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.canvas.*?>
|
||||
<?import java.lang.*?>
|
||||
<?import java.util.*?>
|
||||
<?import javafx.scene.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
|
||||
<AnchorPane id="AnchorPane" fx:id="rootPane" prefHeight="384.0" prefWidth="560.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="jace.JaceUIController">
|
||||
<AnchorPane id="AnchorPane" fx:id="rootPane" prefHeight="384.0" prefWidth="560.0" style="-fx-background-color: BLACK;" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="jace.JaceUIController">
|
||||
<children>
|
||||
<StackPane fx:id="stackPane" prefHeight="384.0" prefWidth="560.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<ImageView fx:id="appleScreen" fitHeight="384.0" fitWidth="560.0" pickOnBounds="true" />
|
||||
<ImageView fx:id="appleScreen" fitHeight="384.0" fitWidth="560.0" pickOnBounds="true" style="-fx-background-color: BLACK;" />
|
||||
<HBox fx:id="notificationBox" alignment="BOTTOM_RIGHT" blendMode="SCREEN" fillHeight="false" maxHeight="45.0" mouseTransparent="true" prefHeight="45.0" prefWidth="560.0" StackPane.alignment="BOTTOM_CENTER" />
|
||||
</children>
|
||||
</StackPane>
|
||||
|
@ -46,7 +46,7 @@ public class Basic6502FuncationalityTest {
|
||||
public static void setupClass() {
|
||||
Utility.setHeadlessMode(true);
|
||||
SoundMixer.MUTE = true;
|
||||
computer = new Apple2e();
|
||||
computer = new LawlessComputer();
|
||||
cpu = (MOS65C02) computer.getCpu();
|
||||
ram = computer.getMemory();
|
||||
Emulator.computer = (LawlessComputer) computer;
|
||||
|
Loading…
Reference in New Issue
Block a user