misc: fix stuff up to make SDL example work again

it still behaves weirdly, should probably find some
other example since I don't trust my own code.
This commit is contained in:
Mis012
2023-10-29 22:47:57 +01:00
parent 9025142bdd
commit 0b0cfed345
8 changed files with 25 additions and 11 deletions

View File

@@ -464,11 +464,14 @@ public final class AssetManager {
throw new RuntimeException("Assetmanager has been closed");
}
asset = openAsset(fileName, 0);
if (asset < 0)
throw new FileNotFoundException("Asset file: " + fileName + ", errno: " + asset);
FileDescriptor fd = new FileDescriptor();
fd.setInt$(asset);
ParcelFileDescriptor pfd = new ParcelFileDescriptor(fd);
if (pfd != null) {
AssetFileDescriptor afd = new AssetFileDescriptor(pfd, mOffsets[0], mOffsets[1]);
AssetFileDescriptor afd = new AssetFileDescriptor(pfd, 0, getAssetLength(asset));
afd.fileName = "/assets/" + fileName;
return afd;
}
@@ -860,7 +863,9 @@ public final class AssetManager {
/*package*/ /*native*/ final String getResourceName(int resid) {
return tableBlockSearch(resid).pickOne().getName();
}
/*package*/ native final String getResourcePackageName(int resid);
/*package*/ /*native*/ final String getResourcePackageName(int resid) {
return tableBlockSearch(resid).pickOne().getPackageName();
}
/*package*/ /*native*/ final String getResourceTypeName(int resid) {
return tableBlockSearch(resid).pickOne().getTypeName();
}