WiiU: Fix alpha blending, WIP towards dual screen support

This commit is contained in:
UnknownShadow200 2024-04-10 18:54:57 +10:00
parent d8ee8a5fab
commit 4c0f7a3867
17 changed files with 97 additions and 18 deletions

View File

@ -692,9 +692,10 @@ static void OnInit(void) {
Gradient_Noise(&ctx, BitmapColor_RGB(0x40, 0x30, 0x20), 6, 0, 0, ctx.width, ctx.height);
Context2D_MakeTexture(&touchBgTex, &ctx);
Context2D_Free(&ctx);
// Tile the texture to fill the entire screen
int tilesX = (320 + ctx.width - 1) / ctx.width;
int tilesY = (240 + ctx.height - 1) / ctx.height;
int tilesX = Math_CeilDiv(Window_Alt.Width, ctx.width);
int tilesY = Math_CeilDiv(Window_Alt.Height, ctx.height);
touchBgTex.width *= tilesX; touchBgTex.height *= tilesY;
touchBgTex.uv.u2 *= tilesX; touchBgTex.uv.v2 *= tilesY;
#endif

View File

@ -441,6 +441,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
return true;
}
cc_result Process_StartOpen(const cc_string* args) {
return ERR_NOT_SUPPORTED;
}
/*########################################################################################################################*
*-------------------------------------------------------Encryption--------------------------------------------------------*

View File

@ -520,6 +520,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
return true;
}
cc_result Process_StartOpen(const cc_string* args) {
return ERR_NOT_SUPPORTED;
}
/*########################################################################################################################*
*-------------------------------------------------------Encryption--------------------------------------------------------*

View File

@ -592,6 +592,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
return true;
}
cc_result Process_StartOpen(const cc_string* args) {
return ERR_NOT_SUPPORTED;
}
/*########################################################################################################################*
*-------------------------------------------------------Encryption--------------------------------------------------------*

View File

@ -286,6 +286,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
return true;
}
cc_result Process_StartOpen(const cc_string* args) {
return ERR_NOT_SUPPORTED;
}
/*########################################################################################################################*
*-------------------------------------------------------Encryption--------------------------------------------------------*

View File

@ -435,6 +435,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
return true;
}
cc_result Process_StartOpen(const cc_string* args) {
return ERR_NOT_SUPPORTED;
}
/*########################################################################################################################*
*-------------------------------------------------------Encryption--------------------------------------------------------*

View File

@ -230,6 +230,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
return false;
}
cc_result Process_StartOpen(const cc_string* args) {
return ERR_NOT_SUPPORTED;
}
/*########################################################################################################################*
*-------------------------------------------------------Encryption--------------------------------------------------------*

View File

@ -726,6 +726,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
return true;
}
cc_result Process_StartOpen(const cc_string* args) {
return ERR_NOT_SUPPORTED;
}
/*########################################################################################################################*
*-------------------------------------------------------Encryption--------------------------------------------------------*

View File

@ -475,6 +475,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
return true;
}
cc_result Process_StartOpen(const cc_string* args) {
return ERR_NOT_SUPPORTED;
}
/*########################################################################################################################*
*-------------------------------------------------------Encryption--------------------------------------------------------*

View File

@ -461,6 +461,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
return true;
}
cc_result Process_StartOpen(const cc_string* args) {
return ERR_NOT_SUPPORTED;
}
/*########################################################################################################################*
*-------------------------------------------------------Encryption--------------------------------------------------------*

View File

@ -417,6 +417,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
return true;
}
cc_result Process_StartOpen(const cc_string* args) {
return ERR_NOT_SUPPORTED;
}
/*########################################################################################################################*
*-------------------------------------------------------Encryption--------------------------------------------------------*

View File

@ -528,6 +528,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
return true;
}
cc_result Process_StartOpen(const cc_string* args) {
return ERR_NOT_SUPPORTED;
}
/*########################################################################################################################*
*-------------------------------------------------------Encryption--------------------------------------------------------*

View File

@ -452,6 +452,10 @@ void Platform_Init(void) {
mkdir("ClassiCube", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
}
cc_result Process_StartOpen(const cc_string* args) {
return ERR_NOT_SUPPORTED;
}
/*########################################################################################################################*
*-------------------------------------------------------Encryption--------------------------------------------------------*

View File

@ -417,6 +417,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
return false;
}
cc_result Process_StartOpen(const cc_string* args) {
return ERR_NOT_SUPPORTED;
}
/*########################################################################################################################*
*-------------------------------------------------------Encryption--------------------------------------------------------*

View File

@ -284,6 +284,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
return false;
}
cc_result Process_StartOpen(const cc_string* args) {
return ERR_NOT_SUPPORTED;
}
/*########################################################################################################################*
*-------------------------------------------------------Encryption--------------------------------------------------------*

View File

@ -20,10 +20,13 @@
#include <gx2/display.h>
#include <vpad/input.h>
#include <whb/proc.h>
#include <padscore/kpad.h>
static cc_bool launcherMode;
struct _DisplayData DisplayInfo;
struct _WindowData WindowInfo;
struct _WindowData Window_Alt;
cc_bool launcherTop;
void Window_Init(void) {
switch(GX2GetSystemTVScanMode())
@ -59,7 +62,11 @@ void Window_Init(void) {
Window_Main.SoftKeyboard = SOFT_KEYBOARD_RESIZE;
Input_SetTouchMode(true);
Window_Alt.Width = 854;
Window_Alt.Height = 480;
KPADInit();
VPADInit();
}
@ -82,6 +89,19 @@ void Window_RequestClose(void) {
Event_RaiseVoid(&WindowEvents.Closing);
}
static void ProcessKPAD(double delta) {
KPADStatus kpad = { 0 };
int res = KPADRead(0, &kpad, 1);
if (res != KPAD_ERROR_OK) return;
switch (kpad.extensionType)
{
}
}
#define AXIS_SCALE 4.0f
static void ProcessVpadStick(int axis, float x, float y, double delta) {
// May not be exactly 0 on actual hardware
@ -90,7 +110,6 @@ static void ProcessVpadStick(int axis, float x, float y, double delta) {
Gamepad_SetAxis(axis, x * AXIS_SCALE, -y * AXIS_SCALE, delta);
}
static void ProcessVpadButtons(int mods) {
Gamepad_SetButton(CCPAD_L, mods & VPAD_BUTTON_L);
@ -112,8 +131,10 @@ static void ProcessVpadButtons(int mods) {
Gamepad_SetButton(CCPAD_DOWN, mods & VPAD_BUTTON_DOWN);
}
static void ProcessVpadTouch(VPADTouchData* data) {
static int was_touched;
// TODO rescale to main screen size
if (data->touched) {
int x = data->x, y = data->y;
@ -125,15 +146,7 @@ static void ProcessVpadTouch(VPADTouchData* data) {
was_touched = data->touched;
}
void Window_ProcessEvents(double delta) {
Input.JoystickMovement = false;
if (!WHBProcIsRunning()) {
Window_Main.Exists = false;
Window_RequestClose();
return;
}
static void ProcessVPAD(double delta) {
VPADStatus vpadStatus;
VPADReadError error = VPAD_READ_SUCCESS;
VPADRead(VPAD_CHAN_0, &vpadStatus, 1, &error);
@ -145,7 +158,20 @@ void Window_ProcessEvents(double delta) {
ProcessVpadStick(PAD_AXIS_LEFT, vpadStatus.leftStick.x, vpadStatus.leftStick.y, delta);
ProcessVpadStick(PAD_AXIS_RIGHT, vpadStatus.rightStick.x, vpadStatus.rightStick.y, delta);
}
void Window_ProcessEvents(double delta) {
Input.JoystickMovement = false;
if (!WHBProcIsRunning()) {
Window_Main.Exists = false;
Window_RequestClose();
return;
}
ProcessVPAD(delta);
ProcessKPAD(delta);
}
void Window_UpdateRawMouse(void) { }
@ -164,7 +190,7 @@ void Window_AllocFramebuffer(struct Bitmap* bmp) {
}
void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
//
if (launcherTop) return; // TODO: Draw on DRC properly
/*for (int y = r.y; y < r.y + r.height; y++)
{

View File

@ -47,7 +47,7 @@ cc_result Process_StartGame2(const cc_string* args, int numArgs) {
String_CopyToRawArray(gameArgs[i], &args[i]);
}
Platform_LogConst("START GAME");
Platform_LogConst("START CLASSICUBE");
gameHasArgs = true;
gameNumArgs = numArgs;
return 0;
@ -95,10 +95,6 @@ cc_result Platform_SetDefaultCurrentDirectory(int argc, char **argv) {
void Process_Exit(cc_result code) { exit(code); }
cc_result Process_StartOpen(const cc_string* args) {
return ERR_NOT_SUPPORTED;
}
/*########################################################################################################################*
*--------------------------------------------------------Updater----------------------------------------------------------*