mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-15 02:29:51 +01:00
Merge branch 'master' into TemporaryHackishBranch
# Conflicts: # Core/Config.cpp # Core/Config.h # Core/KeyMap.cpp # Core/SaveState.cpp # UI/GameSettingsScreen.cpp # assets/compat.ini
This commit is contained in:
commit
072e1522b3
321 files changed
+53762
-2959
No files matched your search
+72
-28
@@ -46,6 +46,7 @@
|
||||
|
||||
#include "Common/Net/HTTPClient.h"
|
||||
#include "Common/Net/Resolve.h"
|
||||
#include "Common/Net/URL.h"
|
||||
#include "Common/Render/TextureAtlas.h"
|
||||
#include "Common/Render/Text/draw_text.h"
|
||||
#include "Common/GPU/OpenGL/GLFeatures.h"
|
||||
@@ -94,6 +95,7 @@
|
||||
#include "Core/HLE/sceUsbCam.h"
|
||||
#include "Core/HLE/sceUsbGps.h"
|
||||
#include "Core/HLE/proAdhoc.h"
|
||||
#include "Core/HW/MemoryStick.h"
|
||||
#include "Core/Util/GameManager.h"
|
||||
#include "Core/Util/AudioFormat.h"
|
||||
#include "Core/WebServer.h"
|
||||
@@ -108,6 +110,7 @@
|
||||
#include "UI/GPUDriverTestScreen.h"
|
||||
#include "UI/HostTypes.h"
|
||||
#include "UI/MiscScreens.h"
|
||||
#include "UI/MemStickScreen.h"
|
||||
#include "UI/OnScreenDisplay.h"
|
||||
#include "UI/RemoteISOScreen.h"
|
||||
#include "UI/TiltEventProcessor.h"
|
||||
@@ -321,7 +324,9 @@ static bool CheckFontIsUsable(const wchar_t *fontFace) {
|
||||
}
|
||||
#endif
|
||||
|
||||
static void PostLoadConfig() {
|
||||
bool CreateDirectoriesAndroid();
|
||||
|
||||
void PostLoadConfig() {
|
||||
// On Windows, we deal with currentDirectory in InitSysDirectories().
|
||||
#if !PPSSPP_PLATFORM(WINDOWS)
|
||||
if (g_Config.currentDirectory.empty()) {
|
||||
@@ -339,12 +344,13 @@ static void PostLoadConfig() {
|
||||
else
|
||||
i18nrepo.LoadIni(g_Config.sLanguageIni, langOverridePath);
|
||||
|
||||
g_threadManager.Init(cpu_info.num_cores, cpu_info.logical_cpu_count);
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
CreateDirectoriesAndroid();
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool CreateDirectoriesAndroid() {
|
||||
// On Android, create a PSP directory tree in the external_dir,
|
||||
// to hopefully reduce confusion a bit.
|
||||
bool CreateDirectoriesAndroid() {
|
||||
// TODO: We should probably simply use this as the shared function to create memstick directories.
|
||||
|
||||
Path pspDir = g_Config.memStickDirectory;
|
||||
if (pspDir.GetFilename() != "PSP") {
|
||||
@@ -358,6 +364,7 @@ static bool CreateDirectoriesAndroid() {
|
||||
return false;
|
||||
}
|
||||
|
||||
File::CreateFullPath(GetSysDirectory(DIRECTORY_CHEATS));
|
||||
File::CreateFullPath(GetSysDirectory(DIRECTORY_SAVEDATA));
|
||||
File::CreateFullPath(GetSysDirectory(DIRECTORY_SAVESTATE));
|
||||
File::CreateFullPath(GetSysDirectory(DIRECTORY_GAME));
|
||||
@@ -436,7 +443,7 @@ static void ClearFailedGPUBackends() {
|
||||
// We've successfully started graphics without crashing, hurray.
|
||||
// In case they update drivers and have totally different problems much later, clear the failed list.
|
||||
g_Config.sFailedGPUBackends.clear();
|
||||
if (System_GetPropertyBool(SYSPROP_SUPPORTS_PERMISSIONS)) {
|
||||
if (System_GetPropertyBool(SYSPROP_SUPPORTS_PERMISSIONS) || System_GetPropertyBool(SYSPROP_ANDROID_SCOPED_STORAGE)) {
|
||||
File::Delete(GetSysDirectory(DIRECTORY_APP_CACHE) / "FailedGraphicsBackends.txt");
|
||||
} else {
|
||||
g_Config.Save("clearFailedGPUBackends");
|
||||
@@ -449,6 +456,8 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
ShaderTranslationInit();
|
||||
|
||||
InitFastMath(cpu_info.bNEON);
|
||||
g_threadManager.Init(cpu_info.num_cores, cpu_info.logical_cpu_count);
|
||||
|
||||
SetupAudioFormats();
|
||||
|
||||
g_Discord.SetPresenceMenu();
|
||||
@@ -504,22 +513,22 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
// is no longer the plain root of external storage, but it's an app specific directory
|
||||
// on external storage (g_extFilesDir).
|
||||
if (System_GetPropertyBool(SYSPROP_ANDROID_SCOPED_STORAGE)) {
|
||||
g_Config.defaultCurrentDirectory = Path(g_extFilesDir);
|
||||
// There's no sensible default directory. Let the user browse for files.
|
||||
g_Config.defaultCurrentDirectory.clear();
|
||||
} else {
|
||||
// Maybe there should be an option to use internal memory instead, but I think
|
||||
// that for most people, using external memory (SDCard/USB Storage) makes the
|
||||
// most sense.
|
||||
g_Config.memStickDirectory = Path(external_dir);
|
||||
g_Config.defaultCurrentDirectory = Path(external_dir);
|
||||
CreateDirectoriesAndroid();
|
||||
}
|
||||
|
||||
// Might also add an option to move it to internal / non-visible storage, but there's
|
||||
// little point, really.
|
||||
|
||||
g_Config.memStickDirectory = Path(external_dir);
|
||||
g_Config.flash0Directory = Path(external_dir) / "flash0";
|
||||
|
||||
Path memstickDirFile = g_Config.internalDataDirectory / "memstick_dir.txt";
|
||||
if (File::Exists(memstickDirFile)) {
|
||||
INFO_LOG(SYSTEM, "Reading '%s' to find memstick dir.", memstickDirFile.c_str());
|
||||
std::string memstickDir;
|
||||
if (File::ReadFileToString(true, memstickDirFile, memstickDir)) {
|
||||
Path memstickPath(memstickDir);
|
||||
@@ -529,15 +538,14 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
} else {
|
||||
ERROR_LOG(SYSTEM, "Couldn't read directory '%s' specified by memstick_dir.txt.", memstickDir.c_str());
|
||||
if (System_GetPropertyBool(SYSPROP_ANDROID_SCOPED_STORAGE)) {
|
||||
// TODO: Gotta resolve this somehow...
|
||||
// I think we wanna pop up the memstick dir chooser before any other screen in this case.
|
||||
// For now we just choose a default.
|
||||
g_Config.memStickDirectory = g_Config.defaultCurrentDirectory;
|
||||
// Ask the user to configure a memstick directory.
|
||||
INFO_LOG(SYSTEM, "Asking the user.");
|
||||
g_Config.memStickDirectory.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
INFO_LOG(SYSTEM, "No memstick directory file found. Using '%s'", memstickDirFile.c_str());
|
||||
INFO_LOG(SYSTEM, "No memstick directory file found (tried to open '%s')", memstickDirFile.c_str());
|
||||
}
|
||||
|
||||
#elif PPSSPP_PLATFORM(IOS)
|
||||
@@ -572,8 +580,9 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
DiskCachingFileLoaderCache::SetCacheDir(g_Config.appCacheDirectory);
|
||||
}
|
||||
|
||||
if (!LogManager::GetInstance())
|
||||
if (!LogManager::GetInstance()) {
|
||||
LogManager::Init(&g_Config.bEnableLogging);
|
||||
}
|
||||
|
||||
#if !PPSSPP_PLATFORM(WINDOWS)
|
||||
g_Config.SetSearchPath(GetSysDirectory(DIRECTORY_SYSTEM));
|
||||
@@ -585,11 +594,6 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
|
||||
LogManager *logman = LogManager::GetInstance();
|
||||
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
// On early versions of Android we don't need to ask permission.
|
||||
CreateDirectoriesAndroid();
|
||||
#endif
|
||||
|
||||
const char *fileToLog = 0;
|
||||
Path stateToLoad;
|
||||
|
||||
@@ -681,7 +685,14 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
}
|
||||
}
|
||||
if (okToLoad) {
|
||||
boot_filename = Path(std::string(argv[i]));
|
||||
std::string str = std::string(argv[i]);
|
||||
// Handle file:/// URIs, since you get those when creating shortcuts on some Android systems.
|
||||
if (startsWith(str, "file:///")) {
|
||||
str = UriDecode(str.substr(7));
|
||||
INFO_LOG(IO, "Decoding '%s' to '%s'", argv[i], str.c_str());
|
||||
}
|
||||
|
||||
boot_filename = Path(str);
|
||||
skipLogo = true;
|
||||
}
|
||||
if (okToLoad && okToCheck) {
|
||||
@@ -785,8 +796,13 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
});
|
||||
}
|
||||
|
||||
DEBUG_LOG(SYSTEM, "ScreenManager!");
|
||||
screenManager = new ScreenManager();
|
||||
if (gotoGameSettings) {
|
||||
if (g_Config.memStickDirectory.empty()) {
|
||||
INFO_LOG(SYSTEM, "No memstick directory! Asking for one to be configured.");
|
||||
screenManager->switchScreen(new LogoScreen(false));
|
||||
screenManager->push(new MemStickScreen(true));
|
||||
} else if (gotoGameSettings) {
|
||||
screenManager->switchScreen(new LogoScreen(true));
|
||||
} else if (gotoTouchScreenTest) {
|
||||
screenManager->switchScreen(new MainScreen());
|
||||
@@ -832,7 +848,6 @@ static UI::Style MakeStyle(uint32_t fg, uint32_t bg) {
|
||||
UI::Style s;
|
||||
s.background = UI::Drawable(bg);
|
||||
s.fgColor = fg;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -1246,6 +1261,10 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) {
|
||||
PostLoadConfig();
|
||||
g_Config.iGPUBackend = gpuBackend;
|
||||
}
|
||||
if (msg == "app_resumed" || msg == "got_focus") {
|
||||
// Assume that the user may have modified things.
|
||||
MemoryStick_NotifyWrite();
|
||||
}
|
||||
}
|
||||
|
||||
void NativeUpdate() {
|
||||
@@ -1354,13 +1373,27 @@ bool NativeAxis(const AxisInput &axis) {
|
||||
// This is static, since we need to remember where we last were (in terms of orientation)
|
||||
static Tilt currentTilt;
|
||||
|
||||
// tilt on x or y?
|
||||
static bool verticalTilt;
|
||||
if (g_Config.iTiltOrientation == 0)
|
||||
verticalTilt = false;
|
||||
else if (g_Config.iTiltOrientation == 1)
|
||||
verticalTilt = true;
|
||||
|
||||
// x and y are flipped if we are in landscape orientation. The events are
|
||||
// sent with respect to the portrait coordinate system, while we
|
||||
// take all events in landscape.
|
||||
// see [http://developer.android.com/guide/topics/sensors/sensors_overview.html] for details
|
||||
bool portrait = dp_yres > dp_xres;
|
||||
switch (axis.axisId) {
|
||||
//TODO: make this generic.
|
||||
case JOYSTICK_AXIS_ACCELEROMETER_X:
|
||||
if (verticalTilt) {
|
||||
if (fabs(axis.value) < 0.8f && g_Config.iTiltOrientation == 2) // Auto tilt switch
|
||||
verticalTilt = false;
|
||||
else
|
||||
return false; // Tilt on Z instead
|
||||
}
|
||||
if (portrait) {
|
||||
currentTilt.x_ = axis.value;
|
||||
} else {
|
||||
@@ -1377,9 +1410,18 @@ bool NativeAxis(const AxisInput &axis) {
|
||||
break;
|
||||
|
||||
case JOYSTICK_AXIS_ACCELEROMETER_Z:
|
||||
//don't handle this now as only landscape is enabled.
|
||||
//TODO: make this generic.
|
||||
return false;
|
||||
if (!verticalTilt) {
|
||||
if (fabs(axis.value) < 0.8f && g_Config.iTiltOrientation == 2) // Auto tilt switch
|
||||
verticalTilt = true;
|
||||
else
|
||||
return false; // Tilt on X instead
|
||||
}
|
||||
if (portrait) {
|
||||
currentTilt.x_ = -axis.value;
|
||||
} else {
|
||||
currentTilt.y_ = -axis.value;
|
||||
}
|
||||
break;
|
||||
|
||||
case JOYSTICK_AXIS_OUYA_UNKNOWN1:
|
||||
case JOYSTICK_AXIS_OUYA_UNKNOWN2:
|
||||
@@ -1477,6 +1519,8 @@ void NativeShutdown() {
|
||||
logger = nullptr;
|
||||
}
|
||||
|
||||
g_threadManager.Teardown();
|
||||
|
||||
// Previously we did exit() here on Android but that makes it hard to do things like restart on backend change.
|
||||
// I think we handle most globals correctly or correct-enough now.
|
||||
}
|
||||
Reference in new issue
Block a user