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