mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 19:15:14 -04:00
Wii/GC: Clear framebuffer initially to grey
This commit is contained in:
parent
b0370d117c
commit
48bf31f86f
@ -9,8 +9,11 @@
|
|||||||
|
|
||||||
static void* fifo_buffer;
|
static void* fifo_buffer;
|
||||||
#define FIFO_SIZE (256 * 1024)
|
#define FIFO_SIZE (256 * 1024)
|
||||||
|
|
||||||
|
extern GXRModeObj* cur_mode;
|
||||||
extern void* Window_XFB;
|
extern void* Window_XFB;
|
||||||
static void* xfbs[2];
|
static void* xfbs[2];
|
||||||
|
|
||||||
static int curFB;
|
static int curFB;
|
||||||
static GfxResourceID white_square;
|
static GfxResourceID white_square;
|
||||||
static GXTexRegionCallback regionCB;
|
static GXTexRegionCallback regionCB;
|
||||||
@ -22,7 +25,7 @@ static GXTexRegionCallback regionCB;
|
|||||||
*---------------------------------------------------------General---------------------------------------------------------*
|
*---------------------------------------------------------General---------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
static void InitGX(void) {
|
static void InitGX(void) {
|
||||||
GXRModeObj* mode = VIDEO_GetPreferredMode(NULL);
|
GXRModeObj* mode = cur_mode;
|
||||||
fifo_buffer = MEM_K0_TO_K1(memalign(32, FIFO_SIZE));
|
fifo_buffer = MEM_K0_TO_K1(memalign(32, FIFO_SIZE));
|
||||||
memset(fifo_buffer, 0, FIFO_SIZE);
|
memset(fifo_buffer, 0, FIFO_SIZE);
|
||||||
|
|
||||||
@ -242,7 +245,8 @@ static BitmapCol* GCWii_GetRow(struct Bitmap* bmp, int y, void* ctx) {
|
|||||||
int blockXStride = (4 * 4) * 4; // 16 pixels per tile
|
int blockXStride = (4 * 4) * 4; // 16 pixels per tile
|
||||||
|
|
||||||
// Do the inverse of converting from 4x4 tiled to linear
|
// Do the inverse of converting from 4x4 tiled to linear
|
||||||
for (u32 x = 0; x < bmp->width; x++){
|
for (u32 x = 0; x < bmp->width; x++)
|
||||||
|
{
|
||||||
int tileY = y >> 2, tileX = x >> 2;
|
int tileY = y >> 2, tileX = x >> 2;
|
||||||
int locY = y & 0x3, locX = x & 0x3;
|
int locY = y & 0x3, locX = x & 0x3;
|
||||||
int idx = (tileY * blockYStride) + (tileX * blockXStride) + ((locY << 2) + locX) * 2;
|
int idx = (tileY * blockYStride) + (tileX * blockXStride) + ((locY << 2) + locX) * 2;
|
||||||
@ -260,9 +264,8 @@ static BitmapCol* GCWii_GetRow(struct Bitmap* bmp, int y, void* ctx) {
|
|||||||
|
|
||||||
cc_result Gfx_TakeScreenshot(struct Stream* output) {
|
cc_result Gfx_TakeScreenshot(struct Stream* output) {
|
||||||
BitmapCol tmp[1024];
|
BitmapCol tmp[1024];
|
||||||
GXRModeObj* vmode = VIDEO_GetPreferredMode(NULL);
|
int width = cur_mode->fbWidth;
|
||||||
int width = vmode->fbWidth;
|
int height = cur_mode->efbHeight;
|
||||||
int height = vmode->efbHeight;
|
|
||||||
|
|
||||||
u8* buffer = memalign(32, width * height * 4);
|
u8* buffer = memalign(32, width * height * 4);
|
||||||
if (!buffer) return ERR_OUT_OF_MEMORY;
|
if (!buffer) return ERR_OUT_OF_MEMORY;
|
||||||
|
@ -23,7 +23,8 @@ static cc_bool launcherMode;
|
|||||||
static int mouseSupported;
|
static int mouseSupported;
|
||||||
#include "../VirtualCursor.h"
|
#include "../VirtualCursor.h"
|
||||||
static void* xfb;
|
static void* xfb;
|
||||||
static GXRModeObj* rmode;
|
|
||||||
|
GXRModeObj* cur_mode;
|
||||||
void* Window_XFB;
|
void* Window_XFB;
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct cc_window WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
@ -34,28 +35,24 @@ static void OnPowerOff(void) {
|
|||||||
Window_RequestClose();
|
Window_RequestClose();
|
||||||
}
|
}
|
||||||
static void InitVideo(void) {
|
static void InitVideo(void) {
|
||||||
// Initialise the video system
|
|
||||||
VIDEO_Init();
|
VIDEO_Init();
|
||||||
|
|
||||||
// Obtain the preferred video mode from the system
|
// Obtain the preferred video mode from the system
|
||||||
// This will correspond to the settings in the Wii menu
|
// This will correspond to the settings in the Wii menu
|
||||||
rmode = VIDEO_GetPreferredMode(NULL);
|
cur_mode = VIDEO_GetPreferredMode(NULL);
|
||||||
// Allocate memory for the display in the uncached region
|
|
||||||
xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
|
|
||||||
|
|
||||||
Window_XFB = xfb;
|
|
||||||
//console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
|
|
||||||
|
|
||||||
// Set up the video registers with the chosen mode
|
// Allocate memory for the display in the uncached region
|
||||||
VIDEO_Configure(rmode);
|
xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(cur_mode));
|
||||||
// Tell the video hardware where our display memory is
|
Window_XFB = xfb;
|
||||||
|
|
||||||
|
VIDEO_Configure(cur_mode);
|
||||||
VIDEO_SetNextFramebuffer(xfb);
|
VIDEO_SetNextFramebuffer(xfb);
|
||||||
|
|
||||||
// Make the display visible
|
|
||||||
VIDEO_SetBlack(FALSE);
|
VIDEO_SetBlack(FALSE);
|
||||||
// Flush the video register changes to the hardware
|
|
||||||
VIDEO_Flush();
|
VIDEO_Flush();
|
||||||
// Wait for Video setup to complete
|
VIDEO_WaitVSync();
|
||||||
|
|
||||||
|
VIDEO_ClearFrameBuffer(cur_mode, xfb, COLOR_GRAY);
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,13 +65,13 @@ void Window_PreInit(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Window_Init(void) {
|
void Window_Init(void) {
|
||||||
DisplayInfo.Width = rmode->fbWidth;
|
DisplayInfo.Width = cur_mode->fbWidth;
|
||||||
DisplayInfo.Height = rmode->xfbHeight;
|
DisplayInfo.Height = cur_mode->xfbHeight;
|
||||||
DisplayInfo.ScaleX = 1;
|
DisplayInfo.ScaleX = 1;
|
||||||
DisplayInfo.ScaleY = 1;
|
DisplayInfo.ScaleY = 1;
|
||||||
|
|
||||||
Window_Main.Width = rmode->fbWidth;
|
Window_Main.Width = cur_mode->fbWidth;
|
||||||
Window_Main.Height = rmode->xfbHeight;
|
Window_Main.Height = cur_mode->xfbHeight;
|
||||||
Window_Main.Focused = true;
|
Window_Main.Focused = true;
|
||||||
|
|
||||||
Window_Main.Exists = true;
|
Window_Main.Exists = true;
|
||||||
@ -544,8 +541,8 @@ void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
|
|||||||
// TODO XFB is raw yuv, but is absolutely a pain to work with..
|
// TODO XFB is raw yuv, but is absolutely a pain to work with..
|
||||||
for (int y = r.y; y < r.y + r.height; y++)
|
for (int y = r.y; y < r.y + r.height; y++)
|
||||||
{
|
{
|
||||||
cc_uint32* src = Bitmap_GetRow(bmp, y) + r.x;
|
cc_uint32* src = Bitmap_GetRow(bmp, y) + r.x;
|
||||||
u16* dst = (u16*)xfb + y * rmode->fbWidth + r.x;
|
u16* dst = (u16*)xfb + y * cur_mode->fbWidth + r.x;
|
||||||
|
|
||||||
for (int x = 0; x < r.width / 2; x++) {
|
for (int x = 0; x < r.width / 2; x++) {
|
||||||
cc_uint32 rgb0 = src[(x<<1) + 0];
|
cc_uint32 rgb0 = src[(x<<1) + 0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user