Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
SquirrelJME
Commits
38941ae0
Commit
38941ae0
authored
Jul 18, 2021
by
Stephanie Gawroriski
Browse files
Bring in more shelf changes.
parent
a322346e
Changes
9
Hide whitespace changes
Inline
Side-by-side
modules/cldc-compact/src/main/java/cc/squirreljme/jvm/mle/ObjectShelf.java
View file @
38941ae0
...
...
@@ -11,6 +11,7 @@ package cc.squirreljme.jvm.mle;
import
cc.squirreljme.jvm.mle.brackets.TypeBracket
;
import
cc.squirreljme.jvm.mle.constants.MonitorResultType
;
import
cc.squirreljme.jvm.mle.exceptions.MLECallError
;
/**
* This shelf supports object anything that has to do with objects.
...
...
@@ -28,6 +29,19 @@ public final class ObjectShelf
{
}
/**
* Checks if the given object can be stored in the specified array.
*
* @param __array The array to check.
* @param __val The value to check
* @return If the value can be stored in the given array.
* @throws MLECallError If given type is not an array or {@code __array}
* is {@code null}.
* @since 2021/02/07
*/
public
static
native
boolean
arrayCheckStore
(
Object
__array
,
Object
__val
)
throws
MLECallError
;
/**
* Copies the given arrays. If the source and destination are the same
* array, the copy operation will not collide with itself.
...
...
@@ -180,6 +194,27 @@ public final class ObjectShelf
*/
public
static
native
int
identityHashCode
(
Object
__o
);
/**
* Checks if this object is an array.
*
* @param __object The object to check.
* @return If this object is an array.
* @since 2021/04/07
*/
public
static
native
boolean
isArray
(
Object
__object
);
/**
* Checks if this object is an instance of the given type.
*
* @param __o The object to check.
* @param __type The type it may be.
* @return If this object is an instance of the given type.
* @throws MLECallError If {@code __type} is null.
* @since 2021/02/07
*/
public
static
native
boolean
isInstance
(
Object
__o
,
TypeBracket
__type
)
throws
MLECallError
;
/**
* Creates a new instance of the given type.
*
...
...
@@ -203,6 +238,10 @@ public final class ObjectShelf
/**
* Waits on the given monitor.
*
* If the monitor will block and SquirrelJME is running in cooperative
* single threaded mode, this will relinquish control of the current
* thread.
*
* @param __object The object to wait on.
* @param __ms The milliseconds to wait.
* @param __ns The nanoseconds to wait.
...
...
modules/cldc-compact/src/main/java/cc/squirreljme/jvm/mle/ThreadShelf.java
View file @
38941ae0
...
...
@@ -9,8 +9,10 @@
package
cc.squirreljme.jvm.mle
;
import
cc.squirreljme.jvm.mle.brackets.TaskBracket
;
import
cc.squirreljme.jvm.mle.brackets.TracePointBracket
;
import
cc.squirreljme.jvm.mle.brackets.VMThreadBracket
;
import
cc.squirreljme.jvm.mle.constants.ThreadModelType
;
import
cc.squirreljme.jvm.mle.exceptions.MLECallError
;
/**
...
...
@@ -43,6 +45,14 @@ public final class ThreadShelf
public
static
native
VMThreadBracket
createVMThread
(
Thread
__javaThread
)
throws
MLECallError
;
/**
* Returns the exit code for the current process.
*
* @return The exit code for the current process.
* @since 2020/06/17
*/
public
static
native
int
currentExitCode
();
/**
* Returns the current Java thread.
*
...
...
@@ -52,12 +62,25 @@ public final class ThreadShelf
public
static
native
Thread
currentJavaThread
();
/**
* Returns the
exit code for the current process
.
* Returns the
current virtual machine thread
.
*
* @return The
exit code for the current process
.
* @since 202
0
/0
6/17
* @return The
current virtual machine thread
.
* @since 202
1
/0
5/08
*/
public
static
native
int
currentExitCode
();
public
static
native
VMThreadBracket
currentVMThread
();
/**
* Checks if these two threads are the same.
*
* @param __a The first thread.
* @param __b The second thread.
* @return If these are the same thread.
* @throws MLECallError If either arguments are null.
* @since 2021/05/08
*/
public
static
native
boolean
equals
(
VMThreadBracket
__a
,
VMThreadBracket
__b
)
throws
MLECallError
;
/**
* Returns whether the interrupt flag was raised and clears it.
...
...
@@ -126,6 +149,14 @@ public final class ThreadShelf
public
static
native
void
javaThreadSetDaemon
(
Thread
__javaThread
)
throws
MLECallError
;
/**
* Returns the {@link ThreadModelType} of the virtual machine.
*
* @return The {@link ThreadModelType} of the virtual machine.
* @since 2021/05/07
*/
public
static
native
int
model
();
/**
* Runs the main entry point for the current process and gives it all of
* the arguments that were specified on program initialization.
...
...
@@ -161,6 +192,10 @@ public final class ThreadShelf
*
* If both times are zero, this means to yield the thread (give up its
* current execution context).
*
* If SquirrelJME is running in cooperative
* single threaded mode, this will relinquish control of the current
* thread.
*
* @param __ms The number of milliseconds.
* @param __ns The number of nanoseconds.
...
...
@@ -267,11 +302,26 @@ public final class ThreadShelf
public
static
native
boolean
vmThreadStart
(
VMThreadBracket
__vmThread
)
throws
MLECallError
;
/**
* Returns the task that owns the given thread.
*
* @param __vmThread The thread to get the task of.
* @return The task for the given thread.
* @throws MLECallError If the thread is not valid.
* @since 2021/05/08
*/
public
static
native
TaskBracket
vmThreadTask
(
VMThreadBracket
__vmThread
)
throws
MLECallError
;
/**
* Waits for the state of threads to be updated, or just times out.
*
* A thread update is when another thread becomes alive, becomes dead,
* or is started.
*
* If waiting and SquirrelJME is running in cooperative
* single threaded mode, this will relinquish control of the current
* thread.
*
* @param __ms The amount of time to wait for.
* @return If the thread was interrupted while waiting.
...
...
modules/cldc-compact/src/main/java/cc/squirreljme/jvm/mle/TypeShelf.java
View file @
38941ae0
...
...
@@ -9,9 +9,11 @@
package
cc.squirreljme.jvm.mle
;
import
cc.squirreljme.jvm.Assembly
;
import
cc.squirreljme.jvm.mle.brackets.JarPackageBracket
;
import
cc.squirreljme.jvm.mle.brackets.TypeBracket
;
import
cc.squirreljme.jvm.mle.exceptions.MLECallError
;
import
cc.squirreljme.runtime.cldc.debug.Debugging
;
/**
* Provides the shelf for types that exist within the JVM.
...
...
@@ -20,14 +22,25 @@ import cc.squirreljme.jvm.mle.exceptions.MLECallError;
*/
public
final
class
TypeShelf
{
/**
* Not used.
*
* @since 2021/01/20
*/
private
TypeShelf
()
{
}
/**
* Returns the binary name of the given class.
*
* @param __type The type to get the binary name of.
* @return The binary name of this class.
* @throws MLECallError If the type is not valid.
* @since 2020/06/07
*/
public
static
native
String
binaryName
(
TypeBracket
__type
);
public
static
native
String
binaryName
(
TypeBracket
__type
)
throws
MLECallError
;
/**
* Returns the name of the package the class is within.
...
...
@@ -119,6 +132,16 @@ public final class TypeShelf
*/
public
static
native
TypeBracket
findType
(
String
__name
);
/**
* Initializes the given class.
*
* @param __info The class info to initialize.
* @throws MLECallError If the class is {@code null}.
* @since 2020/11/28
*/
public
static
native
void
initClass
(
TypeBracket
__info
)
throws
MLECallError
;
/**
* Returns the JAR that the type is within.
*
...
...
@@ -151,6 +174,34 @@ public final class TypeShelf
public
static
native
boolean
isArray
(
TypeBracket
__type
)
throws
MLECallError
;
/**
* Performs the same logic as {@link Class#isAssignableFrom(Class)},
* checks if the given class can be assigned to this one. The check is
* in the same order as {@code instanceof Object} that is
* {@code b.getClass().isAssignableFrom(a.getClass()) == (a instanceof b)}
* and {@code (Class<B>)a} does not throw {@link ClassCastException}.
*
* @param __this The basis class
* @param __other The target class which is checked for assignment.
* @return If the given
* @throws MLECallError On null arguments.
* @since 2021/02/07
*/
public
static
native
boolean
isAssignableFrom
(
TypeBracket
__this
,
TypeBracket
__other
)
throws
MLECallError
;
/**
* Checks if the given class is initialized.
*
* @param __type The class info to initialize.
* @return If the class is initialized.
* @throws MLECallError If the type is not valid.
* @since 2021/01/20
*/
public
static
native
boolean
isClassInit
(
TypeBracket
__type
)
throws
MLECallError
;
/**
* Checks if this is an enumeration.
*
...
...
modules/cldc-compact/src/main/java/cc/squirreljme/jvm/mle/UIFormShelf.java
View file @
38941ae0
...
...
@@ -16,9 +16,9 @@ import cc.squirreljme.jvm.mle.brackets.UIWidgetBracket;
import
cc.squirreljme.jvm.mle.callbacks.UIDisplayCallback
;
import
cc.squirreljme.jvm.mle.callbacks.UIFormCallback
;
import
cc.squirreljme.jvm.mle.constants.UIItemPosition
;
import
cc.squirreljme.jvm.mle.constants.UIWidgetProperty
;
import
cc.squirreljme.jvm.mle.constants.UIItemType
;
import
cc.squirreljme.jvm.mle.constants.UIMetricType
;
import
cc.squirreljme.jvm.mle.constants.UIWidgetProperty
;
import
cc.squirreljme.jvm.mle.exceptions.MLECallError
;
/**
...
...
modules/cldc-compact/src/main/java/cc/squirreljme/jvm/mle/callbacks/UIFormCallback.java
View file @
38941ae0
...
...
@@ -11,12 +11,12 @@ package cc.squirreljme.jvm.mle.callbacks;
import
cc.squirreljme.jvm.mle.brackets.UIFormBracket
;
import
cc.squirreljme.jvm.mle.brackets.UIItemBracket
;
import
cc.squirreljme.jvm.mle.constants.UIWidgetProperty
;
import
cc.squirreljme.jvm.mle.constants.UIKeyEventType
;
import
cc.squirreljme.jvm.mle.constants.UIKeyModifier
;
import
cc.squirreljme.jvm.mle.constants.UIMouseButton
;
import
cc.squirreljme.jvm.mle.constants.UIMouseEventType
;
import
cc.squirreljme.jvm.mle.constants.UIPixelFormat
;
import
cc.squirreljme.jvm.mle.constants.UIWidgetProperty
;
/**
* Interface that is used a callback on a user-interface form is to be done.
...
...
modules/cldc-compact/src/main/java/cc/squirreljme/jvm/mle/constants/NonStandardKey.java
View file @
38941ae0
...
...
@@ -17,10 +17,34 @@ package cc.squirreljme.jvm.mle.constants;
*/
public
interface
NonStandardKey
{
/** Star key. */
int
KEY_STAR
=
42
;
/** Pound key. */
int
KEY_POUND
=
35
;
/** Unknown, zero is the invalid index so always make it known. */
byte
UNKNOWN
=
0
;
/** The up arrow key. */
int
KEY_UP
=
-
1
;
/** Down arrow key. */
int
KEY_DOWN
=
-
2
;
/** Left arrow key. */
int
KEY_LEFT
=
-
3
;
/** Right arrow key. */
int
KEY_RIGHT
=
-
4
;
/** Game Up. */
byte
VGAME_UP
=
-
9
;
...
...
@@ -121,11 +145,36 @@ public interface NonStandardKey
byte
INSERT
=
-
33
;
/** Game Virtual Left Command. */
byte
VGAME_COMMAND_LEFT
=
-
34
;
/** Game Virtual Right Command. */
byte
VGAME_COMMAND_RIGHT
=
-
35
;
/** Game virtual Center Command. */
byte
VGAME_COMMAND_CENTER
=
-
36
;
/** F24. */
byte
F24
=
-
3
5
;
-
3
7
;
/** F1. */
byte
F1
=
NonStandardKey
.
F24
-
24
;
byte
F1
=
NonStandardKey
.
F24
-
24
;
/** F2. */
byte
F2
=
NonStandardKey
.
F1
+
1
;
/** F3. */
byte
F3
=
NonStandardKey
.
F1
+
2
;
/** F13. */
byte
F13
=
NonStandardKey
.
F1
+
12
;
}
modules/cldc-compact/src/main/java/cc/squirreljme/jvm/mle/constants/UIKeyModifier.java
View file @
38941ae0
...
...
@@ -18,25 +18,46 @@ public interface UIKeyModifier
{
/** Alt key modifier. */
int
MODIFIER_ALT
=
65536
;
0x10000
;
/** Shift key modifier. */
int
MODIFIER_SHIFT
=
0x20000
;
/** Control (Ctrl) key modifier. */
int
MODIFIER_CTRL
=
0x40000
;
/** Left Command Button. (SquirrelJME). */
int
MODIFIER_LEFT_COMMAND
=
0x80000
;
/**
Ctrl key modifier
. */
int
MODIFIER_
CHR
=
8388608
;
/**
Right Command button. (SquirrelJME)
. */
int
MODIFIER_
RIGHT_COMMAND
=
0x100000
;
/** Command key modifier. */
int
MODIFIER_COMMAND
=
4194304
;
0x400000
;
/** The Function key. */
int
MODIFIER_FUNCTION
=
0x800000
;
/** Ctrl key modifier. */
int
MODIFIER_CTRL
=
262144
;
/** Left and right commands, used for middle command. */
int
MODIFIER_LEFT_RIGHT_COMMANDS
=
UIKeyModifier
.
MODIFIER_LEFT_COMMAND
|
UIKeyModifier
.
MODIFIER_RIGHT_COMMAND
;
/** Mask specifically for the limits of J2ME. */
int
J2ME_MASK
=
UIKeyModifier
.
MODIFIER_ALT
|
UIKeyModifier
.
MODIFIER_FUNCTION
|
UIKeyModifier
.
MODIFIER_COMMAND
|
UIKeyModifier
.
MODIFIER_CTRL
|
UIKeyModifier
.
MODIFIER_SHIFT
;
/** Mask for all the modifier keys. */
int
MODIFIER_MASK
=
13041664
;
int
MASK
=
UIKeyModifier
.
J2ME_MASK
|
UIKeyModifier
.
MODIFIER_LEFT_RIGHT_COMMANDS
;
/** Shift key modifier. */
int
MODIFIER_SHIFT
=
131072
;
}
modules/cldc-compact/src/main/java/cc/squirreljme/jvm/mle/constants/UIWidgetProperty.java
View file @
38941ae0
...
...
@@ -107,7 +107,11 @@ public interface UIWidgetProperty
byte
INT_UPDATE_LIST_SELECTION_LOCK
=
18
;
/** The form title. */
byte
STRING_FORM_TITLE
=
19
;
/** The number of properties. */
byte
NUM_PROPERTIES
=
19
;
20
;
}
modules/cldc-compact/src/main/java/cc/squirreljme/jvm/mle/exceptions/MLECallError.java
View file @
38941ae0
...
...
@@ -9,6 +9,9 @@
package
cc.squirreljme.jvm.mle.exceptions
;
import
cc.squirreljme.jvm.SystemCallError
;
import
cc.squirreljme.jvm.SystemCallIndex
;
/**
* This is thrown when there was an error made during a MLE call.
*
...
...
@@ -61,4 +64,17 @@ public class MLECallError
{
this
.
initCause
(
__t
);
}
/**
* Initializes system call exception.
*
* @param __callId The {@link SystemCallIndex}.
* @param __code The {@link SystemCallError}.
* @since 2020/11/29
*/
public
MLECallError
(
int
__callId
,
int
__code
)
{
// {@squirreljme.error ZZ4k Failed system call. (The ID; The Error)}
super
(
"ZZ4k "
+
__callId
+
" "
+
__code
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment