mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05:00
Consoles: Try to deinit some stuff on some consoles when exiting the game
This commit is contained in:
parent
dda2f34523
commit
6f41df9926
21 changed files with 45 additions and 3 deletions
|
@ -144,6 +144,8 @@ int main(int argc, char** argv) {
|
|||
while (WindowInfo.Exists) {
|
||||
RunProgram(argc, argv);
|
||||
}
|
||||
|
||||
Window_Free();
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -86,8 +86,10 @@ CC_VAR extern struct _WinData {
|
|||
cc_bool Inactive;
|
||||
} WindowInfo;
|
||||
|
||||
/* Initialises state for window. Also sets Display_ members. */
|
||||
/* Initialises state for window, input, and display. */
|
||||
void Window_Init(void);
|
||||
/* Potentially frees/resets state for window, input, and display. */
|
||||
void Window_Free(void);
|
||||
/* Creates a window of the given size at centre of the screen. */
|
||||
/* NOTE: The created window is compatible with 2D drawing */
|
||||
void Window_Create2D(int width, int height);
|
||||
|
|
|
@ -54,6 +54,8 @@ void Window_Init(void) {
|
|||
irrst_result = irrstInit();
|
||||
}
|
||||
|
||||
void Window_Free(void) { irrstExit(); }
|
||||
|
||||
void Window_Create2D(int width, int height) { launcherMode = true; }
|
||||
void Window_Create3D(int width, int height) { launcherMode = false; }
|
||||
|
||||
|
@ -130,8 +132,8 @@ void Window_ProcessEvents(double delta) {
|
|||
/* TODO implement */
|
||||
|
||||
if (!aptMainLoop()) {
|
||||
Event_RaiseVoid(&WindowEvents.Closing);
|
||||
WindowInfo.Exists = false;
|
||||
Window_RequestClose();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -289,6 +289,8 @@ void Window_Init(void) {
|
|||
DisplayInfo.ScaleY = JavaICall_Float(env, JAVA_getDpiY, NULL);
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
static void RemakeWindowSurface(void) {
|
||||
JNIEnv* env;
|
||||
JavaGetCurrentEnv(env);
|
||||
|
|
|
@ -439,6 +439,8 @@ static void HookEvents(void) {
|
|||
*#########################################################################################################################*/
|
||||
void Window_Init(void) { Window_CommonInit(); }
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
/* Private CGS/CGL stuff */
|
||||
typedef int CGSConnectionID;
|
||||
typedef int CGSWindowID;
|
||||
|
|
|
@ -36,6 +36,8 @@ void Window_Init(void) {
|
|||
DisplayInfo.ContentOffsetY = 20;
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
void Window_Create2D(int width, int height) {
|
||||
launcherMode = true;
|
||||
vid_set_mode(DEFAULT_VID_MODE, PM_RGB888);
|
||||
|
|
|
@ -87,6 +87,8 @@ void Window_Init(void) {
|
|||
PAD_Init();
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
void Window_Create2D(int width, int height) {
|
||||
needsFBUpdate = true;
|
||||
launcherMode = true;
|
||||
|
|
|
@ -38,9 +38,11 @@ void Window_Init(void) {
|
|||
Input.Sources = INPUT_SOURCE_GAMEPAD;
|
||||
DisplayInfo.ContentOffsetX = 10;
|
||||
DisplayInfo.ContentOffsetY = 10;
|
||||
joypad_init();
|
||||
joypad_init();
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
void Window_Create2D(int width, int height) { launcherMode = true; }
|
||||
void Window_Create3D(int width, int height) { launcherMode = false; }
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ void Window_Init(void) {
|
|||
padPortOpen(0, 0, padBuf);
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
static cc_bool hasCreated;
|
||||
static void ResetGfxState(void) {
|
||||
if (!hasCreated) { hasCreated = true; return; }
|
||||
|
|
|
@ -68,6 +68,8 @@ void Window_Init(void) {
|
|||
ioKbGetConfiguration(0, &kb_config);
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
void Window_Create2D(int width, int height) {
|
||||
launcherMode = true;
|
||||
Gfx_Create(); // launcher also uses RSX to draw
|
||||
|
|
|
@ -42,6 +42,8 @@ void Window_Init(void) {
|
|||
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
void Window_Create2D(int width, int height) { launcherMode = true; }
|
||||
void Window_Create3D(int width, int height) { launcherMode = false; }
|
||||
|
||||
|
|
|
@ -56,6 +56,8 @@ void Window_Init(void) {
|
|||
Gfx_AllocFramebuffers();
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
void Window_Create2D(int width, int height) {
|
||||
launcherMode = true;
|
||||
DQ_OnNextFrame = DQ_OnNextFrame2D;
|
||||
|
|
|
@ -38,6 +38,8 @@ void Window_Init(void) {
|
|||
DisplayInfo.ScaleY = 1;
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
static void DoCreateWindow(int width, int height, int flags) {
|
||||
int x = Display_CentreX(width);
|
||||
int y = Display_CentreY(height);
|
||||
|
|
|
@ -394,6 +394,8 @@ void Window_Init(void) {
|
|||
interop_ForceTouchPageLayout();
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
extern void interop_InitContainer(void);
|
||||
static void DoCreateWindow(void) {
|
||||
WindowInfo.Exists = true;
|
||||
|
|
|
@ -307,6 +307,8 @@ void Window_Init(void) {
|
|||
DisplayInfo.Depth *= GetDeviceCaps(hdc, PLANES);
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
static ATOM DoRegisterClass(void) {
|
||||
ATOM atom;
|
||||
WNDCLASSEXW wc = { 0 };
|
||||
|
|
|
@ -270,6 +270,8 @@ void Window_Init(void) {
|
|||
DisplayInfo.ScaleY = 1;
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
#ifdef CC_BUILD_ICON
|
||||
/* See misc/linux_icon_gen.cs for how to generate this file */
|
||||
#include "_CCIcon_X11.h"
|
||||
|
|
|
@ -85,6 +85,8 @@ void Window_Init(void) {
|
|||
OnDeviceChanged(NULL, 0); // TODO useless call?
|
||||
}
|
||||
|
||||
void Window_Free(void) { usbh_core_deinit(); }
|
||||
|
||||
void Window_Create2D(int width, int height) { launcherMode = true; }
|
||||
void Window_Create3D(int width, int height) { launcherMode = false; }
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@ void Window_Init(void) {
|
|||
//xenon_atapi_init();
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
void Window_Create2D(int width, int height) { launcherMode = true; }
|
||||
void Window_Create3D(int width, int height) { launcherMode = false; }
|
||||
|
||||
|
|
|
@ -394,6 +394,8 @@ void Window_Init(void) {
|
|||
DisplayInfo.ScaleY = 1;
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
static void DoCreateWindow(int width, int height) {
|
||||
// https://www.haiku-os.org/docs/api/classBRect.html#details
|
||||
// right/bottom coordinates are inclusive of the coordinates,
|
||||
|
|
|
@ -205,6 +205,8 @@ void Window_Init(void) {
|
|||
NSSetUncaughtExceptionHandler(LogUnhandledNSErrors);
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
*-----------------------------------------------------------Window--------------------------------------------------------*
|
||||
|
|
|
@ -373,6 +373,8 @@ void Window_Init(void) {
|
|||
DisplayInfo.ScaleY = 1; // TODO dpi scale
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
static UIColor* CalcBackgroundColor(void) {
|
||||
// default to purple if no themed background color yet
|
||||
if (!Launcher_Theme.BackgroundColor)
|
||||
|
|
Loading…
Reference in a new issue