Permalink
Browse files

Qt: Remove bundled assets reader.

It was no longer being used or linked, so it just meant the assets were missing.
With this removed, the assets (lang inis, shaders, etc.) are available again.

Fixes #9831 - likely broken since #9061, which stopped using the qrc.
  • Loading branch information...
unknownbrackets committed Jun 9, 2018
1 parent d1b06bb commit a6767216837e535bb5e9a9781772a160651146b3
Showing with 2 additions and 92 deletions.
  1. +1 −1 CMakeLists.txt
  2. +0 −16 Qt/desktop_assets.qrc
  3. +1 −3 UI/NativeApp.cpp
  4. +0 −57 ext/native/file/zip_read.cpp
  5. +0 −15 ext/native/file/zip_read.h
View
@@ -763,7 +763,7 @@ elseif(USING_QT_UI)
Qt/mainwindow.h
)
add_definitions(-DUSING_QT_UI)
include_directories(${CMAKE_CURRENT_BINARY_DIR} Qt Qt/Debugger)
include_directories(${CMAKE_CURRENT_BINARY_DIR} Qt)
set(nativeExtraLibs ${nativeExtraLibs} Qt5::OpenGL Qt5::Gui Qt5::Core)
set(TargetBin PPSSPPQt)
View

This file was deleted.

Oops, something went wrong.
View
@@ -360,9 +360,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
#endif
// We want this to be FIRST.
#ifdef USING_QT_UI
VFSRegister("", new AssetsAssetReader());
#elif defined(IOS)
#if defined(IOS)
// Packed assets are included in app
VFSRegister("", new DirectoryAssetReader(external_dir));
#endif
@@ -3,11 +3,6 @@
#include <set>
#include <stdio.h>
#ifdef USING_QT_UI
#include <QFileInfo>
#include <QDir>
#endif
#ifdef __ANDROID__
#include <zip.h>
#endif
@@ -66,58 +61,6 @@ uint8_t *ReadLocalFile(const char *filename, size_t *size) {
return contents;
}
#ifdef USING_QT_UI
uint8_t *AssetsAssetReader::ReadAsset(const char *path, size_t *size) {
QFile asset(QString(":/assets/") + path);
if (!asset.open(QIODevice::ReadOnly))
return 0;
uint8_t *contents = new uint8_t[asset.size()+1];
memcpy(contents, (uint8_t*)asset.readAll().data(), asset.size());
contents[asset.size()] = 0;
*size = asset.size();
asset.close();
return contents;
}
bool AssetsAssetReader::GetFileListing(const char *path, std::vector<FileInfo> *listing, const char *filter = 0)
{
QDir assetDir(QString(":/assets/") + path);
QStringList filters = QString(filter).split(':', QString::SkipEmptyParts);
for (int i = 0; i < filters.count(); i++)
filters[i].prepend("*.");
QFileInfoList infoList = assetDir.entryInfoList(filters, QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Files, QDir::Name);
foreach(QFileInfo qinfo, infoList) {
FileInfo info;
info.name = qinfo.fileName().toStdString();
info.fullName = qinfo.absoluteFilePath().remove(":/assets/").toStdString();
info.exists = true;
info.isWritable = false;
info.isDirectory = qinfo.isDir();
listing->push_back(info);
}
return true;
}
bool AssetsAssetReader::GetFileInfo(const char *path, FileInfo *info) {
QFileInfo qinfo(QString(":/assets/") + path);
if (!qinfo.exists()) {
info->exists = false;
info->size = 0;
return false;
}
info->fullName = path;
info->exists = true;
info->isWritable = false;
info->isDirectory = qinfo.isDir();
info->size = qinfo.size();
return true;
}
#endif
#ifdef __ANDROID__
ZipAssetReader::ZipAssetReader(const char *zip_file, const char *in_zip_path) {
View
@@ -26,21 +26,6 @@ class AssetReader {
virtual std::string toString() const = 0;
};
#ifdef USING_QT_UI
class AssetsAssetReader : public AssetReader {
public:
AssetsAssetReader() {}
~AssetsAssetReader() {}
// use delete[]
virtual uint8_t *ReadAsset(const char *path, size_t *size);
virtual bool GetFileListing(const char *path, std::vector<FileInfo> *listing, const char *filter);
virtual bool GetFileInfo(const char *path, FileInfo *info);
virtual std::string toString() const {
return ":assets/";
}
};
#endif
#ifdef __ANDROID__
uint8_t *ReadFromZip(zip *archive, const char* filename, size_t *size);
class ZipAssetReader : public AssetReader {

0 comments on commit a676721

Please sign in to comment.