1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-10 23:24:06 +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();
Sound::callback = stopChannel;
if (lvl->size == -1) {
delete lvl;
Core::quit();
return;
}
Core::settings.version = SETTINGS_READING;
Stream::cacheRead("settings", loadSettings, lvl);
readSlots();

View File

@@ -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");

View File

@@ -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);
}
}

View File

@@ -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
#---------------------------------------------------------------------------------

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;
}
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();

View File

@@ -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;

View File

@@ -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;