mirror of
https://github.com/izzy2lost/WeeU.git
synced 2026-07-06 00:19:59 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93b2c73e0c | ||
|
|
0c05c3e87f |
@@ -46,6 +46,7 @@ void decodeBC3Block_UNORM(uint8* inputData, float* imageRGBA);
|
|||||||
void decodeBC4Block_UNORM(uint8* blockStorage, float* rOutput);
|
void decodeBC4Block_UNORM(uint8* blockStorage, float* rOutput);
|
||||||
void decodeBC5Block_UNORM(uint8* blockStorage, float* rgOutput);
|
void decodeBC5Block_UNORM(uint8* blockStorage, float* rgOutput);
|
||||||
void decodeBC5Block_SNORM(uint8* blockStorage, float* rgOutput);
|
void decodeBC5Block_SNORM(uint8* blockStorage, float* rgOutput);
|
||||||
|
using decodingFn = void (uint8 *, float *);
|
||||||
|
|
||||||
inline void BC1_GetPixel(uint8* inputData, sint32 x, sint32 y, uint8 rgba[4])
|
inline void BC1_GetPixel(uint8* inputData, sint32 x, sint32 y, uint8 rgba[4])
|
||||||
{
|
{
|
||||||
@@ -2171,8 +2172,8 @@ public:
|
|||||||
*(outputPixel + 3) = 255;
|
*(outputPixel + 3) = 255;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
template<decodingFn fn>
|
||||||
class TextureDecoder_BC5_To_R8G8 : public TextureDecoder, public SingletonClass<TextureDecoder_BC5_To_R8G8>
|
class TextureDecoder_BC5_To_R8G8 : public TextureDecoder, public SingletonClass<TextureDecoder_BC5_To_R8G8<fn>>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -2192,7 +2193,7 @@ public:
|
|||||||
sint32 blockSizeY = (std::min)(4, textureLoader->height - y);
|
sint32 blockSizeY = (std::min)(4, textureLoader->height - y);
|
||||||
// decode 4x4 pixels at once
|
// decode 4x4 pixels at once
|
||||||
float rgBlock[4 * 4 * 2];
|
float rgBlock[4 * 4 * 2];
|
||||||
decodeBC5Block_UNORM(blockData, rgBlock);
|
fn(blockData, rgBlock);
|
||||||
|
|
||||||
for (sint32 py = 0; py < blockSizeY; py++)
|
for (sint32 py = 0; py < blockSizeY; py++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2579,7 +2579,7 @@ void VulkanRenderer::GetTextureFormatInfoVK(Latte::E_GX2SURFFMT format, bool isD
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
formatInfoOut->vkImageFormat = VK_FORMAT_R8G8_UNORM;
|
formatInfoOut->vkImageFormat = VK_FORMAT_R8G8_UNORM;
|
||||||
formatInfoOut->decoder = TextureDecoder_BC5_To_R8G8::getInstance();
|
formatInfoOut->decoder = TextureDecoder_BC5_To_R8G8<decodeBC5Block_UNORM>::getInstance();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Latte::E_GX2SURFFMT::BC5_SNORM:
|
case Latte::E_GX2SURFFMT::BC5_SNORM:
|
||||||
@@ -2591,7 +2591,7 @@ void VulkanRenderer::GetTextureFormatInfoVK(Latte::E_GX2SURFFMT format, bool isD
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
formatInfoOut->vkImageFormat = VK_FORMAT_R8G8_SNORM;
|
formatInfoOut->vkImageFormat = VK_FORMAT_R8G8_SNORM;
|
||||||
formatInfoOut->decoder = TextureDecoder_BC5_To_R8G8::getInstance();
|
formatInfoOut->decoder = TextureDecoder_BC5_To_R8G8<decodeBC5Block_SNORM>::getInstance();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Latte::E_GX2SURFFMT::R24_X8_UNORM:
|
case Latte::E_GX2SURFFMT::R24_X8_UNORM:
|
||||||
|
|||||||
@@ -112,8 +112,29 @@ public class DocumentsProvider extends android.provider.DocumentsProvider {
|
|||||||
@Override
|
@Override
|
||||||
public void deleteDocument(String documentId) throws FileNotFoundException {
|
public void deleteDocument(String documentId) throws FileNotFoundException {
|
||||||
var file = getFile(documentId);
|
var file = getFile(documentId);
|
||||||
|
if (file.isDirectory()) {
|
||||||
|
deleteFolder(file);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!file.delete())
|
if (!file.delete())
|
||||||
throw new FileNotFoundException("Couldn't delete document with ID '$documentId'");
|
throw new FileNotFoundException("Couldn't delete document with ID " + documentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteFolder(File dirFile) throws FileNotFoundException {
|
||||||
|
if (!dirFile.isDirectory())
|
||||||
|
return;
|
||||||
|
var files = dirFile.listFiles();
|
||||||
|
if (files == null) return;
|
||||||
|
for (var file : files) {
|
||||||
|
if (file.isDirectory()) {
|
||||||
|
deleteFolder(file);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!file.delete())
|
||||||
|
throw new FileNotFoundException("Couldn't delete file " + file.getPath());
|
||||||
|
}
|
||||||
|
if (!dirFile.delete())
|
||||||
|
throw new FileNotFoundException("Couldn't delete file " + dirFile.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -121,30 +142,32 @@ public class DocumentsProvider extends android.provider.DocumentsProvider {
|
|||||||
var parent = getFile(parentDocumentId);
|
var parent = getFile(parentDocumentId);
|
||||||
var file = getFile(documentId);
|
var file = getFile(documentId);
|
||||||
|
|
||||||
if (parent.equals(file) || file.getParentFile() == null || file.getParentFile().equals(parent)) {
|
if (!(parent.equals(file) || file.getParentFile() == null || file.getParentFile().equals(parent)))
|
||||||
if (!file.delete())
|
throw new FileNotFoundException("Couldn't delete document with ID " + documentId);
|
||||||
throw new FileNotFoundException("Couldn't delete document with ID '$documentId'");
|
if (file.isDirectory()) {
|
||||||
} else {
|
deleteFolder(file);
|
||||||
throw new FileNotFoundException("Couldn't delete document with ID '$documentId'");
|
return;
|
||||||
}
|
}
|
||||||
|
if (!file.delete())
|
||||||
|
throw new FileNotFoundException("Couldn't delete document with ID " + documentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String renameDocument(String documentId, String displayName) throws FileNotFoundException {
|
public String renameDocument(String documentId, String displayName) throws FileNotFoundException {
|
||||||
if (displayName == null)
|
if (displayName == null)
|
||||||
throw new FileNotFoundException("Couldn't rename document '$documentId' as the new name is null");
|
throw new FileNotFoundException("Couldn't rename document " + documentId + " as the new name is null");
|
||||||
|
|
||||||
var sourceFile = getFile(documentId);
|
var sourceFile = getFile(documentId);
|
||||||
var sourceParentFile = sourceFile.getParentFile();
|
var sourceParentFile = sourceFile.getParentFile();
|
||||||
if (sourceParentFile == null)
|
if (sourceParentFile == null)
|
||||||
throw new FileNotFoundException("Couldn't rename document '$documentId' as it has no parent");
|
throw new FileNotFoundException("Couldn't rename document '" + documentId + "' as it has no parent");
|
||||||
var destFile = resolve(sourceParentFile, displayName);
|
var destFile = resolve(sourceParentFile, displayName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!sourceFile.renameTo(destFile))
|
if (!sourceFile.renameTo(destFile))
|
||||||
throw new FileNotFoundException("Couldn't rename document from '${sourceFile.name}' to '${destFile.name}'");
|
throw new FileNotFoundException("Couldn't rename document from '" + sourceFile.getName() + "' to '" + destFile.getName() + "'");
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
throw new FileNotFoundException("Couldn't rename document from '${sourceFile.name}' to '${destFile.name}': ${e.message}");
|
throw new FileNotFoundException("Couldn't rename document from '" + sourceFile.getName() + "' to '" + destFile.getName() + "':" + exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return getDocumentId(destFile);
|
return getDocumentId(destFile);
|
||||||
@@ -167,7 +190,7 @@ public class DocumentsProvider extends android.provider.DocumentsProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException exception) {
|
} catch (IOException exception) {
|
||||||
throw new FileNotFoundException("Couldn't copy document '$sourceDocumentId': ${e.message}");
|
throw new FileNotFoundException("Couldn't copy document '" + sourceDocumentId + "': " + exception.getMessage());
|
||||||
}
|
}
|
||||||
return getDocumentId(newFile);
|
return getDocumentId(newFile);
|
||||||
}
|
}
|
||||||
@@ -179,7 +202,7 @@ public class DocumentsProvider extends android.provider.DocumentsProvider {
|
|||||||
removeDocument(sourceDocumentId, sourceParentDocumentId);
|
removeDocument(sourceDocumentId, sourceParentDocumentId);
|
||||||
return newDocumentId;
|
return newDocumentId;
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new FileNotFoundException("Couldn't move document '$sourceDocumentId'");
|
throw new FileNotFoundException("Couldn't move document '" + sourceDocumentId + "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +231,7 @@ public class DocumentsProvider extends android.provider.DocumentsProvider {
|
|||||||
|
|
||||||
private String copyDocument(String sourceDocumentId, String sourceParentDocumentId, String targetParentDocumentId) throws FileNotFoundException {
|
private String copyDocument(String sourceDocumentId, String sourceParentDocumentId, String targetParentDocumentId) throws FileNotFoundException {
|
||||||
if (!isChildDocument(sourceParentDocumentId, sourceDocumentId))
|
if (!isChildDocument(sourceParentDocumentId, sourceDocumentId))
|
||||||
throw new FileNotFoundException("Couldn't copy document '$sourceDocumentId' as its parent is not '$sourceParentDocumentId'");
|
throw new FileNotFoundException("Couldn't copy document '" + sourceDocumentId + "' as its parent is not '" + sourceParentDocumentId + "'");
|
||||||
return copyDocument(sourceDocumentId, targetParentDocumentId);
|
return copyDocument(sourceDocumentId, targetParentDocumentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user