Merge pull request #21299 from hrydgard/assorted-fixes

Code cleanup and minor UI fixes
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2026-02-25 02:03:03 +01:00
commit 253eddc593
29 files changed
+102 -153

No files matched your search

+1 -1
View File
@@ -30,7 +30,7 @@ void BlobFileSystem::DoState(PointerWrap &p) {
// Not used in real emulation.
}
std::vector<PSPFileInfo> BlobFileSystem::GetDirListing(const std::string &path, bool *exists) {
std::vector<PSPFileInfo> BlobFileSystem::GetDirListing(std::string_view path, bool *exists) {
std::vector<PSPFileInfo> listing;
listing.push_back(GetFileInfo(alias_));
if (exists)
+1 -1
View File
@@ -34,7 +34,7 @@ public:
~BlobFileSystem();
void DoState(PointerWrap &p) override;
std::vector<PSPFileInfo> GetDirListing(const std::string &path, bool *exists = nullptr) override;
std::vector<PSPFileInfo> GetDirListing(std::string_view path, bool *exists = nullptr) override;
int OpenFile(std::string filename, FileAccess access, const char *devicename = nullptr) override;
void CloseFile(u32 handle) override;
size_t ReadFile(u32 handle, u8 *pointer, s64 size) override;
+3 -3
View File
@@ -873,7 +873,7 @@ bool DirectoryFileSystem::ComputeRecursiveDirSizeIfFast(const std::string &path,
}
}
std::vector<PSPFileInfo> DirectoryFileSystem::GetDirListing(const std::string &path, bool *exists) {
std::vector<PSPFileInfo> DirectoryFileSystem::GetDirListing(std::string_view path, bool *exists) {
std::vector<PSPFileInfo> myVector;
std::vector<File::FileInfo> files;
@@ -884,7 +884,7 @@ std::vector<PSPFileInfo> DirectoryFileSystem::GetDirListing(const std::string &p
if (this->flags & FileSystemFlags::CASE_SENSITIVE) {
if (!success) {
// TODO: Case sensitivity should be checked on a file system basis, right?
std::string fixedPath = path;
std::string fixedPath(path);
if (FixPathCase(basePath, fixedPath, FPC_FILE_MUST_EXIST)) {
// May have failed due to case sensitivity, try again
localPath = GetLocalPath(fixedPath);
@@ -1204,7 +1204,7 @@ size_t VFSFileSystem::SeekFile(u32 handle, s32 position, FileMove type) {
}
}
std::vector<PSPFileInfo> VFSFileSystem::GetDirListing(const std::string &path, bool *exists) {
std::vector<PSPFileInfo> VFSFileSystem::GetDirListing(std::string_view path, bool *exists) {
std::vector<PSPFileInfo> myVector;
// TODO
if (exists)
+2 -2
View File
@@ -67,7 +67,7 @@ public:
void CloseAll();
void DoState(PointerWrap &p) override;
std::vector<PSPFileInfo> GetDirListing(const std::string &path, bool *exists = nullptr) override;
std::vector<PSPFileInfo> GetDirListing(std::string_view path, bool *exists = nullptr) override;
int OpenFile(std::string filename, FileAccess access, const char *devicename = nullptr) override;
void CloseFile(u32 handle) override;
size_t ReadFile(u32 handle, u8 *pointer, s64 size) override;
@@ -115,7 +115,7 @@ public:
~VFSFileSystem();
void DoState(PointerWrap &p) override;
std::vector<PSPFileInfo> GetDirListing(const std::string &path, bool *exists = nullptr) override;
std::vector<PSPFileInfo> GetDirListing(std::string_view path, bool *exists = nullptr) override;
int OpenFile(std::string filename, FileAccess access, const char *devicename = nullptr) override;
void CloseFile(u32 handle) override;
size_t ReadFile(u32 handle, u8 *pointer, s64 size) override;
+2 -2
View File
@@ -134,7 +134,7 @@ public:
virtual ~IFileSystem() {}
virtual void DoState(PointerWrap &p) = 0;
virtual std::vector<PSPFileInfo> GetDirListing(const std::string &path, bool *exists = nullptr) = 0;
virtual std::vector<PSPFileInfo> GetDirListing(std::string_view path, bool *exists = nullptr) = 0;
virtual int OpenFile(std::string filename, FileAccess access, const char *devicename = nullptr) = 0;
virtual void CloseFile(u32 handle) = 0;
virtual size_t ReadFile(u32 handle, u8 *pointer, s64 size) = 0;
@@ -161,7 +161,7 @@ public:
class EmptyFileSystem : public IFileSystem {
public:
void DoState(PointerWrap &p) override {}
std::vector<PSPFileInfo> GetDirListing(const std::string &path, bool *exists = nullptr) override {
std::vector<PSPFileInfo> GetDirListing(std::string_view path, bool *exists = nullptr) override {
if (exists)
*exists = false;
std::vector<PSPFileInfo> vec;
+5 -4
View File
@@ -22,6 +22,7 @@
#include "Common/CommonTypes.h"
#include "Common/Serialize/Serializer.h"
#include "Common/Serialize/SerializeFuncs.h"
#include "Common/StringUtils.h"
#include "Core/FileSystems/ISOFileSystem.h"
#include "Core/HLE/sceKernel.h"
#include "Core/MemMap.h"
@@ -33,11 +34,11 @@ bool parseLBN(const std::string &filename, u32 *sectorStart, u32 *readSize) {
// The format of this is: "/sce_lbn" "0x"? HEX* ANY* "_size" "0x"? HEX* ANY*
// That means that "/sce_lbn/_size1/" is perfectly valid.
// Most commonly, it looks like /sce_lbn0x10_size0x100 or /sce_lbn10_size100 (always hex.)
// If it doesn't starts with /sce_lbn or doesn't have _size, look for a file instead.
if (filename.compare(0, sizeof("/sce_lbn") - 1, "/sce_lbn") != 0)
if (!startsWith(filename, "/sce_lbn"))
return false;
size_t size_pos = filename.find("_size");
const size_t size_pos = filename.find("_size");
if (size_pos == filename.npos)
return false;
@@ -658,7 +659,7 @@ PSPFileInfo ISOFileSystem::GetFileInfoByHandle(u32 handle) {
return x;
}
std::vector<PSPFileInfo> ISOFileSystem::GetDirListing(const std::string &path, bool *exists) {
std::vector<PSPFileInfo> ISOFileSystem::GetDirListing(std::string_view path, bool *exists) {
std::vector<PSPFileInfo> myVector;
const TreeEntry *entry = GetFromPath(path);
if (!entry) {
+2 -2
View File
@@ -32,7 +32,7 @@ public:
~ISOFileSystem();
void DoState(PointerWrap &p) override;
std::vector<PSPFileInfo> GetDirListing(const std::string &path, bool *exists = nullptr) override;
std::vector<PSPFileInfo> GetDirListing(std::string_view path, bool *exists = nullptr) override;
int OpenFile(std::string filename, FileAccess access, const char *devicename = nullptr) override;
void CloseFile(u32 handle) override;
size_t ReadFile(u32 handle, u8 *pointer, s64 size) override;
@@ -114,7 +114,7 @@ public:
isoFileSystem_->DoState(p);
}
std::vector<PSPFileInfo> GetDirListing(const std::string &path, bool *exists = nullptr) override {
std::vector<PSPFileInfo> GetDirListing(std::string_view path, bool *exists = nullptr) override {
if (exists)
*exists = true;
return std::vector<PSPFileInfo>();
+1 -1
View File
@@ -364,7 +364,7 @@ PSPFileInfo MetaFileSystem::GetFileInfoByHandle(u32 handle) {
return PSPFileInfo();
}
std::vector<PSPFileInfo> MetaFileSystem::GetDirListing(const std::string &path, bool *exists) {
std::vector<PSPFileInfo> MetaFileSystem::GetDirListing(std::string_view path, bool *exists) {
std::lock_guard<std::recursive_mutex> guard(lock);
std::string of;
IFileSystem *system;
+1 -1
View File
@@ -109,7 +109,7 @@ public:
std::string NormalizePrefix(std::string_view prefix) const;
std::vector<PSPFileInfo> GetDirListing(const std::string &path, bool *exists = nullptr) override;
std::vector<PSPFileInfo> GetDirListing(std::string_view path, bool *exists = nullptr) override;
int OpenFile(std::string filename, FileAccess access, const char *devicename = nullptr) override;
void CloseFile(u32 handle) override;
size_t ReadFile(u32 handle, u8 *pointer, s64 size) override;
+7 -7
View File
@@ -652,7 +652,7 @@ static void tmFromFiletime(tm &dest, const FILETIME &src)
}
#endif
std::vector<PSPFileInfo> VirtualDiscFileSystem::GetDirListing(const std::string &path, bool *exists) {
std::vector<PSPFileInfo> VirtualDiscFileSystem::GetDirListing(std::string_view pathStr, bool *exists) {
std::vector<PSPFileInfo> myVector;
// TODO(scoped): Switch this over to GetFilesInDir!
@@ -663,7 +663,7 @@ std::vector<PSPFileInfo> VirtualDiscFileSystem::GetDirListing(const std::string
// TODO: Handler files that are virtual might not be listed.
std::wstring w32path = GetLocalPath(path).ToWString() + L"\\*.*";
std::wstring w32path = GetLocalPath(pathStr).ToWString() + L"\\*.*";
#if PPSSPP_PLATFORM(UWP)
hFind = FindFirstFileExFromAppW(w32path.c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, NULL, 0);
@@ -700,7 +700,7 @@ std::vector<PSPFileInfo> VirtualDiscFileSystem::GetDirListing(const std::string
tmFromFiletime(entry.mtime, findData.ftLastWriteTime);
entry.isOnSectorSystem = true;
std::string fullRelativePath = path + "/" + entry.name;
std::string fullRelativePath = std::string(pathStr) + "/" + entry.name;
int fileIndex = getFileListIndex(fullRelativePath);
if (fileIndex != -1)
entry.startSector = fileList[fileIndex].firstBlock;
@@ -709,11 +709,11 @@ std::vector<PSPFileInfo> VirtualDiscFileSystem::GetDirListing(const std::string
FindClose(hFind);
#else
dirent *dirp;
Path localPath = GetLocalPath(path);
Path localPath = GetLocalPath(pathStr);
DIR *dp = opendir(localPath.c_str());
#if HOST_IS_CASE_SENSITIVE
std::string fixedPath = path;
std::string fixedPath(pathStr);
if(dp == NULL && FixPathCase(basePath, fixedPath, FPC_FILE_MUST_EXIST)) {
// May have failed due to case sensitivity, try again
localPath = GetLocalPath(fixedPath);
@@ -722,7 +722,7 @@ std::vector<PSPFileInfo> VirtualDiscFileSystem::GetDirListing(const std::string
#endif
if (dp == NULL) {
ERROR_LOG(Log::FileSystem,"Error opening directory %s\n", path.c_str());
ERROR_LOG(Log::FileSystem,"Error opening directory %.*s\n", STR_VIEW(pathStr));
if (exists)
*exists = false;
return myVector;
@@ -753,7 +753,7 @@ std::vector<PSPFileInfo> VirtualDiscFileSystem::GetDirListing(const std::string
localtime_r((time_t*)&s.st_mtime,&entry.mtime);
entry.isOnSectorSystem = true;
std::string fullRelativePath = path + "/" + entry.name;
std::string fullRelativePath = std::string(pathStr) + "/" + entry.name;
int fileIndex = getFileListIndex(fullRelativePath);
if (fileIndex != -1)
entry.startSector = fileList[fileIndex].firstBlock;
+1 -1
View File
@@ -43,7 +43,7 @@ public:
bool OwnsHandle(u32 handle) override;
int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override;
PSPDevType DevType(u32 handle) override;
std::vector<PSPFileInfo> GetDirListing(const std::string &path, bool *exists = nullptr) override;
std::vector<PSPFileInfo> GetDirListing(std::string_view path, bool *exists = nullptr) override;
FileSystemFlags Flags() const override { return FileSystemFlags::UMD; }
u64 FreeDiskSpace(const std::string &path) override { return 0; }
+8 -6
View File
@@ -69,8 +69,7 @@ void JitBlock::DoIntegrityCheck(u32 emAddress, int num, const char *reason) cons
_assert_msg_(sentinel == SENTINEL_VAL, "%s: Block %d(%d) sentinel got corrupted: %08x != %08x (origAddr: %08x)", reason, num, blockNum, sentinel, SENTINEL_VAL, originalAddress);
}
JitBlockCache::JitBlockCache(MIPSState *mipsState, CodeBlockCommon *codeBlock) : codeBlock_(codeBlock) {
}
JitBlockCache::JitBlockCache(MIPSState *mipsState, CodeBlockCommon *codeBlock) : codeBlock_(codeBlock) {}
JitBlockCache::~JitBlockCache() {
Shutdown();
@@ -117,7 +116,9 @@ void JitBlockCache::Reset() {
int JitBlockCache::AllocateBlock(u32 startAddress) {
_assert_(num_blocks_ < MAX_NUM_BLOCKS);
JitBlock &b = blocks_[num_blocks_];
const int numBlocks = num_blocks_;
JitBlock &b = blocks_[numBlocks];
b.invalid = false;
b.originalAddress = startAddress;
@@ -126,10 +127,11 @@ int JitBlockCache::AllocateBlock(u32 startAddress) {
b.exitPtrs[i] = 0;
b.linkStatus[i] = false;
}
b.blockNum = num_blocks_;
b.blockNum = numBlocks;
b.sentinel = SENTINEL_VAL;
num_blocks_++; //commit the current block
return num_blocks_ - 1;
num_blocks_ = numBlocks + 1; //commit the current block
return numBlocks;
}
void JitBlockCache::AddBlockMap(int block_num) {
+1 -2
View File
@@ -191,10 +191,9 @@ private:
MIPSOpcode GetEmuHackOpForBlock(int block_num) const;
int num_blocks_ = 0;
CodeBlockCommon *codeBlock_;
JitBlock *blocks_ = nullptr;
int num_blocks_ = 0;
std::unordered_multimap<u32, int> links_to_;
std::map<std::pair<u32,u32>, u32> block_map_; // (end_addr, start_addr) -> number
+2 -6
View File
@@ -335,7 +335,7 @@ void GameScreen::CreateContentViews(UI::ViewGroup *parent) {
}
}
if (found) {
NoticeView *tvVerified = infoLayout->Add(new NoticeView(NoticeLevel::INFO, ga->T("ISO OK according to the ReDump project"), "", new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
NoticeView *tvVerified = infoLayout->Add(new NoticeView(NoticeLevel::INFO, ga->T("ISO OK according to the ReDump project"), "", new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT)));
tvVerified->SetLevel(NoticeLevel::SUCCESS);
}
}
@@ -359,17 +359,13 @@ void GameScreen::CreateContentViews(UI::ViewGroup *parent) {
// INFO_LOG(Log::Loader, "File size %d not matching game DB", (int)info_->gameSizeUncompressed);
}
NoticeView *tvVerified = infoLayout->Add(new NoticeView(NoticeLevel::INFO, ga->T("Click \"Calculate CRC\" to verify ISO"), "", new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
NoticeView *tvVerified = infoLayout->Add(new NoticeView(NoticeLevel::INFO, ga->T("Click \"Calculate CRC\" to verify ISO"), "", new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT)));
tvVerified->SetVisibility(UI::V_VISIBLE);
tvVerified->SetLevel(NoticeLevel::INFO);
}
}
}
NoticeView *tvVerified = infoLayout->Add(new NoticeView(NoticeLevel::INFO, ga->T("Click \"Calculate CRC\" to verify ISO"), "", new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
tvVerified->SetVisibility(UI::V_GONE);
tvVerified->SetSquishy(true);
// Show plugin info_, if any. Later might add checkboxes.
auto plugins = HLEPlugins::FindPlugins(info_->id, g_Config.sLanguageIni);
if (!plugins.empty()) {
+1 -1
View File
@@ -833,7 +833,7 @@ std::string GetConfirmExitMessage() {
return confirmMessage;
}
auto di = GetI18NCategory(I18NCat::DIALOG);
confirmMessage = ApplySafeSubstitutions(di->T("You haven't saved your progress for %1."), NiceTimeFormat((int)unsavedSeconds));
confirmMessage += ApplySafeSubstitutions(di->T("You haven't saved your progress for %1."), NiceTimeFormat((int)unsavedSeconds));
confirmMessage += '\n';
}
-4
View File
@@ -111,10 +111,6 @@
</intent-filter>
</activity>
<meta-data
android:name="xperiaplayoptimized_content"
android:resource="@mipmap/ic_launcher" />
<profileable android:shell="true" android:enabled="true" />
</application>
+1 -1
View File
@@ -62,7 +62,7 @@ dependencies {
// Will replace with a different plugin soon.
implementation("androidx.appcompat:appcompat:1.7.1")
implementation("androidx.documentfile:documentfile:1.1.0")
implementation("com.google.protobuf:protobuf-javalite:4.33.4")
implementation("com.google.protobuf:protobuf-javalite:4.33.5")
}
protobuf {
+6 -4
View File
@@ -125,9 +125,8 @@ static std::atomic<int> emuThreadState((int)EmuThreadState::DISABLED);
AndroidAudioState *g_audioState;
struct FrameCommand {
FrameCommand() {}
FrameCommand(std::string cmd, std::string prm) : command(cmd), params(prm) {}
FrameCommand() = default;
FrameCommand(std::string_view cmd, std::string_view param) : command(cmd), params(param) {}
std::string command;
std::string params;
};
@@ -354,7 +353,7 @@ static void PushCommand(std::string_view cmd, std::string_view param) {
// Android implementation of callbacks to the Java part of the app
void System_Toast(std::string_view text) {
PushCommand("toast", std::string(text));
PushCommand("toast", text);
}
void System_ShowKeyboard() {
@@ -372,6 +371,9 @@ void System_LaunchUrl(LaunchUrlType urlType, std::string_view url) {
case LaunchUrlType::BROWSER_URL: PushCommand("launchBrowser", url); break;
case LaunchUrlType::MARKET_URL: PushCommand("launchMarket", url); break;
case LaunchUrlType::EMAIL_ADDRESS: PushCommand("launchEmail", url); break;
// Can't really support the below well on Android...
case LaunchUrlType::LOCAL_FOLDER: break;
case LaunchUrlType::LOCAL_FILE: break;
}
}
@@ -3,6 +3,8 @@ package org.ppsspp.ppsspp;
import android.media.AudioManager;
import android.media.AudioManager.OnAudioFocusChangeListener;
import androidx.annotation.Keep;
public class AudioFocusChangeListener implements OnAudioFocusChangeListener {
// not used right now, but we may need to use it sometime. So just store it
// for now.
@@ -21,6 +23,7 @@ public class AudioFocusChangeListener implements OnAudioFocusChangeListener {
}
}
@Keep
public boolean hasAudioFocus() {
return hasAudioFocus;
}
+23 -24
View File
@@ -1,6 +1,5 @@
package org.ppsspp.ppsspp;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.ImageFormat;
import android.graphics.Rect;
@@ -13,6 +12,8 @@ import android.view.Display;
import android.view.Surface;
import android.view.WindowManager;
import androidx.annotation.Keep;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@@ -124,31 +125,28 @@ class CameraHelper {
return output;
}
private final Camera.PreviewCallback mPreviewCallback = new Camera.PreviewCallback() {
@Override
public void onPreviewFrame(byte[] previewData, Camera camera) {
// throttle at 16 ms
long currentTime = SystemClock.elapsedRealtime();
if (currentTime - mLastFrameTime < 16) {
return;
}
mLastFrameTime = currentTime;
private final Camera.PreviewCallback mPreviewCallback = (previewData, camera) -> {
// throttle at 16 ms
long currentTime = SystemClock.elapsedRealtime();
if (currentTime - mLastFrameTime < 16) {
return;
}
mLastFrameTime = currentTime;
int cameraRotation = getCameraRotation();
byte[] newPreviewData = rotateNV21(previewData, mPreviewSize.width, mPreviewSize.height,
mTargetWidth, mTargetHeight, cameraRotation);
YuvImage yuvImage = new YuvImage(newPreviewData, ImageFormat.NV21, mTargetWidth, mTargetHeight, null);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int cameraRotation = getCameraRotation();
byte[] newPreviewData = rotateNV21(previewData, mPreviewSize.width, mPreviewSize.height,
mTargetWidth, mTargetHeight, cameraRotation);
YuvImage yuvImage = new YuvImage(newPreviewData, ImageFormat.NV21, mTargetWidth, mTargetHeight, null);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
// convert to Jpeg
Rect crop = new Rect(0, 0, mTargetWidth, mTargetHeight);
yuvImage.compressToJpeg(crop, 80, baos);
NativeApp.pushCameraImageAndroid(baos.toByteArray());
try {
baos.close();
} catch (IOException e) {
Log.e(TAG,"Camera I/O exception: " + e);
}
// convert to Jpeg
Rect crop = new Rect(0, 0, mTargetWidth, mTargetHeight);
yuvImage.compressToJpeg(crop, 80, baos);
NativeApp.pushCameraImageAndroid(baos.toByteArray());
try {
baos.close();
} catch (IOException e) {
Log.e(TAG,"Camera I/O exception: " + e);
}
};
@@ -158,6 +156,7 @@ class CameraHelper {
mSurfaceTexture = new SurfaceTexture(10);
}
@Keep
static ArrayList<String> getDeviceList() {
ArrayList<String> deviceList = new ArrayList<>();
if (PpssppActivity.isVRDevice()) {
@@ -58,14 +58,6 @@ public class ContentUri {
}
}
private static final String[] columns = new String[] {
DocumentsContract.Document.COLUMN_DISPLAY_NAME,
DocumentsContract.Document.COLUMN_SIZE,
DocumentsContract.Document.COLUMN_FLAGS,
DocumentsContract.Document.COLUMN_MIME_TYPE, // check for MIME_TYPE_DIR
DocumentsContract.Document.COLUMN_LAST_MODIFIED
};
private static String cursorToString(Cursor c, String prefixLowercase) {
final int flags = c.getInt(2);
// Filter out any virtual or partial nonsense.
@@ -3,11 +3,8 @@ package org.ppsspp.ppsspp;
import android.content.Context;
import android.hardware.ConsumerIrManager;
import android.hardware.ConsumerIrManager.CarrierFrequencyRange;
import android.os.Build;
import android.util.Log;
import androidx.annotation.RequiresApi;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -1,6 +1,5 @@
package org.ppsspp.ppsspp;
import android.annotation.TargetApi;
import android.content.Context;
import android.location.GnssStatus;
import android.location.GpsSatellite;
@@ -16,8 +15,6 @@ import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import java.util.Iterator;
class LocationHelper implements LocationListener {
private static final String TAG = LocationHelper.class.getSimpleName();
private static final int GPGGA_ID_INDEX = 0;
@@ -37,7 +34,6 @@ class LocationHelper implements LocationListener {
mLocationEnable = false;
}
@SuppressWarnings("deprecation")
void startLocationUpdates() {
Log.d(TAG, "startLocationUpdates");
if (!mLocationEnable) {
@@ -56,22 +52,12 @@ class LocationHelper implements LocationListener {
}
};
mLocationManager.registerGnssStatusCallback(mGnssStatusCallback);
mNmeaMessageListener = new OnNmeaMessageListener() {
@Override
public void onNmeaMessage(String message, long timestamp) {
onNmea(message);
}
};
mNmeaMessageListener = (message, timestamp) -> onNmea(message);
mLocationManager.addNmeaListener(mNmeaMessageListener);
} else {
mGpsStatusListener = this::onGpsStatus;
mLocationManager.addGpsStatusListener(mGpsStatusListener);
mNmeaListener = new GpsStatus.NmeaListener() {
@Override
public void onNmeaReceived(long timestamp, String nmea) {
onNmea(nmea);
}
};
mNmeaListener = (timestamp, nmea) -> onNmea(nmea);
mLocationManager.addNmeaListener(mNmeaListener);
}
mLocationEnable = true;
@@ -85,7 +71,6 @@ class LocationHelper implements LocationListener {
}
}
@SuppressWarnings("deprecation")
void stopLocationUpdates() {
Log.d(TAG, "stopLocationUpdates");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
@@ -2,7 +2,6 @@ package org.ppsspp.ppsspp;
// Note that the display* methods are in NativeRenderer.java
import android.annotation.SuppressLint;
import android.os.Build;
import android.util.Log;
import android.view.InputDevice;
@@ -1240,7 +1240,7 @@ public class PpssppActivity extends AppCompatActivity implements SensorEventList
char c = (char) unicode;
Log.i(TAG, "Key char event " + unicode);
// Handle alphanumeric character
NativeApp.keyChar(NativeApp.DEVICE_ID_KEYBOARD, (int)c);
NativeApp.keyChar(NativeApp.DEVICE_ID_KEYBOARD, c);
return true;
}
@@ -1507,7 +1507,7 @@ public class PpssppActivity extends AppCompatActivity implements SensorEventList
@RequiresApi(Build.VERSION_CODES.M)
private AlertDialog.Builder createDialogBuilderNew() {
return new AlertDialog.Builder(this, android.R.style.Theme_DeviceDefault_Dialog_Alert);
return new AlertDialog.Builder(this, android.R.style.Theme_Material_Dialog_Alert);
}
private AlertDialog.Builder createDialogBuilder() {
@@ -1533,7 +1533,6 @@ public class PpssppActivity extends AppCompatActivity implements SensorEventList
input.setText(defaultText);
input.setFocusableInTouchMode(true);
input.requestFocus();
input.selectAll();
//input.setSelection(input.getText().length());
@@ -1545,9 +1544,7 @@ public class PpssppActivity extends AppCompatActivity implements SensorEventList
NativeApp.sendRequestResult(requestId, true, input.getText().toString(), 0);
// Dismiss happens automatically.
})
.setNegativeButton("Cancel", (d, which) -> {
d.cancel();
});
.setNegativeButton("Cancel", (d, which) -> d.cancel());
builder.setOnDismissListener( d -> {
Log.i(TAG, "input box dismissed");
// This will be ignored if we already sent a success.
@@ -1951,12 +1948,9 @@ public class PpssppActivity extends AppCompatActivity implements SensorEventList
public void postCommand(String command, String parameter) {
final String cmd = command;
final String param = parameter;
runOnUiThread(new Runnable() {
@Override
public void run() {
if (!processCommand(cmd, param)) {
Log.e(TAG, "processCommand failed: cmd: '" + cmd + "' param: '" + param + "'");
}
runOnUiThread(() -> {
if (!processCommand(cmd, param)) {
Log.e(TAG, "processCommand failed: cmd: '" + cmd + "' param: '" + param + "'");
}
});
}
@@ -74,19 +74,17 @@ public class SimpleFileChooser {
// Comparator for Arrays.sort(). Separate folders from files, order
// alphabetically, ignore case.
private final Comparator<File> fileArrayComparator = new Comparator<>() {
public int compare(File file1, File file2) {
if (file1 == null || file2 == null) // if either null, assume equal
return 0;
// put folder first before file
else if (file1.isDirectory() && (!file2.isDirectory()))
return -1;
else if (file2.isDirectory() && (!file1.isDirectory()))
return 1;
else
// when both are folders or both are files, sort by name
return file1.getName().toUpperCase(Locale.ROOT).compareTo(file2.getName().toUpperCase(Locale.ROOT));
}
private final Comparator<File> fileArrayComparator = (file1, file2) -> {
if (file1 == null || file2 == null) // if either null, assume equal
return 0;
// put folder first before file
else if (file1.isDirectory() && (!file2.isDirectory()))
return -1;
else if (file2.isDirectory() && (!file1.isDirectory()))
return 1;
else
// when both are folders or both are files, sort by name
return file1.getName().toUpperCase(Locale.ROOT).compareTo(file2.getName().toUpperCase(Locale.ROOT));
};
// Event when user click item on dialog
+10 -19
View File
@@ -1,9 +1,7 @@
package org.ppsspp.ppsspp;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.Point;
import android.os.Build;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
@@ -11,10 +9,6 @@ import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import androidx.annotation.RequiresApi;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
public class SizeManager implements SurfaceHolder.Callback {
private static final String TAG = "PPSSPPSizeManager";
@@ -106,7 +100,7 @@ public class SizeManager implements SurfaceHolder.Callback {
Log.v(TAG, "surfaceChanged: isCreating:" + holder.isCreating() + " holder: " + holder);
if (holder.isCreating() && desiredSize.x > 0 && desiredSize.y > 0) {
// We have called setFixedSize which will trigger another surfaceChanged after the initial
// one. This one is the original one and we don't care about it.
// one. This one is the original one, and we don't care about it.
Log.w(TAG, "holder.isCreating = true, ignoring. width=" + width + " height=" + height + " desWidth=" + desiredSize.x + " desHeight=" + desiredSize.y);
// TODO: Should we still set earlySurface here, to be sure?
@@ -171,18 +165,15 @@ public class SizeManager implements SurfaceHolder.Callback {
}
public void setupSystemUiCallback(final View view) {
view.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
// Called when the system UI's visibility changes, regardless of
// whether it's because of our or system actions.
// We will try to force it to follow our preference but will not stupidly
// act as if it's visible if it's not.
navigationHidden = ((visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) != 0);
// TODO: Check here if it's the state we want.
Log.i(TAG, "SystemUiVisibilityChange! visibility=" + visibility + " navigationHidden: " + navigationHidden + " decorView: " + view.getWidth() + "x" + view.getHeight());
checkDisplayMeasurements();
}
view.setOnSystemUiVisibilityChangeListener(visibility -> {
// Called when the system UI's visibility changes, regardless of
// whether it's because of our or system actions.
// We will try to force it to follow our preference but will not stupidly
// act as if it's visible if it's not.
navigationHidden = ((visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) != 0);
// TODO: Check here if it's the state we want.
Log.i(TAG, "SystemUiVisibilityChange! visibility=" + visibility + " navigationHidden: " + navigationHidden + " decorView: " + view.getWidth() + "x" + view.getHeight());
checkDisplayMeasurements();
});
}
@@ -10,11 +10,6 @@ import androidx.annotation.Keep;
import java.util.HashMap;
public class TextRenderer {
private static class Font {
public Paint paint;
public Typeface typeFace;
}
private static Paint textPaint = null;
private static final Paint bg;
@@ -22,7 +17,7 @@ public class TextRenderer {
private static int idGen = 1;
private static HashMap<java.lang.Integer, Typeface> fontMap = new HashMap<>();
private static final HashMap<java.lang.Integer, Typeface> fontMap = new HashMap<>();
private static boolean highContrastFontsEnabled = false;
+1 -1
View File
@@ -3,6 +3,6 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-all.zip
android.useAndroidX=true
android.enableJetifier=true