Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes added in "Patching VPKs" #4

Merged
merged 2 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<button id="openSettingsButton" onclick="openSettingsPrompt()">Settings</button>
</div>
<div id="details">
<button id="detailsCloseButton" onclick="closeDetails()"><img src="img/close.svg" /></button>
<button id="detailsUnpackButton">Unpack</button>
<h2 class="title">Details</h2>
<p class="path">Path:<span style="font-size: 12px;"></span></p>
Expand Down
2 changes: 1 addition & 1 deletion main.css
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ body {
vertical-align: middle;
position: absolute;
top: 16px;
right: 64px;
right: 16px;
padding: 8px;
border: none;
cursor: pointer;
Expand Down
12 changes: 5 additions & 7 deletions renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async function selectVPK() {
fileTree.totalCompressed = Object.values(vpk.tree.files).reduce((p, c) => { return p + c.fileParts.reduce((a, b) => (a + b.entryLength), 0) }, 0);
fileTree.totalUncompressed = Object.values(vpk.tree.files).reduce((p, c) => { return p + c.fileParts.reduce((a, b) => (a + b.entryLengthUncompressed), 0) }, 0);

closeDetails();
showDirDetails(fileTree);
renderTree(fileTree);

isVpkOpen = true;
Expand Down Expand Up @@ -172,10 +172,6 @@ function renderDirs(dirs, parentEl) {
})
}

function closeDetails() {
document.querySelector("#details").classList.remove("visible");
}

function showDirDetails(d) {
console.log("Show details:", d);
document.querySelector("#details").classList.add("visible");
Expand Down Expand Up @@ -226,7 +222,7 @@ function bytesToSize(bytes) {
}

async function unpackDir(d) {
if(!isVpkOpen)
if(!isVpkOpen || isDialogOpen)
return;

console.log("Unpack:", d);
Expand All @@ -235,7 +231,7 @@ async function unpackDir(d) {
unpack(files);
}
async function unpackFile(f) {
if(!isVpkOpen)
if(!isVpkOpen || isDialogOpen)
return;

console.log("Unpack:", f);
Expand All @@ -251,7 +247,9 @@ async function unpack(files) {
document.querySelector("#unpackPrompt > .currentPath").innerText = "";
document.querySelector("#unpackPrompt > .progress").innerText = "0/" + files.length;

isDialogOpen = true;
let isUnpacking = await window.api.copyFiles(vpkPath, files)
isDialogOpen = false;

if(isUnpacking) {
unpackStartTime = Date.now();
Expand Down