mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-12 00:56:40 -04:00
WiiU: Fix alpha blending, WIP towards dual screen support
This commit is contained in:
parent
d8ee8a5fab
commit
4c0f7a3867
@ -692,9 +692,10 @@ static void OnInit(void) {
|
|||||||
Gradient_Noise(&ctx, BitmapColor_RGB(0x40, 0x30, 0x20), 6, 0, 0, ctx.width, ctx.height);
|
Gradient_Noise(&ctx, BitmapColor_RGB(0x40, 0x30, 0x20), 6, 0, 0, ctx.width, ctx.height);
|
||||||
Context2D_MakeTexture(&touchBgTex, &ctx);
|
Context2D_MakeTexture(&touchBgTex, &ctx);
|
||||||
Context2D_Free(&ctx);
|
Context2D_Free(&ctx);
|
||||||
|
|
||||||
// Tile the texture to fill the entire screen
|
// Tile the texture to fill the entire screen
|
||||||
int tilesX = (320 + ctx.width - 1) / ctx.width;
|
int tilesX = Math_CeilDiv(Window_Alt.Width, ctx.width);
|
||||||
int tilesY = (240 + ctx.height - 1) / ctx.height;
|
int tilesY = Math_CeilDiv(Window_Alt.Height, ctx.height);
|
||||||
touchBgTex.width *= tilesX; touchBgTex.height *= tilesY;
|
touchBgTex.width *= tilesX; touchBgTex.height *= tilesY;
|
||||||
touchBgTex.uv.u2 *= tilesX; touchBgTex.uv.v2 *= tilesY;
|
touchBgTex.uv.u2 *= tilesX; touchBgTex.uv.v2 *= tilesY;
|
||||||
#endif
|
#endif
|
||||||
|
@ -441,6 +441,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_result Process_StartOpen(const cc_string* args) {
|
||||||
|
return ERR_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
||||||
|
@ -520,6 +520,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_result Process_StartOpen(const cc_string* args) {
|
||||||
|
return ERR_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
||||||
|
@ -592,6 +592,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_result Process_StartOpen(const cc_string* args) {
|
||||||
|
return ERR_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
||||||
|
@ -286,6 +286,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_result Process_StartOpen(const cc_string* args) {
|
||||||
|
return ERR_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
||||||
|
@ -435,6 +435,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_result Process_StartOpen(const cc_string* args) {
|
||||||
|
return ERR_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
||||||
|
@ -230,6 +230,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_result Process_StartOpen(const cc_string* args) {
|
||||||
|
return ERR_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
||||||
|
@ -726,6 +726,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_result Process_StartOpen(const cc_string* args) {
|
||||||
|
return ERR_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
||||||
|
@ -475,6 +475,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_result Process_StartOpen(const cc_string* args) {
|
||||||
|
return ERR_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
||||||
|
@ -461,6 +461,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_result Process_StartOpen(const cc_string* args) {
|
||||||
|
return ERR_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
||||||
|
@ -417,6 +417,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_result Process_StartOpen(const cc_string* args) {
|
||||||
|
return ERR_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
||||||
|
@ -528,6 +528,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_result Process_StartOpen(const cc_string* args) {
|
||||||
|
return ERR_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
||||||
|
@ -452,6 +452,10 @@ void Platform_Init(void) {
|
|||||||
mkdir("ClassiCube", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
mkdir("ClassiCube", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_result Process_StartOpen(const cc_string* args) {
|
||||||
|
return ERR_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
||||||
|
@ -417,6 +417,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_result Process_StartOpen(const cc_string* args) {
|
||||||
|
return ERR_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
||||||
|
@ -284,6 +284,10 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_result Process_StartOpen(const cc_string* args) {
|
||||||
|
return ERR_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
*-------------------------------------------------------Encryption--------------------------------------------------------*
|
||||||
|
@ -20,10 +20,13 @@
|
|||||||
#include <gx2/display.h>
|
#include <gx2/display.h>
|
||||||
#include <vpad/input.h>
|
#include <vpad/input.h>
|
||||||
#include <whb/proc.h>
|
#include <whb/proc.h>
|
||||||
|
#include <padscore/kpad.h>
|
||||||
|
|
||||||
static cc_bool launcherMode;
|
static cc_bool launcherMode;
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WindowData WindowInfo;
|
struct _WindowData WindowInfo;
|
||||||
|
struct _WindowData Window_Alt;
|
||||||
|
cc_bool launcherTop;
|
||||||
|
|
||||||
void Window_Init(void) {
|
void Window_Init(void) {
|
||||||
switch(GX2GetSystemTVScanMode())
|
switch(GX2GetSystemTVScanMode())
|
||||||
@ -59,7 +62,11 @@ void Window_Init(void) {
|
|||||||
|
|
||||||
Window_Main.SoftKeyboard = SOFT_KEYBOARD_RESIZE;
|
Window_Main.SoftKeyboard = SOFT_KEYBOARD_RESIZE;
|
||||||
Input_SetTouchMode(true);
|
Input_SetTouchMode(true);
|
||||||
|
|
||||||
|
Window_Alt.Width = 854;
|
||||||
|
Window_Alt.Height = 480;
|
||||||
|
|
||||||
|
KPADInit();
|
||||||
VPADInit();
|
VPADInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,6 +89,19 @@ void Window_RequestClose(void) {
|
|||||||
Event_RaiseVoid(&WindowEvents.Closing);
|
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
|
#define AXIS_SCALE 4.0f
|
||||||
static void ProcessVpadStick(int axis, float x, float y, double delta) {
|
static void ProcessVpadStick(int axis, float x, float y, double delta) {
|
||||||
// May not be exactly 0 on actual hardware
|
// 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);
|
Gamepad_SetAxis(axis, x * AXIS_SCALE, -y * AXIS_SCALE, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void ProcessVpadButtons(int mods) {
|
static void ProcessVpadButtons(int mods) {
|
||||||
Gamepad_SetButton(CCPAD_L, mods & VPAD_BUTTON_L);
|
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);
|
Gamepad_SetButton(CCPAD_DOWN, mods & VPAD_BUTTON_DOWN);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessVpadTouch(VPADTouchData* data) {
|
static void ProcessVpadTouch(VPADTouchData* data) {
|
||||||
static int was_touched;
|
static int was_touched;
|
||||||
|
|
||||||
// TODO rescale to main screen size
|
// TODO rescale to main screen size
|
||||||
if (data->touched) {
|
if (data->touched) {
|
||||||
int x = data->x, y = data->y;
|
int x = data->x, y = data->y;
|
||||||
@ -125,15 +146,7 @@ static void ProcessVpadTouch(VPADTouchData* data) {
|
|||||||
was_touched = data->touched;
|
was_touched = data->touched;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_ProcessEvents(double delta) {
|
static void ProcessVPAD(double delta) {
|
||||||
Input.JoystickMovement = false;
|
|
||||||
|
|
||||||
if (!WHBProcIsRunning()) {
|
|
||||||
Window_Main.Exists = false;
|
|
||||||
Window_RequestClose();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
VPADStatus vpadStatus;
|
VPADStatus vpadStatus;
|
||||||
VPADReadError error = VPAD_READ_SUCCESS;
|
VPADReadError error = VPAD_READ_SUCCESS;
|
||||||
VPADRead(VPAD_CHAN_0, &vpadStatus, 1, &error);
|
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_LEFT, vpadStatus.leftStick.x, vpadStatus.leftStick.y, delta);
|
||||||
ProcessVpadStick(PAD_AXIS_RIGHT, vpadStatus.rightStick.x, vpadStatus.rightStick.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) { }
|
void Window_UpdateRawMouse(void) { }
|
||||||
@ -164,7 +190,7 @@ void Window_AllocFramebuffer(struct Bitmap* bmp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Window_DrawFramebuffer(Rect2D r, 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++)
|
/*for (int y = r.y; y < r.y + r.height; y++)
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ cc_result Process_StartGame2(const cc_string* args, int numArgs) {
|
|||||||
String_CopyToRawArray(gameArgs[i], &args[i]);
|
String_CopyToRawArray(gameArgs[i], &args[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform_LogConst("START GAME");
|
Platform_LogConst("START CLASSICUBE");
|
||||||
gameHasArgs = true;
|
gameHasArgs = true;
|
||||||
gameNumArgs = numArgs;
|
gameNumArgs = numArgs;
|
||||||
return 0;
|
return 0;
|
||||||
@ -95,10 +95,6 @@ cc_result Platform_SetDefaultCurrentDirectory(int argc, char **argv) {
|
|||||||
|
|
||||||
void Process_Exit(cc_result code) { exit(code); }
|
void Process_Exit(cc_result code) { exit(code); }
|
||||||
|
|
||||||
cc_result Process_StartOpen(const cc_string* args) {
|
|
||||||
return ERR_NOT_SUPPORTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*--------------------------------------------------------Updater----------------------------------------------------------*
|
*--------------------------------------------------------Updater----------------------------------------------------------*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user