1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-11 23:54:09 +02:00

close the game if no original resources are available; #15 add application icon, turn on shader cache, create cache directory at start, swap A/B keys in inventory

This commit is contained in:
XProger
2019-01-08 07:47:13 +03:00
parent c0246bf021
commit a3c0099d2d
8 changed files with 42 additions and 14 deletions

View File

@@ -136,6 +136,12 @@ namespace Game {
Core::init(); Core::init();
Sound::callback = stopChannel; Sound::callback = stopChannel;
if (lvl->size == -1) {
delete lvl;
Core::quit();
return;
}
Core::settings.version = SETTINGS_READING; Core::settings.version = SETTINGS_READING;
Stream::cacheRead("settings", loadSettings, lvl); Stream::cacheRead("settings", loadSettings, lvl);
readSlots(); readSlots();

View File

@@ -1070,10 +1070,6 @@ namespace GAPI {
support.texHalf = support.texHalfLinear || extSupport(ext, "_texture_half_float"); support.texHalf = support.texHalfLinear || extSupport(ext, "_texture_half_float");
support.clipDist = false; // TODO support.clipDist = false; // TODO
#ifdef _OS_NX
support.shaderBinary = false; // TODO: check GPU crash for current switchbrew mesa libs
#endif
#ifdef PROFILE #ifdef PROFILE
support.profMarker = extSupport(ext, "_KHR_debug"); support.profMarker = extSupport(ext, "_KHR_debug");
support.profTiming = extSupport(ext, "_timer_query"); support.profTiming = extSupport(ext, "_timer_query");

View File

@@ -1143,7 +1143,7 @@ struct Inventory {
ControlKey key = cMAX; ControlKey key = cMAX;
if (Input::down[ikCtrl] || Input::down[ikEnter] || Input::lastState[playerIndex] == cAction || joy.down[jkA]) if (Input::down[ikCtrl] || Input::down[ikEnter] || Input::lastState[playerIndex] == cAction || joy.down[jkA])
key = cAction; key = cAction;
else if (Input::down[ikAlt] || joy.down[jkB] || Input::lastState[playerIndex] == cInventory) else if (Input::down[ikAlt] || joy.down[jkB])
key = cInventory; key = cInventory;
else if (Input::down[ikLeft] || joy.down[jkLeft] || joy.L.x < -0.5f || joyMain.down[jkLeft] || joyMain.L.x < -0.5f) else if (Input::down[ikLeft] || joy.down[jkLeft] || joy.L.x < -0.5f || joyMain.down[jkLeft] || joyMain.L.x < -0.5f)
key = cLeft; key = cLeft;
@@ -1154,6 +1154,18 @@ struct Inventory {
else if (Input::down[ikDown] || joy.down[jkDown] || joy.L.y > 0.5f) else if (Input::down[ikDown] || joy.down[jkDown] || joy.L.y > 0.5f)
key = cDown; 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)]; Item *item = items[getGlobalIndex(page, index)];
if (page == PAGE_LEVEL_STATS) { if (page == PAGE_LEVEL_STATS) {
@@ -1940,10 +1952,18 @@ struct Inventory {
if (page == targetPage && Input::touchTimerVis <= 0.0f) { if (page == targetPage && Input::touchTimerVis <= 0.0f) {
float dx = 32.0f - eye; float dx = 32.0f - eye;
char buf[64]; 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); UI::textOut(vec2(dx, 480 - 64), buf, UI::aLeft, UI::width);
if (chosen) { 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); UI::textOut(vec2(0, 480 - 64), buf, UI::aRight, UI::width - dx);
} }
} }

View File

@@ -33,11 +33,14 @@ include $(DEVKITPRO)/libnx/switch_rules
TARGET := OpenLara TARGET := OpenLara
BUILD := build BUILD := build
SOURCES := ./ ./../../libs/stb_vorbis/ ./../../libs/tinf/ ./../../libs/minimp3/ SOURCES := ./ ./../../libs/stb_vorbis/ ./../../libs/tinf/ ./../../libs/minimp3/
DATA := data
INCLUDES := ../../ INCLUDES := ../../
EXEFS_SRC := exefs_src EXEFS_SRC := exefs_src
#ROMFS := romfs #ROMFS := romfs
APP_TITLE := OpenLara
APP_AUTHOR := XProger
APP_VERSION := 1.0
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# options for code generation # options for code generation
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------

BIN
src/platform/nx/icon.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -164,8 +164,8 @@ void configureResolution() {
Core::height = 720; Core::height = 720;
} }
nwindowSetCrop(window, 0, 0, Core::width, Core::height); int offset = 1080 - Core::height;
Core::y = 1080 - Core::height; nwindowSetCrop(window, 0, offset, Core::width, Core::height + offset);
} }
// Input // Input
@@ -294,7 +294,7 @@ int main(int argc, char* argv[]) {
strcat(cacheDir, "/switch/OpenLara/cache/"); strcat(cacheDir, "/switch/OpenLara/cache/");
strcat(saveDir, "/switch/OpenLara/"); strcat(saveDir, "/switch/OpenLara/");
//mkdir("/switch/OpenLara/cache/"); fsFsCreateDirectory(fsdevGetDefaultFileSystem(), cacheDir);
startTime = osGetTime(); startTime = osGetTime();

View File

@@ -770,7 +770,12 @@ int main(int argc, char** argv) {
#endif #endif
SetWindowLong(hWnd, GWL_WNDPROC, (LONG)&WndProc); 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; MSG msg;

View File

@@ -154,9 +154,7 @@ uniform vec4 uFogParams;
fog = length(vViewVec.xyz); fog = length(vViewVec.xyz);
vNormal.w = clamp(1.0 / exp(fog), 0.0, 1.0); vNormal.w = clamp(1.0 / exp(fog), 0.0, 1.0);
#endif #endif
#endif
#if defined(PASS_COMPOSE) && !defined(TYPE_FLASH)
vCoord = coord.xyz; vCoord = coord.xyz;
#endif #endif
return coord; return coord;