diff --git a/src/game.h b/src/game.h index 3579504..32c1290 100644 --- a/src/game.h +++ b/src/game.h @@ -136,6 +136,12 @@ namespace Game { Core::init(); Sound::callback = stopChannel; + if (lvl->size == -1) { + delete lvl; + Core::quit(); + return; + } + Core::settings.version = SETTINGS_READING; Stream::cacheRead("settings", loadSettings, lvl); readSlots(); diff --git a/src/gapi_gl.h b/src/gapi_gl.h index 01bc311..d703680 100644 --- a/src/gapi_gl.h +++ b/src/gapi_gl.h @@ -1070,10 +1070,6 @@ namespace GAPI { support.texHalf = support.texHalfLinear || extSupport(ext, "_texture_half_float"); support.clipDist = false; // TODO - #ifdef _OS_NX - support.shaderBinary = false; // TODO: check GPU crash for current switchbrew mesa libs - #endif - #ifdef PROFILE support.profMarker = extSupport(ext, "_KHR_debug"); support.profTiming = extSupport(ext, "_timer_query"); diff --git a/src/inventory.h b/src/inventory.h index a5f1450..6b5eac4 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -1143,7 +1143,7 @@ struct Inventory { ControlKey key = cMAX; if (Input::down[ikCtrl] || Input::down[ikEnter] || Input::lastState[playerIndex] == cAction || joy.down[jkA]) key = cAction; - else if (Input::down[ikAlt] || joy.down[jkB] || Input::lastState[playerIndex] == cInventory) + else if (Input::down[ikAlt] || joy.down[jkB]) key = cInventory; else if (Input::down[ikLeft] || joy.down[jkLeft] || joy.L.x < -0.5f || joyMain.down[jkLeft] || joyMain.L.x < -0.5f) key = cLeft; @@ -1154,6 +1154,18 @@ struct Inventory { else if (Input::down[ikDown] || joy.down[jkDown] || joy.L.y > 0.5f) key = cDown; + #ifdef _OS_NX + // swap A/B keys for Nintendo (Japanese) UX style + if (key == cAction) { + key = cInventory; + } else if (key == cInventory) { + key = cAction; + } + #endif + + if (Input::lastState[playerIndex] == cInventory) + key = cInventory; + Item *item = items[getGlobalIndex(page, index)]; if (page == PAGE_LEVEL_STATS) { @@ -1940,10 +1952,18 @@ struct Inventory { if (page == targetPage && Input::touchTimerVis <= 0.0f) { float dx = 32.0f - eye; char buf[64]; - sprintf(buf, STR[STR_HELP_SELECT], STR[STR_KEY_FIRST + ikEnter] ); + const char *bSelect = STR[STR_KEY_FIRST + ikEnter]; + const char *bBack = STR[STR_KEY_FIRST + Core::settings.controls[playerIndex].keys[cInventory].key]; + + #ifdef _OS_NX + bSelect = "A"; + bBack = "B"; + #endif + + sprintf(buf, STR[STR_HELP_SELECT], bSelect); UI::textOut(vec2(dx, 480 - 64), buf, UI::aLeft, UI::width); if (chosen) { - sprintf(buf, STR[STR_HELP_BACK], STR[STR_KEY_FIRST + Core::settings.controls[playerIndex].keys[ cInventory ].key] ); + sprintf(buf, STR[STR_HELP_BACK], bBack); UI::textOut(vec2(0, 480 - 64), buf, UI::aRight, UI::width - dx); } } diff --git a/src/platform/nx/Makefile b/src/platform/nx/Makefile index 76d7cda..56c6cb6 100644 --- a/src/platform/nx/Makefile +++ b/src/platform/nx/Makefile @@ -33,11 +33,14 @@ include $(DEVKITPRO)/libnx/switch_rules TARGET := OpenLara BUILD := build SOURCES := ./ ./../../libs/stb_vorbis/ ./../../libs/tinf/ ./../../libs/minimp3/ -DATA := data INCLUDES := ../../ EXEFS_SRC := exefs_src #ROMFS := romfs +APP_TITLE := OpenLara +APP_AUTHOR := XProger +APP_VERSION := 1.0 + #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- diff --git a/src/platform/nx/icon.jpg b/src/platform/nx/icon.jpg new file mode 100644 index 0000000..c04f7bb Binary files /dev/null and b/src/platform/nx/icon.jpg differ diff --git a/src/platform/nx/main.cpp b/src/platform/nx/main.cpp index 147ffff..b610f67 100644 --- a/src/platform/nx/main.cpp +++ b/src/platform/nx/main.cpp @@ -164,8 +164,8 @@ void configureResolution() { Core::height = 720; } - nwindowSetCrop(window, 0, 0, Core::width, Core::height); - Core::y = 1080 - Core::height; + int offset = 1080 - Core::height; + nwindowSetCrop(window, 0, offset, Core::width, Core::height + offset); } // Input @@ -294,7 +294,7 @@ int main(int argc, char* argv[]) { strcat(cacheDir, "/switch/OpenLara/cache/"); strcat(saveDir, "/switch/OpenLara/"); - //mkdir("/switch/OpenLara/cache/"); + fsFsCreateDirectory(fsdevGetDefaultFileSystem(), cacheDir); startTime = osGetTime(); diff --git a/src/platform/win/main.cpp b/src/platform/win/main.cpp index 29f635c..54a5476 100644 --- a/src/platform/win/main.cpp +++ b/src/platform/win/main.cpp @@ -770,7 +770,12 @@ int main(int argc, char** argv) { #endif SetWindowLong(hWnd, GWL_WNDPROC, (LONG)&WndProc); - ShowWindow(hWnd, SW_SHOWDEFAULT); + + if (Core::isQuit) { + MessageBoxA(hWnd, "Please check the readme file first!", "Game resources not found", MB_ICONHAND); + } else { + ShowWindow(hWnd, SW_SHOWDEFAULT); + } MSG msg; diff --git a/src/shaders/shader.glsl b/src/shaders/shader.glsl index 88531a2..36a4c92 100644 --- a/src/shaders/shader.glsl +++ b/src/shaders/shader.glsl @@ -154,9 +154,7 @@ uniform vec4 uFogParams; fog = length(vViewVec.xyz); vNormal.w = clamp(1.0 / exp(fog), 0.0, 1.0); #endif - #endif - #if defined(PASS_COMPOSE) && !defined(TYPE_FLASH) vCoord = coord.xyz; #endif return coord;