mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-12 08:04:09 +02:00
#15 NX custom directory support, relative time from game starts
This commit is contained in:
@@ -46,15 +46,15 @@ APP_VERSION := 1.0
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -mcpu=cortex-a57+crc+fp+simd
|
ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -mcpu=cortex-a57+crc+fp+simd
|
||||||
|
|
||||||
CFLAGS := -g -O -ffast-math -fno-strict-aliasing -fomit-frame-pointer -ffunction-sections \
|
CFLAGS := -O3 -ffast-math -fno-strict-aliasing -fomit-frame-pointer -ffunction-sections \
|
||||||
$(ARCH) $(DEFINES)
|
$(ARCH) $(DEFINES)
|
||||||
|
|
||||||
CFLAGS += $(INCLUDE) -D__SWITCH__
|
CFLAGS += $(INCLUDE) -D__SWITCH__
|
||||||
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
|
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
|
||||||
|
|
||||||
ASFLAGS := -g $(ARCH)
|
ASFLAGS := $(ARCH)
|
||||||
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||||
|
|
||||||
LIBS := -lEGL -lGLESv2 -lglapi -ldrm_nouveau -lnx -lm
|
LIBS := -lEGL -lGLESv2 -lglapi -ldrm_nouveau -lnx -lm
|
||||||
|
|
||||||
|
@@ -25,11 +25,11 @@ void osMutexUnlock(void *obj) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// timing
|
// timing
|
||||||
unsigned int startTime;
|
u64 startTick;
|
||||||
|
|
||||||
int osGetTime() {
|
int osGetTime() {
|
||||||
u64 tick = armGetSystemTick();
|
u64 tick = armGetSystemTick();
|
||||||
return (tick * 625 / 12) / 1000000;
|
return int(((tick - startTick) * 625 / 12) / 1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// sound
|
// sound
|
||||||
@@ -286,6 +286,34 @@ void touchUpdate() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void makeCacheDir(char *elfPath) {
|
||||||
|
char buf[255];
|
||||||
|
int len = strlen(elfPath);
|
||||||
|
int start = 0;
|
||||||
|
strcpy(buf, elfPath);
|
||||||
|
|
||||||
|
// skip volume id
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
if (buf[i] == ':') {
|
||||||
|
start = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// skip executable name
|
||||||
|
for (int i = len - 1; i >= 0; i--) {
|
||||||
|
if (buf[i] == '/') {
|
||||||
|
buf[i] = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// make directory by full path
|
||||||
|
strcpy(cacheDir, buf + start);
|
||||||
|
strcat(cacheDir, "/cache/");
|
||||||
|
fsFsCreateDirectory(fsdevGetDefaultFileSystem(), cacheDir);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
Core::width = 1280;
|
Core::width = 1280;
|
||||||
Core::height = 720;
|
Core::height = 720;
|
||||||
@@ -296,14 +324,9 @@ int main(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cacheDir[0] = saveDir[0] = contentDir[0] = 0;
|
cacheDir[0] = saveDir[0] = contentDir[0] = 0;
|
||||||
|
makeCacheDir(argv[0]);
|
||||||
|
|
||||||
strcat(contentDir, "/switch/OpenLara/");
|
startTick = armGetSystemTick();
|
||||||
strcat(cacheDir, "/switch/OpenLara/cache/");
|
|
||||||
strcat(saveDir, "/switch/OpenLara/");
|
|
||||||
|
|
||||||
fsFsCreateDirectory(fsdevGetDefaultFileSystem(), cacheDir);
|
|
||||||
|
|
||||||
startTime = osGetTime();
|
|
||||||
|
|
||||||
sndInit();
|
sndInit();
|
||||||
joyInit();
|
joyInit();
|
||||||
|
Reference in New Issue
Block a user