Bootup as osgi bundles
This commit is contained in:
parent
9afa43331a
commit
b526b97558
122 changed files with 1762 additions and 681 deletions
68
gdxapp4d-tos4/pom.xml
Normal file
68
gdxapp4d-tos4/pom.xml
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>love.distributedrebirth.gdxapp4d</groupId>
|
||||
<artifactId>gdxapp4d</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>gdxapp4d-tos4</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>love.distributedrebirth.gdxapp4d</groupId>
|
||||
<artifactId>gdxapp4d-lib-bassboonyd</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>love.distributedrebirth.gdxapp4d</groupId>
|
||||
<artifactId>gdxapp4d-lib-numberxd</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>love.distributedrebirth.gdxapp4d</groupId>
|
||||
<artifactId>gdxapp4d-lib-unicodezd</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>love.distributedrebirth.gdxapp4d</groupId>
|
||||
<artifactId>gdxapp4d-lib-imxmi</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>games.spooky.gdx</groupId>
|
||||
<artifactId>gdx-nativefilechooser</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>org.apache.felix.framework</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<_donotcopy>(.git)</_donotcopy>
|
||||
<Import-Package>org.osgi.framework,org.osgi.service.packageadmin,org.osgi.service.url,org.osgi.service.startlevel,org.osgi.util.tracker,*</Import-Package>
|
||||
<Export-Package>love.distributedrebirth.gdxapp4d.tos4.service</Export-Package>
|
||||
<Private-Package>love.distributedrebirth.gdxapp4d.tos4.*</Private-Package>
|
||||
<Embed-Dependency>*;artifactId=org.apache.felix.framework;inline=true,*;artifactId=gdxapp4d-lib-bassboonyd;inline=true</Embed-Dependency>
|
||||
<Bundle-Activator>love.distributedrebirth.gdxapp4d.tos4.GDXAppTos4Activator</Bundle-Activator>
|
||||
<Bundle-Vendor>distributedrebirth.love</Bundle-Vendor>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
package love.distributedrebirth.gdxapp4d.tos4;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.osgi.framework.BundleException;
|
||||
import org.osgi.framework.launch.Framework;
|
||||
|
||||
import com.badlogic.gdx.ApplicationListener;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Screen;
|
||||
import com.badlogic.gdx.utils.ScreenUtils;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnClassInfoʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnPackageInfoʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.jmx.DefaultEnumInstanceᴶᴹˣ;
|
||||
import love.distributedrebirth.bassboonyd.jmx.GuageCounterᴶᴹˣ;
|
||||
import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpTerminal;
|
||||
import net.spookygames.gdx.nativefilechooser.NativeFileChooser;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
@BãßBȍőnClassInfoʸᴰ(name = "GDXAppTos4", purpose = "Main loop render dispatcher and bootup.")
|
||||
@BãßBȍőnPackageInfoʸᴰ(name = "love.distributedrebirth.gdxapp4d.tos4")
|
||||
public enum GDXAppTos4 implements DefaultEnumInstanceᴶᴹˣ<GDXAppTos4,GDXAppTos4Keyʸᴰ>, ApplicationListener, SystemWarpTerminal {
|
||||
|
||||
INSTANCE;
|
||||
|
||||
private Screen screen;
|
||||
private Framework systemBundle;
|
||||
private GDXAppTos4Activator systemActivator;
|
||||
private Map<Class<? extends Screen>,Screen> screens;
|
||||
private NativeFileChooser fileChooser;
|
||||
private final GuageCounterᴶᴹˣ selectScreenCounter;
|
||||
private final BãßBȍőnCoffinOpenʸᴰ<GDXAppTos4Keyʸᴰ> BBC = BãßBȍőnCoffinOpenʸᴰ.newInstance();
|
||||
public BãßBȍőnCoffinʸᴰ<GDXAppTos4Keyʸᴰ> GET_BBC() { return BBC; }
|
||||
|
||||
private GDXAppTos4() {
|
||||
BBC.BOON_INIT(this);
|
||||
BȍőnJmxInit(GDXAppTos4Keyʸᴰ.JMX);
|
||||
selectScreenCounter = BȍőnJmxInitGuageCounter(GDXAppTos4Keyʸᴰ.JMX, "selectScreenCounter");
|
||||
}
|
||||
|
||||
public void BãßInit(List<String> args, int viewWidth, int viewHeight, NativeFileChooser fileChooser) {
|
||||
this.fileChooser = fileChooser;
|
||||
screens = new HashMap<>();
|
||||
systemActivator = new GDXAppTos4Activator();
|
||||
systemActivator.BãßInit(args, viewWidth, viewHeight, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
systemBundle = GDXAppTos4Startup.init(this, systemActivator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resize(int width, int height) {
|
||||
screen.resize(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
ScreenUtils.clear(0f, 0f, 0f, 1f, true);
|
||||
screen.render(Gdx.graphics.getDeltaTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pause() {
|
||||
screen.pause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
screen.resume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
for (Screen screen:screens.values()) {
|
||||
screen.dispose();
|
||||
}
|
||||
try {
|
||||
systemBundle.stop();
|
||||
} catch (BundleException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registrateScreen(Screen screen) {
|
||||
screens.put(screen.getClass(), screen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeScreen(Screen screen) {
|
||||
screens.remove(screen.getClass());
|
||||
screen.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectScreen(Class<? extends Screen> screenClass) {
|
||||
Screen screen = screens.get(screenClass);
|
||||
if (screen == null) {
|
||||
throw new NullPointerException("Unknow screen: "+screenClass);
|
||||
}
|
||||
if (this.screen != null) {
|
||||
this.screen.hide();
|
||||
}
|
||||
this.screen = screen;
|
||||
this.screen.show();
|
||||
this.screen.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
selectScreenCounter.increment();
|
||||
}
|
||||
|
||||
public NativeFileChooser getFileChooser() {
|
||||
return fileChooser;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,272 @@
|
|||
package love.distributedrebirth.gdxapp4d.tos4;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.BundleException;
|
||||
import org.x4o.xml.io.X4OConnectionException;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpBase;
|
||||
import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpBootArgs;
|
||||
import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpSea;
|
||||
import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpShip;
|
||||
import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpTerminal;
|
||||
import love.distributedrebirth.warpme.Warpᵐᵉ;
|
||||
import love.distributedrebirth.warpme.sea.WaterOcean;
|
||||
import love.distributedrebirth.warpme.sea.WaterOceanDriver;
|
||||
import love.distributedrebirth.warpme.sea.WaterSeaChain;
|
||||
import love.distributedrebirth.warpme.sea.WaterSeaMagic;
|
||||
import love.distributedrebirth.warpme.ship.WaterDevice;
|
||||
import love.distributedrebirth.warpme.ship.WaterDeviceDriver;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public class GDXAppTos4Activator implements BundleActivator {
|
||||
|
||||
public List<String> args;
|
||||
public int viewWidth;
|
||||
public int viewHeight;
|
||||
private File hyperdriveHome;
|
||||
private File warpshipHome;
|
||||
private WaterDevice warpshipDevice;
|
||||
private SystemWarpTerminal systemWarpTerminal;
|
||||
private List<GDXAppTos4BootListener> listeners = new ArrayList<>();
|
||||
|
||||
private static final String SYSTEM_USER_HOME = "user.home";
|
||||
private static final String HYPERDRIVE_HOME = "Hyperdrive";
|
||||
private static final String WARPSHIP_HOME = "Warpship";
|
||||
|
||||
public GDXAppTos4Activator() {
|
||||
}
|
||||
|
||||
public void BãßInit(List<String> args, int viewWidth, int viewHeight, SystemWarpTerminal systemWarpTerminal) {
|
||||
this.args = args;
|
||||
this.viewWidth = viewWidth;
|
||||
this.viewHeight = viewHeight;
|
||||
this.systemWarpTerminal = systemWarpTerminal;
|
||||
}
|
||||
|
||||
private void fireMessageEvent(String message) {
|
||||
for (GDXAppTos4BootListener listener:listeners) {
|
||||
listener.bootLine(message);
|
||||
}
|
||||
}
|
||||
|
||||
public void addBootListener(GDXAppTos4BootListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeBootListener(GDXAppTos4BootListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(final BundleContext context) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(final BundleContext context) {
|
||||
fireMessageEvent("Mecca System eXtension superscript Four");
|
||||
fireMessageEvent("tos4: starting...");
|
||||
fireMessageEvent("init-cpus: "+Runtime.getRuntime().availableProcessors());
|
||||
fireMessageEvent("free-memory: 0x"+Long.toHexString(Runtime.getRuntime().freeMemory()));
|
||||
|
||||
boolean useLocal = args.contains("use-local");
|
||||
|
||||
File userHome = new File(System.getProperty(SYSTEM_USER_HOME));
|
||||
hyperdriveHome = new File(userHome, HYPERDRIVE_HOME);
|
||||
fireMessageEvent("hyper-home: "+hyperdriveHome);
|
||||
if (!hyperdriveHome.exists()) {
|
||||
fireMessageEvent("ERROR: No Hyperdrive home.");
|
||||
return;
|
||||
}
|
||||
warpshipHome = new File(hyperdriveHome, WARPSHIP_HOME);
|
||||
if (useLocal) {
|
||||
warpshipHome = new File(".");
|
||||
}
|
||||
if (!warpshipHome.exists()) {
|
||||
fireMessageEvent("ERROR: No Warpship home.");
|
||||
return;
|
||||
}
|
||||
File warpShip = new File(warpshipHome, Warpᵐᵉ.WARP_SHIP);
|
||||
if (useLocal) {
|
||||
warpShip = new File(warpshipHome, "local-ship.xml");
|
||||
}
|
||||
fireMessageEvent("warp-ship: "+warpShip);
|
||||
if (!warpShip.exists()) {
|
||||
fireMessageEvent("ERROR: No warp-ship.xml found.");
|
||||
return;
|
||||
}
|
||||
|
||||
context.registerService(SystemWarpBase.class.getName(), new SystemWarpBaseImpl(), new Hashtable<String, String>());
|
||||
context.registerService(SystemWarpBootArgs.class.getName(), new SystemWarpBootArgsImpl(), new Hashtable<String, String>());
|
||||
context.registerService(SystemWarpShip.class.getName(), new SystemWarpShipImpl(), new Hashtable<String, String>());
|
||||
context.registerService(SystemWarpTerminal.class.getName(), systemWarpTerminal, new Hashtable<String, String>());
|
||||
|
||||
try {
|
||||
warpshipDevice = WaterDeviceDriver.newInstance().createReader().readFile(warpShip);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fireMessageEvent("ERROR: "+e.getMessage());
|
||||
return;
|
||||
}
|
||||
fireMessageEvent("warp-engine: "+warpshipDevice.theShip().getName());
|
||||
|
||||
Properties overrides = new Properties();
|
||||
if (useLocal) {
|
||||
File localOverride = new File("local-override.xml");
|
||||
if (localOverride.exists()) {
|
||||
try {
|
||||
overrides.loadFromXML(new FileInputStream(localOverride));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
fireMessageEvent("use-local: local-override.xml loaded.");
|
||||
} else {
|
||||
fireMessageEvent("use-local: local-override.xml not found.");
|
||||
}
|
||||
|
||||
}
|
||||
int result = 0;
|
||||
try {
|
||||
result = resolveWaterOcean(overrides, context, warpshipDevice.theShip().getEngine());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fireMessageEvent("ERROR: "+e.getMessage());
|
||||
return;
|
||||
}
|
||||
if (result > 0) {
|
||||
fireMessageEvent("tos4: FAILURE BOOT ABORTED");
|
||||
} else {
|
||||
fireMessageEvent("tos4: chains resolved.");
|
||||
}
|
||||
}
|
||||
|
||||
private int resolveWaterOcean(Properties overrides, BundleContext context, String key) throws IOException, InterruptedException, X4OConnectionException, SAXException, BundleException {
|
||||
File waterHome;
|
||||
String override = overrides.getProperty(key);
|
||||
if (override == null) {
|
||||
waterHome = new File(hyperdriveHome, key);
|
||||
if (!waterHome.exists()) {
|
||||
executeHyperdrive("hyperdrive", "mount", waterHome.getAbsolutePath(), key);
|
||||
}
|
||||
String infoResult = executeHyperdrive("hyperdrive", "info", waterHome.getAbsolutePath());
|
||||
if (!infoResult.startsWith("Drive Info")) {
|
||||
fireMessageEvent("ERROR: Couldn't get info on: "+waterHome);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
waterHome = new File(override);
|
||||
}
|
||||
File waterSea = new File(waterHome, Warpᵐᵉ.WARP_SEA);
|
||||
if (!waterSea.exists()) {
|
||||
fireMessageEvent("ERROR: No warp-sea.xml found.");
|
||||
return 1;
|
||||
}
|
||||
WaterOcean ocean = WaterOceanDriver.newInstance().createReader().readFile(waterSea);
|
||||
fireMessageEvent("water-ocean: "+key+" ("+ocean.theWater().getName()+")");
|
||||
|
||||
Hashtable<String, String> props = new Hashtable<String, String>();
|
||||
props.put(SystemWarpSea.NAME_PROPERTY, ocean.theWater().getName());
|
||||
props.put(SystemWarpSea.PROVIDER_PROPERTY, ocean.theWater().getProvider());
|
||||
context.registerService(SystemWarpSea.class.getName(), new SystemWarpSeaImpl(ocean), props);
|
||||
|
||||
for (WaterSeaMagic magic:ocean.theWater().getSeaMagics()) {
|
||||
if ("application/vnd.osgi.bundle".equals(magic.getMime())) {
|
||||
String overrideBundleKey = key + "." + magic.getFile();
|
||||
String overrideBundle = overrides.getProperty(overrideBundleKey);
|
||||
if (overrideBundle == null) {
|
||||
GDXAppTos4BootFactory.installAndStartBundles(context, "reference:file:"+waterHome.getAbsolutePath()+"/"+magic.getFile());
|
||||
} else {
|
||||
GDXAppTos4BootFactory.installAndStartBundles(context, "reference:file:"+overrideBundle);
|
||||
}
|
||||
}
|
||||
}
|
||||
int result = 0;
|
||||
for (WaterSeaChain chain: ocean.theWater().getSeaChains()) {
|
||||
result += resolveWaterOcean(overrides, context, chain.getKey());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private String executeHyperdrive(String...cmd) throws IOException, InterruptedException {
|
||||
ProcessBuilder builder = new ProcessBuilder();
|
||||
builder.command(cmd);
|
||||
builder.directory(new File(System.getProperty("user.home")));
|
||||
Process process = builder.start();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
try(BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
|
||||
String line;
|
||||
while ((line = input.readLine()) != null) {
|
||||
buf.append(line);
|
||||
}
|
||||
}
|
||||
process.waitFor();
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public class SystemWarpSeaImpl implements SystemWarpSea {
|
||||
|
||||
private final WaterOcean warpSea;
|
||||
|
||||
public SystemWarpSeaImpl(WaterOcean warpSea) {
|
||||
this.warpSea = warpSea;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WaterOcean getWarpSea() {
|
||||
return warpSea;
|
||||
}
|
||||
}
|
||||
|
||||
public class SystemWarpBaseImpl implements SystemWarpBase {
|
||||
|
||||
@Override
|
||||
public File getHyperdriveHome() {
|
||||
return hyperdriveHome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getWarpshipHome() {
|
||||
return warpshipHome;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class SystemWarpBootArgsImpl implements SystemWarpBootArgs {
|
||||
|
||||
@Override
|
||||
public List<String> getBootArgs() {
|
||||
return args;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBootWindowWidth() {
|
||||
return viewWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBootWindowHeight() {
|
||||
return viewHeight;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class SystemWarpShipImpl implements SystemWarpShip {
|
||||
|
||||
@Override
|
||||
public WaterDevice getWarpShip() {
|
||||
return warpshipDevice;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
package love.distributedrebirth.gdxapp4d.tos4;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.BundleException;
|
||||
import org.osgi.framework.Constants;
|
||||
import org.osgi.framework.launch.Framework;
|
||||
import org.osgi.framework.launch.FrameworkFactory;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public class GDXAppTos4BootFactory {
|
||||
|
||||
public static void installAndStartBundles(BundleContext bundleContext, String... bundleLocations) throws BundleException {
|
||||
for (String location : bundleLocations) {
|
||||
Bundle addition = bundleContext.installBundle(location);
|
||||
addition.start();
|
||||
}
|
||||
}
|
||||
|
||||
public static Framework createFramework() {
|
||||
return createFramework(buildConfig());
|
||||
}
|
||||
|
||||
public static Framework createFramework(Map<String, String> config) {
|
||||
ServiceLoader<FrameworkFactory> factoryLoader = ServiceLoader.load(FrameworkFactory.class);
|
||||
for (FrameworkFactory factory : factoryLoader) {
|
||||
return factory.newFramework(config);
|
||||
}
|
||||
throw new IllegalStateException("Unable to load FrameworkFactory service.");
|
||||
}
|
||||
|
||||
public static Map<String, String> buildConfig() {
|
||||
final File cachedir = createCacheDir();
|
||||
|
||||
Map<String, String> configMap = new HashMap<String, String>();
|
||||
configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA,
|
||||
"love.distributedrebirth.gdxapp4d.tos4.service,"+
|
||||
"com.badlogic.gdx,"+
|
||||
"com.badlogic.gdx.assets,"+
|
||||
"com.badlogic.gdx.assets.loaders,"+
|
||||
"com.badlogic.gdx.assets.loaders.resolvers,"+
|
||||
"com.badlogic.gdx.audio,"+
|
||||
"com.badlogic.gdx.files,"+
|
||||
"com.badlogic.gdx.graphics,"+
|
||||
"com.badlogic.gdx.graphics.g2d,"+
|
||||
"com.badlogic.gdx.graphics.g3d,"+
|
||||
"com.badlogic.gdx.graphics.g3d.attributes,"+
|
||||
"com.badlogic.gdx.graphics.g3d.decals,"+
|
||||
"com.badlogic.gdx.graphics.g3d.environment,"+
|
||||
"com.badlogic.gdx.graphics.g3d.loader,"+
|
||||
"com.badlogic.gdx.graphics.g3d.model,"+
|
||||
"com.badlogic.gdx.graphics.g3d.model.data,"+
|
||||
"com.badlogic.gdx.graphics.g3d.particles,"+
|
||||
"com.badlogic.gdx.graphics.g3d.particles.bactches,"+
|
||||
"com.badlogic.gdx.graphics.g3d.particles.emitters,"+
|
||||
"com.badlogic.gdx.graphics.g3d.particles.influencers,"+
|
||||
"com.badlogic.gdx.graphics.g3d.particles.renderers,"+
|
||||
"com.badlogic.gdx.graphics.g3d.particles.values,"+
|
||||
"com.badlogic.gdx.graphics.g3d.shaders,"+
|
||||
"com.badlogic.gdx.graphics.g3d.utils,"+
|
||||
"com.badlogic.gdx.graphics.g3d.utils.shapebuilders,"+
|
||||
"com.badlogic.gdx.graphics.glutils,"+
|
||||
"com.badlogic.gdx.graphics.profiling,"+
|
||||
"com.badlogic.gdx.input,"+
|
||||
"com.badlogic.gdx.maps,"+
|
||||
"com.badlogic.gdx.maps.objects,"+
|
||||
"com.badlogic.gdx.maps.tiled,"+
|
||||
"com.badlogic.gdx.maps.tiled.objects,"+
|
||||
"com.badlogic.gdx.maps.tiled.renderers,"+
|
||||
"com.badlogic.gdx.maps.tiled.tiles,"+
|
||||
"com.badlogic.gdx.math,"+
|
||||
"com.badlogic.gdx.math.collision,"+
|
||||
"com.badlogic.gdx.net,"+
|
||||
"com.badlogic.gdx.scenes.scene2d,"+
|
||||
"com.badlogic.gdx.scenes.scene2d.actions,"+
|
||||
"com.badlogic.gdx.scenes.scene2d.ui,"+
|
||||
"com.badlogic.gdx.scenes.scene2d.utils,"+
|
||||
"com.badlogic.gdx.utils,"+
|
||||
"com.badlogic.gdx.utils.async,"+
|
||||
"com.badlogic.gdx.utils.compression,"+
|
||||
"com.badlogic.gdx.utils.compression.lz,"+
|
||||
"com.badlogic.gdx.utils.compression.lzma,"+
|
||||
"com.badlogic.gdx.utils.compression.rangecoder,"+
|
||||
"com.badlogic.gdx.utils.reflect,"+
|
||||
"com.badlogic.gdx.utils.viewport,"+
|
||||
"imgui,"+
|
||||
"imgui.flag,"+
|
||||
"imgui.glfw,"+
|
||||
"imgui.gl3,"+
|
||||
"imgui.type,"+
|
||||
"net.spookygames.gdx.nativefilechooser,"+
|
||||
"love.distributedrebirth.bassboonyd,"+
|
||||
"love.distributedrebirth.bassboonyd.jmx,"+
|
||||
"love.distributedrebirth.numberxd,"+
|
||||
"love.distributedrebirth.numberxd.base2t,"+
|
||||
"love.distributedrebirth.numberxd.base2t.part,"+
|
||||
"love.distributedrebirth.numberxd.base2t.part.warp,"+
|
||||
"love.distributedrebirth.numberxd.base2t.type,"+
|
||||
"love.distributedrebirth.numberxd.base2t.typexl,"+
|
||||
"love.distributedrebirth.numberxd.glyph,"+
|
||||
"love.distributedrebirth.numberxd.x4o"
|
||||
); // ; version=1.0.0
|
||||
|
||||
if (cachedir != null) {
|
||||
configMap.put(Constants.FRAMEWORK_STORAGE, cachedir.getAbsolutePath());
|
||||
}
|
||||
return configMap;
|
||||
}
|
||||
|
||||
private static File createCacheDir() {
|
||||
final File cachedir;
|
||||
try {
|
||||
cachedir = File.createTempFile("gdxapp4d.tos4.cache", null);
|
||||
cachedir.delete();
|
||||
createShutdownHook(cachedir);
|
||||
return cachedir;
|
||||
} catch (IOException e) {
|
||||
// temp dir creation failed, return null
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void createShutdownHook(final File cachedir) {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
deleteFileOrDir(cachedir);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void deleteFileOrDir(File file) {
|
||||
if (file.isDirectory()) {
|
||||
File[] childs = file.listFiles();
|
||||
for (File child : childs) {
|
||||
deleteFileOrDir(child);
|
||||
}
|
||||
}
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package love.distributedrebirth.gdxapp4d.tos4;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public interface GDXAppTos4BootListener {
|
||||
|
||||
void bootLine(String message);
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package love.distributedrebirth.gdxapp4d.tos4;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.ScreenAdapter;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public class GDXAppTos4BootScreen extends ScreenAdapter implements GDXAppTos4BootListener {
|
||||
|
||||
private BitmapFont font;
|
||||
private SpriteBatch batch;
|
||||
private Texture backgroundImage;
|
||||
private List<String> messages = new ArrayList<>();
|
||||
|
||||
public GDXAppTos4BootScreen() {
|
||||
batch = new SpriteBatch();
|
||||
backgroundImage = new Texture(Gdx.files.internal("background/msx-boot.png"));
|
||||
font = new BitmapFont();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float delta) {
|
||||
int textX = 100;
|
||||
int textY = 420;
|
||||
int textYStep = 20;
|
||||
batch.begin();
|
||||
batch.draw(backgroundImage, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
synchronized (messages) {
|
||||
for (String message:messages) {
|
||||
font.draw(batch, message, textX, textY-=textYStep);
|
||||
}
|
||||
}
|
||||
batch.end();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
batch.dispose();
|
||||
backgroundImage.dispose();
|
||||
font.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bootLine(String message) {
|
||||
synchronized (messages) {
|
||||
messages.add(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package love.distributedrebirth.gdxapp4d.tos4;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinStoreKeyʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public enum GDXAppTos4Keyʸᴰ implements BãßBȍőnCoffinStoreKeyʸᴰ {
|
||||
|
||||
JMX,
|
||||
|
||||
;
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
package love.distributedrebirth.gdxapp4d.tos4;
|
||||
|
||||
import org.osgi.framework.launch.Framework;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.badlogic.gdx.Application;
|
||||
import com.badlogic.gdx.ApplicationLogger;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public class GDXAppTos4Startup {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GDXAppTos4Startup.class);
|
||||
|
||||
public static Framework init(GDXAppTos4 tos4, GDXAppTos4Activator systemActivator) {
|
||||
LOG.info("init framework");
|
||||
Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
||||
Gdx.app.setApplicationLogger(new GDXAppApplicationLogger());
|
||||
|
||||
final Framework systemBundle = GDXAppTos4BootFactory.createFramework();
|
||||
final GDXAppTos4BootScreen bootScreen = new GDXAppTos4BootScreen();
|
||||
|
||||
systemActivator.addBootListener(bootScreen);
|
||||
tos4.registrateScreen(bootScreen);
|
||||
tos4.selectScreen(GDXAppTos4BootScreen.class);
|
||||
|
||||
Runnable run = () -> {
|
||||
try {
|
||||
systemBundle.init();
|
||||
systemBundle.start();
|
||||
systemActivator.start(systemBundle.getBundleContext());
|
||||
|
||||
Gdx.app.postRunnable(() -> {
|
||||
LOG.debug("Release boot screen");
|
||||
systemActivator.removeBootListener(bootScreen);
|
||||
tos4.disposeScreen(bootScreen);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
};
|
||||
Thread framework = new Thread(run);
|
||||
framework.start();
|
||||
|
||||
return systemBundle;
|
||||
}
|
||||
|
||||
static class GDXAppApplicationLogger implements ApplicationLogger {
|
||||
|
||||
@Override
|
||||
public void log(String tag, String message) {
|
||||
LoggerFactory.getLogger(tag).info(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(String tag, String message, Throwable exception) {
|
||||
LoggerFactory.getLogger(tag).info(message, exception);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(String tag, String message) {
|
||||
LoggerFactory.getLogger(tag).error(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(String tag, String message, Throwable exception) {
|
||||
LoggerFactory.getLogger(tag).error(message, exception);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(String tag, String message) {
|
||||
LoggerFactory.getLogger(tag).debug(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(String tag, String message, Throwable exception) {
|
||||
LoggerFactory.getLogger(tag).debug(message, exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package love.distributedrebirth.gdxapp4d.tos4.service;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public interface SystemWarpBase {
|
||||
|
||||
File getHyperdriveHome();
|
||||
|
||||
File getWarpshipHome();
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package love.distributedrebirth.gdxapp4d.tos4.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public interface SystemWarpBootArgs {
|
||||
|
||||
List<String> getBootArgs();
|
||||
|
||||
int getBootWindowWidth();
|
||||
|
||||
int getBootWindowHeight();
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package love.distributedrebirth.gdxapp4d.tos4.service;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
import love.distributedrebirth.warpme.sea.WaterOcean;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public interface SystemWarpSea {
|
||||
|
||||
String NAME_PROPERTY = "warp.sea.name";
|
||||
String PROVIDER_PROPERTY = "warp.sea.provider";
|
||||
|
||||
WaterOcean getWarpSea();
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package love.distributedrebirth.gdxapp4d.tos4.service;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
import love.distributedrebirth.warpme.ship.WaterDevice;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public interface SystemWarpShip {
|
||||
|
||||
WaterDevice getWarpShip();
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package love.distributedrebirth.gdxapp4d.tos4.service;
|
||||
|
||||
import com.badlogic.gdx.Screen;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public interface SystemWarpTerminal {
|
||||
|
||||
void registrateScreen(Screen screen);
|
||||
|
||||
void disposeScreen(Screen screen);
|
||||
|
||||
void selectScreen(Class<? extends Screen> screenClass);
|
||||
}
|
||||
BIN
gdxapp4d-tos4/src/main/resources/background/doom-credits.png
Normal file
BIN
gdxapp4d-tos4/src/main/resources/background/doom-credits.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 373 KiB |
BIN
gdxapp4d-tos4/src/main/resources/background/gdxapp-loading.png
Normal file
BIN
gdxapp4d-tos4/src/main/resources/background/gdxapp-loading.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 315 KiB |
BIN
gdxapp4d-tos4/src/main/resources/background/msx-boot.png
Normal file
BIN
gdxapp4d-tos4/src/main/resources/background/msx-boot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
BIN
gdxapp4d-tos4/src/main/resources/background/temple-os.png
Normal file
BIN
gdxapp4d-tos4/src/main/resources/background/temple-os.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
BIN
gdxapp4d-tos4/src/main/resources/background/terrydavis-front.png
Normal file
BIN
gdxapp4d-tos4/src/main/resources/background/terrydavis-front.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 249 KiB |
BIN
gdxapp4d-tos4/src/main/resources/background/terrydavis-nose.png
Normal file
BIN
gdxapp4d-tos4/src/main/resources/background/terrydavis-nose.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 229 KiB |
BIN
gdxapp4d-tos4/src/main/resources/font/code-2000.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/code-2000.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/code-2001.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/code-2001.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/code-2002.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/code-2002.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/fa-solid-900.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/fa-solid-900.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/free-sans.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/free-sans.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/new-gardiner-bmp.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/new-gardiner-bmp.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-balinese.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-balinese.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-bamum.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-bamum.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-batak.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-batak.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-brahmi.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-brahmi.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-glagolitic.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-glagolitic.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-lepcha.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-lepcha.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-lisu.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-lisu.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-samaritan.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-samaritan.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-sinhala.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-sinhala.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-sundanese.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-sundanese.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-tagalog.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-tagalog.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-tagbanwa.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-tagbanwa.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-tai-le.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-tai-le.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-tai-tham.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/noto-sans-tai-tham.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/font/noto-serif-tibetan.ttf
Normal file
BIN
gdxapp4d-tos4/src/main/resources/font/noto-serif-tibetan.ttf
Normal file
Binary file not shown.
BIN
gdxapp4d-tos4/src/main/resources/idtech-doom-sigil.mp3
Normal file
BIN
gdxapp4d-tos4/src/main/resources/idtech-doom-sigil.mp3
Normal file
Binary file not shown.
|
|
@ -0,0 +1,9 @@
|
|||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
uniform vec4 u_color;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = vec4(u_color);
|
||||
}
|
||||
10
gdxapp4d-tos4/src/main/resources/shader/color.vertex.glsl
Normal file
10
gdxapp4d-tos4/src/main/resources/shader/color.vertex.glsl
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
attribute vec3 a_position;
|
||||
attribute vec3 a_normal;
|
||||
attribute vec2 a_texCoord0;
|
||||
|
||||
uniform mat4 u_worldTrans;
|
||||
uniform mat4 u_projTrans;
|
||||
|
||||
void main() {
|
||||
gl_Position = u_projTrans * u_worldTrans * vec4(a_position, 1.0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue