1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-05 12:47:53 +02:00

#15 NX add 1080p docked mode support

This commit is contained in:
XProger
2019-01-05 05:38:59 +03:00
parent 9d5371009c
commit b965ce4ef4

View File

@@ -93,6 +93,7 @@ void sndFree() {
EGLDisplay display;
EGLSurface surface;
EGLContext context;
NWindow *window;
bool eglInit() {
display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
@@ -125,7 +126,10 @@ bool eglInit() {
if (eglChooseConfig(display, eglAttr, &config, 1, &configCount) == EGL_FALSE)
return false;
surface = eglCreateWindowSurface(display, config, (char*)"", NULL);
window = nwindowGetDefault();
nwindowSetDimensions(window, 1920, 1080);
surface = eglCreateWindowSurface(display, config, (EGLNativeWindowType)window, NULL);
if (surface == EGL_NO_SURFACE)
return false;
@@ -151,6 +155,19 @@ void eglFree() {
eglReleaseThread();
}
void configureResolution() {
if (appletGetOperationMode() == AppletOperationMode_Docked) {
Core::width = 1920;
Core::height = 1080;
} else {
Core::width = 1280;
Core::height = 720;
}
nwindowSetCrop(window, 0, 0, Core::width, Core::height);
Core::y = 1080 - Core::height;
}
// Input
bool osJoyReady(int index) {
return index == 0;
@@ -176,7 +193,7 @@ void joySplit(bool split) {
hidSetNpadJoyAssignmentModeDual(CONTROLLER_PLAYER_2);
hidMergeSingleJoyAsDualJoy(CONTROLLER_PLAYER_1, CONTROLLER_PLAYER_2);
if (Game::level && Game::level.players[1]) {
if (Game::level && Game::level->players[1]) {
Game::level->addPlayer(1); // add existing player == remove player
}
}
@@ -291,6 +308,7 @@ int main(int argc, char* argv[]) {
touchUpdate();
if (Game::update()) {
configureResolution();
Game::render();
Core::waitVBlank();
eglSwapBuffers(display, surface);