Fix menu renderer to use the 854x480 framebuffer space
RCO menu objects are authored in the PSP movie player's 854x480 FWVGA framebuffer, not the 480x272 LCD. The renderer was laying everything out in the wrong coordinate space, which is why no menu items were visible.
This commit is contained in:
@@ -475,7 +475,7 @@ public final class Main {
|
||||
};
|
||||
|
||||
String resourceName = rcoPath.substring(rcoPath.lastIndexOf('/') + 1).replace(".RCO", "");
|
||||
VsmxNativeObject globals = GlobalVariables.create(interpreter, 854, 480);
|
||||
VsmxNativeObject globals = GlobalVariables.create(interpreter, 480, 272);
|
||||
VsmxNativeObject controller = Controller.create(interpreter, menuHost, resourceName);
|
||||
VsmxNativeObject movieplayer = MoviePlayer.create(interpreter, menuHost, controller);
|
||||
VsmxNativeObject resource = Resource.create(interpreter, null, controller, rco);
|
||||
|
||||
@@ -96,12 +96,12 @@ public final class RcoRenderer implements Display {
|
||||
double h = canvas.getHeight();
|
||||
g.clearRect(0, 0, w, h);
|
||||
|
||||
// RCO content is authored for the PSP 480x272 screen; scale it to
|
||||
// fill the window while keeping that aspect ratio.
|
||||
// RCO content is authored for the PSP movie player framebuffer, which
|
||||
// is 854x480 (FWVGA) and 16:9. Scale that to fill the canvas.
|
||||
if (w > 0 && h > 0) {
|
||||
double scale = Math.min(w / 480.0, h / 272.0);
|
||||
double drawW = 480.0 * scale;
|
||||
double drawH = 272.0 * scale;
|
||||
double scale = Math.min(w / 854.0, h / 480.0);
|
||||
double drawW = 854.0 * scale;
|
||||
double drawH = 480.0 * scale;
|
||||
g.translate((w - drawW) / 2.0, (h - drawH) / 2.0);
|
||||
g.scale(scale, scale);
|
||||
}
|
||||
@@ -130,12 +130,12 @@ public final class RcoRenderer implements Display {
|
||||
double w = drawWidth > 0 ? drawWidth : image.getWidth();
|
||||
double h = drawHeight > 0 ? drawHeight : image.getHeight();
|
||||
|
||||
// RCO positions are screen-center coordinates with +Y up (OpenGL-like).
|
||||
// Convert to top-left within the 480x272 design space.
|
||||
// RCO positions are screen-center coordinates with +Y up (OpenGL-like),
|
||||
// within the 854x480 framebuffer. Convert to top-left in that space.
|
||||
double cx = display.getX();
|
||||
double cy = display.getY();
|
||||
double x = 240.0 + (cx - w / 2.0);
|
||||
double y = 136.0 - (cy + h / 2.0);
|
||||
double x = 427.0 + (cx - w / 2.0);
|
||||
double y = 240.0 - (cy + h / 2.0);
|
||||
g.drawImage(image, x, y, w, h);
|
||||
g.setGlobalAlpha(1.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user