Display .7z files in file listings. Can't decompress them though.

This commit is contained in:
Henrik Rydgard 2014-10-21 00:09:24 +02:00
parent d24abb3af0
commit e6334dd9d8
8 changed files with 29 additions and 3 deletions

View File

@ -193,6 +193,8 @@ IdentifiedFileType Identify_File(std::string &filename)
return FILETYPE_ARCHIVE_RAR;
} else if (!strcasecmp(extension.c_str(),".r01")) {
return FILETYPE_ARCHIVE_RAR;
} else if (!strcasecmp(extension.substr(1).c_str(), ".7z")) {
return FILETYPE_ARCHIVE_7Z;
}
return FILETYPE_UNKNOWN;
}
@ -268,6 +270,14 @@ bool LoadFile(std::string &filename, std::string *error_string) {
#endif
break;
case FILETYPE_ARCHIVE_7Z:
#ifdef WIN32
*error_string = "7z file detected (Require 7-Zip)";
#else
*error_string = "7z file detected (Require 7-Zip)";
#endif
break;
case FILETYPE_ISO_MODE2:
*error_string = "PSX game image detected.";
break;

View File

@ -37,6 +37,7 @@ enum IdentifiedFileType {
// Try to reduce support emails...
FILETYPE_ARCHIVE_RAR,
FILETYPE_ARCHIVE_ZIP,
FILETYPE_ARCHIVE_7Z,
FILETYPE_PSP_PS1_PBP,
FILETYPE_ISO_MODE2,

View File

@ -445,6 +445,21 @@ handleELF:
}
break;
case FILETYPE_ARCHIVE_7Z:
info_->paramSFOLoaded = true;
{
// Read standard icon
size_t sz;
uint8_t *contents = VFSReadFile("7z.png", &sz);
if (contents) {
lock_guard lock(info_->lock);
info_->iconTextureData = std::string((const char *)contents, sz);
info_->iconDataLoaded = true;
}
delete[] contents;
}
break;
case FILETYPE_NORMAL_DIRECTORY:
default:
info_->paramSFOLoaded = true;

View File

@ -550,7 +550,7 @@ void GameBrowser::Refresh() {
// to a flood of support email...
if (allowBrowsing_) {
fileInfo.clear();
path_.GetListing(fileInfo, "zip:rar:r01:");
path_.GetListing(fileInfo, "zip:rar:r01:7z:");
if (!fileInfo.empty()) {
UI::LinearLayout *zl = new UI::LinearLayout(UI::ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
zl->SetSpacing(4.0f);

BIN
assets/7z.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

2
lang

@ -1 +1 @@
Subproject commit 0644f2d429ad2c3af2a80bed90bd1fe9d8240c37
Subproject commit e86e58ff6650d6a892e5ffb477691be6961a2363

2
native

@ -1 +1 @@
Subproject commit faca4e72ecd1f27531d635cf29420498cca36574
Subproject commit 428f338f28a2909a444e77888ccfce4e1eb55f47

BIN
source_assets/image/zip.pdn Normal file

Binary file not shown.