Added failure boot line message in red.
This commit is contained in:
parent
d29c662ca0
commit
83eec6a1aa
|
@ -58,7 +58,7 @@ public class GDXAppTos4Activator implements BundleActivator {
|
||||||
private Properties localOverrides;
|
private Properties localOverrides;
|
||||||
private WaterDevice warpshipDevice;
|
private WaterDevice warpshipDevice;
|
||||||
private SystemGdxTerminal systemGdxTerminal;
|
private SystemGdxTerminal systemGdxTerminal;
|
||||||
private List<GDXAppTos4BootListener> listeners = new ArrayList<>();
|
private GDXAppTos4BootListener bootScreen;
|
||||||
|
|
||||||
private static final String SYSTEM_USER_HOME = "user.home";
|
private static final String SYSTEM_USER_HOME = "user.home";
|
||||||
private static final String HYPERDRIVE_HOME = "Hyperdrive";
|
private static final String HYPERDRIVE_HOME = "Hyperdrive";
|
||||||
|
@ -76,18 +76,8 @@ public class GDXAppTos4Activator implements BundleActivator {
|
||||||
this.systemGdxTerminal = systemGdxTerminal;
|
this.systemGdxTerminal = systemGdxTerminal;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fireMessageEvent(String message) {
|
public void setBootListener(GDXAppTos4BootListener bootScreen) {
|
||||||
for (GDXAppTos4BootListener listener:listeners) {
|
this.bootScreen = bootScreen;
|
||||||
listener.bootLine(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addBootListener(GDXAppTos4BootListener listener) {
|
|
||||||
listeners.add(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeBootListener(GDXAppTos4BootListener listener) {
|
|
||||||
listeners.remove(listener);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasStartError() {
|
public boolean hasStartError() {
|
||||||
|
@ -101,17 +91,17 @@ public class GDXAppTos4Activator implements BundleActivator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(final BundleContext context) {
|
public void start(final BundleContext context) {
|
||||||
fireMessageEvent("Mecca System eXtension superscript Four");
|
bootScreen.bootLine("Mecca System eXtension superscript Four");
|
||||||
fireMessageEvent("tos4: starting...");
|
bootScreen.bootLine("tos4: starting...");
|
||||||
fireMessageEvent("init-cpus: "+Runtime.getRuntime().availableProcessors());
|
bootScreen.bootLine("init-cpus: "+Runtime.getRuntime().availableProcessors());
|
||||||
fireMessageEvent("free-memory: 0x"+Long.toHexString(Runtime.getRuntime().freeMemory()));
|
bootScreen.bootLine("free-memory: 0x"+Long.toHexString(Runtime.getRuntime().freeMemory()));
|
||||||
|
|
||||||
boolean useLocal = args.contains("use-local");
|
boolean useLocal = args.contains("use-local");
|
||||||
|
|
||||||
File userHome = new File(System.getProperty(SYSTEM_USER_HOME));
|
File userHome = new File(System.getProperty(SYSTEM_USER_HOME));
|
||||||
hyperdriveHome = new File(userHome, HYPERDRIVE_HOME);
|
hyperdriveHome = new File(userHome, HYPERDRIVE_HOME);
|
||||||
if (!hyperdriveHome.exists()) {
|
if (!hyperdriveHome.exists()) {
|
||||||
fireMessageEvent("ERROR: No Hyperdrive home.");
|
bootScreen.bootLineError("ERROR: No Hyperdrive home.");
|
||||||
startError = true;
|
startError = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +110,7 @@ public class GDXAppTos4Activator implements BundleActivator {
|
||||||
warpshipHome = new File(".");
|
warpshipHome = new File(".");
|
||||||
}
|
}
|
||||||
if (!warpshipHome.exists()) {
|
if (!warpshipHome.exists()) {
|
||||||
fireMessageEvent("ERROR: No Warpship home.");
|
bootScreen.bootLineError("ERROR: No Warpship home.");
|
||||||
startError = true;
|
startError = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -128,9 +118,9 @@ public class GDXAppTos4Activator implements BundleActivator {
|
||||||
if (useLocal) {
|
if (useLocal) {
|
||||||
warpShip = new File(warpshipHome, "local-ship.xml");
|
warpShip = new File(warpshipHome, "local-ship.xml");
|
||||||
}
|
}
|
||||||
fireMessageEvent("warp-ship: "+warpShip);
|
bootScreen.bootLine("warp-ship: "+warpShip);
|
||||||
if (!warpShip.exists()) {
|
if (!warpShip.exists()) {
|
||||||
fireMessageEvent("ERROR: No warp-ship.xml found.");
|
bootScreen.bootLineError("ERROR: No warp-ship.xml found.");
|
||||||
startError = true;
|
startError = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -138,11 +128,11 @@ public class GDXAppTos4Activator implements BundleActivator {
|
||||||
warpshipDevice = WaterDeviceDriver.newInstance().createReader().readFile(warpShip);
|
warpshipDevice = WaterDeviceDriver.newInstance().createReader().readFile(warpShip);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
fireMessageEvent("ERROR: "+e.getMessage());
|
bootScreen.bootLineError("ERROR: "+e.getMessage());
|
||||||
startError = true;
|
startError = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fireMessageEvent("warp-engine: "+warpshipDevice.theShip().getName());
|
bootScreen.bootLine("warp-engine: "+warpshipDevice.theShip().getName());
|
||||||
|
|
||||||
localOverrides = new Properties();
|
localOverrides = new Properties();
|
||||||
if (useLocal) {
|
if (useLocal) {
|
||||||
|
@ -153,9 +143,9 @@ public class GDXAppTos4Activator implements BundleActivator {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
fireMessageEvent("use-local: local-override.xml loaded.");
|
bootScreen.bootLine("use-local: local-override.xml loaded.");
|
||||||
} else {
|
} else {
|
||||||
fireMessageEvent("use-local: local-override.xml not found.");
|
bootScreen.bootLine("use-local: local-override.xml not found.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +165,7 @@ public class GDXAppTos4Activator implements BundleActivator {
|
||||||
} catch (InterruptedException ignored) {
|
} catch (InterruptedException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fireMessageEvent("gdx-font: "+parameter.characters.length()+" glyphs loaded.");
|
bootScreen.bootLine("gdx-font: "+parameter.characters.length()+" glyphs loaded.");
|
||||||
|
|
||||||
|
|
||||||
SystemWarpShipImpl systemWarpShip = new SystemWarpShipImpl();
|
SystemWarpShipImpl systemWarpShip = new SystemWarpShipImpl();
|
||||||
|
@ -195,25 +185,25 @@ public class GDXAppTos4Activator implements BundleActivator {
|
||||||
List<SystemWarpSea> registratedSeas = new ArrayList<>();
|
List<SystemWarpSea> registratedSeas = new ArrayList<>();
|
||||||
int result = 0;
|
int result = 0;
|
||||||
try {
|
try {
|
||||||
result = systemWarpShip.loadWaterOcean(context, registratedSeas, warpshipDevice.theShip().getEngine(), v -> fireMessageEvent(v));
|
result = systemWarpShip.loadWaterOcean(context, registratedSeas, warpshipDevice.theShip().getEngine(), v -> bootScreen.bootLine(v));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
fireMessageEvent("ERROR: "+e.getMessage());
|
bootScreen.bootLineError("ERROR: "+e.getMessage());
|
||||||
startError = true;
|
startError = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
fireMessageEvent("tos4: FAILURE BOOT ABORTED");
|
bootScreen.bootLineError("tos4: FAILURE BOOT ABORTED");
|
||||||
startError = true;
|
startError = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fireMessageEvent("tos4: chains resolved.");
|
bootScreen.bootLine("tos4: chains resolved.");
|
||||||
try {
|
try {
|
||||||
systemWarpShip.loadBundles(context, registratedSeas);
|
systemWarpShip.loadBundles(context, registratedSeas);
|
||||||
} catch (BundleException e) {
|
} catch (BundleException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
fireMessageEvent("ERROR: "+e.getMessage());
|
bootScreen.bootLineError("ERROR: "+e.getMessage());
|
||||||
startError = true;
|
startError = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,6 @@ import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||||
public interface GDXAppTos4BootListener {
|
public interface GDXAppTos4BootListener {
|
||||||
|
|
||||||
void bootLine(String message);
|
void bootLine(String message);
|
||||||
|
|
||||||
|
void bootLineError(String message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,14 +15,26 @@ import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||||
public class GDXAppTos4BootScreen extends ScreenAdapter implements GDXAppTos4BootListener {
|
public class GDXAppTos4BootScreen extends ScreenAdapter implements GDXAppTos4BootListener {
|
||||||
|
|
||||||
private BitmapFont font;
|
private BitmapFont font;
|
||||||
|
private BitmapFont fontError;
|
||||||
private SpriteBatch batch;
|
private SpriteBatch batch;
|
||||||
private Texture backgroundImage;
|
private Texture backgroundImage;
|
||||||
private List<String> messages = new ArrayList<>();
|
private List<BootMessage> messages = new ArrayList<>();
|
||||||
|
|
||||||
|
class BootMessage {
|
||||||
|
String bootLine;
|
||||||
|
String bootLineError;
|
||||||
|
public BootMessage(String bootLine, String bootLineError) {
|
||||||
|
this.bootLine = bootLine;
|
||||||
|
this.bootLineError = bootLineError;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public GDXAppTos4BootScreen() {
|
public GDXAppTos4BootScreen() {
|
||||||
batch = new SpriteBatch();
|
batch = new SpriteBatch();
|
||||||
backgroundImage = new Texture(Gdx.files.internal("background/msx-boot.png"));
|
backgroundImage = new Texture(Gdx.files.internal("background/msx-boot.png"));
|
||||||
font = new BitmapFont();
|
font = new BitmapFont();
|
||||||
|
fontError = new BitmapFont();
|
||||||
|
fontError.setColor(1f, 0f, 0f, 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,8 +45,12 @@ public class GDXAppTos4BootScreen extends ScreenAdapter implements GDXAppTos4Boo
|
||||||
batch.begin();
|
batch.begin();
|
||||||
batch.draw(backgroundImage, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
batch.draw(backgroundImage, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
synchronized (messages) {
|
synchronized (messages) {
|
||||||
for (String message:messages) {
|
for (BootMessage message:messages) {
|
||||||
font.draw(batch, message, textX, textY-=textYStep);
|
if (message.bootLine != null) {
|
||||||
|
font.draw(batch, message.bootLine, textX, textY-=textYStep);
|
||||||
|
} else if (message.bootLineError != null) {
|
||||||
|
fontError.draw(batch, message.bootLineError, textX, textY-=textYStep);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
batch.end();
|
batch.end();
|
||||||
|
@ -45,12 +61,20 @@ public class GDXAppTos4BootScreen extends ScreenAdapter implements GDXAppTos4Boo
|
||||||
batch.dispose();
|
batch.dispose();
|
||||||
backgroundImage.dispose();
|
backgroundImage.dispose();
|
||||||
font.dispose();
|
font.dispose();
|
||||||
|
fontError.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bootLine(String message) {
|
public void bootLine(String message) {
|
||||||
synchronized (messages) {
|
synchronized (messages) {
|
||||||
messages.add(message);
|
messages.add(new BootMessage(message, null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void bootLineError(String message) {
|
||||||
|
synchronized (messages) {
|
||||||
|
messages.add(new BootMessage(null, message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class GDXAppTos4Startup {
|
||||||
final Framework systemBundle = GDXAppTos4BootFactory.createFramework();
|
final Framework systemBundle = GDXAppTos4BootFactory.createFramework();
|
||||||
final GDXAppTos4BootScreen bootScreen = new GDXAppTos4BootScreen();
|
final GDXAppTos4BootScreen bootScreen = new GDXAppTos4BootScreen();
|
||||||
|
|
||||||
systemActivator.addBootListener(bootScreen);
|
systemActivator.setBootListener(bootScreen);
|
||||||
tos4.registrateScreen(bootScreen);
|
tos4.registrateScreen(bootScreen);
|
||||||
tos4.selectScreen(GDXAppTos4BootScreen.class);
|
tos4.selectScreen(GDXAppTos4BootScreen.class);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class GDXAppTos4Startup {
|
||||||
if (!systemActivator.hasStartError()) {
|
if (!systemActivator.hasStartError()) {
|
||||||
Gdx.app.postRunnable(() -> {
|
Gdx.app.postRunnable(() -> {
|
||||||
LOG.debug("Release boot-screen");
|
LOG.debug("Release boot-screen");
|
||||||
systemActivator.removeBootListener(bootScreen);
|
systemActivator.setBootListener(null);
|
||||||
tos4.disposeScreen(bootScreen);
|
tos4.disposeScreen(bootScreen);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,6 @@ package love.distributedrebirth.gdxapp4d.vrgem4.service;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher;
|
|
||||||
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection;
|
|
||||||
|
|
||||||
public interface VrGem4LocaleService {
|
public interface VrGem4LocaleService {
|
||||||
|
|
||||||
void setTextLocaleI18n(String isoCode);
|
void setTextLocaleI18n(String isoCode);
|
||||||
|
|
Loading…
Reference in a new issue