Better track 2D/3D window type

This commit is contained in:
UnknownShadow200 2025-11-08 11:45:45 +11:00
parent 14811af6ec
commit dca75bb289
22 changed files with 84 additions and 98 deletions

View File

@ -21,8 +21,6 @@
#define SCREEN_WIDTH 320 #define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 200 #define SCREEN_HEIGHT 200
static cc_bool launcherMode;
struct _DisplayData DisplayInfo; struct _DisplayData DisplayInfo;
struct cc_window WindowInfo; struct cc_window WindowInfo;
@ -52,12 +50,12 @@ void Window_Free(void) { }
void Window_Create2D(int width, int height) { void Window_Create2D(int width, int height) {
Hw32xScreenClear(); Hw32xScreenClear();
launcherMode = true; Window_Main.Is3D = false;
} }
void Window_Create3D(int width, int height) { void Window_Create3D(int width, int height) {
Hw32xScreenClear(); Hw32xScreenClear();
launcherMode = false; Window_Main.Is3D = true;
} }
void Window_Destroy(void) { } void Window_Destroy(void) { }

View File

@ -12,7 +12,6 @@
#include <3ds.h> #include <3ds.h>
static cc_bool launcherMode;
static u16 top_width, top_height; static u16 top_width, top_height;
static u16 btm_width, btm_height; static u16 btm_width, btm_height;
#include "../VirtualKeyboard.h" #include "../VirtualKeyboard.h"
@ -58,18 +57,22 @@ void Window_Init(void) {
void Window_Free(void) { irrstExit(); } void Window_Free(void) { irrstExit(); }
void Window_Create2D(int width, int height) { void Window_Create2D(int width, int height) {
Window_Main.Is3D = false;
Window_Alt.Is3D = false;
DisplayInfo.Width = btm_width; DisplayInfo.Width = btm_width;
Window_Main.Width = btm_width; Window_Main.Width = btm_width;
Window_Alt.Width = top_width; Window_Alt.Width = top_width;
launcherMode = true;
} }
void Window_Create3D(int width, int height) { void Window_Create3D(int width, int height) {
Window_Main.Is3D = true;
Window_Alt.Is3D = true;
DisplayInfo.Width = top_width; DisplayInfo.Width = top_width;
Window_Main.Width = top_width; Window_Main.Width = top_width;
Window_Alt.Width = btm_width; Window_Alt.Width = btm_width;
launcherMode = false;
} }
void Window_Destroy(void) { } void Window_Destroy(void) { }
@ -260,7 +263,7 @@ void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
kb_tileWidth = 20; kb_tileWidth = 20;
kb_tileHeight = 20; kb_tileHeight = 20;
VirtualKeyboard_Open(args, launcherMode); VirtualKeyboard_Open(args);
} }
void OnscreenKeyboard_SetText(const cc_string* text) { void OnscreenKeyboard_SetText(const cc_string* text) {

View File

@ -73,6 +73,6 @@ static void VirtualCursor_SetPosition(int x, int y) {
Game.Draw2DHooks[3] = VirtualCursor_Display3D; Game.Draw2DHooks[3] = VirtualCursor_Display3D;
/* TODO better dirty region tracking */ /* TODO better dirty region tracking */
if (launcherMode) LBackend_Redraw(); if (!Window_Main.Is3D) LBackend_Redraw();
} }

View File

@ -185,7 +185,7 @@ static void VirtualKeyboard_CalcPosition(int* x, int* y, int width, int height)
static int VirtualKeyboard_WindowWidth(void) { static int VirtualKeyboard_WindowWidth(void) {
#ifdef CC_BUILD_DUALSCREEN #ifdef CC_BUILD_DUALSCREEN
return launcherMode ? Window_Main.Width : Window_Alt.Width; return Window_Main.Is3D ? Window_Alt.Width : Window_Main.Width;
#else #else
return Window_Main.Width; return Window_Main.Width;
#endif #endif
@ -193,7 +193,7 @@ static int VirtualKeyboard_WindowWidth(void) {
static int VirtualKeyboard_WindowHeight(void) { static int VirtualKeyboard_WindowHeight(void) {
#ifdef CC_BUILD_DUALSCREEN #ifdef CC_BUILD_DUALSCREEN
return launcherMode ? Window_Main.Height : Window_Alt.Height; return Window_Main.Is3D ? Window_Alt.Height : Window_Main.Height;
#else #else
return Window_Main.Height; return Window_Main.Height;
#endif #endif
@ -439,7 +439,7 @@ static void VirtualKeyboard_Hook(void) {
PointerHooks.UpHook = VirtualKeyboard_PointerUp; PointerHooks.UpHook = VirtualKeyboard_PointerUp;
} }
static void VirtualKeyboard_Open(struct OpenKeyboardArgs* args, cc_bool launcher) { static void VirtualKeyboard_Open(struct OpenKeyboardArgs* args) {
VirtualKeyboard_Close(); VirtualKeyboard_Close();
VirtualKeyboard_Init(); VirtualKeyboard_Init();
DisplayInfo.ShowingSoftKeyboard = true; DisplayInfo.ShowingSoftKeyboard = true;
@ -457,10 +457,10 @@ static void VirtualKeyboard_Open(struct OpenKeyboardArgs* args, cc_bool launcher
kb_str.length = 0; kb_str.length = 0;
String_AppendString(&kb_str, args->text); String_AppendString(&kb_str, args->text);
if (launcher) { if (Window_Main.Is3D) {
KB_MarkDirty = VirtualKeyboard_MarkDirty2D;
} else {
KB_MarkDirty = VirtualKeyboard_MarkDirty3D; KB_MarkDirty = VirtualKeyboard_MarkDirty3D;
} else {
KB_MarkDirty = VirtualKeyboard_MarkDirty2D;
} }
Window_Main.SoftKeyboardFocus = true; Window_Main.SoftKeyboardFocus = true;

View File

@ -15,7 +15,6 @@
#include "Options.h" #include "Options.h"
#include <libdragon.h> #include <libdragon.h>
static cc_bool launcherMode;
#include "VirtualCursor.h" #include "VirtualCursor.h"
struct _DisplayData DisplayInfo; struct _DisplayData DisplayInfo;
@ -48,8 +47,8 @@ void Window_Init(void) {
void Window_Free(void) { } void Window_Free(void) { }
void Window_Create2D(int width, int height) { launcherMode = true; } void Window_Create2D(int width, int height) { Window_Main.Is3D = false; }
void Window_Create3D(int width, int height) { launcherMode = false; } void Window_Create3D(int width, int height) { Window_Main.Is3D = true; }
void Window_Destroy(void) { } void Window_Destroy(void) { }
@ -212,7 +211,7 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
kb_tileWidth = KB_TILE_SIZE / 2; kb_tileWidth = KB_TILE_SIZE / 2;
kb_tileHeight = KB_TILE_SIZE / 2; kb_tileHeight = KB_TILE_SIZE / 2;
VirtualKeyboard_Open(args, launcherMode); VirtualKeyboard_Open(args);
} }
void OnscreenKeyboard_SetText(const cc_string* text) { void OnscreenKeyboard_SetText(const cc_string* text) {

View File

@ -49,7 +49,6 @@ void LogUnhandledNSErrors(NSException* ex);
@interface CCViewController : UIViewController<UIDocumentPickerDelegate, UIAlertViewDelegate> @interface CCViewController : UIViewController<UIDocumentPickerDelegate, UIAlertViewDelegate>
@end @end
static UIWindow* win_handle; static UIWindow* win_handle;
static cc_bool launcherMode;
static void AddTouch(UITouch* t) { static void AddTouch(UITouch* t) {
CGPoint loc = [t locationInView:view_handle]; CGPoint loc = [t locationInView:view_handle];
@ -100,8 +99,8 @@ static CGRect GetViewFrame(void) {
// touchesBegan:withEvent - iOS 2.0 // touchesBegan:withEvent - iOS 2.0
for (UITouch* t in touches) AddTouch(t); for (UITouch* t in touches) AddTouch(t);
// clicking on the background should dismiss onscren keyboard // clicking on the background should dismiss onscreen keyboard
if (launcherMode) { [view_handle endEditing:NO]; } if (!Window_Main.Is3D) { [view_handle endEditing:NO]; }
} }
- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent *)event { - (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent *)event {
@ -532,7 +531,7 @@ cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
static void Init3DLayer(void); static void Init3DLayer(void);
void Window_Create2D(int width, int height) { void Window_Create2D(int width, int height) {
launcherMode = true; Window_Main.Is3D = false;
CGRect bounds = DoCreateWindow(); CGRect bounds = DoCreateWindow();
view_handle = [[UIView alloc] initWithFrame:bounds]; view_handle = [[UIView alloc] initWithFrame:bounds];
@ -541,7 +540,7 @@ void Window_Create2D(int width, int height) {
} }
void Window_Create3D(int width, int height) { void Window_Create3D(int width, int height) {
launcherMode = false; Window_Main.Is3D = true;
CGRect bounds = DoCreateWindow(); CGRect bounds = DoCreateWindow();
view_handle = [[CC3DView alloc] initWithFrame:bounds]; view_handle = [[CC3DView alloc] initWithFrame:bounds];

View File

@ -12,7 +12,6 @@
#include "../VirtualKeyboard.h" #include "../VirtualKeyboard.h"
#include <kos.h> #include <kos.h>
static cc_bool launcherMode;
#include "../VirtualCursor.h" #include "../VirtualCursor.h"
cc_bool window_inited; cc_bool window_inited;
@ -48,10 +47,11 @@ void Window_Init(void) {
void Window_Free(void) { } void Window_Free(void) { }
void Window_Create2D(int width, int height) { void Window_Create2D(int width, int height) {
launcherMode = true; Window_Main.Is3D = false;
} }
void Window_Create3D(int width, int height) { void Window_Create3D(int width, int height) {
launcherMode = false; Window_Main.Is3D = true;
} }
void Window_Destroy(void) { } void Window_Destroy(void) { }
@ -356,7 +356,7 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
*#########################################################################################################################*/ *#########################################################################################################################*/
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
if (Input.Sources & INPUT_SOURCE_NORMAL) return; if (Input.Sources & INPUT_SOURCE_NORMAL) return;
VirtualKeyboard_Open(args, launcherMode); VirtualKeyboard_Open(args);
} }
void OnscreenKeyboard_SetText(const cc_string* text) { void OnscreenKeyboard_SetText(const cc_string* text) {

View File

@ -20,7 +20,6 @@
#endif #endif
static cc_bool needsFBUpdate; static cc_bool needsFBUpdate;
static cc_bool launcherMode;
static int mouseSupported; static int mouseSupported;
#include "../VirtualCursor.h" #include "../VirtualCursor.h"
static void* xfb; static void* xfb;
@ -93,11 +92,11 @@ void Window_Free(void) { }
void Window_Create2D(int width, int height) { void Window_Create2D(int width, int height) {
needsFBUpdate = true; needsFBUpdate = true;
launcherMode = true; Window_Main.Is3D = false;
} }
void Window_Create3D(int width, int height) { void Window_Create3D(int width, int height) {
launcherMode = false; Window_Main.Is3D = true;
} }
void Window_Destroy(void) { } void Window_Destroy(void) { }
@ -582,7 +581,7 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
*#########################################################################################################################*/ *#########################################################################################################################*/
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
if (Input.Sources & INPUT_SOURCE_NORMAL) return; if (Input.Sources & INPUT_SOURCE_NORMAL) return;
VirtualKeyboard_Open(args, launcherMode); VirtualKeyboard_Open(args);
} }
void OnscreenKeyboard_SetText(const cc_string* text) { void OnscreenKeyboard_SetText(const cc_string* text) {

View File

@ -127,16 +127,15 @@ static void Console_Init(cc_bool onSub) {
/*########################################################################################################################* /*########################################################################################################################*
*------------------------------------------------------General data-------------------------------------------------------* *------------------------------------------------------General data-------------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
static cc_bool launcherMode;
static int bg_id; static int bg_id;
static u16* bg_ptr; static u16* bg_ptr;
struct _DisplayData DisplayInfo; struct _DisplayData DisplayInfo;
struct cc_window WindowInfo; struct cc_window WindowInfo;
static void SetupVideo(cc_bool mode) { static void SetupVideo(cc_bool is3D) {
if (launcherMode == mode) return; if (Window_Main.Is3D == is3D) return;
launcherMode = mode; Window_Main.Is3D = is3D;
vramSetBankA(VRAM_A_LCD); vramSetBankA(VRAM_A_LCD);
vramSetBankB(VRAM_B_LCD); vramSetBankB(VRAM_B_LCD);
@ -145,7 +144,7 @@ static void SetupVideo(cc_bool mode) {
vramSetBankH(VRAM_H_LCD); vramSetBankH(VRAM_H_LCD);
vramSetBankI(VRAM_I_LCD); vramSetBankI(VRAM_I_LCD);
if (launcherMode) { if (!is3D) {
videoSetModeSub(MODE_5_2D); videoSetModeSub(MODE_5_2D);
vramSetBankC(VRAM_C_SUB_BG); vramSetBankC(VRAM_C_SUB_BG);
@ -159,11 +158,11 @@ static void SetupVideo(cc_bool mode) {
videoSetMode(MODE_0_3D); videoSetMode(MODE_0_3D);
} }
Console_Init(!launcherMode); Console_Init(is3D);
} }
void Window_PreInit(void) { void Window_PreInit(void) {
SetupVideo(true); SetupVideo(false);
setBrightness(2, 0); setBrightness(2, 0);
} }
@ -188,13 +187,13 @@ void Window_Init(void) {
void Window_Free(void) { } void Window_Free(void) { }
void Window_Create2D(int width, int height) { void Window_Create2D(int width, int height) {
SetupVideo(true); SetupVideo(false);
bg_id = bgInitSub(2, BgType_Bmp16, BgSize_B16_256x256, 2, 0); bg_id = bgInitSub(2, BgType_Bmp16, BgSize_B16_256x256, 2, 0);
bg_ptr = bgGetGfxPtr(bg_id); bg_ptr = bgGetGfxPtr(bg_id);
} }
void Window_Create3D(int width, int height) { void Window_Create3D(int width, int height) {
SetupVideo(false); SetupVideo(true);
} }
void Window_Destroy(void) { } void Window_Destroy(void) { }
@ -354,7 +353,7 @@ static void OnKeyPressed(int key) {
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
Keyboard* kbd = keyboardGetDefault(); Keyboard* kbd = keyboardGetDefault();
if (!launcherMode) videoBgDisableSub(LAYER_CON); if (Window_Main.Is3D) videoBgDisableSub(LAYER_CON);
keyboardInit(kbd, LAYER_KB, BgType_Text4bpp, BgSize_T_256x512, keyboardInit(kbd, LAYER_KB, BgType_Text4bpp, BgSize_T_256x512,
14, 0, false, true); 14, 0, false, true);
@ -374,7 +373,7 @@ void OnscreenKeyboard_Close(void) {
if (!DisplayInfo.ShowingSoftKeyboard) return; if (!DisplayInfo.ShowingSoftKeyboard) return;
DisplayInfo.ShowingSoftKeyboard = false; DisplayInfo.ShowingSoftKeyboard = false;
if (!launcherMode) videoBgEnableSub(LAYER_CON); if (Window_Main.Is3D) videoBgEnableSub(LAYER_CON);
} }

View File

@ -21,7 +21,6 @@
#define SCREEN_XRES 320 #define SCREEN_XRES 320
#define SCREEN_YRES 240 #define SCREEN_YRES 240
static cc_bool launcherMode;
struct _DisplayData DisplayInfo; struct _DisplayData DisplayInfo;
struct cc_window WindowInfo; struct cc_window WindowInfo;
static int gpu_video_mode; static int gpu_video_mode;
@ -89,7 +88,7 @@ extern void Gfx_ResetGPU(void);
void Window_Create2D(int width, int height) { void Window_Create2D(int width, int height) {
Gfx_ResetGPU(); Gfx_ResetGPU();
launcherMode = true; Window_Main.Is3D = false;
InitScreen(); InitScreen();
ClearScreen(); ClearScreen();
@ -97,7 +96,7 @@ void Window_Create2D(int width, int height) {
void Window_Create3D(int width, int height) { void Window_Create3D(int width, int height) {
Gfx_ResetGPU(); Gfx_ResetGPU();
launcherMode = false; Window_Main.Is3D = true;
InitScreen(); InitScreen();
} }
@ -259,7 +258,7 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
kb_tileWidth = KB_TILE_SIZE / 2; kb_tileWidth = KB_TILE_SIZE / 2;
kb_tileHeight = KB_TILE_SIZE / 2; kb_tileHeight = KB_TILE_SIZE / 2;
VirtualKeyboard_Open(args, launcherMode); VirtualKeyboard_Open(args);
} }
void OnscreenKeyboard_SetText(const cc_string* text) { void OnscreenKeyboard_SetText(const cc_string* text) {

View File

@ -24,7 +24,7 @@
#include <libkbd.h> #include <libkbd.h>
#include <libmouse.h> #include <libmouse.h>
static cc_bool launcherMode, mouseSupported, kbdSupported; static cc_bool mouseSupported, kbdSupported;
#include "../VirtualCursor.h" #include "../VirtualCursor.h"
struct _DisplayData DisplayInfo; struct _DisplayData DisplayInfo;
struct cc_window WindowInfo; struct cc_window WindowInfo;
@ -112,13 +112,13 @@ static void InitDisplay(framebuffer_t* fb) {
void Window_Create2D(int width, int height) { void Window_Create2D(int width, int height) {
ResetDisplay(); ResetDisplay();
InitDisplay(&fb_colors[0]); InitDisplay(&fb_colors[0]);
launcherMode = true; Window_Main.Is3D = false;
} }
void Window_Create3D(int width, int height) { void Window_Create3D(int width, int height) {
ResetDisplay(); ResetDisplay();
InitDisplay(&fb_colors[0]); InitDisplay(&fb_colors[0]);
launcherMode = false; Window_Main.Is3D = true;
} }
void Window_Destroy(void) { } void Window_Destroy(void) { }
@ -374,7 +374,7 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
*#########################################################################################################################*/ *#########################################################################################################################*/
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
if (Input.Sources & INPUT_SOURCE_NORMAL) return; if (Input.Sources & INPUT_SOURCE_NORMAL) return;
VirtualKeyboard_Open(args, launcherMode); VirtualKeyboard_Open(args);
} }
void OnscreenKeyboard_SetText(const cc_string* text) { void OnscreenKeyboard_SetText(const cc_string* text) {

View File

@ -17,7 +17,6 @@
#include <sysutil/sysutil.h> #include <sysutil/sysutil.h>
#include <sysutil/video.h> #include <sysutil/video.h>
static cc_bool launcherMode;
static KbInfo kb_info; static KbInfo kb_info;
static KbData kb_data; static KbData kb_data;
static KbConfig kb_config; static KbConfig kb_config;
@ -70,12 +69,12 @@ void Window_Init(void) {
void Window_Free(void) { } void Window_Free(void) { }
void Window_Create2D(int width, int height) { void Window_Create2D(int width, int height) {
launcherMode = true; Window_Main.Is3D = false;
Gfx_Create(); // launcher also uses RSX to draw Gfx_Create(); // launcher also uses RSX to draw
} }
void Window_Create3D(int width, int height) { void Window_Create3D(int width, int height) {
launcherMode = false; Window_Main.Is3D = true;
} }
void Window_Destroy(void) { } void Window_Destroy(void) { }
@ -398,7 +397,7 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
*#########################################################################################################################*/ *#########################################################################################################################*/
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
if (Input.Sources & INPUT_SOURCE_NORMAL) return; if (Input.Sources & INPUT_SOURCE_NORMAL) return;
VirtualKeyboard_Open(args, launcherMode); VirtualKeyboard_Open(args);
} }
void OnscreenKeyboard_SetText(const cc_string* text) { void OnscreenKeyboard_SetText(const cc_string* text) {

View File

@ -13,8 +13,6 @@
#include "../VirtualKeyboard.h" #include "../VirtualKeyboard.h"
#include <VideoOut.h> #include <VideoOut.h>
static cc_bool launcherMode;
struct _DisplayData DisplayInfo; struct _DisplayData DisplayInfo;
struct cc_window WindowInfo; struct cc_window WindowInfo;
@ -48,12 +46,11 @@ void Window_Init(void) {
void Window_Free(void) { } void Window_Free(void) { }
void Window_Create2D(int width, int height) { void Window_Create2D(int width, int height) {
launcherMode = true; Window_Main.Is3D = false;
Gfx_Create(); // launcher also uses RSX to draw
} }
void Window_Create3D(int width, int height) { void Window_Create3D(int width, int height) {
launcherMode = false; Window_Main.Is3D = true;
} }
void Window_Destroy(void) { } void Window_Destroy(void) { }
@ -123,7 +120,7 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
if (Input.Sources & INPUT_SOURCE_NORMAL) return; if (Input.Sources & INPUT_SOURCE_NORMAL) return;
VirtualKeyboard_Open(args, launcherMode); VirtualKeyboard_Open(args);
} }
void OnscreenKeyboard_SetText(const cc_string* text) { void OnscreenKeyboard_SetText(const cc_string* text) {

View File

@ -18,7 +18,6 @@
#define BUFFER_WIDTH 512 #define BUFFER_WIDTH 512
#define SCREEN_WIDTH 480 #define SCREEN_WIDTH 480
#define SCREEN_HEIGHT 272 #define SCREEN_HEIGHT 272
static cc_bool launcherMode;
struct _DisplayData DisplayInfo; struct _DisplayData DisplayInfo;
struct cc_window WindowInfo; struct cc_window WindowInfo;
@ -46,8 +45,8 @@ void Window_Init(void) {
void Window_Free(void) { } void Window_Free(void) { }
void Window_Create2D(int width, int height) { launcherMode = true; } void Window_Create2D(int width, int height) { Window_Main.Is3D = false; }
void Window_Create3D(int width, int height) { launcherMode = false; } void Window_Create3D(int width, int height) { Window_Main.Is3D = true; }
void Window_Destroy(void) { } void Window_Destroy(void) { }
@ -193,7 +192,7 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
*------------------------------------------------------Soft keyboard------------------------------------------------------* *------------------------------------------------------Soft keyboard------------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
VirtualKeyboard_Open(args, launcherMode); VirtualKeyboard_Open(args);
} }
void OnscreenKeyboard_SetText(const cc_string* text) { void OnscreenKeyboard_SetText(const cc_string* text) {

View File

@ -13,7 +13,6 @@
#include <vitasdk.h> #include <vitasdk.h>
static cc_bool launcherMode;
static SceTouchPanelInfo frontPanel, backPanel; static SceTouchPanelInfo frontPanel, backPanel;
struct _DisplayData DisplayInfo; struct _DisplayData DisplayInfo;
@ -61,12 +60,12 @@ void Window_Init(void) {
void Window_Free(void) { } void Window_Free(void) { }
void Window_Create2D(int width, int height) { void Window_Create2D(int width, int height) {
launcherMode = true; Window_Main.Is3D = false;
DQ_OnNextFrame = DQ_OnNextFrame2D; DQ_OnNextFrame = DQ_OnNextFrame2D;
} }
void Window_Create3D(int width, int height) { void Window_Create3D(int width, int height) {
launcherMode = false; Window_Main.Is3D = true;
} }
void Window_Destroy(void) { } void Window_Destroy(void) { }
@ -315,7 +314,7 @@ cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
kb_tileWidth = KB_TILE_SIZE * 2; kb_tileWidth = KB_TILE_SIZE * 2;
VirtualKeyboard_Open(args, launcherMode); VirtualKeyboard_Open(args);
} }
void OnscreenKeyboard_SetText(const cc_string* text) { void OnscreenKeyboard_SetText(const cc_string* text) {

View File

@ -18,8 +18,6 @@
#define SCREEN_WIDTH 320 #define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 224 #define SCREEN_HEIGHT 224
static cc_bool launcherMode;
struct _DisplayData DisplayInfo; struct _DisplayData DisplayInfo;
struct cc_window WindowInfo; struct cc_window WindowInfo;
@ -55,7 +53,7 @@ void Window_Init(void) {
void Window_Free(void) { } void Window_Free(void) { }
void Window_Create3D(int width, int height) { void Window_Create3D(int width, int height) {
launcherMode = false; Window_Main.Is3D = true;
} }
void Window_Destroy(void) { } void Window_Destroy(void) { }
@ -201,7 +199,7 @@ static const vdp2_vram_cycp_t vram_cycp = {
}; };
void Window_Create2D(int width, int height) { void Window_Create2D(int width, int height) {
launcherMode = true; Window_Main.Is3D = false;
const vdp2_scrn_bitmap_format_t format = { const vdp2_scrn_bitmap_format_t format = {
.scroll_screen = VDP2_SCRN_NBG0, .scroll_screen = VDP2_SCRN_NBG0,

View File

@ -14,7 +14,6 @@
#include <switch.h> #include <switch.h>
static cc_bool launcherMode;
static Framebuffer fb; static Framebuffer fb;
static PadState pad; static PadState pad;
static AppletHookCookie cookie; static AppletHookCookie cookie;
@ -83,10 +82,11 @@ void Window_Free(void) {
} }
void Window_Create2D(int width, int height) { void Window_Create2D(int width, int height) {
launcherMode = true; Window_Main.Is3D = false;
} }
void Window_Create3D(int width, int height) { void Window_Create3D(int width, int height) {
launcherMode = false; Window_Main.Is3D = true;
} }
void Window_Destroy(void) { } void Window_Destroy(void) { }

View File

@ -42,7 +42,6 @@ extern "C" {
class CCContainer; class CCContainer;
static cc_bool launcherMode;
static cc_bool gameRunning = false; static cc_bool gameRunning = false;
const TUid KUidClassiCube = {0xE212A5C2}; const TUid KUidClassiCube = {0xE212A5C2};
@ -627,7 +626,8 @@ void CCContainer::SizeChanged() {
DisplayInfo.Width = size.iWidth; DisplayInfo.Width = size.iWidth;
DisplayInfo.Height = size.iHeight; DisplayInfo.Height = size.iHeight;
if (!launcherMode) {
if (Window_Main.Is3D) {
if (size.iWidth <= 360) { if (size.iWidth <= 360) {
DisplayInfo.ScaleX = 0.5f; DisplayInfo.ScaleX = 0.5f;
DisplayInfo.ScaleY = 0.5f; DisplayInfo.ScaleY = 0.5f;
@ -636,6 +636,7 @@ void CCContainer::SizeChanged() {
DisplayInfo.ScaleY = 1; DisplayInfo.ScaleY = 1;
} }
} }
WindowInfo.Width = size.iWidth; WindowInfo.Width = size.iWidth;
WindowInfo.Height = size.iHeight; WindowInfo.Height = size.iHeight;
Event_RaiseVoid(&WindowEvents.Resized); Event_RaiseVoid(&WindowEvents.Resized);
@ -660,7 +661,7 @@ CCoeControl* CCContainer::ComponentControl(TInt) const {
void CCContainer::Draw(const TRect& aRect) const { void CCContainer::Draw(const TRect& aRect) const {
#if CC_GFX_BACKEND_IS_GL() #if CC_GFX_BACKEND_IS_GL()
if (!launcherMode) return; if (Window_Main.Is3D) return;
#endif #endif
if (iBitmap) { if (iBitmap) {
SystemGc().BitBlt(TPoint(0, 0), iBitmap); SystemGc().BitBlt(TPoint(0, 0), iBitmap);
@ -822,11 +823,12 @@ void Window_Free(void) {
} }
void Window_Create2D(int width, int height) { void Window_Create2D(int width, int height) {
launcherMode = true; Window_Main.Is3D = false;
container->SetExtentToWholeScreen(); container->SetExtentToWholeScreen();
} }
void Window_Create3D(int width, int height) { void Window_Create3D(int width, int height) {
launcherMode = false; Window_Main.Is3D = true;
container->SetExtentToWholeScreen(); container->SetExtentToWholeScreen();
} }
@ -913,7 +915,7 @@ void ShowDialogCore(const char* title, const char* msg) {
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
#ifdef CC_BUILD_TOUCH #ifdef CC_BUILD_TOUCH
VirtualKeyboard_Open(args, launcherMode); VirtualKeyboard_Open(args);
#endif #endif
} }

View File

@ -140,7 +140,7 @@ mergeInto(LibraryManager.library, {
var filetype = { var filetype = {
description: UTF8ToString(title), description: UTF8ToString(title),
accept: {'applicaion/octet-stream': [UTF8ToString(filter)]} accept: {'application/octet-stream': [UTF8ToString(filter)]}
}; };
fileTypes.push(filetype); fileTypes.push(filetype);
} }

View File

@ -29,7 +29,6 @@
#include <coreinit/filesystem.h> #include <coreinit/filesystem.h>
#include <coreinit/memdefaultheap.h> #include <coreinit/memdefaultheap.h>
static cc_bool launcherMode;
struct _DisplayData DisplayInfo; struct _DisplayData DisplayInfo;
struct cc_window WindowInfo; struct cc_window WindowInfo;
struct cc_window Window_Alt; struct cc_window Window_Alt;
@ -112,7 +111,7 @@ void Window_Create2D(int width, int height) {
Window_Main.Width = OSSCREEN_DRC_WIDTH; Window_Main.Width = OSSCREEN_DRC_WIDTH;
Window_Main.Height = OSSCREEN_DRC_HEIGHT; Window_Main.Height = OSSCREEN_DRC_HEIGHT;
launcherMode = true; Window_Main.Is3D = false;
Event_Register_(&WindowEvents.InactiveChanged, NULL, LauncherInactiveChanged); Event_Register_(&WindowEvents.InactiveChanged, NULL, LauncherInactiveChanged);
Init2DResources(); Init2DResources();
} }
@ -121,7 +120,7 @@ void Window_Create3D(int width, int height) {
Window_Main.Width = DisplayInfo.Width; Window_Main.Width = DisplayInfo.Width;
Window_Main.Height = DisplayInfo.Height; Window_Main.Height = DisplayInfo.Height;
launcherMode = false; Window_Main.Is3D = true;
Event_Unregister_(&WindowEvents.InactiveChanged, NULL, LauncherInactiveChanged); Event_Unregister_(&WindowEvents.InactiveChanged, NULL, LauncherInactiveChanged);
} }
@ -478,7 +477,7 @@ cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
*#########################################################################################################################*/ *#########################################################################################################################*/
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
if (Input.Sources & INPUT_SOURCE_NORMAL) return; if (Input.Sources & INPUT_SOURCE_NORMAL) return;
VirtualKeyboard_Open(args, launcherMode); VirtualKeyboard_Open(args);
} }
void OnscreenKeyboard_SetText(const cc_string* text) { void OnscreenKeyboard_SetText(const cc_string* text) {

View File

@ -16,7 +16,6 @@
#include <xid_driver.h> #include <xid_driver.h>
#include <pbkit/pbkit.h> #include <pbkit/pbkit.h>
static cc_bool launcherMode;
struct _DisplayData DisplayInfo; struct _DisplayData DisplayInfo;
struct cc_window WindowInfo; struct cc_window WindowInfo;
@ -49,8 +48,8 @@ void Window_Init(void) {
void Window_Free(void) { usbh_core_deinit(); } void Window_Free(void) { usbh_core_deinit(); }
void Window_Create2D(int width, int height) { launcherMode = true; } void Window_Create2D(int width, int height) { Window_Main.Is3D = false; }
void Window_Create3D(int width, int height) { launcherMode = false; } void Window_Create3D(int width, int height) { Window_Main.Is3D = true; }
void Window_Destroy(void) { } void Window_Destroy(void) { }
@ -249,7 +248,7 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
*#########################################################################################################################*/ *#########################################################################################################################*/
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
if (Input.Sources & INPUT_SOURCE_NORMAL) return; if (Input.Sources & INPUT_SOURCE_NORMAL) return;
VirtualKeyboard_Open(args, launcherMode); VirtualKeyboard_Open(args);
} }
void OnscreenKeyboard_SetText(const cc_string* text) { void OnscreenKeyboard_SetText(const cc_string* text) {

View File

@ -15,8 +15,6 @@
#include <usb/usbmain.h> #include <usb/usbmain.h>
#include <pci/io.h> #include <pci/io.h>
static cc_bool launcherMode;
struct _DisplayData DisplayInfo; struct _DisplayData DisplayInfo;
struct cc_window WindowInfo; struct cc_window WindowInfo;
@ -47,8 +45,8 @@ void Window_Init(void) {
void Window_Free(void) { } void Window_Free(void) { }
void Window_Create2D(int width, int height) { launcherMode = true; } void Window_Create2D(int width, int height) { Window_Main.Is3D = false; }
void Window_Create3D(int width, int height) { launcherMode = false; } void Window_Create3D(int width, int height) { Window_Main.Is3D = true; }
void Window_Destroy(void) { } void Window_Destroy(void) { }
@ -207,7 +205,7 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
*#########################################################################################################################*/ *#########################################################################################################################*/
void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) {
if (Input.Sources & INPUT_SOURCE_NORMAL) return; if (Input.Sources & INPUT_SOURCE_NORMAL) return;
VirtualKeyboard_Open(args, launcherMode); VirtualKeyboard_Open(args);
} }
void OnscreenKeyboard_SetText(const cc_string* text) { void OnscreenKeyboard_SetText(const cc_string* text) {