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
7675c775
Commit
7675c775
authored
Dec 28, 2019
by
Stephanie Gawroriski
Browse files
Shorten FRAMEBUFFER_PROPERTY to FRAMEBUFFER; Implement base support for framebuffers.
parent
3d83e322
Changes
9
Hide whitespace changes
Inline
Side-by-side
bldt/javase/libs/javase-runtime/cc/squirreljme/jvm/Assembly.java
View file @
7675c775
...
...
@@ -1760,7 +1760,7 @@ public final class Assembly
case
SystemCallIndex
.
ERROR_GET
:
case
SystemCallIndex
.
ERROR_SET
:
case
SystemCallIndex
.
EXIT
:
case
SystemCallIndex
.
FRAMEBUFFER
_PROPERTY
:
case
SystemCallIndex
.
FRAMEBUFFER
:
case
SystemCallIndex
.
IPC_CALL
:
case
SystemCallIndex
.
GARBAGE_COLLECT
:
case
SystemCallIndex
.
LOAD_STRING
:
...
...
@@ -1912,7 +1912,7 @@ public final class Assembly
break
;
// Property of the framebuffer
case
SystemCallIndex
.
FRAMEBUFFER
_PROPERTY
:
case
SystemCallIndex
.
FRAMEBUFFER
:
try
{
rv
=
SwingFramebuffer
.
instance
().
vfb
.
framebufferProperty
(
...
...
ratufacoat/sjmecon.h
View file @
7675c775
...
...
@@ -616,8 +616,11 @@ extern "C"
/** Upload integer array. */
#define SJME_FRAMEBUFFER_PROPERTY_UPLOAD_ARRAY_INT SJME_JINT_C(14)
/** The backing object for the framebuffer, if there is one. */
#define SJME_FRAMEBUFFER_PROPERTY_BACKING_ARRAY_OBJECT SJME_JINT_C(15)
/** Maximum properties. */
#define SJME_FRAMEBUFFER_PROPERTY_NUM_PROPERTIES SJME_JINT_C(1
5
)
#define SJME_FRAMEBUFFER_PROPERTY_NUM_PROPERTIES SJME_JINT_C(1
6
)
/*****************************************************************************
*************************** SUPERVISOR PROPERTIES ****************************
...
...
runt/apis/cldc-compact/cc/squirreljme/jvm/FramebufferProperty.java
View file @
7675c775
...
...
@@ -127,9 +127,18 @@ public interface FramebufferProperty
public
static
final
byte
UPLOAD_ARRAY_INT
=
14
;
/**
* The array which backs the framebuffer, if there is one.
*
* @return The backing array object, if there is one.
* @since 2019/12/28
*/
public
static
final
byte
BACKING_ARRAY_OBJECT
=
15
;
/** The number of framebuffer properties. */
public
static
final
byte
NUM_PROPERTIES
=
1
5
;
1
6
;
/** Screen is RGB 32-bit. */
public
static
final
byte
FORMAT_INTEGER_RGB888
=
...
...
runt/apis/cldc-compact/cc/squirreljme/jvm/SystemCallIndex.java
View file @
7675c775
...
...
@@ -269,7 +269,7 @@ public interface SystemCallIndex
* @param ... Undefined, this depends on the property selected.
* @return Whatever value the frame buffer property will return.
*/
public
static
final
byte
FRAMEBUFFER
_PROPERTY
=
public
static
final
byte
FRAMEBUFFER
=
24
;
/**
...
...
runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/vfb/VirtualFramebuffer.java
View file @
7675c775
...
...
@@ -9,6 +9,8 @@
package
cc.squirreljme.runtime.lcdui.vfb
;
import
cc.squirreljme.jvm.Assembly
;
import
cc.squirreljme.jvm.FramebufferProperty
;
import
cc.squirreljme.jvm.IPCCallback
;
/**
...
...
@@ -30,6 +32,15 @@ public final class VirtualFramebuffer
/** The callback to invoke with screen actions. */
protected
final
IPCCallback
ipc
;
/** The width. */
protected
final
int
width
;
/** The height. */
protected
final
int
height
;
/** The raw pixel data. */
protected
final
int
[]
pixels
;
/**
* Initializes the virtual framebuffer.
*
...
...
@@ -39,12 +50,33 @@ public final class VirtualFramebuffer
*/
public
VirtualFramebuffer
(
IPCCallback
__ipc
)
throws
NullPointerException
{
this
(
__ipc
,
DEFAULT_WIDTH
,
DEFAULT_HEIGHT
);
}
/**
* Initializes the virtual framebuffer.
*
* @param __ipc The callback to forward events to.
* @param __w The width.
* @param __h The height.
* @throws NullPointerException On null arguments.
* @since 2019/12/28
*/
public
VirtualFramebuffer
(
IPCCallback
__ipc
,
int
__w
,
int
__h
)
{
if
(
__ipc
==
null
)
throw
new
NullPointerException
(
"NARG"
);
// Set IPC to use
this
.
ipc
=
__ipc
;
// Set size
this
.
width
=
__w
;
this
.
height
=
__h
;
// Initialize raw pixel data
this
.
pixels
=
new
int
[
__w
*
__h
];
}
/**
...
...
@@ -151,7 +183,64 @@ public final class VirtualFramebuffer
public
final
long
framebufferProperty
(
int
__pid
,
int
__a
,
int
__b
,
int
__c
,
int
__d
,
int
__e
,
int
__g
,
int
__h
)
{
throw
new
todo
.
TODO
();
// Depends on the property
switch
(
__pid
)
{
// Raw address (since it is simulated, this is not set)
case
FramebufferProperty
.
ADDRESS
:
return
0
;
// Width and scanline length
case
FramebufferProperty
.
WIDTH
:
case
FramebufferProperty
.
SCANLEN
:
return
this
.
width
;
// Height
case
FramebufferProperty
.
HEIGHT
:
return
this
.
height
;
// Flushes the display
case
FramebufferProperty
.
FLUSH
:
throw
new
todo
.
TODO
();
// Pixel format is always integer
case
FramebufferProperty
.
FORMAT
:
return
FramebufferProperty
.
FORMAT_INTEGER_RGB888
;
// Scan line length in bytes
case
FramebufferProperty
.
SCANLEN_BYTES
:
return
this
.
width
*
4
;
// The number of bytes per pixel
case
FramebufferProperty
.
BYTES_PER_PIXEL
:
return
4
;
// Bits per pixel
case
FramebufferProperty
.
BITS_PER_PIXEL
:
return
32
;
// The number of pixels
case
FramebufferProperty
.
NUM_PIXELS
:
return
this
.
width
*
this
.
height
;
// Backlight not supported
case
FramebufferProperty
.
BACKLIGHT_LEVEL_GET
:
case
FramebufferProperty
.
BACKLIGHT_LEVEL_SET
:
case
FramebufferProperty
.
BACKLIGHT_LEVEL_MAX
:
return
0
;
// Upload integer array
case
FramebufferProperty
.
UPLOAD_ARRAY_INT
:
throw
new
todo
.
TODO
();
// The backing array object
case
FramebufferProperty
.
BACKING_ARRAY_OBJECT
:
return
Assembly
.
objectToPointer
(
this
.
pixels
);
// Unknown
default
:
return
0
;
}
}
}
runt/apis/midp-lcdui/com/nokia/mid/ui/DeviceControl.java
View file @
7675c775
...
...
@@ -67,14 +67,14 @@ public class DeviceControl
// Get maximum backlight level, stop if it is zero which means the
// property is not supported or there is no backlight that can be
// controlled
int
max
=
Assembly
.
sysCallV
(
SystemCallIndex
.
FRAMEBUFFER
_PROPERTY
,
int
max
=
Assembly
.
sysCallV
(
SystemCallIndex
.
FRAMEBUFFER
,
FramebufferProperty
.
BACKLIGHT_LEVEL_MAX
);
if
(
max
==
0
)
return
;
// Set the desired level as a percentage of the max
int
val
=
(
max
*
__lvl
)
/
100
;
Assembly
.
sysCall
(
SystemCallIndex
.
FRAMEBUFFER
_PROPERTY
,
Assembly
.
sysCall
(
SystemCallIndex
.
FRAMEBUFFER
,
FramebufferProperty
.
BACKLIGHT_LEVEL_SET
,
(
val
<
0
?
0
:
(
val
>
max
?
max
:
val
)));
}
...
...
runt/apis/midp-lcdui/javax/microedition/lcdui/Display.java
View file @
7675c775
...
...
@@ -1311,11 +1311,14 @@ public class Display
synchronized
(
displays
)
{
// Try to obtain the address of the framebuffer
int
fbaddr
=
Assembly
.
sysCallV
(
SystemCallIndex
.
FRAMEBUFFER_PROPERTY
,
FramebufferProperty
.
ADDRESS
);
int
fbaddr
=
Assembly
.
sysCallV
(
SystemCallIndex
.
FRAMEBUFFER
,
FramebufferProperty
.
ADDRESS
);
int
fbaobj
=
Assembly
.
sysCallV
(
SystemCallIndex
.
FRAMEBUFFER
,
FramebufferProperty
.
BACKING_ARRAY_OBJECT
);
// There is only a single display if a framebuffer is supported
int
numdisplays
=
(
fbaddr
!=
0
?
1
:
0
);
// It could be mapped to an object or otherwise raw memory
int
numdisplays
=
(
fbaddr
!=
0
||
fbaobj
!=
0
?
1
:
0
);
for
(
int
i
=
0
;
i
<
numdisplays
;
i
++)
rv
.
add
(
Display
.
__mapDisplay
(
i
));
}
...
...
runt/klib/supervisor/cc/squirreljme/jvm/FramebufferProperty.java
View file @
7675c775
...
...
@@ -127,9 +127,18 @@ public interface FramebufferProperty
public
static
final
byte
UPLOAD_ARRAY_INT
=
14
;
/**
* The array which backs the framebuffer, if there is one.
*
* @return The backing array object, if there is one.
* @since 2019/12/28
*/
public
static
final
byte
BACKING_ARRAY_OBJECT
=
15
;
/** The number of framebuffer properties. */
public
static
final
byte
NUM_PROPERTIES
=
1
5
;
1
6
;
/** Screen is RGB 32-bit. */
public
static
final
byte
FORMAT_INTEGER_RGB888
=
...
...
runt/klib/supervisor/cc/squirreljme/jvm/SystemCallIndex.java
View file @
7675c775
...
...
@@ -269,7 +269,7 @@ public interface SystemCallIndex
* @param ... Undefined, this depends on the property selected.
* @return Whatever value the frame buffer property will return.
*/
public
static
final
byte
FRAMEBUFFER
_PROPERTY
=
public
static
final
byte
FRAMEBUFFER
=
24
;
/**
...
...
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