Commit 6e97feb5 authored by Stephanie Gawroriski's avatar Stephanie Gawroriski
Browse files

Implement getColorOfName(); Add base entry for StarApplication.

parent 81a16943
Pipeline #90168 passed with stages
in 6 minutes and 45 seconds
......@@ -42,6 +42,10 @@ public class IModeApplication
public static final String VENDOR_PROPERTY =
"cc.squirreljme.imode.vendor";
/** The prefix for ADF properties. */
public static final String ADF_PROPERTY_PREFIX =
"cc.squirrlejme.imode.adf";
/** Boot class. */
private static final String _BOOT_CLASS =
"com.nttdocomo.ui.__AppLaunch__";
......@@ -78,6 +82,10 @@ public class IModeApplication
private static final String _SP_SIZE =
"SPsize";
/** Draw area. */
private static final String _DRAW_AREA =
"DrawArea";
/** ADF Properties. */
private final Map<String, String> _adfProps;
......@@ -156,11 +164,19 @@ public class IModeApplication
adfProps.get(IModeApplication._KVM_VER));
String profile = adfProps.get(IModeApplication._PROFILE_VER);
// Default to old stuff
// Used as heuristic for versioning
String drawArea = adfProps.get(IModeApplication._DRAW_AREA);
// Try to guess a reasonable version to use
if (config == null || config.isEmpty())
config = "CLDC-1.0";
config = "CLDC-1.1";
if (profile == null || profile.isEmpty())
profile = "DoJa-1.0";
{
if (drawArea != null)
profile = "DoJa-2.0";
else
profile = "DoJa-1.0";
}
return new DependencyInfo(new Configuration(config),
new Profile(profile));
......@@ -209,6 +225,12 @@ public class IModeApplication
rv.put("microedition.platform",
SquirrelJME.platform(PhoneModelType.NTT_DOCOMO_D503I));
// Copy all ADF properties to system properties, it can be used in
// the future to access specific properties accordingly
for (Map.Entry<String, String> property : adfProps.entrySet())
rv.put(IModeApplication.ADF_PROPERTY_PREFIX + "." +
property.getKey(), property.getValue());
return rv;
}
......
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package cc.squirreljme.runtime.cldc.debug;
/**
* This is used when an argument is not truly known.
*
* @since 2022/02/27
*/
public final class UndeterminedArgumentType
extends Error
{
/**
* Cannot be initialized.
*
* @since 2022/02/27
*/
private UndeterminedArgumentType()
{
}
}
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package cc.squirreljme.runtime.cldc.debug;
/**
* This represents a type which is not really known.
*
* @since 2022/02/27
*/
public final class UndeterminedReturnType
extends Error
{
/**
* Cannot be initialized.
*
* @since 2022/02/27
*/
private UndeterminedReturnType()
{
}
}
......@@ -20,6 +20,8 @@ squirreljme
definedProfiles += new JavaMEProfile("DoJa-4.1")
definedProfiles += new JavaMEProfile("DoJa-5.0")
definedProfiles += new JavaMEProfile("DoJa-5.1")
definedProfiles += new JavaMEProfile("Star-1.0")
definedProfiles += new JavaMEProfile("Star-2.0")
tags += "nttdocomo"
tags += "imode"
tags += "doja"
......
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package cc.squirreljme.runtime.nttdocomo;
/**
* Common interface for DoJa and Star applications.
*
* @since 2022/02/27
*/
public interface CommonDoJaApplication
{
void terminate();
}
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package com.docomostar;
import cc.squirreljme.runtime.cldc.debug.Debugging;
import cc.squirreljme.runtime.cldc.debug.UndeterminedArgumentType;
import cc.squirreljme.runtime.cldc.debug.UndeterminedReturnType;
import cc.squirreljme.runtime.nttdocomo.CommonDoJaApplication;
public abstract class StarApplication
implements CommonDoJaApplication
{
public static final UndeterminedReturnType LAUNCHED_AFTER_DOWNLOAD =
Debugging.<UndeterminedReturnType>todoObject();
public static final UndeterminedReturnType LAUNCHED_FROM_EXT =
Debugging.<UndeterminedReturnType>todoObject();
public static final UndeterminedReturnType LAUNCHED_FROM_TIMER =
Debugging.<UndeterminedReturnType>todoObject();
public abstract void started(int __unknownInt);
public UndeterminedReturnType activated(UndeterminedArgumentType __unknown)
{
throw Debugging.todo();
}
public UndeterminedReturnType addApplicationListener(
UndeterminedReturnType __unknown)
{
throw Debugging.todo();
}
public UndeterminedReturnType addEventListener(
UndeterminedReturnType __unknown)
{
throw Debugging.todo();
}
public UndeterminedReturnType changeAppType(
UndeterminedArgumentType __unknown)
{
throw Debugging.todo();
}
public UndeterminedReturnType getAppState(
UndeterminedArgumentType __unknown)
{
throw Debugging.todo();
}
public UndeterminedReturnType stateChanged(
UndeterminedArgumentType __unknown)
{
throw Debugging.todo();
}
public UndeterminedReturnType suspend(
UndeterminedArgumentType __unknown)
{
throw Debugging.todo();
}
public void terminate()
{
throw Debugging.todo();
}
}
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
/**
* NTT Docomo Doja Star API.
*
* @since 2022/02/27
*/
package com.docomostar;
......@@ -266,9 +266,32 @@ public class Graphics
// Has no effect on SquirrelJME
}
@SuppressWarnings("MagicNumber")
public static int getColorOfName(int __name)
throws IllegalArgumentException
{
throw Debugging.todo();
switch (__name)
{
case Graphics.AQUA: return 0x00FF00;
case Graphics.BLACK: return 0x000000;
case Graphics.BLUE: return 0x0000FF;
case Graphics.FUCHSIA: return 0xFF0000;
case Graphics.GRAY: return 0xFFFFFF;
case Graphics.GREEN: return 0x000080;
case Graphics.LIME: return 0x0000FF;
case Graphics.MAROON: return 0x008080;
case Graphics.NAVY: return 0x808080;
case Graphics.OLIVE: return 0x808000;
case Graphics.PURPLE: return 0x800080;
case Graphics.RED: return 0x00FFFF;
case Graphics.SILVER: return 0xC0C0C0;
case Graphics.TEAL: return 0x008000;
case Graphics.WHITE: return 0xFFFF00;
case Graphics.YELLOW: return 0xFF00FF;
}
// {@squirreljme.error AH0r Invalid color. (The color)}
throw new IllegalArgumentException("AH0r " + __name);
}
public static int getColorOfRGB(int __r, int __g, int __b)
......
......@@ -10,9 +10,10 @@
package com.nttdocomo.ui;
import cc.squirreljme.runtime.cldc.debug.Debugging;
import cc.squirreljme.runtime.lcdui.mle.StaticDisplayState;
import cc.squirreljme.runtime.nttdocomo.CommonDoJaApplication;
public abstract class IApplication
implements CommonDoJaApplication
{
/** The last application created. */
static volatile IApplication _lastApp;
......
......@@ -11,9 +11,11 @@ package com.nttdocomo.ui;
import cc.squirreljme.runtime.cldc.Poking;
import cc.squirreljme.runtime.midlet.ApplicationHandler;
import com.docomostar.StarApplication;
/**
* This class takes care of launching {@link IApplication}s.
* This class takes care of launching {@link IApplication} and
* {@link StarApplication}.
*
* @since 2021/06/13
*/
......
......@@ -9,9 +9,12 @@
package com.nttdocomo.ui;
import cc.squirreljme.jvm.launch.IModeApplication;
import cc.squirreljme.runtime.cldc.debug.Debugging;
import cc.squirreljme.runtime.midlet.ApplicationHandler;
import cc.squirreljme.runtime.midlet.ApplicationInterface;
import cc.squirreljme.runtime.midlet.CleanupHandler;
import cc.squirreljme.runtime.nttdocomo.CommonDoJaApplication;
import com.docomostar.StarApplication;
import java.util.Objects;
/**
......@@ -20,7 +23,7 @@ import java.util.Objects;
* @since 2021/11/30
*/
final class __IAppliInterface__
implements ApplicationInterface<IApplication>
implements ApplicationInterface<CommonDoJaApplication>
{
/** Main application class. */
protected final String mainClass;
......@@ -51,7 +54,7 @@ final class __IAppliInterface__
* @since 2021/11/30
*/
@Override
public void destroy(IApplication __instance, Throwable __thrown)
public void destroy(CommonDoJaApplication __instance, Throwable __thrown)
throws NullPointerException, Throwable
{
if (__instance == null)
......@@ -72,13 +75,13 @@ final class __IAppliInterface__
* @since 2021/11/30
*/
@Override
public IApplication newInstance()
public CommonDoJaApplication newInstance()
throws Throwable
{
// Load application details
synchronized (IApplication.class)
{
IApplication._appArgs = this._args;;
IApplication._appArgs = this._args;
}
// Main class for entry
......@@ -115,6 +118,8 @@ final class __IAppliInterface__
// instance is being created it will not be erroneously caught
try
{
if (rawInstance instanceof StarApplication)
return (StarApplication)rawInstance;
return (IApplication)rawInstance;
}
catch (ClassCastException e)
......@@ -135,13 +140,17 @@ final class __IAppliInterface__
* @since 2021/11/30
*/
@Override
public void startApp(IApplication __instance)
public void startApp(CommonDoJaApplication __instance)
throws NullPointerException, Throwable
{
if (__instance == null)
throw new NullPointerException("NARG");
// Start the application
__instance.start();
if (__instance instanceof StarApplication)
((StarApplication)__instance).started(
(int)Debugging.todoObject());
else
((IApplication)__instance).start();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment