diff --git a/src/Gui.c b/src/Gui.c index abdb4e380..cb7a567ba 100644 --- a/src/Gui.c +++ b/src/Gui.c @@ -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 diff --git a/src/Platform_3DS.c b/src/Platform_3DS.c index 9d3df7b80..527e1332b 100644 --- a/src/Platform_3DS.c +++ b/src/Platform_3DS.c @@ -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--------------------------------------------------------* diff --git a/src/Platform_Dreamcast.c b/src/Platform_Dreamcast.c index 095d06bdd..7414a87ad 100644 --- a/src/Platform_Dreamcast.c +++ b/src/Platform_Dreamcast.c @@ -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--------------------------------------------------------* diff --git a/src/Platform_GCWii.c b/src/Platform_GCWii.c index 33519a7e8..37dcdcff8 100644 --- a/src/Platform_GCWii.c +++ b/src/Platform_GCWii.c @@ -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--------------------------------------------------------* diff --git a/src/Platform_N64.c b/src/Platform_N64.c index 1419f94c1..8af0f8e30 100644 --- a/src/Platform_N64.c +++ b/src/Platform_N64.c @@ -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--------------------------------------------------------* diff --git a/src/Platform_NDS.c b/src/Platform_NDS.c index 65074330b..f42279351 100644 --- a/src/Platform_NDS.c +++ b/src/Platform_NDS.c @@ -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--------------------------------------------------------* diff --git a/src/Platform_PS1.c b/src/Platform_PS1.c index 4708a1534..06dede3a0 100644 --- a/src/Platform_PS1.c +++ b/src/Platform_PS1.c @@ -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--------------------------------------------------------* diff --git a/src/Platform_PS2.c b/src/Platform_PS2.c index 5be4c5480..a292ac1ea 100644 --- a/src/Platform_PS2.c +++ b/src/Platform_PS2.c @@ -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--------------------------------------------------------* diff --git a/src/Platform_PS3.c b/src/Platform_PS3.c index b24744bd0..95a420ac3 100644 --- a/src/Platform_PS3.c +++ b/src/Platform_PS3.c @@ -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--------------------------------------------------------* diff --git a/src/Platform_PSP.c b/src/Platform_PSP.c index 014edd575..ba4bddf8e 100644 --- a/src/Platform_PSP.c +++ b/src/Platform_PSP.c @@ -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--------------------------------------------------------* diff --git a/src/Platform_PSVita.c b/src/Platform_PSVita.c index e002e5945..d23ce5b86 100644 --- a/src/Platform_PSVita.c +++ b/src/Platform_PSVita.c @@ -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--------------------------------------------------------* diff --git a/src/Platform_Switch.c b/src/Platform_Switch.c index 381831a86..26f128b91 100644 --- a/src/Platform_Switch.c +++ b/src/Platform_Switch.c @@ -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--------------------------------------------------------* diff --git a/src/Platform_WiiU.c b/src/Platform_WiiU.c index 847186a60..861a26fe4 100644 --- a/src/Platform_WiiU.c +++ b/src/Platform_WiiU.c @@ -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--------------------------------------------------------* diff --git a/src/Platform_Xbox.c b/src/Platform_Xbox.c index 80f3f1422..f1d1b131d 100644 --- a/src/Platform_Xbox.c +++ b/src/Platform_Xbox.c @@ -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--------------------------------------------------------* diff --git a/src/Platform_Xbox360.c b/src/Platform_Xbox360.c index d18920e81..aa8a82834 100644 --- a/src/Platform_Xbox360.c +++ b/src/Platform_Xbox360.c @@ -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--------------------------------------------------------* diff --git a/src/Window_WiiU.c b/src/Window_WiiU.c index a284c3bc1..c446b856d 100644 --- a/src/Window_WiiU.c +++ b/src/Window_WiiU.c @@ -20,10 +20,13 @@ #include #include #include +#include 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++) { diff --git a/src/_PlatformConsole.h b/src/_PlatformConsole.h index 65a4c2dab..bd671dcf5 100644 --- a/src/_PlatformConsole.h +++ b/src/_PlatformConsole.h @@ -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----------------------------------------------------------*